Anda di halaman 1dari 150

Project Report On

Hospital Management System

Submitted By: Guided By: 1. Mansi Chitkara. Mrs. Kapila Pareek 2. Namita Khandelwal. Assistant Professor 3. Avinash Chaporkar. IIIM, Jaipur. Team Number: - 09
International School of Informatics & Management
Formerly India International Institute of Management

CERTIFICATE
This is to certify that Hospital Management System embodies the original work done by Mansi Chitkara, Namita Khandelwal, and Avinash Chaporkar during this project submission as a partial fulfillment of the requirement for the System Design Project of Masters of Computer Application IV Semester, of the RajasthanTechnical University, Kota.Swati V. Chande Principal (MCA Department) International School of Informatics and Management Mrs. Kapila Pareek Assistant Professor International School of Informatics and Management

ACKNOWLEDGEMENT
The satisfaction that accompanies that the successful completion of any task would be incomplete without the mention of people whose ceaseless cooperation made it possible, whose constant guidance and encouragement crown all efforts with success. We are grateful to our project guide Mrs. Kapila Pareek for the guidance, inspiration and constructive suggestions that helpful us in the preparation of this project. We also thank our colleagues who have helped in successful completion of the project. Mansi Namita Khandelwal Avinash Chaporkar

CONTENTS
1. Introduction 1.1 Purpose 1.2 Scope 1.3 Technologies used 1.4 Overview 2. Overall Description 2.1 Goals of Proposed System 2.2 Background 2.3 Project Requirements 2.4 User Characteristics 2.5 Constraints 2.6 Definition of Problems 2.7 Alternative Solutions 3. Feasibility Study 3.1 Technical Feasibility 3.2 Economical Feasibility 3.3 Operational Feasibility 3.4 Schedule Feasibility 4. Data Flow Diagrams 5. Entity Relationship Diagram 6. Data Tables 7. Snapshots 8. Conclusion 9. Bibliography

1. Introduction
1.1) Purpose: The Software is for the automation of Hospital Management. It maintains two levels of users:Administrator Level User Level The Software includes:Maintaining Patient details. Providing Prescription, Precautions and Diet advice. Providing and maintaining all kinds of tests for a patient. Billing and Report generation.

1.2) Scope: It can be used in any Hospital, Clinic, Dispensary or Pathology labs for maintaining patient details and their test results.

1.3) Technologies to be used: This project will be a desktop application to be developed in VB 6.0 having Ms Access as backend. Database Design (Ms Access). Form Design (Java Swing). Coding (Java). Testing (Java). Reporting Tool (Data Report).

1.4) Overview
Project is related to Hospital Management System. The project maintains two levels of users:Administrator Level-Doctor User Level-Data Entry Operator Main facilities available in this project are:Maintaining records of indoor/outdoor patients. Maintaining patients diagnosis details, advised tests to be done. Providing different test facilities to a doctor for diagnosis of patients. X-Ray

Urine Test Stool Test Sonography Test Gastroscopy Test Colonoscopy Test Blood Test Biochemistry Test Maintaining patients injection entry records. Maintaining patients prescription, medicine and diet details. Providing billing details for indoor/outdoor patients. Maintaining backup of data as per user requirements (between mentioned dates). If user forgets his/her password then it can be retrieved by hint question. In this project collection of data is from different pathology labs. Results of tests, prescription, precautions and diet advice will be automatically updated in the database. Related test reports, patient details report, prescription and billing reports can be generated as per user requirements. User or Administrator can search a patients record by his/her name or their registration date. Patients diet advice can be provided in Hindi.

2. Overall Description
2.1) Goals of proposed system
1. Planned approach towards working: - The working in the organization will be well planned and organized. The data will be stored properly in data stores, which will help in retrieval of information as well as its storage. 2. Accuracy: - The level of accuracy in the proposed system will be higher. All operation would be done correctly and it ensures that whatever information is coming from the center is accurate. 3. Reliability: - The reliability of the proposed system will be high due to the above stated reasons. The reason for the increased reliability of the system is that now there would be 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.

2.2) Background
A Hospital is a place where Patients come up for general diseases. Hospitals provide facilities like: Consultation by Doctors on Diseases. Diagnosis for diseases. Providing treatment facility. Facility for admitting Patients (providing beds, nursing, medicines etc.) Immunization for Patients/Children. Various operational works that are done in a Hospital are: Recording information about the Patients that come. Generating bills. Recording information related to diagnosis given to Patients. Keeping record of the Immunization provided to children/patients. Keeping information about various diseases and medicines available to cure them. These are the various jobs that need to be done in a Hospital by the operational staff and Doctors. All these works are done on papers. The work is done as follows: Information about Patients is done by just writing the Patients name, age and gender. 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. Immunization records of children are maintained in pre-formatted sheets, which are kept in a file. Information about various diseases is not kept as any document. Doctors themselves do this job by remembering various medicines. 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 cant remember them at that time.

2.3) Project Requirements


2.4) User Characteristics
Every user should be: Comfortable of working with computer. He must have knowledge in medical field. He must also have basic knowledge of English too.

2.5) Constraints
GUI is only in English. Login and password is used for identification of user and there is no facility for guest.

Hardware Requirements
Processor: Pentium II, Pentium III, Pentium IV or higher RAM: 256 Mb or Higher DISK Space: 130 MB or Higher

Software Requirements
Operating System: Win-98, Win-XP, Linux or any other higher version Database: Ms Access 2003,2007 or higher Devoloper Tools: Jdk 1.4, 1.5 or higher

2.6) Definitions of problems


Problems with conventional system 1. Lack of immediate retrievals: -The information is very difficult to retrieve and to find particular information like- E.g. - To find out about the patients history, the user has to go through various registers. This results in inconvenience and wastage of time. 2. Lack of immediate information storage: - The information generated by various transactions takes time and efforts to be stored at right place. 3. Lack of prompt updating: - Various changes to information like patient details or immunization details of child are 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 patients 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.

2.7) Alternative Solutions


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, Immunization Details and a good system for writing bill amount employees and stock availed for the customers can be maintained at central place. Adequate staff may be maintained so that 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 (HMS) 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.

3. Feasibility Study
Depending on the results of the initial investigation the survey is now expanded to a more detailed feasibility study. FEASIBILITY STUDY is a test of system 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 users demonstrable needs and how does a candidate system meet them? 2. What resources are available for given candidate system? 3. What are the likely impacts of the candidate system on the organization? 4. Whether it is worth to solve the problem?

During feasibility analysis for this project, following primary areas of interest are to be considered. Investigation and generating ideas about a new system does this.

Steps in feasibility analysis


Eight steps involved in the feasibility analysis are: Form a project team and appoint a project leader. Prepare system flowcharts. Enumerate potential proposed system. Define and identify characteristics of proposed system. Determine and evaluate performance and cost effective of each proposed system. Weight system performance and cost data. Select the best-proposed system. Prepare and report final project directive to management.

3.1) Technical feasibility


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: Front-end and back-end selection 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. The aspects of our study included the following factors.

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. 10. Front end must support some popular back end like Ms Access. According to the above stated features we selected VB6.0 as the front-end for developing our project. Back-end Selection: 1. Multiple user support. 2. Efficient data handling. 3. Provide inherent features for security. 4. Efficient data retrieval and maintenance. 5. Stored procedures. 6. Popularity. 7. Operating System compatible. 8. Easy to install. 9. Various drivers must be available. 10. Easy to implant with the Front-end. According to above stated features we selected Ms-Access as the backend. 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.

3.2) Economical feasibility


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: The cost to conduct a full system investigation. The cost of hardware and software for the class of application being considered. The benefits in the form of reduced cost. The proposed system will give the minute information, as a result the performance is improved which in turn may be expected to provide increased profits. This feasibility checks whether the system can be developed with the available funds. The Hospital Management System does not require enormous amount of money to be developed. This can be done economically if planned judicially, so it is economically feasible. The cost of project depends upon the number of man hours required.

3.3) Operational Feasibility


It is mainly related to human organizations and political aspects. The points to be considered are: What changes will be brought with the system? What organization structures are disturbed? What new skills will be required? Do the existing staff members have these skills? If not, can they be trained in due course of time? The system is operationally feasible as it very easy for the End users to operate it. It only needs basic information about Windows platform.

3.4) Schedule feasibility


Time evaluation is the most important 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 Hospital Management System can be developed in the considerable amount of time.

4. Data Flow Diagrams


DFD: Level 0 17 DFD: Level 1 18 DFD: Level 2 19 DFD: Level 3

6. Data Tables
1. Admin Login Table:Field Name Name Password 2. Doctors Info Table:Field Name Doc Id Name Address Contact Specialization Workfrom Workto 3. Patient Info Table:Field Name Patientno Name Address Contact Bloodgroup History Dob Current Roomno Dateadd Roomtype Gender Docname Data Type Number Text Text Text Text Text Text Text Text Text Text Text Text Data Type Number Text Text Text Text Text Text Data Type Text Text

7. Snapshots
1. Login Form

2. Home Page

3. Patient Entry Form

4. Patient Info Modification

5.Patient Search Form:-

6. Doctors Search Form:-

7. Billing Form:-

8. Reports Form:-

9. Patient Reports:-

10. Doctors Report:-

Coading
---------------------------------Main.java-----------------------------------import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; public class Main extends JFrame implements ActionListener { Connection con; Statement stm; ResultSet rst; private String username; private String password; private JButton loginBtn; private JButton exitBtn; int dialogtype = JOptionPane.PLAIN_MESSAGE; String dialogmessage; String dialogs; private JLabel nameLbl; private JLabel userLbl; private JLabel passwordLbl; private static JTextField userTxt; private static JPasswordField passwordTxt; public String loginname; public String loginpass; Dimension screen ; Main() { Font f=new Font("Arial",Font.BOLD,15); this.setSize(300,200); this.setLayout(null);

this.setVisible(true); this.setTitle("Hospital Management"); nameLbl = new JLabel("Hospital Managment System"); nameLbl.setBounds(40,10,240,25);nameLbl.setFont(f);nameLbl.setFo reground(Color.red);this.add(nameLbl); userLbl = new JLabel("Username :"); userLbl.setBounds(20,45,100,25);userLbl.setForeground(Color.blue);t his.add(userLbl); userTxt = new JTextField(20); userTxt.setBounds(130,45,110,25);this.add(userTxt); passwordLbl = new JLabel("Password :"); passwordLbl.setBounds(20,80,100,25);passwordLbl.setForeground(C olor.blue);this.add(passwordLbl); passwordTxt = new JPasswordField(20); passwordTxt.setBounds(130,80,110,25);this.add(passwordTxt); loginBtn = new JButton("Login", new ImageIcon("images/key.gif")); loginBtn.setBounds(20,110,120,35);loginBtn.setForeground(Color.blu e);this.add(loginBtn); loginBtn.addActionListener(this); exitBtn = new JButton("Exit", new ImageIcon("images/Keys.gif")); exitBtn.setBounds(150,110,100,35);exitBtn.setForeground(Color.blue) ;this.add(exitBtn); exitBtn.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.exit(0);}});

} public void actionPerformed(ActionEvent event) {

Object source = event.getSource();

if(source.equals(loginBtn)) { String loginname,loginpass; loginname = userTxt.getText().trim(); loginpass = passwordTxt.getText().trim(); try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("Jdbc:Odbc:doc"); stm=con.createStatement(); rst=stm.executeQuery("select * from admin where uname='"+loginname+"' and pass='"+loginpass+"'"); if(rst.next()) { new start(); setVisible(false); this.dispose(); } else{ JOptionPane.showMessageDialog(null,"Invaild User name and password" , "WARNING!!!",JOptionPane.INFORMATION_MESSAGE); userTxt.setText(""); passwordTxt.setText(""); } }catch(Exception e){} } else if(source.equals(exitBtn)) { System.exit(0); } }

public static void main(String[] args) { new Main(); } }

-------------------------start.java--------------------------------

import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; class start extends JFrame implements ActionListener { JButton bpat,bdoc,bbill,breport,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4; //JLabel image=new JLabel(new ImageIcon("images\\background.jpg")); start()

{ super("Hospital Management System"); Font f=new Font("Arial",Font.BOLD,25); Font f1=new Font("Arial",Font.BOLD,15); this.setSize(1024,768); this.setVisible(true); this.setLayout(null); //image.setBounds(0,0,this.getWidth(),this.getHeig ht()); //this.getContentPane().add(image); linfo=new JLabel("SELECT THE APPROPRIATE OPTION"); linfo.setBounds(30,137,500,20); linfo.setForeground(Color.red);linfo.setFont(f); this.add(linfo); linfo1=new JLabel("1. For Inserting, Modifying, Retrieving Patients related Data"); linfo1.setBounds(50,205,335,20); linfo1.setForeground(Color.blue);linfo1.setFont(f1); add(linfo1); linfo2=new JLabel("2. For Inserting, Modifying, Retrieving Doctors related Data"); linfo2.setBounds(50,275,335,20); linfo2.setForeground(Color.blue);linfo2.setFont(f1);

add(linfo2); linfo3=new JLabel("3. Billing Details"); linfo3.setBounds(50,345,150,20); linfo3.setForeground(Color.blue);linfo3.setFont(f1); add(linfo3); linfo4=new JLabel("4. Patient and Doctor related Data"); linfo4.setBounds(50,413,250,20); linfo4.setForeground(Color.blue);linfo4.setFont(f1); add(linfo4); bpat=new JButton("Patient", new ImageIcon("images/Advances.png")); bpat.setBounds(430,200,180,30); bpat.setForeground(Color.blue);bpat.setFont(f1); add(bpat); bdoc=new JButton("Doctor",new ImageIcon("images/Advances.png")); bdoc.setBounds(430,270,180,30); bdoc.setForeground(Color.blue);bdoc.setFont(f1); add(bdoc);

bbill=new JButton("Billing",new ImageIcon("images/Attendance.png")); bbill.setBounds(430,340,180,30); bbill.setForeground(Color.blue);bbill.setFont(f1); add(bbill); breport=new JButton("Reports",new ImageIcon("images/edit.png")); breport.setBounds(430,408,180,30); breport.setForeground(Color.blue);breport.setFont( f1); add(breport); bback=new JButton("BACK" ,new ImageIcon("images/preview_Hover.png")); bback.setBounds(230,515,100,30); bback.setForeground(Color.blue);bback.setFont(f1) ; add(bback); bexit=new JButton("EXIT" ,new ImageIcon("images/exits.png")); bexit.setBounds(730,515,100,30); bexit.setForeground(Color.blue);bexit.setFont(f1); add(bexit);

bpat.addActionListener(new patient()); bdoc.addActionListener(new doctor()); bbill.addActionListener(new billing()); bexit.addActionListener(new exit()); bback.addActionListener(new back()); breport.addActionListener(new report()); } public void actionPerformed(ActionEvent ae) {}

class report implements ActionListener { public void actionPerformed(ActionEvent ae) { new Report(); setVisible(false); } }; class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new Main(); setVisible(false);

} }

class patient implements ActionListener { public void actionPerformed(ActionEvent ae) { new patStart(); setVisible(false); } } class doctor implements ActionListener { public void actionPerformed(ActionEvent ae) { new docStart(); setVisible(false); } } class billing implements ActionListener { public void actionPerformed(ActionEvent ae)

{ new Billing(); setVisible(false); } }

class exit implements ActionListener { public void actionPerformed(ActionEvent ae) { System.exit(0); } } }

--------------------------patStart.java-------------------------import java.awt.*; import java.awt.event.*; import javax.swing.*; class patStart extends JFrame implements ActionListener { JButton badd,bmod,bview,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4; patStart() { super("Patient's Information"); Font f=new Font("Arial",Font.BOLD,25); Font f1=new Font("Arial",Font.BOLD,15); setSize(1024,768); setVisible(true); setLayout(null); linfo=new JLabel("Patient's Information"); linfo.setBounds(400,30,300,20); linfo.setForeground(Color.red);linfo.setFont(f); add(linfo); linfo1=new JLabel("1. Add Patients Information"); linfo1.setBounds(200,150,210,20);

linfo1.setForeground(Color.blue);linfo1.setFont(f1); add(linfo1); badd=new JButton("Add Data",new ImageIcon("images/add.gif")); badd.setBounds(340,180,180,30); badd.setForeground(Color.blue);badd.setFont(f1); add(badd); linfo2=new JLabel("2. Modify Patients Information"); linfo2.setBounds(200,250,210,20); linfo2.setForeground(Color.blue);linfo2.setFont(f1); add(linfo2); bmod=new JButton("Modify Data",new ImageIcon("images/bModify.png")); bmod.setBounds(340,280,180,30); bmod.setForeground(Color.blue);bmod.setFont(f1); add(bmod); linfo3=new JLabel("3. View Patients Information"); linfo3.setBounds(200,350,210,20);

linfo3.setForeground(Color.blue);linfo3.setFont(f1); add(linfo3); bview=new JButton("View Data",new ImageIcon("images/search.png")); bview.setBounds(340,380,180,30); bview.setForeground(Color.blue);bview.setFont(f1) ; add(bview); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(503,545,100,30); bback.setForeground(Color.blue);bback.setFont(f1) ; add(bback);

badd.addActionListener(new add()); bmod.addActionListener(new mod()); bview.addActionListener(new view()); //bexit.addActionListener(new exit()); bback.addActionListener(new back()); }

public void actionPerformed(ActionEvent ae) {} class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new start(); setVisible(false); } }

class add implements ActionListener { public void actionPerformed(ActionEvent ae) { new PatientInfo(); setVisible(false); } } class mod implements ActionListener { public void actionPerformed(ActionEvent ae) { new PatientInfomodify();

setVisible(false); } } class view implements ActionListener { public void actionPerformed(ActionEvent ae) { new PatientInfoView(); setVisible(false); } } /* class exit implements ActionListener { public void actionPerformed(ActionEvent ae) { System.exit(0); } } }

---------------------------docStart.java------------------------import java.awt.*; import java.awt.event.*; import javax.swing.*; class docStart extends JFrame implements ActionListener { JButton badd,bmod,bview,bback,bexit; JLabel linfo,linfo1,linfo2,linfo3,linfo4; docStart() { super("Doctor's Information"); Font f=new Font("Arial",Font.BOLD,25); Font f1=new Font("Arial",Font.BOLD,15); setSize(1024,768); setVisible(true); setResizable(false); setLayout(null); linfo=new JLabel("Doctor's Information"); linfo.setBounds(400,30,300,20); linfo.setForeground(Color.red);linfo.setFont(f); add(linfo); linfo1=new JLabel("1. Add Doctors Information");

linfo1.setBounds(200,150,210,20); linfo1.setForeground(Color.blue);linfo1.setFont(f1); add(linfo1); badd=new JButton("Add Data",new ImageIcon("images/add.gif")); badd.setBounds(350,180,180,30); badd.setForeground(Color.blue);badd.setFont(f1); add(badd); linfo2=new JLabel("2. Modify Doctors Information"); linfo2.setBounds(200,250,210,20); linfo2.setForeground(Color.blue);linfo2.setFont(f1); add(linfo2); bmod=new JButton("Modify Data",new ImageIcon("images/bModify.png")); bmod.setBounds(350,280,180,30); bmod.setForeground(Color.blue);bmod.setFont(f1); add(bmod); linfo3=new JLabel("3. View Doctors Information"); linfo3.setBounds(200,350,210,20);

linfo3.setForeground(Color.blue);linfo3.setFont(f1); add(linfo3); bview=new JButton("View Data",new ImageIcon("images/search.png")); bview.setBounds(350,380,180,30); bview.setForeground(Color.blue);bview.setFont(f1); add(bview); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(503,545,100,30); bback.setForeground(Color.blue);bback.setFont(f1); add(bback);

badd.addActionListener(new add()); bmod.addActionListener(new mod()); bview.addActionListener(new view()); bback.addActionListener(new back()); } public void actionPerformed(ActionEvent ae) {}

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new start(); setVisible(false); } }

class add implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorInfoAdd(); setVisible(false); } } class mod implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorInfomodify(); setVisible(false); } }

class view implements ActionListener { public void actionPerformed(ActionEvent ae) { DoctorInfoView(); setVisible(false); } } class exit implements ActionListener { public void actionPerformed(ActionEvent ae) { System.exit(0); } } }

------------------------------patientInfo.java--------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; import java.io.*; import java.util.*; import java.text.*;

class NameEx extends Exception{} class BlankException extends Exception{} class PatientInfo extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null; JLabel lmain,lpi,lname,ladd,ltel,lmi,lbg,ldob,lhis,lcur,lpno,lroom, ldateadd,lgender,lrtype,ldtip,ldtip2,ldocname; JTextField tfname,tftel,tfdob,tfpno,tfroom,tfdateadd,tfdocname; TextArea taadd,tahis,tacur;

Choice chbg,chrt; CheckboxGroup cbmf; Checkbox cbm,cbf; JButton bsub,bclr,bback; String dialogmessage; String dialogs; int dialogtype = JOptionPane.PLAIN_MESSAGE; clsSettings settings = new clsSettings();

PatientInfo() { super("Add Patient Information"); setSize(1024,768); setVisible(true); setLayout(null); // PERSONAL INFORMATION lmain=new JLabel("Add Patient Information"); lmain.setBounds(440,35,160,15); add(lmain); lpi=new JLabel("Add Personal Information"); lpi.setBounds(40,70,150,15); add(lpi);

lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30); tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :"); ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd); ltel=new JLabel("Contact :"); ltel.setBounds(575,138,50,25); add(ltel); lpno=new JLabel("Patient No.:"); lpno.setBounds(570,97,70,25); add(lpno); tftel=new JTextField(30); tftel.setBounds(640,138,250,20); add(tftel); settings.Numvalidator(tftel);

tfpno=new JTextField(30); tfpno.setBounds(643,97,50,20); add(tfpno);

// END lroom=new JLabel("Room No.:"); lroom.setBounds(720,97,60,20); add(lroom); tfroom=new JTextField(30); tfroom.setBounds(788,97,60,20); add(tfroom);

lmi=new JLabel("Medical Information"); lmi.setBounds(40,268,120,15); add(lmi); lbg=new JLabel("Blood Group :"); lbg.setBounds(104,306,79,15); add(lbg); chbg=new Choice(); chbg.setBounds(270,306,53,15); chbg.addItem("A -ve"); chbg.addItem("A +ve");

chbg.addItem("B -ve"); chbg.addItem("B +ve"); chbg.addItem("AB -ve"); chbg.addItem("AB +ve"); chbg.addItem("O +ve"); chbg.addItem("O -ve"); add(chbg); ldob=new JLabel("Date of Birth :"); ldob.setBounds(575,306,120,15); add(ldob); tfdob=new JTextField(15); tfdob.setBounds(696,305,80,20); add(tfdob); settings.Numvalidator(tfdob); ldtip=new JLabel("(dd-mm-yyyy)"); ldtip.setBounds(782,305,100,20); add(ldtip); lhis=new JLabel("History :"); lhis.setBounds(104,365,50,15); add(lhis); tahis=new TextArea(); tahis.setBounds(270,365,250,100); add(tahis);

//

lcur=new JLabel("Current Problem :"); lcur.setBounds(575,365,100,15); add(lcur); ldocname=new JLabel("Attending Doctor :"); ldocname.setBounds(575,510,130,15); add(ldocname);

tacur=new TextArea(); tacur.setBounds(720,365,250,100); add(tacur); ldateadd=new JLabel("Date Of Admission :"); ldateadd.setBounds(575,180,120,25); add(ldateadd);

//

tfdateadd=new JTextField(40); tfdateadd.setBounds(696,180,80,20); add(tfdateadd); settings.Numvalidator(tfdateadd); tfdocname=new JTextField(100); tfdocname.setBounds(720,510,250,20); add(tfdocname); ldtip2=new JLabel("(dd-mm-yyyy)"); ldtip2.setBounds(782,180,100,20);

add(ldtip2); bsub=new JButton("ADD",new ImageIcon("images/add.gif")); bsub.setBounds(362,643,100,30); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(470,643,100,30); add(bclr); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(580,643,100,30); add(bback); lgender=new JLabel("Gender :"); lgender.setBounds(596,223,50,15); add(lgender);

cbmf=new CheckboxGroup(); cbm=new Checkbox("Male",cbmf,true); cbf=new Checkbox("Female",cbmf,false); cbm.setBounds(698,223,50,15); add(cbm); cbf.setBounds(760,223,60,15);

add(cbf); lrtype=new JLabel("Type Of Room : "); lrtype.setBounds(104,510,120,25); add(lrtype); chrt=new Choice(); chrt.setBounds(270,510,80,15); chrt.addItem("Deluxe"); chrt.addItem("Private"); chrt.addItem("Semi-Private"); chrt.addItem("General"); add(chrt);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:pat" ); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bback.addActionListener(new back()); Calendar cal=Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); System.out.println(df.format(cal.getTime()));

} //End of constructor

public void actionPerformed(ActionEvent ae) {} public static void main(String[] args) { new PatientInfo(); }

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) { tfname.setText(""); tftel.setText(""); tfdob.setText(""); taadd.setText(""); tahis.setText(""); tacur.setText(""); tfpno.setText(""); tfroom.setText(""); tfdateadd.setText(""); } }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new patStart(); setVisible(false); } }

class submit implements ActionListener, ItemListener { public void itemStateChanged(ItemEvent ie) { } public void actionPerformed(ActionEvent ae) { try{ Integer count=0;

Integer num=Integer.parseInt(tfpno.getText()); if(num.equals(null)) { System.out.println("num"); throw new BlankException(); }

String name=tfname.getText(); int a; a=name.charAt(0); if(name.equals("") || a==32) { System.out.println("name=="+name); throw new BlankException(); }

else { for(int i=0; i<name.length(); i++) { boolean check = Character.isLetter(name.charAt(i)); a=name.charAt(i); System.out.print(" "+a); if(!((a>=65 && a<=90) || (a>=97 && a<=122) || (a==32) ||(a==46))) { throw new NameEx(); } } } String addr=taadd.getText(); if(addr.equals(null)) { System.out.println("addr"); throw new BlankException(); } Long contact=Long.parseLong(tftel.getText()); String blgr=chbg.getSelectedItem(); String hist=tahis.getText();

String dob=tfdob.getText(); if(dob.equals(null)) { System.out.println("dob"); throw new BlankException(); } String current=tacur.getText(); if(current.equals(null)) { System.out.println("current"); throw new BlankException(); } String room=tfroom.getText(); String dateadd=tfdateadd.getText(); if(dateadd.equals(null)) { System.out.println("dateadd"); throw new BlankException(); } String docname=tfdocname.getText(); if(docname.equals(null)) { System.out.println("docname"); throw new BlankException();

Calendar cal=Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); //DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); df.setLenient(false); java.util.Date myDate = df.parse(dateadd); System.out.println(dateadd);

String rtype=chrt.getSelectedItem(); String gender=""; if(cbm.getState()==true) { gender="male"; } if(cbf.getState()==true) { gender="female"; }

//Date dateadd=tfdateadd.getString(); /* String query = "SELECT * FROM PAT WHERE num='" + num+ "'"; ResultSet rs = st.executeQuery(query); int foundrec = 0; while (rs.next()) { dialogmessage = "Record Already Exists in DataBase!!!"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); foundrec = 1; } if (foundrec == 0) {*/ Statement st=cn.createStatement();

st.executeUpdate("INSERT INTO PAT VALUES('"+num+"','"+name+"','"+addr+"','"+contact+"',' "+blgr+"','"+hist+"','"+dob+"','"+current+"','"+room+"','"+d ateadd+"','"+rtype+"','"+gender+"','"+docname+"');"); new SuccessDialog();

/* } else { dialogmessage = "Empty Record !!!"; dialogtype = JOptionPane.WARNING_MESSAGE; JOptionPane.showMessageDialog((Component)null, dialogmessage, dialogs, dialogtype); }*/

} catch (ParseException e) { new EDt(); } catch(BlankException be)

{ new ErrorDialog2(); } catch(NumberFormatException nfe) { new ErrorDialog(); } catch(SQLException sq) { System.out.println(sq); } catch(NameEx ne) { new ErrorDialog1(); } catch(Exception e) { System.out.println(e); new EDt(); }

} } }

-------------------------patInfoModify.java---------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; class PatientInfomodify extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null;

JLabel lmain,lpi,lname,ladd,ltel,lmi,lbg,ldob,lhis,lcur,lpno,lnote,l room,ldateadd,lgender,lrtype,ldtip,ldtip2,ldocname; JTextField tfname,tftel,tfdob,tfpno,tfroom,tfdateadd,tfdocname; TextArea taadd,tahis,tacur; JButton bsub,bclr,bback,bmod; Choice chbg,chrt; CheckboxGroup cbmf; Checkbox cbm,cbf; clsSettings settings = new clsSettings(); PatientInfomodify()

{ super("Modify Patient Information"); setSize(1024,768); setVisible(true); setLayout(null); // PERSONAL INFORMATION lmain=new JLabel("Modify Patient Information"); lmain.setBounds(440,35,200,15); add(lmain); lnote=new JLabel("Insert Patient Number"); lnote.setBounds(641,75,127,15); add(lnote); lpi=new JLabel("Personal Information"); lpi.setBounds(40,70,120,15); add(lpi); lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30); tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :");

ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd); ltel=new JLabel("Contact :"); ltel.setBounds(575,138,50,25); add(ltel); lpno=new JLabel("Patient No.:"); lpno.setBounds(570,97,70,25); add(lpno); tftel=new JTextField(30); tftel.setBounds(640,138,250,20); add(tftel); settings.Numvalidator(tftel); tfpno=new JTextField(30); tfpno.setBounds(643,97,50,20); add(tfpno);

// END

lmi=new JLabel("Medical Information");

lmi.setBounds(40,268,120,15); add(lmi); lbg=new JLabel("Blood Group :"); lbg.setBounds(104,306,79,15); add(lbg); /*tfbg=new JTextField(30); tfbg.setBounds(270,306,53,20); add(tfbg);*/ chbg=new Choice(); chbg.setBounds(270,306,53,15); chbg.addItem("A -ve"); chbg.addItem("A +ve"); chbg.addItem("B -ve"); chbg.addItem("B +ve"); chbg.addItem("AB -ve"); chbg.addItem("AB +ve"); chbg.addItem("O +ve"); chbg.addItem("O -ve"); add(chbg); ldob=new JLabel("Date of Birth :"); ldob.setBounds(575,306,135,15); add(ldob); tfdob=new JTextField(15); tfdob.setBounds(720,305,80,20);

//

add(tfdob); settings.Numvalidator(tfdob);

lhis=new JLabel("History :"); lhis.setBounds(104,365,50,15); add(lhis); tahis=new TextArea(); tahis.setBounds(270,365,250,100); add(tahis); lcur=new JLabel("Current Problem :"); lcur.setBounds(575,365,100,15); add(lcur); tacur=new TextArea(); tacur.setBounds(720,365,250,100); add(tacur);

lroom=new JLabel("Room No.:"); lroom.setBounds(720,97,60,20); add(lroom); tfroom=new JTextField(30); tfroom.setBounds(788,97,60,20); add(tfroom);

ldateadd=new JLabel("Date Of Admission :"); ldateadd.setBounds(575,180,120,25); add(ldateadd); tfdateadd=new JTextField(40); tfdateadd.setBounds(696,180,80,20); add(tfdateadd); settings.Numvalidator(tfdateadd);

//

lgender=new JLabel("Gender :"); lgender.setBounds(596,223,50,15); add(lgender);

cbmf=new CheckboxGroup(); cbm=new Checkbox("Male",cbmf,true); cbf=new Checkbox("Female",cbmf,false); cbm.setBounds(698,223,50,15); add(cbm); cbf.setBounds(760,223,60,15); add(cbf); lrtype=new JLabel("Type Of Room : "); lrtype.setBounds(104,510,120,25); add(lrtype);

chrt=new Choice(); chrt.setBounds(270,510,80,15); chrt.addItem("Deluxe"); chrt.addItem("Private"); chrt.addItem("Semi-Private"); chrt.addItem("General"); add(chrt); ldtip=new JLabel("(dd-mm-yyyy)"); ldtip.setBounds(810,305,100,20); add(ldtip); ldocname=new JLabel("Attending Doctor :"); ldocname.setBounds(575,510,130,15); add(ldocname); tfdocname=new JTextField(100); tfdocname.setBounds(720,510,250,20); add(tfdocname); ldtip2=new JLabel("(dd-mm-yyyy)"); ldtip2.setBounds(782,180,100,20); add(ldtip2);

bsub=new JButton("SEARCH",new ImageIcon("images/search.png")); bsub.setBounds(152,643,120,30);

add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(340,643,100,30); add(bclr); bmod=new JButton("MODIFY",new ImageIcon("images/modify.png")); bmod.setBounds(480,643,100,30); add(bmod); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(680,643,90,30); add(bback);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:pat" ); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bmod.addActionListener(new modify()); bback.addActionListener(new back()); } //End of constructor

public void actionPerformed(ActionEvent ae) {} public static void main(String[] args) { new PatientInfomodify(); }

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) {

tfname.setText(""); tftel.setText(""); tfdob.setText(""); taadd.setText(""); tahis.setText(""); tacur.setText(""); tfpno.setText(""); tfroom.setText(""); tfdateadd.setText(""); tfdocname.setText(""); } }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new patStart(); setVisible(false); } }

class modify implements ActionListener { public void actionPerformed(ActionEvent ae) {

try{ Integer num1=Integer.parseInt(tfpno.getText()); if(num1.equals(null)) { throw new BlankException(); }

String name1=tfname.getText(); int a=name1.charAt(0); if(name1.equals("") || a==32) { throw new BlankException(); } for(int i=0; i<name1.length(); i++) { boolean check = Character.isLetter(name1.charAt(i)); a=name1.charAt(i); System.out.print(a); if(!((a>=65 && a<=90) || (a>=97 && a<=122) || (a==32))) { throw new NameEx(); } }

String addr1=taadd.getText(); if(addr1.equals(null)) { throw new BlankException(); }

String contact1=tftel.getText(); String blgr1=chbg.getSelectedItem(); String hist1=tahis.getText(); String dob1=tfdob.getText(); if(dob1.equals(null)) { throw new BlankException(); }

String current1=tacur.getText(); if(current1.equals(null)) { throw new BlankException(); }

String roomno1=tfroom.getText();

String dateadd1=tfdateadd.getText(); if(dateadd1.equals(null)) { throw new BlankException(); } String rtype1=chrt.getSelectedItem(); String gender1=""; String docname=tfdocname.getText();

if(cbm.getState()==true) { gender1="male"; } if(cbf.getState()==true) { gender1="female"; } //Statement st1=cn.createStatement(); String str="UPDATE PAT SET name=?,address=?,contact=?,history=?,bloodgroup=?,

dob=?,current=?,roomno=?,dateadd=?,rtype=?,gender =?,docname=? WHERE patientno=?"; Statement st1= cn.createStatement(); PreparedStatement psmt=cn.prepareStatement(str); psmt.setString(1,name1); psmt.setString(2,addr1); psmt.setString(3,contact1); psmt.setString(4,hist1); psmt.setString(5,blgr1); psmt.setString(6,dob1); psmt.setString(7,current1); psmt.setString(8,roomno1); psmt.setString(9,dateadd1); psmt.setString(10,rtype1); psmt.setString(11,gender1); psmt.setString(12,docname); psmt.setInt(13,num1); psmt.executeUpdate(); new SuccessDialog1();

//st.executeUpdate("UPDATE PAT SET patientno="+num1+",name='"+name1+"',address='"+ad dr1+"',contact='"+contact1+"',history='"+hist1+"',dd='"+d

d1+"',mm='"+mm1+"',yy='"+yy1+"',current='"+current1+ "' WHERE patientno='"+num1+"';"); } catch(BlankException be) { new ErrorDialog2(); } catch(SQLException sq) { System.out.println(sq); } catch(NameEx ne) { new ErrorDialog1(); }

} }

class submit implements ActionListener { public void actionPerformed(ActionEvent ae) { try{

Integer num=Integer.parseInt(tfpno.getText()); String name; String addr; String contact; String blgr; String hist; String dob; String current; String roomno; String dateadd; String rtype; String gender; String docname;

Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM PAT WHERE patientno="+num); if(rs.next()) { num=rs.getInt("patientno"); name=rs.getString("name"); addr=rs.getString("address"); contact=rs.getString("contact"); hist=rs.getString("history"); dob=rs.getString("dob"); current=rs.getString("current"); blgr=rs.getString("bloodgroup");

roomno=rs.getString("roomno"); dateadd=rs.getString("dateadd"); rtype=rs.getString("rtype"); gender=rs.getString("gender"); docname=rs.getString("docname");

tfname.setText(name); tftel.setText(contact); tfdob.setText(dob); taadd.setText(addr); tahis.setText(hist); tacur.setText(current); chbg.select(blgr); tfroom.setText(roomno); tfdateadd.setText(dateadd); tfdocname.setText(docname); chrt.select(rtype); if(gender.equals("male")) { System.out.println(gender); cbm.setState(true); } if(gender.equals("female")) { System.out.println(gender); cbf.setState(true); }

} catch(SQLException sq) { System.out.println(sq); }

} } }

--------------------------patInfoView.java-----------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; class PatientInfoView extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null;

JLabel lmain,lpi,lname,ladd,ltel,lmi,lbg,ldob,lhis,lcur,lpno,lnote,l room,ldateadd,lgender,lrtype,ldtip,ldtip2,ldocname; JTextField tfname,tftel,tfpno,tfbg,tfroom,tfdateadd,tfmf,tfrtype,tfdoc name,tfdob; TextArea taadd,tahis,tacur; //Choice chbg,chrt; //CheckboxGroup cbmf; //Checkbox cbm,cbf; JButton bsub,bclr,bback;

//int x,y; //String str; PatientInfoView() { super("View Patient Information"); setSize(1024,768); setVisible(true); setLayout(null); // PERSONAL INFORMATION lmain=new JLabel("View Patient Information"); lmain.setBounds(440,35,140,15); add(lmain); lnote=new JLabel("Insert Patient Number"); lnote.setBounds(641,75,127,15); add(lnote); lpi=new JLabel("Personal Information"); lpi.setBounds(40,70,120,15); add(lpi); lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30);

tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :"); ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd); ltel=new JLabel("Contact :"); ltel.setBounds(575,138,50,25); add(ltel); lpno=new JLabel("Patient No.:"); lpno.setBounds(570,97,70,25); add(lpno); tftel=new JTextField(30); tftel.setBounds(640,138,250,20); add(tftel); tfpno=new JTextField(30); tfpno.setBounds(643,97,50,20); add(tfpno);

// END

lmi=new JLabel("Medical Information"); lmi.setBounds(40,268,120,15); add(lmi); lbg=new JLabel("Blood Group :"); lbg.setBounds(104,306,79,15); add(lbg); tfbg=new JTextField(30); tfbg.setBounds(270,306,53,20); add(tfbg);

ldob=new JLabel("Date of Birth :"); ldob.setBounds(575,306,135,15); add(ldob); lhis=new JLabel("History :"); lhis.setBounds(104,365,50,15); add(lhis); tahis=new TextArea(); tahis.setBounds(270,365,250,100); add(tahis); lcur=new JLabel("Current Problem :"); lcur.setBounds(575,365,100,15);

add(lcur); tacur=new TextArea(); tacur.setBounds(720,365,250,100); add(tacur); lroom=new JLabel("Room No.:"); lroom.setBounds(720,97,60,20); add(lroom); tfroom=new JTextField(30); tfroom.setBounds(788,97,60,20); add(tfroom); ldateadd=new JLabel("Date Of Admission :"); ldateadd.setBounds(575,180,120,25); add(ldateadd); tfdateadd=new JTextField(40); tfdateadd.setBounds(696,180,80,20); add(tfdateadd);

lgender=new JLabel("Gender :"); lgender.setBounds(575,223,50,15); add(lgender); tfmf=new JTextField(50); tfmf.setBounds(698,223,80,20);

add(tfmf); /*cbmf=new CheckboxGroup(); cbm=new Checkbox("Male",cbmf,true); cbf=new Checkbox("Female",cbmf,false); cbm.setBounds(698,223,50,15); add(cbm); cbf.setBounds(760,223,60,15); add(cbf);*/ lrtype=new JLabel("Type Of Room : "); lrtype.setBounds(104,510,120,25); add(lrtype); tfrtype=new JTextField(); tfrtype.setBounds(270,510,80,20); add(tfrtype); /*chrt=new Choice(); chrt.setBounds(270,510,80,15); chrt.addItem("Deluxe"); chrt.addItem("Private"); chrt.addItem("Semi-Private"); chrt.addItem("General"); add(chrt);*/

bsub=new JButton("SEARCH",new ImageIcon("images/search.png")); bsub.setBounds(300,643,110,30); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(470,643,100,30); add(bclr); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(580,643,100,30); add(bback); ldtip2=new JLabel("(dd-mm-yyyy)"); ldtip2.setBounds(782,180,100,20); add(ldtip2); tfdocname=new JTextField(100); tfdocname.setBounds(720,510,250,20); add(tfdocname); ldocname=new JLabel("Attending Doctor :"); ldocname.setBounds(575,510,130,15); add(ldocname); ldtip=new JLabel("(dd-mm-yyyy)"); ldtip.setBounds(782,305,100,20);

add(ldtip); ldob=new JLabel("Date of Birth :"); ldob.setBounds(575,306,120,15); add(ldob); tfdob=new JTextField(15); tfdob.setBounds(696,305,80,20); add(tfdob);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:pat" ); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bback.addActionListener(new back());

public void actionPerformed(ActionEvent ae) {} public static void main(String[] args) { PatientInfoView piv=new PatientInfoView(); }

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) { tfname.setText(""); tftel.setText(""); tfdob.setText(""); taadd.setText(""); tahis.setText(""); tacur.setText(""); tfpno.setText(""); tfroom.setText(""); tfdateadd.setText("");

tfrtype.setText(""); tfmf.setText(""); tfbg.setText("");

} }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new patStart(); setVisible(false); } }

class submit extends Frame implements ActionListener { Integer num,no=0; String name,addr,contact,blgr,hist,dob,current,room,dateadd,r type,mf,docname;

public void actionPerformed(ActionEvent ae) {

try{

num=Integer.parseInt(tfpno.getText()); Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM PAT WHERE patientno="+num); System.out.println(num); if(rs.next()) { no=rs.getInt("patientno"); name=rs.getString("name"); addr=rs.getString("address"); contact=rs.getString("contact"); hist=rs.getString("history"); dob=rs.getString("dob"); current=rs.getString("current"); blgr=rs.getString("bloodgroup"); room=rs.getString("roomno"); dateadd=rs.getString("dateadd"); rtype=rs.getString("rtype");

mf=rs.getString("gender"); docname=rs.getString("docname");

tfname.setText(name); tftel.setText(contact); tfdob.setText(dob); taadd.setText(addr); tahis.setText(hist); tacur.setText(current); tfbg.setText(blgr); tfroom.setText(room); tfdateadd.setText(dateadd); tfrtype.setText(rtype); tfmf.setText(mf); tfdocname.setText(docname); }

} catch(SQLException sq) { System.out.println(sq); } } } }

------------------------docInfoAdd.java-------------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*;

class DoctorInfoAdd extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null;

JLabel lmain,ldi,lname,ladd,ltel,lspecial,ldid,ldspec,lwork,lworkf rom,lworkto,lfee; JTextField tfname,tftel,tfdid,tfworkf,tfworkt,tffee; TextArea taadd,tacur,taspecial; JButton bsub,bclr,bback; int x,y; String str; clsSettings settings = new clsSettings(); DoctorInfoAdd()

{ super("Doctor Information"); setSize(1024,768); setVisible(true); setLayout(null); lmain=new JLabel("Doctor Information"); lmain.setBounds(440,35,107,15); add(lmain); ldi=new JLabel("Doctor Information"); ldi.setBounds(40,70,120,15); add(ldi); lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30); tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :"); ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd);

ltel=new JLabel("Contact :"); ltel.setBounds(575,138,50,25); add(ltel); ldid=new JLabel("Doctor ID:"); ldid.setBounds(570,97,70,25); add(ldid); tfdid=new JTextField(30); tfdid.setBounds(643,97,50,20); add(tfdid); tftel=new JTextField(30); tftel.setBounds(640,138,200,20); add(tftel); settings.Numvalidator(tftel); ldspec=new JLabel("Specialization :"); ldspec.setBounds(104,310,100,25); add(ldspec); taspecial=new TextArea(); taspecial.setBounds(270,310,250,100); add(taspecial); lwork=new JLabel("Working hours :"); lwork.setBounds(570,310,100,15);

add(lwork); lworkfrom=new JLabel("From :"); lworkfrom.setBounds(670,305,37,25); add(lworkfrom); tfworkf=new JTextField(30); tfworkf.setBounds(710,310,30,20); add(tfworkf); settings.Numvalidator(tfworkf); lworkto=new JLabel("to :"); lworkto.setBounds(747,305,20,25); add(lworkto);

tfworkt=new JTextField(30); tfworkt.setBounds(775,310,30,20); add(tfworkt); settings.Numvalidator(tfworkt);

bsub=new JButton("ADD",new ImageIcon("images/add.gif")); bsub.setBounds(362,643,100,30); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG"));

bclr.setBounds(470,643,100,30); add(bclr); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(580,643,100,30); add(bback);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:doc" ); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bback.addActionListener(new back()); } class clear implements ActionListener {

public void actionPerformed(ActionEvent ae) { tfname.setText(""); tftel.setText(""); tfdid.setText(""); tfworkf.setText(""); tfworkt.setText(""); taadd.setText(""); taspecial.setText(""); } }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new docStart(); setVisible(false); } }

class submit implements ActionListener { public void actionPerformed(ActionEvent ae) {

try{

String num=tfdid.getText(); if(num.equals(null)) { System.out.println("num"); throw new BlankException(); } String name=tfname.getText();

int a; a=name.charAt(0); if(name.equals("") || a==32) { throw new BlankException(); } else { for(int i=0; i<name.length(); i++) { boolean check = Character.isLetter(name.charAt(i)); a=name.charAt(i); System.out.print(" "+a); if(!((a>=65 && a<=90) || (a>=97 && a<=122) || (a==32) ||(a==46)))

{ throw new NameEx(); } } } String addr=taadd.getText(); if(addr.equals(null)) { System.out.println("addr"); throw new BlankException(); }

String contact=tftel.getText();

String spec=taspecial.getText(); String workf=tfworkf.getText(); String workt=tfworkt.getText();

Statement st=cn.createStatement();

st.executeUpdate("INSERT INTO DOC VALUES('"+num+"','"+name+"','"+addr+"','"+contact+"',' "+spec+"','"+workf+"','"+workt+"');"); new SuccessDialog(); } catch(SQLException sq) { String message = "Enter Valid Doctor ID and Contact."; JOptionPane.showMessageDialog(new JFrame(), message, "ERROR!", JOptionPane.ERROR_MESSAGE); System.out.println(sq); } catch(BlankException be) { new ErrorDialog2(); } catch(NumberFormatException nfe) { new ErrorDialog(); } catch(NameEx ne) { new ErrorDialog1(); } catch(Exception e) {

System.out.println(e); new EDt(); }

} }

public void actionPerformed(ActionEvent ae) {}

-----------------------docInfoModify.java----------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; class DoctorInfomodify extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null; JLabel lmain,ldi,lname,ladd,ltel,lspecial,ldid,ldspec,lwork,lworkf rom,lworkto; JTextField tfname,tftel,tfdid,tfworkf,tfworkt; TextArea taadd,taspecial; JButton bsub,bclr,bmod,bback; int x,y; String str; clsSettings settings = new clsSettings(); DoctorInfomodify() { super("Doctor Information");

setSize(1024,768); setVisible(true); setLayout(null); lmain=new JLabel("Doctor Information"); lmain.setBounds(440,35,107,15); add(lmain); ldi=new JLabel("Doctor Information"); ldi.setBounds(40,70,120,15); add(ldi); lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30); tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :"); ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd); ltel=new JLabel("Contact :");

ltel.setBounds(575,138,50,25); add(ltel); ldid=new JLabel("Doctor ID:"); ldid.setBounds(570,97,70,25); add(ldid); tfdid=new JTextField(30); tfdid.setBounds(643,97,50,20); add(tfdid); tftel=new JTextField(30); tftel.setBounds(640,138,200,20); add(tftel); settings.Numvalidator(tftel); ldspec=new JLabel("Specialization :"); ldspec.setBounds(104,310,100,25); add(ldspec); taspecial=new TextArea(); taspecial.setBounds(270,310,250,100); add(taspecial); lwork=new JLabel("Working hours :"); lwork.setBounds(570,310,100,15); add(lwork); lworkfrom=new JLabel("From :");

lworkfrom.setBounds(670,305,37,25); add(lworkfrom); tfworkf=new JTextField(30); tfworkf.setBounds(710,310,30,20); add(tfworkf); settings.Numvalidator(tfworkf); lworkto=new JLabel("to :"); lworkto.setBounds(747,305,20,25); add(lworkto); tfworkt=new JTextField(30); tfworkt.setBounds(775,310,30,20); add(tfworkt); settings.Numvalidator(tfworkt);

bsub=new JButton("SEARCH",new ImageIcon("images/search.png")); bsub.setBounds(250,643,110,30); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(390,643,100,30);

add(bclr); bmod=new JButton("MODIFY",new ImageIcon("images/modify.png")); bmod.setBounds(530,643,100,30); add(bmod); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(700,643,100,30); add(bback);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:doc" ); } catch(Exception e) { System.out.println(e); } bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bmod.addActionListener(new modify());

bback.addActionListener(new back()); } public void actionPerformed(ActionEvent ae) {}

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) { tfname.setText(""); tftel.setText(""); tfdid.setText(""); tfworkf.setText(""); tfworkt.setText(""); taadd.setText(""); taspecial.setText(""); } }

public static void main(String[] args) { new DoctorInfomodify(); System.out.println("Doctors Info Mod"); }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new docStart(); setVisible(false); } }

class submit implements ActionListener {

public void actionPerformed(ActionEvent ae) { try{

Integer num=Integer.parseInt(tfdid.getText()); String name; String addr; String contact; String spec; String workf;

String workt;

Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM DOC WHERE did="+num); if(rs.next()) { num=rs.getInt("did"); name=rs.getString("name"); addr=rs.getString("address"); contact=rs.getString("contact"); spec=rs.getString("specialization"); workf=rs.getString("workfrom"); workt=rs.getString("workto"); tfname.setText(name); taadd.setText(addr); tftel.setText(contact); taspecial.setText(spec); tfworkf.setText(workf); tfworkt.setText(workt);

} } catch(SQLException sq)

{ System.out.println(sq); } } }

class modify implements ActionListener { public void actionPerformed(ActionEvent ae) { try{ Integer num1=Integer.parseInt(tfdid.getText()); if(num1.equals(null)) { System.out.println("num"); throw new BlankException(); }

String name1=tfname.getText(); int a; a=name1.charAt(0); if(name1.equals("") || a==32) {

throw new BlankException(); } else { for(int i=0; i<name1.length(); i++) { boolean check = Character.isLetter(name1.charAt(i)); a=name1.charAt(i); System.out.print(" "+a); if(!((a>=65 && a<=90) || (a>=97 && a<=122) || (a==32) ||(a==46))) { throw new NameEx(); } } }

String addr1=taadd.getText(); if(addr1.equals(null)) { System.out.println("addr"); throw new BlankException(); } String contact1=tftel.getText();

String spec1=taspecial.getText(); String workf1=tfworkf.getText(); String workt1=tfworkt.getText(); //Statement st1=cn.createStatement(); String str="UPDATE DOC SET name=?,address=?,contact=?,specialization=?,workfro m=?,workto=? WHERE did=?"; Statement st1= cn.createStatement(); PreparedStatement psmt=cn.prepareStatement(str); psmt.setString(1,name1); psmt.setString(2,addr1); psmt.setString(3,contact1); psmt.setString(4,spec1); psmt.setString(5,workf1); psmt.setString(6,workt1); psmt.setInt(7,num1); psmt.executeUpdate(); new SuccessDialog2(); }catch(SQLException sq) {

String message = "Enter Valid Doctor ID and Contact."; JOptionPane.showMessageDialog(new JFrame(), message, "ERROR!", JOptionPane.ERROR_MESSAGE); System.out.println(sq); } catch(BlankException be) { new ErrorDialog2(); } catch(NumberFormatException nfe) { new ErrorDialog(); } catch(NameEx ne) { new ErrorDialog1(); } catch(Exception e) { System.out.println(e); new EDt(); } } } }

----------------------docInfoView.java--------------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; class DoctorInfoView extends JFrame implements ActionListener { static Connection cn=null; static Connection cn2=null; Statement st=null; Statement st2=null; ResultSet rs=null; ResultSet rs2=null;

JLabel lmain,ldi,lname,ladd,ltel,lspecial,ldid,ldspec,lwork,lworkf rom,lworkto,lpatlist; JTextField tfname,tftel,tfdid,tfworkf,tfworkt; TextArea taadd,taspecial,tapatlist; JButton bsub,bclr,bback; DoctorInfoView() { super("Doctor Information"); setSize(1024,768);

setVisible(true); setLayout(null); lmain=new JLabel("Doctor Information"); lmain.setBounds(440,35,107,15); add(lmain); ldi=new JLabel("Doctor Information"); ldi.setBounds(40,70,120,15); add(ldi); lname=new JLabel("Name :"); lname.setBounds(104,97,70,25); add(lname); tfname=new JTextField(30); tfname.setBounds(270,97,250,20); add(tfname); ladd=new JLabel("Address :"); ladd.setBounds(104,138,70,15); add(ladd); taadd=new TextArea(); taadd.setBounds(270,138,250,100); add(taadd); ltel=new JLabel("Contact :"); ltel.setBounds(575,138,50,25);

add(ltel); ldid=new JLabel("Doctor ID:"); ldid.setBounds(570,97,70,25); add(ldid); tfdid=new JTextField(30); tfdid.setBounds(643,97,50,20); add(tfdid); tftel=new JTextField(30); tftel.setBounds(640,138,200,20); add(tftel); ldspec=new JLabel("Specialization :"); ldspec.setBounds(104,310,100,25); add(ldspec); taspecial=new TextArea(); taspecial.setBounds(270,310,250,100); add(taspecial); lwork=new JLabel("Working hours :"); lwork.setBounds(570,200,100,15); add(lwork); lworkfrom=new JLabel("From :"); lworkfrom.setBounds(670,200,37,25); add(lworkfrom);

tfworkf=new JTextField(30); tfworkf.setBounds(710,200,30,20); add(tfworkf); lworkto=new JLabel("to :"); lworkto.setBounds(747,200,20,25); add(lworkto); tfworkt=new JTextField(30); tfworkt.setBounds(775,200,30,20); add(tfworkt); lpatlist=new JLabel("Patient List"); lpatlist.setBounds(570,290,80,25); add(lpatlist);

tapatlist=new TextArea(); tapatlist.setBounds(570,310,250,100); add(tapatlist); bsub=new JButton("SEARCH",new ImageIcon("images/search.png")); bsub.setBounds(300,643,110,30); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG"));

bclr.setBounds(470,643,100,30); add(bclr); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(580,643,100,30); add(bback);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:doc" );

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn2=DriverManager.getConnection("Jdbc:Odbc:pat "); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bback.addActionListener(new back()); }

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) { tfname.setText(""); tftel.setText(""); tfdid.setText(""); tfworkf.setText(""); tfworkt.setText(""); taadd.setText(""); taspecial.setText(""); tapatlist.setText(""); } }

class back implements ActionListener { public void actionPerformed(ActionEvent ae)

{ new docStart(); setVisible(false); } }

public void actionPerformed(ActionEvent ae) {} class patinfo implements ActionListener { public void actionPerformed(ActionEvent ae) { } }; class submit implements ActionListener {

public void actionPerformed(ActionEvent ae) { try{ tapatlist.setText(""); Integer num=Integer.parseInt(tfdid.getText());

String name; String addr; String contact; String spec; String workf; String workt;

Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM DOC WHERE did="+num); if(rs.next()) { num=rs.getInt("did"); name=rs.getString("name"); addr=rs.getString("address"); contact=rs.getString("contact"); spec=rs.getString("specialization"); workf=rs.getString("workfrom"); workt=rs.getString("workto");

tfname.setText(name); taadd.setText(addr); tftel.setText(contact); taspecial.setText(spec); tfworkf.setText(workf); tfworkt.setText(workt);

} } catch(SQLException sq) { System.out.println(sq); } try{ String docname=tfname.getText(); System.out.println(docname); Statement st2=cn2.createStatement(); ResultSet rs2=st2.executeQuery("SELECT patientno,name FROM PAT WHERE docname='"+docname+"'"); ResultSetMetaData rsmt=rs2.getMetaData(); int ctr=rsmt.getColumnCount(); while(rs2.next()) { for(int i=1;i<=ctr;i++) { tapatlist.append(rs2.getString(i)+" "); } tapatlist.append("\n"); }

} catch(SQLException sq) { System.out.println(sq); } } } public static void main(String[] args) { new DoctorInfoView(); System.out.println("Doctors Info Add"); } }

---------------------------Billing.java-----------------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.text.*;

class Billing extends JFrame implements ActionListener { static Connection cn=null; Statement st=null; ResultSet rs=null;

JLabel lmain,lpname,lpno,ldad,lddis,lrt,ltamt,temp; JTextField tfname,tfno,tfdateadd,tfrtype,tftamt; JButton bsub,bclr,bback; Font f=new Font("Arial",Font.BOLD,25); Font f1=new Font("Arial",Font.BOLD,15); Billing() { super("Billing Information");

setSize(1024,768); setVisible(true); setLayout(null); lmain=new JLabel("Billing Information"); lmain.setBounds(400,35,300,30); lmain.setForeground(Color.red);lmain.setFont(f); add(lmain); lpname=new JLabel("Patient Name :"); lpname.setBounds(104,97,120,25); lpname.setForeground(Color.blue);lpname.setFont (f1); add(lpname); tfname=new JTextField(30); tfname.setBounds(250,100,225,20); tfname.setForeground(Color.blue);tfname.setFont(f 1); add(tfname); lpno=new JLabel("Patient No. :"); lpno.setBounds(570,97,120,25); lpno.setForeground(Color.blue);lpno.setFont(f1);

add(lpno); tfno=new JTextField(30); tfno.setBounds(694,100,70,20); add(tfno); ldad=new JLabel("Date of Admission :"); ldad.setBounds(104,175,150,25); ldad.setForeground(Color.blue);ldad.setFont(f1); add(ldad); tfdateadd=new JTextField(20); tfdateadd.setBounds(250,178,80,20); add(tfdateadd); lddis=new JLabel("Date of Discharge :"); lddis.setBounds(570,175,150,25); lddis.setForeground(Color.blue);lddis.setFont(f1); add(lddis); lrt=new JLabel("Room Type :"); lrt.setBounds(104,242,120,25); lrt.setForeground(Color.blue);lrt.setFont(f1); add(lrt); tfrtype=new JTextField(20); tfrtype.setBounds(250,242,80,20);

add(tfrtype); ltamt=new JLabel("Total Amount :"); ltamt.setBounds(104,380,120,25); ltamt.setForeground(Color.blue);ltamt.setFont(f1); add(ltamt); tftamt=new JTextField(20); tftamt.setBounds(250,380,120,20); add(tftamt);

bsub=new JButton("SEARCH" ,new ImageIcon("images/setting.png")); bsub.setBounds(300,643,120,30); bsub.setForeground(Color.blue);bsub.setFont(f1); add(bsub); bclr=new JButton("CLEAR",new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(470,643,120,30); bclr.setForeground(Color.blue);bclr.setFont(f1); add(bclr); bback=new JButton("BACK",new ImageIcon("images/restore.png"));

bback.setBounds(600,643,120,30); bback.setForeground(Color.blue);bback.setFont(f1) ; add(bback);

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:pat" ); } catch(Exception e) { System.out.println(e); }

bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bback.addActionListener(new back());

try { Calendar cal=Calendar.getInstance();

SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); df.setLenient(false); //System.out.println(df.format(cal.getTime())); String dd1=df.format(cal.getTime());

temp=new JLabel(dd1); temp.setBounds(710,178,80,20); temp.setForeground(Color.blue);temp.setFont(f1); add(temp);

} catch (Exception e) { new ErrorDialog2(); }

public void actionPerformed(ActionEvent ae) {}

class clear implements ActionListener { public void actionPerformed(ActionEvent ae) { tfname.setText(""); tfno.setText(""); tfdateadd.setText(""); tfrtype.setText(""); tftamt.setText(""); } }

class back implements ActionListener { public void actionPerformed(ActionEvent ae) { new start(); setVisible(false); } }

class submit extends Frame implements ActionListener { public void actionPerformed(ActionEvent ae) { try { int no,num=Integer.parseInt(tfno.getText()); String name,room,dateadd,rtype; Statement st=cn.createStatement(); ResultSet rs=st.executeQuery("SELECT * FROM PAT WHERE patientno="+num); if(rs.next()) { no=rs.getInt("patientno"); name=rs.getString("name"); dateadd=rs.getString("dateadd"); //System.out.println(dateadd); //d=rs.getString("dateadd"); rtype=rs.getString("rtype"); tfname.setText(name); tfdateadd.setText(dateadd); tfrtype.setText(rtype);

} else { JOptionPane.showMessageDialog (this, "Patient Id is not available", "Alert", JOptionPane.PLAIN_MESSAGE); }

try { Calendar cal=Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); df.setLenient(false); int dnow=cal.get(Calendar.DAY_OF_MONTH); int mnow=cal.get(Calendar.MONTH); int ynow=cal.get(Calendar.YEAR); int mnowF=mnow+1; //cal.setTime(df.parse(tfdateadd.getText()));

Calendar cal1=Calendar.getInstance();

cal1.setTime(df.parse(tfdateadd.getText()));

SimpleDateFormat sf2=new SimpleDateFormat("yyyy,MM,dd"); sf2.setLenient(false);

int daddd=cal1.get(Calendar.DAY_OF_MONTH); int daddMM=cal1.get(Calendar.MONTH); int daddYY=cal1.get(Calendar.YEAR); int daddMMF=daddMM+1;

long from = new java.util.GregorianCalendar(ynow,mnowF,dnow).getTi me().getTime(); long to = new java.util.GregorianCalendar(daddYY,daddMMF,daddd). getTime().getTime(); double difference = from-to;

long days = Math.round((difference/(1000*60*60*24))); long bill=0; String rt=tfrtype.getText();

if(rt.equals("Deluxe")) { System.out.println(tfrtype.getText()); int m=2000; System.out.println(m); bill=days*m; System.out.println("total bill = "+bill); } if(rt.equals("Private")) {

int m=800; System.out.println(m); bill=days*m; System.out.println("total bill = "+bill); } if(rt.equals("Semi-Private")) { int m=600; System.out.println(m); bill=days*m; System.out.println("total bill = "+bill); } if(rt.equals("General")) { int m=400; System.out.println(m); bill=days*m; System.out.println("total bill = "+bill); }

//Final Bill String FinalBill=(new Long(bill)).toString(); tftamt.setText(FinalBill);

tftamt.setForeground(Color.blue);tftamt.setFont(f1);

} catch (Exception e) { //new ErrorDialog2(); System.out.println(e); }

} catch (SQLException sq) { System.out.println(sq); }

} } }

--------------------------Report.java--------------------------import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; class Report extends JFrame implements ActionListener { static Connection cn=null; static Connection cn2=null; Statement st=null; Statement st2=null; ResultSet rs=null; ResultSet rs2=null; JButton bpat,bdoc,bback; JLabel lpat,ldoc,title; Font f; Font f1; Report() { super("Reports"); f=new Font("Arial",Font.BOLD,25); f1=new Font("Arial",Font.BOLD,15); setSize(1024,768); setVisible(true); setLayout(null);

title=new JLabel("Report Page"); title.setBounds(420,100,184,30); title.setForeground(Color.red);title.setFont(f); add(title); lpat=new JLabel("For Patients Reports Click Here :"); lpat.setBounds(100,200,400,30); lpat.setForeground(Color.blue);lpat.setFont(f1); add(lpat); ldoc=new JLabel("For Doctors Reports Click Here :"); ldoc.setBounds(100,350,400,30); ldoc.setForeground(Color.blue);ldoc.setFont(f1); add(ldoc); bpat=new JButton("Display Patient's Report",new ImageIcon("images/emp.png")); bpat.setBounds(400,200,250,30); bpat.setForeground(Color.blue);bpat.setFont(f1); add(bpat); bdoc=new JButton("Display Doctor's Report",new ImageIcon("images/users.png")); bdoc.setBounds(400,350,250,30);

bdoc.setForeground(Color.blue);bdoc.setFont(f1); add(bdoc); bback=new JButton("BACK",new ImageIcon("images/restore.png")); bback.setBounds(480,600,100,30); bback.setForeground(Color.blue);bback.setFont(f1) ; add(bback);

bpat.addActionListener(new patreport()); bdoc.addActionListener(new docreport()); bback.addActionListener(this);

} public void actionPerformed(ActionEvent ae) { if (ae.getSource()==bback) { new start(); setVisible(false); }

} class patreport implements ActionListener { public void actionPerformed(ActionEvent ae) { PatientTableFromDatabase frame=new PatientTableFromDatabase(); frame.setDefaultCloseOperation(1); frame.pack(); frame.setVisible(true); } } class docreport implements ActionListener { public void actionPerformed(ActionEvent ae) { new DoctorTableFromDatabase(); DoctorTableFromDatabase frame=new DoctorTableFromDatabase(); frame.setDefaultCloseOperation(1); frame.pack(); frame.setVisible(true); } } }

-----------------doctortablefromdatabase.java-------------import java.awt.*; import java.io.*; import java.sql.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; class DoctorTableFromDatabase extends JFrame { static Connection cn=null; Statement st=null; ResultSet rs=null; DoctorTableFromDatabase() { Vector columnNames = new Vector(); Vector data = new Vector(); try { // Connect to the Database String driver = "sun.jdbc.odbc.JdbcOdbcDriver"; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

cn=DriverManager.getConnection("Jdbc:Odbc:doc" ); } catch(Exception e) { System.out.println(e); }

// Read data from a table String sql = "Select * from DOC"; Statement stmt = cn.createStatement(); ResultSet rs = stmt.executeQuery( sql ); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); // Get column names for (int i = 1; i <= columns; i++) { columnNames.addElement(md.getColumnName(i)) ; }

// Get row data while (rs.next()) { Vector row = new Vector(columns); for (int i = 1; i <= columns; i++) { row.addElement(rs.getObject(i)); } data.addElement( row ); } // rs.close(); //stmt.close(); } catch(Exception e) { System.out.println( e ); } // Create table with database data JTable table = new JTable(data, columnNames);

JScrollPane scrollPane = new JScrollPane(table); getContentPane().add( scrollPane ); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, BorderLayout.SOUTH ); } public static void main(String[] args) { DoctorTableFromDatabase frame = new DoctorTableFromDatabase(); frame.setDefaultCloseOperation( EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }

-----------------patTableFromDatabase.java----------------import java.awt.*; import java.io.*; import java.sql.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; class PatientTableFromDatabase extends JFrame { static Connection cn=null; Statement st=null; ResultSet rs=null; PatientTableFromDatabase() { Vector columnNames = new Vector(); Vector data = new Vector();

try { // Connect to the Database String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("Jdbc:Odbc:pat" ); } catch(Exception e) { System.out.println(e); }

// Read data from a table String sql = "Select * from PAT"; Statement stmt = cn.createStatement(); ResultSet rs = stmt.executeQuery( sql ); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); // Get column names for (int i = 1; i <= columns; i++) { columnNames.addElement(md.getColumnName(i)) ; }

// Get row data while (rs.next()) { Vector row = new Vector(columns); for (int i = 1; i <= columns; i++) { row.addElement(rs.getObject(i)); } data.addElement( row ); } // rs.close(); //stmt.close(); } catch(Exception e) { System.out.println( e ); } // Create table with database data JTable table = new JTable(data, columnNames);

JScrollPane scrollPane = new JScrollPane(table);

getContentPane().add( scrollPane ); JPanel buttonPanel = new JPanel(); getContentPane().add( buttonPanel, BorderLayout.SOUTH ); }

public static void main(String[] args) { PatientTableFromDatabase frame = new PatientTableFromDatabase(); frame.setDefaultCloseOperation( EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }

8. Conclusion
The project Hospital Management System (HMS) is for computerizing the working ina hospital. The software takes care of all the requirements of an average hospital and iscapable to provide easy and effective storage of information related to patients that come up to the hospital.It generates test reports; provide prescription details including various tests, diet advice,and medicines prescribed to patient and doctor. It also provides injection details andbilling facility on the basis of patients status whether it is an indoor or outdoor patient.The system also provides the facility of backup as per the requirement.

9. Bibliography
1. Mastering jdk1.7.0 2. SMS hospital.