2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class Diagnosis
Extends DataObjectBase
{
8 $this->_addFunc("relatedtohcfa", array( "name" => "FreeB.FBDiagnosis.RelatedToHCFA",
9 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
11 $this->_addFunc("isrelatedtootheraccident", array( "name" => "FreeB.FBDiagnosis.isRelatedToOtherAccident",
12 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
14 $this->_addFunc("dateofencounter", array("name" => "FreeB.FBDiagnosis.DateOfEncounter",
15 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
17 $this->_addFunc("dateofonset", array( "name" => "FreeB.FBDiagnosis.DateOfOnset",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("dateoffirstsymptom", array( "name" => "FreeB.FBDiagnosis.DateOfFirstSymptom",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("isfirstoccurence", array( "name" => "FreeB.FBDiagnosis.isFirstOccurrence",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("dateoffirstoccurence", array( "name" => "FreeB.FBDiagnosis.DateOfFirstOccurrence",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("iscantwork", array( "name" => "FreeB.FBDiagnosis.isCantWork",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("dateofcantworkstart", array( "name" => "FreeB.FBDiagnosis.DateOfCantWorkStart",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("dateofcantworkend", array( "name" => "FreeB.FBDiagnosis.DateOfCantWorkEnd",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
38 $this->_addFunc("isrelatedtoemployment", array( "name" => "FreeB.FBDiagnosis.isRelatedToEmployment",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
41 $this->_addFunc("isrelatedtoautoaccident", array( "name" => "FreeB.FBDiagnosis.isRelatedToAutoAccident",
42 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
44 $this->_addFunc("autoaccidentstate", array( "name" => "FreeB.FBDiagnosis.AutoAccidentState",
45 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
47 $this->_addFunc("icd10code", array( "name" => "FreeB.FBDiagnosis.ICD10Code",
48 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
50 $this->_addFunc("icd9code", array( "name" => "FreeB.FBDiagnosis.ICD9Code",
51 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
53 $this->_addFunc("dateoflastvisit", array( "name" => "FreeB.FBDiagnosis.DateOfLastVisit",
54 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
56 $this->_addFunc("comment", array( "name" => "FreeB.FBDiagnosis.Comment",
57 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
61 function relatedtohcfa($m) {
65 //unimplemented by OpenEMR
68 // if we generated an error, create an error return response
70 return $this->_handleError($err);
73 // otherwise, we create the right response
74 // with the state name
75 return new xmlrpcresp(new xmlrpcval($retval,"string"));
79 function isrelatedtootheraccident($m) {
82 //unimplemented by OpenEMR
85 // if we generated an error, create an error return response
87 return $this->_handleError($err);
90 // otherwise, we create the right response
91 // with the state name
92 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
96 function dateofencounter($m) {
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);
108 $err = $db->ErrorMsg();
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
120 return $this->_handleError($err);
123 // otherwise, we create the right response
124 // with the state name
125 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME
));
129 function dateofonset($m) {
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";
139 $db = $GLOBALS['adodb']['db'];
140 $results = $db->Execute($sql);
143 $err = $db->ErrorMsg();
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
155 return $this->_handleError($err);
158 // otherwise, we create the right response
159 // with the state name
160 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME
));
164 function dateoffirstsymptom($m) {
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";
174 $db = $GLOBALS['adodb']['db'];
175 $results = $db->Execute($sql);
178 $err = $db->ErrorMsg();
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
190 return $this->_handleError($err);
193 // otherwise, we create the right response
194 // with the state name
195 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME
));
199 function isfirstoccurence($m) {
203 //unimplemented by OpenEMR
206 // if we generated an error, create an error return response
208 return $this->_handleError($err);
211 // otherwise, we create the right response
212 // with the state name
213 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
217 function dateoffirstoccurence($m) {
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";
227 $db = $GLOBALS['adodb']['db'];
228 $results = $db->Execute($sql);
231 $err = $db->ErrorMsg();
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
243 return $this->_handleError($err);
246 // otherwise, we create the right response
247 // with the state name
248 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME
));
252 function iscantwork($m) {
256 //unimplemented by OpenEMR
259 // if we generated an error, create an error return response
261 return $this->_handleError($err);
264 // otherwise, we create the right response
265 // with the state name
266 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
270 function dateofcantworkstart($m) {
273 //unimplemented by OpenEMR
274 $pkey = $this->_isodate("");
276 // if we generated an error, create an error return response
278 return $this->_handleError($err);
281 // otherwise, we create the right response
282 // with the state name
283 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME
));
287 function dateofcantworkend($m) {
290 //unimplemented by OpenEMR
291 $pkey = $this->_isodate("");
293 // if we generated an error, create an error return response
295 return $this->_handleError($err);
298 // otherwise, we create the right response
299 // with the state name
300 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME
));
304 function isrelatedtoemployment($m) {
308 //unimplemented by OpenEMR
311 // if we generated an error, create an error return response
313 return $this->_handleError($err);
316 // otherwise, we create the right response
317 // with the state name
318 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
322 function isrelatedtoautoaccident($m) {
325 //unimplemented by OpenEMR
328 // if we generated an error, create an error return response
330 return $this->_handleError($err);
333 // otherwise, we create the right response
334 // with the state name
335 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
339 function autoaccidentstate($m) {
343 //unimplmeneted by OpenEMR
346 // if we generated an error, create an error return response
348 return $this->_handleError($err);
351 // otherwise, we create the right response
352 // with the state name
353 return new xmlrpcresp(new xmlrpcval($pkey));
356 function icd10code($m) {
359 //unimplemented by OpenEMR
362 // if we generated an error, create an error return response
364 return $this->_handleError($err);
367 // otherwise, we create the right response
368 // with the state name
369 return new xmlrpcresp(new xmlrpcval($pkey));
372 function icd9code($m) {
376 $obj= $m->getparam(0);
377 $key = $obj->getval();
379 $sql = "SELECT * FROM billing where id = '" . $key . "'";
381 $db = $GLOBALS['adodb']['db'];
382 $results = $db->Execute($sql);
385 $err = $db->ErrorMsg();
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
396 return $this->_handleError($err);
399 // otherwise, we create the right response
400 // with the state name
401 return new xmlrpcresp(new xmlrpcval($retval,"string"));
404 function dateoflastvisit($m){
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";
413 $db = $GLOBALS['adodb']['db'];
414 $results = $db->Execute($sql);
417 $err = $db->ErrorMsg();
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
429 return $this->_handleError($err);
432 // otherwise, we create the right response
433 // with the state name
434 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME
));
437 function comment($m){
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'] ."'";
446 $db = $GLOBALS['adodb']['db'];
447 $results = $db->Execute($sql);
450 $err = $db->ErrorMsg();
453 if (!$results->EOF
) {
454 $retval = $results->fields
['reason'];
458 // if we generated an error, create an error return response
460 return $this->_handleError($err);
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,?>