Hospital Patient

Hospital Patient

import java.util.ArrayList;

import java.util.Calendar;

import java.util.Date;

import java.util.HashMap;

import java.util.Map;

import java.util.Scanner;



public class Hospital
 {

    /**
     * @param args
     */

public static void main(String[] args)
 {

        // TODO Auto-generated method stub

Map<Integer,Patient> patients=new HashMap<Integer,Patient>();

PatientFunction pf=new PatientFunction();

Patient p1=new Patient();

Calendar c=Calendar.getInstance();

Date d=new Date();
d.setMonth(d.getMonth()-1);

c.setTime(d);

p1.setAge(25);
p1.setName("Arg");
p1.setLastAppointment(c);

patients.put(p1.getPatientId(), p1);

Scanner s=new Scanner(System.in);


int ctr=0;

do
{

System.out.println("::::::::Hospital::::::::");

System.out.println("Enter 1.Add a patient 2.Update Patient 3.Search patient 4.Display patients or View status");

ctr=s.nextInt();
s.nextLine();

switch(ctr)
{

case 1:

Patient p=pf.addPatient();

if(p==null)

System.out.println("Incorrect input");

else

patients.put(p.getPatientId(), p);

break;

case 2:

System.out.println("Enter a patient ID");

int pid=s.nextInt();
s.nextLine();

if(patients.containsKey(pid))
{

Patient p2=pf.updatePatient(patients.get(pid));

if(p2!=null)

patients.put(p2.getPatientId(), p2);

else

System.out.println("Invalid input");    

}

else

{

System.out.println("Patient with the ID does not exist");
                    }

break;

case 3:

System.out.println("Enter a patient ID");

pid=s.nextInt();
s.nextLine();

if(patients.containsKey(pid))
{

pf.displayPatientDetails(patients.get(pid));

                    }

else

{

System.out.println("Patient with the ID does not exist");
                    }

break;

case 4:

if(patients.size()==0)

System.out.println("No patients in list");

else

{   
ArrayList<Patient> al=new ArrayList<Patient>(patients.values());
                        pf.displayAll(al);              
                    }

break;

}

System.out.println("Continue? Enter y or n");

if(s.nextLine().toLowerCase().equals("y"))

ctr=999;

}
while(ctr==999);

}


}


import java.util.Calendar;

import java.util.Date;



public class Patient 
{

static int lastId=10000;

private int patientId;

private String name;

private String address;

private int age;

private String sex;

private String illness;

private float amount;

private Calendar lastAppointment;



private String prescription;


public String getPrescription() 
{

return prescription;

}

public void setPrescription(String prescription) 
{

this.prescription = prescription;

}

public int getPatientId() 
{

return patientId;

}

public void setPatientId(int patientId) 
{

this.patientId = patientId;

}

public String getName() 
{

return name;

}

public void setName(String name) 
{

this.name = name;

}

public String getAddress() 
{

return address;

}

public void setAddress(String address) 
{

this.address = address;

}

public int getAge() 
{

return age;

}

public void setAge(int age) 
{

this.age = age;

}

public String getSex() 
{

return sex;

}

public void setSex(String sex) 
{

this.sex = sex;

}

public String getIllness() 
{

return illness;
}

public void setIllness(String illness) 
{

this.illness = illness;

}

public float getAmount() 
{

return amount;

}

public void setAmount(float amount) 
{

this.amount = amount;
}

public Calendar getLastAppointment() 
{

return lastAppointment;

}

public void setLastAppointment(Calendar lastAppointment) 
{

this.lastAppointment = lastAppointment;

}

public static int getLastId() 
{

return lastId;

}

public static void setLastId(int lastId) {
    Patient.lastId = lastId;
}

public Patient(){
    this.patientId=++Patient.lastId;

    lastAppointment=Calendar.getInstance();
}
}

import java.util.ArrayList;

import java.util.Calendar;

import java.util.Date;

import java.util.Scanner;

public class PatientFunction 
{

    Scanner s=new Scanner(System.in);

    public Patient updatePatient(Patient p)
{

        int ctr=0;

        try
{


do 
{

System.out.println("::::Update Customer::::\n1.Name 2.Address 3.Age 4.Sex 5.Illness 6.Amount");

ctr=s.nextInt();s.nextLine();

switch(ctr)
{

case 1:

System.out.println("Current Name:: "+p.getName());
                    p.setName(s.nextLine());

break;

case 2:

System.out.println("Current Address:: "+p.getAddress());
                    p.setAddress(s.nextLine());

break;

case 3:

System.out.println("Current Age:: "+p.getAge());
                    p.setAge(Integer.parseInt(s.nextLine());

break;

case 4:

System.out.println("Current Sex:: "+p.getSex());
                    p.setSex(s.nextLine());

break;

case 5:

System.out.println("Current Illness:: "+p.getIllness());
                    p.setIllness(s.nextLine());

break;

case 6:

System.out.println("Current Amount:: "+p.getName());
                    p.setAmount(Float.parseFloat(s.nextLine()));

break;

}

Calendar c=Calendar.getInstance();

c.setTime(new Date());

p.setLastAppointment(c);

System.out.println("Update other details? Enter y or n");

if(s.nextLine().toLowerCase().equals("y"))

ctr=999;


}
while(ctr==999);

        }
catch(Exception e)
{

return null;

}



return p;

}

public Patient addPatient()
{


Patient p=new Patient();

try
{

System.out.println("Enter Name:: ");

p.setName(s.nextLine());


System.out.println("Enter Address:: ");

p.setAddress(s.nextLine());


System.out.println("Enter Age:: ");

p.setAge(Integer.parseInt(s.nextLine()));


System.out.println("Enter Sex:: ");

p.setSex(s.nextLine());


System.out.println("Enter Illness:: ");

p.setIllness(s.nextLine());


System.out.println("Enter Amount:: ");

p.setAmount(Float.parseFloat(s.nextLine()));

}

catch(Exception e)
{


return null;

}

return p;

}

public void displayPatientDetails(Patient p)
{

System.out.println(":::Customer Details:");

System.out.println("Customer ID:"+p.getPatientId());

System.out.println("Customer Name:"+p.getName());

System.out.println("Customer Age:"+p.getAge());

System.out.println("Customer Address:"+p.getAddress());

System.out.println("Customer Illness:"+p.getIllness());

System.out.println("Customer Amount:"+p.getAmount());

p.getLastAppointment().add(Calendar.DAY_OF_MONTH, 15);      

if(p.getLastAppointment().getTime().compareTo(new Date())>0)
System.out.println("Customer Status: Active");

else

System.out.println("Customer Status: InActive");

p.getLastAppointment().add(Calendar.DAY_OF_MONTH, -15);

}   

public void displayAll(ArrayList<Patient> pl)
{

for(int i=0;i<pl.size();i++)
{

Patient p=pl.get(i);

p.getLastAppointment().add(Calendar.DAY_OF_MONTH, 15);      

if(p.getLastAppointment().getTime().compareTo(new Date())>0)        
            System.out.println("Customer ID:: "+p.getPatientId()+"\t Name:"+p.getName()+"\tCustomer Status: Active");

else

System.out.println("Customer ID:: "+p.getPatientId()+"\t Name:"+p.getName()+"\tCustomer Status: InActive");

p.getLastAppointment().add(Calendar.DAY_OF_MONTH, -15);

    }

}

}
View Answers









Related Tutorials/Questions & Answers:
Hospital Patient
{ System.out.println("::::::::Hospital::::::::"); System.out.println("Enter 1.Add a patient...Hospital Patient  import java.util.ArrayList; import... java.util.Map; import java.util.Scanner; public class Hospital
hospital patient
hospital patient  import java.util.ArrayList; import... PatientFunction { Scanner s=new Scanner(System.in); public Patient updatePatient(Patient p) { int ctr=0; try { do
Advertisements
Hospital project
Hospital project  hello sir i want hospital management system Source code in C # swing Back-end sql sever 2005. i want these type of model 1. Username and password 2. staff details i. Doctor details ii. nurse details iii
hospital management bill
hospital management bill  bill preperation
hospital management bill
hospital management bill  bill preperation
hospital management bill
hospital management bill  bill preperation
ModuleNotFoundError: No module named 'hospital'
ModuleNotFoundError: No module named 'hospital'  Hi, My Python... 'hospital' How to remove the ModuleNotFoundError: No module named 'hospital... to install padas library. You can install hospital python with following
GPS Patient Tracking System
GPS Patient Tracking System The patients with Alzheimer?s disease or dementia... of any mishap that can create further problems for the hospitals. The hospital... be filed against them in case of any misfortune with the patient. For solving
hospital Management System
hospital Management System  hello sir i want hospital management system Source code in java swing Back-end Oracle 9i. i want these type of model 1. Username and password 2. staff details i. Doctor details ii. nurse
Code to register a new patient in a clinic
Code to register a new patient in a clinic  Hi, How do i write a code that allows a user to enter someone's name and then search for that name from... the patient, but if the name is available in the text file, it just updates
Java Hospital management system
Java Hospital management system  hospital management    <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*" %> <!DOCTYPE html> <html> <body>
hospital management bill
hospital management bill  bill preperation    <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.sql.*" %> <!DOCTYPE html> <html> <head> <meta
ModuleNotFoundError: No module named 'collate_patient_logfiles'
ModuleNotFoundError: No module named 'collate_patient_logfiles'  Hi...: No module named 'collate_patient_logfiles' How to remove the ModuleNotFoundError: No module named 'collate_patient_logfiles' error? Thanks  
ModuleNotFoundError: No module named 'collate_patient_logfiles'
ModuleNotFoundError: No module named 'collate_patient_logfiles'  Hi...: No module named 'collate_patient_logfiles' How to remove the ModuleNotFoundError: No module named 'collate_patient_logfiles' error? Thanks  
ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-ethnicity'
ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-ethnicity...: ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-ethnicity' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-medical-patient
ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-occupation'
ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-occupation...: ModuleNotFoundError: No module named 'odoo8-addon-medical-patient-occupation' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-medical-patient
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease'
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease' ...: ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-medical-patient
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-dob'
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-dob' ...: ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-dob' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-dob' error
ModuleNotFoundError: No module named 'Patient-Summary-FHIR'
ModuleNotFoundError: No module named 'Patient-Summary-FHIR'  Hi...: No module named 'Patient-Summary-FHIR' How to remove the ModuleNotFoundError: No module named 'Patient-Summary-FHIR' error? Thanks   Hi
ModuleNotFoundError: No module named 'collate_patient_logfiles'
ModuleNotFoundError: No module named 'collate_patient_logfiles'  Hi...: No module named 'collate_patient_logfiles' How to remove the ModuleNotFoundError: No module named 'collate_patient_logfiles' error? Thanks  
ModuleNotFoundError: No module named 'FHIR-Patient-Summary'
ModuleNotFoundError: No module named 'FHIR-Patient-Summary'  Hi...: No module named 'FHIR-Patient-Summary' How to remove the ModuleNotFoundError: No module named 'FHIR-Patient-Summary' error? Thanks   Hi
ModuleNotFoundError: No module named 'hospital-logfile-analyzer'
ModuleNotFoundError: No module named 'hospital-logfile-analyzer'  Hi...: No module named 'hospital-logfile-analyzer' How to remove the ModuleNotFoundError: No module named 'hospital-logfile-analyzer' error? Thanks  
JSP Servlet update patient data - JSP-Servlet
JSP Servlet update patient data  Hi Friend, I'm attaching my inserting patient data servlet as requested. I tried your posted code, its... it is clearer. 1. I am doing a search on a patient visit table which has a FK
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease-allergy'
ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease...: ModuleNotFoundError: No module named 'odoo9-addon-medical-patient-disease-allergy...-medical-patient-disease-allergy' error? Thanks   Hi, In your
SEVERE: Context [/hospital] startup failed due to previous errors
SEVERE: Context [/hospital] startup failed due to previous errors  Hi my application is hospital i am facing this problem my build.xml file... org.apache.catalina.core.StandardContext start SEVERE: Context [/hospital] startup failed due to previous errors Jan
GPS for Alzheimer's Patients
of dementia that gets worse with time and finally leads to death of the patient... alerts are sent to the caretakers of the patient using e-mail, if the patient... map is thus able to give you the exact location of the patient. The initial
How to add value from sql server in dropdownlist
a hospital management project using jsp servlet, where one form name is patient registration, in that form i have taken id, name, and i want to retrieve a patient id from other table like out patient, and this id will be stored dynamically
Current Running Projects on roseindia.net
Current Running Projects on roseindia.net       Project Title College Alumini Registration and Display System Patient Registration and appointment booking system SS7 real message
Java Stacks - Java Beginners
Assignment: A) Consider the outpatient pharamacy at University Hospital. At the entrance of the pharmacy, the patient gives his prescriptions... prescription submitted. The patient then waits until his name is called, he then receives
Java help - Java Beginners
the outpatient pharamacy at University Hospital. At the entrance of the pharmacy, the patient gives his prescriptions to the pharmacist who then gives him a receipt paper which has a number for each prescription submitted. The patient
Java code problem
("::::::::Hospital::::::::"); System.out.println("Enter 1.Add a patient 2.Update...; import java.util.Scanner; public class Hospital...(); Patient p1=new Patient(); Calendar c=Calendar.getInstance(); Date d=new Date
kgisl
Hospital management project  hospital management
mmm project
Hospital management project  Hospital management
Top 10 Health Applications for iPhone
and fitness, medicine directory and drug reference, patient education, medical... a critical case or on the way home can get in touch to the patient's medical record to come to a conclusion on medical aspect or a patient or his relatives can
GPS services in mobile phones
the nearest hotel or hospital. Now finally those kinds of services are finally
Business Intelligence in Healthcare
information about patient treatment. ADS_TO_REPLACE_1 Here, in case of hospital... it so in the case of hospital management or health sector. In Hospitals Healthcare industry whether hospital or any pharmaceutical companies face a lot
javaprograms
javaprograms  wrire a hospital program in java
HMS
HMS  what are the reqirements of the hospital management
Java Dynamic Array - Java Beginners
[] projects={"University", "School", "Hospital"}; I want to print with a loop: (Greece, University), (Greece, School), (Greece, Hospital) (Germany, University), ... (Greece, University, School), (Greece, School, Hospital), (Greece
Object with different data types
Object with different data types  Hello, I need to build a "patient... linked list. The problem is I don't know how to create patient object. Can...; import java.util.List; public class Patient { String name; String id
Java Class Diagram
of buying glasses from the viewpoint of the patient. The first step is to see an eye doctor who will give the patient a prescription. Once the patient has... and a lense. and place the order for patient glasses. Once the glasses have been made
project
project  sir i want module and source code on my project hospital management system
Lose Weight Surgery
hospital. Wight Loss Surgery types:ADS_TO_REPLACE_1 You should contact to your... reduced Disadvantages:ADS_TO_REPLACE_3 90% of the patient is experiencing
Best Practices for Health Care Management
of the organization. By maintaining steady and smooth access to the patient and all... Systems Quality of health care service in any hospital or clinic is considered
database
database  hi i want to develop one patient database can any one provide me the guide
PHP
PHP  I would love to do PHP project with the title of "Hospital Management System". I want to know how to make validation using jquery
How to retrieve single row from MSSQL
had created the table in MSSQL,the fields with patient name,pid,Dname(doctor name... the patient name and doc name and search button in GUI window.What i want is after giving the name of both patient & doctor,after clicking the search button.It
How to retrieve single row from MSSQL
had created the table in MSSQL,the fields with patient name,pid,Dname(doctor name... the patient name and doc name and search button in GUI window.What i want is after giving the name of both patient & doctor,after clicking the search button.It
How to retrieve single row from MSSQL
had created the table in MSSQL,the fields with patient name,pid,Dname(doctor name... the patient name and doc name and search button in GUI window.What i want is after giving the name of both patient & doctor,after clicking the search button.It
SQL
patient; For (15/03/2011) format: SELECT DATE_FORMAT(dob, '%d/%m/%Y') FROM patient; where patient is our table name and dob is a field of date type

Ads