2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
4 require_once(dirname(__FILE__
) . "/../classes/InsuranceCompany.class.php");
6 class Payer
Extends DataObjectBase
{
9 $this->_addFunc("ismedicare", array( "name" => "FreeB.FBPayer.isMedicare",
10 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
12 $this->_addFunc("ismedicaid", array( "name" => "FreeB.FBPayer.isMedicaid",
13 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
15 $this->_addFunc("ischampusva", array( "name" => "FreeB.FBPayer.isChampusva",
16 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
18 $this->_addFunc("isbcbs", array( "name" => "FreeB.FBPayer.isBcbs",
19 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
21 $this->_addFunc("isfeca", array( "name" => "FreeB.FBPayer.isFeca",
22 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
24 $this->_addFunc("ischampus", array( "name" => "FreeB.FBPayer.isChampus",
25 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
27 $this->_addFunc("isotherhcfa", array( "name" => "FreeB.FBPayer.isOtherHCFA",
28 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
30 $this->_addFunc("nationalplanid", array( "name" => "FreeB.FBPayer.NationalPlanID",
31 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
33 $this->_addFunc("id", array( "name" => "FreeB.FBPayer.ID",
34 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
36 $this->_addFunc("name", array( "name" => "FreeB.FBPayer.Name",
37 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
39 $this->_addFunc("attn", array( "name" => "FreeB.FBPayer.Attn",
40 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
42 $this->_addFunc("streetaddress",array( "name" => "FreeB.FBPayer.StreetAddress",
43 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
45 $this->_addFunc("city", array( "name" => "FreeB.FBPayer.City",
46 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
48 $this->_addFunc("state", array( "name" => "FreeB.FBPayer.State",
49 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
51 $this->_addFunc("zipcode", array( "name" => "FreeB.FBPayer.Zipcode",
52 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
54 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBPayer.PhoneCountry",
55 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
57 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBPayer.PhoneExtension",
58 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
60 $this->_addFunc("phonearea", array( "name" => "FreeB.FBPayer.PhoneArea",
61 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
63 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBPayer.PhoneNumber",
64 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
66 $this->_addFunc("procedurecodeset", array( "name" => "FreeB.FBPayer.ProcedureCodeSet",
67 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
69 $this->_addFunc("diagnosiscodeset", array( "name" => "FreeB.FBPayer.DiagnosisCodeSet",
70 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
72 $this->_addFunc("ishcfacondensed", array( "name" => "FreeB.FBPayer.isHCFACondensed",
73 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
75 $this->_addFunc("x12secondarymedicarecode", array( "name" => "FreeB.FBPayer.X12SecondaryMedicareCode",
76 "sig" => array(XMLRPCSTRING
,XMLRPCSTRING
),
78 $this->_addFunc("x12claimtype", array( "name" => "FreeB.FBPayer.X12ClaimType",
79 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
83 function ismedicare($m) {
87 $obj= $m->getparam(0);
88 $ikey = $obj->getval();
89 $ic = new InsuranceCompany($ikey);
90 $type = $ic->get_freeb_type();
92 //constants for types are defined in class InsuranceCompanies
93 if ($type == FREEB_TYPE_MEDICARE
) {
97 // if we generated an error, create an error return response
99 return $this->_handleError($err);
102 // otherwise, we create the right response
103 // with the state name
104 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
108 function ismedicaid($m) {
113 $obj= $m->getparam(0);
114 $ikey = $obj->getval();
115 $ic = new InsuranceCompany($ikey);
116 $type = $ic->get_freeb_type();
118 //constants for types are defined in class InsuranceCompanies
119 if ($type == FREEB_TYPE_MEDICAID
) {
123 // if we generated an error, create an error return response
125 return $this->_handleError($err);
128 // otherwise, we create the right response
129 // with the state name
130 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
134 function ischampusva($m) {
139 $obj= $m->getparam(0);
140 $ikey = $obj->getval();
141 $ic = new InsuranceCompany($ikey);
142 $type = $ic->get_freeb_type();
144 //constants for types are defined in class InsuranceCompanies
145 if ($type == FREEB_TYPE_CHAMPUSVA
) {
149 // if we generated an error, create an error return response
151 return $this->_handleError($err);
154 // otherwise, we create the right response
155 // with the state name
156 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
160 function isbcbs($m) {
165 $obj= $m->getparam(0);
166 $ikey = $obj->getval();
167 $ic = new InsuranceCompany($ikey);
168 $type = $ic->get_freeb_type();
170 //constants for types are defined in class InsuranceCompanies
171 if ($type == FREEB_TYPE_BCBS
) {
175 // if we generated an error, create an error return response
177 return $this->_handleError($err);
180 // otherwise, we create the right response
181 // with the state name
182 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
186 function isfeca($m) {
191 $obj= $m->getparam(0);
192 $ikey = $obj->getval();
193 $ic = new InsuranceCompany($ikey);
194 $type = $ic->get_freeb_type();
196 //constants for types are defined in class InsuranceCompanies
197 if ($type == FREEB_TYPE_FECA
) {
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,"i4"));
212 function ischampus($m) {
217 $obj= $m->getparam(0);
218 $ikey = $obj->getval();
219 $ic = new InsuranceCompany($ikey);
220 $type = $ic->get_freeb_type();
222 //constants for types are defined in class InsuranceCompanies
223 if ($type == FREEB_TYPE_CHAMPUS
) {
227 // if we generated an error, create an error return response
229 return $this->_handleError($err);
232 // otherwise, we create the right response
233 // with the state name
234 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
238 function isotherhcfa($m) {
243 $obj= $m->getparam(0);
244 $ikey = $obj->getval();
245 $ic = new InsuranceCompany($ikey);
246 $type = $ic->get_freeb_type();
248 //constants for types are defined in class InsuranceCompanies
249 if ($type == FREEB_TYPE_OTHER_HCFA
) {
253 // if we generated an error, create an error return response
255 return $this->_handleError($err);
258 // otherwise, we create the right response
259 // with the state name
260 return new xmlrpcresp(new xmlrpcval($retval,"i4"));
264 function nationalplanid($m) {
269 $obj= $m->getparam(0);
270 $ikey = $obj->getval();
271 $ic = new InsuranceCompany($ikey);
272 $retval = $ic->get_cms_id();
274 //constants for types are defined in class InsuranceCompanies
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($retval));
292 $obj= $m->getparam(0);
293 $key = $obj->getval();
295 $sql = "SELECT * FROM insurance_companies where id='" . $key . "'";
297 $db = $GLOBALS['adodb']['db'];
298 $results = $db->Execute($sql);
301 $err = $db->ErrorMsg();
304 if (!$results->EOF
) {
305 $retval = $results->fields
['cms_id'];
309 // if we generated an error, create an error return response
311 return $this->_handleError($err);
314 // otherwise, we create the right response
315 // with the state name
316 return new xmlrpcresp(new xmlrpcval($retval),"string");
327 $obj= $m->getparam(0);
328 $ikey = $obj->getval();
329 $ic = new InsuranceCompany($ikey);
330 $pkey = $ic->get_name();
332 // if we generated an error, create an error return response
334 return $this->_handleError($err);
337 // otherwise, we create the right response
338 // with the state name
339 return new xmlrpcresp(new xmlrpcval($pkey,"string"));
346 $obj= $m->getparam(0);
347 $ikey = $obj->getval();
348 $ic = new InsuranceCompany($ikey);
349 $pkey = $ic->get_attn();
351 // if we generated an error, create an error return response
353 return $this->_handleError($err);
356 // otherwise, we create the right response
357 // with the state name
358 return new xmlrpcresp(new xmlrpcval($pkey,"string"));
362 function streetaddress($m) {
366 $obj= $m->getparam(0);
367 $ikey = $obj->getval();
368 $ic = new InsuranceCompany($ikey);
369 $pkey = $ic->address
->get_lines_display();
372 // if we generated an error, create an error return response
374 return $this->_handleError($err);
377 // otherwise, we create the right response
378 // with the state name
379 return new xmlrpcresp(new xmlrpcval($pkey));
387 $obj= $m->getparam(0);
388 $ikey = $obj->getval();
389 $ic = new InsuranceCompany($ikey);
390 $pkey = $ic->address
->get_city();
392 // if we generated an error, create an error return response
394 return $this->_handleError($err);
397 // otherwise, we create the right response
398 // with the state name
399 return new xmlrpcresp(new xmlrpcval($pkey));
407 $obj= $m->getparam(0);
408 $ikey = $obj->getval();
409 $ic = new InsuranceCompany($ikey);
410 $pkey = $ic->address
->get_state();
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($pkey));
422 function zipcode($m) {
427 $obj= $m->getparam(0);
428 $ikey = $obj->getval();
429 $ic = new InsuranceCompany($ikey);
430 $pkey = $ic->address
->get_zip();
432 // if we generated an error, create an error return response
434 return $this->_handleError($err);
437 // otherwise, we create the right response
438 // with the state name
439 return new xmlrpcresp(new xmlrpcval($pkey));
442 function phonecountry($m) {
446 $obj= $m->getparam(0);
447 $ikey = $obj->getval();
448 $ic = new InsuranceCompany($ikey);
449 $pkey = $ic->phone
->get_country_code();
451 // if we generated an error, create an error return response
453 return $this->_handleError($err);
456 // otherwise, we create the right response
457 // with the state name
458 return new xmlrpcresp(new xmlrpcval($pkey));
461 function phoneextension($m) {
464 //unimplemented by openemr
467 // if we generated an error, create an error return response
469 return $this->_handleError($err);
472 // otherwise, we create the right response
473 // with the state name
474 return new xmlrpcresp(new xmlrpcval($pkey));
477 function phonearea($m) {
482 $obj= $m->getparam(0);
483 $ikey = $obj->getval();
484 $ic = new InsuranceCompany($ikey);
485 $pkey = $ic->phone
->get_area_code();
487 // if we generated an error, create an error return response
489 return $this->_handleError($err);
492 // otherwise, we create the right response
493 // with the state name
494 return new xmlrpcresp(new xmlrpcval($pkey));
497 function phonenumber($m) {
502 $obj= $m->getparam(0);
503 $ikey = $obj->getval();
504 $ic = new InsuranceCompany($ikey);
505 $pkey = $ic->phone
->get_number();
507 // if we generated an error, create an error return response
509 return $this->_handleError($err);
512 // otherwise, we create the right response
513 // with the state name
514 return new xmlrpcresp(new xmlrpcval($pkey));
518 function procedurecodeset($m) {
522 //OpenEMR only supports CPT-4 at this time
523 //HCPCS support is almost fully developed
526 // if we generated an error, create an error return response
528 return $this->_handleError($err);
531 // otherwise, we create the right response
532 // with the state name
533 return new xmlrpcresp(new xmlrpcval($pkey));
538 function diagnosiscodeset($m) {
542 //OpenEMR only supports ICD9 diagnosis codes
545 // if we generated an error, create an error return response
547 return $this->_handleError($err);
550 // otherwise, we create the right response
551 // with the state name
552 return new xmlrpcresp(new xmlrpcval($pkey));
556 function ishcfacondensed($m) {
560 //defaults to uncondensed
563 // if we generated an error, create an error return response
565 return $this->_handleError($err);
568 // otherwise, we create the right response
569 // with the state name
570 return new xmlrpcresp(new xmlrpcval($pkey,"i4"));
575 function x12secondarymedicarecode($m) {
579 //unsupported by OpenEMR
582 // if we generated an error, create an error return response
584 return $this->_handleError($err);
587 // otherwise, we create the right response
588 // with the state name
589 return new xmlrpcresp(new xmlrpcval($pkey));
593 function x12claimtype($m) {
597 //type of payer determined by HIPAA, supposed to be superceded by PlanID at some point, I don't think yet 06/03/2004
599 $obj= $m->getparam(0);
600 $ikey = $obj->getval();
601 $ic = new InsuranceCompany($ikey);
602 $pkey = $ic->get_freeb_claim_type();
604 // if we generated an error, create an error return response
606 return $this->_handleError($err);
609 // otherwise, we create the right response
610 // with the state name
611 return new xmlrpcresp(new xmlrpcval($pkey));
622 //'FreeB.FBPayer.isMedicare' => \&FreeB_FBPayer_isMedicare,
623 //'FreeB.FBPayer.isMedicaid' => \&FreeB_FBPayer_isMedicaid,
624 //'FreeB.FBPayer.isChampusva' => \&FreeB_FBPayer_isChampusva,
625 //'FreeB.FBPayer.isBcbs' => \&FreeB_FBPayer_isBcbs,
626 //'FreeB.FBPayer.isFeca' => \&FreeB_FBPayer_isFeca,
627 //'FreeB.FBPayer.isChampus' => \&FreeB_FBPayer_isChampus,
628 //'FreeB.FBPayer.isOtherHCFA' => \&FreeB_FBPayer_isOtherHCFA,
629 //'FreeB.FBPayer.NationalPlanID' => \&FreeB_FBPayer_NationalPlanID,
630 //'FreeB.FBPayer.ID' => \&FreeB_FBPayer_ID,
631 //'FreeB.FBPayer.Name' => \&FreeB_FBPayer_Name,
632 //'FreeB.FBPayer.Attn' => \&FreeB_FBPayer_Attn,
633 //'FreeB.FBPayer.StreetAddress' => \&FreeB_FBPayer_Street,
634 //'FreeB.FBPayer.City' => \&FreeB_FBPayer_City,
635 //'FreeB.FBPayer.State' => \&FreeB_FBPayer_State,
636 //'FreeB.FBPayer.Zipcode' => \&FreeB_FBPayer_Zipcode,
637 //'FreeB.FBPayer.PhoneCountry' => \&FreeB_FBPayer_PhoneCountry,
638 //'FreeB.FBPayer.PhoneExtension' => \&FreeB_FBPayer_PhoneExtension,
639 //'FreeB.FBPayer.PhoneArea' => \&FreeB_FBPayer_PhoneArea,
640 //'FreeB.FBPayer.PhoneNumber' => \&FreeB_FBPayer_PhoneNumber,
641 //'FreeB.FBPayer.ProcedureCodeSet' => \&FreeB_FBPayer_ProcedureCodeSet,
642 //'FreeB.FBPayer.DiagnosisCodeSet' => \&FreeB_FBPayer_DiagnosisCodeSet,
643 //'FreeB.FBPayer.isHCFACondensed' => \&FreeB_FBPayer_isHCFACondensed,
644 //'FreeB.FBPayer.X12SecondaryMedicareCode' => \&FreeB_FBPayer_X12SecondaryMedicareCode,
645 //'FreeB.FBPayer.X12ClaimType' => \&FreeB_FBPayer_X12ClaimType,