7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2011-2018 Brady Miller <brady.g.miller@gmail.com>
10 * @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/amc.php";
18 use OpenEMR\Common\Csrf\CsrfUtils
;
19 use OpenEMR\Core\Header
;
22 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
23 CsrfUtils
::csrfNotVerified();
27 // Collect form parameters (set defaults if empty)
28 $begin_date = (isset($_POST['form_begin_date'])) ?
DateTimeToYYYYMMDDHHMMSS(trim($_POST['form_begin_date'])) : "";
29 $end_date = (isset($_POST['form_end_date'])) ?
DateTimeToYYYYMMDDHHMMSS(trim($_POST['form_end_date'])) : "";
30 $rule = (isset($_POST['form_rule'])) ?
trim($_POST['form_rule']) : "";
31 $provider = trim($_POST['form_provider'] ??
'');
39 <title
><?php
echo xlt('Automated Measure Calculations (AMC) Tracking'); ?
></title
>
41 <?php Header
::setupHeader('datetime-picker') ?
>
46 var win
= top
.printLogSetup ? top
: opener
.top
;
47 win
.printLogSetup(document
.getElementById('printbutton'));
49 $
('.datepicker').datetimepicker({
50 <?php
$datetimepicker_timepicker = true; ?
>
51 <?php
$datetimepicker_showseconds = true; ?
>
52 <?php
$datetimepicker_formatInput = true; ?
>
53 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
54 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
58 function send_sum(patient_id
,transaction_id
) {
59 if ( $
('#send_sum_flag_' + patient_id +
'_' + transaction_id
).prop('checked') ) {
66 $
.post( "../../library/ajax/amc_misc_data.php",
67 { amc_id
: "send_sum_amc",
70 patient_id
: patient_id
,
71 object_category
: "transactions",
72 object_id
: transaction_id
,
73 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
78 function send_sum_elec(patient_id
,transaction_id
) {
79 if ( $
('#send_sum_elec_flag_' + patient_id +
'_' + transaction_id
).prop('checked') ) {
80 if ( !$
('#send_sum_flag_' + patient_id +
'_' + transaction_id
).prop('checked') ) {
81 $
('#send_sum_elec_flag_' + patient_id +
'_' + transaction_id
).prop("checked", false);
82 alert(<?php
echo xlj('Can not set this unless the Summary of Care Sent toggle is set.'); ?
>);
91 $
.post( "../../library/ajax/amc_misc_data.php",
92 { amc_id
: "send_sum_elec_amc",
95 patient_id
: patient_id
,
96 object_category
: "transactions",
97 object_id
: transaction_id
,
98 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
103 function provide_rec_pat(patient_id
,date_created
) {
104 if ( $
('#provide_rec_pat_flag_' + patient_id
).prop('checked') ) {
105 var mode
= "complete_safe";
108 var mode
= "uncomplete_safe";
110 top
.restoreSession();
111 $
.post( "../../library/ajax/amc_misc_data.php",
112 { amc_id
: "provide_rec_pat_amc",
115 date_created
: date_created
,
116 patient_id
: patient_id
,
117 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
122 function provide_sum_pat(patient_id
,encounter_id
) {
123 if ( $
('#provide_sum_pat_flag_' + patient_id +
'_' + encounter_id
).prop('checked') ) {
129 top
.restoreSession();
130 $
.post( "../../library/ajax/amc_misc_data.php",
131 { amc_id
: "provide_sum_pat_amc",
134 patient_id
: patient_id
,
135 object_category
: "form_encounter",
136 object_id
: encounter_id
,
137 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
146 /* specifically include & exclude from printing */
152 #report_parameters_daterange {
156 #report_results table {
161 /* specifically exclude some from the screen */
163 #report_parameters_daterange {
172 <body
class="body_top">
174 <!-- Required
for the popup date selectors
-->
175 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
177 <span
class='title'><?php
echo xlt('Report'); ?
> -
179 <?php
echo xlt('Automated Measure Calculations (AMC) Tracking'); ?
></span
>
181 <form method
='post' name
='theform' id
='theform' action
='amc_tracking.php' onsubmit
='return top.restoreSession()'>
182 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
184 <div id
="report_parameters">
189 <div style
='float:left'>
194 <td
class='col-form-label'>
195 <?php
echo xlt('Begin Date'); ?
>:
198 <input type
='text' name
='form_begin_date' id
="form_begin_date" size
='20' value
='<?php echo attr(oeFormatDateTime($begin_date, 0, true)); ?>' class='datepicker form-control' />
203 <td
class='col-form-label'>
204 <?php
echo xlt('End Date'); ?
>:
207 <input type
='text' name
='form_end_date' id
="form_end_date" size
='20' value
='<?php echo attr(oeFormatDateTime($end_date, 0, true)); ?>' class='datepicker form-control' />
212 <td
class='col-form-label'>
213 <?php
echo xlt('Rule'); ?
>:
216 <select name
='form_rule' class='form-control'>
217 <option value
='send_sum_amc' <?php
echo ($rule == "send_sum_amc") ?
"selected" : ""; ?
>><?php
echo xlt('Send Summaries with Referrals'); ?
></option
>
218 <option value
='provide_rec_pat_amc' <?php
echo ($rule == "provide_rec_pat_amc") ?
"selected" : ""; ?
>><?php
echo xlt('Patient Requested Medical Records'); ?
></option
>
219 <option value
='provide_sum_pat_amc' <?php
echo ($rule == "provide_sum_pat_amc") ?
"selected" : ""; ?
>><?php
echo xlt('Provide Records to Patient for Visit'); ?
></option
>
225 <td
class='col-form-label'>
226 <?php
echo xlt('Provider'); ?
>:
231 // Build a drop-down list of providers.
234 $query = "SELECT id, lname, fname FROM users WHERE " .
235 "authorized = 1 ORDER BY lname, fname"; //(CHEMED) facility filter
237 $ures = sqlStatement($query);
239 echo " <select name='form_provider' class='form-control'>\n";
240 echo " <option value=''>-- " . xlt('All') . " --\n";
242 while ($urow = sqlFetchArray($ures)) {
243 $provid = $urow['id'];
244 echo " <option value='" . attr($provid) . "'";
245 if ($provid == ($_POST['form_provider'] ??
'')) {
249 echo ">" . text($urow['lname'] . ", " . $urow['fname']) . "\n";
262 <td
class='h-100' align
='left' valign
='middle'>
263 <table
class='w-100 h-100' style
='border-left: 1px solid;'>
266 <div
class="text-center">
267 <div
class="btn-group" role
="group">
268 <a href
='#' class='btn btn-secondary btn-save' onclick
='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
269 <?php
echo xlt('Submit'); ?
>
271 <?php
if (!empty($_POST['form_refresh'])) { ?
>
272 <a href
='#' class='btn btn-secondary btn-print' id
='printbutton'>
273 <?php
echo xlt('Print'); ?
>
285 </div
> <!-- end of search parameters
-->
290 if (!empty($_POST['form_refresh'])) {
294 <div id
="report_results">
295 <table
class='table'>
297 <thead
class='thead-light'>
299 <?php
echo xlt('Patient Name'); ?
>
303 <?php
echo xlt('Patient ID'); ?
>
308 if ($rule == "send_sum_amc") {
309 echo xlt('Referral Date');
310 } elseif ($rule == "provide_rec_pat_amc") {
311 echo xlt('Record Request Date');
312 } else { // $rule == "provide_sum_pat_amc"
313 echo xlt('Encounter Date');
320 if ($rule == "send_sum_amc") {
321 echo xlt('Referral ID');
322 } elseif ($rule == "provide_rec_pat_amc") {
324 } else { // $rule == "provide_sum_pat_amc"
325 echo xlt('Encounter ID');
332 if ($rule == "provide_rec_pat_amc") {
333 echo xlt('Medical Records Sent');
334 } elseif ($rule == "send_sum_amc") {
335 echo xlt('Summary of Care Sent');
336 } else { // $rule == "provide_sum_pat_amc"
337 echo xlt('Medical Summary Given');
342 if ($rule == "send_sum_amc") {
344 echo xlt('Summary of Care Sent Electronically');
350 <tbody
> <!-- added
for better
print-ability
-->
353 // Send the request for information
354 $resultsArray = amcTrackingRequest($rule, $begin_date, $end_date, $provider);
359 foreach ($resultsArray as $result) {
360 echo "<tr bgcolor='" . attr($bgcolor ??
'') . "'>";
361 echo "<td>" . text($result['lname'] . "," . $result['fname']) . "</td>";
362 echo "<td>" . text($result['pid']) . "</td>";
363 echo "<td>" . text(oeFormatDateTime($result['date'], "global", true)) . "</td>";
364 if ($rule == "send_sum_amc" ||
$rule == "provide_sum_pat_amc") {
365 echo "<td>" . text($result['id']) . "</td>";
366 } else { //$rule == "provide_rec_pat_amc"
367 echo "<td> </td>";
370 if ($rule == "send_sum_amc") {
371 echo "<td><input type='checkbox' id='send_sum_flag_" . attr($result['pid']) . "_" . attr($result['id']) . "' onclick='send_sum(" . attr_js($result['pid']) . "," . attr_js($result['id']) . ")'>" . xlt('Yes') . "</td>";
372 echo "<td><input type='checkbox' id='send_sum_elec_flag_" . attr($result['pid']) . "_" . attr($result['id']) . "' onclick='send_sum_elec(" . attr_js($result['pid']) . "," . attr_js($result['id']) . ")'>" . xlt('Yes') . "</td>";
373 } elseif ($rule == "provide_rec_pat_amc") {
374 echo "<td><input type='checkbox' id='provide_rec_pat_flag_" . attr($result['pid']) . "' onclick='provide_rec_pat(" . attr_js($result['pid']) . "," . attr_js($result['date']) . ")'>" . xlt('Yes') . "</td>";
375 } else { //$rule == "provide_sum_pat_amc"
376 echo "<td><input type='checkbox' id='provide_sum_pat_flag_" . attr($result['pid']) . "_" . attr($result['id']) . "' onclick='provide_sum_pat(" . attr_js($result['pid']) . "," . attr_js($result['id']) . ")'>" . xlt('Yes') . "</td>";
385 </div
> <!-- end of search results
-->
388 <?php
echo xlt('Please input search criteria above, and click Submit to view results.'); ?
>
392 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>