Electronic Health Record (EHR) System Development
EHR (Electronic Health Record) is a digital analogue of a patient's paper medical history. Stores the patient's complete medical history: visits, diagnoses, prescriptions, test results, allergies, vaccinations. EHR is a medical information system (MIS) and must comply with the requirements of Russia's Ministry of Health, GOST R 52636-2006, HL7 FHIR standard.
Key FHIR Resources
HL7 FHIR R4 defines standard resources for medical data. Main ones for EHR:
| FHIR Resource | Description |
|---|---|
Patient |
Patient demographics |
Encounter |
Visit/contact with healthcare organization |
Condition |
Diagnosis (ICD-10 code) |
Observation |
Measurements: blood pressure, temperature, lab values |
MedicationRequest |
Medication prescription |
DiagnosticReport |
Test result (with PDF attachment) |
AllergyIntolerance |
Allergies and intolerances |
Immunization |
Vaccination |
DocumentReference |
Reference to medical document |
Storage in PostgreSQL via JSONB (each resource as JSON) with indexes on key fields:
CREATE TABLE fhir_resources (
id UUID PRIMARY KEY,
resource_type VARCHAR(50),
resource_id VARCHAR(64),
patient_id UUID,
data JSONB,
version_id INT,
last_updated TIMESTAMPTZ
);
CREATE INDEX ON fhir_resources USING GIN (data);
CREATE INDEX ON fhir_resources (resource_type, patient_id);
Ready FHIR servers for PostgreSQL: HAPI FHIR (Java), Medplum (Node.js + TypeScript, with React SDK).
Structured Visit Documentation
Doctor documents visit using SOAP structure:
- S (Subjective) — patient complaints
- O (Objective) — examination, measurements, results
- A (Assessment) — diagnosis (ICD-10)
- P (Plan) — prescriptions, referrals, recommendations
In the interface, each block is a separate section with rich-text editor. Diagnoses are selected from ICD-10 reference with autocomplete.
Prescriptions and Drug Interactions
When prescribing medication, system checks:
- Patient allergies to component
- Drug interactions with already prescribed medications
- Contraindications (pregnancy, age, chronic diseases)
Interaction database: DrugBank API, openFDA, or Russian GRLS (State Registry of Medicines).
Data Security
EHR contains the most sensitive data. Requirements:
- Sharding + encryption at rest: PostgreSQL with TDE or column-level encryption for diagnoses, results
- Row-Level Security: doctor sees only patients in their department/organization
- Audit trail: immutable log of every access to patient record (who, when, what)
- Break-glass access: emergency access to any patient's data with mandatory logging and notification
- Data masking: when demonstrating and testing — masking names and identifiers
Integration with REMD
REMD (Registry of Electronic Medical Documents) — federal Ministry of Health system. Electronic medical documents (discharge summaries, protocols) are transmitted to REMD in CDA R2 or FHIR Bundle format. Requires qualified physician signature and organization signature.
Offline Work
For clinics with unstable internet — capability for offline work:
- Service Worker caches patient data for session
- Changes stored locally, synced when connection restored
- Sync conflicts — via OT or CRDT
Medical Equipment Integration
Automatic data transfer from devices:
- HL7 v2 — old but ubiquitous standard for labs, analyzers (ASTM E1394)
- DICOM — standard for images: CT, MRI, X-ray
- FHIR Device — for modern mobile devices (pulse oximeters, glucometers)
Timeline
EHR MVP (patient card, visit documentation, SOAP documentation, basic ICD-10 diagnoses): 4–6 months. Full-featured system with FHIR server, RLS, audit, REMD integration, DICOM viewer: 9–16 months.







