Search in sources :

Example 1 with II

use of org.hl7.v3.II in project kindling by HL7.

the class CDAGenerator method buildInfrastructureRoot.

private void buildInfrastructureRoot() throws DefinitionException {
    StructureDefinition sd = new StructureDefinition();
    sd.setId("InfrastructureRoot");
    sd.setUrl("http://hl7.org/fhir/cda/StructureDefinition/InfrastructureRoot");
    library.put(sd.getUrl(), sd);
    sd.setName("Base Type for all classes in the CDA structure");
    sd.setTitle("InfrastructureRoot");
    sd.setStatus(PublicationStatus.ACTIVE);
    sd.setExperimental(false);
    sd.setPublisher("HL7");
    sd.setDescription("Defines the base elements and attributes on all CDA elements (other than data types)");
    sd.setKind(StructureDefinitionKind.LOGICAL);
    sd.setType(sd.getUrl());
    sd.setAbstract(true);
    sd.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:v3"));
    sd.setBaseDefinition("http://hl7.org/fhir/cda/StructureDefinition/ANY");
    sd.setDerivation(TypeDerivationRule.SPECIALIZATION);
    ElementDefinition edb = new ElementDefinition();
    edb.setPath(sd.getId());
    seePath(edb);
    edb.setMin(1);
    edb.setMax("*");
    edb.addType().setCode("Element");
    sd.getDifferential().getElement().add(edb);
    ElementDefinition ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.realmCode");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("*");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of realm-specific constraints. The value of this attribute identifies the realm in question");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/CS");
    sd.getDifferential().getElement().add(ed);
    ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.typeId");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("1");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of constraints defined in an HL7-specified message type. This might be a common type (also known as CMET in the messaging communication environment), or content included within a wrapper. The value of this attribute provides a unique identifier for the type in question.");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
    sd.getDifferential().getElement().add(ed);
    ed = new ElementDefinition();
    ed.setPath("InfrastructureRoot.templateId");
    seePath(ed);
    ed.setMin(0);
    ed.setMax("*");
    ed.setDefinition("When valued in an instance, this attribute signals the imposition of a set of template-defined constraints. The value of this attribute provides a unique identifier for the templates in question");
    ed.addType().setCode("http://hl7.org/fhir/cda/StructureDefinition/II");
    sd.getDifferential().getElement().add(ed);
    new ProfileUtilities(null, null, null).setIds(sd, true);
    structures.add(sd);
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) ProfileUtilities(org.hl7.fhir.r5.conformance.ProfileUtilities) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) UriType(org.hl7.fhir.r5.model.UriType)

Example 2 with II

use of org.hl7.v3.II in project ipf by oehf.

the class IiEqualFunction method handle.

@Override
public Object handle(Object... args) throws FunctionProcessingException {
    if (args.length != 2) {
        throw new FunctionProcessingException("Invalid number of parameters.");
    }
    try {
        var arg0 = (II) args[0];
        var arg1 = (II) args[1];
        return arg0.getRoot().equals(arg1.getRoot()) && arg0.getExtension().equals(arg1.getExtension());
    } catch (ClassCastException e) {
        throw new FunctionProcessingException("The arguments are of the wrong datatype", e);
    } catch (Exception e) {
        throw new FunctionProcessingException(e);
    }
}
Also used : II(org.openehealth.ipf.commons.ihe.xacml20.stub.hl7v3.II) FunctionProcessingException(org.herasaf.xacml.core.function.FunctionProcessingException) FunctionProcessingException(org.herasaf.xacml.core.function.FunctionProcessingException)

Example 3 with II

use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.

the class OrganizationMapperTest method mockItkOrganization.

private POCDMT000002UK01Organization mockItkOrganization() {
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    AD itkAddress = mock(AD.class);
    TEL itkTelecom = mock(TEL.class);
    CE codeEntity = mock(CE.class);
    II[] iiArray = new II[] { ii };
    when(itkOrganization.getIdArray()).thenReturn(iiArray);
    when(ii.isSetExtension()).thenReturn(true);
    when(ii.getExtension()).thenReturn(ODS_CODE);
    when(itkOrganization.sizeOfIdArray()).thenReturn(1);
    when(itkOrganization.getAddrArray()).thenReturn(new AD[] { itkAddress });
    when(itkOrganization.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
    when(itkOrganization.isSetStandardIndustryClassCode()).thenReturn(true);
    when(itkOrganization.getStandardIndustryClassCode()).thenReturn(codeEntity);
    when(codeEntity.getDisplayName()).thenReturn(GP_PRACTICE);
    when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(any())).thenReturn(address);
    when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Organization organization = organizationMapper.mapOrganization(itkOrganization);
    assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
    assertThat(organization.getAddressFirstRep()).isEqualTo(address);
    assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(organization.getTypeFirstRep().getText()).isEqualTo(GP_PRACTICE);
    assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
    assertThat(organization.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    return itkOrganization;
}
Also used : II(uk.nhs.connect.iucds.cda.ucr.II) CE(uk.nhs.connect.iucds.cda.ucr.CE) AD(uk.nhs.connect.iucds.cda.ucr.AD) Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 4 with II

use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.

the class OrganizationMapper method mapOrganization.

public Organization mapOrganization(POCDMT000002UK01Organization itkOrganization) {
    Organization fhirOrganization = new Organization();
    fhirOrganization.setIdElement(resourceUtil.newRandomUuid());
    fhirOrganization.setName(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0)));
    fhirOrganization.setAddress(Arrays.stream(itkOrganization.getAddrArray()).map(addressMapper::mapAddress).collect(Collectors.toList()));
    fhirOrganization.setTelecom(Arrays.stream(itkOrganization.getTelecomArray()).map(contactPointMapper::mapContactPoint).collect(Collectors.toList()));
    if (itkOrganization.isSetStandardIndustryClassCode()) {
        fhirOrganization.setType(Collections.singletonList(new CodeableConcept().setText(itkOrganization.getStandardIndustryClassCode().getDisplayName())));
    }
    if (itkOrganization.isSetAsOrganizationPartOf()) {
        if (itkOrganization.getAsOrganizationPartOf().getWholeOrganization() != null) {
            Organization partOf = mapOrganization(itkOrganization.getAsOrganizationPartOf().getWholeOrganization());
            fhirOrganization.setPartOf(resourceUtil.createReference(partOf));
            fhirOrganization.setPartOfTarget(partOf);
        }
    }
    if (itkOrganization.sizeOfIdArray() > 0) {
        List<Identifier> identifierList = new ArrayList<>();
        for (II id : itkOrganization.getIdArray()) {
            if (id.isSetExtension()) {
                identifierList.add(new Identifier().setValue(id.getExtension()));
            }
        }
        fhirOrganization.setIdentifier(identifierList);
    }
    return fhirOrganization;
}
Also used : II(uk.nhs.connect.iucds.cda.ucr.II) Organization(org.hl7.fhir.dstu3.model.Organization) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) Identifier(org.hl7.fhir.dstu3.model.Identifier) ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 5 with II

use of org.hl7.v3.II in project integration-adaptor-111 by nhsconnect.

the class CompositionMapperTest method setUp.

@BeforeEach
public void setUp() {
    effectiveTime.setValue(EFFECTIVE_DATE);
    questionnaireResponseList = new ArrayList<>();
    questionnaireResponseList.add(questionnaireResponse);
    POCDMT000002UK01RelatedDocument1[] relatedDocsArray = { mock(POCDMT000002UK01RelatedDocument1.class) };
    when(clinicalDocument.getRelatedDocumentArray()).thenReturn(relatedDocsArray);
    when(clinicalDocument.getRelatedDocumentArray(0)).thenReturn(relatedDocument1);
    when(relatedDocument1.getParentDocument()).thenReturn(parentDocument1);
    when(parentDocument1.getIdArray(0)).thenReturn(ii);
    when(clinicalDocument.getSetId()).thenReturn(ii);
    when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
    when(ii.getRoot()).thenReturn("411910CF-1A76-4330-98FE-C345DDEE5553");
    when(clinicalDocument.getConfidentialityCode()).thenReturn(ce);
    when(ce.getCode()).thenReturn("V");
    when(ce.isSetCode()).thenReturn(true);
    when(ii.isSetRoot()).thenReturn(true);
    when(referralRequest.fhirType()).thenReturn("ReferralRequest");
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
    when(resourceUtil.createReference(questionnaireResponse)).thenReturn(new Reference(questionnaireResponse));
    when(resourceUtil.createReference(carePlan)).thenReturn(new Reference(carePlan));
    when(resourceUtil.createReference(referralRequest)).thenReturn(new Reference(referralRequest));
    mockStructuredBody();
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01RelatedDocument1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedDocument1) IdType(org.hl7.fhir.dstu3.model.IdType) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ArrayList (java.util.ArrayList)10 II (net.ihe.gazelle.hl7v3.datatypes.II)9 CS (net.ihe.gazelle.hl7v3.datatypes.CS)8 TS (net.ihe.gazelle.hl7v3.datatypes.TS)8 Identifier (org.hl7.fhir.r4.model.Identifier)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 BL (net.ihe.gazelle.hl7v3.datatypes.BL)7 CD (net.ihe.gazelle.hl7v3.datatypes.CD)7 CE (net.ihe.gazelle.hl7v3.datatypes.CE)7 INT (net.ihe.gazelle.hl7v3.datatypes.INT)7 MCCIMT000100UV01Device (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Device)7 MCCIMT000100UV01Receiver (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Receiver)7 MCCIMT000100UV01Sender (net.ihe.gazelle.hl7v3.mccimt000100UV01.MCCIMT000100UV01Sender)7 HumanName (org.hl7.fhir.r4.model.HumanName)7 PatientCommunicationComponent (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent)7 II (iso.v21090.dt.v1.II)6 COCTMT090003UV01AssignedEntity (net.ihe.gazelle.hl7v3.coctmt090003UV01.COCTMT090003UV01AssignedEntity)6 COCTMT090003UV01Organization (net.ihe.gazelle.hl7v3.coctmt090003UV01.COCTMT090003UV01Organization)6 COCTMT150003UV03ContactParty (net.ihe.gazelle.hl7v3.coctmt150003UV03.COCTMT150003UV03ContactParty)6 COCTMT150003UV03Organization (net.ihe.gazelle.hl7v3.coctmt150003UV03.COCTMT150003UV03Organization)6