-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPatient.java
More file actions
299 lines (244 loc) · 8.23 KB
/
Patient.java
File metadata and controls
299 lines (244 loc) · 8.23 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
//worked on by Hy Nguyen
// 11-11-2021
// Should be all finsihed. Just need to test and debug as a whole
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
public class Patient extends Account {
// Patient Attributes
float weight, bodyTemp, bloodPres; // vitals taken by Nurse
String patientEmail, patientFName, patientLName, patientNumber, height, // Patient info and reason for visit
emerFName, emerLName, emerEmail, emergenNumber, medication, // Emergency Contact Info
dateOfBirth, pharmacy, immunization, prevHealthIssues, room;
Doctor currentDoctor;
MessageHandler messageHandler;
ArrayList<String> patientHistoryArray;
public Queue<String> patientHistory = new LinkedList<>();
// Patient Operations
public Patient() {
// Empty Patient
super();
this.dateOfBirth = "Jan. 01, 2000";
this.patientFName = "John";
this.patientLName = "Doe";
this.patientEmail = "johndoe@doe.com";
this.patientNumber = "000-000-0000";
this.emerFName = "Jane";
this.emerLName = "Doe";
this.emerEmail = "janedoe@doe.com";
this.emergenNumber = "000-000-0000";
this.medication = "";
this.prevHealthIssues = "";
this.immunization = "";
this.pharmacy = "CVS";
// Setting default vitals
this.weight = 0;
this.height = "0 ' 0";
this.bodyTemp = 0;
this.bloodPres = 0;
this.patientHistoryArray = new ArrayList<String>();
this.room = "N/A";
this.messageHandler = new MessageHandler();
}
public Patient(String username, String password, String fName, String lName, String birthday, String email,
String phoneNum, String pharmacy, String emerfName, String emerlName, String emerEmail,
String emergenNumber) {
super(username, password);
this.patientFName = fName;
this.patientLName = lName;
this.dateOfBirth = birthday;
this.patientEmail = email;
this.patientNumber = phoneNum;
this.emerFName = emerfName;
this.emerLName = emerlName;
this.emerEmail = emerEmail;
this.emergenNumber = emergenNumber;
this.pharmacy = pharmacy;
// Setting default vitals
this.weight = 0;
this.height = "0 ' 0";
this.bodyTemp = 0;
this.bloodPres = 0;
this.patientHistoryArray = new ArrayList<String>();
this.room = "N/A";
this.immunization = "";
this.messageHandler = new MessageHandler();
}
// This function will be used by the Patients to mesage their doctors
// It'll take in a Doctor as the receiptient of the message, and the message
// itself
@Override
public void sendMessage(Account acc, String messString) {
if (acc instanceof Nurse) {
Nurse recipient = (Nurse) acc;
String messageToSend = "Patient " + this.patientFName + ": " + messString;
try {
messageHandler.writeMessage(recipient, this, messageToSend);
} catch (Exception e) {
System.out.println("there was a problem creating a message from doctor to current patient");
e.printStackTrace();
}
} else {
Doctor recipient = (Doctor) acc;
String messageToSend = "Patient " + this.patientFName + ": " + messString;
try {
messageHandler.writeMessage(recipient, this, messageToSend);
} catch (Exception e) {
System.out.println("there was a problem creating a message from doctor to current patient");
e.printStackTrace();
}
}
}
// This message will be used to update a patient contact information.
// It will return a boolean if information is updated
public boolean changeContactInformation(String email, String phoneNum) {
boolean success = false;
if (email != "") {
this.patientEmail = email;
success = true;
}
if (phoneNum != "") {
this.patientNumber = phoneNum;
success = true;
}
return success;
}
public ArrayList<String> getPatientHistoryArray() {
return this.patientHistoryArray;
}
public void updateVitals(float weight, String height, float bodyTemp, float bloodPres) {
this.weight = weight;
this.height = height;
this.bodyTemp = bodyTemp;
this.bloodPres = bloodPres;
}
public void assignDoctor(Doctor doctor) {
this.currentDoctor = doctor;
}
public void assignMedication(String medication) {
this.medication = medication;
}
// Setters for Patient Creation if needed
public void setWeight(float weight) {
this.weight = weight;
}
public void setBodyTemp(float bodyTemp) {
this.bodyTemp = bodyTemp;
}
public void setImmunization(String immunString) {
this.immunization += ("\n" + immunString);
}
public void setBloodPressure(float bloodPres) {
this.bloodPres = bloodPres;
}
public void setPatientEmail(String email) {
this.patientEmail = email;
}
public void setPatientFirstName(String FirstName) {
this.patientFName = FirstName;
}
public void setPatientLastName(String lastName) {
this.patientLName = lastName;
}
public void setPatientPhoneNumber(String number) {
this.patientNumber = number;
}
public void setPatientHeight(String height) {
this.height = height;
}
public void setHealthIssues(String healtIssues) {
this.prevHealthIssues = healtIssues;
}
public void setEmergencyContact(String firstName, String lastName, String email, String number) {
this.emerFName = firstName;
this.emerLName = lastName;
this.emerEmail = email;
this.emergenNumber = number;
}
public void setUsername(String username) {
super.username = username;
}
public void setPassword(String password) {
super.password = password;
}
public void setDateOfBirth(String birthday) {
this.dateOfBirth = birthday;
}
public void setDateOfBirth(String month, String day, String year) {
String birthday = month + " " + day + ", " + year;
this.dateOfBirth = birthday;
}
public void setPharmacy(String pharmacy) {
this.pharmacy = pharmacy;
}
public void setRoom(String room) {
this.room = room;
}
// Getters for the View Own Patient Info
public float getWeight() {
return this.weight;
}
public float getBodyTemp() {
return this.bodyTemp;
}
public float getbloodPres() {
return this.bloodPres;
}
public String getImmunization() {
return this.immunization;
}
public String getPrevHealthIssues() {
return this.prevHealthIssues;
}
public String getPatientEmail() {
return this.patientEmail;
}
public String getPatientFirstName() {
return this.patientFName;
}
public String getPatientLastName() {
return this.patientLName;
}
public String getPatientFullName() {
return this.patientFName + " " + this.patientLName;
}
public String getPhoneNumber() {
return this.patientNumber;
}
public String getHeight() {
return this.height;
}
public String getEmergencyFirstName() {
return this.emerFName;
}
public String getEmergencyLastName() {
return this.emerLName;
}
public String getEmergencyFullName() {
return this.emerFName + " " + this.emerLName;
}
public String getEmergencyEmail() {
return this.emerEmail;
}
public String getEmergencyPhoneNumb() {
return this.emergenNumber;
}
public String getMedication() {
return this.medication;
}
public String getUsername() {
return this.username;
}
public String getPassword() {
return this.password;
}
public String getDateOfBirth() {
return this.dateOfBirth;
}
public String getPharmacy() {
return this.pharmacy;
}
public String getRoom() {
return this.room;
}
}