edihistory -- revisions and cleanup of 277 claim status functions
[openemr.git] / ccr / createCCRActor.php
blobfbbc5a530f67c10e58c2f48bb3a86798b9831100
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 $dob = date_create($row['DOB']);
60 $e_ExactDateTime = $ccr->createElement('ExactDateTime',$dob->format('Y-m-d\TH:i:s\Z'));
61 $e_DateOfBirth->appendChild($e_ExactDateTime);
63 $e_Gender = $ccr->createElement('Gender');
64 $e_Person->appendChild($e_Gender);
66 $e_Text = $ccr->createElement('Text',$row['sex']);
67 $e_Gender->appendChild($e_Text);
69 $e_Code = $ccr->createElement('Code');
70 $e_Gender->appendChild($e_Code);
72 $e_Value = $ccr->createElement('Value');
73 $e_Code->appendChild($e_Value);
75 $e_IDs = $ccr->createElement('IDs');
76 $e_Actor->appendChild($e_IDs);
78 $e_Type = $ccr->createElement('Type');
79 $e_IDs->appendChild($e_Type);
81 $e_Text = $ccr->createElement('Text', 'Patient ID');
82 $e_Type->appendChild($e_Text);
84 $e_ID = $ccr->createElement('ID', $row['pid']);
85 $e_IDs->appendChild($e_ID);
87 $e_Source = $ccr->createElement('Source');
88 $e_IDs->appendChild($e_Source);
90 $e_SourceActor = $ccr->createElement('Actor');
91 $e_Source->appendChild($e_SourceActor);
93 $e_ActorID = $ccr->createElement('ActorID', getUuid());
94 $e_SourceActor->appendChild($e_ActorID);
96 // address
97 $e_Address = $ccr->createElement('Address');
98 $e_Actor->appendChild($e_Address);
100 $e_Type = $ccr->createElement('Type');
101 $e_Address->appendChild($e_Type);
103 $e_Text = $ccr->createElement('Text', 'H');
104 $e_Type->appendChild($e_Text);
106 $e_Line1 = $ccr->createElement('Line1', $row['street']);
107 $e_Address->appendChild($e_Line1);
109 $e_Line2 = $ccr->createElement('Line2');
110 $e_Address->appendChild($e_Line1);
112 $e_City = $ccr->createElement('City', $row['city']);
113 $e_Address->appendChild($e_City);
115 $e_State = $ccr->createElement('State', $row['state']);
116 $e_Address->appendChild($e_State);
118 $e_PostalCode = $ccr->createElement('PostalCode', $row['postal_code']);
119 $e_Address->appendChild($e_PostalCode);
121 $e_Telephone = $ccr->createElement('Telephone');
122 $e_Actor->appendChild($e_Telephone);
124 $e_Value = $ccr->createElement('Value', $row['phone_contact']);
125 $e_Telephone->appendChild($e_Value);
127 $e_Source = $ccr->createElement('Source');
128 $e_Actor->appendChild($e_Source);
130 $e_Actor = $ccr->createElement('Actor');
131 $e_Source->appendChild($e_Actor);
133 $e_ActorID = $ccr->createElement('ActorID', $authorID);
134 $e_Actor->appendChild($e_ActorID);
138 $row1 = sqlFetchArray($result[1]);
139 //////// Actor Information Systems
141 $e_Actor = $ccr->createElement('Actor');
142 $e_Actors->appendChild($e_Actor);
144 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $authorID);
145 $e_Actor->appendChild($e_ActorObjectID);
147 $e_InformationSystem = $ccr->createElement('InformationSystem');
148 $e_Actor->appendChild($e_InformationSystem);
150 $e_Name = $ccr->createElement('Name', $row1['facility']);
151 $e_InformationSystem->appendChild($e_Name);
153 $e_Type = $ccr->createElement('Type', 'Facility');
154 $e_InformationSystem->appendChild($e_Type);
156 $e_IDs = $ccr->createElement('IDs');
157 $e_Actor->appendChild($e_IDs);
159 $e_Type = $ccr->createElement('Type');
160 $e_IDs->appendChild($e_Type);
162 $e_Text = $ccr->createElement('Text', '');
163 $e_Type->appendChild($e_Text);
165 $e_ID = $ccr->createElement('ID', '');
166 $e_IDs->appendChild($e_ID);
168 $e_Source = $ccr->createElement('Source');
169 $e_IDs->appendChild($e_Source);
171 $e_SourceActor = $ccr->createElement('Actor');
172 $e_Source->appendChild($e_SourceActor);
174 $e_ActorID = $ccr->createElement('ActorID', $authorID);
175 $e_SourceActor->appendChild($e_ActorID);
177 $e_Address = $ccr->createElement('Address');
178 $e_Actor->appendChild($e_Address);
180 $e_Type = $ccr->createElement('Type');
181 $e_Address->appendChild($e_Type);
183 $e_Text = $ccr->createElement('Text', 'WP');
184 $e_Type->appendChild($e_Text);
186 $e_Line1 = $ccr->createElement('Line1',$row1['street']);
187 $e_Address->appendChild($e_Line1);
189 $e_Line2 = $ccr->createElement('Line2');
190 $e_Address->appendChild($e_Line1);
192 $e_City = $ccr->createElement('City',$row1['city']);
193 $e_Address->appendChild($e_City);
195 $e_State = $ccr->createElement('State',$row1['state'].' ');
196 $e_Address->appendChild($e_State);
198 $e_PostalCode = $ccr->createElement('PostalCode',$row1['postal_code']);
199 $e_Address->appendChild($e_PostalCode);
201 $e_Telephone = $ccr->createElement('Telephone');
202 $e_Actor->appendChild($e_Telephone);
204 $e_Phone = $ccr->createElement('Value',$row1['phone']);
205 $e_Telephone->appendChild($e_Phone);
207 $e_Source = $ccr->createElement('Source');
208 $e_Actor->appendChild($e_Source);
210 $e_Actor = $ccr->createElement('Actor');
211 $e_Source->appendChild($e_Actor);
213 $e_ActorID = $ccr->createElement('ActorID', $authorID);
214 $e_Actor->appendChild($e_ActorID);
216 //////// Actor Information Systems
217 $e_Actor = $ccr->createElement('Actor');
218 $e_Actors->appendChild($e_Actor);
220 $e_ActorObjectID = $ccr->createElement('ActorObjectID', $oemrID);
221 $e_Actor->appendChild($e_ActorObjectID);
223 $e_InformationSystem = $ccr->createElement('InformationSystem');
224 $e_Actor->appendChild($e_InformationSystem);
226 $e_Name = $ccr->createElement('Name', 'OEMR');
227 $e_InformationSystem->appendChild($e_Name);
229 $e_Type = $ccr->createElement('Type', 'OpenEMR');
230 $e_InformationSystem->appendChild($e_Type);
232 $e_Version = $ccr->createElement('Version', '4.x');
233 $e_InformationSystem->appendChild($e_Version);
235 $e_IDs = $ccr->createElement('IDs');
236 $e_Actor->appendChild($e_IDs);
238 $e_Type = $ccr->createElement('Type');
239 $e_IDs->appendChild($e_Type);
241 $e_Text = $ccr->createElement('Text', 'Certification #');
242 $e_Type->appendChild($e_Text);
244 $e_ID = $ccr->createElement('ID', 'EHRX-OEMRXXXXXX-2011');
245 $e_IDs->appendChild($e_ID);
247 $e_Source = $ccr->createElement('Source');
248 $e_IDs->appendChild($e_Source);
250 $e_SourceActor = $ccr->createElement('Actor');
251 $e_Source->appendChild($e_SourceActor);
253 $e_ActorID = $ccr->createElement('ActorID', $authorID);
254 $e_SourceActor->appendChild($e_ActorID);
256 $e_Address = $ccr->createElement('Address');
257 $e_Actor->appendChild($e_Address);
259 $e_Type = $ccr->createElement('Type');
260 $e_Address->appendChild($e_Type);
262 $e_Text = $ccr->createElement('Text', 'WP');
263 $e_Type->appendChild($e_Text);
265 $e_Line1 = $ccr->createElement('Line1','2365 Springs Rd. NE');
266 $e_Address->appendChild($e_Line1);
268 $e_Line2 = $ccr->createElement('Line2');
269 $e_Address->appendChild($e_Line1);
271 $e_City = $ccr->createElement('City','Hickory');
272 $e_Address->appendChild($e_City);
274 $e_State = $ccr->createElement('State','NC ');
275 $e_Address->appendChild($e_State);
277 $e_PostalCode = $ccr->createElement('PostalCode','28601');
278 $e_Address->appendChild($e_PostalCode);
280 $e_Telephone = $ccr->createElement('Telephone');
281 $e_Actor->appendChild($e_Telephone);
283 $e_Phone = $ccr->createElement('Value','000-000-0000');
284 $e_Telephone->appendChild($e_Phone);
286 $e_Source = $ccr->createElement('Source');
287 $e_Actor->appendChild($e_Source);
289 $e_Actor = $ccr->createElement('Actor');
290 $e_Source->appendChild($e_Actor);
292 $e_ActorID = $ccr->createElement('ActorID', $authorID);
293 $e_Actor->appendChild($e_ActorID);
295 while ($row2 = sqlFetchArray($result[2])) {
297 $e_Actor = $ccr->createElement('Actor');
298 $e_Actors->appendChild($e_Actor);
300 $e_ActorObjectID = $ccr->createElement('ActorObjectID', ${"labID{$row2['id']}"});
301 $e_Actor->appendChild($e_ActorObjectID);
303 $e_InformationSystem = $ccr->createElement('InformationSystem');
304 $e_Actor->appendChild($e_InformationSystem);
306 $e_Name = $ccr->createElement('Name', $row2['lname']." ".$row2['fname']);
307 $e_InformationSystem->appendChild($e_Name);
309 $e_Type = $ccr->createElement('Type', 'Lab Service');
310 $e_InformationSystem->appendChild($e_Type);
312 $e_IDs = $ccr->createElement('IDs');
313 $e_Actor->appendChild($e_IDs);
315 $e_Type = $ccr->createElement('Type');
316 $e_IDs->appendChild($e_Type);
318 $e_Text = $ccr->createElement('Text', '');
319 $e_Type->appendChild($e_Text);
321 $e_ID = $ccr->createElement('ID', '');
322 $e_IDs->appendChild($e_ID);
324 $e_Source = $ccr->createElement('Source');
325 $e_IDs->appendChild($e_Source);
327 $e_SourceActor = $ccr->createElement('Actor');
328 $e_Source->appendChild($e_SourceActor);
330 $e_ActorID = $ccr->createElement('ActorID', $authorID);
331 $e_SourceActor->appendChild($e_ActorID);
333 $e_Address = $ccr->createElement('Address');
334 $e_Actor->appendChild($e_Address);
336 $e_Type = $ccr->createElement('Type');
337 $e_Address->appendChild($e_Type);
339 $e_Text = $ccr->createElement('Text', 'WP');
340 $e_Type->appendChild($e_Text);
342 $e_Line1 = $ccr->createElement('Line1',$row2['street']);
343 $e_Address->appendChild($e_Line1);
345 $e_Line2 = $ccr->createElement('Line2');
346 $e_Address->appendChild($e_Line1);
348 $e_City = $ccr->createElement('City',$row2['city']);
349 $e_Address->appendChild($e_City);
351 $e_State = $ccr->createElement('State',$row2['state'].' ');
352 $e_Address->appendChild($e_State);
354 $e_PostalCode = $ccr->createElement('PostalCode',$row2['zip']);
355 $e_Address->appendChild($e_PostalCode);
357 $e_Telephone = $ccr->createElement('Telephone');
358 $e_Actor->appendChild($e_Telephone);
360 $e_Phone = $ccr->createElement('Value',$row2['phone']);
361 $e_Telephone->appendChild($e_Phone);
363 $e_Source = $ccr->createElement('Source');
364 $e_Actor->appendChild($e_Source);
366 $e_Actor = $ccr->createElement('Actor');
367 $e_Source->appendChild($e_Actor);
369 $e_ActorID = $ccr->createElement('ActorID', $authorID);
370 $e_Actor->appendChild($e_ActorID);