SQL: Extended Time Recall

About

This SQL will show all active patients whose default sick or well appointment type is an extended appointment type. It also shows who their PCP is and when their last sick and well visits were.

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

Report Usage Ideas

You can use this to see which of your patients who typically need extra time during a visit. Many extra time patients need it because of chronic medical issues, medical fragility, or other social determinants of health. It is due to these factors that these patients may require a check-in.

Code

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

select patno, staffname, fname, lname, birthdat, well_appt_type, sick_appt_type, last_sick, last_well from register
inner join staff1 on staff1.staffid = register.addr_id 
left outer join (select patno, max(date1) as last_sick from enc_note group by patno) e on e.patno = register.patno
left outer join (select patno, max(date1) as last_well from physical group by patno) w on w.patno = register.patno
where status_pat = 'ACTIVE' and patno >99 and lname <> 'TESTPATIENT' and (well_appt_type is not null or sick_appt_type is not null)