CCR-CCD module: minor bug fix
[openemr.git] / ccr / createCCRProcedure.php
blob33b2b9b2ebebfcc2e9777fb5d0ab416e8b1fb824
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 = getProcedureData();
30 $row = sqlFetchArray($result);
32 do {
34 echo 'encounter :'.$row['encounter'].'\n';
36 $e_Procedure = $ccr->createElement('Procedure');
37 $e_Procedures->appendChild($e_Procedure);
39 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
40 $e_Procedure->appendChild($e_CCRDataObjectID);
42 $e_DateTime = $ccr->createElement('DateTime');
43 $e_Procedure->appendChild($e_DateTime);
45 $date = date_create($row['date']);
47 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
48 $e_DateTime->appendChild($e_ExactDateTime);
50 $e_Type = $ccr->createElement('Type');
51 $e_Procedure->appendChild($e_Type);
53 $e_Text = $ccr->createElement('Text', $row['type']);
54 $e_Type->appendChild($e_Text);
57 $e_Description = $ccr->createElement('Description' );
58 $e_Procedure->appendChild($e_Description);
60 $e_Text->nodeValue = $row['proc_title'];
61 $e_Description->appendChild(clone $e_Text);
63 $e_Code = $ccr->createElement('Code');
64 $e_Description->appendChild($e_Code);
66 $e_Value = $ccr->createElement('Value', 'None');
67 $e_Code->appendChild($e_Value);
69 $e_Status = $ccr->createElement('Status');
70 $e_Procedure->appendChild($e_Status);
72 $e_Text->nodeValue = $row['outcome'];
73 $e_Status->appendChild(clone $e_Text);
75 $e_Procedure->appendChild(sourceType($ccr, $authorID));
77 $e_Locations = $ccr->createElement('Locations');
78 $e_Procedure->appendChild($e_Locations);
80 $e_Location = $ccr->createElement('Location');
81 $e_Locations->appendChild($e_Location);
83 $e_Description = $ccr->createElement('Description' );
84 $e_Location->appendChild($e_Description);
86 $e_Text->nodeValue = 'body_location'; //$row['laterality'];
87 $e_Description->appendChild(clone $e_Text);
89 $e_Practitioners = $ccr->createElement('Practitioners');
90 $e_Procedure->appendChild($e_Practitioners);
92 $e_Practitioner = $ccr->createElement('Practitioner');
93 $e_Practitioners->appendChild($e_Practitioner);
95 $e_ActorRole = $ccr->createElement('ActorRole');
96 $e_Practitioner->appendChild($e_ActorRole);
98 $e_Text->nodeValue = 'None';
99 $e_ActorRole->appendChild(clone $e_Text);
101 $e_Duration = $ccr->createElement('Duration');
102 $e_Procedure->appendChild($e_Duration);
104 $e_Description = $ccr->createElement('Description' );
105 $e_Duration->appendChild($e_Description);
107 $e_Text->nodeValue = 'None';
108 $e_Description->appendChild(clone $e_Text);
110 $e_Substance = $ccr->createElement('Substance');
111 $e_Procedure->appendChild($e_Substance);
113 $e_Text->nodeValue = 'substance';
114 $e_Substance->appendChild(clone $e_Text);
116 $e_Method = $ccr->createElement('Method');
117 $e_Procedure->appendChild($e_Method);
119 $e_Text->nodeValue = 'method'; //?
120 $e_Method->appendChild(clone $e_Text);
122 $e_Position = $ccr->createElement('Position'); //$row['laterality']
123 $e_Procedure->appendChild($e_Position);
125 $e_Text->nodeValue = 'body_position';// $row['laterality'];
126 $e_Position->appendChild(clone $e_Text);
128 $e_Site = $ccr->createElement('Site');
129 $e_Procedure->appendChild($e_Site);
131 $e_Text->nodeValue = 'body_site';//$row['body_site'];
132 $e_Site->appendChild(clone $e_Text);
134 } while ($row = sqlFetchArray($result));