From c9f23f3e0a0eb1ff5a024d21910422cc500ff7fb Mon Sep 17 00:00:00 2001 From: Alfonso Perez Date: Sun, 4 Dec 2011 07:56:49 -0800 Subject: [PATCH] Added support for procedure-specific claim notes. (Modified for a 4.1 patch) --- interface/forms/fee_sheet/new.php | 24 ++++++++++++++++++++---- library/Claim.class.php | 4 ++++ library/billing.inc | 6 +++--- library/gen_hcfa_1500.inc.php | 5 ++++- library/gen_x12_837.inc.php | 9 +++++++++ sql/patch.sql | 4 ++++ 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/interface/forms/fee_sheet/new.php b/interface/forms/fee_sheet/new.php index e61d840b0d..29191d5ab 100644 --- a/interface/forms/fee_sheet/new.php +++ b/interface/forms/fee_sheet/new.php @@ -77,7 +77,7 @@ function contraceptionClass($code_type, $code) { // function echoLine($lino, $codetype, $code, $modifier, $ndc_info='', $auth = TRUE, $del = FALSE, $units = NULL, $fee = NULL, $id = NULL, - $billed = FALSE, $code_text = NULL, $justify = NULL, $provider_id = 0) + $billed = FALSE, $code_text = NULL, $justify = NULL, $provider_id = 0, $notecodes='') { global $code_types, $ndc_applies, $ndc_uom_choices, $justinit, $pid; global $contraception, $usbillstyle; @@ -153,6 +153,12 @@ function echoLine($lino, $codetype, $code, $modifier, $ndc_info='', echo " "; genProviderSelect('', '-- Default --', $provider_id, true); echo "\n"; + if ($codetype == 'HCPCS' || $codetype == 'CPT4') { + echo " $notecodes\n"; + } + else { + echo " \n"; + } echo " \n"; echo " "; genProviderSelect("bill[$lino][provid]", '-- Default --', $provider_id); echo "\n"; + if ($codetype == 'HCPCS' || $codetype == 'CPT4') { + echo " \n"; + } + else { + echo " \n"; + } echo " \n"; echo " \n"; > + > > @@ -857,6 +872,7 @@ if ($billresult) { $authorized = $iter["authorized"]; $ndc_info = $iter["ndc_info"]; $justify = trim($iter['justify']); + $notecodes = trim($iter['notecodes']); if ($justify) $justify = substr(str_replace(':', ',', $justify), 0, strlen($justify) - 1); $provider_id = $iter['provider_id']; @@ -879,7 +895,7 @@ if ($billresult) { echoLine($bill_lino, $iter["code_type"], trim($iter["code"]), $modifier, $ndc_info, $authorized, $del, $units, $fee, $iter["id"], $iter["billed"], - $iter["code_text"], $justify, $provider_id); + $iter["code_text"], $justify, $provider_id, $notecodes); } } @@ -901,7 +917,7 @@ if ($_POST['bill']) { if ($iter['code_type'] == 'COPAY' && $fee > 0) $fee = 0 - $fee; echoLine(++$bill_lino, $iter["code_type"], $iter["code"], trim($iter["mod"]), $ndc_info, $iter["auth"], $iter["del"], $units, - $fee, NULL, FALSE, NULL, $iter["justify"], 0 + $iter['provid']); + $fee, NULL, FALSE, NULL, $iter["justify"], 0 + $iter['provid'], $iter['notecodes']); } } diff --git a/library/Claim.class.php b/library/Claim.class.php index 26edaae10..9288ceb97 100644 --- a/library/Claim.class.php +++ b/library/Claim.class.php @@ -926,6 +926,10 @@ class Claim { return (implode (':', $cln_mods)); } + function cptNotecodes($prockey) { + return x12clean(trim($this->procs[$prockey]['notecodes'])); + } + // Returns the procedure code, followed by ":modifier" if there is one. function cptKey($prockey) { $tmp = $this->cptModifier($prockey); diff --git a/library/billing.inc b/library/billing.inc index 28a645088..e649479da 100644 --- a/library/billing.inc +++ b/library/billing.inc @@ -26,15 +26,15 @@ function getBillingByEncounter ($pid,$encounter, $cols = "code_type, code, code_ function addBilling($encounter_id, $code_type, $code, $code_text, $pid, $authorized="0", $provider, $modifier="", $units="", $fee="0.00", - $ndc_info='', $justify='', $billed=0) + $ndc_info='', $justify='', $billed=0, $notecodes='') { $sql = "insert into billing (date, encounter, code_type, code, code_text, " . "pid, authorized, user, groupname, activity, billed, provider_id, " . - "modifier, units, fee, ndc_info, justify) values (" . + "modifier, units, fee, ndc_info, justify, notecodes) values (" . "NOW(), '$encounter_id', '$code_type', '$code', '$code_text', '$pid', " . "'$authorized', '" . $_SESSION['authId'] . "', '" . $_SESSION['authProvider'] . "', 1, $billed, $provider, '$modifier', '$units', " . - "'$fee', '$ndc_info', '$justify')"; + "'$fee', '$ndc_info', '$justify', '$notecodes')"; return sqlInsert($sql); } diff --git a/library/gen_hcfa_1500.inc.php b/library/gen_hcfa_1500.inc.php index 221d408f0..f752a8ecf 100644 --- a/library/gen_hcfa_1500.inc.php +++ b/library/gen_hcfa_1500.inc.php @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2011 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -435,6 +435,9 @@ function gen_hcfa_1500_page($pid, $encounter, &$log, &$claim) { ++$svccount; $lino = $svccount * 2 + 41; + //Note Codes. + put_hcfa($lino, 25, 7, $claim->cptNotecodes($hcfa_proc_index)); + // Drug Information. Medicaid insurers want this with HCPCS codes. // $ndc = $claim->cptNDCID($hcfa_proc_index); diff --git a/library/gen_x12_837.inc.php b/library/gen_x12_837.inc.php index e9eacfa0a..472dbb179 100644 --- a/library/gen_x12_837.inc.php +++ b/library/gen_x12_837.inc.php @@ -969,6 +969,15 @@ function gen_x12_837($pid, $encounter, &$log, $encounter_claim=false) { "*" . $claim->serviceDate() . "~\n"; + $testnote = rtrim($claim->cptNotecodes($prockey)); + if (!empty($testnote)) { + ++$edicount; + $out .= "NTE" . // Explain Unusual Circumstances. + "*ADD" . + "*" . $claim->cptNotecodes($prockey) . + "~\n"; + } + // Segment DTP*471 (Prescription Date) omitted. // Segment DTP*607 (Revision/Recertification Date) omitted. // Segment DTP*463 (Begin Therapy Date) omitted. diff --git a/sql/patch.sql b/sql/patch.sql index ae7f3e733..961c96891 100644 --- a/sql/patch.sql +++ b/sql/patch.sql @@ -109,3 +109,7 @@ ALTER TABLE `insurance_data` ADD COLUMN `policy_type` varchar(25) NOT NULL defau UPDATE `code_types` SET `ct_mod` = '12' where ct_key = 'CPT4' OR ct_key = 'HCPCS'; #Endif +#IfMissingColumn billing notecodes +ALTER TABLE `billing` ADD `notecodes` varchar(25) NOT NULL default ''; +#EndIf + -- 2.11.4.GIT