Apply Now Apply Now Apply Now
header_logo
Post thumbnail
DATABASE

How to Design ER Diagram for a Hospital Management System : Complete Beginner’s Guide

By Jebasta

If you are learning database design, one of the most practical projects you will work on is an ER diagram for a hospital management system. It covers almost every concept you need to know: entities, attributes, relationships, primary keys, foreign keys, and cardinality. It also mirrors how real hospital software is built, which makes it valuable for both exams and actual development.

This guide walks you through everything from scratch. What an ER diagram is, what symbols are used, which entities to include, what attributes each entity has, how they all connect, and how to read the relationships correctly.

Quick Answer

An ER diagram for a hospital management system is a visual blueprint of the hospital database. It maps out entities like Patient, Doctor, Appointment, Room, Department, Bill, and Medical Record, shows the attributes each one holds, and defines how they relate to each other using cardinality rules like one-to-many and many-to-many.

Table of contents


  1. What Is an ER Diagram
  2. ER Diagram Symbols You Must Know
  3. What Is a Hospital Management System
  4. Step-by-Step: How to Design an ER Diagram for a Hospital Management System
  5. Core Entities in an ER Diagram for a Hospital Management System
    • Patient
    • Doctor
    • Department
    • Appointment
    • Room
    • Medical Record
    • Bill
    • Nurse
    • Lab Report
  6. Relationships in an ER Diagram for a Hospital Management System
  7. Cardinality Explained Simply
  8. Primary Key vs Foreign Key
  9. Tools to Draw an ER Diagram for a Hospital Management System
  10. Tips for Beginners Designing an ER Diagram for a Hospital Management System
    • 💡 Did You Know?
  11. Conclusion
  12. FAQs
    • What is an ER diagram for a hospital management system?
    • What are the main entities in an ER diagram for a hospital management system?
    • What is cardinality in an ER diagram for a hospital management system?
    • How is a many-to-many relationship handled in an ER diagram for a hospital management system?
    • Which free tools can I use to draw an ER diagram for a hospital management system?

What Is an ER Diagram

An ER diagram stands for Entity-Relationship diagram. It is a visual tool used to design and plan the structure of a database before you start writing any code or creating tables.

What an ER diagram shows:

  • Entities: The main objects or things in the system (like Patient, Doctor, Room)
  • Attributes: The details or properties that describe each entity (like name, age, ID)
  • Relationships: How two entities are connected or interact with each other
  • Cardinality: How many of one entity relates to how many of another

Why ER diagrams are important:

  • They help you plan the database before building it
  • They prevent missing important data fields
  • They make it easy for developers, designers, and managers to understand the system together
  • They directly translate into database tables when the project moves to implementation

Learn database design, SQL, normalization, ER modeling, relational database concepts, queries, joins, constraints, indexing, and real-world data management skills with HCL GUVI’s Database Course. This beginner-friendly program helps you understand how systems like hospital management software store and organize data efficiently, making it perfect for aspiring developers, backend engineers, and database professionals preparing for projects and technical interviews. 

ER Diagram Symbols You Must Know

Before designing an ER diagram for a hospital management system, you need to understand the standard symbols used.

SymbolShapeRepresents
EntityRectangleA real-world object like Patient or Doctor
AttributeOval or EllipseA property of an entity like Name or Age
Primary Key AttributeUnderlined ovalThe unique identifier of an entity
RelationshipDiamondThe connection between two entities
Multivalued AttributeDouble ovalAn attribute with multiple values like Phone Numbers
Derived AttributeDashed ovalA value calculated from another attribute like Age from DOB
Weak EntityDouble rectangleAn entity that cannot exist without another entity
LineSingle lineConnects entity to relationship or attribute
Double lineDouble lineTotal participation, every instance must participate

What Is a Hospital Management System

A hospital management system (HMS) is software that manages all hospital operations digitally. It replaces paper records and manual tracking with organized, connected digital data.

Core modules in a hospital management system:

  • Patient Management: Registering patients, storing demographics and medical history
  • Doctor Management: Tracking doctor details, specializations, and schedules
  • Appointment Management: Booking, rescheduling, and tracking consultations
  • Room and Ward Management: Allocating and tracking room availability
  • Department Management: Organizing hospital departments and assigned staff
  • Billing and Payments: Generating bills and recording payment history
  • Medical Records: Storing diagnoses, prescriptions, lab reports, and treatment history
  • Pharmacy and Medication: Managing medicines prescribed and dispensed

An ER diagram for a hospital management system captures all of these modules through connected entities.

MDN

Step-by-Step: How to Design an ER Diagram for a Hospital Management System

Step-by-Step: How to Design an ER Diagram for a Hospital Management System

Follow these steps every time you design an ER diagram for a hospital management system. This is the standard approach used in both exams and real projects.

Step 1: Identify all entities List every major object that the system needs to track.

Step 2: Identify attributes for each entity For each entity, list all the data fields it needs. Mark the primary key.

Step 3: Identify relationships between entities Determine how each entity connects to others using action verbs like consults, belongs to, pays, and assigns.

Step 4: Determine cardinality For each relationship, decide if it is one-to-one, one-to-many, or many-to-many.

Step 5: Draw the diagram Place entities as rectangles, connect them with diamond-shaped relationship labels, and attach oval-shaped attributes.

Step 6: Review for completeness Check that every entity has a primary key, every relationship has a cardinality, and no important data field is missing.

Core Entities in an ER Diagram for a Hospital Management System

1. Patient

The Patient entity is the most central entity in any ER diagram for a hospital management system. Every other entity connects back to the patient in some way.

Attributes:

AttributeTypeNotes
Patient_IDPrimary KeyUnique identifier for each patient
NameStringFull name of the patient
Date_of_BirthDateUsed to derive age
AgeDerived AttributeCalculated from Date_of_Birth
GenderStringMale, Female, Other
Blood_GroupStringA+, B+, O+ etc.
AddressStringResidential address
Phone_NumberMultivaluedPatient may have multiple contacts
Medical_HistoryStringPrevious conditions and surgeries

2. Doctor

The Doctor entity stores all information about medical practitioners in the hospital.

Attributes:

AttributeTypeNotes
Doctor_IDPrimary KeyUnique identifier for each doctor
NameStringFull name
SpecializationStringCardiology, Neurology, Pediatrics etc.
QualificationStringMBBS, MD, MS etc.
Phone_NumberMultivaluedDoctor may have multiple contacts
AvailabilityStringDays and time slots available
Department_IDForeign KeyLinks doctor to their department

3. Department

The Department entity organizes the hospital into functional units.

Attributes:

AttributeTypeNotes
Department_IDPrimary KeyUnique identifier for each department
Department_NameStringCardiology, Radiology, Orthopedics etc.
LocationStringFloor or block in the hospital
Head_Doctor_IDForeign KeyThe doctor who leads the department

4. Appointment

The Appointment entity is a relationship-turned-entity (also called an associative entity) because it holds data about the interaction between a Patient and a Doctor.

Attributes:

AttributeTypeNotes
Appointment_IDPrimary KeyUnique identifier for each appointment
DateDateDate of the appointment
TimeTimeTime slot booked
StatusStringScheduled, Completed, Cancelled
Patient_IDForeign KeyLinks to Patient
Doctor_IDForeign KeyLinks to Doctor
ReasonStringBrief reason for the visit

5. Room

The Room entity manages the physical spaces patients are admitted to.

Attributes:

AttributeTypeNotes
Room_NoPrimary KeyUnique room identifier
Room_TypeStringGeneral, ICU, Private, Semi-Private
StatusStringAvailable, Occupied
CapacityIntegerNumber of beds in the room
Daily_ChargeIntegerPer day cost of the room

6. Medical Record

The Medical Record entity stores the clinical history of each patient visit.

Attributes:

AttributeTypeNotes
Record_IDPrimary KeyUnique identifier for the record
DiagnosisStringDoctor’s diagnosis
PrescriptionStringMedicines prescribed
Test_ResultsStringLab or imaging results
DateDateDate of the record entry
Patient_IDForeign KeyLinks to Patient
Doctor_IDForeign KeyThe doctor who created the record

7. Bill

The Bill entity tracks all financial transactions in the hospital.

Attributes:

AttributeTypeNotes
Bill_IDPrimary KeyUnique bill number
Patient_IDForeign KeyLinks to Patient
Total_AmountIntegerTotal charges
Doctor_ChargeIntegerConsultation fee
Room_ChargeIntegerRoom rental charges
Medicine_ChargeIntegerPharmacy charges
Lab_ChargeIntegerDiagnostic test charges
Payment_StatusStringPaid, Pending, Partially Paid
DateDateDate of bill generation

8. Nurse

The Nurse entity tracks nursing staff assigned to patients and wards.

Attributes:

AttributeTypeNotes
Nurse_IDPrimary KeyUnique identifier
NameStringFull name
Phone_NumberStringContact number
ShiftStringMorning, Evening, Night
Room_NoForeign KeyThe room the nurse manages

9. Lab Report

The Lab Report entity stores all diagnostic test information.

Attributes:

AttributeTypeNotes
Lab_IDPrimary KeyUnique test identifier
Patient_IDForeign KeyLinks to Patient
Doctor_IDForeign KeyDoctor who ordered the test
Test_NameStringBlood test, MRI, X-Ray etc.
ResultStringTest findings
DateDateDate the test was conducted

Relationships in an ER Diagram for a Hospital Management System

RelationshipEntities InvolvedCardinalityMeaning
ConsultsPatient, DoctorMany-to-ManyA patient can consult many doctors. A doctor can treat many patients.
BooksPatient, AppointmentOne-to-ManyOne patient can have many appointments.
HasDoctor, AppointmentOne-to-ManyOne doctor can have many appointments.
Belongs ToDoctor, DepartmentMany-to-OneMany doctors belong to one department.
Assigned ToPatient, RoomMany-to-OneMany patients can be assigned to a room over time.
ManagesNurse, RoomOne-to-ManyOne nurse can manage multiple rooms.
PaysPatient, BillOne-to-ManyOne patient can have many bills.
Has RecordPatient, Medical RecordOne-to-ManyOne patient can have many medical records.
OrdersDoctor, Lab ReportOne-to-ManyOne doctor can order many lab reports.
UndergoesPatient, Lab ReportOne-to-ManyOne patient can undergo many lab tests.

Cardinality Explained Simply

Cardinality tells you how many instances of one entity can relate to instances of another entity.

Cardinality TypeWhat It MeansHospital Example
One-to-One (1:1)One record in Entity A matches exactly one record in Entity BOne patient has one unique Patient_ID
One-to-Many (1:N)One record in Entity A matches many records in Entity BOne doctor has many appointments
Many-to-Many (M:N)Many records in Entity A match many records in Entity BMany patients consult many doctors

How many-to-many relationships are handled:

A many-to-many relationship cannot be directly stored in a database. It is broken down using an intermediate entity called an associative entity or junction table. For example, the many-to-many relationship between Patient and Doctor is handled through the Appointment entity which holds Patient_ID and Doctor_ID as foreign keys.

Primary Key vs Foreign Key

These two concepts are essential for understanding any ER diagram for a hospital management system.

TermDefinitionExample
Primary KeyA unique identifier for each record in an entity. No two records can have the same value.Patient_ID in the Patient table
Foreign KeyA field in one entity that points to the primary key of another entity. It creates the link between two entities.Patient_ID inside the Appointment table pointing to the Patient table

Tools to Draw an ER Diagram for a Hospital Management System

You do not need to draw by hand. Several free tools make it easy:

ToolTypeBest For
draw.io (diagrams.net)Free, browser-basedQuick, clean ER diagrams
LucidchartFree tier availableCollaborative team design
dbdiagram.ioFree, code-basedDevelopers who prefer typing
MySQL WorkbenchFree, desktopDirect database design and export
ERDPlusFree, browser-basedStudents and academic projects

Tips for Beginners Designing an ER Diagram for a Hospital Management System

  • Start with entities before attributes. List all the main objects first. Do not get lost in attribute details before you have the full entity list.
  • Every entity must have a primary key. No exceptions. The primary key uniquely identifies each record and is the backbone of all relationships.
  • Break every many-to-many into an associative entity. If you find a many-to-many relationship, always create an intermediate entity to handle it properly.
  • Use foreign keys to create links. Every relationship between two entities is implemented in the database using a foreign key in one of the tables.
  • Do not add attributes that can be derived. Age can be calculated from Date_of_Birth. Store Date_of_Birth and mark Age as a derived attribute rather than storing both.
  • Name relationships with action verbs. Consults, pays, assigns, belongs to. Verb-based names make the diagram easy to read and understand.
  • Review from a real hospital perspective. Ask yourself: if a patient comes in today, what data does the hospital need to capture? That thinking helps you avoid missing entities.

💡 Did You Know?

  • The concept of ER diagrams was introduced by Peter Chen in 1976 in his landmark research paper and has been the standard method for database design ever since.
  • In a real hospital management system, the ER diagram for a hospital management system can have over 50 entities once modules like pharmacy, HR, insurance, and emergency care are included.

Conclusion

An ER diagram for a hospital management system is one of the best learning projects in database design because it touches every core concept: entities, attributes, primary keys, foreign keys, one-to-many relationships, many-to-many relationships, and associative entities. Once you can design this diagram cleanly, you are ready to tackle any real-world database project.

Start by drawing just four entities: Patient, Doctor, Appointment, and Bill. Connect them with the relationships from this guide. Then add Department, Room, Medical Record, and Lab Report one at a time. Each addition teaches you something new. By the time all nine entities are on your diagram, you will have practiced every concept that database design exams and interviews test.

FAQs

1. What is an ER diagram for a hospital management system?

An ER diagram for a hospital management system is a visual representation of the hospital database. It shows all the main entities like Patient, Doctor, and Appointment, the attributes each entity holds, and how they connect to each other through defined relationships and cardinality rules.

2. What are the main entities in an ER diagram for a hospital management system?

The main entities are Patient, Doctor, Department, Appointment, Room, Medical Record, Bill, Nurse, and Lab Report. Each entity represents a key module in the hospital’s operations and connects to other entities through relationships like consults, pays, belongs to, and assigns.

3. What is cardinality in an ER diagram for a hospital management system?

Cardinality defines how many instances of one entity relate to instances of another. In the ER diagram for a hospital management system, one patient can have many appointments (one-to-many), many patients can consult many doctors (many-to-many), and one bill belongs to one patient (one-to-one in some designs).

4. How is a many-to-many relationship handled in an ER diagram for a hospital management system?

A many-to-many relationship cannot be stored directly in a database. It is resolved using an associative entity or junction table. For example, the many-to-many relationship between Patient and Doctor is converted into two one-to-many relationships using the Appointment entity, which holds Patient_ID and Doctor_ID as foreign keys.

MDN

5. Which free tools can I use to draw an ER diagram for a hospital management system?

The most popular free tools are draw.io (also called diagrams.net), Lucidchart (free tier), dbdiagram.io, MySQL Workbench, and ERDPlus. For beginners, draw.io is the easiest to start with because it is browser-based, requires no installation, and has built-in ER diagram shapes.

Success Stories

Did you enjoy this article?

Schedule 1:1 free counselling

Similar Articles

Loading...
Get in Touch
Chat on Whatsapp
Request Callback
Share logo Copy link
Table of contents Table of contents
Table of contents Articles
Close button

  1. What Is an ER Diagram
  2. ER Diagram Symbols You Must Know
  3. What Is a Hospital Management System
  4. Step-by-Step: How to Design an ER Diagram for a Hospital Management System
  5. Core Entities in an ER Diagram for a Hospital Management System
    • Patient
    • Doctor
    • Department
    • Appointment
    • Room
    • Medical Record
    • Bill
    • Nurse
    • Lab Report
  6. Relationships in an ER Diagram for a Hospital Management System
  7. Cardinality Explained Simply
  8. Primary Key vs Foreign Key
  9. Tools to Draw an ER Diagram for a Hospital Management System
  10. Tips for Beginners Designing an ER Diagram for a Hospital Management System
    • 💡 Did You Know?
  11. Conclusion
  12. FAQs
    • What is an ER diagram for a hospital management system?
    • What are the main entities in an ER diagram for a hospital management system?
    • What is cardinality in an ER diagram for a hospital management system?
    • How is a many-to-many relationship handled in an ER diagram for a hospital management system?
    • Which free tools can I use to draw an ER diagram for a hospital management system?