4 * The Chart Tracker feature facilitates the old traditional paper charts updates.
5 * This feature requires a new list:
7 * INSERT INTO list_options VALUES ('lists','chartloc','Chart Storage Locations',51,0,0);
11 * @link http://www.open-emr.org
12 * @author Rod Roark <rod@sunsetsystems.com>
13 * @author Brady Miller <brady.g.miller@gmail.com>
14 * @author Roberto Vasquez <robertogagliotta@gmail.com>
15 * @Copyright (C) 2008-2012 Rod Roark <rod@sunsetsystems.com>
16 * @Copyright (C) 2011-2018 Brady Miller <brady.g.miller@gmail.com>
17 * @Copyright (C) 2017 Roberto Vasquez <robertogagliotta@gmail.com>
20 require_once("../interface/globals.php");
21 require_once("$srcdir/options.inc.php");
23 use OpenEMR\Common\Csrf\CsrfUtils
;
24 use OpenEMR\Core\Header
;
25 use OpenEMR\Entities\ChartTracker
;
26 use OpenEMR\Services\ChartTrackerService
;
27 use OpenEMR\Services\UserService
;
29 $form_newid = isset($_POST['form_newid' ]) ?
trim($_POST['form_newid' ]) : '';
30 $form_curpid = isset($_POST['form_curpid' ]) ?
trim($_POST['form_curpid' ]) : '';
31 $form_curid = isset($_POST['form_curid' ]) ?
trim($_POST['form_curid' ]) : '';
32 $form_newloc = isset($_POST['form_newloc' ]) ?
trim($_POST['form_newloc' ]) : '';
33 $form_newuser = isset($_POST['form_newuser']) ?
trim($_POST['form_newuser']) : '';
44 <?php Header
::setupHeader(); ?
>
45 <title
><?php
echo xlt('Chart Tracker'); ?
></title
>
49 function locationSelect() {
50 var f
= document
.forms
[0];
51 var i
= f
.form_newloc
.selectedIndex
;
53 f
.form_newuser
.selectedIndex
= 0;
57 function userSelect() {
58 var f
= document
.forms
[0];
59 var i
= f
.form_newuser
.selectedIndex
;
61 f
.form_newloc
.selectedIndex
= 0;
69 <body
class="body_top">
70 <div
class="container">
74 <h1
><?php
echo xlt('Chart Tracker'); ?
></h1
>
78 <form method
='post' action
='chart_tracker.php' class='form-horizontal' onsubmit
='return top.restoreSession()'>
79 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
82 // This is the place for status messages.
84 if ($form_newloc ||
$form_newuser) {
85 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
86 CsrfUtils
::csrfNotVerified();
89 $tracker = new ChartTracker();
90 $tracker->setPid($form_curpid);
91 $tracker->setWhen(new \
DateTime(date('Y-m-d H:i:s')));
92 $tracker->setUserId($form_newuser);
93 $tracker->setLocation($form_newloc);
94 $chartTrackerService = new ChartTrackerService();
95 $chartTrackerService->trackPatientLocation($tracker);
96 echo "<div class='alert alert-success'>" . xlt('Save Successful for chart ID') . " " . "'" . text($form_curid) . "'.</div>";
102 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
103 CsrfUtils
::csrfNotVerified();
106 // Find out where the chart is now.
107 $query = "SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, " .
108 "pd.ss, pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when " .
109 "FROM patient_data AS pd " .
110 "LEFT OUTER JOIN chart_tracker AS ct ON ct.ct_pid = pd.pid " .
111 "WHERE pd.pubpid = ? " .
112 "ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1";
113 $row = sqlQuery($query, array($form_newid));
115 echo "<div class='alert alert-danger'>" . xlt('Chart ID') . " " . "'" . text($form_newid) . "' " . xlt('not found') . "!</div>";
122 $userService = new UserService();
123 $ct_userid = $row['ct_userid'];
124 $ct_location = $row['ct_location'];
125 $current_location = xlt('Unassigned');
127 $user = $userService->getUser($ct_userid);
128 $current_location = text($user->getLname() . ", " . $user->getFname() . " " . $user->getMname() . " " . oeFormatDateTime($row['ct_when'], "global", true));
129 } elseif ($ct_location) {
130 $current_location = generate_display_field(array('data_type' => '1','list_id' => 'chartloc'), $ct_location);
135 <div
class="col-sm-6 jumbotron jumbotron-fluid p-3">
136 <div
class="form-row">
137 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Patient ID') . ":"; ?
></label
>
138 <div
class='col-sm-9'>
139 <p
class="form-control-static"><?php
echo text($row['pid']) ?
></p
>
140 <input type
='hidden' name
='form_curpid' value
='<?php echo attr($row['pid
']); ?>' />
141 <input type
='hidden' name
='form_curid' value
='<?php echo attr($row['pubpid
']); ?>' />
144 <div
class="form-row">
145 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Name') . ":"; ?
></label
>
146 <div
class='col-sm-9'>
147 <p
class="form-control-static"><?php
echo text($row['lname'] . ", " . $row['fname'] . " " . $row['mname']) ?
></p
>
150 <div
class="form-row">
151 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('DOB') . ":"; ?
></label
>
152 <div
class='col-sm-9'>
153 <p
class="form-control-static"><?php
echo text(oeFormatShortDate($row['DOB'])) ?
></p
>
156 <div
class="form-row">
157 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('SSN') . ":"; ?
></label
>
158 <div
class='col-sm-9'>
159 <p
class="form-control-static"><?php
echo text($row['ss']) ?
></p
>
162 <div
class="form-row">
163 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Current Location') . ":"; ?
></label
>
164 <div
class='col-sm-9'>
165 <p
class="form-control-static"><?php
echo text($current_location) ?
></p
>
168 <div
class="form-row">
169 <label
for="form_curr_loc" class='col-form-label col-sm-3'><?php
echo xlt('Check In To') . ":"; ?
></label
>
170 <div
class='col-sm-9'>
171 <?php
generate_form_field(array('data_type' => 1,'field_id' => 'newloc','list_id' => 'chartloc','empty_title' => ''), ''); ?
>
174 <div
class="form-row">
175 <label
for="form_out_to" class='col-form-label col-sm-3'><?php
echo xlt('Our Out To') . ":"; ?
></label
>
176 <div
class='col-sm-9'>
177 <select name
='form_newuser' class='form-control' onchange
='userSelect()'>
178 <option value
=''></option
>
180 $users = $userService->getActiveUsers();
182 foreach ($users as $activeUser) {
183 echo " <option value='" . attr($activeUser->getId()) . "'";
184 echo ">" . text($activeUser->getLname()) . ', ' . text($activeUser->getFname()) . ' ' . text($activeUser->getMname()) .
191 <div
class="form-row">
192 <div
class="offset-sm-3 col-sm-9">
193 <button type
='submit' class='btn btn-secondary btn-save' name
='form_save'><?php
echo xlt("Save"); ?
></button
>
202 <div
class="col-sm-6 jumbotron jumbotron-fluid p-3">
203 <div
class="form-row">
204 <label
for='form_newid' class='col-form-label col-sm-3'><?php
echo xlt('New Patient ID') . ":"; ?
></label
>
205 <div
class='col-sm-9'>
206 <input type
='text' name
='form_newid' id
='form_newid' class='form-control' title
='<?php echo xla('Type
or scan the patient identifier here
'); ?>' />
209 <div
class="form-row">
210 <div
class='offset-sm-3 col-sm-9'>
211 <button type
='submit' class='btn btn-secondary btn-search' name
='form_lookup'><?php
echo xlt("Look Up"); ?
></button
>