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