Skip to main content

Referral Module

v1.0.0 · Spring Boot 3.3 · HAPI FHIR 7.4 · Java 21 · Apache 2.0

The AJ FHIR Referral Module is a standalone Spring Boot service that manages cross-facility clinical referrals using FHIR R4 ServiceRequest and Task resources. Before any data is shared with the receiving facility, it verifies patient consent via the Consent Manager.

It runs on port 8083 alongside the AJ FHIR platform.

What it does

GP Practice                              Cardiology Unit
│ │
│ 1. Create draft referral │
│ 2. POST /api/referrals/{id}/send │
│ → Consent gate checks each │
│ resource type for receiving │
│ facility's client_id │
│ → Gate passes → ACTIVE │
│ → ServiceRequest + Task → HAPI │
│ │
│ 3. GET /api/referrals/inbox
│ 4. PATCH Task → ACCEPTED
│ 5. PATCH Task → COMPLETED
│◄─ referral status updates ─────────────│
│ │
└──── AuditEvent written async to HAPI ──┘

Key features

FeatureDetail
FHIR ServiceRequest + TaskFull bidirectional sync with HAPI FHIR JPA
Consent gateVerifies patient consent per resource type before sending
State machineValidated transitions — invalid moves are rejected with 422
Cross-facility inboxReceiving facility sees their referral queue
IHE ATNA auditEvery action audited with consent check result
Fail-closed consentUnreachable Consent Manager → referral blocked, not permitted
Clinician portalSend, track, and manage referrals

FHIR resources used

ResourcePurpose
ServiceRequestThe referral itself — requester, performer, reason, priority
TaskWorkflow steps at the receiving facility — triage, schedule, complete
AuditEventIHE ATNA record of every action and consent decision
DocumentReferenceSupporting clinical documents attached to the referral
BundleBulk referral export (planned)

Port and integration

The Referral Module runs on port 8083. It depends on three other platform services:

DependencyPortPurpose
HAPI FHIR JPA8080Canonical ServiceRequest/Task/AuditEvent store
SMART Auth Server9000RS256 JWT validation
Consent Manager8082Consent gate for cross-facility sharing

What it does not do

The Referral Module manages the workflow and data sharing aspects of referrals. It does not provide scheduling, appointment booking, clinical documentation authoring, or billing integration. It is the consent-enforced routing layer, not an EHR.


Next: Quick Start →