-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatient.cpp
More file actions
115 lines (104 loc) · 3.13 KB
/
Copy pathPatient.cpp
File metadata and controls
115 lines (104 loc) · 3.13 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
#include "Patient.h"
Patient::Patient()
{
unique_id = 0;
age = 0;
age_unit = TimeUnitEnum::years;
first_name = "";
last_name = "";
street_addr = "";
city = "";
zip_code = "";
phone_number = "";
insurance_name = "";
phone_type = PhoneTypeEnum::Other;
state = "";
med_list = {};
}
Patient::Patient(unsigned int id, unsigned short int agenum, TimeUnitEnum ageunit, std::string fname, std::string lname,
std::string addr, std::string cty, std::string zip, std::string phnum,
std::string insname, PhoneTypeEnum phtype, std::string st, std::vector<Medication*>* medlist)
{
unique_id = id;
age = agenum;
age_unit = ageunit;
first_name = fname;
last_name = lname;
street_addr = addr;
city = cty;
zip_code = zip;
phone_number = phnum;
insurance_name = insname;
phone_type = phtype;
state = st;
if(medlist) med_list = *medlist;
}
void Patient::addMedToList(Medication* m)
{
if (m == nullptr)
{
std::cout << "Nullptr medication in addMedToList(), exiting." << std::endl;
exit(-1);
}
med_list.push_back(m);
}
void Patient::delMedFromList(unsigned int id)
{
if (id == 0) return;
for (int i = 0; i < med_list.size(); i++)
{
if (med_list[i]->getUniqueID() == id)
{
delete(med_list[i]);
med_list.erase(med_list.begin() + i);
break;
}
}
}
unsigned int Patient::getUniqueID() { return unique_id; }
unsigned short int Patient::getAge() { return age; }
TimeUnitEnum Patient::getAgeUnit() { return age_unit; }
std::string Patient::getFirstName() { return first_name; }
std::string Patient::getLastName() { return last_name; }
std::string Patient::getStreetAddr() { return street_addr; }
std::string Patient::getCity() { return city; }
std::string Patient::getZipCode() { return zip_code; }
std::string Patient::getPhoneNum() { return phone_number; }
std::string Patient::getInsuranceName() { return insurance_name; }
PhoneTypeEnum Patient::getPhoneType() { return phone_type; }
std::string Patient::getState() { return state; }
std::vector<Medication*>* Patient::getMedList() { return &med_list; }
void Patient::setUniqueID(unsigned int val) { unique_id = val; }
void Patient::setAge(unsigned short int val) { age = val; }
void Patient::setAgeUnit(TimeUnitEnum val) { age_unit = val; }
void Patient::setFirstName(std::string val) { first_name = val; }
void Patient::setLastName(std::string val) { last_name = val; }
void Patient::setStreetAddr(std::string val) { street_addr = val; }
void Patient::setCity(std::string val) { city = val; }
void Patient::setZipCode(std::string val) { zip_code = val; }
void Patient::setPhoneNum(std::string val) { phone_number = val; }
void Patient::setInsuranceName(std::string val) { insurance_name = val; }
void Patient::setPhoneType(PhoneTypeEnum val) { phone_type = val; }
void Patient::setState(std::string val) { state = val; }
void Patient::setMedList(std::vector<Medication*>* val)
{
if (val == nullptr)
{
wxLogDebug("Warning: Nullptr in setMedList() in Patient class. Cannot set medication list.");
return;
}
deleteMedList();
med_list = *val;
}
void Patient::deleteMedList()
{
for (int i = 0; i < med_list.size(); i++)
{
delete(med_list[i]);
}
med_list.clear();
}
Patient::~Patient()
{
deleteMedList();
}