remove obsolete frame divider images
[openemr.git] / library / freeb / Diagnosis.class.php
blob89b9b96801cb598daa73cabb4b41229d19cc41d2
1 <?php
2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class Diagnosis Extends DataObjectBase {
7 function Diagnosis() {
8 $this->_addFunc("relatedtohcfa", array( "name" => "FreeB.FBDiagnosis.RelatedToHCFA",
9 "sig" => array(XMLRPCSTRING,XMLRPCINT),
10 "doc" => ""));
11 $this->_addFunc("isrelatedtootheraccident", array( "name" => "FreeB.FBDiagnosis.isRelatedToOtherAccident",
12 "sig" => array(XMLRPCSTRING,XMLRPCINT),
13 "doc" => ""));
14 $this->_addFunc("dateofencounter", array("name" => "FreeB.FBDiagnosis.DateOfEncounter",
15 "sig" => array(XMLRPCSTRING,XMLRPCINT),
16 "doc" => ""));
17 $this->_addFunc("dateofonset", array( "name" => "FreeB.FBDiagnosis.DateOfOnset",
18 "sig" => array(XMLRPCSTRING,XMLRPCINT),
19 "doc" => ""));
20 $this->_addFunc("dateoffirstsymptom", array( "name" => "FreeB.FBDiagnosis.DateOfFirstSymptom",
21 "sig" => array(XMLRPCSTRING,XMLRPCINT),
22 "doc" => ""));
23 $this->_addFunc("isfirstoccurence", array( "name" => "FreeB.FBDiagnosis.isFirstOccurrence",
24 "sig" => array(XMLRPCSTRING,XMLRPCINT),
25 "doc" => ""));
26 $this->_addFunc("dateoffirstoccurence", array( "name" => "FreeB.FBDiagnosis.DateOfFirstOccurrence",
27 "sig" => array(XMLRPCSTRING,XMLRPCINT),
28 "doc" => ""));
29 $this->_addFunc("iscantwork", array( "name" => "FreeB.FBDiagnosis.isCantWork",
30 "sig" => array(XMLRPCSTRING,XMLRPCINT),
31 "doc" => ""));
32 $this->_addFunc("dateofcantworkstart", array( "name" => "FreeB.FBDiagnosis.DateOfCantWorkStart",
33 "sig" => array(XMLRPCSTRING,XMLRPCINT),
34 "doc" => ""));
35 $this->_addFunc("dateofcantworkend", array( "name" => "FreeB.FBDiagnosis.DateOfCantWorkEnd",
36 "sig" => array(XMLRPCSTRING,XMLRPCINT),
37 "doc" => ""));
38 $this->_addFunc("isrelatedtoemployment", array( "name" => "FreeB.FBDiagnosis.isRelatedToEmployment",
39 "sig" => array(XMLRPCSTRING,XMLRPCINT),
40 "doc" => ""));
41 $this->_addFunc("isrelatedtoautoaccident", array( "name" => "FreeB.FBDiagnosis.isRelatedToAutoAccident",
42 "sig" => array(XMLRPCSTRING,XMLRPCINT),
43 "doc" => ""));
44 $this->_addFunc("autoaccidentstate", array( "name" => "FreeB.FBDiagnosis.AutoAccidentState",
45 "sig" => array(XMLRPCSTRING,XMLRPCINT),
46 "doc" => ""));
47 $this->_addFunc("icd10code", array( "name" => "FreeB.FBDiagnosis.ICD10Code",
48 "sig" => array(XMLRPCSTRING,XMLRPCINT),
49 "doc" => ""));
50 $this->_addFunc("icd9code", array( "name" => "FreeB.FBDiagnosis.ICD9Code",
51 "sig" => array(XMLRPCSTRING,XMLRPCINT),
52 "doc" => ""));
53 $this->_addFunc("dateoflastvisit", array( "name" => "FreeB.FBDiagnosis.DateOfLastVisit",
54 "sig" => array(XMLRPCSTRING,XMLRPCINT),
55 "doc" => ""));
56 $this->_addFunc("comment", array( "name" => "FreeB.FBDiagnosis.Comment",
57 "sig" => array(XMLRPCSTRING,XMLRPCINT),
58 "doc" => ""));
61 function relatedtohcfa($m) {
63 $err="";
65 //unimplemented by OpenEMR
66 $retval = "";
68 // if we generated an error, create an error return response
69 if ($err) {
70 return $this->_handleError($err);
72 else {
73 // otherwise, we create the right response
74 // with the state name
75 return new xmlrpcresp(new xmlrpcval($retval,"string"));
79 function isrelatedtootheraccident($m) {
81 $err="";
82 //unimplemented by OpenEMR
83 $retval = false;
85 // if we generated an error, create an error return response
86 if ($err) {
87 return $this->_handleError($err);
89 else {
90 // otherwise, we create the right response
91 // with the state name
92 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
96 function dateofencounter($m) {
97 $err="";
98 $retval ="";
99 $obj= $m->getparam(0);
100 $key = $obj->getval();
102 $sql = "SELECT * FROM form_encounter where encounter = '" . $_SESSION['billkey'] .
103 "' and pid = '" . $_SESSION['patient_id'] ."' order by date DESC";
104 $db = $GLOBALS['adodb']['db'];
105 $results = $db->Execute($sql);
107 if (!$results) {
108 $err = $db->ErrorMsg();
110 else {
111 if (!$results->EOF) {
112 $retval = $results->fields['date'];
115 $retval = date("Y-m-d",strtotime($retval));
116 $retval = $this->_isodate($retval);
118 // if we generated an error, create an error return response
119 if ($err) {
120 return $this->_handleError($err);
122 else {
123 // otherwise, we create the right response
124 // with the state name
125 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME));
129 function dateofonset($m) {
131 $err="";
133 $retval ="";
134 $obj= $m->getparam(0);
135 $key = $obj->getval();
137 $sql = "SELECT * FROM form_encounter where encounter = '" . $_SESSION['billkey'] ."' and pid = '" . $_SESSION['patient_id'] ."' order by date DESC";
138 //echo $sql;
139 $db = $GLOBALS['adodb']['db'];
140 $results = $db->Execute($sql);
142 if (!$results) {
143 $err = $db->ErrorMsg();
145 else {
146 if (!$results->EOF) {
147 $retval = $results->fields['onset_date'];
150 $retval = date("Y-m-d",strtotime($retval));
151 $retval = $this->_isodate($retval);
153 // if we generated an error, create an error return response
154 if ($err) {
155 return $this->_handleError($err);
157 else {
158 // otherwise, we create the right response
159 // with the state name
160 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME));
164 function dateoffirstsymptom($m) {
166 $err="";
168 $retval ="";
169 $obj= $m->getparam(0);
170 $key = $obj->getval();
172 $sql = "SELECT * FROM form_encounter where encounter = '" . $_SESSION['billkey'] ."' and pid = '" . $_SESSION['patient_id'] ."' order by date DESC";
173 //echo $sql;
174 $db = $GLOBALS['adodb']['db'];
175 $results = $db->Execute($sql);
177 if (!$results) {
178 $err = $db->ErrorMsg();
180 else {
181 if (!$results->EOF) {
182 $retval = $results->fields['onset_date'];
185 $retval = date("Y-m-d",strtotime($retval));
186 $retval = $this->_isodate($retval);
188 // if we generated an error, create an error return response
189 if ($err) {
190 return $this->_handleError($err);
192 else {
193 // otherwise, we create the right response
194 // with the state name
195 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME));
199 function isfirstoccurence($m) {
201 $err="";
203 //unimplemented by OpenEMR
204 $pkey = false;
206 // if we generated an error, create an error return response
207 if ($err) {
208 return $this->_handleError($err);
210 else {
211 // otherwise, we create the right response
212 // with the state name
213 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
217 function dateoffirstoccurence($m) {
219 $err="";
221 $retval ="";
222 $obj= $m->getparam(0);
223 $key = $obj->getval();
225 $sql = "SELECT * FROM form_encounter where encounter = '" . $_SESSION['billkey'] ."' and pid = '" . $_SESSION['patient_id'] ."' order by date DESC";
226 //echo $sql;
227 $db = $GLOBALS['adodb']['db'];
228 $results = $db->Execute($sql);
230 if (!$results) {
231 $err = $db->ErrorMsg();
233 else {
234 if (!$results->EOF) {
235 $retval = $results->fields['onset_date'];
238 $retval = date("Y-m-d",strtotime($retval));
239 $retval = $this->_isodate($retval);
241 // if we generated an error, create an error return response
242 if ($err) {
243 return $this->_handleError($err);
245 else {
246 // otherwise, we create the right response
247 // with the state name
248 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME));
252 function iscantwork($m) {
254 $err="";
256 //unimplemented by OpenEMR
257 $pkey = false;
259 // if we generated an error, create an error return response
260 if ($err) {
261 return $this->_handleError($err);
263 else {
264 // otherwise, we create the right response
265 // with the state name
266 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
270 function dateofcantworkstart($m) {
272 $err="";
273 //unimplemented by OpenEMR
274 $pkey = $this->_isodate("");
276 // if we generated an error, create an error return response
277 if ($err) {
278 return $this->_handleError($err);
280 else {
281 // otherwise, we create the right response
282 // with the state name
283 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME));
287 function dateofcantworkend($m) {
289 $err="";
290 //unimplemented by OpenEMR
291 $pkey = $this->_isodate("");
293 // if we generated an error, create an error return response
294 if ($err) {
295 return $this->_handleError($err);
297 else {
298 // otherwise, we create the right response
299 // with the state name
300 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME));
304 function isrelatedtoemployment($m) {
306 $err="";
308 //unimplemented by OpenEMR
309 $pkey = false;
311 // if we generated an error, create an error return response
312 if ($err) {
313 return $this->_handleError($err);
315 else {
316 // otherwise, we create the right response
317 // with the state name
318 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
322 function isrelatedtoautoaccident($m) {
324 $err="";
325 //unimplemented by OpenEMR
326 $pkey = "";
328 // if we generated an error, create an error return response
329 if ($err) {
330 return $this->_handleError($err);
332 else {
333 // otherwise, we create the right response
334 // with the state name
335 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
339 function autoaccidentstate($m) {
341 $err="";
343 //unimplmeneted by OpenEMR
344 $pkey = "";
346 // if we generated an error, create an error return response
347 if ($err) {
348 return $this->_handleError($err);
350 else {
351 // otherwise, we create the right response
352 // with the state name
353 return new xmlrpcresp(new xmlrpcval($pkey));
356 function icd10code($m) {
358 $err="";
359 //unimplemented by OpenEMR
360 $pkey = "";
362 // if we generated an error, create an error return response
363 if ($err) {
364 return $this->_handleError($err);
366 else {
367 // otherwise, we create the right response
368 // with the state name
369 return new xmlrpcresp(new xmlrpcval($pkey));
372 function icd9code($m) {
374 $err="";
376 $obj= $m->getparam(0);
377 $key = $obj->getval();
379 $sql = "SELECT * FROM billing where id = '" . $key . "'";
380 //echo $sql;
381 $db = $GLOBALS['adodb']['db'];
382 $results = $db->Execute($sql);
384 if (!$results) {
385 $err = $db->ErrorMsg();
387 else {
388 if (!$results->EOF) {
389 $retval = $results->fields['code'];
392 $retval = str_replace("."," ", $retval);
394 // if we generated an error, create an error return response
395 if ($err) {
396 return $this->_handleError($err);
398 else {
399 // otherwise, we create the right response
400 // with the state name
401 return new xmlrpcresp(new xmlrpcval($retval,"string"));
404 function dateoflastvisit($m){
405 $err="";
407 $retval ="";
408 $obj= $m->getparam(0);
409 $key = $obj->getval();
411 $sql = "SELECT * FROM form_encounter where encounter = '" . $_SESSION['billkey'] ."' and pid = '" . $_SESSION['patient_id'] ."' order by date DESC";
412 //echo $sql;
413 $db = $GLOBALS['adodb']['db'];
414 $results = $db->Execute($sql);
416 if (!$results) {
417 $err = $db->ErrorMsg();
419 else {
420 if (!$results->EOF) {
421 $retval = $results->fields['date'];
424 $retval = date("Y-m-d",strtotime($retval));
425 $retval = $this->_isodate($retval);
427 // if we generated an error, create an error return response
428 if ($err) {
429 return $this->_handleError($err);
431 else {
432 // otherwise, we create the right response
433 // with the state name
434 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME));
437 function comment($m){
438 $err="";
440 $retval ="";
441 $obj= $m->getparam(0);
442 $key = $obj->getval();
444 $sql = "SELECT reason FROM form_encounter where encounter = '" . $_SESSION['billkey'] ."' and pid = '" . $_SESSION['patient_id'] ."'";
445 //echo $sql;
446 $db = $GLOBALS['adodb']['db'];
447 $results = $db->Execute($sql);
449 if (!$results) {
450 $err = $db->ErrorMsg();
452 else {
453 if (!$results->EOF) {
454 $retval = $results->fields['reason'];
458 // if we generated an error, create an error return response
459 if ($err) {
460 return $this->_handleError($err);
462 else {
463 // otherwise, we create the right response
464 // with the state name
465 return new xmlrpcresp(new xmlrpcval($retval,"string"));
469 //'FreeB.FBDiagnosis.RelatedToHCFA' => \&FreeB_FBDiagnosis_RelatedToHCFA,
470 //'FreeB.FBDiagnosis.isRelatedToOtherAccident' => \&FreeB_FBDiagnosis_isRelatedToOtherAccident,
471 //'FreeB.FBDiagnosis.DateOfOnset' => \&FreeB_FBDiagnosis_DateOfOnset,
472 //'FreeB.FBDiagnosis.DateOfFirstSymptom' => \&FreeB_FBDiagnosis_DateOfFirstSymptom,
473 //'FreeB.FBDiagnosis.isFirstOccurrence' => \&FreeB_FBDiagnosis_isFirstOccurence,
474 //'FreeB.FBDiagnosis.DateOfFirstOccurrence' => \&FreeB_FBDiagnosis_DateOfFirstOccurence,
475 //'FreeB.FBDiagnosis.isCantWork' => \&FreeB_FBDiagnosis_isCantWork,
476 //'FreeB.FBDiagnosis.DateOfCantWorkStart' => \&FreeB_FBDiagnosis_DateOfCantWorkStart,
477 //'FreeB.FBDiagnosis.DateOfCantWorkEnd' => \&FreeB_FBDiagnosis_DateOfCantWorkEnd,
478 //'FreeB.FBDiagnosis.isRelatedToEmployment' => \&FreeB_FBDiagnosis_isRelatedToEmployment,
479 //'FreeB.FBDiagnosis.isRelatedToAutoAccident' => \&FreeB_FBDiagnosis_isRelatedToAutoAccident,
480 //'FreeB.FBDiagnosis.AutoAccidentState' => \&FreeB_FBDiagnosis_AutoAccidentState,
481 //'FreeB.FBDiagnosis.ICD10Code' => \&FreeB_FBDiagnosis_ICD9Code,
482 //'FreeB.FBDiagnosis.ICD9Code' => \&FreeB_FBDiagnosis_ICD9Code,?>