Professional Documents
Culture Documents
Hospital Management System
Hospital Management System
Hospital Management System
SUBMITTED BY
Name: PIYUSH RUSTAGI Class:XII-B
JAVA
Acknowledgement
At the outset, I am offering gratitude to my guide, who gave me great insight into what had to be done, and for their encouragement, without which it couldnt have been possible to complete this project. I am indicated to my friends for help me to prepare this project and for several useful suggestions. I would also like to thank to every one of the organization who helped me in preparing this project and who guided me and gave me many useful suggestions by time to time in resolving difficulties. I hope that my efforts on the project will fully satisfy experts who will examine this project. And I pray god to give me success and brilliance in the field of computer. Its my first opportunity by DIVINE HAPPY SCHOOL ,PASCHIM
VIHARi, New Delhi-59.
, So very thankful to give me first golden occasion in my life. And I will be eager to work on various projects in the future.
JAVA
Certificate
This is to certify that PIYUSH RUSTAGI ,student of class XII-B of divine happy senior secondary school, new delhi, has completed .The project file under my supervision.He has taken proper care and shown atmost sincerity in completation of this project. I certify that his project is upto my expectations and as per the guidelines issued by CBSE.
NAME
: Mrs.RUCHI
JAVA
1. Title Page 2. Acknowledgements 3. Contents 4. List of tables 5. List of figures 6. Introduction 7.Coding 8. Summary and conclusions
JAVA
List of tables
Each Module in the Hospital Management table whose data structure is given below. (A) New Patient table (B) Doctor Table (C) Login table
The following tables give the details and attributes of each table------
(A). New Patient table Name Patient id Patient Name Address Phone Diseases Doctor Null? Not Null Not Null Not Null Not Null Not Null Not Null Key Primary Type Number (5) Varchar(20) Varchar(20) Number (5) Varchar(20) Number
(B) Doctor Tabel Name Id Doctor Name Address Phone Spacilist. Null? Not Null Not Null Not Null Not Null Not Null Key Primary Type Number (5) Varchar(20) Varchar(20) date Number (5)
JAVA (c) Login Tabel Name Username Password Null? Not Null Not Null
Key Primary
JAVA
7.List of figures
1.Login Page
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmLogin.java * * Created on Dec 28, 2010, 12:04:12 AM */ package hospitalmanagement; /** * * @author Administrator */ public class frmLogin extends javax.swing.JFrame { /** Creates new form frmLogin */ public frmLogin() { initComponents(); } /** This method is called from within the constructor to * initialize the form.
JAVA
* WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtUserId = new java.awt.TextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); txtPassword = new javax.swing.JPasswordField(); lblmsg = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(51, 0, 0)); jLabel1.setText("User Id"); jLabel2.setText("Password"); jButton1.setText("Login"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Exit"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); lblmsg.setForeground(new java.awt.Color(51, 0, 0));
JAVA
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE) .addComponent(jButton1) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(32, 32, 32)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtPassword, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtUserId, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE))) .addContainerGap(55, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(164, Short.MAX_VALUE) .addComponent(lblmsg) .addGap(194, 194, 194)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(lblmsg) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
JAVA
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addContainerGap()) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(txtUserId.getText().equals("admin") && txtPassword.getText().equals("admin")) { frmMain frm=new frmMain(); frm.show(); this.setVisible(false); } else { lblmsg.setText("Invalid UserID/Password ! Please Try Again"); } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.setVisible(false);
JAVA
} /**
* @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmLogin().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel lblmsg; private javax.swing.JPasswordField txtPassword; private java.awt.TextField txtUserId; // End of variables declaration }
JAVA
2.Doctor Page:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmDoctor.java * * Created on Dec 27, 2010, 11:48:27 PM */ package hospitalmanagement; /** * * @author Administrator
JAVA
*/ import java.sql.*;
public class frmDoctor extends javax.swing.JFrame { /** Creates new form frmDoctor */ static public final String connection ="jdbc:mysql://localhost:3306/hospital"; static public final String user = "root"; static public final String password = "root"; Connection con; public frmDoctor() { initComponents(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(connection,user,password); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtId = new java.awt.TextField(); jLabel2 = new javax.swing.JLabel();
JAVA
String[] { "Eye", "Heart", "Nose", " ", " " })); jButton1.setText("New"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });
JAVA
jButton2.setText("Save"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Update"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Delete"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton5.setText("Close"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap()
JAVA
nt.LEADING) .addComponent(jLabel2) .addComponent(jLabel1) .addComponent(jLabel3) .addComponent(jLabel4) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELAT ED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Align ment.LEADING, false) .addComponent(txtPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE) .addComponent(txtAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE) .addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtDoctor, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE) .addComponent(cmbSpecialist, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R ELATED) .addComponent(jButton2) .addGap(18, 18, 18) .addComponent(jButton3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R ELATED) .addComponent(jButton4) .addGap(18, 18, 18) .addComponent(jButton5)) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE))
JAVA
nt.LEADING) .addComponent(jLabel1) .addComponent(txtId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELAT ED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel2) .addComponent(txtDoctor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELAT ED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel3) .addComponent(txtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELAT ED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel4)
JAVA
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNREL ATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.LEADING) .addComponent(jLabel5) .addComponent(cmbSpecialist, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignme nt.BASELINE) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jButton3) .addComponent(jButton4) .addComponent(jButton5)) .addGap(19, 19, 19) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(48, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
JAVA
} private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("insert into Doctor(DoctorName,Address,Phone,Specialist) values('" + txtDoctor.getText() + "', '" + txtAddress.getText() + "', '"+txtPhone.getText()+"','"+cmbSpecialist.getName()+"')" ); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); } }
JAVA
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(lst.getSelectedItem()==null) { return; } try { Statement st=con.createStatement(); st.execute("delete from Doctor where DoctorName='"+lst.getSelectedItem()+"'"); getList();
} catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("Update Doctor set DoctorName='"+txtDoctor.getText() +"',Address='"+txtAddress.getText()+"',Phone='"+txtPhone.getText() +"',Specialist='"+cmbSpecialist.getName()+"' where DoctorName='"+lst.getSelectedItem()+"'"); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); }
JAVA
} void getList(){ try{ lst.removeAll();
Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Doctor order by DoctorName"); while(rs.next()){ lst.add(rs.getString("DoctorName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmDoctor().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JComboBox cmbSpecialist; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4;
JAVA
private javax.swing.JLabel jLabel5; private java.awt.List lst; private java.awt.TextField txtAddress; private java.awt.TextField txtDoctor; private java.awt.TextField txtId; private java.awt.TextField txtPhone; // End of variables declaration }
3.Patient Page:
JAVA
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmPatient.java * * Created on Dec 28, 2010, 1:59:45 AM */ package hospitalmanagement; /** * * * @author Administrator */ import java.sql.*;
JAVA
static public final String connection ="jdbc:mysql://localhost:3306/hospital"; static public final String user = "root"; static public final String password = "root"; Connection con; /** Creates new form frmPatient */ public frmPatient() { initComponents(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(connection,user,password); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txtId = new javax.swing.JTextField(); txtPatientName = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); txtAddress = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); txtPhone = new javax.swing.JTextField();
JAVA
org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setText("ID"); getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 44, -1, -1)); jLabel2.setText("Patient Name"); getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 81, -1, -1)); getContentPane().add(txtId, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 44, 89, -1)); getContentPane().add(txtPatientName, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 75, 242, -1)); jLabel3.setText("Address"); getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 119, -1, -1)); getContentPane().add(txtAddress, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 113, 242, -1)); jLabel4.setText("Phone"); getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 151, -1, -1)); getContentPane().add(txtPhone, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 151, 242, -1));
JAVA
jLabel5.setText("Disease");
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 195, -1, -1)); getContentPane().add(txtDisease, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 189, 242, -1)); jLabel6.setText("Doctor"); getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 233, -1, -1)); getContentPane().add(cmbDoctor, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 227, 242, -1)); jButton1.setText("New"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 266, -1, -1)); jButton2.setText("Save"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(179, 266, -1, -1)); jButton3.setText("Close"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } });
JAVA
org.netbeans.lib.awtextra.AbsoluteConstraints(246, 266, -1, -1)); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { int id=1; Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select max(id)+1 from patient"); if(rs.next()) { id=rs.getInt(1); } txtId.setText(Integer.toString(id)); } catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("insert into Patient(patientName,Address,Phone,Disease,Doctor) values('" + txtPatientName.getText() + "', '" + txtAddress.getText() + "', '"+txtPhone.getText()+"','"+txtDisease.getText()+"','"+cmbDoctor.getName()+"')" );
JAVA
catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } /** * @param args the command line arguments */ void getList(){ try{ cmbDoctor.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Doctor order by DoctorName"); while(rs.next()){ cmbDoctor.add(rs.getString("DoctorName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmPatient().setVisible(true); } });
JAVA
}
// Variables declaration - do not modify private java.awt.Choice cmbDoctor; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JTextField txtAddress; private javax.swing.JTextField txtDisease; private javax.swing.JTextField txtId; private javax.swing.JTextField txtPatientName; private javax.swing.JTextField txtPhone; // End of variables declaration }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmBilling.java * * Created on Dec 28, 2010, 2:09:33 AM */ package hospitalmanagement; /** * * @author Administrator */ import java.sql.*; public class frmBilling extends javax.swing.JFrame { static public final String connection ="jdbc:mysql://localhost:3306/hospital";
JAVA
static public final String user = "root";
static public final String password = "root"; Connection con; /** Creates new form frmBilling */ public frmBilling() { initComponents(); try {
Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(connection,user,password);
} catch(Exception ex) { System.out.println(ex.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtId = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txtPatient = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel();
JAVA
"Economical", "Luxury" })); jLabel6.setText("Total Amount"); jButton1.setText("New"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Save");
JAVA
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtPatient, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING ) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel3)
JAVA
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD ING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELAT ED)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel5) .addGap(44, 44, 44))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD ING) .addComponent(txtDOD, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cmdRoom, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addGap(18, 18, 18) .addComponent(jButton2))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3))) .addContainerGap(76, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(37, 37, 37) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1)
JAVA
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtPatient, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtDAO, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtDOD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(cmdRoom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(txtAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jButton3)) .addContainerGap(22, Short.MAX_VALUE)) ); pack(); }// </editor-fold>
JAVA
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { Statement st=con.createStatement(); st.execute("insert into Billing(id,PatientName,DAO,DOD,RoomType,Amt) values('" + txtId.getText() + "','" + txtPatient.getText() + "', '" + txtDAO.getText() + "', '"+txtDOD.getText() +"','"+cmdRoom.getName()+"',"+txtAmount.getText()+")" ); frmThanx frm=new frmThanx(); frm.show(); this.hide();
} catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try { int id=1; Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select max(id)+1 from Billing"); if(rs.next()) { id=rs.getInt(1); } txtId.setText(Integer.toString(id)); } catch(Exception ex)
JAVA
{
System.out.println(ex.getMessage()); } } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmBilling().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JComboBox cmdRoom; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JTextField txtAmount; private javax.swing.JTextField txtDAO; private javax.swing.JTextField txtDOD; private javax.swing.JTextField txtId; private javax.swing.JTextField txtPatient; // End of variables declaration }
JAVA
5.Search Doctor
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmDoctorSearch.java * * Created on Dec 28, 2010, 3:47:04 PM */ package hospitalmanagement; /** * * @author Administrator
JAVA
*/ import java.sql.*;
public class frmDoctorSearch extends javax.swing.JFrame { /** Creates new form frmDoctorSearch */ static public final String connection ="jdbc:mysql://localhost:3306/hospital"; static public final String user = "root"; static public final String password = "root"; Connection con; public frmDoctorSearch() { initComponents(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(connection,user,password); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtSearch = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton();
JAVA
lst = new java.awt.List();
jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Search"); jButton1.setText("Search"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); lst.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jButton2.setText("Close"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Close"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Close"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); }
JAVA
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(69, 69, 69) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING ) .addComponent(jButton4) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(30, 30, 30) .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton1))))) .addContainerGap(31, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(184, 184, 184) .addComponent(jButton2) .addContainerGap(190, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(199, Short.MAX_VALUE) .addComponent(jButton3) .addGap(175, 175, 175))) ); layout.setVerticalGroup(
JAVA
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22) .addComponent(jButton4) .addContainerGap(25, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(152, 152, 152) .addComponent(jButton2) .addContainerGap(156, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(162, Short.MAX_VALUE) .addComponent(jButton3) .addGap(146, 146, 146))) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(txtSearch.getText().equals("")) { System.out.println("Please Enter valid Doctor Name"); return; }
JAVA
lst.removeAll(); try { Statement st=con.createStatement();
ResultSet rs= st.executeQuery("select * from Doctor where DoctorName='"+txtSearch.getText() +"'"); while(rs.next()) { lst.add(rs.getString("DoctorName")); } } catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() {
JAVA
public void run() {
new frmDoctorSearch().setVisible(true); } }); } void getList(){ try{ lst.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from Doctor order by DoctorName"); while(rs.next()){ lst.add(rs.getString("DoctorName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JLabel jLabel1; private java.awt.List lst; private javax.swing.JTextField txtSearch; // End of variables declaration }
JAVA
6.Search Patient
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * frmPatientSearch.java * * Created on Dec 28, 2010, 3:47:24 PM */ package hospitalmanagement; /** * * @author Administrator */ import java.sql.*;
JAVA
public class frmPatientSearch extends javax.swing.JFrame { /** Creates new form frmPatientSearch */ static public final String connection ="jdbc:mysql://localhost:3306/hospital"; static public final String user = "root"; static public final String password = "root"; Connection con; public frmPatientSearch() { initComponents(); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection(connection,user,password); getList(); } catch(Exception ex) { System.out.println(ex.getMessage()); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtSearch = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); lst = new java.awt.List(); jButton2 = new javax.swing.JButton();
JAVA
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Search"); jButton1.setText("Search"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Close"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jLabel1) .addGap(30, 30, 30) .addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(65, Short.MAX_VALUE) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(56, 56, 56))
JAVA
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1)) .addGap(29, 29, 29) .addComponent(lst, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE) .addComponent(jButton2)) ); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if(txtSearch.getText().equals("")) { System.out.println("Please Enter valid patient Name"); return; } lst.removeAll(); try { Statement st=con.createStatement(); ResultSet rs= st.executeQuery("select * from patient where patientName='"+txtSearch.getText() +"'");
JAVA
while(rs.next()) {
lst.add(rs.getString("PatientName")); } } catch(Exception ex) { System.out.println(ex.getMessage()); } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.hide(); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmPatientSearch().setVisible(true); } }); } void getList(){ try{ lst.removeAll(); Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from patient order by patientName"); while(rs.next()){ lst.add(rs.getString("patientName")); } } catch(Exception ex){ System.out.println(ex.getMessage()); } }
JAVA
// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private java.awt.List lst;
JAVA
2.Doctor Page:
4.Bill Page
JAVA
INTRODUCTION
The Hospital Manaement System is developed to enhance the patient admission problem in hospital. The software will be great relief to the patient. Hospital Manaement System is developing to enhance the admission of patient, which fully works as an application. This software will be great relief to the customer for Reporting, Registration and searching the information about patient and doctor. Main Objectives are : The Hospital Manaement System is means to keep the security
The main concern of this project is to improve the efficiency and effectiveness of the whole system.
JAVA
: : : :
Intel P-III based system 250 MHz to 833MHz 64MB to 256MB 2GB to 30GB
: : :
JDK 1.5,Core Java,Net beans 6.9 My Sql 5.0 Any Operating System.
JAVA
CONCLUSION
The result of the Hospital Manaement System is that it supports many type of different-different admitting problem system of patient and the individual patient or the end-users with unique interface, through which the admission problems of patient are solved within given time and it shows effective efficiency in the internal system and results in accurate way and this can be run with the minimal resources. We can also enhance this module in future into web application.