updated adodb package to work with php 7.1
[openemr.git] / ccr / createCCRActor.php
blob83e36d19036e5d78cce3ad911079bc3777792048
1 <?php
2 /**
3 * CCR Script.
5 * Copyright (C) 2010 Garden State Health Systems <http://www.gshsys.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 3
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 Garden State Health Systems <http://www.gshsys.com/>
20 * @link http://www.open-emr.org
24 $result = getActorData();
25 while ($row = sqlFetchArray($result[0])) {
27 $e_Actor = $ccr->createElement('Actor');
28 $e_Actors->appendChild($e_Actor);
30 $e_ActorObjectID = $ccr->createElement('ActorObjectID', 'A1234'); // Refer createCCRHeader.php
31 $e_Actor->appendChild($e_ActorObjectID);
33 $e_Person = $ccr->createElement('Person');
34 $e_Actor->appendChild($e_Person);
36 $e_Name = $ccr->createElement('Name');
37 $e_Person->appendChild($e_Name);
39 $e_CurrentName = $ccr->createElement('CurrentName');
40 $e_Name->appendChild($e_CurrentName);
42 $e_Given = $ccr->createElement('Given',$row['fname']);
43 $e_CurrentName->appendChild($e_Given);
45 $e_Family = $ccr->createElement('Family',$row['lname']);
46 $e_CurrentName->appendChild($e_Family);
48 $e_Suffix = $ccr->createElement('Suffix');
49 $e_CurrentName->appendChild($e_Suffix);
51 $e_DateOfBirth = $ccr->createElement('DateOfBirth');
52 $e_Person->appendChild($e_DateOfBirth);
54 $dob = date_create($row['DOB']);
56 $e_ExactDateTime = $ccr->createElement('ExactDateTime',$dob->format('Y-m-d\TH:i:s\Z'));
57 $e_DateOfBirth->appendChild($e_ExactDateTime);
59 $e_Gender = $ccr->createElement('Gender');
60 $e_Person->appendChild($e_Gender);
62 $e_Text = $ccr->createElement('Text',$row['sex']);
63 $e_Gender->appendChild($e_Text);
65 $e_Code = $ccr->createElement('Code');
66 $e_Gender->appendChild($e_Code);
68 $e_Value = $ccr->createElement('Value');
69 $e_Code->appendChild($e_Value);
71 $e_IDs = $ccr->createElement('IDs');
72 $e_Actor->appendChild($e_IDs);
74 $e_Type = $ccr->createElement('Type');
75 $e_IDs->appendChild($e_Type);
77 $e_Text = $ccr->createElement('Text', 'Patient ID');
78 $e_Type->appendChild($e_Text);
80 $e_ID = $ccr->createElement('ID', $row['pid']);
81 $e_IDs->appendChild($e_ID);
83 $e_Source = $ccr->createElement('Source');
84 $e_IDs->appendChild($e_Source);
86 $e_SourceActor = $ccr->createElement('Actor');
87 $e_Source->appendChild($e_SourceActor);
89 $e_ActorID = $ccr->createElement('ActorID', getUuid());
90 $e_SourceActor->appendChild($e_ActorID);
92 // address
93 $e_Address = $ccr->createElement('Address');
94 $e_Actor->appendChild($e_Address);
96 $e_Type = $ccr->createElement('Type');
97 $e_Address->appendChild($e_Type);
99 $e_Text = $ccr->createElement('Text', 'H');
100 $e_Type->appendChild($e_Text);
102 $e_Line1 = $ccr->createElement('Line1', $row['street']);
103 $e_Address->appendChild($e_Line1);
105 $e_Line2 = $ccr->createElement('Line2');
106 $e_Address->appendChild($e_Line1);
108 $e_City = $ccr->createElement('City', $row['city']);
109 $e_Address->appendChild($e_City);
111 $e_State = $ccr->createElement('State', $row['state']);
112 $e_Address->appendChild($e_State);
114 $e_PostalCode = $ccr->createElement('PostalCode', $row['postal_code']);
115 $e_Address->appendChild($e_PostalCode);
117 $e_Telephone = $ccr->createElement('Telephone');
118 $e_Actor->appendChild($e_Telephone);
120 $e_Value = $ccr->createElement('Value', $row['phone_contact']);
121 $e_Telephone->appendChild($e_Value);
123 $e_Source = $ccr->createElement('Source');
124 $e_Actor->appendChild($e_Source);
126 $e_Actor = $ccr->createElement('Actor');
127 $e_Source->appendChild($e_Actor);
129 $e_ActorID = $ccr->createElement('ActorID', $authorID);
130 $e_Actor->appendChild($e_ActorID);
134 $row1 = sqlFetchArray($result[1]);
135 //////// Actor Information Systems
137 $e_Actor = $ccr->createElement('Actor');
138 $e_Actors->appendChild($e_Actor);
140 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $authorID);
141 $e_Actor->appendChild($e_ActorObjectID);
143 $e_InformationSystem = $ccr->createElement('InformationSystem');
144 $e_Actor->appendChild($e_InformationSystem);
146 $e_Name = $ccr->createElement('Name', $row1['facility']);
147 $e_InformationSystem->appendChild($e_Name);
149 $e_Type = $ccr->createElement('Type', 'Facility');
150 $e_InformationSystem->appendChild($e_Type);
152 $e_IDs = $ccr->createElement('IDs');
153 $e_Actor->appendChild($e_IDs);
155 $e_Type = $ccr->createElement('Type');
156 $e_IDs->appendChild($e_Type);
158 $e_Text = $ccr->createElement('Text', '');
159 $e_Type->appendChild($e_Text);
161 $e_ID = $ccr->createElement('ID', '');
162 $e_IDs->appendChild($e_ID);
164 $e_Source = $ccr->createElement('Source');
165 $e_IDs->appendChild($e_Source);
167 $e_SourceActor = $ccr->createElement('Actor');
168 $e_Source->appendChild($e_SourceActor);
170 $e_ActorID = $ccr->createElement('ActorID', $authorID);
171 $e_SourceActor->appendChild($e_ActorID);
173 $e_Address = $ccr->createElement('Address');
174 $e_Actor->appendChild($e_Address);
176 $e_Type = $ccr->createElement('Type');
177 $e_Address->appendChild($e_Type);
179 $e_Text = $ccr->createElement('Text', 'WP');
180 $e_Type->appendChild($e_Text);
182 $e_Line1 = $ccr->createElement('Line1',$row1['street']);
183 $e_Address->appendChild($e_Line1);
185 $e_Line2 = $ccr->createElement('Line2');
186 $e_Address->appendChild($e_Line1);
188 $e_City = $ccr->createElement('City',$row1['city']);
189 $e_Address->appendChild($e_City);
191 $e_State = $ccr->createElement('State',$row1['state'].' ');
192 $e_Address->appendChild($e_State);
194 $e_PostalCode = $ccr->createElement('PostalCode',$row1['postal_code']);
195 $e_Address->appendChild($e_PostalCode);
197 $e_Telephone = $ccr->createElement('Telephone');
198 $e_Actor->appendChild($e_Telephone);
200 $e_Phone = $ccr->createElement('Value',$row1['phone']);
201 $e_Telephone->appendChild($e_Phone);
203 $e_Source = $ccr->createElement('Source');
204 $e_Actor->appendChild($e_Source);
206 $e_Actor = $ccr->createElement('Actor');
207 $e_Source->appendChild($e_Actor);
209 $e_ActorID = $ccr->createElement('ActorID', $authorID);
210 $e_Actor->appendChild($e_ActorID);
212 //////// Actor Information Systems
213 $e_Actor = $ccr->createElement('Actor');
214 $e_Actors->appendChild($e_Actor);
216 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $oemrID);
217 $e_Actor->appendChild($e_ActorObjectID);
219 $e_InformationSystem = $ccr->createElement('InformationSystem');
220 $e_Actor->appendChild($e_InformationSystem);
222 $e_Name = $ccr->createElement('Name', 'OEMR');
223 $e_InformationSystem->appendChild($e_Name);
225 $e_Type = $ccr->createElement('Type', 'OpenEMR');
226 $e_InformationSystem->appendChild($e_Type);
228 $e_Version = $ccr->createElement('Version', '4.x');
229 $e_InformationSystem->appendChild($e_Version);
231 $e_IDs = $ccr->createElement('IDs');
232 $e_Actor->appendChild($e_IDs);
234 $e_Type = $ccr->createElement('Type');
235 $e_IDs->appendChild($e_Type);
237 $e_Text = $ccr->createElement('Text', 'Certification #');
238 $e_Type->appendChild($e_Text);
240 $e_ID = $ccr->createElement('ID', 'EHRX-OEMRXXXXXX-2011');
241 $e_IDs->appendChild($e_ID);
243 $e_Source = $ccr->createElement('Source');
244 $e_IDs->appendChild($e_Source);
246 $e_SourceActor = $ccr->createElement('Actor');
247 $e_Source->appendChild($e_SourceActor);
249 $e_ActorID = $ccr->createElement('ActorID', $authorID);
250 $e_SourceActor->appendChild($e_ActorID);
252 $e_Address = $ccr->createElement('Address');
253 $e_Actor->appendChild($e_Address);
255 $e_Type = $ccr->createElement('Type');
256 $e_Address->appendChild($e_Type);
258 $e_Text = $ccr->createElement('Text', 'WP');
259 $e_Type->appendChild($e_Text);
261 $e_Line1 = $ccr->createElement('Line1','2365 Springs Rd. NE');
262 $e_Address->appendChild($e_Line1);
264 $e_Line2 = $ccr->createElement('Line2');
265 $e_Address->appendChild($e_Line1);
267 $e_City = $ccr->createElement('City','Hickory');
268 $e_Address->appendChild($e_City);
270 $e_State = $ccr->createElement('State','NC ');
271 $e_Address->appendChild($e_State);
273 $e_PostalCode = $ccr->createElement('PostalCode','28601');
274 $e_Address->appendChild($e_PostalCode);
276 $e_Telephone = $ccr->createElement('Telephone');
277 $e_Actor->appendChild($e_Telephone);
279 $e_Phone = $ccr->createElement('Value','000-000-0000');
280 $e_Telephone->appendChild($e_Phone);
282 $e_Source = $ccr->createElement('Source');
283 $e_Actor->appendChild($e_Source);
285 $e_Actor = $ccr->createElement('Actor');
286 $e_Source->appendChild($e_Actor);
288 $e_ActorID = $ccr->createElement('ActorID', $authorID);
289 $e_Actor->appendChild($e_ActorID);
291 while ($row2 = sqlFetchArray($result[2])) {
293 $e_Actor = $ccr->createElement('Actor');
294 $e_Actors->appendChild($e_Actor);
296 $e_ActorObjectID = $ccr->createElement('ActorObjectID', ${"labID{$row2['id']}"});
297 $e_Actor->appendChild($e_ActorObjectID);
299 $e_InformationSystem = $ccr->createElement('InformationSystem');
300 $e_Actor->appendChild($e_InformationSystem);
302 $e_Name = $ccr->createElement('Name', $row2['lname']." ".$row2['fname']);
303 $e_InformationSystem->appendChild($e_Name);
305 $e_Type = $ccr->createElement('Type', 'Lab Service');
306 $e_InformationSystem->appendChild($e_Type);
308 $e_IDs = $ccr->createElement('IDs');
309 $e_Actor->appendChild($e_IDs);
311 $e_Type = $ccr->createElement('Type');
312 $e_IDs->appendChild($e_Type);
314 $e_Text = $ccr->createElement('Text', '');
315 $e_Type->appendChild($e_Text);
317 $e_ID = $ccr->createElement('ID', '');
318 $e_IDs->appendChild($e_ID);
320 $e_Source = $ccr->createElement('Source');
321 $e_IDs->appendChild($e_Source);
323 $e_SourceActor = $ccr->createElement('Actor');
324 $e_Source->appendChild($e_SourceActor);
326 $e_ActorID = $ccr->createElement('ActorID', $authorID);
327 $e_SourceActor->appendChild($e_ActorID);
329 $e_Address = $ccr->createElement('Address');
330 $e_Actor->appendChild($e_Address);
332 $e_Type = $ccr->createElement('Type');
333 $e_Address->appendChild($e_Type);
335 $e_Text = $ccr->createElement('Text', 'WP');
336 $e_Type->appendChild($e_Text);
338 $e_Line1 = $ccr->createElement('Line1',$row2['street']);
339 $e_Address->appendChild($e_Line1);
341 $e_Line2 = $ccr->createElement('Line2');
342 $e_Address->appendChild($e_Line1);
344 $e_City = $ccr->createElement('City',$row2['city']);
345 $e_Address->appendChild($e_City);
347 $e_State = $ccr->createElement('State',$row2['state'].' ');
348 $e_Address->appendChild($e_State);
350 $e_PostalCode = $ccr->createElement('PostalCode',$row2['zip']);
351 $e_Address->appendChild($e_PostalCode);
353 $e_Telephone = $ccr->createElement('Telephone');
354 $e_Actor->appendChild($e_Telephone);
356 $e_Phone = $ccr->createElement('Value',$row2['phone']);
357 $e_Telephone->appendChild($e_Phone);
359 $e_Source = $ccr->createElement('Source');
360 $e_Actor->appendChild($e_Source);
362 $e_Actor = $ccr->createElement('Actor');
363 $e_Source->appendChild($e_Actor);
365 $e_ActorID = $ccr->createElement('ActorID', $authorID);
366 $e_Actor->appendChild($e_ActorID);