Fix bug when converting resolved clinical status for allergy intolerance dstu3 -> r4 (#793)
This commit is contained in:
parent
220f32a94b
commit
c4676c5dc9
|
@ -160,7 +160,7 @@ public class AllergyIntolerance30_40 {
|
|||
case INACTIVE:
|
||||
return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("inactive"));
|
||||
case RESOLVED:
|
||||
new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved"));
|
||||
return new org.hl7.fhir.r4.model.CodeableConcept(new org.hl7.fhir.r4.model.Coding().setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical").setCode("resolved"));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.conv30_40;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
public class AllergyIntolerance30_40Test {
|
||||
@Test
|
||||
@DisplayName("Test stu3 -> r4 conversion for AllergyIntolerance with resolved clinical status")
|
||||
public void test1() {
|
||||
// Given resource with dstu3 resource with resolved clinicalStatus
|
||||
org.hl7.fhir.dstu3.model.AllergyIntolerance dstu3Allergy = new org.hl7.fhir.dstu3.model.AllergyIntolerance();
|
||||
dstu3Allergy.setClinicalStatus(
|
||||
org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED);
|
||||
|
||||
// When convertor is called
|
||||
org.hl7.fhir.r4.model.Resource r4Resource = VersionConvertorFactory_30_40.convertResource(dstu3Allergy);
|
||||
|
||||
// Then r4 resource should have resolved clinicalStatus
|
||||
Assertions.assertTrue(r4Resource instanceof org.hl7.fhir.r4.model.AllergyIntolerance);
|
||||
org.hl7.fhir.r4.model.AllergyIntolerance r4Allergy = (org.hl7.fhir.r4.model.AllergyIntolerance) r4Resource;
|
||||
|
||||
List<org.hl7.fhir.r4.model.Coding> r4AllergyCodeableConcept = r4Allergy.getClinicalStatus().getCoding();
|
||||
Assertions.assertEquals(1, r4AllergyCodeableConcept.size());
|
||||
|
||||
String r4AllergyCode = r4AllergyCodeableConcept.get(0).getCode();
|
||||
Assertions.assertEquals("resolved", r4AllergyCode);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue