
Hospital OS: Patient Records & OPD
Overview
Part 1 of a 50+ module Hospital Operating System built for a psychiatric and mental-healthcare hospital. This part is the foundation every other module depends on: a single patient registry keyed on a unique hospital identifier (UHID), and the outpatient department (OPD) workflow that moves a patient from registration to booked slot, queue token, consultation and prescription. Everything downstream (admissions, pharmacy, laboratory and billing) reads from and writes to this one record.
Shared patient record across departments
Modules in the full system
Workflow digitised
Full build delivered
The challenge
we had to solve
Appointments, patient files and consultation notes were kept manually and offline. The same patient could exist as several paper files with slightly different details, front-desk staff had no live view of which doctor was running late, and a psychiatrist's notes, prescriptions and referrals sat in folders that could not follow the patient to the next visit. For long-term mental-health care, where continuity across months of follow-ups matters, a fragmented history was a clinical risk as well as an operational one.

How we
approached it
We designed a normalised PostgreSQL schema around a single patient entity with a system-generated UHID, server-side duplicate checks on name, date of birth and phone, and a merge path for records that do collide. On top of it sits a React OPD workspace: doctor-wise slot calendars, walk-in and booked appointments in one queue, token numbers that update in real time as consultations start and close, and a consultation screen where the clinician records history, diagnosis, prescriptions and investigation orders against the same visit. Orders and referrals are written as structured records, not free text, so the pharmacy, laboratory and billing modules pick them up without re-entry.

One Patient, One Record
Every patient gets a UHID at registration. Visits, notes, orders and documents attach to it, so the full history follows the patient across departments and years of follow-up.
Predictable Front Desk
Doctor-wise slot calendars, walk-ins and booked appointments share one queue with token numbers, so staff can see who is waiting, who is in consultation and who is next.
Structured Consultations
Clinicians record history, diagnosis, prescriptions and investigation orders in structured fields designed for psychiatric follow-ups, not loose paper notes.
Built to Connect
Prescriptions, lab orders and referrals are stored as typed records exposed through REST APIs, ready for pharmacy, laboratory and billing to consume, and for HL7/FHIR-ready exchange later.
Four phases
zero shortcuts
Registry & Data Model
Mapped every way a patient enters the hospital and designed the normalised patient, visit and encounter tables around a single UHID, with duplicate detection and controlled record merging.
Appointments & Queue Engine
Built doctor-wise slot templates, walk-in handling and a token queue whose status changes are pushed to front-desk and doctor screens as consultations start and close.
OPD Consultation Workspace
Delivered the React consultation screen (visit history, notes, diagnosis, prescriptions and investigation orders) with server-side validation on every clinical field.
Orders, Referrals & Handover
Exposed prescriptions, orders and referrals as structured records over REST APIs so the pharmacy, lab and billing modules receive them without re-typing.
The work,
in full resolution
Drag to explore. Click to open full screen.



Before vs.
after
The system transformed the way we manage appointments and patient workflows while giving us a professional digital presence.
Want results like these? Let's talk about what we can build together.
Start a project