Search in sources :

Example 26 with RCMRMT030101UK04EhrExtract

use of org.hl7.v3.RCMRMT030101UK04EhrExtract in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConditionMapperTest method testConditionIsMappedCorrectlyWithRelatedClinicalContentReference.

@Test
public void testConditionIsMappedCorrectlyWithRelatedClinicalContentReference() {
    when(dateTimeMapper.mapDateTime(any())).thenReturn(EHR_EXTRACT_AVAILABILITY_DATETIME);
    final RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("linkset_valid.xml");
    final List<Condition> conditions = conditionMapper.mapResources(ehrExtract, patient, List.of(), PRACTISE_CODE);
    conditionMapper.addReferences(buildBundleWithStatementRefObservations(), conditions, ehrExtract);
    assertThat(conditions).isNotEmpty();
    assertThat(conditions.get(0).getExtensionsByUrl(RELATED_CLINICAL_CONTENT_URL)).isNotEmpty();
    assertRelatedClinicalContentExtension(conditions.get(0));
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) RCMRMT030101UK04EhrExtract(org.hl7.v3.RCMRMT030101UK04EhrExtract) Test(org.junit.jupiter.api.Test)

Example 27 with RCMRMT030101UK04EhrExtract

use of org.hl7.v3.RCMRMT030101UK04EhrExtract in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConditionMapperTest method testLinkSetWithNoDatesIsMappedCorrectly.

@Test
public void testLinkSetWithNoDatesIsMappedCorrectly() {
    final RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("linkset_no_dates.xml");
    final List<Condition> conditions = conditionMapper.mapResources(ehrExtract, patient, List.of(), PRACTISE_CODE);
    assertGeneratedComponentsAreCorrect(conditions.get(0));
    assertThat(conditions.get(0).getId()).isEqualTo(LINKSET_ID);
    assertThat(conditions.get(0).getClinicalStatus().getDisplay()).isEqualTo("Inactive");
    assertThat(conditions.get(0).getAbatementDateTimeType()).isNull();
    assertThat(conditions.get(0).getAssertedDateElement().getValue()).isEqualTo(EHR_EXTRACT_AVAILABILITY_DATETIME.getValue());
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) RCMRMT030101UK04EhrExtract(org.hl7.v3.RCMRMT030101UK04EhrExtract) Test(org.junit.jupiter.api.Test)

Example 28 with RCMRMT030101UK04EhrExtract

use of org.hl7.v3.RCMRMT030101UK04EhrExtract in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConditionMapperTest method testConditionIsMappedCorrectlyWithActualProblemReference.

@Test
public void testConditionIsMappedCorrectlyWithActualProblemReference() {
    when(dateTimeMapper.mapDateTime(any())).thenReturn(EHR_EXTRACT_AVAILABILITY_DATETIME);
    final RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("linkset_valid.xml");
    final List<Condition> conditions = conditionMapper.mapResources(ehrExtract, patient, List.of(), PRACTISE_CODE);
    conditionMapper.addReferences(buildBundleWithNamedStatementObservation(), conditions, ehrExtract);
    assertThat(conditions).isNotEmpty();
    assertThat(conditions.get(0).getExtensionsByUrl(ACTUAL_PROBLEM_URL)).isNotEmpty();
    assertActualProblemExtension(conditions.get(0));
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) RCMRMT030101UK04EhrExtract(org.hl7.v3.RCMRMT030101UK04EhrExtract) Test(org.junit.jupiter.api.Test)

Aggregations

RCMRMT030101UK04EhrExtract (org.hl7.v3.RCMRMT030101UK04EhrExtract)19 Reference (org.hl7.fhir.dstu3.model.Reference)13 Test (org.junit.jupiter.api.Test)13 Condition (org.hl7.fhir.dstu3.model.Condition)7 IdType (org.hl7.fhir.dstu3.model.IdType)7 List (java.util.List)5 Encounter (org.hl7.fhir.dstu3.model.Encounter)5 Observation (org.hl7.fhir.dstu3.model.Observation)5 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)4 RCMRMT030101UK04Component2 (org.hl7.v3.RCMRMT030101UK04Component2)4 ArrayList (java.util.ArrayList)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Specimen (org.hl7.fhir.dstu3.model.Specimen)3 RCMRMT030101UK04EhrComposition (org.hl7.v3.RCMRMT030101UK04EhrComposition)3 Service (org.springframework.stereotype.Service)3 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)3 Coding (org.hl7.fhir.dstu3.model.Coding)2 DateTimeType (org.hl7.fhir.dstu3.model.DateTimeType)2 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)2