-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatientAccount.java
46 lines (40 loc) · 2.07 KB
/
PatientAccount.java
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
package clinic;
import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
public class PatientAccount extends ClinicSystem implements IViewable, TextFileManipulation {
public void viewAppointment(String patientname) throws NoSuchMethodException, SecurityException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException {
readLines(this, appointmentPath(), getMethodObject("clinic.PatientAccount", "readPatientName"), patientname,
null, null, null, null, null);
if (!appointmentList.isEmpty())
System.out.println(appointmentList.get(0));
else {
System.out.println("You have no upcoming appointment");
}
}
public void readPatientName(String readLine, String patientname, String keyword2, String keyword3, String keyword4,
String keyword5, String keyword6) {
String[] token = readLine.split(",");
if (token[1].equals(patientname)) {
appointmentList.add(readLine);
}
}
public void sendRequestToMessageFile(String doctor, String patient, String date, String time)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
SecurityException, ClassNotFoundException {
System.out.println("Please input date you would like to change to: ");
readLines(this, appointmentPath(), getMethodObject("clinic.PatientAccount", "readAppointment"), doctor, patient,
date, time, null, null);
System.out.println("Yeah finished");
}
public void readAppointment(String readLine, String doctor, String patient, String date, String time,
String keyword5, String keyword6)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
SecurityException, ClassNotFoundException, ParseException {
String[] token = readLine.split(",");
if (token[0].equals(doctor) && token[1].equals(patient) && token[2].equals(date) && token[3].equals(time)) {
String Line = doctor + "," + patient + "," + date + "," + time + "," + setAppointmentDate(doctor, patient);
writeLines(messageFilePath(), Line);
}
}
}