Beruflich Dokumente
Kultur Dokumente
On
Patient Billing Software
Submitted in partial fulfillment of the requirements
For the award of the degree of
Submitted by
Pankaj Batra:
2. Analysis
• Context diagram
• Data flow diagram (Level I, II, III)
• Functional decomposition Diagram
3. Design
• ER diagram
• Data dictionary
• Table design
• Input forms design
• Report Layouts
4. Coding
• Quality of code
• Input data validations
• Quality of report
1 Introduction:
The basic problem with existing hospital management system is that manual operation is still going on in
various hospitals. About 75% of the government hospitals use manual operating system for maintaining the
records, however in some hospitals computerized system is used but it is not up to the mark. The basic
problems are:
• Improper maintenance of records
• Time management problem
• Unfulfillment of user requirements
The main objective for the creation of this project is to fulfill the basic needs of its users. It will keep proper
records and maintain a proper working environment for the users. It will eradicate time management
problems and enhance the performance of the system. This system is used to reduce the manual work of the
staff thus increasing the efficiency of the existing work flow.
Patient Billing System helps to keep track of patient’s charges consumption and helps to keep track and
evaluate patient’s bills.
The hospital can computerize its system so that a clear picture of patient’s reports and charges are always
available and the patient can make use of facilities provided by hospital in proper way in future.
1.1 Objective:
Printer NLQ dot matrix printer HLQ laser printer NLQ dot matrix printer
Sound card PCI sound card PCI sound card PCI sound card
Speaker Normal Normal Normal
500watt 650watt 900watt
Other: Printing and Backup Media.
Software Requirements: -
Operating System Database
Win-98, Win-XP, Linux or any other higher version Ms Access
Technologies to be used:
Db2-Database
Eclipse: Development tool
Rational-Design Tool
WAS Web Server
The process model which is chosen is the Water Fall Model. It is so because it is a sequential software
development model (a process for the creation of software) in which development is seen as flowing
steadily downwards (like a waterfall) through the phases of requirements analysis, design, implementation,
testing (validation),integration, and maintenance.
Waterfall Model
What is existing system
The traditional way of maintaining details of a patient in a hospital was to record those, using case sheets
manually. It was difficult to manually retrieve data whenever needed and almost next to impossible to
maintain such capacious data as the years passed by. It was difficult to update information for a patient
after some years. The billing had become a hard-hitting task for the data operators. Hence to prevent losing
of data and enhance the maintainability, various computerized approaches have been evolved. This project
is aimed at developing a patient billing software system that is of importance to a hospital. This system can
be used to maintain all patient information the treatment given to the patient the location or bed no. allotted
to each patient either in the ward or the ICU. The charges to be paid are computed automatically
considering the treatment charges specified the doctor’s charges and the ward bed charges. It also computes
the tax and generates a user bill.
3. Overall Description:
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 proper storage of
information.
4. No Redundancy: - In the proposed system utmost care would be that no information is repeated
anywhere, in storage or otherwise. This would assure economic use of storage space and consistency in
the data stored.
5. Immediate retrieval of information: - The main objective of proposed system is to provide for a
quick and efficient retrieval 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 developed
within a short period of time and fit in the limited budget of the user.
3.2 Background:
A Hospital is a place where Patients come up for general diseases. Hospitals provide facilities like:-
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. Whenever
the 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 on the document, which contains Patient
information. It is destroyed after some time period to decrease the paper load in the office.
All this work is done manually by the receptionist and other operational staff and lot of papers are needed
to be handled and taken care of. Doctors have to remember various medicines available for diagnosis and
sometimes miss better alternatives as they can’t remember them at that time.
3.5 Constraints:
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 difficult to 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 becomes a difficult task as information is difficult
to collect from various registers.
1. Improved Manual System: - 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, doctor diary 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 updations are made at the very moment at the same time. Proper
person for proper work should be made responsible so that a better efficiency could be achieved. This
needs a lot of work force.
2. Batch System: - Another alternative solution can be used of computer based 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 periodical basis.
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 provides online storage/ updations and retrieval facility. This system
promises very less or no paper work and also provides help to doctor and operational staff.
In this system everything is stored electronically so very less amount of paper work is required and
information can be retrieved very easily without searching here and there into registers. This system is been
discussed here.
4. Feasibility Study:
“FEASIBILITY STUDY” is a test of system proposal according to its workability, impact of the
organization, ability to meet needs and effective use of the resources. It focuses on these 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.
A study of resource availability that may affect the ability to achieve an acceptable system. This evaluation
determines whether the technology needed for the proposed system is available or not.
• Can the work for the project be done with current equipment existing software technology & available
personal?
• Can the system be upgraded if developed?
• If new technology is needed then what can be developed?
This is concerned with specifying equipment and software that will successfully satisfy the user
requirement. The technical needs of the system may include:
An important issue for the development of a project is the selection of 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 development of the project.
Front-end selection:
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.
Back-end Selection:
The technical feasibility is frequently the most difficult area encountered at this stage. It is essential that the
process of analysis and definition be conducted in parallel with an assessment to technical feasibility. It
centers on the existing computer system (hardware, software etc.) and to what extent it can support the
proposed system.
Economic justification is generally the “Bottom Line” consideration for most systems. Economic
justification includes a broad range of concerns that includes cost benefit analysis. In this we weight the
cost and 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 design phase.
The financial and the economic questions during the preliminary investigation are verified to estimate the
following:
It is mainly related to human organizations and political aspects. The points to be considered are:
Time evaluation is the most important consideration in the development of project. The time schedule
required for the developed of this project is very important since more development time effect machine
time, cost and cause delay in the development of other systems.
A reliable Patient Billing System can be developed in the considerable amount of time.
Patient Billing Software basic requirement is that it should maintain the record of patient and information
regarding the bills as well as the treatment they have got in that hospital. The task should be divided among
the users according to their classification.
The Patient Register contains information related to each patient. Whenever a new patient is admitted in the
hospital, an entry is made in Patient Register. The Registration-No is automatically generated in the form
and so is unique for each patient. The Patient’s name i.e. First name and Last name cannot be left Blank,
similarly Address, City is automatically formatted and cannot be left blank. The date of admission is
automatically taken as current date by the system.
The Bed Allocation Register contains details regarding a patient’s bed allocation viz. Reg-no, Patient’s
name, bed-no, bed-charges, advance etc. The Registration-no once entered is checked for in the Patient
Register, and only if the NO is found the record is entered into the Bed Allocation Register. The bed to be
allocated is checked for availability.
The Medicine Detail Register is used to display all the medicines currently in stock of the hospital.
Whenever a patient requires any medicine, it is issued against a bill in name of patient.
This register includes the bill printing and display options. A registration number is entered to generate bill,
which is first checked in patient register for existence.
(e) Reception:
The Administrator will create different bills for the patient. The system users will be created and will be
assigned with the different roles. More than one patient can be granted or revoked from the system.
(h) Patient:
(j) Admission:
Details of the different rooms in which the patient has to be transferred for different operations.
(m) Doctor:
Patient Register
Bill Register
PasswordMaster
Main Scenario:
ACTIVITY CASE 1
SELECT
N
e Go To Patient
EXIST
s Admission
Y
e
s
Modify Record
View Record
Main Scenario:
ACTIVITY CASE 2
SELECT
PATIENT
N
e Go To Patient
EXIST
s Admission
Y
e
s
Modify Bill
Generate Bill
5.4.3 USE CASE 3:
Main Scenario:
ACTIVITY CASE 3
SELECT
PATIENT
Y
e
EXIST
s Go To Stop
N
e
s
Create New
Patient Record
Edit Details
Bed Detail
Main Scenario:
ACTIVITY CASE 4
SELECT BED
DETAILS
N
e
EXIST
s Add the Details
Y
e
s
Modify Details
Generate Final
details
E-R Diagram
DFD Diagram
6. SYSTEM IMPLEMENTATION:
• PLATFORM USED:
Writing in the Java programming language is the primary way to produce code that will be deployed as
Java bytecode, though there are compilers available for other languages such as JavaScript, Python and
Ruby, and a native Java scripting language called Groovy. Java syntax borrows heavily from C and C++
but it 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 Java Virtual Machine (JVM).
On 13 November 2006, Sun Microsystems made the bulk of its implementation of Java available under the
GNU General Public License, although there are still a few parts distributed as precompiled binaries due to
intellectual property restrictions.
An edition of the Java platform is the name for a bundle of related programs, or platform, from Sun which
allow for developing and running programs written in the Java programming language.
The platform is not specific to any one processor or operating system, but rather an execution engine
(called a virtual machine) and a compiler with a set of standard libraries that are implemented for various
hardware and operating systems so that Java programs can run identically on all of them.
• Java Card: refers to a technology that allows small Java-based applications (applets) to be run
securely on smart cards and similar small memory footprint devices.
• Java ME (Micro Edition): Specifies several different sets of libraries (known as profiles) for
devices which are sufficiently limited that supplying the full set of Java libraries would take up
unacceptably large amounts of storage.
• Java SE (Standard Edition): For general purpose use on desktop PCs, servers and similar devices.
• Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tier client-server
enterprise applications.
As of September 2008, the current version of the Java Platform is specified as either 1.6.0 or 6 (both refer
to the same version). Version 6 is the product version, while 1.6.0 is the developer version.
The Java Platform consists of several programs, each of which provides a distinct portion of its overall
capabilities. For example, the Java compiler, which converts Java source code into Java bytecode (an
intermediate language for the Java Virtual Machine (JVM)), is provided as part of the Java Development
Kit (JDK). The Java Runtime Environment (JRE), complementing the JVM with a just-in-time (JIT)
compiler, converts intermediate bytecode into native machine code on the fly. Also supplied are extensive
libraries (pre-compiled in There are several other components, some available only in certain editions.
The essential components in the platform are the Java language compiler, the libraries, and the runtime
environment in which Java intermediate bytecode "executes" according to the rules laid out in the virtual
machine specification.
The initial codebase originated from VisualAge. In its default form it is meant for Java developers,
consisting of the Java Development Tools (JDT). Users can extend its capabilities by installing plug-ins
written for the Eclipse software framework, such as development toolkits for other programming
languages, and can write and contribute their own plug-in modules. Language packs provide translations
into over a dozen natural languages.
Architecture:
Eclipse employs plug-ins in order to provide all of its functionality on top of (and including) the runtime
system, in contrast to some other applications where functionality is typically hard coded. The runtime
system of Eclipse is based on Equinox, an OSGi standard compliant implementation.
This plug-in mechanism is a lightweight software componentry framework. In addition to allowing Eclipse
to be extended using other programming languages such as C and Python, the plug-in framework allows
Eclipse to work with typesetting languages like LaTeX, networking applications such as telnet, and
database management systems. The plug-in architecture supports writing any desired extension to the
environment, such as for configuration management. Java and CVS support is provided in the Eclipse
SDK.
The key to the seamless integration (but not of seamless interoperability) of tools with Eclipse is the plug-
in. With the exception of a small run-time kernel, everything in Eclipse is a plug-in.
This means that every plug-in developed integrates with Eclipse in exactly the same way as other plug-ins;
in this respect, all features are created equal.
Eclipse provides plug-ins for a wide variety of features, some of which are through third parties using both
free and commercial models. Examples of plug-ins include UML plug-in for Sequence and other UML
diagrams, plug-in for Database explorer, and many others.
The Eclipse SDK includes the Eclipse Java Development Tools, offering an IDE with a built-in incremental
Java compiler and a full model of the Java source files. This allows for advanced refactoring techniques
and code analysis. The IDE also makes use of a workspace, in this case a set of metadata over a flat file
space allowing external file modifications as long as the corresponding workspace "resource" is refreshed
afterwards. The Visual Editor project (discontinued since June 30, 2006) allows interfaces to be created
interactively, thus allowing Eclipse to be used as a RAD tool.
Eclipse's widgets are implemented by a widget toolkit for Java called SWT, unlike most Java applications,
which use the Java standard Abstract Window Toolkit (AWT) or Swing. Eclipse's user interface also uses
an intermediate GUI layer called JFace, which simplifies the construction of applications based on SWT.
Eclipse provides the Eclipse Rich Client Platform (RCP) for developing general purpose applications. The
following components constitute the rich client platform:
DB2 is one of IBM's families of relational database management system (RDBMS) software products
within IBM's broader Information Management Software line. Although there are different "editions" and
"versions" of DB2 which run on devices ranging from handhelds to mainframes, most often DB2 refers to
DB2 Enterprise Server Edition, which runs on Unix (AIX), Windows or Linux servers; or DB2 for z/OS.
DB2 powers the different IBM InfoSphere Warehouse editions. Alongside DB2 is another RDBMS:
Informix, which was acquired by IBM in 2001.
DB2 is available in several "editions," or licensing arrangements. By opting for a reduced-feature "edition,"
IBM allows customers to avoid paying for database features which they do not need. Sample editions
include the Express, Workgroup, and Enterprise Edition. The most sophisticated edition for
Linux/UNIX/Windows is DB2 Data Warehouse Enterprise Edition or DB2 for short. This edition is
intended for mixed workload (OLTP and data warehousing) or business intelligence (BI) implementations.
DB2 DWE includes several "BI" features such as ETL, data mining, OLAP acceleration, and in-line
analytics.
DB2 for z/OS is available under its own licensing terms. Starting with Version 8, IBM brought DB2 for
z/OS and for the other platforms into much closer alignment. (Previously there were significant differences
in SQL vocabularies, for example.) DB2 for z/OS has some exclusives — notably Multi-Level Security
(MLS), extremely large table sizes, and hardware-assisted compression — owing to its special environment
and the demanding needs of its customers. DB2 for z/OS has always been known for its leading OLTP
performance and capabilities, and for its reliability and availability to support mission-critical business
operations, but the z/OS version is now starting to acquire BI features as well, such as materialized query
tables (MQTs) and star schema. Oracle's CEO Larry Ellison commented that DB2 for z/OS is the one
competitive database he respects and admires.
On January 30, 2006, IBM released a no-charge version of DB2 called DB2 Express-C. This was an
expected response to the recently announced free versions of Oracle 10g and Microsoft SQL Server. Unlike
Microsoft or Oracle's free editions, Express-C has no limit on number of users or on database size. While
versions 8.2 and 9.1 of DB2 Express-C imposed hardware limits on the server on which it ran, DB2
Express-C 9.5 can run on Windows and Linux machines of any size, but the database engine will not utilize
more than two CPU cores and 2GB RAM. In 2007, IBM introduced a yearly support subscription called the
Fixed Term License (FTL), which offers a year of telephone support for Express-C. Purchasing the FTL
also allows the DB2 Express-C engine to use up to four CPU cores and 4GB RAM.
Users of DB2 Express-C who don't purchase an FTL subscription can receive support and assistance on a
free, public web forum staffed by IBM technicians and other DB2 users.
DB2 can be administered from either the command-line or a GUI. The command-line interface requires
more knowledge of the product but can be more easily scripted and automated. The GUI is a multi-platform
Java client that contains a variety of wizards suitable for novice users. DB2 supports both SQL and
XQuery. DB2 has native implementation of XML data storage, where XML data is stored as XML (not as
relational data or CLOB data) for faster access using XQuery.
Program Code
mainpage.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.Statement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
//import javax.swing.JLabel;
//import javax.swing.JOptionPane;
//import javax.swing.JTextField;
JButton
jbnadddoctor,jbneditdoctor,jbnmedicine,jbneditmedicine,jbnreg,jbneditreg,jbnbloodbank,jbneditbl
oodbank,jbndepartment,jbneditdepartment,jbndiet,jbneditdiet,jbnschedule,jbneditschedule,jbndrug
master,jbneditdrugmaster,jbnlab,jbneditlab,jbnward,jbneditward,jbnpatientroom,jbneditpatientroo
m,jbntreatment,jbnedittreatment,jbnroom,jbneditroom,jbnroomtransfer,jbnpatientbill,jbnback,jbn
exit;
Container cPane;
public static void main(String args[]){
new mainpage();
}
public mainpage()
{
createGUI();
}
public void createGUI(){
/*Create a frame, get its contentpane and set layout*/
appFrame = new JFrame("mainpage");
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void arrangeComponents(){
jbnadddoctor = new JButton("ADD NEW DOCTORS ENTRY");
jbneditdoctor = new JButton("EDIT DOCTORS ENTRY");
jbnmedicine = new JButton("NEW MEDICINE ENTRY");
jbneditmedicine = new JButton("EDIT MEDICINE ENTRY");
jbnreg = new JButton("REGISTRATION OF PATIENT");
jbneditreg = new JButton("EDIT REGISTRATION OF PATIENT");
jbnbloodbank = new JButton(" BLOOD BANK ");
jbneditbloodbank = new JButton("EDIT BLOOD BANK");
jbndepartment = new JButton(" DEPARTMENT ");
jbneditdepartment = new JButton("EDIT DEPARTMENT");
jbndiet = new JButton(" DIET ");
jbneditdiet = new JButton(" EDIT DIET ");
jbndrugmaster = new JButton(" DRUGMASTER ");
jbneditdrugmaster = new JButton("EDIT DRUGMASTER");
jbnlab = new JButton(" LAB ENTRY ");
jbneditlab = new JButton("EDIT LAB ENTRY ");
jbnward = new JButton(" WARD ENTRY ");
jbneditward = new JButton("EDIT WARD ENTRY");
jbnpatientroom = new JButton( "Patient ROOM " );
jbneditpatientroom = new JButton("EDIT PATIENT ROOM");
jbntreatment = new JButton(" DAILY CHARGES " );
jbnedittreatment = new JButton(" EDIT CHARGES " );
jbnroom = new JButton(" ROOMS ENTRY " );
jbneditroom = new JButton("EDIT ROOMS ENTRY" );
jbnroomtransfer = new JButton(" ROOM TRANSFER ");
jbnpatientbill = new JButton(" PATIENT BILL ");
jbnback = new JButton(" BACK " );
jbnexit = new JButton(" EXIT ");
jbnadddoctor.addActionListener(this);
jbneditdoctor.addActionListener(this);
jbnmedicine.addActionListener(this);
jbneditmedicine.addActionListener(this);
jbnreg.addActionListener(this);
jbneditreg.addActionListener(this);
jbnbloodbank.addActionListener(this);
jbneditbloodbank.addActionListener(this);
jbndepartment.addActionListener(this);
jbneditdepartment.addActionListener(this);
jbndiet.addActionListener(this);
jbneditdiet.addActionListener(this);
jbndrugmaster.addActionListener(this);
jbneditdrugmaster.addActionListener(this);
jbnlab.addActionListener(this);
jbneditlab.addActionListener(this);
jbnward.addActionListener(this);
jbneditward.addActionListener(this);
jbnpatientroom.addActionListener(this);
jbneditpatientroom.addActionListener(this);
jbntreatment.addActionListener(this);
jbnedittreatment.addActionListener(this);
jbnroom.addActionListener(this);
jbneditroom.addActionListener(this);
jbnroomtransfer.addActionListener(this);
jbneditward.addActionListener(this);
jbnpatientbill.addActionListener(this);
jbnback.addActionListener(this);
jbnexit.addActionListener(this);
}
public void actionPerformed (ActionEvent e)
{
if (e.getSource() == jbnadddoctor){
new docmaster();
}
else if (e.getSource() == jbneditdoctor){
new docmaster1();
}
else if (e.getSource() == jbnmedicine){
new medicines();
}
else if (e.getSource() == jbneditmedicine){
new medicines1();
}
else if (e.getSource() == jbnreg){
new registration();
}
else if (e.getSource() == jbneditreg){
new registration1();
}
else if (e.getSource() == jbnbloodbank){
new bloodbank();
}
else if (e.getSource() == jbneditbloodbank){
new bloodbank1();
}
else if (e.getSource() == jbndepartment){
new departement();
}
else if (e.getSource() == jbneditdepartment){
new department1();
}
else if (e.getSource() == jbndiet){
new diet();
}
else if (e.getSource() == jbneditdiet){
new diet1();
}
else if (e.getSource() == jbndrugmaster){
new drugmaster();
}
else if (e.getSource() == jbneditdrugmaster){
new drugmaster1();
}
else if (e.getSource() == jbnlab){
new lab();
}
else if (e.getSource() == jbneditlab){
new lab1();
}
else if (e.getSource() == jbnward){
new wardmaster();
}
else if (e.getSource() == jbneditward){
new wa();
}
else if (e.getSource() == jbnpatientroom){
new patientroom();
}
else if (e.getSource() == jbneditpatientroom){
new editpatientroom();
}
else if (e.getSource() == jbntreatment){
new treatment();
}
else if (e.getSource() == jbnedittreatment){
new edittreatment();
}
else if (e.getSource() == jbnroom){
new room();
}
else if (e.getSource() == jbneditroom){
new editroom();
}
else if (e.getSource() == jbnroomtransfer){
new roomtransfer();
}
else if (e.getSource() == jbnpatientbill){
new patientbilling();
}
else if (e.getSource() == jbnback){
new loginenter();
}
else if (e.getSource() == jbnexit){
System.exit(0);
}}
// Save the Person into the Address Book
}
loginenter.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
//import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
//import javax.swing.JOptionPane;
import javax.swing.*;
Container cPane;
public static void main(String args[]){
new loginenter();
}
public loginenter()
{
login="";
pass="";
createGUI();
}
public void createGUI(){
/*Create a frame, get its contentpane and set layout*/
appFrame = new JFrame("Login Page");
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void arrangeComponents(){
// jComboBox1.addActionListener(this);
jbnsubmit.addActionListener(this);
jbnClear.addActionListener(this);
jbnexit.addActionListener(this);
}
void searchPerson()
{
// jtfloginname.setText(com);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
//JComboBox x=jComboBox1.getSelectedItem()
// jtfloginname.setText(com);
String sql = "SELECT * FROM login3 WHERE loginname= '"+
jtfloginname.getText() +"' and password= '"+ jtfpassword.getText() +"' ";
//jtfloginname.setText(sql);
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
login = rs.getString("loginname");
pass= rs.getString("password");
new mainpage();
}
else
{
JOptionPane.showMessageDialog(null, "Wrong Entry");
}}
catch(Exception e){
System.out.println("D");
System.out.println(e);
jtfloginname.setText("problem");
}
//return personsList;
}
public void actionPerformed (ActionEvent e){
if (e.getSource () == jbnsubmit){
searchPerson();
}
else if (e.getSource() == jbnClear){
clear();
}
else if (e.getSource() == jbnexit){
System.exit(0);
}}
// submit the Person into the Address Book
public void clear(){
jtfloginname.setText("");
jtfpassword.setText("");
}}
Wardmaster.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
JButton jbnSave,jbnClear,back;
Container cPane;
public static void main(String args[]){
new wardmaster();
}
public wardmaster()
{
wardno="";
wardname="";
wardincharge="";
headnurse="";
noofbeds="";
aviablebeds="";
createGUI();
}
public void createGUI(){
/*Create a frame, get its contentpane and set layout*/
appFrame = new JFrame("WARD MASTER");
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void arrangeComponents(){
jlbwardno = new JLabel("Ward Number");
jlbwardname = new JLabel(" wardname");
jlbwardincharge = new JLabel("wardincharge");
jlbheadnurse = new JLabel("headnurse");
jlbnoofbeds = new JLabel("noofbeds");
jlbaviablebeds= new JLabel("aviable");
jtfwardno = new JTextField(20);
jtfwardname = new JTextField(20);
jtfwardincharge = new JTextField(20);
jtfheadnurse = new JTextField(20);
jtfnoofbeds = new JTextField(20);
jtfaviablebeds = new JTextField(20);
jbnSave = new JButton("Save");
jbnClear = new JButton("Clear");
back = new JButton("Back");
jbnSave.addActionListener(this);
jbnClear.addActionListener(this);
back.addActionListener(this);
}
public void actionPerformed (ActionEvent e){
if (e.getSource () == jbnSave){
savePerson();
clear();
}
else if (e.getSource() == jbnClear){
clear();
}else if (e.getSource() == back){
new mainpage();
}}
// Save the Person into the Address Book
public void savePerson(){
wardno = jtfwardno.getText();
if(wardno.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO wardmaster2 VALUES ('" + jtfwardno.getText()+
"','" + jtfwardname.getText() + "','" + jtfwardincharge.getText() + "','" + jtfheadnurse.getText() +
"','" + jtfnoofbeds.getText() + "','" + jtfaviablebeds.getText() + "')";
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
JOptionPane.showMessageDialog(null, "Record Saved");
}}
public void clear(){
jtfwardno.setText("");
jtfwardname.setText("");
jtfwardincharge.setText("");
jtfheadnurse.setText("");
jtfnoofbeds.setText("");
jtfaviablebeds.setText("");
} }
Roomtransfer.java
package patient;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new roomtransfer();
}
public roomtransfer()
{
id="";
date="";
roomfrom="";
amount="";
roomto="";
createGUI();
}
public void createGUI(){
/*Create a frame, get its contentpane and set layout*/
appFrame = new JFrame("Room Allocation");
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1000,1000);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void arrangeComponents(){
jlbid = new JLabel("patient ID");
jlbdate = new JLabel(" date");
jlbroomfrom = new JLabel("roomfrom no");
jlbamount = new JLabel("amount");
jlbroomto= new JLabel("roomto");
one=new JLabel("Hospital roomtransfers");
Font f=new Font("Arial",Font.BOLD,50);
one.setFont(f);
jtfId = new JTextField(20);
jtfdate = new JTextField(20);
jtfroomfrom = new JTextField(20);
jtfamount = new JTextField(20);
jtfroomto = new JTextField(20);
jbbsubmit = new JButton("submit");
jbnClear = new JButton("Clear");
jbnback=new JButton("Back");
search=new JButton("Search");
Date s=new Date();
String ss=s.toString();
jtfdate.setText(ss);
jbbsubmit.addActionListener(this);
jbnClear.addActionListener(this);
jbnback.addActionListener(this);
search.addActionListener(this);
}
public void actionPerformed (ActionEvent e){
if (e.getSource () == jbbsubmit){
deletePerson();
submitPerson();
clear();
}else if (e.getSource() == jbnClear){
clear();
}
else if (e.getSource() == jbnback){
new mainpage();
}
else if (e.getSource() == search){
searchPerson();
} }
void searchPerson()
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT * FROM room WHERE roomno= '"+ jtfroomto.getText() +"'";
// Create a prepared statement
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
amount = rs.getString("charges");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,ddate,address,fdate,lline,mobile,room,exp,eid,tfrom,tto,rno,ipdpatientroom,opdp
atientroom);
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO patientroom VALUES ('" +
jtfId.getText()+ "','" + jtfdate.getText() + "','" + jtfroomfrom.getText() + "','" + jtfamount.getText()
+ "','" + jtfroomto.getText() + "')";
Patientbilling.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
JLabel jlbbillno,jlbdate,
jlbipd,jlbname,jlbtreatment,jlbamt,jlbroomcharges,jlbmedcharges,jlblabtestcharges,jlbbloodcharges
,jlbothercharges,jlbtotalcharges;
JTextField jtfbillno,jtfdate,
jtfipd,jtfname,jtftreatment,jtfamt,jtfroomcharges,jtfmedcharges,jtflabtestcharges,jtfbloodcharges,jtf
othercharges,jtftotalcharges;
JButton jbbSave , jbnClear,back,auto,total;
String
billno,date,ipd,name,treatment,amt,roomcharges,medcharges,labtestcharges,bloodcharges,otherchar
ges,totalcharges;
Container cPane;
public static void main(String args[]){
new patientbilling();
}
public patientbilling()
{
billno="";
date="";
ipd="";
name="";
treatment="";
amt="";
roomcharges="";
medcharges="";
labtestcharges="";
bloodcharges="";
othercharges="";
totalcharges="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
jtfdate.setText(ss);
searchPerson();
GridBagConstraints gridBagConstraintsx14 = new GridBagConstraints();
gridBagConstraintsx14.gridx = 1;
gridBagConstraintsx14.gridy = 6;
gridBagConstraintsx14.insets = new Insets(5,5,5,5);
gridBagConstraintsx14.gridwidth = 2;
gridBagConstraintsx14.fill = GridBagConstraints.BOTH;
cPane.add(jtfroomcharges, gridBagConstraintsx14);
jbbSave.addActionListener(this);
jbnClear.addActionListener(this);
back.addActionListener(this);
auto.addActionListener(this);
total.addActionListener(this);
}
if (e.getSource () == jbbSave){
savePerson();
deletePerson();
clear();
}
else if (e.getSource() == jbnClear){
clear();
}
else if (e.getSource() == back){
new mainpage();
}
else if (e.getSource() ==total){
total();
}
else if (e.getSource() == auto){
searchPerson1();
searchPerson2();
searchPerson3();
searchPerson4();
searchPerson5();
searchPerson6();
searchPerson7();
}
public void total()
{
String tc=jtfamt.getText();
int tc1=Integer.parseInt(tc);
String rc=jtfroomcharges.getText();
int rc1=Integer.parseInt(rc);
String lab=jtflabtestcharges.getText();
int lab1=Integer.parseInt(lab);
String med=jtfmedcharges.getText();
int med1=Integer.parseInt(med);
String bl=jtfbloodcharges.getText();
int bl1=Integer.parseInt(bl);
String oc=jtfothercharges.getText();
int oc1=Integer.parseInt(oc);
int total=0;
total=tc1+rc1+lab1+med1+oc1+bl1;
String xx=Integer.toString(total);
jtftotalcharges.setText(xx);
}
void searchPerson()
{
String billno;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
billno = rs.getString("bill");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
jtfbillno.setText(billno);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
void searchPerson1()
{
String amt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
amt = rs.getString("amt");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
void searchPerson5()
{
String amt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT sum(charges) as amt FROM medicines1 where pid='" + jtfipd.getText() + "'
";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
amt = rs.getString("amt");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
void searchPerson6()
{
String amt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT sum(amount) as amt FROM lab1 where pid='" + jtfipd.getText() + "' ";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
amt = rs.getString("amt");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
void searchPerson7()
{
String amt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
amt = rs.getString("amt");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
jtfbloodcharges.setText(amt);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
void searchPerson2()
{
String treatment;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT * FROM treatment3 where pid='" + jtfipd.getText() + "' ";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
treatment = rs.getString("treatment");
jtftreatment.setText(treatment);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
void searchPerson3()
{
String name;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
name = rs.getString("pname");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
jtfname.setText(name);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
void searchPerson4()
{
String roomcharges;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
roomcharges = rs.getString("amount");
jtfroomcharges.setText(roomcharges);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
public void deletePerson(){
ipd= jtfipd.getText();
ipd = ipd.toUpperCase();
if(ipd.equals("")){
JOptionPane.showMessageDialog(null,"Please enter doctor id to delete.");
}
else{
//remove Person of the given name from the Address Book database
int numberOfDeleted =removePerson(ipd);
JOptionPane.showMessageDialog(null, numberOfDeleted + " Record(s)
deleted. from treatment");
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM treatment3 WHERE pid = '" + ipd + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
billno = jtfbillno.getText();
if(billno.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, labtest, medchargess, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO patientbilling2 VALUES (" +
jtfbillno.getText()+ ",'" + jtfdate.getText() + "','" + jtfipd.getText() + "','" + jtfname.getText() + "','"
+ jtftreatment.getText() + "'," + jtfamt.getText() + "," + jtfroomcharges.getText() + "," +
jtfmedcharges.getText() + "," + jtflabtestcharges.getText() + "," + jtfbloodcharges.getText() + "," +
jtfothercharges.getText() + "," + jtftotalcharges.getText() + ")";
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
jtfbillno.setText("");
jtfdate.setText("");
jtfipd.setText("");
jtfname.setText("");
jtftreatment.setText("");
jtfamt.setText("");
jtfroomcharges.setText("");
jtfmedcharges.setText("");
jtflabtestcharges.setText("");
jtfbloodcharges.setText("");
jtfothercharges.setText("");
jtftotalcharges.setText("");
}}
Medicines.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new medicines1();
}
public medicines1()
{
pid="";
drugcode="";
quantity="";
dregno="";
dosage="";
charges="";
createGUI();
}
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
public void actionPerformed (ActionEvent e){
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
}
// Save the Person into the Address Book
public void savePerson(){
pid = jtfpid.getText();
if(pid.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Doctor If.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String amount=jtfcharges.getText();
int amt=Integer.parseInt(amount);
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM medicines1 WHERE pid = '" + pid + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String pid,drugcode,quantity,dregno,dosage,charges;
pid="";
drugcode="";
quantity="";
dregno="";
dosage="";
charges="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT * FROM medicines1 WHERE pid= '"+ jtfpid.getText() +"'";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
pid = rs.getString("pid");
drugcode= rs.getString("drugcode");
quantity = rs.getString("quantity");
dregno = rs.getString("dregno");
dosage = rs.getString("dosage");
charges= rs.getString("charges");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
//return personsList;
jtfpid.setText("");
jtfdrugcode.setText("");
jtfquantity.setText("");
jtfdregno.setText("");
jtfdosage.setText("");
jtfcharges.setText("");
}}
Edittreatment.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new edittreatment();
}
public edittreatment()
{
pid="";
treatment="";
amount="";
date="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void arrangeComponents(){
jlbpid = new JLabel("pid");
jlbtreatment= new JLabel(" treatment");
jlbamount = new JLabel("amount");
jlbdate = new JLabel("date");
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUptreatment.addActionListener(this);
jbnback.addActionListener(this);
}
public void actionPerformed (ActionEvent e){
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
else if (e.getSource() == jbnUptreatment){
deletePerson();
savePerson();
clear();
}
pid = jtfpid.getText();
if(pid.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department
regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone,
email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","",""); }
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String amount=jtfamount.getText();
int amt=Integer.parseInt(amount);
jtfpid.setText(sql);
PreparedStatement ps =
con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM treatment1 WHERE pid = '" + pid + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String pid,treatment, amount,date;
pid="";
treatment="";
amount="";
date="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT * FROM treatment1 WHERE pid= '"+ jtfpid.getText() +"'";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
pid = rs.getString("pid");
treatment= rs.getString("treatment");
amount= rs.getString("amount");
date = rs.getString("date");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
Editroom.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new editroom();
}
public editroom()
{
roomtype="";
roomno="";
charges="";
ipd="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnExit.addActionListener(this);
jbnback.addActionListener(this);
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
}
// Save the Person into the Address Book
public void savePerson(){
roomtype = jtfroomtype.getText();
if(roomtype.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department
regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone,
email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","",""); }
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO room VALUES ('" +
jtfroomtype.getText()+ "','" + jtfroomno.getText() + "','" + jtfcharges.getText() + "','" + jtfipd.getText()
+ "')";
PreparedStatement ps =
con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,
e.toString());
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM room WHERE roomno = '" + roomno +
"'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String roomtype,roomno, charges,ipd;
roomtype="";
roomno="";
charges="";
ipd="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
String sql = "SELECT * FROM room WHERE roomno= '"+ jtfroomno.getText() +"'";
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
roomtype = rs.getString("roomtype");
roomno= rs.getString("roomno");
charges= rs.getString("charges");
ipd = rs.getString("ipd");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
jtfroomtype.setText("");
jtfroomno.setText("");
jtfcharges.setText("");
jtfipd.setText("");
}}
Drugmaster.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
String drugcode,drugtype,drugname,date,quantity,balance,expirydate;
Container cPane;
public static void main(String args[]){
new drugmaster1();
}
public drugmaster1()
{
drugcode="";
drugtype="";
drugname="";
date="";
quantity="";
balance="";
expirydate="";
createGUI();
}
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
drugcode = jtfdrugcode.getText();
if(drugcode.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO drugmaster1 VALUES ('" +
jtfdrugcode.getText()+ "','" + jtfdrugtype.getText() + "','" + jtfdrugname.getText() + "','" +
jtfdate.getText() + "','" + jtfquantity.getText() + "','" + jtfbalance.getText() + "','" +
jtfexpirydate.getText() + "')";
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM drugmaster1 WHERE drug = '" + drugcode + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String drugcode,drugtype,drugname,date,quantity,balance,expirydate;
drugcode="";
drugtype="";
drugname="";
date="";
quantity="";
balance="";
expirydate="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
drugcode = rs.getString("drug");
drugtype= rs.getString("drugtype");
drugname = rs.getString("drugname");
date = rs.getString("date");
quantity = rs.getString("quantity");
balance= rs.getString("balance");
expirydate = rs.getString("expirydate");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
//Add the person object to array list
//personsList.add(person);
jtfdrugcode.setText(drugcode);
jtfdrugtype.setText(drugtype);
jtfdrugname.setText(drugname);
jtfdate.setText(date);
jtfquantity.setText(quantity);
jtfbalance.setText(balance);
jtfexpirydate.setText(expirydate);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}}
Docschedule.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new docschedule1();
}
public docschedule1()
{
dregno="";
day="";
operations="";
inpatients="";
outpatients="";
workinghours="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
//Arrange components on contentPane and set Action Listeners to each JButton
arrangeComponents();
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
dregno = jtfdregno.getText();
if(dregno.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Doctor If.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO docschedule VALUES ('" +
jtfdregno.getText()+ "','" + jtfday.getText() + "','" + jtfoperations.getText() + "','" +
jtfinpatients.getText() + "','" + jtfoutpatients.getText() + "','" + jtfworkinghours.getText() + "')";
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM docschedule WHERE dregno = '" + dregno + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
void searchPerson()
{
String dregno, day,operations,inpatients,outpatients,workinghours;
dregno="";
day="";
operations="";
inpatients="";
outpatients="";
workinghours="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
dregno = rs.getString("dregno");
day= rs.getString("day");
operations = rs.getString("operations");
inpatients = rs.getString("inpatients");
outpatients = rs.getString("outpatients");
workinghours= rs.getString("working");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
//return personsList;
jtfdregno.setText("");
jtfday.setText("");
jtfoperations.setText("");
jtfinpatients.setText("");
jtfoutpatients.setText("");
jtfworkinghours.setText("");
}}
Docmaster.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
JLabel jlbDregno,jlbDoc_name,
jlbDesign,jlbDept,jlbDoc_room,jlbSpec,jlbWork_hour,jlbPhone;
JTextField jtfDregno,jtfDoc_name,
jtfDesign,jtfDept,jtfDoc_room,jtfSpec,jtfWork_hour,jtfPhone;
JButton jbnDelete, jbnUpdate, jbnSearch, jbnback;
String dregno,doc_name,design,dept,doc_room,spec,work_hour,phone;
Container cPane;
public static void main(String args[]){
new docmaster1();
}
public docmaster1()
{
dregno="";
doc_name="";
design="";
dept="";
doc_room="";
spec="";
work_hour="";
phone="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
dregno = jtfDregno.getText();
if(dregno.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO doc_detail1 VALUES ('" +
jtfDregno.getText()+ "','" + jtfDoc_name.getText() + "','" + jtfDesign.getText() + "','" +
jtfDept.getText() + "','" + jtfDoc_room.getText() + "','" + jtfSpec.getText() + "','" +
jtfWork_hour.getText() + "','" + jtfPhone.getText() + "')";
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM doc_detail1 WHERE dregno = '" + dregno +
"'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String dregno,doc_name,design,dept,doc_room,spec,work_hour,phone;
dregno="";
doc_name="";
design="";
dept="";
doc_room="";
spec="";
work_hour="";
phone="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
dregno = rs.getString("dregno");
doc_name= rs.getString("Doc_name");
design = rs.getString("Design");
dept = rs.getString("Dept");
doc_room = rs.getString("doc_room");
spec= rs.getString("Spec");
work_hour = rs.getString("work_hour");
phone = rs.getString("phone");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
//Add the person object to array list
//personsList.add(person);
jtfDregno.setText(dregno);
jtfDoc_name.setText(doc_name);
jtfDesign.setText(design);
jtfDept.setText(dept);
jtfDoc_room.setText(doc_room);
jtfSpec.setText(spec);
jtfWork_hour.setText(work_hour);
jtfPhone.setText(phone);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
Diet1.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new diet1();
}
public diet1()
{
pid="";
cmb="";
hpd="";
pm="";
date="";
Remarks="";
total="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
pid = jtfpid.getText();
if(pid.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(Remarksme, address, phone,
email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
} try
{
String sql = "INSERT INTO diet VALUES ('" +
jtfpid.getText()+ "','" + jtfcmb.getText() + "','" + jtfhpd.getText() + "','" + jtfpm.getText() + "','" +
jtfdate.getText() + "','" + jtfRemarks.getText() + "','" + jtftotal.getText() + "')";
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
}
public int removePerson(String id)
{
int no = 0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM diet WHERE sago = '" + pid + "'";
System.out.println(id);
// Create a Pressared statement
//con=DriverMaRemarksger.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String pid,cmb, hpd,pm,date,Remarks,total;
pid="";
cmb="";
hpd="";
pm="";
date="";
Remarks="";
total="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
pid = rs.getString("sago");
cmb= rs.getString("qcmb");
hpd = rs.getString("hpd");
pm = rs.getString("qpm");
date = rs.getString("date");
Remarks= rs.getString("add");
total = rs.getString("tqty");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dRemarksme,address,fRemarksme,lline,mobile,category,exp,eid,tfrom,tto,rno,ip
dcharge,opdcharge);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
jtfpid.setText("");
jtfcmb.setText("");
jtfhpd.setText("");
jtfpm.setText("");
jtfdate.setText("");
jtfRemarks.setText("");
jtftotal.setText("");
}}
Department1.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
public department1()
{
did="";
dname="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
}
// Save the Person into the Address Book
public void savePerson(){
did = jtfDid.getText();
if(did.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Doctor If.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone, email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO department1 VALUES ('" + jtfDid.getText()+ "','" + jtfDname.getText()
+ "')";
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM department1 WHERE did = '" + did + "'";
System.out.println(did);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String did,dname;
did="";
dname="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
did = rs.getString("did");
dname = rs.getString("dname");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
jtfDname.setText(dname);
}
}
catch(Exception e){
System.out.println("D");
System.out.println(e);
}
//return personsList;
}
public void clear(){
jtfDid.setText("");
jtfDname.setText("");
}}
Bloodbank.java
package patient;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
//import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.sql.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
Container cPane;
public static void main(String args[]){
new bloodbank1();
}
public bloodbank1()
{
bgroup="";
date="";
pid="";
amount="";
createGUI();
cPane = appFrame.getContentPane();
cPane.setLayout(new GridBagLayout());
appFrame.setSize(1200,1200);
appFrame.setResizable(false);
appFrame.setVisible(true);
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jbnDelete.addActionListener(this);
jbnSearch.addActionListener(this);
jbnUpdate.addActionListener(this);
jbnback.addActionListener(this);
}
public void actionPerformed (ActionEvent e){
if (e.getSource() == jbnDelete){
deletePerson();
clear();
}
bgroup = jtfbgroup.getText();
String amount=jtfamount.getText();
int amt=Integer.parseInt(amount);
if(bgroup.equals("")){
JOptionPane.showMessageDialog(null, "Please enter Department
regno.");
}else{
//create a PersonInfo object and pass it to PersonDAO to save it
// PersonInfo person = new PersonInfo(name, address, phone,
email);
// pDAO.savePerson(person);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","",""); }
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try
{
String sql = "INSERT INTO bloodbank4
VALUES ('" + jtfbgroup.getText()+ "','" + jtfdate.getText() + "','" + jtfpid.getText() + "'," + amt +
")";
PreparedStatement ps =
con.prepareStatement(sql);
ps.executeUpdate();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.toString());
}
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try{
String sql = "DELETE FROM bloodbank4 WHERE pid = '" +jtfpid.getText() +
"'";
System.out.println(id);
// Create a Pressared statement
//con=DriverManager.getConnection("jdbc:odbc:ho","","");
} catch(SQLException ex) {
PreparedStatement ps = con.prepareStatement(sql);
ps.executeUpdate();
no=1;
}
catch(Exception e){
System.out.println(e);
}
return no;
}
//Perform a Case-Insensitive Search to find the Person
void searchPerson()
{
String bgroup,date, pid,amount;
bgroup="";
date="";
pid="";
amount="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection("jdbc:odbc:bil","","");
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
try {
ResultSet rs = s.executeQuery(sql);
if(rs.next())
{
bgroup = rs.getString("bgroup");
date= rs.getString("date");
pid= rs.getString("pid");
amount = rs.getString("amount");
//Create a PersonInfo object
//PersonInfo person = new
PersonInfo(pid,did,dname,address,fname,lline,mobile,category,exp,eid,tfrom,tto,rno,ipdcharge,opdc
harge);
//return personsList;
}
public void clear(){
jtfbgroup.setText("");
jtfdate.setText("");
jtfpid.setText("");
jtfamount.setText("");
}}
TESTING
• SOFTWARE TESTING
TESTING: What is it?
Once the source code has been generated, software must be tested to uncover as many errors as possible.
Our goal must be to design a series of test cases that have a high likelihood of finding errors. This is done
through software testing techniques. These techniques provide systematic guidance for designing that-
exercise the internal logic of software components and exercise the input and output domains of the
program to uncover errors in program function, behavior and performance.
Importance of testing:
Reviews and other software quality assurance activities can also uncover errors but they are not sufficient.
Every time the program is executed, the customer tests it. Therefore, you have to execute the program
before it gets to the customer with the specific intent of finding and removing errors. In order to find the
highest possible number of errors, tests must be conducted systematically and test cases must be designed
using disciplined techniques.
A software engineer performs all tests during early stages of testing. As the testing progresses, testing
specialists may also be involved.
Testing: Steps
In both the cases, the intent is to find the maximum number of errors with the minimum amount of effort
and time.
• TESTING METHODOLOGY
A methodology for testing integrates test case design techniques into a well-planned series of steps that
results in the successful construction of the software.
The first step in system testing is to prepare a plan that will test all the aspects of system, in a way that
promotes its credibility among potential users. A workable test plan is prepared in accordance with the
established specification. Procedure for using test data, personnel and training requirements after the test
plan were develops, and all tests can be planned and designed before any code is generated.
Except for small programs, system should not be tested as a single unit. Large systems are built out of
modules that in turn are composed of functions and procedures, the testing process should therefore
proceed in stages where testing is carried out incrementally in conjunction with the system implementation.
The testing process is an iterative one with information being feedback from later stage to earlier parts of
the process.
Therefore testing can be categorized into following forms:
• Unit testing
• Module testing
• System testing
• Alpha/ Beta testing
• White Box/ Black Box testing
UNIT TESTING:
The methodology of unit testing was followed in the manner that each and every piece of code was tested
as soon as it was written. The individual components were tested to ensure that they operate correctly and
independently. Let’s have a closer look at this kind of pattern:
Each component is tested independently without the other system components. It is the first level of testing
and the different modules are tested against the specifications.
Unit testing is essential for verification of the code product during the coding phase; and hence the goal is
to test the internal logic of the module. Unit testing focuses in the verification effort of the smallest unit of
software design module.
MODULE TESTING:
SYSTEM TESTING:
Collections of modules make a sub-system and collection of sub-systems makes the entire system. This
phase involves testing of collection of sub-systems, which have been integrated into the entire system. Aim
is to find out errors, which normally result from unanticipated interaction between sub-systems and
components. It is also concerned with validating that the system meets its functional and non-functional
requirements.
Generally, it begins with low volumes of transactions based on live data. System testing is actually a series
of different tests whose primary purpose is to fully exercise the computer-based system. In system testing,
performance and acceptance standards are developed.
ALPHA/BETA TESTING:
Alpha Testing- in this of testing the system is tested with the user provided data. Customer tests the system
at developer site. Developer “looks over shoulder” and records errors & usage problems. Test is conducted
in a controlled environment.
Beta Testing:
This kind of testing involves delivering the system to a number of potential customers who give their
feedback regarding the software. The system is then modified with respect to the feedback given. Repairing
the system may introduce new bugs or errors in the system, thus testing has to be repeated after the system
has been modified. Beta testing is conducted at one or more customer’s site by the end user. Unlike in alpha
testing, the developer is generally not present.
WHITE BOX & BLACK BOX TESTING:
White Box Testing is concerned with the implementation of the program. The idea is to test
different programming and data structures used in the program. This test mainly focuses on the code rather
than on the specifications. The test cases must be designed in such a way that it is able to locate most of the
errors with minimum amount of time and efforts. White box testing is a design method that uses the control
structure of the procedural design to derive test cases.
Here, in the project few proto were developed and tested thoroughly. All the modules were designed only
using those protos.]
Using the White Box method, we derive the test case that:
• Guarantee that all independent paths within a module have been exercised at once.
• Exercise all logical decisions on the true and false sides.
• Execute all loops at their boundaries and within their operational bounds.
• Exercise internal data structure to ensure their validity.
Black Box testing method focuses on the functional requirements of the software. A set of input
conditions are derived that will fully exercise all functional requirements for a program. It is not an
alternative to white box but is a complementary approach that uncovers a different class of errors than
white box methods.
Black Box method attempts to find out errors relating to incorrect or missing functions, Interface errors,
errors in data structures, performance errors, initialization and termination errors. White box testing is
performed at earlier stages but black box testing is applied at the later stages of testing.
We also began with unit testing procedures. In this we tested individual forms developed to meet different
requirements, to find and remove the errors. Following problems were encountered while making our
project:
• Syntax error caused due to misspelling or missing clause.
• Unrecognized command verb, phrase and keywords.
• Data types mismatched.
• Expected errors.
• Connectivity errors and logic errors.
Finally the project is run to test the connectivity and integrity of different options given in the menu to
choices given by the user. This is to ensure that the system is responding well and giving best results as per
user expectations and requirements.
Snapshots & Test Cases:
Input Screen 1:
Test Case 1:
Input screen 2:
Test Case 2:
Input Screen 3:
Test Case 3:
Input Screen 4:
Test Case 4:
Input Screen 5:
Test Case 5:
Input Screen 6:
Test Case 6:
Input Screen 7:
Test Case 7:
Input Screen 8:
Test Case 8:
Input Screen 9:
Test Case 9:
Input Screen 10:
The PBS is designed to have computerized system management in hospitals. It helps in diagnosing disease,
prescribing the medicines, keeping proper records like registration of a new patient, availability of staff and
much other important functional utilization that demand for the accurate and sufficient records for proper
working. The project will result in improved decision making and also provides the authorities a view for
future requirements.
FUTURE SCOPE:
It refers to the changes which can be made to the project in relation with the future requirements.