bug: fix typo in 837I script (#7469)
[openemr.git] / ccr / createCCRAlerts.php
blobba96285b01d1c5d1ef118990adfff73f59e98c8f
1 <?php
3 /**
4 * CCR Script.
6 * Copyright (C) 2010 Garden State Health Systems <http://www.gshsys.com/>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Garden State Health Systems <http://www.gshsys.com/>
21 * @link http://www.open-emr.org
24 $result = getAlertData();
25 $row = sqlFetchArray($result);
27 do {
28 //while ($row = sqlFetchArray($result)) {
30 $e_Alert = $ccr->createElement('Alert');
31 $e_Alerts->appendChild($e_Alert);
33 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
34 $e_Alert->appendChild($e_CCRDataObjectID);
36 $e_DateTime = $ccr->createElement('DateTime');
37 $e_Alert->appendChild($e_DateTime);
39 $date = date_create($row['date'] ?? '');
41 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
42 $e_DateTime->appendChild($e_ExactDateTime);
44 $e_IDs = $ccr->createElement('IDs');
45 $e_Alert->appendChild($e_IDs);
47 $e_ID = $ccr->createElement('ID', $row['pid'] ?? '');
48 $e_IDs->appendChild($e_ID);
50 $e_IDs->appendChild(sourceType($ccr, $sourceID));
52 $e_Type = $ccr->createElement('Type');
53 $e_Alert->appendChild($e_Type);
55 $e_Text = $ccr->createElement('Text', ($row['type'] ?? '') . '-' . ($row['alert_title'] ?? ''));
56 $e_Type->appendChild($e_Text);
58 $e_Description = $ccr->createElement('Description');
59 $e_Alert->appendChild($e_Description);
61 $e_Text = $ccr->createElement('Text', $row['code_text'] ?? '');
62 $e_Description->appendChild($e_Text);
64 $e_Code = $ccr->createElement('Code');
65 $e_Description->appendChild($e_Code);
67 $e_Value = $ccr->createElement('Value', $row['diagnosis'] ?? '');
68 $e_Code->appendChild($e_Value);
70 $e_Alert->appendChild(sourceType($ccr, $sourceID));
72 $e_Agent = $ccr->createElement('Agent');
73 $e_Alert->appendChild($e_Agent);
75 $e_EnvironmentalAgents = $ccr->createElement('EnvironmentalAgents');
76 $e_Agent->appendChild($e_EnvironmentalAgents);
78 $e_EnvironmentalAgent = $ccr->createElement('EnvironmentalAgent');
79 $e_EnvironmentalAgents->appendChild($e_EnvironmentalAgent);
81 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
82 $e_EnvironmentalAgent->appendChild($e_CCRDataObjectID);
84 $e_DateTime = $ccr->createElement('DateTime');
85 $e_EnvironmentalAgent->appendChild($e_DateTime);
87 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $row['date'] ?? '');
88 $e_DateTime->appendChild($e_ExactDateTime);
90 $e_Description = $ccr->createElement('Description');
91 $e_EnvironmentalAgent->appendChild($e_Description);
93 $e_Text = $ccr->createElement('Text', $row['alert_title'] ?? '');
94 $e_Description->appendChild($e_Text);
96 $e_Code = $ccr->createElement('Code');
97 $e_Description->appendChild($e_Code);
99 $e_Value = $ccr->createElement('Value');//,$row['codetext']
100 $e_Code->appendChild($e_Value);
102 $e_Status = $ccr->createElement('Status');
103 $e_EnvironmentalAgent->appendChild($e_Status);
105 $e_Text = $ccr->createElement('Text', $row['outcome'] ?? '');
106 $e_Status->appendChild($e_Text);
108 $e_EnvironmentalAgent->appendChild(sourceType($ccr, $sourceID));
110 $e_Reaction = $ccr->createElement('Reaction');
111 $e_Alert->appendChild($e_Reaction);
113 $e_Description = $ccr->createElement('Description');
114 $e_Reaction->appendChild($e_Description);
116 $e_Text = $ccr->createElement('Text', $row['reaction'] ?? '');
117 $e_Description->appendChild($e_Text);
119 $e_Status = $ccr->createElement('Status');
120 $e_Reaction->appendChild($e_Status);
122 $e_Text = $ccr->createElement('Text', 'None');
123 $e_Status->appendChild($e_Text);
124 } while ($row = sqlFetchArray($result));