MuleSoft application for lab and radiology orders out of eClinicalWorks (ORM^O01) and discrete results / PDF reports back in (ORU^R01 2.3 or 2.5.1, ORU/MDM), plus an optional FHIR R4 read path (ServiceRequest, DiagnosticReport, Observation). Covers the eCW SOW and connectivity prerequisites, a canonical order/result model so each new LIS/RIS partner is a mapping exercise rather than a new interface project, order↔result correlation, unsolicited-result patient matching with a dead-letter path, corrected-result handling, embedded-PDF reports, and HIPAA audit logging. Built from eCW's public HL7 Lab/Radiology Orders, Results, and Reports Inbound specifications and the eCW FHIR Developer Portal.
Tags: healthcare, eclinicalworks, fhir, radiology, orders, results, ehr-integration, hl7v2, labs
eClinicalWorks Orders & Results Integration (HL7 v2 + FHIR R4)
Deliverable: A MuleSoft application set that sends lab and radiology orders out of eClinicalWorks (ORM^O01) to any LIS/RIS/reference lab, brings discrete results (ORU^R01, HL7 2.3 or 2.5.1) and PDF reports (ORU/MDM) back into the patient chart, and exposes a FHIR R4 read path (ServiceRequest, DiagnosticReport, Observation) for downstream consumers — with idempotent result matching, ACK handling, and a dead-letter path for unmatched results.
Objective: Practices on eCW that add a new lab, imaging center, or hospital partner typically wait months on a point-to-point eCW-vendor interface, then repeat the whole exercise for the next partner. Results that fail to match an order or patient land in a manual queue, delaying provider review and creating chart gaps. This Solution Accelerator standardizes the eCW side once — one MLLP/SFTP edge, one canonical order/result model — so each new partner is a mapping exercise rather than a new interface project, and every unmatched result is caught, routed, and reported instead of silently dropped.
What you should see
- /ecw-hl7-outbound (System API — eCW ORM listener) — Receives ORM^O01 lab and radiology orders from eCW over MLLP or SFTP pickup, validates against the eCW spec, returns ACK ·
MLLP :2575, GET /orders/{placerOrderId}
- /ecw-hl7-inbound (System API — eCW ORU/MDM sender) — Delivers ORU^R01 (2.3 / 2.5.1) results and ORU/MDM embedded-PDF reports to the eCW interface engine, handles eCW ACK/NAK ·
POST /results, POST /reports
- /partner-lab (System API — LIS/RIS/reference lab) — Partner-specific transport and message shape (MLLP, SFTP, or vendor API) ·
POST /orders, MLLP :2576 (results in)
- /orders-results-prc (Process API) — Canonical order/result model, order↔result correlation, patient matching, compendium code mapping, unsolicited-result handling ·
POST /orders, POST /results, GET /results/unmatched
- /ecw-fhir (System API — eCW FHIR R4 backend service) — OAuth 2.0 client-credentials read of
ServiceRequest, DiagnosticReport, Observation, Patient for downstream consumers; optional ServiceRequest/Task create where the FHIR Create contract exists · GET /ServiceRequest, GET /DiagnosticReport, GET /Observation
- /orders-results-exp (Experience API) — Order status and result lookup for portals, analytics, or Agentforce ·
GET /patients/{id}/orders, GET /patients/{id}/results
Prerequisites
- An eCW interface Statement of Work. eCW requires an SOW for every HL7 interface and there are typically per-interface costs; this is the long pole and should be started before any build.
- The current versions of the eCW implementation guides from the customer's my.eclinicalworks.com portal: HL7 Lab Orders, HL7 Lab Results (2.3 and/or 2.5.1), HL7 Radiology Orders, HL7 Radiology Results, HL7 Reports Inbound (ORU/MDM). Public copies exist on eclinicalworks.com (Aug 2020–2022 revisions) and are sufficient for design; use the portal versions for build.
- eCW interface engine connectivity details from eCW support: MLLP host/port or SFTP drop for each direction, VPN or IP allow-list, sending/receiving application and facility IDs (MSH-3/4/5/6).
- The partner lab or RIS implementation guide, order compendium (test codes, AOE questions), and results code set (LOINC or local).
- For the FHIR path: registration of a provider-facing backend service app on the eClinicalWorks FHIR Developer Portal (fhir.eclinicalworks.com), the practice's FHIR base URL, and confirmation the practice is on a certified build (12.0.2 / 12.0.3 cumulative patch or later) so ServiceRequest and DiagnosticReport scopes are supported. Write access (FHIR Create) requires a separate contract with eCW.
- Anypoint Platform with MLLP connector, SFTP connector, and HL7 EDI module licensed; a CloudHub 2.0 private space or on-prem runtime that can sit inside the practice VPN.
- Sample messages with PHI-scrubbed but structurally real data from both eCW and the partner for mapping validation.
Choose your path
- HL7 v2 (primary) — Choose this for orders out and discrete results in. eCW's clinical interface model is HL7 Orders Outbound / Results Inbound / Reports Inbound; this is the only path that writes discrete results into the chart and it is what eCW's interface team supports.
- FHIR R4 (read-side, additive) — Choose this to expose orders and results to consumers outside eCW (portals, analytics, agents) without another HL7 feed. Do not plan on FHIR as the results-inbound path; Create support is limited and contracted separately.
Architecture
1. Stand up the eCW edge (ecw-hl7-outbound / ecw-hl7-inbound)
- Build the MLLP listener for ORM^O01 and the MLLP client for ORU^R01/MDM as separate apps; eCW treats orders-out and results-in as distinct interfaces with distinct SOWs, and separating them lets one be redeployed without dropping the other.
- Return an application ACK (MSA-1 = AA) only after the message is durably persisted (object store or queue). Returning AA before persistence is how orders get lost during a redeploy.
- Support SFTP as an alternate transport from day one; many eCW deployments still exchange via file drop, and the eCW SOW will specify which.
- Validate MSH-3/4 against the agreed sending application/facility so a misconfigured eCW test tenant cannot push into production.
2. Define the canonical order and result model (orders-results-prc)
- Model an order as placer order number (ORC-2), filler order number (ORC-3), patient (PID-3 eCW MRN + demographics), ordering provider (ORC-12), one or more requested tests (OBR-4), AOE answers (OBX on the order), and insurance (IN1) where the lab requires it.
- Model a result as filler order number, result status (OBR-25 / OBX-11: P, F, C), observations with LOINC or local codes, reference ranges, abnormal flags, and notes (NTE at PID, OBR, or OBX level — eCW accepts all three).
- Keep the canonical model version-neutral so the same Process API serves 2.3 and 2.5.1 labs; the 2.5.1 differences (SPM specimen segment, extended OBX-5 typing) live in the System API mappings.
3. Orders outbound: map ORM^O01 to the partner
- Map eCW test codes to the partner compendium via a versioned lookup table, not inline DataWeave literals; compendium updates are the most frequent change on a live interface.
- Carry ORC-2 (placer order number) unchanged end to end. It is the only key eCW will use to match a solicited result back to the order.
- Emit one order per OBR when the lab requires it; eCW may group multiple OBRs under one ORC.
- Persist the outbound order (placer ID, patient, tests, timestamp) before sending to the partner so unsolicited or delayed results can still be correlated.
4. Results inbound: correlate, match, and deliver
- Solicited results: look up by ORC-2/ORC-3 against persisted orders. Matched results are mapped to the eCW ORU spec and delivered.
- Unsolicited results (no originating eCW order): eCW accepts these, but only if the patient can be identified. Match on PID-3 (eCW MRN) first; fall back to a deterministic demographic match (last name, DOB, sex, and one of first name or phone). Anything below the match threshold goes to the unmatched queue, never to eCW.
- Preserve result status transitions: preliminary → final → corrected. A corrected result (OBR-25 = C) must reference the same filler order number so eCW updates rather than duplicates.
- For radiology, pass the PACS viewer URL in the result per the eCW radiology results spec so the provider can launch images from the chart.
- PDF reports go through the Reports Inbound spec as ORU or MDM with base64 PDF in OBX-5 (ED type). Only embedded PDF is supported; do not send links or other MIME types.
- Anything below the match threshold goes to the unmatched queue, never to eCW — acknowledged back to the partner as accepted (HTTP 202 for API/SFTP partners, MSA-1 = AA for MLLP) so the partner does not retry.
5. FHIR R4 read path (ecw-fhir / orders-results-exp)
- Register a backend service (client-credentials) app on the eCW FHIR Developer Portal; store the client secret in Anypoint secure properties.
- Expose
ServiceRequest (orders/referrals), DiagnosticReport and Observation (results), and Patient through the Experience API with the same patient and order identifiers used in the HL7 path so a consumer can navigate from an HL7-delivered result to its FHIR representation.
- Handle the "scope not supported" response gracefully: practices on older builds return it for ServiceRequest/DiagnosticReport, and the Experience API should degrade to HL7-sourced data rather than error.
6. Security and compliance
- HIPAA: all transports are VPN-bound MLLP or SFTP with key auth; FHIR over TLS 1.2+ with OAuth 2.0. No PHI in CloudHub public endpoints.
- PHI is encrypted at rest in the object store and message queues; queue TTL is set so unmatched results are aged into a reviewed exception report, not retained indefinitely.
- Audit log every message with MSH-10 (message control ID), direction, patient MRN, order/filler IDs, and outcome (ACK/NAK/unmatched). Never log OBX-5 result values or PDF content.
- Use Anypoint Monitoring alerts on NAK rate and unmatched-queue depth; both are patient-safety signals, not just operational ones.
Sample payload — canonical result (Process API) for a solicited CBC
{
"placerOrderId": "ECW-2026-000123",
"fillerOrderId": "LAB-77881",
"patient": { "mrn": "10045", "lastName": "Doe", "firstName": "Jane", "dob": "1980-04-12", "sex": "F" },
"orderingProvider": { "npi": "1234567890", "name": "Smith, John" },
"resultStatus": "F",
"observations": [
{ "code": "6690-2", "codeSystem": "LN", "display": "WBC", "value": "7.1", "unit": "10*3/uL", "range": "4.0-10.5", "flag": "N" },
{ "code": "718-7", "codeSystem": "LN", "display": "Hemoglobin", "value": "11.2", "unit": "g/dL", "range": "12.0-16.0", "flag": "L" }
],
"notes": ["Specimen slightly hemolyzed."],
"sourceMessageControlId": "MSG20260910120000"
}
Deterministic checks
- Every ORM^O01 accepted from eCW yields exactly one persisted order keyed on ORC-2 (placer order number); message-level idempotency is keyed separately on MSH-10 — the ACK carries MSA-2 = inbound MSH-10, and replaying the same MSH-10 is a no-op (no second order, same ACK).
- Every result delivered to eCW carries ORC-2 equal to the originating order's placer ID; a result with an unknown ORC-2 and no patient match above threshold is routed to the unmatched queue with HTTP 202 to the partner and never reaches eCW.
- A corrected result (OBR-25 = C) for an existing filler ID produces one update in eCW, not a duplicate — verified by querying
GET /results/{fillerId} and by the eCW ACK sequence.
- MLLP framing is correct: every outbound message to eCW is wrapped
<VT>…<FS><CR>, and any NAK (MSA-1 = AE/AR) is retried with backoff up to N times then dead-lettered with the NAK text.
ecw-hl7-inbound never sends a message whose MSH-3/MSH-4 do not match configured values for the target environment.
- Build an MUnit suite (src/test/munit) covering ORM parse, 2.3 and 2.5.1 ORU generation, unsolicited-result matching (positive and below-threshold), corrected-result update, and PDF report packaging; target ≥ 80% coverage.
Testing and validation
- Happy path: order placed in the eCW test tenant → appears at the partner with correct compendium code → partner returns a final result → result is visible on the correct patient and order in eCW with abnormal flags intact.
- Edge case that breaks naive builds: a lab sends a preliminary result, then a final with an added OBX, then a correction that removes an OBX. Verify eCW shows a single, current result set and the provider's inbox shows one item, not three.
- Patient matching: send an unsolicited result for a patient with a name/DOB collision in the practice; confirm it lands in the unmatched queue rather than on either chart.
- Mapping proof: run the full partner compendium through the lookup and diff against the eCW test-code export; zero unmapped codes before go-live.
- Load: replay one day of the practice's real order volume against the test tenant at 3× rate with no ACK timeouts.
Phased rollout
Phase 1 — Connect
- Execute the eCW SOW, establish VPN/MLLP or SFTP connectivity to the eCW test tenant, prove ACK round-trip both directions with the eCW sample messages.
Phase 2 — Map and validate
- Load the partner compendium, map both directions, run scrubbed real messages, clear the unmapped-code list, complete the preliminary/final/corrected and unmatched-patient scenarios with clinical sign-off.
Phase 3 — Production
- Cut over one ordering location first, monitor NAK rate and unmatched depth daily for two weeks, then expand. Hand the compendium lookup table and exception report to the practice's interface analyst.
Success metrics
- Time to onboard the next lab or imaging partner: from months to weeks, measured as SOW-to-live.
- Results requiring manual matching: below 1% of inbound volume.
- Order-to-result-in-chart latency: p95 under 5 minutes from partner send.
- NAK rate from eCW: below 0.1%; unmatched queue cleared within one business day.
Troubleshooting
- eCW ACKs the result but it never appears on the chart — Likely cause: ORC-2 does not match an open order and the patient match failed silently on the eCW side, or the ordering provider in ORC-12 is not an eCW user. Fix: confirm placer ID passthrough and validate ORC-12 against the eCW provider list.
- Duplicate results in the provider inbox — Likely cause: filler order number changed between preliminary and final, or a retry re-sent a message with a new MSH-10. Fix: hold filler ID constant across statuses; make retries reuse the original MSH-10.
- NAK: "unsupported version" — Likely cause: sending a 2.5.1 ORU (SPM segment) to an interface configured for 2.3. Fix: confirm the version in the eCW SOW and route through the correct System API mapping.
- PDF report rejected — Likely cause: OBX-5 not typed ED, or content is a link rather than embedded base64. Fix: eCW reports inbound only accepts embedded PDF.
- FHIR returns "read/search for this scope is not supported" — Likely cause: practice is below the certified 12.0.2/12.0.3 patch level. Fix: practice opens a case on my.eclinicalworks.com for an upgrade; Experience API falls back to HL7-sourced data meanwhile.
- Orders stop flowing after a redeploy — Likely cause: MLLP listener port not reserved in the private space, or eCW's engine cached a dead connection. Fix: pin the port, enable TCP keepalive, and have eCW restart the interface after deploys.