DBMS Case Study Hospital Management System

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

DBMS CASE STUDY

HOSPITAL MANAGEMENT SYSTEM

Team - 4 Members and their Contribution of work:


V. Devi 122010333041 (Complete word doc, Abstraction, intro,
Advantages ERD model,
Relational Schema, create table
statements, insert table statements ,
Sample Queries, Schema Refinement)
Sarayu 122010306022 (Abstraction, intro, Advantages and
Schema Refinement)
Sindhu 122010306047 (Abstraction, intro, Advantages and
Schema Refinement)
Taruni 122010307011 (Introduction)
Jhansi 122010312058 (Introduction)
DBMS
CASE STUDY

CASE STUDY TOPIC: Hospital Management System


ABSTRACT / SUMMARY:
In this case study we are going to discuss about Hospital Management System
in terms of Database Management System. The aim of this project is to show
how data related to these tasks can be made easier to manage using
databases.Organisations such as hospitals have to deal with a lot of patients
regularly and hence a lot of data. Hence it is very important for a hospital to
have a DBMS with a frontend that easily allows patients to book appointments
and allows doctors or administrators to manage patient data.

Here we are taking an example of a Multi-specialty hospital with various


facilities available in it. It has a number of departments, doctors, nurses,
receptionists, lab technicians and many other staff members. They also a have
renowned doctors with specialty in various fields of medicine. Patients suffering
from different kinds of ailments come to the hospital and get checkup done
from the concerned doctors. Based on the diagnosis given by the doctors, the
patients either admit in the hospital or leave after taking a few medicines.

By seeing all this we can realize that there is a vast amount of data that needs to
be stored in order to run a hospital seamlessly. For this we can use a database
for the hospital to maintain the records of various departments, rooms, and
doctors in the hospital. It will help us in maintaining records of the patients
admitted in the hospital, the check up of patients done by the doctors, the
patients that have been operated, and patients discharged from the hospital.

We started this case study with a brief description of a Hospital Management


System and have identified a few tables. You can undertake a thorough study on
this system such that you are able to design better tables for this system. We
have tried to explain the process of creating various tables, their relationships,
queries, schema refinement and triggers. However, you must use this
information to develop the required exercises for hospital management. Thus,
this case study provides a flavor of various tools that are essential to build up a
database application. Some of the basic tools which have been introduced are:
ERD plus – ER models and relational schema

Oracle live SQL – Query Generator


You must keep working on these tools to obtain expertise over a period of time.
This is the complete summary of our case study Hospital Management System.

INTRODUCTION:

Database Management System (DBMS) is a software application that is used to


create, access, maintain, and manage databases. We can install it like any other
application and use SQL for all the operations that we intend to perform on
databases. DBMS accepts the incoming data either from an application or from
a user who is manually entering it. It does not matter if it is a large or small
DBMS, with its help, we can store and retrieve data and make changes
whenever we want to. Some commands are predefined in DBMS, and these
commands can be used to manipulate the database. These commands are also
the interface between the database and end-users to establish communication.

 DBMS is an unstructured data.


 Location is not required to access data.
 Redundancy can be removed.
 Concurrent access can be done in DBMS.
 Security is more backup and restore of data can be done in DBMS.
 Data is consistent in DBMS.

 DBA designs the conceptual schema(what relations to store) and physical


schema (how to store them)
 DBA ensures that unauthorized data access is not permitted.

 DBA ensures security by granting permissions to different users to access


the only certain views and relations.

 DBA ensures crash recovery and takes necessary steps to restore the data
to a consistent state .

 DBA ensures data tuning i.e, takes the responsibility for modifying the
database, in particular conceptual and physical schema(basing on users
requirements)

OBJECTIVES:

The main purpose of the system is to:


Design and maintain a database of the patient as well as employee details
of the hospital.
It also includes the patient’s appointment, billing information, lab tests,
disease history.
A feedback table is maintained in the database to store the feedbacks of
the patients.
Reports are generated to visualize the data in a better manner.

ADVANTAGES:
Specifically, the integration of the software into the system has made
communication much more effective in the case of the health care system. As a
result, it is possible to access every data from anywhere in the world specifically
via. authorized login. This mode of communication has become relatively
cheaper.
The effective usage of technology has contributed to minimizing many of the
limitations. One of the biggest issues in the health care system is considered to
be the geographical limitation.This has been effectively managed with the
addition of the hospital management system. The integral reports can be sent
through instant messages, emails, etc.
In the case of the hospital management system, the information is available 24
hours throughout the week. This indicates that the reports can be sent anytime
on any particular day.So, there is no such possibility for the delay in getting the
treatment. Apart from that, the communication mode has become relatively
cheaper. Therefore, no report will be delayed from reaching the hands of the
authorities.
Improved productivity and cost-effectiveness is considered to be another
important advantage of the hospital management system. Currently, it has been
productive to manage the things automatically when compared to the old day
manual set up.
In recent days, many of the modifications are brought to the specific system.
One of the integral things is considered to be the change in the education
system. This has ultimately given shape to a completely new type of system.

CONCERPTUAL DATABASE SYSTEM:


The ER(Entity-Relationship) data model allows us to describe the data
involved in a real-world enterprise in terms of objects(entity) and their
relationship and is widely used to design Databases.

ER model stands for an Entity-Relationship model. It is a high-level data model.


This model is used to define the data elements and relationship for a specified
system.

It develops a conceptual design for the database. It also develops a very simple
and easy to design view of data.

In ER modelling, the database structure is portrayed as a diagram called an


entity-relationship diagram.

Entity is a thing/object about what data are to be collected and stored in the
tables.
Eg. EMPLOYEE
Attributes are characteristics of the entity/it describes about an entity.
Eg. SSN, last name, first name, Ph no, email etc.,
Relationships describe associations between the entities
i.e. 1:M, M:M, 1:1, M:1

STEPS OF ER MODEL:
1. Identify the Entities and Attributes.
 ENTITIES:
Patient
Doctor
Appointment
Medical History
 ATTRIBUTES:
Patient – email id (unique)
Name
Gender
Password
Address
Doctor – email id (unique)
Name
Gender
Password
Appointment – id (unique)
Date
Start time
End time
Status
Medical History – id (unique)
Date
Condition
Surgeries
Medication
2. Name the Entity (Relationship).
 Patients Attend Appointments
 Patients Fill History
 Doctor Views Medical History
 Doctor Diagnose Appointments
3. Identify the cardinality (1-M , M-1 , M-M , 1-1)
 Patients Attend Appointments (M – M)

P1 A1

P2 A2

P3 A3

P4 A4

M M
 Patients Fill History(1 – M)

P1 M1

P2 M2

P3 M3

M4

1 M
 Doctor Views Medical History(M – M)

D1 M1
D2 M2
D3 M3
D4 M4

M M
 Doctor Diagnose Appointments(1 – M)

D1 A1
D2 A2
D3 A3

A4

1 M
4. Draw the ER Model.

ER MODEL:
LOGICAL DATABASE SYSTEM:

Relational model can represent as a table with columns and rows. Each row is
known as a tuple. Each table of the column has a name or attribute.

Domain: It contains a set of atomic values that an attribute can take.

Attribute: It contains the name of a column in a particular table. Each attribute


Ai must have a domain, dom(Ai)

Relational instance: In the relational database system, the relational instance is


represented by a finite set of tuples. Relation instances do not have duplicate
tuples.

Relational schema: A relational schema contains the name of the relation and
name of all columns or attributes.

Relational key: In the relational key, each row has one or more attributes. It
can identify the row in the relation uniquely.

(CONVERT ER MODEL TO RELATIONAL SCHEMA)


 Create Table Statements:

Create table Patient(


email varchar(50) primary key,
password varchar(30) not null,
name varchar(50) not null,
address varchar(60) not null,
gender varchar(20) not null
);
desc Patient;

Create table MedicalHistory(


id int primary key,
day date not null,
conditions varchar(100) not null,
surgeries varchar(100) not null,
medication varchar(100) not null
);
desc MedicalHistory;

Create table Doctor(


email varchar(50) primary key,
gender varchar(20) not null,
password varchar(30) not null,
name varchar(50) not null
);
desc Doctor;
Create table Appointment(
id int primary key,
day date not null,
starttime varchar(10) not null,
endtime varchar(10) not null,
status varchar(15) not null
);
desc Appointment;
Create table PatientsAttendAppointments(
email varchar(50) not null,
id int not null,
concerns varchar(40) not null,
symptoms varchar(40) not null,
Foreign key (email) references Patient ON DELETE CASCADE,
Foreign key (id) references Appointment ON DELETE CASCADE,
Primary key (email, id)
);
desc PatientsAttendAppointments;

Create table PatientsFillHistory(


email varchar(50) not null,
id int not null,
Foreign key (email) references Patient ON DELETE CASCADE,
Foreign key (id) references MedicalHistory ON DELETE CASCADE,
Primary key (email, id)
);
desc PatientsFillHistory;

Create table Diagnose(


id int not null,
email varchar(50) not null,
diagnosis varchar(40) not null,
prescription varchar(50) not null,
Foreign key (id) references Appointment ON DELETE CASCADE,
Foreign key (email) references Doctor ON DELETE CASCADE,
Primary key (id, email)
);
desc Diagnose;
Create table DoctorViewsHistory(
id int not null,
email varchar(50) not null,
Foreign key (id) references MedicalHistory ON DELETE CASCADE,
Foreign key (email) references Doctor ON DELETE CASCADE,
Primary key (email, id)
);
desc DoctorViewsHistory;
 Sample Insert Statements:

insert into Patient values('desra@gmail.com', '123', 'Surya', 'Vizag',


'Male');
insert into Patient values('pchana@gmail.com', '45', 'Preethi', 'Hyd',
'Female');
insert into Patient values('kvasu1@gmail.com', '712', 'Karthik',
'vijayawada', 'Male');
insert into Patient values('vaishu@gmail.com', '698', 'Vaishu', 'Vizag',
'Female');
insert into Patient values('rsana@gmail.com', '33', 'Renu', 'Kurnool',
'Female');
select * from Patient;
insert into MedicalHistory values('1', '15/jan/2019', 'Pain in abdomen',
'Heart Surgery', 'Albuterol');
insert into MedicalHistory values('2', '23/oct/2020', 'Hemorrhoids', 'Colon
and Rectal Surgery', 'Oxaliplatin');
insert into MedicalHistory values('3', '17/jan/2020', 'Endometrial
Ablation', 'Gynecological Surgery', 'Relugolix');
insert into MedicalHistory values('4', '6/may/2019', 'Brain tumors', 'Neuro
Surgery', 'Corticosteriods');
insert into MedicalHistory values('5', '29/aug/2020', 'Spinal or shoulder
pain', 'Orthopedic Surgery', 'Antidepressants');
select * from MedicalHistory;
insert into Doctor values('ramesh@gmail.com', 'Male', 's1', 'Ramesh');
insert into Doctor values('svasi@gmail.com', 'Female', 'dani123',
'Seetha');
insert into Doctor values('Maneesh@gmail.com', 'Male', 'ashri9',
'Maneesh');
insert into Doctor values('vidhya@gmail.com', 'Female', 'vid71',
'Vidhya');
insert into Doctor values('Priya@gmail.com', 'Female', 'pry34', 'Priya');
select * from Doctor;
insert into Appointment values(1, '15/jan/2019', '09:00', '10:00', 'Done');
insert into Appointment values(2, '23/oct/2020', '15:00', '16:00', 'Not
Done');
insert into Appointment values(3, '17/jan/2020', '11:00', '12:00', 'Not
Done');
insert into Appointment values(4, '6/may/2019', '06:00', '08:00', 'Done');
insert into Appointment values(5, '29/aug/2020', '19:00', '20:00', 'Done');
select * from Appointment;
insert into PatientsAttendAppointments values('desra@gmail.com', 1,
'none', 'itchy throat');
insert into PatientsAttendAppointments values('pchana@gmail.com', 2,
'Fever', 'Cough');
insert into PatientsAttendAppointments values('kvasu1@gmail.com', 3,
'none', 'Headache');
insert into PatientsAttendAppointments values('vaishu@gmail.com', 4,
'none', 'Stomach pain');
insert into PatientsAttendAppointments values('rsana@gmail.com', 5,
'Indigestion', 'Acidity');
select * from PatientsAttendAppointments;
insert into PatientsFillHistory values('desra@gmail.com', 1);
insert into PatientsFillHistory values('pchana@gmail.com', 2);
insert into PatientsFillHistory values('kvasu1@gmail.com', 3);
insert into PatientsFillHistory values('vaishu@gmail.com', 4);
insert into PatientsFillHistory values('rsana@gmail.com', 5);
select * from PatientsFillHistory;
insert into Diagnose values(1, 'ramesh@gmail.com', 'Major bloating due
to allergy', 'Ibuprofen');
insert into Diagnose values(2, 'svasi@gmail.com', 'Pneumonia',
'levofloxacin');
insert into Diagnose values(3, 'Maneesh@gmail.com', 'Amputation',
'Ibuprofen');
insert into Diagnose values(4, 'vidhya@gmail.com', 'Diabetes', 'Insulin');
insert into Diagnose values(5, 'Priya@gmail.com', 'Post-op
Prostatectomy', 'sildenafil');
select * from Diagnose;
insert into DoctorViewsHistory values(1, 'ramesh@gmail.com');
insert into DoctorViewsHistory values(2, 'svasi@gmail.com');
insert into DoctorViewsHistory values(3, 'Maneesh@gmail.com');
insert into DoctorViewsHistory values(4, 'vidhya@gmail.com');
insert into DoctorViewsHistory values(5, 'Priya@gmail.com');
select * from DoctorViewsHistory;
SAMPLE QUERIES:
 Display email, name and address of Patients
Select email, name, address from Patient
 Display name of the patient who is a female
Select name from Patient where gender='Female'

 Count number of Doctors


Select count(*) from Doctor

 Find the average id of Appointments


Select avg(id) from Appointment

 Display surgeries of MedicalHistory whose medication starts with A


Select surgeries from MedicalHistory where medication like 'A%'
 Display Address of Patient who took Appointment on '17/jan/2020'
Select p.Address from Patient p, PatientsAttendAppointments x,
Appointment A where p.email=x.email and x.id=A.id and day =
'17/jan/2020'

 Display condition of MedicalHistory in ascending order


Select conditions from MedicalHistory order by conditions

 Display conditions, surgeries and medication from MedicalHistory


whose id is in between 1 and 4
Select conditions, surgeries, medication from MedicalHistory where id
between 1 and 4
 Count address and display names of patient of each name in
ascending order of their names
Select count(address), name from Patient group by name order by name

 Display the id of Medical History and Appointment


Select id from MedicalHistory
Union
Select id from Appointment
 Alter Patient table by adding age and display all the patients
Alter table Patient
Add age integer
Select * from Patient

 Alter Patient by deleting age and display all the patients


Alter table Patient
Drop column age
Select * from Patient
 Update day of Appointment whose id=2 and display all the
Appointments
Update Appointment
Set day='4/dec/2019'
Where id=2
Select * from Appointment

SCHEMA REFINEMENT:
Functional Dependencies and Normalisation
1. Patient :
R = (Email, Password, Name, Address, Gender)
FDs:
a. Email -> Password
b. Email -> Name
c. Email -> Address
d. Email -> Gender

Table is in 1NF since all attributes are atomic.


Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

2. Medical History:
R = (id, Date, Conditions, Surgeries, Medication)
FDs:
a. id -> Password
b. id -> Date
c. id -> Conditions
d. id -> Surgeries
e. id -> Medication
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.
3. Doctor:
R = (email, gender, password, name)
FDs:
a. email ->gender
b. email -> password
c. email -> name
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

4. Appointment:
R = (id, date, start time, end time, status)
FDs:
a. id -> date
b. id -> start time
c. id -> end time
d. id -> status
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

5. PatientsAttendAppointments:
R = (patient, appointment, concerns, symptoms)
FDs:
a. (patient, appointment) ->concerns
b. (patient, appointment) -> symptoms
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

6. PatientsFillHistory:
R = (Patient, History)
FDs:
a. History ->Patient
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

7. Diagnose:
R = (appointment, doctor,diagnosis, prescription)
FDs:
a. (appointment, doctor) ->diagnosis
b. (appointment, doctor) ->prescription
Table is in 1NF since all attributes are atomic.
Table is in 2NF since there is no partial dependency.
Table is in 3NF due to absence of any transitive dependency.

8. DoctorViewsHistory:
R = (history, doctor)
Since entire table is the key, it does not have partial and transitive
dependencies. It also has atomic attributes.
Hence it is in 3NF.

https://livesql.oracle.com/apex/livesql/s/n90b1cngcz99qb69
9o6ktbmo7

You might also like