Query for anesthetic medications by DEA schedule
Posted: Fri Jan 20, 2012 3:22 pm
For users of the EASy Anesthesia Module, here is a query that will list all of the patients who received anesthetic medications by DEA schedule for a given date range:
This example will list all the schedule II medications delivered to patients last year. You can change the schedule number and date ranges to suit your needs. If you used arabic numbers instead of roman numerals (or some other notation) when you set up the program, use those characters for DEASchedule.
Code: Select all
SELECT DISTINCT anestheticrecord.AnestheticRecordNum,anestheticrecord.AnestheticDate, patient.PatNum as 'Patient#',patient.LName,patient.FName,
patient.Gender,patient.Birthdate,patient.Address,patient.Address2,patient.City,patient.Zip,
patient.HmPhone,patient.WirelessPhone,anesthmedsgiven.AnesthMedName,anesthmedsgiven.QtyGiven,
anesthmedsgiven.QtyWasted
FROM anestheticrecord
LEFT JOIN anesthmedsgiven ON anesthmedsgiven.AnestheticRecordNum = anestheticrecord.AnestheticRecordNum
LEFT JOIN patient ON patient.PatNum = anestheticrecord.PatNum
WHERE DATE_FORMAT(anestheticdate,'%Y-%m-%d') >= '2011-01-01' AND
DATE_FORMAT(anestheticdate,'%Y-%m-%d') <= '2011-12-31' AND
anesthmedsinventory.DEASchedule = 'II'
ORDER BY anestheticdate ASC