You are on page 1of 24

Hospital Management System 2017-18

Chapter 1

INTRODUCTION
A database is a collection of related data, typically stored on disk, and accessible by
possibly many concurrent users. Databases are generally separated into application areas.
For example,databases may contain Human Resource data, sales data,accounting data.

A database has the following implicit properties:

1. A database represents some aspect of the real world, sometimes called the miniworld
or the Universe of Discourse. Changes in the real world will be reflected in the
database.
2. A database is a logically coherent collection of data with some inherent meaning. A
random assortment of data cannot be referred to as a database.
3. A database is designed, built, and populated with data for a specific purpose. It has an
intended group of users and some predefined applications in which these users are
interested.
Databases are managed by a Database Management System.

1.1 Database Management System


A Database Management System (DBMS) is a set of programs that enables users to
create and maintain a database.The DBMS is a general-purpose software system that
simplifies the processes of defining, constructing, manipulating, and sharing databases
among various users and applications.
Defining a database involves specifying the data types, structures and constraints
of the data to be stored in the database. The database definition or descriptive information
is also stored in the database in the form of a database catalog or dictionary; it is called
meta-data.Constructing the Database is the process of storing data on some storage
medium that is controlled by DBMS.Manipulating a Databaseincludes functions such as
querying the database to retrieve specific data, updating the database to reflect changes in
the miniworld, and generating the report from the data.Sharing a Databaseallows multiple
users and programs to access the database simultaneously.
An Application Program accesses the database by sending queries or requests for
data to the DBMS. A query typically causes some data to be retrieved.

KSSEM Dept. of CSE Page 1


Hospital Management System 2017-18

1.2 Project Description

Hospital Management System includes registration of patients, storing their details into
the system. It also includes doctor details. The software (NETBEANS and Oracle) used
has the unique facility to give a unique ID for every patient and stores the details of every
patient and staff automatically. User can search availability of a doctor and the details of
a patient using the ID.
The Hospital Management System can be logged in using the username and
password. It is accessible by the receptionist. Only they can add data into the database.
The data can be retrieved easily. The interface is very user-friendly. The data are well
protected for personal use and makes the data processing very fast.
The purpose of developing Hospital Management System is to computerize the
traditional way of keeping the record.

1.3 Introduction to SQL

Structured Query Language (SQL) is a programming language used for storing and
managing data in Relational DBMS (RDBMS). SQL was the first commercial language
introduced for E.F Codd's Relational model. Today almost all RDBMS (MySql, Oracle,
Infomix, Sybase, MS Access) uses SQL as the standard database language. SQL is used
to perform all type of data operations in RDBMS.
SQL Command
SQL defines following data languages to manipulate data of RDBMS.

DDL : Data Definition Language


All DDL commands are auto-committed. That means it saves all the changes permanently
in the database.
Command Description
create to create new table or database
alter for alteration
truncate delete data from table
drop to drop a table
rename to rename a table

DML : Data Manipulation Language


DML commands are not auto-committed. It means changes are not permanent to
database, they can be rolled back.
KSSEM Dept. of CSE Page 2
Hospital Management System 2017-18

Command Description
insert to insert a new row
update to update existing row
delete to delete a row
merge merging two rows or two tables

TCL : Transaction Control Language


These commands are to keep a check on other commands and their affect on the database.
These commands can annul changes made by other commands by rolling back to original
state. It can also make changes permanent.
Command Description
commit to permanently save
rollback to undo change
savepoint to save temporarily

DCL : Data Control Language


Data control language provides command to grant and take back authority.
Command Description
grant grant permission of right
revoke take back permission

DQL : Data Query Language


Command Description
select retrieve records from one or more table

1.4 Applications of Database Management System

Some of the fields where Database Management System is used are:


 Telecom: It has a database which keeps track of the information regarding calls
made, network usage, customer details etc. Without the database systems it is hard
to maintain that huge amount of data that keeps updating every millisecond.

 Industry: It has a manufacturing unit, warehouse or distribution centre, each one


needs a database to keep the records of ins and outs. For example distribution
centre should keep a track of the product units that supplied into the centre as well
as the products that got delivered out from the distribution centre on each day; this
is where DBMS comes into picture.

KSSEM Dept. of CSE Page 3


Hospital Management System 2017-18

 Banking system: For storing customer info, tracking day to day credit and debit
transactions, generating bank statements etc. All this work has been done with the
help of Database management systems.

 Education sector: Database systems are frequently used in schools and colleges to
store and retrieve the data regarding student details, staff details, course details,
exam details, payroll data, attendance details, fees details etc. There is a lot of
inter-related data that needs to be stored and retrieved in an efficient manner.

 Online shopping: Online shopping websites such as Amazon, Flipkart etc., stores
product information, customer’s addresses and preferences, credit details and
provide customers with the relevant list of products based on their query. All this
involves a Database management system.

KSSEM Dept. of CSE Page 4


Hospital Management System 2017-18

Chapter 2

RESOURCE REQUIREMENTS
2.1 Hardware Requirements
The Hardware requirements are very minimal and the program can be run on most of the
machines.

Processor : Dual core 1.3 or higher processor


RAM : 512 MB RAM or higher
Monitor Resolution : 1920×1080px

2.2 Software Requirements

Operating System : Windows 10


Back end : Oracle 10g
Front end: : Java Netbeans 8.2

KSSEM Dept. of CSE Page 5


Hospital Management System 2017-18

Chapter 3

DESIGN
3.1 E-R Model

An Entity–Relationship model (ER model) describes inter-related things of interest in a


specific domain of knowledge. An ER model is composed of entity types (which classify
the things of interest) and specifies relationships that can exist between instances of those
entity types.

ER diagram should have mainly three components namely, entity, attribute, relationship.
The notations shown in Fig.3.1.1 can be used for drawing an ER diagram.

Fig. 3.1.1 E-R Diagram Notations

Fig. 3.1.2 shows the ER diagram for hospital management system.

KSSEM Dept. of CSE Page 6


Hospital Management System 2017-18

Fig. 3.1.2 E-R Diagram for Hospital Management System

3.2 Relational Schema

The relational schema diagram gives the relation of one entity with another as well as the
information about the key constraints. Fig.3.2.1 shows the relational schema diagram of
student attendance management system in which the attributes that are underlined are the
primary key and the arrow line is used to represent the mapping.

Fig.3.2.1 Schema Diagram

KSSEM Dept. of CSE Page 7


Hospital Management System 2017-18

Chapter 4

IMPLEMENTATION
4.1 Tables and their description

Table 4.1.1 Tables used

sql> select * from tab;

TNAME TABTYPE
ADDDOCTOR TABLE
ADDPATIENT TABLE
ADDSTAFF TABLE
USERS TABLE

Table 4.1.1 shows the list of tables used in implementation of student attendance
management system.

user_login
Table 4.1.2 Login Details

Table 4.1.2 shows the description of user_login table. This table is used to authenticate
the user who is logging into the system.

KSSEM Dept. of CSE Page 8


Hospital Management System 2017-18

Table 4.1.3 Doctor Details

Table 4.1.3 shows the description of Doctor details. This table is used to add doctors into
a particular hospital.

Table 4.1.4 Patient Details

Table 4.1.4 shows the description of patient details. This table is used to add patient into
a particular hospital.

KSSEM Dept. of CSE Page 9


Hospital Management System 2017-18

Table 4.1.5 Staff Details

Table 4.1.5 shows the description of staff details. This table is used to add staff into a
particular hospital.

CODES
Insertion code
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String Name=name.getText();
String Doctor_id=d_id.getText();
String Address=address.getText();
String PNo=phno.getText();
String Qualification=qualification.getText();
String Dep=department.getText();
String Fee=fee.getText();
String FeeVali=feevlid.getText();
String DOJ=doj.getText();
String CabinNo=cbno.getText();
String WorkingT=wrkhrs.getText();
JOptionPane.showMessageDialog(null,"welcome doctor!!");
try
{

KSSEM Dept. of CSE Page 10


Hospital Management System 2017-18

Class.forName("oracle.jdbc.OracleDriver");
Connection
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","ke
dar","kedar");
PreparedStatement ps =conn.prepareStatement("insert into adddoctor
values(?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,Name);
ps.setString(2,Doctor_id);
ps.setString(3,Address);
ps.setString(4,PNo);
ps.setString(5,Qualification);
ps.setString(6,Dep);
ps.setString(7,Fee);
ps.setString(8,FeeVali);
ps.setString(9,DOJ);
ps.setString(10,CabinNo);
ps.setString(11,WorkingT);

ps.executeUpdate();
new Add().setVisible(true);
this.setVisible(false);

} catch (ClassNotFoundException | SQLException ex) {


Logger.getLogger(Add_Doctor.class.getName()).log(Level.SEVERE,
null, ex);
JOptionPane.showMessageDialog(this, ex);
}
}
DELETION CODE
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("oracle.jdbc.OracleDriver");

KSSEM Dept. of CSE Page 11


Hospital Management System 2017-18

Connection
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","ke
dar","kedar");
Statement stmt=conn.createStatement();
String DOCTOR_NUMBER=d_id.getText();
String SQL = "DELETE FROM adddoctor where
DOCTORID="+DOCTOR_NUMBER;
System.out.println("the contents are " + SQL);
stmt.executeQuery(SQL);
JOptionPane.showMessageDialog(this,"DELETION SUCCESS");
}
catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(Add_Doctor.class.getName()).log(Level.SEVERE,
null, ex);
JOptionPane.showMessageDialog(this, ex);
}
}
UPDATION CODE
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String CurrentDoctorNumber=curr_dno.getText();
String changeDoctorNumber=new_dno.getText();
String patientNumber=pno.getText();
try
{
Class.forName("oracle.jdbc.OracleDriver");
Connection
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","ke
dar","kedar");
PreparedStatement ps =conn.prepareStatement("update addpatient set
doctorid=? where patient_number=?");
ps.setString(1,changeDoctorNumber);
ps.setString(2,patientNumber);
ps.executeUpdate();

KSSEM Dept. of CSE Page 12


Hospital Management System 2017-18

JOptionPane.showMessageDialog(null,"doctor for the patient record has been


updated");
this.setVisible(false);
new Add().setVisible(true);

} catch (ClassNotFoundException | SQLException ex) {


Logger.getLogger(Update_Doctor.class.getName()).log(Level.SEVERE,
null, ex);
}
}

KSSEM Dept. of CSE Page 13


Hospital Management System 2017-18

Chapter 5
RESULTS
Fig. 5.1.1 shows the login form used to enter into the Login page.

Fig. 5.1.1 Login form


Fig. 5.1.2 shows the login form used for security purpose. Only authenticated person can
access the system.

Fig. 5.1.2 Login form

KSSEM Dept. of CSE Page 14


Hospital Management System 2017-18

Fig. 5.1.3 displays the successfully login confirmation.

Fig. 5.1.3 Login Confirmation

Fig. 5.1.4 displays the Welcome page of the hospital and allows you to add, update,
delete and view the records available in the Hospital management database.

Fig. 5.1.4 Welcome page

KSSEM Dept. of CSE Page 15


Hospital Management System 2017-18

Fig. 5.1.5 This frame allows you to add new doctors, patient and staff into the Hospital.

Fig. 5.1.5 Add Records

Fig. 5.1.6 Allows you to add new doctor into the hospital.

Fig. 5.1.6 Add New Doctor

KSSEM Dept. of CSE Page 16


Hospital Management System 2017-18

Fig. 5.1.7 Allows you to add new patient into the hospital.

Fig. 5.1.7 Add New Patient

KSSEM Dept. of CSE Page 17


Hospital Management System 2017-18

Fig. 5.1.8 Allows you to add new patient into the hospital.

Fig. 5.1.8 Add New Staff

Fig. 5.1.9 Allows you to update a particular doctor in the hospital.

Fig. 5.1.9 Update Doctor

KSSEM Dept. of CSE Page 18


Hospital Management System 2017-18

Fig. 5.1.10 Allows you to view the records of doctors, patients, staff and users.

Fig. 5.1.10 View Records


Fig. 5.1.11 Allows you to view the records of Doctors.

Fig. 5.1.11 Doctors Records

KSSEM Dept. of CSE Page 19


Hospital Management System 2017-18

Fig. 5.1.12 Allows you to view the records of Patients.

Fig. 5.1.12 Patients Records

Fig. 5.1.13 Allows you to view the records of Staff.

Fig. 5.1.13 Staff Records

KSSEM Dept. of CSE Page 20


Hospital Management System 2017-18

Fig. 5.1.14 Allows you to view the records of Users.

Fig. 5.1.14 Users Records


Fig. 5.1.15 Allows you to delete the records of doctors, patients and staff.

Fig. 5.1.15 Delete Records

KSSEM Dept. of CSE Page 21


Hospital Management System 2017-18

Fig. 5.1.16 Allows you to delete the records of doctors.

Fig. 5.1.16 Delete Doctor


Fig. 5.1.17 allows you to delete the records of patients.

Fig. 5.1.17 Delete Patient

Fig. 5.1.18 allows you to delete the records of staff.

Fig. 5.1.18 Delete Staff


KSSEM Dept. of CSE Page 22
Hospital Management System 2017-18

Chapter 6

CONCLUSION AND FUTURE ENHANCEMENT


6.1 Conclusion

Hospital management system is developed using NetBeans 8.2. Project facilitates the
receptionist to generate the report at any time to know the overall status of the hospital,
status of a particular doctor appointment to a patient.

6.2 Future Enhancement

The system can be enhanced by including more facilities like the billing system,
impatient room allotment for the admitted patients and the stock details of the medicines
in the pharmacy. Providing such feature enable the users to include more comments into
the system.

KSSEM Dept. of CSE Page 23


Hospital Management System 2017-18

BIBLIOGRAPHY

[1] Elmasri, Navathe, Fundamentals of Database Systems, Pearson Education, 5 th Edition,


2006, ISBN- 978-81-317-1625-0.

[2] Raghu Ramakrishnan and Johannes Gehrke, Database Management Systems, Tata
McGraw-Hill, 3rd Edition, 2003, ISBN- 0-07-123151-X.

[3] Silberschatz, Korth and Sudarshan, Database System Concepts, Tata McGraw-Hill, 5th
Edition, 2002, ISBN- 007-124476-X.

[4] HerbertSchildt, The Complete Reference JAVA, 7 th Edition


[5] http://www.planetnetbeans.org/topic61731.html
[6] http://www.dineshkrish.com/java/swing/dispaly-data-from-database-in-jtable/
[7]http://stackoverflow.com/questions/16645724/how-to-insert-date-into-mysql-database-
table-in-java
[8] http://www.scribd.com.mobile/doc/hospital-management-system

KSSEM Dept. of CSE Page 24

You might also like