Akshay, Himanshu
Akshay, Himanshu
Akshay, Himanshu
A
Project Report
on
(HOSPITAL MANAGEMENT SYSTEM)
ACKNOWLEDGEMENT
This research project report on “Hospital management system” is the result of idea and
suggestions to me by Dr.PARMODKUMARwe have received unfailing encouragement and
inspiration of Dr. PARMOD KUMAR whose exceptional knowledge and unparalleled
behavior is full of ardent inspiration in it. However, we can never adequate thank all those
who have their assistance, guidance, cooperation criticism contributed to the improvement of
this report. We are ebullient in expressing my intense in debtless heartiest gratitude to all of
them.
DECLARATION
We ( AKSHAY KUMAR and HIMANSHU ) hereby declare that the project
report title“HOSPITAL
MANAGEMENT SYSTEM”is an original work carried out by us under the
supervision of Dr.PARMOD SHARMA.I further declare that this workhas not
been submitted to any other Institute/University for the award of thedegree of
Master of Computer Applications.
CONTENTS
INTRODUCTION 06
OBJECTIVES OF THE PROJECT 07
HARFDWARE AND SOFTWARE REQUIREMENT 08
BACK-END FRONT-END 09
MODULES AND DETAILS 11
SRS 12
DATAFLOW DIAGRAM 17
ER DIAGRAM 20-21
DATABASE 23
CODING 35-72
CONCLUSION 73
FUTURE SCOPE 75
BIBLIOGRAPHY 76
5
1.INTRODUCTION:
Human body is a very complex and sophisticated structure and comprises of millions of
functions. All these complicated functions have been understoodbyman him, part-by-part
their research and experiments. As science andtechnology progressed, medicine became an
integral part of the research. Gradually, medical science became an entirely new branch of
science. As of today, the health Sector comprises ofinstitutions i.e. Hospitals, etc. research
and development institutions and medical college, Thusthe Health sector aims at providing
the best medical facilities to the common man.
The project Hospital Management system includes registration of patients, storing their
details into the system, and also computerized billing in the pharmacy, and labs. The
Software has the facility to give a unique id for every patient and stores the details of every
patient and the staff automatically. It includes a search facility to know the current status of
each rows.User can search availability of a doctor and the details of a patient using the id.
6
Hospitals and healthcare centers have undergone a charge for its betterment. The
administrations of healthcaresector are opting IT solutions for the better management and
patient care in their hospital campus. Have a look at some salient features of hospital
management software.
Hospital are the essential part of our lives, providing best medical facilitiesto people
suffering from various ailments, which may be due to change in climateconditions, increased
work-load, emotional trauma stress etc. It is necessary forthe hospitals to keep track of its
day-to-day activities & record of its patients,doctors, nurse, ward boys and other staff
personals that keep the hospital running smoothly & successfully.
But keeping track of all the activities and their record on paper is very cumbersome and
error proved. It also is very inefficient and a time -consumingprocess observing the
continuous
increase in population and number of peoplevisiting the hospital, Recording and maintaining
all these records are highlyunreliable inefficient and error-prove. It is also not economically
technically feasible to maintain these records on paper.
7
On next visit, need not weight in long queue for registering again
MYSQL
HARDWARE REQUIREMENTS:
PROCESSOR p3 & Above
RAM 1GB
HARDDISK 512GB
MONITOR
KEYBOARD
MOUSE
9
SOFTWARE REQUIREMENTS
• Jdk1.7
• MYSQL
Level 0 DFD –
A Data Flow Diagram (DFD) is a graphical tool used to describe and analyze the
movement of data through a system - manual or automated including the processes, stores of
data and delays in the system. They are central tools and the basis from which other
components
are developed. It depicts the transformation of data, independent of the physical components,
from input to output through logical processes and the interaction between process.
In a DFD there are four components:
Sources or Destinations of data such as human, entities that interact with system, outside the
system boundary, who form the source and the recipient of information are depicted in the
form
of a closed rectangle.
Admin Level-0
Patient
Hospital
Patient
10
Level DFD
patient Room
11
Searching
Process
Display
process
E-R DAIGRAM:
H Add
P Name P id H id H name
Patient Hospital
Addmitted in
H city
Paddress
P m no.
Doctor
12
LOGIN TABLE
PATIENT TABLE
DOCTOR TABLE:
DISCHARGE:
1. The first includes unit testing, where in each module is tested to provide its
correctness
validity and also determine any missing operations and to verify whether the
objectives
have been met. Errors are noted down and corrected immediately.
2. The second step includes integration testing. It need not be the case, the software
16
whose modules when run individually and showing perfect results, will also show
perfect
results when run as a whole
5. CONCLUSION:
in a hospital.
It generates test report; provide prescription details including various tests, check-
Login form
17
Doctor form
18
Discharge Form
19
importjava.awt.*;
importjava.awt.event.*;
importjava.sql.*;
import Package.Welcome;
class Login{
JLabel l3;
//JTextField t;
//JTextField p;
public Login(){
l1.setFont(new Font("Monaco",Font.BOLD,15));
l2.setFont(new Font("Monaco",Font.BOLD,15));
t.setFont(new Font("Monaco",Font.BOLD,15));
l3=new JLabel();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
l1.setBounds(20,50,150,20);
l2.setBounds(20,90,150,20);
t.setBounds(110,50,120,20);
p.setBounds(110,90,120,20);
b2.setBounds(80,120,70,20);
b1.setBounds(160,120,70,20);
b3.setBounds(245,120,70,20);
20
f.setSize(600,600);
b2.addActionListener(new ActionListener(){
t.getText();
p.getText();
t.setText("");
l3.getText();
l3.setText("");
p.setText("");
});
b3.addActionListener(new ActionListener(){
f.dispose();
});
b1.addActionListener(new ActionListener(){
try{
Connection con=DriverManager.getConnection(url,userName,password);
Statement st=con.createStatement();
String un=t.getText();
String pw=p.getText();
rs.next();
if(un.equals(rs.getString(1)) &&pw.equals(rs.getString(2))){
f.dispose();
new Welcome();
else
JOptionPane.showMessageDialog(null,"Unsuccessfull");
con.close();
21
catch(Exception e){
System.out.println("error"+e);
});
f.add(l1);
f.add(t);
f.add(l2);
f.add(p);
f.add(b2);
f.add(b1);
f.add(b3);
f.add(l3);
f.setLayout(null);
f.setResizable(false);
f.setLocationRelativeTo(null);
f.setVisible(true);
new Login();
package Package;
importjava.awt.*;
importjava.awt.event.*;
importjavax.swing.*;
import Package.HospitalManagementSystem;
22
img=new ImageIcon("main.jpg");
jlpic=new JLabel(img);
jlpic.setBounds(2,40,400,400);
f1.add(jlpic);
lbltitle1=new JLabel("Hospital Management System");
ft1=new Font("monotype corsiva",Font.BOLD+Font.ITALIC,30);
lbltitle1.setFont(ft1);
lbltitle1.setBounds(10,10,690,40);
f1.add(lbltitle1);
lbltitle2=new JLabel(":-Developed By");
ft1=new Font("monotype corsiva",Font.BOLD+Font.ITALIC,30);
lbltitle2.setFont(ft1);
lbltitle2.setBounds(430,80,200,50);
lbltitle3=new JLabel("1.Neha Pundir");
ft1=new Font("monotype corsiva",Font.BOLD+Font.ITALIC,30);
lbltitle3.setFont(ft1);
lbltitle3.setBounds(430,150,200,50);
23
f1.dispose();
}
});
btnPatientInfo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEventae){
f1.dispose();
new Patient();
}
});
btnDischarge.addActionListener(new ActionListener(){
public void actionPerformed(ActionEventae){
f1.dispose();
new Discharge();
}
});
btnDoctorInfo.addActionListener(new ActionListener(){
public void actionPerformed(ActionEventae){
f1.dispose();
new Doctor();
}
});;
//btnDischarge.addActionListener(this);
//btnExit.addActionListener(this);
}
/*public void actionPerformed(ActionEventae)
{
if(ae.getSource()==btnPatientInfo)
{
new Patient();
}
if(ae.getSource()==btnExit)
{
System.exit(0);
}
if(ae.getSource()==btnDoctorInfo)
26
{
new Doctor();
}
}*/
/*public static void main(String arg[])
{
HospitalManagementSystem HMS1=new HospitalManagementSystem();
}*/
}
importjava.sql.*;
public class Patient extends JFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7;
JTextField tf1,tf2,tf3,tf4,tf5,tf6,tf7;
JButton b1,b2,b3,b4,b5;
ResultSetrs;
Connection con;
Statement st;
//JLabellpic;
//ImageIconimg;
public Patient()
{
setSize(1400,1400);
setLayout(null);
setVisible(true);
setTitle("Patient");
//img=new ImageIcon("E:/ggg.jpg");
//lpic=new JLabel(img);
//lpic.setBounds(0,0,500,500);
init();
components();
refresh();
}
public void init()
{
l1=new JLabel("ID");
l1.setBounds(40,60,130,30);
l2=new JLabel("Name");
l2.setBounds(40,110,130,30);
l3=new JLabel("Father Name");
l3.setBounds(40,160,130,30);
l4=new JLabel("Address");
l4.setBounds(40,210,130,30);
28
l5=new JLabel("Age");
l5.setBounds(40,260,130,30);
l6=new JLabel("Disease");
l6.setBounds(40,310,130,30);
l7=new JLabel("Gender");
l7.setBounds(40,360,130,30);
//l8=new JLabel("Date");
//l8.setBounds(40,410,130,30);
b1=new JButton("Save");
b1.setBounds(40,480,100,30);
b2=new JButton("Back");
b2.setBounds(150,480,100,30);
b3=new JButton("Update");
b3.setBounds(300,480,100,30);
b4=new JButton("Delete");
b4.setBounds(430,480,100,30);
b5=new JButton("New");
b5.setBounds(570,480,100,30);
tf1=new JTextField();
tf1.setBounds(180,60,150,30);
tf2=new JTextField();
tf2.setBounds(180,110,150,30);
tf3=new JTextField();
tf3.setBounds(180,160,150,30);
tf4=new JTextField();
tf4.setBounds(180,210,150,30);
tf5=new JTextField();
tf5.setBounds(180,260,150,30);
tf6=new JTextField();
tf6.setBounds(180,310,150,30);
tf7=new JTextField();
tf7.setBounds(180,360,150,30);
}
public void components()
29
{
add(l1);
add(l2);
add(l3);
add(l4);
add(l5);
add(l6);
add(l7);
//add(l8);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(tf1);
add(tf2);
add(tf3);
add(tf4);
add(tf5);
add(tf6);
add(tf7);
//add(tf8);
//add(lpic);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
refresh();
}
});
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
30
{
if(e.getSource()==b2)
{
//new WelcomePage();
}
refresh();
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
intt=st.executeUpdate("insertinto tblcustomer VALUES('"+tf1.getText()
+"','"+tf2.getText()+"','"+tf3.getText()+"','"+tf4.getText()
+"','"+tf5.getText()+"','"+tf6.getText()+"','"+tf7.getText()+"')");
if(t>0)
{
JOptionPane.showMessageDialog(null,"Record Saved...");
st.close();
con.close();
refresh()
}
Else
JOptionPane.showMessageDialog(null,"RecordNotSaved...");
//UserBind();
}catch(Exception ex){
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
31
if(e.getSource()==b3)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connectioncon=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
Intrs=st.executeUpdate("update tblcustomer set cusname='"+tf2.getText()
+"',cusmedicine='"+tf3.getText()+"',medquantity='"+tf4.getText()
+"',addres='"+tf5.getText()+"',ndate='"+tf6.getText()
+"',price='"+tf7.getText()+"' where cusid='"+tf1.getText()+"'");
if(rs>0)
{
JOptionPane.showMessageDialog(null,"Record Updated...");
st.close();
con.close();
refresh()
}
Else
JOptionPane.showMessageDialog(null,"Record Not updated...");
//UserBind();
}catch(Exception ex){
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
if(e.getSource()==b4)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
intrs=st.executeUpdate("delete from tblcustomer where
cusid='"+tf1.getText()+"'");
if(rs>0)
{
JOptionPane.showMessageDialog(null,"Record Delete...");
32
st.close();
con.close();
refresh();
}
else
JOptionPane.showMessageDialog(null,"Record Not Delete...");
//UserBind();
}catch(Exception ex){
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
}
public void refresh(){
tf1.setText(" ");
tf2.setText(" ");
tf3.setText(" ");
tf4.setText(" ");
tf5.setText(" ");
tf6.setText(" ");
tf7.setText(" ");
}
/*public static void main(String[]ar)
{
new Patient();
}*/
}
33
setLayout(null);
setVisible(true);
setTitle("Doctor");
//img=new ImageIcon("E:/ggg.jpg");
//lpic=new JLabel(img);
//lpic.setBounds(0,0,500,500);
init();
components();
refresh();
}
public void init()
{
l1=new JLabel("Doctor ID");
l1.setBounds(40,60,130,30);
l2=new JLabel("Doctor Name");
l2.setBounds(40,110,130,30);
l3=new JLabel("Email:");
l3.setBounds(40,160,130,30);
l4=new JLabel("Address");
l4.setBounds(40,210,130,30);
l5=new JLabel("mobile no:");
l5.setBounds(40,260,130,30);
l6=new JLabel("Age");
l6.setBounds(40,310,130,30);
l7=new JLabel("Gender");
l7.setBounds(40,360,130,30);
b1=new JButton("Save");
b1.setBounds(40,480,100,30);
b2=new JButton("Back");
b2.setBounds(170,480,100,30);
b3=new JButton("Update");
b3.setBounds(300,480,100,30);
b4=new JButton("Delete");
b4.setBounds(430,480,100,30);
b5=new JButton("New");
35
b5.setBounds(570,480,100,30);
tf1=new JTextField();
tf1.setBounds(180,60,150,30);
tf2=new JTextField();
tf2.setBounds(180,110,150,30);
tf3=new JTextField();
tf3.setBounds(180,160,150,30);
tf4=new JTextField();
tf4.setBounds(180,210,150,30);
tf5=new JTextField();
tf5.setBounds(180,260,150,30);
tf6=new JTextField();
tf6.setBounds(180,310,150,30);
tf7=new JTextField();
tf7.setBounds(180,360,150,30);
}
public void components()
{
add(l1);
add(l2);
add(l3);
add(l4);
add(l5);
add(l6);
add(l7);
//add(l8);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(tf1);
add(tf2);
add(tf3);
add(tf4);
36
add(tf5);
add(tf6);
add(tf7);
//add(tf8);
//add(lpic);
b1.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
refresh();
}
});
b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b2)
{
//new WelcomePage();
}
refresh();
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
int t=st.executeUpdate("insert into tblcustomer VALUES('"+tf1.getText()
+"','"+tf2.getText()+"','"+tf3.getText()+"','"+tf4.getText()
+"','"+tf5.getText()+"','"+tf6.getText()+"','"+tf7.getText()+"')");
37
if(t>0)
{
JOptionPane.showMessageDialog(null,"Record Saved...");
st.close();
con.close();
refresh();
}
else
JOptionPane.showMessageDialog(null,"Record Not Saved...")
//UserBind();
}catch(Exception ex){
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
if(e.getSource()==b3)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
intrs=st.executeUpdate("update tblcustomer set cusname='"+tf2.getText()
+"',cusmedicine='"+tf3.getText()+"',medquantity='"+tf4.getText()
+"',addres='"+tf5.getText()+"',ndate='"+tf6.getText()
+"',price='"+tf7.getText()+"' where cusid='"+tf1.getText()+"'");
if(rs>0)
{
JOptionPane.showMessageDialog(null,"Record Updated...");
st.close();
con.close();
refresh();
}
Else
JOptionPane.showMessageDialog(null,"Record Not updated...");
//UserBind();
}catch(Exception ex){
38
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
if(e.getSource()==b4)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:mydsn");
Statement st=con.createStatement();
intrs=st.executeUpdate("delete from tblcustomer where
cusid='"+tf1.getText()+"'");
if(rs>0)
{
JOptionPane.showMessageDialog(null,"Record Delete...");
st.close();
con.close();
refresh();
}
else
JOptionPane.showMessageDialog(null,"Record Not Delete...");
//UserBind();
}catch(Exception ex){
System.out.println(ex);
JOptionPane.showMessageDialog(null,ex);
}
}
}
public void refresh(){
tf1.setText(" ");
tf2.setText(" ");
tf3.setText(" ");
tf4.setText(" ");
tf5.setText(" ");
tf6.setText(" ");
39
tf7.setText(" ");
}
/*public static void main(String[]ar)
{
new Doctor();
}*/
}
importjava.awt.*;
importjava.awt.event.*;
importjavax.swing.*;
importjava.sql.*;
40
JFrame f1;
JLabel lb1,lb2,lb3,lb4,lb5,lb6,lb7,lb8,lb9,lb10,lb11;
JButtonbtnadd,btnsave,btnback;
ImageIconimg;
JLabeljlpic;
Choice ch;
Choice ch1,chbrn;
Connection con;
String s1,s2;
Statement st;
ResultSetrs;
PatientAdmitDetails()
f1.setSize(800,700);
f1.setLayout(null);
f1.setVisible(true);
//f1.setResizable(false);
img=new ImageIcon("rahul1.jpg");
41
jlpic=new JLabel(img);
jlpic.setBounds(400,8,300,400);
f1.add(jlpic);
lb1.setBounds(40,40,60,40);
f1.add(lb1);
txt1=new JTextField();
txt1.setBounds(140,40,100,40);
f1.add(txt1);
lb2.setBounds(40,90,80,40);
f1.add(lb2);
txt2=new JTextField();
txt2.setBounds(140,90,100,40);
f1.add(txt2);
lb3.setBounds(40,140,100,40);
42
f1.add(lb3);
txt3=new JTextField();
txt3.setBounds(140,140,100,40);
f1.add(txt3);
lb4=new JLabel("Age");
lb4.setBounds(40,190,100,40);
f1.add(lb4);
txt4=new JTextField();
txt4.setBounds(140,190,100,40);
f1.add(txt4);
lb5=new JLabel("Gender");
lb5.setBounds(40,240,100,40);
f1.add(lb5);
ch=new Choice();
ch.add("Male");
ch.add("Female");
ch.setBounds(140,240,100,40);
43
f1.add(ch);
lb6=new JLabel("Time");
lb6.setBounds(40,290,80,40);
f1.add(lb6);
txt5=new JTextField();
txt5.setBounds(140,290,100,40);
f1.add(txt5);
lb7=new JLabel("Address");
lb7.setBounds(40,340,80,40);
f1.add(lb7);
txtadd=new JTextField();
txtadd.setBounds(140,340,200,40);
f1.add(txtadd);
lb8.setBounds(40,390,100,40);
f1.add(lb8);
44
txt6=new JTextField();
txt6.setBounds(140,390,100,30);
f1.add(txt6);
ewJLabel("Room");
lb9.setBounds(40,440,120,40);
f1.add(lb9);
ch1=new Choice();
ch1.add("General");
ch1.add("Private");
ch1.setBounds(160,450,100,40);
f1.add(ch1);
lb11=new JLabel("");
lb11.setBounds(280,450,40,40);
f1.add(lb11);
chbrn=new Choice();
chbrn.setBounds(350,450,100,40);
f1.add(chbrn);
45
lb10.setBounds(40,490,140,40);
f1.add(lb10);
txt7=new JTextField();
txt7.setBounds(140,490,300,30);
f1.add(txt7);
btnadd.setBounds(150,550,100,60);
f1.add(btnadd);
btnsave=new JButton("save");
btnsave.setBounds(280,550,100,60);
f1.add(btnsave);
s2="Booked";
btnback=new JButton("Back");
btnback.setBounds(420,550,100,60);
f1.add(btnback);
btnsave.setEnabled(false);
txt1.setEnabled(false);
46
txt2.setEnabled(false);
txt3.setEnabled(false);
txt4.setEnabled(false);
txt5.setEnabled(false);
txtadd.setEnabled(false);
txt6.setEnabled(false);
txt7.setEnabled(false);
ch.setEnabled(false);
ch1.setEnabled(false);
btnadd.addActionListener(this);
btnsave.addActionListener(this);
btnback.addActionListener(this);
ch1.addItemListener(this);
//Coding of
connectivity==============================================
====
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospital");
st=con.createStatement();
if(rs.next())
txt1.setText(String.valueOf(rs.getInt(1)));
catch(Exception e)
System.out.print(e);
int id;
if(ae.getSource()==btnadd)
btnsave.setEnabled(true);
btnadd.setEnabled(false);
48
txt2.setEnabled(true);
txt3.setEnabled(true);
txt4.setEnabled(true);
txt5.setEnabled(true);
txt6.setEnabled(true);
txt7.setEnabled(true);
txtadd.setEnabled(true);
ch.setEnabled(true);
ch1.setEnabled(true);
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospital");
st=con.createStatement();
if(rs.next())
id=rs.getInt(1);
id=id+1;
txt1.setText(String.valueOf(id));
}
49
catch(Exception e)
System.out.print(e);
if(ae.getSource()==btnsave)
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospital");
st=con.createStatement();
if(i>0)
50
btnsave.setEnabled(false);
btnadd.setEnabled(true);
catch(Exception e)
System.out.print(e);
if(ae.getSource()==btnback)
f1.hide();
{
51
if(ie.getSource()==ch1)
String s1="Free";
chbrn.removeAll();
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospital");
st=con.createStatement();
while(rs.next())
chbrn.add(String.valueOf(rs.getInt(3)));
catch(Exception e)
System.out.print(e);
}
52
BIBLOGRAPHY
1. JAVA NETBEANS
2. DBMS: Data Base Management System
“Ramez, Elmarsi ,Shamakant , B.Navathe”,Fifth Edition
3. www.google.com