3 * CDR trigger log report.
5 * Copyright (C) 2015-2017 Brady Miller <brady.g.miller@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @author Brady Miller <brady.g.miller@gmail.com>
20 * @link http://www.open-emr.org
23 //STOP FAKE REGISTER GLOBALS
24 $fake_register_globals=false;
27 require_once("../globals.php");
28 require_once("../../library/patient.inc");
29 require_once "$srcdir/options.inc.php";
30 require_once "$srcdir/clinical_rules.php";
36 <?php
html_header_show();?
>
38 <title
><?php
echo xlt('Alerts Log'); ?
></title
>
40 <?php
$include_standard_style_js = array("datetimepicker"); ?
>
41 <?php
require "{$GLOBALS['srcdir']}/templates/standard_header_template.php"; ?
>
43 <script LANGUAGE
="JavaScript">
45 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
47 $
(document
).ready(function() {
48 $
('.datepicker').datetimepicker({
49 <?php
$datetimepicker_timepicker = true; ?
>
50 <?php
$datetimepicker_showseconds = true; ?
>
51 <?php
$datetimepicker_formatInput = false; ?
>
52 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
53 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
59 <style type
="text/css">
61 /* specifically include & exclude from printing */
67 #report_parameters_daterange {
71 #report_results table {
76 /* specifically exclude some from the screen */
78 #report_parameters_daterange {
87 <body
class="body_top">
89 <!-- Required
for the popup date selectors
-->
90 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
92 <span
class='title'><?php
echo xlt('Alerts Log'); ?
></span
>
94 <form method
='post' name
='theform' id
='theform' action
='cdr_log.php?search=1' onsubmit
='return top.restoreSession()'>
96 <div id
="report_parameters">
101 <div style
='float:left'>
106 <td
class='control-label'>
107 <?php
echo xlt('Begin Date'); ?
>:
110 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr($_POST['form_begin_date
']); ?>'
111 class='datepicker form-control'
112 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
117 <td
class='control-label'>
118 <?php
echo xlt('End Date'); ?
>:
121 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr($_POST['form_end_date
']); ?>'
122 class='datepicker form-control'
123 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
130 <td align
='left' valign
='middle' height
="100%">
131 <table style
='border-left:1px solid; width:100%; height:100%' >
134 <div
class="text-center">
135 <div
class="btn-group" role
="group">
136 <a id
='search_button' href
='#' class='btn btn-default btn-search' onclick
='top.restoreSession(); $("#theform").submit()'>
137 <?php
echo xlt('Search'); ?
>
148 </div
> <!-- end of search parameters
-->
152 <?php
if ($_GET['search'] == 1) { ?
>
154 <div id
="report_results">
159 <?php
echo xlt('Date'); ?
>
163 <?php
echo xlt('Patient ID'); ?
>
167 <?php
echo xlt('User ID'); ?
>
171 <?php
echo xlt('Category'); ?
>
175 <?php
echo xlt('All Alerts'); ?
>
179 <?php
echo xlt('New Alerts'); ?
>
183 <tbody
> <!-- added
for better
print-ability
-->
185 $res = listingCDRReminderLog($_POST['form_begin_date'],$_POST['form_end_date']);
187 while ($row = sqlFetchArray($res)) {
188 //Create category title
189 if ($row['category'] == 'clinical_reminder_widget') {
190 $category_title = xl("Passive Alert");
192 else if ($row['category'] == 'active_reminder_popup') {
193 $category_title = xl("Active Alert");
195 else if ($row['category'] == 'allergy_alert') {
196 $category_title = xl("Allergy Warning");
199 $category_title = $row['category'];
201 //Prepare the targets
202 $all_alerts = json_decode($row['value'], true);
203 if (!empty($row['new_value'])) {
204 $new_alerts = json_decode($row['new_value'], true);
208 <td
><?php
echo text($row['date']); ?
></td
>
209 <td
><?php
echo text($row['pid']); ?
></td
>
210 <td
><?php
echo text($row['uid']); ?
></td
>
211 <td
><?php
echo text($category_title); ?
></td
>
214 //list off all targets with rule information shown when hover
215 foreach ($all_alerts as $targetInfo => $alert) {
216 if ( ($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup') ) {
217 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
218 $catAndTarget = explode(':',$targetInfo);
219 $category = $catAndTarget[0];
220 $target = $catAndTarget[1];
221 echo "<span title='" .attr($rule_title) . "'>" .
222 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
223 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
224 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
227 else { // $row['category'] == 'allergy_alert'
228 echo $alert . "<br>";
235 if (!empty($row['new_value'])) {
236 //list new targets with rule information shown when hover
237 foreach ($new_alerts as $targetInfo => $alert) {
238 if ( ($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup') ) {
239 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
240 $catAndTarget = explode(':',$targetInfo);
241 $category = $catAndTarget[0];
242 $target = $catAndTarget[1];
243 echo "<span title='" .attr($rule_title) . "'>" .
244 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
245 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
246 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
249 else { // $row['category'] == 'allergy_alert'
250 echo $alert . "<br>";
262 } // $row = sqlFetchArray($res) while
266 </div
> <!-- end of search results
-->
268 <?php
} // end of if search button clicked ?>