Prepared the ubuntu-debian for impending 4.0 release
[openemr.git] / ccr / createCCRMedication.php
blob87fee61e4e13660a00ff6d3b605d6d34e21e97a8
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 = getMedicationData();
29 $value = sqlFetchArray($result);
31 do {
33 $e_Medication = $ccr->createElement('Medication');
34 $e_Medications->appendChild($e_Medication);
36 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
37 $e_Medication->appendChild($e_CCRDataObjectID);
39 $e_DateTime = $ccr->createElement('DateTime');
40 $e_Medication->appendChild($e_DateTime);
42 $date = date_create($value['date_added']);
44 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
45 $e_DateTime->appendChild($e_ExactDateTime);
47 $e_Type = $ccr->createElement('Type');
48 $e_Medication->appendChild($e_Type);
50 // $e_Text = $ccr->createElement('Text', $value['medication']);
51 $e_Text = $ccr->createElement('Text', 'Medication');
52 $e_Type->appendChild($e_Text);
54 $e_Status = $ccr->createElement('Status');
55 $e_Medication->appendChild($e_Status);
57 // $e_Text = $ccr->createElement('Text',$value['active']);
58 $e_Text = $ccr->createElement('Text', 'Active');
59 $e_Status->appendChild($e_Text);
61 $e_Medication->appendChild(sourceType($ccr, $authorID));
63 $e_Product = $ccr->createElement('Product');
64 $e_Medication->appendChild($e_Product);
66 $e_ProductName = $ccr->createElement('ProductName');
67 $e_Product->appendChild($e_ProductName);
69 $e_Text = $ccr->createElement('Text',$value['drug']);
70 $e_ProductName->appendChild(clone $e_Text);
72 $e_Form = $ccr->createElement('Form');
73 $e_Product->appendChild($e_Form);
75 $e_Text = $ccr->createElement('Text', 'Tablets');
76 $e_Form->appendChild($e_Text);
78 $e_Strength = $ccr->createElement('Strength');
79 $e_Product->appendChild($e_Strength);
81 $e_Value = $ccr->createElement('Value');
82 $e_Strength->appendChild($e_Value);
84 $e_Text = $ccr->createElement('Text', '100');
85 $e_Value->appendChild($e_Text);
87 $e_Units = $ccr->createElement('Units');
88 $e_Strength->appendChild($e_Units);
90 $e_Unit = $ccr->createElement('Unit');
91 $e_Units->appendChild($e_Unit);
93 $e_Text = $ccr->createElement('Text', 'MG');
94 $e_Unit->appendChild($e_Text);
96 $e_Quantity = $ccr->createElement('Quantity');
97 $e_Medication->appendChild($e_Quantity);
99 $e_Value = $ccr->createElement('Value');
100 $e_Quantity->appendChild($e_Value);
102 $e_Text = $ccr->createElement('Text', '10');
103 $e_Value->appendChild($e_Text);
105 $e_Units = $ccr->createElement('Units');
106 $e_Quantity->appendChild($e_Units);
108 $e_Unit = $ccr->createElement('Unit');
109 $e_Units->appendChild($e_Unit);
111 $e_Text = $ccr->createElement('Text', 'Tablets');
112 $e_Unit->appendChild($e_Text);
114 $e_Directions = $ccr->createElement('Directions');
115 $e_Medication->appendChild($e_Directions);
117 $e_Direction = $ccr->createElement('Direction');
118 $e_Directions->appendChild($e_Direction);
120 $e_Description = $ccr->createElement('Description', $value['note']);
121 $e_Direction->appendChild($e_Description);
123 // $e_Text = $ccr->createElement('Text',$value['note']);
124 $e_Text = $ccr->createElement('Text', 'Note');
125 $e_Description->appendChild(clone $e_Text);
127 $e_Route = $ccr->createElement('Route');
128 $e_Direction->appendChild($e_Route);
130 $e_Text = $ccr->createElement('Text', 'Tablet');
131 $e_Route->appendChild($e_Text);
133 $e_Site = $ccr->createElement('Site');
134 $e_Direction->appendChild($e_Site);
136 $e_Text = $ccr->createElement('Text', 'Oral');
137 $e_Site->appendChild($e_Text);
139 $e_Indications = $ccr->createElement('Indications');
140 $e_Medication->appendChild($e_Indications);
142 $e_Indication = $ccr->createElement('Indication');
143 $e_Indications->appendChild($e_Indication);
145 // $e_Indication->appendChild(sourceType($ccr, $authorID));
147 $e_InternalCCRLink = $ccr->createElement('InternalCCRLink');
148 $e_Indication->appendChild($e_InternalCCRLink);
150 $e_LinkID = $ccr->createElement('LinkID', 'PROB1');
151 $e_InternalCCRLink->appendChild($e_LinkID);
153 $e_PatientInstructions = $ccr->createElement('PatientInstructions');
154 $e_Medication->appendChild($e_PatientInstructions);
156 $e_Instruction = $ccr->createElement('Instruction');
157 $e_PatientInstructions->appendChild($e_Instruction);
159 $e_Text = $ccr->createElement('Text', 'Patient Instructions');
160 $e_Instruction->appendChild($e_Text);
162 $e_Refills = $ccr->createElement('Refills');
163 $e_Medication->appendChild($e_Refills);
165 $e_Refill = $ccr->createElement('Refill');
166 $e_Refills->appendChild($e_Refill);
168 $e_Number = $ccr->createElement('Number', 4);
169 $e_Refill->appendChild($e_Number);
171 } while ($value = sqlFetchArray($result));