3 * CDR trigger log report.
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2015-2017 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("../../library/patient.inc");
15 require_once "$srcdir/options.inc.php";
16 require_once "$srcdir/clinical_rules.php";
18 use OpenEMR\Core\Header
;
20 $form_begin_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_begin_date']);
21 $form_end_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_end_date']);
27 <title
><?php
echo xlt('Alerts Log'); ?
></title
>
29 <?php Header
::setupHeader('datetime-picker'); ?
>
31 <script LANGUAGE
="JavaScript">
32 $
(document
).ready(function() {
33 $
('.datepicker').datetimepicker({
34 <?php
$datetimepicker_timepicker = true; ?
>
35 <?php
$datetimepicker_showseconds = true; ?
>
36 <?php
$datetimepicker_formatInput = true; ?
>
37 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
38 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
43 <style type
="text/css">
44 /* specifically include & exclude from printing */
50 #report_parameters_daterange {
54 #report_results table {
59 /* specifically exclude some from the screen */
61 #report_parameters_daterange {
69 <body
class="body_top">
71 <!-- Required
for the popup date selectors
-->
72 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
74 <span
class='title'><?php
echo xlt('Alerts Log'); ?
></span
>
76 <form method
='post' name
='theform' id
='theform' action
='cdr_log.php?search=1' onsubmit
='return top.restoreSession()'>
78 <div id
="report_parameters">
83 <div style
='float:left'>
88 <td
class='control-label'>
89 <?php
echo xlt('Begin Date'); ?
>:
92 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr(oeFormatDateTime($form_begin_date, 0, true)); ?>'
93 class='datepicker form-control'>
98 <td
class='control-label'>
99 <?php
echo xlt('End Date'); ?
>:
102 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr(oeFormatDateTime($form_end_date, 0, true)); ?>'
103 class='datepicker form-control'>
110 <td align
='left' valign
='middle' height
="100%">
111 <table style
='border-left:1px solid; width:100%; height:100%' >
114 <div
class="text-center">
115 <div
class="btn-group" role
="group">
116 <a id
='search_button' href
='#' class='btn btn-default btn-search' onclick
='top.restoreSession(); $("#theform").submit()'>
117 <?php
echo xlt('Search'); ?
>
128 </div
> <!-- end of search parameters
-->
132 <?php
if ($_GET['search'] == 1) { ?
>
134 <div id
="report_results">
139 <?php
echo xlt('Date'); ?
>
143 <?php
echo xlt('Patient ID'); ?
>
147 <?php
echo xlt('User ID'); ?
>
151 <?php
echo xlt('Category'); ?
>
155 <?php
echo xlt('All Alerts'); ?
>
159 <?php
echo xlt('New Alerts'); ?
>
163 <tbody
> <!-- added
for better
print-ability
-->
165 $res = listingCDRReminderLog($form_begin_date, $form_end_date);
167 while ($row = sqlFetchArray($res)) {
168 //Create category title
169 if ($row['category'] == 'clinical_reminder_widget') {
170 $category_title = xl("Passive Alert");
171 } else if ($row['category'] == 'active_reminder_popup') {
172 $category_title = xl("Active Alert");
173 } else if ($row['category'] == 'allergy_alert') {
174 $category_title = xl("Allergy Warning");
176 $category_title = $row['category'];
179 //Prepare the targets
180 $all_alerts = json_decode($row['value'], true);
181 if (!empty($row['new_value'])) {
182 $new_alerts = json_decode($row['new_value'], true);
186 <td
><?php
echo text(oeFormatDateTime($row['date'], "global", true)); ?
></td
>
187 <td
><?php
echo text($row['pid']); ?
></td
>
188 <td
><?php
echo text($row['uid']); ?
></td
>
189 <td
><?php
echo text($category_title); ?
></td
>
192 //list off all targets with rule information shown when hover
193 foreach ($all_alerts as $targetInfo => $alert) {
194 if (($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup')) {
195 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
196 $catAndTarget = explode(':', $targetInfo);
197 $category = $catAndTarget[0];
198 $target = $catAndTarget[1];
199 echo "<span title='" .attr($rule_title) . "'>" .
200 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
201 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
202 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
204 } else { // $row['category'] == 'allergy_alert'
205 echo $alert . "<br>";
212 if (!empty($row['new_value'])) {
213 //list new targets with rule information shown when hover
214 foreach ($new_alerts as $targetInfo => $alert) {
215 if (($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup')) {
216 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
217 $catAndTarget = explode(':', $targetInfo);
218 $category = $catAndTarget[0];
219 $target = $catAndTarget[1];
220 echo "<span title='" .attr($rule_title) . "'>" .
221 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
222 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
223 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
225 } else { // $row['category'] == 'allergy_alert'
226 echo $alert . "<br>";
237 } // $row = sqlFetchArray($res) while
241 </div
> <!-- end of search results
-->
243 <?php
} // end of if search button clicked ?>