2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class Patient
Extends DataObjectBase
{
9 $this->_addFunc("firstname", array( "name" => "FreeB.FBPatient.FirstName",
10 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
12 $this->_addFunc("middlename", array( "name" => "FreeB.FBPatient.MiddleName",
13 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
15 $this->_addFunc("lastname", array( "name" => "FreeB.FBPatient.LastName",
16 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
18 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBPatient.StreetAddress",
19 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
21 $this->_addFunc("city", array( "name" => "FreeB.FBPatient.City",
22 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
24 $this->_addFunc("state", array( "name" => "FreeB.FBPatient.State",
25 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
27 $this->_addFunc("zipcode", array( "name" => "FreeB.FBPatient.Zipcode",
28 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
30 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBPatient.PhoneCountry",
31 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
33 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBPatient.PhoneExtension",
34 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
36 $this->_addFunc("phonearea", array( "name" => "FreeB.FBPatient.PhoneArea",
37 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
39 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBPatient.PhoneNumber",
40 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
42 $this->_addFunc("title", array( "name" => "FreeB.FBPatient.Title",
43 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
45 $this->_addFunc("account", array( "name" => "FreeB.FBPatient.Account",
46 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
48 $this->_addFunc("isdead", array( "name" => "FreeB.FBPatient.isDead",
49 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
51 $this->_addFunc("dateofbirth", array( "name" => "FreeB.FBPatient.DateOfBirth",
52 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
54 $this->_addFunc("dateofdeath", array( "name" => "FreeB.FBPatient.DateOfDeath",
55 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
57 $this->_addFunc("sex", array( "name" => "FreeB.FBPatient.Sex",
58 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
60 $this->_addFunc("issingle", array( "name" => "FreeB.FBPatient.isSingle",
61 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
63 $this->_addFunc("ismarried", array( "name" => "FreeB.FBPatient.isMarried",
64 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
66 $this->_addFunc("ismaritalotherhcfa", array( "name" => "FreeB.FBPatient.isMaritalOtherHCFA",
67 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
69 $this->_addFunc("isemployed", array( "name" => "FreeB.FBPatient.isEmployed",
70 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
72 $this->_addFunc("isfulltimestudent", array( "name" => "FreeB.FBPatient.isFullTimeStudent",
73 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
75 $this->_addFunc("isparttimestudent", array( "name" => "FreeB.FBPatient.isPartTimeStudent",
76 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
78 $this->_addFunc("ischildofinsured", array( "name" => "FreeB.FBPatient.isChildOfInsured",
79 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
81 $this->_addFunc("ishusbandofinsured", array( "name" => "FreeB.FBPatient.isHusbandOfInsured",
82 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
84 $this->_addFunc("iswifeofinsured", array( "name" => "FreeB.FBPatient.isWifeOfInsured",
85 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
87 $this->_addFunc("isdivorceeofinsured", array( "name" => "FreeB.FBPatient.isDivorceeOfInsured",
88 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
90 $this->_addFunc("isselfofinsured", array( "name" => "FreeB.FBPatient.isSelfOfInsured",
91 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
93 $this->_addFunc("isotherofinsured", array( "name" => "FreeB.FBPatient.isOtherOfInsured",
94 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
96 $this->_addFunc("socialsecuritynumber", array( "name" => "FreeB.FBPatient.SocialSecurityNumber",
97 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
99 $this->_addFunc("coveragecount", array( "name" => "FreeB.FBPatient.CoverageCount",
100 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
102 $this->_addFunc("x12insuredrelationship", array( "name" => "FreeB.FBPatient.X12InsuredRelationship",
103 "sig" => array(XMLRPCSTRING
,XMLRPCINT
,XMLRPCINT
),
105 $this->_addFunc("ispregnant", array( "name" => "FreeB.FBPatient.isPregnant",
106 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
111 function firstname($m) {
116 $obj= $m->getparam(0);
117 $key = $obj->getval();
119 $sql = "SELECT * FROM patient_data where pid = '" . $key . "'";
121 $db = $GLOBALS['adodb']['db'];
122 $results = $db->Execute($sql);
125 $err = $db->ErrorMsg();
128 if (!$results->EOF
) {
129 $retval = $results->fields
['fname'];
133 // if we generated an error, create an error return response
135 return $this->_handleError($err);
138 // otherwise, we create the right response
139 // with the state name
140 return new xmlrpcresp(new xmlrpcval($retval,"string"));
144 function middlename($m) {
149 $obj= $m->getparam(0);
150 $key = $obj->getval();
152 $sql = "SELECT * FROM patient_data where pid = '" . $key . "'";
154 $db = $GLOBALS['adodb']['db'];
155 $results = $db->Execute($sql);
158 $err = $db->ErrorMsg();
161 if (!$results->EOF
) {
162 $retval = $results->fields
['mname'];
167 // if we generated an error, create an error return response
169 return $this->_handleError($err);
172 // otherwise, we create the right response
173 // with the state name
174 return new xmlrpcresp(new xmlrpcval($retval,"string"));
178 function lastname($m) {
183 $obj= $m->getparam(0);
184 $key = $obj->getval();
186 $sql = "SELECT * FROM patient_data where pid = '" . $key . "'";
188 $db = $GLOBALS['adodb']['db'];
189 $results = $db->Execute($sql);
192 $err = $db->ErrorMsg();
195 if (!$results->EOF
) {
196 $retval = $results->fields
['lname'];
201 // if we generated an error, create an error return response
203 return $this->_handleError($err);
206 // otherwise, we create the right response
207 // with the state name
208 return new xmlrpcresp(new xmlrpcval($retval,"string"));
212 function streetaddress($m) {
217 $obj= $m->getparam(0);
218 $key = $obj->getval();
220 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
222 $db = $GLOBALS['adodb']['db'];
223 $results = $db->Execute($sql);
226 $err = $db->ErrorMsg();
229 if (!$results->EOF
) {
230 $retval = $results->fields
['street'];
235 // if we generated an error, create an error return response
237 return $this->_handleError($err);
240 // otherwise, we create the right response
241 // with the state name
242 return new xmlrpcresp(new xmlrpcval($retval,"string"));
252 $obj= $m->getparam(0);
253 $key = $obj->getval();
255 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
257 $db = $GLOBALS['adodb']['db'];
258 $results = $db->Execute($sql);
261 $err = $db->ErrorMsg();
264 if (!$results->EOF
) {
265 $retval = $results->fields
['city'];
270 // if we generated an error, create an error return response
272 return $this->_handleError($err);
275 // otherwise, we create the right response
276 // with the state name
277 return new xmlrpcresp(new xmlrpcval($retval,"string"));
286 $obj= $m->getparam(0);
287 $key = $obj->getval();
289 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
291 $db = $GLOBALS['adodb']['db'];
292 $results = $db->Execute($sql);
295 $err = $db->ErrorMsg();
298 if (!$results->EOF
) {
299 $retval = $results->fields
['state'];
304 // if we generated an error, create an error return response
306 return $this->_handleError($err);
309 // otherwise, we create the right response
310 // with the state name
311 return new xmlrpcresp(new xmlrpcval($retval,"string"));
315 function zipcode($m) {
320 $obj= $m->getparam(0);
321 $key = $obj->getval();
323 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
325 $db = $GLOBALS['adodb']['db'];
326 $results = $db->Execute($sql);
329 $err = $db->ErrorMsg();
332 if (!$results->EOF
) {
333 $retval = $results->fields
['postal_code'];
338 // if we generated an error, create an error return response
340 return $this->_handleError($err);
343 // otherwise, we create the right response
344 // with the state name
345 return new xmlrpcresp(new xmlrpcval($retval,"string"));
349 function phonecountry($m) {
353 //OpenEMR only supports US country code
356 // if we generated an error, create an error return response
358 return $this->_handleError($err);
361 // otherwise, we create the right response
362 // with the state name
363 return new xmlrpcresp(new xmlrpcval($pkey));
367 function phoneextension($m) {
371 //unimplemented by openemr
374 // if we generated an error, create an error return response
376 return $this->_handleError($err);
379 // otherwise, we create the right response
380 // with the state name
381 return new xmlrpcresp(new xmlrpcval($pkey));
385 function phonearea($m) {
390 $obj= $m->getparam(0);
391 $key = $obj->getval();
393 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
395 $db = $GLOBALS['adodb']['db'];
396 $results = $db->Execute($sql);
399 $err = $db->ErrorMsg();
402 if (!$results->EOF
) {
403 $retval = $results->fields
['phone_home'];
407 $phone_parts = array();
408 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
409 $retval = $phone_parts[1];
412 // if we generated an error, create an error return response
414 return $this->_handleError($err);
417 // otherwise, we create the right response
418 // with the state name
419 return new xmlrpcresp(new xmlrpcval($retval,"string"));
423 function phonenumber($m) {
428 $obj= $m->getparam(0);
429 $key = $obj->getval();
431 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
433 $db = $GLOBALS['adodb']['db'];
434 $results = $db->Execute($sql);
437 $err = $db->ErrorMsg();
440 if (!$results->EOF
) {
441 $retval = $results->fields
['phone_home'];
445 $phone_parts = array();
446 preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
447 $retval = $phone_parts[2] . "-" . $phone_parts[3];
449 // if we generated an error, create an error return response
451 return $this->_handleError($err);
454 // otherwise, we create the right response
455 // with the state name
456 return new xmlrpcresp(new xmlrpcval($retval,"string"));
466 $obj= $m->getparam(0);
467 $key = $obj->getval();
469 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
471 $db = $GLOBALS['adodb']['db'];
472 $results = $db->Execute($sql);
475 $err = $db->ErrorMsg();
478 if (!$results->EOF
) {
479 $retval = $results->fields
['title'];
484 // if we generated an error, create an error return response
486 return $this->_handleError($err);
489 // otherwise, we create the right response
490 // with the state name
491 return new xmlrpcresp(new xmlrpcval($retval,"string"));
495 function account($m) {
500 $retval = $_SESSION['patient_id'] . "-" . $_SESSION['billkey'];
502 // if we generated an error, create an error return response
504 return $this->_handleError($err);
507 // otherwise, we create the right response
508 // with the state name
509 return new xmlrpcresp(new xmlrpcval($retval));
513 function isdead($m) {
517 //unimplemented by OpenEMR
520 // if we generated an error, create an error return response
522 return $this->_handleError($err);
525 // otherwise, we create the right response
526 // with the state name
527 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
531 function dateofbirth($m) {
536 $obj= $m->getparam(0);
537 $key = $obj->getval();
539 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
541 $db = $GLOBALS['adodb']['db'];
542 $results = $db->Execute($sql);
545 $err = $db->ErrorMsg();
548 if (!$results->EOF
) {
549 $retval = $results->fields
['DOB'];
554 $retval = $this->_isodate($retval);
556 // if we generated an error, create an error return response
558 return $this->_handleError($err);
561 // otherwise, we create the right response
562 // with the state name
563 return new xmlrpcresp(new xmlrpcval($retval,XMLRPCDATETIME
));
567 function dateofdeath($m) {
571 //Unimplimented by OpenEMR
574 // if we generated an error, create an error return response
576 return $this->_handleError($err);
579 // otherwise, we create the right response
580 // with the state name
581 return new xmlrpcresp(new xmlrpcval($pkey,XMLRPCDATETIME
));
590 $obj= $m->getparam(0);
591 $key = $obj->getval();
593 $sql = "SELECT * FROM patient_data where pid = '" . $key . "'";
595 $db = $GLOBALS['adodb']['db'];
596 $results = $db->Execute($sql);
599 $err = $db->ErrorMsg();
602 if (!$results->EOF
) {
603 $retval = $results->fields
['sex'];
606 if (strtolower($retval) == "male") {
609 elseif (strtolower($retval) == "female") {
613 // if we generated an error, create an error return response
615 return $this->_handleError($err);
618 // otherwise, we create the right response
619 // with the state name
620 return new xmlrpcresp(new xmlrpcval($retval,"string"));
626 function issingle($m) {
631 $obj= $m->getparam(0);
632 $key = $obj->getval();
634 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
636 $db = $GLOBALS['adodb']['db'];
637 $results = $db->Execute($sql);
640 $err = $db->ErrorMsg();
643 if (!$results->EOF
) {
644 $retval = $results->fields
['status'];
648 if ($retval == "single") {
655 // if we generated an error, create an error return response
657 return $this->_handleError($err);
660 // otherwise, we create the right response
661 // with the state name
662 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
666 function ismarried($m) {
671 $obj= $m->getparam(0);
672 $key = $obj->getval();
674 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
676 $db = $GLOBALS['adodb']['db'];
677 $results = $db->Execute($sql);
680 $err = $db->ErrorMsg();
683 if (!$results->EOF
) {
684 $retval = $results->fields
['status'];
688 if ($retval == "married") {
696 // if we generated an error, create an error return response
698 return $this->_handleError($err);
701 // otherwise, we create the right response
702 // with the state name
703 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
707 function ismaritalotherhcfa($m) {
712 $obj= $m->getparam(0);
713 $key = $obj->getval();
715 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
717 $db = $GLOBALS['adodb']['db'];
718 $results = $db->Execute($sql);
721 $err = $db->ErrorMsg();
724 if (!$results->EOF
) {
725 $retval = $results->fields
['status'];
729 if ($retval == "domestic partner") {
737 // if we generated an error, create an error return response
739 return $this->_handleError($err);
742 // otherwise, we create the right response
743 // with the state name
744 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
748 function isemployed($m) {
753 $obj= $m->getparam(0);
754 $key = $obj->getval();
756 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
758 $db = $GLOBALS['adodb']['db'];
759 $results = $db->Execute($sql);
762 $err = $db->ErrorMsg();
765 if (!$results->EOF
) {
766 $retval = $results->fields
['occupation'];
770 if ($retval == "Unemployed" ||
empty($retval)) {
778 // if we generated an error, create an error return response
780 return $this->_handleError($err);
783 // otherwise, we create the right response
784 // with the state name
785 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
789 function isfulltimestudent($m) {
794 $obj= $m->getparam(0);
795 $key = $obj->getval();
797 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
799 $db = $GLOBALS['adodb']['db'];
800 $results = $db->Execute($sql);
803 $err = $db->ErrorMsg();
806 if (!$results->EOF
) {
807 $retval = $results->fields
['occupation'];
811 if (strtolower($retval) == "student") {
818 // if we generated an error, create an error return response
820 return $this->_handleError($err);
823 // otherwise, we create the right response
824 // with the state name
825 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
829 function isparttimestudent($m) {
834 $obj= $m->getparam(0);
835 $key = $obj->getval();
837 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
839 $db = $GLOBALS['adodb']['db'];
840 $results = $db->Execute($sql);
843 $err = $db->ErrorMsg();
846 if (!$results->EOF
) {
847 $retval = $results->fields
['occupation'];
851 if (strtolower($retval) == "pt student") {
859 // if we generated an error, create an error return response
861 return $this->_handleError($err);
864 // otherwise, we create the right response
865 // with the state name
866 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
870 function ischildofinsured($m) {
875 $obj= $m->getparam(0);
876 $key = $obj->getval();
877 $obj= $m->getparam(1);
878 $key2 = $obj->getval();
879 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
881 $db = $GLOBALS['adodb']['db'];
882 $results = $db->Execute($sql);
885 $err = $db->ErrorMsg();
888 if (!$results->EOF
) {
889 $retval = $results->fields
['subscriber_relationship'];
893 if (strtolower($retval) == "child") {
900 // if we generated an error, create an error return response
902 return $this->_handleError($err);
905 // otherwise, we create the right response
906 // with the state name
907 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
911 function ishusbandofinsured($m) {
916 $obj= $m->getparam(0);
917 $key = $obj->getval();
918 $obj= $m->getparam(1);
919 $key2 = $obj->getval();
920 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
922 $db = $GLOBALS['adodb']['db'];
923 $results = $db->Execute($sql);
926 $err = $db->ErrorMsg();
929 if (!$results->EOF
) {
930 $retval = $results->fields
['subscriber_relationship'];
934 if (strtolower($retval) == "spouse") {
942 // if we generated an error, create an error return response
944 return $this->_handleError($err);
947 // otherwise, we create the right response
948 // with the state name
949 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
953 function iswifeofinsured($m) {
958 $obj= $m->getparam(0);
959 $key = $obj->getval();
960 $obj= $m->getparam(1);
961 $key2 = $obj->getval();
962 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
964 $db = $GLOBALS['adodb']['db'];
965 $results = $db->Execute($sql);
968 $err = $db->ErrorMsg();
971 if (!$results->EOF
) {
972 $retval = $results->fields
['subscriber_relationship'];
976 if (strtolower($retval) == "spouse" && $results->fields
['sex'] == "male") {
984 // if we generated an error, create an error return response
986 return $this->_handleError($err);
989 // otherwise, we create the right response
990 // with the state name
991 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
995 function isdivorceeofinsured($m) {
1000 $obj= $m->getparam(0);
1001 $key = $obj->getval();
1002 $obj= $m->getparam(1);
1003 $key2 = $obj->getval();
1004 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
1006 $db = $GLOBALS['adodb']['db'];
1007 $results = $db->Execute($sql);
1010 $err = $db->ErrorMsg();
1013 if (!$results->EOF
) {
1014 $retval = $results->fields
['subscriber_relationship'];
1018 if (strtolower($retval) == "divorcee") {
1026 // if we generated an error, create an error return response
1028 return $this->_handleError($err);
1031 // otherwise, we create the right response
1032 // with the state name
1033 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
1037 function isselfofinsured($m) {
1042 $obj= $m->getparam(0);
1043 $key = $obj->getval();
1044 $obj= $m->getparam(1);
1045 $key2 = $obj->getval();
1046 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
1048 $db = $GLOBALS['adodb']['db'];
1049 $results = $db->Execute($sql);
1052 $err = $db->ErrorMsg();
1055 if (!$results->EOF
) {
1056 $retval = $results->fields
['subscriber_relationship'];
1060 if (strtolower($retval) == "self") {
1068 // if we generated an error, create an error return response
1070 return $this->_handleError($err);
1073 // otherwise, we create the right response
1074 // with the state name
1075 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
1079 function isotherofinsured($m) {
1084 $obj= $m->getparam(0);
1085 $key = $obj->getval();
1086 $obj= $m->getparam(1);
1087 $key2 = $obj->getval();
1088 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
1090 $db = $GLOBALS['adodb']['db'];
1091 $results = $db->Execute($sql);
1094 $err = $db->ErrorMsg();
1097 if (!$results->EOF
) {
1098 $retval = $results->fields
['subscriber_relationship'];
1102 if (strtolower($retval) == "other") {
1110 // if we generated an error, create an error return response
1112 return $this->_handleError($err);
1115 // otherwise, we create the right response
1116 // with the state name
1117 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
1121 function socialsecuritynumber($m) {
1126 $obj= $m->getparam(0);
1127 $key = $obj->getval();
1129 $sql = "SELECT * FROM patient_data where pid = '" . $_SESSION['patient_id'] . "'";
1131 $db = $GLOBALS['adodb']['db'];
1132 $results = $db->Execute($sql);
1135 $err = $db->ErrorMsg();
1138 if (!$results->EOF
) {
1139 $retval = $results->fields
['ss'];
1143 // if we generated an error, create an error return response
1145 return $this->_handleError($err);
1148 // otherwise, we create the right response
1149 // with the state name
1150 return new xmlrpcresp(new xmlrpcval($pkey));
1155 function coveragecount($m) {
1159 //unimplemented in OpenEMR
1162 // if we generated an error, create an error return response
1164 return $this->_handleError($err);
1167 // otherwise, we create the right response
1168 // with the state name
1169 return new xmlrpcresp(new xmlrpcval($pkey));
1173 function x12insuredrelationship($m) {
1176 $obj= $m->getparam(0);
1177 $patientkey = $obj->getval();
1179 $obj= $m->getparam(1);
1180 $insuredkey = $obj->getval();
1183 $obj= $m->getparam(0);
1184 $key = $obj->getval();
1185 $obj= $m->getparam(1);
1186 $key2 = $obj->getval();
1187 $sql = "SELECT * FROM insurance_data where pid = '" . $key . "' AND id = '" . $key2 . "'";
1189 $db = $GLOBALS['adodb']['db'];
1190 $results = $db->Execute($sql);
1193 $err = $db->ErrorMsg();
1196 if (!$results->EOF
) {
1197 $retval = $results->fields
['subscriber_relationship'];
1201 if (strtolower($retval) == "self") {
1204 elseif (strtolower($retval) == "spouse") {
1207 elseif (strtolower($retval) == "child") {
1210 elseif (strtolower($retval) == "other") {
1215 * For Reference these values are currently in use, we only support a subset
1217 * 04 Grandfather or Grandmother
1218 * 05 Grandson or Granddaughter
1219 * 07 Nephew or Niece
1223 * 17 Stepson or Stepdaughter
1227 * 22 Handicapped Dependent
1228 * 23 Sponsored Dependent
1229 * 24 Dependent of a Minor Dependent
1230 * 29 Significant Other
1234 * 36 Emancipated Minor
1237 * 41 Injured Plaintiff
1238 * 43 Child Where Insured Has No Financial Responsibility
1240 * G8 Other Relationship
1244 // if we generated an error, create an error return response
1246 return $this->_handleError($err);
1249 // otherwise, we create the right response
1250 // with the state name
1251 return new xmlrpcresp(new xmlrpcval($retval,"string"));
1255 function x12secondarymedicarecode($m) {
1259 //unimplemented in OpenEMR
1263 * For future reference values can be:
1264 *12 Medicare Secondary Working Aged Beneficiary or Spouse with Employer Group Health Plan
1265 *13 Medicare Secondary End-Stage Renal Disease Beneficiary in the 12 month coordination period with an employer's group health plan
1266 *14 Medicare Secondary, No-fault Insurance including Auto is Primary
1267 *15 Medicare Secondary Worker's Compensation
1268 *16 Medicare Secondary Public Health Service (PHS)or Other Federal Agency
1269 *41 Medicare Secondary Black Lung
1270 *42 Medicare Secondary Veteran's Administration
1271 *43 Medicare Secondary Disabled Beneficiary Under Age 65 with Large Group Health Plan (LGHP)
1272 *47 Medicare Secondary, Other Liability Insurance is Primary
1275 // if we generated an error, create an error return response
1277 return $this->_handleError($err);
1280 // otherwise, we create the right response
1281 // with the state name
1282 return new xmlrpcresp(new xmlrpcval($pkey));
1286 function ispregnant($m) {
1290 //unimplemented in OpenEMR
1293 // if we generated an error, create an error return response
1295 return $this->_handleError($err);
1298 // otherwise, we create the right response
1299 // with the state name
1300 return new xmlrpcresp(new xmlrpcval($pkey));
1313 //'FreeB.FBPatient.FirstName' => \&FreeB_FBPatient_FirstName,
1314 //'FreeB.FBPatient.MiddleName' => \&FreeB_FBPatient_MiddleName,
1315 //'FreeB.FBPatient.LastName' => \&FreeB_FBPatient_LastName,
1316 //'FreeB.FBPatient.StreetAddress' => \&FreeB_FBPatient_StreetAddres,
1317 //'FreeB.FBPatient.City' => \&FreeB_FBPatient_City,
1318 //'FreeB.FBPatient.Zipcode' => \&FreeB_FBPatient_Zipcode,
1319 //'FreeB.FBPatient.State' => \&FreeB_FBPatient_State,
1320 //'FreeB.FBPatient.PhoneCountry' => \&FreeB_FBPatient_PhoneCountry,
1321 //'FreeB.FBPatient.PhoneExtension' => \&FreeB_FBPatient_PhoneExtension,
1322 //'FreeB.FBPatient.PhoneArea' => \&FreeB_FBPatient_PhoneArea,
1323 //'FreeB.FBPatient.PhoneNumber' => \&FreeB_FBPatient_PhoneNumber,
1324 //'FreeB.FBPatient.Title' => \&FreeB_FBPatient_Title,
1325 //'FreeB.FBPatient.Account' => \&FreeB_FBPatient_Account,
1326 //'FreeB.FBPatient.isDead' => \&FreeB_FBPatient_isDead,
1327 //'FreeB.FBPatient.DateOfBirth' => \&FreeB_FBPatient_DateOfBirth,
1328 //'FreeB.FBPatient.DateOfDeath' => \&FreeB_FBPatient_DateOfDeath,
1329 //'FreeB.FBPatient.Sex' => \&FreeB_FBPatient_Sex,
1330 //'FreeB.FBPatient.isSingle' => \&FreeB_FBPatient_isSingle,
1331 //'FreeB.FBPatient.isMarried' => \&FreeB_FBPatient_isMarried,
1332 //'FreeB.FBPatient.isMaritalOtherHCFA' => \&FreeB_FBPatient_isMaritalOtherHCFA,
1333 //'FreeB.FBPatient.isEmployed' => \&FreeB_FBPatient_isEmployed,
1334 //'FreeB.FBPatient.isFullTimeStudent' => \&FreeB_FBPatient_isFullTimeStudent,
1335 //'FreeB.FBPatient.isPartTimeStudent' => \&FreeB_FBPatient_isPartTimeStudent,
1336 //'FreeB.FBPatient.isChildOfInsured' => \&FreeB_FBPatient_isChildOfInsured,
1337 //'FreeB.FBPatient.isHusbandOfInsured' => \&FreeB_FBPatient_isHusbandOfInsured,
1338 //'FreeB.FBPatient.isWifeOfInsured' => \&FreeB_FBPatient_isWifeOfInsured,
1339 //'FreeB.FBPatient.isDivorceeOfInsured' => \&FreeB_FBPatient_isDivorceeOfInsured,
1340 //'FreeB.FBPatient.isSelfOfInsured' => \&FreeB_FBPatient_isSelfOfInsured,
1341 //'FreeB.FBPatient.isOtherOfInsured' => \&FreeB_FBPatient_isOtherOfInsured,
1342 //'FreeB.FBPatient.ReferringProviderKey' => \&FreeB_FBPatient_ReferringProviderKey,
1343 //'FreeB.FBPatient.SocialSecurityNumber' => \&FreeB_FBPatient_SocialSecurityNumber,
1344 //'FreeB.FBPatient.CoverageCount' => \&FreeB_FBPatient_CoverageCount,
1345 //'FreeB.FBPatient.X12InsuredRelationship' => \&FreeB_FBPatient_X12InsuredRelationship,
1346 //'FreeB.FBPatient.isPregnant' => \&FreeB_FBPatient_isPregnant,