2 // Copyright (C) 2010 Brady Miller <brady@sparmy.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
10 $sanitize_all_escapes=true;
13 //STOP FAKE REGISTER GLOBALS
14 $fake_register_globals=false;
17 require_once("../globals.php");
18 require_once("../../library/patient.inc");
19 require_once("$srcdir/formatting.inc.php");
20 require_once "$srcdir/options.inc.php";
21 require_once "$srcdir/formdata.inc.php";
22 require_once "$srcdir/clinical_rules.php";
24 // Collect report type parameter (standard, amc, or cqm)
25 $type_report = (isset($_GET['type'])) ?
trim($_GET['type']) : "standard";
27 // Collect form parameters (set defaults if empty)
28 if ($type_report == "amc") {
29 $begin_date = (isset($_POST['form_begin_date'])) ?
trim($_POST['form_begin_date']) : "";
30 $labs_manual = (isset($_POST['labs_manual_entry'])) ?
trim($_POST['labs_manual_entry']) : "0";
32 $target_date = (isset($_POST['form_target_date'])) ?
trim($_POST['form_target_date']) : date('Y-m-d H:i:s');
33 $rule_filter = (isset($_POST['form_rule_filter'])) ?
trim($_POST['form_rule_filter']) : "";
34 $plan_filter = (isset($_POST['form_plan_filter'])) ?
trim($_POST['form_plan_filter']) : "";
35 $organize_method = (empty($plan_filter)) ?
"default" : "plans";
36 $provider = trim($_POST['form_provider']);
43 <?php
html_header_show();?
>
45 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
47 <?php
if ($type_report == "standard") { ?
>
48 <title
><?php
echo htmlspecialchars( xl('Standard Measures'), ENT_NOQUOTES
); ?
></title
>
50 <?php
if ($type_report == "cqm") { ?
>
51 <title
><?php
echo htmlspecialchars( xl('Clinical Quality Measures (CQM)'), ENT_NOQUOTES
); ?
></title
>
53 <?php
if ($type_report == "amc") { ?
>
54 <title
><?php
echo htmlspecialchars( xl('Automated Measure Calculations (AMC)'), ENT_NOQUOTES
); ?
></title
>
57 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
58 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
59 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
60 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
62 <script LANGUAGE
="JavaScript">
64 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
66 function refreshme() {
69 document
.forms
[0].submit();
72 function GenXml(sNested
) {
74 var sLoc
= '../../custom/export_registry_xml.php?&target_date=' + theform
.form_target_date
.value +
'&nested=' + sNested
;
75 dlgopen(sLoc
, '_blank', 600, 500);
81 <style type
="text/css">
83 /* specifically include & exclude from printing */
89 #report_parameters_daterange {
93 #report_results table {
98 /* specifically exclude some from the screen */
100 #report_parameters_daterange {
109 <body
class="body_top">
111 <!-- Required
for the popup date selectors
-->
112 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
114 <span
class='title'><?php
echo htmlspecialchars( xl('Report'), ENT_NOQUOTES
); ?
> -
116 <?php
if ($type_report == "standard") { ?
>
117 <?php
echo htmlspecialchars( xl('Standard Measures'), ENT_NOQUOTES
); ?
></span
>
119 <?php
if ($type_report == "cqm") { ?
>
120 <?php
echo htmlspecialchars( xl('Clinical Quality Measures (CQM)'), ENT_NOQUOTES
); ?
></span
>
122 <?php
if ($type_report == "amc") { ?
>
123 <?php
echo htmlspecialchars( xl('Automated Measure Calculations (AMC)'), ENT_NOQUOTES
); ?
></span
>
127 <form method
='post' name
='theform' id
='theform' action
='cqm.php?type=<?php echo htmlspecialchars($type_report,ENT_QUOTES) ;?>' onsubmit
='return top.restoreSession()'>
129 <div id
="report_parameters">
134 <div style
='float:left'>
138 <?php
if ($type_report == "amc") { ?
>
141 <?php
echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES
); ?
>:
144 <input type
='text' name
='form_begin_date' id
="form_begin_date" size
='20' value
='<?php echo htmlspecialchars( $begin_date, ENT_QUOTES); ?>'
145 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo htmlspecialchars( xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
146 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
147 id
='img_begin_date' border
='0' alt
='[?]' style
='cursor:pointer'
148 title
='<?php echo htmlspecialchars( xl('Click here to choose a date
'), ENT_QUOTES); ?>'>
155 <?php
if ($type_report == "amc") { ?
>
156 <?php
echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES
); ?
>:
158 <?php
echo htmlspecialchars( xl('Target Date'), ENT_NOQUOTES
); ?
>:
162 <input type
='text' name
='form_target_date' id
="form_target_date" size
='20' value
='<?php echo htmlspecialchars( $target_date, ENT_QUOTES); ?>'
163 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo htmlspecialchars( xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
164 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
165 id
='img_target_date' border
='0' alt
='[?]' style
='cursor:pointer'
166 title
='<?php echo htmlspecialchars( xl('Click here to choose a date
'), ENT_QUOTES); ?>'>
170 <?php
if ($type_report == "cqm") { ?
>
171 <input type
='hidden' name
='form_rule_filter' value
='cqm'>
173 <?php
if ($type_report == "amc") { ?
>
174 <input type
='hidden' name
='form_rule_filter' value
='amc'>
176 <?php
if ($type_report == "standard") { ?
>
179 <?php
echo htmlspecialchars( xl('Rule Set'), ENT_NOQUOTES
); ?
>:
182 <select name
='form_rule_filter'>
183 <option value
='passive_alert' <?php
if ($rule_filter == "passive_alert") echo "selected"; ?
>>
184 <?php
echo htmlspecialchars( xl('Passive Alert Rules'), ENT_NOQUOTES
); ?
></option
>
185 <option value
='active_alert' <?php
if ($rule_filter == "active_alert") echo "selected"; ?
>>
186 <?php
echo htmlspecialchars( xl('Active Alert Rules'), ENT_NOQUOTES
); ?
></option
>
187 <option value
='patient_reminder' <?php
if ($rule_filter == "patient_reminder") echo "selected"; ?
>>
188 <?php
echo htmlspecialchars( xl('Patient Reminder Rules'), ENT_NOQUOTES
); ?
></option
>
194 <?php
if ($type_report == "amc") { ?
>
195 <input type
='hidden' name
='form_plan_filter' value
=''>
199 <?php
echo htmlspecialchars( xl('Plan Set'), ENT_NOQUOTES
); ?
>:
202 <select name
='form_plan_filter'>
203 <option value
=''>-- <?php
echo htmlspecialchars( xl('Ignore'), ENT_NOQUOTES
); ?
> --</option
>
204 <?php
if ($type_report == "cqm") { ?
>
205 <option value
='cqm' <?php
if ($plan_filter == "cqm") echo "selected"; ?
>>
206 <?php
echo htmlspecialchars( xl('Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
208 <?php
if ($type_report == "standard") { ?
>
209 <option value
='normal' <?php
if ($plan_filter == "normal") echo "selected"; ?
>>
210 <?php
echo htmlspecialchars( xl('Active Plans'), ENT_NOQUOTES
); ?
></option
>
218 <?php
echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES
); ?
>:
223 // Build a drop-down list of providers.
226 $query = "SELECT id, lname, fname FROM users WHERE ".
227 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
229 $ures = sqlStatement($query);
231 echo " <select name='form_provider'>\n";
232 echo " <option value=''>-- " . htmlspecialchars( xl('All (Cumulative)'), ENT_NOQUOTES
) . " --\n";
234 echo " <option value='collate_outer'";
235 if ($_POST['form_provider'] == 'collate_outer') echo " selected";
236 echo ">-- " . htmlspecialchars( xl('All (Collated Format A)'), ENT_NOQUOTES
) . " --\n";
238 echo " <option value='collate_inner'";
239 if ($_POST['form_provider'] == 'collate_inner') echo " selected";
240 echo ">-- " . htmlspecialchars( xl('All (Collated Format B)'), ENT_NOQUOTES
) . " --\n";
242 while ($urow = sqlFetchArray($ures)) {
243 $provid = $urow['id'];
244 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES
)."'";
245 if ($provid == $_POST['form_provider']) echo " selected";
246 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES
) . "\n";
255 <?php
if ($type_report == "amc") { ?
>
258 <?php
echo htmlspecialchars( xl('Number labs'), ENT_NOQUOTES
); ?
>:<br
>
259 (<?php
echo htmlspecialchars( xl('Non-electronic'), ENT_NOQUOTES
); ?
>)
262 <input type
="text" name
="labs_manual_entry" value
="<?php echo htmlspecialchars($labs_manual,ENT_QUOTES); ?>">
272 <td align
='left' valign
='middle' height
="100%">
273 <table style
='border-left:1px solid; width:100%; height:100%' >
276 <div style
='margin-left:15px'>
277 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
279 <?php
echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES
); ?
>
282 <?php
if ($type_report == "cqm") { ?
>
283 <a href
='#' class='css_button' onclick
='return GenXml("false")'>
285 <?php
echo htmlspecialchars( xl('Generate PQRI report (Method A)'), ENT_NOQUOTES
); ?
>
288 <a href
='#' class='css_button' onclick
='return GenXml("true")'>
290 <?php
echo htmlspecialchars( xl('Generate PQRI report (Method E)'), ENT_NOQUOTES
); ?
>
294 <?php
if ($_POST['form_refresh']) { ?
>
295 <a href
='#' class='css_button' onclick
='window.print()'>
297 <?php
echo htmlspecialchars( xl('Print'), ENT_NOQUOTES
); ?
>
309 </div
> <!-- end of search parameters
-->
314 if ($_POST['form_refresh']) {
318 <div id
="report_results">
323 <?php
echo htmlspecialchars( xl('Title'), ENT_NOQUOTES
); ?
>
327 <?php
echo htmlspecialchars( xl('Total Patients'), ENT_NOQUOTES
); ?
>
331 <?php
if ($type_report == "amc") { ?
>
332 <?php
echo htmlspecialchars( xl('Denominator'), ENT_NOQUOTES
); ?
></a
>
334 <?php
echo htmlspecialchars( xl('Applicable Patients') .' (' . xl('Denominator') . ')', ENT_NOQUOTES
); ?
></a
>
338 <?php
if ($type_report != "amc") { ?
>
340 <?php
echo htmlspecialchars( xl('Excluded Patients'), ENT_NOQUOTES
); ?
></a
>
345 <?php
if ($type_report == "amc") { ?
>
346 <?php
echo htmlspecialchars( xl('Numerator'), ENT_NOQUOTES
); ?
></a
>
348 <?php
echo htmlspecialchars( xl('Passed Patients') . ' (' . xl('Numerator') . ')', ENT_NOQUOTES
); ?
></a
>
353 <?php
echo htmlspecialchars( xl('Performance Percentage'), ENT_NOQUOTES
); ?
></a
>
357 <tbody
> <!-- added
for better
print-ability
-->
360 if ($type_report == "amc") {
362 // need to make $target_date an array with two elements ('dateBegin' and 'dateTarget')
363 // need to to send a manual data entry option (number of labs)
364 $array_date = array();
365 $array_date['dateBegin'] = $begin_date;
366 $array_date['dateTarget'] = $target_date;
367 $options = array('labs_manual'=>$labs_manual);
368 $dataSheet = test_rules_clinic($provider,$rule_filter,$array_date,"report",'',$plan_filter,$organize_method,$options);
371 $dataSheet = test_rules_clinic($provider,$rule_filter,$target_date,"report",'',$plan_filter,$organize_method);
374 $firstProviderFlag = TRUE;
375 $firstPlanFlag = TRUE;
376 $existProvider = FALSE;
377 foreach ($dataSheet as $row) {
381 <tr bgcolor
='<?php echo $bgcolor ?>'>
384 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
385 echo "<td class='detail'>";
386 if (isset($row['is_main'])) {
387 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
388 if (!empty($row['cqm_pqri_code']) ||
!empty($row['cqm_nqf_code']) ||
!empty($row['amc_code'])) {
390 if (!empty($row['cqm_pqri_code'])) {
391 echo " " . htmlspecialchars( xl('PQRI') . ":" . $row['cqm_pqri_code'], ENT_NOQUOTES
) . " ";
393 if (!empty($row['cqm_nqf_code'])) {
394 echo " " . htmlspecialchars( xl('NQF') . ":" . $row['cqm_nqf_code'], ENT_NOQUOTES
) . " ";
396 if (!empty($row['amc_code'])) {
397 echo " " . htmlspecialchars( xl('AMC') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
402 if ( !(empty($row['concatenated_label'])) ) {
403 echo ", " . htmlspecialchars( xl( $row['concatenated_label'] ), ENT_NOQUOTES
) . " ";
407 else { // isset($row['is_sub'])
408 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
409 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
412 echo "<td align='center'>" . $row['total_patients'] . "</td>";
413 echo "<td align='center'>" . $row['pass_filter'] . "</td>";
414 if ($type_report != "amc") {
415 echo "<td align='center'>" . $row['excluded'] . "</td>";
417 echo "<td align='center'>" . $row['pass_target'] . "</td>";
418 echo "<td align='center'>" . $row['percentage'] . "</td>";
420 else if (isset($row['is_provider'])) {
421 // Display the provider information
422 if (!$firstProviderFlag && $_POST['form_provider'] == 'collate_outer') {
423 echo "<tr><td> </td></tr>";
425 echo "<td class='detail' align='center'><b>";
426 echo htmlspecialchars( xl("Provider").": " . $row['prov_lname'] . "," . $row['prov_fname'], ENT_NOQUOTES
);
427 if (!empty($row['npi']) ||
!empty($row['federaltaxid'])) {
429 if (!empty($row['npi'])) {
430 echo " " . htmlspecialchars( xl('NPI') . ":" . $row['npi'], ENT_NOQUOTES
) . " ";
432 if (!empty($row['federaltaxid'])) {
433 echo " " . htmlspecialchars( xl('TID') . ":" . $row['federaltaxid'], ENT_NOQUOTES
) . " ";
438 $firstProviderFlag = FALSE;
439 $existProvider = TRUE;
441 else { // isset($row['is_plan'])
442 if (!$firstPlanFlag && $_POST['form_provider'] != 'collate_outer') {
443 echo "<tr><td> </td></tr>";
445 echo "<td class='detail' align='center'><b>";
446 echo htmlspecialchars( xl("Plan"), ENT_NOQUOTES
) . ": ";
447 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'),$row['id']);
448 if (!empty($row['cqm_measure_group'])) {
449 echo " (". htmlspecialchars( xl('Measure Group Code') . ": " . $row['cqm_measure_group'], ENT_NOQUOTES
) . ")";
452 $firstPlanFlag = FALSE;
462 </div
> <!-- end of search results
-->
465 <?php
echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES
); ?
>
469 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
475 <!-- stuff
for the popup calendar
-->
476 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
477 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
478 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
479 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
480 <script language
="Javascript">
481 <?php
if ($type_report == "amc") { ?
>
482 Calendar
.setup({inputField
:"form_begin_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_begin_date", showsTime
:'true'});
484 Calendar
.setup({inputField
:"form_target_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_target_date", showsTime
:'true'});