PatientModel.java
2.71 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
package com.sw.laryngoscope.FHIR.model;
import android.text.format.DateFormat;
import com.sw.laryngoscope.FHIR.model.observation.BloodPressureObservationModel;
import com.sw.laryngoscope.FHIR.model.observation.ObservationModel;
import com.sw.laryngoscope.FHIR.model.observation.ObservationType;
import org.hl7.fhir.r4.model.Enumerations;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
public class PatientModel {
private String patientID;
private String name;
private Date birthDate;
private Enumerations.AdministrativeGender gender;
private PatientAddressModel address;
private HashMap<ObservationType, ObservationModel> observationReadings;
private HashMap<ObservationType, Boolean> isMonitored;
private ArrayList<BloodPressureObservationModel> latestBPReadings;
/**
* Constructor
* @param patientID Unique patient ID from the FHIR server
* @param name name of the patient
*/
public PatientModel(String patientID, String name, Date birthDate, Enumerations.AdministrativeGender gender, PatientAddressModel address) {
this.patientID = patientID;
this.name = name;
this.birthDate = birthDate;
this.gender = gender;
this.address = address;
observationReadings = new HashMap<>();
isMonitored = new HashMap<>();
latestBPReadings = new ArrayList<>();
initialiseMonitoredObservations();
}
public String getPatientID() {
return patientID;
}
public String getName() {
return name;
}
public String getBirthDate() {
return DateFormat.format("yyyy.MM.dd", birthDate).toString();
}
public String getGender() {
return gender.toString();
}
public PatientAddressModel getAddress() {
return address;
}
public void setObservation(ObservationType type, ObservationModel observation) {
observationReadings.put(type, observation);
}
public ObservationModel getObservationReading(ObservationType type) {
return observationReadings.get(type);
}
public void monitorObservation(ObservationType type, Boolean check) {
isMonitored.put(type, check);
}
public Boolean isObservationMonitored(ObservationType type) {
return isMonitored.get(type);
}
private void initialiseMonitoredObservations() {
for (ObservationType type: ObservationType.values()) {
monitorObservation(type, false);
}
}
public void addLatestBPReadings(ArrayList<BloodPressureObservationModel> readings) {
latestBPReadings = readings;
}
public ArrayList<BloodPressureObservationModel> getLatestBPReadings() {
return latestBPReadings;
}
}