Fixed patient and encounter links in main title frame to ensure use correct session
[openemr.git] / ccr / createCCRAlerts.php
blob064f49b7b15ddae6c4c4ae73a9e167dd62fa4c61
1 <?php
2 /**
3 * CCR Script.
5 * Copyright (C) 2010 Garden State Health Systems <http://www.gshsys.com/>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Garden State Health Systems <http://www.gshsys.com/>
20 * @link http://www.open-emr.org
24 $result = getAlertData();
25 $row = sqlFetchArray($result);
27 do {
29 //while ($row = sqlFetchArray($result)) {
31 $e_Alert = $ccr->createElement('Alert');
32 $e_Alerts->appendChild($e_Alert);
34 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
35 $e_Alert->appendChild($e_CCRDataObjectID);
37 $e_DateTime = $ccr->createElement('DateTime');
38 $e_Alert->appendChild($e_DateTime);
40 $date = date_create($row['date']);
42 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
43 $e_DateTime->appendChild($e_ExactDateTime);
45 $e_IDs = $ccr->createElement('IDs');
46 $e_Alert->appendChild($e_IDs);
48 $e_ID = $ccr->createElement('ID', $row['pid']);
49 $e_IDs->appendChild($e_ID);
51 $e_IDs->appendChild(sourceType($ccr, $sourceID));
53 $e_Type = $ccr->createElement('Type');
54 $e_Alert->appendChild($e_Type);
56 $e_Text = $ccr->createElement('Text', $row['type'].'-'.$row['alert_title']);
57 $e_Type->appendChild($e_Text);
59 $e_Description = $ccr->createElement('Description');
60 $e_Alert->appendChild($e_Description);
62 $e_Text = $ccr->createElement('Text', $row['code_text']);
63 $e_Description->appendChild($e_Text);
65 $e_Code = $ccr->createElement('Code');
66 $e_Description->appendChild($e_Code);
68 $e_Value = $ccr->createElement('Value', $row['diagnosis']);
69 $e_Code->appendChild($e_Value);
71 $e_Alert->appendChild(sourceType($ccr, $sourceID));
73 $e_Agent = $ccr->createElement('Agent');
74 $e_Alert->appendChild($e_Agent);
76 $e_EnvironmentalAgents = $ccr->createElement('EnvironmentalAgents');
77 $e_Agent->appendChild($e_EnvironmentalAgents);
79 $e_EnvironmentalAgent = $ccr->createElement('EnvironmentalAgent');
80 $e_EnvironmentalAgents->appendChild($e_EnvironmentalAgent);
82 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', getUuid());
83 $e_EnvironmentalAgent->appendChild($e_CCRDataObjectID);
85 $e_DateTime = $ccr->createElement('DateTime');
86 $e_EnvironmentalAgent->appendChild($e_DateTime);
88 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $row['date']);
89 $e_DateTime->appendChild($e_ExactDateTime);
91 $e_Description = $ccr->createElement('Description' );
92 $e_EnvironmentalAgent->appendChild($e_Description);
94 $e_Text = $ccr->createElement('Text', $row['alert_title']);
95 $e_Description->appendChild($e_Text);
97 $e_Code = $ccr->createElement('Code');
98 $e_Description->appendChild($e_Code);
100 $e_Value = $ccr->createElement('Value');//,$row['codetext']
101 $e_Code->appendChild($e_Value);
103 $e_Status = $ccr->createElement('Status');
104 $e_EnvironmentalAgent->appendChild($e_Status);
106 $e_Text = $ccr->createElement('Text',$row['outcome']);
107 $e_Status->appendChild($e_Text);
109 $e_EnvironmentalAgent->appendChild(sourceType($ccr, $sourceID));
111 $e_Reaction = $ccr->createElement('Reaction');
112 $e_Alert->appendChild($e_Reaction);
114 $e_Description = $ccr->createElement('Description');
115 $e_Reaction->appendChild($e_Description);
117 $e_Text = $ccr->createElement('Text', $row['reaction']);
118 $e_Description->appendChild($e_Text);
120 $e_Status = $ccr->createElement('Status');
121 $e_Reaction->appendChild($e_Status);
123 $e_Text = $ccr->createElement('Text', 'None');
124 $e_Status->appendChild($e_Text);
126 } while ($row = sqlFetchArray($result));