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\Services\UserService
;
27 $form_newid = isset($_POST['form_newid' ]) ?
trim($_POST['form_newid' ]) : '';
28 $form_curpid = isset($_POST['form_curpid' ]) ?
trim($_POST['form_curpid' ]) : '';
29 $form_curid = isset($_POST['form_curid' ]) ?
trim($_POST['form_curid' ]) : '';
30 $form_newloc = isset($_POST['form_newloc' ]) ?
trim($_POST['form_newloc' ]) : '';
31 $form_newuser = isset($_POST['form_newuser']) ?
trim($_POST['form_newuser']) : '';
42 <?php Header
::setupHeader(); ?
>
43 <title
><?php
echo xlt('Chart Tracker'); ?
></title
>
47 function locationSelect() {
48 var f
= document
.forms
[0];
49 var i
= f
.form_newloc
.selectedIndex
;
51 f
.form_newuser
.selectedIndex
= 0;
55 function userSelect() {
56 var f
= document
.forms
[0];
57 var i
= f
.form_newuser
.selectedIndex
;
59 f
.form_newloc
.selectedIndex
= 0;
67 <body
class="body_top">
68 <div
class="container">
72 <h1
><?php
echo xlt('Chart Tracker'); ?
></h1
>
76 <form method
='post' action
='chart_tracker.php' class='form-horizontal' onsubmit
='return top.restoreSession()'>
77 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
80 // This is the place for status messages.
82 if ($form_newloc ||
$form_newuser) {
83 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
84 CsrfUtils
::csrfNotVerified();
86 sqlStatement("INSERT INTO `chart_tracker` (`ct_pid`, `ct_when`, `ct_userid`, `ct_location`) VALUES (?, NOW(), ?, ?)", [$form_curpid, $form_newuser, $form_newloc]);
87 echo "<div class='alert alert-success'>" . xlt('Save Successful for chart ID') . " " . "'" . text($form_curid) . "'.</div>";
93 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
94 CsrfUtils
::csrfNotVerified();
97 // Find out where the chart is now.
98 $query = "SELECT pd.pid, pd.pubpid, pd.fname, pd.mname, pd.lname, " .
99 "pd.ss, pd.DOB, ct.ct_userid, ct.ct_location, ct.ct_when " .
100 "FROM patient_data AS pd " .
101 "LEFT OUTER JOIN chart_tracker AS ct ON ct.ct_pid = pd.pid " .
102 "WHERE pd.pubpid = ? " .
103 "ORDER BY pd.pid ASC, ct.ct_when DESC LIMIT 1";
104 $row = sqlQuery($query, array($form_newid));
106 echo "<div class='alert alert-danger'>" . xlt('Chart ID') . " " . "'" . text($form_newid) . "' " . xlt('not found') . "!</div>";
113 $userService = new UserService();
114 $ct_userid = $row['ct_userid'];
115 $ct_location = $row['ct_location'];
116 $current_location = xlt('Unassigned');
118 $user = $userService->getUser($ct_userid);
119 $current_location = text($user['lname'] . ", " . $user['fname'] . " " . $user['mname'] . " " . oeFormatDateTime($row['ct_when'], "global", true));
120 } elseif ($ct_location) {
121 $current_location = generate_display_field(array('data_type' => '1','list_id' => 'chartloc'), $ct_location);
126 <div
class="col-sm-6 jumbotron jumbotron-fluid p-3">
127 <div
class="form-row">
128 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Patient ID') . ":"; ?
></label
>
129 <div
class='col-sm-9'>
130 <p
class="form-control-static"><?php
echo text($row['pid']) ?
></p
>
131 <input type
='hidden' name
='form_curpid' value
='<?php echo attr($row['pid
']); ?>' />
132 <input type
='hidden' name
='form_curid' value
='<?php echo attr($row['pubpid
']); ?>' />
135 <div
class="form-row">
136 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Name') . ":"; ?
></label
>
137 <div
class='col-sm-9'>
138 <p
class="form-control-static"><?php
echo text($row['lname'] . ", " . $row['fname'] . " " . $row['mname']) ?
></p
>
141 <div
class="form-row">
142 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('DOB') . ":"; ?
></label
>
143 <div
class='col-sm-9'>
144 <p
class="form-control-static"><?php
echo text(oeFormatShortDate($row['DOB'])) ?
></p
>
147 <div
class="form-row">
148 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('SSN') . ":"; ?
></label
>
149 <div
class='col-sm-9'>
150 <p
class="form-control-static"><?php
echo text($row['ss']) ?
></p
>
153 <div
class="form-row">
154 <label
for="form_pat_id" class='col-form-label col-sm-3'><?php
echo xlt('Current Location') . ":"; ?
></label
>
155 <div
class='col-sm-9'>
156 <p
class="form-control-static"><?php
echo text($current_location) ?
></p
>
159 <div
class="form-row">
160 <label
for="form_curr_loc" class='col-form-label col-sm-3'><?php
echo xlt('Check In To') . ":"; ?
></label
>
161 <div
class='col-sm-9'>
162 <?php
generate_form_field(array('data_type' => 1,'field_id' => 'newloc','list_id' => 'chartloc','empty_title' => ''), ''); ?
>
165 <div
class="form-row">
166 <label
for="form_out_to" class='col-form-label col-sm-3'><?php
echo xlt('Our Out To') . ":"; ?
></label
>
167 <div
class='col-sm-9'>
168 <select name
='form_newuser' class='form-control' onchange
='userSelect()'>
169 <option value
=''></option
>
171 $users = $userService->getActiveUsers();
173 foreach ($users as $activeUser) {
174 echo " <option value='" . attr($activeUser['id']) . "'";
175 echo ">" . text($activeUser['lname']) . ', ' . text($activeUser['fname']) . ' ' . text($activeUser['mname']) .
182 <div
class="form-row">
183 <div
class="offset-sm-3 col-sm-9">
184 <button type
='submit' class='btn btn-secondary btn-save' name
='form_save'><?php
echo xlt("Save"); ?
></button
>
193 <div
class="col-sm-6 jumbotron jumbotron-fluid p-3">
194 <div
class="form-row">
195 <label
for='form_newid' class='col-form-label col-sm-3'><?php
echo xlt('New Patient ID') . ":"; ?
></label
>
196 <div
class='col-sm-9'>
197 <input type
='text' name
='form_newid' id
='form_newid' class='form-control' title
='<?php echo xla('Type
or scan the patient identifier here
'); ?>' />
200 <div
class="form-row">
201 <div
class='offset-sm-3 col-sm-9'>
202 <button type
='submit' class='btn btn-secondary btn-search' name
='form_lookup'><?php
echo xlt("Look Up"); ?
></button
>