fix: several clinical_notes form fixes (#6811)
[openemr.git] / ccr / createCCRResult.php
blob8cfdad4ae88f588af7495590ea1f13c41c09b473
1 <?php
3 /**
4 * CCR Script.
6 * Copyright (C) 2010 Garden State Health Systems <http://www.gshsys.com/>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Garden State Health Systems <http://www.gshsys.com/>
21 * @link http://www.open-emr.org
24 $result = getResultData();
25 $row = sqlFetchArray($result);
27 do {
28 $e_Result = $ccr->createElement('Result');
29 $e_Results->appendChild($e_Result);
31 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());//, $row['immunization_id']);
32 $e_Result->appendChild($e_CCRDataObjectID);
34 $e_DateTime = $ccr->createElement('DateTime');
35 $e_Result->appendChild($e_DateTime);
37 $date = date_create($row['date']);
39 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
40 $e_DateTime->appendChild($e_ExactDateTime);
42 $e_IDs = $ccr->createElement('IDs');
43 $e_Result->appendChild($e_IDs);
45 $e_ID = $ccr->createElement('ID');
46 $e_IDs->appendChild($e_ID);
48 $e_IDs->appendChild(sourceType($ccr, $authorID));
50 $e_Source = $ccr->createElement('Source');
51 $e_Result->appendChild($e_Source);
53 $e_Actor = $ccr->createElement('Actor');
54 $e_Source->appendChild($e_Actor);
56 $e_ActorID = $ccr->createElement('ActorID', $uuid);
57 //$e_ActorID = $ccr->createElement('ActorID',${"labID{$row['lab']}"});
58 $e_Actor->appendChild($e_ActorID);
60 $e_Test = $ccr->createElement('Test');
61 $e_Result->appendChild($e_Test);
63 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
64 $e_Test->appendChild($e_CCRDataObjectID);
66 $e_DateTime = $ccr->createElement('DateTime');
67 $e_Test->appendChild($e_DateTime);
69 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
70 $e_DateTime->appendChild($e_ExactDateTime);
72 $e_Type = $ccr->createElement('Type');
73 $e_Test->appendChild($e_Type);
75 $e_Text = $ccr->createElement('Text', 'Observation');
76 $e_Type->appendChild($e_Text);
78 $e_Description = $ccr->createElement('Description');
79 $e_Test->appendChild($e_Description);
81 $e_Text = $ccr->createElement('Text', $row['name']);
82 $e_Description->appendChild($e_Text);
84 $e_Code = $ccr->createElement('Code');
85 $e_Description->appendChild($e_Code);
87 $e_Value = $ccr->createElement('Value', 'Value');
88 $e_Code->appendChild($e_Value);
90 $e_Source = $ccr->createElement('Source');
91 $e_Test->appendChild($e_Source);
93 $e_Actor = $ccr->createElement('Actor');
94 $e_Source->appendChild($e_Actor);
96 $e_ActorID = $ccr->createElement('ActorID', $uuid);
97 $e_Actor->appendChild($e_ActorID);
99 $e_TestResult = $ccr->createElement('TestResult');
100 $e_Test->appendChild($e_TestResult);
102 $e_Value = $ccr->createElement('Value', $row['result']);
103 $e_TestResult->appendChild($e_Value);
105 $e_Code = $ccr->createElement('Code');
106 $e_TestResult->appendChild($e_Code);
108 $e_Value = $ccr->createElement('Value', 'Value');
109 $e_Code->appendChild($e_Value);
111 $e_Description = $ccr->createElement('Description');
112 $e_TestResult->appendChild($e_Description);
114 $e_Text = $ccr->createElement('Text', $row['result']);
115 $e_Description->appendChild($e_Text);
117 //if($row['abnormal'] == '' ) {
118 $e_NormalResult = $ccr->createElement('NormalResult');
119 $e_Test->appendChild($e_NormalResult);
121 $e_Normal = $ccr->createElement('Normal');
122 $e_NormalResult->appendChild($e_Normal);
124 $e_Value = $ccr->createElement('Value', $row['range']);
125 $e_Normal->appendChild($e_Value);
127 $e_Units = $ccr->createElement('Units');
128 $e_Normal->appendChild($e_Units);
130 $e_Unit = $ccr->createElement('Unit', 'Test Unit');
131 $e_Units->appendChild($e_Unit);
133 $e_Source = $ccr->createElement('Source');
134 $e_Normal->appendChild($e_Source);
136 $e_Actor = $ccr->createElement('Actor');
137 $e_Source->appendChild($e_Actor);
139 $e_ActorID = $ccr->createElement('ActorID', $uuid);
140 $e_Actor->appendChild($e_ActorID);
142 //} else {
143 $e_Flag = $ccr->createElement('Flag');
144 $e_Test->appendChild($e_Flag);
146 $e_Text = $ccr->createElement('Text', $row['abnormal']);
147 $e_Flag->appendChild($e_Text);
150 //$e_Test = $ccr->createElement('Test');
151 //$e_Result->appendChild($e_Test);
153 //$e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
154 //$e_Test->appendChild($e_CCRDataObjectID);
156 //$e_DateTime = $ccr->createElement('DateTime');
157 //$e_Test->appendChild($e_DateTime);
159 //$e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
160 //$e_DateTime->appendChild($e_ExactDateTime);
162 //$e_Type = $ccr->createElement('Type');
163 //$e_Test->appendChild($e_Type);
165 //$e_Text = $ccr->createElement('Text', 'Observation');
166 //$e_Type->appendChild($e_Text);
169 //$e_Description = $ccr->createElement('Description' );
170 //$e_Test->appendChild($e_Description);
172 //$e_Text = $ccr->createElement('Text', 'Range');
173 //$e_Description->appendChild($e_Text);
175 //$e_Code = $ccr->createElement('Code');
176 //$e_Description->appendChild($e_Code);
178 //$e_Value = $ccr->createElement('Value', 'None');
179 //$e_Code->appendChild($e_Value);
181 //$e_Test->appendChild(sourceType($ccr, $authorID));
183 //$e_TestResult = $ccr->createElement('TestResult' );
184 //$e_Test->appendChild($e_TestResult);
186 //$e_Value = $ccr->createElement('Value', '1.0');
187 //$e_TestResult->appendChild($e_Value);
189 //$e_Code = $ccr->createElement('Code' );
190 //$e_TestResult->appendChild($e_Code);
192 //$e_Value = $ccr->createElement('Value', 'Test 01 Code');
193 //$e_Code->appendChild($e_Value);
195 //$e_Description = $ccr->createElement('Description' );
196 //$e_TestResult->appendChild($e_Description);
198 //$e_Text = $ccr->createElement('Text', $row['range']);
199 //$e_Description->appendChild($e_Text);
202 //if($row['abnormal'] == '' ) {
203 // $e_NormalResult = $ccr->createElement('NormalResult');
204 // $e_Test->appendChild($e_NormalResult);
205 //} else {
206 // $e_Flag = $ccr->createElement('Flag');
207 // $e_Test->appendChild($e_Flag);
209 // $e_Text = $ccr->createElement('Text');
210 // $e_Flag->appendChild($e_Text);
213 } while ($row = sqlFetchArray($result));