Projects

Hospital Management System

One connected system for a private hospital: a patient walks in, sees a doctor, gets tests and medicine, is admitted if needed and leaves with one clear bill. Nothing is written twice.

Owner dashboard showing money billed and collected, OPD visits, bed occupancy, pharmacy margin and revenue by department
My role
Sole developer: design, database, backend, frontend and testing
Built with
Python, FastAPI, SQLAlchemy, PostgreSQL, React, Vite
Size
30+ screens, 86 database tables, 14 staff roles
Status
Built and tested, 45 automated tests passing

Why it was needed

In many private hospitals, reception writes the patient's name in one register, the lab writes it in another and the pharmacy types it again. Bills get added up by hand at discharge, and the owner has no quick way to see how much money came in, how much is still owed, or where it leaks.

This hospital already used MediStore for its pharmacy. My job was to build everything around it, so that every department works from the same patient record.

How a visit flows

  • 1. Registration and tokenThe patient gets one ID and a token for their doctor. Tokens can't repeat, even when two receptionists book at the same moment.
  • 2. ConsultationThe doctor records vitals, notes, diagnosis with ICD-10 codes, then signs prescriptions, lab tests and imaging orders.
  • 3. Orders reach departmentsSigned orders appear in the lab, radiology and pharmacy queues on their own. Unsigned drafts stay private to the doctor.
  • 4. Pharmacy checks the patientA name alone isn't enough. Staff confirm identity with a QR card, visit ID or date of birth before dispensing.
  • 5. Results go backLab and imaging reports land in the doctor's inbox, and the patient gets an SMS link to read them.
  • 6. One billEvery service lands on one invoice, whether the patient pays cash, uses a panel or insurance, or the Sehat Card.

What's in it

  • Front deskRegistration, appointments, token queue display, printed slips and patient cards with a QR code.
  • EmergencyColour triage, unidentified patients, treat-first billing and a medico-legal (MLC) register.
  • Doctor deskConsultations, e-signed orders, a results inbox and printed prescriptions with PMDC numbers.
  • Laboratory and radiologyBill, collect sample or perform, enter and verify the result, upload the report.
  • PharmacyMediStore runs inside the hospital: batches, expiry, FEFO dispensing and the DRAP controlled-drug register.
  • Admissions and bedsWards, bed transfers, treatment records, discharge summary, LAMA, referral and death certificates.
  • Operation theatreScheduling with clash checks, consent before elective surgery, anaesthesia record and consumables.
  • MoneyPanels and insurance with credit limits, advance deposits, packages, cashier shifts and day-end closing.
  • AccountsDoctor revenue share, expenses, payables, a balanced double-entry journal and an FBR POS queue.
  • Hospital servicesBlood bank, dialysis, physiotherapy, ambulance, diet kitchen, general store and equipment upkeep.
  • HR and payrollStaff records, rosters, attendance and payroll with income-tax slabs.
  • Owner dashboardBilled vs collected, outstanding dues, bed occupancy, average stay and revenue by department and doctor.

The engineering I'm proud of

Hospital software has to be right when it's busy, so I put most of my effort into the parts nobody sees.

  • No double dispensingI tested four pharmacists clicking "dispense" on the same prescription at once: exactly one succeeds and stock drops once.
  • Safe numberingInvoice, token and prescription numbers come from one atomic PostgreSQL statement, so they never repeat.
  • Privacy by roleFourteen staff roles each see only their screens. Patient QR codes are signed and can be revoked, and every sensitive action is audit-logged.
  • MediStore kept intactThe pharmacy code is copied byte for byte, and a test fails if anyone edits it, so both products stay in step.
  • Tested on real PostgreSQL45 pytest tests cover the full outpatient and inpatient journeys, ER, panels, OT, payroll and compliance.
  • Clicked through as real staffPlaywright logged in as ten different roles and opened every screen with no errors. Migrations upgrade and roll back cleanly.

Screens

Patient names in these screens are made up.

What I learned

The first version covered the clinical workflow. Then the hospital owner sat with it and listed what a real day needs: emergencies that can't wait for payment, insurance panels with credit limits, cash that has to balance at the end of each shift. I built those in four more stages, each one tested before the next began.

That review taught me more than any spec could. Software for a hospital isn't just screens. It has to match how the staff actually move through their day.

Running a hospital or clinic on paper and spreadsheets?

Let's talk about it