hms report
TRANSCRIPT
MINI PROJECT REPORT
On
“Dr.care”
(Hospital Management System)
Submitted in partial fulfillment of the
Requirements for the award of the degree in
B.Sc Computer Science
Mahatma Gandhi University, Kottayam
Submitted by
NIKHIL K.S
NITHIN A M
SUMITH SUKU
VILAYATHULLA P.H
POULSON
Under the guidance of
Mrs. Swapna Miss
S N ARTS & SCIENCE COLLEGE
Kedamangalam, N.Paravoor
2008-2011
Dr.CARE – Hospital Management System
BONAFIDE CERTIFICATE
This is to certify that project report entitled “Dr.CARE (HMS)”
done at G-TECH bonafide work of MRS.ANU who carried out the work under my
supervision. Certified further, that to the best of my knowledge, the work reported here
is not part of any other project report or dissertation on the basis of which a degree or
award was conferred on an earlier occasion on this on any other candidate.
Mrs.Swapna Mrs.Swapna Suman (Internal Guide) ( H.O.D )
2
Dr.CARE – Hospital Management System
DECLARATION
We hereby declare that this project work entitled “Dr.CARE-
(HMS)” has been carried out under the guidance of Mrs.Swapna as per the requirement
of curriculum of Bachelor of Computer Science program of Mahatma Gandhi
University further we also declare this report has not been previously submitted.
Place:Kedamangalam NIKHIL K.S
Date: NITHIN A.M
SUMITH SUKU
VILAYATHULLA P.H
POULSON
3
Dr.CARE – Hospital Management System
ACKNOWLEDGEMENT
I express my humble thanks to almighty, for the kind grace showed on me to complete the project successfully.
I have pleasure to acknowledge my deep sense of gratitude to Prof.E.K.Sreenivasan, Principal, SN Arts& Science College, Mrs.Swapna head of the department, Mrs.Anitha-Lecturer, Mrs.Jish-Lecturer and all other teachers for the wholesome guidance and support in completing my project.
I earnest express my respect and regards to Mrs.Anu my project guide at G-Tec, N.Paravoor, for his support, advices and timely help for the success of this project. I want to thank my friends and others including my parents for their help and co-operation to me for the success of my project.
My love and gratitude go once again to all those who supported me for the success of my project.
NIKHIL K.S
NITHIN A.M
SUMITH SUKU
VILAYATHULLA P.H
POULSON
4
Dr.CARE – Hospital Management System
INDEX
CONTENTS PAGE1. INTRODUCTION 6
1.1. PROJECT OVERVIEW 72. SYSTEM ANALYSIS 8
2.1. EXISTING SYSTEM 92.2. REQUIREMENTS OF NEW SYSTEM 92.3. PROPOSED SYSTEM 10
3. FEASIBILITY STUDY 113.1. TECHNICAL FEASIBILITY 123.2. ECONOMICAL FEASIBILTY 123.3. OPERATIONAL FEASIBILTY 12
4. SYSTEM CONFIGURATION 134.1. HARDWARE CONFIGURATION 144.2. SOFTWARE CONFIGURATION 14
4.2.1. ABOUT SOFTWARE 155. SYSTEM DESIGN AND DEVELOPMENT 17
5.1. INPUT DESIGN 185.2. OUTPUT DESIGN 185.3. DATABASE DESIGN 19
6. SYSTEM TESTING AND IMPLEMENTATION 206.1. SYSTEM TESTING 216.2. SYSTEM IMPLEMENTATION 22
7. SYSTEM SECURITY MEASURES 238. CONCLUSION 269. SCOPE FOR FUTURE ENHANCEMENT 2810. APPENDICES 30
(i) APPENDIX A 31a. DATA FLOW DIGRAMS 32
(ii) APPENDIX B 33a. TABLE STRUCTURE 34
(iii) APPENDIX C 38a. SAMPLE SCREEN SHOTS 38
(iv)APPENDIX D 50a. PROGRAM CODE 51
11. BIBLOGRAPHY 58
5
Dr.CARE – Hospital Management System
INTRODUCTION
1.1 Project Overview
1.1) Purpose
This Software is for the automation of Hospital Management. It maintains two levels of users:-
1. Staff Level 2. Doctor Level
This Software includes:- Maintaining Patient details. Department Details Rooms Details Staff Details(Doctors)
It can be used in any Hospital For maintaining Patient Registration And their
Consulting Details. In our Project we are going to implement a Dr.CARE (Hospital
Management System). This is a database system in which Hospital will keep the record
of Hospital Details. This will help the Hospital Staff&Doctors to manage their records
easily.
7
Dr.CARE – Hospital Management System
SYSTEM ANALYSIS
System Analysis involves study of the current system in detail and to
find out how it works and where the improvements have to be made. It also involves the
detailed study of the various operations performed by the system and their relationship
within and outside the system. The analyst and the user work in close association during the
complete analysis phase. Analysis is a phase that determines what is to be done for software
development.
2.1 Existing System
The need for the system stems from the nature of the organization. In
order to justify and appreciate the need for the system, we have to study the existing system.
By conducting this study, we will be able to identify the disadvantages of the existing
system and thereby we can frame the modifications required in order to accomplish the
goals of the proposed system.
We found that the existing system is a manual process of recording
information in books recording. This type of recording information in books has a lot of
limitations.
Some of the limitations of existing system are:-
Time complexity and Space complexity.
Storage capacity is limited.
Retrieving data from a large collection is complex.
Data can be damaged or lost easily.
2.2 Requirements of New System
The major motivation for the new system is to incorporate the efficiency
of Computer based data processing. Analysis of that much data consumes pretty good
amount of human working hours. In a computer based application, this process is a
breeze. As this process is computerized, Time and space complexity can be diminished.
9
Dr.CARE – Hospital Management System
2.3 Proposed System
The proposed system overcomes the limitations faced by the existing
systems. Proposed system is developed as computerized application, so it reduced the
disadvantages that were faced in the Manual system. In the manual system, Hospital
Staff and doctors used books and papers to store the details of the Hospital & Patient .
As the proposed system is developed, this system helps to store more data
The major advantages of the proposed system are as follows:
•Overcame Time and Space Complexity.
Hospitals can store infinite amount data with a small amount of time.
• Data Accuracy
By computerizing this process data stored are more accurate than that of handwritten
recording.
• Legibility of record
Handwritten reports are notoriously difficult to read. On-screen or printed text is often
far more legible than handwriting.
• Data storage and recovery
Data are stored in hard disk. So the storage capacity can be extended and if the data is
lost it can be recovered.
10
Dr.CARE – Hospital Management System
FEASIBILITY STUDY
The development and implementation of a new system is definitely
expensive. It requires system resources, manpower, time and money. So it increases the
necessity of the feasibility study based on the proposed system requirements. During
system analysis, the feasibility study of the proposed system is to be carried out. The
study is done in three phases:
Technical feasibility
Economical feasibility
Operational Feasibility
3.1 Technical Feasibility
The assessment of technical feasibility must be based on an outline design
of system requirements in terms of input, output, files, programs, and procedures. This
can be qualified in terms of volume of data, trends, frequency of updating, cycles of
activity etc. in order to give an introduction of technical system. “Dr.CARE” satisfies
technical feasibility because it need not require any additional hardware or system
configuration for implementation and execution.
3.2 Economical Feasibility
Usually for Desktop applications costs may vary. But this software is a small scale
product so the cost is affordable. So the “Dr.CARE” satisfies economical feasibility
3.2 Operational Feasibility
The desktop applications are considered to be isolated environment when
compared to web based application that allows only customization only to the users who
uses it. Two important components of a desktop application are user friendly interface
and easy to share and store; available to all and sundry at no expense. Friendly user
interface makes the user more comfortable to use the software that allows users to
retrieve data and manipulate it.
12
Dr.CARE – Hospital Management System
SYSTEM CONFIGURATION
4.1 Hardware Configuration
ProcessorPersonal computer (PC) with a Pentium IV-class processor, 1.8
gigahertz (GHz) or higher.
Operating
Systems Any platform that Java 1.1 or greater runs on:
MemoryMicrosoft Windows 2003 Server with 512 MB of RAM
Microsoft Windows XP with 512 megabytes (MB) of RAM
Microsoft Windows Vista with 512 MB of RAM
Hard Disk Standard Edition1 gigabytes (GB) on installation drive, which
includes 10GB on system drive (can be extended).
Drive CD-ROM or DVD-ROM drive
Display Super VGA (800 x 600) or higher-resolution monitor with 256
colors
Mouse Microsoft Mouse or Compatible pointing device
4.2 Software Configuration
Tools : Net beans
Front End : Java 1.1 or Above
Back End : SQL Server 2005
14
Dr.CARE – Hospital Management System
4.2.1 About the Software
4.2.1.1 Java SE 6 Platform
Java refers to a number of computer software products and specifications
from Sun Microsystems, a subsidiary of Oracle Corporation, that together provide a
system for developing application software and deploying it in a cross-platform
environment. Java is used in a wide variety of computing platforms from embedded
devices and mobile phones on the low end, to enterprise servers and supercomputers on
the high end. Java is used in mobile phones, Web servers and enterprise applications,
and while less common on desktop computers, Java applets are often used to provide
improved and secure functionalities while browsing the World Wide Web.
Writing in the Java programming language is the primary way to produce
code that will be deployed as Java byte code, though there are byte code compilers
available for other languages such as JavaScript, Python, and Ruby. Several new
languages have been designed to run natively on the Java Virtual Machine (JVM), such
as Scala, Clojure and Groovy. Java syntax borrows heavily from C and C++, but object-
oriented features are modeled after Smalltalk and Objective-C.[1] Java eliminates certain
low-level constructs such as pointers and has a very simple memory model where every
object is allocated on the heap and all variables of object types are references. Memory
management is handled through integrated automatic garbage collection performed by
the JVM.
4.2.1.2 Front-End Tools
NetBeans Platform
The NetBeans Platform is a reusable framework for simplifying the
development of Java Swing desktop applications. The NetBeans IDE bundle for Java SE
15
Dr.CARE – Hospital Management System
contains what is needed to start developing NetBeans plugins and NetBeans Platform
based applications; no additional SDK is required.
Applications can install modules dynamically. Any application can
include the Update Center module to allow users of the application to download
digitally-signed upgrades and new features directly into the running application.
Reinstalling an upgrade or a new release does not force users to download the entire
application again.
The platform offers reusable services common to desktop applications,
allowing developers to focus on the logic specific to their application. Among the
features of the platform are:
User interface management (e.g. menus and toolbars)
User settings management
Storage management (saving and loading any kind of data)
Window management
Wizard framework (supports step-by-step dialogs)
NetBeans Visual Library
NetBeans IDE
The NetBeans IDE is an open-source integrated development
environment. NetBeans IDE supports development of all Java application types (Java SE
including JavaFX, (Java ME, web, EJB and mobile applications) out of the box. Among
other features are an Ant-based project system, Maven support, refactoring, version
control (supporting CVS, Subversion, Mercurial and Clear case).
4.2.1.3 Back-End Tool
16
Dr.CARE – Hospital Management System
SQL Server is a Relational Database Management System. The
Microsoft SQL server 2005 database has been selected as the database of choice for the
Data driven Application Development.
4.2.1.4 Operating System
Any platform that Java 1.1 or greater runs on.
17
Dr.CARE – Hospital Management System
SYSTEM DESIGN AND DEVELOPMENT
System design is the process of developing specifications for a candidate
system that meet the criteria established in the system analysis.
The project is enclosed in two modules:-
The project is divided into two modules. That means it is consist of 2 users.
The Staff (Front Office) and Doctor. Staff module is then divided into 4 main parts.
Patient details
Room
Department details
Doctor details
In these three parts the staffs can search, store, update and delete the details
of the Patients, Room/Departments and Doctors. Doctors’ module is then divided into 1
main part.
Patient details, Prescription ,Medical History ..etc
5.1Input Design
The major step in system design is the preparation of the input forms and the
output reports in a form applicable to the user. The input design is carried in such a way that
the input screens are user friendly. The goal of input design is to make data entry as easy,
logical and error free.
In this system, importance is given to development of Graphical User
Interface for the module.
5.2 Output Design
The goal of the output design is to capture the output and get the data into a format suitable
for the computer. It is very helpful to produce the clear, accurate and speedy information for
end users.
As in the input design, the importance is laid to develop Graphical User.
19
Dr.CARE – Hospital Management System
5.3 Database Design
Database design is one of the most important aspects of the system design
phase. The primary objectives of database design are fast response time to inquiries, more
information at low cost, control of redundancy, clarity and ease of use, data and program
independence, accuracy and integrity of the system and fast recovery.
Several tables are maintained in the system to store data that are required for
the processing of various data as well as storing intermediate or final processed results.
These stored data are accessed by the main Module.
There are 5 major steps in design process. The first 4 steps are usually done
on paper and finally the design is implemented.
(i) Identify the table and relationships: The tables required are identified and the
relationship amongst the tables is analyzed.
(ii) Identify the data that is needed for each table and relationship: The actual
data needed for each table is analyzed.
(iii) Normalization: Data structuring is defined through a process called
normalization. Data are grouped in the simplest way possible so that later
changes can be made with a minimum of impact on the data structure. The
major normal forms are 1NF, 2NF, 3NF, BCNF, 4NF and 5NF.
(iv) Verify the design: The proposed design is verified using test data.
(v) Implement the design: This is the phase where the database is implemented
physically.
There are mainly 5 tables used in this project. They are as follows:
Doctor : For Login and storing Doctors details.
Patient : For storing Patient Information details.
Room : For storing Rooms details.
Department: For Storing The Department details
Consulting : For Storing Consulting Details Of Patient
20
Dr.CARE – Hospital Management System
SYSTEM TESTING AND IMPLEMENTATION
6.1 System Testing
System testing is a critical element of quality assurance and represents the
ultimate previews of analysis, design and coding. Testing represents an interesting anomaly
for the software. The quality assurance goal of the testing phase is to ensure the
completeness and the accuracy of the system and minimize the retesting process. Test case
design focuses on a set of techniques for the creation of test cases that meet overall testing
objective. When a system is developed it is hoped that it performs properly. The main
purpose of testing an information system is to find the errors and correct them. The scope of
system testing should include both manual and computerized operations.
The strategy for system testing integrates system test cases and design techniques
into a well-planned series of steps that result in the successful construction of software. The
testing must co-operate with test planning, test case design, test execution and the resultant
data collection and evaluation. A strategy for software testing must accommodate low level
test that are necessary to verify whether a small code segment has correctly been
implemented as well as high level test that validates major system functions against user
requirements. The Different types of testing are:
Unit Testing
Integration Testing
Validation Testing
System Testing
User Acceptance Testing
Unit Testing
In unit testing different modules are tested against the specification produced
during the design of modules. Unit testing is essential for verification during the coding
phase. The tests are carried out during the programming stage itself. In computer
programming, a unit test is a procedure used to verify that a particular module of source
code is working properly. The idea about unit tests is to write test cases for all functions and
methods so that whenever a change causes a regression, it can be quickly identified and
tested. As the project was divided into modules, each unit in the module was tested.
22
Dr.CARE – Hospital Management System
Integration Testing
Integration testing focuses on the design and the construction of the software
architecture. The sub functions when combined may not produce the desired function.
Integration testing takes as its input, modules that have been checked out by unit testing,
groups them in larger aggregates. The need for integrated system is to find the overall
system performance.
Validation Testing
At the culmination of integration testing, software is completely assembled as a
package; interfacing errors have been recovered and corrected and then validation tests
begin. Proper validation checks are done in case of insertion and updating of tables, in order
to see that no duplication of data has occurred. If any such cases arise, appropriate warning
messages are displayed.
System Testing
System testing is testing conducted on a complete, integrated system to evaluate
the system's compliance with its specified requirements. As a rule, system testing takes, as
its input the software system itself integrated with any applicable hardware systems. The
purpose of Integration testing is to detect any inconsistencies between the software units that
are integrated together called assemblages or between any of the assemblages and hardware.
User Acceptance Testing
User acceptance testing of the system is the key factor for the success of any
system. The system under consideration is tested for user acceptance by constantly keeping
in touch with the prospective system at the time of development and making change
whenever required. This is done with regard to the interface design.
6.2 System Implementation
System implementation is the final phase i.e., putting the utility into action.
Implementation is the state in the project where theoretical design turns into a working
system. The most crucial stage is achieving a new successful system and giving assurance
that the new system will work efficiently and effectively. It involves careful planning,
investigation of the current system and constraints on implementation, as well as design of
methods to achieve.
23
Dr.CARE – Hospital Management System
SYSTEM SECURITY MEASURES
Any system developed should be secured and protected against possible
hazards. The system may have to face the unwanted events called threats. Computer system
is secure against a particular threat if counter measures have been taken to reduce an
acceptability low-level amount of loss that the threat may be expected to cause over a given
period of time. The system security problem can be divided in to four related issues:
Security, Integrity, Privacy, and Confidentiality. These problems may adversely affect the
ability of the computer system to carry out its intended task.
System Security
System security refers to the technical innovations and procedures applied to
the hardware and operating system to protect against deliberate or accidental damage from a
defined threat. In contrast, data security is the protection of data from loss, disclosure,
modification and destruction. The security features are considered while developing the
system, so as to avoid the errors and omissions that may lead to serious problems.
System Integrity
System integrity refers to the proper functioning of hardware and programs,
appropriate physical security, and safety against external threats. A threat to a computer
system is any events that adversely affect the one or more assets or resources, which make
up the system. An event can be interruption of communication, destruction of hardware,
modification of software, removal of programs, disclosure of information etc. The major
methods for handling threats are avoiding it by altering the design, threat retention or threat
reduction. Data integrity makes sure that the data do not differ from their original form and
have not been accidentally or intentionally disclosed, altered or destroyed.
Privacy
Privacy defines the rights of the users or organizations to determine what
information they are willing to share with or accept from others and how the organization
25
Dr.CARE – Hospital Management System
can be protected against unwelcome, unfair or excessive dissemination of information about
it.
Confidentiality
The term confidentiality is a special status given to sensitive information in a
database to minimize the possible invasion of privacy. It is an attribute of information that
characterizes its need for protection. In contrast privacy is largely a procedural matter of
how information is used.
The above security issues were analyzed carefully and the following precautions are taken
for the implementation of the system:
Physical security or protection from fire, flood and other physical damage.
A procedure for protecting systems makes sure that the facility is physically
secure, provides a recovery/ restarts capability, and has access to backup files. The list of
potential lists is Errors and omissions, Disgruntled and dishonest employees, Fire, Natural
disasters and External attack. Care has been taken to avoid such damages.
Database integrity through data validation techniques.
The application stores data in a RDBMS called SQL Server. We can store
data in a secured and easily retrievable manner into the tables. So the proposed system
provides powerful security measures. The system is capable to cope with the changes in the
organization policies.
Control measures through passwords on a regular basis.
Security measures are provided to prevent unauthorized access of the system
and the database at various levels. In this project the data security and validation are applied
using a password authentication. All the data, which is entered by the user is validated.
26
Dr.CARE – Hospital Management System
Users should enter their username and password for the requesting access. Only after a valid
login does the user get access to the system.
CONCLUSION
27
Dr.CARE – Hospital Management System
CONCLUSION
This is a project dealing with the computerization of services of
“Hospital Management“. This project deals with the patient information and it adds new
patent and gives admission. It genrates reports like which patient is alloted to which doctor,
and which patient contains which Medical History.
The system provides the features to search, delete, update. The
system was successfully designed, developed and tested. All the given objectives were met
with satisfaction. The system after being tested was found to be achieving what it is meant
for. The system is found to be 100% error free and ready for implementation.
The product is found to be highly scaleable, pluggable and generic.
The system can be maintained successfully, without much rework. The System is
implemented with an insight of necessary modifications that may require in the future. The
system can be upgraded with latest evolving technologies that are being introduced in the IT
industry.
28
Dr.CARE – Hospital Management System
SCOPE FOR FUTURE ENHANCEMENT
The analysis of the future organization provides the opportunity to
explore new ways of better meeting theorganization’s aims and objectives. Information
systems have the potential to change the way in which the organisation’sbusiness is
conducted. So, thought should be given to the issues of how the structure of the
organization can be improved,how the effectiveness of management can be increased,
how procedures can be streamlined. Known and possible changesto the policies of the
organization also need to be addressed.
It is important to recognize that strategic thinking on the future role of
information systems in the futureorganization should not initially be constrained by the
present status of information supply. Consideration should be givento create an entirely
separate concept for the future information systems, one which is not merely a logical
extension ofthe existing system.
This aspect of strategic thinking may require the use of special techniques
for modeling information, data andprocesses. There are methodologies that can provide
assistance. There is, however, no single recommended approach.The prime requirement
is for the appropriate skills and experience.
30
Dr.CARE – Hospital Management System
TABLE STRUCTURE
Table Name: Doctor
For Login and storing Doctor Details.
Field Data Type Length Constraint
Name Nvarchar 50
Depname Nvarchar 50
Address Nvarchar 50
Qualification Nvarchar 50
Phone Nvarchar 50
Time Nvarchar
Joiningdate Nvarchar 50
ID Int
password Int
weight Int
36
Dr.CARE – Hospital Management System
TABLE STRUCTURE Contd.
Table Name: Patient
For storing Patient details.
Field Data Type Length Constraint
PID Int Primary Key
name Nvarchar 50
Gender Nvarchar 50
Address Nvarchar 50
Age Nvarchar 50
Phone Nvarchar 50
email Nvarchar 50
Department Navarchar 50
Docname Nvaerchar 50
TABLE STRUCTURE Contd.
Table Name: Cunsulting
For storing Patient Consulting details.
Field Data Type Length Constraint
Dname Nvarchar 25
Pname Nvarchar 50
Prescription Nvarchar 50
37
Dr.CARE – Hospital Management System
Medicalhistory Nvarchar 50
TABLE STRUCTURE Contd.
Table Name: Department
For storing Department details.
Field Data Type Length Constraint
Depname Nvarchar 50
HOD Nvarchar 50
Description Nvarchar 50
TABLE STRUCTURE Contd.
Table Name: Room
For storing Room details.
Field Data Type Length Constraint
Roomno Nvarchar 50
Floorno Nvarchar 50
Description Nvarchar 50
Status Nvarchar 50
Pname Nvarchar 50
Docname Nvarchar 50
38
Dr.CARE – Hospital Management System
1. LOGIN FORM:
This form is used for typing the user name and password by using the keyboard, as well as by using the mouse interface. This will allow the user to work with ‘Dr.CARE’.
40
Dr.CARE – Hospital Management System
3. FRONT OFFICE WINDOW:
This is the main window (Front Office)of ‘Dr.CARE’. From here you can perform all the operations.
41
Dr.CARE – Hospital Management System
4.PATIENTREGISTRATIONWINDOW:
This form is used to Registering A new Patient in the hospital
5. ADD DEPARTMENT:
42
Dr.CARE – Hospital Management System
This form is used to add new Department details In the hospital
6. ADD ROOMS WINDOW:
This form is used to Add new rooms details in the hospital
7. ADMIT PATIENT WINDOW:
43
Dr.CARE – Hospital Management System
This form is used to Admit Patient in to rooms.
8. DISCHARGE/SERCH WINDOW:
44
Dr.CARE – Hospital Management System
This form is used to Discharge /search the patient .
9. ADD NEW DOCTOR WINDOW:
This form is used to addthe new Doctor in the hospital That can store details of the doctor
45
Dr.CARE – Hospital Management System
10. ‘DELETE DOCTOR’ WINDOW:
This form is to delete the Doctor details that have already stored in the database.
12. DOCTORS WINDOW:
46
Dr.CARE – Hospital Management System
This form is Displaying After the doctor login.
13. SELECT MY PATIEN WINDOW:
47
Dr.CARE – Hospital Management System
This form is used to get all the details about the patient including medical history
48
Dr.CARE – Hospital Management System
SAMPLE CODE
LOGIN FORM
/*
* login.java
*
* Created on May 5, 2009, 2:00 PM
*/
package hospital;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
public class login extends javax.swing.JFrame {
/** Creates new form login */
public login() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
50
Dr.CARE – Hospital Management System
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jPasswordField1 = new javax.swing.JPasswordField();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CL
OSE);
setTitle("Login");
setForeground(new java.awt.Color(247, 246, 246));
jLabel2.setText("Password");
jLabel1.setText("Username");
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Exit");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
51
Dr.CARE – Hospital Management System
}
});
jRadioButton1.setText("Doctors");
jRadioButton1.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
jRadioButton2.setText("Staffs");
jRadioButton2.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/hospital/login_key.jpg"))
); // NOI18N
org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 483,
Short.MAX_VALUE)
.add(layout.createSequentialGroup()
52
Dr.CARE – Hospital Management System
.add(104, 104, 104)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayo
ut.LEADING)
.add(layout.createSequentialGroup()
.add(24, 24, 24)
.add(jRadioButton1)
.add(57, 57, 57)
.add(jRadioButton2))
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.T
RAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.add(jButton1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 111,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELA
TED)
.add(jButton2,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING,
layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.Grou
pLayout.LEADING)
.add(jLabel2)
.add(jLabel1))
.add(27, 27, 27)
53
Dr.CARE – Hospital Management System
.add(layout.createParallelGroup(org.jdesktop.layout.Grou
pLayout.LEADING)
.add(jTextField1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 145,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jPasswordField1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 145,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
.add(159, 159, 159))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayo
ut.BASELINE)
.add(jRadioButton1)
.add(jRadioButton2))
.add(22, 22, 22)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayo
ut.BASELINE)
.add(jLabel1)
.add(jTextField1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
54
Dr.CARE – Hospital Management System
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
35, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayo
ut.BASELINE)
.add(jPasswordField1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jLabel2))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATE
D)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayo
ut.BASELINE)
.add(jButton1)
.add(jButton2))
.add(18, 18, 18))
);
pack();
}// </editor-fold>
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
this.dispose();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
if(jRadioButton1.isSelected()==true)
{
55
Dr.CARE – Hospital Management System
if(jTextField1.getText().equals("")||
jPasswordField1.getText().equals(""))
{
JOptionPane.showMessageDialog(this,"Doctor Not Found");
}
else
try {
int a=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:Hospital");
Statement stat=con.createStatement();
ResultSet rs1=stat.executeQuery("select * from Doctor where
id='"+jTextField1.getText()+"' AND pass='"+jPasswordField1.getText()
+"'");
while(rs1.next())
{
Doctor g=new Doctor();
g.setSize(800,800);
g.setVisible(true);
this.setVisible(false);
a=1;
}
if(a==0)
JOptionPane.showMessageDialog(this,"Doctor Not Found");
}
catch(Exception e)
{}
}
56
Dr.CARE – Hospital Management System
else if(jRadioButton2.isSelected()==true)
{
if(jTextField1.getText().equalsIgnoreCase("Office") &&
String.valueOf(jPasswordField1.getPassword()).equals("office"))
{
FrontOffice f = new FrontOffice();
f.show();
this.dispose();
}
else
{
JOptionPane.showMessageDialog(this,"Staff Not Found");
}
}
else
{
JOptionPane.showMessageDialog(this,"Select User(Doctor or
Staff)");
}
// JOptionPane.showMessageDialog(this,"Invaild User
Information");
//}
}
private void
jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2.setSelected(false); // TODO add your handling code
here:
}
57
Dr.CARE – Hospital Management System
private void
jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1.setSelected(false); // TODO add your handling code
here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new login().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JTextField jTextField1;
// End of variables declaration
}
58