Clearing financial info of a deleted patient

is there a way of clearing financial info of a deleted patient, like all my test patients financial info is still being compiled when i run reports on financial collections, billing end of reports

you’ll have to do it via the database, like with phpmyadmin inside admin->other->database until the delete patient script is upgraded to included billing. The related tables are billing, ar_activity, and payments.

Thanks but in order not to delete an important and current patient record, atached is the screenshot of my billing table in phpmyadmin do i delete by d patients id, moreover my current patients id r not here and they have been billed

i have located billing, ar_activity, and payments tables, should i delete all the information there ?

No. You have to run specific queries to delete the test patient and you should run it on a backup server to test first if that’s possible.

ok thanks. please if you dont mind can you help me with the queries. i am not an SQL expert. please if you dont mind

Hello nzube,
We suggest the following option, Assuming that you are aware of the test patients pid.
Please use the below command to delete the record of the test patient in respective tables.
DELETE from ‘table_name’ where pid=‘your_test_patient_pid’;
Please make sure that, you have entered only the test patients pid.

Let us know, if you have further clarifications.

Thanks
ViSolve

Thank you all for your help, was able to clear all the deleted patients financial info.

Thanks again

I have been working on something similar. I have cleared the billing, payments, ar_activity, ar_session and claims table. There are still payments showing on the payment page for the patient. Does anyone know which table I am missing?

hi @juggernautsei, that’s weird, no. it’s really only the ar_activity that needs attention but when you say the payment page to what are you referring?

This is the page and the patient balance is connected to these entries. Since the patient has all these encounters and has a CoPay of $225 that is in the patient chart under CoPay. So, when I removed that entry, the patient balance dropped to zero.

The issue that I foresee happening is that when the patient starts receiving new encounters and the staff puts in the copay amount again. It will populate against all the previous encounters and not just the ones going forward. So, that is going to throw the patient balance off.

Let me backtrack so you get the whole picture. Doc’s been using the program for 5 yrs and now wants to start using the billing modules. However, all the patient balances have to be zeroed out.

The system was not built for this to happen. I am having to build processes to handle the fallout from moving billing from the software and not having done it from the beginning.

Any suggestions?

oh, am familiar with that situation, think i have a simple sql script to adjust old encounters, let me see if i can find it and upload it for your perusal

That would be great! Logic had brought me to the conclusion that I would have to do something about past encounters because as the screenshot shows that the copay recorded in the patient’s chart is added to the insurance balance whether the copay has been made or not so it shows as a credit on the patient’s balance. That does not seem right to me but I am not an accountant.

looks like i’ve edited the script since i used it for clearing up past encounters before the practice started using integrated billing but the key step is creating a charge adjustment procedure code and then adding entries to the billing table to counteract the compounding copays

$q4 = "INSERT INTO `billing`(id, date, code_type, code, pid, provider_id, " .
    "user, groupname, authorized, encounter, code_text, billed, activity, " .
    "payer_id, bill_process, bill_date, process_date, process_file, ".
    "modifier, units, fee, justify, target, x12_partner_id, ndc_info, notecodes) " .
    " VALUES (DEFAULT, DEFAULT, 'CPT4', '00002', $row2[0], '0', " .
    "'1', DEFAULT, '1', $row2[1], 'CHARGE ADJUSTMENT', DEFAULT, '1', " .
    "DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, " .
    "DEFAULT, '1', $amt, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT)";

@stephenwaite, I’m being lazy. Where does this script go?

in the openemr web root after you set it up to feed a single patient and their encounters or add logic to grab all patients

@stephenwaite excuse me, my ignorance is showing.
Those words mean something to you but I’m left with:
Setup a feed?
Grab all patients?

Can you dumb it down some more, please kind sir?
Or walk me through the logic. :wink:

setup the feed = provide values to variables in the sql query
grab all patients = might want to loop through all patients

looking at this [function] (openemr/billing.inc at 5220b634e2f1e28c8ce8204d766ba1cd5cad37ba · openemr/openemr · GitHub)

which is called and creates the balance on each line

maybe instead could change the effective date of all insurances to be the date that the practice started billing with openemr?

I tried changing the effective date and the patient chart still shows a credit of whatever is placed in the copay box times the number of encounters.

I think that did work. That is the only thing that changed in the system when I applied copay to the patient’s chart. I will try it again and report back.