edihistory -- revisions and cleanup of 277 claim status functions
[openemr.git] / ccr / createCCRAlerts.php
blobdb816b4d06e594d1cc4a916453ea0dc13abcca09
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 = getAlertData();
29 $row = sqlFetchArray($result);
31 do {
33 //while ($row = sqlFetchArray($result)) {
35 $e_Alert = $ccr->createElement('Alert');
36 $e_Alerts->appendChild($e_Alert);
38 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
39 $e_Alert->appendChild($e_CCRDataObjectID);
41 $e_DateTime = $ccr->createElement('DateTime');
42 $e_Alert->appendChild($e_DateTime);
44 $date = date_create($row['date']);
46 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
47 $e_DateTime->appendChild($e_ExactDateTime);
49 $e_IDs = $ccr->createElement('IDs');
50 $e_Alert->appendChild($e_IDs);
52 $e_ID = $ccr->createElement('ID', $row['pid']);
53 $e_IDs->appendChild($e_ID);
55 $e_IDs->appendChild(sourceType($ccr, $sourceID));
57 $e_Type = $ccr->createElement('Type');
58 $e_Alert->appendChild($e_Type);
60 $e_Text = $ccr->createElement('Text', $row['type'].'-'.$row['alert_title']);
61 $e_Type->appendChild($e_Text);
63 $e_Description = $ccr->createElement('Description');
64 $e_Alert->appendChild($e_Description);
66 $e_Text = $ccr->createElement('Text', $row['code_text']);
67 $e_Description->appendChild($e_Text);
69 $e_Code = $ccr->createElement('Code');
70 $e_Description->appendChild($e_Code);
72 $e_Value = $ccr->createElement('Value', $row['diagnosis']);
73 $e_Code->appendChild($e_Value);
75 $e_Alert->appendChild(sourceType($ccr, $sourceID));
77 $e_Agent = $ccr->createElement('Agent');
78 $e_Alert->appendChild($e_Agent);
80 $e_EnvironmentalAgents = $ccr->createElement('EnvironmentalAgents');
81 $e_Agent->appendChild($e_EnvironmentalAgents);
83 $e_EnvironmentalAgent = $ccr->createElement('EnvironmentalAgent');
84 $e_EnvironmentalAgents->appendChild($e_EnvironmentalAgent);
86 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
87 $e_EnvironmentalAgent->appendChild($e_CCRDataObjectID);
89 $e_DateTime = $ccr->createElement('DateTime');
90 $e_EnvironmentalAgent->appendChild($e_DateTime);
92 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $row['date']);
93 $e_DateTime->appendChild($e_ExactDateTime);
95 $e_Description = $ccr->createElement('Description' );
96 $e_EnvironmentalAgent->appendChild($e_Description);
98 $e_Text = $ccr->createElement('Text', $row['alert_title']);
99 $e_Description->appendChild($e_Text);
101 $e_Code = $ccr->createElement('Code');
102 $e_Description->appendChild($e_Code);
104 $e_Value = $ccr->createElement('Value');//,$row['codetext']
105 $e_Code->appendChild($e_Value);
107 $e_Status = $ccr->createElement('Status');
108 $e_EnvironmentalAgent->appendChild($e_Status);
110 $e_Text = $ccr->createElement('Text',$row['outcome']);
111 $e_Status->appendChild($e_Text);
113 $e_EnvironmentalAgent->appendChild(sourceType($ccr, $sourceID));
115 $e_Reaction = $ccr->createElement('Reaction');
116 $e_Alert->appendChild($e_Reaction);
118 $e_Description = $ccr->createElement('Description');
119 $e_Reaction->appendChild($e_Description);
121 $e_Text = $ccr->createElement('Text', $row['reaction']);
122 $e_Description->appendChild($e_Text);
124 $e_Status = $ccr->createElement('Status');
125 $e_Reaction->appendChild($e_Status);
127 $e_Text = $ccr->createElement('Text', 'None');
128 $e_Status->appendChild($e_Text);
130 } while ($row = sqlFetchArray($result));