Designing an ER Diagram for a Hospital Management System (Patients, Doctors, Departments, Appointments)

Designing an ER Diagram for a Hospital Management System (Patients, Doctors, Departments, Appointments)

Verified Sources
Sep 12, 2026

Designing an ER diagram for a Hospital Management System starts by identifying the core Entity types, then specifying each Attribute and the Relationship between them with correct Cardinality and (optionally) Participation.

Below is a complete ER design using four main entities—Patients, Doctors, Departments, and Appointments—then explicitly defining their attributes and cardinalities, including the critical Appointment relationships that tie together Patients and Doctors.

Key modeling decisions:

  • Use APPOINTMENT as a relationship-associative entity that captures the scheduling event between a PATIENT and a DOCTOR.
  • Model DEPARTMENT–DOCTOR as a typical “one department has many doctors” association.
  • Optionally (but commonly), derive Department for an Appointment from the doctor’s department, or store it explicitly to preserve history and support reporting.

Pro Tip: If you need accurate historical reporting (e.g., which department handled the appointment at the time), model department_id on APPOINTMENT explicitly, even if it can be inferred from the doctor later.

ER Diagram Design Roadmap

Start with real-world objects

1. Identify Entities

Patient, Doctor, Department, Appointment"

Choose identifiers and descriptive fields

2. Add Attributes

Primary keys, dates, contact details, times, status"

Connect entities with meaning

3. Define Relationships

Appointment links Patient & Doctor; Department links to Doctor (and optionally Appointment)"

Ensure constraints match business rules

4. Set Cardinalities

1-to-many and many-to-one with appointment scheduling"

Mark total vs partial participation

5. (Optional) Participation Constraints

E.g., every Appointment must have a Patient and a Doctor"

Entities, Attributes, and Keys (Hospital Core)

1) PATIENT

Suggested attributes

  • patient_id (PK)
  • full_name
  • date_of_birth
  • gender
  • phone
  • email
  • address

Notes

  • Keep patient_id as the stable unique identifier.
  • Demographic attributes are typically immutable-ish, but you may allow updates later.

2) DEPARTMENT

Suggested attributes

  • department_id (PK)
  • department_name
  • location
  • phone

3) DOCTOR

Suggested attributes

  • doctor_id (PK)
  • full_name
  • specialty (e.g., Cardiology, Dermatology)
  • license_number
  • phone
  • email

4) APPOINTMENT

Suggested attributes

  • appointment_id (PK)
  • start_time
  • end_time (optional but useful)
  • appointment_type (e.g., New Visit, Follow-up)
  • status (e.g., Scheduled, Completed, Canceled)
  • reason (optional)
  • notes (optional)
  • (recommended) patient_id, doctor_id, and optionally department_id as foreign-key-like link attributes in the relational mapping stage

Relationships and Cardinalities (the critical design part)

Relationship A: Patient ↔ Appointment

Meaning: A patient can have many appointments; each appointment belongs to exactly one patient.

  • [PATIENT] (1) —— (many) [APPOINTMENT]
  • Cardinality:
    • PATIENT to APPOINTMENT: one-to-many
    • APPOINTMENT to PATIENT: many-to-one
  • Participation:
    • Total on the Appointment side (every appointment must have a patient)

Formally:

  • Each Appointment has exactly 1 patient.
  • Each Patient can have 0..N appointments.

Relationship B: Doctor ↔ Appointment

Meaning: A doctor can attend many appointments; each appointment is attended by exactly one doctor.

  • [DOCTOR] (1) —— (many) [APPOINTMENT]

Cardinality:

  • DOCTOR to APPOINTMENT: one-to-many
  • APPOINTMENT to DOCTOR: many-to-one Participation:
  • Total on Appointment side (every appointment must have a doctor)

Relationship C: Department ↔ Doctor

Meaning: A department employs many doctors; each doctor belongs to exactly one department (common assumption).

  • [DEPARTMENT] (1) —— (many) [DOCTOR]

Cardinality:

  • DEPARTMENT to DOCTOR: one-to-many
  • DOCTOR to DEPARTMENT: many-to-one

Warning: Some hospitals allow a doctor to work across multiple departments (e.g., joint appointments). If that’s required, this relationship becomes many-to-many and the model must change (e.g., a Doctor_Department associative entity). The design here assumes one primary department per doctor.

Relationship D (Option/Recommendation): Department ↔ Appointment

There are two approaches:

  1. Infer Department from Doctor

    • No direct DEPARTMENT–APPOINTMENT relationship.
    • Reporting depends on joining through DOCTOR.
  2. Store Department on Appointment (recommended for history)

    • DEPARTMENT (1) —— (many) APPOINTMENT
    • Appointment records remain accurate even if a doctor later changes departments.

In the ER diagram above, we modeled Department ↔ Appointment as one-to-many.

Step-by-Step: Produce the Hospital ER Diagram with Cardinalities

  1. 1
    Step 1

    Create four entities: PATIENT, DOCTOR, DEPARTMENT, APPOINTMENT.

  2. 2
    Step 2

    Set patient_id, doctor_id, department_id, appointment_id as PKs.

  3. 3
    Step 3

    Assign descriptive fields (names, dates, contact info) to each entity.

  4. 4
    Step 4

    Model APPOINTMENT as an entity/event connected to PATIENT and DOCTOR.

  5. 5
    Step 5

    PATIENT (1) to APPOINTMENT (many); each appointment must reference exactly one patient.

  6. 6
    Step 6

    DOCTOR (1) to APPOINTMENT (many); each appointment must reference exactly one doctor.

  7. 7
    Step 7

    DEPARTMENT (1) to DOCTOR (many); each doctor belongs to exactly one department (assumption).

  8. 8
    Step 8

    Either infer via DOCTOR or store department_id in APPOINTMENT for historical correctness.

  9. 9
    Step 9

    Ensure constraints match reality (e.g., no appointment without a patient/doctor).

Cardinality Summary for Key ER Relationships

How many instances on each side of the relationship

Cardinality Table (Concrete Constraints)

RelationshipCardinality (ER)Business Constraint
PATIENT — APPOINTMENT1 to manyA patient may have 0..N0..N appointments; each appointment has 11 patient
DOCTOR — APPOINTMENT1 to manyA doctor may have 0..N0..N appointments; each appointment has 11 doctor
DEPARTMENT — DOCTOR1 to manyA department has 0..N0..N doctors; each doctor has 11 department
DEPARTMENT — APPOINTMENT (optional)1 to manyA department covers 0..N0..N appointments; each appointment has 11 department

Modeling Edge Cases & Assumptions

Pro Tip: Use Appointment as the scheduling “event” entity

Even if you think of Appointment as a relationship, modeling it as an entity with its own attributes (time, status, reason) makes the ER design clearer and supports constraints.

Warning: Many-to-many requires an associative entity

If doctors can belong to multiple departments (and vice versa), DEPARTMENT–DOCTOR becomes many-to-many and you should introduce something like DoctorDepartment (with its own attributes if needed).

ER Diagram Tutorial (Chen Notation & Practice)

Knowledge Check

Question 1 of 4
Q1Single choice

In the ER design, which relationship should be modeled as an entity/event to capture time and status explicitly?