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