CCR-CCD module: minor bug fix
[openemr.git] / ccr / createCCRResult.php
blob5aa49501737357c799ee55d854ee03f3c83f5f57
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 // ------------------------------------------------------------------------ //
27 //require_once(dirname(__FILE__) . "/../library/sql-ccr.inc");
29 $result = getResultData();
30 $row = sqlFetchArray($result);
32 do {
34 $e_Result = $ccr->createElement('Result');
35 $e_Results->appendChild($e_Result);
37 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());//, $row['immunization_id']);
38 $e_Immunization->appendChild($e_CCRDataObjectID);
40 $e_DateTime = $ccr->createElement('DateTime');
41 $e_Result->appendChild($e_DateTime);
43 $date = date_create($row['date']);
45 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
46 $e_DateTime->appendChild($e_ExactDateTime);
48 $e_IDs = $ccr->createElement('IDs');
49 $e_Result->appendChild($e_IDs);
51 $e_ID = $ccr->createElement('ID', $row['pid']);
52 $e_IDs->appendChild($e_ID);
54 $e_IDs->appendChild(sourceType($ccr, $authorID));
56 $e_Result->appendChild(sourceType($ccr, $authorID));
58 $e_Test = $ccr->createElement('Test');
59 $e_Result->appendChild($e_Test);
61 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
62 $e_Test->appendChild($e_CCRDataObjectID);
64 $e_DateTime = $ccr->createElement('DateTime');
65 $e_Test->appendChild($e_DateTime);
67 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
68 $e_DateTime->appendChild($e_ExactDateTime);
70 $e_Type = $ccr->createElement('Type');
71 $e_Test->appendChild($e_Type);
73 $e_Text = $ccr->createElement('Text', 'Observation');
74 $e_Type->appendChild($e_Text);
76 $e_Description = $ccr->createElement('Description' );
77 $e_Test->appendChild($e_Description);
79 $e_Text = $ccr->createElement('Text', $row['ankle_able_to_bear_weight_steps']);
80 $e_Description->appendChild($e_Text);
82 $e_Code = $ccr->createElement('Code');
83 $e_Description->appendChild($e_Code);
85 $e_Value = $ccr->createElement('Value', 'None');
86 $e_Code->appendChild($e_Value);
88 $e_Test->appendChild(sourceType($ccr, $authorID));
90 $e_TestResult = $ccr->createElement('TestResult' );
91 $e_Test->appendChild($e_TestResult);
93 $e_Value = $ccr->createElement('Value', '1.0');
94 $e_TestResult->appendChild($e_Value);
96 $e_Code = $ccr->createElement('Code' );
97 $e_TestResult->appendChild($e_Code);
99 $e_Value = $ccr->createElement('Value', 'Test 01 Code');
100 $e_Code->appendChild($e_Value);
102 $e_Description = $ccr->createElement('Description' );
103 $e_TestResult->appendChild($e_Description);
105 $e_Text = $ccr->createElement('Text', $row['ankle_able_to_bear_weight_steps']);
106 $e_Description->appendChild( $e_Text);
109 if('high' == 'normal' ) {
110 $e_NormalResult = $ccr->createElement('NormalResult','normal');
111 $e_Test->appendChild($e_NormalResult);
112 } else {
113 $e_Flag = $ccr->createElement('Flag', 'high' );
114 $e_Test->appendChild($e_Flag);
116 $e_Text = $ccr->createElement('Text', $row['high']);
117 $e_Flag->appendChild($e_Text);
120 $e_Test = $ccr->createElement('Test');
121 $e_Result->appendChild($e_Test);
123 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
124 $e_Test->appendChild($e_CCRDataObjectID);
126 $e_DateTime = $ccr->createElement('DateTime');
127 $e_Test->appendChild($e_DateTime);
129 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
130 $e_DateTime->appendChild($e_ExactDateTime);
132 $e_Type = $ccr->createElement('Type', 'x ray');
133 $e_Test->appendChild($e_Type);
135 $e_Text = $ccr->createElement('Text', 'Observation');
136 $e_Type->appendChild($e_Text);
139 $e_Description = $ccr->createElement('Description' );
140 $e_Test->appendChild($e_Description);
142 $e_Text = $ccr->createElement('Text', $row['ankle_x_ray_interpretation']);
143 $e_Description->appendChild($e_Text);
145 $e_Code = $ccr->createElement('Code');
146 $e_Description->appendChild($e_Code);
148 $e_Value = $ccr->createElement('Value', 'None');
149 $e_Code->appendChild($e_Value);
151 $e_Test->appendChild(sourceType($ccr, $authorID));
153 $e_TestResult = $ccr->createElement('TestResult' );
154 $e_Test->appendChild($e_TestResult);
156 $e_Value = $ccr->createElement('Value', '1.0');
157 $e_TestResult->appendChild($e_Value);
159 $e_Code = $ccr->createElement('Code' );
160 $e_TestResult->appendChild($e_Code);
162 $e_Value = $ccr->createElement('Value', 'Test 01 Code');
163 $e_Code->appendChild($e_Value);
165 $e_Description = $ccr->createElement('Description' );
166 $e_TestResult->appendChild($e_Description);
168 $e_Text = $ccr->createElement('Text', $row['ankle_x_ray_interpretation']);
169 $e_Description->appendChild($e_Text);
172 if('normal' == 'normal' ) {
173 $e_NormalResult = $ccr->createElement('NormalResult','normal');
174 $e_Test->appendChild($e_NormalResult);
175 } else {
176 $e_Flag = $ccr->createElement('Flag');
177 $e_Test->appendChild($e_Flag);
179 $e_Text = $ccr->createElement('Text', $row['high']);
180 $e_Flag->appendChild($e_Text);
184 } while ($row = sqlFetchArray($result));