We are currently updating the OP Help Center content for the release of OP 14.19 or OP 19. OP 19 is a member of the certified OP 14 family of products (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: Rendering Provider vs PCP

About

For a date range you specify, shows all patients seen for sick and well visits along with the rendering provider for that visit, along with the patient’s assigned PCP in the REGISTER.

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

Caveats

“Seen for sick and well visits” means there is an encounter note or well visit note in their chart (as opposed to who they were scheduled with or who the billing provider was).

Code

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

select patno, fname, lname, s2.staffname as pcp, appts.date1 as appt_date, s1.staffname as rendering_provider, appt_type from
(
select patno, date1, p_addr_id, 'sick' as appt_type from enc_note where date1 between :start_date and :end_Date
union
select patno, date1, p_addr_id, 'well' as appt_type from physical where date1 between :start_date and :end_Date
) appts 
inner join register r on r.patno = appts.patno
inner join staff1 s1 on s1.staffid = appts.p_addr_id
inner join staff1 s2 on s2.staffid = r.addr_id