Health-system pharmacy revenue and patients leak out the front door — discharge scripts walk to retail, refills are a phone tree, and patients have no self-service. This is the patient-facing operations layer over Epic Willow, not another Willow internals build: discharge meds captured and filled before the patient leaves, an auto-refill subscription engine that proactively fills and notifies with consent-governed nudges, and a patient pharmacy portal — driving fills into existing Willow fulfillment and measuring the leakage it recaptures.
Tags: healthcare, provider, pharmacy, medication-management, epic, willow, patient-engagement, adherence, subscription, benefits-verification, prior-authorization, agentforce, api-led, event-driven, salesforce, consent
Pharmacy Operations Optimization: Meds-to-Beds, Auto-Refill Subscriptions, and the Patient Pharmacy Portal
Objective: Health-system pharmacy revenue and patients both leak out the front door — discharge scripts go to the retail pharmacy because nobody filled them in time, refills run on a phone tree and fax instead of a subscription, and patients have no self-service way to manage their pharmacy relationship. Every leaked script is earned margin lost; every missed refill is a readmission risk. Working looks like discharge meds filled in-house before the patient leaves, an auto-refill subscription that proactively fills and notifies, and a patient portal as easy as a retail app. This is deliberately not another Epic Willow internals build — it's the patient-facing layer driving fills into the workflow epic-automated-dispensing-system, epic-medication-carousels-robots, and epic-tpn-compounders already fulfill, without rebuilding that machinery.
What's Getting Built
- Patient Pharmacy Portal (Experience API) — backs the MyChart or Health Cloud portal for order, refill, status, and subscription management ·
POST /orders, POST /refills, GET /orders/{id}/status, GET /subscriptions, PATCH /subscriptions/{id}
- Fill Orchestration (Process API) — sole gate that clears coverage and PA then hands cleared fills to Willow, keyed on patient and medication to prevent duplicate fills ·
POST /fills, GET /fills/{id}, POST /fills/{id}/dispense-confirmed
- Auto-Refill Subscription Engine (Scheduler) — per-medication subscription clock that recomputes next-fill date from last confirmed dispense and triggers cycle fills ·
SCHEDULER daily next-fill sweep, POST /fills per due cycle
- Subscription & Adherence Store (Object Store) — holds per-medication subscription records, next-fill dates, and adherence state across cycles ·
GET /{subscriptionId}, PUT /{subscriptionId}, DELETE /{subscriptionId}
- Courier / Mail-Order Adapter (System API) — isolates the delivery vendor behind the Process API so a vendor swap never touches subscription code ·
POST /deliveries, GET /deliveries/{id}/status
- Epic Willow (target) — receives cleared fill orders via the existing outpatient order path and emits dispense-confirmation events ·
POST /MedicationRequest, EVENT MedicationDispense dispense-confirmed
Prerequisites
Choose your path
- Epic MyChart-native — Patients already live in MyChart. Build discharge status, refill requests, and subscription management as MyChart pharmacy features on this blueprint's Process APIs.
- Salesforce Health Cloud or custom portal — For a differentiated experience beyond MyChart's module, calling the same Process APIs. Both paths converge on one Process/System layer; only the Experience API differs.
Platform notes
Epic Willow fulfillment handoff
Benefits, PA, and financial clearance
Patient engagement and adherence
Agentforce
- A refill/adherence assistant is a natural Agentforce deployment on this blueprint's Process APIs, scoped to read status and initiate a refill, never override a benefits or PA hold — grounded in the ledger.
Architecture
1. Business requirements
- Every discharge medication is captured, cleared for coverage, and filled in-house before the patient leaves, wherever possible.
- Patients can enroll in auto-refill for maintenance meds; the program proactively fills and notifies instead of waiting for a call.
- A patient pharmacy portal supports order, refill, and status tracking for one-time and subscription fills.
- No fill reaches Willow without a coverage check and a PA check when required.
- Leakage — scripts that went to an outside pharmacy that could've been filled in-house — is measured, not assumed.
2. Discharge-med capture at the point of discharge order
- Hook capture into the Willow discharge order event (MedicationRequest at discharge, or Bridges ORC/RXE at order-sign), not a downstream batch — the window is minutes, not shifts.
- Flag every discharge med for in-house fill by default; require a reason code for an outside-pharmacy opt-out, so exceptions stay visible and reportable.
- Attribute the order to the discharging unit, encounter, and expected discharge time so pharmacy prioritizes by departure time.
- Where the med is normally dispensed via epic-medication-carousels-robots or compounded via epic-tpn-compounders, hand off the same way any Willow script flows.
3. Benefits and prior-authorization clearance
- Call healthcare-benefits-eligibility-verification synchronously before queuing any fill; starting a fill before coverage is confirmed is the biggest source of write-offs and pickup-counter friction.
- Route only PA-required medications and payers to healthcare-prior-authorization — gating everything kills the SLA.
- Surface copay and coverage results to the ordering clinician or pharmacist before the patient leaves, so a coverage problem is a bedside conversation, not a pickup-counter surprise.
- Treat "PA pending" as distinct from "cleared" and "held" — a subscription fill waiting on PA should not silently drop off the calendar.
4. Fill orchestration into Willow fulfillment
- Submit the cleared fill order via Willow's existing outpatient order path as the sole writer, so epic-automated-dispensing-system and epic-medication-carousels-robots see one order stream.
- Track order status (queued, filling, ready, picked up, delivered) via dispense-confirmation events, not polling — a stuck "filling" fill sends the patient home empty-handed.
- Correlate every fill order to its origin — discharge, portal, or subscription cycle — with a single identifier; leakage measurement depends on it.
- Escalate any discharge fill not "ready" within the SLA to a pharmacy work queue with expected discharge time.
5. Patient pharmacy portal
- Expose order, refill, and status endpoints from the Experience API chosen above, backed by the same Process API the subscription engine and discharge flow use.
- Let a patient view active subscriptions, one-time fills, pickup/delivery status, and copay per fill, pulling coverage already computed in step 3.
- Allow a patient to request an early refill or switch pickup/delivery, subject to the same coverage and duplicate-fill checks as any other fill path.
- Pull identity and consent from healthcare-patient-360 so the portal shows one patient record, not a second copy.
6. Auto-refill subscription engine
- Model a subscription per medication, not per patient — days-supply and next-fill date drift independently by medication.
- Compute next-fill date from days-supply and last confirmed dispense date, not a fixed interval, so a delayed pickup shifts the cycle instead of double-filling.
- Gate every subscription fill through the same benefits check as step 3 — coverage can change between cycles.
- Track adherence state (on-track, at-risk, lapsed) from pickup/delivery confirmation, and drive nudges off that state.
- Require explicit consent at enrollment for auto-refill and separately for adherence-nudge channels, matching pharma-commercial-patient-services's program-consent pattern.
- Let a patient pause, cancel, or skip a cycle from the portal without canceling the prescription.
7. Adherence nudges and delivery/pickup scheduling
- Hand refill-due and adherence-risk audiences to healthcare-marketing-outreach for consent, suppression, quiet hours, and TCPA rules — this blueprint supplies who and why, not how the message may legally be sent.
- Send refill-ready and delivery-status alerts through platform-utility-apis' notification API rather than a pharmacy-specific integration.
- Book pickup or delivery windows through healthcare-appointment-scheduling, treating delivery as any schedulable appointment.
- Where a courier or mail-order vendor fulfills delivery, treat the hand-off as a System API behind the Process API, so a vendor swap doesn't touch subscription code.
8. Leakage capture measurement
- Log every discharge order's disposition — filled in-house, filled outside, or unknown — with the step-2 reason code, and report capture rate by unit and clinician.
- Compare auto-refill enrollment and adherence against a pre-program baseline of retail refill patterns, to estimate revenue recaptured versus still leaking.
- Report portal refill volume against subscription-eligible medication volume, since low conversion is leakage too.
- Feed capture-rate and leakage metrics to pharmacy leadership on the same cadence as revenue reports.
9. Security and compliance
- Encrypt PHI in transit and at rest, including subscription and adherence-state records, which reveal clinical information even without a diagnosis field.
- Audit-log every access to pharmacy data, and preserve chain-of-custody attributes for controlled-substance discharge meds, matching diversion-analytics expectations epic-automated-dispensing-system already carries.
- Enforce minimum-necessary access for operators, support users, and Agentforce — it should read fill status, not full medication history.
- Evaluate consent at the moment of every nudge, never from a cached flag, matching the fail-closed pattern in healthcare-marketing-outreach.
- Treat auto-refill as authorization to fill and bill, not to contact by every channel — keep permissions separately revocable.
Sample payload — Auto-refill subscription record
{
"subscriptionId": "RXSUB-2026-004471",
"patientId": "Patient/eXampleMRN",
"medicationDisplay": "Atorvastatin 20 MG Tablet",
"daysSupply": 90,
"refillsRemaining": 2,
"status": "active",
"fulfillmentChannel": "delivery",
"lastConfirmedFill": { "fillOrderId": "FILL-2026-119042", "dispensedAt": "2026-05-29" },
"nextFillDate": "2026-08-27",
"adherenceState": "at-risk",
"coverage": { "verifiedAt": "2026-08-20", "status": "active", "copay": 12.0 },
"priorAuthRequired": false,
"consent": { "autoRefill": true, "adherenceNudges": { "channel": "sms", "granted": true } }
}
Testing and validation
- Fire a synthetic discharge order flagged for in-house fill; confirm it clears benefits, queues to Willow, and reaches "ready" inside the SLA, then confirm escalation fires when it doesn't.
- Enroll a test patient in auto-refill, advance past the days-supply window, and confirm a fill generates, coverage re-checks, and next-fill date recomputes from dispense date.
- Request a portal refill for a med with a subscription due in three days; confirm the duplicate-fill guard rejects or merges instead of double-filling.
- Revoke nudge consent and confirm the next nudge is suppressed while auto-refill continues.
- Submit a fill needing PA and confirm it holds at "PA pending," visible in portal and subscription record.
- Reconcile a week of discharge orders against fill records and confirm the leakage report classifies every disposition.
Phased rollout
Phase 1 — Connect
Phase 2 — Map and validate
- Pilot discharge-med capture on one unit; validate the SLA and escalation queue against real timing.
- Pilot auto-refill for one medication class; validate next-fill-date computation, adherence derivation, and the duplicate-fill guard.
Phase 3 — Production
- Expand discharge capture hospital-wide and auto-refill to the full formulary; turn on nudges through healthcare-marketing-outreach.
- Hand leakage reporting, subscription operations, and Agentforce escalation review to pharmacy operations.
Success metrics
- In-house discharge-med capture rate, trended against the pre-program baseline.
- Auto-refill enrollment and adherence-state distribution (on-track/at-risk/lapsed), alongside readmission-risk metrics case management watches.
- Fill-order-to-Willow-ready latency at P95, measured against the SLA.
- Duplicate-fill incidents per month, trending to zero.
Troubleshooting
- Auto-refill fires without checking current coverage or PA status — Cause: reused the enrollment-time result instead of re-verifying each cycle. Fix: call healthcare-benefits-eligibility-verification (and healthcare-prior-authorization where required) fresh, holding at "coverage pending."
- A nudge goes out after consent revocation, or outside TCPA hours — Cause: checked a cached flag instead of send-time evaluation through healthcare-marketing-outreach. Fix: route every nudge through its send-time gate; fail closed if unreachable.
- A discharge medication isn't filled before the patient leaves — Cause: capture hooked into a batch job, or the fill stalled in benefits/PA without escalation. Fix: trigger on the discharge event, escalate any fill not "ready" within the SLA.
- The same medication is filled twice — portal request and auto-refill cycle — Cause: no shared correlation key between the two generators. Fix: route both through one Process API gate, keyed on medication and patient.
Deliverable: A Process API-orchestrated pharmacy operations layer — discharge-med capture, benefits/PA clearance, and fill hand-off into Epic Willow fulfillment (epic-automated-dispensing-system, epic-medication-carousels-robots, epic-tpn-compounders) — plus a patient portal, an auto-refill engine with adherence tracking and consent-governed nudges, and a leakage report pharmacy can act on.