incremented patch version 6
[openemr.git] / ccr / createCCRResult.php
blob97903e626e4309ff1a0f270d78ccf81ad491792f
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 = getResultData();
29 $row = sqlFetchArray($result);
31 do {
33 $e_Result = $ccr->createElement('Result');
34 $e_Results->appendChild($e_Result);
36 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());//, $row['immunization_id']);
37 $e_Result->appendChild($e_CCRDataObjectID);
39 $e_DateTime = $ccr->createElement('DateTime');
40 $e_Result->appendChild($e_DateTime);
42 $date = date_create($row['date']);
44 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
45 $e_DateTime->appendChild($e_ExactDateTime);
47 $e_IDs = $ccr->createElement('IDs');
48 $e_Result->appendChild($e_IDs);
50 $e_ID = $ccr->createElement('ID');
51 $e_IDs->appendChild($e_ID);
53 $e_IDs->appendChild(sourceType($ccr, $authorID));
55 $e_Source = $ccr->createElement('Source');
56 $e_Result->appendChild($e_Source);
58 $e_Actor = $ccr->createElement('Actor');
59 $e_Source->appendChild($e_Actor);
61 $e_ActorID = $ccr->createElement('ActorID',$uuid);
62 //$e_ActorID = $ccr->createElement('ActorID',${"labID{$row['lab']}"});
63 $e_Actor->appendChild($e_ActorID);
65 $e_Test = $ccr->createElement('Test');
66 $e_Result->appendChild($e_Test);
68 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
69 $e_Test->appendChild($e_CCRDataObjectID);
71 $e_DateTime = $ccr->createElement('DateTime');
72 $e_Test->appendChild($e_DateTime);
74 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
75 $e_DateTime->appendChild($e_ExactDateTime);
77 $e_Type = $ccr->createElement('Type');
78 $e_Test->appendChild($e_Type);
80 $e_Text = $ccr->createElement('Text', 'Observation');
81 $e_Type->appendChild($e_Text);
83 $e_Description = $ccr->createElement('Description' );
84 $e_Test->appendChild($e_Description);
86 $e_Text = $ccr->createElement('Text', $row['name']);
87 $e_Description->appendChild($e_Text);
89 $e_Code = $ccr->createElement('Code');
90 $e_Description->appendChild($e_Code);
92 $e_Value = $ccr->createElement('Value', 'Value');
93 $e_Code->appendChild($e_Value);
95 $e_Source = $ccr->createElement('Source');
96 $e_Test->appendChild($e_Source);
98 $e_Actor = $ccr->createElement('Actor');
99 $e_Source->appendChild($e_Actor);
101 $e_ActorID = $ccr->createElement('ActorID',$uuid);
102 $e_Actor->appendChild($e_ActorID);
104 $e_TestResult = $ccr->createElement('TestResult' );
105 $e_Test->appendChild($e_TestResult);
107 $e_Value = $ccr->createElement('Value', $row['result']);
108 $e_TestResult->appendChild($e_Value);
110 $e_Code = $ccr->createElement('Code' );
111 $e_TestResult->appendChild($e_Code);
113 $e_Value = $ccr->createElement('Value', 'Value');
114 $e_Code->appendChild($e_Value);
116 $e_Description = $ccr->createElement('Description' );
117 $e_TestResult->appendChild($e_Description);
119 $e_Text = $ccr->createElement('Text', $row['result']);
120 $e_Description->appendChild( $e_Text);
122 //if($row['abnormal'] == '' ) {
123 $e_NormalResult = $ccr->createElement('NormalResult');
124 $e_Test->appendChild($e_NormalResult);
126 $e_Normal = $ccr->createElement('Normal');
127 $e_NormalResult->appendChild($e_Normal);
129 $e_Value = $ccr->createElement('Value', $row['range']);
130 $e_Normal->appendChild($e_Value);
132 $e_Units = $ccr->createElement('Units');
133 $e_Normal->appendChild($e_Units);
135 $e_Unit = $ccr->createElement('Unit', 'Test Unit');
136 $e_Units->appendChild($e_Unit);
138 $e_Source = $ccr->createElement('Source');
139 $e_Normal->appendChild($e_Source);
141 $e_Actor = $ccr->createElement('Actor');
142 $e_Source->appendChild($e_Actor);
144 $e_ActorID = $ccr->createElement('ActorID',$uuid);
145 $e_Actor->appendChild($e_ActorID);
147 //} else {
148 $e_Flag = $ccr->createElement('Flag');
149 $e_Test->appendChild($e_Flag);
151 $e_Text = $ccr->createElement('Text', $row['abnormal']);
152 $e_Flag->appendChild($e_Text);
155 //$e_Test = $ccr->createElement('Test');
156 //$e_Result->appendChild($e_Test);
158 //$e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
159 //$e_Test->appendChild($e_CCRDataObjectID);
161 //$e_DateTime = $ccr->createElement('DateTime');
162 //$e_Test->appendChild($e_DateTime);
164 //$e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
165 //$e_DateTime->appendChild($e_ExactDateTime);
167 //$e_Type = $ccr->createElement('Type');
168 //$e_Test->appendChild($e_Type);
170 //$e_Text = $ccr->createElement('Text', 'Observation');
171 //$e_Type->appendChild($e_Text);
174 //$e_Description = $ccr->createElement('Description' );
175 //$e_Test->appendChild($e_Description);
177 //$e_Text = $ccr->createElement('Text', 'Range');
178 //$e_Description->appendChild($e_Text);
180 //$e_Code = $ccr->createElement('Code');
181 //$e_Description->appendChild($e_Code);
183 //$e_Value = $ccr->createElement('Value', 'None');
184 //$e_Code->appendChild($e_Value);
186 //$e_Test->appendChild(sourceType($ccr, $authorID));
188 //$e_TestResult = $ccr->createElement('TestResult' );
189 //$e_Test->appendChild($e_TestResult);
191 //$e_Value = $ccr->createElement('Value', '1.0');
192 //$e_TestResult->appendChild($e_Value);
194 //$e_Code = $ccr->createElement('Code' );
195 //$e_TestResult->appendChild($e_Code);
197 //$e_Value = $ccr->createElement('Value', 'Test 01 Code');
198 //$e_Code->appendChild($e_Value);
200 //$e_Description = $ccr->createElement('Description' );
201 //$e_TestResult->appendChild($e_Description);
203 //$e_Text = $ccr->createElement('Text', $row['range']);
204 //$e_Description->appendChild($e_Text);
207 //if($row['abnormal'] == '' ) {
208 // $e_NormalResult = $ccr->createElement('NormalResult');
209 // $e_Test->appendChild($e_NormalResult);
210 //} else {
211 // $e_Flag = $ccr->createElement('Flag');
212 // $e_Test->appendChild($e_Flag);
214 // $e_Text = $ccr->createElement('Text');
215 // $e_Flag->appendChild($e_Text);
219 } while ($row = sqlFetchArray($result));