Search in sources :

Example 41 with CodeableReference

use of org.hl7.fhir.r5.model.CodeableReference in project org.hl7.fhir.core by hapifhir.

the class MedicationAdministration30_50 method convertMedicationAdministration.

public static org.hl7.fhir.dstu3.model.MedicationAdministration convertMedicationAdministration(org.hl7.fhir.r5.model.MedicationAdministration src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.MedicationAdministration tgt = new org.hl7.fhir.dstu3.model.MedicationAdministration();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.addDefinition().setReference(t.getValue());
    for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference30_50.convertReference(t));
    if (src.hasStatus())
        tgt.setStatusElement(convertMedicationAdministrationStatus(src.getStatusElement()));
    if (src.hasCategory())
        tgt.setCategory(CodeableConcept30_50.convertCodeableConcept(src.getCategoryFirstRep()));
    if (src.getMedication().hasConcept())
        tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getConcept()));
    if (src.getMedication().hasReference())
        tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getReference()));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    if (src.hasEncounter())
        tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
    for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(Reference30_50.convertReference(t));
    if (src.hasOccurence())
        tgt.setEffective(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getOccurence()));
    for (org.hl7.fhir.r5.model.MedicationAdministration.MedicationAdministrationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertMedicationAdministrationPerformerComponent(t));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addReasonReference(Reference30_50.convertReference(t.getReference()));
    if (src.hasRequest())
        tgt.setPrescription(Reference30_50.convertReference(src.getRequest()));
    for (org.hl7.fhir.r5.model.Reference t : src.getDevice()) tgt.addDevice(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    if (src.hasDosage())
        tgt.setDosage(convertMedicationAdministrationDosageComponent(src.getDosage()));
    for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) tgt.addEventHistory(Reference30_50.convertReference(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 42 with CodeableReference

use of org.hl7.fhir.r5.model.CodeableReference in project org.hl7.fhir.core by hapifhir.

the class MedicationRequest30_50 method convertMedicationRequest.

public static org.hl7.fhir.r5.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu3.model.MedicationRequest src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r5.model.MedicationRequest tgt = new org.hl7.fhir.r5.model.MedicationRequest();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference30_50.convertReference(t));
    if (src.hasGroupIdentifier())
        tgt.setGroupIdentifier(Identifier30_50.convertIdentifier(src.getGroupIdentifier()));
    if (src.hasStatus())
        tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement()));
    if (src.hasIntent())
        tgt.setIntentElement(convertMedicationRequestIntent(src.getIntentElement()));
    if (src.hasPriority())
        tgt.setPriorityElement(convertMedicationRequestPriority(src.getPriorityElement()));
    if (src.hasMedicationCodeableConcept())
        tgt.getMedication().setConcept(CodeableConcept30_50.convertCodeableConcept(src.getMedicationCodeableConcept()));
    if (src.hasMedicationReference())
        tgt.getMedication().setReference(Reference30_50.convertReference(src.getMedicationReference()));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    if (src.hasContext())
        tgt.setEncounter(Reference30_50.convertReference(src.getContext()));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(Reference30_50.convertReference(t));
    if (src.hasAuthoredOn())
        tgt.setAuthoredOnElement(DateTime30_50.convertDateTime(src.getAuthoredOnElement()));
    if (src.hasRecorder())
        tgt.setRecorder(Reference30_50.convertReference(src.getRecorder()));
    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(new CodeableReference().setConcept(CodeableConcept30_50.convertCodeableConcept(t)));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) tgt.addReason(new CodeableReference().setReference(Reference30_50.convertReference(t)));
    for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) tgt.getDose().addDosageInstruction(Dosage30_50.convertDosage(t));
    if (src.hasDispenseRequest())
        tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest()));
    if (src.hasSubstitution())
        tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution()));
    if (src.hasPriorPrescription())
        tgt.setPriorPrescription(Reference30_50.convertReference(src.getPriorPrescription()));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(Reference30_50.convertReference(t));
    for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(Reference30_50.convertReference(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 43 with CodeableReference

use of org.hl7.fhir.r5.model.CodeableReference in project org.hl7.fhir.core by hapifhir.

the class MedicationRequest30_50 method convertMedicationRequest.

public static org.hl7.fhir.dstu3.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.r5.model.MedicationRequest src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.dstu3.model.MedicationRequest tgt = new org.hl7.fhir.dstu3.model.MedicationRequest();
    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference30_50.convertReference(t));
    if (src.hasGroupIdentifier())
        tgt.setGroupIdentifier(Identifier30_50.convertIdentifier(src.getGroupIdentifier()));
    if (src.hasStatus())
        tgt.setStatusElement(convertMedicationRequestStatus(src.getStatusElement()));
    if (src.hasIntent())
        tgt.setIntentElement(convertMedicationRequestIntent(src.getIntentElement()));
    if (src.hasPriority())
        tgt.setPriorityElement(convertMedicationRequestPriority(src.getPriorityElement()));
    if (src.getMedication().hasConcept())
        tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getConcept()));
    if (src.getMedication().hasReference())
        tgt.setMedication(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getMedication().getReference()));
    if (src.hasSubject())
        tgt.setSubject(Reference30_50.convertReference(src.getSubject()));
    if (src.hasEncounter())
        tgt.setContext(Reference30_50.convertReference(src.getEncounter()));
    for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(Reference30_50.convertReference(t));
    if (src.hasAuthoredOn())
        tgt.setAuthoredOnElement(DateTime30_50.convertDateTime(src.getAuthoredOnElement()));
    if (src.hasRecorder())
        tgt.setRecorder(Reference30_50.convertReference(src.getRecorder()));
    for (CodeableReference t : src.getReason()) {
        if (t.hasConcept()) {
            tgt.addReasonCode(CodeableConcept30_50.convertCodeableConcept(t.getConcept()));
        }
        if (t.hasReference()) {
            tgt.addReasonReference(Reference30_50.convertReference(t.getReference()));
        }
    }
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation30_50.convertAnnotation(t));
    for (org.hl7.fhir.r5.model.Dosage t : src.getDose().getDosageInstruction()) tgt.addDosageInstruction(Dosage30_50.convertDosage(t));
    if (src.hasDispenseRequest())
        tgt.setDispenseRequest(convertMedicationRequestDispenseRequestComponent(src.getDispenseRequest()));
    if (src.hasSubstitution())
        tgt.setSubstitution(convertMedicationRequestSubstitutionComponent(src.getSubstitution()));
    if (src.hasPriorPrescription())
        tgt.setPriorPrescription(Reference30_50.convertReference(src.getPriorPrescription()));
    for (org.hl7.fhir.r5.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(Reference30_50.convertReference(t));
    for (org.hl7.fhir.r5.model.Reference t : src.getEventHistory()) tgt.addEventHistory(Reference30_50.convertReference(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 44 with CodeableReference

use of org.hl7.fhir.r5.model.CodeableReference in project org.hl7.fhir.core by hapifhir.

the class CareTeam40_50 method convertCareTeam.

public static org.hl7.fhir.r4.model.CareTeam convertCareTeam(org.hl7.fhir.r5.model.CareTeam src) throws FHIRException {
    if (src == null)
        return null;
    org.hl7.fhir.r4.model.CareTeam tgt = new org.hl7.fhir.r4.model.CareTeam();
    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
    if (src.hasStatus())
        tgt.setStatusElement(convertCareTeamStatus(src.getStatusElement()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(CodeableConcept40_50.convertCodeableConcept(t));
    if (src.hasName())
        tgt.setNameElement(String40_50.convertString(src.getNameElement()));
    if (src.hasSubject())
        tgt.setSubject(Reference40_50.convertReference(src.getSubject()));
    if (src.hasPeriod())
        tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
    for (org.hl7.fhir.r5.model.CareTeam.CareTeamParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertCareTeamParticipantComponent(t));
    for (CodeableReference t : src.getReason()) if (t.hasConcept())
        tgt.addReasonCode(CodeableConcept40_50.convertCodeableConcept(t.getConcept()));
    for (CodeableReference t : src.getReason()) if (t.hasReference())
        tgt.addReasonReference(Reference40_50.convertReference(t.getReference()));
    for (org.hl7.fhir.r5.model.Reference t : src.getManagingOrganization()) tgt.addManagingOrganization(Reference40_50.convertReference(t));
    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(ContactPoint40_50.convertContactPoint(t));
    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
    return tgt;
}
Also used : CodeableReference(org.hl7.fhir.r5.model.CodeableReference)

Example 45 with CodeableReference

use of org.hl7.fhir.r5.model.CodeableReference in project org.hl7.fhir.core by hapifhir.

the class JsonParser method composeType.

protected void composeType(String prefix, DataType type) throws IOException {
    if (type == null) {
        ;
    } else if (type instanceof Address) {
        composeAddress(prefix + "Address", (Address) type);
    } else if (type instanceof Age) {
        composeAge(prefix + "Age", (Age) type);
    } else if (type instanceof Annotation) {
        composeAnnotation(prefix + "Annotation", (Annotation) type);
    } else if (type instanceof Attachment) {
        composeAttachment(prefix + "Attachment", (Attachment) type);
    } else if (type instanceof CodeableConcept) {
        composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
    } else if (type instanceof CodeableReference) {
        composeCodeableReference(prefix + "CodeableReference", (CodeableReference) type);
    } else if (type instanceof Coding) {
        composeCoding(prefix + "Coding", (Coding) type);
    } else if (type instanceof ContactDetail) {
        composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
    } else if (type instanceof ContactPoint) {
        composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
    } else if (type instanceof Contributor) {
        composeContributor(prefix + "Contributor", (Contributor) type);
    } else if (type instanceof Count) {
        composeCount(prefix + "Count", (Count) type);
    } else if (type instanceof DataRequirement) {
        composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    } else if (type instanceof Distance) {
        composeDistance(prefix + "Distance", (Distance) type);
    } else if (type instanceof Dosage) {
        composeDosage(prefix + "Dosage", (Dosage) type);
    } else if (type instanceof Duration) {
        composeDuration(prefix + "Duration", (Duration) type);
    } else if (type instanceof ElementDefinition) {
        composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
    } else if (type instanceof Expression) {
        composeExpression(prefix + "Expression", (Expression) type);
    } else if (type instanceof Extension) {
        composeExtension(prefix + "Extension", (Extension) type);
    } else if (type instanceof HumanName) {
        composeHumanName(prefix + "HumanName", (HumanName) type);
    } else if (type instanceof Identifier) {
        composeIdentifier(prefix + "Identifier", (Identifier) type);
    } else if (type instanceof MarketingStatus) {
        composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
    } else if (type instanceof Meta) {
        composeMeta(prefix + "Meta", (Meta) type);
    } else if (type instanceof Money) {
        composeMoney(prefix + "Money", (Money) type);
    } else if (type instanceof Narrative) {
        composeNarrative(prefix + "Narrative", (Narrative) type);
    } else if (type instanceof ParameterDefinition) {
        composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
    } else if (type instanceof Period) {
        composePeriod(prefix + "Period", (Period) type);
    } else if (type instanceof Population) {
        composePopulation(prefix + "Population", (Population) type);
    } else if (type instanceof ProdCharacteristic) {
        composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) type);
    } else if (type instanceof ProductShelfLife) {
        composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
    } else if (type instanceof Quantity) {
        composeQuantity(prefix + "Quantity", (Quantity) type);
    } else if (type instanceof Range) {
        composeRange(prefix + "Range", (Range) type);
    } else if (type instanceof Ratio) {
        composeRatio(prefix + "Ratio", (Ratio) type);
    } else if (type instanceof RatioRange) {
        composeRatioRange(prefix + "RatioRange", (RatioRange) type);
    } else if (type instanceof Reference) {
        composeReference(prefix + "Reference", (Reference) type);
    } else if (type instanceof RelatedArtifact) {
        composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
    } else if (type instanceof SampledData) {
        composeSampledData(prefix + "SampledData", (SampledData) type);
    } else if (type instanceof Signature) {
        composeSignature(prefix + "Signature", (Signature) type);
    } else if (type instanceof Timing) {
        composeTiming(prefix + "Timing", (Timing) type);
    } else if (type instanceof TriggerDefinition) {
        composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
    } else if (type instanceof UsageContext) {
        composeUsageContext(prefix + "UsageContext", (UsageContext) type);
    } else if (type instanceof CodeType) {
        composeCodeCore(prefix + "Code", (CodeType) type, false);
        composeCodeExtras(prefix + "Code", (CodeType) type, false);
    } else if (type instanceof OidType) {
        composeOidCore(prefix + "Oid", (OidType) type, false);
        composeOidExtras(prefix + "Oid", (OidType) type, false);
    } else if (type instanceof CanonicalType) {
        composeCanonicalCore(prefix + "Canonical", (CanonicalType) type, false);
        composeCanonicalExtras(prefix + "Canonical", (CanonicalType) type, false);
    } else if (type instanceof UuidType) {
        composeUuidCore(prefix + "Uuid", (UuidType) type, false);
        composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
    } else if (type instanceof UrlType) {
        composeUrlCore(prefix + "Url", (UrlType) type, false);
        composeUrlExtras(prefix + "Url", (UrlType) type, false);
    } else if (type instanceof UnsignedIntType) {
        composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
        composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
    } else if (type instanceof MarkdownType) {
        composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
        composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
    } else if (type instanceof IdType) {
        composeIdCore(prefix + "Id", (IdType) type, false);
        composeIdExtras(prefix + "Id", (IdType) type, false);
    } else if (type instanceof PositiveIntType) {
        composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
        composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
    } else if (type instanceof DateType) {
        composeDateCore(prefix + "Date", (DateType) type, false);
        composeDateExtras(prefix + "Date", (DateType) type, false);
    } else if (type instanceof DateTimeType) {
        composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
        composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
    } else if (type instanceof StringType) {
        composeStringCore(prefix + "String", (StringType) type, false);
        composeStringExtras(prefix + "String", (StringType) type, false);
    } else if (type instanceof IntegerType) {
        composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
        composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
    } else if (type instanceof Integer64Type) {
        composeInteger64Core(prefix + "Integer64", (Integer64Type) type, false);
        composeInteger64Extras(prefix + "Integer64", (Integer64Type) type, false);
    } else if (type instanceof UriType) {
        composeUriCore(prefix + "Uri", (UriType) type, false);
        composeUriExtras(prefix + "Uri", (UriType) type, false);
    } else if (type instanceof InstantType) {
        composeInstantCore(prefix + "Instant", (InstantType) type, false);
        composeInstantExtras(prefix + "Instant", (InstantType) type, false);
    } else if (type instanceof BooleanType) {
        composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
        composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
    } else if (type instanceof Base64BinaryType) {
        composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
        composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
    } else if (type instanceof TimeType) {
        composeTimeCore(prefix + "Time", (TimeType) type, false);
        composeTimeExtras(prefix + "Time", (TimeType) type, false);
    } else if (type instanceof DecimalType) {
        composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
        composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
    } else
        throw new Error("Unhandled type");
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Aggregations

CodeableReference (org.hl7.fhir.r5.model.CodeableReference)58 CodeableConcept (org.hl7.fhir.r5.model.CodeableConcept)5 NotImplementedException (org.apache.commons.lang3.NotImplementedException)4 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)3 Annotation (org.hl7.fhir.r5.model.Annotation)3 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Base64 (org.apache.commons.codec.binary.Base64)2 ElementDefn (org.hl7.fhir.definitions.model.ElementDefn)2 Address (org.hl7.fhir.r4b.model.Address)2 Annotation (org.hl7.fhir.r4b.model.Annotation)2 Attachment (org.hl7.fhir.r4b.model.Attachment)2 Base (org.hl7.fhir.r4b.model.Base)2 Base64BinaryType (org.hl7.fhir.r4b.model.Base64BinaryType)2 BooleanType (org.hl7.fhir.r4b.model.BooleanType)2 CodeType (org.hl7.fhir.r4b.model.CodeType)2 CodeableConcept (org.hl7.fhir.r4b.model.CodeableConcept)2 CodeableReference (org.hl7.fhir.r4b.model.CodeableReference)2 Coding (org.hl7.fhir.r4b.model.Coding)2