3 * To be run by cron hourly, sending phone reminders
6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @author Jason 'Toolbox' Oettinger <jason@oettinger.email>
9 * @author Robert Down <robertdown@live.com>
10 * @copyright Copyright (c) 2012 Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2017 Jason 'Toolbox' Oettinger <jason@oettinger.email>
12 * @copyright Copyright (c) 2017 Robert Down <robertdown@live.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(dirname(__FILE__
)."/../../interface/globals.php");
16 require_once($GLOBALS['srcdir'] . "/maviq_phone_api.php");
17 require_once($GLOBALS['srcdir'] . "/reminders.php");
18 require_once($GLOBALS['srcdir'] . "/report_database.inc");
19 use OpenEMR\Core\Header
;
21 //To improve performance and not freeze the session when running this
22 // report, turn off session writing. Note that php session variables
23 // can not be modified after the line below. So, if need to do any php
24 // session work in the future, then will need to remove this line.
25 session_write_close();
27 //Remove time limit, since script can take many minutes
30 // If report_id, then just going to show the report log
31 $report_id = ($_GET['report_id']) ?
$_GET['report_id'] : "";
33 // Set the "nice" level of the process for this script when. When the "nice" level
34 // is increased, this cpu intensive script will have less affect on the performance
35 // of other server activities, albeit it may negatively impact the performance
36 // of this script (note this is only applicable for linux).
37 if (empty($report_id) && !empty($GLOBALS['pat_rem_clin_nice'])) {
38 proc_nice($GLOBALS['pat_rem_clin_nice']);
44 <?php Header
::setupHeader(); ?
>
45 <title
><?php
echo xlt('Patient Reminder Batch Job') ?
></title
>
47 <body
class="body_top container">
49 <?php
require_once("batch_navigation.php");?
>
50 <h1
class="col-md-12">
51 <a href
="batchcom.php"><?php
echo xlt('Batch Communication Tool'); ?
></a
>
52 <small
><?php
echo xlt('Patient Reminder Batch Job'); ?
></small
>
56 // Collect the sender information
63 <div
class="col-md-12">
64 <table
class="table table-striped table-bordered">
66 <td
class='text' align
='left' colspan
="3"><br
>
70 // collect log from a previous run to show
71 $results_log = collectReportDatabase($report_id);
72 $data_log = json_decode($results_log['data'], true);
73 $update_rem_log = $data_log[0];
74 if ($results_log['type'] == "process_send_reminders") {
75 $send_rem_log = $data_log[1];
78 echo "<span class='text'>" . xlt("Date of Report") . ": " . text($results_log['date_report']) . "</span><br><br>";
80 $update_rem_log = update_reminders_batch_method();
81 $send_rem_log = send_reminders();
85 <span
class="text"><?php
echo xlt('The patient reminders have been updated') . ":"?
></span
><br
>
86 <span
class="text"><?php
echo xlt('Total active actions') . ": " . $update_rem_log['total_active_actions'];?
></span
><br
>
87 <span
class="text"><?php
echo xlt('Total active reminders before update') . ": " . $update_rem_log['total_pre_active_reminders'];?
></span
><br
>
88 <span
class="text"><?php
echo xlt('Total unsent reminders before update') . ": " . $update_rem_log['total_pre_unsent_reminders'];?
></span
><br
>
89 <span
class="text"><?php
echo xlt('Total active reminders after update') . ": " . $update_rem_log['total_post_active_reminders'];?
></span
><br
>
90 <span
class="text"><?php
echo xlt('Total unsent reminders after update') . ": " . $update_rem_log['total_post_unsent_reminders'];?
></span
><br
>
91 <span
class="text"><?php
echo xlt('Total new reminders') . ": " . $update_rem_log['number_new_reminders'];?
></span
><br
>
92 <span
class="text"><?php
echo xlt('Total updated reminders') . ": " . $update_rem_log['number_updated_reminders'];?
></span
><br
>
93 <span
class="text"><?php
echo xlt('Total inactivated reminders') . ": " . $update_rem_log['number_inactivated_reminders'];?
></span
><br
>
94 <span
class="text"><?php
echo xlt('Total unchanged reminders') . ": " . $update_rem_log['number_unchanged_reminders'];?
></span
><br
>
96 <?php
if ($results_log['type'] != "process_reminders") { ?
>
97 <br
><span
class="text"><?php
echo xlt('The patient reminders have been sent') . ":"?
></span
><br
>
98 <span
class="text"><?php
echo xlt('Total unsent reminders before sending process') . ": " . $send_rem_log['total_pre_unsent_reminders'];?
></span
><br
>
99 <span
class="text"><?php
echo xlt('Total unsent reminders after sending process') . ": " . $send_rem_log['total_post_unsent_reminders'];?
></span
><br
>
100 <span
class="text"><?php
echo xlt('Total successful reminders sent via email') . ": " . $send_rem_log['number_success_emails'];?
></span
><br
>
101 <span
class="text"><?php
echo xlt('Total failed reminders sent via email') . ": " . $send_rem_log['number_failed_emails'];?
></span
><br
>
102 <span
class="text"><?php
echo xlt('Total successful reminders sent via phone') . ": " . $send_rem_log['number_success_calls'];?
></span
><br
>
103 <span
class="text"><?php
echo xlt('Total failed reminders sent via phone') . ": " . $send_rem_log['number_unchanged_reminders'];?
></span
><br
>
105 <br
><span
class="text"><?php
echo xlt('(Email delivery is immediate, while automated VOIP is sent to the service provider for further processing.)')?
></span
><br
>
106 <?php
} // end of ($results_log['type'] != "process_reminders") ?>
108 <?php
if (report_id
) { ?
>
109 <br
><input type
="button" value
="<?php echo xlt('Back'); ?>" onClick
="top.restoreSession(); window.open('../reports/report_results.php','_self',false)"><br
><br
><br
>
111 <input type
="button" value
="<?php echo xlt('Close'); ?>" onClick
="window.close()">