Search in sources :

Example 11 with DocumentReference

use of org.hl7.fhir.r4.model.DocumentReference in project Gravity-SDOH-Exchange-RI by FHIR.

the class RecordedSexGenderBundleFactory method onBundleCreated.

@Override
protected void onBundleCreated(Bundle bundle) {
    Observation obs = (Observation) bundle.getEntry().get(0).getResource();
    DocumentReference docRef = new DocumentReference().setStatus(Enumerations.DocumentReferenceStatus.CURRENT).setDate(new Date());
    docRef.addAuthor(new Reference(new IdType(SmartOnFhirContext.get().getFhirUser()).toUnqualifiedVersionless()));
    docRef.addContent().setAttachment(new Attachment().setTitle(derivedFromFileName).setContentType(MediaType.APPLICATION_PDF_VALUE).setData(derivedFromFile));
    docRef.setId(IdType.newRandomUuid());
    Bundle.BundleEntryComponent postEntry = FhirUtil.createPostEntry(docRef);
    obs.addDerivedFrom(FhirUtil.toReference(DocumentReference.class, docRef.getIdElement().getIdPart()));
    bundle.addEntry(postEntry);
}
Also used : DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Reference(org.hl7.fhir.r4.model.Reference) Bundle(org.hl7.fhir.r4.model.Bundle) Observation(org.hl7.fhir.r4.model.Observation) Attachment(org.hl7.fhir.r4.model.Attachment) DocumentReference(org.hl7.fhir.r4.model.DocumentReference) Date(java.util.Date) IdType(org.hl7.fhir.r4.model.IdType)

Example 12 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.dstu3.utils.formats.Turtle.Complex)

Example 13 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);
    if (element.hasFormat())
        composeCoding(t, "DocumentReference", "format", element.getFormat(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 14 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.dstu3.utils.formats.Turtle.Complex)

Example 15 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.dstu3.utils.formats.Turtle.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