SlideShare a Scribd company logo
1 of 76
RAJOKARI INSTITUTE OF
TECHNOLGY,
RAJOKARI, NEW DELHI-110038
Board of Technical Education
(Govt. of NCT of Delhi)
MAJOR PROJECT REPORT
ON
HOSPITAL MANAGEMENT SYSTEM
Using Java Programming and Database
2019
SUBMITTED IN PARTIAL FULFILLMENT
FOR AWARD OF DIPLOMA IN
COMPUTER ENGINEERING
(Batch 2016-2019)
SUBMITTED BY
Ranjit Singh (1613051041)
UNDER GUIDANCE OF
Mrs. Antima Jain
CERTIFICATE
This is to certify that Hospital Management System embodies
the original work done by Ranjit Singh during this project
submission as a partial fulfillment of the requirement for the
Hospital Management System, of Rajokari Institute of
Technology.
Umesh Chand
Principal
(Rajokari Institute of Technology)
Mrs. Antima Jain
Assistant Professor
ACKNOWLEDGEMENT
My unreserved gratitude goes to God, who gave me the
opportunity to complete this journey. To my family, I say
thank you for your support. To all my friends I say am
grateful that you all came my way.
Special thanks to my supervisor, Mrs. Antima Jain for her
support and patience throughout this thesis project.
Thanks to Mr. for the knowledge I gained from him and for
pushing me to the extreme during his programming classes. I
actually learnt a lot from him.
Ranjit Singh
CONTENTS
1. Introduction
1.1 Purpose
1.2 Scope
1.3 Relevant Tools and Technologies
1.3.1 Java Programming Language
1.3.2 JDK and JRE
1.3.3 MySQL
1.3.4 Netbeans IDE
1.4 Overview
2. OverallDescription
2.1 Goals of Proposed System
2.2 Background
2.3 Current Management System
2.4 ProjectRequirements
2.5 User Characteristics
2.6 Constraints
2.7 Definition of Problems
2.8 Alternative Solutions
3. Feasibility Study
3.1 Technical Feasibility
3.2 EconomicalFeasibility
3.3 Operational Feasibility
3.4 Schedule Feasibility
4. Entity Relationship Diagram
5. Database and GUI Design
5.1 Database Design
5.2 GUI Design
5.2.1 LoginForm
5.2.2 Home Screen
5.2.2.1 Users Menu
a) New User
b) Change Password
c) Login Details
5.2.2.2 Patients Menu
a) Registration
b) Services
5.2.2.3 Doctors Menu
a) Entry
5.2.2.4 Rooms Menu
a) Add Rooms
b) Admit
c) Discharge
d) Billing
5.2.2.5 Help
a) About
b) Logout
6. Implementation
6.1 Login Form
6.2 Home Page
6.3 New User
6.4 Update User
6.5 Delete Patient Record
6.6 Services
6.7 Patient Registration
6.8 Admit Patient
6.9 Discharge Patient
6.10 Rooms
6.11 Generating Bill
7. Testing
8. Conclusion
9. Bibliography
LIST OF FIGURES AND TABLES
Figure 1. Entity Relationship Diagram
Figure 2. Login Form
Figure 3. Home Screen
Figure 4. Users Menu
Figure 5. New User Form
Figure 6. Change Password Form
Figure 7. Login Details Form
Figure 8. Patients Menu
Figure 9. Registration Form
Figure 10. Services Form
Figure 11. Doctors Menu
Figure 12. Entry Form
Figure 13. Rooms Menu
Figure 14. Add Rooms Form
Figure 15. Admit Form
Figure 16. Discharge Form
Figure 17. Bill Form
Figure 18. Help Menu
Figure 19. About Form
Table 1. Project Requirements
Table 2. User Table
Table 3. Registration Table
Table 4. Patient Registration Table
Table 5. Admit Patient Table
Table 6. Discharge Patient RoomTable
Table 7. RoomTable
Table 8. Services Table
Table 9. Bill RoomTable
Table 10. Software testing template and results
1. Introduction
1.1) Purpose
The Software is for the automation of Hospital Management.
It maintains one levels of user:-
Administrator Level
The Software includes:-
Maintaining Patient ‘s details.
Maintaining Doctor’s details.
Maintaining Room records.
Bill generation.
1.2) Scope
It can be used in any Hospital, Clinic and Dispensaryfor maintaining
patient details.
1.3) Relevant Tools and Technologies
This chapter presents some discussions about the relevant tools and technologies
used to develop the e-commerce web application. Some of the tools and
technologies are Java programming language, JDK and JRE, MySQL and
Netbeans IDE.
1.3.1 Java Programming Language
This is the main programming language used to develop the application. The Java
Programming Language was formerly developed by Sun Microsystems as
proposedbyJames Gosling. It was first released in 1995. It runs on Mac OS,
Windows, the different versions of UNIX, and other platforms. Java is considered
to be secure and robust. Also, it is multithreading and platform independent (unlike
C and C++)
1.3.2 JDK and JRE
The Java Development Kit (JDK) is a software development environment for
developing applets and applications written in Java. It consists of an interpreter, a
Java compiler, a documentation generator (JavaDoc) and several other tools for
building Java applications. The Java Runtime Environment is a component of JDK,
and it consists of the Java Virtual Machine (JVM), libraries, files and other
components for running applications written in Java. JVM is an implementation of
JRE for running Java bytecode.
1.3.3 MySQL
MySQL is a free, open source relational database management system (RDBMS)
that supports Structured QueryLanguage(SQL).An RDBMS is a system used to
manage databases, and it is made up of tables containing columns and rows, where
the tables are related by keys. MySQL DBMS is the world’s most popular open
sourcedatabase system and one of the most commonly used database systems for
Java web applications. It is one of the fastest RDBMS and it is easy to use. Also, it
runs on almost all platforms, such as Windows, Linux and OS X.
1.3.4 Netbeans IDE
Netbeans is an integrated development environment (IDE) for Java Netbeans
allows applications to be developed from a set of modular software components
called modules. Netbeans runs on Windows, macOS, Linux and Solaris. In
addition to Java development, it has extensions for other languages like PHP, C,
C++ and JavaScript. Applications based on Netbeans, including the Netbeans IDE,
can be extended by third party developers. The latest release of Netbeans is
Netbeans IDE 10.0, which was released in December 2018.
1.4) Overview
Projectis related to Hospital Management System.
The projectmaintains one level of users:-
Administrator Level-Doctor
Main facilities available in this projectare:-
 Maintaining records of indoor/outdoorpatients.
Maintaining records of services provided to the patient.
 Maintaining records of doctors registered with the hospital/clinic.
 Providing billing details for indoor/outdoorpatients.
 Maintaining details of users logging in.
. Administrator can search a patient’s record.
2. Overall Description
2.1) Goals of proposed system
1. Planned approach towards working: - The working in the
organization will be well planned and organized. The data will be stored
properly in data stores, which will help in retrieval of information as well as
its storage.
2. Accuracy: - The level of accuracy in the proposed system will be
higher. All operation would be done correctly and it ensures that whatever
information is coming from the center is accurate.
3. Reliability: - The reliability of the proposed system will be high due to
the above stated reasons. The reason for the increased reliability of the
system is that now there would be properstorage of information.
4. No Redundancy: - In the proposedsystem utmost care would be that
no information is repeated anywhere, in storage or otherwise. This would
assure economic use of storage space and consistencyin the data stored.
5. Immediate retrieval of information: - The main objective of
proposed system is to provide for a quick and efficientretrieval of
information. Any type of information would be available whenever the user
requires.
6. Immediate storage of information: - In manual system there are
many problems to store the largest amount of information.
7. Easy to Operate: - The system should be easy to operate and should
be such that it can be developedwithin a short period of time and fit in the
limited budget of the user.
2.2) Background
A Hospital is a place where Patients come up for general diseases.
Hospitals provide facilities like:-
Consultation by Doctors on Diseases.
Diagnosis for diseases.
Providing treatment facility.
Facility for admitting Patients (providing beds,nursing, medicines etc.)
Immunization for Patients/Children.
Various operational works that are done in a Hospital are:-
Recording information about the Patients that come.
Generating bills.
Recording information related to diagnosis given to Patients.
Keeping record of the Immunization provided to children/patients.
Keeping information about various diseases available to cure them.
These are the various jobs that need to be done in a Hospital by the
operational staff and Doctors.All these works are done on papers.
The work is done as follows:-
Information about Patients is done by just writing the Patients name, age
and gender. Wheneverthe Patient comes up his information is stored
freshly.
Bills are generated by recording price for each facility provided to Patient
on a separate sheet and at last they all are summed up.
Diagnosis information to patients is generally recorded onthe document,
which contains Patient information. It is destroyed after some time period to
decrease the paper load in the office.
Immunization records of children are maintained in pre-formatted sheets,
which are kept in a file.
Information about various diseases is not kept as any document. Doctor
themselves do this job by remembering various medicines.
All this work is done manually by the receptionistand other operational staff
and lot of papers are needed to be handled and taken care of. Doctors
have to remembervarious medicines available for diagnosis and
sometimesmiss better alternatives as they can’t rememberthem at that
time.
2.3) Current Management System
Most hospitals face several challenges with Hospital Management
System because some of them are still using manual processes, while the
ones that use the computerized method are also faced with the challenge
of adjusting to it. Such problems include:
High cost of software development, deployment and improvement.
Difficulty in migrating from manual processes, because both staff and
patients are used to the manual processes and so are unable to speedily
cope with the new system.
Lack of IT friendly medical personnel is also presenting several
challenges.
Huge influx of patients visiting government hospitals makes the
process of migrating to automated processes highly difficult. They do
not have the patience to wait for registration and data entry and often fail
to understand the functioning of automated processes.
Considering the above, there is need for the improvement of
computerized hospital management system to such hospitals as it would
help provide and customize clinical data, enable faster diagnosis with
ready-made templates, allow doctors to follow advanced medical
prescription patterns, and so on.
2.4) Project Requirements
Hardware Requirements
Processor RAM Disk Space
Pentium IV or
higher
64 MB or higher 150 MB
Software Requirements
Operating System Database
Win- 07 , Win -10 or any other
higher version
MySQL 5.1 or higher
Table 1: Project Requirements
2.5) User Characteristics
Every user should be:
Comfortable to work on computer.
He must have knowledge in medical field.
He must also have basic knowledge of English too.
2.6) Constraints
GUI is only in English.
Login and password is used for identification of user and there is no
facility for guest.
2.7) Definitions of problems
Problems with conventional system
1. Lack of immediate retrievals: -The information is very difficult to
retrieve and to find particular information like- E.g. - To find out about the
patient’s history, the user has to go through various registers.This results
in inconvenience and wastage of time.
2. Lack of immediate information storage: - The information
generated by various transactions takes time and efforts to be stored at
right place.
3. Lack of prompt updating: - Various changes to information like
patient details or immunization details of child are difficultto make as paper
work is involved.
4. Error prone manual calculation: - Manual calculations are error
prone and take a lot of time this may result in incorrect information. For
example calculation of patient’s bill based on various treatments.
5. Preparation of accurate and prompt reports: - This becomesa
difficult task as information is difficultto collectfrom various registers.
2.8) Alternative Solutions
1. Improved ManualSystem:-
One of the alternative solutions is the improvement of the manual system.
Anything, which can be done by using automated methods,can be done
manually. But the question arises how to perform thing manually in a sound
manner. Following are some suggestions,which can be useful in the
manual system.
A more sophisticate register maintenance for various Patient Information,
Doctordiary, Immunization Details and a good system for writing bill
amount employees and stock availed for the customers can be maintained
at central place.
Adequate staff may be maintained so that updates are made at the very
moment at the same time. Properperson for properwork should be made
responsible so that a betterefficiencycould be achieved. This needs a lot
of work force.
2. Batch System:-
Another alternative solution can be used of computerbased batch system
for maintaining the information regarding purchase details, customers and
employees.A batch system refers to a system in which data is processed
in a periodicalbasis.
The batch system is able to achieve most of the goals and sub goals. But a
batch system data is processed in sequential basis. Therefore batch
system is not suggested.
3. Online System:-
This system (HMS) provides online storage/updates and retrieval facility.
This system promises very less or no paper work and also provides help to
Doctorand operational staff.
In this system everything is stored electronically so very less amount of
paperwork is required and information can be retrieved very easily without
searching here and there into registers.This system is beendiscussed
here.
3. Feasibility Study
Depending on the results of the initial investigation the survey is now
expanded to a more detailed feasibility study. “FEASIBILITY STUDY” is a
test of system proposalaccording to its workability, impact of the
organization, ability to meet needs and effective use of the resources.It
focuses onthese major questions:
1. What are the user’s demonstrable needs and how does a candidate
system meet them?
2. What resources are available for given candidate system?
3. What are the likely impacts of the candidate system on the organization?
4. Whether it is worth to solve the problem?
During feasibility analysis for this project, following primary areas of interest
are to be considered.Investigation and generating ideas about a new
system does this.
Steps in feasibility analysis
Eight steps involved in the feasibility analysis are:
Form a project team and appoint a projectleader.
Prepare system flowcharts.
Enumerate potential proposedsystem.
Define and identify characteristics of proposedsystem.
Determine and evaluate performance and costeffective of each
proposed system.
Weightsystem performance and costdata.
Selectthe best-proposed system.
Prepare and report final project directive to management.
3.1) Technical feasibility
A study of availability of resources that may affectthe ability to achieve an
acceptable system.This evaluation determines whether the technology
needed forthe proposed system is available or not.
Can the work for the projectbe done with current equipmentexisting
software technology& available personal?
Can the system be upgraded if developed?
If new technologyis needed then what can be developed?
This is concerned with specifying equipmentand software that will
successfullysatisfy the user requirement. The technical needs of the
system may include:
Front-endand back-end selection
An important issue for the developmentof a project is the selectionof
suitable front-end and back-end. When we decided to develop the project
we went through an extensive study to determine the most suitable
platform that suits the needs of the organization as well as helps in
developmentof the project.
The aspects of our study included the following factors.
Front-endselection:
1. It must have a graphical user interface that assists employees that are
not from IT background.
2. Scalability and extensibility.
3. Flexibility.
4. Robustness.
5. According to the organization requirement and the culture.
6. Must provide excellent reporting features with good printing support.
7. Platform independent.
8. Easy to debug and maintain.
9. Event driven programming facility.
10. Front end must supportsome popular back end like MySQL.
According to the above stated features we selected Netbeans IDE 6.5.1 as
the front-end for developing our project.
Back-endSelection:
1. Multiple user support.
2. Efficientdata handling.
3. Provide inherent features for security.
4. Efficientdata retrieval and maintenance.
5. Stored procedures.
6. Popularity.
7. Operating System compatible.
8. Easy to install.
9. Various drivers must be available.
10. Easy to implant with the Front-end.
According to above stated features we selected MySQL as the backend.
The technical feasibility is frequently the most difficultarea encountered at
this stage. It is essentialthat the process ofanalysis and definition be
conducted in parallel with an assessmentto technical feasibility. It centers
on the existing computersystem (hardware, software etc.) and to what
extent it can supportthe proposed system.
3.2) Economical feasibility
Economic justification is generally the “Bottom Line” considerationfor most
systems.
Economic justification includes a broad range of concerns that includes
costbenefit analysis. In this we weight the costand the benefits associated
with the candidate system and if it suits the basic purpose of the
organization i.e. profit making, the project is making to the analysis and
designphase.
The financial and the economic questions during the preliminary
investigation are verified to estimate the following:
 The costto conducta full system investigation.
The cost of hardware and software for the class of application being
considered.
The benefits in the form of reduced cost.
The proposedsystem will give the minute information, as a result the
performance is improved which in turn may be expected to provide
increased profits.
This feasibility checks whether the system can be developedwith the
available funds. The Hospital ManagementSystem does not
require enormous amount of money to be developed.This can be
done economicallyif planned judicially, so it is economicallyfeasible.
The cost of projectdepends uponthe number of man-hours required.
3.3) Operational Feasibility
It is mainly related to human organizations and political aspects.The points
to be consideredare:
What changes will be brought with the system?
What organization structures are disturbed?
What new skills will be required? Do the existing staff members have
these skills? If not, can they be trained in due course of time?
The system is operationally feasible as it very easy for the End users to
operate it. It only needs basic information about Windows platform.
3.4) Schedule feasibility
Time evaluation is the most important considerationin the developmentof
project.The time schedule required for the developedof this project is very
important since more developmenttime effectmachine time, cost and
cause delay in the developmentof other systems.
A reliable Hospital ManagementSystem can be developed inthe
considerable amount of time.
4. Entity Relationship Diagram
Figure 1: Entity Relationship Diagram
Hospital Management
System
have
Admin
PasswordLogin
Id
do
Login
do
Patient
Registration
do
Doctor
Registration
do
Generate
Bills
create
ee
New Users
do
Admit
Patients
do
Discharge
Patients
5. Database and GUI Design
Every Java application needs to have an operational database to store its
generated data. More so, a simple and interactive Graphical User
Interface (GUI) is one of the success indicators of any application
project. This chapter presents the database and GUI design for this
Hospital Management application.
5.1 Database Design
MySQL database management system is the most popular database
system for Java applications because of its speed, reliability, and
flexibility. All the data generated by this application are managed on
MySQL database system. The following numbered list gives a brief
explanation of these tables.
5.1.1. Data Tables
1. Users Table
Field Name Datatype Size Description
User_name Text 20 Primary Key
Password Text 20
Table 1: Users Table
2. Registration Table
Field Name Datatype Size Description
Name Text 20
User_Name Text 20 Primary Key
Password Text 20
Email_id Text 30
Contact_No Number 10
Table 2: Registration Table
3. Doctor Table
Field Name Datatype Size Description
Doctor ID Number 10 Primary Key
Doctor Name Text 20
Father Name Text 20
Email Text 50
Contact No. Text 11
Qualifications Text 50
Gender Text 01
Blood Group Text 05
Date of
Joining
Date
Address Text 100
Table 3: Doctor Table
4. Patient Registration Table
Field Name Datatype Size Description
Patient ID Number 10 Primary Key
Patient Name Text 20
Father Name Text 20
Email Text 30
Contact No. Number 11
Age Number 02
Remarks Text 100
Gender Text 01
Blood Group Text 03
Address Text 100
Table 4: Patient Registration Table
5. Admit Patient Room Table
Field Name Datatype Size Description
Patient ID Number 10 Primary Key
Disease Text 50
Admit Date Date
Room No. Number 05 References
from ‘Room’
Table
Doctor ID Number 10 References
from ’Doctor’
Table
AP_Remarks Text 50
Table 5: Admit Patient Room Table
6. Discharge Patient Room Table
Field Name Datatype Size Description
Admit ID Number 20
Discharge
Date
Date
DP_Remarks Text 50
Table 6: Discharge Patient Room Table
7. Room Table
Field Name Datatype Size Description
Room No. Number 05 Primary Key
Room Type Text 10
Room Charges Number 10
Room Status Text 10
Table 7: Room Table
8. Services Table
Field Name Datatype Size Description
Service Name Text 20
Service Date Date
Patient ID Number 10 References
from ‘Patient
Registration’
Table
Service
Charges
Number 10
Service ID Number 10 Primary Key
Auto-
increment
Table 8: Services Table
9. Bill Room Table
Field Name Datatype Size Description
Discharge ID Number 05
Billing Date Date
No. of Days Number 05
Service
Charges
Number 10
Payment
Mode
Text 20
Payment
Mode Details
Text 100
Room Charges Number 10
Total Room
Charges
Number 10
Total Charges Number 10
Bill No. Text 15 Primary Key
Table 9: Bill Room Table
5.2 GUI Design
The user interfaces for this application were designed using Netbeans
IDE. The following subsections present the descriptions of these
interfaces.
5.2.1 Login Form
The login form of the application is shown in Figure 2.It is the first form
of the application where the user is prompted to enter the username and
the password.
Figure 2: Login Form
5.2.2 Home Screen
The home screen of the application is as shown in the Figure 3. It
contains a menu bar with different menus viz. Users, Patients, Doctors,
Rooms and Help. This form allows the user to navigate through these
menus and do the relevant task.
Figure 3: Home Screen
The various options available under these menus are as follows:
5.2.2.1 Users Menu
Figure 4: Users Menu
a) New User
This option allows the user to register another user using his/her
username. The shortcut key to select this option is Ctrl+N.
Figure 5 shows the form which is to be filled to register as user.
Figure 5: New User Form
b) Change Password
This option lets the user to change his/her login password. User
can also change his/her password by using the shortcut key Ctrl+C.
The Change Password form is as shown in the Figure 6.
Figure 6: Change Password Form
c) Login Details
This option lets the administrator see the details of other users. The
details can also be seen pressing Ctrl+D.
Figure 7 shows the form containing login details.
Figure 7: Login Details
5.2.2.2 Patients Menu
Figure 8: Patients Menu
a) Registration
The registration form is as shown in the Figure 9. This form is
accessed when the user clicks the registration option or presses the
key Ctrl+R. On this form, patient is registered by filling the form.
It allows selecting a doctor from a list of available doctors by
clicking on the doctor’s name. It also shows the list of registered
patients.
Figure 9: Registration Form
b) Services
The services form is as shown in the Figure 10. It allows selecting
the name of the patient receiving services from a table containing
the name of registered patients.
The shortcut key Ctrl+S can also be used to open this form.
Figure 10: Services Form
5.2.2.3 Doctors Menu
Figure 11: Services Menu
a) Entry
Figure 12 shows the Doctor’s Registration form which can be
accessed by selecting Entry option from Doctors Menu or by
pressing Ctrl+E.
This form registers the doctor with the hospital/clinic and marks
him/her as available to treat the patients.
Figure 12: Doctor’s Registration Form
5.2.2.4 Rooms Menu
Figure 13: Rooms Menu
a) Add Rooms
Figure 14 shows the Add Room form. This option adds a
room in the hospital and is marked as vacant by default. The
room type can either be General or Deluxe. The form also
shows a list of rooms along with their type, charges and
status.
Figure 14: Add Rooms Form
b) Admit
The Patient Admit form is as shown in Figure 15. The form
shows two tables from which the patient to be admitted and
the doctor attending the patient can be choosen.
Figure 15: Patient Admit Form
c) Discharge
Figure 16 shows the discharge form. By clicking the”>” button
(placed alongside the Patient ID text field) , all the entry gets
filled . Only “Discharge Date” and “Remarks “need to be filled
to discharge the patient.
Figure 16: Discharge Form
d) Billing
The successfully discharged patient has to pay the bill for the
treatment and services received by him at the hospital. The
Billing form is as shown in Figure 17.
The button”>” (placed alongside the Patient ID textfield)
displays the list of patients who have been discharged. The
Admin selects the name for whom he wants to generate bill.
The patient info gets filled when Admin selects the name. The
“Payment Details” are filled by the admin and a “Bill No.” is
generated.
Figure 17: Billing Form
5.2.2.4 Help Menu
Figure 18: Help Menu
a) About
Figure 19 shows the About Menu which recites the facility
provided by this Hospital Management System and also
briefs about the developer of this application.
Ctrl+I can also be used to jump to this option.
Figure 19: About
b) Logout
By clicking on the Logout menu or by pressing the key
Ctrl+L user logs out from the application.
6. Implementation
Implementation in software development is the process of realizing an
application’s requirements and design. It mainly involves mapping the
design into coding in order to achieve the specifications stated for the
application. This section will describe the key implementation processes
and some code snippets of this desktop application.
6.1 Login Page
Code Snippet 1 shows the process for logging on the application.
The username and password entered in the form are matched with the
user details stored in the database. If the details entered are identical
with the stored information then the permission is granted otherwise a
message is displayed as “Login Failed!!”
The username ”Ranjit” and password “hr36” can be used to login for the
first time.
import javax.swing.JOptionPane;
import java.sql.*;
public class login extends javax.swing.JFrame {
public login() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
if (txtUsername.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter user name");
return;
}
if (jPassword.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter password");
return;
}
con=Connect.ConnectDB();
String sq1= "select * from users where user_name= '" + txtUsername.getText() +
"' and password ='" + jPassword.getText() + "'";
try{
pst=con.prepareStatement(sq1);
rs= pst.executeQuery();
if (rs.next()){
this.hide();
Main frm=new Main();
frm.setVisible(true);
}
else{
JOptionPane.showMessageDialog(null, "Login Failed..Try again !");
}
}catch(SQLException e){
JOptionPane.showMessageDialog(null, e);
}
}
6.2 Home Page
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent
evt) {
ChangePassword ob1=new ChangePassword();
ob1.setVisible(true);
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent
evt) {
NewUser ob1=new NewUser();
ob1.setVisible(true);
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent
evt) {
LoginDetails ob1=new LoginDetails();
ob1.setVisible(true); // TODO add your handling code here:
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent
evt) {
Entry ob1=new Entry();
ob1.setVisible(true);
}
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent
evt) {
About ob1=new About();
ob1.setVisible(true);
}
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent
evt) {
Registration ob1=new Registration();
ob1.setVisible(true);
}
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent
evt) {
Services ob1=new Services();
ob1.setVisible(true);
}
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent
evt) {
Room obj1=new Room();
obj1.setVisible(true);
}
private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent
evt) {
Patient_Admit_Room obj1=new Patient_Admit_Room();
obj1.setVisible(true);
}
private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent
evt) {
Bill_Room obj1=new Bill_Room();
obj1.setVisible(true);
}
private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent
evt) {
Patient_Discharge_room obj1=new Patient_Discharge_room();
obj1.setVisible(true);
}
private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent
evt) {
login obj1= new login();
obj1.setVisible(true);
}
6.3 New User
The implementation of registering new user is given below.
Connect.DB() method is used to connect the application with database.
The “fieldname.equals()”(the field name may vary) method makes sure
that none of the entry is left blank. The string “sql2” is used to check
that already existed username in the database is not entered while
registering as a new user. If any text field is left blank then a
corresponding message is shown in dialog box with the help of
JOPtionPane.showMessageDialog() method. If the username entered is
not as same as one in the database then string “sql2” is used to enter the
details entered in the registration form to be stored in the database.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class NewUser extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public NewUser() {
initComponents();
}
private void reset()
{
txtName.setText("");
txtUsername.setText("");
jPassword.setText("");
txtEmailid.setText("");
txtContactno.setText("");
Save.setEnabled(true);
Delete.setEnabled(false);
Update.setEnabled(false);
}
try{
con=Connect.ConnectDB();
if (txtName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter name");
return;
}
if (txtUsername.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter user name");
return;
}
if (jPassword.equals("")) {
JOptionPane.showMessageDialog( this, "Please enter password");
return;
}
if (txtContactno.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter contact no.");
return;
}
if (txtEmailid.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter email id");
return;
}
Statement stmt= con.createStatement();
String sql1="Select user_name from registration where user_name= '" +
txtUsername.getText() + "'";
rs=stmt.executeQuery(sql1);
if(rs.next()){
JOptionPane.showMessageDialog( this, "User name already exists");
txtUsername.setText("");
return;
}
String sql= "insert into
registration(user_name,password,name,email_id,contact_no)values('"+
txtUsername.getText() + "','" + jPassword.getText() + "','" + txtName.getText() +
"','" + txtEmailid.getText() + "','" + txtContactno.getText() + "')";
pst=con.prepareStatement(sql);
pst.execute();
String sql2= "insert into users(user_name,password)values('" +
txtUsername.getText() + "','" + jPassword.getText() + "')";
pst=con.prepareStatement(sql2);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully Registered");
Save.setEnabled(false);
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void DeleteActionPerformed(java.awt.event.ActionEvent evt) {
try
{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete
?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from registration where user_name = '" +
txtUsername.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
String sql1= "delete from Users where user_name = '" + txtUsername.getText() +
"'";
pst=con.prepareStatement(sql1);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully deleted");
reset();
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void UpdateActionPerformed(java.awt.event.ActionEvent evt) {
try{
con=Connect.ConnectDB();
String sql= "update registration set password='" + jPassword.getText() +
"',name='" + txtName.getText() + "',email_id='" + txtEmailid.getText() +
"',contact_no='" + txtContactno.getText() + "' where user_name='" +
txtUsername.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
String sql2= "update users set password='" + jPassword.getText() + "' where
user_name='" + txtUsername.getText() + "'";
pst=con.prepareStatement(sql2);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully updated","User
info",JOptionPane.INFORMATION_MESSAGE);
Update.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void GetDataActionPerformed(java.awt.event.ActionEvent evt) {
this.hide();
UserRecord ob1 = new UserRecord();
ob1.setVisible(true);
}
6.4 Update User
The implementation of registering patientis shown in the code below.
Connect.DB() method is used to connect the application with database.
The string “sql2” is responsible for updating the users detail stored in the
database.
try{
con=Connect.ConnectDB();
Statement stmt1= con.createStatement();
String s= cmbRoomNo.getSelectedItem().toString();
String t= cmbRoomNo1.getSelectedItem().toString();
if (!t.equals(s)){
String sql2="Select RoomNo from Room where RoomNo= '" +
cmbRoomNo.getSelectedItem()+ "' and RoomStatus='Booked'";
rs=stmt1.executeQuery(sql2);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Room is already booked","Error",
JOptionPane.ERROR_MESSAGE);
cmbRoomNo.setSelectedItem("");
cmbRoomNo.requestDefaultFocus();
return;
}
}
Code Snippet 3: Updating user details
6.5 Delete Patient Record
Code Snippet 4 shows the implementation of registering patient.
Connect.DB() method is used to connect the application with database.
The string “sql” is responsible for deleting the users detail stored from
the database.
private void DeleteActionPerformed(java.awt.event.ActionEvent evt) {
try
{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to
delete ?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from registration where user_name = '" +
txtUsername.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
String sql1= "delete from Users where user_name = '" +
txtUsername.getText() + "'";
pst=con.prepareStatement(sql1);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully deleted");
reset();
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
Code Snippet 4: Deleting patient details
6.6 Services
The implementation of providing services to the patient is shown below.
Connect.DB() method is used to connect the application with database.
Get_Data1() method is used to retrieve patient details from database
using string “sql”.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
public class Services extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Services() {
initComponents();
setLocationRelativeTo(null);
txtServiceID.setVisible(false);
Get_Data1();
}
private void Get_Data1(){
try{
con=Connect.ConnectDB();
String sql="select PatientID as 'Patient ID', PatientName as 'Patient
Name' from Patientregistration order by PatientName";
pst=con.prepareStatement(sql);
rs= pst.executeQuery();
tblPatient.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void Reset()
{
txtPatientID.setText("");
txtServiceCharges.setText("");
txtPatientName.setText("");
txtServiceDate.setText("");
txtServiceName.setText("");
txtSave.setEnabled(true);
txtUpdate.setEnabled(false);
txtDelete.setEnabled(false);
}
private void txtNewActionPerformed(java.awt.event.ActionEvent
evt) {
Reset();
}
private void txtSaveActionPerformed(java.awt.event.ActionEvent evt) {
try{
con=Connect.ConnectDB();
if (txtServiceName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter service name");
return;
}
if (txtServiceDate.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter service date");
return;
}
if (txtPatientID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve patient id");
return;
}
if (txtServiceCharges.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter service charges");
return;
}
String sql= "insert into
Services(ServiceName,ServiceDate,PatientID,ServiceCharges)values('
"+ txtServiceName.getText() + "','"+ txtServiceDate.getText() + "','" +
txtPatientID.getText() + "'," + txtServiceCharges.getText() + ")";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
saved","Record",JOptionPane.INFORMATION_MESSAGE);
txtSave.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void txtDeleteActionPerformed(java.awt.event.ActionEvent
evt) {
try{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to
delete ?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from Services where ServiceID = " +
txtServiceID.getText() + "";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully deleted");
Reset();
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void txtUpdateActionPerformed(java.awt.event.ActionEvent
evt) {
try{
con=Connect.ConnectDB();
String sql= "update Services set ServiceName='" +
txtServiceName.getText() +"',ServiceDate='" +
txtServiceDate.getText()+ "',PatientID='" + txtPatientID.getText() +
"',ServiceCharges='" + txtServiceCharges.getText() + "' where
ServiceID='" + txtServiceID.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully updated");
txtUpdate.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void txtGetDataActionPerformed(java.awt.event.ActionEvent
evt) {
this.hide();
ServicesRec frm= new ServicesRec();
frm.setVisible(true);
}
private void tblPatientMouseClicked(java.awt.event.MouseEvent evt) {
try{
con=Connect.ConnectDB();
int row= tblPatient.getSelectedRow();
String table_click= tblPatient.getModel().getValueAt(row,
0).toString();
String sql= "select * from PatientRegistration where PatientID = '" +
table_click + "'";
pst=con.prepareStatement(sql);
rs= pst.executeQuery();
if(rs.next()){
String add1=rs.getString("PatientID");
txtPatientID.setText(add1);
String add2=rs.getString("Patientname");
txtPatientName.setText(add2);
}
}catch(Exception ex){
JOptionPane.showMessageDialog(this,ex);
}
}
Code Snippet 5: Services
6.7Patient Registration
The implementation of registering patient is shown in the code.
Connect.DB() method is used to connect the application with database.
The “fieldname.equals()”( the field names may vary) method makes sure
that none of the entry is left blank. If any text field is left blank then a
corresponding message is shown in dialog box with the help of
JOPtionPane.showMessageDialog() method. The string “sql2” is used to
check that already existed username in the database is not entered while
registering as a new user. If the username entered is not as same as one
in the database then string “sql” is used to enter the details entered in the
registration form to be stored in the database.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class Registration extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Registration() {
initComponents();
}
try{
con=Connect.ConnectDB();
if (txtId.getText().equals("")) {
OptionPane.showMessageDialog( this, "Please enter patient id","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter patient
name","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtFname.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter Father's
name","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtAdd.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter address","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtContact.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter contact
no.","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtAge.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter age","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (cmbGender.getSelectedItem().equals("")) {
JOptionPane.showMessageDialog( this, "Please select gender","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (cmbBG.getSelectedItem().equals("")) {
JOptionPane.showMessageDialog( this, "Please select blood
group","Error", JOptionPane.ERROR_MESSAGE);
return;
}
Statement stmt= con.createStatement();
String sql1="Select PatientID from PatientRegistration where
PatientID= '" + txtId.getText() + "'";
rs=stmt.executeQuery(sql1);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Patient ID already
exists","Error", JOptionPane.ERROR_MESSAGE);
txtId.setText("");
txtId.requestDefaultFocus();
return;
}
String sql= "insert into
PatientRegistration(PatientID,Patientname,FatherName,Email,Contact
No,Age,Remarks,Gen,BG,Address)values('"+ txtId.getText() + "','"+
txtName.getText() + "','"+ txtFname.getText() + "','"+
txtEmail.getText() + "','"+ txtContact.getText() + "'," +
txtAge.getText() + ",'"+ txtInfo.getText() + "','" +
cmbGender.getSelectedItem() + "','"+ cmbBG.getSelectedItem() + "','"
+ txtAdd.getText() + "')";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
Registered","Patient",JOptionPane.INFORMATION_MESSAGE);
btnSave.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnGetDataActionPerformed(java.awt.event.ActionEvent
evt) {
this.hide();
PatientRec frm=new PatientRec();
frm.setVisible(true);
Code Snippet 6: Registering patient
6.8 Admit Patient
The implementation of admitting patient is given in the code below.
Connect.DB() method is used to connect the application with database.
Get_Data1() method is used to retrieve patient details from database
using string “sql”.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
public class Patient_Admit_Room extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Patient_Admit_Room() {
initComponents();
setLocationRelativeTo(null);
fillcombo();
cmbRoomNo.setSelectedIndex(-1);
cmbRoomNo1.setVisible(false);
Get_Data1();
GetRecord();
}
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try{
con=Connect.ConnectDB();
if (PatientID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve Patient
ID","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtPatientName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve Patient
Name","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtGender.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve
Gender","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtBloodGroup.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve blood
group","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtDisease.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter disease","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtAdmitDate.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter admit
date","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (cmbRoomNo.getSelectedItem().equals("")) {
JOptionPane.showMessageDialog( this, "Please select room no.","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtDoctorID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve doctor
id","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtDoctorName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter retrieve doctor
name","Error", JOptionPane.ERROR_MESSAGE);
return;
}
Statement stmt1= con.createStatement();
String sql2="Select RoomNo from Room where RoomNo= '" +
cmbRoomNo.getSelectedItem()+ "' and RoomStatus='Booked'";
rs=stmt1.executeQuery(sql2);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Room is already
booked","Error", JOptionPane.ERROR_MESSAGE);
cmbRoomNo.setSelectedItem("");
cmbRoomNo.requestDefaultFocus();
return;
}
Statement stmt= con.createStatement();
String sql1="Select PatientID,AdmitDate from AdmitPatient_Room
where PatientID= '" + PatientID.getText() + "' and AdmitDate='" +
txtAdmitDate + "'";
rs=stmt.executeQuery(sql1);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Record already exists","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
String sql= "insert into
admitpatient_room(PatientID,Disease,AdmitDate,RoomNo,DoctorID,A
P_Remarks)values('"+ PatientID.getText() + "','"+ txtDisease.getText()
+ "','"+ txtAdmitDate.getText() + "','"+
cmbRoomNo.getSelectedItem()+ "','" + txtDoctorID.getText() + "','"+
txtRemarks.getText() + "')";
Pst =con.prepareStatement(sql);
pst.execute();
String sql3= "update room set RoomStatus='Booked' where RoomNo='"
+ cmbRoomNo.getSelectedItem() + "'";
pst=con.prepareStatement(sql3);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
admitted","Patient",JOptionPane.INFORMATION_MESSAGE);
btnSave.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
Code Snippet 7: Admitting Patient
6.9 Discharge Patient
The implementation of discharging patient is given in the code.
Connect.DB() method is used to connect the application with database.
The string “sql” is responsible for inserting the discharge details of the
patient in the table “Discharge Patient Room”. The string “sql3” updates
the table” Room” and marks the status of room as vacant.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
public class Patient_Discharge_room extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Patient_Discharge_room() {
initComponents();
setLocationRelativeTo(null);
}
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try{
con=Connect.ConnectDB();
if (PatientID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve Patient ID");
return;
}
if (txtPatientName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve patient
Name");
return;
}
if (txtGender.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve Gender");
return;
}
if (txtBloodGroup.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve blood group");
return;
}
if (txtDisease.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve disease");
return;
}
if (txtAdmitDate.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve admit date");
return;
}
if (txtDoctorID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve doctor id");
return;
}
if (txtDoctorName.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter retrieve doctor
name");
return;
}
if (txtDischargeDate.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter discharge date");
return;
}
Statement stmt;
stmt= con.createStatement();
String sql1="Select AdmitID from DischargePatient_Room
where AdmitID= " + PatientID.getText() + "";
rs=stmt.executeQuery(sql1);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Record already exists");
return;
}
String sql= "insert into
DischargePatient_Room(AdmitID,DischargeDate,DP_Remarks)values("+
PatientID.getText() + ",'"+ txtDischargeDate.getText() + "','"+
txtRemarks.getText() + "')";
pst=con.prepareStatement(sql);
pst.execute();
String sql3= "update room set RoomStatus='Vacant' where RoomNo='"
+ txtRoomNo.getText() + "'";
pst=con.prepareStatement(sql3);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
discharged","Patient",JOptionPane.INFORMATION_MESSAGE);
btnSave.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnDeleteActionPerformed(java.awt.event.ActionEvent
evt) {
try{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to
delete ?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from DischargePatient_Room where AdmitID = " +
PatientID.getText() + "";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully deleted");
Reset();
}
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnUpdateActionPerformed(java.awt.event.ActionEvent
evt) {
try{
con=Connect.ConnectDB();
String sql= "update DischargePatient_Room set
AdmitID="+PatientID.getText() + ",DischargeDate='"+
txtDischargeDate.getText() + "',DP_Remarks='"+
txtRemarks.getText() + "' where AdmitID= " + PatientID.getText() +
"";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully updated");
btnSave.setEnabled(false);
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
Code Snippet 8: Method for discharging patient
6.10 Rooms
The implementation of adding rooms and doing rooms related tasks is
shown in the code below.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
public class Room extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Room() {
initComponents();
con= Connect.ConnectDB();
Get_Data();
setLocationRelativeTo(null);
}
private void Reset()
{
txtRoomNo.setText("");
txtRoomCharges.setText("");
cmbRoomType.setSelectedIndex(-1);
btnSave.setEnabled(true);
btnDelete.setEnabled(false);
btnUpdate.setEnabled(false);
txtRoomNo.requestDefaultFocus();
Get_Data();
}
private void Get_Data(){
String sql="select RoomNo as 'Room No.',RoomType as 'Room Type',
RoomCharges as 'Room Charges',RoomStatus as 'Room Status' from
Room";
try{
pst=con.prepareStatement(sql);
rs= pst.executeQuery();
Room_table.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}}
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {
Reset();
}
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try{
con=Connect.ConnectDB();
if (txtRoomNo.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter room no.","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (cmbRoomType.getSelectedItem().equals("")) {
JOptionPane.showMessageDialog( this, "Please select room
type","Error", JOptionPane.ERROR_MESSAGE);
return;
}
if (txtRoomCharges.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter room
Charges","Error", JOptionPane.ERROR_MESSAGE);
return;
}
Statement stmt= con.createStatement();
String sql1="Select RoomNo from Room where RoomNo= '" +
txtRoomNo.getText() + "'";
rs=stmt.executeQuery(sql1);
if(rs.next()){
JOptionPane.showMessageDialog( this, "Room No. already
exists","Error", JOptionPane.ERROR_MESSAGE);
txtRoomNo.setText("");
txtRoomNo.requestDefaultFocus();
return;
}
String sql= "insert into
Room(RoomNo,RoomType,RoomCharges,RoomStatus)values('"+
txtRoomNo.getText() + "','"+ cmbRoomType.getSelectedItem() + "'," +
txtRoomCharges.getText() + ",'Vacant')";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully saved","Room
Record",JOptionPane.INFORMATION_MESSAGE);
btnSave.setEnabled(false);
Get_Data();
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnUpdateActionPerformed(java.awt.event.ActionEvent
evt) {
try{
con=Connect.ConnectDB();
String sql= "update Room set Roomtype='"+
cmbRoomType.getSelectedItem() + "',RoomCharges=" +
txtRoomCharges.getText() + " where RoomNo='" +
txtRoomNo.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully updated","Room
Record",JOptionPane.INFORMATION_MESSAGE);
btnUpdate.setEnabled(false);
Get_Data();
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnDeleteActionPerformed(java.awt.event.ActionEvent
evt) {
try
{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to
delete ?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from Room where RoomNo = '" +
txtRoomNo.getText() + "'";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
deleted","Record",JOptionPane.INFORMATION_MESSAGE);
Reset();
}
}catch( SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnGetDataActionPerformed(java.awt.event.ActionEvent
evt) {
Get_Data();
}
private void Room_tableMouseClicked(java.awt.event.MouseEvent evt) {
try{
con=Connect.ConnectDB();
int row= Room_table.getSelectedRow();
String table_click= Room_table.getModel().getValueAt(row,
0).toString();
String sql= "select * from Room where RoomNo = '" + table_click + "'";
pst=con.prepareStatement(sql);
rs= pst.executeQuery();
if(rs.next()){
String add1=rs.getString("RoomNo");
txtRoomNo.setText(add1);
String add2=rs.getString("RoomType");
cmbRoomType.setSelectedItem(add2);
int add3 = rs.getInt("RoomCharges");
String add4= Integer.toString(add3);
txtRoomCharges.setText(add4);
btnUpdate.setEnabled(true);
btnDelete.setEnabled(true);
btnSave.setEnabled(false);
}
}catch(Exception ex){
JOptionPane.showMessageDialog(this,ex);
}
}
6.11 Generating Bill
The method for generating bill after discharging the patient is shown
below. Connect.DB() method is used to connect the application with
database. The string “sql1” is responsible for verifying patient’s detail
stored in the database is not same. Further, the string, “sql” is
responsible for inserting details of the form “Bill” in the table
Bill_Room.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.lang.String;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
public class Bill_Room extends javax.swing.JFrame {
Connection con=null;
ResultSet rs=null;
PreparedStatement pst=null;
public Bill_Room() {
initComponents();
setLocationRelativeTo(null);
Get_Data1();
}
private void Get_Data1(){
try{
con=Connect.ConnectDB();
String sql="select PatientRegistration.PatientID as 'Patient ID', PatientName as
'Patient Name',sum(serviceCharges) as 'Service Charges' from
Services,PatientRegistration where
Services.PatientID=PatientRegistration.PatientID group by
PatientRegistration.PatientID,PatientName order by PatientName";
pst=con.prepareStatement(sql);
rs= pst.executeQuery();
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
private void Reset(){
txtDoctorID.setText("");
txtDoctorName.setText("");
PatientID.setText("");
txtPatientName.setText("");
txtBloodGroup.setText("");
txtGender.setText("");
txtDisease.setText("");
txtAdmitDate.setText("");
txtRoomNo.setText("");
txtServiceCharges.setText("");
txtRoomCharges.setText("");
txtPaymentModeDetails.setText("");
txtTotalCharges.setText("");
txtBillingDate.setText("");
cmbPaymentMode.setSelectedIndex(-1);
txtDischargeDate.setText("");
txtNoOfDays.setText("");
txtTotalRoomCharges.setText("");
btnSave.setEnabled(true);
btnUpdate.setEnabled(false);
btnDelete.setEnabled(false);
}
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {
if(PatientID.getText().equals("")){
JOptionPane.showMessageDialog(this,"Please Enter Patient data first!");
}
else{
try{
con=Connect.ConnectDB();
int row= jTable1.getSelectedRow();
String val =jTable1.getModel().getValueAt(row,2).toString();
txtServiceCharges.setText(val);
int totalRoomCharges = Integer.parseInt(txtTotalRoomCharges.getText());
int totalCharges = totalRoomCharges +
Integer.parseInt(txtServiceCharges.getText());
txtTotalCharges.setText(Integer.toString(totalCharges));
}catch(Exception ex){
JOptionPane.showMessageDialog(this,ex);
}
}
}
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {
Reset();
}
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {
try{
con=Connect.ConnectDB();
if (PatientID.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve Patient ID","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtNoOfDays.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter no. of days","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtServiceCharges.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please retrieve service charges","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (txtBillingDate.getText().equals("")) {
JOptionPane.showMessageDialog( this, "Please enter billing date","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
Statement stmt = null;
try {
stmt = con.createStatement();
} catch (SQLException ex) {
Logger.getLogger(Bill_Room.class.getName()).log(Level.SEVERE, null, ex);
}
String sql1="Select DischargeID from Bill_Room where DischargeID= " +
PatientID.getText() + "";
try {
rs = stmt.executeQuery(sql1);
} catch (SQLException ex) {
Logger.getLogger(Bill_Room.class.getName()).log(Level.SEVERE, null, ex);
}
if(rs.next()){
JOptionPane.showMessageDialog( this, "Record already exists","Error",
JOptionPane.ERROR_MESSAGE);
return;
}
String sql= "insert into
Bill_Room(DischargeID,BillingDate,RoomCharges,ServiceCharges,PaymentMode,Pay
mentModeDetails,TotalCharges,NoOfDays,TotalRoomCharges,BillNo)values(" +
PatientID.getText() + ",'"+ txtBillingDate.getText() + "',"+
txtRoomCharges.getText() + ","+ txtServiceCharges.getText() + ",'" +
cmbPaymentMode.getSelectedItem()+ "','" + txtPaymentModeDetails.getText() +
"',"+ txtTotalCharges.getText() +","+ txtNoOfDays.getText() + "," +
txtTotalRoomCharges.getText() + ",'"+txtBillNo.getText()+"')";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
saved","Record",JOptionPane.INFORMATION_MESSAGE);
btnSave.setEnabled(false);
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {
try{
int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete
?","Confirmation",JOptionPane.YES_NO_OPTION);
if (P==0)
{
con=Connect.ConnectDB();
String sql= "delete from Bill_Room where BillNo = " + txtBillNo.getText() + "";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
deleted","Record",JOptionPane.INFORMATION_MESSAGE);
Reset();
}
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {
try{
con=Connect.ConnectDB();
String sql= "update Bill_Room set DischargeID="+ PatientID.getText() +
",BillingDate='"+ txtBillingDate.getText() + "',RoomCharges="+
txtRoomCharges.getText() + ",ServiceCharges="+ txtServiceCharges.getText() +
",PaymentMode='" + cmbPaymentMode.getSelectedItem()+
"',PaymentModeDetails='" + txtPaymentModeDetails.getText() +
"',TotalCharges="+ txtTotalCharges.getText() + ",NoOfDays="+
txtNoOfDays.getText() +",TotalRoomCharges=" + txtTotalRoomCharges.getText()
+ " where BillNo= " + txtBillNo.getText() +"";
pst=con.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(this,"Successfully
Updated","Record",JOptionPane.INFORMATION_MESSAGE);
btnUpdate.setEnabled(false);
}catch(SQLException ex){
JOptionPane.showMessageDialog(this,ex);
}
}
private void btnGetDataActionPerformed(java.awt.event.ActionEvent evt) {
this.hide();
Bill_RoomRec frm= new Bill_RoomRec();
frm.setVisible(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
this.hide();
Patient_Discharge_roomRec2 frm = new Patient_Discharge_roomRec2();
frm.setVisible(true);
}
Code Snippet 9: Generating Bill
7. TESTING
Software testing is carried out on a software application mainly to detect
software bugs or missing requirements of the application. It involves the
process of investigating and evaluating a software product or application
in order to make sure that its business and technical requirements are
fulfilled. For the purpose of testing, this application was deployed and
run on Netbeans IDE 6.5.1. For simplicity, the testing template in
Table 10 was used for the testing.
Table 10. Software testing template and results.
S.No. Test
Description
Steps Expected
System
Response
Status
(Pass/Fail)
1. Access the login
form of the
application to
view home
screen.
Enter the
username and
password in the
login form.
The home
screen of the
application is
displayed.
Pass
2. Registering New
User
Go to User
menu. Select
New User
option. Fill the
form and click
on Save button.
A message
”Successfully
Registered” is
displayed in a
dialog box.
Pass
3. Updating User
Details
Click “Get
Data” button.
Select the user
whose details
need to be
updated and
click on Save
button.
A message
”Successfully
Updated” is
displayed in a
dialog box.
Pass
4. Viewing Login
Details
Go to Users tab
and select
Login Details.
A form
containing
username and
password is
displayed.
Pass
5. Registering New
Patient
Go to Patient
menu. Select
Registration
option. Fill the
form and click
on Save button.
A message
”Successfully
Registered” is
displayed in a
dialog box.
Pass
6. Services Go to Patient
menu. Select
Services
option. Fill the
form and click
on Save button.
A message
”Successfully
Registered” is
displayed in a
dialog box.
Pass
7. Doctor
Registration
Go to Doctors
menu. Select
Entry option.
Fill the form
A message
”Successfully
Registered” is
displayed in a
Pass
and click on
Save button.
dialog box.
8. Adding Rooms Go to Rooms
menu. Select
Add Rooms
option. Fill the
form and click
on Save button.
A message
”Room Added”
is displayed in a
dialog box.
Pass
9. Admitting
Patient
Go to Rooms
Menu. Select
Admit option.
Fill the form
and click on
Save button.
A message
”Successfully
admitted” is
displayed in a
dialog box.
Pass
10. Discharging
Patient
Go to Rooms
Menu. Select
Discharge
option. Fill the
form and click
on Save button.
A message
”Successfully
discharged” is
displayed in a
dialog box.
Pass
11. Generating Bill Go to Rooms
Menu. Select
Discharge
option. Fill the
form and click
on Save button.
A bill no. is
generated by
concatenating
patient ID and
Date of
discharge.
Pass
12. Help Go to About
Menu. Select
Help option.
A form
containing
description of
the application
is displayed
Pass
8. CONCLUSION
The project Hospital ManagementSystem (HMS) is for computerizing the
working in a hospital. The software takes care of all the requirements of an average
hospital and is capable to provide easy and effective storage of information related
to patients that come up to the hospital.
It generates test reports; provide prescription details including various tests, diet
advice, and medicines prescribed to patient and doctor. It also provides injection
details and billing facility on the basis of patient’s status whether it is an indoor or
outdoorpatient. The system also provides the facility of backup as per the
requirement.
Future Enhancements
The proposed system is Hospital Management System. We can enhance
this system by including more facilities like pharmacy system for the
stock details of medicines in the pharmacy. Providing such features
enable the users to include more comments in the system.
9. BIBLIOGRAPHY
1. Informatics Practices –XI by Sumita Arora
2. Informatics Practices –XII by Sumita Arora
Web References:
1. www.istockphotos.com
2. www.google.com
3. www.geeksforgeeks.com

More Related Content

What's hot

Hospital management system
Hospital management systemHospital management system
Hospital management systemAsmat Hayat
 
Hospital management system(database)
Hospital management system(database)Hospital management system(database)
Hospital management system(database)Iftikhar Ahmad
 
Hospital Management System proposal
Hospital Management System proposalHospital Management System proposal
Hospital Management System proposalChandresh Prasad
 
Design and implementation of a hospital management system
Design and implementation of a hospital management systemDesign and implementation of a hospital management system
Design and implementation of a hospital management systemOvercomer Michael
 
Hospital Management System Presentation
Hospital Management System PresentationHospital Management System Presentation
Hospital Management System PresentationSanjeev Kumar Rao
 
HOSPITAL MANAGEMENT SYSTEM ppt
HOSPITAL MANAGEMENT SYSTEM pptHOSPITAL MANAGEMENT SYSTEM ppt
HOSPITAL MANAGEMENT SYSTEM pptPurbita Sen
 
Hospital management final report presentation
Hospital management final report presentationHospital management final report presentation
Hospital management final report presentationMd Abul Kalam Azad
 
Hospital management-system
Hospital management-systemHospital management-system
Hospital management-systemsam143143
 
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4NICHOLAS RATEMO
 
Synopsis of hms(Hospital Management System)
Synopsis of hms(Hospital Management System)Synopsis of hms(Hospital Management System)
Synopsis of hms(Hospital Management System)Farooq Stanikzai
 
Project Proposal(Hospital Management System)
Project Proposal(Hospital Management System)Project Proposal(Hospital Management System)
Project Proposal(Hospital Management System)SN Chakraborty
 
Hospital Management System.pptx
Hospital Management System.pptxHospital Management System.pptx
Hospital Management System.pptxLakshayPanchal
 
Hospital Management Record System Proposal
Hospital Management Record System ProposalHospital Management Record System Proposal
Hospital Management Record System ProposalBishal Bista
 
[PPT] Hospital management system - Quanta-his
[PPT] Hospital management system - Quanta-his[PPT] Hospital management system - Quanta-his
[PPT] Hospital management system - Quanta-hisBirlamedisoft Pvt. Ltd
 
Hospital management system
Hospital management systemHospital management system
Hospital management systemsubu
 
Hospital Management System SRS
Hospital Management System SRSHospital Management System SRS
Hospital Management System SRSChandresh Prasad
 

What's hot (20)

Hospital management system
Hospital management systemHospital management system
Hospital management system
 
HOSPITAL MANAGEMENT SYSTEM project report
HOSPITAL MANAGEMENT SYSTEM project reportHOSPITAL MANAGEMENT SYSTEM project report
HOSPITAL MANAGEMENT SYSTEM project report
 
Hospital management system(database)
Hospital management system(database)Hospital management system(database)
Hospital management system(database)
 
Hospital Management System proposal
Hospital Management System proposalHospital Management System proposal
Hospital Management System proposal
 
Design and implementation of a hospital management system
Design and implementation of a hospital management systemDesign and implementation of a hospital management system
Design and implementation of a hospital management system
 
Hospital Management System Presentation
Hospital Management System PresentationHospital Management System Presentation
Hospital Management System Presentation
 
HOSPITAL MANAGEMENT SYSTEM ppt
HOSPITAL MANAGEMENT SYSTEM pptHOSPITAL MANAGEMENT SYSTEM ppt
HOSPITAL MANAGEMENT SYSTEM ppt
 
Hospital management final report presentation
Hospital management final report presentationHospital management final report presentation
Hospital management final report presentation
 
Hospital management-system
Hospital management-systemHospital management-system
Hospital management-system
 
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4
PROJECT-HOSPITAL MANAGEMENT SYSTEM CHAP. 1 TO 4
 
Healthcare copy
Healthcare   copyHealthcare   copy
Healthcare copy
 
Synopsis of hms(Hospital Management System)
Synopsis of hms(Hospital Management System)Synopsis of hms(Hospital Management System)
Synopsis of hms(Hospital Management System)
 
Project Proposal(Hospital Management System)
Project Proposal(Hospital Management System)Project Proposal(Hospital Management System)
Project Proposal(Hospital Management System)
 
Hospital Management System
Hospital Management SystemHospital Management System
Hospital Management System
 
Hospital management system
Hospital management systemHospital management system
Hospital management system
 
Hospital Management System.pptx
Hospital Management System.pptxHospital Management System.pptx
Hospital Management System.pptx
 
Hospital Management Record System Proposal
Hospital Management Record System ProposalHospital Management Record System Proposal
Hospital Management Record System Proposal
 
[PPT] Hospital management system - Quanta-his
[PPT] Hospital management system - Quanta-his[PPT] Hospital management system - Quanta-his
[PPT] Hospital management system - Quanta-his
 
Hospital management system
Hospital management systemHospital management system
Hospital management system
 
Hospital Management System SRS
Hospital Management System SRSHospital Management System SRS
Hospital Management System SRS
 

Similar to Hospital Management System

Electronic Medical Regulation
Electronic Medical RegulationElectronic Medical Regulation
Electronic Medical RegulationAditya Chauhan
 
13569522 09 projecthospital-management-system-2
13569522 09 projecthospital-management-system-213569522 09 projecthospital-management-system-2
13569522 09 projecthospital-management-system-2bishwajit patel
 
09.project hospital management system
09.project hospital management system09.project hospital management system
09.project hospital management systemAbiola Oladejo
 
09.project hospital management system
09.project hospital management system09.project hospital management system
09.project hospital management systemshahidahmad527
 
SRS for Hospital Management System
SRS for Hospital Management SystemSRS for Hospital Management System
SRS for Hospital Management Systemkataria Arvind
 
PAMC IT PROJECT
PAMC IT PROJECTPAMC IT PROJECT
PAMC IT PROJECTvarun p v
 
IRJET - Hospital Management System
IRJET -  	  Hospital Management SystemIRJET -  	  Hospital Management System
IRJET - Hospital Management SystemIRJET Journal
 
Hospital Management System Project Report
Hospital Management System Project Report Hospital Management System Project Report
Hospital Management System Project Report Sarfaraj Alam
 
hospital management system.docx
hospital management system.docxhospital management system.docx
hospital management system.docxNikhil Patil
 
Hospital Management System SRS for software
Hospital Management System SRS for softwareHospital Management System SRS for software
Hospital Management System SRS for softwareknowledgeradha07
 
Online doctor appointment
Online doctor appointmentOnline doctor appointment
Online doctor appointmentAmna Nawazish
 
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docSCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docbosed0737
 
Srs hospital management
Srs hospital managementSrs hospital management
Srs hospital managementmaamir farooq
 
Hostpital management system(srs)
Hostpital management system(srs)Hostpital management system(srs)
Hostpital management system(srs)maamir farooq
 
Hosiptal-MS-PPT-zl64ci.pptx
Hosiptal-MS-PPT-zl64ci.pptxHosiptal-MS-PPT-zl64ci.pptx
Hosiptal-MS-PPT-zl64ci.pptxrohanthombre2
 
Hospital management system project
Hospital management system projectHospital management system project
Hospital management system projectHimani Chopra
 
Hospitalmanagementsystemproject 140513065037-phpapp02
Hospitalmanagementsystemproject 140513065037-phpapp02Hospitalmanagementsystemproject 140513065037-phpapp02
Hospitalmanagementsystemproject 140513065037-phpapp02Shekhar Prasad
 

Similar to Hospital Management System (20)

Hospital management system
Hospital management systemHospital management system
Hospital management system
 
Electronic Medical Regulation
Electronic Medical RegulationElectronic Medical Regulation
Electronic Medical Regulation
 
13569522 09 projecthospital-management-system-2
13569522 09 projecthospital-management-system-213569522 09 projecthospital-management-system-2
13569522 09 projecthospital-management-system-2
 
09.project hospital management system
09.project hospital management system09.project hospital management system
09.project hospital management system
 
09.project hospital management system
09.project hospital management system09.project hospital management system
09.project hospital management system
 
SRS for Hospital Management System
SRS for Hospital Management SystemSRS for Hospital Management System
SRS for Hospital Management System
 
PAMC IT PROJECT
PAMC IT PROJECTPAMC IT PROJECT
PAMC IT PROJECT
 
IRJET - Hospital Management System
IRJET -  	  Hospital Management SystemIRJET -  	  Hospital Management System
IRJET - Hospital Management System
 
Hospital Management System Project Report
Hospital Management System Project Report Hospital Management System Project Report
Hospital Management System Project Report
 
hospital management system.docx
hospital management system.docxhospital management system.docx
hospital management system.docx
 
Hospital Management System SRS for software
Hospital Management System SRS for softwareHospital Management System SRS for software
Hospital Management System SRS for software
 
Online doctor appointment
Online doctor appointmentOnline doctor appointment
Online doctor appointment
 
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.docSCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
SCHOOL_MANAGEMENT_SYSTEM_This_Report_Pre.doc
 
Srs hospital management
Srs hospital managementSrs hospital management
Srs hospital management
 
Hostpital management system(srs)
Hostpital management system(srs)Hostpital management system(srs)
Hostpital management system(srs)
 
Majd
MajdMajd
Majd
 
Majd
MajdMajd
Majd
 
Hosiptal-MS-PPT-zl64ci.pptx
Hosiptal-MS-PPT-zl64ci.pptxHosiptal-MS-PPT-zl64ci.pptx
Hosiptal-MS-PPT-zl64ci.pptx
 
Hospital management system project
Hospital management system projectHospital management system project
Hospital management system project
 
Hospitalmanagementsystemproject 140513065037-phpapp02
Hospitalmanagementsystemproject 140513065037-phpapp02Hospitalmanagementsystemproject 140513065037-phpapp02
Hospitalmanagementsystemproject 140513065037-phpapp02
 

Recently uploaded

Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% SafeBangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safenarwatsonia7
 
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking Models
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking ModelsMumbai Call Girls Service 9910780858 Real Russian Girls Looking Models
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking Modelssonalikaur4
 
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Availablenarwatsonia7
 
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...Miss joya
 
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% SafeBangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safenarwatsonia7
 
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment Booking
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment BookingCall Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment Booking
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment BookingNehru place Escorts
 
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbai
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service MumbaiVIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbai
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbaisonalikaur4
 
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...narwatsonia7
 
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.MiadAlsulami
 
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Availablenarwatsonia7
 
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original PhotosCall Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photosnarwatsonia7
 
Asthma Review - GINA guidelines summary 2024
Asthma Review - GINA guidelines summary 2024Asthma Review - GINA guidelines summary 2024
Asthma Review - GINA guidelines summary 2024Gabriel Guevara MD
 
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Availablenarwatsonia7
 
Aspirin presentation slides by Dr. Rewas Ali
Aspirin presentation slides by Dr. Rewas AliAspirin presentation slides by Dr. Rewas Ali
Aspirin presentation slides by Dr. Rewas AliRewAs ALI
 
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiCall Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiNehru place Escorts
 
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any Time
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any TimeCall Girls Budhwar Peth 7001305949 All Area Service COD available Any Time
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any Timevijaych2041
 
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service JaipurHigh Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipurparulsinha
 
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service Available
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls ITPL Just Call 7001305949 Top Class Call Girl Service Available
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service Availablenarwatsonia7
 
Call Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknow
Call Girl Lucknow Mallika 7001305949 Independent Escort Service LucknowCall Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknow
Call Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknownarwatsonia7
 
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbai
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service MumbaiLow Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbai
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbaisonalikaur4
 

Recently uploaded (20)

Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% SafeBangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Marathahalli 📞 9907093804 High Profile Service 100% Safe
 
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking Models
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking ModelsMumbai Call Girls Service 9910780858 Real Russian Girls Looking Models
Mumbai Call Girls Service 9910780858 Real Russian Girls Looking Models
 
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Whitefield Just Call 7001305949 Top Class Call Girl Service Available
 
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...
VIP Call Girls Pune Vrinda 9907093804 Short 1500 Night 6000 Best call girls S...
 
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% SafeBangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safe
Bangalore Call Girls Majestic 📞 9907093804 High Profile Service 100% Safe
 
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment Booking
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment BookingCall Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment Booking
Call Girls Service Nandiambakkam | 7001305949 At Low Cost Cash Payment Booking
 
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbai
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service MumbaiVIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbai
VIP Call Girls Mumbai Arpita 9910780858 Independent Escort Service Mumbai
 
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...
Call Girls Kanakapura Road Just Call 7001305949 Top Class Call Girl Service A...
 
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
 
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Hsr Layout Just Call 7001305949 Top Class Call Girl Service Available
 
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original PhotosCall Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
 
Asthma Review - GINA guidelines summary 2024
Asthma Review - GINA guidelines summary 2024Asthma Review - GINA guidelines summary 2024
Asthma Review - GINA guidelines summary 2024
 
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Jp Nagar Just Call 7001305949 Top Class Call Girl Service Available
 
Aspirin presentation slides by Dr. Rewas Ali
Aspirin presentation slides by Dr. Rewas AliAspirin presentation slides by Dr. Rewas Ali
Aspirin presentation slides by Dr. Rewas Ali
 
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiCall Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
 
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any Time
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any TimeCall Girls Budhwar Peth 7001305949 All Area Service COD available Any Time
Call Girls Budhwar Peth 7001305949 All Area Service COD available Any Time
 
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service JaipurHigh Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
 
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service Available
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls ITPL Just Call 7001305949 Top Class Call Girl Service Available
Call Girls ITPL Just Call 7001305949 Top Class Call Girl Service Available
 
Call Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknow
Call Girl Lucknow Mallika 7001305949 Independent Escort Service LucknowCall Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknow
Call Girl Lucknow Mallika 7001305949 Independent Escort Service Lucknow
 
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbai
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service MumbaiLow Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbai
Low Rate Call Girls Mumbai Suman 9910780858 Independent Escort Service Mumbai
 

Hospital Management System

  • 1. RAJOKARI INSTITUTE OF TECHNOLGY, RAJOKARI, NEW DELHI-110038 Board of Technical Education (Govt. of NCT of Delhi) MAJOR PROJECT REPORT ON HOSPITAL MANAGEMENT SYSTEM Using Java Programming and Database 2019 SUBMITTED IN PARTIAL FULFILLMENT FOR AWARD OF DIPLOMA IN COMPUTER ENGINEERING (Batch 2016-2019) SUBMITTED BY Ranjit Singh (1613051041) UNDER GUIDANCE OF Mrs. Antima Jain
  • 2. CERTIFICATE This is to certify that Hospital Management System embodies the original work done by Ranjit Singh during this project submission as a partial fulfillment of the requirement for the Hospital Management System, of Rajokari Institute of Technology. Umesh Chand Principal (Rajokari Institute of Technology) Mrs. Antima Jain Assistant Professor
  • 3. ACKNOWLEDGEMENT My unreserved gratitude goes to God, who gave me the opportunity to complete this journey. To my family, I say thank you for your support. To all my friends I say am grateful that you all came my way. Special thanks to my supervisor, Mrs. Antima Jain for her support and patience throughout this thesis project. Thanks to Mr. for the knowledge I gained from him and for pushing me to the extreme during his programming classes. I actually learnt a lot from him. Ranjit Singh
  • 4. CONTENTS 1. Introduction 1.1 Purpose 1.2 Scope 1.3 Relevant Tools and Technologies 1.3.1 Java Programming Language 1.3.2 JDK and JRE 1.3.3 MySQL 1.3.4 Netbeans IDE 1.4 Overview 2. OverallDescription 2.1 Goals of Proposed System 2.2 Background 2.3 Current Management System 2.4 ProjectRequirements 2.5 User Characteristics 2.6 Constraints 2.7 Definition of Problems 2.8 Alternative Solutions 3. Feasibility Study 3.1 Technical Feasibility 3.2 EconomicalFeasibility 3.3 Operational Feasibility 3.4 Schedule Feasibility 4. Entity Relationship Diagram 5. Database and GUI Design 5.1 Database Design 5.2 GUI Design 5.2.1 LoginForm
  • 5. 5.2.2 Home Screen 5.2.2.1 Users Menu a) New User b) Change Password c) Login Details 5.2.2.2 Patients Menu a) Registration b) Services 5.2.2.3 Doctors Menu a) Entry 5.2.2.4 Rooms Menu a) Add Rooms b) Admit c) Discharge d) Billing 5.2.2.5 Help a) About b) Logout 6. Implementation 6.1 Login Form 6.2 Home Page 6.3 New User 6.4 Update User 6.5 Delete Patient Record 6.6 Services 6.7 Patient Registration 6.8 Admit Patient 6.9 Discharge Patient 6.10 Rooms 6.11 Generating Bill 7. Testing 8. Conclusion 9. Bibliography
  • 6. LIST OF FIGURES AND TABLES Figure 1. Entity Relationship Diagram Figure 2. Login Form Figure 3. Home Screen Figure 4. Users Menu Figure 5. New User Form Figure 6. Change Password Form Figure 7. Login Details Form Figure 8. Patients Menu Figure 9. Registration Form Figure 10. Services Form Figure 11. Doctors Menu Figure 12. Entry Form Figure 13. Rooms Menu Figure 14. Add Rooms Form Figure 15. Admit Form Figure 16. Discharge Form Figure 17. Bill Form Figure 18. Help Menu Figure 19. About Form Table 1. Project Requirements Table 2. User Table Table 3. Registration Table Table 4. Patient Registration Table Table 5. Admit Patient Table Table 6. Discharge Patient RoomTable Table 7. RoomTable Table 8. Services Table Table 9. Bill RoomTable Table 10. Software testing template and results
  • 7. 1. Introduction 1.1) Purpose The Software is for the automation of Hospital Management. It maintains one levels of user:- Administrator Level The Software includes:- Maintaining Patient ‘s details. Maintaining Doctor’s details. Maintaining Room records. Bill generation. 1.2) Scope It can be used in any Hospital, Clinic and Dispensaryfor maintaining patient details. 1.3) Relevant Tools and Technologies This chapter presents some discussions about the relevant tools and technologies used to develop the e-commerce web application. Some of the tools and technologies are Java programming language, JDK and JRE, MySQL and Netbeans IDE. 1.3.1 Java Programming Language This is the main programming language used to develop the application. The Java Programming Language was formerly developed by Sun Microsystems as proposedbyJames Gosling. It was first released in 1995. It runs on Mac OS, Windows, the different versions of UNIX, and other platforms. Java is considered to be secure and robust. Also, it is multithreading and platform independent (unlike C and C++) 1.3.2 JDK and JRE The Java Development Kit (JDK) is a software development environment for developing applets and applications written in Java. It consists of an interpreter, a Java compiler, a documentation generator (JavaDoc) and several other tools for building Java applications. The Java Runtime Environment is a component of JDK, and it consists of the Java Virtual Machine (JVM), libraries, files and other
  • 8. components for running applications written in Java. JVM is an implementation of JRE for running Java bytecode. 1.3.3 MySQL MySQL is a free, open source relational database management system (RDBMS) that supports Structured QueryLanguage(SQL).An RDBMS is a system used to manage databases, and it is made up of tables containing columns and rows, where the tables are related by keys. MySQL DBMS is the world’s most popular open sourcedatabase system and one of the most commonly used database systems for Java web applications. It is one of the fastest RDBMS and it is easy to use. Also, it runs on almost all platforms, such as Windows, Linux and OS X. 1.3.4 Netbeans IDE Netbeans is an integrated development environment (IDE) for Java Netbeans allows applications to be developed from a set of modular software components called modules. Netbeans runs on Windows, macOS, Linux and Solaris. In addition to Java development, it has extensions for other languages like PHP, C, C++ and JavaScript. Applications based on Netbeans, including the Netbeans IDE, can be extended by third party developers. The latest release of Netbeans is Netbeans IDE 10.0, which was released in December 2018. 1.4) Overview Projectis related to Hospital Management System. The projectmaintains one level of users:- Administrator Level-Doctor Main facilities available in this projectare:-  Maintaining records of indoor/outdoorpatients. Maintaining records of services provided to the patient.  Maintaining records of doctors registered with the hospital/clinic.  Providing billing details for indoor/outdoorpatients.  Maintaining details of users logging in. . Administrator can search a patient’s record.
  • 9. 2. Overall Description 2.1) Goals of proposed system 1. Planned approach towards working: - The working in the organization will be well planned and organized. The data will be stored properly in data stores, which will help in retrieval of information as well as its storage. 2. Accuracy: - The level of accuracy in the proposed system will be higher. All operation would be done correctly and it ensures that whatever information is coming from the center is accurate. 3. Reliability: - The reliability of the proposed system will be high due to the above stated reasons. The reason for the increased reliability of the system is that now there would be properstorage of information. 4. No Redundancy: - In the proposedsystem utmost care would be that no information is repeated anywhere, in storage or otherwise. This would assure economic use of storage space and consistencyin the data stored. 5. Immediate retrieval of information: - The main objective of proposed system is to provide for a quick and efficientretrieval of information. Any type of information would be available whenever the user requires. 6. Immediate storage of information: - In manual system there are many problems to store the largest amount of information. 7. Easy to Operate: - The system should be easy to operate and should be such that it can be developedwithin a short period of time and fit in the limited budget of the user.
  • 10. 2.2) Background A Hospital is a place where Patients come up for general diseases. Hospitals provide facilities like:- Consultation by Doctors on Diseases. Diagnosis for diseases. Providing treatment facility. Facility for admitting Patients (providing beds,nursing, medicines etc.) Immunization for Patients/Children. Various operational works that are done in a Hospital are:- Recording information about the Patients that come. Generating bills. Recording information related to diagnosis given to Patients. Keeping record of the Immunization provided to children/patients. Keeping information about various diseases available to cure them. These are the various jobs that need to be done in a Hospital by the operational staff and Doctors.All these works are done on papers. The work is done as follows:- Information about Patients is done by just writing the Patients name, age and gender. Wheneverthe Patient comes up his information is stored freshly. Bills are generated by recording price for each facility provided to Patient on a separate sheet and at last they all are summed up. Diagnosis information to patients is generally recorded onthe document, which contains Patient information. It is destroyed after some time period to decrease the paper load in the office. Immunization records of children are maintained in pre-formatted sheets, which are kept in a file. Information about various diseases is not kept as any document. Doctor themselves do this job by remembering various medicines. All this work is done manually by the receptionistand other operational staff and lot of papers are needed to be handled and taken care of. Doctors have to remembervarious medicines available for diagnosis and sometimesmiss better alternatives as they can’t rememberthem at that time.
  • 11. 2.3) Current Management System Most hospitals face several challenges with Hospital Management System because some of them are still using manual processes, while the ones that use the computerized method are also faced with the challenge of adjusting to it. Such problems include: High cost of software development, deployment and improvement. Difficulty in migrating from manual processes, because both staff and patients are used to the manual processes and so are unable to speedily cope with the new system. Lack of IT friendly medical personnel is also presenting several challenges. Huge influx of patients visiting government hospitals makes the process of migrating to automated processes highly difficult. They do not have the patience to wait for registration and data entry and often fail to understand the functioning of automated processes. Considering the above, there is need for the improvement of computerized hospital management system to such hospitals as it would help provide and customize clinical data, enable faster diagnosis with ready-made templates, allow doctors to follow advanced medical prescription patterns, and so on.
  • 12. 2.4) Project Requirements Hardware Requirements Processor RAM Disk Space Pentium IV or higher 64 MB or higher 150 MB Software Requirements Operating System Database Win- 07 , Win -10 or any other higher version MySQL 5.1 or higher Table 1: Project Requirements 2.5) User Characteristics Every user should be: Comfortable to work on computer. He must have knowledge in medical field. He must also have basic knowledge of English too. 2.6) Constraints GUI is only in English. Login and password is used for identification of user and there is no facility for guest.
  • 13. 2.7) Definitions of problems Problems with conventional system 1. Lack of immediate retrievals: -The information is very difficult to retrieve and to find particular information like- E.g. - To find out about the patient’s history, the user has to go through various registers.This results in inconvenience and wastage of time. 2. Lack of immediate information storage: - The information generated by various transactions takes time and efforts to be stored at right place. 3. Lack of prompt updating: - Various changes to information like patient details or immunization details of child are difficultto make as paper work is involved. 4. Error prone manual calculation: - Manual calculations are error prone and take a lot of time this may result in incorrect information. For example calculation of patient’s bill based on various treatments. 5. Preparation of accurate and prompt reports: - This becomesa difficult task as information is difficultto collectfrom various registers. 2.8) Alternative Solutions 1. Improved ManualSystem:- One of the alternative solutions is the improvement of the manual system. Anything, which can be done by using automated methods,can be done manually. But the question arises how to perform thing manually in a sound manner. Following are some suggestions,which can be useful in the manual system. A more sophisticate register maintenance for various Patient Information, Doctordiary, Immunization Details and a good system for writing bill
  • 14. amount employees and stock availed for the customers can be maintained at central place. Adequate staff may be maintained so that updates are made at the very moment at the same time. Properperson for properwork should be made responsible so that a betterefficiencycould be achieved. This needs a lot of work force. 2. Batch System:- Another alternative solution can be used of computerbased batch system for maintaining the information regarding purchase details, customers and employees.A batch system refers to a system in which data is processed in a periodicalbasis. The batch system is able to achieve most of the goals and sub goals. But a batch system data is processed in sequential basis. Therefore batch system is not suggested. 3. Online System:- This system (HMS) provides online storage/updates and retrieval facility. This system promises very less or no paper work and also provides help to Doctorand operational staff. In this system everything is stored electronically so very less amount of paperwork is required and information can be retrieved very easily without searching here and there into registers.This system is beendiscussed here. 3. Feasibility Study Depending on the results of the initial investigation the survey is now expanded to a more detailed feasibility study. “FEASIBILITY STUDY” is a test of system proposalaccording to its workability, impact of the organization, ability to meet needs and effective use of the resources.It focuses onthese major questions: 1. What are the user’s demonstrable needs and how does a candidate system meet them? 2. What resources are available for given candidate system? 3. What are the likely impacts of the candidate system on the organization? 4. Whether it is worth to solve the problem?
  • 15. During feasibility analysis for this project, following primary areas of interest are to be considered.Investigation and generating ideas about a new system does this. Steps in feasibility analysis Eight steps involved in the feasibility analysis are: Form a project team and appoint a projectleader. Prepare system flowcharts. Enumerate potential proposedsystem. Define and identify characteristics of proposedsystem. Determine and evaluate performance and costeffective of each proposed system. Weightsystem performance and costdata. Selectthe best-proposed system. Prepare and report final project directive to management. 3.1) Technical feasibility A study of availability of resources that may affectthe ability to achieve an acceptable system.This evaluation determines whether the technology needed forthe proposed system is available or not. Can the work for the projectbe done with current equipmentexisting software technology& available personal? Can the system be upgraded if developed? If new technologyis needed then what can be developed? This is concerned with specifying equipmentand software that will successfullysatisfy the user requirement. The technical needs of the system may include: Front-endand back-end selection An important issue for the developmentof a project is the selectionof suitable front-end and back-end. When we decided to develop the project we went through an extensive study to determine the most suitable platform that suits the needs of the organization as well as helps in developmentof the project. The aspects of our study included the following factors.
  • 16. Front-endselection: 1. It must have a graphical user interface that assists employees that are not from IT background. 2. Scalability and extensibility. 3. Flexibility. 4. Robustness. 5. According to the organization requirement and the culture. 6. Must provide excellent reporting features with good printing support. 7. Platform independent. 8. Easy to debug and maintain. 9. Event driven programming facility. 10. Front end must supportsome popular back end like MySQL. According to the above stated features we selected Netbeans IDE 6.5.1 as the front-end for developing our project. Back-endSelection: 1. Multiple user support. 2. Efficientdata handling. 3. Provide inherent features for security. 4. Efficientdata retrieval and maintenance. 5. Stored procedures. 6. Popularity.
  • 17. 7. Operating System compatible. 8. Easy to install. 9. Various drivers must be available. 10. Easy to implant with the Front-end. According to above stated features we selected MySQL as the backend. The technical feasibility is frequently the most difficultarea encountered at this stage. It is essentialthat the process ofanalysis and definition be conducted in parallel with an assessmentto technical feasibility. It centers on the existing computersystem (hardware, software etc.) and to what extent it can supportthe proposed system. 3.2) Economical feasibility Economic justification is generally the “Bottom Line” considerationfor most systems. Economic justification includes a broad range of concerns that includes costbenefit analysis. In this we weight the costand the benefits associated with the candidate system and if it suits the basic purpose of the organization i.e. profit making, the project is making to the analysis and designphase. The financial and the economic questions during the preliminary investigation are verified to estimate the following:  The costto conducta full system investigation. The cost of hardware and software for the class of application being considered. The benefits in the form of reduced cost. The proposedsystem will give the minute information, as a result the performance is improved which in turn may be expected to provide increased profits.
  • 18. This feasibility checks whether the system can be developedwith the available funds. The Hospital ManagementSystem does not require enormous amount of money to be developed.This can be done economicallyif planned judicially, so it is economicallyfeasible. The cost of projectdepends uponthe number of man-hours required. 3.3) Operational Feasibility It is mainly related to human organizations and political aspects.The points to be consideredare: What changes will be brought with the system? What organization structures are disturbed? What new skills will be required? Do the existing staff members have these skills? If not, can they be trained in due course of time? The system is operationally feasible as it very easy for the End users to operate it. It only needs basic information about Windows platform. 3.4) Schedule feasibility Time evaluation is the most important considerationin the developmentof project.The time schedule required for the developedof this project is very important since more developmenttime effectmachine time, cost and cause delay in the developmentof other systems. A reliable Hospital ManagementSystem can be developed inthe considerable amount of time.
  • 19. 4. Entity Relationship Diagram Figure 1: Entity Relationship Diagram Hospital Management System have Admin PasswordLogin Id do Login do Patient Registration do Doctor Registration do Generate Bills create ee New Users do Admit Patients do Discharge Patients
  • 20. 5. Database and GUI Design Every Java application needs to have an operational database to store its generated data. More so, a simple and interactive Graphical User Interface (GUI) is one of the success indicators of any application project. This chapter presents the database and GUI design for this Hospital Management application. 5.1 Database Design MySQL database management system is the most popular database system for Java applications because of its speed, reliability, and flexibility. All the data generated by this application are managed on MySQL database system. The following numbered list gives a brief explanation of these tables. 5.1.1. Data Tables 1. Users Table Field Name Datatype Size Description User_name Text 20 Primary Key Password Text 20 Table 1: Users Table 2. Registration Table Field Name Datatype Size Description Name Text 20 User_Name Text 20 Primary Key Password Text 20
  • 21. Email_id Text 30 Contact_No Number 10 Table 2: Registration Table 3. Doctor Table Field Name Datatype Size Description Doctor ID Number 10 Primary Key Doctor Name Text 20 Father Name Text 20 Email Text 50 Contact No. Text 11 Qualifications Text 50 Gender Text 01 Blood Group Text 05 Date of Joining Date Address Text 100 Table 3: Doctor Table 4. Patient Registration Table Field Name Datatype Size Description Patient ID Number 10 Primary Key Patient Name Text 20 Father Name Text 20 Email Text 30 Contact No. Number 11 Age Number 02 Remarks Text 100
  • 22. Gender Text 01 Blood Group Text 03 Address Text 100 Table 4: Patient Registration Table 5. Admit Patient Room Table Field Name Datatype Size Description Patient ID Number 10 Primary Key Disease Text 50 Admit Date Date Room No. Number 05 References from ‘Room’ Table Doctor ID Number 10 References from ’Doctor’ Table AP_Remarks Text 50 Table 5: Admit Patient Room Table 6. Discharge Patient Room Table Field Name Datatype Size Description Admit ID Number 20 Discharge Date Date DP_Remarks Text 50 Table 6: Discharge Patient Room Table
  • 23. 7. Room Table Field Name Datatype Size Description Room No. Number 05 Primary Key Room Type Text 10 Room Charges Number 10 Room Status Text 10 Table 7: Room Table 8. Services Table Field Name Datatype Size Description Service Name Text 20 Service Date Date Patient ID Number 10 References from ‘Patient Registration’ Table Service Charges Number 10 Service ID Number 10 Primary Key Auto- increment Table 8: Services Table 9. Bill Room Table Field Name Datatype Size Description Discharge ID Number 05 Billing Date Date No. of Days Number 05 Service Charges Number 10
  • 24. Payment Mode Text 20 Payment Mode Details Text 100 Room Charges Number 10 Total Room Charges Number 10 Total Charges Number 10 Bill No. Text 15 Primary Key Table 9: Bill Room Table 5.2 GUI Design The user interfaces for this application were designed using Netbeans IDE. The following subsections present the descriptions of these interfaces. 5.2.1 Login Form The login form of the application is shown in Figure 2.It is the first form of the application where the user is prompted to enter the username and the password.
  • 25. Figure 2: Login Form 5.2.2 Home Screen The home screen of the application is as shown in the Figure 3. It contains a menu bar with different menus viz. Users, Patients, Doctors, Rooms and Help. This form allows the user to navigate through these menus and do the relevant task. Figure 3: Home Screen
  • 26. The various options available under these menus are as follows: 5.2.2.1 Users Menu Figure 4: Users Menu a) New User This option allows the user to register another user using his/her username. The shortcut key to select this option is Ctrl+N. Figure 5 shows the form which is to be filled to register as user.
  • 27. Figure 5: New User Form b) Change Password This option lets the user to change his/her login password. User can also change his/her password by using the shortcut key Ctrl+C. The Change Password form is as shown in the Figure 6. Figure 6: Change Password Form
  • 28. c) Login Details This option lets the administrator see the details of other users. The details can also be seen pressing Ctrl+D. Figure 7 shows the form containing login details. Figure 7: Login Details 5.2.2.2 Patients Menu Figure 8: Patients Menu
  • 29. a) Registration The registration form is as shown in the Figure 9. This form is accessed when the user clicks the registration option or presses the key Ctrl+R. On this form, patient is registered by filling the form. It allows selecting a doctor from a list of available doctors by clicking on the doctor’s name. It also shows the list of registered patients. Figure 9: Registration Form b) Services
  • 30. The services form is as shown in the Figure 10. It allows selecting the name of the patient receiving services from a table containing the name of registered patients. The shortcut key Ctrl+S can also be used to open this form. Figure 10: Services Form 5.2.2.3 Doctors Menu
  • 31. Figure 11: Services Menu a) Entry Figure 12 shows the Doctor’s Registration form which can be accessed by selecting Entry option from Doctors Menu or by pressing Ctrl+E. This form registers the doctor with the hospital/clinic and marks him/her as available to treat the patients.
  • 32. Figure 12: Doctor’s Registration Form 5.2.2.4 Rooms Menu Figure 13: Rooms Menu a) Add Rooms Figure 14 shows the Add Room form. This option adds a room in the hospital and is marked as vacant by default. The room type can either be General or Deluxe. The form also shows a list of rooms along with their type, charges and status.
  • 33. Figure 14: Add Rooms Form b) Admit The Patient Admit form is as shown in Figure 15. The form shows two tables from which the patient to be admitted and the doctor attending the patient can be choosen. Figure 15: Patient Admit Form
  • 34. c) Discharge Figure 16 shows the discharge form. By clicking the”>” button (placed alongside the Patient ID text field) , all the entry gets filled . Only “Discharge Date” and “Remarks “need to be filled to discharge the patient. Figure 16: Discharge Form d) Billing The successfully discharged patient has to pay the bill for the treatment and services received by him at the hospital. The Billing form is as shown in Figure 17.
  • 35. The button”>” (placed alongside the Patient ID textfield) displays the list of patients who have been discharged. The Admin selects the name for whom he wants to generate bill. The patient info gets filled when Admin selects the name. The “Payment Details” are filled by the admin and a “Bill No.” is generated. Figure 17: Billing Form 5.2.2.4 Help Menu
  • 36. Figure 18: Help Menu a) About Figure 19 shows the About Menu which recites the facility provided by this Hospital Management System and also briefs about the developer of this application. Ctrl+I can also be used to jump to this option.
  • 37. Figure 19: About b) Logout By clicking on the Logout menu or by pressing the key Ctrl+L user logs out from the application. 6. Implementation Implementation in software development is the process of realizing an application’s requirements and design. It mainly involves mapping the design into coding in order to achieve the specifications stated for the application. This section will describe the key implementation processes and some code snippets of this desktop application.
  • 38. 6.1 Login Page Code Snippet 1 shows the process for logging on the application. The username and password entered in the form are matched with the user details stored in the database. If the details entered are identical with the stored information then the permission is granted otherwise a message is displayed as “Login Failed!!” The username ”Ranjit” and password “hr36” can be used to login for the first time. import javax.swing.JOptionPane; import java.sql.*; public class login extends javax.swing.JFrame { public login() { initComponents(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; if (txtUsername.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter user name"); return; } if (jPassword.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter password"); return; } con=Connect.ConnectDB(); String sq1= "select * from users where user_name= '" + txtUsername.getText() + "' and password ='" + jPassword.getText() + "'"; try{ pst=con.prepareStatement(sq1); rs= pst.executeQuery(); if (rs.next()){ this.hide(); Main frm=new Main();
  • 39. frm.setVisible(true); } else{ JOptionPane.showMessageDialog(null, "Login Failed..Try again !"); } }catch(SQLException e){ JOptionPane.showMessageDialog(null, e); } } 6.2 Home Page private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) { ChangePassword ob1=new ChangePassword(); ob1.setVisible(true); } private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { NewUser ob1=new NewUser(); ob1.setVisible(true); } private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) { LoginDetails ob1=new LoginDetails(); ob1.setVisible(true); // TODO add your handling code here: } private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) { Entry ob1=new Entry(); ob1.setVisible(true); }
  • 40. private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) { About ob1=new About(); ob1.setVisible(true); } private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) { Registration ob1=new Registration(); ob1.setVisible(true); } private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) { Services ob1=new Services(); ob1.setVisible(true); } private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) { Room obj1=new Room(); obj1.setVisible(true); } private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) { Patient_Admit_Room obj1=new Patient_Admit_Room(); obj1.setVisible(true); } private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) { Bill_Room obj1=new Bill_Room(); obj1.setVisible(true); } private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) { Patient_Discharge_room obj1=new Patient_Discharge_room();
  • 41. obj1.setVisible(true); } private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) { login obj1= new login(); obj1.setVisible(true); } 6.3 New User The implementation of registering new user is given below. Connect.DB() method is used to connect the application with database. The “fieldname.equals()”(the field name may vary) method makes sure that none of the entry is left blank. The string “sql2” is used to check that already existed username in the database is not entered while registering as a new user. If any text field is left blank then a corresponding message is shown in dialog box with the help of JOPtionPane.showMessageDialog() method. If the username entered is not as same as one in the database then string “sql2” is used to enter the details entered in the registration form to be stored in the database. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; public class NewUser extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public NewUser() { initComponents();
  • 42. } private void reset() { txtName.setText(""); txtUsername.setText(""); jPassword.setText(""); txtEmailid.setText(""); txtContactno.setText(""); Save.setEnabled(true); Delete.setEnabled(false); Update.setEnabled(false); } try{ con=Connect.ConnectDB(); if (txtName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter name"); return; } if (txtUsername.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter user name"); return; } if (jPassword.equals("")) { JOptionPane.showMessageDialog( this, "Please enter password"); return; } if (txtContactno.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter contact no."); return; } if (txtEmailid.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter email id"); return; } Statement stmt= con.createStatement(); String sql1="Select user_name from registration where user_name= '" + txtUsername.getText() + "'";
  • 43. rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( this, "User name already exists"); txtUsername.setText(""); return; } String sql= "insert into registration(user_name,password,name,email_id,contact_no)values('"+ txtUsername.getText() + "','" + jPassword.getText() + "','" + txtName.getText() + "','" + txtEmailid.getText() + "','" + txtContactno.getText() + "')"; pst=con.prepareStatement(sql); pst.execute(); String sql2= "insert into users(user_name,password)values('" + txtUsername.getText() + "','" + jPassword.getText() + "')"; pst=con.prepareStatement(sql2); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully Registered"); Save.setEnabled(false); }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void DeleteActionPerformed(java.awt.event.ActionEvent evt) { try { int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0) { con=Connect.ConnectDB(); String sql= "delete from registration where user_name = '" + txtUsername.getText() + "'"; pst=con.prepareStatement(sql); pst.execute(); String sql1= "delete from Users where user_name = '" + txtUsername.getText() + "'";
  • 44. pst=con.prepareStatement(sql1); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted"); reset(); } }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void UpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); String sql= "update registration set password='" + jPassword.getText() + "',name='" + txtName.getText() + "',email_id='" + txtEmailid.getText() + "',contact_no='" + txtContactno.getText() + "' where user_name='" + txtUsername.getText() + "'"; pst=con.prepareStatement(sql); pst.execute(); String sql2= "update users set password='" + jPassword.getText() + "' where user_name='" + txtUsername.getText() + "'"; pst=con.prepareStatement(sql2); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully updated","User info",JOptionPane.INFORMATION_MESSAGE); Update.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void GetDataActionPerformed(java.awt.event.ActionEvent evt) { this.hide(); UserRecord ob1 = new UserRecord(); ob1.setVisible(true); } 6.4 Update User The implementation of registering patientis shown in the code below.
  • 45. Connect.DB() method is used to connect the application with database. The string “sql2” is responsible for updating the users detail stored in the database. try{ con=Connect.ConnectDB(); Statement stmt1= con.createStatement(); String s= cmbRoomNo.getSelectedItem().toString(); String t= cmbRoomNo1.getSelectedItem().toString(); if (!t.equals(s)){ String sql2="Select RoomNo from Room where RoomNo= '" + cmbRoomNo.getSelectedItem()+ "' and RoomStatus='Booked'"; rs=stmt1.executeQuery(sql2); if(rs.next()){ JOptionPane.showMessageDialog( this, "Room is already booked","Error", JOptionPane.ERROR_MESSAGE); cmbRoomNo.setSelectedItem(""); cmbRoomNo.requestDefaultFocus(); return; } } Code Snippet 3: Updating user details 6.5 Delete Patient Record Code Snippet 4 shows the implementation of registering patient. Connect.DB() method is used to connect the application with database. The string “sql” is responsible for deleting the users detail stored from the database. private void DeleteActionPerformed(java.awt.event.ActionEvent evt) { try { int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0)
  • 46. { con=Connect.ConnectDB(); String sql= "delete from registration where user_name = '" + txtUsername.getText() + "'"; pst=con.prepareStatement(sql); pst.execute(); String sql1= "delete from Users where user_name = '" + txtUsername.getText() + "'"; pst=con.prepareStatement(sql1); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted"); reset(); } }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } Code Snippet 4: Deleting patient details 6.6 Services The implementation of providing services to the patient is shown below. Connect.DB() method is used to connect the application with database. Get_Data1() method is used to retrieve patient details from database using string “sql”. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils;
  • 47. public class Services extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Services() { initComponents(); setLocationRelativeTo(null); txtServiceID.setVisible(false); Get_Data1(); } private void Get_Data1(){ try{ con=Connect.ConnectDB(); String sql="select PatientID as 'Patient ID', PatientName as 'Patient Name' from Patientregistration order by PatientName"; pst=con.prepareStatement(sql); rs= pst.executeQuery(); tblPatient.setModel(DbUtils.resultSetToTableModel(rs)); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } private void Reset() { txtPatientID.setText(""); txtServiceCharges.setText(""); txtPatientName.setText(""); txtServiceDate.setText(""); txtServiceName.setText(""); txtSave.setEnabled(true); txtUpdate.setEnabled(false); txtDelete.setEnabled(false); }
  • 48. private void txtNewActionPerformed(java.awt.event.ActionEvent evt) { Reset(); } private void txtSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); if (txtServiceName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter service name"); return; } if (txtServiceDate.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter service date"); return; } if (txtPatientID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve patient id"); return; } if (txtServiceCharges.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter service charges"); return; } String sql= "insert into Services(ServiceName,ServiceDate,PatientID,ServiceCharges)values(' "+ txtServiceName.getText() + "','"+ txtServiceDate.getText() + "','" + txtPatientID.getText() + "'," + txtServiceCharges.getText() + ")"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully saved","Record",JOptionPane.INFORMATION_MESSAGE); txtSave.setEnabled(false); }catch( SQLException ex){
  • 49. JOptionPane.showMessageDialog(this,ex); } } private void txtDeleteActionPerformed(java.awt.event.ActionEvent evt) { try{ int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0) { con=Connect.ConnectDB(); String sql= "delete from Services where ServiceID = " + txtServiceID.getText() + ""; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted"); Reset(); } }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void txtUpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); String sql= "update Services set ServiceName='" + txtServiceName.getText() +"',ServiceDate='" + txtServiceDate.getText()+ "',PatientID='" + txtPatientID.getText() + "',ServiceCharges='" + txtServiceCharges.getText() + "' where ServiceID='" + txtServiceID.getText() + "'"; pst=con.prepareStatement(sql); pst.execute();
  • 50. JOptionPane.showMessageDialog(this,"Successfully updated"); txtUpdate.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void txtGetDataActionPerformed(java.awt.event.ActionEvent evt) { this.hide(); ServicesRec frm= new ServicesRec(); frm.setVisible(true); } private void tblPatientMouseClicked(java.awt.event.MouseEvent evt) { try{ con=Connect.ConnectDB(); int row= tblPatient.getSelectedRow(); String table_click= tblPatient.getModel().getValueAt(row, 0).toString(); String sql= "select * from PatientRegistration where PatientID = '" + table_click + "'"; pst=con.prepareStatement(sql); rs= pst.executeQuery(); if(rs.next()){ String add1=rs.getString("PatientID"); txtPatientID.setText(add1); String add2=rs.getString("Patientname"); txtPatientName.setText(add2); } }catch(Exception ex){ JOptionPane.showMessageDialog(this,ex); } } Code Snippet 5: Services
  • 51. 6.7Patient Registration The implementation of registering patient is shown in the code. Connect.DB() method is used to connect the application with database. The “fieldname.equals()”( the field names may vary) method makes sure that none of the entry is left blank. If any text field is left blank then a corresponding message is shown in dialog box with the help of JOPtionPane.showMessageDialog() method. The string “sql2” is used to check that already existed username in the database is not entered while registering as a new user. If the username entered is not as same as one in the database then string “sql” is used to enter the details entered in the registration form to be stored in the database. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; public class Registration extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Registration() { initComponents(); } try{ con=Connect.ConnectDB(); if (txtId.getText().equals("")) { OptionPane.showMessageDialog( this, "Please enter patient id","Error", JOptionPane.ERROR_MESSAGE); return;
  • 52. } if (txtName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter patient name","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtFname.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter Father's name","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtAdd.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter address","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtContact.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter contact no.","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtAge.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter age","Error", JOptionPane.ERROR_MESSAGE); return; } if (cmbGender.getSelectedItem().equals("")) { JOptionPane.showMessageDialog( this, "Please select gender","Error", JOptionPane.ERROR_MESSAGE); return; } if (cmbBG.getSelectedItem().equals("")) {
  • 53. JOptionPane.showMessageDialog( this, "Please select blood group","Error", JOptionPane.ERROR_MESSAGE); return; } Statement stmt= con.createStatement(); String sql1="Select PatientID from PatientRegistration where PatientID= '" + txtId.getText() + "'"; rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( this, "Patient ID already exists","Error", JOptionPane.ERROR_MESSAGE); txtId.setText(""); txtId.requestDefaultFocus(); return; } String sql= "insert into PatientRegistration(PatientID,Patientname,FatherName,Email,Contact No,Age,Remarks,Gen,BG,Address)values('"+ txtId.getText() + "','"+ txtName.getText() + "','"+ txtFname.getText() + "','"+ txtEmail.getText() + "','"+ txtContact.getText() + "'," + txtAge.getText() + ",'"+ txtInfo.getText() + "','" + cmbGender.getSelectedItem() + "','"+ cmbBG.getSelectedItem() + "','" + txtAdd.getText() + "')"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully Registered","Patient",JOptionPane.INFORMATION_MESSAGE); btnSave.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } }
  • 54. private void btnGetDataActionPerformed(java.awt.event.ActionEvent evt) { this.hide(); PatientRec frm=new PatientRec(); frm.setVisible(true); Code Snippet 6: Registering patient 6.8 Admit Patient The implementation of admitting patient is given in the code below. Connect.DB() method is used to connect the application with database. Get_Data1() method is used to retrieve patient details from database using string “sql”. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; public class Patient_Admit_Room extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Patient_Admit_Room() { initComponents(); setLocationRelativeTo(null); fillcombo(); cmbRoomNo.setSelectedIndex(-1); cmbRoomNo1.setVisible(false); Get_Data1();
  • 55. GetRecord(); } private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); if (PatientID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Patient ID","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtPatientName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Patient Name","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtGender.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Gender","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtBloodGroup.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve blood group","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtDisease.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter disease","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtAdmitDate.getText().equals("")) {
  • 56. JOptionPane.showMessageDialog( this, "Please enter admit date","Error", JOptionPane.ERROR_MESSAGE); return; } if (cmbRoomNo.getSelectedItem().equals("")) { JOptionPane.showMessageDialog( this, "Please select room no.","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtDoctorID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve doctor id","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtDoctorName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter retrieve doctor name","Error", JOptionPane.ERROR_MESSAGE); return; } Statement stmt1= con.createStatement(); String sql2="Select RoomNo from Room where RoomNo= '" + cmbRoomNo.getSelectedItem()+ "' and RoomStatus='Booked'"; rs=stmt1.executeQuery(sql2); if(rs.next()){ JOptionPane.showMessageDialog( this, "Room is already booked","Error", JOptionPane.ERROR_MESSAGE); cmbRoomNo.setSelectedItem(""); cmbRoomNo.requestDefaultFocus(); return; } Statement stmt= con.createStatement();
  • 57. String sql1="Select PatientID,AdmitDate from AdmitPatient_Room where PatientID= '" + PatientID.getText() + "' and AdmitDate='" + txtAdmitDate + "'"; rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( this, "Record already exists","Error", JOptionPane.ERROR_MESSAGE); return; } String sql= "insert into admitpatient_room(PatientID,Disease,AdmitDate,RoomNo,DoctorID,A P_Remarks)values('"+ PatientID.getText() + "','"+ txtDisease.getText() + "','"+ txtAdmitDate.getText() + "','"+ cmbRoomNo.getSelectedItem()+ "','" + txtDoctorID.getText() + "','"+ txtRemarks.getText() + "')"; Pst =con.prepareStatement(sql); pst.execute(); String sql3= "update room set RoomStatus='Booked' where RoomNo='" + cmbRoomNo.getSelectedItem() + "'"; pst=con.prepareStatement(sql3); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully admitted","Patient",JOptionPane.INFORMATION_MESSAGE); btnSave.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } Code Snippet 7: Admitting Patient 6.9 Discharge Patient The implementation of discharging patient is given in the code.
  • 58. Connect.DB() method is used to connect the application with database. The string “sql” is responsible for inserting the discharge details of the patient in the table “Discharge Patient Room”. The string “sql3” updates the table” Room” and marks the status of room as vacant. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; public class Patient_Discharge_room extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Patient_Discharge_room() { initComponents(); setLocationRelativeTo(null); } private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); if (PatientID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Patient ID"); return; } if (txtPatientName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve patient Name"); return;
  • 59. } if (txtGender.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Gender"); return; } if (txtBloodGroup.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve blood group"); return; } if (txtDisease.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve disease"); return; } if (txtAdmitDate.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve admit date"); return; } if (txtDoctorID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve doctor id"); return; } if (txtDoctorName.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter retrieve doctor name"); return; } if (txtDischargeDate.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter discharge date"); return; } Statement stmt; stmt= con.createStatement(); String sql1="Select AdmitID from DischargePatient_Room
  • 60. where AdmitID= " + PatientID.getText() + ""; rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( this, "Record already exists"); return; } String sql= "insert into DischargePatient_Room(AdmitID,DischargeDate,DP_Remarks)values("+ PatientID.getText() + ",'"+ txtDischargeDate.getText() + "','"+ txtRemarks.getText() + "')"; pst=con.prepareStatement(sql); pst.execute(); String sql3= "update room set RoomStatus='Vacant' where RoomNo='" + txtRoomNo.getText() + "'"; pst=con.prepareStatement(sql3); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully discharged","Patient",JOptionPane.INFORMATION_MESSAGE); btnSave.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) { try{ int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0) { con=Connect.ConnectDB();
  • 61. String sql= "delete from DischargePatient_Room where AdmitID = " + PatientID.getText() + ""; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted"); Reset(); } }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); String sql= "update DischargePatient_Room set AdmitID="+PatientID.getText() + ",DischargeDate='"+ txtDischargeDate.getText() + "',DP_Remarks='"+ txtRemarks.getText() + "' where AdmitID= " + PatientID.getText() + ""; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully updated"); btnSave.setEnabled(false); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } Code Snippet 8: Method for discharging patient
  • 62. 6.10 Rooms The implementation of adding rooms and doing rooms related tasks is shown in the code below. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; public class Room extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Room() { initComponents(); con= Connect.ConnectDB(); Get_Data(); setLocationRelativeTo(null); } private void Reset() { txtRoomNo.setText(""); txtRoomCharges.setText(""); cmbRoomType.setSelectedIndex(-1); btnSave.setEnabled(true); btnDelete.setEnabled(false); btnUpdate.setEnabled(false); txtRoomNo.requestDefaultFocus();
  • 63. Get_Data(); } private void Get_Data(){ String sql="select RoomNo as 'Room No.',RoomType as 'Room Type', RoomCharges as 'Room Charges',RoomStatus as 'Room Status' from Room"; try{ pst=con.prepareStatement(sql); rs= pst.executeQuery(); Room_table.setModel(DbUtils.resultSetToTableModel(rs)); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); }} private void btnNewActionPerformed(java.awt.event.ActionEvent evt) { Reset(); } private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); if (txtRoomNo.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter room no.","Error", JOptionPane.ERROR_MESSAGE); return; } if (cmbRoomType.getSelectedItem().equals("")) { JOptionPane.showMessageDialog( this, "Please select room type","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtRoomCharges.getText().equals("")) {
  • 64. JOptionPane.showMessageDialog( this, "Please enter room Charges","Error", JOptionPane.ERROR_MESSAGE); return; } Statement stmt= con.createStatement(); String sql1="Select RoomNo from Room where RoomNo= '" + txtRoomNo.getText() + "'"; rs=stmt.executeQuery(sql1); if(rs.next()){ JOptionPane.showMessageDialog( this, "Room No. already exists","Error", JOptionPane.ERROR_MESSAGE); txtRoomNo.setText(""); txtRoomNo.requestDefaultFocus(); return; } String sql= "insert into Room(RoomNo,RoomType,RoomCharges,RoomStatus)values('"+ txtRoomNo.getText() + "','"+ cmbRoomType.getSelectedItem() + "'," + txtRoomCharges.getText() + ",'Vacant')"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully saved","Room Record",JOptionPane.INFORMATION_MESSAGE); btnSave.setEnabled(false); Get_Data(); }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB();
  • 65. String sql= "update Room set Roomtype='"+ cmbRoomType.getSelectedItem() + "',RoomCharges=" + txtRoomCharges.getText() + " where RoomNo='" + txtRoomNo.getText() + "'"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully updated","Room Record",JOptionPane.INFORMATION_MESSAGE); btnUpdate.setEnabled(false); Get_Data(); }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) { try { int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0) { con=Connect.ConnectDB(); String sql= "delete from Room where RoomNo = '" + txtRoomNo.getText() + "'"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted","Record",JOptionPane.INFORMATION_MESSAGE); Reset(); } }catch( SQLException ex){ JOptionPane.showMessageDialog(this,ex);
  • 66. } } private void btnGetDataActionPerformed(java.awt.event.ActionEvent evt) { Get_Data(); } private void Room_tableMouseClicked(java.awt.event.MouseEvent evt) { try{ con=Connect.ConnectDB(); int row= Room_table.getSelectedRow(); String table_click= Room_table.getModel().getValueAt(row, 0).toString(); String sql= "select * from Room where RoomNo = '" + table_click + "'"; pst=con.prepareStatement(sql); rs= pst.executeQuery(); if(rs.next()){ String add1=rs.getString("RoomNo"); txtRoomNo.setText(add1); String add2=rs.getString("RoomType"); cmbRoomType.setSelectedItem(add2); int add3 = rs.getInt("RoomCharges"); String add4= Integer.toString(add3); txtRoomCharges.setText(add4); btnUpdate.setEnabled(true); btnDelete.setEnabled(true); btnSave.setEnabled(false); } }catch(Exception ex){ JOptionPane.showMessageDialog(this,ex); } }
  • 67. 6.11 Generating Bill The method for generating bill after discharging the patient is shown below. Connect.DB() method is used to connect the application with database. The string “sql1” is responsible for verifying patient’s detail stored in the database is not same. Further, the string, “sql” is responsible for inserting details of the form “Bill” in the table Bill_Room. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.lang.String; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; public class Bill_Room extends javax.swing.JFrame { Connection con=null; ResultSet rs=null; PreparedStatement pst=null; public Bill_Room() { initComponents(); setLocationRelativeTo(null); Get_Data1(); } private void Get_Data1(){ try{ con=Connect.ConnectDB(); String sql="select PatientRegistration.PatientID as 'Patient ID', PatientName as 'Patient Name',sum(serviceCharges) as 'Service Charges' from Services,PatientRegistration where Services.PatientID=PatientRegistration.PatientID group by
  • 68. PatientRegistration.PatientID,PatientName order by PatientName"; pst=con.prepareStatement(sql); rs= pst.executeQuery(); jTable1.setModel(DbUtils.resultSetToTableModel(rs)); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } } private void Reset(){ txtDoctorID.setText(""); txtDoctorName.setText(""); PatientID.setText(""); txtPatientName.setText(""); txtBloodGroup.setText(""); txtGender.setText(""); txtDisease.setText(""); txtAdmitDate.setText(""); txtRoomNo.setText(""); txtServiceCharges.setText(""); txtRoomCharges.setText(""); txtPaymentModeDetails.setText(""); txtTotalCharges.setText(""); txtBillingDate.setText(""); cmbPaymentMode.setSelectedIndex(-1); txtDischargeDate.setText(""); txtNoOfDays.setText(""); txtTotalRoomCharges.setText(""); btnSave.setEnabled(true); btnUpdate.setEnabled(false); btnDelete.setEnabled(false); } private void jTable1MouseClicked(java.awt.event.MouseEvent evt) { if(PatientID.getText().equals("")){ JOptionPane.showMessageDialog(this,"Please Enter Patient data first!"); } else{ try{ con=Connect.ConnectDB();
  • 69. int row= jTable1.getSelectedRow(); String val =jTable1.getModel().getValueAt(row,2).toString(); txtServiceCharges.setText(val); int totalRoomCharges = Integer.parseInt(txtTotalRoomCharges.getText()); int totalCharges = totalRoomCharges + Integer.parseInt(txtServiceCharges.getText()); txtTotalCharges.setText(Integer.toString(totalCharges)); }catch(Exception ex){ JOptionPane.showMessageDialog(this,ex); } } } private void btnNewActionPerformed(java.awt.event.ActionEvent evt) { Reset(); } private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); if (PatientID.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve Patient ID","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtNoOfDays.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter no. of days","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtServiceCharges.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please retrieve service charges","Error", JOptionPane.ERROR_MESSAGE); return; } if (txtBillingDate.getText().equals("")) { JOptionPane.showMessageDialog( this, "Please enter billing date","Error", JOptionPane.ERROR_MESSAGE); return; }
  • 70. Statement stmt = null; try { stmt = con.createStatement(); } catch (SQLException ex) { Logger.getLogger(Bill_Room.class.getName()).log(Level.SEVERE, null, ex); } String sql1="Select DischargeID from Bill_Room where DischargeID= " + PatientID.getText() + ""; try { rs = stmt.executeQuery(sql1); } catch (SQLException ex) { Logger.getLogger(Bill_Room.class.getName()).log(Level.SEVERE, null, ex); } if(rs.next()){ JOptionPane.showMessageDialog( this, "Record already exists","Error", JOptionPane.ERROR_MESSAGE); return; } String sql= "insert into Bill_Room(DischargeID,BillingDate,RoomCharges,ServiceCharges,PaymentMode,Pay mentModeDetails,TotalCharges,NoOfDays,TotalRoomCharges,BillNo)values(" + PatientID.getText() + ",'"+ txtBillingDate.getText() + "',"+ txtRoomCharges.getText() + ","+ txtServiceCharges.getText() + ",'" + cmbPaymentMode.getSelectedItem()+ "','" + txtPaymentModeDetails.getText() + "',"+ txtTotalCharges.getText() +","+ txtNoOfDays.getText() + "," + txtTotalRoomCharges.getText() + ",'"+txtBillNo.getText()+"')"; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully saved","Record",JOptionPane.INFORMATION_MESSAGE); btnSave.setEnabled(false); }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) { try{
  • 71. int P = JOptionPane.showConfirmDialog(null," Are you sure want to delete ?","Confirmation",JOptionPane.YES_NO_OPTION); if (P==0) { con=Connect.ConnectDB(); String sql= "delete from Bill_Room where BillNo = " + txtBillNo.getText() + ""; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully deleted","Record",JOptionPane.INFORMATION_MESSAGE); Reset(); } }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ con=Connect.ConnectDB(); String sql= "update Bill_Room set DischargeID="+ PatientID.getText() + ",BillingDate='"+ txtBillingDate.getText() + "',RoomCharges="+ txtRoomCharges.getText() + ",ServiceCharges="+ txtServiceCharges.getText() + ",PaymentMode='" + cmbPaymentMode.getSelectedItem()+ "',PaymentModeDetails='" + txtPaymentModeDetails.getText() + "',TotalCharges="+ txtTotalCharges.getText() + ",NoOfDays="+ txtNoOfDays.getText() +",TotalRoomCharges=" + txtTotalRoomCharges.getText() + " where BillNo= " + txtBillNo.getText() +""; pst=con.prepareStatement(sql); pst.execute(); JOptionPane.showMessageDialog(this,"Successfully Updated","Record",JOptionPane.INFORMATION_MESSAGE); btnUpdate.setEnabled(false); }catch(SQLException ex){ JOptionPane.showMessageDialog(this,ex); } } private void btnGetDataActionPerformed(java.awt.event.ActionEvent evt) { this.hide();
  • 72. Bill_RoomRec frm= new Bill_RoomRec(); frm.setVisible(true); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { this.hide(); Patient_Discharge_roomRec2 frm = new Patient_Discharge_roomRec2(); frm.setVisible(true); } Code Snippet 9: Generating Bill 7. TESTING Software testing is carried out on a software application mainly to detect software bugs or missing requirements of the application. It involves the process of investigating and evaluating a software product or application in order to make sure that its business and technical requirements are fulfilled. For the purpose of testing, this application was deployed and run on Netbeans IDE 6.5.1. For simplicity, the testing template in Table 10 was used for the testing. Table 10. Software testing template and results. S.No. Test Description Steps Expected System Response Status (Pass/Fail) 1. Access the login form of the application to view home screen. Enter the username and password in the login form. The home screen of the application is displayed. Pass
  • 73. 2. Registering New User Go to User menu. Select New User option. Fill the form and click on Save button. A message ”Successfully Registered” is displayed in a dialog box. Pass 3. Updating User Details Click “Get Data” button. Select the user whose details need to be updated and click on Save button. A message ”Successfully Updated” is displayed in a dialog box. Pass 4. Viewing Login Details Go to Users tab and select Login Details. A form containing username and password is displayed. Pass 5. Registering New Patient Go to Patient menu. Select Registration option. Fill the form and click on Save button. A message ”Successfully Registered” is displayed in a dialog box. Pass 6. Services Go to Patient menu. Select Services option. Fill the form and click on Save button. A message ”Successfully Registered” is displayed in a dialog box. Pass 7. Doctor Registration Go to Doctors menu. Select Entry option. Fill the form A message ”Successfully Registered” is displayed in a Pass
  • 74. and click on Save button. dialog box. 8. Adding Rooms Go to Rooms menu. Select Add Rooms option. Fill the form and click on Save button. A message ”Room Added” is displayed in a dialog box. Pass 9. Admitting Patient Go to Rooms Menu. Select Admit option. Fill the form and click on Save button. A message ”Successfully admitted” is displayed in a dialog box. Pass 10. Discharging Patient Go to Rooms Menu. Select Discharge option. Fill the form and click on Save button. A message ”Successfully discharged” is displayed in a dialog box. Pass 11. Generating Bill Go to Rooms Menu. Select Discharge option. Fill the form and click on Save button. A bill no. is generated by concatenating patient ID and Date of discharge. Pass 12. Help Go to About Menu. Select Help option. A form containing description of the application is displayed Pass
  • 75. 8. CONCLUSION The project Hospital ManagementSystem (HMS) is for computerizing the working in a hospital. The software takes care of all the requirements of an average hospital and is capable to provide easy and effective storage of information related to patients that come up to the hospital. It generates test reports; provide prescription details including various tests, diet advice, and medicines prescribed to patient and doctor. It also provides injection details and billing facility on the basis of patient’s status whether it is an indoor or outdoorpatient. The system also provides the facility of backup as per the requirement. Future Enhancements The proposed system is Hospital Management System. We can enhance this system by including more facilities like pharmacy system for the stock details of medicines in the pharmacy. Providing such features enable the users to include more comments in the system.
  • 76. 9. BIBLIOGRAPHY 1. Informatics Practices –XI by Sumita Arora 2. Informatics Practices –XII by Sumita Arora Web References: 1. www.istockphotos.com 2. www.google.com 3. www.geeksforgeeks.com