4 * Copyright (C) 2010-2017 Brady Miller <brady@sparmy.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@sparmy.com>
19 * @link http://www.open-emr.org
22 //SANITIZE ALL ESCAPES
23 $sanitize_all_escapes=true;
26 //STOP FAKE REGISTER GLOBALS
27 $fake_register_globals=false;
30 require_once("../globals.php");
31 require_once("../../library/patient.inc");
32 require_once("$srcdir/formatting.inc.php");
33 require_once "$srcdir/options.inc.php";
34 require_once "$srcdir/clinical_rules.php";
35 require_once "$srcdir/report_database.inc";
37 // See if showing an old report or creating a new report
38 $report_id = (isset($_GET['report_id'])) ?
trim($_GET['report_id']) : "";
40 // Collect the back variable, if pertinent
41 $back_link = (isset($_GET['back'])) ?
trim($_GET['back']) : "";
43 // If showing an old report, then collect information
44 if (!empty($report_id)) {
45 $report_view = collectReportDatabase($report_id);
46 $date_report = $report_view['date_report'];
47 $type_report = $report_view['type'];
49 $type_report = (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2") ||
50 ($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) ?
$type_report : "standard";
51 $rule_filter = $report_view['type'];
53 if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) {
54 $begin_date = $report_view['date_begin'];
55 $labs_manual = $report_view['labs_manual'];
57 $target_date = $report_view['date_target'];
58 $plan_filter = $report_view['plan'];
59 $organize_method = $report_view['organize_mode'];
60 $provider = $report_view['provider'];
61 $pat_prov_rel = $report_view['pat_prov_rel'];
62 $dataSheet = json_decode($report_view['data'],TRUE);
65 // Collect report type parameter (standard, amc, cqm)
66 // Note that need to convert amc_2011 and amc_2014 to amc and cqm_2011 and cqm_2014 to cqm
67 // to simplify for when submitting for a new report.
68 $type_report = (isset($_GET['type'])) ?
trim($_GET['type']) : "standard";
70 if ( ($type_report == "cqm_2011") ||
($type_report == "cqm_2014") ) {
73 if ( ($type_report == "amc_2011") ||
($type_report == "amc_2014") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2") ) {
76 // Collect form parameters (set defaults if empty)
77 if ($type_report == "amc") {
78 $begin_date = (isset($_POST['form_begin_date'])) ?
trim($_POST['form_begin_date']) : "";
79 $labs_manual = (isset($_POST['labs_manual_entry'])) ?
trim($_POST['labs_manual_entry']) : "0";
81 $target_date = (isset($_POST['form_target_date'])) ?
trim($_POST['form_target_date']) : date('Y-m-d H:i:s');
82 $rule_filter = (isset($_POST['form_rule_filter'])) ?
trim($_POST['form_rule_filter']) : "";
83 $plan_filter = (isset($_POST['form_plan_filter'])) ?
trim($_POST['form_plan_filter']) : "";
84 $organize_method = (empty($plan_filter)) ?
"default" : "plans";
85 $provider = trim($_POST['form_provider']);
86 $pat_prov_rel = (empty($_POST['form_pat_prov_rel'])) ?
"primary" : trim($_POST['form_pat_prov_rel']);
93 <?php
html_header_show();?
>
95 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
96 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
98 <?php
if ($type_report == "standard") { ?
>
99 <title
><?php
echo xlt('Standard Measures'); ?
></title
>
102 <?php
if ($type_report == "cqm") { ?
>
103 <title
><?php
echo xlt('Clinical Quality Measures (CQM)'); ?
></title
>
105 <?php
if ($type_report == "cqm_2011") { ?
>
106 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
></title
>
108 <?php
if ($type_report == "cqm_2014") { ?
>
109 <title
><?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
></title
>
112 <?php
if ($type_report == "amc") { ?
>
113 <title
><?php
echo xlt('Automated Measure Calculations (AMC)'); ?
></title
>
115 <?php
if ($type_report == "amc_2011") { ?
>
116 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
></title
>
118 <?php
if ($type_report == "amc_2014_stage1") { ?
>
119 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
></title
>
121 <?php
if ($type_report == "amc_2014_stage2") { ?
>
122 <title
><?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
></title
>
125 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
126 <script type
="text/javascript" src
="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
127 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
128 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script
>
129 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script
>
131 <script LANGUAGE
="JavaScript">
133 var mypcc
= '<?php echo text($GLOBALS['phone_country_code
']) ?>';
135 $
(document
).ready(function() {
136 var win
= top
.printLogSetup ? top
: opener
.top
;
137 win
.printLogSetup(document
.getElementById('printbutton'));
139 $
('.datepicker').datetimepicker({
140 <?php
$datetimepicker_timepicker = true; ?
>
141 <?php
$datetimepicker_formatInput = false; ?
>
142 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
143 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
147 function runReport() {
150 if (!(validateForm())) {
151 alert("<?php echo xls("Rule Set
and Plan Set selections are not consistent
. Please fix
and Submit again
."); ?>");
155 // Showing processing wheel
156 $
("#processing").show();
158 // hide Submit buttons
159 $
("#submit_button").hide();
160 $
("#xmla_button").hide();
161 $
("#xmlb_button").hide();
162 $
("#xmlc_button").hide();
163 $
("#print_button").hide();
164 $
("#genQRDA").hide();
167 $
("#instructions_text").hide();
169 // Collect an id string via an ajax request
170 top
.restoreSession();
171 $
.get("../../library/ajax/collect_new_report_id.php",
173 // Set the report id in page form
174 $
("#form_new_report_id").attr("value",data
);
176 // Start collection status checks
177 collectStatus($
("#form_new_report_id").val());
180 top
.restoreSession();
181 $
.post("../../library/ajax/execute_cdr_report.php",
182 {provider
: $
("#form_provider").val(),
183 type
: $
("#form_rule_filter").val(),
184 date_target
: $
("#form_target_date").val(),
185 date_begin
: $
("#form_begin_date").val(),
186 plan
: $
("#form_plan_filter").val(),
187 labs
: $
("#labs_manual_entry").val(),
188 pat_prov_rel
: $
("#form_pat_prov_rel").val(),
189 execute_report_id
: $
("#form_new_report_id").val()
194 function collectStatus(report_id
) {
195 // Collect the status string via an ajax request and place in DOM at timed intervals
196 top
.restoreSession();
197 // Do not send the skip_timeout_reset parameter, so don't close window before report is done.
198 $
.post("../../library/ajax/status_report.php",
199 {status_report_id
: report_id
},
201 if (data
== "PENDING") {
202 // Place the pending string in the DOM
203 $
('#status_span').replaceWith("<span id='status_span'><?php echo xlt("Preparing To Run Report
"); ?></span>");
205 else if (data
== "COMPLETE") {
206 // Go into the results page
207 top
.restoreSession();
208 link_report
= "cqm.php?report_id="+report_id
;
209 window
.open(link_report
,'_self',false);
210 //$("#processing").hide();
211 //$('#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>");
214 // Place the string in the DOM
215 $
('#status_span').replaceWith("<span id='status_span'>"+data+
"</span>");
218 // run status check every 10 seconds
219 var repeater
= setTimeout("collectStatus("+report_id+
")", 10000);
222 function GenXml(sNested
) {
223 top
.restoreSession();
224 //QRDA Category III Export
225 if(sNested
== "QRDA"){
226 var form_rule_filter
= theform
.form_rule_filter
.value
227 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);?>";
229 var sLoc
= '../../custom/export_registry_xml.php?&target_date=' + theform
.form_target_date
.value +
'&nested=' + sNested
;
231 dlgopen(sLoc
, '_blank', 600, 500);
235 //QRDA I - 2014 Download
236 function downloadQRDA() {
237 top
.restoreSession();
238 var reportID
= '<?php echo attr($report_id); ?>';
239 var provider
= $
("#form_provider").val();
240 sLoc
= '../../custom/download_qrda.php?&report_id=' + reportID +
'&provider_id=' + provider
;
241 dlgopen(sLoc
, '_blank', 600, 500);
244 function validateForm() {
245 <?php
if ( (empty($report_id)) && ($type_report == "cqm") ) { ?
>
246 // If this is a cqm and plan set not set to ignore, then need to ensure consistent with the rules set
247 if ($
("#form_plan_filter").val() != '') {
248 if ($
("#form_rule_filter").val() == $
("#form_plan_filter").val()) {
262 function Form_Validate() {
263 <?php
if ( (empty($report_id)) && (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) ){ ?
>
264 var d
= document
.forms
[0];
265 FromDate
= d
.form_begin_date
.value
;
266 ToDate
= d
.form_target_date
.value
;
267 if ( (FromDate
.length
> 0) && (ToDate
.length
> 0) ) {
268 if (FromDate
> ToDate
){
269 alert("<?php echo xls('End date must be later than Begin date!'); ?>");
275 //For Results are in Gray Background & disabling anchor links
276 <?php
if($report_id != ""){?
>
277 $
("#report_results").css("opacity", '0.4');
278 $
("#report_results").css("filter", 'alpha(opacity=40)');
279 $
("a").removeAttr("href");
282 $
("#form_refresh").attr("value","true");
289 <style type
="text/css">
291 /* specifically include & exclude from printing */
297 #report_parameters_daterange {
301 #report_results table {
306 /* specifically exclude some from the screen */
308 #report_parameters_daterange {
317 <body
class="body_top">
319 <!-- Required
for the popup date selectors
-->
320 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
322 <span
class='title'><?php
echo xlt('Report'); ?
> -
324 <?php
if ($type_report == "standard") { ?
>
325 <?php
echo xlt('Standard Measures'); ?
>
328 <?php
if ($type_report == "cqm") { ?
>
329 <?php
echo xlt('Clinical Quality Measures (CQM)'); ?
>
331 <?php
if ($type_report == "cqm_2011") { ?
>
332 <?php
echo xlt('Clinical Quality Measures (CQM) - 2011'); ?
>
334 <?php
if ($type_report == "cqm_2014") { ?
>
335 <?php
echo xlt('Clinical Quality Measures (CQM) - 2014'); ?
>
338 <?php
if ($type_report == "amc") { ?
>
339 <?php
echo xlt('Automated Measure Calculations (AMC)'); ?
>
341 <?php
if ($type_report == "amc_2011") { ?
>
342 <?php
echo xlt('Automated Measure Calculations (AMC) - 2011'); ?
>
344 <?php
if ($type_report == "amc_2014_stage1") { ?
>
345 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage I'); ?
>
347 <?php
if ($type_report == "amc_2014_stage2") { ?
>
348 <?php
echo xlt('Automated Measure Calculations (AMC) - 2014 Stage II'); ?
>
351 <?php
if (!empty($report_id)) { ?
>
352 <?php
echo " - " . xlt('Date of Report') . ": " . text($date_report);
353 //prepare to disable form elements
354 $dis_text = " disabled='disabled' ";
359 <form method
='post' name
='theform' id
='theform' action
='cqm.php?type=<?php echo attr($type_report) ;?>' onsubmit
='return validateForm()'>
361 <div id
="report_parameters">
364 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) $widthDyn = "410px";
368 <td scope
="row" width
='<?php echo $widthDyn;?>'>
369 <div style
='float:left'>
373 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
376 <?php
echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES
); ?
>:
379 <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); ?>'
381 title
='<?php echo htmlspecialchars( xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
382 <?php
if (empty($report_id)) { ?
>
390 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
391 <?php
echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES
); ?
>:
393 <?php
echo htmlspecialchars( xl('Target Date'), ENT_NOQUOTES
); ?
>:
397 <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); ?>'
399 title
='<?php echo htmlspecialchars( xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
400 <?php
if (empty($report_id)) { ?
>
405 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
408 <?php
echo xlt('Rule Set'); ?
>:
411 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter'>
412 <option value
='cqm' <?php
if ($rule_filter == "cqm") echo "selected"; ?
>>
413 <?php
echo xlt('All Clinical Quality Measures (CQM)'); ?
></option
>
414 <option value
='cqm_2011' <?php
if ($rule_filter == "cqm_2011") echo "selected"; ?
>>
415 <?php
echo xlt('2011 Clinical Quality Measures (CQM)'); ?
></option
>
416 <option value
='cqm_2014' <?php
if ($rule_filter == "cqm_2014") echo "selected"; ?
>>
417 <?php
echo xlt('2014 Clinical Quality Measures (CQM)'); ?
></option
>
423 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
426 <?php
echo xlt('Rule Set'); ?
>:
429 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter'>
431 <?php
if ($rule_filter == "amc") { //only show this when displaying old reports. Not available option for new reports ?>
432 <option value
='amc' selected
>
433 <?php
echo xlt('All Automated Measure Calculations (AMC)'); ?
></option
>
436 <option value
='amc_2011' <?php
if ($rule_filter == "amc_2011") echo "selected"; ?
>>
437 <?php
echo xlt('2011 Automated Measure Calculations (AMC)'); ?
></option
>
438 <option value
='amc_2014_stage1' <?php
if ($rule_filter == "amc_2014_stage1") echo "selected"; ?
>>
439 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage I'); ?
></option
>
440 <option value
='amc_2014_stage2' <?php
if ($rule_filter == "amc_2014_stage2") echo "selected"; ?
>>
441 <?php
echo xlt('2014 Automated Measure Calculations (AMC) - Stage II'); ?
></option
>
447 <?php
if ($type_report == "standard") { ?
>
450 <?php
echo xlt('Rule Set'); ?
>:
453 <select
<?php
echo $dis_text; ?
> id
='form_rule_filter' name
='form_rule_filter'>
454 <option value
='passive_alert' <?php
if ($rule_filter == "passive_alert") echo "selected"; ?
>>
455 <?php
echo xlt('Passive Alert Rules'); ?
></option
>
456 <option value
='active_alert' <?php
if ($rule_filter == "active_alert") echo "selected"; ?
>>
457 <?php
echo xlt('Active Alert Rules'); ?
></option
>
458 <option value
='patient_reminder' <?php
if ($rule_filter == "patient_reminder") echo "selected"; ?
>>
459 <?php
echo xlt('Patient Reminder Rules'); ?
></option
>
465 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
466 <input type
='hidden' id
='form_plan_filter' name
='form_plan_filter' value
=''>
470 <?php
echo htmlspecialchars( xl('Plan Set'), ENT_NOQUOTES
); ?
>:
473 <select
<?php
echo $dis_text; ?
> id
='form_plan_filter' name
='form_plan_filter'>
474 <option value
=''>-- <?php
echo htmlspecialchars( xl('Ignore'), ENT_NOQUOTES
); ?
> --</option
>
475 <?php
if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) { ?
>
476 <option value
='cqm' <?php
if ($plan_filter == "cqm") echo "selected"; ?
>>
477 <?php
echo htmlspecialchars( xl('All Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
478 <option value
='cqm_2011' <?php
if ($plan_filter == "cqm_2011") echo "selected"; ?
>>
479 <?php
echo htmlspecialchars( xl('2011 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
480 <option value
='cqm_2014' <?php
if ($plan_filter == "cqm_2014") echo "selected"; ?
>>
481 <?php
echo htmlspecialchars( xl('2014 Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
483 <?php
if ($type_report == "standard") { ?
>
484 <option value
='normal' <?php
if ($plan_filter == "normal") echo "selected"; ?
>>
485 <?php
echo htmlspecialchars( xl('Active Plans'), ENT_NOQUOTES
); ?
></option
>
493 <?php
echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES
); ?
>:
498 // Build a drop-down list of providers.
501 $query = "SELECT id, lname, fname FROM users WHERE ".
502 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
504 $ures = sqlStatement($query);
506 echo " <select " . $dis_text . " id='form_provider' name='form_provider'>\n";
507 echo " <option value=''>-- " . htmlspecialchars( xl('All (Cumulative)'), ENT_NOQUOTES
) . " --\n";
509 echo " <option value='collate_outer'";
510 if ($provider == 'collate_outer') echo " selected";
511 echo ">-- " . htmlspecialchars( xl('All (Collated Format A)'), ENT_NOQUOTES
) . " --\n";
513 echo " <option value='collate_inner'";
514 if ($provider == 'collate_inner') echo " selected";
515 echo ">-- " . htmlspecialchars( xl('All (Collated Format B)'), ENT_NOQUOTES
) . " --\n";
517 while ($urow = sqlFetchArray($ures)) {
518 $provid = $urow['id'];
519 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES
)."'";
520 if ($provid == $provider) echo " selected";
521 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES
) . "\n";
532 <?php
echo htmlspecialchars( xl('Provider Relationship'), ENT_NOQUOTES
); ?
>:
537 // Build a drop-down list of of patient provider relationships.
539 echo " <select ". $dis_text ." id='form_pat_prov_rel' name='form_pat_prov_rel' 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";
540 echo " <option value='primary'";
541 if ($pat_prov_rel == 'primary') echo " selected";
542 echo ">" . xlt('Primary') . "\n";
543 echo " <option value='encounter'";
544 if ($pat_prov_rel == 'encounter') echo " selected";
545 echo ">" . xlt('Encounter') . "\n";
551 <?php
if (($type_report == "amc") ||
($type_report == "amc_2011") ||
($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2")) { ?
>
554 <?php
echo htmlspecialchars( xl('Number labs'), ENT_NOQUOTES
); ?
>:<br
>
555 (<?php
echo htmlspecialchars( xl('Non-electronic'), ENT_NOQUOTES
); ?
>)
558 <input
<?php
echo $dis_text; ?
> type
="text" id
="labs_manual_entry" name
="labs_manual_entry" value
="<?php echo htmlspecialchars($labs_manual,ENT_QUOTES); ?>">
568 <td align
='left' valign
='middle' height
="100%">
569 <table style
='border-left:1px solid; width:100%; height:100%' >
573 <div style
='margin-left:15px'>
575 <?php
if (empty($report_id)) { ?
>
576 <a id
='submit_button' href
='#' class='css_button' onclick
='runReport();'>
578 <?php
echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES
); ?
>
581 <span id
='status_span'></span
>
582 <div id
='processing' style
='margin:10px;display:none;'><img src
='../pic/ajax-loader.gif'/></div
>
583 <?php
if ($type_report == "cqm") { ?
>
584 <a id
='xmla_button' href
='#' class='css_button' onclick
='return GenXml("false")'>
586 <?php
echo htmlspecialchars( xl('Generate PQRI report (Method A) - 2011'), ENT_NOQUOTES
); ?
>
589 <a id
='xmlb_button' href
='#' class='css_button' onclick
='return GenXml("true")'>
591 <?php
echo htmlspecialchars( xl('Generate PQRI report (Method E) - 2011'), ENT_NOQUOTES
); ?
>
597 <?php
if (!empty($report_id)) { ?
>
598 <a href
='#' class='css_button' id
='printbutton'>
600 <?php
echo htmlspecialchars( xl('Print'), ENT_NOQUOTES
); ?
>
603 <?php
if ($type_report == "cqm_2014") { ?
>
604 <a href
="#" id
="genQRDA" class='css_button' onclick
='return downloadQRDA()'>
606 <?php
echo htmlspecialchars( xl('Generate QRDA I – 2014'), ENT_NOQUOTES
); ?
>
609 <a href
="#" id
="xmlc_button" class='css_button' onclick
='return GenXml("QRDA")'>
611 <?php
echo htmlspecialchars( xl('Generate QRDA III - 2014'), ENT_NOQUOTES
); ?
>
616 <?php
if ($back_link == "list") { ?
>
617 <a href
='report_results.php' class='css_button' onclick
='top.restoreSession()'><span
><?php
echo xlt("Return To Report Results"); ?
></span
></a
>
619 <a href
='#' class='css_button' onclick
='top.restoreSession(); $("#theform").submit();'><span
><?php
echo xlt("Start Another Report"); ?
></span
></a
>
630 </div
> <!-- end of search parameters
-->
635 if (!empty($report_id)) {
639 <div id
="report_results">
644 <?php
echo htmlspecialchars( xl('Title'), ENT_NOQUOTES
); ?
>
649 if($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014')
650 echo htmlspecialchars( xl('Initial Patient Population'), ENT_NOQUOTES
);
652 echo htmlspecialchars( xl('Total Patients'), ENT_NOQUOTES
);
657 <?php
if ($type_report == "amc") { ?
>
658 <?php
echo htmlspecialchars( xl('Denominator'), ENT_NOQUOTES
); ?
></a
>
660 <?php
echo htmlspecialchars( xl('Applicable Patients') .' (' . xl('Denominator') . ')', ENT_NOQUOTES
); ?
></a
>
664 <?php
if ($type_report != "amc") { ?
>
666 <?php
echo htmlspecialchars( xl('Denominator Exclusion'), ENT_NOQUOTES
); ?
></a
>
669 <?php
if($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014') {?
>
671 <?php
echo htmlspecialchars( xl('Denominator Exception'), ENT_NOQUOTES
); ?
></a
>
676 <?php
if ($type_report == "amc") { ?
>
677 <?php
echo htmlspecialchars( xl('Numerator'), ENT_NOQUOTES
); ?
></a
>
679 <?php
echo htmlspecialchars( xl('Passed Patients') . ' (' . xl('Numerator') . ')', ENT_NOQUOTES
); ?
></a
>
684 <?php
if ($type_report == "amc") { ?
>
685 <?php
echo htmlspecialchars( xl('Failed'), ENT_NOQUOTES
); ?
></a
>
687 <?php
echo htmlspecialchars( xl('Failed Patients'), ENT_NOQUOTES
); ?
></a
>
692 <?php
echo htmlspecialchars( xl('Performance Percentage'), ENT_NOQUOTES
); ?
></a
>
696 <tbody
> <!-- added
for better
print-ability
-->
699 $firstProviderFlag = TRUE;
700 $firstPlanFlag = TRUE;
701 $existProvider = FALSE;
702 foreach ($dataSheet as $row) {
706 <tr bgcolor
='<?php echo $bgcolor ?>'>
709 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
710 echo "<td class='detail'>";
711 if (isset($row['is_main'])) {
713 // is_sub is a special case of is_main whereas total patients, denominator, and excluded patients are taken
714 // from is_main prior to it. So, need to store denominator patients from is_main for subsequent is_sub
715 // to calculate the number of patients that failed.
716 // Note that exlusion in the standard rules is not the same as in the cqm/amd and should not be in calculation
717 // as is in the cqm/amc rules.
718 $main_pass_filter = $row['pass_filter'];
720 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
722 $tempCqmAmcString = "";
723 if (($type_report == "cqm") ||
($type_report == "cqm_2011") ||
($type_report == "cqm_2014")) {
724 if (!empty($row['cqm_pqri_code'])) {
725 $tempCqmAmcString .= " " . htmlspecialchars( xl('PQRI') . ":" . $row['cqm_pqri_code'], ENT_NOQUOTES
) . " ";
727 if (!empty($row['cqm_nqf_code'])) {
728 $tempCqmAmcString .= " " . htmlspecialchars( xl('NQF') . ":" . $row['cqm_nqf_code'], ENT_NOQUOTES
) . " ";
731 if ($type_report == "amc") {
732 if (!empty($row['amc_code'])) {
733 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
735 if (!empty($row['amc_code_2014'])) {
736 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES
) . " ";
739 if ($type_report == "amc_2011") {
740 if (!empty($row['amc_code'])) {
741 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2011') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
744 if ( ($type_report == "amc_2014_stage1") ||
($type_report == "amc_2014_stage2") ) {
745 if (!empty($row['amc_code_2014'])) {
746 $tempCqmAmcString .= " " . htmlspecialchars( xl('AMC-2014') . ":" . $row['amc_code_2014'], ENT_NOQUOTES
) . " ";
750 if (!empty($tempCqmAmcString)) {
751 echo "(".$tempCqmAmcString.")";
754 if ( !(empty($row['concatenated_label'])) ) {
755 echo ", " . htmlspecialchars( xl( $row['concatenated_label'] ), ENT_NOQUOTES
) . " ";
759 else { // isset($row['is_sub'])
760 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
761 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
765 if($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014')
766 echo "<td align='center'>" . $row['initial_population'] . "</td>";
768 echo "<td align='center'>" . $row['total_patients'] . "</td>";
770 if ( isset($row['itemized_test_id']) && ($row['pass_filter'] > 0) ) {
771 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>";
774 echo "<td align='center'>" . $row['pass_filter'] . "</td>";
777 if ($type_report != "amc") {
778 // Note that amc will likely support in excluded items in the future for MU2
779 if ( ($type_report != "standard") && isset($row['itemized_test_id']) && ($row['excluded'] > 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=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>";
784 echo "<td align='center'>" . $row['excluded'] . "</td>";
788 if($type_report == 'cqm' ||
$type_report == 'cqm_2011' ||
$type_report == 'cqm_2014'){
789 // Note that amc will likely support in exception items in the future for MU2
790 if ( isset($row['itemized_test_id']) && ($row['exception'] > 0) ) {
791 // Note standard reporting exluded is different than cqm/amc and will not support itemization
792 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>";
795 echo "<td align='center'>" . $row['exception'] . "</td>";
799 if ( isset($row['itemized_test_id']) && ($row['pass_target'] > 0) ) {
800 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>";
803 echo "<td align='center'>" . $row['pass_target'] . "</td>";
807 if (isset($row['is_main'])) {
808 if ($type_report == "standard") {
809 // Excluded is not part of denominator in standard rules so do not use in calculation
810 $failed_items = $row['pass_filter'] - $row['pass_target'];
813 $failed_items = $row['pass_filter'] - $row['pass_target'] - $row['excluded'];
816 else { // isset($row['is_sub'])
817 // Excluded is not part of denominator in standard rules so do not use in calculation
818 $failed_items = $main_pass_filter - $row['pass_target'];
820 if ( isset($row['itemized_test_id']) && ($failed_items > 0) ) {
821 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>";
824 echo "<td align='center'>" . $failed_items . "</td>";
827 echo "<td align='center'>" . $row['percentage'] . "</td>";
829 else if (isset($row['is_provider'])) {
830 // Display the provider information
831 if (!$firstProviderFlag && $_POST['form_provider'] == 'collate_outer') {
832 echo "<tr><td> </td></tr>";
834 echo "<td class='detail' align='center'><b>";
835 echo htmlspecialchars( xl("Provider").": " . $row['prov_lname'] . "," . $row['prov_fname'], ENT_NOQUOTES
);
836 if (!empty($row['npi']) ||
!empty($row['federaltaxid'])) {
838 if (!empty($row['npi'])) {
839 echo " " . htmlspecialchars( xl('NPI') . ":" . $row['npi'], ENT_NOQUOTES
) . " ";
841 if (!empty($row['federaltaxid'])) {
842 echo " " . htmlspecialchars( xl('TID') . ":" . $row['federaltaxid'], ENT_NOQUOTES
) . " ";
847 $firstProviderFlag = FALSE;
848 $existProvider = TRUE;
850 else { // isset($row['is_plan'])
851 if (!$firstPlanFlag && $_POST['form_provider'] != 'collate_outer') {
852 echo "<tr><td> </td></tr>";
854 echo "<td class='detail' align='center'><b>";
855 echo htmlspecialchars( xl("Plan"), ENT_NOQUOTES
) . ": ";
856 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'),$row['id']);
857 if (!empty($row['cqm_measure_group'])) {
858 echo " (". htmlspecialchars( xl('Measure Group Code') . ": " . $row['cqm_measure_group'], ENT_NOQUOTES
) . ")";
861 $firstPlanFlag = FALSE;
871 </div
> <!-- end of search results
-->
873 <div id
="instructions_text" class='text'>
874 <?php
echo htmlspecialchars( xl('Please input search criteria above, and click Submit to start report.'), ENT_NOQUOTES
); ?
>
878 <input type
='hidden' name
='form_new_report_id' id
='form_new_report_id' value
=''/>