-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoctor.java
More file actions
112 lines (84 loc) · 3.08 KB
/
Copy pathDoctor.java
File metadata and controls
112 lines (84 loc) · 3.08 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.util.ArrayList;
public class Doctor extends User{
private String Specialization;
private String Department;
ArrayList<Patient>assignedpatients=new ArrayList<>();
ArrayList<Appointment>MyAppointments=new ArrayList<>();
public Doctor (){
}
public Doctor( String ID, String name, String password, String username,String phonenumber) {
super(ID, name, password, username,phonenumber);
}
public Doctor(String Department, String Specialization, String ID, String name, String password, String username,String phonenumber) {
super(ID, name, password, username,phonenumber);
this.Department = Department;
this.Specialization = Specialization;
}
public void setSpecialization(String Specialization) {
this.Specialization = Specialization;
}
public void setDepartment(String Department) {
this.Department = Department;
}
public ArrayList<Appointment> getMyAppointments() {
return MyAppointments;
}
@Override
public void displayinfo(){
System.out.println("Name : "+ getName());
System.out.println("Doctor ID : "+ getID());
System.out.println("Username : "+getUsername());
System.out.println("Specialization : "+Specialization);
System.out.println("Department : "+Department);
System.out.println("Phone number : "+getPhonenumber());
System.out.println(" ");
}
public void viewAssignedPatients(){
if(assignedpatients.isEmpty()){
System.out.println("No Assigned Patients Now. ");
}else{
System.out.println("Assigned Patients : ");
for ( Patient p: assignedpatients) {
System.out.println("Patient Name : "+p.getName()+ ", Paient ID : "+p.getID());
}
}
System.out.println();
}
public void viewMyAppointments(){
if(MyAppointments.isEmpty()){
System.out.println("Appointment list is empty ");
}else{
System.out.println("My Appointments :");
for (Appointment appointment :MyAppointments) {
System.out.println(" Appointment ID : "+appointment.appointmentID+", Date : "+appointment.date+", Time : "+appointment.time+
", Patient ID: "+appointment.patientID+", Status : "+appointment.status
);
}
}
System.out.println();
}
public void updateAppointmentStatus(String id ,String newstatus ){
boolean found = false;
for (Appointment appointment : MyAppointments) {
if(appointment.appointmentID.equals(id)) {
found = true;
appointment.setStatus(newstatus);
System.out.println("Appointment Status updated to : " + newstatus);
break;
}
}
if(!found){
System.out.println("The Appointment not found");
}
System.out.println();
}
public String getSpecialization() {
return Specialization;
}
public String getDepartment() {
return Department;
}
public ArrayList<Patient> getAssignedpatients() {
return assignedpatients;
}
}