You are on page 1of 25

ALAGUPANDI.V AVINASH DHANDPANI.

J
KABILESH.R KANAGARAJ.J
LALRINSIAMMA MANIKANDAN.A
VANLALCHHUNGA ANANTH.K

ON

HOSPITAL MANAGEMENT
Contents

S.No Title Page No


1. Abstract 2
2. Introduction 3
2.i Need of Mini Project 3
2.ii The Programming 4
Process
3. Project Description 5
3.i. Main Form 5
3.ii. Start Form 5
3.iii. Patient Start Form 5
3.iv. Patient Info Form 6
3.v. Patient Info Modify Form 7
3.vi. Patient Info View Form 7
3.vii. Doctor Start Form 7
3.viii. Doctor Info Form 7
3.ix. Doctor Info Modify Form 8
3.x. Doctor Info View Form 8
3.xi. Billing Form 9
3.xii. Report Form 9
3.xiii. Patient’s Report 10
3.xiv. Doctor’s Report 10
4. Coding 11
5. Output 17
6. References 24
ABSTRACT

A mini project in Java on the topic “HOSPITAL


MANAGEMENT” has been done to meet the needs of the people
maintaining records in the hospital. First of all a hospital should keep
the details and history of patients who come to their hospital. Next
they must keep details about the doctors working in the hospital. Next
is billing which requires all the history of the patient. In this modern
era it is tough to maintain all the record manually. With the use of
computer everything is made possible. This is the background which
led us to do a mini project on this topic. First of all the result should
be user friendly so we used GUI using Java. To maintain records of
all the happening we made use of Microsoft Access as a back end.
Finally using a JDBC connection we connected these two and created
what we required. JDBC is nothing but Java Database Connectivity
using which we can connect the JVM i.e. Java Virtual Machine with
the database which we required. Once a connection is made with the
database whatever changes made in the GUI will get reflected in the
database which is connected. Thus making it possible to retrieve and
use it for further purpose. Thus by using this one can easily perform
the operation like searching, modifying and viewing both patient and
doctor’s detail. Billing is also made using this thus making all
calculation perfect and easy. Thus this mini project when
implemented will make everything easy in a hospital.

2.Introduction
Java is an object-oriented programming, multi-threaded
programming developed by Sun Microsystems is a Platform
Independent programming language which is used to create an
application useful for Hospital in managing the patients and doctors
records and use it for further purpose. Microsoft Access is the most
commonly used application to build a GUI application. One can
create a database using MS Access. With that database one can
establish an ODBC connection with any language. Here by using MS
Access as a back end and by using java the application is generated.
Given the topic Hospital Management we need to do
various operations like searching, viewing and updating. First of all
the fields required are gathered. In order to maintain simplicity we
have classified it into three parts i.e. patients, doctors and billing part.
Each part has its own features. Since Java is a multi
threaded programming language each and every module is linked.

i. Need of Mini Project


Due to the rapid development in the use of technology in
all fields there is no exception for any field. So all the works are
changed from manual to computerized. As a result of which we
require all the things to be updated to be computerized. So we decided
to modernize the hospital management. Using which we can add a
patient detail and can view a report. Using this we can also make
billing. Thus making it easy for the employees of the hospital to
maintain the history of the patients and produce the bill for the
patient.

ii. The Programming Process:

1. Write the coding in java.


2. Create a database in MS ACCESS with the required table
with the required fields.
3. Create an ODBC connection for that database.

Once the connections are made and the coding is done it is ready
for execution. It can be used as an application anywhere required.
Report is nothing but a view of specified fields as a whole. It may be
useful in the case of generating overall report. For that we have also
added a report to it.

Here Report is generated using vector. Vector is dynamic array


which can grow automatically according to the required need. Vector
does not require any fix dimension like String array and int array.
Vector contains many useful methods. To add element in Vector, we
can use add() method of vector class.
This generalises our mini project. Following this comes the
project description.

Project Description:

i. Main Form
It is a form which helps in providing entry to the application. It
contains the fields “USERNAME” and “PASSWORD”. The person
knowing the correct username and correct password can only enter
the application. This is made in order to assure that the employee who
is assigned to work with it can alone use it.
After providing this it gets transferred to the start.java . If the
incorrect password or username is given then there arises a error
dialogue box saying to provide correct username and password.

ii. Start Form

This is the form which helps us to transfer between the Patient


Information, Doctor Information and the Billing. It acts as a Home
Form. It has four buttons namely Patient, Doctor, Billing and Report.
Clicking on each button takes control to the respective sub forms.
The transition is done by creating object for the corresponding
class and thus calling it.

iii. Patient Start Form:

This is the form which is used to either add, update or view a


patient detail. By clicking the respective buttons we can transfer to the
add form or update form or view form.

iv.Patient Info Form:

This is form which is used to add a patient detail. It has the


following fields.
a)Name h)Date of Birth
b)Address i)History
c)Contact j) Current Problem
d)Patient no k) Attending Doctor
e)Room no l) Date of Admission
f)Blood Group m) Type of Room
g)Sex

The important thing to note is that the date which is given


should be of the format dd-mm-yyyy or else it will generate a dialog
box stating “Enter a Valid Date”. Blood Group is a list box. From
which one may be chosen from the list of options available. The field
Sex is a radio button i.e. only Male or Female can be selected.
Multiple selection is not possible. The Type of Room is also a List
box which has four options
 Deluxe
 Private
 Semi-Private
 General
Once all the fields are filled then add button can be clicked. If
all the details or correct a dialog box showing “Details Added
Successfully !! ” splashes.
After this it returns to the Patient Start Form.

i. Patient Info Update Form:

This form is similar to that of the Patient Info form in


appearance. First of all the patient number is typed and it is searched
to display the details of that patient. Then the changes which has to
be carried over the patient is done and the update button is clicked
producing a dialogue box stating “Details Updated Successfully!!”
After this it returns to the Patient Start Form.

ii. Patient Info View Form:

It is used to view the details about the patient. It is done by


typing the patient number and searching. Thereby, viewing all the
details.

iii.Doctor Start Form:

This is the form which is used to either add, update or view a


doctor detail. By clicking the respective buttons we can transfer to the
add form or update form or view form.

iv.Doctor Info Form

This is form which is used to add a patient detail. It has the


following fields.

• Name
• Address
• Contact
• Doctor Id
• Specialization
• Working from
• Working to

Once all the fields are filled then add button can be clicked. If
all the details or correct a dialog box showing “Details Added
Successfully!!” splashes.
There are three buttons in the form they are
• Add
• Clear
• Back
Clicking Back returns to the Doctor Start Form. By clicking the
Clear button it erases all the items in the text boxes and displays an
empty text boxes with cursor on the first field.

i. Doctor Info Modify Form:

This form is similar to that of the Doctor Info form in


appearance. First of all the Doctor Id is typed and it is searched to
display the details of that doctor. Then the changes which has to be
carried over the doctor is done and the update button is clicked
producing a dialogue box stating “Details Updated Successfully!!”
After this it returns to the Doctor Start Form.

ii. Doctor Info View Form:

It is used to view the details about the patient. It is done by


typing the patient number and searching. Thereby, viewing all the
details.

iii. Billing Form:

This form is to do the billing. This form is useful for the purpose
of billing. It has the following fields

➢ Patient Name
➢ Patient Number
➢ Date of Admission
➢ Date of Discharge
➢ Room Type
➢ Total Amount

First of all the patient number is entered and the search button is
clicked thereby displaying all the details specified above.

i. Report Form:

This has two buttons to view

Patient’s Report
Doctor’s Report

By clicking the corresponding buttons we can display the


respective reports.
Reports are nothing but table which is being generated from the
tables. The needed fields are grouped together and viewed in the
form of table. Here a vector is used to do so. Vector is dynamic array
which can grow automatically according to the required need. Vector
does not require any fix dimension like String array and int array.
Vector contains many useful methods. To add element in Vector, we
can use add() method of vector class.

i. Patient’s Report:

It displays the fields

a)Name h)Date of Birth


b)Address i)History
c)Contact j) Current Problem
d)Patient no k) Attending Doctor
e)Room no l) Date of Admission
f)Blood Group m) Type of Room
g)Sex

as a tabular form with the above as title and the records of each
patient as a row. Since vector is dynamic the number of patients can
be more.

ii. Doctor’s Report:

It displays the fields

• Name
• Address
• Contact
• Doctor Id
• Specialization
• Working from
• Working to

The above fields are displayed as table. The heading of each


column is the above said field. The records of each doctor are
displayed as rows.

• Once the close button is clicked the window is closed.


• Each window has a back button using which one can go to the
previous button.

Finally the Billing details after being closed the details of bill is
also printed in the command prompt in addition.
1. Coding:

/* main.java */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class main extends JFrame implements ActionListener


{
static JFrame frame;
private String username;
private String password;
private static JFrame loginFrame;
private static JPanel panel1;
private static JPanel panel2;
private static JPanel panel3;
private JButton loginBtn;
private JButton exitBtn;
int dialogtype = JOptionPane.PLAIN_MESSAGE;
String dialogmessage;
String dialogs;
private JLabel nameLbl;
private JLabel userLbl;
private JLabel passwordLbl;
private static JTextField userTxt;
private static JPasswordField passwordTxt;
public String loginname;
public String loginpass;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
main()
{
panel1 = new JPanel();
panel1.setLayout(new FlowLayout());
nameLbl = new JLabel("Hospital Managment ");
panel2 = new JPanel();
panel2.setLayout(new GridLayout(2,2));
userLbl = new JLabel("Username :");
userTxt = new JTextField(20);
passwordLbl = new JLabel("Password :");
passwordTxt = new JPasswordField(20);
panel3 = new JPanel();
panel3.setLayout(new FlowLayout());
loginBtn = new JButton("Login", new
ImageIcon("images/key.gif"));
loginBtn.addActionListener(this);
exitBtn = new JButton("Exit", new
ImageIcon("images/Keys.gif"));
exitBtn.addActionListener(this);
panel1.add(nameLbl);
panel1.setOpaque(true);
panel2.add(userLbl);
panel2.add(userTxt);
panel2.add(passwordLbl);
panel2.add(passwordTxt);
panel2.setOpaque(true);
panel3.add(loginBtn);
panel3.add(exitBtn);
panel3.setOpaque(true);
frame = new JFrame("Hospital Managment");
frame.setSize(300,200);
Container pane = frame.getContentPane();
pane.setLayout(new BoxLayout(pane,
BoxLayout.Y_AXIS));
pane.add(panel1);
pane.add(panel2);
pane.add(panel3);
frame.setLocation((screen.width - 500)/2,((screen.height-
350)/2));
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source.equals(loginBtn))
{
String loginname,loginpass;
loginname = userTxt.getText().trim();
loginpass = passwordTxt.getText().trim();
if(loginname.equals("Cse") && loginpass.equals("hospital"))
{
dialogmessage = "Welcome - " +loginname;
dialogtype = JOptionPane.INFORMATION_MESSAGE;
JOptionPane.showMessageDialog((Component)null,
dialogmessage, dialogs, dialogtype);
userTxt.setText("");
new start();
setVisible(false);
frame.dispose();

}
else{
JOptionPane.showMessageDialog(null,"Invaild User name
and password" , "WARNING!!!",JOptionPane.INFORMATION_MESSAGE);
userTxt.setText("");
passwordTxt.setText("");
}

}
else if(source.equals(exitBtn))
{
System.exit(0);
}
}
public static void main(String[] args)
{
new main();
}
}

/*start.java*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;

class start extends JFrame implements ActionListener


{
JButton bpat,bdoc,bbill,breport,bback,bexit;
JLabel linfo,linfo1,linfo2,linfo3,linfo4;
start()
{
super("Hospital Management System");
setSize(1024,768);
setVisible(true);
setLayout(null);

linfo=new JLabel("SELECT THE APPROPRIATE OPTION");


linfo.setBounds(30,137,210,20);
add(linfo);

linfo1=new JLabel("1. For Inserting, Modifying, Retrieving Patients


related Data");
linfo1.setBounds(50,205,335,20);
add(linfo1);

linfo2=new JLabel("2. For Inserting, Modifying, Retrieving Doctors


related Data");
linfo2.setBounds(50,275,335,20);
add(linfo2);

linfo3=new JLabel("3. Billing Details");


linfo3.setBounds(50,345,150,20);
add(linfo3);

linfo4=new JLabel("4. Patient and Doctor related Data");


linfo4.setBounds(50,413,250,20);
add(linfo4);
bpat=new JButton("Patient", new
ImageIcon("images/Advances.png"));
bpat.setBounds(430,200,180,30);
add(bpat);

bdoc=new JButton("Doctor",new
ImageIcon("images/Advances.png"));
bdoc.setBounds(430,270,180,30);
add(bdoc);

bbill=new JButton("Billing",new
ImageIcon("images/Attendance.png"));
bbill.setBounds(430,340,180,30);
add(bbill);

breport=new JButton("Reports",new
ImageIcon("images/edit.png"));
breport.setBounds(430,408,180,30);
add(breport);

bback=new JButton("BACK" ,new


ImageIcon("images/preview_Hover.png"));
bback.setBounds(230,515,100,30);
add(bback);

bexit=new JButton("EXIT" ,new ImageIcon("images/exits.png"));


bexit.setBounds(730,515,100,30);
add(bexit);

bpat.addActionListener(new patient());
bdoc.addActionListener(new doctor());
bbill.addActionListener(new billing());
bexit.addActionListener(new exit());
bback.addActionListener(new back());
breport.addActionListener(new report());

public void actionPerformed(ActionEvent ae)


{}

class report implements ActionListener


{
public void actionPerformed(ActionEvent ae)
{
new Report();
setVisible(false);
}
};

class back implements ActionListener


{
public void actionPerformed(ActionEvent ae)
{
new main();
setVisible(false);
}
}

class patient implements ActionListener


{
public void actionPerformed(ActionEvent ae)
{
new patStart();
setVisible(false);
}
}

class doctor implements ActionListener


{
public void actionPerformed(ActionEvent ae)
{
new docStart();
setVisible(false);
}
}

class billing implements ActionListener


{
public void actionPerformed(ActionEvent ae)
{
new Billing();
setVisible(false);
}
}
class exit implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{
System.exit(0);
}
}

2. OUTPUT
6. References:

http://www.roseindia.net/java/example/java/applet/
http://www.realapplets.com/tutorial/
http://www.web-source.net/java_applet_tutorial.htm
www.w3schools.com

You might also like