chore(task): archive 07-02-elder-bed-context-optimization
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# Elder Bed Context Optimization Design
|
||||
|
||||
## Summary
|
||||
|
||||
Add read-only cross-module context to the existing elder and bed workspaces. The implementation should not merge workflows; it only surfaces concise recent signals from persisted admissions, care tasks, health records, and emergency incidents.
|
||||
|
||||
## Data Boundary
|
||||
|
||||
Use existing persisted tables:
|
||||
|
||||
- admissions / beds / rooms for current bed state.
|
||||
- care_tasks for recent and active care execution.
|
||||
- vital_records and health_anomaly_reviews for health context.
|
||||
- system_incidents for safety/emergency context.
|
||||
|
||||
No schema change is required. `system_incidents` does not have elder/bed foreign keys yet, so emergency context is shown only when an incident's title, description, or source clearly mentions the elder name, bed code, or room label.
|
||||
|
||||
## Permission Boundary
|
||||
|
||||
Server pages decide which context to load:
|
||||
|
||||
- `admission:read` / `facility:read`: bed/admission context.
|
||||
- `care:read`: recent care task context.
|
||||
- `health:read`: health anomalies and latest vitals.
|
||||
- `incident:read`: matching open/acknowledged emergency context.
|
||||
|
||||
Users without a permission should not receive that context in props.
|
||||
|
||||
## Server Helper
|
||||
|
||||
Add `modules/operations/server/context.ts`:
|
||||
|
||||
- `listElderBedContextData(input)`
|
||||
- input:
|
||||
- `organizationId`
|
||||
- `permissions`
|
||||
- `elders`
|
||||
- `beds`
|
||||
- `admissions`
|
||||
- output:
|
||||
- `elderContexts: Record<string, ElderOperationalContext>`
|
||||
- `bedContexts: Record<string, BedOperationalContext>`
|
||||
|
||||
The helper should batch queries and keep bounded result sizes.
|
||||
|
||||
## UI Design
|
||||
|
||||
### Elder list
|
||||
|
||||
Add a compact "近期联动" column:
|
||||
|
||||
- current bed/admission is already shown in the bed column.
|
||||
- show up to three concise lines:
|
||||
- latest active/recent care task.
|
||||
- latest health anomaly or vital summary.
|
||||
- matching open/acknowledged emergency event.
|
||||
- If no permitted context exists, show `-`.
|
||||
|
||||
### Bed workspace
|
||||
|
||||
Add an occupant context column to the bed status table:
|
||||
|
||||
- show current elder care level/status.
|
||||
- show active/recent care task for that occupant.
|
||||
- show matching emergency event for occupant or bed when present.
|
||||
- Keep actions in the existing workflows; context is read-only.
|
||||
|
||||
## Compatibility
|
||||
|
||||
- Existing elder CRUD remains unchanged.
|
||||
- Existing admission workflows remain unchanged.
|
||||
- Client refresh continues to update elder/bed/admission tables; cross-module snippets are refreshed on page reload.
|
||||
Reference in New Issue
Block a user