Important Content Update Message
We are currently updating the OP Help Center content for the release of OP 20. OP 20 (official version 20.0.x) is the certified, 2015 Edition, version of the Office Practicum software. This is displayed in your software (Help tab > About) and in the Help Center tab labeled Version 20.0. We appreciate your patience as we continue to update all of our content.

SQL: Fluoride Varnish Applied

About

This SQL shows all kids that are 1 - 3 years old who had a checkup on the date they were seen in a selected date range.  If they had a fluoride done (LOINC code "XFLUOR") sometime in that period (not necessarily the same day as the checkup), then it puts the date in "FLUORIDE DATE" column.

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

Caveats

This requires that you are documenting fluoride application as a Diagnostic test using the LOINC code XFLUOR.

Code

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

select physical.patno, date1, fluoride_date from physical
inner join register on register.patno = physical.patno
 
left outer join 
(select patno, loinc_code, date1 as fluoride_date from diag_test_order where loinc_code = 'XFLUOR' and date1  between :start_date and :end_date) d on d.patno = physical.patno
where date1 between :start_date and :end_date
and (date1-birthdat) >=365 and (date1-birthdat)<1460
order by patno