Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
public static boolean dischargePatient(ArrayList<Patient> patientList) { 
		int ind=0;
		boolean patientfound = false;
		boolean isdischarged = false;
		String name =Helper.readString("enter patient name : ");
		for (Patient patient:patientList) {
			if (patient.getName().equalsIgnoreCase(name)) {
				ind=patientList.indexOf(patient);
				patientfound =true;
			}
		}
		if (isdischarged ==true ) {
			System.out.println("Patient has already been discharged ");
			
		}
		if (patientfound ==true ){
				patientList.get(ind).display();
				String datedischarged=Helper.readString("enter date discharged: ");
				patientList.get(ind).setDatedischarged(datedischarged) ;
				patientList.get(ind).setVisitorcount(0);
				System.out.println("**** patient has been discharged ****");
				isdischarged=true;
			}
//			if (isdischarged ==true ) {
//				System.out.println("Patient has already been discharged ");
//				
//			}
			if (patientfound==false) {
				System.out.println("No such patient in ward ");
			}
		return patientfound;
	}