Professional Documents
Culture Documents
Final
Final
ON
“HOSPITAL MANAGEMENT SYSTEM”
Submitted for the partial fulfilment for the
award Of
BACHELOR OF COMPUTER APPLICATION
Submitted To:
DELHI COLLEGE OF MANAGEMENT, MEERUT
DEPARTMENT OF MANAGEMENT
DELHI COLLEGE OF MANAGEMENT, MEERUT
(U.P.)
CERTIFICATE OF ORIGINALITY
carried out under the guidance of Mr. NEERAJ CHAUHAN and that the
Project has not previously formed the basis for the award of any other degree.
Place: Meerut
Date:
This is to certify that the above statement made by the candidate is correct to the
best of my knowledge.
Name
Designation
ACKNOWLEDGEMENT
training project. Without its willingness to permit this project would not have
been succeed.
First of all, I would like to thanks all those people who helped me directly
all faculties encourages me and due to their kindness and helpful nature and
Last but not least, I would like to express my gratitude to those persons
Contents
I. Front Page
II. Certificate
III. Acknowledgement
1. Introduction……………………………………………………………………………………………
1.1 Objective
1.2 Scope
1.3 Overview
2. System Analysis…………………………………………………………………….………………..
2.1 Introduction
3. System Design………………………………………………………………………………………………….
1
3.1.2 Output design
3.2 DFD
4. Coding………………………………………………………………………………………………………………..
5. Testing………………………………………………………………………………………………………………..
6. Screen Shots………………………………………………………………………………………………………..
7. Conclusion…………………………………………………………………………………………………………..
9. References…………………………………………………………………………………………………………..
2
LIST OF TABLES
3
LIST OF FIGURES
4
LIST OF SYMBOLS AND ABBREVIATIONS
Entity Symbol
Process Symbol
Relational Model
Weak Entity
5
TITLE OF THE PROJECT
HOSPITAL MANAGEMENT SYSTEM
6
Introduction
The project Hospital Management System includes registration of patients, storing the
details into the system, and also computerized billing in the pharmacy, and labs. The
software has the facility to give a unique id for every patient and stores the details of every
patient and staff automatically. It includes a search facility to know the current status of
each room. User can search availability of doctor and the details of patient using id.
The Hospital management System can be entered using a username and password. It is
accessible either by an administrator or receptionist. Only they can add data into the
database.The data can be retrieved easily. The interface is very user-friendly. The data are
well protected for personal use and makes the data processing very fast.
Hospital Management System is powerful, flexible and easy to use and is designed and
developed to deliver real conceivable benefits to hospitals.
7
Objective of system
The project “Hospital Management System” is aimed to develop to maintain the day-to –day
state of admission/discharge of patients, list of doctors, reports generation, and etc.It is
designed to achieve the following objectives:
2. Scheduling the appointment of patient with doctors to make it convenient for both.
3. Scheduling the services of specialized doctors and emergency properly so that facilities
provided by hospital are fully utilized in effective and efficient manner.
4. It should be able to handle the test reports of patients conducted in the pathology lab of
the hospital.
6. The information of the patients should be kept up to date and there record should
be kept in the system for further purpose.
8
PROJECT CATEGORY
Windows Application Software
Hardware and Software Requirements
HARDWARE REQUIREMENTS
Processor :Intel (R) Core (TM) 2 Duo
Processor Speed : 2.00 GHz
RAM : 2.00 GB
Hard Disk : 50 GB hard disk or above
SOFTWARE REQUIREMENTS
Front End : JAVA
Back End : SQL
Operating System : Widows 7
9
Roles &Responsibility
Name Role &Responsibility
Aruna Analysis & Coding
Ronak Designing
Sweety Designing
10
Analysis
Zero Level DFD:
11
One Level DFD:
12
Login Table
Patient Table
13
Room Table
Bill Table
14
Modules
15
ARCHITECTURE DIAGRAM
And for the web portal i.e. DoctorsHelpline, we have used J2EE on Net Beans 6.9 and the
database is handled by MY SQL Server 2005.
16
USE CASE DIAGRAM FOR DOCTORS TOOLKIT
A use case diagram in the Unified Modeling Language (UML) is a type of behavioral
diagram defined by and created from a Use-case analysis. Its purpose is to present a graphical
overview of the functionality provided by a system in terms of actors, their goals (represented
as use cases), and any dependencies between those use cases.
The main purpose of a use case diagram is to show what system functions are performed for
which actor. Roles of the actors in the system can be depicted.
Select Symptoms
17
DATA FLOW DIAGRAMS
18
Level 1 DFD
Nose Files
Eye Files Ear Files
19
Head files
20
Data Flow Diagram’s
21
22
ONTROL FLOW DIAGRAMS
For stand-alone application DoctorsToolkit
(Head, eye, ear, nose, throat, chest, back, stomach, skin & others module)
Doctors toolkit
Select Symptoms
Get diseases
Allopathic Homeopathic
treatment treatment
23
Forms Screen
Login Screen
24
Main Screen
25
Room Information Screen
26
Add Room InformationScreen
27
Room Update and Delete Screen
28
Patient Registration Screen
29
Room Allocation Screen
30
Patient Bill Screen
31
All Patient Report Screen
32
Patient wise Report Screen
33
Checks and Validation
Patient Form
Name Mandatory Field
34
CODING
*******Coding of login page*******
import javax.swing.JOptionPane;
import java.sql.*;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author BCA
*/
public class loginform extends javax.swing.JFrame {
Connection con;
Statement st;
ResultSet rs;
public loginform() {
initComponents();
String url="jdbc:mysql://localhost:3306/hospital_mgt";
String user="root";
String password="root";
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(url,user,password);
st=con.createStatement();
}
catch(Exception e)
{
System.out.print (e.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 default state="collapsed" desc="Generated Code">
private void initComponents() {
35
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
btnLogin = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
txtPassword = new
javax.swing.JPasswordField(); txtUserName =
new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
btnLogin.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.R
AISED));
btnLogin.addActionListener(new java.awt.event.ActionListener () {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLoginActionPerformed(evt);
}
});
jPanel1.add(btnLogin);
btnLogin.setBounds (230, 380, 110,
40);
jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospital/management/project
image/hospital_1.jpg"))); // NOI18N
jLabel6.setText("jLabel6");
jPanel1.add(jLabel6);
jLabel6.setBounds(190, 70, 220, 170);
txtPassword.addActionListener (new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPasswordActionPerformed(evt);
}
});
36
txtPassword.addKeyListener(new java.awt.event.KeyAdapter() {
37
public void keyPressed(java.awt.event.KeyEvent evt) {
txtPasswordKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
txtPasswordKeyTyped(evt);
}
});
jPanel1.add(txtPassword);
txtPassword.setBounds(410, 320, 140, 30);
jPanel1.add(txtUserName);
txtUserName.setBounds(410, 280, 140,
30);
{
JOptionPane.showMessageDialog(null,"invalid password");
txtUserName.requestFocus();
txtUserName.selectAll ();
return;
}
}
catch (Exception e)
{
38
System.out.print (e.getMessage ());
}
private void txtPasswordActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void txtPasswordKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
int a =evt.getKeyCode();
//JOptionPane.showMessageDialog(this,a);
if(a==10)
btnLogin.doClick ();
}
private void txtPasswordKeyTyped (java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
String pass=txtPassword.getText();
int length=pass.length();
if(length>=10)
evt.consume();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold default state="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel (info.getClassName ());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger (loginform.class.getName()).log
(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger
(loginform.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(loginform.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger (loginform.class.getName ()).log
(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
39
/* Create and display the form */
java.awt.EventQueue.invokeLater (new Runnable ()
{
public void run () {
new loginform ().setVisible (true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnLogin;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField txtPassword;
private javax.swing.JTextField txtUserName;
// End of variables declaration
}
40
*******Coding of Room Form******
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author BCA
*/
public class Room extends javax.swing.JFrame {
/**
* Creates new form Room
*/
Connection con;
Statement st;
ResultSet rs;
public Room() {
initComponents();
String url="jdbc:mysql://localhost:3306/hospital_mgt";
String user="root";
String password="root";
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(url,user,password);
st=con.createStatement();
}
catch(Exception e)
{
System.out.print(e.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.
*/
41
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
txtprice.setEnabled(false);
txtprice.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtpriceKeyPressed(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
txtpriceKeyTyped(evt);
}
});
btnok.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAIS
ED));
42
btnok.setEnabled(false);
btnok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnokActionPerformed(evt);
}
});
jPanel2.setLayout(null);
jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospital/management/
project image/7_1.jpg"))); // NOI18N
jLabel6.setText("jLabel6");
jPanel2.add(jLabel6);
jLabel6.setBounds(0, 0, 260,
160);
btnnew.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RA
ISED));
btnnew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnnewActionPerformed(evt);
}
});
43
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 131,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(223, 223, 223)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE, 114,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(cmbroomtype, javax.swing.GroupLayout.PREFERRED_SIZE, 140,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lable2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(82, 82, 82)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 253,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(lable3, javax.swing.GroupLayout.PREFERRED_SIZE, 216,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE)))
.addGap(18, 18, 18)
44
.addComponent(txtRoomno, javax.swing.GroupLayout.PREFERRED_SIZE, 138,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(btnnew, javax.swing.GroupLayout.PREFERRED_SIZE, 67,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnok, javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addComponent(btncancel1)
.addGap(133, 133, 133)))
.addContainerGap(61, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 148,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addGap(29, 29, 29)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 83,
Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtRoomno, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lable2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(27, 27, 27)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lable3)
.addComponent(cmbroomtype, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(44, 44, 44)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnok)
45
.addComponent(btncancel1)
.addComponent(btnnew))
.addGap(231, 231, 231))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
int i;
int id=Integer.parseInt(txtRoomno.getText());
//String room=txtRoomno.getText();
String roomtype=cmbroomtype.getSelectedItem().toString();
String price=txtprice.getText();
if(cmbroomtype.getSelectedItem().equals("Select"))
{
JOptionPane.showMessageDialog(null,"Select Room Type");
cmbroomtype.requestFocus();
return;
}
if(price.equals(""))
{
JOptionPane.showMessageDialog(null, "Room Price should be entered");
txtprice.requestFocus();
return;
}
String query ="insert into room values(" + id +",'" + roomtype + "','" + price + "')";
int res = JOptionPane.showConfirmDialog(null, "Do you want to save record?", "Confirm",
46
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if(res == 0) {
System.out.println("Pressed YES");
try{
i=st.executeUpdate(query);
JOptionPane.showMessageDialog(this,"Room Booked Successfully");
//lblpatient.setText("");
//txtroom.setEnabled(false);
cmbroomtype.setEnabled(false);
txtprice.setEnabled(false);
btnnew.setEnabled(true);
btnok.setEnabled(false);
txtRoomno.setText("");
cmbroomtype.setSelectedItem("Select");
txtprice.setText("");
}
catch(Exception ex){
System.out.print(ex.getMessage());
}
}
btnok.setEnabled(false);
//new menu().setVisible(true);
//this.dispose();
}
btnok.setEnabled(true);
btnnew.setEnabled(false);
47
// txtroom.setEnabled(true);
cmbroomtype.setEnabled(true);
txtprice.setEnabled(true);
int id=101;
try
{
rs=st.executeQuery(query1);
while(rs.next())
{
id=rs.getInt(1)+1;
}
txtRoomno.setText(Integer.toString(id));
// txtroom.requestFocus();
}
catch(Exception ex)
{
System.out.print(ex.getMessage());
}
btnok.setEnabled(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.dispose();
new NewMain().setVisible(true);
}
private void cmbroomtypeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void txtpriceKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
char c=evt.getKeyChar();
//JOptionPane.showMessageDialog(this, c);
if((c>= '0' && c<= '9') || c==8)
{
}
else
evt.consume();
}
48
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Room.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Room.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Room.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Room.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
49
private javax.swing.JLabel lable2;
private javax.swing.JLabel lable3;
private javax.swing.JLabel txtRoomno;
private javax.swing.JTextField txtprice;
// End of variables declaration
}*******Coding of Room Update and Delete Form*****
import java.sql.*;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author BCA
*/
public class RoomDelete extends javax.swing.JFrame {
Connection con;
Statement st;
ResultSet rs;
int globalRoom;
/**
* Creates new form RoomDelete
*/
public RoomDelete() {
initComponents();
String url="jdbc:mysql://localhost:3306/hospital_mgt";
String user="root";
String password="root";
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(url,user,password);
st=con.createStatement();
}
catch(Exception e)
{
System.out.print(e.getMessage());
}
String query="select room_no from room";
try{
rs=st.executeQuery(query);
while(rs.next())
{
cmbRoom.addItem(rs.getString("Room_no"));
50
}
}
cmbRoom.setSelectedItem("select");
cmbRoom.setEnabled(false);
txtPrice.setText("");
txtDate.setText("");
btnadd.setText("");
txtPatient.setText("");
txtId.setText("");
}
catch(Exception ex){
System.out.print(ex.getMessage());
}
}
51
private void txtPatientActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
if(txtPatient.getText().isEmpty())
{
JOptionPane.showMessageDialog(null,"Enter Patient Id");
return;
}
int id=Integer.parseInt(txtPatient.getText());
String query="select * from patient where patient_id="+ id;
try{
rs=st.executeQuery(query);
if(rs.next())
{
txtName.setText(rs.getString("name"));
txtPhone.setText(rs.getString("contact_no"));
txtDiseases.setText(rs.getString("Disease"));
}
else
JOptionPane.showMessageDialog(this,"no record found");
txtPatient.setEnabled(false);
cmbRoomtype.setEnabled(true);
}
catch(Exception ex){
52
rs=st.executeQuery(query);
cmbRoom.setEnabled(true);
btnPrice.setEnabled(true);
while(rs.next())
{
cmbRoom.addItem(rs.getString("Room_no"));
}
catch(Exception ex){
JOptionPane.showMessageDialog(this,ex.getMessage());
}
}
}
else
JOptionPane.showMessageDialog(this,"no record found");
}
catch(Exception ex){
JOptionPane.showMessageDialog(this,ex.getMessage());
}
}
53
// TODO add your handling code here:
String query1="select allocation_id from room_Allocation";
// btnok.setEnabled(true);
//btnnew.setEnabled(false);
// txtroom.setEnabled(true);
//cmbroomtype.setEnabled(true);
txtPatient.setEnabled(true);
btnSearch.setEnabled(true);
int id=101;
try
{
rs=st.executeQuery(query1);
while(rs.next())
{
id=rs.getInt(1)+1;
}
txtId.setText(Integer.toString(id));
// txtroom.requestFocus();
}
catch(Exception ex)
{
System.out.print(ex.getMessage());
}
btnadd.setEnabled(true);
btnNew.setEnabled(false);
}
}
else
evt.consume();
54
}
}
else
evt.consume();
}
}
else
evt.consume();
}
}
else
evt.consume();
}
else
evt.consume();
}
55
private void txtDateActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(checkout.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(checkout.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(checkout.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(checkout.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>
56
private javax.swing.JButton btnNew;
private javax.swing.JButton btnPrice;
private javax.swing.JButton btnSearch;
private javax.swing.JButton btnadd;
private javax.swing.JComboBox
cmbRoom;
private javax.swing.JComboBox cmbRoomtype;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JTextField txtDate;
private javax.swing.JTextField txtDiseases;
private javax.swing.JLabel txtId;
private javax.swing.JTextField txtName;
private javax.swing.JTextField txtPatient;
private javax.swing.JTextField txtPhone;
private javax.swing.JTextField txtPrice;
// End of variables declaration
}
57
*******Coding of Bill Form******
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author BCA
*/
public class frmBill extends javax.swing.JFrame {
/**
* Creates new form frmBill
*/
Connection con;
Statement st;
ResultSet rs;
public frmBill() {
initComponents();
String url="jdbc:mysql://localhost:3306/hospital_mgt";
String user="root";
String password="root";
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(url,user,password);
st=con.createStatement();
}
catch(Exception e)
{
System.out.print(e.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">
58
private void initComponents() {
jTextField1.setText("jTextField1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
txtpatient.setEnabled(false);
btnsearch.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.
RAISED));
btnsearch.setEnabled(false);
btnsearch.addActionListener(new java.awt.event.ActionListener() {
59
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnsearchActionPerformed(evt);
}
});
txtphone.setEnabled(false);
txtphone.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtphoneKeyTyped(evt);
}
});
txtdiseases.setEnabled(false);
txtdiseases.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtdiseasesKeyTyped(evt);
}
});
txtroomNo.setEnabled(false);
txtroomNo.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtroomNoKeyTyped(evt);
}
});
txtname.setEnabled(false);
txtname.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
60
txtnameKeyTyped(evt);
}
});
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 92,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton2)))
.addGap(112, 112, 112)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 151,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
61
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtbillId, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(txtpatient)
.addComponent(txtroomNo, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtdiseases, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtphone, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtname, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE))
.addGap(16, 16, 16)
.addComponent(btnsearch)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtbillId, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtpatient, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnsearch))
.addGap(8, 8, 8))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(18, 18, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
62
.addComponent(txtname, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(20, 20, 20))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addComponent(txtphone, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(21, 21, 21))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addComponent(txtdiseases, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(20, 20, 20)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(txtroomNo, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
txtdays.setEnabled(false);
txtdays.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtdaysFocusLost(evt);
}
});
txtdays.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtdaysKeyTyped(evt);
}
});
63
txttotalprice.setEnabled(false);
txttotalprice.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txttotalpriceKeyTyped(evt);
}
});
btncalculate.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBord
er.RAISED));
btncalculate.setEnabled(false);
btncalculate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btncalculateActionPerformed(evt);
}
});
txtprice.setEnabled(false);
txtprice.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtpriceKeyTyped(evt);
}
});
btnnew.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RA
ISED));
btnnew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnnewActionPerformed(evt);
}
});
btnadd.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAI
SED));
btnadd.setEnabled(false);
btnadd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
64
btnaddActionPerformed(evt);
}
});
jButton4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.R
AISED));
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btnnew)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnadd)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton4))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 100,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtdays, javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btncalculate)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 103,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
65
.addComponent(txttotalprice, javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(6, 6, 6))
);
jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btncalculate)
.addComponent(jLabel10)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtdays, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)))
.addComponent(txttotalprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53,
Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnnew)
.addComponent(btnadd)
.addComponent(jButton4))
.addGap(31, 31, 31))
);
66
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
}
txtbillId.setText(Integer.toString(id));
txtpatient.setEnabled(true);
btnsearch.setEnabled(true);
btnnew.setEnabled(false);
btnadd.setEnabled(true);
// txtroom.requestFocus();
}
catch(Exception ex)
{
System.out.print(ex.getMessage());
}
}
if(txtpatient.getText().isEmpty())
{
JOptionPane.showMessageDialog(this,"Enter Patient Id First" );
return;
}
int id=Integer.parseInt(txtpatient.getText());
String query="select * from room_allocation where patient_id="+ id;
try{
rs=st.executeQuery(query);
if(rs.next())
67
{
txtname.setText(rs.getString("name"));
txtphone.setText(rs.getString("phone"));
txtdiseases.setText(rs.getString("disease"));
txtroomNo.setText(Integer.toString(rs.getInt("room_no")));
txtprice.setText( rs.getString("price"));
txtdays.setEnabled(true);
}
else
JOptionPane.showMessageDialog(this,"no record found");
}
catch(Exception ex){
}
}
try{
int i=st.executeUpdate(query);
JOptionPane.showMessageDialog(this,"Bill Generate Succesfully");
68
btnnew.setEnabled(true);
btnadd.setEnabled(false);
txtpatient.setText("");
txtname.setText("");
txtphone.setText("");
txtdiseases.setText("");
txtprice.setText("");
txtbillId.setText("");
txtroomNo.setText("");
txttotalprice.setText("");
txtdays.setText("");
}
catch(Exception ex){
System.out.print(ex.getMessage());
}
}
69
}
}
else
evt.consume();
}
}
else
evt.consume();
}
}
else
evt.consume();
}
70
private void txtroomNoKeyTyped(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
char c=evt.getKeyChar();
//JOptionPane.showMessageDialog(this, c);
if((c>= '0' && c<= '9') || c==8)
{
}
else
evt.consume();
}
}
else
evt.consume();
}
}
else
evt.consume();
}
71
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(frmBill.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmBill.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmBill.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmBill.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frmBill().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnadd;
private javax.swing.JButton btncalculate;
private javax.swing.JButton btnnew;
private javax.swing.JButton btnsearch;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
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;
72
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel
jPanel1; private
javax.swing.JPanel jPanel2;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JTextField jTextField1;
private javax.swing.JLabel txtbillId;
private javax.swing.JTextField txtdays;
private javax.swing.JTextField txtdiseases;
private javax.swing.JTextField txtname;
private javax.swing.JTextField txtpatient;
private javax.swing.JTextField txtphone;
private javax.swing.JTextField txtprice;
private javax.swing.JTextField txtroomNo;
private javax.swing.JTextField txttotalprice;
// End of variables declaration
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author BCA
*/
public class report extends javax.swing.JFrame {
/**
* Creates new form report
*/
Connection con;
Statement st;
ResultSet rs;
public report() {
initComponents();
String url="jdbc:mysql://localhost:3306/hospital_mgt";
String user="root";
73
String password="root";
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(url,user,password);
st=con.createStatement();
}
catch(Exception e)
{
System.out.print(e.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() {
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jTable1);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
74
jPanel1.setBackground(new java.awt.Color(153, 153, 255));
jPanel1.setLayout(null);
table1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"PATIENT REG.", "NAME", "CONTACT NO.", "DIEASES", "ADDRESS", "DOCTOR"
}
));
jScrollPane1.setViewportView(table1);
jPanel1.add(jScrollPane1);
jScrollPane1.setBounds(60, 300, 599, 209);
btnReport.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.Beve
lBorder.RAISED));
btnReport.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnReportActionPerformed(evt);
}
});
jPanel1.add(btnReport);
btnReport.setBounds(290, 540, 230,
50);
jPanel2.setLayout(null);
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/hospital/management/project
image/patient.jpg"))); // NOI18N
jLabel3.setText("jLabel3");
jPanel2.add(jLabel3);
jLabel3.setBounds(0, 0, 240,
130);
jPanel1.add(jPanel2);
jPanel2.setBounds(230, 90, 240, 120);
75
jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
76
jButton1.setText("Home");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel1.add(jButton1);
jButton1.setBounds(20, 20, 80, 25);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
77
Address=rs.getString("Address");
doctor=rs.getString("doctorname");
name=rs.getString("name");
i++;
dm.addRow(new Object[]{registration,name,contact,Disease,Address,doctor});
}
if(i==0)
{
JOptionPane.showMessageDialog(null, "Record Not Found");
}
} catch(Exception e)
{
System.out.print(e.getMessage());
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(report.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
78
java.util.logging.Logger.getLogger(report.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(report.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(report.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
79
Feasibility Study
Feasibility study is a test of a system proposal according to its workability, impact on the
organization, ability to meet user’s needs, and effective use of resources. The objective of
feasibility study is not solve the problem but to acquire a sense of its scope. During the
study, the problem definition is crystallized and aspects of the problem to be included in the
system are determine
The result of Feasibility study is formal proposal. This is simply a report-a formal document
detailing the nature and scope of the Propose solution. Finally, Feasibility study is carried
out to select the best system that meets the performance requirements. Feasibility is the
determination of whether or not project is worth doing. The process followed in making this
determination is called a Feasibility study.
80
Testing
Testing is a process of executing a program with the aim of finding error. To makes our
software perform well it should be error free. If testing is done successfully it will remove all
the errors from the software. The various types of testing are:
Unit Testing
Integration Testing
Regression Testing
Alpha Testing
Beta Testing
System Testing
Performance Testing
Stress Testing
1. Unit Testing
It focuses on smallest unit of software design. In this we test an individual unit or group of
interrelated units. It often done by programmer by using sample input and observing its
corresponding outputs.
2. Integration Testing
The objective is to take unit tested components and build a program structure that has been
dictated by design. Integration testing in which a group of component is combine to
produce output.
Top Down
Bottom Up
Sandwich
Big-Bang
3 .Regression Testing
Every time a new module is added leads to change in program. This type of testing make
sure that whole component works properly even after adding component to the complete
program.
4. Smoke Testing
This test is done to make sure that software under testing is ready or stable for further
testing.
81
It is called Smoke test as testing initial pass is done to check if it did not catch the fire or
smoked in the initial switch on.
5. Alpha Testing
This is a type of validation testing .It is a type of acceptance testing which is done before the
product is released to the customers. It is typically done by QA people.
6. Beta Testing
The beta test is done at one or more customer sites by the end-user of the software. This
version is released for the limited number of users for testing in real time environment.
7. System Testing
In this software is tested such that it works fine for different operating system .It is covered
under the Black Box testing technquie.In this we just focus on internal working.
In this we have security testing, recovery testing, stress testing, and performance testing.
8. Performance Testing
9. Stress Testing
In this we give unfavorable conditions to the system and check how they perform in those
conditions.
82
Future Scope
The proposed software product is the Hospital Management System. The system will be
used in any Hospital, Clinic, Dispensary or pathology labs to get the information from the
patients and then storing the data for future usage.
The current system in use is a paper –based system. It is too slow and cannot provide
update lists of patients within a reasonable timeframe. The intentions of the system are to
reduce over –time pay and increase the number of patients that can be treated accurately.
Requirements statements in this document are both functional and non-functional.
83
Bibliography
o Websites
http://www.tcs.com
http://www.msdn.microsoft.com
http://www.codeguru.com
84