Personal tools
You are here: Home / OSCAR Users / EMR and Case Management Resources / Query By Example - Database Searches / Query for Morphine Equivalents per Day
 

Query for Morphine Equivalents per Day

Created by Peter Hutten-Czapski - The following rather lengthy script covers codeine oxycodone hyrdomorphone and morphine Note this assumes that you are only giving one script for one type of narcotic at a time and you properly put in duration. If you don't total MED will be higher.

Plain Text icon Morphine Equivalents Per Day QBE.txt — Plain Text, 516 bytes

File contents

SELECT dr.`provider_no`, dr.`demographic_no`, `BN` , ROUND(CAST( `dosage` AS UNSIGNED )*`quantity`*IF(GN LIKE 'FENTA%',4,IF(GN LIKE 'HYDROMOR%', 5,IF(GN LIKE 'CODEIN%',0.152,IF(GN LIKE 'OXYCO',1.52,1))) )/(`duration`*IF( `durunit`="M", "30","1"))) as MED, `duration` , `durunit` , `dosage` , `quantity`
FROM `drugs` dr
WHERE (GN LIKE 'MORPHINE%'
OR GN LIKE 'HYDROMOR%' OR GN LIKE 'CODEINE%' OR GN LIKE 'OXYCON%'OR GN LIKE 'FENTA')
AND `durunit` IN ("D","M")
AND dr.`end_date` > CURDATE( ) ORDER BY MED DESC;

Document Actions

 

Download button

DOWNLOAD OSCAR FOR TESTING

 

eForms button

DOWNLOAD SHARED E-FORMS


 Customize button

FIND PLUG-INS AND TWEAKS
FOR YOUR OSCAR EMR

 

Subscribe Button

SUBSCRIBE TO DISCUSSION LIST 
(SEE ALL LISTS)

  

Help button

ACCESS THE ONLINE MANUALS
(PAID SUPPORT)