
001package org.hl7.fhir.convertors.conv43_50.resources43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 009import org.hl7.fhir.exceptions.FHIRException; 010import org.hl7.fhir.r5.model.Enumeration; 011import org.hl7.fhir.r5.model.ImmunizationEvaluation; 012 013/* 014 Copyright (c) 2011+, HL7, Inc. 015 All rights reserved. 016 017 Redistribution and use in source and binary forms, with or without modification, 018 are permitted provided that the following conditions are met: 019 020 * Redistributions of source code must retain the above copyright notice, this 021 list of conditions and the following disclaimer. 022 * Redistributions in binary form must reproduce the above copyright notice, 023 this list of conditions and the following disclaimer in the documentation 024 and/or other materials provided with the distribution. 025 * Neither the name of HL7 nor the names of its contributors may be used to 026 endorse or promote products derived from this software without specific 027 prior written permission. 028 029 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 030 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 031 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 032 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 033 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 034 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 035 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 036 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 037 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 038 POSSIBILITY OF SUCH DAMAGE. 039 040*/ 041// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 042public class ImmunizationEvaluation43_50 { 043 044 public static org.hl7.fhir.r5.model.ImmunizationEvaluation convertImmunizationEvaluation(org.hl7.fhir.r4b.model.ImmunizationEvaluation src) throws FHIRException { 045 if (src == null) 046 return null; 047 org.hl7.fhir.r5.model.ImmunizationEvaluation tgt = new org.hl7.fhir.r5.model.ImmunizationEvaluation(); 048 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 049 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 050 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 051 if (src.hasStatus()) 052 tgt.setStatusElement(convertImmunizationEvaluationStatus(src.getStatusElement())); 053 if (src.hasPatient()) 054 tgt.setPatient(Reference43_50.convertReference(src.getPatient())); 055 if (src.hasDate()) 056 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 057 if (src.hasAuthority()) 058 tgt.setAuthority(Reference43_50.convertReference(src.getAuthority())); 059 if (src.hasTargetDisease()) 060 tgt.setTargetDisease(CodeableConcept43_50.convertCodeableConcept(src.getTargetDisease())); 061 if (src.hasImmunizationEvent()) 062 tgt.setImmunizationEvent(Reference43_50.convertReference(src.getImmunizationEvent())); 063 if (src.hasDoseStatus()) 064 tgt.setDoseStatus(CodeableConcept43_50.convertCodeableConcept(src.getDoseStatus())); 065 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getDoseStatusReason()) 066 tgt.addDoseStatusReason(CodeableConcept43_50.convertCodeableConcept(t)); 067 if (src.hasDescription()) 068 tgt.setDescriptionElement(String43_50.convertStringToMarkdown(src.getDescriptionElement())); 069 if (src.hasSeries()) 070 tgt.setSeriesElement(String43_50.convertString(src.getSeriesElement())); 071 if (src.hasDoseNumber()) 072 tgt.setDoseNumber(src.getDoseNumber().primitiveValue()); 073 if (src.hasSeriesDoses()) 074 tgt.setSeriesDoses(src.getSeriesDoses().primitiveValue()); 075 return tgt; 076 } 077 078 public static org.hl7.fhir.r4b.model.ImmunizationEvaluation convertImmunizationEvaluation(org.hl7.fhir.r5.model.ImmunizationEvaluation src) throws FHIRException { 079 if (src == null) 080 return null; 081 org.hl7.fhir.r4b.model.ImmunizationEvaluation tgt = new org.hl7.fhir.r4b.model.ImmunizationEvaluation(); 082 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 083 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 084 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 085 if (src.hasStatus()) 086 tgt.setStatusElement(convertImmunizationEvaluationStatus(src.getStatusElement())); 087 if (src.hasPatient()) 088 tgt.setPatient(Reference43_50.convertReference(src.getPatient())); 089 if (src.hasDate()) 090 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 091 if (src.hasAuthority()) 092 tgt.setAuthority(Reference43_50.convertReference(src.getAuthority())); 093 if (src.hasTargetDisease()) 094 tgt.setTargetDisease(CodeableConcept43_50.convertCodeableConcept(src.getTargetDisease())); 095 if (src.hasImmunizationEvent()) 096 tgt.setImmunizationEvent(Reference43_50.convertReference(src.getImmunizationEvent())); 097 if (src.hasDoseStatus()) 098 tgt.setDoseStatus(CodeableConcept43_50.convertCodeableConcept(src.getDoseStatus())); 099 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDoseStatusReason()) 100 tgt.addDoseStatusReason(CodeableConcept43_50.convertCodeableConcept(t)); 101 if (src.hasDescription()) 102 tgt.setDescriptionElement(String43_50.convertString(src.getDescriptionElement())); 103 if (src.hasSeries()) 104 tgt.setSeriesElement(String43_50.convertString(src.getSeriesElement())); 105 if (src.hasDoseNumber()) 106 tgt.setDoseNumber(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDoseNumberElement())); 107 if (src.hasSeriesDoses()) 108 tgt.setSeriesDoses(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSeriesDosesElement())); 109 return tgt; 110 } 111 112 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> convertImmunizationEvaluationStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> src) throws FHIRException { 113 if (src == null || src.isEmpty()) 114 return null; 115 Enumeration<ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> tgt = new Enumeration<>(new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()); 116 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 117 if (src.getValue() == null) { 118 tgt.setValue(null); 119 } else { 120 switch (src.getValue()) { 121 case COMPLETED: 122 tgt.setValue(ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.COMPLETED); 123 break; 124 case ENTEREDINERROR: 125 tgt.setValue(ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.ENTEREDINERROR); 126 break; 127 default: 128 tgt.setValue(ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.NULL); 129 break; 130 } 131 } 132 return tgt; 133 } 134 135 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> convertImmunizationEvaluationStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> src) throws FHIRException { 136 if (src == null || src.isEmpty()) 137 return null; 138 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()); 139 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 140 if (src.getValue() == null) { 141 tgt.setValue(null); 142 } else { 143 switch (src.getValue()) { 144 case COMPLETED: 145 tgt.setValue(org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.COMPLETED); 146 break; 147 case ENTEREDINERROR: 148 tgt.setValue(org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.ENTEREDINERROR); 149 break; 150 default: 151 tgt.setValue(org.hl7.fhir.r4b.model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes.NULL); 152 break; 153 } 154 } 155 return tgt; 156 } 157}