Case Study: Hospital Management System (HMS)
1. Abstract
The Hospital Management System (HMS) is a comprehensive
database system designed to automate the management of a
hospital's patient information, staff scheduling, medical records,
and billing. The primary goal is to streamline operations, enhance
data integrity, and improve the efficiency of hospital staff in
accessing patient data. This system incorporates several modules
such as patient records, doctor schedules, billing, pharmacy, and
more.
2. Introduction
The purpose of the Hospital Management System is to manage
hospital operations more effectively. With increasing numbers of
patients and healthcare needs, hospitals face challenges in managing
records, which can lead to errors. HMS ensures that all patient
records are stored, updated, and accessed with ease, reducing
redundancy and improving accuracy.
3. Project Description
This project involves designing a database that will handle the
hospital’s data, including patient information, doctor schedules,
prescriptions, and billing information. It aims to integrate all
aspects of hospital operations into one centralized system. The
project is developed using SQL and PL/SQL.
4. List of Entities and Attributes
Patient: Patient_ID, Name, Age, Gender, Address, Contact,
Admission_Date, Discharge_Date
Doctor: Doctor_ID, Name, Specialization, Contact, Schedule
Nurse: Nurse_ID, Name, Department, Shift
Appointment: Appointment_ID, Patient_ID, Doctor_ID, Date, Time,
Reason
Billing: Bill_ID, Patient_ID, Total_Amount, Paid_Amount,
Due_Date
Pharmacy: Medicine_ID, Name, Stock, Price
5. ER Diagram
(An ER diagram can be created to show relationships between
entities like Patients, Doctors, Appointments, etc.)
6. Schema Diagram
(A schema diagram defines how the tables are structured, including
primary and foreign keys, constraints, etc.)
7. Creating Commands
a. Create Table:
Example: Creating the Patient table
sql
CREATE TABLE Patient (
Patient_ID INT PRIMARY KEY,
Name VARCHAR(100),
Age INT,
Gender VARCHAR(10),
Address VARCHAR(255),
Contact VARCHAR(15),
Admission_Date DATE,
Discharge_Date DATE
);
b. Insert Into:
Example: Inserting a new patient record
sql
INSERT INTO Patient (Patient_ID, Name, Age, Gender, Address,
Contact, Admission_Date)
VALUES (101, 'John Doe', 45, 'Male', '123 Street Name',
'9876543210', '2023-10-23');
c. Aggregate Functions:
Example: Counting the total number of patients admitted in the last
month
sql
SELECT COUNT(*) FROM Patient WHERE Admission_Date >=
'2023-09-01';
d. Cursor:
Example: Using a cursor to retrieve patient details for billing
purposes.
sql
DECLARE
CURSOR patient_cursor IS
SELECT Name, Total_Amount FROM Patient JOIN Billing ON
Patient.Patient_ID = Billing.Patient_ID;
BEGIN
FOR record IN patient_cursor LOOP
DBMS_OUTPUT.PUT_LINE('Patient: ' || record.Name || ' |
Total Bill: ' || record.Total_Amount);
END LOOP;
END;
e. View:
Example: Creating a view to show doctor schedules
sql
Copy codeCREATE VIEW Doctor_Schedule AS
SELECT Doctor_ID, Name, Specialization, Schedule FROM
Doctor;
f. Trigger:
Example: Trigger to update the billing status when payment is made
sql
CREATE OR REPLACE TRIGGER update_billing_status
AFTER UPDATE ON Billing
FOR EACH ROW
BEGIN
IF :NEW.Paid_Amount = :NEW.Total_Amount THEN
UPDATE Billing SET Status = 'Paid' WHERE Bill_ID
= :NEW.Bill_ID;
END IF;
END;
g. Package:
Example: A package to handle patient discharge and billing
operations
sql
CREATE OR REPLACE PACKAGE Discharge_Pkg AS
PROCEDURE discharge_patient(p_patient_id INT);
PROCEDURE generate_bill(p_patient_id INT);
END Discharge_Pkg;
8. Conclusion
The Hospital Management System simplifies hospital management
by integrating essential operations into a single database. With
features such as automated scheduling, efficient billing, and secure
patient records, HMS improves the hospital’s workflow. The system
is scalable and can be enhanced with more features like online
appointments, medical history tracking, and insurance handling.