| name | healthcare-emr-patterns |
| description | EMR/EHR development patterns for healthcare applications. Clinical safety, encounter workflows, prescription generation, clinical decision support integration, and accessibility-first UI for medical data entry. Use when building EMR or EHR features such as encounter workflows, prescription generation, or clinical data entry UI. |
| metadata | {"version":"1.0.0","origin":"Health1 Super Speciality Hospitals โ contributed by Dr. Keyur Patel"} |
Healthcare EMR Development Patterns
Patterns for building Electronic Medical Record (EMR) and Electronic Health Record (EHR) systems. Prioritizes patient safety, clinical accuracy, and practitioner efficiency.
When to Use
- Building patient encounter workflows (complaint, exam, diagnosis, prescription)
- Implementing clinical note-taking (structured + free text + voice-to-text)
- Designing prescription/medication modules with drug interaction checking
- Integrating Clinical Decision Support Systems (CDSS)
- Building lab result displays with reference range highlighting
- Implementing audit trails for clinical data
- Designing healthcare-accessible UIs for clinical data entry
How It Works
Patient Safety First
Every design decision must be evaluated against: "Could this harm a patient?"
- Drug interactions MUST alert, not silently pass
- Abnormal lab values MUST be visually flagged
- Critical vitals MUST trigger escalation workflows
- No clinical data modification without audit trail
Single-Page Encounter Flow
Clinical encounters should flow vertically on a single page โ no tab switching:
Patient Header (sticky โ always visible)
โโโ Demographics, allergies, active medications
โ
Encounter Flow (vertical scroll)
โโโ 1. Chief Complaint (structured templates + free text)
โโโ 2. History of Present Illness
โโโ 3. Physical Examination (system-wise)
โโโ 4. Vitals (auto-trigger clinical scoring)
โโโ 5. Diagnosis (ICD-10/SNOMED search)
โโโ 6. Medications (drug DB + interaction check)
โโโ 7. Investigations (lab/radiology orders)
โโโ 8. Plan & Follow-up
โโโ 9. Sign / Lock / Print
Smart Template System
interface ClinicalTemplate {
id: string;
name: string;
chips: string[];
requiredFields: string[];
redFlags: string[];
icdSuggestions: string[];
}
Red flags in any template must trigger a visible, non-dismissable alert โ NOT a toast notification.
Medication Safety Pattern
User selects drug
โ Check current medications for interactions
โ Check encounter medications for interactions
โ Check patient allergies
โ Validate dose against weight/age/renal function
โ If CRITICAL interaction: BLOCK prescribing entirely
โ Clinician must document override reason to proceed past a block
โ If MAJOR interaction: display warning, require acknowledgment
โ Log all alerts and override reasons in audit trail
Critical interactions block prescribing by default. The clinician must explicitly override with a documented reason stored in the audit trail. The system never silently allows a critical interaction.
Locked Encounter Pattern
Once a clinical encounter is signed:
- No edits allowed โ only an addendum (a separate linked record)
- Both original and addendum appear in the patient timeline
- Audit trail captures who signed, when, and any addendum records
UI Patterns for Clinical Data
Vitals Display: Current values with normal range highlighting (green/yellow/red), trend arrows vs previous, clinical scoring auto-calculated (NEWS2, qSOFA), escalation guidance inline.
Lab Results Display: Normal range highlighting, previous value comparison, critical values with non-dismissable alert, collection/analysis timestamps, pending orders with expected turnaround.
Prescription PDF: One-click generation with patient demographics, allergies, diagnosis, drug details (generic + brand, dose, route, frequency, duration), clinician signature block.
Accessibility for Healthcare
Healthcare UIs have stricter requirements than typical web apps:
- 4.5:1 minimum contrast (WCAG AA) โ clinicians work in varied lighting
- Large touch targets (44x44px minimum) โ for gloved/rushed interaction
- Keyboard navigation โ for power users entering data rapidly
- No color-only indicators โ always pair color with text/icon (colorblind clinicians)
- Screen reader labels on all form fields
- No auto-dismissing toasts for clinical alerts โ clinician must actively acknowledge
Anti-Patterns
- Storing clinical data in browser localStorage
- Silent failures in drug interaction checking
- Dismissable toasts for critical clinical alerts
- Tab-based encounter UIs that fragment the clinical workflow
- Allowing edits to signed/locked encounters
- Displaying clinical data without audit trail
- Using
any type for clinical data structures
Examples
Example 1: Patient Encounter Flow
Doctor opens encounter for Patient #4521
โ Sticky header shows: "Rajesh M, 58M, Allergies: Penicillin, Active Meds: Metformin 500mg"
โ Chief Complaint: selects "Chest Pain" template
โ Clicks chips: "substernal", "radiating to left arm", "crushing"
โ Red flag "crushing substernal chest pain" triggers non-dismissable alert
โ Examination: CVS system โ "S1 S2 normal, no murmur"
โ Vitals: HR 110, BP 90/60, SpO2 94%
โ NEWS2 auto-calculates: score 8, risk HIGH, escalation alert shown
โ Diagnosis: searches "ACS" โ selects ICD-10 I21.9
โ Medications: selects Aspirin 300mg
โ CDSS checks against Metformin: no interaction
โ Signs encounter โ locked, addendum-only from this point
Example 2: Medication Safety Workflow
Doctor prescribes Warfarin for Patient #4521
โ CDSS detects: Warfarin + Aspirin = CRITICAL interaction
โ UI: red non-dismissable modal blocks prescribing
โ Doctor clicks "Override with reason"
โ Types: "Benefits outweigh risks โ monitored INR protocol"
โ Override reason + alert stored in audit trail
โ Prescription proceeds with documented override
Example 3: Locked Encounter + Addendum
Encounter #E-2024-0891 signed by Dr. Shah at 14:30
โ All fields locked โ no edit buttons visible
โ "Add Addendum" button available
โ Dr. Shah clicks addendum, adds: "Lab results received โ Troponin elevated"
โ New record E-2024-0891-A1 linked to original
โ Timeline shows both: original encounter + addendum with timestamps