3 * The Chart Tracker feature facilitates the old traditional paper charts updates.
4 * This feature requires a new list:
6 * INSERT INTO list_options VALUES ('lists','chartloc','Chart Storage Locations',51,0,0);
10 * @link http://www.open-emr.org
11 * @author Rod Roark <rod@sunsetsystems.com>
12 * @author Brady Miller <brady.g.miller@gmail.com>
13 * @author Roberto Vasquez <robertogagliotta@gmail.com>
14 * @Copyright (C) 2008-2012 Rod Roark <rod@sunsetsystems.com>
15 * @Copyright (C) 2011-2018 Brady Miller <brady.g.miller@gmail.com>
16 * @Copyright (C) 2017 Roberto Vasquez <robertogagliotta@gmail.com>
20 require_once("../interface/globals.php");
21 require_once("$srcdir/acl.inc");
22 require_once("$srcdir/options.inc.php");
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
>
47 <script language
="JavaScript">
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">
73 <div
class="col-xs-12">
74 <div
class="page-header">
75 <h1
><?php
echo xlt('Chart Tracker'); ?
></h1
>
80 <form method
='post' action
='chart_tracker.php' class='form-horizontal' onsubmit
='return top.restoreSession()'>
83 // This is the place for status messages.
85 if ($form_newloc ||
$form_newuser) {
86 $tracker = new ChartTracker();
87 $tracker->setPid($form_curpid);
88 $tracker->setWhen(new \
DateTime(date('Y-m-d H:i:s')));
89 $tracker->setUserId($form_newuser);
90 $tracker->setLocation($form_newloc);
91 $chartTrackerService = new ChartTrackerService();
92 $chartTrackerService->trackPatientLocation($tracker);
93 echo "<div class='alert alert-success'>" . xlt('Save Successful for chart ID') . " " . "'" . text($form_curid) . "'.</div>";
99 // Find out where the chart is now.
100 $query = "SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, " .
101 "pd.ss, pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when " .
102 "FROM patient_data AS pd " .
103 "LEFT OUTER JOIN chart_tracker AS ct ON ct.ct_pid = pd.pid " .
104 "WHERE pd.pubpid = ? " .
105 "ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1";
106 $row = sqlQuery($query, array($form_newid));
108 echo "<div class='alert alert-danger'>" . xlt('Chart ID') . " " . "'" . text($form_newid) . "' " . xlt('not found') . "!</div>";
115 $userService = new UserService();
116 $ct_userid = $row['ct_userid'];
117 $ct_location = $row['ct_location'];
118 $current_location = xlt('Unassigned');
120 $user = $userService->getUser($ct_userid);
121 $current_location = text($user->getLname() . ", " . $user->getFname() . " " . $user->getMname() . " " . oeFormatDateTime($row['ct_when'], "global", true));
122 } else if ($ct_location) {
123 $current_location = generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'), $ct_location);
128 <div
class="col-sm-6 well">
129 <div
class="form-group">
130 <label
for="form_pat_id" class='control-label col-sm-3'><?php
echo xlt('Patient ID') . ":"; ?
></label
>
131 <div
class='col-sm-9'>
132 <p
class="form-control-static"><?php
echo text($row['pid']) ?
></p
>
133 <input type
='hidden' name
='form_curpid' value
='<?php echo attr($row['pid
']); ?>' />
134 <input type
='hidden' name
='form_curid' value
='<?php echo attr($row['pubpid
']); ?>' />
137 <div
class="form-group">
138 <label
for="form_pat_id" class='control-label col-sm-3'><?php
echo xlt('Name') . ":"; ?
></label
>
139 <div
class='col-sm-9'>
140 <p
class="form-control-static"><?php
echo text($row['lname'] . ", " . $row['fname'] . " " . $row['mname']) ?
></p
>
143 <div
class="form-group">
144 <label
for="form_pat_id" class='control-label col-sm-3'><?php
echo xlt('DOB') . ":"; ?
></label
>
145 <div
class='col-sm-9'>
146 <p
class="form-control-static"><?php
echo text(oeFormatShortDate($row['DOB'])) ?
></p
>
149 <div
class="form-group">
150 <label
for="form_pat_id" class='control-label col-sm-3'><?php
echo xlt('SSN') . ":"; ?
></label
>
151 <div
class='col-sm-9'>
152 <p
class="form-control-static"><?php
echo text($row['ss']) ?
></p
>
155 <div
class="form-group">
156 <label
for="form_pat_id" class='control-label col-sm-3'><?php
echo xlt('Current Location') . ":"; ?
></label
>
157 <div
class='col-sm-9'>
158 <p
class="form-control-static"><?php
echo text($current_location) ?
></p
>
161 <div
class="form-group">
162 <label
for="form_curr_loc" class='control-label col-sm-3'><?php
echo xlt('Check In To') . ":"; ?
></label
>
163 <div
class='col-sm-9'>
164 <?php
generate_form_field(array('data_type'=>1,'field_id'=>'newloc','list_id'=>'chartloc','empty_title'=>''), ''); ?
>
167 <div
class="form-group">
168 <label
for="form_out_to" class='control-label col-sm-3'><?php
echo xlt('Our Out To') . ":"; ?
></label
>
169 <div
class='col-sm-9'>
170 <select name
='form_newuser' class='form-control' onchange
='userSelect()'>
171 <option value
=''></option
>
173 $users = $userService->getActiveUsers();
175 foreach ($users as $activeUser) {
176 echo " <option value='" . attr($activeUser->getId()) . "'";
177 echo ">" . text($activeUser->getLname()) . ', ' . text($activeUser->getFname()) . ' ' . text($activeUser->getMname()) .
184 <div
class="form-group">
185 <div
class="col-sm-offset-3 col-sm-9">
186 <button type
='submit' class='btn btn-default btn-save' name
='form_save'><?php
echo xlt("Save"); ?
></button
>
196 <div
class="col-sm-6 well">
197 <div
class="form-group">
198 <label
for='form_newid' class='control-label col-sm-3'><?php
echo xlt('New Patient ID') . ":"; ?
></label
>
199 <div
class='col-sm-9'>
200 <input type
='text' name
='form_newid' id
='form_newid' class='form-control' title
='<?php echo xla('Type
or scan the patient identifier here
'); ?>'>
203 <div
class="form-group">
204 <div
class='col-sm-offset-3 col-sm-9'>
205 <button type
='submit' class='btn btn-default btn-search' name
='form_lookup'><?php
echo xlt("Look Up"); ?
></button
>