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
24 use OpenEMR\Core\Header
;
26 require_once("../globals.php");
27 require_once("../../library/patient.inc");
28 require_once "$srcdir/options.inc.php";
29 require_once "$srcdir/clinical_rules.php";
36 <title
><?php
echo xlt('Alerts Log'); ?
></title
>
38 <?php Header
::setupHeader('datetime-picker'); ?
>
40 <script LANGUAGE
="JavaScript">
42 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
44 $
(document
).ready(function() {
45 $
('.datepicker').datetimepicker({
46 <?php
$datetimepicker_timepicker = true; ?
>
47 <?php
$datetimepicker_showseconds = true; ?
>
48 <?php
$datetimepicker_formatInput = false; ?
>
49 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
50 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
56 <style type
="text/css">
58 /* specifically include & exclude from printing */
64 #report_parameters_daterange {
68 #report_results table {
73 /* specifically exclude some from the screen */
75 #report_parameters_daterange {
84 <body
class="body_top">
86 <!-- Required
for the popup date selectors
-->
87 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
89 <span
class='title'><?php
echo xlt('Alerts Log'); ?
></span
>
91 <form method
='post' name
='theform' id
='theform' action
='cdr_log.php?search=1' onsubmit
='return top.restoreSession()'>
93 <div id
="report_parameters">
98 <div style
='float:left'>
103 <td
class='control-label'>
104 <?php
echo xlt('Begin Date'); ?
>:
107 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr($_POST['form_begin_date
']); ?>'
108 class='datepicker form-control'
109 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
114 <td
class='control-label'>
115 <?php
echo xlt('End Date'); ?
>:
118 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr($_POST['form_end_date
']); ?>'
119 class='datepicker form-control'
120 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
127 <td align
='left' valign
='middle' height
="100%">
128 <table style
='border-left:1px solid; width:100%; height:100%' >
131 <div
class="text-center">
132 <div
class="btn-group" role
="group">
133 <a id
='search_button' href
='#' class='btn btn-default btn-search' onclick
='top.restoreSession(); $("#theform").submit()'>
134 <?php
echo xlt('Search'); ?
>
145 </div
> <!-- end of search parameters
-->
149 <?php
if ($_GET['search'] == 1) { ?
>
151 <div id
="report_results">
156 <?php
echo xlt('Date'); ?
>
160 <?php
echo xlt('Patient ID'); ?
>
164 <?php
echo xlt('User ID'); ?
>
168 <?php
echo xlt('Category'); ?
>
172 <?php
echo xlt('All Alerts'); ?
>
176 <?php
echo xlt('New Alerts'); ?
>
180 <tbody
> <!-- added
for better
print-ability
-->
182 $res = listingCDRReminderLog($_POST['form_begin_date'], $_POST['form_end_date']);
184 while ($row = sqlFetchArray($res)) {
185 //Create category title
186 if ($row['category'] == 'clinical_reminder_widget') {
187 $category_title = xl("Passive Alert");
188 } else if ($row['category'] == 'active_reminder_popup') {
189 $category_title = xl("Active Alert");
190 } else if ($row['category'] == 'allergy_alert') {
191 $category_title = xl("Allergy Warning");
193 $category_title = $row['category'];
196 //Prepare the targets
197 $all_alerts = json_decode($row['value'], true);
198 if (!empty($row['new_value'])) {
199 $new_alerts = json_decode($row['new_value'], true);
203 <td
><?php
echo text($row['date']); ?
></td
>
204 <td
><?php
echo text($row['pid']); ?
></td
>
205 <td
><?php
echo text($row['uid']); ?
></td
>
206 <td
><?php
echo text($category_title); ?
></td
>
209 //list off all targets with rule information shown when hover
210 foreach ($all_alerts as $targetInfo => $alert) {
211 if (($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup')) {
212 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
213 $catAndTarget = explode(':', $targetInfo);
214 $category = $catAndTarget[0];
215 $target = $catAndTarget[1];
216 echo "<span title='" .attr($rule_title) . "'>" .
217 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
218 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
219 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
221 } else { // $row['category'] == 'allergy_alert'
222 echo $alert . "<br>";
229 if (!empty($row['new_value'])) {
230 //list new targets with rule information shown when hover
231 foreach ($new_alerts as $targetInfo => $alert) {
232 if (($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup')) {
233 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
234 $catAndTarget = explode(':', $targetInfo);
235 $category = $catAndTarget[0];
236 $target = $catAndTarget[1];
237 echo "<span title='" .attr($rule_title) . "'>" .
238 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
239 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
240 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
242 } else { // $row['category'] == 'allergy_alert'
243 echo $alert . "<br>";
254 } // $row = sqlFetchArray($res) while
258 </div
> <!-- end of search results
-->
260 <?php
} // end of if search button clicked ?>