-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatient.java
More file actions
65 lines (52 loc) · 2.25 KB
/
Copy pathPatient.java
File metadata and controls
65 lines (52 loc) · 2.25 KB
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
65
// Patient.java
package vhs;
import java.util.ArrayList;
import java.util.List;
public class Patient extends User {
private String medicalHistory;
private String contactNumber;
private String emergencyContact;
private List<Appointment> appointments;
private EHR ehr;
public Patient() {
super();
this.appointments = new ArrayList<>();
this.ehr = new EHR(this);
}
public Patient(String id, String name, String email, String password,
String medicalHistory, String contactNumber, String emergencyContact) {
super(id, name, email, password, "PATIENT");
this.medicalHistory = medicalHistory;
this.contactNumber = contactNumber;
this.emergencyContact = emergencyContact;
this.appointments = new ArrayList<>();
this.ehr = new EHR(this);
}
// Getters and Setters
public String getMedicalHistory() { return medicalHistory; }
public void setMedicalHistory(String medicalHistory) { this.medicalHistory = medicalHistory; }
public String getContactNumber() { return contactNumber; }
public void setContactNumber(String contactNumber) { this.contactNumber = contactNumber; }
public String getEmergencyContact() { return emergencyContact; }
public void setEmergencyContact(String emergencyContact) { this.emergencyContact = emergencyContact; }
public List<Appointment> getAppointments() { return appointments; }
public void setAppointments(List<Appointment> appointments) { this.appointments = appointments; }
public EHR getEhr() { return ehr; }
public void setEhr(EHR ehr) { this.ehr = ehr; }
// Updated: Adding new feature commits
// Methods
public void addAppointment(Appointment appointment) {
appointments.add(appointment);
}
public void removeAppointment(Appointment appointment) {
appointments.remove(appointment);
}
@Override
public void displayInfo() {
System.out.println("Patient: " + getName() + " | Medical History: " + medicalHistory);
}
@Override
public String toString() {
return super.toString() + ", Contact: " + contactNumber + ", Medical History: " + medicalHistory;
}
}