minor fix to prior commit
[openemr.git] / ccr / createCCRProcedure.php
blob1aaa380ea3fc6052b996c949b6b2305b082d19ad
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 = getProcedureData();
25 $row = sqlFetchArray($result);
27 do {
29 $e_Procedure = $ccr->createElement('Procedure');
30 $e_Procedures->appendChild($e_Procedure);
32 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
33 $e_Procedure->appendChild($e_CCRDataObjectID);
35 $e_DateTime = $ccr->createElement('DateTime');
36 $e_Procedure->appendChild($e_DateTime);
38 $date = date_create($row['date']);
40 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
41 $e_DateTime->appendChild($e_ExactDateTime);
43 $e_Type = $ccr->createElement('Type');
44 $e_Procedure->appendChild($e_Type);
46 $e_Text = $ccr->createElement('Text', $row['type']);
47 $e_Type->appendChild($e_Text);
49 $e_Description = $ccr->createElement('Description' );
50 $e_Procedure->appendChild($e_Description);
52 $e_Text = $ccr->createElement('Text', $row['proc_title']);
53 $e_Description->appendChild($e_Text);
55 $e_Code = $ccr->createElement('Code');
56 $e_Description->appendChild($e_Code);
58 $e_Value = $ccr->createElement('Value', $row['code']);
59 $e_Code->appendChild($e_Value);
61 $e_Value = $ccr->createElement('CodingSystem', $row['coding']);
62 $e_Code->appendChild($e_Value);
64 $e_Status = $ccr->createElement('Status');
65 $e_Procedure->appendChild($e_Status);
67 $e_Text = $ccr->createElement('Text', $row['outcome']);
68 $e_Status->appendChild($e_Text);
70 $e_Procedure->appendChild(sourceType($ccr, $sourceID));
72 $e_Locations = $ccr->createElement('Locations');
73 $e_Procedure->appendChild($e_Locations);
75 $e_Location = $ccr->createElement('Location');
76 $e_Locations->appendChild($e_Location);
78 $e_Description = $ccr->createElement('Description' );
79 $e_Location->appendChild($e_Description);
81 $e_Text = $ccr->createElement('Text', $row['laterality']);
82 $e_Description->appendChild($e_Text);
84 $e_Practitioners = $ccr->createElement('Practitioners');
85 $e_Procedure->appendChild($e_Practitioners);
87 $e_Practitioner = $ccr->createElement('Practitioner');
88 $e_Practitioners->appendChild($e_Practitioner);
90 $e_ActorRole = $ccr->createElement('ActorRole');
91 $e_Practitioner->appendChild($e_ActorRole);
93 $e_Text = $ccr->createElement('Text', 'None');
94 $e_ActorRole->appendChild($e_Text);
96 $e_Duration = $ccr->createElement('Duration');
97 $e_Procedure->appendChild($e_Duration);
99 $e_Description = $ccr->createElement('Description' );
100 $e_Duration->appendChild($e_Description);
102 $e_Text = $ccr->createElement('Text', 'None');
103 $e_Description->appendChild($e_Text);
105 $e_Substance = $ccr->createElement('Substance');
106 $e_Procedure->appendChild($e_Substance);
108 $e_Text = $ccr->createElement('Text', '');
109 $e_Substance->appendChild($e_Text);
111 $e_Method = $ccr->createElement('Method');
112 $e_Procedure->appendChild($e_Method);
114 $e_Text = $ccr->createElement('Text', '');
115 $e_Method->appendChild($e_Text);
117 $e_Position = $ccr->createElement('Position');
118 $e_Procedure->appendChild($e_Position);
120 $e_Text = $ccr->createElement('Text', $row['laterality']);
121 $e_Position->appendChild($e_Text);
123 $e_Site = $ccr->createElement('Site');
124 $e_Procedure->appendChild($e_Site);
126 $e_Text = $ccr->createElement('Text', $row['body_site']);
127 $e_Site->appendChild($e_Text);
129 } while ($row = sqlFetchArray($result));