support spaces and colons as modifier separators, as suggest by yehster
[openemr.git] / ccr / createCCRActor.php
blob719dfc5c43f2844219f139cc7315278c9c13cfca
1 <?php
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. //
11 // //
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. //
16 // //
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. //
21 // //
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 // ------------------------------------------------------------------------ //
28 $result = getActorData();
29 while ($row = sqlFetchArray($result[0])) {
31 $e_Actor = $ccr->createElement('Actor');
32 $e_Actors->appendChild($e_Actor);
34 $e_ActorObjectID = $ccr->createElement('ActorObjectID', 'A1234'); // Refer createCCRHeader.php
35 $e_Actor->appendChild($e_ActorObjectID);
37 $e_Person = $ccr->createElement('Person');
38 $e_Actor->appendChild($e_Person);
40 $e_Name = $ccr->createElement('Name');
41 $e_Person->appendChild($e_Name);
43 $e_CurrentName = $ccr->createElement('CurrentName');
44 $e_Name->appendChild($e_CurrentName);
46 $e_Given = $ccr->createElement('Given',$row['fname']);
47 $e_CurrentName->appendChild($e_Given);
49 $e_Family = $ccr->createElement('Family',$row['lname']);
50 $e_CurrentName->appendChild($e_Family);
52 $e_Suffix = $ccr->createElement('Suffix');
53 $e_CurrentName->appendChild($e_Suffix);
55 $e_DateOfBirth = $ccr->createElement('DateOfBirth');
56 $e_Person->appendChild($e_DateOfBirth);
58 $e_ExactDateTime = $ccr->createElement('ExactDateTime',$row['DOB']);
59 $e_DateOfBirth->appendChild($e_ExactDateTime);
61 $e_Gender = $ccr->createElement('Gender');
62 $e_Person->appendChild($e_Gender);
64 $e_Text = $ccr->createElement('Text',$row['sex']);
65 $e_Gender->appendChild($e_Text);
67 $e_Code = $ccr->createElement('Code');
68 $e_Gender->appendChild($e_Code);
70 $e_Value = $ccr->createElement('Value');
71 $e_Code->appendChild($e_Value);
73 $e_IDs = $ccr->createElement('IDs');
74 $e_Actor->appendChild($e_IDs);
76 $e_Type = $ccr->createElement('Type');
77 $e_IDs->appendChild($e_Type);
79 $e_Text = $ccr->createElement('Text', 'Patient ID');
80 $e_Type->appendChild($e_Text);
82 $e_ID = $ccr->createElement('ID', $row['pid']);
83 $e_IDs->appendChild($e_ID);
85 $e_Source = $ccr->createElement('Source');
86 $e_IDs->appendChild($e_Source);
88 $e_SourceActor = $ccr->createElement('Actor');
89 $e_Source->appendChild($e_SourceActor);
91 $e_ActorID = $ccr->createElement('ActorID', getUuid());
92 $e_SourceActor->appendChild($e_ActorID);
94 // address
95 $e_Address = $ccr->createElement('Address');
96 $e_Actor->appendChild($e_Address);
98 $e_Type = $ccr->createElement('Type');
99 $e_Address->appendChild($e_Type);
101 $e_Text = $ccr->createElement('Text', 'H');
102 $e_Type->appendChild($e_Text);
104 $e_Line1 = $ccr->createElement('Line1', $row['street']);
105 $e_Address->appendChild($e_Line1);
107 $e_Line2 = $ccr->createElement('Line2');
108 $e_Address->appendChild($e_Line1);
110 $e_City = $ccr->createElement('City', $row['city']);
111 $e_Address->appendChild($e_City);
113 $e_State = $ccr->createElement('State', $row['state']);
114 $e_Address->appendChild($e_State);
116 $e_PostalCode = $ccr->createElement('PostalCode', $row['postal_code']);
117 $e_Address->appendChild($e_PostalCode);
119 $e_Telephone = $ccr->createElement('Telephone');
120 $e_Actor->appendChild($e_Telephone);
122 $e_Value = $ccr->createElement('Value', $row['phone_contact']);
123 $e_Telephone->appendChild($e_Value);
125 $e_Source = $ccr->createElement('Source');
126 $e_Actor->appendChild($e_Source);
128 $e_Actor = $ccr->createElement('Actor');
129 $e_Source->appendChild($e_Actor);
131 $e_ActorID = $ccr->createElement('ActorID', $authorID);
132 $e_Actor->appendChild($e_ActorID);
136 $row1 = sqlFetchArray($result[1]);
137 //////// Actor Information Systems
139 $e_Actor = $ccr->createElement('Actor');
140 $e_Actors->appendChild($e_Actor);
142 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $authorID);
143 $e_Actor->appendChild($e_ActorObjectID);
145 $e_InformationSystem = $ccr->createElement('InformationSystem');
146 $e_Actor->appendChild($e_InformationSystem);
148 $e_Name = $ccr->createElement('Name', $row1['facility']);
149 $e_InformationSystem->appendChild($e_Name);
151 $e_Type = $ccr->createElement('Type', 'Facility');
152 $e_InformationSystem->appendChild($e_Type);
154 $e_IDs = $ccr->createElement('IDs');
155 $e_Actor->appendChild($e_IDs);
157 $e_Type = $ccr->createElement('Type');
158 $e_IDs->appendChild($e_Type);
160 $e_Text = $ccr->createElement('Text', '');
161 $e_Type->appendChild($e_Text);
163 $e_ID = $ccr->createElement('ID', '');
164 $e_IDs->appendChild($e_ID);
166 $e_Source = $ccr->createElement('Source');
167 $e_IDs->appendChild($e_Source);
169 $e_SourceActor = $ccr->createElement('Actor');
170 $e_Source->appendChild($e_SourceActor);
172 $e_ActorID = $ccr->createElement('ActorID', $authorID);
173 $e_SourceActor->appendChild($e_ActorID);
175 $e_Address = $ccr->createElement('Address');
176 $e_Actor->appendChild($e_Address);
178 $e_Type = $ccr->createElement('Type');
179 $e_Address->appendChild($e_Type);
181 $e_Text = $ccr->createElement('Text', 'WP');
182 $e_Type->appendChild($e_Text);
184 $e_Line1 = $ccr->createElement('Line1',$row1['street']);
185 $e_Address->appendChild($e_Line1);
187 $e_Line2 = $ccr->createElement('Line2');
188 $e_Address->appendChild($e_Line1);
190 $e_City = $ccr->createElement('City',$row1['city']);
191 $e_Address->appendChild($e_City);
193 $e_State = $ccr->createElement('State',$row1['state'].' ');
194 $e_Address->appendChild($e_State);
196 $e_PostalCode = $ccr->createElement('PostalCode',$row1['postal_code']);
197 $e_Address->appendChild($e_PostalCode);
199 $e_Telephone = $ccr->createElement('Telephone');
200 $e_Actor->appendChild($e_Telephone);
202 $e_Phone = $ccr->createElement('Value',$row1['phone']);
203 $e_Telephone->appendChild($e_Phone);
205 $e_Source = $ccr->createElement('Source');
206 $e_Actor->appendChild($e_Source);
208 $e_Actor = $ccr->createElement('Actor');
209 $e_Source->appendChild($e_Actor);
211 $e_ActorID = $ccr->createElement('ActorID', $authorID);
212 $e_Actor->appendChild($e_ActorID);
214 //////// Actor Information Systems
215 $e_Actor = $ccr->createElement('Actor');
216 $e_Actors->appendChild($e_Actor);
218 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $oemrID);
219 $e_Actor->appendChild($e_ActorObjectID);
221 $e_InformationSystem = $ccr->createElement('InformationSystem');
222 $e_Actor->appendChild($e_InformationSystem);
224 $e_Name = $ccr->createElement('Name', 'OEMR');
225 $e_InformationSystem->appendChild($e_Name);
227 $e_Type = $ccr->createElement('Type', 'OpenEMR');
228 $e_InformationSystem->appendChild($e_Type);
230 $e_Version = $ccr->createElement('Version', '4.x');
231 $e_InformationSystem->appendChild($e_Version);
233 $e_IDs = $ccr->createElement('IDs');
234 $e_Actor->appendChild($e_IDs);
236 $e_Type = $ccr->createElement('Type');
237 $e_IDs->appendChild($e_Type);
239 $e_Text = $ccr->createElement('Text', 'Certification #');
240 $e_Type->appendChild($e_Text);
242 $e_ID = $ccr->createElement('ID', 'EHRX-OEMRXXXXXX-2011');
243 $e_IDs->appendChild($e_ID);
245 $e_Source = $ccr->createElement('Source');
246 $e_IDs->appendChild($e_Source);
248 $e_SourceActor = $ccr->createElement('Actor');
249 $e_Source->appendChild($e_SourceActor);
251 $e_ActorID = $ccr->createElement('ActorID', $authorID);
252 $e_SourceActor->appendChild($e_ActorID);
254 $e_Address = $ccr->createElement('Address');
255 $e_Actor->appendChild($e_Address);
257 $e_Type = $ccr->createElement('Type');
258 $e_Address->appendChild($e_Type);
260 $e_Text = $ccr->createElement('Text', 'WP');
261 $e_Type->appendChild($e_Text);
263 $e_Line1 = $ccr->createElement('Line1','2365 Springs Rd. NE');
264 $e_Address->appendChild($e_Line1);
266 $e_Line2 = $ccr->createElement('Line2');
267 $e_Address->appendChild($e_Line1);
269 $e_City = $ccr->createElement('City','Hickory');
270 $e_Address->appendChild($e_City);
272 $e_State = $ccr->createElement('State','NC ');
273 $e_Address->appendChild($e_State);
275 $e_PostalCode = $ccr->createElement('PostalCode','28601');
276 $e_Address->appendChild($e_PostalCode);
278 $e_Telephone = $ccr->createElement('Telephone');
279 $e_Actor->appendChild($e_Telephone);
281 $e_Phone = $ccr->createElement('Value','000-000-0000');
282 $e_Telephone->appendChild($e_Phone);
284 $e_Source = $ccr->createElement('Source');
285 $e_Actor->appendChild($e_Source);
287 $e_Actor = $ccr->createElement('Actor');
288 $e_Source->appendChild($e_Actor);
290 $e_ActorID = $ccr->createElement('ActorID', $authorID);
291 $e_Actor->appendChild($e_ActorID);
293 while ($row2 = sqlFetchArray($result[2])) {
295 $e_Actor = $ccr->createElement('Actor');
296 $e_Actors->appendChild($e_Actor);
298 $e_ActorObjectID = $ccr->createElement('ActorObjectID', ${"labID{$row2['id']}"});
299 $e_Actor->appendChild($e_ActorObjectID);
301 $e_InformationSystem = $ccr->createElement('InformationSystem');
302 $e_Actor->appendChild($e_InformationSystem);
304 $e_Name = $ccr->createElement('Name', $row2['lname']." ".$row2['fname']);
305 $e_InformationSystem->appendChild($e_Name);
307 $e_Type = $ccr->createElement('Type', 'Lab Service');
308 $e_InformationSystem->appendChild($e_Type);
310 $e_IDs = $ccr->createElement('IDs');
311 $e_Actor->appendChild($e_IDs);
313 $e_Type = $ccr->createElement('Type');
314 $e_IDs->appendChild($e_Type);
316 $e_Text = $ccr->createElement('Text', '');
317 $e_Type->appendChild($e_Text);
319 $e_ID = $ccr->createElement('ID', '');
320 $e_IDs->appendChild($e_ID);
322 $e_Source = $ccr->createElement('Source');
323 $e_IDs->appendChild($e_Source);
325 $e_SourceActor = $ccr->createElement('Actor');
326 $e_Source->appendChild($e_SourceActor);
328 $e_ActorID = $ccr->createElement('ActorID', $authorID);
329 $e_SourceActor->appendChild($e_ActorID);
331 $e_Address = $ccr->createElement('Address');
332 $e_Actor->appendChild($e_Address);
334 $e_Type = $ccr->createElement('Type');
335 $e_Address->appendChild($e_Type);
337 $e_Text = $ccr->createElement('Text', 'WP');
338 $e_Type->appendChild($e_Text);
340 $e_Line1 = $ccr->createElement('Line1',$row2['street']);
341 $e_Address->appendChild($e_Line1);
343 $e_Line2 = $ccr->createElement('Line2');
344 $e_Address->appendChild($e_Line1);
346 $e_City = $ccr->createElement('City',$row2['city']);
347 $e_Address->appendChild($e_City);
349 $e_State = $ccr->createElement('State',$row2['state'].' ');
350 $e_Address->appendChild($e_State);
352 $e_PostalCode = $ccr->createElement('PostalCode',$row2['zip']);
353 $e_Address->appendChild($e_PostalCode);
355 $e_Telephone = $ccr->createElement('Telephone');
356 $e_Actor->appendChild($e_Telephone);
358 $e_Phone = $ccr->createElement('Value',$row2['phone']);
359 $e_Telephone->appendChild($e_Phone);
361 $e_Source = $ccr->createElement('Source');
362 $e_Actor->appendChild($e_Source);
364 $e_Actor = $ccr->createElement('Actor');
365 $e_Source->appendChild($e_Actor);
367 $e_ActorID = $ccr->createElement('ActorID', $authorID);
368 $e_Actor->appendChild($e_ActorID);