
001package org.hl7.fhir.convertors.conv30_50.resources30_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.*; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.PositiveInt30_50; 007import org.hl7.fhir.exceptions.FHIRException; 008import org.hl7.fhir.r5.model.CodeableReference; 009 010public class Encounter30_50 { 011 012 public static org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent src) throws FHIRException { 013 if (src == null) 014 return null; 015 org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent(); 016 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 017 if (src.hasClass_()) 018 tgt.setClass_(Coding30_50.convertCoding(src.getClass_())); 019 if (src.hasPeriod()) 020 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 021 return tgt; 022 } 023 024 public static org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent convertClassHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent src) throws FHIRException { 025 if (src == null) 026 return null; 027 org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent(); 028 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 029 if (src.hasClass_()) 030 tgt.setClass_(Coding30_50.convertCoding(src.getClass_())); 031 if (src.hasPeriod()) 032 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 033 return tgt; 034 } 035 036 public static org.hl7.fhir.r5.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { 037 if (src == null) 038 return null; 039 org.hl7.fhir.r5.model.Encounter tgt = new org.hl7.fhir.r5.model.Encounter(); 040 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 041 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 042 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 043 if (src.hasStatus()) 044 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 045 for (org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) 046 tgt.addStatusHistory(convertStatusHistoryComponent(t)); 047 if (src.hasClass_()) 048 tgt.setClass_(Coding30_50.convertCoding(src.getClass_())); 049 for (org.hl7.fhir.dstu3.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) 050 tgt.addClassHistory(convertClassHistoryComponent(t)); 051 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) 052 tgt.addType(CodeableConcept30_50.convertCodeableConcept(t)); 053 if (src.hasPriority()) 054 tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority())); 055 if (src.hasSubject()) 056 tgt.setSubject(Reference30_50.convertReference(src.getSubject())); 057 for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) 058 tgt.addEpisodeOfCare(Reference30_50.convertReference(t)); 059 for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) 060 tgt.addBasedOn(Reference30_50.convertReference(t)); 061 for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) 062 tgt.addParticipant(convertEncounterParticipantComponent(t)); 063 if (src.hasAppointment()) 064 tgt.addAppointment(Reference30_50.convertReference(src.getAppointment())); 065 if (src.hasPeriod()) 066 tgt.setActualPeriod(Period30_50.convertPeriod(src.getPeriod())); 067 if (src.hasLength()) 068 tgt.setLength(Duration30_50.convertDuration(src.getLength())); 069 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) 070 tgt.addReason(Reference30_50.convertCodeableConceptToCodableReference(t)); 071 for (org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) 072 tgt.addDiagnosis(convertDiagnosisComponent(t)); 073 for (org.hl7.fhir.dstu3.model.Reference t : src.getAccount()) tgt.addAccount(Reference30_50.convertReference(t)); 074 if (src.hasHospitalization()) 075 tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); 076 for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) 077 tgt.addLocation(convertEncounterLocationComponent(t)); 078 if (src.hasServiceProvider()) 079 tgt.setServiceProvider(Reference30_50.convertReference(src.getServiceProvider())); 080 if (src.hasPartOf()) 081 tgt.setPartOf(Reference30_50.convertReference(src.getPartOf())); 082 return tgt; 083 } 084 085 public static org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.r5.model.Encounter src) throws FHIRException { 086 if (src == null) 087 return null; 088 org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); 089 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 090 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 091 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 092 if (src.hasStatus()) 093 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 094 for (org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent t : src.getStatusHistory()) 095 tgt.addStatusHistory(convertStatusHistoryComponent(t)); 096 if (src.hasClass_()) 097 tgt.setClass_(Coding30_50.convertCoding(src.getClass_())); 098 for (org.hl7.fhir.r5.model.Encounter.ClassHistoryComponent t : src.getClassHistory()) 099 tgt.addClassHistory(convertClassHistoryComponent(t)); 100 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) 101 tgt.addType(CodeableConcept30_50.convertCodeableConcept(t)); 102 if (src.hasPriority()) 103 tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority())); 104 if (src.hasSubject()) 105 tgt.setSubject(Reference30_50.convertReference(src.getSubject())); 106 for (org.hl7.fhir.r5.model.Reference t : src.getEpisodeOfCare()) 107 tgt.addEpisodeOfCare(Reference30_50.convertReference(t)); 108 for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) 109 tgt.addIncomingReferral(Reference30_50.convertReference(t)); 110 for (org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) 111 tgt.addParticipant(convertEncounterParticipantComponent(t)); 112 if (src.hasAppointment()) 113 tgt.setAppointment(Reference30_50.convertReference(src.getAppointmentFirstRep())); 114 if (src.hasActualPeriod()) 115 tgt.setPeriod(Period30_50.convertPeriod(src.getActualPeriod())); 116 if (src.hasLength()) 117 tgt.setLength(Duration30_50.convertDuration(src.getLength())); 118 for (CodeableReference t : src.getReason()) 119 if (t.hasConcept()) 120 tgt.addReason(CodeableConcept30_50.convertCodeableConcept(t.getConcept())); 121 for (org.hl7.fhir.r5.model.Encounter.DiagnosisComponent t : src.getDiagnosis()) 122 tgt.addDiagnosis(convertDiagnosisComponent(t)); 123 for (org.hl7.fhir.r5.model.Reference t : src.getAccount()) tgt.addAccount(Reference30_50.convertReference(t)); 124 if (src.hasHospitalization()) 125 tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); 126 for (org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent t : src.getLocation()) 127 tgt.addLocation(convertEncounterLocationComponent(t)); 128 if (src.hasServiceProvider()) 129 tgt.setServiceProvider(Reference30_50.convertReference(src.getServiceProvider())); 130 if (src.hasPartOf()) 131 tgt.setPartOf(Reference30_50.convertReference(src.getPartOf())); 132 return tgt; 133 } 134 135 public static org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { 136 if (src == null) 137 return null; 138 org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); 139 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 140 if (src.hasPreAdmissionIdentifier()) 141 tgt.setPreAdmissionIdentifier(Identifier30_50.convertIdentifier(src.getPreAdmissionIdentifier())); 142 if (src.hasOrigin()) 143 tgt.setOrigin(Reference30_50.convertReference(src.getOrigin())); 144 if (src.hasAdmitSource()) 145 tgt.setAdmitSource(CodeableConcept30_50.convertCodeableConcept(src.getAdmitSource())); 146 if (src.hasReAdmission()) 147 tgt.setReAdmission(CodeableConcept30_50.convertCodeableConcept(src.getReAdmission())); 148 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getDietPreference()) 149 tgt.addDietPreference(CodeableConcept30_50.convertCodeableConcept(t)); 150 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialCourtesy()) 151 tgt.addSpecialCourtesy(CodeableConcept30_50.convertCodeableConcept(t)); 152 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialArrangement()) 153 tgt.addSpecialArrangement(CodeableConcept30_50.convertCodeableConcept(t)); 154 if (src.hasDestination()) 155 tgt.setDestination(Reference30_50.convertReference(src.getDestination())); 156 if (src.hasDischargeDisposition()) 157 tgt.setDischargeDisposition(CodeableConcept30_50.convertCodeableConcept(src.getDischargeDisposition())); 158 return tgt; 159 } 160 161 public static org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { 162 if (src == null) 163 return null; 164 org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterHospitalizationComponent(); 165 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 166 if (src.hasPreAdmissionIdentifier()) 167 tgt.setPreAdmissionIdentifier(Identifier30_50.convertIdentifier(src.getPreAdmissionIdentifier())); 168 if (src.hasOrigin()) 169 tgt.setOrigin(Reference30_50.convertReference(src.getOrigin())); 170 if (src.hasAdmitSource()) 171 tgt.setAdmitSource(CodeableConcept30_50.convertCodeableConcept(src.getAdmitSource())); 172 if (src.hasReAdmission()) 173 tgt.setReAdmission(CodeableConcept30_50.convertCodeableConcept(src.getReAdmission())); 174 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) 175 tgt.addDietPreference(CodeableConcept30_50.convertCodeableConcept(t)); 176 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) 177 tgt.addSpecialCourtesy(CodeableConcept30_50.convertCodeableConcept(t)); 178 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) 179 tgt.addSpecialArrangement(CodeableConcept30_50.convertCodeableConcept(t)); 180 if (src.hasDestination()) 181 tgt.setDestination(Reference30_50.convertReference(src.getDestination())); 182 if (src.hasDischargeDisposition()) 183 tgt.setDischargeDisposition(CodeableConcept30_50.convertCodeableConcept(src.getDischargeDisposition())); 184 return tgt; 185 } 186 187 public static org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent src) throws FHIRException { 188 if (src == null) 189 return null; 190 org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); 191 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 192 if (src.hasLocation()) 193 tgt.setLocation(Reference30_50.convertReference(src.getLocation())); 194 if (src.hasStatus()) 195 tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); 196 if (src.hasPeriod()) 197 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 198 return tgt; 199 } 200 201 public static org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { 202 if (src == null) 203 return null; 204 org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterLocationComponent(); 205 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 206 if (src.hasLocation()) 207 tgt.setLocation(Reference30_50.convertReference(src.getLocation())); 208 if (src.hasStatus()) 209 tgt.setStatusElement(convertEncounterLocationStatus(src.getStatusElement())); 210 if (src.hasPeriod()) 211 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 212 return tgt; 213 } 214 215 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus> convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus> src) throws FHIRException { 216 if (src == null || src.isEmpty()) 217 return null; 218 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()); 219 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 220 switch (src.getValue()) { 221 case PLANNED: 222 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.PLANNED); 223 break; 224 case ACTIVE: 225 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.ACTIVE); 226 break; 227 case RESERVED: 228 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.RESERVED); 229 break; 230 case COMPLETED: 231 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.COMPLETED); 232 break; 233 default: 234 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus.NULL); 235 break; 236 } 237 return tgt; 238 } 239 240 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus> convertEncounterLocationStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterLocationStatus> src) throws FHIRException { 241 if (src == null || src.isEmpty()) 242 return null; 243 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatusEnumFactory()); 244 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 245 switch (src.getValue()) { 246 case PLANNED: 247 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED); 248 break; 249 case ACTIVE: 250 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE); 251 break; 252 case RESERVED: 253 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED); 254 break; 255 case COMPLETED: 256 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED); 257 break; 258 default: 259 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL); 260 break; 261 } 262 return tgt; 263 } 264 265 public static org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent src) throws FHIRException { 266 if (src == null) 267 return null; 268 org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); 269 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 270 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) 271 tgt.addType(CodeableConcept30_50.convertCodeableConcept(t)); 272 if (src.hasPeriod()) 273 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 274 if (src.hasActor()) 275 tgt.setIndividual(Reference30_50.convertReference(src.getActor())); 276 return tgt; 277 } 278 279 public static org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { 280 if (src == null) 281 return null; 282 org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r5.model.Encounter.EncounterParticipantComponent(); 283 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 284 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) 285 tgt.addType(CodeableConcept30_50.convertCodeableConcept(t)); 286 if (src.hasPeriod()) 287 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 288 if (src.hasIndividual()) 289 tgt.setActor(Reference30_50.convertReference(src.getIndividual())); 290 return tgt; 291 } 292 293 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterStatus> convertEncounterStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterStatus> src) throws FHIRException { 294 if (src == null || src.isEmpty()) 295 return null; 296 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Encounter.EncounterStatusEnumFactory()); 297 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 298 switch (src.getValue()) { 299 case PLANNED: 300 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED); 301 break; 302 case INPROGRESS: 303 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS); 304 break; 305 case COMPLETED: 306 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED); 307 break; 308 case CANCELLED: 309 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED); 310 break; 311 case ENTEREDINERROR: 312 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ENTEREDINERROR); 313 break; 314 case UNKNOWN: 315 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.UNKNOWN); 316 break; 317 default: 318 tgt.setValue(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL); 319 break; 320 } 321 return tgt; 322 } 323 324 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Encounter.EncounterStatus> convertEncounterStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Encounter.EncounterStatus> src) throws FHIRException { 325 if (src == null || src.isEmpty()) 326 return null; 327 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()); 328 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 329 switch (src.getValue()) { 330 case PLANNED: 331 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.PLANNED); 332 break; 333 case ARRIVED: 334 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 335 break; 336 case TRIAGED: 337 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 338 break; 339 case INPROGRESS: 340 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 341 break; 342 case ONLEAVE: 343 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.INPROGRESS); 344 break; 345 case FINISHED: 346 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.COMPLETED); 347 break; 348 case CANCELLED: 349 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.CANCELLED); 350 break; 351 case ENTEREDINERROR: 352 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.ENTEREDINERROR); 353 break; 354 case UNKNOWN: 355 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.UNKNOWN); 356 break; 357 default: 358 tgt.setValue(org.hl7.fhir.r5.model.Encounter.EncounterStatus.NULL); 359 break; 360 } 361 return tgt; 362 } 363 364 public static org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent src) throws FHIRException { 365 if (src == null) 366 return null; 367 org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent(); 368 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 369 if (src.hasStatus()) 370 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 371 if (src.hasPeriod()) 372 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 373 return tgt; 374 } 375 376 public static org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent convertStatusHistoryComponent(org.hl7.fhir.r5.model.Encounter.StatusHistoryComponent src) throws FHIRException { 377 if (src == null) 378 return null; 379 org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.StatusHistoryComponent(); 380 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 381 if (src.hasStatus()) 382 tgt.setStatusElement(convertEncounterStatus(src.getStatusElement())); 383 if (src.hasPeriod()) 384 tgt.setPeriod(Period30_50.convertPeriod(src.getPeriod())); 385 return tgt; 386 } 387 388 public static org.hl7.fhir.r5.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent src) throws FHIRException { 389 if (src == null) return null; 390 org.hl7.fhir.r5.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.r5.model.Encounter.DiagnosisComponent(); 391 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 392 if (src.hasCondition()) tgt.setCondition(Reference30_50.convertReference(src.getCondition())); 393 if (src.hasRole()) tgt.setUse(CodeableConcept30_50.convertCodeableConcept(src.getRole())); 394 if (src.hasRank()) tgt.setRankElement(PositiveInt30_50.convertPositiveInt(src.getRankElement())); 395 return tgt; 396 } 397 398 public static org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent convertDiagnosisComponent(org.hl7.fhir.r5.model.Encounter.DiagnosisComponent src) throws FHIRException { 399 if (src == null) return null; 400 org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.DiagnosisComponent(); 401 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 402 if (src.hasCondition()) tgt.setCondition(Reference30_50.convertReference(src.getCondition())); 403 if (src.hasUse()) tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getUse())); 404 if (src.hasRank()) tgt.setRankElement(PositiveInt30_50.convertPositiveInt(src.getRankElement())); 405 return tgt; 406 } 407}