SQL: Visibility Cleanup: Medications

OP sets all defaults to share all information. Any individual decisions by Practice-users to restrict information sharing (access, use, or exchange) are the responsibility of the Practice in the implementation of its 21st Century Cures Act Information Blocking policies and procedures for its Practice and patients.

About

The report will list the Medication entries for oral contraceptives that can be considered sensitive.

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

Caveats

If you want to add another medication like Privacillin, you can modify the SQL by adding a line, for example:

(prescrib like '%(21)%'
or lower(prescrib) like '%privacillin%'  
or prescrib like '%(28)%'

The above will find upper and lower and mixed case spellings of Privacillin. Any medication name you add will need to include a single quote and a percent (%) sign at the beginning and end of the medication name.

Code

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

select patno,register.fname, register.lname, birthdat, date1 as rx_date, staff1.staffname as prescriber, cast(prescrib as char(2000)) as prescription_info, rx_status,
rx_prescrib_id, epcs_status as e_status, e_sent_date  as status_date,
case when privacy_level = 'A' or privacy_level = '' or privacy_level is null then 'public' else 'private' end as privacy

from medications
inner join register on register.patno = medications.patno
inner join staff1 on staff1.staffid = medications.p_addr_id
where  status_pat = 'ACTIVE'
and  (prescrib like '%(21)%'
or prescrib like '%(28)%' 
or prescrib like '%ogest%' or lower(prescrib) like '%estr%'  or lower(prescrib) like 'provera%')
and lname <> 'TESTPATIENT'
order by patno, date1