SQL: Extended Time Recall

There are two versions of this SQL: Firebird and MySQL. The MySQL version only applies to clients who are have migrated to MySQL.. All other Practices should continue to use the Firebird version of this code. Click to expand and copy the code you need. If you are unsure which code to use, please check with your Practice Administrator.

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.

This SQL can also be helpful in evaluating productivity of providers in a practice. If one provider has a disproportionate number of complex medical patients, they will be unable to see as many patients per day. However, that person taking on this responsibility does free up more time for the other providers and is therefore valuable to the office. To calculate the percentage of a providers panel that requires extra time you can use this SQL, filter the STAFFNAME column to the desired provider, and use the number in the bottom left as the numerator. The panel size for that provider can be easily found using the demographic analysis and recall tool. This panel size will be the denominator when calculating the percentage of complex patients.

SQL Code: Firebird

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)


SQL Code: MySQL

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

select register.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 register.patno >99 and lname <> 'TESTPATIENT' and (well_appt_type is not null or sick_appt_type is not null)