From f0edd1b9b8235f5bdb554922bda4bcb4d93ea3c9 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. --- 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/4_1_0-to-4_1_1_upgrade.sql | 5 +++++ sql/database.sql | 1 + version.php | 2 +- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/interface/forms/fee_sheet/new.php b/interface/forms/fee_sheet/new.php index 8d8d0264a..f1db7f403 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, $hasCharges; @@ -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"; > + > > @@ -886,6 +901,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']; @@ -908,7 +924,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); } } @@ -930,7 +946,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 cfd988f7f..0668db3f6 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/4_1_0-to-4_1_1_upgrade.sql b/sql/4_1_0-to-4_1_1_upgrade.sql index e884bd103..eee395168 100644 --- a/sql/4_1_0-to-4_1_1_upgrade.sql +++ b/sql/4_1_0-to-4_1_1_upgrade.sql @@ -133,3 +133,8 @@ CREATE TABLE `product_warehouse` ( ALTER TABLE `billing` MODIFY `modifier` varchar(12); 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 + diff --git a/sql/database.sql b/sql/database.sql index 5f41662f3..b129f027a 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -135,6 +135,7 @@ CREATE TABLE `billing` ( `target` varchar(30) default NULL, `x12_partner_id` int(11) default NULL, `ndc_info` varchar(255) default NULL, + `notecodes` varchar(25) NOT NULL default '', PRIMARY KEY (`id`), KEY `pid` (`pid`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ; diff --git a/version.php b/version.php index 0b1eafaee..b53de15ec 100644 --- a/version.php +++ b/version.php @@ -17,5 +17,5 @@ $v_realpatch = '0'; // is a database change in the course of development. It is used // internally to determine when a database upgrade is needed. // -$v_database = 55; // last updated by mi-squared.com 2011-12-04 +$v_database = 56; // last updated by sunsetsystems 2011-12-04 ?> -- 2.11.4.GIT