Multi-role platform for hospital escort and home care
A modular-monolith platform for hospital escort, care-worker and home-service orders. It includes a patient mini-program, a worker mini-program and app, hospital and operator consoles, and a separate ledger domain for payment splitting and settlement.
Direct answer. We built one modular-monolith backend that serves patients, workers, hospitals and the operator for escort and home-care orders, kept money movement in a separate ledger schema, and limited dispatch and tracking to what mini-programs can do on a phone.
Summary
Patients and families order through a mini-program. Workers take and complete jobs through a separate mini-program and a Flutter app. Hospitals and the operator use web consoles. The build started from a structured architecture review that put compliance and payment-splitting risks ahead of framework choice.
Problem
Escort and care services involve several parties: patient, family, worker, hospital and operator. Each party needs a different interface. Payment has to be split between platform and providers within the payment channel’s rules. Location and job-dispatch features also have to work within what mini-programs can actually do on a phone.
Constraints
- Patient-facing access through a messaging-platform mini-program only. The worker side needs a separate app identity because the two sides need different permissions.
- Mini-programs pause in the background, so continuous live tracking was not a reliable promise. The product wording changed to “every service step is recorded”.
- The payment channel limits how much of a payment can be split. Settlement rules had to fit that limit.
- Home nursing was deferred from the first milestone until the licensing and recording-device requirements under a provincial nursing-service standard could be met.
Architecture
| Part | Implementation |
|---|---|
| Backend | Java 21, Spring Boot 4.1; a Maven multi-module monolith with 15 modules, including order, staff, hospital, market, pay, settle and notify |
| Data | PostgreSQL 17 with separate business and ledger schemas; jOOQ in the ledger domain, Spring Data JDBC in the business domain; every schema change is a versioned Flyway migration |
| Clients | Two mini-programs built with the platform’s native framework, a Flutter worker app, and Vue 3 hospital and operator consoles |
| Local stack | Docker Compose with a mock messaging-platform service, so login and payment flows run without live credentials |
Key decisions
- Modular monolith, not microservices. Order, dispatch and settlement share one deployable, which keeps their transactions local; module boundaries are enforced in code instead of over the network.
- Separate ledger domain. Settlement and splitting are written in explicit SQL in their own schema, and the business domain never writes money records directly, so every money movement can be traced to one module.
- No promises the platform cannot keep. Instead of broadcast order-grabbing, dispatch uses targeted assignment, a confirmation timeout that escalates, and automated voice calls.
- Contracts before code. API, database, theming, environment and test contracts were written down first, and the architecture review recorded which items only the project owner could decide.
Evidence
- 287 Java test classes and 156 versioned migration files in the backend.
- Repository documents include a full audit report (2026-09-17) and a delivery review (2026-09-19).
Limits
Order volumes, live operating status, partner institutions and financial terms are not published. Regulatory interpretation in this case is engineering input, not legal advice.
Frequently asked questions
Why mini-programs instead of a native patient app?
Patients come in by scanning a code at the hospital. The architecture review found that mini-programs suit that entry point and the payment channels, so a separate native app would add little for patients.
How is money handled?
The ledger domain has its own schema, and only that domain writes money records. Splitting rules are designed within the payment channel's limits.
Is real-time worker tracking supported?
The platform records each service step. It does not promise continuous live tracking, because mini-programs cannot keep reporting location in the background.