Sei sulla pagina 1di 52

Welcome

National Institute of Technology Delhi


Project Report on Hospital Management System submitted as a
part of the curriculum of Database Management Systems
(subject code: CSB 202) for the Autumn Semester 2019 in 2 nd
year of Bachelor of technology in Computer Science and
Engineering
Contents
 Introduction
 Case Study
 Entity Relationship Diagram
 Relational Schema (Populated)
 Software Information
 DDL Commands
 Basic Queries
 Advanced Queries
 Front End View
 References (or Bibliography)
Introduction
The Hospital is an integral part of the social and medical
organization, the function of which is to provide for the
population complete health care, both curative and preventive.
Management is the process of designing and maintaining an
environment in which individuals, working together in groups
efficiently accomplish selected aims.
Present day, it is very important to have a management system
for every hospital maintaining a database containing the data
of patients, doctors, medicines, departments, facilities
..etc. This project’s main aim is to demonstrate one such
management system for a hospital named XYZ Hospital.
CASE STUDY
XYZ hospital is a multi-speciality hospital that includes a number of departments, rooms, doctors, nurses,
compounders and other staff working in the hospital. Patients having different kinds of ailments come to the
hospital and get check-up done from the concerned doctors. If required they are admitted in the hospital and
discharged after treatment.The aim of this case study is to design and develop a database for the hospital to
maintain the records of various departments, rooms and doctors in hospital. It also maintains the records of the
regular patients, patients admitted in hospital, the check-up of patients done by the doctors, the patients that have
been operated, and patients discharged from the hospital.
In the hospital, there are many departments like Orthopaedic, Pathology, Emergency, Dental, Gynaecology,
Anaesthetics, I.C.U, Blood Bank, Operation Theatre, Laboratory, M.R.I, Neurology, Cardiology, Cancer Department,
Corpse etc. There is an OPD where patients come and get a card (that is entry card of the patient) for check-up
from the concerned doctor. After making entry in the card, they go to the concerned doctor’s room and the doctor
checks up their ailments. According to the ailments, the doctor either prescribes medicines or admits the patient in
the concerned department.The patient may choose either general room or private room according to his/her need.
But before getting admission in the hospital, the patient has to fulfil certain formalities of the hospital like room
charges etc. After the treatment, the doctor discharges the patient. Before discharging from the hospital, the patient
again has to complete certain formalities of hospital like balance charges, test charges, operation charges (if any),
blood charges, doctor’s charges, etc. Next we talk about the doctors of the hospital. There are two types of doctors
in the hospital, namely, regular doctors and call on doctors. Regular doctors are those doctors who come to
hospital regularly. Call on doctors are those are called by the hospital if the concerned doctor is not available.
Entity Relationship
diagram
Relational Schema (Populated)
Department Table
OPD Table
Staff Table
Doctor Table
Treats Table
Admitted Patient Table
Discharged Patient Table
Regular Patient Table
Medicine Table
Bill Table
Admitted Room Table
Department Table
OPD Table
Staff Table
Doctor Table
Treats Table
Bill Table
Admitted Rooms Table
Medicine Table
Admitted Patient Table
Discharged Patient Table
Regular Patient Table
SQL – DDL SCHEMA
DEPARTMENT TABLE OPD TABLE

create table department create table opd


( (
dept_name varchar(25) not null, fname varchar(15) not null,
dept_location varchar(15), minit char,
facilities varchar(30), lname varchar(15) not null,
primary key (dept_name) age int,
); gender char,
birth_date date,
address varchar(20),
phone varchar(15),
enroll_id char(12) not null,
primary key (enroll_id)
);
DOCTOR TABLE
create table doctor
TREATS TABLE
(
fname varchar(15) not null, create table treats
minit char, (
lname varchar(15) not null, enroll_id char(12) not null,
age int, doctor_id char(10) not null,
gender char, primary key (enroll_id,doctor_id),
birth_date date, foreign key (enroll_id) references opd(enroll_id),
address varchar(20), foreign KEY (doctor_id) REFERENCES doctor(doctor_id)
phone varchar(15), );
specializations varchar(20),
salary decimal(8,0),
dept_name varchar(25) not null,
doctor_id char(10) not null,
doctor_type varchar(15) not null,
purpose varchar(30),
primary key (doctor_id),
foreign key (dept_name) references department(dept_name)
STAFF TABLE ADMITTED ROOM TABLE
create table staff
(
fname varchar(15) not null, create table admitted_room
minit char, (
lname varchar(15) not null, room_no char(6) not null,
age int, dept_name varchar(25) not null,
gender char, room_type varchar(15) not null,
birth_date date, primary key (room_no),
address varchar(20), foreign key (dept_name) references department(dept_n
phone varchar(15), ame)
salary decimal(8,0), );
dept_name varchar(25) not null,
staff_id char(10) not null,
primary key (staff_id),
foreign key (dept_name) references department(dept_name)
);
BILL TABLE MEDICINE TABLE
create table bill create table medicine
( (
bill_no char(12) not null, dept_name varchar(25) not null,
doctor_charges decimal(8,0), medicine_name varchar(15) not null,
medicine_charges decimal(8,0), dosage varchar(8),
admit_charges decimal(8,0), medicine_type varchar(10) not null,
discharge_charges decimal(8,0), primary key (medicine_name),
lab_test_charges decimal(8,0), foreign key (dept_name) references department(dept_n
other_charges decimal(8,0), ame)
total_charges decimal(8,0) not null, );
enroll_id char(12) not null,
primary key (bill_no),
foreign key (enroll_id) references opd(enroll_id)
);
DISCHARGED PAT ADMITTED PAT
TABLE TABLE
create table discharged_patient create table admitted_patient
( (
discharge_charges decimal(8,0), enroll_id char(12) not null,
discharge_date date, doctor_id char(10) not null,
room_no char(6) not null, problem varchar(20) not null,
bill_no char(12) not null, admit_charges decimal(8,0),
enroll_id char(12) not null, admit_date date,
foreign key (bill_no) references bill, bill_no char(12) not null,
foreign key (enroll_id) references admitted_ room_no char(6) not null,
patient(enroll_id), primary key (enroll_id),
foreign KEY (room_no) REFERENCES ad foreign key (enroll_id) references opd(enroll_id),
mitted_room(room_no) foreign key (bill_no) references bill(bill_no),
); foreign KEY (doctor_id) REFERENCES doctor(d
octor_id),
FOREIGN KEY (room_no) REFERENCES admitt
ed_room(room_no)
);
REGULAR PATIENT TABLE
create table regular_patient
(
enroll_id char(12) not null,
doctor_id char(10) not null,
visit_date date,
bill_no char(12) not null,
problem varchar(20) not null,
primary key (enroll_id),
foreign key (bill_no) references bill(bill_no)
);
SQL – DML QUERIES (EASY TO HARD)
Q1) List the names of departments located in ‘Block-B’
Q2) Retrieve the name and staff id of staff having salary greater than 2,00,000
Q3) list the name of patients who are suffering from cardiac arrest
Q4) find the enrollment id of patients who are allotted in room ‘RM9876’
Q5) retrieve the names and doctor_id of all doctors who are called for a specific
purpose
Q6) find the enroll_id of patients whose name ends with naidu
Q7) retrieve the first names of all female regular doctors working in hospital
Q8) find the names of all doctors whose age is greater than 50 but earning less
than 2500000
Q9) retrieve the names of patients who are admitted in private room
Q10) retrieve the names of medicines which are prescribed by cardiology
department
Q11) find the enroll_id of patient who has been admitted in hospital but
visited for regular check up earlier
Q12) find the enroll_id of patients who has been admitted in hospital
but not visited the hospital previously
Q13) find the names of the patients whose doctor_charges are greater than
medicine_charges
Q14) find the name of regular doctor who has second largest salary
Q15) retrieve the names of top 3 staff who are highly paid
Q16) find the names of doctors whose salary is greater than average salary
of all the doctors
Q17) find the number of doctors that are working in neurology
department
Q18) retrieve all the names of female staff and doctors who are under
the age of 30
Q19) retrieve the names of admitted patients whose age is greater
than 40
SOFTWARE INFORMATION

 Microsoft SQL Server 2014 – For DDL Schema and For DML Queries
 Microsoft Visual Studio Code for Frontend Web Page
 Languages used for Frontend Web Page: HTML and CSS
Web Frontend View
 Database System Concepts, 6th Edition, Abraham
Silberschatz, Henry.F.Korth, S.Sudarshan
 Database Systems, Ramez Elmasri, Shamkant.B.Navathe
 YouTube channels:
Bibliography  Education4U
 Edureka
 Intellipaat
Thank You

Potrebbero piacerti anche