6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2010-2017 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("../../library/patient.inc");
15 require_once "$srcdir/options.inc.php";
16 require_once "$srcdir/clinical_rules.php";
17 require_once "$srcdir/report_database.inc";
19 use OpenEMR\Core\Header
;
21 // See if showing an old report or creating a new report
22 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
24 // Collect the back variable, if pertinent
25 $back_link = (isset($_GET['back'])) ?
trim($_GET['back']) : "";
27 // If showing an old report, then collect information
28 if (!empty($report_id)) {
29 $report_view = collectReportDatabase($report_id);
30 $date_report = $report_view['date_report'];
31 $type_report = $report_view['type'];
33 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2") ||
34 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
35 $rule_filter = $report_view['type'];
37 if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
38 $begin_date = $report_view['date_begin'];
39 $labs_manual = $report_view['labs_manual'];
42 $target_date = $report_view['date_target'];
43 $plan_filter = $report_view['plan'];
44 $organize_method = $report_view['organize_mode'];
45 $provider = $report_view['provider'];
46 $pat_prov_rel = $report_view['pat_prov_rel'];
47 $dataSheet = json_decode($report_view['data'], true);
49 // Collect report type parameter (standard, amc, cqm)
50 // Note that need to convert amc_2011 and amc_2014 to amc and cqm_2011 and cqm_2014 to cqm
51 // to simplify for when submitting for a new report.
52 $type_report = (isset($_GET['type'])) ?
trim($_GET['type']) : "standard";
54 if (($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
58 if (($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
62 // Collect form parameters (set defaults if empty)
63 if ($type_report == "amc") {
64 $begin_date = (isset($_POST['form_begin_date'])) ?
DateTimeToYYYYMMDDHHMMSS(trim($_POST['form_begin_date'])) : "";
65 $labs_manual = (isset($_POST['labs_manual_entry'])) ?
trim($_POST['labs_manual_entry']) : "0";
68 $target_date = (isset($_POST['form_target_date'])) ?
DateTimeToYYYYMMDDHHMMSS(trim($_POST['form_target_date'])) : date('Y-m-d H:i:s');
69 $rule_filter = (isset($_POST['form_rule_filter'])) ?
trim($_POST['form_rule_filter']) : "";
70 $plan_filter = (isset($_POST['form_plan_filter'])) ?
trim($_POST['form_plan_filter']) : "";
71 $organize_method = (empty($plan_filter)) ?
"default" : "plans";
72 $provider = trim($_POST['form_provider']);
73 $pat_prov_rel = (empty($_POST['form_pat_prov_rel'])) ?
"primary" : trim($_POST['form_pat_prov_rel']);
81 <?php
if ($type_report == "standard") { ?
>
82 <title
><?php
echo xlt('Standard Measures'); ?
></title
>
85 <?php
if ($type_report == "cqm") { ?
>
86 <title
><?php
echo xlt('Clinical Quality Measures (CQM)'); ?
></title
>
88 <?php
if ($type_report == "cqm_2011") { ?
>
89 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
></title
>
91 <?php
if ($type_report == "cqm_2014") { ?
>
92 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
></title
>
95 <?php
if ($type_report == "amc") { ?
>
96 <title
><?php
echo xlt('Automated Measure Calculations (AMC)'); ?
></title
>
98 <?php
if ($type_report == "amc_2011") { ?
>
99 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
></title
>
101 <?php
if ($type_report == "amc_2014_stage1") { ?
>
102 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
></title
>
104 <?php
if ($type_report == "amc_2014_stage2") { ?
>
105 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
></title
>
108 <?php Header
::setupHeader('datetime-picker'); ?
>
110 <script LANGUAGE
="JavaScript">
112 <?php
require $GLOBALS['srcdir'] . "/formatting_DateToYYYYMMDD_js.js.php" ?
>
114 var mypcc
= '<?php echo text($GLOBALS['phone_country_code
']) ?>';
116 $
(document
).ready(function() {
117 var win
= top
.printLogSetup ? top
: opener
.top
;
118 win
.printLogSetup(document
.getElementById('printbutton'));
120 $
('.datepicker').datetimepicker({
121 <?php
$datetimepicker_timepicker = true; ?
>
122 <?php
$datetimepicker_showseconds = true; ?
>
123 <?php
$datetimepicker_formatInput = true; ?
>
124 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
125 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
129 function runReport() {
132 if (!(validateForm())) {
133 alert("<?php echo xls("Rule Set
and Plan Set selections are not consistent
. Please fix
and Submit again
."); ?>");
137 // Showing processing wheel
138 $
("#processing").show();
140 // hide Submit buttons
141 $
("#submit_button").hide();
142 $
("#xmla_button").hide();
143 $
("#xmlb_button").hide();
144 $
("#xmlc_button").hide();
145 $
("#print_button").hide();
146 $
("#genQRDA").hide();
149 $
("#instructions_text").hide();
151 // Collect an id string via an ajax request
152 top
.restoreSession();
153 $
.get("../../library/ajax/collect_new_report_id.php",
155 // Set the report id in page form
156 $
("#form_new_report_id").attr("value",data
);
158 // Start collection status checks
159 collectStatus($
("#form_new_report_id").val());
162 top
.restoreSession();
163 $
.post("../../library/ajax/execute_cdr_report.php",
164 {provider
: $
("#form_provider").val(),
165 type
: $
("#form_rule_filter").val(),
166 date_target
: DateToYYYYMMDDHHMMSS_js($
("#form_target_date").val()),
167 date_begin
: DateToYYYYMMDDHHMMSS_js($
("#form_begin_date").val()),
168 plan
: $
("#form_plan_filter").val(),
169 labs
: $
("#labs_manual_entry").val(),
170 pat_prov_rel
: $
("#form_pat_prov_rel").val(),
171 execute_report_id
: $
("#form_new_report_id").val()
176 function collectStatus(report_id
) {
177 // Collect the status string via an ajax request and place in DOM at timed intervals
178 top
.restoreSession();
179 // Do not send the skip_timeout_reset parameter, so don't close window before report is done.
180 $
.post("../../library/ajax/status_report.php",
181 {status_report_id
: report_id
},
183 if (data
== "PENDING") {
184 // Place the pending string in the DOM
185 $
('#status_span').replaceWith("<span id='status_span'><?php echo xlt("Preparing To Run Report
"); ?></span>");
187 else if (data
== "COMPLETE") {
188 // Go into the results page
189 top
.restoreSession();
190 link_report
= "cqm.php?report_id="+report_id
;
191 window
.open(link_report
,'_self',false);
192 //$("#processing").hide();
193 //$('#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>");
196 // Place the string in the DOM
197 $
('#status_span').replaceWith("<span id='status_span'>"+data+
"</span>");
200 // run status check every 10 seconds
201 var repeater
= setTimeout("collectStatus("+report_id+
")", 10000);
204 function GenXml(sNested
) {
205 top
.restoreSession();
206 //QRDA Category III Export
207 if(sNested
== "QRDA"){
208 var form_rule_filter
= theform
.form_rule_filter
.value
209 var sLoc
= '../../custom/export_qrda_xml.php?target_date=' +
encodeURIComponent(DateToYYYYMMDDHHMMSS_js(theform
.form_target_date
.value
)) +
'&qrda_version=3&rule_filter=cqm_2014&form_provider=' +
encodeURIComponent(theform
.form_provider
.value
) +
'&report_id=<?php echo attr(urlencode($report_id)); ?>&csrf_token_form=<?php echo attr(urlencode(collectCsrfToken())); ?>';
211 var sLoc
= '../../custom/export_registry_xml.php?&target_date=' +
encodeURIComponent(DateToYYYYMMDDHHMMSS_js(theform
.form_target_date
.value
)) +
'&nested=' +
encodeURIComponent(sNested
) +
'&csrf_token_form=<?php echo attr(urlencode(collectCsrfToken())); ?>';
213 dlgopen(sLoc
, '_blank', 600, 500);
217 //QRDA I - 2014 Download
218 function downloadQRDA() {
219 top
.restoreSession();
220 var reportID
= '<?php echo attr($report_id); ?>';
221 var provider
= $
("#form_provider").val();
222 sLoc
= '../../custom/download_qrda.php?&report_id=' +
encodeURIComponent(reportID
) +
'&provider_id=' +
encodeURIComponent(provider
) +
'&csrf_token_form=<?php echo attr(urlencode(collectCsrfToken())); ?>';
223 dlgopen(sLoc
, '_blank', 600, 500);
226 function validateForm() {
227 <?php
if ((empty($report_id)) && ($type_report == "cqm")) { ?
>
228 // If this is a cqm and plan set not set to ignore, then need to ensure consistent with the rules set
229 if ($
("#form_plan_filter").val() != '') {
230 if ($
("#form_rule_filter").val() == $
("#form_plan_filter").val()) {
244 function Form_Validate() {
245 <?php
if ((empty($report_id)) && (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2"))) { ?
>
246 var d
= document
.forms
[0];
247 FromDate
= DateToYYYYMMDDHHMMSS_js(d
.form_begin_date
.value
);
248 ToDate
= DateToYYYYMMDDHHMMSS_js(d
.form_target_date
.value
);
249 if ( (FromDate
.length
> 0) && (ToDate
.length
> 0) ) {
250 if (FromDate
> ToDate
){
251 alert("<?php echo xls('End date must be later than Begin date!'); ?>");
257 //For Results are in Gray Background & disabling anchor links
258 <?php
if ($report_id != "") {?
>
259 $
("#report_results").css("opacity", '0.4');
260 $
("#report_results").css("filter", 'alpha(opacity=40)');
261 $
("a").removeAttr("href");
264 $
("#form_refresh").attr("value","true");
271 <style type
="text/css">
273 /* specifically include & exclude from printing */
279 #report_parameters_daterange {
283 #report_results table {
288 /* specifically exclude some from the screen */
290 #report_parameters_daterange {
299 <body
class="body_top">
301 <!-- Required
for the popup date selectors
-->
302 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
304 <span
class='title'><?php
echo xlt('Report'); ?
> -
306 <?php
if ($type_report == "standard") { ?
>
307 <?php
echo xlt('Standard Measures'); ?
>
310 <?php
if ($type_report == "cqm") { ?
>
311 <?php
echo xlt('Clinical Quality Measures (CQM)'); ?
>
313 <?php
if ($type_report == "cqm_2011") { ?
>
314 <?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
>
316 <?php
if ($type_report == "cqm_2014") { ?
>
317 <?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
>
320 <?php
if ($type_report == "amc") { ?
>
321 <?php
echo xlt('Automated Measure Calculations (AMC)'); ?
>
323 <?php
if ($type_report == "amc_2011") { ?
>
324 <?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
>
326 <?php
if ($type_report == "amc_2014_stage1") { ?
>
327 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
>
329 <?php
if ($type_report == "amc_2014_stage2") { ?
>
330 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
>
333 <?php
if (!empty($report_id)) { ?
>
334 <?php
echo " - " . xlt('Date of Report') . ": " . text(oeFormatDateTime($date_report, "global", true));
335 //prepare to disable form elements
336 $dis_text = " disabled='disabled' ";
341 <form method
='post' name
='theform' id
='theform' action
='cqm.php?type=<?php echo attr($type_report) ;?>' onsubmit
='return validateForm()'>
343 <div id
="report_parameters">
346 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
352 <td scope
="row" width
='<?php echo $widthDyn;?>'>
353 <div style
='float:left'>
357 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
359 <td
class='control-label'>
360 <?php
echo xlt('Begin Date'); ?
>:
363 <input
<?php
echo $dis_text; ?
> type
='text' name
='form_begin_date' id
="form_begin_date" size
='20' value
='<?php echo attr(oeFormatDateTime($begin_date, 0, true)); ?>'
364 class='datepicker form-control'>
365 <?php
if (empty($report_id)) { ?
>
372 <td
class='control-label'>
373 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
374 <?php
echo xlt('End Date'); ?
>:
376 <?php
echo xlt('Target Date'); ?
>:
380 <input
<?php
echo $dis_text; ?
> type
='text' name
='form_target_date' id
="form_target_date" size
='20' value
='<?php echo attr(oeFormatDateTime($target_date, 0, true)); ?>'
381 class='datepicker form-control'>
382 <?php
if (empty($report_id)) { ?
>
387 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
389 <td
class='control-label'>
390 <?php
echo xlt('Rule Set'); ?
>:
393 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
394 <option value
='cqm' <?php
echo ($rule_filter == "cqm") ?
"selected" : ""; ?
>>
395 <?php
echo xlt('All Clinical Quality Measures (CQM)'); ?
></option
>
396 <option value
='cqm_2011' <?php
echo ($rule_filter == "cqm_2011") ?
"selected" : ""; ?
>>
397 <?php
echo xlt('2011 Clinical Quality Measures (CQM)'); ?
></option
>
398 <option value
='cqm_2014' <?php
echo ($rule_filter == "cqm_2014") ?
"selected" : ""; ?
>>
399 <?php
echo xlt('2014 Clinical Quality Measures (CQM)'); ?
></option
>
405 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
407 <td
class='control-label'>
408 <?php
echo xlt('Rule Set'); ?
>:
411 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
413 <?php
if ($rule_filter == "amc") { //only show this when displaying old reports. Not available option for new reports ?>
414 <option value
='amc' selected
>
415 <?php
echo xlt('All Automated Measure Calculations (AMC)'); ?
></option
>
418 <option value
='amc_2011' <?php
echo ($rule_filter == "amc_2011") ?
"selected" : ""; ?
>>
419 <?php
echo xlt('2011 Automated Measure Calculations (AMC)'); ?
></option
>
420 <option value
='amc_2014_stage1' <?php
echo ($rule_filter == "amc_2014_stage1") ?
"selected" : ""; ?
>>
421 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage I'); ?
></option
>
422 <option value
='amc_2014_stage2' <?php
echo ($rule_filter == "amc_2014_stage2") ?
"selected" : ""; ?
>>
423 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage II'); ?
></option
>
429 <?php
if ($type_report == "standard") { ?
>
431 <td
class='control-label'>
432 <?php
echo xlt('Rule Set'); ?
>:
435 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter' class='form-control'>
436 <option value
='passive_alert' <?php
echo ($rule_filter == "passive_alert") ?
"selected" : ""; ?
>>
437 <?php
echo xlt('Passive Alert Rules'); ?
></option
>
438 <option value
='active_alert' <?php
echo ($rule_filter == "active_alert") ?
"selected" : ""; ?
>>
439 <?php
echo xlt('Active Alert Rules'); ?
></option
>
440 <option value
='patient_reminder' <?php
echo ($rule_filter == "patient_reminder") ?
"selected" : ""; ?
>>
441 <?php
echo xlt('Patient Reminder Rules'); ?
></option
>
447 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
448 <input type
='hidden' id
='form_plan_filter' name
='form_plan_filter' value
=''>
451 <td
class='control-label'>
452 <?php
echo xlt('Plan Set'); ?
>:
455 <select
<?php
echo $dis_text; ?
> id
='form_plan_filter' name
='form_plan_filter' class='form-control'>
456 <option value
=''>-- <?php
echo xlt('Ignore'); ?
> --</option
>
457 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
458 <option value
='cqm' <?php
echo ($plan_filter == "cqm") ?
"selected" : ""; ?
>>
459 <?php
echo xlt('All Official Clinical Quality Measures (CQM) Measure Groups'); ?
></option
>
460 <option value
='cqm_2011' <?php
echo ($plan_filter == "cqm_2011") ?
"selected" : ""; ?
>>
461 <?php
echo xlt('2011 Official Clinical Quality Measures (CQM) Measure Groups'); ?
></option
>
462 <option value
='cqm_2014' <?php
echo ($plan_filter == "cqm_2014") ?
"selected" : ""; ?
>>
463 <?php
echo xlt('2014 Official Clinical Quality Measures (CQM) Measure Groups'); ?
></option
>
465 <?php
if ($type_report == "standard") { ?
>
466 <option value
='normal' <?php
echo ($plan_filter == "normal") ?
"selected" : ""; ?
>>
467 <?php
echo xlt('Active Plans'); ?
></option
>
474 <td
class='control-label'>
475 <?php
echo xlt('Provider'); ?
>:
480 // Build a drop-down list of providers.
483 $query = "SELECT id, lname, fname FROM users WHERE ".
484 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
486 $ures = sqlStatement($query);
488 echo " <select " . $dis_text . " id='form_provider' name='form_provider' class='form-control'>\n";
489 echo " <option value=''>-- " . xlt('All (Cumulative)') . " --\n";
491 echo " <option value='collate_outer'";
492 if ($provider == 'collate_outer') {
496 echo ">-- " . xlt('All (Collated Format A)') . " --\n";
498 echo " <option value='collate_inner'";
499 if ($provider == 'collate_inner') {
503 echo ">-- " . xlt('All (Collated Format B)') . " --\n";
505 while ($urow = sqlFetchArray($ures)) {
506 $provid = $urow['id'];
507 echo " <option value='".attr($provid)."'";
508 if ($provid == $provider) {
512 echo ">" . text($urow['lname'] . ", " . $urow['fname']) . "\n";
522 <td
class='control-label'>
523 <?php
echo xlt('Provider Relationship'); ?
>:
528 // Build a drop-down list of of patient provider relationships.
530 echo " <select ". $dis_text ." id='form_pat_prov_rel' name='form_pat_prov_rel' class='form-control' title='" . xla('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";
531 echo " <option value='primary'";
532 if ($pat_prov_rel == 'primary') {
536 echo ">" . xlt('Primary') . "\n";
537 echo " <option value='encounter'";
538 if ($pat_prov_rel == 'encounter') {
542 echo ">" . xlt('Encounter') . "\n";
548 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
551 <?php
echo xlt('Number labs'); ?
>:<br
>
552 (<?php
echo xlt('Non-electronic'); ?
>)
555 <input
<?php
echo $dis_text; ?
> type
="text" id
="labs_manual_entry" name
="labs_manual_entry" class='form-control' value
="<?php echo attr($labs_manual); ?>">
565 <td align
='left' valign
='middle' height
="100%">
566 <table style
='border-left:1px solid; width:100%; height:100%' >
569 <div
class="text-center">
570 <div
class="btn-group" role
="group">
571 <?php
if (empty($report_id)) { ?
>
572 <a href
='#' id
='submit_button' class='btn btn-default btn-save' onclick
='runReport();'>
573 <?php
echo xlt('Submit'); ?
>
575 <span id
='status_span'></span
>
576 <div id
='processing' style
='margin:10px;display:none;'><img src
='../pic/ajax-loader.gif'/></div
>
577 <?php
if ($type_report == "cqm") { ?
>
578 <a href
='#' id
='xmla_button' class='btn btn-default btn-transmit' onclick
='return GenXml("false")'>
579 <?php
echo xlt('Generate PQRI report (Method A) - 2011'); ?
>
581 <a href
='#' id
='xmlb_button' class='btn btn-default btn-transmit' onclick
='return GenXml("true")'>
582 <?php
echo xlt('Generate PQRI report (Method E) - 2011'); ?
>
586 <?php
if (!empty($report_id)) { ?
>
587 <a href
='#' class='btn btn-default btn-print' id
='printbutton'>
588 <?php
echo xlt('Print'); ?
>
590 <?php
if ($type_report == "cqm_2014") { ?
>
591 <a href
='#' id
="genQRDA" class='btn btn-default btn-transmit' onclick
='return downloadQRDA()'>
592 <?php
echo xlt('Generate QRDA I – 2014'); ?
>
594 <a href
='#' id
="xmlc_button" class='btn btn-default btn-transmit' onclick
='return GenXml("QRDA")'>
595 <?php
echo xlt('Generate QRDA III - 2014'); ?
>
598 <?php
if ($back_link == "list") { ?
>
599 <a href
='report_results.php' class='btn btn-default btn-transmit' onclick
='top.restoreSession()'>
600 <?php
echo xlt("Return To Report Results"); ?
>
603 <a href
='#' class='btn btn-default btn-transmit' onclick
='top.restoreSession(); $("#theform").submit();'>
604 <?php
echo xlt("Start Another Report"); ?
>
617 </div
> <!-- end of search parameters
-->
622 if (!empty($report_id)) {
626 <div id
="report_results">
631 <?php
echo xlt('Title'); ?
>
636 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
637 echo xlt('Initial Patient Population');
639 echo xlt('Total Patients');
645 <?php
if ($type_report == "amc") { ?
>
646 <?php
echo xlt('Denominator'); ?
></a
>
648 <?php
echo xlt('Applicable Patients') .' (' . xlt('Denominator') . ')'; ?
></a
>
652 <?php
if ($type_report != "amc") { ?
>
654 <?php
echo xlt('Denominator Exclusion'); ?
></a
>
657 <?php
if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {?
>
659 <?php
echo xlt('Denominator Exception'); ?
></a
>
664 <?php
if ($type_report == "amc") { ?
>
665 <?php
echo xlt('Numerator'); ?
></a
>
667 <?php
echo xlt('Passed Patients') . ' (' . xlt('Numerator') . ')'; ?
></a
>
672 <?php
if ($type_report == "amc") { ?
>
673 <?php
echo xlt('Failed'); ?
></a
>
675 <?php
echo xlt('Failed Patients'); ?
></a
>
680 <?php
echo xlt('Performance Percentage'); ?
></a
>
684 <tbody
> <!-- added
for better
print-ability
-->
687 $firstProviderFlag = true;
688 $firstPlanFlag = true;
689 $existProvider = false;
690 foreach ($dataSheet as $row) {
693 <tr bgcolor
='<?php echo $bgcolor ?>'>
696 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
697 echo "<td class='detail'>";
698 if (isset($row['is_main'])) {
699 // is_sub is a special case of is_main whereas total patients, denominator, and excluded patients are taken
700 // from is_main prior to it. So, need to store denominator patients from is_main for subsequent is_sub
701 // to calculate the number of patients that failed.
702 // Note that exlusion in the standard rules is not the same as in the cqm/amd and should not be in calculation
703 // as is in the cqm/amc rules.
704 $main_pass_filter = $row['pass_filter'];
706 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'), $row['id'])."</b>";
708 $tempCqmAmcString = "";
709 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
710 if (!empty($row['cqm_pqri_code'])) {
711 $tempCqmAmcString .= " " . xlt('PQRI') . ":" . text($row['cqm_pqri_code']) . " ";
714 if (!empty($row['cqm_nqf_code'])) {
715 $tempCqmAmcString .= " " . xlt('NQF') . ":" . text($row['cqm_nqf_code']) . " ";
719 if ($type_report == "amc") {
720 if (!empty($row['amc_code'])) {
721 $tempCqmAmcString .= " " . xlt('AMC-2011') . ":" . text($row['amc_code']) . " ";
724 if (!empty($row['amc_code_2014'])) {
725 $tempCqmAmcString .= " " . xlt('AMC-2014') . ":" . text($row['amc_code_2014']) . " ";
729 if ($type_report == "amc_2011") {
730 if (!empty($row['amc_code'])) {
731 $tempCqmAmcString .= " " . xlt('AMC-2011') . ":" . text($row['amc_code']) . " ";
735 if (($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
736 if (!empty($row['amc_code_2014'])) {
737 $tempCqmAmcString .= " " . xlt('AMC-2014') . ":" . text($row['amc_code_2014']) . " ";
741 if (!empty($tempCqmAmcString)) {
742 echo "(".$tempCqmAmcString.")";
745 if (!(empty($row['concatenated_label']))) {
746 echo ", " . xlt($row['concatenated_label']) . " ";
748 } else { // isset($row['is_sub'])
749 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $row['action_category']);
750 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $row['action_item']);
755 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
756 echo "<td align='center'>" . text($row['initial_population']) . "</td>";
758 echo "<td align='center'>" . text($row['total_patients']) . "</td>";
761 if (isset($row['itemized_test_id']) && ($row['pass_filter'] > 0)) {
762 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()'>" . text($row['pass_filter']) . "</a></td>";
764 echo "<td align='center'>" . text($row['pass_filter']) . "</td>";
767 if ($type_report != "amc") {
768 // Note that amc will likely support in excluded items in the future for MU2
769 if (($type_report != "standard") && isset($row['itemized_test_id']) && ($row['excluded'] > 0)) {
770 // Note standard reporting exluded is different than cqm/amc and will not support itemization
771 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()'>" . text($row['excluded']) . "</a></td>";
773 echo "<td align='center'>" . text($row['excluded']) . "</td>";
777 if ($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {
778 // Note that amc will likely support in exception items in the future for MU2
779 if (isset($row['itemized_test_id']) && ($row['exception'] > 0)) {
780 // Note standard reporting exluded is different than cqm/amc and will not support itemization
781 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()'>" . text($row['exception']) . "</a></td>";
783 echo "<td align='center'>" . text($row['exception']) . "</td>";
787 if (isset($row['itemized_test_id']) && ($row['pass_target'] > 0)) {
788 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()'>" . text($row['pass_target']) . "</a></td>";
790 echo "<td align='center'>" . text($row['pass_target']) . "</td>";
794 if (isset($row['is_main'])) {
795 if ($type_report == "standard") {
796 // Excluded is not part of denominator in standard rules so do not use in calculation
797 $failed_items = $row['pass_filter'] - $row['pass_target'];
799 $failed_items = $row['pass_filter'] - $row['pass_target'] - $row['excluded'];
801 } else { // isset($row['is_sub'])
802 // Excluded is not part of denominator in standard rules so do not use in calculation
803 $failed_items = $main_pass_filter - $row['pass_target'];
806 if (isset($row['itemized_test_id']) && ($failed_items > 0)) {
807 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()'>" . text($failed_items) . "</a></td>";
809 echo "<td align='center'>" . text($failed_items) . "</td>";
812 echo "<td align='center'>" . text($row['percentage']) . "</td>";
813 } else if (isset($row['is_provider'])) {
814 // Display the provider information
815 if (!$firstProviderFlag && $_POST['form_provider'] == 'collate_outer') {
816 echo "<tr><td> </td></tr>";
819 echo "<td class='detail' align='center'><b>";
820 echo xlt("Provider").": " . text($row['prov_lname']) . "," . text($row['prov_fname']);
821 if (!empty($row['npi']) ||
!empty($row['federaltaxid'])) {
823 if (!empty($row['npi'])) {
824 echo " " . xlt('NPI') . ":" . text($row['npi']) . " ";
827 if (!empty($row['federaltaxid'])) {
828 echo " " . xlt('TID') . ":" . text($row['federaltaxid']) . " ";
835 $firstProviderFlag = false;
836 $existProvider = true;
837 } else { // isset($row['is_plan'])
838 if (!$firstPlanFlag && $_POST['form_provider'] != 'collate_outer') {
839 echo "<tr><td> </td></tr>";
842 echo "<td class='detail' align='center'><b>";
843 echo xlt("Plan") . ": ";
844 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'), $row['id']);
845 if (!empty($row['cqm_measure_group'])) {
846 echo " (". xlt('Measure Group Code') . ": " . text($row['cqm_measure_group']) . ")";
850 $firstPlanFlag = false;
860 </div
> <!-- end of search results
-->
862 <div id
="instructions_text" class='text'>
863 <?php
echo xlt('Please input search criteria above, and click Submit to start report.'); ?
>
867 <input type
='hidden' name
='form_new_report_id' id
='form_new_report_id' value
=''/>