4 * Copyright (C) 2010-2017 Brady Miller <brady.g.miller@gmail.com>
6 * LICENSE: This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @author Brady Miller <brady.g.miller@gmail.com>
19 * @link http://www.open-emr.org
23 use OpenEMR\Core\Header
;
25 require_once("../globals.php");
26 require_once("../../library/patient.inc");
27 require_once "$srcdir/options.inc.php";
28 require_once "$srcdir/clinical_rules.php";
29 require_once "$srcdir/report_database.inc";
31 // See if showing an old report or creating a new report
32 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
34 // Collect the back variable, if pertinent
35 $back_link = (isset($_GET['back'])) ?
trim($_GET['back']) : "";
37 // If showing an old report, then collect information
38 if (!empty($report_id)) {
39 $report_view = collectReportDatabase($report_id);
40 $date_report = $report_view['date_report'];
41 $type_report = $report_view['type'];
43 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2") ||
44 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
45 $rule_filter = $report_view['type'];
47 if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
48 $begin_date = $report_view['date_begin'];
49 $labs_manual = $report_view['labs_manual'];
52 $target_date = $report_view['date_target'];
53 $plan_filter = $report_view['plan'];
54 $organize_method = $report_view['organize_mode'];
55 $provider = $report_view['provider'];
56 $pat_prov_rel = $report_view['pat_prov_rel'];
57 $dataSheet = json_decode($report_view['data'], true);
59 // Collect report type parameter (standard, amc, cqm)
60 // Note that need to convert amc_2011 and amc_2014 to amc and cqm_2011 and cqm_2014 to cqm
61 // to simplify for when submitting for a new report.
62 $type_report = (isset($_GET['type'])) ?
trim($_GET['type']) : "standard";
64 if (($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
68 if (($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
72 // Collect form parameters (set defaults if empty)
73 if ($type_report == "amc") {
74 $begin_date = (isset($_POST['form_begin_date'])) ?
trim($_POST['form_begin_date']) : "";
75 $labs_manual = (isset($_POST['labs_manual_entry'])) ?
trim($_POST['labs_manual_entry']) : "0";
78 $target_date = (isset($_POST['form_target_date'])) ?
trim($_POST['form_target_date']) : date('Y-m-d H:i:s');
79 $rule_filter = (isset($_POST['form_rule_filter'])) ?
trim($_POST['form_rule_filter']) : "";
80 $plan_filter = (isset($_POST['form_plan_filter'])) ?
trim($_POST['form_plan_filter']) : "";
81 $organize_method = (empty($plan_filter)) ?
"default" : "plans";
82 $provider = trim($_POST['form_provider']);
83 $pat_prov_rel = (empty($_POST['form_pat_prov_rel'])) ?
"primary" : trim($_POST['form_pat_prov_rel']);
91 <?php
if ($type_report == "standard") { ?
>
92 <title
><?php
echo xlt('Standard Measures'); ?
></title
>
95 <?php
if ($type_report == "cqm") { ?
>
96 <title
><?php
echo xlt('Clinical Quality Measures (CQM)'); ?
></title
>
98 <?php
if ($type_report == "cqm_2011") { ?
>
99 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
></title
>
101 <?php
if ($type_report == "cqm_2014") { ?
>
102 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
></title
>
105 <?php
if ($type_report == "amc") { ?
>
106 <title
><?php
echo xlt('Automated Measure Calculations (AMC)'); ?
></title
>
108 <?php
if ($type_report == "amc_2011") { ?
>
109 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
></title
>
111 <?php
if ($type_report == "amc_2014_stage1") { ?
>
112 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
></title
>
114 <?php
if ($type_report == "amc_2014_stage2") { ?
>
115 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
></title
>
118 <?php Header
::setupHeader('datetime-picker'); ?
>
120 <script LANGUAGE
="JavaScript">
122 var mypcc
= '<?php echo text($GLOBALS['phone_country_code
']) ?>';
124 $
(document
).ready(function() {
125 var win
= top
.printLogSetup ? top
: opener
.top
;
126 win
.printLogSetup(document
.getElementById('printbutton'));
128 $
('.datepicker').datetimepicker({
129 <?php
$datetimepicker_timepicker = true; ?
>
130 <?php
$datetimepicker_showseconds = true; ?
>
131 <?php
$datetimepicker_formatInput = false; ?
>
132 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
133 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
137 function runReport() {
140 if (!(validateForm())) {
141 alert("<?php echo xls("Rule Set
and Plan Set selections are not consistent
. Please fix
and Submit again
."); ?>");
145 // Showing processing wheel
146 $
("#processing").show();
148 // hide Submit buttons
149 $
("#submit_button").hide();
150 $
("#xmla_button").hide();
151 $
("#xmlb_button").hide();
152 $
("#xmlc_button").hide();
153 $
("#print_button").hide();
154 $
("#genQRDA").hide();
157 $
("#instructions_text").hide();
159 // Collect an id string via an ajax request
160 top
.restoreSession();
161 $
.get("../../library/ajax/collect_new_report_id.php",
163 // Set the report id in page form
164 $
("#form_new_report_id").attr("value",data
);
166 // Start collection status checks
167 collectStatus($
("#form_new_report_id").val());
170 top
.restoreSession();
171 $
.post("../../library/ajax/execute_cdr_report.php",
172 {provider
: $
("#form_provider").val(),
173 type
: $
("#form_rule_filter").val(),
174 date_target
: $
("#form_target_date").val(),
175 date_begin
: $
("#form_begin_date").val(),
176 plan
: $
("#form_plan_filter").val(),
177 labs
: $
("#labs_manual_entry").val(),
178 pat_prov_rel
: $
("#form_pat_prov_rel").val(),
179 execute_report_id
: $
("#form_new_report_id").val()
184 function collectStatus(report_id
) {
185 // Collect the status string via an ajax request and place in DOM at timed intervals
186 top
.restoreSession();
187 // Do not send the skip_timeout_reset parameter, so don't close window before report is done.
188 $
.post("../../library/ajax/status_report.php",
189 {status_report_id
: report_id
},
191 if (data
== "PENDING") {
192 // Place the pending string in the DOM
193 $
('#status_span').replaceWith("<span id='status_span'><?php echo xlt("Preparing To Run Report
"); ?></span>");
195 else if (data
== "COMPLETE") {
196 // Go into the results page
197 top
.restoreSession();
198 link_report
= "cqm.php?report_id="+report_id
;
199 window
.open(link_report
,'_self',false);
200 //$("#processing").hide();
201 //$('#status_span').replaceWith("<a id='view_button' href='cqm.php?report_id="+report_id+"' class='css_button' onclick='top.restoreSession()'><span><?php echo xlt('View Report'); ?></span></a>");
204 // Place the string in the DOM
205 $
('#status_span').replaceWith("<span id='status_span'>"+data+
"</span>");
208 // run status check every 10 seconds
209 var repeater
= setTimeout("collectStatus("+report_id+
")", 10000);
212 function GenXml(sNested
) {
213 top
.restoreSession();
214 //QRDA Category III Export
215 if(sNested
== "QRDA"){
216 var form_rule_filter
= theform
.form_rule_filter
.value
217 var sLoc
= '../../custom/export_qrda_xml.php?target_date=' + theform
.form_target_date
.value +
'&qrda_version=3&rule_filter=cqm_2014&form_provider='+theform
.form_provider
.value+
"&report_id=<?php echo attr($report_id);?>";
219 var sLoc
= '../../custom/export_registry_xml.php?&target_date=' + theform
.form_target_date
.value +
'&nested=' + sNested
;
221 dlgopen(sLoc
, '_blank', 600, 500);
225 //QRDA I - 2014 Download
226 function downloadQRDA() {
227 top
.restoreSession();
228 var reportID
= '<?php echo attr($report_id); ?>';
229 var provider
= $
("#form_provider").val();
230 sLoc
= '../../custom/download_qrda.php?&report_id=' + reportID +
'&provider_id=' + provider
;
231 dlgopen(sLoc
, '_blank', 600, 500);
234 function validateForm() {
235 <?php
if ((empty($report_id)) && ($type_report == "cqm")) { ?
>
236 // If this is a cqm and plan set not set to ignore, then need to ensure consistent with the rules set
237 if ($
("#form_plan_filter").val() != '') {
238 if ($
("#form_rule_filter").val() == $
("#form_plan_filter").val()) {
252 function Form_Validate() {
253 <?php
if ((empty($report_id)) && (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2"))) { ?
>
254 var d
= document
.forms
[0];
255 FromDate
= d
.form_begin_date
.value
;
256 ToDate
= d
.form_target_date
.value
;
257 if ( (FromDate
.length
> 0) && (ToDate
.length
> 0) ) {
258 if (FromDate
> ToDate
){
259 alert("<?php echo xls('End date must be later than Begin date!'); ?>");
265 //For Results are in Gray Background & disabling anchor links
266 <?php
if ($report_id != "") {?
>
267 $
("#report_results").css("opacity", '0.4');
268 $
("#report_results").css("filter", 'alpha(opacity=40)');
269 $
("a").removeAttr("href");
272 $
("#form_refresh").attr("value","true");
279 <style type
="text/css">
281 /* specifically include & exclude from printing */
287 #report_parameters_daterange {
291 #report_results table {
296 /* specifically exclude some from the screen */
298 #report_parameters_daterange {
307 <body
class="body_top">
309 <!-- Required
for the popup date selectors
-->
310 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
312 <span
class='title'><?php
echo xlt('Report'); ?
> -
314 <?php
if ($type_report == "standard") { ?
>
315 <?php
echo xlt('Standard Measures'); ?
>
318 <?php
if ($type_report == "cqm") { ?
>
319 <?php
echo xlt('Clinical Quality Measures (CQM)'); ?
>
321 <?php
if ($type_report == "cqm_2011") { ?
>
322 <?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
>
324 <?php
if ($type_report == "cqm_2014") { ?
>
325 <?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
>
328 <?php
if ($type_report == "amc") { ?
>
329 <?php
echo xlt('Automated Measure Calculations (AMC)'); ?
>
331 <?php
if ($type_report == "amc_2011") { ?
>
332 <?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
>
334 <?php
if ($type_report == "amc_2014_stage1") { ?
>
335 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
>
337 <?php
if ($type_report == "amc_2014_stage2") { ?
>
338 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
>
341 <?php
if (!empty($report_id)) { ?
>
342 <?php
echo " - " . xlt('Date of Report') . ": " . text($date_report);
343 //prepare to disable form elements
344 $dis_text = " disabled='disabled' ";
349 <form method
='post' name
='theform' id
='theform' action
='cqm.php?type=<?php echo attr($type_report) ;?>' onsubmit
='return validateForm()'>
351 <div id
="report_parameters">
354 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
360 <td scope
="row" width
='<?php echo $widthDyn;?>'>
361 <div style
='float:left'>
365 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
367 <td
class='control-label'>
368 <?php
echo htmlspecialchars(xl('Begin Date'), ENT_NOQUOTES
); ?
>:
371 <input
<?php
echo $dis_text; ?
> type
='text' name
='form_begin_date' id
="form_begin_date" size
='20' value
='<?php echo htmlspecialchars($begin_date, ENT_QUOTES); ?>'
372 class='datepicker form-control'
373 title
='<?php echo htmlspecialchars(xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
374 <?php
if (empty($report_id)) { ?
>
381 <td
class='control-label'>
382 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
383 <?php
echo htmlspecialchars(xl('End Date'), ENT_NOQUOTES
); ?
>:
385 <?php
echo htmlspecialchars(xl('Target Date'), ENT_NOQUOTES
); ?
>:
389 <input
<?php
echo $dis_text; ?
> type
='text' name
='form_target_date' id
="form_target_date" size
='20' value
='<?php echo htmlspecialchars($target_date, ENT_QUOTES); ?>'
390 class='datepicker form-control'
391 title
='<?php echo htmlspecialchars(xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
392 <?php
if (empty($report_id)) { ?
>
397 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
399 <td
class='control-label'>
400 <?php
echo xlt('Rule Set'); ?
>:
403 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
404 <option value
='cqm' <?php
if ($rule_filter == "cqm") {
407 <?php
echo xlt('All Clinical Quality Measures (CQM)'); ?
></option
>
408 <option value
='cqm_2011' <?php
if ($rule_filter == "cqm_2011") {
411 <?php
echo xlt('2011 Clinical Quality Measures (CQM)'); ?
></option
>
412 <option value
='cqm_2014' <?php
if ($rule_filter == "cqm_2014") {
415 <?php
echo xlt('2014 Clinical Quality Measures (CQM)'); ?
></option
>
421 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
423 <td
class='control-label'>
424 <?php
echo xlt('Rule Set'); ?
>:
427 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
429 <?php
if ($rule_filter == "amc") { //only show this when displaying old reports. Not available option for new reports ?>
430 <option value
='amc' selected
>
431 <?php
echo xlt('All Automated Measure Calculations (AMC)'); ?
></option
>
434 <option value
='amc_2011' <?php
if ($rule_filter == "amc_2011") {
437 <?php
echo xlt('2011 Automated Measure Calculations (AMC)'); ?
></option
>
438 <option value
='amc_2014_stage1' <?php
if ($rule_filter == "amc_2014_stage1") {
441 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage I'); ?
></option
>
442 <option value
='amc_2014_stage2' <?php
if ($rule_filter == "amc_2014_stage2") {
445 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage II'); ?
></option
>
451 <?php
if ($type_report == "standard") { ?
>
453 <td
class='control-label'>
454 <?php
echo xlt('Rule Set'); ?
>:
457 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
458 <option value
='passive_alert' <?php
if ($rule_filter == "passive_alert") {
461 <?php
echo xlt('Passive Alert Rules'); ?
></option
>
462 <option value
='active_alert' <?php
if ($rule_filter == "active_alert") {
465 <?php
echo xlt('Active Alert Rules'); ?
></option
>
466 <option value
='patient_reminder' <?php
if ($rule_filter == "patient_reminder") {
469 <?php
echo xlt('Patient Reminder Rules'); ?
></option
>
475 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
476 <input type
='hidden' id
='form_plan_filter' name
='form_plan_filter' value
=''>
479 <td
class='control-label'>
480 <?php
echo htmlspecialchars(xl('Plan Set'), ENT_NOQUOTES
); ?
>:
483 <select
<?php
echo $dis_text; ?
> id
='form_plan_filter' name
='form_plan_filter' class='form-control'>
484 <option value
=''>-- <?php
echo htmlspecialchars(xl('Ignore'), ENT_NOQUOTES
); ?
> --</option
>
485 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
486 <option value
='cqm' <?php
if ($plan_filter == "cqm") {
489 <?php
echo htmlspecialchars(xl('All Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
490 <option value
='cqm_2011' <?php
if ($plan_filter == "cqm_2011") {
493 <?php
echo htmlspecialchars(xl('2011 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
494 <option value
='cqm_2014' <?php
if ($plan_filter == "cqm_2014") {
497 <?php
echo htmlspecialchars(xl('2014 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
499 <?php
if ($type_report == "standard") { ?
>
500 <option value
='normal' <?php
if ($plan_filter == "normal") {
503 <?php
echo htmlspecialchars(xl('Active Plans'), ENT_NOQUOTES
); ?
></option
>
510 <td
class='control-label'>
511 <?php
echo htmlspecialchars(xl('Provider'), ENT_NOQUOTES
); ?
>:
516 // Build a drop-down list of providers.
519 $query = "SELECT id, lname, fname FROM users WHERE ".
520 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
522 $ures = sqlStatement($query);
524 echo " <select " . $dis_text . " id='form_provider' name='form_provider' class='form-control'>\n";
525 echo " <option value=''>-- " . htmlspecialchars(xl('All (Cumulative)'), ENT_NOQUOTES
) . " --\n";
527 echo " <option value='collate_outer'";
528 if ($provider == 'collate_outer') {
532 echo ">-- " . htmlspecialchars(xl('All (Collated Format A)'), ENT_NOQUOTES
) . " --\n";
534 echo " <option value='collate_inner'";
535 if ($provider == 'collate_inner') {
539 echo ">-- " . htmlspecialchars(xl('All (Collated Format B)'), ENT_NOQUOTES
) . " --\n";
541 while ($urow = sqlFetchArray($ures)) {
542 $provid = $urow['id'];
543 echo " <option value='".htmlspecialchars($provid, ENT_QUOTES
)."'";
544 if ($provid == $provider) {
548 echo ">" . htmlspecialchars($urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES
) . "\n";
558 <td
class='control-label'>
559 <?php
echo htmlspecialchars(xl('Provider Relationship'), ENT_NOQUOTES
); ?
>:
564 // Build a drop-down list of of patient provider relationships.
566 echo " <select ". $dis_text ." id='form_pat_prov_rel' name='form_pat_prov_rel' class='form-control' title='" . xlt('Only applicable if a provider or collated list was chosen above. PRIMARY only selects patients that the provider is the primary provider. ENCOUNTER selects all patients that the provider has seen.') . "'>\n";
567 echo " <option value='primary'";
568 if ($pat_prov_rel == 'primary') {
572 echo ">" . xlt('Primary') . "\n";
573 echo " <option value='encounter'";
574 if ($pat_prov_rel == 'encounter') {
578 echo ">" . xlt('Encounter') . "\n";
584 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
587 <?php
echo htmlspecialchars(xl('Number labs'), ENT_NOQUOTES
); ?
>:<br
>
588 (<?php
echo htmlspecialchars(xl('Non-electronic'), ENT_NOQUOTES
); ?
>)
591 <input
<?php
echo $dis_text; ?
> type
="text" id
="labs_manual_entry" name
="labs_manual_entry" class='form-control' value
="<?php echo htmlspecialchars($labs_manual, ENT_QUOTES); ?>">
601 <td align
='left' valign
='middle' height
="100%">
602 <table style
='border-left:1px solid; width:100%; height:100%' >
605 <div
class="text-center">
606 <div
class="btn-group" role
="group">
607 <?php
if (empty($report_id)) { ?
>
608 <a href
='#' id
='submit_button' class='btn btn-default btn-save' onclick
='runReport();'>
609 <?php
echo xlt('Submit'); ?
>
611 <span id
='status_span'></span
>
612 <div id
='processing' style
='margin:10px;display:none;'><img src
='../pic/ajax-loader.gif'/></div
>
613 <?php
if ($type_report == "cqm") { ?
>
614 <a href
='#' id
='xmla_button' class='btn btn-default btn-transmit' onclick
='return GenXml("false")'>
615 <?php
echo xlt('Generate PQRI report (Method A) - 2011'); ?
>
617 <a href
='#' id
='xmlb_button' class='btn btn-default btn-transmit' onclick
='return GenXml("true")'>
618 <?php
echo xlt('Generate PQRI report (Method E) - 2011'); ?
>
622 <?php
if (!empty($report_id)) { ?
>
623 <a href
='#' class='btn btn-default btn-print' id
='printbutton'>
624 <?php
echo xlt('Print'); ?
>
626 <?php
if ($type_report == "cqm_2014") { ?
>
627 <a href
='#' id
="genQRDA" class='btn btn-default btn-transmit' onclick
='return downloadQRDA()'>
628 <?php
echo xlt('Generate QRDA I – 2014'); ?
>
630 <a href
='#' id
="xmlc_button" class='btn btn-default btn-transmit' onclick
='return GenXml("QRDA")'>
631 <?php
echo xlt('Generate QRDA III - 2014'); ?
>
634 <?php
if ($back_link == "list") { ?
>
635 <a href
='report_results.php' class='btn btn-default btn-transmit' onclick
='top.restoreSession()'>
636 <?php
echo xlt("Return To Report Results"); ?
>
639 <a href
='#' class='btn btn-default btn-transmit' onclick
='top.restoreSession(); $("#theform").submit();'>
640 <?php
echo xlt("Start Another Report"); ?
>
653 </div
> <!-- end of search parameters
-->
658 if (!empty($report_id)) {
662 <div id
="report_results">
667 <?php
echo htmlspecialchars(xl('Title'), ENT_NOQUOTES
); ?
>
672 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
673 echo htmlspecialchars(xl('Initial Patient Population'), ENT_NOQUOTES
);
675 echo htmlspecialchars(xl('Total Patients'), ENT_NOQUOTES
);
681 <?php
if ($type_report == "amc") { ?
>
682 <?php
echo htmlspecialchars(xl('Denominator'), ENT_NOQUOTES
); ?
></a
>
684 <?php
echo htmlspecialchars(xl('Applicable Patients') .' (' . xl('Denominator') . ')', ENT_NOQUOTES
); ?
></a
>
688 <?php
if ($type_report != "amc") { ?
>
690 <?php
echo htmlspecialchars(xl('Denominator Exclusion'), ENT_NOQUOTES
); ?
></a
>
693 <?php
if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {?
>
695 <?php
echo htmlspecialchars(xl('Denominator Exception'), ENT_NOQUOTES
); ?
></a
>
700 <?php
if ($type_report == "amc") { ?
>
701 <?php
echo htmlspecialchars(xl('Numerator'), ENT_NOQUOTES
); ?
></a
>
703 <?php
echo htmlspecialchars(xl('Passed Patients') . ' (' . xl('Numerator') . ')', ENT_NOQUOTES
); ?
></a
>
708 <?php
if ($type_report == "amc") { ?
>
709 <?php
echo htmlspecialchars(xl('Failed'), ENT_NOQUOTES
); ?
></a
>
711 <?php
echo htmlspecialchars(xl('Failed Patients'), ENT_NOQUOTES
); ?
></a
>
716 <?php
echo htmlspecialchars(xl('Performance Percentage'), ENT_NOQUOTES
); ?
></a
>
720 <tbody
> <!-- added
for better
print-ability
-->
723 $firstProviderFlag = true;
724 $firstPlanFlag = true;
725 $existProvider = false;
726 foreach ($dataSheet as $row) {
729 <tr bgcolor
='<?php echo $bgcolor ?>'>
732 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
733 echo "<td class='detail'>";
734 if (isset($row['is_main'])) {
735 // is_sub is a special case of is_main whereas total patients, denominator, and excluded patients are taken
736 // from is_main prior to it. So, need to store denominator patients from is_main for subsequent is_sub
737 // to calculate the number of patients that failed.
738 // Note that exlusion in the standard rules is not the same as in the cqm/amd and should not be in calculation
739 // as is in the cqm/amc rules.
740 $main_pass_filter = $row['pass_filter'];
742 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'), $row['id'])."</b>";
744 $tempCqmAmcString = "";
745 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
746 if (!empty($row['cqm_pqri_code'])) {
747 $tempCqmAmcString .= " " . htmlspecialchars(xl('PQRI') . ":" . $row['cqm_pqri_code'], ENT_NOQUOTES
) . " ";
750 if (!empty($row['cqm_nqf_code'])) {
751 $tempCqmAmcString .= " " . htmlspecialchars(xl('NQF') . ":" . $row['cqm_nqf_code'], ENT_NOQUOTES
) . " ";
755 if ($type_report == "amc") {
756 if (!empty($row['amc_code'])) {
757 $tempCqmAmcString .= " " . htmlspecialchars(xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
760 if (!empty($row['amc_code_2014'])) {
761 $tempCqmAmcString .= " " . htmlspecialchars(xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES
) . " ";
765 if ($type_report == "amc_2011") {
766 if (!empty($row['amc_code'])) {
767 $tempCqmAmcString .= " " . htmlspecialchars(xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
771 if (($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
772 if (!empty($row['amc_code_2014'])) {
773 $tempCqmAmcString .= " " . htmlspecialchars(xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES
) . " ";
777 if (!empty($tempCqmAmcString)) {
778 echo "(".$tempCqmAmcString.")";
781 if (!(empty($row['concatenated_label']))) {
782 echo ", " . htmlspecialchars(xl($row['concatenated_label']), ENT_NOQUOTES
) . " ";
784 } else { // isset($row['is_sub'])
785 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $row['action_category']);
786 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $row['action_item']);
791 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
792 echo "<td align='center'>" . $row['initial_population'] . "</td>";
794 echo "<td align='center'>" . $row['total_patients'] . "</td>";
797 if (isset($row['itemized_test_id']) && ($row['pass_filter'] > 0)) {
798 echo "<td align='center'><a href='../main/finder/patient_select.php?from_page=cdr_report&pass_id=all&report_id=".attr($report_id)."&itemized_test_id=".attr($row['itemized_test_id'])."&numerator_label=".urlencode(attr($row['numerator_label']))."' onclick='top.restoreSession()'>" . $row['pass_filter'] . "</a></td>";
800 echo "<td align='center'>" . $row['pass_filter'] . "</td>";
803 if ($type_report != "amc") {
804 // Note that amc will likely support in excluded items in the future for MU2
805 if (($type_report != "standard") && isset($row['itemized_test_id']) && ($row['excluded'] > 0)) {
806 // Note standard reporting exluded is different than cqm/amc and will not support itemization
807 echo "<td align='center'><a href='../main/finder/patient_select.php?from_page=cdr_report&pass_id=exclude&report_id=".attr($report_id)."&itemized_test_id=".attr($row['itemized_test_id'])."&numerator_label=".urlencode(attr($row['numerator_label']))."' onclick='top.restoreSession()'>" . $row['excluded'] . "</a></td>";
809 echo "<td align='center'>" . $row['excluded'] . "</td>";
813 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
814 // Note that amc will likely support in exception items in the future for MU2
815 if (isset($row['itemized_test_id']) && ($row['exception'] > 0)) {
816 // Note standard reporting exluded is different than cqm/amc and will not support itemization
817 echo "<td align='center'><a href='../main/finder/patient_select.php?from_page=cdr_report&pass_id=exception&report_id=".attr($report_id)."&itemized_test_id=".attr($row['itemized_test_id'])."&numerator_label=".urlencode(attr($row['numerator_label']))."' onclick='top.restoreSession()'>" . $row['exception'] . "</a></td>";
819 echo "<td align='center'>" . $row['exception'] . "</td>";
823 if (isset($row['itemized_test_id']) && ($row['pass_target'] > 0)) {
824 echo "<td align='center'><a href='../main/finder/patient_select.php?from_page=cdr_report&pass_id=pass&report_id=".attr($report_id)."&itemized_test_id=".attr($row['itemized_test_id'])."&numerator_label=".urlencode(attr($row['numerator_label']))."' onclick='top.restoreSession()'>" . $row['pass_target'] . "</a></td>";
826 echo "<td align='center'>" . $row['pass_target'] . "</td>";
830 if (isset($row['is_main'])) {
831 if ($type_report == "standard") {
832 // Excluded is not part of denominator in standard rules so do not use in calculation
833 $failed_items = $row['pass_filter'] - $row['pass_target'];
835 $failed_items = $row['pass_filter'] - $row['pass_target'] - $row['excluded'];
837 } else { // isset($row['is_sub'])
838 // Excluded is not part of denominator in standard rules so do not use in calculation
839 $failed_items = $main_pass_filter - $row['pass_target'];
842 if (isset($row['itemized_test_id']) && ($failed_items > 0)) {
843 echo "<td align='center'><a href='../main/finder/patient_select.php?from_page=cdr_report&pass_id=fail&report_id=".attr($report_id)."&itemized_test_id=".attr($row['itemized_test_id'])."&numerator_label=".urlencode(attr($row['numerator_label']))."' onclick='top.restoreSession()'>" . $failed_items . "</a></td>";
845 echo "<td align='center'>" . $failed_items . "</td>";
848 echo "<td align='center'>" . $row['percentage'] . "</td>";
849 } else if (isset($row['is_provider'])) {
850 // Display the provider information
851 if (!$firstProviderFlag && $_POST['form_provider'] == 'collate_outer') {
852 echo "<tr><td> </td></tr>";
855 echo "<td class='detail' align='center'><b>";
856 echo htmlspecialchars(xl("Provider").": " . $row['prov_lname'] . "," . $row['prov_fname'], ENT_NOQUOTES
);
857 if (!empty($row['npi']) ||
!empty($row['federaltaxid'])) {
859 if (!empty($row['npi'])) {
860 echo " " . htmlspecialchars(xl('NPI') . ":" . $row['npi'], ENT_NOQUOTES
) . " ";
863 if (!empty($row['federaltaxid'])) {
864 echo " " . htmlspecialchars(xl('TID') . ":" . $row['federaltaxid'], ENT_NOQUOTES
) . " ";
871 $firstProviderFlag = false;
872 $existProvider = true;
873 } else { // isset($row['is_plan'])
874 if (!$firstPlanFlag && $_POST['form_provider'] != 'collate_outer') {
875 echo "<tr><td> </td></tr>";
878 echo "<td class='detail' align='center'><b>";
879 echo htmlspecialchars(xl("Plan"), ENT_NOQUOTES
) . ": ";
880 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'), $row['id']);
881 if (!empty($row['cqm_measure_group'])) {
882 echo " (". htmlspecialchars(xl('Measure Group Code') . ": " . $row['cqm_measure_group'], ENT_NOQUOTES
) . ")";
886 $firstPlanFlag = false;
896 </div
> <!-- end of search results
-->
898 <div id
="instructions_text" class='text'>
899 <?php
echo htmlspecialchars(xl('Please input search criteria above, and click Submit to start report.'), ENT_NOQUOTES
); ?
>
903 <input type
='hidden' name
='form_new_report_id' id
='form_new_report_id' value
=''/>