-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatient.cpp
More file actions
73 lines (61 loc) · 1.83 KB
/
patient.cpp
File metadata and controls
73 lines (61 loc) · 1.83 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
#include "patient.h"
Patient::Patient(
const QString & f,
const QString & l,
const QString & father,
const QString & a,
const QDate & bD,
const QDate & arr,
QDate & le)
: _FirstName{f}, _LastName{l}, _FatherName{father}, _Address{a}
, _BirthDate{bD}, _ArriveDate{arr}, m_pLeaveDate{&le}, m_pPhotosVector{nullptr}
{
}
Patient::Patient(const Patient & p)
: id(p.id),
_FirstName(p._FirstName),
_LastName(p._LastName),
_FatherName(p._FatherName),
_Address(p._Address),
_BirthDate(p._BirthDate),
_ArriveDate(p._ArriveDate),
m_pLeaveDate(p.m_pLeaveDate)
{}
Patient::~Patient() {
if (m_pLeaveDate)
delete m_pLeaveDate;
}
const QString Patient::GetFullName() const {
QString str{};
str += _FirstName + " " + _LastName + " " + _FatherName;
return str;
}
void Patient::loadPhotos(std::vector<Photo*> * photos) {
if (!m_pPhotosVector)
m_pPhotosVector = photos;
else
Patient_Ex::PhotosAlreadyLoadedError().raise();
}
void Patient::clearPhotos() {
if (m_pPhotosVector)
for (Photo * pPhoto: * m_pPhotosVector)
delete pPhoto;
delete m_pPhotosVector;
m_pPhotosVector = nullptr;
}
const std::vector<Photo *> * Patient::Photos() const {
return m_pPhotosVector;
}
void Patient::DropPhoto(int row_num) {
m_pPhotosVector->erase(m_pPhotosVector->begin() + row_num);
}
void Patient::AddPhoto(Photo * pPhoto) {
m_pPhotosVector->push_back(pPhoto);
}
using namespace Patient_Ex;
BirthAndArriveDateLogicError::BirthAndArriveDateLogicError(const QDate & bdate,
const QDate & arrdate)
{
m_message += "Birth date '" + bdate.toString() + "' can't be less than ";
m_message += "arrive date '" + arrdate.toString() + "'.";
}