3 * This feature requires a new list:
5 * INSERT INTO list_options VALUES ('lists','chartloc','Chart Storage Locations',51,0,0);
8 * Copyright (C) 2008-2012 Rod Roark <rod@sunsetsystems.com>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @author Rod Roark <rod@sunsetsystems.com>
23 * @author Brady Miller <brady.g.miller@gmail.com>
24 * @link http://www.open-emr.org
30 require_once("../interface/globals.php");
31 require_once("$srcdir/acl.inc");
32 require_once("$srcdir/options.inc.php");
34 $form_newid = isset($_POST['form_newid' ]) ?
trim($_POST['form_newid' ]) : '';
35 $form_curpid = isset($_POST['form_curpid' ]) ?
trim($_POST['form_curpid' ]) : '';
36 $form_curid = isset($_POST['form_curid' ]) ?
trim($_POST['form_curid' ]) : '';
37 $form_newloc = isset($_POST['form_newloc' ]) ?
trim($_POST['form_newloc' ]) : '';
38 $form_newuser = isset($_POST['form_newuser']) ?
trim($_POST['form_newuser']) : '';
40 if ($form_newuser) $form_newloc = ''; else $form_newuser = 0;
45 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
46 <title
><?php
echo xlt('Chart Tracker'); ?
></title
>
48 <script language
="JavaScript">
50 function locationSelect() {
51 var f
= document
.forms
[0];
52 var i
= f
.form_newloc
.selectedIndex
;
54 f
.form_newuser
.selectedIndex
= 0;
58 function userSelect() {
59 var f
= document
.forms
[0];
60 var i
= f
.form_newuser
.selectedIndex
;
62 f
.form_newloc
.selectedIndex
= 0;
70 <body
class="body_top">
73 echo "<span class='title'>" . xlt('Chart Tracker') . "</span>\n";
78 <form method
='post' action
='chart_tracker.php' onsubmit
='return top.restoreSession()'>
81 // This is the place for status messages.
83 if ($form_newloc ||
$form_newuser) {
84 $tracker = new \entities\
ChartTracker();
85 $tracker->setPid($form_curpid);
86 $tracker->setWhen(new \
DateTime(date('Y-m-d H:i:s')));
87 $tracker->setUserId($form_newuser);
88 $tracker->setLocation($form_newloc);
89 $chartTrackerService = new \services\
ChartTrackerService();
90 $chartTrackerService->trackPatientLocation($tracker);
91 echo "<font color='green'>" . xlt('Save Successful for chart ID') . " " . "'" . text($form_curid) . "'.</font><br />";
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 "<font color='red'>" . xlt('Chart ID') . " " . "'" . text($form_newid) . "' " . xlt('not found') . "!</font><br />";
115 $userService = new \services\
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() . " " . $row['ct_when'] );
123 else if ($ct_location) {
124 $current_location = generate_display_field(array('data_type'=>'1','list_id'=>'chartloc'),$ct_location);
128 echo " <td class='bold'>" . xlt('Patient ID') . ":</td>\n";
129 echo " <td class='text'>" . text($row['pubpid']) .
130 "<input type='hidden' name='form_curpid' value='" . attr($row['pid']) . "' />" .
131 "<input type='hidden' name='form_curid' value='" . attr($row['pubpid']) . "' /></td>\n";
135 echo " <td class='bold'>" . xlt('Name') . ":</td>\n";
136 echo " <td class='text'>" . text( $row['lname'] . ", " . $row['fname'] . " " . $row['mname'] ) . "</td>\n";
140 echo " <td class='bold'>" . xlt('DOB') . ":</td>\n";
141 echo " <td class='text'>" . text($row['DOB']) . "</td>\n";
145 echo " <td class='bold'>" . xlt('SSN') . ":</td>\n";
146 echo " <td class='text'>" . text($row['ss']) . "</td>\n";
150 echo " <td class='bold'>" . xlt('Current Location') . ":</td>\n";
151 // Note that $current_location has already been html escaped
152 echo " <td class='text'>$current_location</td>\n";
156 echo " <td class='bold'>" . xlt('Check In To') . ":</td>\n";
157 echo " <td class='text'>";
158 generate_form_field(array('data_type'=>1,'field_id'=>'newloc','list_id'=>'chartloc','empty_title'=>''), '');
163 echo " <td class='bold'>" . xlt('Or Out To') . ":</td>\n";
164 echo " <td class='text'><select name='form_newuser' onchange='userSelect()'>\n";
165 echo " <option value=''></option>";
167 $users = $userService->getActiveUsers();
169 foreach($users as $activeUser) {
170 echo " <option value='" . attr($activeUser->getId()) . "'";
171 echo ">" . text($activeUser->getLname()) . ', ' . text($activeUser->getFname()) . ' ' . text($activeUser->getMname()) .
175 echo " </select></td>\n";
179 echo " <td> </td>\n";
180 echo " <td class='text'><input type='submit' name='form_save' value='" . xlt('Save') . "' /></td>\n";
184 echo " <td class='text' colspan='2'> </td>\n";
191 <?php
echo xlt('New Patient ID'); ?
>:  
;
194 <input type
='text' name
='form_newid' size
='10' value
=''
195 class='inputtext' title
='<?php echo xla("Type or scan the patient identifier here") ?>' />
200 <td
class='bold'> 
;</td
>
202 <input type
='submit' class='button' name
='form_lookup' value
='<?php echo xla("Look Up"); ?>' />