Newer
Older
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
package edu.ncsu.csc.itrust.beans;
import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import edu.ncsu.csc.itrust.enums.BloodType;
import edu.ncsu.csc.itrust.enums.Ethnicity;
import edu.ncsu.csc.itrust.enums.Gender;
/**
* A bean for storing data about a patient.
*
* A bean's purpose is to store data. Period. Little or no functionality is to be added to a bean
* (with the exception of minor formatting such as concatenating phone numbers together).
* A bean must only have Getters and Setters (Eclipse Hint: Use Source > Generate Getters and Setters
* to create these easily)
*/
public class PatientBean implements Serializable, Comparable<PatientBean> {
private static final long serialVersionUID = -6474182977342257877L;
private long MID = 0;
private String firstName = "";
private String lastName = "";
private String email = "";
private String securityQuestion = "";
private String securityAnswer = "";
private String password = "";
private String confirmPassword = "";
private String streetAddress1 = "";
private String streetAddress2 = "";
private String city = "";
private String state = "AK";
private String zip = "";
private String phone = "";
private String emergencyName = "";
private String emergencyPhone = "";
private String icName = "";
private String icAddress1 = "";
private String icAddress2 = "";
private String icCity = "";
private String icState = "AK";
private String icZip = "";
private String icPhone = "";
private String icID = "";
private String creditCardType = "";
private String creditCardNumber = "";
// Topical Health Information
ahmadaldhalaan
committed
private String dateOfBirthStr = new SimpleDateFormat("MM/dd/yyyy").format(new Date());
private String dateOfDeathStr = "";
private String causeOfDeath = "";
private String motherMID = "0";
private String fatherMID = "0";
private BloodType bloodType = BloodType.NS;
private Ethnicity ethnicity = Ethnicity.NotSpecified;
private Gender gender = Gender.NotSpecified;
private String topicalNotes = "";
private String directionsToHome = "";
private String religion = "";
private String language = "";
private String spiritualPractices = "";
private String alternateName = "";
private String dateOfDeactivationStr = "";
private String messageFilter= "";
public void setMessageFilter(String nf) {
this.messageFilter = nf;
}
public String getMessageFilter(){
return messageFilter;
}
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
public BloodType getBloodType() {
return bloodType;
}
public void setBloodTypeStr(String bloodType) {
this.bloodType = BloodType.parse(bloodType);
}
public void setBloodType(BloodType bloodType) {
this.bloodType = bloodType;
}
public String getCauseOfDeath() {
return causeOfDeath;
}
public void setCauseOfDeath(String causeOfDeath) {
this.causeOfDeath = causeOfDeath;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDateOfBirthStr() {
return dateOfBirthStr;
}
public Date getDateOfBirth() {
try {
ahmadaldhalaan
committed
return new SimpleDateFormat("MM/dd/yyyy").parse(dateOfBirthStr);
} catch (ParseException e) {
return null;
}
}
public Date getDateOfDeath() {
try {
ahmadaldhalaan
committed
return new SimpleDateFormat("MM/dd/yyyy").parse(dateOfDeathStr);
} catch (ParseException e) {
return null;
}
}
public void setDateOfBirthStr(String dateOfBirthStr) {
this.dateOfBirthStr = dateOfBirthStr;
}
public int getAge() {
try {
ahmadaldhalaan
committed
long ageInMs = System.currentTimeMillis()
- new SimpleDateFormat("MM/dd/yyyy").parse(dateOfBirthStr).getTime();
long age = ageInMs / (1000L * 60L * 60L * 24L * 365L);
return (int) age;
} catch (ParseException e) {
return -1;
}
}
public long getAgeInDays() {
long age;
long ageInMs;
try {
ahmadaldhalaan
committed
ageInMs = System.currentTimeMillis()
- new SimpleDateFormat("MM/dd/yyyy").parse(dateOfBirthStr).getTime();
age = ageInMs / (1000L * 60L * 60L * 24L);
}
catch (ParseException e) {
return -1;
}
return age;
}
public long getAgeInWeeks() {
long age;
long ageInMs;
try {
ahmadaldhalaan
committed
ageInMs = System.currentTimeMillis()
- new SimpleDateFormat("MM/dd/yyyy").parse(dateOfBirthStr).getTime();
age = ageInMs / (1000L * 60L * 60L * 24L * 7L);
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
}
catch (ParseException e) {
return -1;
}
return age;
}
public String getDateOfDeathStr() {
return dateOfDeathStr;
}
public void setDateOfDeathStr(String dateOfDeathStr) {
this.dateOfDeathStr = dateOfDeathStr;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmergencyName() {
return emergencyName;
}
public void setEmergencyName(String emergencyName) {
this.emergencyName = emergencyName;
}
public Ethnicity getEthnicity() {
return ethnicity;
}
public void setEthnicityStr(String ethnicity) {
this.ethnicity = Ethnicity.parse(ethnicity);
}
public void setEthnicity(Ethnicity ethnicity) {
this.ethnicity = ethnicity;
}
public String getFatherMID() {
return fatherMID;
}
public void setFatherMID(String fatherMID) {
this.fatherMID = fatherMID;
}
public String getFullName() {
return getFirstName() + " " + getLastName();
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public Gender getGender() {
return gender;
}
public void setGenderStr(String gender) {
this.gender = Gender.parse(gender);
}
public void setGender(Gender gender) {
this.gender = gender;
}
public String getIcAddress1() {
return icAddress1;
}
public void setIcAddress1(String icAddress1) {
this.icAddress1 = icAddress1;
}
public String getIcAddress2() {
return icAddress2;
}
public void setIcAddress2(String icAddress2) {
this.icAddress2 = icAddress2;
}
// Composition of city, state, and zip
public String getIcAddress3() {
return getIcCity() + ", " + getIcState() + " " + getIcZip();
}
public String getIcCity() {
return icCity;
}
public void setIcCity(String icCity) {
this.icCity = icCity;
}
public String getIcID() {
return icID;
}
public void setIcID(String icID) {
this.icID = icID;
}
public String getCreditCardType() {
return creditCardType;
}
public void setCreditCardType(String creditCardType) {
this.creditCardType = creditCardType;
}
public String getCreditCardNumber() {
return creditCardNumber;
}
public void setCreditCardNumber(String creditCardNumber) {
this.creditCardNumber = creditCardNumber;
}
public String getIcName() {
return icName;
}
public void setIcName(String icName) {
this.icName = icName;
}
public String getIcZip() {
return icZip;
}
public void setIcZip(String icZip) {
this.icZip = icZip;
}
public String getIcState() {
return icState;
}
public void setIcState(String icState) {
this.icState = icState;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public long getMID() {
return MID;
}
public void setMID(long mid) {
MID = mid;
}
public String getMotherMID() {
return motherMID;
}
public void setMotherMID(String motherMID) {
this.motherMID = motherMID;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getSecurityAnswer() {
return securityAnswer;
}
public void setSecurityAnswer(String securityAnswer) {
this.securityAnswer = securityAnswer;
}
public String getSecurityQuestion() {
return securityQuestion;
}
public void setSecurityQuestion(String securityQuestion) {
this.securityQuestion = securityQuestion;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStreetAddress1() {
return streetAddress1;
}
public void setStreetAddress1(String streetAddress1) {
this.streetAddress1 = streetAddress1;
}
public String getStreetAddress2() {
return streetAddress2;
}
public void setStreetAddress2(String streetAddress2) {
this.streetAddress2 = streetAddress2;
}
// Composition of the city, state, zip
public String getStreetAddress3() {
return getCity() + ", " + getState() + " " + getZip();
}
public String getTopicalNotes() {
return topicalNotes;
}
public void setTopicalNotes(String topicalNotes) {
this.topicalNotes = topicalNotes;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getEmergencyPhone() {
return emergencyPhone;
}
public void setEmergencyPhone(String emergencyPhone) {
this.emergencyPhone = emergencyPhone;
}
public String getIcPhone() {
return icPhone;
}
public void setIcPhone(String icPhone) {
this.icPhone = icPhone;
}
public String getConfirmPassword() {
return confirmPassword;
}
public void setConfirmPassword(String confirmPassword) {
this.confirmPassword = confirmPassword;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDirectionsToHome() {
return directionsToHome;
}
public void setDirectionsToHome(String directionsToHome) {
this.directionsToHome = directionsToHome;
}
public String getReligion() {
return religion;
}
public void setReligion(String religion) {
this.religion = religion;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getSpiritualPractices() {
return spiritualPractices;
}
public void setSpiritualPractices(String spiritualPractices) {
this.spiritualPractices = spiritualPractices;
}
public String getAlternateName() {
return alternateName;
}
public void setAlternateName(String alternateName) {
this.alternateName = alternateName;
}
public String getDateOfDeactivationStr() {
return dateOfDeactivationStr;
}
public void setDateOfDeactivationStr(String dateOfDeactivationStr) {
this.dateOfDeactivationStr = dateOfDeactivationStr;
}
public int compareTo(PatientBean o) {
return (int)(o.MID-this.MID);
}
public int equals(PatientBean o) {
return (int)(o.MID-this.MID);
}
public int hashCode() {
assert false : "hashCode not designed";
return 42; // any arbitrary constant will do
}