Some further cleanup for chartable LBF forms.
[openemr.git] / ccr / createCCRAlerts.php
bloba5b21bc8aa79e358b4e1c2632a9ded475061fb74
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 = getAlertData();
30 $row = sqlFetchArray($result);
32 do {
34 //while ($row = sqlFetchArray($result)) {
36 $e_Alert = $ccr->createElement('Alert');
37 $e_Alerts->appendChild($e_Alert);
39 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
40 $e_Alert->appendChild($e_CCRDataObjectID);
42 $e_DateTime = $ccr->createElement('DateTime');
43 $e_Alert->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_IDs = $ccr->createElement('IDs');
51 $e_Alert->appendChild($e_IDs);
53 $e_ID = $ccr->createElement('ID', $row['pid']);
54 $e_IDs->appendChild($e_ID);
56 $e_IDs->appendChild(sourceType($ccr, $authorID));
58 $e_Type = $ccr->createElement('Type');
59 $e_Alert->appendChild($e_Type);
61 $e_Text = $ccr->createElement('Text', $row['type'].'-'.$row['alert_title']);
62 $e_Type->appendChild($e_Text);
64 $e_Description = $ccr->createElement('Description');
65 $e_Alert->appendChild($e_Description);
67 $e_Text = $ccr->createElement('Text', $row['code_text']);
68 $e_Description->appendChild($e_Text);
70 $e_Code = $ccr->createElement('Code');
71 $e_Description->appendChild($e_Code);
73 $e_Value = $ccr->createElement('Value', $row['diagnosis']);
74 $e_Code->appendChild($e_Value);
76 $e_Alert->appendChild(sourceType($ccr, $authorID));
78 $e_Agent = $ccr->createElement('Agent');
79 $e_Alert->appendChild($e_Agent);
81 $e_EnvironmentalAgents = $ccr->createElement('EnvironmentalAgents');
82 $e_Agent->appendChild($e_EnvironmentalAgents);
84 $e_EnvironmentalAgent = $ccr->createElement('EnvironmentalAgent');
85 $e_EnvironmentalAgents->appendChild($e_EnvironmentalAgent);
87 $e_DateTime = $ccr->createElement('DateTime');
88 $e_EnvironmentalAgent->appendChild($e_DateTime);
90 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $row['date']);
91 $e_DateTime->appendChild($e_ExactDateTime);
93 $e_Description = $ccr->createElement('Description' );
94 $e_EnvironmentalAgent->appendChild($e_Description);
96 $e_Text = $ccr->createElement('Text', $row['alert_title']);
97 $e_Description->appendChild($e_Text);
99 $e_Code = $ccr->createElement('Code');
100 $e_Description->appendChild($e_Code);
102 $e_Value = $ccr->createElement('Value');//,$row['codetext']
103 $e_Code->appendChild($e_Value);
105 $e_Status = $ccr->createElement('Status');
106 $e_EnvironmentalAgent->appendChild($e_Status);
108 $e_Text = $ccr->createElement('Text',$row['outcome']);
109 $e_Status->appendChild($e_Text);
111 $e_EnvironmentalAgent->appendChild(sourceType($ccr, $authorID));
113 $e_Reaction = $ccr->createElement('Reaction');
114 $e_Alert->appendChild($e_Reaction);
116 $e_Description = $ccr->createElement('Description');
117 $e_Reaction->appendChild($e_Description);
119 $e_Text = $ccr->createElement('Text', 'None');
120 $e_Description->appendChild($e_Text);
122 $e_Status = $ccr->createElement('Status');
123 $e_Reaction->appendChild($e_Status);
125 $e_Text = $ccr->createElement('Text', 'None');
126 $e_Status->appendChild($e_Text);
128 } while ($row = sqlFetchArray($result));