diff --git a/input/pagecontent/cql/OpioidCDSCommon.cql b/input/pagecontent/cql/OpioidCDSCommon.cql index 1841a195..d8c50855 100644 --- a/input/pagecontent/cql/OpioidCDSCommon.cql +++ b/input/pagecontent/cql/OpioidCDSCommon.cql @@ -214,8 +214,9 @@ define "Admitted/Referred/Discharged to Hospice Care": ) union ( - [ServiceRequest: code in "Hospice Procedure Codes"] E - where E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' } + "Service Requests" SR + where SR.code in "Hospice Procedure Codes" + and SR.status.value in { 'active', 'completed' } ) union ( @@ -355,3 +356,7 @@ define function ToRxNormCode(coding List): singleton from ( coding C where C.system = 'http://www.nlm.nih.gov/research/umls/rxnorm' ) + + define "Service Requests": + [ServiceRequest] SR + return SR diff --git a/input/pagecontent/cql/OpioidCDSREC08.cql b/input/pagecontent/cql/OpioidCDSREC08.cql index 6c111e6c..02917f28 100644 --- a/input/pagecontent/cql/OpioidCDSREC08.cql +++ b/input/pagecontent/cql/OpioidCDSREC08.cql @@ -84,10 +84,13 @@ define "Exclusion Criteria": ) or Common."End of Life Assessment" +define "Active Ambulatory Opioid Rx": + Common."Active Ambulatory Opioid Rx" + define "Total MME": MMECalculator.TotalMME( "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" - union Common."Active Ambulatory Opioid Rx" + union "Active Ambulatory Opioid Rx" ) define "On Naloxone": diff --git a/input/pagecontent/cql/OpioidCDSRoutines.cql b/input/pagecontent/cql/OpioidCDSRoutines.cql index e1d071ed..e1eccbda 100644 --- a/input/pagecontent/cql/OpioidCDSRoutines.cql +++ b/input/pagecontent/cql/OpioidCDSRoutines.cql @@ -62,10 +62,11 @@ define "Conditions Indicating End Of Life Present": define "Order For Palliative Care In Past 90 Days": exists ( - [ServiceRequest: Common."Therapies indicating end of life care"] SR - where SR.status in { 'active', 'completed'} - and SR.intent != null - and FHIRHelpers.ToDateTime(SR.authoredOn) during day of "Palliative Care Lookback Period" + Common."Service Requests" SR + where SR.status in { 'active', 'completed'} + and SR.intent != null + and FHIRHelpers.ToDateTime(SR.authoredOn) during day of "Palliative Care Lookback Period" + and SR.code in Common."Therapies indicating end of life care" ) define "Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present":