use of org.hl7.fhir.r4b.model.CodeableReference in project org.hl7.fhir.core by hapifhir.
the class MedicationStatement40_50 method convertMedicationStatement.
public static org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r5.model.MedicationUsage src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement();
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));
// for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference40_50.convertReference(t));
if (src.hasStatus())
tgt.setStatusElement(convertMedicationStatementStatus(src.getStatusElement()));
// tgt.addStatusReason(CodeableConcept40_50.convertCodeableConcept(t));
if (src.hasCategory())
tgt.setCategory(CodeableConcept40_50.convertCodeableConcept(src.getCategoryFirstRep()));
if (src.getMedication().hasConcept()) {
tgt.setMedication(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMedication().getConcept()));
}
if (src.getMedication().hasReference()) {
tgt.setMedication(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getMedication().getReference()));
}
if (src.hasSubject())
tgt.setSubject(Reference40_50.convertReference(src.getSubject()));
if (src.hasEncounter())
tgt.setContext(Reference40_50.convertReference(src.getEncounter()));
if (src.hasEffective())
tgt.setEffective(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getEffective()));
if (src.hasDateAsserted())
tgt.setDateAssertedElement(DateTime40_50.convertDateTime(src.getDateAssertedElement()));
if (src.hasInformationSource())
tgt.setInformationSource(Reference40_50.convertReference(src.getInformationSource()));
for (org.hl7.fhir.r5.model.Reference t : src.getDerivedFrom()) tgt.addDerivedFrom(Reference40_50.convertReference(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.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage40_50.convertDosage(t));
return tgt;
}
use of org.hl7.fhir.r4b.model.CodeableReference in project org.hl7.fhir.core by hapifhir.
the class Immunization40_50 method convertImmunization.
public static org.hl7.fhir.r4.model.Immunization convertImmunization(org.hl7.fhir.r5.model.Immunization src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.Immunization tgt = new org.hl7.fhir.r4.model.Immunization();
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(convertImmunizationStatus(src.getStatusElement()));
if (src.hasStatusReason())
tgt.setStatusReason(CodeableConcept40_50.convertCodeableConcept(src.getStatusReason()));
if (src.hasVaccineCode())
tgt.setVaccineCode(CodeableConcept40_50.convertCodeableConcept(src.getVaccineCode()));
if (src.hasPatient())
tgt.setPatient(Reference40_50.convertReference(src.getPatient()));
if (src.hasEncounter())
tgt.setEncounter(Reference40_50.convertReference(src.getEncounter()));
if (src.hasOccurrence())
tgt.setOccurrence(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getOccurrence()));
if (src.hasRecorded())
tgt.setRecordedElement(DateTime40_50.convertDateTime(src.getRecordedElement()));
if (src.hasPrimarySource())
tgt.setPrimarySourceElement(Boolean40_50.convertBoolean(src.getPrimarySourceElement()));
if (src.hasInformationSourceCodeableConcept())
tgt.setReportOrigin(CodeableConcept40_50.convertCodeableConcept(src.getInformationSourceCodeableConcept()));
if (src.hasLocation())
tgt.setLocation(Reference40_50.convertReference(src.getLocation()));
if (src.hasManufacturer())
tgt.setManufacturer(Reference40_50.convertReference(src.getManufacturer()));
if (src.hasLotNumber())
tgt.setLotNumberElement(String40_50.convertString(src.getLotNumberElement()));
if (src.hasExpirationDate())
tgt.setExpirationDateElement(Date40_50.convertDate(src.getExpirationDateElement()));
if (src.hasSite())
tgt.setSite(CodeableConcept40_50.convertCodeableConcept(src.getSite()));
if (src.hasRoute())
tgt.setRoute(CodeableConcept40_50.convertCodeableConcept(src.getRoute()));
if (src.hasDoseQuantity())
tgt.setDoseQuantity(SimpleQuantity40_50.convertSimpleQuantity(src.getDoseQuantity()));
for (org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent t : src.getPerformer()) tgt.addPerformer(convertImmunizationPerformerComponent(t));
for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(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()));
if (src.hasIsSubpotent())
tgt.setIsSubpotentElement(Boolean40_50.convertBoolean(src.getIsSubpotentElement()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSubpotentReason()) tgt.addSubpotentReason(CodeableConcept40_50.convertCodeableConcept(t));
for (org.hl7.fhir.r5.model.Immunization.ImmunizationEducationComponent t : src.getEducation()) tgt.addEducation(convertImmunizationEducationComponent(t));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getProgramEligibility()) tgt.addProgramEligibility(CodeableConcept40_50.convertCodeableConcept(t));
if (src.hasFundingSource())
tgt.setFundingSource(CodeableConcept40_50.convertCodeableConcept(src.getFundingSource()));
for (org.hl7.fhir.r5.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) tgt.addReaction(convertImmunizationReactionComponent(t));
for (org.hl7.fhir.r5.model.Immunization.ImmunizationProtocolAppliedComponent t : src.getProtocolApplied()) tgt.addProtocolApplied(convertImmunizationProtocolAppliedComponent(t));
return tgt;
}
Aggregations