Skip to content

Commit

Permalink
feat: minor refactor x12 insurance eligibility api (#6915)
Browse files Browse the repository at this point in the history
* feat: minor refactor x12 insurance eligibility api

* bump db version

* typo
  • Loading branch information
stephenwaite committed Oct 7, 2023
1 parent 65b18f2 commit 90bee3b
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 12 deletions.
2 changes: 1 addition & 1 deletion controllers/C_InsuranceCompany.class.php
Expand Up @@ -16,7 +16,7 @@ public function __construct($template_mod = "general")
$this->assign("CURRENT_ACTION", $GLOBALS['webroot'] . "/controller.php?" . "practice_settings&insurance_company&");
$this->assign("STYLE", $GLOBALS['style']);
$this->assign("SUPPORT_ENCOUNTER_CLAIMS", $GLOBALS['support_encounter_claims']);
$this->assign("SUPPORT_ELIGIBILITY_REQUESTS", $GLOBALS['enable_oa']);
$this->assign("SUPPORT_ELIGIBILITY_REQUESTS", $GLOBALS['enable_eligibility_requests']);
$this->InsuranceCompany = new InsuranceCompany();
}

Expand Down
2 changes: 1 addition & 1 deletion interface/billing/edi_270.php
Expand Up @@ -433,7 +433,7 @@ function toggleMessage(id,x12){
<?php echo xlt('Create batch'); ?>
<input type='hidden' name='form_savefile' id='form_savefile' value=''></input>

<?php if ($GLOBALS['enable_oa']) {
<?php if ($GLOBALS['enable_eligibility_requests']) {
echo "<a href='#' class='btn btn-secondary btn-transmit' onclick='return validate_batch(true);'>" . xlt('Request Eligibility') . "</a>\n";
}
?>
Expand Down
4 changes: 2 additions & 2 deletions interface/patient_file/summary/demographics.php
Expand Up @@ -1377,7 +1377,7 @@ function filterActiveIssues(array $i): array
}
}

if ($GLOBALS["enable_oa"]) {
if ($GLOBALS["enable_eligibility_requests"]) {
if (($_POST['status_update'] ?? '') === 'true') {
unset($_POST['status_update']);
$showEligibility = true;
Expand Down Expand Up @@ -1414,7 +1414,7 @@ function filterActiveIssues(array $i): array
'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false,
'ins' => $insArr,
'eligibility' => $output,
'enable_oa' => $GLOBALS['enable_oa'],
'enable_eligibility_requests' => $GLOBALS['enable_eligibility_requests'],
'auth' => AclMain::aclCheckCore('patients', 'demo', '', 'write'),
'prependedInjection' => $dispatchResult->getPrependedInjection(),
'appendedInjection' => $dispatchResult->getAppendedInjection(),
Expand Down
66 changes: 66 additions & 0 deletions library/classes/X12Partner.class.php
Expand Up @@ -47,6 +47,12 @@ class X12Partner extends ORDataObject
var $x12_sftp_port;
var $x12_sftp_local_dir;
var $x12_sftp_remote_dir;
var $x12_client_id;
var $x12_client_secret;
var $x12_token_endpoint;
var $x12_eligibility_endpoint;
var $x12_claim_status_endpoint;
var $x12_attachment_endpoint;

/**
* Constructor sets all Insurance attributes to their default value
Expand Down Expand Up @@ -429,4 +435,64 @@ function get_x12_dtp03_type_array()
'E' => 'Subscriber Effective Date',
);
}

function set_x12_client_id($string)
{
$this->x12_client_id = $string;
}

function get_x12_client_id()
{
return $this->x12_client_id;
}

function set_x12_client_secret($string)
{
$this->x12_client_secret = $string;
}

function get_x12_client_secret()
{
return $this->x12_client_secret;
}

function set_x12_token_endpoint($string)
{
$this->x12_token_endpoint = $string;
}

function get_x12_token_endpoint()
{
return $this->x12_token_endpoint;
}

function set_x12_eligibility_endpoint($string)
{
$this->x12_eligibility_endpoint = $string;
}

function get_x12_eligibility_endpoint()
{
return $this->x12_eligibility_endpoint;
}

function set_x12_claim_status_endpoint($string)
{
$this->x12_claim_status_endpoint = $string;
}

function get_x12_claim_status_endpoint()
{
return $this->x12_claim_status_endpoint;
}

function set_x12_attachment_endpoint($string)
{
$this->x12_attachment_endpoint = $string;
}

function get_x12_attachment_endpoint()
{
return $this->x12_attachment_endpoint;
}
}
6 changes: 3 additions & 3 deletions library/globals.inc.php
Expand Up @@ -2010,11 +2010,11 @@ function gblTimeZones()
),
// Insurance Tab
'Insurance' => array(
'enable_oa' => array(
xl('Enable Office Ally Insurance Eligibility'),
'enable_eligibility_requests' => array(
xl('Enable Insurance Eligibility'),
'bool',
'0',
xl('Allow insurance eligibility checks using Office Ally')
xl('Allow insurance eligibility checks using an X12 Partner')
),

'simplified_demographics' => array(
Expand Down
24 changes: 24 additions & 0 deletions sql/7_0_1-to-7_0_2_upgrade.sql
Expand Up @@ -553,4 +553,28 @@ CREATE TABLE `edi_sequences` (
`id` int(9) unsigned NOT NULL default '0'
) ENGINE=InnoDB;
INSERT INTO `edi_sequences` VALUES (0);
#EndIf

#IfMissingColumn x12_partners x12_client_id;
ALTER TABLE `x12_partners` ADD COLUMN `x12_client_id` tinytext;
#EndIf

#IfMissingColumn x12_partners x12_client_secret;
ALTER TABLE `x12_partners` ADD COLUMN `x12_client_secret` tinytext;
#EndIf

#IfMissingColumn x12_partners x12_token_endpoint
ALTER TABLE `x12_partners` ADD COLUMN `x12_token_endpoint` tinytext;
#EndIf

#IfMissingColumn x12_partners x12_eligibility_endpoint
ALTER TABLE `x12_partners` ADD COLUMN `x12_eligibility_endpoint` tinytext;
#EndIf

#IfMissingColumn x12_partners x12_claim_status_endpoint
ALTER TABLE `x12_partners` ADD COLUMN `x12_claim_status_endpoint` tinytext;
#EndIf

#IfMissingColumn x12_partners x12_attachment_endpoint
ALTER TABLE `x12_partners` ADD COLUMN `x12_attachment_endpoint` tinytext;
#EndIf
6 changes: 6 additions & 0 deletions sql/database.sql
Expand Up @@ -9105,6 +9105,12 @@ CREATE TABLE `x12_partners` (
`x12_sftp_port` varchar(255) DEFAULT NULL,
`x12_sftp_local_dir` varchar(255) DEFAULT NULL,
`x12_sftp_remote_dir` varchar(255) DEFAULT NULL,
`x12_token_endpoint` tinytext,
`x12_eligibility_endpoint` tinytext,
`x12_claim_status_endpoint` tinytext,
`x12_attachment_endpoint` tinytext,
`x12_client_id` tinytext,
`x12_client_secret` tinytext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

Expand Down
6 changes: 3 additions & 3 deletions src/Billing/EDI270.php
Expand Up @@ -16,7 +16,7 @@
* @copyright Copyright (c) 2016 Terry Hill <terry@lillysystems.com>
* @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
* @copyright Copyright (c) 2019 Jerry Padgett <sjpadgett@gmail.com>
* @copyright Copyright (c) 2019 Stephen Waite <stephen.waite@cmsvt.com>
* @copyright Copyright (c) 2019-2023 Stephen Waite <stephen.waite@cmsvt.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

Expand Down Expand Up @@ -159,7 +159,7 @@ public static function createNM1($row, $nm1Cast, $X12info, $segTer, $compEleSep)
$NM1[6] = ""; // Data Element not required.
$NM1[7] = ""; // Data Element not required.
$NM1[8] = "PI"; // 5010 no longer uses "46"
if ($GLOBALS['enable_oa']) {
if ($GLOBALS['enable_eligibility_requests']) {
$payerId = $row['eligibility_id'];
} else {
$payerId = $row['cms_id'];
Expand Down Expand Up @@ -849,7 +849,7 @@ public static function requestEligibility($partner = '', $x12_270 = '')
$response = oeHttp::bodyFormat('body')
//->setDebug('5000')/* @todo uncomment and set proxy port to debug eg Fiddler */
->usingHeaders($headers)
->post('https://wsd.officeally.com/TransactionSite/rtx.aspx', $mime_body); // @TODO put request urls in x12 partner's for versatility.
->post($X12info['x12_eligibility_endpoint'], $mime_body);

$formBody = $response->body();
$contentType = $response->header('Content-Type')[0];
Expand Down
2 changes: 1 addition & 1 deletion templates/patient/card/insurance.html.twig
Expand Up @@ -89,7 +89,7 @@
</div>
{% endfor %}
<div class="tab-pane" id="eligibility" role="tabpanel" aria-labelledby="eligibility-tab">
{% if enable_oa %}
{% if enable_eligibility_requests %}
<form action="./demographics.php" method="post">
<div>
<button class='btn btn-success btn-sm btn-transmit float-right' name='status_update' value='true'>{{ "Update Status"|xlt }}</button>
Expand Down
42 changes: 42 additions & 0 deletions templates/x12_partners/general_edit.html
Expand Up @@ -176,6 +176,48 @@
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_client_id" class="col-form-label col-sm-2">{xlt t='Client ID'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_client_id" name="x12_client_id" class="form-control" value="{$partner->get_x12_client_id()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_client_secret" class="col-form-label col-sm-2">{xlt t='Client Secret'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_client_secret" name="x12_client_secret" class="form-control" value="{$partner->get_x12_client_secret()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_token_endpoint" class="col-form-label col-sm-2">{xlt t='Token Endpoint'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_token_endpoint" name="x12_token_endpoint" class="form-control" value="{$partner->get_x12_token_endpoint()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_eligibility_endpoint" class="col-form-label col-sm-2">{xlt t='Eligibility Endpoint'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_eligibility_endpoint" name="x12_eligibility_endpoint" class="form-control" value="{$partner->get_x12_eligibility_endpoint()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_claim_status_endpoint" class="col-form-label col-sm-2">{xlt t='Claim Status Endpoint'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_claim_status_endpoint" name="x12_claim_status_endpoint" class="form-control" value="{$partner->get_x12_claim_status_endpoint()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="form-row my-sm-2">
<label for="x12_attachment_endpoint" class="col-form-label col-sm-2">{xlt t='Attachment Endpoint'}</label>
<div class="col-sm-8">
<input type="text" maxlength="400" id="x12_attachment_endpoint" name="x12_attachment_endpoint" class="form-control" value="{$partner->get_x12_attachment_endpoint()|attr}" onKeyDown="PreventIt(event)">
</div>
</div>

<div class="btn-group offset-sm-2">
<a href="javascript:add_x12();" class="btn btn-secondary btn-save" onclick="top.restoreSession()">
{xlt t='Save'}
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -28,7 +28,7 @@
// is a database change in the course of development. It is used
// internally to determine when a database upgrade is needed.
//
$v_database = 495;
$v_database = 496;

// Access control version identifier, this is to be incremented whenever there
// is a access control change in the course of development. It is used
Expand Down

0 comments on commit 90bee3b

Please sign in to comment.