示例#1
0
 function InsuranceCompany($insco = 0)
 {
     if ($insco == 0) {
         return false;
     }
     // error checking
     if (!isset($GLOBALS['__freemed']['cache']['insco'][$insco])) {
         // Get record
         $this->local_record = $GLOBALS['sql']->get_link('insco', $insco);
         // Cache it
         $GLOBALS['__freemed']['cache']['insco'][$insco] = $this->local_record;
     } else {
         // Retrieve from the cache
         $this->local_record = $GLOBALS['__freemed']['cache']['insco'][$insco];
     }
     $this->id = $this->local_record["id"];
     $this->insconame = $this->local_record["insconame"];
     $this->inscoalias = $this->local_record["inscoalias"];
     $this->modifiers = fm_split_into_array($this->local_record["inscomod"]);
 }
示例#2
0
 public function CalculateCharge($covid, $procunits, $cptid, $phyid, $patid)
 {
     global $display_buffer;
     // id of coverage record, cpt record, physician record
     // and patient record
     // charge calculation routine lies here
     //   charge = units * relative_value(cpt) *
     //            base_value(physician/provider)
     //   standard_fee = standard_fee [insurance co] unless 0 then
     //                = default_standard_fee
     //  (we display "standard fee" as what the bastards (insurance companies)
     //   are actually going to pay -- be sure to check for divide by zeros...)
     // step one:
     //   calculate the standard fee
     //if ($covid==0)
     //		return 0;
     $primary = CreateObject('org.freemedsoftware.core.Coverage', $covid);
     $insid = $primary->local_record[covinsco];
     $cpt_code = $GLOBALS['sql']->get_link('cpt', $cptid);
     // cpt code
     $cpt_code_fees = unserialize($cpt_code["cptstdfee"]);
     $cpt_code_stdfee = $cpt_code_fees[$insid];
     // grab proper std fee
     if (empty($cpt_code_stdfee) or $cpt_code_stdfee == 0) {
         $cpt_code_stdfee = $cpt_code["cptdefstdfee"];
     }
     // if none, do default
     $cpt_code_stdfee = bcadd($cpt_code_stdfee, 0, 2);
     // step two:
     //   grab the relative value from the CPT db
     $relative_value = $cpt_code["cptrelval"];
     if ($debug) {
         $display_buffer .= " (relative_value = \"{$relative_value}\")\n";
     }
     // step three:
     //   calculate the base value
     $internal_type = $cpt_code["cpttype"];
     // grab internal type
     if ($debug) {
         $display_buffer .= " (inttype = {$internal_type}) (procphysician = {$procphysician}) ";
     }
     $this_physician = $GLOBALS['sql']->get_link('physician', $physid);
     $charge_map = fm_split_into_array($this_physician["phychargemap"]);
     $base_value = $charge_map[$internal_type];
     if ($debug) {
         $display_buffer .= "<BR>base value = \"{$base_value}\"\n";
     }
     // step four:
     //   check for patient discount percentage
     $this_patient = CreateObject('org.freemedsoftware.core.Patient', $patid);
     $percentage = $this_patient->local_record["ptdisc"];
     if ($percentage > 0) {
         $discount = $percentage / 100;
     } else {
         $discount = 0;
     }
     if ($debug) {
         $display_buffer .= "<BR>discount = \"{$discount}\"\n";
     }
     // step five:
     //   calculate formula...
     $charge = $base_value * $procunits * $relative_value - $discount;
     if ($charge == 0) {
         $charge = $cpt_code_stdfee * $procunits;
     }
     if ($debug) {
         $display_buffer .= " (charge = \"{$charge}\") \n";
     }
     // step six:
     //   adjust values to proper precision
     $charge = bcadd($charge, 0, 2);
     return $charge + 0;
 }
示例#3
0
文件: API.php 项目: rrsc/freemed
function fm_value_in_string($cur_string, $value)
{
    // Check for "," separator indicating hash'd array
    if (!(strpos($cur_string, ",") === false)) {
        // Split it out...
        $this_array = fm_split_into_array($cur_string);
        // ... then use fm_value_in_array to return the value
        return fm_value_in_array($this_array, $value);
    }
    // end checking for ","
    // Otherwise do a simple substring match check
    //if (strstr($cur_string,$value) != "") return true;
    if (trim($cur_string) == trim($value)) {
        return true;
    }
    // If it hasn't been found, return false
    return false;
}