Search in sources :

Example 66 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project integration-adaptor-111 by nhsconnect.

the class RelatedPersonMapper method mapRelatedPerson.

public RelatedPerson mapRelatedPerson(POCDMT000002UK01Informant12 informant, Encounter encounter) {
    if (!informant.isSetRelatedEntity()) {
        return null;
    }
    POCDMT000002UK01RelatedEntity relatedEntity = informant.getRelatedEntity();
    RelatedPerson relatedPerson = new RelatedPerson();
    relatedPerson.setIdElement(resourceUtil.newRandomUuid());
    relatedPerson.setActive(true).setPatient(encounter.getSubject()).setGender(UNKNOWN);
    if (relatedEntity.isSetRelatedPerson()) {
        relatedPerson.setName(getHumanNameFromITK(relatedEntity.getRelatedPerson()));
    }
    if (relatedEntity.sizeOfTelecomArray() > 0) {
        relatedPerson.setTelecom(getTelecomFromITK(relatedEntity.getTelecomArray()));
    }
    if (relatedEntity.sizeOfAddrArray() > 0) {
        relatedPerson.setAddress(getAddressesFromITK(relatedEntity.getAddrArray()));
    }
    if (relatedEntity.isSetEffectiveTime()) {
        Period period = new Period();
        if (relatedEntity.getEffectiveTime().isSetLow()) {
            period.setStartElement(DateUtil.parse(relatedEntity.getEffectiveTime().getLow().getValue()));
        }
        if (relatedEntity.getEffectiveTime().isSetHigh()) {
            period.setEndElement(DateUtil.parse(relatedEntity.getEffectiveTime().getHigh().getValue()));
        }
        relatedPerson.setPeriod(period);
    }
    relatedPerson.setPeriod(getPeriod(relatedEntity));
    setRelationship(relatedEntity, relatedPerson);
    markEmergencyContact(relatedEntity.getTelecomArray(), relatedPerson);
    return relatedPerson;
}
Also used : POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Period(org.hl7.fhir.dstu3.model.Period) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson)

Example 67 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeRelatedPerson.

protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "RelatedPerson", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
    if (element.hasActiveElement())
        composeBoolean(t, "RelatedPerson", "active", element.getActiveElement(), -1);
    if (element.hasPatient())
        composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
    for (int i = 0; i < element.getName().size(); i++) composeHumanName(t, "RelatedPerson", "name", element.getName().get(i), i);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
    if (element.hasGenderElement())
        composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
    if (element.hasBirthDateElement())
        composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
    for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
    for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
    if (element.hasPeriod())
        composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 68 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireBuilder method addTimingQuestions.

private void addTimingQuestions(GroupComponent group, ElementDefinition element, String path, List<QuestionnaireResponse.GroupComponent> answerGroups) throws FHIRException {
    ToolingExtensions.addType(group, "Schedule");
    addQuestion(group, AnswerFormat.STRING, path, "text", "text:", answerGroups);
    addQuestion(group, AnswerFormat.DATETIME, path, "date", "date:", answerGroups);
    QuestionComponent q = addQuestion(group, AnswerFormat.REFERENCE, path, "author", "author:", answerGroups);
    ToolingExtensions.addReference(q, "/Patient?");
    ToolingExtensions.addReference(q, "/Practitioner?");
    ToolingExtensions.addReference(q, "/RelatedPerson?");
}
Also used : QuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent)

Example 69 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeRelatedPerson.

protected void composeRelatedPerson(Complex parent, String parentType, String name, RelatedPerson element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "RelatedPerson", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "RelatedPerson", "identifier", element.getIdentifier().get(i), i);
    if (element.hasPatient())
        composeReference(t, "RelatedPerson", "patient", element.getPatient(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "RelatedPerson", "relationship", element.getRelationship(), -1);
    if (element.hasName())
        composeHumanName(t, "RelatedPerson", "name", element.getName(), -1);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "RelatedPerson", "telecom", element.getTelecom().get(i), i);
    if (element.hasGenderElement())
        composeEnum(t, "RelatedPerson", "gender", element.getGenderElement(), -1);
    if (element.hasBirthDateElement())
        composeDate(t, "RelatedPerson", "birthDate", element.getBirthDateElement(), -1);
    for (int i = 0; i < element.getAddress().size(); i++) composeAddress(t, "RelatedPerson", "address", element.getAddress().get(i), i);
    for (int i = 0; i < element.getPhoto().size(); i++) composeAttachment(t, "RelatedPerson", "photo", element.getPhoto().get(i), i);
    if (element.hasPeriod())
        composePeriod(t, "RelatedPerson", "period", element.getPeriod(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 70 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireBuilder method addTimingQuestions.

private void addTimingQuestions(QuestionnaireItemComponent group, ElementDefinition element, String path, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups) throws FHIRException {
    ToolingExtensions.addFhirType(group, "Schedule");
    addQuestion(group, QuestionnaireItemType.STRING, path, "text", "text:", answerGroups);
    addQuestion(group, QuestionnaireItemType.DATETIME, path, "date", "date:", answerGroups);
    QuestionnaireItemComponent q = addQuestion(group, QuestionnaireItemType.REFERENCE, path, "author", "author:", answerGroups);
    ToolingExtensions.addAllowedResource(q, "Patient");
    ToolingExtensions.addAllowedResource(q, "Practitioner");
    ToolingExtensions.addAllowedResource(q, "RelatedPerson");
}
Also used : QuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent)

Aggregations

Test (org.junit.Test)87 RelatedPerson (org.hl7.fhir.r4.model.RelatedPerson)54 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)51 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)33 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)29 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)24 StringOrListParam (ca.uhn.fhir.rest.param.StringOrListParam)24 StringParam (ca.uhn.fhir.rest.param.StringParam)24 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)24 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)20 RelatedPerson (org.hl7.fhir.dstu3.model.RelatedPerson)17 Test (org.junit.jupiter.api.Test)17 Resource (org.hl7.fhir.r4.model.Resource)14 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)13 DateRangeParam (ca.uhn.fhir.rest.param.DateRangeParam)12 TokenAndListParam (ca.uhn.fhir.rest.param.TokenAndListParam)12 Patient (org.hl7.fhir.r4.model.Patient)12 MockIBundleProvider (org.openmrs.module.fhir2.providers.r4.MockIBundleProvider)11 Identifier (org.hl7.fhir.r4.model.Identifier)10 Reference (org.hl7.fhir.r4.model.Reference)9