use of com.nedap.archie.rm.datavalues.quantity.ReferenceRange in project openEHR_SDK by ehrbase.
the class DvOrderedPostprocessor method process.
/**
* {@inheritDoc} Adds the encoding information
*/
@Override
public void process(String term, DvOrdered rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
if (rmObject.getNormalRange() != null) {
handleRange(term + "/_normal_range", values, rmObject.getNormalRange(), context);
}
IntStream.range(0, rmObject.getOtherReferenceRanges().size()).forEach(i -> {
ReferenceRange referenceRange = (ReferenceRange) rmObject.getOtherReferenceRanges().get(i);
if (referenceRange.getMeaning() != null) {
callMarshal(term, "_other_reference_ranges:" + i + "/meaning", referenceRange.getMeaning(), values, context, context.getNodeDeque().peek().findChildById("meaning").orElse(null));
callPostprocess(term, "_other_reference_ranges:" + i + "/meaning", referenceRange.getMeaning(), values, context, context.getNodeDeque().peek().findChildById("meaning").orElse(null));
}
if (referenceRange.getRange() != null) {
handleRange(term + "/_other_reference_ranges:" + i, values, referenceRange.getRange(), context);
}
});
addValue(values, term, "normal_status", Optional.ofNullable(rmObject.getNormalStatus()).map(CodePhrase::getCodeString).orElse(null));
}
use of com.nedap.archie.rm.datavalues.quantity.ReferenceRange in project openEHR_SDK by ehrbase.
the class DvOrderedPostprocessor method process.
/**
* {@inheritDoc}
*/
@Override
public void process(String term, DvOrdered rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
handleNormalRange(values, consumedPaths, context, term + "/_normal_range", rmObject::setNormalRange);
FlatHelper.extractMultiValuedFullPath(term, "_other_reference_ranges", values).forEach((k, v) -> {
ReferenceRange referenceRange = new ReferenceRange();
rmObject.addOtherReferenceRange(referenceRange);
Map<FlatPathDto, String> meaningValues = FlatHelper.filter(values, term + "/_other_reference_ranges:" + k + "/meaning", false);
if (!meaningValues.isEmpty()) {
final DvText meaning;
String meaningAttributeName = "meaning";
boolean isDvCodedText = isDvCodedText(meaningValues, term + "/_other_reference_ranges:" + k + "/meaning");
if (isDvCodedText) {
meaning = new DvCodedText();
} else {
meaning = new DvText();
}
referenceRange.setMeaning(meaning);
callUnmarshal(term + "/_other_reference_ranges:" + k, meaningAttributeName, meaning, meaningValues, consumedPaths, context, context.getNodeDeque().peek().findChildById(meaningAttributeName).orElse(buildDummyChild(meaningAttributeName, context.getNodeDeque().peek())));
callPostProcess(term + "/_other_reference_ranges:" + k, meaningAttributeName, meaning, meaningValues, consumedPaths, context, context.getNodeDeque().peek().findChildById(meaningAttributeName).orElse(buildDummyChild(meaningAttributeName, context.getNodeDeque().peek())));
}
handleNormalRange(v, consumedPaths, context, term + "/_other_reference_ranges:" + k, referenceRange::setRange);
});
setValue(term, "normal_status", values, s -> {
if (s != null) {
rmObject.setNormalStatus(new CodePhrase(new TerminologyId("openehr_normal_statuses"), s));
}
}, String.class, consumedPaths);
}
Aggregations