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. //
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. //
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. //
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);
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', 'Medication');
51 $e_Type->appendChild($e_Text);
53 $e_Status = $ccr->createElement('Status');
54 $e_Medication->appendChild($e_Status);
56 $e_Text = $ccr->createElement('Text',$value['active']);
57 $e_Status->appendChild($e_Text);
59 $e_Medication->appendChild(sourceType($ccr, $sourceID));
61 $e_Product = $ccr->createElement('Product');
62 $e_Medication->appendChild($e_Product);
64 $e_ProductName = $ccr->createElement('ProductName');
65 $e_Product->appendChild($e_ProductName);
67 $e_Text = $ccr->createElement('Text',$value['drug']);
68 $e_ProductName->appendChild(clone $e_Text);
70 $e_Strength = $ccr->createElement('Strength');
71 $e_Product->appendChild($e_Strength);
73 $e_Value = $ccr->createElement('Value', $value['size']);
74 $e_Strength->appendChild($e_Value);
76 $e_Units = $ccr->createElement('Units');
77 $e_Strength->appendChild($e_Units);
79 $e_Unit = $ccr->createElement('Unit', $value['title']);
80 $e_Units->appendChild($e_Unit);
82 $e_Form = $ccr->createElement('Form');
83 $e_Product->appendChild($e_Form);
85 $e_Text = $ccr->createElement('Text', $value['form']);
86 $e_Form->appendChild($e_Text);
88 $e_Quantity = $ccr->createElement('Quantity');
89 $e_Medication->appendChild($e_Quantity);
91 $e_Value = $ccr->createElement('Value', $value['quantity']);
92 $e_Quantity->appendChild($e_Value);
94 $e_Units = $ccr->createElement('Units');
95 $e_Quantity->appendChild($e_Units);
97 $e_Unit = $ccr->createElement('Unit', '');
98 $e_Units->appendChild($e_Unit);
100 $e_Directions = $ccr->createElement('Directions');
101 $e_Medication->appendChild($e_Directions);
103 $e_Direction = $ccr->createElement('Direction');
104 $e_Directions->appendChild($e_Direction);
106 $e_Description = $ccr->createElement('Description');
107 $e_Direction->appendChild($e_Description);
109 $e_Text = $ccr->createElement('Text', '');
110 $e_Description->appendChild(clone $e_Text);
112 $e_Route = $ccr->createElement('Route');
113 $e_Direction->appendChild($e_Route);
115 $e_Text = $ccr->createElement('Text', 'Tablet');
116 $e_Route->appendChild($e_Text);
118 $e_Site = $ccr->createElement('Site');
119 $e_Direction->appendChild($e_Site);
121 $e_Text = $ccr->createElement('Text', 'Oral');
122 $e_Site->appendChild($e_Text);
124 $e_PatientInstructions = $ccr->createElement('PatientInstructions');
125 $e_Medication->appendChild($e_PatientInstructions);
127 $e_Instruction = $ccr->createElement('Instruction');
128 $e_PatientInstructions->appendChild($e_Instruction);
130 $e_Text = $ccr->createElement('Text', $value['note']);
131 $e_Instruction->appendChild($e_Text);
133 $e_Refills = $ccr->createElement('Refills');
134 $e_Medication->appendChild($e_Refills);
136 $e_Refill = $ccr->createElement('Refill');
137 $e_Refills->appendChild($e_Refill);
139 $e_Number = $ccr->createElement('Number', $value['refills']);
140 $e_Refill->appendChild($e_Number);
142 } while ($value = sqlFetchArray($result));