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