Project Report on HMS

download Project Report on HMS

of 150

Transcript of Project Report on HMS

  • 7/31/2019 Project Report on HMS

    1/150

    Project ReportOn

    Hospital Management System

    Submitted By: Guided By:1. Mansi Chitkara. Mrs. Kapila Pareek2. Namita Khandelwal. Assistant Professor

    3. Avinash Chaporkar. IIIM, Jaipur.Team Number: - 09International School of Informatics & ManagementFormerly India International Institute of Management

  • 7/31/2019 Project Report on HMS

    2/150

    CERTIFICATE

    This is to certify that Hospital Management System embodiesthe original work done by Mansi Chitkara, Namita Khandelwal,and Avinash Chaporkar during this project submission as apartial fulfillment of the requirement for the System Design Projectof Masters of Computer Application IV Semester, of theRajasthanTechnical University, Kota.Swati V. Chande Principal(MCA Department) International School of Informatics and

    Management Mrs. Kapila Pareek Assistant Professor InternationalSchool of Informatics and Management

  • 7/31/2019 Project Report on HMS

    3/150

    ACKNOWLEDGEMENT

    The satisfaction that accompanies that the successful completionof any task would be incomplete without the mention of peoplewhose ceaseless cooperation made it possible, whose constantguidance and encouragement crown all efforts with success.We are grateful to our project guide Mrs. Kapila Pareek for theguidance, inspiration and constructive suggestions that helpful usin the preparation of this project. We also thank our colleagueswho have helped in successful completion of the project.

    MansiNamitaKhandelwalAvinash Chaporkar

  • 7/31/2019 Project Report on HMS

    4/150

    CONTENTS1. Introduction1.1 Purpose

    1.2 Scope1.3 Technologies used1.4 Overview2. Overall Description2.1 Goals of Proposed System2.2 Background2.3 Project Requirements2.4 User Characteristics2.5 Constraints2.6 Definition of Problems

    2.7 Alternative Solutions3. Feasibility Study3.1 Technical Feasibility3.2 Economical Feasibility3.3 Operational Feasibility3.4 Schedule Feasibility4. Data Flow Diagrams5. Entity Relationship Diagram6. Data Tables

    7. Snapshots8. Conclusion9. Bibliography

  • 7/31/2019 Project Report on HMS

    5/150

    1. Introduction1.1) Purpose:- The Software is for the automation of Hospital Management.

    It maintains two levels of users:-Administrator LevelUser 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) OverviewProject 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

  • 7/31/2019 Project Report on HMS

    6/150

    Urine TestStool TestSonography TestGastroscopy TestColonoscopy TestBlood TestBiochemistry 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 beautomatically updated in the database.Related test reports, patient details report, prescription and billingreports can be generated as per user requirements.User or Administrator can search a patients record by his/hername or their registration date.Patients diet advice can be provided in Hindi.

    2. Overall Description2.1) Goals of proposed system1. Planned approach towards working: - The working in theorganization will be well planned and organized. The data will be storedproperly in data stores, which will help in retrieval of information as well asits storage.

    2. Accuracy: - The level of accuracy in the proposed system will behigher. 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 tothe above stated reasons. The reason for the increased reliability of thesystem is that now there would be proper storage of information.

    4. No Redundancy: - In the proposed system utmost care would be thatno information is repeated anywhere, in storage or otherwise. This wouldassure economic use of storage space and consistency in the data stored.

  • 7/31/2019 Project Report on HMS

    7/150

    5. Immediate retrieval of information: - The main objective ofproposed system is to provide for a quick and efficient retrieval ofinformation. Any type of information would be available whenever the userrequires.

    6. Immediate storage of information: - In manual system there aremany problems to store the largest amount of information.7. Easy to Operate: - The system should be easy to operate and shouldbe such that it can be developed within a short period of time and fit in thelimited budget of the user.

    2.2) BackgroundA 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 theoperational 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 isstored freshly.

    Bills are generated by recording price for each facility provided toPatient on a separate sheet and at last they all are summed up.

  • 7/31/2019 Project Report on HMS

    8/150

    Diagnosis information to patients is generally recorded on thedocument, which contains Patient information. It is destroyed aftersome time period to decrease the paper load in the office.

    Immunization records of children are maintained in pre-formattedsheets, 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 staffand lot of papers are needed to be handled and taken care of. Doctorshave to remember various medicines available for diagnosis andsometimes miss better alternatives as they cant remember them at thattime.

    2.3) Project Requirements

    2.4) User CharacteristicsEvery 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

  • 7/31/2019 Project Report on HMS

    9/150

    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 toretrieve and to find particular information like- E.g. - To find out about thepatients history, the user has to go through various registers. This resultsin inconvenience and wastage of time.

    2. Lack of immediate information storage: - The informationgenerated by various transactions takes time and efforts to be stored atright place.

    3. Lack of prompt updating: - Various changes to information likepatient details or immunization details of child are difficult to make as paper

    work is involved.4. Error prone manual calculation: - Manual calculations are errorprone and take a lot of time this may result in incorrect information. Forexample calculation of patients bill based on various treatments.

    5. Preparation of accurate and prompt reports: - This becomes adifficult task as information is difficult to collect from various registers.

    2.7) Alternative Solutions1. 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 donemanually. But the question arises how to perform thing manually in a soundmanner. Following are some suggestions, which can be useful in themanual system.

  • 7/31/2019 Project Report on HMS

    10/150

    A more sophisticate register maintenance for various Patient Information,Doctor diary, Immunization Details and a good system for writing billamount employees and stock availed for the customers can be maintainedat central place. Adequate staff may be maintained so that updations aremade at the very moment at the same time. Proper person for proper workshould 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 systemfor maintaining the information regarding purchase details, customers andemployees. A batch system refers to a system in which data is processedin a periodical basis. The batch system is able to achieve most of the goalsand 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 toDoctor and operational staff.In this system everything is stored electronically so very less amount ofpaper work is required and information can be retrieved very easily withoutsearching here and there into registers. This system is been discussedhere.

    3. Feasibility StudyDepending on the results of the initial investigation the survey is nowexpanded to a more detailed feasibility study. FEASIBILITY STUDY is atest of system proposal according to its workability, impact of theorganization, ability to meet needs and effective use of the resources. Itfocuses on these major questions:

    1. What are the users demonstrable needs and how does a candidatesystem 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?

  • 7/31/2019 Project Report on HMS

    11/150

    During feasibility analysis for this project, following primary areas of interestare to be considered. Investigation and generating ideas about a newsystem 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 feasibilityA study of resource availability that may affect the ability to achieve anacceptable system. This evaluation determines whether the technologyneeded 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 willsuccessfully satisfy the user requirement. The technical needs of thesystem may include:

    Front-end and back-end selectionAn important issue for the development of a project is the selection ofsuitable front-end and back-end. When we decided to develop the project

    we went through an extensive study to determine the most suitableplatform that suits the needs of the organization as well as helps indevelopment of the project. The aspects of our study included the followingfactors.

  • 7/31/2019 Project Report on HMS

    12/150

    Front-end selection:1. It must have a graphical user interface that assists employees that arenot 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-endfor 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 thebackend. The technical feasibility is frequently the most difficult areaencountered at this stage. It is essential that the process of analysis anddefinition be conducted in parallel with an assessment to technicalfeasibility. It centers on the existing computer system (hardware, softwareetc.) and to what extent it can support the proposed system.

    3.2) Economical feasibilityEconomic justification is generally the Bottom Line consideration for mostsystems. Economic justification includes a broad range of concerns thatincludes cost benefit analysis. In this we weight the cost and the benefitsassociated with the candidate system and if it suits the basic purpose of theorganization i.e. profit making, the project is making to the analysis and

  • 7/31/2019 Project Report on HMS

    13/150

    design phase. The financial and the economic questions during thepreliminary 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 provideincreased profits.

    This feasibility checks whether the system can be developed with theavailable funds. The Hospital Management System does notrequire enormous amount ofmoney 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 pointsto beconsidered 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 havethese skills? If not, can they be trained in due course of time?The system is operationally feasible as it very easy for the End usersto operate it. It only needs basic information about Windows platform.

    3.4) Schedule feasibility

    Time evaluation is the most important consideration in the development ofproject. The time schedule required for the developed of this project is very

    important since more development time effect machine time, cost andcause delay in the development of other systems.A reliable Hospital Management System can be developed in theconsiderable amount of time.

  • 7/31/2019 Project Report on HMS

    14/150

    4. Data Flow DiagramsDFD: Level 017DFD: Level 1

    18DFD: Level 219DFD: Level 3

  • 7/31/2019 Project Report on HMS

    15/150

    6. Data Tables1. Admin Login Table:-

    Field Name Data Type

    Name TextPassword Text

    2. Doctors Info Table:-

    Field Name Data TypeDoc Id NumberName Text

    Address TextContact TextSpecialization TextWorkfrom TextWorkto Text

    3. Patient Info Table:-

    Field Name Data TypePatientno NumberName TextAddress TextContact TextBloodgroup TextHistory TextDob TextCurrent TextRoomno TextDateadd Text

    Roomtype TextGender TextDocname Text

  • 7/31/2019 Project Report on HMS

    16/150

    7. Snapshots1. Login Form

  • 7/31/2019 Project Report on HMS

    17/150

    2. Home Page

  • 7/31/2019 Project Report on HMS

    18/150

    3. Patient Entry Form

  • 7/31/2019 Project Report on HMS

    19/150

    4. Patient Info Modification

  • 7/31/2019 Project Report on HMS

    20/150

    5.Patient Search Form:-

  • 7/31/2019 Project Report on HMS

    21/150

    6. Doctors Search Form:-

  • 7/31/2019 Project Report on HMS

    22/150

    7. Billing Form:-

  • 7/31/2019 Project Report on HMS

    23/150

    8. Reports Form:-

  • 7/31/2019 Project Report on HMS

    24/150

    9. Patient Reports:-

  • 7/31/2019 Project Report on HMS

    25/150

    10. Doctors Report:-

  • 7/31/2019 Project Report on HMS

    26/150

    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);

  • 7/31/2019 Project Report on HMS

    27/150

    this.setVisible(true);this.setTitle("Hospital Management");

    nameLbl = new JLabel("Hospital Managment System");

    nameLbl.setBounds(40,10,240,25);nameLbl.setFont(f);nameLbl.setForeground(Color.red);this.add(nameLbl);

    userLbl = new JLabel("Username :");

    userLbl.setBounds(20,45,100,25);userLbl.setForeground(Color.blue);this.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(Color.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.blue);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 voidactionPerformed(ActionEvent e){System.exit(0);}});

    }

    public void actionPerformed(ActionEvent event){

    Object source = event.getSource();

  • 7/31/2019 Project Report on HMS

    28/150

    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 andpassword" ,"WARNING!!!",JOptionPane.INFORMATION_MESSAGE);

    userTxt.setText("");passwordTxt.setText("");

    }}catch(Exception e){}

    }else if(source.equals(exitBtn)){

    System.exit(0);}

    }

  • 7/31/2019 Project Report on HMS

    29/150

    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()

  • 7/31/2019 Project Report on HMS

    30/150

    {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.getHeight());

    //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);

  • 7/31/2019 Project Report on HMS

    31/150

    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 Doctorrelated Data");

    linfo4.setBounds(50,413,250,20);

    linfo4.setForeground(Color.blue);linfo4.setFont(f1);add(linfo4);

    bpat=new JButton("Patient", newImageIcon("images/Advances.png"));

    bpat.setBounds(430,200,180,30);

    bpat.setForeground(Color.blue);bpat.setFont(f1);add(bpat);

    bdoc=new JButton("Doctor",newImageIcon("images/Advances.png"));

    bdoc.setBounds(430,270,180,30);

    bdoc.setForeground(Color.blue);bdoc.setFont(f1);add(bdoc);

  • 7/31/2019 Project Report on HMS

    32/150

    bbill=new JButton("Billing",newImageIcon("images/Attendance.png"));

    bbill.setBounds(430,340,180,30);

    bbill.setForeground(Color.blue);bbill.setFont(f1);add(bbill);

    breport=new JButton("Reports",newImageIcon("images/edit.png"));

    breport.setBounds(430,408,180,30);

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

    add(breport);

    bback=new JButton("BACK" ,newImageIcon("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);

  • 7/31/2019 Project Report on HMS

    33/150

    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);

  • 7/31/2019 Project Report on HMS

    34/150

    }}

    class patient implements ActionListener{

    public void actionPerformed(ActionEventae)

    {

    new patStart();setVisible(false);

    }}

    class doctor implements ActionListener{

    public void actionPerformed(ActionEventae)

    {new docStart();setVisible(false);

    }}

    class billing implements ActionListener{

    public void actionPerformed(ActionEventae)

  • 7/31/2019 Project Report on HMS

    35/150

    {new Billing();setVisible(false);

    }}

    class exit implements ActionListener{

    public void actionPerformed(ActionEvent

    ae){

    System.exit(0);}

    }

    }

  • 7/31/2019 Project Report on HMS

    36/150

    --------------------------patStart.java--------------------------

    import java.awt.*;

    import java.awt.event.*;import javax.swing.*;

    class patStart extends JFrame implementsActionListener{

    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 PatientsInformation");

    linfo1.setBounds(200,150,210,20);

  • 7/31/2019 Project Report on HMS

    37/150

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

    add(linfo1);

    badd=new JButton("Add Data",newImageIcon("images/add.gif"));

    badd.setBounds(340,180,180,30);

    badd.setForeground(Color.blue);badd.setFont(f1);add(badd);

    linfo2=new JLabel("2. Modify PatientsInformation");

    linfo2.setBounds(200,250,210,20);

    linfo2.setForeground(Color.blue);linfo2.setFont(f1);add(linfo2);

    bmod=new JButton("Modify Data",newImageIcon("images/bModify.png"));

    bmod.setBounds(340,280,180,30);

    bmod.setForeground(Color.blue);bmod.setFont(f1);add(bmod);

    linfo3=new JLabel("3. View PatientsInformation");

    linfo3.setBounds(200,350,210,20);

  • 7/31/2019 Project Report on HMS

    38/150

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

    add(linfo3);

    bview=new JButton("View Data",newImageIcon("images/search.png"));

    bview.setBounds(340,380,180,30);

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

    add(bview);

    bback=new JButton("BACK",newImageIcon("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());

    }

  • 7/31/2019 Project Report on HMS

    39/150

    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();

  • 7/31/2019 Project Report on HMS

    40/150

    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);

    }}

    }

  • 7/31/2019 Project Report on HMS

    41/150

    ---------------------------docStart.java-------------------------

    import java.awt.*;

    import java.awt.event.*;import javax.swing.*;

    class docStart extends JFrame implementsActionListener{

    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 DoctorsInformation");

  • 7/31/2019 Project Report on HMS

    42/150

    linfo1.setBounds(200,150,210,20);

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

    add(linfo1);

    badd=new JButton("Add Data",newImageIcon("images/add.gif"));

    badd.setBounds(350,180,180,30);

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

    add(badd);

    linfo2=new JLabel("2. Modify DoctorsInformation");

    linfo2.setBounds(200,250,210,20);

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

    add(linfo2);

    bmod=new JButton("Modify Data",newImageIcon("images/bModify.png"));

    bmod.setBounds(350,280,180,30);

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

    add(bmod);

    linfo3=new JLabel("3. View DoctorsInformation");

    linfo3.setBounds(200,350,210,20);

  • 7/31/2019 Project Report on HMS

    43/150

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

    add(linfo3);

    bview=new JButton("View Data",newImageIcon("images/search.png"));

    bview.setBounds(350,380,180,30);bview.setForeground(Color.blue);bview.setFont(f1);

    add(bview);

    bback=new JButton("BACK",newImageIcon("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){}

  • 7/31/2019 Project Report on HMS

    44/150

    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);

    }}

  • 7/31/2019 Project Report on HMS

    45/150

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

    {DoctorInfoView();setVisible(false);

    }}

    class exit implements ActionListener

    {public void actionPerformed(ActionEvent ae)

    {System.exit(0);

    }}

    }

  • 7/31/2019 Project Report on HMS

    46/150

    ------------------------------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 implementsActionListener

    {

    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;

    JTextFieldtfname,tftel,tfdob,tfpno,tfroom,tfdateadd,tfdocname;

    TextArea taadd,tahis,tacur;

  • 7/31/2019 Project Report on HMS

    47/150

    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);

  • 7/31/2019 Project Report on HMS

    48/150

    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);

  • 7/31/2019 Project Report on HMS

    49/150

    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");

  • 7/31/2019 Project Report on HMS

    50/150

    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);

  • 7/31/2019 Project Report on HMS

    51/150

    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);

  • 7/31/2019 Project Report on HMS

    52/150

    add(ldtip2);

    bsub=new JButton("ADD",new

    ImageIcon("images/add.gif"));bsub.setBounds(362,643,100,30);add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

    bclr.setBounds(470,643,100,30);

    add(bclr);

    bback=new JButton("BACK",newImageIcon("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);

  • 7/31/2019 Project Report on HMS

    53/150

    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);}

  • 7/31/2019 Project Report on HMS

    54/150

    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();

    }

  • 7/31/2019 Project Report on HMS

    55/150

    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);

    }}

  • 7/31/2019 Project Report on HMS

    56/150

    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();

    }

  • 7/31/2019 Project Report on HMS

    57/150

    else{

    for(int i=0; i=65 && a=97

    && a

  • 7/31/2019 Project Report on HMS

    58/150

    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();

  • 7/31/2019 Project Report on HMS

    59/150

    }

    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";

    }

  • 7/31/2019 Project Report on HMS

    60/150

    //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 Existsin DataBase!!!";

    dialogtype =JOptionPane.WARNING_MESSAGE;

    JOptionPane.showMessageDialog((Component)null,dialogmessage, dialogs, dialogtype);

    foundrec = 1;

    }if (foundrec == 0)

    {*/

    Statement st=cn.createStatement();

  • 7/31/2019 Project Report on HMS

    61/150

    st.executeUpdate("INSERT INTO PATVALUES('"+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)

  • 7/31/2019 Project Report on HMS

    62/150

    {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();

    }

    }}

    }

  • 7/31/2019 Project Report on HMS

    63/150

    -------------------------patInfoModify.java----------------------

    import java.awt.*;

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

    class PatientInfomodify extends JFrame implementsActionListener{

    static Connection cn=null;Statement st=null;ResultSet rs=null;

    JLabellmain,lpi,lname,ladd,ltel,lmi,lbg,ldob,lhis,lcur,lpno,lnote,l

    room,ldateadd,lgender,lrtype,ldtip,ldtip2,ldocname;JTextFieldtfname,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()

  • 7/31/2019 Project Report on HMS

    64/150

    {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 :");

  • 7/31/2019 Project Report on HMS

    65/150

    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");

  • 7/31/2019 Project Report on HMS

    66/150

    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);

  • 7/31/2019 Project Report on HMS

    67/150

    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);

  • 7/31/2019 Project Report on HMS

    68/150

    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);

  • 7/31/2019 Project Report on HMS

    69/150

    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",newImageIcon("images/search.png"));

    bsub.setBounds(152,643,120,30);

  • 7/31/2019 Project Report on HMS

    70/150

    add(bsub);

    bclr=new JButton("CLEAR",new

    ImageIcon("images/LOGGOFF.PNG"));bclr.setBounds(340,643,100,30);add(bclr);

    bmod=new JButton("MODIFY",newImageIcon("images/modify.png"));

    bmod.setBounds(480,643,100,30);

    add(bmod);

    bback=new JButton("BACK",newImageIcon("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);}

  • 7/31/2019 Project Report on HMS

    71/150

    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){

  • 7/31/2019 Project Report on HMS

    72/150

    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){

  • 7/31/2019 Project Report on HMS

    73/150

    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=65 && a=97

    && a

  • 7/31/2019 Project Report on HMS

    74/150

    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();

  • 7/31/2019 Project Report on HMS

    75/150

    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 SETname=?,address=?,contact=?,history=?,bloodgroup=?,

  • 7/31/2019 Project Report on HMS

    76/150

    dob=?,current=?,roomno=?,dateadd=?,rtype=?,gender=?,docname=? WHERE patientno=?";

    Statement st1= cn.createStatement();

    PreparedStatementpsmt=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 SETpatientno="+num1+",name='"+name1+"',address='"+addr1+"',contact='"+contact1+"',history='"+hist1+"',dd='"+d

  • 7/31/2019 Project Report on HMS

    77/150

    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{

  • 7/31/2019 Project Report on HMS

    78/150

    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");

  • 7/31/2019 Project Report on HMS

    79/150

    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);

    }

  • 7/31/2019 Project Report on HMS

    80/150

    }

    }catch(SQLException sq){

    System.out.println(sq);}

    }}

    }

  • 7/31/2019 Project Report on HMS

    81/150

    --------------------------patInfoView.java------------------------

    import java.awt.*;

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

    class PatientInfoView extends JFrame implementsActionListener{

    static Connection cn=null;Statement st=null;ResultSet rs=null;

    JLabellmain,lpi,lname,ladd,ltel,lmi,lbg,ldob,lhis,lcur,lpno,lnote,lroom,ldateadd,lgender,lrtype,ldtip,ldtip2,ldocname;JTextFieldtfname,tftel,tfpno,tfbg,tfroom,tfdateadd,tfmf,tfrtype,tfdocname,tfdob;TextArea taadd,tahis,tacur;

    //Choice chbg,chrt;//CheckboxGroup cbmf;//Checkbox cbm,cbf;JButton bsub,bclr,bback;

  • 7/31/2019 Project Report on HMS

    82/150

    //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);

  • 7/31/2019 Project Report on HMS

    83/150

    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

  • 7/31/2019 Project Report on HMS

    84/150

    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);

  • 7/31/2019 Project Report on HMS

    85/150

    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);

  • 7/31/2019 Project Report on HMS

    86/150

    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);*/

  • 7/31/2019 Project Report on HMS

    87/150

    bsub=new JButton("SEARCH",newImageIcon("images/search.png"));

    bsub.setBounds(300,643,110,30);

    add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

    bclr.setBounds(470,643,100,30);add(bclr);

    bback=new JButton("BACK",newImageIcon("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);

  • 7/31/2019 Project Report on HMS

    88/150

    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());

  • 7/31/2019 Project Report on HMS

    89/150

    }

    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("");

  • 7/31/2019 Project Report on HMS

    90/150

    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,rtype,mf,docname;

  • 7/31/2019 Project Report on HMS

    91/150

    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");

  • 7/31/2019 Project Report on HMS

    92/150

    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);

    }}

    }

    }

  • 7/31/2019 Project Report on HMS

    93/150

    ------------------------docInfoAdd.java--------------------------

    import java.awt.*;

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

    class DoctorInfoAdd extends JFrame implementsActionListener

    {static Connection cn=null;Statement st=null;ResultSet rs=null;

    JLabellmain,ldi,lname,ladd,ltel,lspecial,ldid,ldspec,lwork,lworkfrom,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()

  • 7/31/2019 Project Report on HMS

    94/150

    {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);

  • 7/31/2019 Project Report on HMS

    95/150

    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);

  • 7/31/2019 Project Report on HMS

    96/150

    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",newImageIcon("images/add.gif"));

    bsub.setBounds(362,643,100,30);add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

  • 7/31/2019 Project Report on HMS

    97/150

    bclr.setBounds(470,643,100,30);add(bclr);

    bback=new JButton("BACK",newImageIcon("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{

  • 7/31/2019 Project Report on HMS

    98/150

    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){

  • 7/31/2019 Project Report on HMS

    99/150

    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=65 && a=97

    && a

  • 7/31/2019 Project Report on HMS

    100/150

    {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();

  • 7/31/2019 Project Report on HMS

    101/150

    st.executeUpdate("INSERT INTO DOCVALUES('"+num+"','"+name+"','"+addr+"','"+contact+"','"+spec+"','"+workf+"','"+workt+"');");

    new SuccessDialog();}catch(SQLException sq){

    String message = "Enter Valid Doctor IDand Contact.";

    JOptionPane.showMessageDialog(newJFrame(), 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){

  • 7/31/2019 Project Report on HMS

    102/150

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

    }

    }

    }

    public void actionPerformed(ActionEvent ae){}

    }

  • 7/31/2019 Project Report on HMS

    103/150

    -----------------------docInfoModify.java-----------------------

    import java.awt.*;

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

    class DoctorInfomodify extends JFrame implementsActionListener{

    static Connection cn=null;Statement st=null;ResultSet rs=null;

    JLabellmain,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");

  • 7/31/2019 Project Report on HMS

    104/150

    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 :");

  • 7/31/2019 Project Report on HMS

    105/150

    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 :");

  • 7/31/2019 Project Report on HMS

    106/150

    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",newImageIcon("images/search.png"));

    bsub.setBounds(250,643,110,30);

    add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

    bclr.setBounds(390,643,100,30);

  • 7/31/2019 Project Report on HMS

    107/150

    add(bclr);

    bmod=new JButton("MODIFY",new

    ImageIcon("images/modify.png"));bmod.setBounds(530,643,100,30);add(bmod);

    bback=new JButton("BACK",newImageIcon("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());

  • 7/31/2019 Project Report on HMS

    108/150

    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");

    }

  • 7/31/2019 Project Report on HMS

    109/150

    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;

  • 7/31/2019 Project Report on HMS

    110/150

    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)

  • 7/31/2019 Project Report on HMS

    111/150

    {System.out.println(sq);

    }

    }

    }

    class modify implements ActionListener

    {public void actionPerformed(ActionEvent ae){

    try{

    Integernum1=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)

    {

  • 7/31/2019 Project Report on HMS

    112/150

    throw new BlankException();}

    else

    {for(int i=0; i=65 && a=97&& a

  • 7/31/2019 Project Report on HMS

    113/150

    String spec1=taspecial.getText();String workf1=tfworkf.getText();

    String workt1=tfworkt.getText();

    //Statement st1=cn.createStatement();

    String str="UPDATE DOC SETname=?,address=?,contact=?,specialization=?,workfrom=?,workto=? WHERE did=?";

    Statement st1= cn.createStatement();

    PreparedStatementpsmt=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){

  • 7/31/2019 Project Report on HMS

    114/150

    String message = "Enter Valid Doctor IDand 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();

    }

    }}}

  • 7/31/2019 Project Report on HMS

    115/150

    ----------------------docInfoView.java---------------------------import java.awt.*;import java.awt.event.*;

    import java.sql.*;import javax.swing.*;

    class DoctorInfoView extends JFrame implementsActionListener{

    static Connection cn=null;static Connection cn2=null;Statement st=null;Statement st2=null;ResultSet rs=null;ResultSet rs2=null;

    JLabellmain,ldi,lname,ladd,ltel,lspecial,ldid,ldspec,lwork,lworkfrom,lworkto,lpatlist;

    JTextField tfname,tftel,tfdid,tfworkf,tfworkt;TextArea taadd,taspecial,tapatlist;JButton bsub,bclr,bback;

    DoctorInfoView(){super("Doctor Information");setSize(1024,768);

  • 7/31/2019 Project Report on HMS

    116/150

    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);

  • 7/31/2019 Project Report on HMS

    117/150

    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);

  • 7/31/2019 Project Report on HMS

    118/150

    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",newImageIcon("images/search.png"));

    bsub.setBounds(300,643,110,30);add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

  • 7/31/2019 Project Report on HMS

    119/150

    bclr.setBounds(470,643,100,30);add(bclr);

    bback=new JButton("BACK",newImageIcon("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);}

  • 7/31/2019 Project Report on HMS

    120/150

    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)

  • 7/31/2019 Project Report on HMS

    121/150

    {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());

  • 7/31/2019 Project Report on HMS

    122/150

    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);

  • 7/31/2019 Project Report on HMS

    123/150

    }

    }catch(SQLException sq){

    System.out.println(sq);}

    try{

    String docname=tfname.getText();System.out.println(docname);Statement st2=cn2.createStatement();

    ResultSet rs2=st2.executeQuery("SELECTpatientno,name FROM PAT WHEREdocname='"+docname+"'");

    ResultSetMetaDatarsmt=rs2.getMetaData();

    int ctr=rsmt.getColumnCount();while(rs2.next()){

    for(int i=1;i

  • 7/31/2019 Project Report on HMS

    124/150

    }catch(SQLException sq){

    System.out.println(sq);}

    }

    }

    public static void main(String[] args){

    new DoctorInfoView();System.out.println("Doctors Info Add");

    }}

  • 7/31/2019 Project Report on HMS

    125/150

    ---------------------------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 implementsActionListener{

    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");

  • 7/31/2019 Project Report on HMS

    126/150

    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(f1);

    add(tfname);

    lpno=new JLabel("Patient No. :");lpno.setBounds(570,97,120,25);

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

  • 7/31/2019 Project Report on HMS

    127/150

    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);

  • 7/31/2019 Project Report on HMS

    128/150

    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" ,newImageIcon("images/setting.png"));

    bsub.setBounds(300,643,120,30);

    bsub.setForeground(Color.blue);bsub.setFont(f1);add(bsub);

    bclr=new JButton("CLEAR",newImageIcon("images/LOGGOFF.PNG"));

    bclr.setBounds(470,643,120,30);

    bclr.setForeground(Color.blue);bclr.setFont(f1);add(bclr);

    bback=new JButton("BACK",newImageIcon("images/restore.png"));

  • 7/31/2019 Project Report on HMS

    129/150

    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();

  • 7/31/2019 Project Report on HMS

    130/150

    SimpleDateFormat df = newSimpleDateFormat("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();}

    }

  • 7/31/2019 Project Report on HMS

    131/150

    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);}

    }

  • 7/31/2019 Project Report on HMS

    132/150

    class submit extends Frame implements ActionListener{

    public void actionPerformed(ActionEvent ae)

    {try{

    intno,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);

  • 7/31/2019 Project Report on HMS

    133/150

    }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);

    intdnow=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()));

    Calendarcal1=Calendar.getInstance();

  • 7/31/2019 Project Report on HMS

    134/150

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

    SimpleDateFormat sf2=newSimpleDateFormat("yyyy,MM,dd");

    sf2.setLenient(false);

    intdaddd=cal1.get(Calendar.DAY_OF_MONTH);

    intdaddMM=cal1.get(Calendar.MONTH);

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

  • 7/31/2019 Project Report on HMS

    135/150

    long from = newjava.util.GregorianCalendar(ynow,mnowF,dnow).getTime().getTime();

    long to = newjava.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")){

  • 7/31/2019 Project Report on HMS

    136/150

    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 BillString FinalBill=(new

    Long(bill)).toString();tftamt.setText(FinalBill);

  • 7/31/2019 Project Report on HMS

    137/150

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

    }

    catch (Exception e){

    //new ErrorDialog2();

    System.out.println(e);}

    }catch (SQLException sq)

    {System.out.println(sq);

    }

    }

    }}

  • 7/31/2019 Project Report on HMS

    138/150

  • 7/31/2019 Project Report on HMS

    139/150

    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 ClickHere :");

    ldoc.setBounds(100,350,400,30);

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

    add(ldoc);

    bpat=new JButton("Display Patient'sReport",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'sReport",new ImageIcon("images/users.png"));

    bdoc.setBounds(400,350,250,30);

  • 7/31/2019 Project Report on HMS

    140/150

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

    add(bdoc);

    bback=new JButton("BACK",newImageIcon("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);

    }

  • 7/31/2019 Project Report on HMS

    141/150

    }

    class patreport implements ActionListener

    {public void actionPerformed(ActionEvent ae){

    PatientTableFromDatabase frame=newPatientTableFromDatabase();

    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);}

    }}

  • 7/31/2019 Project Report on HMS

    142/150

    -----------------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");

  • 7/31/2019 Project Report on HMS

    143/150

    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

  • 7/31/2019 Project Report on HMS

    144/150

    // Get row data

    while (rs.next()){

    Vector row = new Vector(columns);

    for (int i = 1; i

  • 7/31/2019 Project Report on HMS

    145/150

    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 = newDoctorTableFromDatabase();

    frame.setDefaultCloseOperation( EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);

    }

    }

  • 7/31/2019 Project Report on HMS

    146/150

    -----------------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{

  • 7/31/2019 Project Report on HMS

    147/150

    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

  • 7/31/2019 Project Report on HMS

    148/150

    // Get row data

    while (rs.next())

    {Vector row = new Vector(columns);

    for (int i = 1; i

  • 7/31/2019 Project Report on HMS

    149/150

    getContentPane().add( scrollPane );

    JPanel buttonPanel = new JPanel();

    getContentPane().add( buttonPanel,BorderLayout.SOUTH );

    }

    public static void main(String[] args){

    PatientTableFromDatabase frame = newPatientTableFromDatabase();

    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);

    frame.pack();frame.setVisible(true);

    }