Change support desk contact information (#7561)
[openemr.git] / library / patient_tracker.inc.php
blob4796677f26de82327a2202c46505a4d251088d2c
1 <?php
3 /**
4 * library/patient_tracker.inc.php Functions used in the Patient Flow Board.
6 * Functions for use in the Patient Flow Board and Patient Flow Board Reports.
9 * Copyright (C) 2015 Terry Hill <terry@lillysystems.com>
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Terry Hill <terry@lillysystems.com>
24 * @link https://www.open-emr.org
26 * Please help the overall project by sending changes you make to the author and to the OpenEMR community.
30 require_once(dirname(__FILE__) . '/appointments.inc.php');
32 use OpenEMR\Services\AppointmentService;
33 use OpenEMR\Services\PatientTrackerService;
35 function get_Tracker_Time_Interval($tracker_from_time, $tracker_to_time, $allow_sec = false)
37 return PatientTrackerService::get_Tracker_Time_Interval($tracker_from_time, $tracker_to_time, $allow_sec);
40 function fetch_Patient_Tracker_Events($from_date, $to_date, $provider_id = null, $facility_id = null, $form_apptstatus = null, $form_apptcat = null, $form_patient_name = null, $form_patient_id = null)
42 // TODO: refactor this method to use the PatientTrackerService There is a whole heirarchy of inner function calls
43 // inside the fetchAppointments method scattered across several different files which will require creating lots more classes
44 // (ie a bigger undertaking). Leaving this method alone until we can tackle this work at a later date in time.
45 # used to determine which providers to display in the Patient Tracker
46 if ($provider_id == 'ALL') {
47 //set null to $provider id if it's 'all'
48 $provider_id = null;
51 $events = fetchAppointments($from_date, $to_date, $form_patient_id, $provider_id, $facility_id, $form_apptstatus, null, null, $form_apptcat, true, 0, null, $form_patient_name);
52 return $events;
55 #check to see if a status code exist as a check in
56 function is_checkin($option)
58 return AppointmentService::isCheckInStatus($option);
61 #check to see if a status code exist as a check out
62 function is_checkout($option)
64 return AppointmentService::isCheckOutStatus($option);
68 # This function will return false for both below scenarios:
69 # 1. The tracker item does not exist
70 # 2. If the tracker item does exist, but the encounter has not been set
71 function is_tracker_encounter_exist($apptdate, $appttime, $pid, $eid)
73 return PatientTrackerService::is_tracker_encounter_exist($apptdate, $appttime, $pid, $eid);
76 # this function will return the tracker id that is managed
77 # or will return false if no tracker id was managed (in the case of a recurrent appointment)
78 function manage_tracker_status($apptdate, $appttime, $eid, $pid, $user, $status = '', $room = '', $enc_id = '')
80 $patientTrackerService = new PatientTrackerService();
81 return $patientTrackerService->manage_tracker_status($apptdate, $appttime, $eid, $pid, $user, $status, $room, $enc_id);
84 # This is used to break apart the information contained in the notes field of
85 #list_options. Currently the color and alert time are the only items stored
86 function collectApptStatusSettings($option)
88 return PatientTrackerService::collectApptStatusSettings($option);
91 # This is used to collect the tracker elements for the Patient Flow Board Report
92 # returns the elements in an array
93 function collect_Tracker_Elements($trackerid)
95 return PatientTrackerService::collect_Tracker_Elements($trackerid);
98 #used to determine check in time
99 function collect_checkin($trackerid)
101 return PatientTrackerService::collect_checkin($trackerid);
104 #used to determine check out time
105 function collect_checkout($trackerid)
107 return PatientTrackerService::collect_checkout($trackerid);
110 /* get information the statuses of the appointments*/
111 function getApptStatus($appointments)
113 return PatientTrackerService::getApptStatus($appointments);