CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
🌙☀️
Log inStart free
Home/Templates/Student Projects (College Reports)

🎓 Student Projects (College Reports) · Database ERD

Hospital Management System ER Diagram

The database behind a hospital management system: patients, doctors and departments, appointments, admissions to wards and beds, prescriptions, lab tests and bills.

More Student Projects (College Reports) templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • 14 tables with primary and foreign keys
  • Admissions link patients to wards and beds
  • Bills settled by one or more payments

Prompt used

ER diagram for a hospital management system: patients, doctors with departments, appointments between a patient and a doctor, admissions to wards and beds, prescriptions with medicines, lab tests and their results, and bills with payments. Show keys and relationships.

Mermaid code
erDiagram
    DEPARTMENT ||--o{ DOCTOR : "employs"
    DEPARTMENT ||--o{ WARD : "manages"
    PATIENT ||--o{ APPOINTMENT : "schedules"
    PATIENT ||--o{ ADMISSION : "undergoes"
    PATIENT ||--o{ PRESCRIPTION : "receives"
    PATIENT ||--o{ LAB_TEST : "ordered_for"
    PATIENT ||--o{ BILL : "billed_to"
    DOCTOR ||--o{ APPOINTMENT : "conducts"
    DOCTOR ||--o{ PRESCRIPTION : "authorizes"
    DOCTOR ||--o{ LAB_TEST : "requests"
    WARD ||--o{ BED : "contains"
    BED ||--o{ ADMISSION : "allocated_to"
    PRESCRIPTION ||--o{ PRESCRIPTION_ITEM : "includes"
    MEDICINE ||--o{ PRESCRIPTION_ITEM : "specified_in"
    LAB_TEST ||--o{ LAB_RESULT : "produces"
    BILL ||--o{ PAYMENT : "settled_by"
    ADMISSION ||--o{ BILL : "generates"

    DEPARTMENT {
        uuid id PK
        string name
        string code
        string location
        timestamp created_at
    }

    DOCTOR {
        uuid id PK
        uuid department_id FK
        string first_name
        string last_name
        string license_number
        timestamp created_at
    }

    PATIENT {
        uuid id PK
        string national_id
        string first_name
        string last_name
        date date_of_birth
        timestamp created_at
    }

    APPOINTMENT {
        uuid id PK
        uuid patient_id FK
        uuid doctor_id FK
        timestamp scheduled_at
        string status
        timestamp created_at
    }

    WARD {
        uuid id PK
        uuid department_id FK
        string name
        string ward_type
        timestamp created_at
    }

    BED {
        uuid id PK
        uuid ward_id FK
        string bed_number
        string status
        timestamp created_at
    }

    ADMISSION {
        uuid id PK
        uuid patient_id FK
        uuid bed_id FK
        timestamp admitted_at
        timestamp discharged_at
        timestamp created_at
    }

    MEDICINE {
        uuid id PK
        string code
        string name
        decimal unit_price
        timestamp created_at
    }

    PRESCRIPTION {
        uuid id PK
        uuid patient_id FK
        uuid doctor_id FK
        timestamp issued_at
        string status
        timestamp created_at
    }

    PRESCRIPTION_ITEM {
        uuid id PK
        uuid prescription_id FK
        uuid medicine_id FK
        string dosage
        integer quantity
        timestamp created_at
    }

    LAB_TEST {
        uuid id PK
        uuid patient_id FK
        uuid doctor_id FK
        string test_name
        string status
        timestamp created_at
    }

    LAB_RESULT {
        uuid id PK
        uuid lab_test_id FK
        string result_value
        string reference_range
        timestamp recorded_at
        timestamp created_at
    }

    BILL {
        uuid id PK
        uuid patient_id FK
        uuid admission_id FK
        decimal total_amount
        decimal tax_amount
        timestamp created_at
    }

    PAYMENT {
        uuid id PK
        uuid bill_id FK
        decimal amount
        string payment_method
        timestamp paid_at
        timestamp created_at
    }

Inside this diagram

An entity relationship diagram with 14 tables, 80 columns and 17 relationships.

Tables and their columns

  • DEPARTMENT: id (PK), name, code, location, created_at
  • DOCTOR: id (PK), department_id (FK), first_name, last_name, license_number, created_at
  • WARD: id (PK), department_id (FK), name, ward_type, created_at
  • PATIENT: id (PK), national_id, first_name, last_name, date_of_birth, created_at
  • APPOINTMENT: id (PK), patient_id (FK), doctor_id (FK), scheduled_at, status, created_at
  • ADMISSION: id (PK), patient_id (FK), bed_id (FK), admitted_at, discharged_at, created_at
  • PRESCRIPTION: id (PK), patient_id (FK), doctor_id (FK), issued_at, status, created_at
  • LAB_TEST: id (PK), patient_id (FK), doctor_id (FK), test_name, status, created_at
  • BILL: id (PK), patient_id (FK), admission_id (FK), total_amount, tax_amount, created_at
  • BED: id (PK), ward_id (FK), bed_number, status, created_at
  • PRESCRIPTION_ITEM: id (PK), prescription_id (FK), medicine_id (FK), dosage, quantity, created_at
  • MEDICINE: id (PK), code, name, unit_price, created_at
  • LAB_RESULT: id (PK), lab_test_id (FK), result_value, reference_range, recorded_at, created_at
  • PAYMENT: id (PK), bill_id (FK), amount, payment_method, paid_at, created_at

Relationships

  • DEPARTMENT employs DOCTOR: each DEPARTMENT has zero or more DOCTOR, each DOCTOR belongs to exactly one DEPARTMENT
  • DEPARTMENT manages WARD: each DEPARTMENT has zero or more WARD, each WARD belongs to exactly one DEPARTMENT
  • PATIENT schedules APPOINTMENT: each PATIENT has zero or more APPOINTMENT, each APPOINTMENT belongs to exactly one PATIENT
  • PATIENT undergoes ADMISSION: each PATIENT has zero or more ADMISSION, each ADMISSION belongs to exactly one PATIENT
  • PATIENT receives PRESCRIPTION: each PATIENT has zero or more PRESCRIPTION, each PRESCRIPTION belongs to exactly one PATIENT
  • PATIENT ordered_for LAB_TEST: each PATIENT has zero or more LAB_TEST, each LAB_TEST belongs to exactly one PATIENT
  • PATIENT billed_to BILL: each PATIENT has zero or more BILL, each BILL belongs to exactly one PATIENT
  • DOCTOR conducts APPOINTMENT: each DOCTOR has zero or more APPOINTMENT, each APPOINTMENT belongs to exactly one DOCTOR
  • DOCTOR authorizes PRESCRIPTION: each DOCTOR has zero or more PRESCRIPTION, each PRESCRIPTION belongs to exactly one DOCTOR
  • DOCTOR requests LAB_TEST: each DOCTOR has zero or more LAB_TEST, each LAB_TEST belongs to exactly one DOCTOR
  • WARD contains BED: each WARD has zero or more BED, each BED belongs to exactly one WARD
  • BED allocated_to ADMISSION: each BED has zero or more ADMISSION, each ADMISSION belongs to exactly one BED
  • PRESCRIPTION includes PRESCRIPTION_ITEM: each PRESCRIPTION has zero or more PRESCRIPTION_ITEM, each PRESCRIPTION_ITEM belongs to exactly one PRESCRIPTION
  • MEDICINE specified_in PRESCRIPTION_ITEM: each MEDICINE has zero or more PRESCRIPTION_ITEM, each PRESCRIPTION_ITEM belongs to exactly one MEDICINE
  • LAB_TEST produces LAB_RESULT: each LAB_TEST has zero or more LAB_RESULT, each LAB_RESULT belongs to exactly one LAB_TEST
  • BILL settled_by PAYMENT: each BILL has zero or more PAYMENT, each PAYMENT belongs to exactly one BILL
  • ADMISSION generates BILL: each ADMISSION has zero or more BILL, each BILL belongs to exactly one ADMISSION

Make your own diagram like this

Describe your own system in plain English and the AI ER diagram generator draws it in seconds, in the same style as this template.

Related templates

Use CaseStudent Projects (College Reports)

Library Management System Use Case Diagram

Who uses a college library system and what each of them can do: members, the librarian and the system administrator.

Database ERDStudent Projects (College Reports)

Library Management System ER Diagram

The database of a library system: books and their copies, authors, members, loans, reservations and fines, with keys and cardinality.

Data FlowStudent Projects (College Reports)

Library Management System Data Flow Diagram (Level 1)

How data moves through a library system: members and the librarian, the main processes, and the data stores they read and write.

Class UMLStudent Projects (College Reports)

Library Management System Class Diagram

The main classes of a library system with attributes, methods and UML relationships.

SequenceStudent Projects (College Reports)

Library Management System Sequence Diagram (Issue a Book)

The steps when a member borrows a book: checks, loan record and the copy status update.

Use CaseStudent Projects (College Reports)

Online Examination System Use Case Diagram

What students, examiners and the administrator do in an online examination system.