minor fix to prior commit
[openemr.git] / services / PatientService.php
blob42bde441622d39226513b0fb9ff0709ad8763bd9
1 <?php
2 /**
3 * Patient Service
5 * Copyright (C) 2017 Victor Kofia <victor.kofia@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Victor Kofia <victor.kofia@gmail.com>
20 * @link http://www.open-emr.org
23 namespace services;
25 class PatientService {
27 /**
28 * Default constructor.
30 public function __construct() {
33 /**
34 * @param $pid unique patient id
35 * @return recordset
37 public static function getChartTrackerInformationActivity($pid) {
38 $sql = "SELECT ct.ct_when,
39 ct.ct_userid,
40 ct.ct_location,
41 u.username,
42 u.fname,
43 u.mname,
44 u.lname
45 FROM chart_tracker AS ct
46 LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid
47 WHERE ct.ct_pid = ?
48 ORDER BY ct.ct_when DESC";
49 return sqlStatement($sql, array($pid));
52 /**
53 * @return recordset
55 public static function getChartTrackerInformation() {
56 $sql = "SELECT ct.ct_when,
57 u.username,
58 u.fname AS ufname,
59 u.mname AS umname,
60 u.lname AS ulname,
61 p.pubpid,
62 p.fname,
63 p.mname,
64 p.lname
65 FROM chart_tracker AS ct
66 JOIN cttemp ON cttemp.ct_pid = ct.ct_pid AND cttemp.ct_when = ct.ct_when
67 LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid
68 LEFT OUTER JOIN patient_data AS p ON p.pid = ct.ct_pid
69 WHERE ct.ct_userid != 0
70 ORDER BY p.pubpid";
71 return sqlStatement($sql);