Вы находитесь на странице: 1из 46

SUSHEEL

A
HOSPIT
AL
Submitted to: Submitted by:
Mr. Rahul Gupta Ankit Kumar
Enroll:

 Acknowledgement
 Introduction
 Flow chart
 Specialty of this Project
 Advantage of this Project
 Feedback of User
 Preview of Form Page
 Table Description
 Source Code
 Conclusion
ACKNOWLEDGEMENT
No task is a single man’s effort. Various factors, situations, and persons
integrate to provide the background for accomplishment of a task. Several
persons with whom we had interacted have contributed significantly to the
successful completion of the Project Study.

We are grateful to Mr. Rahul Gupta, friend for their sincere guidance and
valuable explanation of project task handling and execution. Most
importantly, it gives me great satisfaction to record my deep sense of
appreciation of excellent guidance and encouragement provided to me to
complete this project work.
INTRODUCTION
‘SUSHEELA’ is a hospital providing the general health services. The
information about the patients admitted in the hospital is maintained
properly.

As we know that there occurs a rapid growth because of the


widespread use of technology, which increased the efficiency and
helped in improving the performance of various health care
processes of the whole system. So, I have decided to prepare a
computer based patient record system includes all the elements that
facilitate the capture, storage, processing, communication, security,
and presentation of computer-based patient record information.
Flow Chart
Welcome Screen appears
Press Enter

Entry Frame appear


Select The Radio Button Option
Press The Cancel Button

1.Patient Information 2.Doctor


Information 3.Room Details

If Option2 If Option1
Selected Press The OK Button Selected

Doctor Information appears If Patient Information appears


Option3
Selected
Records Can Be Updated, Saved, Records Can Be Updated, Saved,
Deleted, Searched, Added Deleted, Searched, Added
Room Information frame
appears & collect the
Information from database
If(record) If(record)
Exists Exists
Press Back button to get
Back to Entry Frame
Display Doctor’s Detail Display Patient’s Detail

First, Next, Last Records can be First, Next, Last Records can be
searched searched

Press Back Button to Exit From Press Back Button to Exit From
Frame Frame

Back To Main Frame


Specialty of This Project
• All the information about the patients can be save,
delete and cancelled through Doctors/Patients records.

• Each related information is provided via a separate form page.

• If all the information have been filled and has saved also user
can get exit from the form.
ADVANTAGES OF CURRENT Project
 I have tried to remove the problems by using the language

Microsoft Access, Java and try to make my project error free as

far as possible:

 Patient’s details can be easily searched out through user as all

the options have their specific identification.

 Whenever user is working with this form he will be stress free to

load the form, he can easily interact with all the tools provided to

make it attractive.

 Each tool consists of exit option whenever user is misguiding in

the form he may click on exit button to get out from the form.
Feedback of user
• However I had tried to give my full attention to make my frame
window creative but a user should not have any difficulty in
using it.

• Some Times it will create a problem, when back-end will not be


connected properly, user may get the difficulties in save the
details of record.

• Sometimes User can found the difficulty in search, for the


patient, because the system updates the data records & with out
locking it may be difficult to keep records safely.

• Sometimes user can found the difficulties to print the


documents.
Preview of Form Page
Welcome Frame
Login Form
Information Form
Doctor Detail Frame
Staff Detail Frame
Patient DetailFrame
Table Description
For Login Table

For Doctor table


For Staff Detail

For Patient Detail


Source Code
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class hospital extends Frame implements ActionListener {
Connection con;
PreparedStatement ps;
ResultSet rs;
//-----------------------------------------------------------------------------------
static hospital k;
Font ffo,cc;
Panel P1,P2,P3;
Label l1,l2;
Button b1;
Frame welcome;
//--------------------------------------------------------------------------------------------
------------------------------------------
// Login Information
Panel P4,P5,P6,P7,P8,P9;
Font ft ,fg;
TextField textuname,textpassword;
Label l3,l4,l5;
Button b2,b3;
CheckboxGroup cg;
Checkbox c1,c2;
Frame login;
//--------------------------------------------------------------------------------------------
--------------------------------------
//--------------------------------------------------------------------------------------------
-------------------
// Information
Panel P10,P11,P12,P13;
Label l6;
Font gh,hj,jt;
Button B5,B6;
CheckboxGroup cu;
Checkbox c3,c4,c5;
Frame information;
//--------------------------------------------------------------------------------------------
--------------------

//--------------------------------------------------------------------------------------------
--------------------------
// Doctor Information
Panel P14,P15,P16,P17,P18,P19,P20;
TextField T4,T5,T6,T7,T8,T9;
Label L6,l7,l8,l9,l10,l11,l12,l13;
Button b4,b5,b6,b7,b13;
Choice ch9;
Font dd,gy,ko;
Frame doc;

//------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
--
//Staff Information
Panel P21,P22,P23,P24,P25,P26,P27;
Label l14,l15,l16,l17,l18;
Choice ch1;
Button b14,b15,b16,b17,b23;
TextField T10,T11,T12;
Frame stf;
Font mk,ni,dh;
//--------------------------------------------------------------------------------------------
-----

//--------------------------------------------------------------------------------------------
--------------
//Patient Information
Panel P28,P29,P30,P31,P32,P33,P34,P35,P36;
Label l19,l20,l21,l22,l23,l24,l25,l26,l27;
Choice ch2,ch3,ch4,ch5,ch6,ch7,ch8;
TextField T13,T14,T15,T16,T17;
Button b24,b25,b26,b27,b28,b29,b30,b31,b32,b33;
Frame ptf;
Font op,er,gc;
//--------------------------------------------------------------------------------------------
-----------------------
public hospital() {
ffo=new Font("TimesRoman",Font.BOLD,22);
cc=new Font("TimesRoman",Font.BOLD,10);
b1=new Button(" Ok ");
b1.setForeground(Color.blue);

b1.setFont(cc);
l1=new Label("Susheela Hospital");
l1.setFont(ffo);
l1.setForeground(Color.blue);
l2=new Label("Welocme you");
l2.setFont(ffo);
l2.setForeground(Color.blue);

P1=new Panel();
P2=new Panel();
P3=new Panel();
P1.add(l1);
P2.add(l2);
P3.setLayout(new GridLayout(2,1));
P3.add (P1);
P3.add (P2);
Panel fbut=new Panel();
fbut.add(b1);
Panel main=new Panel();
main.setLayout(new GridLayout(2,1));
main.add(P3);
main.add(fbut);
welcome= new Frame("Hospital Management");
welcome.add(main);
welcome.setBackground(Color.pink);
welcome.setSize(300,200);
welcome.setVisible(true);
b1.addActionListener(this);
}
public void login() {
ft =new Font("TimesRoman",Font.BOLD,22);
fg =new Font("TimesRoman",Font.BOLD,10);

b2=new Button(" Ok ");


b2.setForeground(Color.blue);
b2.addActionListener(this);
b3=new Button(" Cancel ");
b3.setForeground(Color.blue);
b3.addActionListener(this);
l3=new Label(" Login Information ");
l3.setForeground(Color.red);
l3.setFont(ft);
l4=new Label(" User Name ");
l4.setForeground(Color.blue);
l4.setFont(fg);
l5=new Label(" Password ");
l5.setForeground(Color.blue);
l5.setFont(fg);
P4=new Panel();
P5=new Panel();
P6=new Panel();
P7=new Panel();
P8=new Panel();
P9=new Panel();
textuname=new TextField(20);
textpassword=new TextField(20);
textpassword.setEchoChar('*');
cg=new CheckboxGroup();

c1=new Checkbox(" Admin ",cg,false);


c1.setFont(fg);

c2=new Checkbox(" Normal ",cg,false);


c2.setFont(fg);

P4.add(l3);
P5.setLayout(new GridLayout(3,2));
P5.add(l4);
P5.add(textuname);
P5.add(l5);
P5.add(textpassword);
P5.add(c1);
P5.add(c2);
P6.add(P5);
P7.add(b2);
b2.setFont(fg);
P7.add(b3);
b3.setFont(fg);
P8.setLayout(new GridLayout(3,1));
P8.setBackground(Color.pink);
P8.add(P4);
P8.add(P5);
P8.add(P7);
P9.add(P8);
login= new Frame(" Hospital Management ");
login.add(P9);
login.setSize(400,300);
login.setVisible(true);
login.setBackground(Color.pink);
}

public void information() {


gh=new Font("TimesRoman",Font.BOLD,22);
hj=new Font("TimesRoman",Font.BOLD,10);
jt=new Font("TimesRoman",Font.BOLD,12);

B5=new Button("Ok");
B5.setFont(hj);
B5.setForeground(Color.blue);
B5.addActionListener(this);
B6=new Button("Cancle");
B6.setForeground(Color.blue);
B6.setFont(hj);
B6.addActionListener(this);
l6= new Label("Select Information");
l6.setForeground(Color.blue);
l6.setFont(gh);
P10=new Panel();
P11=new Panel();
P12=new Panel();
P13=new Panel();
cu=new CheckboxGroup();
c3=new Checkbox("Doctor Information",cu,false);
c3.setFont(jt);
c4=new Checkbox("Staff Information",cu,false);
c4.setFont(jt);
c5=new Checkbox("Patient Information",cu,false);
c5.setFont(jt);
P10.add(l6) ;
P11.setLayout(new GridLayout(3,1));
P11.add(c3);
P11.add(c4);
P11.add(c5);
P12.add(B5);
P12.add(B6);
P13.setLayout(new GridLayout(5,1));
P13.add(P10);
P13.add(P11);
P13.add(P12);
P13.setBackground(Color.pink);
information= new Frame("Hospital Management");
information.add(P13);
information.setSize(400,300);
information.setVisible(true);
information.setBackground(Color.pink);
}
public void dinformation() {
dd=new Font("TimesRoman",Font.BOLD,22);
gy=new Font("TimesRoman",Font.BOLD,12);
ko=new Font("TimesRoman",Font.BOLD,10);
P14=new Panel();
P15=new Panel();
P16=new Panel();
P17=new Panel();
P18=new Panel();
P19=new Panel();
P20=new Panel();
b4=new Button("Add");
b4.setFont(ko);
b4.setForeground(Color.blue);
b4.addActionListener(this);
b5=new Button("Search");
b5.setForeground(Color.blue);
b5.setFont(ko);
b5.addActionListener(this);
b6=new Button("Save");
b6.setFont(ko);
b6.setForeground(Color.blue);
b6.addActionListener(this);
b7=new Button("Staff ");
b7.setFont(ko);
b7.setForeground(Color.blue);
b7.addActionListener(this);
b13=new Button("Cancle");
b13.setForeground(Color.blue);
b13.setFont(ko);
b13.addActionListener(this);
L6=new Label("Doctor Information") ;
L6.setForeground(Color.red);
L6.setFont(dd);
l7=new Label("Id No.") ;
l7.setForeground(Color.blue);

l7.setFont(gy);
l8=new Label("Name") ;
l8.setFont(gy);
l8.setForeground(Color.blue);

l9=new Label("Address") ;
l9.setFont(gy);
l9.setForeground(Color.blue);
l10=new Label("Qualification") ;
l10.setFont(gy);
l10.setForeground(Color.blue);
l11=new Label("Specilist") ;
l11.setFont(gy);
l11.setForeground(Color.blue);
l12=new Label("Experience") ;
l12.setFont(gy);
l12.setForeground(Color.blue);
l13=new Label("Contact No.");
l13.setFont(gy);
l13.setForeground(Color.blue);
ch9=new Choice();
T4=new TextField(20);
T5=new TextField(20);
T6=new TextField(20);
T7=new TextField(20);
T8=new TextField(20);
T9=new TextField(20);
P14.add(L6);
P15.setLayout(new GridLayout(7,2));
P15.add(l7);
P15.add( ch9);
P15.add(l8);
P15.add(T4);
P15.add(l9);
P15.add(T5);
P15.add(l10);
P15.add(T6);
P15.add(l11);
P15.add(T7);
P15.add(l12);
P15.add(T8);
P15.add(l13);
P15.add(T9);
P16.add(P15);
P17.setLayout(new GridLayout(1,5));
P17.add(b4);
P17.add(b5);
P17.add(b6);
P17.add(b7);
P17.add(b13);
P18.add(P17);
P19.setLayout(new GridLayout(3,1));
P19.add(P14);
P19.add(P16);
P19.add(P18);
P20.add(P19);
P20.setBackground(Color.pink);
doc = new Frame("Hospital Management");
doc.add(P20);
doc.setSize(400,500);
doc.setVisible(true);
doc.setBackground(Color.pink);
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",""
);
s=con.createStatement();
rs=s.executeQuery("select * from doctorinfo");
while(rs.next())
ch9.add(rs.getString(1).trim());
con.close();

} catch(Exception ee){System.out.println(ee);}

}
public void stinformation() {
mk=new Font("TimesRoman",Font.BOLD,22);
ni=new Font("TimesRoman",Font.BOLD,10);
dh=new Font("TimesRoman",Font.BOLD,12);

P21=new Panel();
P22=new Panel();
P23=new Panel();
P24=new Panel();
P25=new Panel();
P26=new Panel();
P27=new Panel();
l14=new Label(" Staff Information ") ;
l14.setFont(mk);
l14.setForeground(Color.red);
l15=new Label(" Id No .") ;
l15.setForeground(Color.blue);
l15.setFont(dh);
l16=new Label(" Name ") ;
l16.setForeground(Color.blue);
l16.setFont(dh);
l17=new Label(" Address ") ;
l17.setForeground(Color.blue);
l17.setFont(dh);
l18=new Label("Contact ") ;
l18.setForeground(Color.blue);
l18.setFont(dh);
T10 = new TextField(20);
T11=new TextField(20);
T12=new TextField(20);
ch1=new Choice();
b14=new Button("Add");
b14.setFont(ni);
b14.setForeground(Color.blue);
b14.addActionListener(this);
b15=new Button("Search");
b15.setFont(ni);
b15.setForeground(Color.blue);
b15.addActionListener(this);
b16=new Button("Save");
b16.setFont(ni);
b16.setForeground(Color.blue);
b16.addActionListener(this);
b17=new Button("Patient ");
b17.setFont(ni);
b17.setForeground(Color.blue);
b17.addActionListener(this);
b23=new Button("Cancle");
b23.setFont(ni);
b23.setForeground(Color.blue);
b23.addActionListener(this);
P21.add(l14);
P22.setLayout(new GridLayout(4,2));
P22.add(l15);
P22.add(ch1);
P22.add(l16);
P22.add(T10);
P22.add(l17);
P22.add(T11);
P22.add(l18);
P22.add(T12);
P23.add(P22);
P24.setLayout(new GridLayout(1,5));
P24.add(b14);
P24.add(b15);
P24.add(b16);
P24.add(b17);
P24.add(b23);
P25.add(P24);
Panel lpa=new Panel();
lpa=new Panel(new GridLayout(2,1));
lpa.add(P23);
lpa.add(P25);
P26.setLayout(new BorderLayout());
P26.add(P21,BorderLayout.NORTH);
P26.add(lpa,BorderLayout.CENTER);
//P26.add(P25,BorderLayout.CENTER);
P27.add(P26);
P27.setBackground(Color.pink);

stf = new Frame("Hospital Management");


stf.add(P27);
stf.setSize(400,500);
stf.setVisible(true);
stf.setBackground(Color.pink);
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",""
);
s=con.createStatement();
rs=s.executeQuery("select * from staffinfo");
while(rs.next())
ch1.add(rs.getString(1).trim());
con.close();

} catch(Exception ee){System.out.println(ee);}

public void pinformation() {


op=new Font("TimesRoman",Font.BOLD,22);
er=new Font("TimesRoman",Font.BOLD,10);
gc=new Font("TimesRoman",Font.BOLD,12);
P28=new Panel();
P29=new Panel();
P30=new Panel();
P31=new Panel();
P32=new Panel();
P33=new Panel();
P34=new Panel();
P35=new Panel();
P36=new Panel();
l19= new Label("Patient Information");
l19.setForeground(Color.red);
l19.setFont(op);
l20= new Label("Id No.");
l20.setForeground(Color.blue);
l20.setFont(gc);
l21= new Label("Name");
l21.setForeground(Color.blue);
l21.setFont(gc);
l22= new Label("Address");
l22.setFont(gc);
l22.setForeground(Color.blue);
l23= new Label("Disease");
l23.setFont(gc);
l23.setForeground(Color.blue);
l24= new Label("Admit Date");
l24.setFont(gc);
l24.setForeground(Color.blue);
l25= new Label("Discharge Date");
l25.setFont(gc);
l25.setForeground(Color.blue);
l26= new Label("Contact No.");
l26.setFont(gc);
l26.setForeground(Color.blue);
l27= new Label("Refer By");
l27.setFont(gc);
l27.setForeground(Color.blue);
T13 = new TextField();
T14=new TextField();
T15=new TextField();
T16=new TextField();
T17=new TextField();
b24=new Button("Add");
b24.setForeground(Color.blue);
b24.addActionListener(this);
b24.setFont(er);
b25=new Button("Search");
b25.setForeground(Color.blue);
b25.addActionListener(this);
b25.setFont(er);
b26=new Button("Save");
b26.setForeground(Color.blue);
b26.addActionListener(this);
b26.setFont(er);
b27=new Button("Information");
b27.setForeground(Color.blue);
b27.addActionListener(this);
b27.setFont(er);
b33=new Button("Cancle");
b33.setForeground(Color.blue);
b33.addActionListener(this);
b33.setFont(er);
ch2=new Choice();
ch3=new Choice();
for(int i=1;i<=31;i++) {
if(i<10)
ch3.addItem("0"+String.valueOf(i));
else
ch3.addItem(String.valueOf(i));
}
ch4=new Choice();
ch4.addItem("Jan");
ch4.addItem("Feb");
ch4.addItem("Mar");
ch4.addItem("Apr");
ch4.addItem("May");
ch4.addItem("Jun");
ch4.addItem("Jul");
ch4.addItem("Aug");
ch4.addItem("Sep");
ch4.addItem("Oct");
ch4.addItem("Nov");
ch4.addItem("Dec");
ch5=new Choice();
for(int i=1980;i<=2015;i++) {
ch5.addItem(String.valueOf(i));
}
ch6=new Choice();
for(int i=1;i<=31;i++) {
if(i<10)
ch6.addItem("0"+String.valueOf(i));
else
ch6.addItem(String.valueOf(i));

}
ch7=new Choice();
ch7.addItem("Jan");
ch7.addItem("Feb");
ch7.addItem("Mar");
ch7.addItem("Apr");
ch7.addItem("May");
ch7.addItem("Jun");
ch7.addItem("Jul");
ch7.addItem("Aug");
ch7.addItem("Sep");
ch7.addItem("Oct");
ch7.addItem("Nov");
ch7.addItem("Dec");

ch8=new Choice();
for(int i=1980;i<=2015;i++) {
ch8.addItem(String.valueOf(i));
}
P28.add(l19);
P30.setLayout(new GridLayout(1,3));
P30.add(ch3);
P30.add(ch4);
P30.add(ch5);
P31.setLayout(new GridLayout(1,3));
P31.add(ch6);
P31.add(ch7);
P31.add(ch8);

P29.setLayout(new GridLayout( 8,2));


P29.add(l20);
P29.add(ch2);
P29.add(l21);
P29.add(T13);
P29.add(l22);
P29.add(T14);
P29.add(l23);
P29.add(T15);
P29.add(l24);
P29.add(P30);
P29.add(l25);
P29.add(P31);
P29.add(l26);
P29.add(T16);
P29.add(l27);
P29.add(T17);
P32.add(P29);
P33.setLayout(new GridLayout(1,5));
P33.add(b24);
P33.add(b25);
P33.add(b26);
P33.add(b27);
P33.add(b33);
P34.add(P33);
P35.setLayout(new BorderLayout());
P35.add(P28,BorderLayout.NORTH);
P35.add(P32,BorderLayout.CENTER);
P35.add(P34,BorderLayout.SOUTH);
P36.add(P35);
P36.setBackground(Color.pink);

ptf= new Frame(" Hospital Management ");


ptf.add(P36);
ptf.setSize(400,500);
ptf.setVisible(true);
ptf.setBackground(Color.pink);
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",""
);
s=con.createStatement();
rs=s.executeQuery("select * from patientinfo");
while(rs.next())
ch2.add(rs.getString(1).trim());
con.close();

} catch(Exception ee){System.out.println(ee);
}
} public static void main(String[] args) {
k=new hospital();
}

public void actionPerformed(ActionEvent ae) {


if(ae.getSource()==b1) {
welcome.setVisible(false);
k.login();
}
if(ae.getSource()==b2) {
String ty="";
ty=cg.getSelectedCheckbox().getLabel();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps=con.prepareStatement("select * from logininfo where
usname=? and password=? and type=?");
ps.setString(1,textuname.getText().trim());
ps.setString(2,textpassword.getText().trim());
ps.setString(3,ty.trim());
rs=ps.executeQuery();
rs.next();
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
con.close();
login.setVisible(false);
k.information();
} catch(Exception ee) {
System.out.println("No record"+ty);
}
}//end of b2
if(ae.getSource()==b3) {
login.setVisible(false);
hospital j=new hospital();

}// end of b3
if(ae.getSource()==B5) {
if(cu.getSelectedCheckbox().getLabel().equals("Doctor
Information")) {
information.setVisible(false);
k.dinformation();
}

if(cu.getSelectedCheckbox().getLabel().equals("Staff
Information")) {
information.setVisible(false);
k.stinformation();
}
if(cu.getSelectedCheckbox().getLabel().equals("Patient
Information")) {
information.setVisible(false);
k.pinformation();
}

}//end of B5
if (ae.getSource()==B6) {
information.setVisible(false);
k.login();
}//end of B6

if(ae.getSource()==b5) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps=con.prepareStatement("select * from doctorinfo where
idno=?");
ps.setString(1,ch9.getSelectedItem().trim());
rs=ps.executeQuery();
rs.next();
T4.setText(rs.getString(2));
T5.setText(rs.getString(3));
T6.setText(rs.getString(4));
T7.setText(rs.getString(5));
T8.setText(rs.getString(6));
T9.setText(rs.getString(7));
con.close();
} catch(Exception ee) {
System.out.println("No record");

}
}//end of b5
if(ae.getSource()==b4) {
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
s=con.createStatement();
rs=s.executeQuery("select count(*) from doctorinfo");
rs.next();
int coun=rs.getInt(1);
coun++;
ch9.removeAll();
ch9.add(String.valueOf(coun));
con.close();
} catch(Exception ee) {
System.out.println("No record");

}
T4.setText("");
T5.setText("");
T6.setText("");
T7.setText("");
T8.setText("");
T9.setText("");
} // end of b4
if(ae.getSource()==b6) {

int check=0;
if (T4.getText().equals("")) {
System.out.println("Doctor name is invalid");
check=1;
} else if (T5.getText().equals("")) {
System.out.println("Doctor address is invalid");
check=1;
} else if (T6.getText().equals("")) {
System.out.println("Doctor qualification is invalid");
check=1;
} else if (T7.getText().equals("")) {
System.out.println("Doctor speciilist is invalid");
check=1;
} else if (T8.getText().equals("")) {
System.out.println("Doctor experience is invalid");
check=1;
} else if (T9.getText().equals("")) {
System.out.println("Doctor contact no is invalid");
check=1;
}

if(check==0) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","
","");
ps= con.prepareStatement("insert into doctorinfo
values(?,?,?,?,?,?,?)");
ps.setString(1,ch9.getSelectedItem().trim());
ps.setString(2,T4.getText().trim());
ps.setString(3,T5.getText().trim());
ps.setString(4,T6.getText().trim());
ps.setString(5,T7.getText().trim());
ps.setString(6,T8.getText().trim());
ps.setString(7,T9.getText().trim());
ps.executeUpdate();
System.out.println("Record Update");
con.close();
}

catch(Exception ee) {
System.out.println("No record"+ee);

}
}
}//end of b6
if(ae.getSource()==b7) {
doc.setVisible(false);
k.stinformation();

}// end of b7

if(ae.getSource()==b13) {
doc.setVisible(false);
k.information();
}// end of b13
if(ae.getSource()==b14) {
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
s=con.createStatement();
rs=s.executeQuery("select count(*) from staffinfo");
rs.next();
int coun=rs.getInt(1);
coun++;
ch1.removeAll();
ch1.add(String.valueOf(coun));
con.close();
} catch(Exception ee) {
System.out.println("No record");
}
T10.setText("");
T11.setText("");
T12.setText("");
}// end of b14
if(ae.getSource()==b15) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps=con.prepareStatement("select * from staffinfo where
id_no=?");
ps.setString(1,ch1.getSelectedItem().trim());
rs=ps.executeQuery();
rs.next();
T10.setText(rs.getString(2));
T11.setText(rs.getString(3));
T12.setText(rs.getString(4));
con.close();
} catch(Exception ee) {
System.out.println("No record");

}
}//end of b15
if(ae.getSource()==b16) {

int check=0;
if (T10.getText().equals("")) {
System.out.println("Staff name is invalid");
check=1;
} else if (T11.getText().equals("")) {
System.out.println("Staff address is invalid");
check=1;
} else if (T12.getText().equals("")) {
System.out.println("Contact no is invalid");
check=1;
}

if(check==0) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps= con.prepareStatement("insert into staffinfo
values(?,?,?,?)");
ps.setString(1,ch1.getSelectedItem().trim());
ps.setString(2,T10.getText().trim());
ps.setString(3,T11.getText().trim());
ps.setString(4,T12.getText().trim());
ps.executeUpdate();
System.out.println("Record Update");
con.close();
}

catch(Exception ee) {
System.out.println("No record"+ee);

}
}

}//end of b16
if(ae.getSource()==b17) {
stf.setVisible(false);
k.pinformation();

}// end of b17

if(ae.getSource()==b23) {
stf.setVisible(false);
k.dinformation();
}//end of b23
if(ae.getSource()==b24) {
try {
Statement s;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
s=con.createStatement();
rs=s.executeQuery("select count(*) from patientinfo");
rs.next();
int coun=rs.getInt(1);
coun++;
ch2.removeAll();
ch2.add(String.valueOf(coun));
con.close();
} catch(Exception ee) {
System.out.println("No record");
}
T13.setText("");
T14.setText("");
T15.setText("");
T16.setText("");
T17.setText("");
}// end of b24
if(ae.getSource()==b25) {
try {
String dd,mm,yy,dat;
String dd1,mm1,yy1,dat1;
dd=mm=yy=dat="";
dd1=mm1=yy1=dat1="";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps=con.prepareStatement("select * from patientinfo where
id_nopt=?");
ps.setString(1,ch2.getSelectedItem().trim());
rs=ps.executeQuery();
rs.next();
T13.setText(rs.getString(2));
T14.setText(rs.getString(3));
T15.setText(rs.getString(4));
dat=rs.getString(5);
dat1=rs.getString(6);
T16.setText(rs.getString(7));
T17.setText(rs.getString(8));
dd=dat.substring(0,2).trim();
mm=dat.substring(3,6).trim();
yy=dat.substring(7,11).trim();
System.out.println(dd+" \n "+mm+"\n"+yy);
ch3.select(dd);
ch4.select(mm);
ch5.select(yy);
dd1=dat1.substring(0,2).trim();
mm1=dat1.substring(3,6).trim();
yy1=dat1.substring(7,11).trim();
System.out.println(dd1+" \n "+mm1+"\n"+yy1);
ch6.select(dd1);
ch7.select(mm1);
ch8.select(yy1);
con.close();
} catch(Exception ee) {
System.out.println("No record");

}
}//end of b25
if(ae.getSource()==b26)
{
String AD=ch3.getSelectedItem().trim()
+"-"+ch4.getSelectedItem().trim()+"-"+ch5.getSelectedItem().trim();
String DD=ch6.getSelectedItem().trim()
+"-"+ch7.getSelectedItem().trim()+"-"+ch8.getSelectedItem().trim();

int check=0;
if (T13.getText().equals("")) {
System.out.println("Patient name is invalid");
check=1;
} else if (T14.getText().equals("")) {
System.out.println("Patient address is invalid");
check=1;
} else if (T15.getText().equals("")) {
System.out.println("Disease is invalid");
check=1;
}
else if (T16.getText().equals("")) {
System.out.println("Contact no is invalid");
check=1;
}
else if (T17.getText().equals("")) {
System.out.println("Refer By is invalid");
check=1;
}
if(check==0) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:hospitald","",
"");
ps= con.prepareStatement("insert into patientinfo
values(?,?,?,?,?,?,?,?)");
ps.setString(1,ch2.getSelectedItem().trim());
ps.setString(2,T13.getText().trim());
ps.setString(3,T14.getText().trim());
ps.setString(4,T15.getText().trim());
ps.setString(5,AD.trim());
ps.setString(6,DD.trim());
ps.setString(7,T16.getText().trim());
ps.setString(8,T17.getText().trim());
ps.executeUpdate();
System.out.println("Record Update");
con.close();
}

catch(Exception ee) {
System.out.println("No record"+ee);

}
}

}//end of b26
if(ae.getSource()==b27) {
ptf.setVisible(false);
k.information();

}// end of b27

if(ae.getSource()==b33) {
ptf.setVisible(false);
k.stinformation();
}//end of b33
}//end of action Performed

}
CONCLUSION
At last, I want to say that I made my full efforts to compile this
project free from errors as far as possible. This project is only for
removing the user difficulty. Restrictions are applied at user only for
removing error of calculation. My efforts are been successful with
the help of “Faculty” .I am so hope fully awaited that all my efforts
which I have applied to compile this e-project shall be much
appreciated.

Вам также может понравиться