Search in sources :

Example 36 with DocumentReference

use of org.hl7.fhir.r4.model.DocumentReference in project fhir-bridge by ehrbase.

the class DocumentReferenceProcessor method process.

@Override
public void process(Exchange exchange) throws Exception {
    DocumentReference documentReference = exchange.getIn().getMandatoryBody(DocumentReference.class);
    Attachment attachment = documentReference.getContentFirstRep().getAttachment();
    ObjectWriteResponse response = minioService.uploadObject(new ByteArrayInputStream(attachment.getData()), attachment.getContentType());
    if (!attachment.hasSize()) {
        attachment.setSize(attachment.getData().length);
    }
    attachment.setUrl(minioService.getObjectUrl(response.object()));
    attachment.setData(null);
    exchange.getMessage().setHeader(CamelConstants.MINIO_OBJECT, response.object());
    MethodOutcome outcome = new MethodOutcome().setResource(documentReference);
    exchange.setProperty(CamelConstants.OUTCOME, outcome);
}
Also used : ObjectWriteResponse(io.minio.ObjectWriteResponse) ByteArrayInputStream(java.io.ByteArrayInputStream) Attachment(org.hl7.fhir.r4.model.Attachment) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) DocumentReference(org.hl7.fhir.r4.model.DocumentReference)

Example 37 with DocumentReference

use of org.hl7.fhir.r4.model.DocumentReference in project fhir-bridge by ehrbase.

the class DocumentReferenceToHipDocumentConverter method getMultimedia.

private MediendateiCluster getMultimedia(DocumentReference documentReference) {
    Attachment attachment = documentReference.getContentFirstRep().getAttachment();
    DvMultimedia multimedia = new DvMultimedia();
    multimedia.setUri(new DvURI(attachment.getUrl()));
    multimedia.setMediaType(new CodePhrase(new TerminologyId("IANA_media-types"), attachment.getContentType()));
    multimedia.setSize(attachment.getSize());
    MediendateiCluster result = new MediendateiCluster();
    result.setMediendateiInhalt(multimedia);
    result.setMediendateiInhaltValue(attachment.getTitle());
    result.setBeschreibungValue(documentReference.getDescription());
    getCreation(attachment).ifPresent(result::setErstelltValue);
    return result;
}
Also used : TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) Attachment(org.hl7.fhir.r4.model.Attachment) DvMultimedia(com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia) MediendateiCluster(org.ehrbase.fhirbridge.ehr.opt.hipdocumentcomposition.definition.MediendateiCluster) DvURI(com.nedap.archie.rm.datavalues.DvURI)

Example 38 with DocumentReference

use of org.hl7.fhir.r4.model.DocumentReference in project fhir-bridge by ehrbase.

the class DocumentReferenceIT method testMapping.

@Override
public void testMapping(String resourcePath, String paragonPath) throws IOException {
    DocumentReference documentReference = (DocumentReference) super.testFileLoader.loadResource(resourcePath);
    DocumentReferenceToHipDocumentConverter converter = new DocumentReferenceToHipDocumentConverter();
    HIPDocumentComposition result = converter.convert(documentReference);
    Diff diff = compareCompositions(getJavers(), paragonPath, result);
    assertEquals(0, diff.getChanges().size());
}
Also used : Diff(org.javers.core.diff.Diff) DocumentReferenceToHipDocumentConverter(org.ehrbase.fhirbridge.ehr.converter.specific.hipdocument.DocumentReferenceToHipDocumentConverter) HIPDocumentComposition(org.ehrbase.fhirbridge.ehr.opt.hipdocumentcomposition.HIPDocumentComposition) DocumentReference(org.hl7.fhir.r4.model.DocumentReference)

Example 39 with DocumentReference

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

the class RdfParser method composeDocumentReferenceDocumentReferenceContentComponent.

protected void composeDocumentReferenceDocumentReferenceContentComponent(Complex parent, String parentType, String name, DocumentReference.DocumentReferenceContentComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "content", name, element, index);
    if (element.hasAttachment())
        composeAttachment(t, "DocumentReference", "attachment", element.getAttachment(), -1);
    for (int i = 0; i < element.getFormat().size(); i++) composeCoding(t, "DocumentReference", "format", element.getFormat().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 40 with DocumentReference

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

the class RdfParser method composeDocumentReferenceDocumentReferenceRelatesToComponent.

protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(Complex parent, String parentType, String name, DocumentReference.DocumentReferenceRelatesToComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "relatesTo", name, element, index);
    if (element.hasCodeElement())
        composeEnum(t, "DocumentReference", "code", element.getCodeElement(), -1);
    if (element.hasTarget())
        composeReference(t, "DocumentReference", "target", element.getTarget(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

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