Reort Final
Reort Final
1.Title
2: Introduction & Objective
;. Tools/Platform, Hardware and Software Requirement
4. Analysis
-ER Diagram
-DFD
-Data Dictionary
5. Modules
Process logic of each modules
6. Screen
-Input
-Reports
7. Coding
8. Validation Checks
9.Testing
10.Conclusion
11.Future Scope
12.Bibliography
TITLE
HOSPITAL
MANAGEMENT
SYSTEM
INTRODUCTION & OBJECTIVE
INTRODUCTION
The Hospital Management System is a comprehensive software solution designed to
streamline and automate various administrative and operational tasks within a hospital
or healthcare facility. This project aims to develop a user-friendly and efficient system
using Java programming language, which will provide hospitals with a centralized
platform to manage their daily operations effectively.
OBJECTIVE
This main objective of the system is to computerize the maintenance of the patient
details and billing section in the hospital. It also includes the details about the laboratory
checkups. The primary objective of the HOSPITAL MANAGEMENT SYSTEM are as
follows:
2.Enhance Patient Care: The project aims to improve the overall quality of patient care
by providing healthcare professionals with easy access to accurate and up-to-date
patient information.
5.Ensure Data Security and Privacy: Data security and patient privacy are paramount
in healthcare systems.
6.Provide Comprehensive Reporting and Analytics: The Hospital Management
System project aims to provide comprehensive reporting and analytics capabilities.
TOOLS AND PLATFORMS
Software Requirements
Hardware Requirements
The application will run on a Windows operating system with the following
specifications:
-
Hospital
User Management System Cloud Side
2. FIRST LEVEL DFD
INTRODUCTION
Testing is the process of executing a program with the intent of finding errors. It
is a major quality measure employed during software development. During testing,
the program is executed with a set of conditions known as test cases, and the
output is evaluated to determine whether the program is performing as expectation the
programmer. Testing is the process of executing a program with the intent of finding
errors.
TESTING OBJECTIVES
• Testing is the process of executing a program with the intent of finding an error.
• A successful test uncovers a yet undiscovered error.
• A good test case has a high probability of finding errors if it exists.
• The tests are inadequate to detect possibly present errors.
LEVELS OF TESTING
To uncover the errors, present in different phases we have the concept of levels
of things. The basic levels of testing are
• Interface errors
• Errors in a data structure or external database access
• Performance errors
• Initialization and termination errors.
• In this testing only output is checked for correctness. The logical flow of data
is not checked.
3. WHITE BOX TESTING
In this the test cases are generated on the logic of each module by drawing flow
• graphs of that module and logical decisions are tested on all the cases.
• It has been used to generate the testcases in the following cases:
• Guarantee that all independent paths have been executed.
• Execute all logical decisions on their true and false sides.
• Execute all loops at their boundaries and within their operational bounds.
• Execute internal data structure to ensure their validity.
4. INTEGRATION TESTING
Integration testing ensures that the software and the subsystems work together as a
whole. It tests the interface of the entire module to make sure that the modules behave
properly
when integrated.
5. SYSTEM TESTING
System testing involves in-house testing of the entire system before delivery to the user.
It aims to satisfy the user that the system meets all requirements of the
client’s specifications.
8. OUTPUT TESTING
After performing validation testing, the nextstep is output testing of the proposed system
since no system could be useful if it does not produce the required specified format.. The
output format on the screen is found to be correct as the format was designed in the system
design phase according to the user’s needs. For the hard copy also output comes as the
specified requirements by the users. Hence output testing does not result in any corrections in
the system.
Bibliography
Indexpage.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
index()
{
f=new JFrame ("Index page");
f.setBackground(Color.WHITE);
f.setLayout(null);
bt1=new JButton("Doctor");
bt1.setBounds(50,390,150,40);
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
l1.add(bt1);
bt2=new JButton("Patient");
bt2.setBounds(220,390,150,40);
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.white);
l1.add(bt2);
bt3=new JButton("Receptionist");
bt3.setBounds(50,450,150,40);
bt3.setBackground(Color.BLACK);
bt3.setForeground(Color.white);
l1.add(bt3);
bt4=new JButton("Admin");
bt4.setBounds(220,450,150,40);
bt4.setBackground(Color.BLACK);
bt4.setForeground(Color.white);
l1.add(bt4);
bt1.addActionListener(this);
bt2.addActionListener(this);
bt3.addActionListener(this);
bt4.addActionListener(this);
f.setSize(800,570);
f.setLocation(300,100);
f.setVisible(true);
f.setResizable(false);
}
public void actionperformed (ActionEvent ae)
{
if(ae.getSource()==bt1)
{
f.setVisible(false);
new loginpage();
}
if(ae.getSource()==bt2)
{
f.setVisible(false);
new loginpage();
}
if(ae.getSource()==bt3)
{
f.setVisible(false);
new loginpage();
}
if(ae.getSource()==bt4)
{
f.setVisible(false);
new loginpage();
}
}
public static void main(String[] args)
{
new index();
}
Loginpage.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
JFrame f;
JPanel panel;
JLabel l1, l2, l3, l4;
JTextField tf;
JPasswordField pf;
JButton bt1, bt2;
loginpage() {
f = new JFrame("loginpage");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1 = new JLabel();
l1.setBounds(0, 0, 580, 350);
l1.setLayout(null);
l3 = new JLabel("Username:");
l3.setBounds(180, 120, 150, 30);
l3.setFont(new Font("Airal", Font.BOLD, 20));
l3.setForeground(Color.BLACK);
l1.add(l3);
l4 = new JLabel("Password:");
l4.setBounds(180, 170, 150, 30);
l4.setFont(new Font("Airal", Font.BOLD, 20));
l4.setForeground(Color.BLACK);
l1.add(l4);
tf = new JTextField();
tf.setBounds(310, 120, 150, 30);
l1.add(tf);
pf = new JPasswordField();
pf.setBounds(310, 170, 150, 30);
l1.add(pf);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(580, 350);
f.setLocation(300, 100);
f.setResizable(false);
}
if(rs.next())
{
// System.out.println("login");
String adminname=rs.getString("name");
new adminhomepage(adminname).setVisible(true);
f.setVisible(false);
}
else
{
JOptionPane.showMessageDialog(null,"you have entered
wrong username and password !");
f.setVisible(false);
f.setVisible(true);
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(ae.getSource()==bt2)
{
this.f.setVisible(false);
new index();
}
public static void main(String[] args)
{
new loginpage();
}
}
Adminhomepage.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
adminhomepage(String adminname)
{
super("admin homepage");
setLocation(0,0);
setSize(1500,730);
men1.add(ment1);
men1.add(ment2);
men2.add(ment3);
men2.add(ment4);
men3.add(ment5);
men3.add(ment6);
men4.add(ment7);
men4.add(ment8);
men5.add(ment9);
men5.add(ment10);
men8.add(ment14);
m1.add(men1);
m1.add(men2);
m1.add(men3);
m1.add(men4);
m1.add(men5);
m1.add(men8);
men1.setFont(f);
men2.setFont(f);
men3.setFont(f);
men4.setFont(f);
men5.setFont(f);
men8.setFont(f);
ment1.setFont(f1);
ment2.setFont(f1);
ment3.setFont(f1);
ment4.setFont(f1);
ment5.setFont(f1);
ment6.setFont(f1);
ment7.setFont(f1);
ment8.setFont(f1);
ment9.setFont(f1);
ment10.setFont(f1);
ment14.setFont(f1);
m1.setBackground(Color.BLACK);
men1.setForeground(Color.GRAY);
men2.setForeground(Color.GRAY);
men3.setForeground(Color.GRAY);
men4.setForeground(Color.GRAY);
men5.setForeground(Color.GRAY);
men8.setForeground(Color.RED);
ment1.setForeground(Color.YELLOW);
ment3.setForeground(Color.YELLOW);
ment5.setForeground(Color.YELLOW);
ment7.setForeground(Color.YELLOW);
ment9.setForeground(Color.YELLOW);
ment14.setForeground(Color.ED);
ment1.setBackground(Color.BLACK);
ment3.setBackground(Color.BLACK);
ment5.setBackground(Color.BLACK);
ment7.setBackground(Color.BLACK);
ment9.setBackground(Color.BLACK);
ment14.setBackground(Color.BLACK);
ment1.addActionListener(this);
ment2.addActionListener(this);
ment3.addActionListener(this);
ment4.addActionListener(this);
ment5.addActionListener(this);
ment6.addActionListener(this);
ment7.addActionListener(this);
ment8.addActionListener(this);
ment9.addActionListener(this);
ment10.addActionListener(this);
ment14.addActionListener(this);
setJMenuBar (m1);
add (m1);
}
}
AddDoctor.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
;
import java.util.Random;
AddDoctor()
{
f = new JFrame("Add Doctor");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
t2=new JTextField();
t2.setBounds(600,150,150,30);
l1.add(t2);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
l1.add(t3);
t4=new JTextField();
t4.setBounds(600,200,150,30);
l1.add(t4);
t5=new JTextField();
t5.setBounds(200,250,150,30);
l1.add(t5);
t7=new JTextField();
t7.setBounds(200,300,150,30);
l1.add(t7);
t8=new JTextField();
t8.setBounds(600,300,150,30);
l1.add(t8);
t9=new JTextField();
t9.setBounds(200,350,150,30);
l1.add(t9);
t10=new JTextField();
t10.setBounds(600,350,150,30);
l1.add(t10);
t12=new JTextField();
t12.setBounds(600,450,120,30);
l1.add(t12);
t13=new JTextField();
t13.setBounds(200,400,150,30);
l1.add(t13);
t14=new JTextField();
t14.setBounds(200,450,150,30);
l1.add(t14);
bt1=new JButton("Submit");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
public void actionperformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String password=t3.getText();
String dob=t4.getText();
String address=t5.getText();
String phone=t6.getText();
String email=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String clinic=t12.getText();
String jod=t13.getText();
String splz=t14.getText();
String avl="yes";
Random r= new Random();
String doc_l1=""+Math.abs(r.nextInt() % 100000);
try
{
connectionclass obj = new connectionclass();
String q = "insert into doctor
values('"doc_l1"',"+name+"','"+username+"','"+password"','"+dob+"','"
+address+"','"+phone+"','"+email"','"+city+"','"+gender+"','"+blood"','"
+age+"','"+clinic+"','"+jod+"','"+splz+"','"+avl")";
obj.stm.executeUpdate(q);
JOptionPane . showMessageDialog(null,"Details
Successfully Inserted");
f.setVisible(false);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
}
public static void main(String[] args)
{
new AddDoctor();
}
}
Viewdoctor.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public class viewdoctor extends JFrame
implements ActionListener
{
String x[]={"Name"
,"Username","DOB","ADDRESS","PHONE","EMAIL",
"CITY","GENDER","BLOOD GROUP","AGE","CLINIC
NO.",
"JOINING
DATE","SPCIALIZATION","AVAILABILITY"};
JButton bt,bt1;
Stringy[][]=new String[20][14];
inti=0,j=0;
JTablet;
JLabell1,l2;
JTextField tf1;
JPanel p1,p2,p3;
Font f,f1;
viewdoctor()
{
super("Doctor Information");
setSize(1500,400);
setLocation(1,1);
try
{
connectionclass obj=new connectionclass();
String q="Select * from doctor";
ResultSet rest=obj.stm.executeQuery(q);
while(rest.next())
{
y[i][j++]=rest.getString("name");
y[i][j++]=rest.getString("username");
y[i][j++]=rest.getString("dob");
y[i][j++]=rest.getString("address");
y[i][j++]=rest.getString("phone");
y[i][j++]=rest.getString("email");
y[i][j++]=rest.getString("city");
y[i][j+
+]=rest.getString("gender"); y[i]
[j++]=rest.getString("blood");
y[i][j++]=rest.getString("age");
y[i][j++]=rest.getString("clinic_no");
y[i][j++]=rest.getString("joining_date");
y[i][j++]=rest.getString("specialization");
y[i][j++]=rest.getString("availability");
i++;
j=0;
}
t=new JTable(y,x);
t.setFont(f);
t.setBackground(Color.BLACK);
t.setForeground(Color.WHITE);
}
catch(Exception ex)
{
ex.printStackTrace();
}
JScrollPane sp=new JScrollPane(t);
l1.setForeground(Color.GRAY);
l2.setForeground(Color.YELLOW);
l1.setFont(f);
l2.setFont(f1);
bt.setBackground(Color.BLACK);
bt1.setBackground(Color.BLACK);
bt.setForeground(Color.WHITE);
bt1.setForeground(Color.WHITE);
tf1=new JTextField();
tf1.setFont(f);
p1=new JPanel();
p1.setLayout(new GridLayout(1,1,10,10));
p1.add(l2);
p2=new JPanel();
p2.setLayout(new GridLayout(1,4,10,10));
p2.add(l1);
p2.add(tf1);
p2.add(bt);
p2.add(bt1);
p3=new JPanel();
p3.setLayout(new GridLayout(2,1,10,10));
p3.add(p1);
p3.add(p2);
p1.setBackground(Color.BLACK);
p2.setBackground(Color.BLACK);
p3.setBackground(Color.BLACK);
add(p3,"South");
add(sp);
}
public void actionPerformed(ActionEvent ae)
{
String username=tf1.getText();
if(ae.getSource()==bt)
{
try
{
connectionclass obj1=new connectionclass();
String q="delete from doctor
where username='"+username+"'";
obj1.stm.executeUpdate(q);
String q2="update appointment
set appointment_ststus='cancel'where
doctor
_username='"+username+"'and appointment_status='open'";
obj1.stm.executeUpdate(q);
setVisible(false);
}
}
catch(Exception e)
{
e.printStackTrace();
}
if(ae.getSource()==bt1)
{
if(username.isEmpty())
{
JOptionPane.showMessageDialog(null, "Please fill
the doctor username !");
}
else
{
setVisible(false);
new EditDoctor(username).setVisible(true);
}
}
}
public static void main(String[] args)
{
new viewdoctor().setVisible(true);
}
}
output
EditDoctor.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
EditDoctor(String username)
{
try
{
connectionclass obj= new connectionclass();
String q="select * from doctor where
username='"+username+"'";
ResultSet rest=obj.stm.executeQuery(q);
if(rest0.next())
{
f = new JFrame("Edit Doctor");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
try
{
connectionclass obj= new connectionclass();
String q="select * from doctor
where username='"+username+"'";
ResultSet rest()=obj.stm.executeQuery(q);
while(rest.next())
{
t1=new JTextField();
t1.setBounds(200,150,150,30);
t1.setText(rest.getString("name"));
l1.add(t1);
t2=new JTextField();
t2.setBounds(600,150,150,30);
t2.setText(rest.getString("username"));
t2.setEditable(false);
l1.add(t2);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
t3.setText(rest.getString("password"));
t3.setEditable(false);
l1.add(t3);
t4=new JTextField();
t4.setBounds(600,200,150,30);
t4.setText(rest.getString("dob"));
l1.add(t4);
t5=new JTextField();
t5.setBounds(200,250,150,30);
t5.setText(rest.getString("address"));
l1.add(t5);
t6=new JTextField();
t6.setBounds(600,250,150,30);
t6.setText(rest.getString("phone"));
l1.add(t6);
t7=new JTextField();
t7.setBounds(200,300,150,30);
t7.setText(rest.getString("email"));
l1.add(t7);
t8=new JTextField();
t8.setBounds(600,300,150,30);
t8.setText(rest.getString("city"));
l1.add(t8);
t9=new JTextField();
t9.setBounds(200,350,150,30);
t9.setText(rest.getString("gender"));
l1.add(t9);
t10=new JTextField();
t10.setBounds(600,350,150,30);
t10.setText(rest.getString("blood"));
l1.add(t10);
t11=new JTextField();
t11.setBounds(600,400,150,30);
t11.setText(rest.getString("age"));
l1.add(t11);
t12=new JTextField();
t12.setBounds(600,450,120,30);
t12.setText(rest.getString("clinic_n0"));
l1.add(t12);
t13=new JTextField();
t13.setBounds(200,400,150,30);
t13.setText(rest.getString("joiningP_date"))
; l1.add(t13);
t14=new JTextField();
t14.setBounds(200,450,150,30);
t14.setText(rest.getString("specialization"))
; l1.add(t14);
}
}
catch(Exception ee)
{
ee.printStackTrace();
}
bt1=new JButton("Update");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
else
{
JOptionPane.showMessageDialog(null,"record not
found,please fill the right doctor username!");
this.setVisible(false);
}
}
catch(Exception exx)
{
exx.printStackTrace();
}
}
public void actionperformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String dob=t4.getText();
String address=t5.getText();
String phone=t6.getText();
String email=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String clinic=t12.getText();
String jod=t13.getText();
String splz=t14.getText();
try
{
connectionclass obj = new
connectionclass() String q2="update doctor set
name='"+name+"',dob='"+dob+"',address='"+address+"',phone
='"+phone+"',email='"+email"',city='"+city+"',gender='"+gende
r+"',blood='"+blood"',age='"+age+"',clinic_no='"+clinic+"',join
ing_date='"+jod+"',specialization='"+splz+"',availablity='"+avl
+"' where username='"+username+"'";
obj.stm.executeUpdate(q2);
JOptionPane . showMessageDialog(null,"Details
Successfully updated");
f.setVisible(false);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
• Add Patient
addpatient.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Random;
{
JFrame f;
JLabell1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16;
JTextField t1,t2,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
JPasswordField t3;
JButton bt1,bt2;
addpatient()
{
f = new JFrame("Add Patient");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
l1.setIcon(img1);
l2.setBounds(280,30,500,50);
l2.setFont(new Font("Airal",Font.BOLD,30));
l2.setForeground(Color.BLACK);
l1.add(l2);
f.add(l1);
l3.setForeground(Color.BLACK);
l1.add(l3);
t1=new JTextField();
t1.setBounds(200,150,150,30);
l1.add(t1);
l4.setBounds(450,150,200,30);
l4.setFont(new Font("Airal",Font.BOLD,20));
l4.setForeground(Color.BLACK);
l1.add(l4);
t2=new JTextField();
t2.setBounds(600,150,150,30);
l1.add(t2);
l5=new JLabel ("Password");
l5.setBounds(50,200,100,30);
l5.setFont(new Font("Airal",Font.BOLD,20));
l5.setForeground(Color.BLACK);
l1.add(l5);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
l1.add(t3);
l6.setForeground(Color.BLACK);
l1.add(l6);
t4=new JTextField();
t4.setBounds(600,200,150,30);
l1.add(t4);
l7.setBounds(50,250,150,30);
l7.setFont(new Font("Airal",Font.BOLD,20));
l7.setForeground(Color.BLACK);
l1.add(l7);
t5=new JTextField();
t5.setBounds(200,250,150,30);
l1.add(t5);
l8=new JLabel ("Phone");
l8.setBounds(450,250,100,30);
l8.setFont(new Font("Airal",Font.BOLD,20));
l8.setForeground(Color.BLACK);
l1.add(l8);
t6=new JTextField();
t6.setBounds(600,250,150,30);
l1.add(t6);
l9.setBounds(50,300,150,30);
l9.setFont(new Font("Airal",Font.BOLD,20));
l9.setForeground(Color.BLACK);
l1.add(l9);
t7=new JTextField();
t7.setBounds(200,300,150,30);
l1.add(t7);
l10.setForeground(Color.BLACK);
l1.add(l10);
t8=new JTextField();
t8.setBounds(600,300,150,30);
l1.add(t8);
l11=new JLabel ("Gender");
l11.setBounds(50,350,100,30);
l11.setFont(new Font("Airal",Font.BOLD,20));
l11.setForeground(Color.BLACK);
l1.add(l11);
t9=new JTextField();
t9.setBounds(200,350,150,30);
l1.add(t9);
l12.setBounds(450,350,140,30);
l12.setFont(new Font("Airal",Font.BOLD,20));
l12.setForeground(Color.BLACK);
l1.add(l12);
t10=new JTextField();
t10.setBounds(600,350,150,30);
l1.add(t10);
l1.add(l13);
t11=new JTextField();
t11.setBounds(600,400,150,30);
l1.add(t11);
l14=new JLabel ("Deceased");
l14.setBounds(450,450,150,30);
l14.setFont(new Font("Airal",Font.BOLD,20));
l14.setForeground(Color.BLACK);
l1.add(l14);
t12=new JTextField();
t12.setBounds(600,450,120,30);
l1.add(t12);
l15.setBounds(50,400,120,30);
l15.setFont(new Font("Airal",Font.BOLD,20));
l15.setForeground(Color.BLACK);
l1.add(l15);
t13=new JTextField();
t13.setBounds(200,400,150,30);
l1.add(t13);
l16.setBounds(50,450,140,30);
l16.setFont(new Font("Airal",Font.BOLD,20));
l16.setForeground(Color.BLACK);
l1.add(l16);
t14=new JTextField();
t14.setBounds(200,450,150,30);
l1.add(t14);
bt1=new JButton("Submit");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
public void actionPerformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String password=t3.getText();
String email=t4.getText();
String fname=t5.getText();
String phone=t6.getText();
String material_status=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String deceased=t12.getText();
String address=t13.getText();
String dob=t14.getText();
try
{
connectionclass obj = new connectionclass();
String q = "insert into patient
values('"+pat_id+"','"+name+"','"+username+"','"+password"','"+email+"','"+fname+"','"+pho
ne+"','"+material_status"','"+city+"','"+gender+"','"+blood"','"+age+"','"+deceased+"','"+addre
ss+"','"+dob+"')";
obj.stm.executeUpdate(q);
JOptionPane . showMessageDialog(null,"Patient Details Successfully Inserted");
f.setVisible(false);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
}
public static void main(String[] args)
{
new addpatient();
}
}
Viewpatient.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
viewpatient()
{
super("Patient Information");
setSize(1500,400);
setLocation(1,1);
try
{
connectionclass obj=new connectionclass();
String q="Select * from patient";
ResultSet
rest=obj.stm.executeQuery(q);
while(rest.next())
{
y[i][j++]=rest.getString("name");
y[i][j++]=rest.getString("username");
y[i][j++]=rest.getString("email");
y[i][j++]=rest.getString("father_name");
y[i][j++]=rest.getString("phone");
y[i][j++]=rest.getString("material_status");
y[i][j++]=rest.getString("city");
y[i][j++]=rest.getString("gender");
y[i][j++]=rest.getString("blood");
y[i][j++]=rest.getString("age");
y[i][j++]=rest.getString("dob");
y[i][j+
+]=rest.getString("deceased"); y[i]
[j++]=rest.getString("address");
i++;
j=0;
}
t=new JTable(y,x);
t.setFont(f);
t.setBackground(Color.BLACK)
;
t.setForeground(Color.WHITE);
}
catch(Exception ex)
{
ex.printStackTrace();
}
JScrollPane sp=new JScrollPane(t);
l1.setForeground(Color.GRAY);
l2.setForeground(Color.YELLOW);
l1.setFont(f);
l2.setFont(f1);
bt.setBackground(Color.BLACK);
bt1.setBackground(Color.BLACK);
bt.setForeground(Color.WHITE);
bt1.setForeground(Color.WHITE)
;
tf1=new JTextField();
tf1.setFont(f);
p1=new JPanel();
p1.setLayout(new GridLayout(1,1,10,10));
p1.add(l2);
p2=new JPanel();
p2.setLayout(new GridLayout(1,4,10,10));
p2.add(l1);
p2.add(tf1);
p2.add(bt);
p2.add(bt1);
p3=new JPanel();
p3.setLayout(new GridLayout(2,1,10,10));
p3.add(p1);
p3.add(p2);
p1.setBackground(Color.BLACK);
p2.setBackground(Color.BLACK);
p3.setBackground(Color.BLACK);
add(p3,"South");
add(sp);
}
public void actionPerformed(ActionEvent ae)
{
String username=tf1.getText();
if(ae.getSource()==bt)
{
try
{
connectionclass obj1=new connectionclass();
String q="delete from patient
where username='"+username+"'";
obj1.stm.executeUpdate(q);
setVisible(false);
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(ae.getSource()==bt1)
{
if(username.isEmpty())
{
JOptionPane.showMessageDialog(null,
"Please fill the patient username !");
}
else
{
setVisible(false);
new Editpatient(username).setVisible(true);
}
}
}
public static void main(String[]
args) {
new viewpatient().setVisible(true);
}
}
}
}
ACKNOWLEDGEMENT
We are sincerely indebted to Ms. ADITI who extended valuable guidance, constant
encouragement and help through various difficult stages for the completion of the project.
Thankyou for introducing add on subject which made our work even easier. We would
also thank our faculty members without whom this project would have been distant reality.
At
end, we want to thank our family, friends and relatives for their positive criticism and
needful support
CERTIFICATE
This is to certify that the project report on
“HOSPITAL MANAGEMENT SYSTEM”
By
Department of BCA
Vidya Institute of Creative Teaching
2024-2025
Editpatient.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
{
JFrame f;
JLabell1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16;
JTextField t1,t2,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
JPasswordField t3;
JButton bt1,bt2;
Editpatient(String username)
{
try
{
connectionclass obj= new connectionclass();
String q="select * from patient where username='"+username+"'";
ResultSet rest0=obj.stm.executeQuery(q);
if(rest0.next())
{
f = new JFrame("Edit Patient");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
l2.setBounds(280,30,500,50);
l2.setFont(new Font("Airal",Font.BOLD,30));
l2.setForeground(Color.BLACK);
l1.add(l2);
f.add(l1);
l1.add(l3);
l4.setBounds(450,150,200,30);
l4.setFont(new Font("Airal",Font.BOLD,20));
l4.setForeground(Color.BLACK);
l1.add(l4);
l5.setBounds(50,200,100,30);
l5.setFont(new Font("Airal",Font.BOLD,20));
l5.setForeground(Color.BLACK);
l1.add(l5);
l6.setForeground(Color.BLACK);
l1.add(l6);
l7.setBounds(50,250,100,30);
l7.setFont(new Font("Airal",Font.BOLD,20));
l7.setForeground(Color.BLACK);
l1.add(l7);
l8.setForeground(Color.BLACK);
l1.add(l8);
l9.setBounds(50,300,100,30);
l9.setFont(new Font("Airal",Font.BOLD,20));
l9.setForeground(Color.BLACK);
l1.add(l9);
l10.setForeground(Color.BLACK);
l1.add(l10);
l11.setForeground(Color.BLACK);
l1.add(l11);
l12.setBounds(450,350,140,30);
l12.setFont(new Font("Airal",Font.BOLD,20));
l12.setForeground(Color.BLACK);
l1.add(l12);
l13=new JLabel ("Age");
l13.setBounds(450,400,100,30);
l13.setFont(new Font("Airal",Font.BOLD,20));
l13.setForeground(Color.BLACK);
l1.add(l13);
l14.setBounds(450,450,150,30);
l14.setFont(new Font("Airal",Font.BOLD,20));
l14.setForeground(Color.BLACK);
l1.add(l14);
l15.setBounds(50,400,120,30);
l15.setFont(new Font("Airal",Font.BOLD,20));
l15.setForeground(Color.BLACK);
l1.add(l15);
l16.setBounds(50,450,140,30);
l16.setFont(new Font("Airal",Font.BOLD,20));
l16.setForeground(Color.BLACK);
l1.add(l16);
try
{
connectionclass obj1= new connectionclass();
String q1="select * from patient where username='"+username+"'";
ResultSet rest=obj1.stm.executeQuery(q1);
while(rest.next())
{
t1=new JTextField();
t1.setBounds(200,150,150,30);
t1.setText(rest.getString("name"));
l1.add(t1);
t2=new JTextField();
t2.setBounds(600,150,150,30);
t2.setText(rest.getString("username"));
t2.setEditable(false);
l1.add(t2);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
t3.setText(rest.getString("password"));
t3.setEditable(false);
l1.add(t3);
t4=new JTextField();
t4.setBounds(600,200,150,30);
t4.setText(rest.getString("email"));
l1.add(t4);
t5=new JTextField();
t5.setBounds(200,250,150,30);
t5.setText(rest.getString("fname"));
l1.add(t5);
t6=new JTextField();
t6.setBounds(600,250,150,30);
t6.setText(rest.getString("phone"));
l1.add(t6);
t7=new JTextField();
t7.setBounds(200,300,150,30);
t7.setText(rest.getString("material_status"));
l1.add(t7);
t8=new JTextField();
t8.setBounds(600,300,150,30);
t8.setText(rest.getString("city"));
l1.add(t8);
t9=new JTextField();
t9.setBounds(200,350,150,30);
t9.setText(rest.getString("gender"));
l1.add(t9);
t10=new JTextField();
t10.setBounds(600,350,150,30);
t10.setText(rest.getString("blood"));
l1.add(t10);
t11=new JTextField();
t11.setBounds(600,400,150,30);
t11.setText(rest.getString("age"));
l1.add(t11);
t12=new JTextField();
t12.setBounds(600,450,120,30);
t12.setText(rest.getString("deceased"));
l1.add(t12);
t13=new JTextField();
t13.setBounds(200,400,150,30);
t13.setText(rest.getString("address"));
l1.add(t13);
t14=new JTextField();
t14.setBounds(200,450,150,30);
t14.setText(rest.getString("dob"));
l1.add(t14);
}
catch(Exception ee)
{
ee.printStackTrace();
}
bt1=new JButton("Update");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
else
{
}
}
catch(Exception exx)
{
exx.printStackTrace();
}
}
public void actionPerformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String email=t4.getText();
String fname=t5.getText();
String phone=t6.getText();
String material_status=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String deceased=t12.getText();
String address=t13.getText();
String dob=t14.getText()
try
{
connectionclass obj = new connectionclass();
String q2="update patient set
name='"+name+"',email='"+email+"',father_name='"+fname+"',phone='"+phone+"',material
status='"+material_status+"',city='"+city+"',gender='"+gender+"',blood
group='"+blood+"',age='"+age+"',deceased='"+deceased+"',address='"+address+"',date of
birth='"+dob+"' where username='"+username+"'";
obj.stm.executeUpdate(q2);
JOptionPane . showMessageDialog(null,"Details Successfully Updated");
f.setVisible(false);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
}
}
addreceptionist.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Random;
{
JFrame f;
JLabell1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16;
JTextField t1,t2,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
JPasswordField t3;
JButton bt1,bt2;
addreceptionist()
{
f = new JFrame("Add Receptionist");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
l2.setBounds(280,30,500,50);
l2.setFont(new Font("Airal",Font.BOLD,30));
l2.setForeground(Color.BLACK);
l1.add(l2);
f.add(l1);
l3.setForeground(Color.BLACK);
l1.add(l3);
t1=new JTextField();
t1.setBounds(200,150,150,30);
l1.add(t1);
l4.setBounds(450,150,200,30);
l4.setFont(new Font("Airal",Font.BOLD,20));
l4.setForeground(Color.BLACK);
l1.add(l4);
t2=new JTextField();
t2.setBounds(600,150,150,30);
l1.add(t2);
l5.setBounds(50,200,100,30);
l5.setFont(new Font("Airal",Font.BOLD,20));
l5.setForeground(Color.BLACK);
l1.add(l5);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
l1.add(t3);
l1.add(l6);
t4=new JTextField();
t4.setBounds(600,200,150,30);
l1.add(t4);
l7.setBounds(50,250,150,30);
l7.setFont(new Font("Airal",Font.BOLD,20));
l7.setForeground(Color.BLACK);
l1.add(l7);
t5=new JTextField();
t5.setBounds(200,250,150,30);
l1.add(t5);
l1.add(l8);
t6=new JTextField();
t6.setBounds(600,250,150,30);
l1.add(t6);
l9.setBounds(50,300,150,30);
l9.setFont(new Font("Airal",Font.BOLD,20));
l9.setForeground(Color.BLACK);
l1.add(l9);
t7=new JTextField();
t7.setBounds(200,300,150,30);
l1.add(t7);
l10.setForeground(Color.BLACK);
l1.add(l10);
t8=new JTextField();
t8.setBounds(600,300,150,30);
l1.add(t8);
l1.add(l11);
t9=new JTextField();
t9.setBounds(200,350,150,30);
l1.add(t9);
l12.setBounds(450,350,140,30);
l12.setFont(new Font("Airal",Font.BOLD,20));
l12.setForeground(Color.BLACK);
l1.add(l12);
t10=new JTextField();
t10.setBounds(600,350,150,30);
l1.add(t10);
l13.setForeground(Color.BLACK);
l1.add(l13);
t11=new JTextField();
t11.setBounds(600,400,150,30);
l1.add(t11);
l14.setBounds(450,450,150,30);
l14.setFont(new Font("Airal",Font.BOLD,20));
l14.setForeground(Color.BLACK);
l1.add(l14);
t12=new JTextField();
t12.setBounds(600,450,150,30);
l1.add(t12);
l15.setBounds(50,400,120,30);
l15.setFont(new Font("Airal",Font.BOLD,20));
l15.setForeground(Color.BLACK);
l1.add(l15);
t13=new JTextField();
t13.setBounds(200,400,150,30);
l1.add(t13);
l16.setBounds(50,450,140,30);
l16.setFont(new Font("Airal",Font.BOLD,20));
l16.setForeground(Color.BLACK);
l1.add(l16);
t14=new JTextField();
t14.setBounds(200,450,150,30);
l1.add(t14);
bt1=new JButton("Submit");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
public void actionPerformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String password=t3.getText();
String email=t4.getText();
String fname=t5.getText();
String phone=t6.getText();
String qualification=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String jod=t12.getText();
String address=t13.getText();
String dob=t14.getText();
Random r= new Random();
String res_id=""+Math.abs(r.nextInt() % 10000;
try
{
connectionclass obj = new connectionclass();
String q = "insert into receptionist
values('"+res_id+"','"+name+"','"+username+"','"+password+"','"+email+"','"+fname+"','"+ph
one+"','"+qualification+"','"+city+"','"+gender+"','"+blood+"','"+age+"','"+jod+"','"+address+"
','"+dob+"')";
obj.stm.executeUpdate(q);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
}
public static void main(String[] args)
{
new addreceptionist();
}
}
viewreceptionist.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
JButton bt,bt1;
Stringy[][]=new String[20][13];
inti=0,j=0;
JTablet;
JLabel l1,l2;
JTextField tf1;
JPanel p1,p2,p3;
Font f,f1;
viewreceptionist()
{
super("Receptionist Information");
setSize(1500,400);
setLocation(1,1);
try
{
connectionclass obj=new connectionclass();
while(rest.next())
{
y[i][j++]=rest.getString("name");
y[i][j++]=rest.getString("username");
y[i][j++]=rest.getString("email");
y[i][j++]=rest.getString("father_name");
y[i][j++]=rest.getString("phone");
y[i][j++]=rest.getString("qualification");
y[i][j++]=rest.getString("city");
y[i][j++]=rest.getString("gender");
y[i][j++]=rest.getString("blood");
y[i][j++]=rest.getString("age");
y[i][j++]=rest.getString("joining_date");
y[i][j++]=rest.getString("address");
y[i][j++]=rest.getString("dob");
i++;
j=0;
}
t=new JTable(y,x);
t.setFont(f);
t.setBackground(Color.BLACK);
t.setForeground(Color.WHITE);
}
catch(Exception ex)
{
ex.printStackTrace();
}
JScrollPane sp=new JScrollPane(t);
f1=new Font("Lucida Fax",Font.BOLD,25);
l2.setHorizontalAlignment(JLabel.CENTER);
l1.setForeground(Color.GRAY);
l2.setForeground(Color.YELLOW);
l1.setFont(f);
l2.setFont(f1);
bt.addActionListener(this);
bt1.addActionListener(this);
bt.setBackground(Color.BLACK);
bt1.setBackground(Color.BLACK);
bt.setForeground(Color.WHITE);
bt1.setForeground(Color.WHITE);
tf1=new JTextField();
tf1.setFont(f);
p1=new JPanel();
p1.setLayout(new GridLayout(1,1,10,10));
p1.add(l2);
p2=new JPanel();
p2.setLayout(new GridLayout(1,4,10,10));
p2.add(l1);
p2.add(tf1);
p2.add(bt);
p2.add(bt1);
p3=new JPanel();
p3.setLayout(new GridLayout(2,1,10,10));
p3.add(p1);
p3.add(p2);
p1.setBackground(Color.BLACK);
p2.setBackground(Color.BLACK);
p3.setBackground(Color.BLACK);
add(p3,"South");
add(sp);
}
public void actionPerformed(ActionEvent ae)
{
String username=tf1.getText();
if(ae.getSource()==bt)
{
try
{
connectionclass obj1=new connectionclass();
String q="delete from receptionist where username='"+username+"'";
obj1.stm.executeUpdate(q);
setVisible(false);
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(ae.getSource()==bt1)
{
if(username.isEmpty())
{
JOptionPane.showMessageDialog(null, "Please fill the receptionist username !");
else
{
setVisible(false);
new Editreceptionist(username).setVisible(true);
}
}
}
public static void main(String[] args)
{
new viewreceptionist().setVisible(true);
}
}
Editreceptionist.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
{
JFrame f;
JLabell1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16;
JTextField t1,t2,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
JPasswordField t3;
JButton bt1,bt2;
Editreceptionist(String username)
{
try
{
connectionclass obj= new connectionclass();
String q="select * from receptionist where username='"+username+"'";
ResultSet rest0=obj.stm.executeQuery(q);
if(rest0.next())
{
f = new JFrame("Edit Receptionist");
f.setBackground(Color.WHITE);
f.setLayout(null);
l1=new JLabel();
l1.setBounds(0, 0, 900, 600);
l1.setLayout(null);
l2.setBounds(280,30,500,50);
l2.setFont(new Font("Airal",Font.BOLD,30));
l2.setForeground(Color.BLACK);
l1.add(l2);
f.add(l1);
l1.add(l3);
l4.setBounds(450,150,200,30);
l4.setFont(new Font("Airal",Font.BOLD,20));
l4.setForeground(Color.BLACK);
l1.add(l4);
l5.setBounds(50,200,100,30);
l5.setFont(new Font("Airal",Font.BOLD,20));
l5.setForeground(Color.BLACK);
l1.add(l5);
l6.setForeground(Color.BLACK);
l1.add(l6);
l7.setBounds(50,250,100,30);
l7.setFont(new Font("Airal",Font.BOLD,20));
l7.setForeground(Color.BLACK);
l1.add(l7);
l8.setForeground(Color.BLACK);
l1.add(l8);
l9.setBounds(50,300,100,30);
l9.setFont(new Font("Airal",Font.BOLD,20));
l9.setForeground(Color.BLACK);
l1.add(l9);
l10.setForeground(Color.BLACK);
l1.add(l10);
l11.setForeground(Color.BLACK);
l1.add(l11);
l12.setBounds(450,350,140,30);
l12.setFont(new Font("Airal",Font.BOLD,20));
l12.setForeground(Color.BLACK);
l1.add(l12);
l13=new JLabel ("Age");
l13.setBounds(450,400,100,30);
l13.setFont(new Font("Airal",Font.BOLD,20));
l13.setForeground(Color.BLACK);
l1.add(l13);
l14.setBounds(450,450,150,30);
l14.setFont(new Font("Airal",Font.BOLD,20));
l14.setForeground(Color.BLACK);
l1.add(l14);
l15.setBounds(50,400,120,30);
l15.setFont(new Font("Airal",Font.BOLD,20));
l15.setForeground(Color.BLACK);
l1.add(l15);
l16.setBounds(50,450,140,30);
l16.setFont(new Font("Airal",Font.BOLD,20));
l16.setForeground(Color.BLACK);
l1.add(l16);
try
{
connectionclass obj1= new connectionclass();
String q1="select * from patient where username='"+username+"'";
ResultSet rest=obj1.stm.executeQuery(q1);
while(rest.next())
{
t1=new JTextField();
t1.setBounds(200,150,150,30);
t1.setText(rest.getString("name"));
l1.add(t1);
t2=new JTextField();
t2.setBounds(600,150,150,30);
t2.setText(rest.getString("username"));
t2.setEditable(false);
l1.add(t2);
t3=new JPasswordField();
t3.setBounds(200,200,150,30);
t3.setText(rest.getString("password"));
t3.setEditable(false);
l1.add(t3);
t4=new JTextField();
t4.setBounds(600,200,150,30);
t4.setText(rest.getString("email"));
l1.add(t4);
t5=new JTextField();
t5.setBounds(200,250,150,30);
t5.setText(rest.getString("father_name"));
l1.add(t5);
t6=new JTextField();
t6.setBounds(600,250,150,30);
t6.setText(rest.getString("phone"));
l1.add(t6);
t7=new JTextField();
t7.setBounds(200,300,150,30);
t7.setText(rest.getString("qualification"));
l1.add(t7);
t8=new JTextField();
t8.setBounds(600,300,150,30);
t8.setText(rest.getString("city"));
l1.add(t8);
t9=new JTextField();
t9.setBounds(200,350,150,30);
t9.setText(rest.getString("gender"));
l1.add(t9);
t10=new JTextField();
t10.setBounds(600,350,150,30);
t10.setText(rest.getString("blood"));
l1.add(t10);
t11=new JTextField();
t11.setBounds(600,400,150,30);
t11.setText(rest.getString("age"));
l1.add(t11);
t12=new JTextField();
t12.setBounds(600,450,120,30);
t12.setText(rest.getString("joining_date"));
l1.add(t12);
t13=new JTextField();
t13.setBounds(200,400,150,30);
t13.setText(rest.getString("address"));
l1.add(t13);
t14=new JTextField();
t14.setBounds(200,450,150,30);
t14.setText(rest.getString("dob"));
l1.add(t14);
}
catch(Exception ee)
{
ee.printStackTrace();
}
bt1=new JButton("Update");
bt1.setBackground(Color.BLACK);
bt1.setForeground(Color.white);
bt1.setBounds(250,500,150,40);
l1.add(bt1);
bt2=new JButton("Cancel");
bt2.setBackground(Color.BLACK);
bt2.setForeground(Color.WHITE);
bt2.setBounds(450,500,150,40);
l1.add(bt2);
bt1.addActionListener(this);
bt2.addActionListener(this);
f.setVisible(true);
f.setSize(900,600);
f.setLocation(300, 100);
}
else
{
}
}
catch(Exception exx)
{
exx.printStackTrace();
}
}
public void actionPerformed (ActionEvent e)
{
if(e.getSource()==bt1)
{
String name=t1.getText();
String username=t2.getText();
String email=t4.getText();
String fname=t5.getText();
String phone=t6.getText();
String qualification=t7.getText();
String city=t8.getText();
String gender=t9.getText();
String blood=t10.getText();
String age=t11.getText();
String joining_date=t12.getText();
String address=t13.getText();
String dob=t14.getText();
try
{
connectionclass obj = new connectionclass();
String q2="update Receptionist set
name='"+name+"',email='"+email+"',father_name='"+fname+"',phone='"+phone+"',qalificati
on='"+qualification+"',city='"+city+"',gender='"+gender+"',blood
group='"+blood+"',age='"+age+"',joining_date='"+joining_date+"',address='"+address+"',date
of birth='"+dob+"' where username='"+username+"'";
obj.stm.executeUpdate(q2);
JOptionPane . showMessageDialog(null,"Details Successfully updated");
f.setVisible(false);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
if(e.getSource()==bt2)
{
f.setVisible(false);
}
}
}
addappointment.java
package hospital;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Random;
{
Font f,f1;
JLabell1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12;
JPanel p1,p2,p3;
JButton bt1,bt2,bt3;
Choice ch,ch1,ch2;
String q;
addappointment()
{
super("Add Appointment");
setLocation(450,10);
setSize(740,730);
f=new Font("Airal",Font.BOLD,25);
f1=new Font("Airal",Font.BOLD,18);
ch=new Choice();
ch1=new Choice();
ch2=new Choice();
ch2.add("10AM");
ch2.add("11AM");
ch2.add("12AM");
ch2.add("2PM");
ch2.add("3PM");
ch2.add("4PM");
ch2.add("5PM");
try
{
connectionclass obj=new connectionclass();
while(rest.next())
{
ch.add(rest.getString("username"));
}
catch(Exception ex)
{
ex.printStackTrace();
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
t11=new JTextField();
t12=new JTextField();
t1.setEditable(false);
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
t6.setEditable(false);
t7.setEditable(false);
t8.setEditable(false);
t9.setEditable(false);
t10.setEditable(false);
bt2=new JButton("Back");
bt3=new JButton("Check");
bt1.addActionListener(this);
bt2.addActionListener(this);
bt3.addActionListener(this);
bt1.setBackground(Color.BLUE);
bt2.setBackground(Color.RED);
bt3.setBackground(Color.BLACK);
bt1.setForeground(Color.WHITE);
bt2.setForeground(Color.WHITE);
bt3.setForeground(Color.WHITE);
l1.setHorizontalAlignment(JLabel.CENTER);
l1.setFont(f);
l2.setFont(f1);
l3.setFont(f1);
l4.setFont(f1);
l5.setFont(f1);
l6.setFont(f1);
l7.setFont(f1);
l8.setFont(f1);
l9.setFont(f1);
l10.setFont(f1);
l11.setFont(f1);
l13.setFont(f1);
l14.setFont(f1);
l15.setFont(f1);
l16.setFont(f1);
l17.setFont(f1);
l18.setFont(f1);
ch.setFont(f1);
ch1.setFont(f1);
ch2.setFont(f1);
t1.setFont(f1);
t2.setFont(f1);
t3.setFont(f1);
t4.setFont(f1);
t5.setFont(f1);
t6.setFont(f1);
t7.setFont(f1);
t8.setFont(f1);
t9.setFont(f1);
t10.setFont(f1);
t11.setFont(f1);
t12.setFont(f1);
bt1.setFont(f1);
bt2.setFont(f1);
bt3.setFont(f1);
p1=new JPanel();
p1.setLayout(new GridLayout(1,1,10,10));
p1.add(l1);
p2=new JPanel();
p2.setLayout(new GridLayout(17,2,10,10));
p2.add(l2);
p2.add(ch);
p2.add(l3);
p2.add(t1);
p2.add(l4);
p2.add(t2);
p2.add(l5);
p2.add(t3);
p2.add(l6);
p2.add(t4);
p2.add(l7);
p2.add(t5);
p2.add(l8);
p2.add(t6);
p2.add(l9);
p2.add(t7);
p2.add(l10);
p2.add(t8);
p2.add(l11);
p2.add(t9);
p2.add(l13);
p2.add(t10);
p2.add(l14);
p2.add(t11);
p2.add(l15);
p2.add(bt3);
p2.add(l16);
p2.add(ch1);
p2.add(l17);
p2.add(t12);
p2.add(l18);
p2.add(ch2);
p2.add(bt1);
p2.add(bt2);
p3=new JPanel();
p3.setLayout(new GridLayout(1,1,10,10));
p3.add(l12);
setLayout(new BorderLayout(10,10));
add(p1,"North");
add(p2,"Center");
add(p3,"West");
ch.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent arg0)
{
try
{
connectionclass obj2=new connectionclass();
String username=ch.getSelectedItem();
String q1="select * from patient where username='"+username+"'";
ResultSet rest1=obj2.stm.executeQuery(q1);
while(rest1.next())
t1.setText(rest1.getString("name"));
t2.setText(rest1.getString("email"));
t3.setText(rest1.getString("father_name"));
t4.setText(rest1.getString("phone"));
t5.setText(rest1.getString("material_status"));
t6.setText(rest1.getString("city"));
t7.setText(rest1.getString("gender"));
t8.setText(rest1.getString("blood"));
t9.setText(rest1.getString("age"));
t10.setText(rest1.getString("dob"));
t11.setText(rest1.getString("deceased"));
}
}
catch(Exception exx)
{
exx.printStackTrace();
}
}
});
}
{
if(e.getSource()==bt3)
{
ch1.removeAll();
try
{
connectionclass obj3=new connectionclass();
while(rest4.next())
{
ch1.add(rest4.getString("username"));
}
}
catch(Exception ee)
{
ee.printStackTrace();
}
}
if(e.getSource()==bt1)
{
String username=ch.getSelectedItem();
String name=t1.getText();
String email=t2.getText();
String fname=t3.getText();
String phone=t4.getText();
String mstatus=t5.getText();
String city=t6.getText();
String gender=t7.getText();
String blood=t8.getText();
String age=t9.getText();
String deceased=t10.getText();
String dob=t11.getText();
String doctor=ch1.getSelectedItem();
String app_date=t12.getText();
String app_time=ch2.getSelectedItem();
String app_status="Open";
Random r=new Random();
String app_id=""+Math.abs(r.nextInt() % 100000);
try
{
connectionclass obj3=new connectionclass();
if(aa==1)
{
JOptionPane.showMessageDialog(null, "your appointment successfully
booked");
this.setVisible(false);
}
else
{
JOptionPane.showMessageDialog(null,"please!,fill all details carefully");
}
}
catch(Exception ee)
{
ee.printStackTrace();
}
}
if(e.getSource()==bt2);
{
this.setVisible(false);
}
}
public static void main(String[] args)
{
new addappointment().setVisible(true);
}
}
Data Dictionary
Indexpage
Login page
Adminhomepage
Adddoctor
Viewdoctor
Addpatient
Viewpatient
Addreceptionist
Viewreceptionist
Addappointment