2 // ------------------------------------------------------------------------ //
3 // Garden State Health Systems //
4 // Copyright (c) 2010 gshsys.com //
5 // <http://www.gshsys.com/> //
6 // ------------------------------------------------------------------------ //
7 // This program is free software; you can redistribute it and/or modify //
8 // it under the terms of the GNU General Public License as published by //
9 // the Free Software Foundation; either version 2 of the License, or //
10 // (at your option) any later version. //
12 // You may not change or alter any portion of this comment or credits //
13 // of supporting developers from this source code or any supporting //
14 // source code which is considered copyrighted (c) material of the //
15 // original comment or credit authors. //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20 // GNU General Public License for more details. //
22 // You should have received a copy of the GNU General Public License //
23 // along with this program; if not, write to the Free Software //
24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
25 // ------------------------------------------------------------------------ //
27 function getHeaderData() {
29 // Reserved for future use
33 function getMedicationData() {
37 SELECT prescriptions.date_added ,
38 prescriptions.patient_id,
39 prescriptions.start_date,
40 prescriptions.quantity,
41 prescriptions.interval,
44 prescriptions.medication,
46 prescriptions.provider_id
48 WHERE prescriptions.patient_id = ?";
50 $result = sqlStatement($sql, array($pid) );
54 function getImmunizationData() {
57 $sql = " SELECT immunizations.administered_date,
58 immunizations.patient_id,
59 immunizations.vis_date,
61 immunizations.immunization_id,
62 immunizations.manufacturer,
64 FROM immunizations , list_options
65 WHERE immunizations.immunization_id = list_options.option_id and immunizations.patient_id = ? and list_id = 'immunizations' " ;
67 $result = sqlStatement($sql, array($pid) );
72 function getProcedureData() {
81 lists.title as proc_title,
85 form_encounter.onset_date,
86 form_encounter.encounter,
95 left join issue_encounter
96 on issue_encounter.list_id = lists.id
97 left join form_encounter
98 on form_encounter.encounter = issue_encounter.encounter
100 on form_encounter.facility_id = facility.id
102 on form_encounter.provider_id = users.id
103 where lists.type = 'surgery' and lists.pid=?";
105 $result = sqlStatement($sql, array($pid) );
110 function getProblemData() {
115 select fe.encounter, fe.reason, fe.provider_id, u.title, u.fname, u.lname,
116 fe.facility_id, f.street, f.city, f.state, ie.list_id, l.pid, l.title as prob_title, l.diagnosis,
117 l.outcome, l.groupname, l.begdate, l.enddate, l.type, l.comments , l.date, cd.code_text
119 left join issue_encounter as ie
121 left join form_encounter as fe
122 on fe.encounter = ie.encounter
123 left join facility as f
124 on fe.facility_id = f.id
126 on fe.provider_id = u.id
127 left join codes as cd
128 on cd.code = SUBSTRING(l.diagnosis, LOCATE(':',l.diagnosis)+1)
129 where l.type = 'medical_problem' and l.pid=?";
131 $result = sqlStatement($sql, array($pid) );
136 function getAlertData() {
141 select fe.reason, fe.provider_id, fe.facility_id, fe.encounter,
142 ie.list_id, l.pid, l.title as alert_title, l.outcome,
143 l.groupname, l.begdate, l.enddate, l.type, l.diagnosis, l.date ,
144 f.street, f.city, f.state, u.title, u.fname, u.lname, cd.code_text
146 left join issue_encounter as ie
148 left join form_encounter as fe
149 on fe.encounter = ie.encounter
150 left join facility as f
151 on fe.facility_id = f.id
153 on fe.provider_id = u.id
154 left join codes as cd
155 on cd.code = SUBSTRING(l.diagnosis, LOCATE(':',l.diagnosis)+1)
156 where l.type = 'allergy' and l.pid=?";
158 $result = sqlStatement($sql, array($pid) );
163 function getResultData() {
167 // Commented this out, since throws error because the form_ankleinjury table does not
168 // exist in default OpenEMR instance.
171 //select date, pid, groupname, ankle_able_to_bear_weight_steps, ankle_x_ray_interpretation
172 //from form_ankleinjury
175 //$result = sqlStatement($sql, array($pid) );
180 function getActorData() {
184 select fname, lname, DOB, sex, pid, street, city, state, postal_code, phone_contact
188 $result = sqlStatement($sql, array($pid) );