From e7e0d37a7966a9f1e1a57757acd1d332775aa7a8 Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Mon, 5 Sep 2011 05:55:08 -0700 Subject: [PATCH] Added HCFA box 15 support and equivalently for X12 claims. --- interface/forms/misc_billing_options/new.php | 21 ++++- interface/forms/misc_billing_options/save.php | 106 +++++++++++++------------ interface/forms/misc_billing_options/table.sql | 1 + interface/forms/misc_billing_options/view.php | 51 +----------- library/Claim.class.php | 5 ++ library/gen_hcfa_1500.inc.php | 9 ++- library/gen_x12_837.inc.php | 13 ++- sql/4_0_0-to-4_1_0_upgrade.sql | 4 + version.php | 2 +- 9 files changed, 103 insertions(+), 109 deletions(-) rewrite interface/forms/misc_billing_options/save.php (77%) rewrite interface/forms/misc_billing_options/view.php (99%) diff --git a/interface/forms/misc_billing_options/new.php b/interface/forms/misc_billing_options/new.php index a9aa3003f..de6cc3265 100755 --- a/interface/forms/misc_billing_options/new.php +++ b/interface/forms/misc_billing_options/new.php @@ -1,20 +1,33 @@ - + -
+\n"; +?>



: >

: > : " >

: >

+ " />

" > " >

" > diff --git a/interface/forms/misc_billing_options/save.php b/interface/forms/misc_billing_options/save.php dissimilarity index 77% index cc3044472..a7c4d788f 100755 --- a/interface/forms/misc_billing_options/save.php +++ b/interface/forms/misc_billing_options/save.php @@ -1,51 +1,55 @@ - $var) { -$_POST[$k] = mysql_escape_string($var); -echo "$var\n"; -} -if ($encounter == "") -$encounter = date("Ymd"); -if ($_GET["mode"] == "new"){ -$newid = formSubmit("form_misc_billing_options", $_POST, $_GET["id"], $userauthorized); -addForm($encounter, "Misc Billing Options", $newid, "misc_billing_options", $pid, $userauthorized); -}elseif ($_GET["mode"] == "update") { -sqlInsert("update form_misc_billing_options set pid = {$_SESSION["pid"]}, - groupname='".$_SESSION["authProvider"]."', - user='".$_SESSION["authUser"]."', - authorized=$userauthorized,activity=1, date = NOW(), - employment_related='".$_POST["employment_related"]."', - auto_accident='".$_POST["auto_accident"]."', - accident_state='".$_POST["accident_state"]."', - other_accident='".$_POST["other_accident"]."', - outside_lab='".$_POST["outside_lab"]."', - lab_amount='".$_POST["lab_amount"]."', - is_unable_to_work='".$_POST["is_unable_to_work"]."', - off_work_from='".$_POST["off_work_from"]."', - off_work_to='".$_POST["off_work_to"]."', - is_hospitalized='".$_POST["is_hospitalized"]."', - hospitalization_date_from='".$_POST["hospitalization_date_from"]."', - hospitalization_date_to='".$_POST["hospitalization_date_to"]."', - medicaid_resubmission_code='".$_POST["medicaid_resubmission_code"]."', - medicaid_original_reference='".$_POST["medicaid_original_reference"]."', - prior_auth_number='".$_POST["prior_auth_number"]."', - replacement_claim='".$_POST["replacement_claim"]."', - comments='".$_POST["comments"]."' - where id=$id"); -} -$_SESSION["encounter"] = $encounter; -formHeader("Redirecting...."); -formJump(); -formFooter(); -?> + diff --git a/interface/forms/misc_billing_options/table.sql b/interface/forms/misc_billing_options/table.sql index c635f2f9b..c192bc163 100755 --- a/interface/forms/misc_billing_options/table.sql +++ b/interface/forms/misc_billing_options/table.sql @@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `form_misc_billing_options` ( outside_lab tinyint(1) default NULL, lab_amount decimal(5,2) default NULL, is_unable_to_work tinyint(1) default NULL, + date_initial_treatment date default NULL, off_work_from date default NULL, off_work_to date default NULL, is_hospitalized tinyint(1) default NULL, diff --git a/interface/forms/misc_billing_options/view.php b/interface/forms/misc_billing_options/view.php dissimilarity index 99% index 4998c13be..49270798a 100755 --- a/interface/forms/misc_billing_options/view.php +++ b/interface/forms/misc_billing_options/view.php @@ -1,48 +1,3 @@ - - - - - - - -" name="my_form"> -

-

-: >

-: > -: " >

-: >

- " > - " >

-" > -" >

-: > -: " >

-" > -" >

-" >

-: >

- - - - - -
-:

-
-
- - -[] -
-" - class="link" onclick="top.restoreSession()">[] - - + diff --git a/library/Claim.class.php b/library/Claim.class.php index 997b6f146..3793d8c9a 100644 --- a/library/Claim.class.php +++ b/library/Claim.class.php @@ -221,6 +221,7 @@ class Claim { "ON fpa.id = forms.form_id WHERE " . "forms.encounter = '{$this->encounter_id}' AND " . "forms.pid = '{$this->pid}' AND " . + "forms.deleted = 0 AND " . "forms.formdir = 'misc_billing_options' " . "ORDER BY forms.date"; $this->billing_options = sqlQuery($sql); @@ -1045,6 +1046,10 @@ class Claim { return x12clean(trim($this->billing_options['comments'])); } + function dateInitialTreatment() { + return str_replace('-', '', substr($this->billing_options['date_initial_treatment'], 0, 10)); + } + // Returns an array of unique diagnoses. Periods are stripped. function diagArray() { $da = array(); diff --git a/library/gen_hcfa_1500.inc.php b/library/gen_hcfa_1500.inc.php index 908fd2e4d..215e223e6 100644 --- a/library/gen_hcfa_1500.inc.php +++ b/library/gen_hcfa_1500.inc.php @@ -1,5 +1,5 @@ +// Copyright (C) 2008-2010 Rod Roark // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -301,8 +301,11 @@ function gen_hcfa_1500_page($pid, $encounter, &$log, &$claim) { put_hcfa(32, 5, 2, substr($tmp,6,2)); put_hcfa(32, 8, 4, substr($tmp,0,4)); - // Box 15. Date of First Occurrence - // Not currently supported. + // Box 15. First Date of Same or Similar Illness, if applicable + $tmp = $claim->dateInitialTreatment(); + put_hcfa(32,36, 2, substr($tmp,4,2)); + put_hcfa(32,39, 2, substr($tmp,6,2)); + put_hcfa(32,42, 4, substr($tmp,0,4)); // Box 16. Dates Patient Unable to Work in Current Occupation if ($claim->isUnableToWork()) { diff --git a/library/gen_x12_837.inc.php b/library/gen_x12_837.inc.php index 5740ea232..cf43dcb09 100644 --- a/library/gen_x12_837.inc.php +++ b/library/gen_x12_837.inc.php @@ -1,5 +1,5 @@ +// Copyright (C) 2007-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 @@ -383,7 +383,16 @@ function gen_x12_837($pid, $encounter, &$log, $encounter_claim=false) { "*Y" . "*C" . "~\n"; - + + if ($claim->dateInitialTreatment()) { + ++$edicount; + $out .= "DTP" . // Date of Initial Treatment + "*454" . + "*D8" . + "*" . $claim->dateInitialTreatment() . + "~\n"; + } + ++$edicount; $out .= "DTP" . // Date of Onset "*431" . diff --git a/sql/4_0_0-to-4_1_0_upgrade.sql b/sql/4_0_0-to-4_1_0_upgrade.sql index 226edc7cc..bcf229edf 100644 --- a/sql/4_0_0-to-4_1_0_upgrade.sql +++ b/sql/4_0_0-to-4_1_0_upgrade.sql @@ -1635,4 +1635,8 @@ CREATE TABLE `patient_access_offsite` ( UPDATE globals SET gl_value = 'style_purple.css' WHERE gl_name = 'css_header' AND gl_value = 'style_tan.css'; #EndIf +#IfMissingColumn form_misc_billing_options date_initial_treatment +ALTER TABLE `form_misc_billing_options` + ADD date_initial_treatment date default NULL; +#EndIf diff --git a/version.php b/version.php index 63abd6571..62854a6ff 100644 --- a/version.php +++ b/version.php @@ -12,5 +12,5 @@ $v_tag = '-dev'; // minor revision number, should be empty for production rele // is a database change in the course of development. It is used // internally to determine when a database upgrade is needed. // -$v_database = 43; +$v_database = 44; ?> -- 2.11.4.GIT