added Filipino language
[openemr.git] / ccr / createCCRProblem.php
blobedc73e0058586ab568122c2b3fbb8767c7748d10
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 = getProblemData();
25 $row = sqlFetchArray($result);
26 $pCount =0;
27 //while ($row = sqlFetchArray($result)) {
29 do {
30 $pCount++;
32 $e_Problem = $ccr->createElement('Problem');
33 $e_Problems->appendChild($e_Problem);
35 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', 'PROB'.$pCount);
36 $e_Problem->appendChild($e_CCRDataObjectID);
38 $e_DateTime = $ccr->createElement('DateTime');
39 $e_Problem->appendChild($e_DateTime);
41 $date = date_create($row['date']);
43 $e_ExactDateTime = $ccr->createElement('ExactDateTime', $date->format('Y-m-d\TH:i:s\Z'));
44 $e_DateTime->appendChild($e_ExactDateTime);
46 $e_IDs = $ccr->createElement('IDs');
47 $e_Problem->appendChild($e_IDs);
49 $e_ID = $ccr->createElement('ID', $row['pid']);
50 $e_IDs->appendChild($e_ID);
52 $e_IDs->appendChild(sourceType($ccr, $sourceID));
54 $e_Type = $ccr->createElement('Type');
55 $e_Problem->appendChild($e_Type);
57 $e_Text = $ccr->createElement('Text', 'Problem'); // Changed to pass through validator, Problem type must be one of the required string values: Problem, Condition, Diagnosis, Symptom, Finding, Complaint, Functional Limitation.
58 //$e_Text = $ccr->createElement('Text', $row['prob_title']);
59 $e_Type->appendChild($e_Text);
61 $e_Description = $ccr->createElement('Description');
62 $e_Problem->appendChild($e_Description);
64 $e_Text = $ccr->createElement('Text', lookup_code_descriptions($row['diagnosis']));
65 $e_Description->appendChild($e_Text);
67 $e_Code = $ccr->createElement('Code');
68 $e_Description->appendChild($e_Code);
70 $e_Value = $ccr->createElement('Value', $row['diagnosis']);
71 $e_Code->appendChild($e_Value);
73 $e_Value = $ccr->createElement('CodingSystem', 'ICD9-CM');
74 $e_Code->appendChild($e_Value);
76 $e_Status = $ccr->createElement('Status');
77 $e_Problem->appendChild($e_Status);
79 // $e_Text = $ccr->createElement('Text', $row['outcome']);
80 $e_Text = $ccr->createElement('Text', 'Active');
81 $e_Status->appendChild($e_Text);
83 //$e_CommentID = $ccr->createElement('CommentID', $row['comments']);
84 //$e_Problem->appendChild($e_CommentID);
86 $e_Source = $ccr->createElement('Source');
88 $e_Actor = $ccr->createElement('Actor');
89 $e_Source->appendChild($e_Actor);
91 $e_ActorID = $ccr->createElement('ActorID', $uuid);
92 $e_Actor->appendChild($e_ActorID);
94 $e_Problem->appendChild($e_Source);
96 $e_CommentID = $ccr->createElement('CommentID', $row['comments']);
97 $e_Problem->appendChild($e_CommentID);
99 $e_Episodes = $ccr->createElement('Episodes');
100 $e_Problem->appendChild($e_Episodes);
102 $e_Number = $ccr->createElement('Number');
103 $e_Episodes->appendChild($e_Number);
105 $e_Episode = $ccr->createElement('Episode');
106 $e_Episodes->appendChild($e_Episode);
108 $e_CCRDataObjectID = $ccr->createElement('CCRDataObjectID', 'EP'.$pCount);
109 $e_Episode->appendChild($e_CCRDataObjectID);
111 $e_Episode->appendChild(sourceType($ccr, $sourceID));
113 $e_Episodes->appendChild(sourceType($ccr, $sourceID));
115 $e_HealthStatus = $ccr->createElement('HealthStatus');
116 $e_Problem->appendChild($e_HealthStatus);
118 $e_DateTime = $ccr->createElement('DateTime');
119 $e_HealthStatus->appendChild($e_DateTime);
121 $e_ExactDateTime = $ccr->createElement('ExactDateTime');
122 $e_DateTime->appendChild($e_ExactDateTime);
124 $e_Description = $ccr->createElement('Description');
125 $e_HealthStatus->appendChild($e_Description);
127 $e_Text = $ccr->createElement('Text', $row['reason']);
128 $e_Description->appendChild($e_Text);
130 $e_HealthStatus->appendChild(sourceType($ccr, $sourceID));
131 } while ($row = sqlFetchArray($result));
134 // complex type should go in different find and should be included in createCCR.php
136 function sourceType($ccr, $uuid){
138 $e_Source = $ccr->createElement('Source');
140 $e_Actor = $ccr->createElement('Actor');
141 $e_Source->appendChild($e_Actor);
143 $e_ActorID = $ccr->createElement('ActorID',$uuid);
144 $e_Actor->appendChild($e_ActorID);
146 return $e_Source;