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.
9 // This report shows upcoming appointments with filtering and
10 // sorting by patient, practitioner, appointment type, and date.
12 //SANITIZE ALL ESCAPES
13 $sanitize_all_escapes=true;
16 //STOP FAKE REGISTER GLOBALS
17 $fake_register_globals=false;
20 require_once("../globals.php");
21 require_once("../../library/patient.inc");
22 require_once("$srcdir/formatting.inc.php");
23 require_once "$srcdir/options.inc.php";
24 require_once "$srcdir/formdata.inc.php";
25 require_once "$srcdir/clinical_rules.php";
27 // Collect parameters (set defaults if empty)
28 $target_date = (isset($_POST['form_target_date'])) ?
trim($_POST['form_target_date']) : date('Y-m-d H:i:s');
29 $rule_filter = (isset($_POST['form_rule_filter'])) ?
trim($_POST['form_rule_filter']) : "";
30 $plan_filter = (isset($_POST['form_plan_filter'])) ?
trim($_POST['form_plan_filter']) : "";
31 $organize_method = (empty($plan_filter)) ?
"default" : "plans";
32 $provider = trim($_POST['form_provider']);
39 <?php
html_header_show();?
>
41 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
43 <title
><?php
echo htmlspecialchars( xl('Clinical Quality Measures'), ENT_NOQUOTES
); ?
></title
>
45 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
46 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
47 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
48 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
50 <script LANGUAGE
="JavaScript">
52 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
54 function refreshme() {
56 document
.forms
[0].submit();
61 <style type
="text/css">
63 /* specifically include & exclude from printing */
69 #report_parameters_daterange {
73 #report_results table {
78 /* specifically exclude some from the screen */
80 #report_parameters_daterange {
89 <body
class="body_top">
91 <!-- Required
for the popup date selectors
-->
92 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
94 <span
class='title'><?php
echo htmlspecialchars( xl('Report'), ENT_NOQUOTES
); ?
> -
95 <?php
echo htmlspecialchars( xl('Clinical Quality Measures'), ENT_NOQUOTES
); ?
></span
>
97 <form method
='post' name
='theform' id
='theform' action
='cqm.php'>
99 <div id
="report_parameters">
104 <div style
='float:left'>
109 <?php
xl('Target Date','e'); ?
>:
112 <input type
='text' name
='form_target_date' id
="form_target_date" size
='20' value
='<?php echo htmlspecialchars( $target_date, ENT_QUOTES); ?>'
113 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo htmlspecialchars( xl('yyyy
-mm
-dd hh
:mm
:ss
'), ENT_QUOTES); ?>'>
114 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
115 id
='img_target_date' border
='0' alt
='[?]' style
='cursor:pointer'
116 title
='<?php echo htmlspecialchars( xl('Click here to choose a date
'), ENT_QUOTES); ?>'>
121 <?php
echo htmlspecialchars( xl('Rule Set'), ENT_NOQUOTES
); ?
>:
124 <select name
='form_rule_filter'>
125 <option value
=''>-- <?php
echo htmlspecialchars( xl('Show All'), ENT_NOQUOTES
); ?
> --</option
>
126 <option value
='cqm' <?php
if ($rule_filter == "cqm") echo "selected"; ?
>>
127 <?php
echo htmlspecialchars( xl('Official Clinical Quality Measures (CQM) Rules'), ENT_NOQUOTES
); ?
></option
>
128 <option value
='amc' <?php
if ($rule_filter == "amc") echo "selected"; ?
>>
129 <?php
echo htmlspecialchars( xl('Official Automated Measure Calculation Rules'), ENT_NOQUOTES
); ?
></option
>
130 <option value
='passive_alert' <?php
if ($rule_filter == "passive_alert") echo "selected"; ?
>>
131 <?php
echo htmlspecialchars( xl('Passive Alert Rules'), ENT_NOQUOTES
); ?
></option
>
132 <option value
='active_alert' <?php
if ($rule_filter == "active_alert") echo "selected"; ?
>>
133 <?php
echo htmlspecialchars( xl('Active Alert Rules'), ENT_NOQUOTES
); ?
></option
>
134 <option value
='patient_reminder' <?php
if ($rule_filter == "patient_reminder") echo "selected"; ?
>>
135 <?php
echo htmlspecialchars( xl('Patient Reminder Rules'), ENT_NOQUOTES
); ?
></option
>
140 <?php
echo htmlspecialchars( xl('Plan Set'), ENT_NOQUOTES
); ?
>:
143 <select name
='form_plan_filter'>
144 <option value
=''>-- <?php
echo htmlspecialchars( xl('Show All'), ENT_NOQUOTES
); ?
> --</option
>
145 <option value
='cqm' <?php
if ($plan_filter == "cqm") echo "selected"; ?
>>
146 <?php
echo htmlspecialchars( xl('Official Clinical Quality Measures (CQM) Measure Groups'), ENT_NOQUOTES
); ?
></option
>
147 <option value
='normal' <?php
if ($plan_filter == "normal") echo "selected"; ?
>>
148 <?php
echo htmlspecialchars( xl('Active Plans'), ENT_NOQUOTES
); ?
></option
>
153 <?php
echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES
); ?
>:
158 // Build a drop-down list of providers.
161 $query = "SELECT id, lname, fname FROM users WHERE ".
162 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
164 $ures = sqlStatement($query);
166 echo " <select name='form_provider'>\n";
167 echo " <option value=''>-- " . htmlspecialchars( xl('All (Cumulative)'), ENT_NOQUOTES
) . " --\n";
169 echo " <option value='collate'";
170 if ($_POST['form_provider'] == 'collate') echo " selected";
171 echo ">-- " . htmlspecialchars( xl('All (Collated)'), ENT_NOQUOTES
) . " --\n";
173 while ($urow = sqlFetchArray($ures)) {
174 $provid = $urow['id'];
175 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES
)."'";
176 if ($provid == $_POST['form_provider']) echo " selected";
177 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES
) . "\n";
190 <td align
='left' valign
='middle' height
="100%">
191 <table style
='border-left:1px solid; width:100%; height:100%' >
194 <div style
='margin-left:15px'>
195 <a href
='#' class='css_button' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
197 <?php
echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES
); ?
>
201 <?php
if ($_POST['form_refresh']) { ?
>
202 <a href
='#' class='css_button' onclick
='window.print()'>
204 <?php
echo htmlspecialchars( xl('Print'), ENT_NOQUOTES
); ?
>
216 </div
> <!-- end of search parameters
-->
221 if ($_POST['form_refresh']) {
225 <div id
="report_results">
230 <?php
echo htmlspecialchars( xl('Title'), ENT_NOQUOTES
); ?
>
234 <?php
echo htmlspecialchars( xl('Total Patients'), ENT_NOQUOTES
); ?
>
238 <?php
echo htmlspecialchars( xl('Applicable Patients'), ENT_NOQUOTES
); ?
></a
>
242 <?php
echo htmlspecialchars( xl('Excluded Patients'), ENT_NOQUOTES
); ?
></a
>
246 <?php
echo htmlspecialchars( xl('Passed Patients'), ENT_NOQUOTES
); ?
></a
>
250 <?php
echo htmlspecialchars( xl('Performance Percentage'), ENT_NOQUOTES
); ?
></a
>
254 <tbody
> <!-- added
for better
print-ability
-->
257 //collect the results
258 $dataSheet = test_rules_clinic($provider,$rule_filter,$target_date,"report",'',$plan_filter,$organize_method);
260 $firstProviderFlag = TRUE;
261 $firstPlanFlag = TRUE;
262 $existProvider = FALSE;
263 foreach ($dataSheet as $row) {
267 <tr bgcolor
='<?php echo $bgcolor ?>'>
270 if (isset($row['is_main']) ||
isset($row['is_sub'])) {
271 echo "<td class='detail'>";
272 if (isset($row['is_main'])) {
273 echo "<b>".generate_display_field(array('data_type'=>'1','list_id'=>'clinical_rules'),$row['id'])."</b>";
274 if (!empty($row['cqm_pqri_code']) ||
!empty($row['cqm_nqf_code']) ||
!empty($row['amc_code'])) {
276 if (!empty($row['cqm_pqri_code'])) {
277 echo " " . htmlspecialchars( xl('PQRI') . ":" . $row['cqm_pqri_code'], ENT_NOQUOTES
) . " ";
279 if (!empty($row['cqm_nqf_code'])) {
280 echo " " . htmlspecialchars( xl('NQF') . ":" . $row['cqm_nqf_code'], ENT_NOQUOTES
) . " ";
282 if (!empty($row['amc_code'])) {
283 echo " " . htmlspecialchars( xl('AMC') . ":" . $row['amc_code'], ENT_NOQUOTES
) . " ";
288 else { // isset($row['is_sub'])
289 echo generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$row['action_category']);
290 echo ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$row['action_item']);
293 echo "<td align='center'>" . $row['total_patients'] . "</td>";
294 echo "<td align='center'>" . $row['pass_filter'] . "</td>";
295 echo "<td align='center'>" . $row['excluded'] . "</td>";
296 echo "<td align='center'>" . $row['pass_target'] . "</td>";
297 echo "<td align='center'>" . $row['percentage'] . "</td>";
299 else if (isset($row['is_provider'])) {
300 // Display the provider information
301 if (!$firstProviderFlag) {
302 echo "<tr><td> </td></tr>";
304 echo "<td class='detail' align='center'><b>";
305 echo htmlspecialchars( xl("Provider").": " . $row['prov_lname'] . "," . $row['prov_fname'], ENT_NOQUOTES
);
306 if (!empty($row['npi']) ||
!empty($row['federaltaxid'])) {
308 if (!empty($row['npi'])) {
309 echo " " . htmlspecialchars( xl('NPI') . ":" . $row['npi'], ENT_NOQUOTES
) . " ";
311 if (!empty($row['federaltaxid'])) {
312 echo " " . htmlspecialchars( xl('TID') . ":" . $row['federaltaxid'], ENT_NOQUOTES
) . " ";
317 $firstProviderFlag = FALSE;
318 $existProvider = TRUE;
320 else { // isset($row['is_plan'])
321 if (!$firstPlanFlag && !$existProvider) {
322 echo "<tr><td> </td></tr>";
324 echo "<td class='detail' align='center'><b>";
325 echo htmlspecialchars( xl("Plan"), ENT_NOQUOTES
) . ": ";
326 echo generate_display_field(array('data_type'=>'1','list_id'=>'clinical_plans'),$row['id']);
327 if (!empty($row['cqm_measure_group'])) {
328 echo " (". htmlspecialchars( xl('Measure Group Code') . ": " . $row['cqm_measure_group'], ENT_NOQUOTES
) . ")";
331 $firstPlanFlag = FALSE;
341 </div
> <!-- end of search results
-->
344 <?php
echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES
); ?
>
348 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
354 <!-- stuff
for the popup calendar
-->
355 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
356 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
357 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
358 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
359 <script language
="Javascript">
360 Calendar
.setup({inputField
:"form_target_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_target_date", showsTime
:'true'});