
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.Annotation43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50; 011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50; 012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 013import org.hl7.fhir.exceptions.FHIRException; 014import org.hl7.fhir.r5.model.CodeableReference; 015import org.hl7.fhir.r5.model.Enumeration; 016import org.hl7.fhir.r5.model.FamilyMemberHistory; 017 018/* 019 Copyright (c) 2011+, HL7, Inc. 020 All rights reserved. 021 022 Redistribution and use in source and binary forms, with or without modification, 023 are permitted provided that the following conditions are met: 024 025 * Redistributions of source code must retain the above copyright notice, this 026 list of conditions and the following disclaimer. 027 * Redistributions in binary form must reproduce the above copyright notice, 028 this list of conditions and the following disclaimer in the documentation 029 and/or other materials provided with the distribution. 030 * Neither the name of HL7 nor the names of its contributors may be used to 031 endorse or promote products derived from this software without specific 032 prior written permission. 033 034 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 035 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 036 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 037 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 038 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 039 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 040 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 041 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 042 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 043 POSSIBILITY OF SUCH DAMAGE. 044 045*/ 046// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 047public class FamilyMemberHistory43_50 { 048 049 public static org.hl7.fhir.r5.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r4b.model.FamilyMemberHistory src) throws FHIRException { 050 if (src == null) 051 return null; 052 org.hl7.fhir.r5.model.FamilyMemberHistory tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory(); 053 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 054 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 055 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 056 for (org.hl7.fhir.r4b.model.CanonicalType t : src.getInstantiatesCanonical()) 057 tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t)); 058 for (org.hl7.fhir.r4b.model.UriType t : src.getInstantiatesUri()) 059 tgt.getInstantiatesUri().add(Uri43_50.convertUri(t)); 060 if (src.hasStatus()) 061 tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement())); 062 if (src.hasDataAbsentReason()) 063 tgt.setDataAbsentReason(CodeableConcept43_50.convertCodeableConcept(src.getDataAbsentReason())); 064 if (src.hasPatient()) 065 tgt.setPatient(Reference43_50.convertReference(src.getPatient())); 066 if (src.hasDate()) 067 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 068 if (src.hasName()) 069 tgt.setNameElement(String43_50.convertString(src.getNameElement())); 070 if (src.hasRelationship()) 071 tgt.setRelationship(CodeableConcept43_50.convertCodeableConcept(src.getRelationship())); 072 if (src.hasSex()) 073 tgt.setSex(CodeableConcept43_50.convertCodeableConcept(src.getSex())); 074 if (src.hasBorn()) 075 tgt.setBorn(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getBorn())); 076 if (src.hasAge()) 077 tgt.setAge(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAge())); 078 if (src.hasEstimatedAge()) 079 tgt.setEstimatedAgeElement(Boolean43_50.convertBoolean(src.getEstimatedAgeElement())); 080 if (src.hasDeceased()) 081 tgt.setDeceased(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDeceased())); 082 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReasonCode()) 083 tgt.addReason(CodeableConcept43_50.convertCodeableConceptToCodeableReference(t)); 084 for (org.hl7.fhir.r4b.model.Reference t : src.getReasonReference()) 085 tgt.addReason(Reference43_50.convertReferenceToCodeableReference(t)); 086 for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 087 for (org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) 088 tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); 089 return tgt; 090 } 091 092 public static org.hl7.fhir.r4b.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.r5.model.FamilyMemberHistory src) throws FHIRException { 093 if (src == null) 094 return null; 095 org.hl7.fhir.r4b.model.FamilyMemberHistory tgt = new org.hl7.fhir.r4b.model.FamilyMemberHistory(); 096 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 097 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 098 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 099 for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) 100 tgt.getInstantiatesCanonical().add(Canonical43_50.convertCanonical(t)); 101 for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) 102 tgt.getInstantiatesUri().add(Uri43_50.convertUri(t)); 103 if (src.hasStatus()) 104 tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement())); 105 if (src.hasDataAbsentReason()) 106 tgt.setDataAbsentReason(CodeableConcept43_50.convertCodeableConcept(src.getDataAbsentReason())); 107 if (src.hasPatient()) 108 tgt.setPatient(Reference43_50.convertReference(src.getPatient())); 109 if (src.hasDate()) 110 tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement())); 111 if (src.hasName()) 112 tgt.setNameElement(String43_50.convertString(src.getNameElement())); 113 if (src.hasRelationship()) 114 tgt.setRelationship(CodeableConcept43_50.convertCodeableConcept(src.getRelationship())); 115 if (src.hasSex()) 116 tgt.setSex(CodeableConcept43_50.convertCodeableConcept(src.getSex())); 117 if (src.hasBorn()) 118 tgt.setBorn(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getBorn())); 119 if (src.hasAge()) 120 tgt.setAge(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getAge())); 121 if (src.hasEstimatedAge()) 122 tgt.setEstimatedAgeElement(Boolean43_50.convertBoolean(src.getEstimatedAgeElement())); 123 if (src.hasDeceased()) 124 tgt.setDeceased(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDeceased())); 125 for (CodeableReference t : src.getReason()) 126 if (t.hasConcept()) 127 tgt.addReasonCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept())); 128 for (CodeableReference t : src.getReason()) 129 if (t.hasReference()) 130 tgt.addReasonReference(Reference43_50.convertReference(t.getReference())); 131 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 132 for (org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) 133 tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); 134 return tgt; 135 } 136 137 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus> convertFamilyHistoryStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus> src) throws FHIRException { 138 if (src == null || src.isEmpty()) 139 return null; 140 Enumeration<FamilyMemberHistory.FamilyHistoryStatus> tgt = new Enumeration<>(new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()); 141 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 142 if (src.getValue() == null) { 143 tgt.setValue(null); 144 } else { 145 switch (src.getValue()) { 146 case PARTIAL: 147 tgt.setValue(FamilyMemberHistory.FamilyHistoryStatus.PARTIAL); 148 break; 149 case COMPLETED: 150 tgt.setValue(FamilyMemberHistory.FamilyHistoryStatus.COMPLETED); 151 break; 152 case ENTEREDINERROR: 153 tgt.setValue(FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR); 154 break; 155 case HEALTHUNKNOWN: 156 tgt.setValue(FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN); 157 break; 158 default: 159 tgt.setValue(FamilyMemberHistory.FamilyHistoryStatus.NULL); 160 break; 161 } 162 } 163 return tgt; 164 } 165 166 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus> convertFamilyHistoryStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyHistoryStatus> src) throws FHIRException { 167 if (src == null || src.isEmpty()) 168 return null; 169 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatusEnumFactory()); 170 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 171 if (src.getValue() == null) { 172 tgt.setValue(null); 173 } else { 174 switch (src.getValue()) { 175 case PARTIAL: 176 tgt.setValue(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL); 177 break; 178 case COMPLETED: 179 tgt.setValue(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED); 180 break; 181 case ENTEREDINERROR: 182 tgt.setValue(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR); 183 break; 184 case HEALTHUNKNOWN: 185 tgt.setValue(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN); 186 break; 187 default: 188 tgt.setValue(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyHistoryStatus.NULL); 189 break; 190 } 191 } 192 return tgt; 193 } 194 195 public static org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { 196 if (src == null) 197 return null; 198 org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); 199 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 200 if (src.hasCode()) 201 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 202 if (src.hasOutcome()) 203 tgt.setOutcome(CodeableConcept43_50.convertCodeableConcept(src.getOutcome())); 204 if (src.hasContributedToDeath()) 205 tgt.setContributedToDeathElement(Boolean43_50.convertBoolean(src.getContributedToDeathElement())); 206 if (src.hasOnset()) 207 tgt.setOnset(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOnset())); 208 for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 209 return tgt; 210 } 211 212 public static org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.r5.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { 213 if (src == null) 214 return null; 215 org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.r4b.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); 216 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt); 217 if (src.hasCode()) 218 tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode())); 219 if (src.hasOutcome()) 220 tgt.setOutcome(CodeableConcept43_50.convertCodeableConcept(src.getOutcome())); 221 if (src.hasContributedToDeath()) 222 tgt.setContributedToDeathElement(Boolean43_50.convertBoolean(src.getContributedToDeathElement())); 223 if (src.hasOnset()) 224 tgt.setOnset(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOnset())); 225 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 226 return tgt; 227 } 228}