
001package org.hl7.fhir.convertors.conv30_40.resources30_40; 002 003import java.util.List; 004 005import org.hl7.fhir.convertors.VersionConvertorConstants; 006import org.hl7.fhir.convertors.context.ConversionContext30_40; 007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40; 008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Annotation30_40; 009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40; 010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40; 011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Period30_40; 012import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.SimpleQuantity30_40; 013import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Boolean30_40; 014import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40; 015import org.hl7.fhir.dstu3.model.CarePlan; 016import org.hl7.fhir.dstu3.model.Enumeration; 017import org.hl7.fhir.dstu3.model.Reference; 018import org.hl7.fhir.exceptions.FHIRException; 019import org.hl7.fhir.r4.model.Coding; 020 021public class CarePlan30_40 { 022 023 public static org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.r4.model.CarePlan src) throws FHIRException { 024 if (src == null) 025 return null; 026 org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); 027 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 028 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 029 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 030 for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) { 031 tgt.addBasedOn(Reference30_40.convertReference(t)); 032 } 033 for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) { 034 tgt.addReplaces(Reference30_40.convertReference(t)); 035 } 036 for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) { 037 tgt.addPartOf(Reference30_40.convertReference(t)); 038 } 039 if (src.hasStatus()) { 040 if (src.hasStatus()) 041 tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement())); 042 } 043 if (src.hasIntent()) { 044 if (src.hasIntent()) 045 tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement())); 046 } 047 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) { 048 tgt.addCategory(CodeableConcept30_40.convertCodeableConcept(t)); 049 } 050 if (src.hasTitle()) { 051 if (src.hasTitleElement()) 052 tgt.setTitleElement(String30_40.convertString(src.getTitleElement())); 053 } 054 if (src.hasDescription()) { 055 if (src.hasDescriptionElement()) 056 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 057 } 058 if (src.hasSubject()) { 059 if (src.hasSubject()) 060 tgt.setSubject(Reference30_40.convertReference(src.getSubject())); 061 } 062 if (src.hasEncounter()) { 063 if (src.hasEncounter()) 064 tgt.setContext(Reference30_40.convertReference(src.getEncounter())); 065 } 066 if (src.hasPeriod()) { 067 if (src.hasPeriod()) 068 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 069 } 070 if (src.hasAuthor()) { 071 if (src.hasAuthor()) 072 tgt.addAuthor(Reference30_40.convertReference(src.getAuthor())); 073 } 074 for (org.hl7.fhir.r4.model.Reference t : src.getCareTeam()) { 075 tgt.addCareTeam(Reference30_40.convertReference(t)); 076 } 077 for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) { 078 tgt.addAddresses(Reference30_40.convertReference(t)); 079 } 080 for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInfo()) { 081 tgt.addSupportingInfo(Reference30_40.convertReference(t)); 082 } 083 for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { 084 tgt.addGoal(Reference30_40.convertReference(t)); 085 } 086 for (org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { 087 tgt.addActivity(convertCarePlanActivityComponent(t)); 088 } 089 for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) { 090 tgt.addNote(Annotation30_40.convertAnnotation(t)); 091 } 092 return tgt; 093 } 094 095 public static org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { 096 if (src == null) 097 return null; 098 org.hl7.fhir.r4.model.CarePlan tgt = new org.hl7.fhir.r4.model.CarePlan(); 099 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 100 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 101 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 102 for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn()) { 103 tgt.addBasedOn(Reference30_40.convertReference(t)); 104 } 105 for (org.hl7.fhir.dstu3.model.Reference t : src.getReplaces()) { 106 tgt.addReplaces(Reference30_40.convertReference(t)); 107 } 108 for (org.hl7.fhir.dstu3.model.Reference t : src.getPartOf()) { 109 tgt.addPartOf(Reference30_40.convertReference(t)); 110 } 111 if (src.hasStatus()) { 112 if (src.hasStatus()) 113 tgt.setStatusElement(convertCarePlanStatus(src.getStatusElement())); 114 } 115 if (src.hasIntent()) { 116 if (src.hasIntent()) 117 tgt.setIntentElement(convertCarePlanIntent(src.getIntentElement())); 118 } 119 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) { 120 tgt.addCategory(CodeableConcept30_40.convertCodeableConcept(t)); 121 } 122 if (src.hasTitle()) { 123 if (src.hasTitleElement()) 124 tgt.setTitleElement(String30_40.convertString(src.getTitleElement())); 125 } 126 if (src.hasDescription()) { 127 if (src.hasDescriptionElement()) 128 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 129 } 130 if (src.hasSubject()) { 131 if (src.hasSubject()) 132 tgt.setSubject(Reference30_40.convertReference(src.getSubject())); 133 } 134 if (src.hasContext()) { 135 if (src.hasContext()) 136 tgt.setEncounter(Reference30_40.convertReference(src.getContext())); 137 } 138 if (src.hasPeriod()) { 139 if (src.hasPeriod()) 140 tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod())); 141 } 142 List<Reference> authors = src.getAuthor(); 143 if (authors.size() > 0) { 144 tgt.setAuthor(Reference30_40.convertReference(authors.get(0))); 145 if (authors.size() > 1) { 146 } 147 } 148 for (org.hl7.fhir.dstu3.model.Reference t : src.getCareTeam()) { 149 tgt.addCareTeam(Reference30_40.convertReference(t)); 150 } 151 for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) { 152 tgt.addAddresses(Reference30_40.convertReference(t)); 153 } 154 for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) { 155 tgt.addSupportingInfo(Reference30_40.convertReference(t)); 156 } 157 for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { 158 tgt.addGoal(Reference30_40.convertReference(t)); 159 } 160 for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) { 161 tgt.addActivity(convertCarePlanActivityComponent(t)); 162 } 163 for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) { 164 tgt.addNote(Annotation30_40.convertAnnotation(t)); 165 } 166 return tgt; 167 } 168 169 public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { 170 if (src == null) 171 return null; 172 org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent(); 173 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 174 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { 175 tgt.addOutcomeCodeableConcept(CodeableConcept30_40.convertCodeableConcept(t)); 176 } 177 for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) { 178 tgt.addOutcomeReference(Reference30_40.convertReference(t)); 179 } 180 for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) { 181 tgt.addProgress(Annotation30_40.convertAnnotation(t)); 182 } 183 if (src.hasReference()) { 184 if (src.hasReference()) 185 tgt.setReference(Reference30_40.convertReference(src.getReference())); 186 } 187 if (src.hasDetail()) { 188 if (src.hasDetail()) 189 tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); 190 } 191 return tgt; 192 } 193 194 public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { 195 if (src == null) 196 return null; 197 org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); 198 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 199 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) { 200 tgt.addOutcomeCodeableConcept(CodeableConcept30_40.convertCodeableConcept(t)); 201 } 202 for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) { 203 tgt.addOutcomeReference(Reference30_40.convertReference(t)); 204 } 205 for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) { 206 tgt.addProgress(Annotation30_40.convertAnnotation(t)); 207 } 208 if (src.hasReference()) { 209 if (src.hasReference()) 210 tgt.setReference(Reference30_40.convertReference(src.getReference())); 211 } 212 if (src.hasDetail()) { 213 if (src.hasDetail()) 214 tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); 215 } 216 return tgt; 217 } 218 219 public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { 220 if (src == null) 221 return null; 222 org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent(); 223 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 224 if (src.hasCategory()) { 225 org.hl7.fhir.r4.model.Extension t = new org.hl7.fhir.r4.model.Extension(); 226 t.setUrl(VersionConvertorConstants.EXT_CarePlanActivityDetailComponentExtension); 227 t.setValue(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getCategory())); 228 tgt.addExtension(t); 229 } 230 if (src.hasCode()) { 231 if (src.hasCode()) 232 tgt.setCode(CodeableConcept30_40.convertCodeableConcept(src.getCode())); 233 } 234 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) { 235 tgt.addReasonCode(CodeableConcept30_40.convertCodeableConcept(t)); 236 } 237 for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) { 238 tgt.addReasonReference(Reference30_40.convertReference(t)); 239 } 240 for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) { 241 tgt.addGoal(Reference30_40.convertReference(t)); 242 } 243 if (src.hasStatus()) { 244 if (src.hasStatus()) 245 tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement())); 246 } 247 if (src.hasStatusReason()) { 248 org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding(); 249 code.setCode(src.getStatusReason()); 250 org.hl7.fhir.r4.model.CodeableConcept t = new org.hl7.fhir.r4.model.CodeableConcept(code); 251 tgt.setStatusReason(t); 252 } 253 if (src.hasProhibited()) { 254 if (src.hasProhibitedElement()) 255 tgt.setDoNotPerformElement(Boolean30_40.convertBoolean(src.getProhibitedElement())); 256 } 257 if (src.hasScheduled()) { 258 if (src.hasScheduled()) 259 tgt.setScheduled(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getScheduled())); 260 } 261 if (src.hasLocation()) { 262 if (src.hasLocation()) 263 tgt.setLocation(Reference30_40.convertReference(src.getLocation())); 264 } 265 for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) { 266 tgt.addPerformer(Reference30_40.convertReference(t)); 267 } 268 if (src.hasProduct()) { 269 if (src.hasProduct()) 270 tgt.setProduct(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getProduct())); 271 } 272 if (src.hasDailyAmount()) { 273 if (src.hasDailyAmount()) 274 tgt.setDailyAmount(SimpleQuantity30_40.convertSimpleQuantity(src.getDailyAmount())); 275 } 276 if (src.hasQuantity()) { 277 if (src.hasQuantity()) 278 tgt.setQuantity(SimpleQuantity30_40.convertSimpleQuantity(src.getQuantity())); 279 } 280 if (src.hasDescription()) { 281 if (src.hasDescriptionElement()) 282 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 283 } 284 return tgt; 285 } 286 287 public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { 288 if (src == null) 289 return null; 290 org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); 291 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt); 292 if (src.hasExtension()) { 293 org.hl7.fhir.r4.model.Extension extension = src.getExtensionByUrl(VersionConvertorConstants.EXT_CarePlanActivityDetailComponentExtension); 294 if (extension != null) { 295 org.hl7.fhir.r4.model.Type value = extension.getValue(); 296 if (value instanceof org.hl7.fhir.r4.model.CodeableConcept) { 297 tgt.setCategory(CodeableConcept30_40.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) value)); 298 } 299 } 300 } 301 if (src.hasCode()) { 302 if (src.hasCode()) 303 tgt.setCode(CodeableConcept30_40.convertCodeableConcept(src.getCode())); 304 } 305 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) { 306 tgt.addReasonCode(CodeableConcept30_40.convertCodeableConcept(t)); 307 } 308 for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) { 309 tgt.addReasonReference(Reference30_40.convertReference(t)); 310 } 311 for (org.hl7.fhir.r4.model.Reference t : src.getGoal()) { 312 tgt.addGoal(Reference30_40.convertReference(t)); 313 } 314 if (src.hasStatus()) { 315 if (src.hasStatus()) 316 tgt.setStatusElement(convertCarePlanActivityStatus(src.getStatusElement())); 317 } 318 if (src.hasStatusReason()) { 319 List<Coding> coding = src.getStatusReason().getCoding(); 320 if (coding.size() > 0) { 321 tgt.setStatusReason(coding.get(0).getCode()); 322 } 323 } 324 if (src.hasDoNotPerform()) { 325 if (src.hasDoNotPerformElement()) 326 tgt.setProhibitedElement(Boolean30_40.convertBoolean(src.getDoNotPerformElement())); 327 } 328 if (src.hasScheduled()) { 329 if (src.hasScheduled()) 330 tgt.setScheduled(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getScheduled())); 331 } 332 if (src.hasLocation()) { 333 if (src.hasLocation()) 334 tgt.setLocation(Reference30_40.convertReference(src.getLocation())); 335 } 336 for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) { 337 tgt.addPerformer(Reference30_40.convertReference(t)); 338 } 339 if (src.hasProduct()) { 340 if (src.hasProduct()) 341 tgt.setProduct(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getProduct())); 342 } 343 if (src.hasDailyAmount()) { 344 if (src.hasDailyAmount()) 345 tgt.setDailyAmount(SimpleQuantity30_40.convertSimpleQuantity(src.getDailyAmount())); 346 } 347 if (src.hasQuantity()) { 348 if (src.hasQuantity()) 349 tgt.setQuantity(SimpleQuantity30_40.convertSimpleQuantity(src.getQuantity())); 350 } 351 if (src.hasDescription()) { 352 if (src.hasDescriptionElement()) 353 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 354 } 355 return tgt; 356 } 357 358 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException { 359 if (src == null || src.isEmpty()) 360 return null; 361 Enumeration<CarePlan.CarePlanActivityStatus> tgt = new Enumeration<>(new CarePlan.CarePlanActivityStatusEnumFactory()); 362 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 363 if (src.getValue() == null) { 364 tgt.setValue(null); 365 } else { 366 switch (src.getValue()) { 367 case CANCELLED: 368 tgt.setValue(CarePlan.CarePlanActivityStatus.CANCELLED); 369 break; 370 case COMPLETED: 371 tgt.setValue(CarePlan.CarePlanActivityStatus.COMPLETED); 372 break; 373 case INPROGRESS: 374 tgt.setValue(CarePlan.CarePlanActivityStatus.INPROGRESS); 375 break; 376 case NOTSTARTED: 377 tgt.setValue(CarePlan.CarePlanActivityStatus.NOTSTARTED); 378 break; 379 case ONHOLD: 380 tgt.setValue(CarePlan.CarePlanActivityStatus.ONHOLD); 381 break; 382 case SCHEDULED: 383 tgt.setValue(CarePlan.CarePlanActivityStatus.SCHEDULED); 384 break; 385 case UNKNOWN: 386 tgt.setValue(CarePlan.CarePlanActivityStatus.UNKNOWN); 387 break; 388 default: 389 tgt.setValue(CarePlan.CarePlanActivityStatus.NULL); 390 break; 391 } 392 } 393 return tgt; 394 } 395 396 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus> src) throws FHIRException { 397 if (src == null || src.isEmpty()) 398 return null; 399 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatusEnumFactory()); 400 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 401 if (src.getValue() == null) { 402 tgt.setValue(null); 403 } else { 404 switch (src.getValue()) { 405 case CANCELLED: 406 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.CANCELLED); 407 break; 408 case COMPLETED: 409 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.COMPLETED); 410 break; 411 case INPROGRESS: 412 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.INPROGRESS); 413 break; 414 case NOTSTARTED: 415 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NOTSTARTED); 416 break; 417 case ONHOLD: 418 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.ONHOLD); 419 break; 420 case SCHEDULED: 421 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.SCHEDULED); 422 break; 423 case UNKNOWN: 424 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.UNKNOWN); 425 break; 426 default: 427 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityStatus.NULL); 428 break; 429 } 430 } 431 return tgt; 432 } 433 434 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent> src) throws FHIRException { 435 if (src == null || src.isEmpty()) 436 return null; 437 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanIntentEnumFactory()); 438 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 439 if (src.getValue() == null) { 440 tgt.setValue(null); 441 } else { 442 switch (src.getValue()) { 443 case OPTION: 444 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.OPTION); 445 break; 446 case ORDER: 447 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.ORDER); 448 break; 449 case PLAN: 450 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PLAN); 451 break; 452 case PROPOSAL: 453 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.PROPOSAL); 454 break; 455 default: 456 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanIntent.NULL); 457 break; 458 } 459 } 460 return tgt; 461 } 462 463 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanIntent> convertCarePlanIntent(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanIntent> src) throws FHIRException { 464 if (src == null || src.isEmpty()) 465 return null; 466 Enumeration<CarePlan.CarePlanIntent> tgt = new Enumeration<>(new CarePlan.CarePlanIntentEnumFactory()); 467 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 468 if (src.getValue() == null) { 469 tgt.setValue(null); 470 } else { 471 switch (src.getValue()) { 472 case OPTION: 473 tgt.setValue(CarePlan.CarePlanIntent.OPTION); 474 break; 475 case ORDER: 476 tgt.setValue(CarePlan.CarePlanIntent.ORDER); 477 break; 478 case PLAN: 479 tgt.setValue(CarePlan.CarePlanIntent.PLAN); 480 break; 481 case PROPOSAL: 482 tgt.setValue(CarePlan.CarePlanIntent.PROPOSAL); 483 break; 484 default: 485 tgt.setValue(CarePlan.CarePlanIntent.NULL); 486 break; 487 } 488 } 489 return tgt; 490 } 491 492 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus> convertCarePlanStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> src) throws FHIRException { 493 if (src == null || src.isEmpty()) 494 return null; 495 Enumeration<CarePlan.CarePlanStatus> tgt = new Enumeration<>(new CarePlan.CarePlanStatusEnumFactory()); 496 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 497 if (src.getValue() == null) { 498 tgt.setValue(null); 499 } else { 500 switch (src.getValue()) { 501 case ACTIVE: 502 tgt.setValue(CarePlan.CarePlanStatus.ACTIVE); 503 break; 504 case REVOKED: 505 tgt.setValue(CarePlan.CarePlanStatus.CANCELLED); 506 break; 507 case COMPLETED: 508 tgt.setValue(CarePlan.CarePlanStatus.COMPLETED); 509 break; 510 case DRAFT: 511 tgt.setValue(CarePlan.CarePlanStatus.DRAFT); 512 break; 513 case ENTEREDINERROR: 514 tgt.setValue(CarePlan.CarePlanStatus.ENTEREDINERROR); 515 break; 516 case ONHOLD: 517 tgt.setValue(CarePlan.CarePlanStatus.SUSPENDED); 518 break; 519 case UNKNOWN: 520 tgt.setValue(CarePlan.CarePlanStatus.UNKNOWN); 521 break; 522 default: 523 tgt.setValue(CarePlan.CarePlanStatus.NULL); 524 break; 525 } 526 } 527 return tgt; 528 } 529 530 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> convertCarePlanStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus> src) throws FHIRException { 531 if (src == null || src.isEmpty()) 532 return null; 533 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.CarePlan.CarePlanStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CarePlan.CarePlanStatusEnumFactory()); 534 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 535 if (src.getValue() == null) { 536 tgt.setValue(null); 537 } else { 538 switch (src.getValue()) { 539 case ACTIVE: 540 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE); 541 break; 542 case CANCELLED: 543 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.REVOKED); 544 break; 545 case COMPLETED: 546 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED); 547 break; 548 case DRAFT: 549 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT); 550 break; 551 case ENTEREDINERROR: 552 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ENTEREDINERROR); 553 break; 554 case SUSPENDED: 555 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ONHOLD); 556 break; 557 case UNKNOWN: 558 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.UNKNOWN); 559 break; 560 default: 561 tgt.setValue(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL); 562 break; 563 } 564 } 565 return tgt; 566 } 567}