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);
}
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;
}
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());
}
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);
}
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);
}
Aggregations