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 report will pull all active patients when their last BMI was >=95%. It also shows the age at which their BMI was done, the date, and their last sick and well encounter, and their PCP.
A sample image of this SQL report run in the Database Viewer is shown below:
Report Usage Ideas
- Use telemedicine for counseling visits. If individual visit you may code 9921x or 9940x based on time.
- Use telemedicine for group counseling visits to discuss nutrition and fitness. Your TeleHealth platform must support multiple patients. If group visit you may code 99411 for each patient that participates.
- Once you have the list, send a personalized portal message inquiring on how everyone is doing. You may ask them to log their progress and send a message to the office using the Patient Portal. You may code 99421-3 if you communicate with the patient 5-21+ minutes within a seven day period.
SQL Code: Firebird
To highlight and copy the code below to your clipboard, simply click the Copy button.
select bmi.patno, staffname as pcp, fname, lname, sex, birthdat, date1 as bmi_date, floor(datediff(month,birthdat,date1)/12) as age_on_bmi, bmi, bmi_percent, last_sick, last_well from (select birthdat,staffname, register.addr_id, patno, fname, lname, sex, physical_chart.date1, physical_chart.bmi, physical_chart.bmi_percent from register inner join ( select patno, max(date1) as most_recent from physical_chart where bmi <> 0 group by patno ) p on p.patno = register.patno inner join physical_chart on register.patno = physical_chart.patno and p.most_recent= physical_chart.date1 left outer join staff1 on staff1.staffid = register.addr_id where patno >=101 and status_pat = 'ACTIVE' and lname <> 'TESTPATIENT' and bmi >0) bmi left outer join (select patno, max(date1) as last_sick from enc_note group by patno) s on s.patno = bmi.patno left outer join (select patno, max(date1) as last_well from physical group by patno) w on w.patno = bmi.patno where bmi_percent >=95
SQL Code: MySQL
To highlight and copy the code below to your clipboard, simply click the Copy button.
select bmi.patno, staffname as pcp, fname, lname, sex, birthdat, date1 as bmi_date, floor(timestampdiff(year,birthdat,date1)) as age_on_bmi, bmi, bmi_percent, last_sick, last_well from (select birthdat,staffname, register.addr_id, register.patno, fname, lname, sex, physical_chart.date1, physical_chart.bmi, physical_chart.bmi_percent from register inner join ( select patno, max(date1) as most_recent from physical_chart where bmi <> 0 group by patno ) p on p.patno = register.patno inner join physical_chart on register.patno = physical_chart.patno and p.most_recent= physical_chart.date1 left outer join staff1 on staff1.staffid = register.addr_id where register.patno >=101 and status_pat = 'ACTIVE' and lname <> 'TESTPATIENT' and bmi >0) bmi left outer join (select patno, max(date1) as last_sick from enc_note group by patno) s on s.patno = bmi.patno left outer join (select patno, max(date1) as last_well from physical group by patno) w on w.patno = bmi.patno where bmi_percent >=95