Search in sources :

Example 6 with Dosage

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

the class RdfParser method composeMedicationAdministrationMedicationAdministrationDosageComponent.

protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(Complex parent, String parentType, String name, MedicationAdministration.MedicationAdministrationDosageComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "dosage", name, element, index);
    if (element.hasTextElement())
        composeString(t, "MedicationAdministration", "text", element.getTextElement(), -1);
    if (element.hasSite())
        composeCodeableConcept(t, "MedicationAdministration", "site", element.getSite(), -1);
    if (element.hasRoute())
        composeCodeableConcept(t, "MedicationAdministration", "route", element.getRoute(), -1);
    if (element.hasMethod())
        composeCodeableConcept(t, "MedicationAdministration", "method", element.getMethod(), -1);
    if (element.hasDose())
        composeQuantity(t, "MedicationAdministration", "dose", element.getDose(), -1);
    if (element.hasRate())
        composeType(t, "MedicationAdministration", "rate", element.getRate(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 7 with Dosage

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

the class RdfParser method composeActivityDefinition.

protected void composeActivityDefinition(Complex parent, String parentType, String name, ActivityDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ActivityDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "ActivityDefinition", "url", element.getUrlElement(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ActivityDefinition", "identifier", element.getIdentifier().get(i), i);
    if (element.hasVersionElement())
        composeString(t, "ActivityDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "ActivityDefinition", "name", element.getNameElement(), -1);
    if (element.hasTitleElement())
        composeString(t, "ActivityDefinition", "title", element.getTitleElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "ActivityDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "ActivityDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "ActivityDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "ActivityDefinition", "publisher", element.getPublisherElement(), -1);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "ActivityDefinition", "description", element.getDescriptionElement(), -1);
    if (element.hasPurposeElement())
        composeMarkdown(t, "ActivityDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasUsageElement())
        composeString(t, "ActivityDefinition", "usage", element.getUsageElement(), -1);
    if (element.hasApprovalDateElement())
        composeDate(t, "ActivityDefinition", "approvalDate", element.getApprovalDateElement(), -1);
    if (element.hasLastReviewDateElement())
        composeDate(t, "ActivityDefinition", "lastReviewDate", element.getLastReviewDateElement(), -1);
    if (element.hasEffectivePeriod())
        composePeriod(t, "ActivityDefinition", "effectivePeriod", element.getEffectivePeriod(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "ActivityDefinition", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
    for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "topic", element.getTopic().get(i), i);
    for (int i = 0; i < element.getContributor().size(); i++) composeContributor(t, "ActivityDefinition", "contributor", element.getContributor().get(i), i);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "ActivityDefinition", "contact", element.getContact().get(i), i);
    if (element.hasCopyrightElement())
        composeMarkdown(t, "ActivityDefinition", "copyright", element.getCopyrightElement(), -1);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "ActivityDefinition", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    for (int i = 0; i < element.getLibrary().size(); i++) composeReference(t, "ActivityDefinition", "library", element.getLibrary().get(i), i);
    if (element.hasKindElement())
        composeEnum(t, "ActivityDefinition", "kind", element.getKindElement(), -1);
    if (element.hasCode())
        composeCodeableConcept(t, "ActivityDefinition", "code", element.getCode(), -1);
    if (element.hasTiming())
        composeType(t, "ActivityDefinition", "timing", element.getTiming(), -1);
    if (element.hasLocation())
        composeReference(t, "ActivityDefinition", "location", element.getLocation(), -1);
    for (int i = 0; i < element.getParticipant().size(); i++) composeActivityDefinitionActivityDefinitionParticipantComponent(t, "ActivityDefinition", "participant", element.getParticipant().get(i), i);
    if (element.hasProduct())
        composeType(t, "ActivityDefinition", "product", element.getProduct(), -1);
    if (element.hasQuantity())
        composeQuantity(t, "ActivityDefinition", "quantity", element.getQuantity(), -1);
    for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "ActivityDefinition", "dosage", element.getDosage().get(i), i);
    for (int i = 0; i < element.getBodySite().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "bodySite", element.getBodySite().get(i), i);
    if (element.hasTransform())
        composeReference(t, "ActivityDefinition", "transform", element.getTransform(), -1);
    for (int i = 0; i < element.getDynamicValue().size(); i++) composeActivityDefinitionActivityDefinitionDynamicValueComponent(t, "ActivityDefinition", "dynamicValue", element.getDynamicValue().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 8 with Dosage

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

the class MedicationRequest10_30 method convertMedicationOrder.

public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest();
    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
    tgt.setIntent(MedicationRequest.MedicationRequestIntent.ORDER);
    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
    if (src.hasDateWritten())
        tgt.setAuthoredOn(src.getDateWritten());
    if (src.hasStatus())
        tgt.setStatus(MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode()));
    if (src.hasPatient())
        tgt.setSubject(Reference10_30.convertReference(src.getPatient()));
    if (src.hasPrescriber())
        tgt.setRequester(medRequestor(src));
    if (src.hasEncounter())
        tgt.setContext(Reference10_30.convertReference(src.getEncounter()));
    if (src.hasReasonCodeableConcept())
        tgt.addReasonCode(CodeableConcept10_30.convertCodeableConcept(src.getReasonCodeableConcept()));
    if (src.hasReasonReference())
        tgt.addReasonReference(Reference10_30.convertReference(src.getReasonReference()));
    if (src.hasNote())
        tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation(new StringType(src.getNote())));
    if (src.hasMedication())
        tgt.setMedication(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getMedication()));
    for (MedicationOrder.MedicationOrderDosageInstructionComponent dosage : src.getDosageInstruction()) tgt.addDosageInstruction(medDosageInstruction(dosage));
    if (src.hasDispenseRequest())
        tgt.setDispenseRequest(medDispenseRequest(src.getDispenseRequest()));
    if (src.hasSubstitution())
        tgt.setSubstitution(medSubstitution(src.getSubstitution()));
    if (src.hasPriorPrescription())
        tgt.setPriorPrescription(Reference10_30.convertReference(src.getPriorPrescription()));
    return tgt;
}
Also used : MedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest) MedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest) StringType(org.hl7.fhir.dstu3.model.StringType) MedicationOrder(org.hl7.fhir.dstu2.model.MedicationOrder)

Example 9 with Dosage

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

the class RdfParser method composeDosage.

protected void composeDosage(Complex parent, String parentType, String name, Dosage element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeElement(t, "Dosage", name, element, index);
    if (element.hasSequenceElement())
        composeInteger(t, "Dosage", "sequence", element.getSequenceElement(), -1);
    if (element.hasTextElement())
        composeString(t, "Dosage", "text", element.getTextElement(), -1);
    for (int i = 0; i < element.getAdditionalInstruction().size(); i++) composeCodeableConcept(t, "Dosage", "additionalInstruction", element.getAdditionalInstruction().get(i), i);
    if (element.hasPatientInstructionElement())
        composeString(t, "Dosage", "patientInstruction", element.getPatientInstructionElement(), -1);
    if (element.hasTiming())
        composeTiming(t, "Dosage", "timing", element.getTiming(), -1);
    if (element.hasAsNeeded())
        composeType(t, "Dosage", "asNeeded", element.getAsNeeded(), -1);
    if (element.hasSite())
        composeCodeableConcept(t, "Dosage", "site", element.getSite(), -1);
    if (element.hasRoute())
        composeCodeableConcept(t, "Dosage", "route", element.getRoute(), -1);
    if (element.hasMethod())
        composeCodeableConcept(t, "Dosage", "method", element.getMethod(), -1);
    if (element.hasDose())
        composeType(t, "Dosage", "dose", element.getDose(), -1);
    if (element.hasMaxDosePerPeriod())
        composeRatio(t, "Dosage", "maxDosePerPeriod", element.getMaxDosePerPeriod(), -1);
    if (element.hasMaxDosePerAdministration())
        composeQuantity(t, "Dosage", "maxDosePerAdministration", element.getMaxDosePerAdministration(), -1);
    if (element.hasMaxDosePerLifetime())
        composeQuantity(t, "Dosage", "maxDosePerLifetime", element.getMaxDosePerLifetime(), -1);
    if (element.hasRate())
        composeType(t, "Dosage", "rate", element.getRate(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 10 with Dosage

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

the class RdfParser method composeMedicationAdministrationMedicationAdministrationDosageComponent.

protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(Complex parent, String parentType, String name, MedicationAdministration.MedicationAdministrationDosageComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "dosage", name, element, index);
    if (element.hasTextElement())
        composeString(t, "MedicationAdministration", "text", element.getTextElement(), -1);
    if (element.hasSite())
        composeType(t, "MedicationAdministration", "site", element.getSite(), -1);
    if (element.hasRoute())
        composeCodeableConcept(t, "MedicationAdministration", "route", element.getRoute(), -1);
    if (element.hasMethod())
        composeCodeableConcept(t, "MedicationAdministration", "method", element.getMethod(), -1);
    if (element.hasQuantity())
        composeQuantity(t, "MedicationAdministration", "quantity", element.getQuantity(), -1);
    if (element.hasRate())
        composeType(t, "MedicationAdministration", "rate", element.getRate(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Dosage (org.hl7.fhir.r4.model.Dosage)8 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)8 Date (java.util.Date)6 ArrayList (java.util.ArrayList)5 Reference (org.hl7.fhir.dstu3.model.Reference)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 Test (org.junit.Test)5 JsonElement (com.google.gson.JsonElement)4 JsonObject (com.google.gson.JsonObject)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Dosage (org.hl7.fhir.dstu3.model.Dosage)4 Coding (org.hl7.fhir.r4.model.Coding)4 Quantity (org.hl7.fhir.r4.model.Quantity)4 NotImplementedException (org.apache.commons.lang3.NotImplementedException)3 Coding (org.hl7.fhir.dstu3.model.Coding)3 Quantity (org.hl7.fhir.dstu3.model.Quantity)3 Timing (org.hl7.fhir.dstu3.model.Timing)3 BooleanType (org.hl7.fhir.r4.model.BooleanType)3 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3