SQL for Objective 2: E-Prescribing with Formulary Query
You will be prompted to enter the reporting period start and end date and the provider's OP ID number.
Report Usage Ideas
For more information about how this report is constructed, see Objective 2: Electronic Prescribing.
Code
To highlight and copy the code below to your clipboard, simply click the Copy button.
select case when purpose = 'Med - to dispense' and RX_prescrib_id <>'' and medications.checked_formulary = 1 then 'pass' else 'fail' end as metric, medications.patno, date1, prescrib, purpose, dea_schedule, drug_availability, checked_formulary, rx_prescrib_id from medications where date1 between :start_date and :end_date and p_addr_id =:provider and purpose in ('Med - to dispense','Med - unformatted') and medications.drug_availability <> 'OTC'