Search in sources :

Example 76 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.r4.model.Questionnaire.QuestionnaireItemComponent)

Example 77 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project MobileAccessGateway by i4mi.

the class Iti66ResponseConverter method translateToFhir.

/**
 * convert ITI-18 query response to ITI-66 response bundle
 */
@Override
public List<ListResource> translateToFhir(QueryResponse input, Map<String, Object> parameters) {
    ArrayList<ListResource> list = new ArrayList<ListResource>();
    if (input != null && Status.SUCCESS.equals(input.getStatus())) {
        Map<String, ListResource> targetList = new HashMap<String, ListResource>();
        if (input.getSubmissionSets() != null) {
            for (SubmissionSet submissionSet : input.getSubmissionSets()) {
                ListResource documentManifest = new ListResource();
                documentManifest.setId(noUuidPrefix(submissionSet.getEntryUuid()));
                documentManifest.setCode(new CodeableConcept(new Coding("http://profiles.ihe.net/ITI/MHD/CodeSystem/MHDlistTypes", "submissionset", "Submission Set")));
                targetList.put(documentManifest.getId(), documentManifest);
                list.add(documentManifest);
                // limitedMetadata -> meta.profile canonical [0..*]
                if (submissionSet.isLimitedMetadata()) {
                    documentManifest.getMeta().addProfile("http://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.SubmissionSet");
                } else {
                    documentManifest.getMeta().addProfile("http://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.SubmissionSet");
                }
                // comment -> text Narrative [0..1]
                LocalizedString comments = submissionSet.getComments();
                if (comments != null) {
                    documentManifest.addNote().setText(comments.getValue());
                }
                // uniqueId -> masterIdentifier Identifier [0..1] [1..1]
                if (submissionSet.getUniqueId() != null) {
                    documentManifest.addIdentifier((new Identifier().setUse(IdentifierUse.USUAL).setSystem("urn:ietf:rfc:3986").setValue("urn:oid:" + submissionSet.getUniqueId())));
                }
                // entryUUID -> identifier Identifier [0..*]
                if (submissionSet.getEntryUuid() != null) {
                    documentManifest.addIdentifier((new Identifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:ietf:rfc:3986").setValue(asUuid(submissionSet.getEntryUuid()))));
                }
                // approved -> status=current Other status values are allowed but are not defined in this mapping to XDS.
                if (AvailabilityStatus.APPROVED.equals(submissionSet.getAvailabilityStatus())) {
                    documentManifest.setStatus(ListResource.ListStatus.CURRENT);
                }
                documentManifest.setMode(ListMode.WORKING);
                // contentTypeCode -> type CodeableConcept [0..1]
                if (submissionSet.getContentTypeCode() != null) {
                    documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType").setValue(transform(submissionSet.getContentTypeCode()));
                }
                // patientId -> subject Reference(Patient| Practitioner| Group| Device) [0..1], Reference(Patient)
                if (submissionSet.getPatientId() != null) {
                    Identifiable patient = submissionSet.getPatientId();
                    documentManifest.setSubject(transformPatient(patient));
                }
                // submissionTime -> created dateTime [0..1]
                if (submissionSet.getSubmissionTime() != null) {
                    documentManifest.setDate(Date.from(submissionSet.getSubmissionTime().getDateTime().toInstant()));
                }
                // authorInstitution, authorPerson, authorRole, authorSpeciality, authorTelecommunication -> author Reference(Practitioner| PractitionerRole| Organization| Device| Patient| RelatedPerson) [0..*]
                if (submissionSet.getAuthors() != null) {
                    for (Author author : submissionSet.getAuthors()) {
                        documentManifest.setSource(transformAuthor(author));
                    }
                }
                // intendedRecipient -> recipient Reference(Patient| Practitioner| PractitionerRole| RelatedPerson| Organization) [0..*]
                List<Recipient> recipients = submissionSet.getIntendedRecipients();
                for (Recipient recipient : recipients) {
                    Organization org = recipient.getOrganization();
                    Person person = recipient.getPerson();
                    ContactPoint contact = transform(recipient.getTelecom());
                    var organization = transform(org);
                    Practitioner practitioner = transformPractitioner(person);
                    if (organization != null && practitioner == null) {
                        if (contact != null)
                            organization.addTelecom(contact);
                        documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-intendedRecipient").setValue(new Reference().setResource(organization));
                    } else if (organization != null && practitioner != null) {
                        PractitionerRole role = new PractitionerRole();
                        role.setPractitioner((Reference) new Reference().setResource(practitioner));
                        role.setOrganization((Reference) new Reference().setResource(organization));
                        if (contact != null)
                            role.addTelecom(contact);
                        documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-intendedRecipient").setValue(new Reference().setResource(role));
                    } else if (organization == null && practitioner != null) {
                    // May be a patient, related person or practitioner
                    }
                }
                // sourceId -> source uri [0..1] [1..1]
                if (submissionSet.getSourceId() != null) {
                    documentManifest.addExtension().setUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-sourceId").setValue(new Identifier().setValue("urn:oid:" + submissionSet.getSourceId()));
                }
                // title -> description string [0..1]
                LocalizedString title = submissionSet.getTitle();
                if (title != null) {
                    documentManifest.setTitle(title.getValue());
                }
            }
        }
        if (input.getAssociations() != null) {
            for (Association ass : input.getAssociations()) {
                AssociationType tt = ass.getAssociationType();
                String source = ass.getSourceUuid();
                String target = ass.getTargetUuid();
                if (tt == AssociationType.HAS_MEMBER) {
                    ListResource s = targetList.get(noUuidPrefix(source));
                    if (s != null) {
                        s.addEntry().setItem(new Reference().setReference("DocumentReference/" + noUuidPrefix(target)));
                    }
                }
            }
        }
    } else {
        processError(input);
    }
    return list;
}
Also used : Organization(org.openehealth.ipf.commons.ihe.xds.core.metadata.Organization) HashMap(java.util.HashMap) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) SubmissionSet(org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet) Recipient(org.openehealth.ipf.commons.ihe.xds.core.metadata.Recipient) LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) Practitioner(org.hl7.fhir.r4.model.Practitioner) ContactPoint(org.hl7.fhir.r4.model.ContactPoint) Identifier(org.hl7.fhir.r4.model.Identifier) Association(org.openehealth.ipf.commons.ihe.xds.core.metadata.Association) AssociationType(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssociationType) Coding(org.hl7.fhir.r4.model.Coding) Author(org.openehealth.ipf.commons.ihe.xds.core.metadata.Author) ListResource(org.hl7.fhir.r4.model.ListResource) Person(org.openehealth.ipf.commons.ihe.xds.core.metadata.Person) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 78 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project MobileAccessGateway by i4mi.

the class Iti67ResponseConverter method translateToFhir.

@Override
public List<DocumentReference> translateToFhir(QueryResponse input, Map<String, Object> parameters) {
    ArrayList<DocumentReference> list = new ArrayList<DocumentReference>();
    if (input != null && Status.SUCCESS.equals(input.getStatus())) {
        // process relationship association
        Map<String, List<DocumentReferenceRelatesToComponent>> relatesToMapping = new HashMap<String, List<DocumentReferenceRelatesToComponent>>();
        for (Association association : input.getAssociations()) {
            // Relationship type -> relatesTo.code code [1..1]
            // relationship reference -> relatesTo.target Reference(DocumentReference)
            String source = association.getSourceUuid();
            String target = association.getTargetUuid();
            AssociationType type = association.getAssociationType();
            DocumentReferenceRelatesToComponent relatesTo = new DocumentReferenceRelatesToComponent();
            if (type != null)
                switch(type) {
                    case APPEND:
                        relatesTo.setCode(DocumentRelationshipType.APPENDS);
                        break;
                    case REPLACE:
                        relatesTo.setCode(DocumentRelationshipType.REPLACES);
                        break;
                    case TRANSFORM:
                        relatesTo.setCode(DocumentRelationshipType.TRANSFORMS);
                        break;
                    case SIGNS:
                        relatesTo.setCode(DocumentRelationshipType.SIGNS);
                        break;
                }
            relatesTo.setTarget(new Reference().setReference("urn:oid:" + target));
            if (!relatesToMapping.containsKey(source))
                relatesToMapping.put(source, new ArrayList<DocumentReferenceRelatesToComponent>());
            relatesToMapping.get(source).add(relatesTo);
        }
        if (input.getDocumentEntries() != null) {
            for (DocumentEntry documentEntry : input.getDocumentEntries()) {
                DocumentReference documentReference = new DocumentReference();
                // FIXME do we need to cache this id in
                documentReference.setId(noUuidPrefix(documentEntry.getEntryUuid()));
                // relation to the DocumentManifest itself
                // for
                list.add(documentReference);
                // limitedMetadata -> meta.profile canonical [0..*]
                if (documentEntry.isLimitedMetadata()) {
                    documentReference.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE_MHD_Query_Comprehensive_DocumentReference");
                } else {
                    documentReference.getMeta().addProfile("http://ihe.net/fhir/StructureDefinition/IHE_MHD_Comprehensive_DocumentManifest");
                }
                // uniqueId -> masterIdentifier Identifier [0..1] [1..1]
                if (documentEntry.getUniqueId() != null) {
                    documentReference.setMasterIdentifier((new Identifier().setValue("urn:oid:" + documentEntry.getUniqueId())));
                }
                // DocumentReference.identifier. use shall be ‘official’
                if (documentEntry.getEntryUuid() != null) {
                    documentReference.addIdentifier((new Identifier().setSystem("urn:ietf:rfc:3986").setValue(asUuid(documentEntry.getEntryUuid()))).setUse(IdentifierUse.OFFICIAL));
                }
                // Other status values are allowed but are not defined in this mapping to XDS.
                if (AvailabilityStatus.APPROVED.equals(documentEntry.getAvailabilityStatus())) {
                    documentReference.setStatus(DocumentReferenceStatus.CURRENT);
                }
                if (AvailabilityStatus.DEPRECATED.equals(documentEntry.getAvailabilityStatus())) {
                    documentReference.setStatus(DocumentReferenceStatus.SUPERSEDED);
                }
                // contentTypeCode -> type CodeableConcept [0..1]
                if (documentEntry.getTypeCode() != null) {
                    documentReference.setType(transform(documentEntry.getTypeCode()));
                }
                // classCode -> category CodeableConcept [0..*]
                if (documentEntry.getClassCode() != null) {
                    documentReference.addCategory((transform(documentEntry.getClassCode())));
                }
                // representing the XDS Affinity Domain Patient.
                if (documentEntry.getPatientId() != null) {
                    Identifiable patient = documentEntry.getPatientId();
                    documentReference.setSubject(transformPatient(patient));
                }
                // creationTime -> date instant [0..1]
                if (documentEntry.getCreationTime() != null) {
                    documentReference.setDate(Date.from(documentEntry.getCreationTime().getDateTime().toInstant()));
                }
                // PractitionerRole| Organization| Device| Patient| RelatedPerson) [0..*]
                if (documentEntry.getAuthors() != null) {
                    for (Author author : documentEntry.getAuthors()) {
                        documentReference.addAuthor(transformAuthor(author));
                    }
                }
                // legalAuthenticator -> authenticator Note 1
                // Reference(Practitioner|Practition erRole|Organization [0..1]
                Person person = documentEntry.getLegalAuthenticator();
                if (person != null) {
                    Practitioner practitioner = transformPractitioner(person);
                    documentReference.setAuthenticator((Reference) new Reference().setResource(practitioner));
                }
                // Relationship Association -> relatesTo [0..*]
                // [1..1]
                documentReference.setRelatesTo(relatesToMapping.get(documentEntry.getEntryUuid()));
                // title -> description string [0..1]
                if (documentEntry.getTitle() != null) {
                    documentReference.setDescription(documentEntry.getTitle().getValue());
                }
                // DocumentReference itself.
                if (documentEntry.getConfidentialityCodes() != null) {
                    documentReference.addSecurityLabel(transform(documentEntry.getConfidentialityCodes()));
                }
                DocumentReferenceContentComponent content = documentReference.addContent();
                Attachment attachment = new Attachment();
                content.setAttachment(attachment);
                // mimeType -> content.attachment.contentType [1..1] code [0..1]
                if (documentEntry.getMimeType() != null) {
                    attachment.setContentType(documentEntry.getMimeType());
                }
                // languageCode -> content.attachment.language code [0..1]
                if (documentEntry.getLanguageCode() != null) {
                    attachment.setLanguage(documentEntry.getLanguageCode());
                }
                // retrievable location of the document -> content.attachment.url uri
                // [0..1] [1..1
                // has to defined, for the PoC we define
                // $host:port/camel/$repositoryid/$uniqueid
                attachment.setUrl(config.getUriMagXdsRetrieve() + "?uniqueId=" + documentEntry.getUniqueId() + "&repositoryUniqueId=" + documentEntry.getRepositoryUniqueId());
                // size -> content.attachment.size integer [0..1] The size is calculated
                if (documentEntry.getSize() != null) {
                    attachment.setSize(documentEntry.getSize().intValue());
                }
                // on the data prior to base64 encoding, if the data is base64 encoded.
                if (documentEntry.getHash() != null) {
                    attachment.setHash(Hex.fromHex(documentEntry.getHash()));
                }
                // comments -> content.attachment.title string [0..1]
                if (documentEntry.getComments() != null) {
                    attachment.setTitle(documentEntry.getComments().getValue());
                }
                // TcreationTime -> content.attachment.creation dateTime [0..1]
                if (documentEntry.getCreationTime() != null) {
                    attachment.setCreation(Date.from(documentEntry.getCreationTime().getDateTime().toInstant()));
                }
                // formatCode -> content.format Coding [0..1]
                if (documentEntry.getFormatCode() != null) {
                    content.setFormat(transform(documentEntry.getFormatCode()).getCodingFirstRep());
                }
                DocumentReferenceContextComponent context = new DocumentReferenceContextComponent();
                documentReference.setContext(context);
                // referenceIdList -> context.encounter Reference(Encounter) [0..*] When
                // referenceIdList contains an encounter, and a FHIR Encounter is available, it
                // may be referenced.
                // Map to context.related
                List<ReferenceId> refIds = documentEntry.getReferenceIdList();
                if (refIds != null) {
                    for (ReferenceId refId : refIds) {
                        context.getRelated().add(transform(refId));
                    }
                }
                // eventCodeList -> context.event CodeableConcept [0..*]
                if (documentEntry.getEventCodeList() != null) {
                    documentReference.getContext().setEvent(transformMultiple(documentEntry.getEventCodeList()));
                }
                // serviceStartTime serviceStopTime -> context.period Period [0..1]
                if (documentEntry.getServiceStartTime() != null || documentEntry.getServiceStopTime() != null) {
                    Period period = new Period();
                    period.setStartElement(transform(documentEntry.getServiceStartTime()));
                    period.setEndElement(transform(documentEntry.getServiceStopTime()));
                    documentReference.getContext().setPeriod(period);
                }
                // [0..1]
                if (documentEntry.getHealthcareFacilityTypeCode() != null) {
                    context.setFacilityType(transform(documentEntry.getHealthcareFacilityTypeCode()));
                }
                // practiceSettingCode -> context.practiceSetting CodeableConcept [0..1]
                if (documentEntry.getPracticeSettingCode() != null) {
                    context.setPracticeSetting(transform(documentEntry.getPracticeSettingCode()));
                }
                // sourcePatientId and sourcePatientInfo -> context.sourcePatientInfo
                // Reference(Patient) [0..1] Contained Patient Resource with
                // Patient.identifier.use element set to ‘usual’.
                Identifiable sourcePatientId = documentEntry.getSourcePatientId();
                PatientInfo sourcePatientInfo = documentEntry.getSourcePatientInfo();
                Patient sourcePatient = new Patient();
                if (sourcePatientId != null) {
                    sourcePatient.addIdentifier((new Identifier().setSystem("urn:oid:" + sourcePatientId.getAssigningAuthority().getUniversalId()).setValue(sourcePatientId.getId())).setUse(IdentifierUse.OFFICIAL));
                }
                if (sourcePatientInfo != null) {
                    sourcePatient.setBirthDateElement(transformToDate(sourcePatientInfo.getDateOfBirth()));
                    String gender = sourcePatientInfo.getGender();
                    if (gender != null) {
                        switch(gender) {
                            case "F":
                                sourcePatient.setGender(Enumerations.AdministrativeGender.FEMALE);
                                break;
                            case "M":
                                sourcePatient.setGender(Enumerations.AdministrativeGender.MALE);
                                break;
                            case "U":
                                sourcePatient.setGender(Enumerations.AdministrativeGender.UNKNOWN);
                                break;
                            case "A":
                                sourcePatient.setGender(Enumerations.AdministrativeGender.OTHER);
                                break;
                        }
                    }
                    ListIterator<Name> names = sourcePatientInfo.getNames();
                    while (names.hasNext()) {
                        Name name = names.next();
                        sourcePatient.addName(transform(name));
                    }
                    ListIterator<Address> addresses = sourcePatientInfo.getAddresses();
                    while (addresses.hasNext()) {
                        Address address = addresses.next();
                        if (address != null)
                            sourcePatient.addAddress(transform(address));
                    }
                }
                if (sourcePatientId != null || sourcePatientInfo != null) {
                    context.getSourcePatientInfo().setResource(sourcePatient);
                }
            }
        }
    } else {
        processError(input);
    }
    return list;
}
Also used : DocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent) DocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent) Address(org.openehealth.ipf.commons.ihe.xds.core.metadata.Address) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Attachment(org.hl7.fhir.r4.model.Attachment) PatientInfo(org.openehealth.ipf.commons.ihe.xds.core.metadata.PatientInfo) Name(org.openehealth.ipf.commons.ihe.xds.core.metadata.Name) Association(org.openehealth.ipf.commons.ihe.xds.core.metadata.Association) Identifier(org.hl7.fhir.r4.model.Identifier) ReferenceId(org.openehealth.ipf.commons.ihe.xds.core.metadata.ReferenceId) DocumentEntry(org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry) ArrayList(java.util.ArrayList) List(java.util.List) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Reference(org.hl7.fhir.r4.model.Reference) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Period(org.hl7.fhir.r4.model.Period) Patient(org.hl7.fhir.r4.model.Patient) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) Practitioner(org.hl7.fhir.r4.model.Practitioner) AssociationType(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssociationType) Author(org.openehealth.ipf.commons.ihe.xds.core.metadata.Author) Person(org.openehealth.ipf.commons.ihe.xds.core.metadata.Person) DocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent)

Example 79 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project MobileAccessGateway by i4mi.

the class Iti65RequestConverter method processDocumentManifest.

/**
 * ITI-65: process DocumentManifest resource from Bundle
 * @param manifest
 * @param submissionSet
 */
private void processDocumentManifest(DocumentManifest manifest, SubmissionSet submissionSet) {
    // masterIdentifier	SubmissionSet.uniqueId
    Identifier masterIdentifier = manifest.getMasterIdentifier();
    submissionSet.setUniqueId(noPrefix(masterIdentifier.getValue()));
    submissionSet.assignEntryUuid();
    manifest.setId(submissionSet.getEntryUuid());
    CodeableConcept type = manifest.getType();
    submissionSet.setContentTypeCode(transformCodeableConcept(type));
    DateTimeType created = manifest.getCreatedElement();
    submissionSet.setSubmissionTime(timestampFromDate(created));
    // subject	SubmissionSet.patientId
    Reference ref = manifest.getSubject();
    submissionSet.setPatientId(transformReferenceToIdentifiable(ref, manifest));
    // Author
    Extension authorRoleExt = manifest.getExtensionByUrl("http://fhir.ch/ig/ch-epr-mhealth/StructureDefinition/ch-ext-author-authorrole");
    if (manifest.hasAuthor() || (authorRoleExt != null)) {
        Identifiable identifiable = null;
        Reference author = manifest.getAuthorFirstRep();
        if (authorRoleExt != null) {
            Coding coding = authorRoleExt.castToCoding(authorRoleExt.getValue());
            if (coding != null) {
                identifiable = new Identifiable(coding.getCode(), new AssigningAuthority(noPrefix(coding.getSystem())));
            }
        }
        submissionSet.setAuthor(transformAuthor(author, manifest.getContained(), identifiable));
    }
    // recipient	SubmissionSet.intendedRecipient
    for (Reference recipientRef : manifest.getRecipient()) {
        Resource res = findResource(recipientRef, manifest.getContained());
        if (res instanceof Practitioner) {
            Recipient recipient = new Recipient();
            recipient.setPerson(transform((Practitioner) res));
            recipient.setTelecom(transform(((Practitioner) res).getTelecomFirstRep()));
            submissionSet.getIntendedRecipients().add(recipient);
        } else if (res instanceof Organization) {
            Recipient recipient = new Recipient();
            recipient.setOrganization(transform((Organization) res));
            recipient.setTelecom(transform(((Organization) res).getTelecomFirstRep()));
            submissionSet.getIntendedRecipients().add(recipient);
        } else if (res instanceof PractitionerRole) {
            Recipient recipient = new Recipient();
            PractitionerRole role = (PractitionerRole) res;
            recipient.setOrganization(transform((Organization) findResource(role.getOrganization(), manifest.getContained())));
            recipient.setPerson(transform((Practitioner) findResource(role.getPractitioner(), manifest.getContained())));
            recipient.setTelecom(transform(role.getTelecomFirstRep()));
            submissionSet.getIntendedRecipients().add(recipient);
        } else if (res instanceof Patient) {
            Recipient recipient = new Recipient();
            recipient.setPerson(transform((Patient) res));
            recipient.setTelecom(transform(((Patient) res).getTelecomFirstRep()));
        } else if (res instanceof RelatedPerson) {
            Recipient recipient = new Recipient();
            recipient.setPerson(transform((RelatedPerson) res));
            recipient.setTelecom(transform(((RelatedPerson) res).getTelecomFirstRep()));
        }
    }
    // source	SubmissionSet.sourceId
    String source = noPrefix(manifest.getSource());
    submissionSet.setSourceId(source);
    String description = manifest.getDescription();
    if (description != null)
        submissionSet.setTitle(localizedString(description));
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Reference(org.hl7.fhir.r4.model.Reference) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Resource(org.hl7.fhir.r4.model.Resource) ListResource(org.hl7.fhir.r4.model.ListResource) DomainResource(org.hl7.fhir.r4.model.DomainResource) Patient(org.hl7.fhir.r4.model.Patient) Recipient(org.openehealth.ipf.commons.ihe.xds.core.metadata.Recipient) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) CXiAssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.CXiAssigningAuthority) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) LocalizedString(org.openehealth.ipf.commons.ihe.xds.core.metadata.LocalizedString) RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable) Extension(org.hl7.fhir.r4.model.Extension) Practitioner(org.hl7.fhir.r4.model.Practitioner) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 80 with RelatedPerson

use of org.hl7.fhir.r4.model.RelatedPerson in project MobileAccessGateway by i4mi.

the class Iti65RequestConverter method transform.

/**
 * FHIR RelatedPerson -> XDS Person
 * @param related
 * @return
 */
public Person transform(RelatedPerson related) {
    if (related == null)
        return null;
    Person result = new Person();
    result.setId(transform(related.getIdentifierFirstRep()));
    if (related.hasName())
        result.setName(transform(related.getNameFirstRep()));
    return result;
}
Also used : RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) Person(org.openehealth.ipf.commons.ihe.xds.core.metadata.Person)

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