consolidated reviewMode in forms.php (this can then be used for view only acl users...
[openemr.git] / ccr / createCCRResult.php
blob53eea12879b05ec7060528c7d2e0e6eb42d925ea
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 = getResultData();
25 $row = sqlFetchArray($result);
27 do {
29 $e_Result = $ccr->createElement('Result');
30 $e_Results->appendChild($e_Result);
32 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());//, $row['immunization_id']);
33 $e_Result->appendChild($e_CCRDataObjectID);
35 $e_DateTime = $ccr->createElement('DateTime');
36 $e_Result->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_IDs = $ccr->createElement('IDs');
44 $e_Result->appendChild($e_IDs);
46 $e_ID = $ccr->createElement('ID');
47 $e_IDs->appendChild($e_ID);
49 $e_IDs->appendChild(sourceType($ccr, $authorID));
51 $e_Source = $ccr->createElement('Source');
52 $e_Result->appendChild($e_Source);
54 $e_Actor = $ccr->createElement('Actor');
55 $e_Source->appendChild($e_Actor);
57 $e_ActorID = $ccr->createElement('ActorID',$uuid);
58 //$e_ActorID = $ccr->createElement('ActorID',${"labID{$row['lab']}"});
59 $e_Actor->appendChild($e_ActorID);
61 $e_Test = $ccr->createElement('Test');
62 $e_Result->appendChild($e_Test);
64 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
65 $e_Test->appendChild($e_CCRDataObjectID);
67 $e_DateTime = $ccr->createElement('DateTime');
68 $e_Test->appendChild($e_DateTime);
70 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
71 $e_DateTime->appendChild($e_ExactDateTime);
73 $e_Type = $ccr->createElement('Type');
74 $e_Test->appendChild($e_Type);
76 $e_Text = $ccr->createElement('Text', 'Observation');
77 $e_Type->appendChild($e_Text);
79 $e_Description = $ccr->createElement('Description' );
80 $e_Test->appendChild($e_Description);
82 $e_Text = $ccr->createElement('Text', $row['name']);
83 $e_Description->appendChild($e_Text);
85 $e_Code = $ccr->createElement('Code');
86 $e_Description->appendChild($e_Code);
88 $e_Value = $ccr->createElement('Value', 'Value');
89 $e_Code->appendChild($e_Value);
91 $e_Source = $ccr->createElement('Source');
92 $e_Test->appendChild($e_Source);
94 $e_Actor = $ccr->createElement('Actor');
95 $e_Source->appendChild($e_Actor);
97 $e_ActorID = $ccr->createElement('ActorID',$uuid);
98 $e_Actor->appendChild($e_ActorID);
100 $e_TestResult = $ccr->createElement('TestResult' );
101 $e_Test->appendChild($e_TestResult);
103 $e_Value = $ccr->createElement('Value', $row['result']);
104 $e_TestResult->appendChild($e_Value);
106 $e_Code = $ccr->createElement('Code' );
107 $e_TestResult->appendChild($e_Code);
109 $e_Value = $ccr->createElement('Value', 'Value');
110 $e_Code->appendChild($e_Value);
112 $e_Description = $ccr->createElement('Description' );
113 $e_TestResult->appendChild($e_Description);
115 $e_Text = $ccr->createElement('Text', $row['result']);
116 $e_Description->appendChild( $e_Text);
118 //if($row['abnormal'] == '' ) {
119 $e_NormalResult = $ccr->createElement('NormalResult');
120 $e_Test->appendChild($e_NormalResult);
122 $e_Normal = $ccr->createElement('Normal');
123 $e_NormalResult->appendChild($e_Normal);
125 $e_Value = $ccr->createElement('Value', $row['range']);
126 $e_Normal->appendChild($e_Value);
128 $e_Units = $ccr->createElement('Units');
129 $e_Normal->appendChild($e_Units);
131 $e_Unit = $ccr->createElement('Unit', 'Test Unit');
132 $e_Units->appendChild($e_Unit);
134 $e_Source = $ccr->createElement('Source');
135 $e_Normal->appendChild($e_Source);
137 $e_Actor = $ccr->createElement('Actor');
138 $e_Source->appendChild($e_Actor);
140 $e_ActorID = $ccr->createElement('ActorID',$uuid);
141 $e_Actor->appendChild($e_ActorID);
143 //} else {
144 $e_Flag = $ccr->createElement('Flag');
145 $e_Test->appendChild($e_Flag);
147 $e_Text = $ccr->createElement('Text', $row['abnormal']);
148 $e_Flag->appendChild($e_Text);
151 //$e_Test = $ccr->createElement('Test');
152 //$e_Result->appendChild($e_Test);
154 //$e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
155 //$e_Test->appendChild($e_CCRDataObjectID);
157 //$e_DateTime = $ccr->createElement('DateTime');
158 //$e_Test->appendChild($e_DateTime);
160 //$e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
161 //$e_DateTime->appendChild($e_ExactDateTime);
163 //$e_Type = $ccr->createElement('Type');
164 //$e_Test->appendChild($e_Type);
166 //$e_Text = $ccr->createElement('Text', 'Observation');
167 //$e_Type->appendChild($e_Text);
170 //$e_Description = $ccr->createElement('Description' );
171 //$e_Test->appendChild($e_Description);
173 //$e_Text = $ccr->createElement('Text', 'Range');
174 //$e_Description->appendChild($e_Text);
176 //$e_Code = $ccr->createElement('Code');
177 //$e_Description->appendChild($e_Code);
179 //$e_Value = $ccr->createElement('Value', 'None');
180 //$e_Code->appendChild($e_Value);
182 //$e_Test->appendChild(sourceType($ccr, $authorID));
184 //$e_TestResult = $ccr->createElement('TestResult' );
185 //$e_Test->appendChild($e_TestResult);
187 //$e_Value = $ccr->createElement('Value', '1.0');
188 //$e_TestResult->appendChild($e_Value);
190 //$e_Code = $ccr->createElement('Code' );
191 //$e_TestResult->appendChild($e_Code);
193 //$e_Value = $ccr->createElement('Value', 'Test 01 Code');
194 //$e_Code->appendChild($e_Value);
196 //$e_Description = $ccr->createElement('Description' );
197 //$e_TestResult->appendChild($e_Description);
199 //$e_Text = $ccr->createElement('Text', $row['range']);
200 //$e_Description->appendChild($e_Text);
203 //if($row['abnormal'] == '' ) {
204 // $e_NormalResult = $ccr->createElement('NormalResult');
205 // $e_Test->appendChild($e_NormalResult);
206 //} else {
207 // $e_Flag = $ccr->createElement('Flag');
208 // $e_Test->appendChild($e_Flag);
210 // $e_Text = $ccr->createElement('Text');
211 // $e_Flag->appendChild($e_Text);
215 } while ($row = sqlFetchArray($result));