Customizing Appointments Report

kristopherm wrote on Friday, June 19, 2009:

Hello everyone,

I’ve been pulling my hair for the last 6 hours trying to add a few columns to the Appointments Report.

I’d like to have the following columns for each appointment listed:

Time of Appointment
Patient Name
Patient Date of Birth
Patient ID
Patient Home Phone
Patient Primary Insurance Provider
Office Visit Type
Comments (should be the comments added when adding the appointment.  It’s the bottom field.)

I understand that a few of those options are already available, and they are working.

I have the table headings added and the issue I’m having is I’m not sure what should be in the table data for each row in order to make this work.

Any insight would be greatly appreciated.

Thank you!

Kristopher Minnich
CVIK

kristopherm wrote on Thursday, July 16, 2009:

Does anyone have input on this?  It’s been awhile since I posted and still having troubles customizing this report.

Thanks,

Kris.

cfapress wrote on Friday, July 17, 2009:

Hi Kris,

This change requires a few changes
1) To the SQL statement used to retrieve the data
2) To the table displaying the retrieved data

The trickiest part of all is trying to bring in the insurance data. Patient insurance data is kept in the insurance_data table. Already there are some complex table joins going on with the appointments report. Including yet another table into the query makes it really complex.

My gut feeling is to add a new query to the report’s page that specifically gathers up a patient’s current primary insurance provider. Something like this:

$insqry = “select provider from insurace_data where type=‘primary’ and pid=’$patient’”;
$insres = sqlStatement($insqry);
$insrow = sqlFetch($insres);
$insprov = $insrow[‘provider’];

Then later, in the loop that presents the appointment report just stamp each row of the table with the data in the $insprov variable.

There isn’t too much value including the primary provider because it will be identical for each appointment in the report. OpenEMR does not track historical insurance data. So if you have patients that switch providers often, you’ll be losing this information each time you update a patient’s record.

As for the other fields you’re looking for, here is what you should be including in the query around line 70 of the code:

"p.DOB, p.phone_biz, e.pc_comments"

Jason

uhsarp wrote on Wednesday, November 03, 2010:

sorry for opening up an old thread. I have another question relating to adjusting the query for a custom report.

Can anyone help me to write a query for selecting providers from a certain “group” in the OpenEMR? Like I created a custom group “abc” and I want the report to show only the providers from “abc” in the report?

thanks!

visolveemr wrote on Monday, November 08, 2010:

Hi,

In latest development version, we can have an option to create new groups and assigning users to that particular group under administration->Users by un-checking the ‘Disable User Groups’ in Administration->Globals->Features.

For OpenEMR-3.2.0, set ‘false’ to $GLOBALS in interface/globals.php.

Hope this option helps to fulfill your requirement or else if your are interested in query please do let us know. We will help you in framing the query.

Thanks
ViCarePlus Team,
www.vicareplus.com
services@vicareplus.com

uhsarp wrote on Monday, November 08, 2010:

Thanks visolveemr for that info.

I was wondering if I can filter out the reports by groups rather than/along with providers. Like for example, in our test clinic, we have multiple groups with providers. We want to see the reports of all patients assigned to providers from group A and then group B separately. I tried to edit the report page but I just can’t seem to get the sql query right.

uhsarp wrote on Monday, November 15, 2010:

any input guys?

Thanks in advance!