Search in sources :

Example 46 with DocumentReference

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

the class RdfParser method composeDocumentReference.

protected void composeDocumentReference(Complex parent, String parentType, String name, DocumentReference element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "DocumentReference", name, element, index);
    if (element.hasMasterIdentifier())
        composeIdentifier(t, "DocumentReference", "masterIdentifier", element.getMasterIdentifier(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "DocumentReference", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "DocumentReference", "status", element.getStatusElement(), -1);
    if (element.hasDocStatusElement())
        composeEnum(t, "DocumentReference", "docStatus", element.getDocStatusElement(), -1);
    if (element.hasType())
        composeCodeableConcept(t, "DocumentReference", "type", element.getType(), -1);
    for (int i = 0; i < element.getCategory().size(); i++) composeCodeableConcept(t, "DocumentReference", "category", element.getCategory().get(i), i);
    if (element.hasSubject())
        composeReference(t, "DocumentReference", "subject", element.getSubject(), -1);
    if (element.hasDateElement())
        composeInstant(t, "DocumentReference", "date", element.getDateElement(), -1);
    for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "DocumentReference", "author", element.getAuthor().get(i), i);
    if (element.hasAuthenticator())
        composeReference(t, "DocumentReference", "authenticator", element.getAuthenticator(), -1);
    if (element.hasCustodian())
        composeReference(t, "DocumentReference", "custodian", element.getCustodian(), -1);
    for (int i = 0; i < element.getRelatesTo().size(); i++) composeDocumentReferenceDocumentReferenceRelatesToComponent(t, "DocumentReference", "relatesTo", element.getRelatesTo().get(i), i);
    if (element.hasDescriptionElement())
        composeString(t, "DocumentReference", "description", element.getDescriptionElement(), -1);
    for (int i = 0; i < element.getSecurityLabel().size(); i++) composeCodeableConcept(t, "DocumentReference", "securityLabel", element.getSecurityLabel().get(i), i);
    for (int i = 0; i < element.getContent().size(); i++) composeDocumentReferenceDocumentReferenceContentComponent(t, "DocumentReference", "content", element.getContent().get(i), i);
    if (element.hasContext())
        composeDocumentReferenceDocumentReferenceContextComponent(t, "DocumentReference", "context", element.getContext(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 47 with DocumentReference

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

the class RdfParser method composeDocumentReferenceDocumentReferenceContextComponent.

protected void composeDocumentReferenceDocumentReferenceContextComponent(Complex parent, String parentType, String name, DocumentReference.DocumentReferenceContextComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "context", name, element, index);
    if (element.hasEncounter())
        composeReference(t, "DocumentReference", "encounter", element.getEncounter(), -1);
    for (int i = 0; i < element.getEvent().size(); i++) composeCodeableConcept(t, "DocumentReference", "event", element.getEvent().get(i), i);
    if (element.hasPeriod())
        composePeriod(t, "DocumentReference", "period", element.getPeriod(), -1);
    if (element.hasFacilityType())
        composeCodeableConcept(t, "DocumentReference", "facilityType", element.getFacilityType(), -1);
    if (element.hasPracticeSetting())
        composeCodeableConcept(t, "DocumentReference", "practiceSetting", element.getPracticeSetting(), -1);
    if (element.hasSourcePatientInfo())
        composeReference(t, "DocumentReference", "sourcePatientInfo", element.getSourcePatientInfo(), -1);
    for (int i = 0; i < element.getRelated().size(); i++) composeDocumentReferenceDocumentReferenceContextRelatedComponent(t, "DocumentReference", "related", element.getRelated().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 48 with DocumentReference

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

the class RdfParser method composeDocumentReferenceDocumentReferenceContextRelatedComponent.

protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(Complex parent, String parentType, String name, DocumentReference.DocumentReferenceContextRelatedComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "related", name, element, index);
    if (element.hasIdentifier())
        composeIdentifier(t, "DocumentReference", "identifier", element.getIdentifier(), -1);
    if (element.hasRef())
        composeReference(t, "DocumentReference", "ref", element.getRef(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 49 with DocumentReference

use of org.hl7.fhir.r4.model.DocumentReference in project eCRNow by drajer-health.

the class R4ResourcesDataTest method constructR4DocumentReferenceTest.

@Test
public void constructR4DocumentReferenceTest() {
    R4ResourcesData dataObject = new R4ResourcesData();
    String rrXml = TestUtils.getFileContentAsString("R4/Misc/TestRRXml.xml");
    DocumentReference result = dataObject.constructR4DocumentReference(rrXml, "P123456", "E98765");
    assertNotNull(result);
}
Also used : DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Test(org.junit.Test)

Example 50 with DocumentReference

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

the class Iti67RequestUpdateConverter method convertDocumentReferenceToDocumentEntry.

/**
 * ITI-67 Response to ITI-57 request converter
 *
 * @param searchParameter
 * @return
 */
public SubmitObjectsRequest convertDocumentReferenceToDocumentEntry(@Body DocumentReference documentReference) {
    SubmissionSet submissionSet = new SubmissionSet();
    submissionSet.setSubmissionTime(new Timestamp(ZonedDateTime.now(), Timestamp.Precision.SECOND));
    Extension source = documentReference.getExtensionByUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-sourceId");
    if (source != null && source.getValue() instanceof Identifier) {
        submissionSet.setSourceId(noPrefix(((Identifier) source.getValue()).getValue()));
    }
    Extension designationType = documentReference.getExtensionByUrl("http://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType");
    if (designationType != null && designationType.getValue() instanceof CodeableConcept) {
        submissionSet.setContentTypeCode(transformCodeableConcept((CodeableConcept) designationType.getValue()));
    }
    Extension authorRoleExt = documentReference.getExtensionByUrl("http://fhir.ch/ig/ch-epr-mhealth/StructureDefinition/ch-ext-author-authorrole");
    if (authorRoleExt != null) {
        Identifiable identifiable = null;
        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(null, null, identifiable));
    }
    // TODO should be
    RegisterDocumentSetBuilder builder = new RegisterDocumentSetBuilder(true, submissionSet);
    // true?
    DocumentEntry entry = new DocumentEntry();
    processDocumentReference(documentReference, entry);
    entry.setLogicalUuid(new URN(UUID.randomUUID()).toString());
    submissionSet.setPatientId(entry.getPatientId());
    submissionSet.assignEntryUuid();
    builder.withDocument(entry);
    builder.withAssociation(createHasMemberAssocationWithOriginalPreviousLabel(submissionSet, entry));
    return EbXML30Converters.convert(builder.build());
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) URN(org.openehealth.ipf.commons.core.URN) Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) RegisterDocumentSetBuilder(org.openehealth.ipf.commons.ihe.xds.core.requests.builder.RegisterDocumentSetBuilder) SubmissionSet(org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet) DocumentEntry(org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry) AssigningAuthority(org.openehealth.ipf.commons.ihe.xds.core.metadata.AssigningAuthority) Timestamp(org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Identifiable(org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)

Aggregations

DocumentReference (org.hl7.fhir.r4.model.DocumentReference)32 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 ValueSource (org.junit.jupiter.params.provider.ValueSource)15 Identifier (org.hl7.fhir.r4.model.Identifier)12 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)10 Coding (org.hl7.fhir.r4.model.Coding)8 Attachment (org.hl7.fhir.r4.model.Attachment)7 Reference (org.hl7.fhir.r4.model.Reference)7 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)6 Practitioner (org.hl7.fhir.r4.model.Practitioner)6 Resource (org.hl7.fhir.r4.model.Resource)6 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)5 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)5 Bundle (org.hl7.fhir.r4.model.Bundle)5 HashMap (java.util.HashMap)4 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)4 DocumentReferenceContextComponent (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent)4 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)4 Test (org.junit.jupiter.api.Test)4 Identifiable (org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable)4