fixed conversion for Device (#355)

This commit is contained in:
Mark Iantorno 2020-09-23 07:01:24 -04:00 committed by GitHub
parent b8370f7e61
commit 8eeffb8979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 370 additions and 84 deletions

View File

@ -4,90 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.hl7.fhir.convertors.conv30_40.Account30_40;
import org.hl7.fhir.convertors.conv30_40.ActivityDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.AllergyIntolerance30_40;
import org.hl7.fhir.convertors.conv30_40.Appointment30_40;
import org.hl7.fhir.convertors.conv30_40.AppointmentResponse30_40;
import org.hl7.fhir.convertors.conv30_40.AuditEvent30_40;
import org.hl7.fhir.convertors.conv30_40.Basic30_40;
import org.hl7.fhir.convertors.conv30_40.Binary30_40;
import org.hl7.fhir.convertors.conv30_40.BodySite30_40;
import org.hl7.fhir.convertors.conv30_40.Bundle30_40;
import org.hl7.fhir.convertors.conv30_40.CapabilityStatement30_40;
import org.hl7.fhir.convertors.conv30_40.CarePlan30_40;
import org.hl7.fhir.convertors.conv30_40.CareTeam30_40;
import org.hl7.fhir.convertors.conv30_40.ClinicalImpression30_40;
import org.hl7.fhir.convertors.conv30_40.CodeSystem30_40;
import org.hl7.fhir.convertors.conv30_40.Communication30_40;
import org.hl7.fhir.convertors.conv30_40.CompartmentDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.Composition30_40;
import org.hl7.fhir.convertors.conv30_40.ConceptMap30_40;
import org.hl7.fhir.convertors.conv30_40.Condition30_40;
import org.hl7.fhir.convertors.conv30_40.Consent30_40;
import org.hl7.fhir.convertors.conv30_40.Coverage30_40;
import org.hl7.fhir.convertors.conv30_40.DataElement30_40;
import org.hl7.fhir.convertors.conv30_40.DetectedIssue30_40;
import org.hl7.fhir.convertors.conv30_40.DeviceUseStatement30_40;
import org.hl7.fhir.convertors.conv30_40.DiagnosticReport30_40;
import org.hl7.fhir.convertors.conv30_40.DocumentReference30_40;
import org.hl7.fhir.convertors.conv30_40.Encounter30_40;
import org.hl7.fhir.convertors.conv30_40.Endpoint30_40;
import org.hl7.fhir.convertors.conv30_40.EpisodeOfCare30_40;
import org.hl7.fhir.convertors.conv30_40.ExpansionProfile30_40;
import org.hl7.fhir.convertors.conv30_40.FamilyMemberHistory30_40;
import org.hl7.fhir.convertors.conv30_40.Flag30_40;
import org.hl7.fhir.convertors.conv30_40.Goal30_40;
import org.hl7.fhir.convertors.conv30_40.GraphDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.Group30_40;
import org.hl7.fhir.convertors.conv30_40.HealthcareService30_40;
import org.hl7.fhir.convertors.conv30_40.ImagingStudy30_40;
import org.hl7.fhir.convertors.conv30_40.Immunization30_40;
import org.hl7.fhir.convertors.conv30_40.ImplementationGuide30_40;
import org.hl7.fhir.convertors.conv30_40.Library30_40;
import org.hl7.fhir.convertors.conv30_40.Linkage30_40;
import org.hl7.fhir.convertors.conv30_40.List30_40;
import org.hl7.fhir.convertors.conv30_40.Location30_40;
import org.hl7.fhir.convertors.conv30_40.Media30_40;
import org.hl7.fhir.convertors.conv30_40.Medication30_40;
import org.hl7.fhir.convertors.conv30_40.MedicationAdministration30_40;
import org.hl7.fhir.convertors.conv30_40.MedicationDispense30_40;
import org.hl7.fhir.convertors.conv30_40.MedicationRequest30_40;
import org.hl7.fhir.convertors.conv30_40.MedicationStatement30_40;
import org.hl7.fhir.convertors.conv30_40.MessageDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.MessageHeader30_40;
import org.hl7.fhir.convertors.conv30_40.NamingSystem30_40;
import org.hl7.fhir.convertors.conv30_40.Observation30_40;
import org.hl7.fhir.convertors.conv30_40.OperationDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.OperationOutcome30_40;
import org.hl7.fhir.convertors.conv30_40.Organization30_40;
import org.hl7.fhir.convertors.conv30_40.Parameters30_40;
import org.hl7.fhir.convertors.conv30_40.Patient30_40;
import org.hl7.fhir.convertors.conv30_40.PaymentNotice30_40;
import org.hl7.fhir.convertors.conv30_40.Person30_40;
import org.hl7.fhir.convertors.conv30_40.PlanDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.Practitioner30_40;
import org.hl7.fhir.convertors.conv30_40.PractitionerRole30_40;
import org.hl7.fhir.convertors.conv30_40.Procedure30_40;
import org.hl7.fhir.convertors.conv30_40.ProcedureRequest30_40;
import org.hl7.fhir.convertors.conv30_40.Provenance30_40;
import org.hl7.fhir.convertors.conv30_40.Questionnaire30_40;
import org.hl7.fhir.convertors.conv30_40.QuestionnaireResponse30_40;
import org.hl7.fhir.convertors.conv30_40.RelatedPerson30_40;
import org.hl7.fhir.convertors.conv30_40.RiskAssessment30_40;
import org.hl7.fhir.convertors.conv30_40.Schedule30_40;
import org.hl7.fhir.convertors.conv30_40.SearchParameter30_40;
import org.hl7.fhir.convertors.conv30_40.Sequence30_40;
import org.hl7.fhir.convertors.conv30_40.Slot30_40;
import org.hl7.fhir.convertors.conv30_40.Specimen30_40;
import org.hl7.fhir.convertors.conv30_40.StructureDefinition30_40;
import org.hl7.fhir.convertors.conv30_40.StructureMap30_40;
import org.hl7.fhir.convertors.conv30_40.Subscription30_40;
import org.hl7.fhir.convertors.conv30_40.Substance30_40;
import org.hl7.fhir.convertors.conv30_40.SupplyDelivery30_40;
import org.hl7.fhir.convertors.conv30_40.TestReport30_40;
import org.hl7.fhir.convertors.conv30_40.TestScript30_40;
import org.hl7.fhir.convertors.conv30_40.ValueSet30_40;
import org.hl7.fhir.convertors.conv30_40.*;
import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
import org.hl7.fhir.exceptions.FHIRException;
@ -5164,6 +5081,8 @@ public class VersionConvertor_30_40 {
return Coverage30_40.convertCoverage((org.hl7.fhir.r4.model.Coverage) src);
if (src instanceof org.hl7.fhir.r4.model.DetectedIssue)
return DetectedIssue30_40.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src);
if (src instanceof org.hl7.fhir.r4.model.Device)
return Device30_40.convertDevice((org.hl7.fhir.r4.model.Device) src);
if (src instanceof org.hl7.fhir.r4.model.DeviceUseStatement)
return DeviceUseStatement30_40.convertDeviceUseStatement((org.hl7.fhir.r4.model.DeviceUseStatement) src);
if (src instanceof org.hl7.fhir.r4.model.DiagnosticReport)

View File

@ -0,0 +1,258 @@
package org.hl7.fhir.convertors.conv30_40;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.dstu3.model.Device;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Patient;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
public class Device30_40 extends VersionConvertor_30_40 {
public static org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.Device tgt = new org.hl7.fhir.r4.model.Device();
copyDomainResource(src, tgt);
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
if (src.hasUdi()) {
org.hl7.fhir.r4.model.Device.DeviceUdiCarrierComponent carrierComponent = tgt.getUdiCarrierFirstRep();
carrierComponent.setDeviceIdentifierElement(VersionConvertor_30_40.convertString(src.getUdi().getDeviceIdentifierElement()));
carrierComponent.setJurisdictionElement(VersionConvertor_30_40.convertUri(src.getUdi().getJurisdictionElement()));
carrierComponent.setCarrierHRFElement(VersionConvertor_30_40.convertString(src.getUdi().getCarrierHRFElement()));
carrierComponent.setCarrierAIDCElement(VersionConvertor_30_40.convertBase64Binary(src.getUdi().getCarrierAIDCElement()));
carrierComponent.setIssuerElement(VersionConvertor_30_40.convertUri(src.getUdi().getIssuerElement()));
carrierComponent.setEntryTypeElement(convertUDIEntryType(src.getUdi().getEntryTypeElement()));
tgt.setUdiCarrier(Collections.singletonList(carrierComponent));
org.hl7.fhir.r4.model.Device.DeviceDeviceNameComponent nameComponent = tgt.getDeviceNameFirstRep();
nameComponent.setNameElement(VersionConvertor_30_40.convertString(src.getUdi().getNameElement()));
nameComponent.setType(org.hl7.fhir.r4.model.Device.DeviceNameType.UDILABELNAME);
}
if (src.hasStatus())
tgt.setStatusElement(convertFHIRDeviceStatus(src.getStatusElement()));
if (src.hasType())
tgt.setType(convertCodeableConcept(src.getType()));
if (src.hasLotNumber())
tgt.setLotNumberElement(convertString(src.getLotNumberElement()));
if (src.hasManufacturer())
tgt.setManufacturerElement(convertString(src.getManufacturerElement()));
if (src.hasManufactureDate())
tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement()));
if (src.hasExpirationDate())
tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement()));
if (src.hasModelElement())
tgt.setModelNumberElement(VersionConvertor_30_40.convertString(src.getModelElement()));
if (src.hasVersionElement())
tgt.setVersion(Collections.singletonList(tgt.getVersionFirstRep().setValueElement(VersionConvertor_30_40.convertString(src.getVersionElement()))));
if (src.hasPatient())
tgt.setPatient(convertReference(src.getPatient()));
if (src.hasOwner())
tgt.setOwner(convertReference(src.getOwner()));
if (src.hasContact())
tgt.setContact(src.getContact().stream().map(VersionConvertor_30_40::convertContactPoint).collect(Collectors.toList()));
if (src.hasLocation())
tgt.setLocation(convertReference(src.getLocation()));
if (src.hasUrl())
tgt.setUrlElement(convertUri(src.getUrlElement()));
for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSafety()) tgt.addSafety(convertCodeableConcept(t));
return tgt;
}
public static org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.r4.model.Device src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device();
copyDomainResource(src, tgt);
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
if (src.hasUdiCarrier()) {
Device.DeviceUdiComponent udi = tgt.getUdi();
udi.setDeviceIdentifierElement(VersionConvertor_30_40.convertString(src.getUdiCarrierFirstRep().getDeviceIdentifierElement()));
udi.setJurisdictionElement(VersionConvertor_30_40.convertUri(src.getUdiCarrierFirstRep().getJurisdictionElement()));
udi.setCarrierHRFElement(VersionConvertor_30_40.convertString(src.getUdiCarrierFirstRep().getCarrierHRFElement()));
udi.setCarrierAIDCElement(VersionConvertor_30_40.convertBase64Binary(src.getUdiCarrierFirstRep().getCarrierAIDCElement()));
udi.setIssuerElement(VersionConvertor_30_40.convertUri(src.getUdiCarrierFirstRep().getIssuerElement()));
udi.setEntryTypeElement(convertUDIEntryType(src.getUdiCarrierFirstRep().getEntryTypeElement()));
tgt.setUdi(udi);
}
if (src.hasStatus())
tgt.setStatusElement(convertFHIRDeviceStatus(src.getStatusElement()));
if (src.hasType())
tgt.setType(convertCodeableConcept(src.getType()));
if (src.hasLotNumber())
tgt.setLotNumberElement(convertString(src.getLotNumberElement()));
if (src.hasManufacturer())
tgt.setManufacturerElement(convertString(src.getManufacturerElement()));
if (src.hasManufactureDate())
tgt.setManufactureDateElement(convertDateTime(src.getManufactureDateElement()));
if (src.hasExpirationDate())
tgt.setExpirationDateElement(convertDateTime(src.getExpirationDateElement()));
if (src.hasModelNumber())
tgt.setModel(src.getModelNumber());
if (src.hasVersion())
tgt.setVersionElement(VersionConvertor_30_40.convertString(src.getVersion().get(0).getValueElement()));
if (src.hasDeviceName())
tgt.setUdi(tgt.getUdi().setName(src.getDeviceName().get(0).getName()));
if (src.hasPatient())
tgt.setPatient(convertReference(src.getPatient()));
if (src.hasOwner())
tgt.setOwner(convertReference(src.getOwner()));
if (src.hasContact())
tgt.setContact(src.getContact().stream().map(VersionConvertor_30_40::convertContactPoint).collect(Collectors.toList()));
if (src.hasLocation())
tgt.setLocation(convertReference(src.getLocation()));
for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) tgt.addContact(convertContactPoint(t));
if (src.hasLocation())
tgt.setLocation(VersionConvertor_30_40.convertReference(src.getLocation()));
if (src.hasUrl())
tgt.setUrlElement(convertUri(src.getUrlElement()));
for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSafety()) tgt.addSafety(convertCodeableConcept(t));
return tgt;
}
static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.FHIRDeviceStatus> convertFHIRDeviceStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.FHIRDeviceStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Device.FHIRDeviceStatusEnumFactory());
VersionConvertor_30_40.copyElement(src, tgt);
switch (src.getValue()) {
case ACTIVE:
tgt.setValue(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE);
break;
case INACTIVE:
tgt.setValue(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus> convertFHIRDeviceStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.FHIRDeviceStatus> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatusEnumFactory());
VersionConvertor_30_40.copyElement(src, tgt);
switch (src.getValue()) {
case ACTIVE:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE);
break;
case INACTIVE:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.UDIEntryType> convertUDIEntryType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.UDIEntryType> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.UDIEntryType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Device.UDIEntryTypeEnumFactory());
VersionConvertor_30_40.copyElement(src, tgt);
switch (src.getValue()) {
case BARCODE:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.BARCODE);
break;
case RFID:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.RFID);
break;
case MANUAL:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.MANUAL);
break;
case CARD:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.CARD);
break;
case SELFREPORTED:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.SELFREPORTED);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.r4.model.Device.UDIEntryType.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.UDIEntryType> convertUDIEntryType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Device.UDIEntryType> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Device.UDIEntryType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Device.UDIEntryTypeEnumFactory());
VersionConvertor_30_40.copyElement(src, tgt);
switch (src.getValue()) {
case BARCODE:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.BARCODE);
break;
case RFID:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.RFID);
break;
case MANUAL:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.MANUAL);
break;
case CARD:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.CARD);
break;
case SELFREPORTED:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.SELFREPORTED);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.Device.UDIEntryType.NULL);
break;
}
return tgt;
}
}

View File

@ -0,0 +1,43 @@
package org.hl7.fhir.convertors.conv30_40;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
public class Device30_40Test {
@Test
@DisplayName("Test r4 -> dstu3 device conversion.")
public void test1() throws IOException {
InputStream r4_input = this.getClass().getResourceAsStream("/0_device_40.json");
InputStream dstu3_expected_output = this.getClass().getResourceAsStream("/0_device_30.json");
org.hl7.fhir.r4.model.Device r4_actual = (org.hl7.fhir.r4.model.Device) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input);
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertor_30_40.convertResource(r4_actual, true);
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
org.hl7.fhir.dstu3.model.Resource dstu3_expected = dstu3_parser.parse(dstu3_expected_output);
Assertions.assertTrue(dstu3_expected.equalsDeep(dstu3_conv),
"Failed comparing\n" + dstu3_parser.composeString(dstu3_expected) + "\nand\n" + dstu3_parser.composeString(dstu3_conv));
}
@Test
@DisplayName("Test r4 -> dstu3 device conversion, part 2.")
public void test2() throws IOException {
InputStream r4_input = this.getClass().getResourceAsStream("/1_device_40.json");
InputStream dstu3_expected_output = this.getClass().getResourceAsStream("/1_device_30.json");
org.hl7.fhir.r4.model.Device r4_actual = (org.hl7.fhir.r4.model.Device) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_input);
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertor_30_40.convertResource(r4_actual, true);
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
org.hl7.fhir.dstu3.model.Resource dstu3_expected = dstu3_parser.parse(dstu3_expected_output);
Assertions.assertTrue(dstu3_expected.equalsDeep(dstu3_conv),
"Failed comparing\n" + dstu3_parser.composeString(dstu3_expected) + "\nand\n" + dstu3_parser.composeString(dstu3_expected));
}
}

View File

@ -0,0 +1,13 @@
{
"resourceType": "Device",
"id": "DEV000000000872",
"identifier": [
{
"system": "https://fresenius.org/device",
"value": "DEV000000000872"
}
],
"udi": {
"name": "LC021691"
}
}

View File

@ -0,0 +1,20 @@
{
"resourceType": "Device",
"id": "DEV000000000872",
"identifier": [
{
"system": "https://fresenius.org/device",
"value": "DEV000000000872"
}
],
"definition": {
"reference": "Dialysis"
},
"serialNumber": "LC021691",
"deviceName": [
{
"name": "LC021691",
"type": "manufacturer-name"
}
]
}

View File

@ -0,0 +1,13 @@
{
"resourceType": "Device",
"id": "DEV000000000873",
"identifier": [
{
"system": "https://fresenius.org/device",
"value": "DEV000000000873"
}
],
"udi": {
"name": "LC020678"
}
}

View File

@ -0,0 +1,20 @@
{
"resourceType": "Device",
"id": "DEV000000000873",
"identifier": [
{
"system": "https://fresenius.org/device",
"value": "DEV000000000873"
}
],
"definition": {
"reference": "Dialysis"
},
"serialNumber": "LC020678",
"deviceName": [
{
"name": "LC020678",
"type": "manufacturer-name"
}
]
}