X12 claims for Medicare and Blue Shield

rpl121 wrote on Saturday, July 12, 2008:

I have installed a recent 2.8.4-dev version of OpenEMR and am working on the X12 electronic claim generation features.  Rod Roark’s claim generation process worked out of the box with FreeClaims clearing house.  Not only did I get confirmation of the claims, but also actual paymen.

Next I tweaked three of the files in order to make claim generation work properly for claims uploaded directly to Highmark Medicare Services.  That required some minor modifications to these files:

/var/www/openemr/interface/billing/billing_process.php
/var/www/openemr/library/Class.claim.php
/var/www/openemr/library/gen_x12_837.inc.php

The modifications included fixing the format for the “control code” so it had the same number of digits in both locations, so I didn’t get an error for failure to match.  Also, I had to make sure all the right ID types got into the right place.  There is a “source” ID for sending the claims and a “sender” ID for the practice etc.  Finally, I got this to work and have actually received payment from Medicare for real services.

Next, I did the same thing for Highmark Blue Shield.  Similarly, this required getting all the ID types into the right place.  In addition, an ID qualifier of 33 had to replace XX for the carrier ID code.  Finally, I got the Blue Shield file to go through directly to Blue Shield with generation of an actual payment.

Wherever possible I extracted data from the OpenEMR data files.  (I admit that as a matter of expedience I had to hard code my personal ID into one of the files because I wanted to get results and haven’t yet figured out all the ins and outs of the logic of the three files.)

Here’s my question for those with more familiarity with the x12 billing process:

How can I have three separate versions of the x12 generation files available so that I can, by choosing a different menu item, generate clearinghouse, Medicare or Blue Shield claims?

I was thinking of renaming the three files with slightly different names for each of the three choices, and makeing it so the file created by any one of the combinations creates an x12 with a name giving a clue as to whether it is clearinghouse, Medicare or Blue Shield claim.  Then, I was thinking that the "Billing" tab under "Admin" could be expanded to three tabs:  "Bill Clearinghouse," "Bill Medicare" and "Bill Blue Shield."

Can anybody suggest how to go about this, or perhaps suggest a better way entirely?

sunsetsystems wrote on Monday, July 14, 2008:

This is what the "x12_partners" table is for.  It is maintained via the Admin/Practice area.  You may have changed some items that are not in that table but should be, in which case the correct solution is to add them to both the table and the corresponding administration form.

Rod
www.sunsetsystems.com

rpl121 wrote on Monday, July 14, 2008:

I can see that the “x12_partners” table should have all the special information so that the x12 file generating scripts can just pull everything from that table.  Maybe I’m confused, but I have three different X12 partners set up, and I have “Medicare X12 partner” the default for “Medicare insurance.”  Similarly, I have “Highmark Blue Shield X12 partner” as the default for “Highmark Blue Shield insurance.” 

Trouble is, when I generate multiple claims including those intended for more than one X12 partner receiver, they are all included in a single X12 837 file.  Because of that, the file cannot have proper details that are simultaneously correct for all the X12 receivers.

I was thinking of installing OpenEMR in three separate directories, for example /var/www/openemr, /var/www/openemr_medicare, /var/www/openemr_highmark.  They could each be set up to work its own directory but with the same MySQL and PostreSQL databases.  The X12 generating scripts could be customized in each subdirectory.  That way, to send claims for a specific X12 partner, one would just log into the appropriate subdirectory.

Seems the best solution would be to have the X12 generation button cause the claims to be grouped by X12 partner and then creating one file for each of the X12 partners, with appropriate labels.  The cure has to be somewhere in all those SQL queries!

sunsetsystems wrote on Monday, July 14, 2008:

True, the system should be more helpful in this situation.  I expect most sites have just one X12 partner so it doesn’t come up much.  But if I’m understanding you correctly, you can just be careful to select claims for only one partner each time you create a batch.

Rod
www.sunsetsystems.com

rpl121 wrote on Monday, July 14, 2008:

Yes, I can select out claims for a given X12 partner.  However, I still have a problem in billing_process.php.  Apparently this is the code that puts introductory information into the X12 837 file, before even considering any of the actual individual claims.  I found that I have to do the following in this file:

$ISA07 = ‘33’;                      (for Blue Shield)
vs
$ISA07 = ‘ZZ’;                      (for Medicare)

I know that ‘ZZ’ also works for FreeClaims.

Also, I have to assign a different source number for Blue Shield and Medicare, i.e.

$GS02 = ‘XXXXXXXXX’;                (for Blue Shield)
vs
$GS02 = ‘YYYYYYYYY’;                (for Medicare)

I tried putting some logic in the script, but it did not work, apparently because when the script is executed, the X12 partner is not really defined yet.

The other problem is that I made the control code have the same number of characters for the leading and trailing positions – otherwise Medicare protests. The change was this, within billing_process.php:

on the line

$bat_content .= sprintf("ST*837*09d~", $bat_stcount);

I changed the 09d to 04d.

This made the control code 4 characters long in both positions instead of 9 in the header and 4 in the trailer.  This way, Medicare did not protest.

Needless to say, I am quite pleased to have Medicare and Blue Shield working properly.  In my family practice, probably about 2/3 of the claims are Blue Shield and Medicare.  That amounts to about 4000 Medicare and Blue Shield claims per year for the average family physician.  If the clearing house charged $0.15 per claim, that’s a saving of $600 per year per doctor to send claims directly for Medicare and Blue Shield.

rpl121 wrote on Monday, July 14, 2008:

By the way, I hard coded the source numbers because when I pulled them from the database files, then came up with trailing spaces to make a length of 15 characters.  I couldn’t find the way to strip those characters away gracefully.

But again, the X12 partner is not yet defined at the time this script is executed, so even then the script wouldn’t be able to choose properly.

rpl121 wrote on Monday, July 14, 2008:

I wonder whether I could create a single long string with ID numbers, ID type qualifiers for BOTH sources and insert everything into ALL the files.  My hope is that each receiver would use the proper qualifier to choose which ID to accept and which to ignore.

Will try it sometime this week.

sunsetsystems wrote on Monday, July 14, 2008:

This could all be fixed easily enough.  The original header segments are created by gen_x12_837.inc.php, which could get ISA07, etc. from x12_partners (once it is there), and then they would be available to billing_process.php (in the same way that the sender and receiver IDs already are).

The ST segment seems to use %04d, not %09d, in current CVS.

Rod
www.sunsetsystems.com

rpl121 wrote on Monday, July 14, 2008:

Instead of having a separate field in the x12_partners table for the various ID qualifiers, one could simply assign the first two spaces of each id field to the qualifier, then follow it with the actual ID number.  If you separated them with an asterik, one could skip the section that assigns "XX" or what not and the ID qualifier and the actual id code would be laid in all at once.

rpl121 wrote on Wednesday, July 16, 2008:

Expedient short term solutions to make X12 files work with any X12 partner:

1.  Create versions of the following files for each of the X12 partners – if necessary one can hard code the ID qualifiers such as ZZ or 33 or what not.

/var/www/openemr/interface/billing/billing_process.php
/var/www/openemr/library/Class.claim.php
/var/www/openemr/library/gen_x12_837.inc.php

The files can be renamed with suffix to indicate which X12 partner they are designed for.  Then one can run a crontab to put different versions into the active position on different days of the week.  One can do Medicare on MWF for exampla and Blue Shield on all other days.

2.  Configure sed or awk or similar rudimentary editing program to find and replace the ID qualifiers and IDs in the generated files.

3.  Use existing OpenEMR interface and install ID qualifier, asterisk and ID itself as a single string in the ID field of the program.  Then adust the scripts to avoid putting in the ID qualifier separately.

4.  use logic in the scripts to decide on the basis of what format applies to each claim "cms," "standard," etc. what ID qualifier to use.

etc.

gutiersa wrote on Wednesday, July 23, 2008:

I have a similar situation at my practice:

I use office ally as my clearing house for commercial claims.
for medicare I have used their medicare claims express in the past, but would like to start sending claims from openemr.
Medicaid claims would still be paper claims

My x12 file for office ally seems to be working so far, I am still in testing process

My idea is to alter the billing frame so that I can choose the x12 partner so that I can process the claims for only those insurance companies, this will generate an x12 file for the specific partner.
ie: If I can select office ally associated ins companies, on the billing frame, then I will generate an office ally x12 file, then I could select medicare claims and generate a separate x12 file. Then I would process the files accordingly.
I think this way the code of the gen_x12_837.inc.php file need not be changed. The specific info for each x12 partner can just be entered into admin>x12 partner form (this form and table may also need some alteration)

Is any of this possible?? Please help, I need to start doing my own billing soon.

voipbound wrote on Friday, November 07, 2008:

Where are you in solving this problem?  I am aloso looking to solve another problem where only one of my 3 diagnosis is showing up in the x12.  Interestingly, it is the 2nd Dx.  The 1st and 3rd Dx’s are dropped.