We are currently updating the OP Help Center content for the release of OP 19, which is a member of the certified OP 14 family of products. OP 19’s official version is 14.19.1, which you may see in your software (such as in Help > About) and in the Help Center tabs labeled 14.19. You may also notice that the version number in content and videos may not match the version of your software, and some procedural content may not match the workflow in your software. We appreciate your patience and understanding as we make these enhancements.

SQL: Instances of Sick and Well on Same Day for Period

About

This report indicates instances of when a well visit (9938x, 9939x) was billed on the same day as a sick visit (99201-5, 99212-5). It also indicates the patient and what rendering provider.

A sample image of this SQL report run in the Database Viewer is shown below:

Caveats

This sql takes a while to run the report. Do not run for periods exceeding one or two months. For an extensivedate range "Not Responding" may appear in the window while the data is gathered.

Code

To highlight and copy the code below to your clipboard, simply click the Copy button.

select at1.patno, at1.invoiceno,staffname, at2.cptcode as sick, at3.cptcode as well from
(select distinct patno, invoiceno, rend_addr_id from archive_transactions where date1 between :start_date and :end_Date) at1
 inner join (select patno, invoiceno, date1, cptcode from archive_transactions where cptcode between '99201' and '99215' and cptcode <> '99211' and date1 between :start_date and :end_date) at2 on at2.invoiceno = at1.invoiceno 
inner join (select patno, invoiceno, date1, cptcode from archive_transactions where cptcode between '99381' and '99395' and date1 between :start_date and :end_date) at3 on at3.invoiceno = at1.invoiceno
inner join staff1 on staff1.staffid = at1.rend_addr_id