Search in sources :

Example 11 with RCMRMT030101UK04CompoundStatement

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

the class ConsultationListMapper method mapToCategory.

public ListResource mapToCategory(ListResource topic, RCMRMT030101UK04CompoundStatement compoundStatement) {
    ListResource category = new ListResource();
    category.setStatus(ListStatus.CURRENT).setMode(ListMode.SNAPSHOT).setTitle(getTitle(compoundStatement)).setCode(CodeableConceptUtils.createCodeableConcept(CATEGORY_CODE_CODE, LIST_CODE_SYSTEM, CATEGORY_CODE_DISPLAY, null)).setEncounter(topic.getEncounter()).setSubject(topic.getSubject()).setDateElement(getDate(compoundStatement, topic)).setOrderedBy(CodeableConceptUtils.createCodeableConcept(LIST_ORDERED_BY_CODE, LIST_ORDERED_BY_SYSTEM, LIST_ORDERED_BY_DISPLAY, null)).setMeta(generateMeta(LIST_META_PROFILE)).setId(compoundStatement.getId().get(0).getRoot());
    return category;
}
Also used : ListResource(org.hl7.fhir.dstu3.model.ListResource)

Example 12 with RCMRMT030101UK04CompoundStatement

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

the class EncounterMapper method generateCategoryLists.

private void generateCategoryLists(RCMRMT030101UK04CompoundStatement topicCompoundStatement, ListResource topic, List<ListResource> categories) {
    var categoryCompoundStatements = getCategoryCompoundStatements(topicCompoundStatement);
    categoryCompoundStatements.forEach(categoryCompoundStatement -> {
        var category = consultationListMapper.mapToCategory(topic, categoryCompoundStatement);
        List<Reference> entryReferences = new ArrayList<>();
        resourceReferenceUtil.extractChildReferencesFromCompoundStatement(categoryCompoundStatement, entryReferences);
        entryReferences.forEach(reference -> addEntry(category, reference));
        topic.addEntry(new ListEntryComponent(new Reference(category)));
        categories.add(category);
    });
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Example 13 with RCMRMT030101UK04CompoundStatement

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

the class ResourceReferenceUtilTest method testTemplateResourcesReferencedAtCompoundStatementLevel.

@Test
public void testTemplateResourcesReferencedAtCompoundStatementLevel() {
    final RCMRMT030101UK04CompoundStatement compoundStatement = unmarshallCompoundStatementElement("compound_statement_template.xml");
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromCompoundStatement(compoundStatement, references);
    assertThat(references.size()).isEqualTo(FOUR);
    assertThat(references.get(0).getReference()).isEqualTo("QuestionnaireResponse/7334D39A-BBB3-424A-B5D3-E841BCA39BF7-QRSP");
    assertThat(references.get(1).getReference()).isEqualTo("Observation/7334D39A-BBB3-424A-B5D3-E841BCA39BF7");
    assertThat(references.get(2).getReference()).isEqualTo("Observation/3DCC9FC9-1873-4004-9789-C4E5C52B02B9");
    assertThat(references.get(THREE).getReference()).isEqualTo("Observation/278ADD5F-2AC7-48DC-966A-0BA7C029C793");
}
Also used : RCMRMT030101UK04CompoundStatement(org.hl7.v3.RCMRMT030101UK04CompoundStatement) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with RCMRMT030101UK04CompoundStatement

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

the class ResourceReferenceUtilTest method testResourcesReferencedAtCompoundStatementLevel.

@ParameterizedTest
@MethodSource("compoundStatementResourceFiles")
public void testResourcesReferencedAtCompoundStatementLevel(String inputXML, String referenceString) {
    final RCMRMT030101UK04CompoundStatement compoundStatement = unmarshallCompoundStatementElement(inputXML);
    lenient().when(immunizationChecker.isImmunization(any())).thenAnswer(new Answer<Boolean>() {

        @Override
        public Boolean answer(InvocationOnMock invocation) throws Throwable {
            String input = (String) invocation.getArgument(0);
            return input.equals("1664081000000114");
        }
    });
    List<Reference> references = new ArrayList<>();
    resourceReferenceUtil.extractChildReferencesFromCompoundStatement(compoundStatement, references);
    assertThat(references.size()).isOne();
    assertThat(references.get(0).getReference()).isEqualTo(referenceString);
}
Also used : RCMRMT030101UK04CompoundStatement(org.hl7.v3.RCMRMT030101UK04CompoundStatement) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 15 with RCMRMT030101UK04CompoundStatement

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

the class ResourceFilterUtilTest method testIsDiagnosticReportResource.

@Test
public void testIsDiagnosticReportResource() {
    final RCMRMT030101UK04CompoundStatement compoundStatement = unmarshallCompoundStatementElement("diagnostic_report_resource.xml");
    assertThat(ResourceFilterUtil.isDiagnosticReport(compoundStatement)).isTrue();
}
Also used : RCMRMT030101UK04CompoundStatement(org.hl7.v3.RCMRMT030101UK04CompoundStatement) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

RCMRMT030101UK04CompoundStatement (org.hl7.v3.RCMRMT030101UK04CompoundStatement)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 Reference (org.hl7.fhir.dstu3.model.Reference)10 Test (org.junit.jupiter.api.Test)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 ArrayList (java.util.ArrayList)4 ListResource (org.hl7.fhir.dstu3.model.ListResource)2 ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)2 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)2 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 QuestionnaireResponse (org.hl7.fhir.dstu3.model.QuestionnaireResponse)1 Specimen (org.hl7.fhir.dstu3.model.Specimen)1 UriType (org.hl7.fhir.dstu3.model.UriType)1 CD (org.hl7.v3.CD)1 II (org.hl7.v3.II)1 TS (org.hl7.v3.TS)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 ResourceUtil.addContextToObservation (uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)1