About Experience Engineering Projects Infrastructure Blog Contact
ERPNext & Frappe πŸ‡§πŸ‡© BD Case Study Β· Part 2: Hospital

ERPNext for Bangladesh Hospitals: Dhaka Care Medical & Hospital Ltd.

Published: Aug 30, 2026

πŸ₯ Hospital Profile: Dhaka Care Medical & Hospital Ltd.

Fictional company, illustrative implementation. Dhaka Care Medical & Hospital Ltd. is a fictional private hospital and diagnostic center in Dhaka, Bangladesh, used as a running example across this companion series β€” first introduced in Part 1's company profile. No real hospital's data, systems, or configuration are represented here.

The hospital runs both inpatient and outpatient care alongside its own diagnostic lab and pharmacy, which is exactly the kind of multi-department, multi-revenue-stream organization ERPNext is well suited to model once its core modules are combined with a couple of domain-specific custom modules. Its departments, for the purpose of this case study:

OPD

Emergency

IPD

ICU

CCU

OT

Pharmacy

Laboratory

Radiology

Blood Bank

Ambulance

Nursing

Every section below assumes this department list and reuses the same Part 1 implementation methodology β€” the base-module-first, custom-module-only-when-necessary discipline this series is built around.

🚢 The Patient Journey

Before mapping anything to ERPNext DocTypes, it helps to see the journey as a patient actually experiences it β€” one continuous path that later gets split across a custom clinical module, a custom lab module, and several base ERPNext modules:

Patient
β†’
Appointment
β†’
Consultation
β†’
Investigation
β†’
Prescription
β†’
Admission
β†’
Treatment
β†’
Discharge
β†’
Billing
β†’
Payment

Each stop on that journey touches a different record. Laid out as relationships instead of a sequence, the same journey looks like this:

Patient

↓generates / is seen by

Doctor

Appointment

Lab

Radiology

Pharmacy

Bed

Admission

Treatment

Billing

Everything in that second layer ultimately references the same Patient record β€” this is the "reference, don't duplicate" master-data pattern the base course establishes in Part 1's master/transaction table split, applied to a hospital instead of a warehouse.

🧩 Hospital Operations on Base ERPNext

Most of what keeps a hospital's business running β€” not its clinical work, its business β€” is already covered by ERPNext's standard modules, exactly as introduced in Part 1 of the base course and detailed per-module in Part 3. Nothing here needs a custom DocType:

ModuleUsed for, in this hospital
AccountingPatient billing, doctor payment, supplier payment, pharmacy/diagnostic revenue, expenses, hospital assets, bank, cash, GL
BuyingMedicine procurement, medical equipment, lab consumables, surgical materials, office supplies
StockMedicines, consumables, surgical supplies, lab reagents, equipment inventory
HRDoctors, nurses, pharmacists, lab technicians, receptionists, admin staff
PayrollSalary, allowances, deductions, payroll accounting
AssetsMRI, CT scanner, X-ray machine, ICU equipment, ambulance, computers
ProjectsHospital expansion, new branch, equipment installation, construction projects

What's not in that table β€” appointments, consultations, admissions, lab requests β€” is precisely what the two custom modules below exist to cover, following the same Configure β†’ Customize β†’ Custom Module β†’ Integration decision ladder Part 1 establishes.

🩺 Custom Module A: Hospital Clinical Management

Nothing in base ERPNext models a patient, an appointment slot, or a bed β€” so this is the "need new DocTypes" branch of the customization decision tree. The clinical module's DocTypes:

DocTypeRole
PatientMaster record for the person receiving care
Patient RegistrationThe intake event that creates or re-identifies a Patient
AppointmentA scheduled slot with a Doctor
DoctorMaster record for a consulting/attending physician
ConsultationThe actual visit/encounter record
DiagnosisClinical finding(s) recorded against a Consultation
PrescriptionMedicines and instructions issued from a Consultation
AdmissionAn inpatient stay, opened when OPD care isn't enough
DischargeCloses an Admission
BedA physical, assignable inpatient resource
WardGroups Beds (general ward, ICU, CCU, …)

The relationships branch in two directions from Patient, so they're shown as two focused diagrams rather than forcing one diagram to show both branches at once:

Outpatient branch

Patient
β†’
Appointment
β†’
Consultation
β†’
Diagnosis + Prescription

Inpatient branch

Patient
β†’
Admission
β†’
Ward + Bed
β†’
Discharge

A compact field-level view of the Patient DocType only, in the same field-level training table shape Part 1 uses throughout that article for training end users field by field:

FieldTypeRequired?Who enters?When?Why?ExampleRelated DocType
patient_idData (naming series)AutoSystemOn saveUnique, human-readable patient identifier used across the whole recordPAT-2026-00042β€”
patient_nameDataYesReceptionistRegistrationIdentifies the patient on every downstream documentAbdul Karimβ€”
date_of_birthDateRecommendedReceptionistRegistrationAge-appropriate dosing, pediatric vs adult routing1990-04-12β€”
genderSelectRecommendedReceptionistRegistrationClinical relevance, ward assignmentMaleβ€”
contact_numberData (Phone)YesReceptionistRegistrationAppointment confirmation, emergency contact+8801XXXXXXXXXβ€”
addressSmall TextRecommendedReceptionistRegistrationRecords District/Division for demographic and referral trackingMirpur, DhakaAddress
blood_groupSelectRecommendedNurse/ReceptionistRegistration or first admissionEmergency and transfusion safetyB+β€”
customerLink β†’ CustomerAuto/SystemSystem (on registration)RegistrationLets the Patient bill through the standard ERPNext AR flow without duplicating billing logicCUST-PAT-00042Customer
As with every DocType and field name in this series, treat these as illustrative β€” exact field names, types, and mandatory rules must be finalized in the actual site's Customize Form / DocType editor and validated against the ERPNext version in use, per the accuracy note in Part 1 of the base course.

🧫 Custom Module B: Laboratory & Diagnostic Management

Lab Request
β†’
Sample
β†’
Sample Type
β†’
Test
β†’
Test Parameter
β†’
Result
β†’
Result Approval
β†’
Lab Report
πŸ’‘ This is the same Lab Sample pattern the base course's capstone already built β€” specialized. The 9-part base course's Laboratory Management capstone project introduced a generic Patient β†’ Sample β†’ Test Request β†’ Test β†’ Lab Result β†’ Lab Report pattern as a standalone teaching example. This hospital's Laboratory & Diagnostic Management module is that exact same architectural pattern, now expanded for a real, multi-department hospital: it adds explicit Sample Type and Test Parameter granularity so a single Lab Request can carry a full diagnostic panel (e.g. a CBC with a dozen individual parameters) rather than one result per request. See the capstone's DocType Design and Workflow sections for the underlying mechanics this module reuses rather than re-derives.

Concretely: Sample Type (blood, urine, swab, CSF, …) and Test Parameter (e.g. hemoglobin, WBC count, platelet count within one CBC Test) are the two additions that make the pattern hospital-grade β€” a single physical Sample can carry multiple Tests, and a single Test can carry multiple Test Parameters, each with its own reference range and Result row.

πŸ”— Custom Module ↔ ERPNext Core

Both custom modules exist to model things ERPNext doesn't know about natively β€” but every one of their key records ultimately drives a base ERPNext DocType, exactly the three-level integration pattern (UI, Data, Business Logic) from Part 1's custom module case study:

Custom Hospital Module

↓links into

Patient

Appointment

Admission

Lab Request

Lab Result

↓drives

Customer

Item

Employee

↓

Billing

Stock

HR

↓

Accounting

Custom DocTypeBase DocTypeRelationshipWhyWhen
PatientCustomerLinkBillingAt registration
MedicineItemLinkInventoryPharmacy setup
Hospital EmployeeEmployeeLinkHRStaff onboarding
Lab ServiceItemLinkBillingService setup

πŸ’Š Pharmacy

Doctor
β†’
Prescription
β†’
Pharmacy
β†’
Medicine
β†’
Stock
β†’
Delivery / Issue
β†’
Invoice
β†’
Payment

Once a Prescription reaches the Pharmacy counter, nothing about dispensing a medicine is hospital-specific anymore β€” it's a standard ERPNext Stock + Selling problem: every Medicine is an Item (typically inside an Item Group like "Pharmaceuticals"), tracked by Batch and expiry, held in a pharmacy Warehouse, and moved by whatever document issues it β€” each such movement writing a Stock Ledger Entry. Where Serial or Batch tracking, pricing, and Sales Invoice generation actually happen mechanically is covered in depth already, rather than re-derived here β€” see Part 3's Stock module walkthrough and Part 5's Stock Ledger Entry generation section.

The only hospital-specific piece is the front end of that chain: a Prescription (custom DocType) needs to resolve its medicine lines into ordinary Items before the pharmacy's stock/billing documents can pick them up β€” the same Link-field integration pattern used throughout this module.

πŸ”¬ Laboratory Workflow

Doctor
β†’
Lab Request
β†’
Sample Collection
β†’
Sample Accession
β†’
Test Assignment
β†’
Result Entry
β†’
Technician Verification
β†’
Doctor/Pathologist Approval
β†’
Report

Who can act at which step is a permissions question, not a workflow-state question alone β€” both matter together, the same layered idea from Part 1's permission flow:

RoleTypical permission on Lab Request/Result
ReceptionistCreate request
Lab TechnicianEdit sample/result, no approval
PathologistApprove/verify
Lab ManagerOversight/reassign
AccountantView only, for billing
AdministratorFull

🧾 Hospital Billing

A single hospital visit routinely bills across several departments at once β€” this is exactly the "many sources converge on one settlement layer" pattern from Part 1's module interconnection diagram, applied to billing specifically:

Consultation

Lab

Radiology

Bed

Medicine

Procedure

↓converge into

Patient Invoice

↓

Payment

The mechanism that makes this possible without a custom billing engine: every billable custom-module concept β€” a Lab Service, a bed-day, a procedure β€” is mapped to an ordinary ERPNext Item, so it can appear as one line on a standard Sales Invoice alongside consultation fees and dispensed medicine. The hospital never needs its own invoice format; it needs its custom records to resolve to Items before the Sales Invoice is raised.

Why the Invoice and the Payment stay two separate records even here β€” a multi-service hospital bill is exactly the case where partial payments, insurance reimbursement delays, and installment settlement make that separation matter most β€” is the underlying accounting theory covered in full in Invoice vs Payment: The Core Concept and its Allocation model.

πŸ‡§πŸ‡© Bangladesh VAT/Tax for Hospital Services

Service/Item
β†’
Tax Category
β†’
Tax Template
β†’
Sales Invoice
β†’
Tax Lines
β†’
Accounting
⚠️ Every VAT/tax percentage below is an example/configuration placeholder β€” not a real, current Bangladesh rate. This follows the exact framing set out in Part 1's Bangladesh Context section: verify applicable current Bangladesh NBR (National Board of Revenue) rules, and the hospital's actual VAT/BIN registration status, before any of this is configured for production. Healthcare services in particular can carry exemptions, reduced rates, or category-specific treatment under NBR rules that this article does not attempt to state authoritatively.

Conceptually β€” not as guaranteed exact ERPNext behavior β€” a hospital's tax setup rests on a few pieces: a BIN (Business Identification Number) and VAT registration status recorded against the Company; a decision on VAT-inclusive vs VAT-exclusive pricing per price list; one or more Tax Categories (e.g. standard service, exempt service, corporate/insurance-billed service) that a Sales Invoice's customer or item resolves to; and Tax Templates that attach the actual percentage and the target VAT Payable–type account. Whatever the resolved rate, the tax line ultimately posts through the same GL Entry mechanism as any other accounting impact β€” see Part 5's GL Entry generation section for how that posting mechanically happens.

Service/ItemIllustrative tax treatment
ConsultationExample VAT rate = configurable placeholder (services can be exempt or reduced-rate β€” verify with NBR)
Diagnostic serviceExample VAT rate = configurable placeholder
MedicineExample VAT rate = configurable placeholder (pharmaceuticals often have distinct NBR treatment β€” verify)
Hospital bedExample VAT rate = configurable placeholder
ProcedureExample VAT rate = configurable placeholder
Corporate/insurance serviceExample VAT rate = configurable placeholder (billing entity may differ from the patient, affecting the applicable Tax Category)

πŸ” Hospital Role/Permission Matrix

RolePatientDoctorLabPharmacyBillingHRAdmin
ReceptionistCreate/EditViewCreateNoViewNoNo
DoctorView/Edit (clinical)View ownCreate/ViewViewNoNoNo
Lab TechnicianLimited (linked records only)NoEditNoNoNoNo
PharmacistLimitedNoNoEditCreate (pharmacy invoice)NoNo
AccountantViewViewViewViewFullLimitedNo
HRNoLimitedNoNoNoFullNo
AdministratorFullFullFullFullFullFullFull
This matrix is illustrative. Actual permissions in a live site are configured through the Role Permission Manager and User Permissions β€” see Part 2's Permission Manager section β€” and must be validated against the real roles created for this hospital's site before go-live.

πŸ“Š Hospital Dashboards

Management

  • Daily Revenue
  • Patient Count
  • OPD Count
  • IPD Occupancy
  • Pharmacy Sales
  • Lab Revenue
  • Outstanding
  • Expenses

Lab Manager

  • Pending Samples
  • Testing Queue
  • Pending Verification
  • Critical Results
  • Turnaround Time

Pharmacy

  • Low Stock
  • Expired Medicine
  • Daily Sales
  • Fast Moving Items

πŸ” End-to-End Hospital Workflow

Registration
↓
Appointment
↓
Doctor Consultation
↓
Prescription
↓
Lab Request
↓
Sample
↓
Lab Result
↓
Pharmacy
↓
Admission
↓
Treatment
↓
Discharge
↓
Billing
↓
Payment
↓
Accounting

Reading that chain against what actually implements each step: Payment and Accounting/GL are pure base ERPNext β€” no custom code touches them. Appointment, Consultation, Admission, and Lab Request/Result are Custom Module territory β€” they don't exist in ERPNext core and are exactly what the two custom modules in this article were built to cover. Everything else in the chain (Prescription resolving to Pharmacy stock, Billing resolving to a Sales Invoice) is the seam where the custom modules hand off into base ERPNext via ordinary Link fields.

🧯 Real-World Troubleshooting Scenarios

Scenario 1: Lab result cannot be approved

SymptomWhat to investigate
"Lab result cannot be approved"Permission, Workflow state, Role, Validation, Server error

Scenario 2: Medicine stock is incorrect

SymptomWhat to investigate
"Medicine stock is incorrect"Stock Entry, Delivery, Purchase Receipt, Stock Ledger Entry, Warehouse, Batch

Scenario 3: Patient invoice has wrong tax

SymptomWhat to investigate
"Patient invoice has wrong tax"Item, Tax Category, Tax Template, Company, Customer, Invoice

πŸ›‘οΈ Hospital Data Security

  • Least privilege β€” every role gets only the access its job requires, nothing more
  • Role separation β€” clinical, lab, pharmacy, billing, and HR access kept distinct
  • Audit trail β€” owner, modified_by, and version history preserved on every document
  • Access logging β€” who viewed or changed a patient record, and when
  • Backups β€” scheduled, offsite, and periodically tested for actual recovery
  • Encryption β€” data at rest and in transit
  • HTTPS everywhere β€” no plaintext access to any hospital data
  • Restricted database access β€” no shared or ad-hoc direct DB credentials
  • Secure API β€” scoped keys, never a System Manager key for integrations
  • File access controls on attachments (reports, scans, discharge summaries)
  • Production secrets kept out of source control and rotated on exposure

As stated throughout this series: this article uses only fictional patient and company data, and does not represent any real Bangladesh hospital's actual data, systems, or security posture.

βœ… Hospital UAT Checklist

Before go-live, walk every one of the following end to end on the actual configured site β€” not in isolation:

  • Patient registration
  • Appointment scheduling and rescheduling
  • Lab: request through report (including an abnormal/flagged result path)
  • Pharmacy: prescription through stock issue
  • Billing: a multi-service invoice covering consultation, lab, and medicine together
  • Payment: full, partial, and insurance/corporate settlement paths
  • Reports: management, lab manager, and pharmacy dashboards render with real data

πŸ—ΊοΈ What's Next

This is Part 2 of the 4-part ERPNext Bangladesh Implementation Case Study β€” a companion series to the 9-part base course, walking one fictional Bangladeshi organization's ERPNext rollout end to end.

Part 4 in particular is where the Clinical Management and Laboratory & Diagnostic modules sketched here stop being a design exercise and become an actual custom Frappe app: repository structure, CI, staging vs production sites, and a deployment pipeline β€” following the same custom-app architecture the base course establishes in Part 7.

↑