Search in sources :

Example 1 with DeviceVersionComponent

use of org.hl7.fhir.r4.model.Device.DeviceVersionComponent in project summary-care-record-api by NHSDigital.

the class DeviceMapper method mapDevice.

public Device mapDevice(Node deviceHl7) {
    Device deviceFhir = new Device();
    deviceFhir.setId(randomUUID());
    xmlUtils.getOptionalValueByXPath(deviceHl7, ID_EXTENSION_XPATH).ifPresent(id -> deviceFhir.addIdentifier().setValue(id));
    xmlUtils.detachOptionalNodeByXPath(deviceHl7, CODE_ELEMENT_XPATH).ifPresent(code -> deviceFhir.setType(new CodeableConcept(new Coding().setCode(xmlUtils.getValueByXPath(code, CODE_ATTRIBUTE_XPATH)).setDisplay(xmlUtils.getValueByXPath(code, CODE_DISPLAY_XPATH)))));
    addName(deviceHl7, deviceFhir, NAME_XPATH, OTHER);
    addName(deviceHl7, deviceFhir, MANUFACTURER_MODE_NAME_XPATH, MANUFACTURERNAME);
    xmlUtils.detachOptionalNodeByXPath(deviceHl7, DESCRIPTION_XPATH).ifPresent(descNode -> deviceFhir.addNote(new Annotation().setText(descNode.getTextContent())));
    xmlUtils.detachOptionalNodeByXPath(deviceHl7, SOFTWARE_NAME_XPATH).ifPresent(software -> deviceFhir.addVersion(new DeviceVersionComponent().setValue(software.getTextContent())));
    return deviceFhir;
}
Also used : DeviceVersionComponent(org.hl7.fhir.r4.model.Device.DeviceVersionComponent) Coding(org.hl7.fhir.r4.model.Coding) Device(org.hl7.fhir.r4.model.Device) Annotation(org.hl7.fhir.r4.model.Annotation) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Aggregations

Annotation (org.hl7.fhir.r4.model.Annotation)1 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)1 Coding (org.hl7.fhir.r4.model.Coding)1 Device (org.hl7.fhir.r4.model.Device)1 DeviceVersionComponent (org.hl7.fhir.r4.model.Device.DeviceVersionComponent)1