Bidirectional MuleSoft integration between an external surgical referral or ASC scheduling system and Epic OpTime, exchanging surgical consults, case requests, and post-operative results over FHIR R4 and HL7v2 SIU/ORM/MDM.
Perioperative Workflows
Objective: Surgical care starts outside Epic OpTime: a referring clinic sends a consult, an ambulatory surgery center requests a case slot, and post-operative notes and pathology come back after the patient leaves the OR. Today these move by fax, phone, and manual OpTime entry, so case requests arrive without laterality, ASA class, or equipment needs, and post-op documentation never closes the loop with the referrer. Done looks like structured consults and case requests flowing into OpTime as ServiceRequest and Appointment data with a scheduler acknowledgment, and operative notes, disposition, and pathology returning to the originating system, all correlated to one surgical case. This accelerator packages the Perioperative Workflows Epic Data Sharing Playbook as a MuleSoft-anchored solution plan.
What's Getting Built
- Perioperative Intake (Experience API) — accepts surgical consults and case requests from the ASC or referring clinic and returns booking acknowledgments ·
POST /consults, POST /case-requests
- Perioperative Orchestration (Process API) — orchestrates patient match, procedure validation, and OR booking, then aggregates one scheduler acknowledgment ·
POST /cases, GET /cases/{id}/status
- ServiceRequest (System API) — writes the surgical consult and case request into Epic OpTime as FHIR ServiceRequest and Appointment/Slot ·
POST /ServiceRequest, POST /Appointment, GET /Slot
- Bridges SIU (System API) — exchanges HL7v2 scheduling and document messages with Epic OpTime through Bridges ·
SEND SIU^S12, LISTEN SIU^S13/S14, LISTEN MDM^T02
- Post-op Result Return (Process API) — correlates operative notes, disposition, and Beaker pathology to the case and returns them to the originating system ·
LISTEN ORU^R01, GET /DocumentReference, POST /post-op-return
- Case-request and result-return queues (Anypoint MQ) — queues case requests and post-op returns with correlation-ID dedupe and a dead-letter queue ·
PUBLISH case-request, CONSUME result-return, PUBLISH dead-letter
Prerequisites
- Epic OpTime licensed and live, with surgical service, procedure, and OR location master files mapped and a case request queue configured
- Epic on FHIR R4 client registered via App Orchard/Vendor Services with ServiceRequest, Appointment, and DocumentReference scopes and a backend OAuth 2.0 client-credentials JWT
- Bridges interface engine endpoints provisioned for HL7v2 SIU (scheduling), ORM/OMG (orders), and MDM (operative and pathology documents)
- Provider and patient identity available through an EMPI or Epic patient-match endpoint keyed on MRN and demographics
- Anypoint Platform with a VPC or MPLS path to the hospital network, plus Anypoint MQ for the case-request and result-return queues
- Master data for surgeon NPI, anesthesia coverage, procedure catalog (CPT), and equipment/preference cards agreed with the OR business office
1. Epic interfaces and standards
This accelerator implements the Perioperative Workflows Epic Data Sharing Playbook. Register the connecting app on Epic on FHIR and confirm the customer has the relevant Epic modules licensed before building.
- OpTime (perioperative scheduling and case tracking)
- Bridges HL7v2: SIU S12/S13/S14 for surgical scheduling, ORM/OMG for procedure orders, MDM T02 for operative notes and pathology
- FHIR R4 ServiceRequest for surgical consult and case request
- FHIR R4 Appointment and Slot for OR booking status
- FHIR R4 DocumentReference and Procedure for post-operative documentation
- Beaker (surgical pathology ORU results returned post-op)
Architecture
2. Business requirements
- Accept a surgical consult and a distinct case request; a consult asks the surgeon to evaluate, a case request asks the OR to book a slot, and OpTime treats them differently.
- Require laterality, ASA physical status, planned CPT, estimated case length, and equipment or implant needs on every case request; reject the request rather than let OpTime schedule an underspecified case.
- Return an explicit scheduler acknowledgment with the assigned OR date, room, and surgical service so the sender never has to call to confirm.
- Close the loop post-operatively by returning the operative note, disposition, and surgical pathology to the system that originated the case.
- Preserve one surgical case identity across consult, request, booking, and post-op so a referrer can track a patient end to end.
3. Ingestion and mapping
- Map an inbound surgical consult to FHIR ServiceRequest with intent=order, category=surgical, and a code from the procedure catalog; carry laterality in bodySite.
- Transform the case request in DataWeave to both an Appointment/Slot booking intent and an HL7v2 SIU S12 when OpTime scheduling runs through Bridges.
- Normalize procedure codes to CPT and diagnosis to ICD-10-CM at the System API boundary; do not push sender-local codes into OpTime.
- Represent required equipment, implants, and vendor reps as ServiceRequest.orderDetail and supportingInfo so preference cards and vendor scheduling can key off them.
- Stamp a correlation ID on ingestion and echo it into HL7v2 MSH-10 and FHIR meta so the case can be traced across FHIR and v2 hops.
4. Matching and normalization
- Match the patient before creating a case; call the Epic patient-match endpoint on MRN plus name, DOB, and sex and reject on ambiguous multi-match rather than guessing.
- Resolve the surgeon and referring provider to Epic Practitioner by NPI, not by free-text name, so case attribution and privileging are correct.
- Validate that the requested procedure exists in the OR procedure master and maps to a surgical service; unmapped procedures go to a review queue, not to OpTime.
- Normalize planned anesthesia type and ASA class to Epic-configured values so anesthesia staffing and pre-op requirements fire correctly.
- Confirm laterality and body site are internally consistent before booking; a left/right mismatch is a wrong-site-surgery precursor and must block, not warn.
5. Orchestration and post-op return
- Run the case request through a Process API that fans out patient match, procedure validation, and OR booking, then aggregates a single acknowledgment with room and time.
- Subscribe to OpTime case status via Bridges SIU S13/S14 or FHIR Appointment polling, and relay reschedules and cancellations back to the sender in near real time.
- On case completion, receive the operative note and disposition as HL7v2 MDM T02 or FHIR DocumentReference and route it to the originating system.
- Receive surgical pathology as Beaker ORU results, correlate to the case by placer/filler and accession, and attach it to the post-op return package.
- Treat the post-op return as event-driven off case-closed and document-signed events, not a nightly batch, so referrers see results while they still matter.
6. Error handling and operations
- Route unmatched patients, unmapped procedures, and laterality conflicts to a dead-letter queue with the correlation ID and a human-readable reason, never a silent drop.
- Alert on the absence of an expected post-op document within an SLA of case-closed; the missing operative note is the failure mode dashboards miss most often.
- Make case-request submission idempotent on the sender's request ID so a retry after a timeout does not double-book an OR slot.
- Retry transient Bridges and FHIR failures with backoff, but fail fast and escalate on booking-conflict rejections so a human resolves the slot contention.
- Log every state transition (requested, matched, booked, completed, returned) against the case correlation ID for audit and SLA reporting.
7. Security and compliance
- Encrypt PHI in transit and at rest.
- Audit-log every access to and modification of patient data, and carry a correlation ID end to end.
- Enforce minimum-necessary access for integration operators and support users.
- Enforce wrong-site-surgery safeguards in code: laterality and body-site validation is a patient-safety control, and any bypass must be logged and alerted.
- Scope the FHIR backend client to ServiceRequest, Appointment, DocumentReference, and Procedure only; do not request broad read scopes for a scheduling integration.
- Verify surgeon and referrer NPI against a trusted provider directory before attributing a case, to prevent spoofed or misrouted surgical requests.
- Encrypt operative notes and pathology in transit and at rest in Anypoint MQ, and purge post-op payloads from queues once delivery is acknowledged.
Sample payload — Surgical case request as FHIR ServiceRequest
{
"resourceType": "ServiceRequest",
"meta": { "tag": [{ "system": "urn:mule:correlation", "code": "peri-8f21c0" }] },
"status": "active",
"intent": "order",
"category": [{ "coding": [{ "system": "http://snomed.info/sct", "code": "387713003", "display": "Surgical procedure" }] }],
"priority": "routine",
"code": { "coding": [{ "system": "http://www.ama-assn.org/go/cpt", "code": "29881", "display": "Arthroscopy knee with meniscectomy" }] },
"bodySite": [{ "coding": [{ "system": "http://snomed.info/sct", "code": "7771000", "display": "Left" }], "text": "Left knee" }],
"subject": { "reference": "Patient/eXYZ", "display": "MRN 30291823" },
"requester": { "reference": "Practitioner/1073574649", "display": "NPI 1073574649" },
"orderDetail": [{ "text": "Arthroscopy tower; meniscal repair kit; vendor rep required" }],
"occurrenceTiming": { "repeat": { "boundsPeriod": { "start": "2026-09-08" } } },
"supportingInfo": [{ "display": "ASA class II; general anesthesia; est case 75 min" }]
}
Testing and validation
- Submit a valid case request and assert OpTime returns an Appointment with room, date, and surgical service, and the sender receives the acknowledgment within SLA.
- Send a request with left CPT laterality but right-side body site and confirm it is blocked, dead-lettered, and never booked.
- Fire a duplicate case request with the same sender request ID and verify only one OR slot is booked (idempotency).
- Simulate an OpTime reschedule via SIU S13 and confirm the change is relayed to the originating system with the same case correlation ID.
- Complete a case with no operative note and confirm the missing-document SLA alert fires after the configured window.
- Post a Beaker surgical pathology ORU and verify it correlates by accession to the correct case and joins the post-op return package.
Phased rollout
Phase 1 — Connect
- Register and validate the Epic FHIR backend client and Bridges SIU/ORM/MDM endpoints in a non-production Epic environment.
- Establish network connectivity and stand up the Anypoint MQ case-request and result-return queues with correlation-ID tracing.
Phase 2 — Map and test
- Load the OR procedure, surgical service, and anesthesia master mappings and validate CPT/ICD-10 normalization against Epic values.
- Run the full test matrix including laterality blocks, idempotency, reschedule relay, and post-op document return in a masked test org.
Phase 3 — Production
- Go live with one surgical service line and a controlled sender before expanding to all services.
- Monitor booking acknowledgments and post-op return SLAs, and hold a wrong-site safeguard review before broadening scope.
Success metrics
- Percent of case requests booked without manual scheduler intervention
- Median time from case request to booking acknowledgment
- Percent of completed cases with operative note returned within SLA
- Case-request rejection rate by reason (unmatched patient, unmapped procedure, laterality conflict)
- Duplicate-booking incidents caused by non-idempotent retries (target zero)
Troubleshooting
- Case request is accepted but never appears in the OpTime case queue. — Likely cause: The procedure code did not map to an OR procedure master entry or surgical service, so OpTime silently rejected the booking. Fix: Check the review queue for unmapped-procedure entries, add the CPT-to-OR-procedure mapping, and resubmit; make unmapped procedures a hard rejection with a reason rather than a pass-through.
- Referrer receives a booking acknowledgment but the patient is a different person than intended. — Likely cause: Patient match resolved on demographics alone and picked the wrong record when MRN was missing or wrong. Fix: Require MRN plus at least two demographic identifiers, reject on ambiguous multi-match, and route low-confidence matches to human review before booking.
- Operative note never reaches the originating system after surgery. — Likely cause: The MDM T02 or DocumentReference could not be correlated to the case because the placer/filler or correlation ID was lost across the FHIR-to-v2 hop. Fix: Persist the case correlation ID and echo it into MSH-10 and document identifiers, and enable the missing-document SLA alert so the gap surfaces immediately.
- The same OR slot is booked twice for one patient. — Likely cause: The sender retried after a gateway timeout and the request path was not idempotent on the sender request ID. Fix: Key an idempotency check on the sender request ID at the Process API, return the original acknowledgment on replay, and add a dedupe window in Anypoint MQ.
Deliverable: A deployable MuleSoft API-led blueprint (System, Process, and Experience APIs with DataWeave mappings, Anypoint MQ queues, and dead-letter handling) that ingests surgical consults and case requests into Epic OpTime via FHIR R4 and HL7v2 SIU/ORM, returns booking acknowledgments, and closes the loop with post-operative notes and Beaker pathology, all correlated to a single surgical case.