🏥

ER Diagram for Hospital Management

Aug 5, 2024

ER Diagram for Hospital Management System

Introduction

  • Learning to draw the ER diagram for a hospital management system.

Step 1: Choose Entities

  • Entity Definition: An object with physical or conceptual existence.
  • Entities Identified:
    • Doctor: Physically existing entity.
    • Patient: Physically existing entity.
    • Medicine: Conceptually existing entity.
  • Rectangular Boxes: Entities are represented inside rectangular boxes.
    • Draw three rectangular boxes:
      1. Doctor
      2. Patient
      3. Medicine

Step 2: Write Attributes Associated with Entities

  • Attribute Definition: Characteristics of an entity.
  • Attributes Representation: Attributes are written inside ovals.

Attributes for Doctor

  • Name: Composite attribute (can be divided into first name, middle name, last name).
  • Doctor ID: Primary key (uniquely identifies a doctor; underlined).
  • Address: Basic attribute.
  • Phone Number: Multi-valued attribute (can have multiple phone numbers; represented in double oval).

Attributes for Patient

  • Name: Composite attribute (can be divided into first name, middle name, last name).
  • Patient ID: Primary key (uniquely identifies a patient; underlined).
  • Address: Basic attribute.
  • Phone Number: Multi-valued attribute (can have multiple phone numbers; represented in double oval).

Attributes for Medicine

  • Quantity: Amount of medicine available.
  • Price: Cost of the medicine.

Step 3: Join Entities Using Relationships

  • Relationship Definition: Represents interaction between entities, drawn as diamond shapes.
  • Relationships Identified:
    • Doctor - Patient: Relationship is labeled as "treats" (Doctor treats Patient).
    • Patient - Medicine: Implies that after treatment, the Patient buys Medicine and pays the bill.

Conclusion

  • Diagram Summary:

    • Entities: Doctor, Patient, Medicine.
    • Attributes: Various attributes defined for each entity.
    • Relationships: Connections between entities represented by diamonds.
  • This concludes the ER diagram for the hospital management system.

Call to Action

  • If you liked this video, please like, subscribe, and share with friends.