Billing Code Reviews/Testing needed

bradymiller wrote on Tuesday, January 04, 2011:

hi,

zhhealthcare has recently released two commits and asked for reviews. I have found no major semantic issues with their code, but would like a contributor with lots of billing experience (Tony or Rod or other) to test/eyeball these submissions before we commit them. Here they are:
http://github.com/zhhealthcare/openemr/commits/modified_payment_v2 (details in top commit comments)
http://github.com/zhhealthcare/openemr/commits/billing_given_v3 (details in top commit comments)

thanks,
-brady

sunsetsystems wrote on Tuesday, January 04, 2011:

Brady I’ll try to get to this later today (Tuesday)… just been kinda swamped here.

Rod
www.sunsetsystems.com

sunsetsystems wrote on Tuesday, January 04, 2011:

I have added some comments to the commits.  Overall, looks very good.

Rod
www.sunsetsystems.com

zhhealthcare wrote on Tuesday, January 04, 2011:

Rod and Brady
Thank you for your time and effort: much appreciated.

Regards
Sam

tmccormi wrote on Tuesday, January 04, 2011:

I’ve been using slightly older versions of these to commits for a while now with good results, I’ll down lowd and test the newer ones this week and look over the code in more detail.
-Tony

bradymiller wrote on Wednesday, January 05, 2011:

Sam and John,

Committed to sourceforge:
http://github.com/zhhealthcare/openemr/commits/billing_given_v3
(please see the review for a couple minor fixes that can be done with a simple follow-up commit)

Requested another minor revision for:
http://github.com/zhhealthcare/openemr/commits/modified_payment_v2
(just some potential syntax issues; see the review for details)

thanks for the contributions,
-brady

bradymiller wrote on Wednesday, January 05, 2011:

In above addressee, I meant Sam and Paul.

zhhealthcare wrote on Wednesday, January 05, 2011:

Thank you Brady for committing the billing branch.
The minor correction in the same will be submitted as early as possible.

Also we will work on the second one(payment) as per the comments we received.
Please give us a little time.

Regards
Paul

zhhealthcare wrote on Thursday, January 06, 2011:

The comments said during the time of first commit is coded.
Individual tabs(mainly used for indenting) are replaced by 4 spaces.Old and new areas all are replaced.
Copyright is edited.Now Company name is set to “Z&H Consultancy Services Private Limited” and year is 2011.
2 xl() calls are corrected by removing variables from it.

The patch file is uploaded with name
‘0002-Minor corrections.patch’  at the tracker
https://sourceforge.net/tracker/?func=detail&aid=3150337&group_id=60081&atid=1245239

I have updated in git to the branch
(billing_given_v3) accessible at
https://github.com/zhhealthcare/openemr/tree/billing_given_v3

Thanks
Paul

bradymiller wrote on Friday, January 07, 2011:

Paul,
I committed this to the sourceforge codebase.
thanks,
-brady

aethelwulffe wrote on Friday, January 07, 2011:

Upgraded 3.2 to 4.0, with file named “openemr-openemr-v3_0_1-1116-g02da2cd” downloaded at 4:25 AM 2011JAN7.

Everything else looks good so far, except the billing module.   Billing reports on localhost are VERY slow.

Query x-12 partner (choosing a specific one) results in a list that has multiple x12 partners.
Last level billed, choosing ins1 or anything else results in a list of every encounter, including those not coded.
Authorization status choices never result in a list.
Billing Status reports seem like they may be OK, but it seems like we somehow have a lot of claims that have been re-opened…hmmm…
Charge coded==coded/not coded…whatever that is, no results either way, and “All” doesn’t result in a selection, though it does give what may be a full list.ERROR: query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = ‘primary’ AND form_encounter.encounter in ('87-6003) and billing.code_type like ‘%’ and billing.activity = 1 order by billing.pid, billing.date ASC

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘87-6003) and billing.code_type like ‘%’ and billing.activity = 1 order by bill’ at line 1

Whether insured=not insured (and we have quite a few) or "insured== no results.
by encounter=

ERROR: query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = 'primary' AND (form_encounter.date between \'2011-01-07 00:00:00\' and \'2011-01-07 23:59:59\') AND billing.billed = '\'0' and billing.code_type like '%' and billing.activity = 1 order by billing.pid, billing.date ASC
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'2011-01-07 00:00:00\' and \'2011-01-07 23:59:59\') AND billing.billed = '\'0' ' at line 1

by insurance company = no selection available even with full name entered.
by patient number=

ERROR: query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = 'primary' AND form_encounter.pid in (\'666) and billing.code_type like '%' and billing.activity = 1 order by billing.pid, billing.date ASC
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'666) and billing.code_type like '%' and billing.activity = 1 order by billing.' at line 1

Patient Name==no results

Claim type==no results

Date of Billing==

ERROR: query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = 'primary' AND (claims.process_time between \'2011-01-01 00:00:00\' and \'2011-01-07 23:59:59\') and billing.code_type like '%' and billing.activity = 1 order by billing.pid, billing.date ASC
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'2011-01-01 00:00:00\' and \'2011-01-07 23:59:59\') and billing.code_type like ' at line 1

Date of Entry:

ERROR: query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = 'primary' AND (billing.date between \'2011-01-01 00:00:00\' and \'2011-01-07 23:59:59\') and billing.code_type like '%' and billing.activity = 1 order by billing.pid, billing.date ASC
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'2011-01-01 00:00:00\' and \'2011-01-07 23:59:59\') and billing.code_type like ' at line 1

Date of Service (Last month was tried)==yet another sql error message.

arnabnaha wrote on Friday, January 07, 2011:

Hi…
I am getting the same errors…the module is good…but why these sql errors??

zhhealthcare wrote on Friday, January 07, 2011:

Let me first tell the issue with the error.
The problem is the backslashes that are embedded in the query line.
It might be a php.ini configuration issue.
In the php.ini magic_quotes_gpc must be Off …

Thanks
Paul

arnabnaha wrote on Friday, January 07, 2011:

Thanks…it works fine now…

aethelwulffe wrote on Friday, January 07, 2011:

Yep, got it.  Guess that file will need to be configured before distribution.   The other issues still seem to be there, but I will continue testing.

bradymiller wrote on Saturday, January 08, 2011:

Paul,

That is a bug. Code needs to work when both magic quotes is off or on.

Note that there are still likely some pockets of OpenEMR that require magic quotes to be on, so our official recommendations are for users to turn this on:
http://www.openmedsoftware.org/wiki/FAQ#What_are_the_correct_PHP_settings_.28can_be_found_in_the_php.ini_file.29_.3F

Awhile back we incorporated the functions in library/formdata.inc.php throughout the codebase to make openemr work with magic quotes both off/on, but again not complete (I’m guessing several places will still break if magic quotes is turned off). For your code, you need to incorporate these functions, so your code is compatible with both magic quotes on and magic quotes off.

If your making a new script(s), then I recommend considering the new security model, since magic quote dealings and sql escaping are all done automatically (ie. no need to deal with the confusing functions in library/formdata.inc.php)(also eliminate sql-injection and xss attacks):
http://www.openmedsoftware.org/wiki/Active_Projects#PLAN

For either method, feel free to submit partial code to ensure you’re doing it right (so you don’t waste time modifying a large amount of code incorrectly, and then need to waste time redoing it).

thanks,
-brady