Skip to content

Commit

Permalink
Support flexiblility in code types utilized in claims
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Jul 3, 2012
1 parent 7b8e0cc commit 72ea436
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions library/Claim.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,25 @@ function Claim($pid, $encounter_id) {
$this->encounter = sqlQuery($sql);

// Sort by procedure timestamp in order to get some consistency.
$sql = "SELECT * FROM billing WHERE " .
"encounter = '{$this->encounter_id}' AND pid = '{$this->pid}' AND " .
"(code_type = 'CPT4' OR code_type = 'HCPCS' OR code_type = 'COPAY' OR code_type = 'ICD9') AND " .
"activity = '1' ORDER BY date, id";
$sql = "SELECT b.id, b.date, b.code_type, b.code, b.pid, b.provider_id, " .
"b.user, b.groupname, b.authorized, b.encounter, b.code_text, b.billed, " .
"b.activity, b.payer_id, b.bill_process, b.bill_date, b.process_date, " .
"b.process_file, b.modifier, b.units, b.fee, b.justify, b.target, b.x12_partner_id, " .
"b.ndc_info, b.notecodes, ct.ct_diag " .
"FROM billing as b INNER JOIN code_types as ct " .
"ON b.code_type = ct.ct_key " .
"WHERE ( ct.ct_fee = '1' OR ct.ct_diag = '1' ) AND " .
"ct.ct_active = '1' AND " .
"b.encounter = '{$this->encounter_id}' AND b.pid = '{$this->pid}' AND " .
"b.activity = '1' ORDER BY b.date, b.id";
$res = sqlStatement($sql);
while ($row = sqlFetchArray($res)) {
if ($row['code_type'] == 'COPAY') {
$this->copay -= $row['fee'];
continue;
}
// Save all diagnosis codes.
if ($row['code_type'] == 'ICD9') {
if ($row['ct_diag'] == '1') {
$this->diags[$row['code']] = $row['code'];
continue;
}
Expand Down

0 comments on commit 72ea436

Please sign in to comment.