001package org.hl7.fhir.convertors.conv40_50.resources40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext40_50; 004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.*; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.PositiveInt40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 007import org.hl7.fhir.exceptions.FHIRException; 008import org.hl7.fhir.r5.model.CodeableReference; 009 010/* 011 Copyright (c) 2011+, HL7, Inc. 012 All rights reserved. 013 014 Redistribution and use in source and binary forms, with or without modification, 015 are permitted provided that the following conditions are met: 016 017 * Redistributions of source code must retain the above copyright notice, this 018 list of conditions and the following disclaimer. 019 * Redistributions in binary form must reproduce the above copyright notice, 020 this list of conditions and the following disclaimer in the documentation 021 and/or other materials provided with the distribution. 022 * Neither the name of HL7 nor the names of its contributors may be used to 023 endorse or promote products derived from this software without specific 024 prior written permission. 025 026 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 027 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 028 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 029 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 030 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 031 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 032 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 033 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 035 POSSIBILITY OF SUCH DAMAGE. 036 037*/ 038// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 039public class Encounter40_50 { 040 041 public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.r4.model.Encounter src) throws FHIRException { 042 if (src == null) 043 return null; 044 org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); 045 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 046 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 047 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 048 if (src.hasStatus()) 049 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 050 for (org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) 051 tgt.addStatusHistory(convertStatusHistoryComponent(t)); 052 if (src.hasClass_()) 053 tgt.setClass_(Coding40_50.convertCoding(src.getClass_())); 054 for (org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) 055 tgt.addClassHistory(convertClassHistoryComponent(t)); 056 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) 057 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 058 if (src.hasServiceType()) 059 tgt.setServiceType(CodeableConcept40_50.convertCodeableConcept(src.getServiceType())); 060 if (src.hasPriority()) 061 tgt.setPriority(CodeableConcept40_50.convertCodeableConcept(src.getPriority())); 062 if (src.hasSubject()) 063 tgt.setSubject(Reference40_50.convertReference(src.getSubject())); 064 for (org.hl7.fhir.r4.model.Reference t : src.getEpisodeOfCare()) 065 tgt.addEpisodeOfCare(Reference40_50.convertReference(t)); 066 for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference40_50.convertReference(t)); 067 for (org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) 068 tgt.addParticipant(convertEncounterParticipantComponent(t)); 069 for (org.hl7.fhir.r4.model.Reference t : src.getAppointment()) 070 tgt.addAppointment(Reference40_50.convertReference(t)); 071 if (src.hasPeriod()) 072 tgt.setActualPeriod(Period40_50.convertPeriod(src.getPeriod())); 073 if (src.hasLength()) 074 tgt.setLength(Duration40_50.convertDuration(src.getLength())); 075 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) 076 tgt.addReason(CodeableConcept40_50.convertCodeableConceptToCodeableReference(t)); 077 for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) 078 tgt.addReason(Reference40_50.convertReferenceToCodeableReference(t)); 079 for (org.hl7.fhir.r4.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) 080 tgt.addDiagnosis(convertDiagnosisComponent(t)); 081 for (org.hl7.fhir.r4.model.Reference t : src.getAccount()) tgt.addAccount(Reference40_50.convertReference(t)); 082 if (src.hasHospitalization()) 083 tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); 084 for (org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent t : src.getLocation()) 085 tgt.addLocation(convertEncounterLocationComponent(t)); 086 if (src.hasServiceProvider()) 087 tgt.setServiceProvider(Reference40_50.convertReference(src.getServiceProvider())); 088 if (src.hasPartOf()) 089 tgt.setPartOf(Reference40_50.convertReference(src.getPartOf())); 090 return tgt; 091 } 092 093 public static org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { 094 if (src == null) 095 return null; 096 org.hl7.fhir.r4.model.Encounter tgt = new org.hl7.fhir.r4.model.Encounter(); 097 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 098 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 099 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 100 if (src.hasStatus()) 101 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 102 for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) 103 tgt.addStatusHistory(convertStatusHistoryComponent(t)); 104 if (src.hasClass_()) 105 tgt.setClass_(Coding40_50.convertCoding(src.getClass_())); 106 for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) 107 tgt.addClassHistory(convertClassHistoryComponent(t)); 108 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) 109 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 110 if (src.hasServiceType()) 111 tgt.setServiceType(CodeableConcept40_50.convertCodeableConcept(src.getServiceType())); 112 if (src.hasPriority()) 113 tgt.setPriority(CodeableConcept40_50.convertCodeableConcept(src.getPriority())); 114 if (src.hasSubject()) 115 tgt.setSubject(Reference40_50.convertReference(src.getSubject())); 116 for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) 117 tgt.addEpisodeOfCare(Reference40_50.convertReference(t)); 118 for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference40_50.convertReference(t)); 119 for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) 120 tgt.addParticipant(convertEncounterParticipantComponent(t)); 121 for (org.hl7.fhir.r5.model.Reference t : src.getAppointment()) 122 tgt.addAppointment(Reference40_50.convertReference(t)); 123 if (src.hasActualPeriod()) 124 tgt.setPeriod(Period40_50.convertPeriod(src.getActualPeriod())); 125 if (src.hasLength()) 126 tgt.setLength(Duration40_50.convertDuration(src.getLength())); 127 for (CodeableReference t : src.getReason()) 128 if (t.hasConcept()) 129 tgt.addReasonCode(CodeableConcept40_50.convertCodeableConcept(t.getConcept())); 130 for (CodeableReference t : src.getReason()) 131 if (t.hasReference()) 132 tgt.addReasonReference(Reference40_50.convertReference(t.getReference())); 133 for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) 134 tgt.addDiagnosis(convertDiagnosisComponent(t)); 135 for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(Reference40_50.convertReference(t)); 136 if (src.hasHospitalization()) 137 tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); 138 for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) 139 tgt.addLocation(convertEncounterLocationComponent(t)); 140 if (src.hasServiceProvider()) 141 tgt.setServiceProvider(Reference40_50.convertReference(src.getServiceProvider())); 142 if (src.hasPartOf()) 143 tgt.setPartOf(Reference40_50.convertReference(src.getPartOf())); 144 return tgt; 145 } 146 147 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterStatus> convertEncounterStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterStatus> src) throws FHIRException { 148 if (src == null || src.isEmpty()) 149 return null; 150 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Encounter.EncounterStatusEnumFactory()); 151 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 152 switch (src.getValue()) { 153 case PLANNED: 154 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED); 155 break; 156 case ARRIVED: 157 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 158 break; 159 case TRIAGED: 160 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 161 break; 162 case INPROGRESS: 163 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 164 break; 165 case ONLEAVE: 166 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 167 break; 168 case FINISHED: 169 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED); 170 break; 171 case CANCELLED: 172 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED); 173 break; 174 case ENTEREDINERROR: 175 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR); 176 break; 177 case UNKNOWN: 178 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN); 179 break; 180 default: 181 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL); 182 break; 183 } 184 return tgt; 185 } 186 187 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterStatus> convertEncounterStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterStatus> src) throws FHIRException { 188 if (src == null || src.isEmpty()) 189 return null; 190 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Encounter.EncounterStatusEnumFactory()); 191 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 192 switch (src.getValue()) { 193 case PLANNED: 194 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED); 195 break; 196 case INPROGRESS: 197 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS); 198 break; 199 case CANCELLED: 200 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED); 201 break; 202 case COMPLETED: 203 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED); 204 break; 205 case ENTEREDINERROR: 206 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.ENTEREDINERROR); 207 break; 208 case UNKNOWN: 209 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN); 210 break; 211 default: 212 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL); 213 break; 214 } 215 return tgt; 216 } 217 218 public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent src) throws FHIRException { 219 if (src == null) 220 return null; 221 org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); 222 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 223 if (src.hasStatus()) 224 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 225 if (src.hasPeriod()) 226 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 227 return tgt; 228 } 229 230 public static org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { 231 if (src == null) 232 return null; 233 org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.StatusHistoryComponent(); 234 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 235 if (src.hasStatus()) 236 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 237 if (src.hasPeriod()) 238 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 239 return tgt; 240 } 241 242 public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent src) throws FHIRException { 243 if (src == null) 244 return null; 245 org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); 246 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 247 if (src.hasClass_()) 248 tgt.setClass_(Coding40_50.convertCoding(src.getClass_())); 249 if (src.hasPeriod()) 250 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 251 return tgt; 252 } 253 254 public static org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { 255 if (src == null) 256 return null; 257 org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.ClassHistoryComponent(); 258 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 259 if (src.hasClass_()) 260 tgt.setClass_(Coding40_50.convertCoding(src.getClass_())); 261 if (src.hasPeriod()) 262 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 263 return tgt; 264 } 265 266 public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { 267 if (src == null) 268 return null; 269 org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); 270 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 271 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) 272 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 273 if (src.hasPeriod()) 274 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 275 if (src.hasIndividual()) 276 tgt.setActor(Reference40_50.convertReference(src.getIndividual())); 277 return tgt; 278 } 279 280 public static org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { 281 if (src == null) 282 return null; 283 org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); 284 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 285 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) 286 tgt.addType(CodeableConcept40_50.convertCodeableConcept(t)); 287 if (src.hasPeriod()) 288 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 289 if (src.hasActor()) 290 tgt.setIndividual(Reference40_50.convertReference(src.getActor())); 291 return tgt; 292 } 293 294 public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r4.model.Encounter.DiagnosisComponent src) throws FHIRException { 295 if (src == null) 296 return null; 297 org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); 298 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 299 if (src.hasCondition()) 300 tgt.setCondition(Reference40_50.convertReference(src.getCondition())); 301 if (src.hasUse()) 302 tgt.setUse(CodeableConcept40_50.convertCodeableConcept(src.getUse())); 303 if (src.hasRank()) 304 tgt.setRankElement(PositiveInt40_50.convertPositiveInt(src.getRankElement())); 305 return tgt; 306 } 307 308 public static org.hl7.fhir.r4.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { 309 if (src == null) 310 return null; 311 org.hl7.fhir.r4.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r4.model.Encounter.DiagnosisComponent(); 312 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 313 if (src.hasCondition()) 314 tgt.setCondition(Reference40_50.convertReference(src.getCondition())); 315 if (src.hasUse()) 316 tgt.setUse(CodeableConcept40_50.convertCodeableConcept(src.getUse())); 317 if (src.hasRank()) 318 tgt.setRankElement(PositiveInt40_50.convertPositiveInt(src.getRankElement())); 319 return tgt; 320 } 321 322 public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { 323 if (src == null) 324 return null; 325 org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); 326 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 327 if (src.hasPreAdmissionIdentifier()) 328 tgt.setPreAdmissionIdentifier(Identifier40_50.convertIdentifier(src.getPreAdmissionIdentifier())); 329 if (src.hasOrigin()) 330 tgt.setOrigin(Reference40_50.convertReference(src.getOrigin())); 331 if (src.hasAdmitSource()) 332 tgt.setAdmitSource(CodeableConcept40_50.convertCodeableConcept(src.getAdmitSource())); 333 if (src.hasReAdmission()) 334 tgt.setReAdmission(CodeableConcept40_50.convertCodeableConcept(src.getReAdmission())); 335 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getDietPreference()) 336 tgt.addDietPreference(CodeableConcept40_50.convertCodeableConcept(t)); 337 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialCourtesy()) 338 tgt.addSpecialCourtesy(CodeableConcept40_50.convertCodeableConcept(t)); 339 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialArrangement()) 340 tgt.addSpecialArrangement(CodeableConcept40_50.convertCodeableConcept(t)); 341 if (src.hasDestination()) 342 tgt.setDestination(Reference40_50.convertReference(src.getDestination())); 343 if (src.hasDischargeDisposition()) 344 tgt.setDischargeDisposition(CodeableConcept40_50.convertCodeableConcept(src.getDischargeDisposition())); 345 return tgt; 346 } 347 348 public static org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { 349 if (src == null) 350 return null; 351 org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent(); 352 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 353 if (src.hasPreAdmissionIdentifier()) 354 tgt.setPreAdmissionIdentifier(Identifier40_50.convertIdentifier(src.getPreAdmissionIdentifier())); 355 if (src.hasOrigin()) 356 tgt.setOrigin(Reference40_50.convertReference(src.getOrigin())); 357 if (src.hasAdmitSource()) 358 tgt.setAdmitSource(CodeableConcept40_50.convertCodeableConcept(src.getAdmitSource())); 359 if (src.hasReAdmission()) 360 tgt.setReAdmission(CodeableConcept40_50.convertCodeableConcept(src.getReAdmission())); 361 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) 362 tgt.addDietPreference(CodeableConcept40_50.convertCodeableConcept(t)); 363 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) 364 tgt.addSpecialCourtesy(CodeableConcept40_50.convertCodeableConcept(t)); 365 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) 366 tgt.addSpecialArrangement(CodeableConcept40_50.convertCodeableConcept(t)); 367 if (src.hasDestination()) 368 tgt.setDestination(Reference40_50.convertReference(src.getDestination())); 369 if (src.hasDischargeDisposition()) 370 tgt.setDischargeDisposition(CodeableConcept40_50.convertCodeableConcept(src.getDischargeDisposition())); 371 return tgt; 372 } 373 374 public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent src) throws FHIRException { 375 if (src == null) 376 return null; 377 org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); 378 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 379 if (src.hasLocation()) 380 tgt.setLocation(Reference40_50.convertReference(src.getLocation())); 381 if (src.hasStatus()) 382 tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); 383 if (src.hasPhysicalType()) 384 tgt.setPhysicalType(CodeableConcept40_50.convertCodeableConcept(src.getPhysicalType())); 385 if (src.hasPeriod()) 386 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 387 return tgt; 388 } 389 390 public static org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { 391 if (src == null) 392 return null; 393 org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent(); 394 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 395 if (src.hasLocation()) 396 tgt.setLocation(Reference40_50.convertReference(src.getLocation())); 397 if (src.hasStatus()) 398 tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); 399 if (src.hasPhysicalType()) 400 tgt.setPhysicalType(CodeableConcept40_50.convertCodeableConcept(src.getPhysicalType())); 401 if (src.hasPeriod()) 402 tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod())); 403 return tgt; 404 } 405 406 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus> convertEncounterLocationStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus> src) throws FHIRException { 407 if (src == null || src.isEmpty()) 408 return null; 409 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Encounter.EncounterLocationStatusEnumFactory()); 410 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 411 switch (src.getValue()) { 412 case PLANNED: 413 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED); 414 break; 415 case ACTIVE: 416 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE); 417 break; 418 case RESERVED: 419 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED); 420 break; 421 case COMPLETED: 422 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED); 423 break; 424 default: 425 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL); 426 break; 427 } 428 return tgt; 429 } 430 431 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus> convertEncounterLocationStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus> src) throws FHIRException { 432 if (src == null || src.isEmpty()) 433 return null; 434 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Encounter.EncounterLocationStatusEnumFactory()); 435 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 436 switch (src.getValue()) { 437 case PLANNED: 438 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.PLANNED); 439 break; 440 case ACTIVE: 441 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.ACTIVE); 442 break; 443 case RESERVED: 444 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.RESERVED); 445 break; 446 case COMPLETED: 447 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.COMPLETED); 448 break; 449 default: 450 tgt.setValue(org.hl7.fhir.r4.model.Encounter.EncounterLocationStatus.NULL); 451 break; 452 } 453 return tgt; 454 } 455}