This Hospital management application performs the following operations.1. Register a patient with following details Patient-Name, patient Address, Age, Patient-Sex, Patient-Illness,Amount-for-Appointment.
2. Update entered patient details
3. Display patient detials
4. Remove inactive patient. A patient is treated as inactive if he is 15 days old from the the date of admit to the hospital.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | package Hospital;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.*;import java.io.*;public class HospitalProcess {static ArrayListnew ArrayListstatic String joindate;public static void main(String[] args) throws IOException {char l='i';Calendar currentDate = Calendar.getInstance();SimpleDateFormat new SimpleDateFormat("yyyy/MMM/dd HH:mm:ss");joindate = formatter.format(currentDate.getTime());Patient p1 = new Patient(1,"Raja", "Miyapur,Hyderabad" ,40 ,'m' ,"Fever" ,250f ,joindate);arl.add(p1);Patient p2 = new Patient(2,"Rani", "Madhapur,Hyderabad" ,45 ,'f' ,"Cough" ,250f ,joindate);arl.add(p2);Patient p3 = new Patient(3,"James", "Hydernagar,Hyderabad" ,56 ,'m' ,"Cancer" ,300f ,joindate);arl.add(p3);do{Patient p = new Patient();System.out.println("Press 1 to register a Patient,2 to update Patient details,3 to deactivate Patient details,4 to display Patient details,");BufferedReader br = new BufferedReader(new InputStreamReader(System.in));int choice =Integer.parseInt(br.readLine());switch(choice){case 1:p.registerPatient();System.out.println("Patient Registered Successfully !!!");p.showPatientDetails();break;case 2:p.showPatientDetails();p.updatePatientDetails();break;case 3:p.removeInactivePatient();break;case 4:Collections.sort(arl);p.showPatientDetails();break;default:System.out.println("Patient with that id doesnot exists");System.out.println("Try again");break;}l=(char)br.read();}while(l=='y');}} |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | class Patient implements Comparableint patientID;String patientName;String patientAddress;int age;char patientSex;String patientIllness;float amountForAppointment;String joindate;HospitalProcess hm = new HospitalProcess();Patient() {}public int compareTo(Patient p){return this.patientID-p.patientID;}BufferedReader br = new BufferedReader(new InputStreamReader(System.in));Patient(int patientID,String patientName,String patientAddress,int age,char patientSex,String patientIllness,float amountForAppointment, String joindate){this.patientID=patientID;this.patientName=patientName;this.patientAddress=patientAddress;this.age=age;this.patientSex=patientSex;this.patientIllness=patientIllness;this.amountForAppointment=amountForAppointment;this.joindate = joindate;}void registerPatient()throws IOException{Patient pr = new Patient();pr.showPatientDetails();int patientID=hm.arl.size();pr.patientID = patientID+1;System.out.println("Enter Patient name:");pr.patientName = br.readLine();System.out.println("Enter Patient Address:");pr.patientAddress =br.readLine();System.out.println("Enter Patient Age:");pr.age =Integer.parseInt(br.readLine());System.out.println("Enter Patient Sex:");String temp = br.readLine();pr.patientSex =temp.charAt(0);System.out.println("Enter Patient Illness:");pr.patientIllness =br.readLine();System.out.println("Enter the amount patient needs to pay for appointment:");pr.amountForAppointment =Float.parseFloat(br.readLine());pr.joindate = hm.joindate;hm.arl.add(pr);} |
More >>
A java application to implement hospital management system
No comments:
Post a Comment