-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlabvalue.cpp
More file actions
127 lines (118 loc) · 4.26 KB
/
labvalue.cpp
File metadata and controls
127 lines (118 loc) · 4.26 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
#include "labvalue.h"
LabValue::LabValue(QString line)
{
//qDebug() << "Creating new Single Lab Value: " << line;
QStringList split = line.split("\t");
if(split.length()<2) {
this->success = false;
return;
}
//qDebug() << "split is: " << split;
this->isPassthrough = false;
this->param = split[0];
this->paramName = split[1];
this->value = split[2];
this->unit = split[3];
this->flag = split[4];
this->reference = split[5];
this->status = split[6];
this->unused = split[7];
this->comment = split[8]; // Comment in single view
this->value = this->value.remove("<").remove(">").remove("(").remove(")").remove("?").simplified();
QStringList passThrough;
passThrough << "Mat. fehlt" << "entfällt" << "folgt" << "s. Bem" << "s.u." << "folgt";
if(passThrough.contains(this->value)) {
//qDebug() << "parameter: " << paramName << " is passThrough";
this->success = true;
this->isPassthrough = true;
return;
} else {
QList<QString> urineParams;
urineParams.append("9LEUU");
urineParams << "9HBU" << "9BILU" << "9UROU" << "9TPU" << "9KETU" << "9NITU" << "9GLUU";
//if(this->value != "+" && !urineParams.contains(this->param))
// this->value = this->value.remove("+");
if(urineParams.contains(this->param)) {
int level = this->value.count("+");
if(level>0)
this->value = QString::number(level);
}
if(this->value.endsWith("-"))
this->value = this->value.remove("-");
//qDebug() << "p: " << this->param << "output: " << this->value;
if(this->param == "9ALBO") {
// mg/dl statt g/dl! FAKTOR 1000!
double albo = this->value.toDouble();
albo /= 1000;
//qDebug() << "output is now: " << this->value;
//qDebug() << "albo is now: " << albo;
this->value = QString::number(albo);
//qDebug() << "output is now: " << this->value;
}
this->success = true;
}
}
LabValue::LabValue(QString parameter, QString paramName, QString unit, QString refRange, QString value) {
this->param = parameter;
this->paramName = paramName;
this->unit = unit;
this->reference = refRange;
this->isPassthrough = false;
if(value.length() == 0)
{
this->success = false;
return;
}
QStringList passThrough;
passThrough << "Mat. fehlt" << "entfällt" << "folgt" << "s. Bem" << "s.u." << "folgt";
value = value.remove("<").remove(">").remove("(").remove(")").remove("?").simplified();
if(passThrough.contains(value)) {
//qDebug() << "parameter: " << paramName << " is passThrough";
this->value = value;
this->success = true;
this->flag = "";
this->isPassthrough = true;
return;
} else {
QStringList vsplit = value.split(" ");
//qDebug() << "value: " << value << " numsplit: " << vsplit.length();
this->value = vsplit[0];
if(this->param == "9ALBO") {
// mg/dl statt g/dl! FAKTOR 1000!
double albo = this->value.toDouble();
albo /= 1000;
//qDebug() << "output is now: " << this->value;
//qDebug() << "albo is now: " << albo;
this->value = QString::number(albo);
//qDebug() << "output is now: " << this->value;
}
if(vsplit.length()==2)
this->flag = vsplit[1];
else
this->flag = "";
QList<QString> urineParams;
urineParams.append("9LEUU");
urineParams << "9HBU" << "9BILU" << "9UROU" << "9TPU" << "9KETU" << "9NITU" << "9GLUU";
if(urineParams.contains(this->param)) {
int level = this->value.count("+");
if(level>0)
this->value = QString::number(level);
}
this->success = true;
return;
}
}
QString LabValue::getValue(int delim) {
QString output = this->value;
if(output=="s. Bem" || output == "Mat. fehlt" || output == "s.u.")
return output;
if(delim== 0){
output = output.replace(".",",");
} else {
output = output.replace(",",".");
}
return output;
}
QString LabValue::getValue() {
return this->value;
}