Over-prescription of opioids after surgery remains common. Residual and unnecessarily prescribed opioids can provide a reservoir for nonmedical use. We therefore tested the hypothesis that a decision-support tool embedded in electronic health records guides clinicians to prescribe fewer opioids at discharge after inpatient surgery.


We studied 21,689 surgical inpatient discharges in a cluster randomized multiple crossover trial from July 2020 to June 2021 in four Colorado hospitals. Hospital-level clusters were randomized to alternating eight-week periods during which an electronic decision-support tool recommended tailored discharge opioid prescriptions based on prior inpatient opioid intake. During active alert periods, the alert was displayed to clinicians when the proposed opioid prescription exceeded recommended amounts. No alerts were displayed during inactive periods. Carryover effects were mitigated by including 4-week washout periods. The primary outcome was oral morphine milligram equivalents prescribed at discharge. Secondary outcomes included combination opioid/non-opioid prescriptions and additional opioid prescriptions until day 28 after discharge. A vigorous state-wide opioid education and awareness campaign was in place during the trial.


The total postdischarge opioid prescription was a median [quartiles] of 75 [0, 225] oral morphine milligram equivalents among 11,003 patients discharged when the alerts were active and 100 [0, 225] morphine milligram equivalents in 10,686 patients when the alerts were inactive, with an estimated ratio of geometric means of 0.95 (95% CI: 0.80, 1.13; P = 0.586). The alert was displayed in 28% (3,074/11,003) of the discharges during the active alert period. There was no relationship between the alert and prescribed opioid/non-opioid combination medications or additional opioid prescriptions written after discharge.


A decision-support tool incorporated into electronic medical records did not reduce discharge opioid prescribing for postoperative patients in the context of vigorous opioid education and awareness efforts. Opioid prescribing alerts might yet be valuable in other contexts.