-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
ConceptNumeric.java
241 lines (197 loc) · 5.69 KB
/
ConceptNumeric.java
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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
/**
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs;
import org.simpleframework.xml.Attribute;
/**
* The ConceptNumeric extends upon the Concept object by adding some number range values
*
* @see Concept
*/
public class ConceptNumeric extends Concept implements java.io.Serializable {
public static final long serialVersionUID = 47323L;
// Fields
private Double hiAbsolute;
private Double hiCritical;
private Double hiNormal;
private Double lowAbsolute;
private Double lowCritical;
private Double lowNormal;
private String units;
private Boolean precise = false;
// Constructors
/** default constructor */
public ConceptNumeric() {
}
/**
* Generic constructor taking the primary key
*
* @param conceptId key for this numeric concept
*/
public ConceptNumeric(Integer conceptId) {
setConceptId(conceptId);
}
/**
* Optional constructor for turning a Concept into a ConceptNumeric <br/>
* <br/>
* Note: This cannot copy over numeric specific values
*
*
* @param c
* @should make deep copie of collections
* @should change reference to the parent object for objects in answers collection
* @should change reference to the parent object for objects in concpetSets collection
* @should change reference to the parent object for objects in names collection
* @should change reference to the parent object for objects in descriptions collection
* @should change reference to the parent object for objects in conceptMappings collection
*/
public ConceptNumeric(Concept c) {
this.setUuid(c.getUuid());
this.getAnswers().addAll(c.getAnswers());
for (ConceptAnswer cAnswer : this.getAnswers())
cAnswer.setConcept(this);
this.setChangedBy(c.getChangedBy());
this.setConceptClass(c.getConceptClass());
this.setConceptId(c.getConceptId());
this.getConceptSets().addAll(c.getConceptSets());
for (ConceptSet cSet : this.getConceptSets())
cSet.setConcept(this);
this.setCreator(c.getCreator());
this.setDatatype(c.getDatatype());
this.setDateChanged(c.getDateChanged());
this.setDateCreated(c.getDateCreated());
this.setSet(c.getSet());
this.getNames().addAll(c.getNames());
for (ConceptName cName : this.getNames())
cName.setConcept(this);
this.getDescriptions().addAll(c.getDescriptions());
for (ConceptDescription cDesciption : this.getDescriptions())
cDesciption.setConcept(this);
this.getConceptMappings().addAll(c.getConceptMappings());
for (ConceptMap cMap : this.getConceptMappings())
cMap.setConcept(this);
this.setRetired(c.isRetired());
this.setRetiredBy(c.getRetiredBy());
this.setRetireReason(c.getRetireReason());
this.setVersion(c.getVersion());
this.setVersion(c.getVersion());
this.setDateCreated(c.getDateCreated());
this.hiAbsolute = null;
this.hiCritical = null;
this.hiNormal = null;
this.lowAbsolute = null;
this.lowCritical = null;
this.lowNormal = null;
this.units = "";
this.precise = false;
}
// Property accessors
/**
*
*/
@Attribute(required = false)
public Double getHiAbsolute() {
return this.hiAbsolute;
}
@Attribute(required = false)
public void setHiAbsolute(Double hiAbsolute) {
this.hiAbsolute = hiAbsolute;
}
/**
*
*/
@Attribute(required = false)
public Double getHiCritical() {
return this.hiCritical;
}
@Attribute(required = false)
public void setHiCritical(Double hiCritical) {
this.hiCritical = hiCritical;
}
/**
*
*/
@Attribute(required = false)
public Double getHiNormal() {
return this.hiNormal;
}
@Attribute(required = false)
public void setHiNormal(Double hiNormal) {
this.hiNormal = hiNormal;
}
/**
*
*/
@Attribute(required = false)
public Double getLowAbsolute() {
return this.lowAbsolute;
}
@Attribute(required = false)
public void setLowAbsolute(Double lowAbsolute) {
this.lowAbsolute = lowAbsolute;
}
/**
*
*/
@Attribute(required = false)
public Double getLowCritical() {
return this.lowCritical;
}
@Attribute(required = false)
public void setLowCritical(Double lowCritical) {
this.lowCritical = lowCritical;
}
/**
*
*/
@Attribute(required = false)
public Double getLowNormal() {
return this.lowNormal;
}
@Attribute(required = false)
public void setLowNormal(Double lowNormal) {
this.lowNormal = lowNormal;
}
/**
*
*/
@Attribute(required = false)
public String getUnits() {
return this.units;
}
@Attribute(required = false)
public void setUnits(String units) {
this.units = units;
}
public Boolean isPrecise() {
return (precise == null ? false : precise);
}
@Attribute
public Boolean getPrecise() {
return isPrecise();
}
@Attribute
public void setPrecise(Boolean precise) {
this.precise = precise;
}
/**
* This method will <i>always</i> return true for ConceptNumeric objects that have a datatype of
* Numeric
*
* @see org.openmrs.Concept#isNumeric()
*/
@Override
public boolean isNumeric() {
return (getDatatype().getName().equals("Numeric"));
}
}