001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038 039import ca.uhn.fhir.model.api.annotation.Block; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044 045/** 046 * An association between a patient and an organization / healthcare provider(s) 047 * during which time encounters may occur. The managing organization assumes a 048 * level of responsibility for the patient during this time. 049 */ 050@ResourceDef(name = "EpisodeOfCare", profile = "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare") 051public class EpisodeOfCare extends DomainResource { 052 053 public enum EpisodeOfCareStatus { 054 /** 055 * This episode of care is planned to start at the date specified in the 056 * period.start. During this status, an organization may perform assessments to 057 * determine if the patient is eligible to receive services, or be organizing to 058 * make resources available to provide care services. 059 */ 060 PLANNED, 061 /** 062 * This episode has been placed on a waitlist, pending the episode being made 063 * active (or cancelled). 064 */ 065 WAITLIST, 066 /** 067 * This episode of care is current. 068 */ 069 ACTIVE, 070 /** 071 * This episode of care is on hold; the organization has limited responsibility 072 * for the patient (such as while on respite). 073 */ 074 ONHOLD, 075 /** 076 * This episode of care is finished and the organization is not expecting to be 077 * providing further care to the patient. Can also be known as "closed", 078 * "completed" or other similar terms. 079 */ 080 FINISHED, 081 /** 082 * The episode of care was cancelled, or withdrawn from service, often selected 083 * during the planned stage as the patient may have gone elsewhere, or the 084 * circumstances have changed and the organization is unable to provide the 085 * care. It indicates that services terminated outside the planned/expected 086 * workflow. 087 */ 088 CANCELLED, 089 /** 090 * This instance should not have been part of this patient's medical record. 091 */ 092 ENTEREDINERROR, 093 /** 094 * added to help the parsers with the generic types 095 */ 096 NULL; 097 098 public static EpisodeOfCareStatus fromCode(String codeString) throws FHIRException { 099 if (codeString == null || "".equals(codeString)) 100 return null; 101 if ("planned".equals(codeString)) 102 return PLANNED; 103 if ("waitlist".equals(codeString)) 104 return WAITLIST; 105 if ("active".equals(codeString)) 106 return ACTIVE; 107 if ("onhold".equals(codeString)) 108 return ONHOLD; 109 if ("finished".equals(codeString)) 110 return FINISHED; 111 if ("cancelled".equals(codeString)) 112 return CANCELLED; 113 if ("entered-in-error".equals(codeString)) 114 return ENTEREDINERROR; 115 if (Configuration.isAcceptInvalidEnums()) 116 return null; 117 else 118 throw new FHIRException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 119 } 120 121 public String toCode() { 122 switch (this) { 123 case PLANNED: 124 return "planned"; 125 case WAITLIST: 126 return "waitlist"; 127 case ACTIVE: 128 return "active"; 129 case ONHOLD: 130 return "onhold"; 131 case FINISHED: 132 return "finished"; 133 case CANCELLED: 134 return "cancelled"; 135 case ENTEREDINERROR: 136 return "entered-in-error"; 137 case NULL: 138 return null; 139 default: 140 return "?"; 141 } 142 } 143 144 public String getSystem() { 145 switch (this) { 146 case PLANNED: 147 return "http://hl7.org/fhir/episode-of-care-status"; 148 case WAITLIST: 149 return "http://hl7.org/fhir/episode-of-care-status"; 150 case ACTIVE: 151 return "http://hl7.org/fhir/episode-of-care-status"; 152 case ONHOLD: 153 return "http://hl7.org/fhir/episode-of-care-status"; 154 case FINISHED: 155 return "http://hl7.org/fhir/episode-of-care-status"; 156 case CANCELLED: 157 return "http://hl7.org/fhir/episode-of-care-status"; 158 case ENTEREDINERROR: 159 return "http://hl7.org/fhir/episode-of-care-status"; 160 case NULL: 161 return null; 162 default: 163 return "?"; 164 } 165 } 166 167 public String getDefinition() { 168 switch (this) { 169 case PLANNED: 170 return "This episode of care is planned to start at the date specified in the period.start. During this status, an organization may perform assessments to determine if the patient is eligible to receive services, or be organizing to make resources available to provide care services."; 171 case WAITLIST: 172 return "This episode has been placed on a waitlist, pending the episode being made active (or cancelled)."; 173 case ACTIVE: 174 return "This episode of care is current."; 175 case ONHOLD: 176 return "This episode of care is on hold; the organization has limited responsibility for the patient (such as while on respite)."; 177 case FINISHED: 178 return "This episode of care is finished and the organization is not expecting to be providing further care to the patient. Can also be known as \"closed\", \"completed\" or other similar terms."; 179 case CANCELLED: 180 return "The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the care. It indicates that services terminated outside the planned/expected workflow."; 181 case ENTEREDINERROR: 182 return "This instance should not have been part of this patient's medical record."; 183 case NULL: 184 return null; 185 default: 186 return "?"; 187 } 188 } 189 190 public String getDisplay() { 191 switch (this) { 192 case PLANNED: 193 return "Planned"; 194 case WAITLIST: 195 return "Waitlist"; 196 case ACTIVE: 197 return "Active"; 198 case ONHOLD: 199 return "On Hold"; 200 case FINISHED: 201 return "Finished"; 202 case CANCELLED: 203 return "Cancelled"; 204 case ENTEREDINERROR: 205 return "Entered in Error"; 206 case NULL: 207 return null; 208 default: 209 return "?"; 210 } 211 } 212 } 213 214 public static class EpisodeOfCareStatusEnumFactory implements EnumFactory<EpisodeOfCareStatus> { 215 public EpisodeOfCareStatus fromCode(String codeString) throws IllegalArgumentException { 216 if (codeString == null || "".equals(codeString)) 217 if (codeString == null || "".equals(codeString)) 218 return null; 219 if ("planned".equals(codeString)) 220 return EpisodeOfCareStatus.PLANNED; 221 if ("waitlist".equals(codeString)) 222 return EpisodeOfCareStatus.WAITLIST; 223 if ("active".equals(codeString)) 224 return EpisodeOfCareStatus.ACTIVE; 225 if ("onhold".equals(codeString)) 226 return EpisodeOfCareStatus.ONHOLD; 227 if ("finished".equals(codeString)) 228 return EpisodeOfCareStatus.FINISHED; 229 if ("cancelled".equals(codeString)) 230 return EpisodeOfCareStatus.CANCELLED; 231 if ("entered-in-error".equals(codeString)) 232 return EpisodeOfCareStatus.ENTEREDINERROR; 233 throw new IllegalArgumentException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 234 } 235 236 public Enumeration<EpisodeOfCareStatus> fromType(PrimitiveType<?> code) throws FHIRException { 237 if (code == null) 238 return null; 239 if (code.isEmpty()) 240 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.NULL, code); 241 String codeString = code.asStringValue(); 242 if (codeString == null || "".equals(codeString)) 243 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.NULL, code); 244 if ("planned".equals(codeString)) 245 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.PLANNED, code); 246 if ("waitlist".equals(codeString)) 247 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.WAITLIST, code); 248 if ("active".equals(codeString)) 249 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ACTIVE, code); 250 if ("onhold".equals(codeString)) 251 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ONHOLD, code); 252 if ("finished".equals(codeString)) 253 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.FINISHED, code); 254 if ("cancelled".equals(codeString)) 255 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.CANCELLED, code); 256 if ("entered-in-error".equals(codeString)) 257 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ENTEREDINERROR, code); 258 throw new FHIRException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 259 } 260 261 public String toCode(EpisodeOfCareStatus code) { 262 if (code == EpisodeOfCareStatus.PLANNED) 263 return "planned"; 264 if (code == EpisodeOfCareStatus.WAITLIST) 265 return "waitlist"; 266 if (code == EpisodeOfCareStatus.ACTIVE) 267 return "active"; 268 if (code == EpisodeOfCareStatus.ONHOLD) 269 return "onhold"; 270 if (code == EpisodeOfCareStatus.FINISHED) 271 return "finished"; 272 if (code == EpisodeOfCareStatus.CANCELLED) 273 return "cancelled"; 274 if (code == EpisodeOfCareStatus.ENTEREDINERROR) 275 return "entered-in-error"; 276 return "?"; 277 } 278 279 public String toSystem(EpisodeOfCareStatus code) { 280 return code.getSystem(); 281 } 282 } 283 284 @Block() 285 public static class EpisodeOfCareStatusHistoryComponent extends BackboneElement implements IBaseBackboneElement { 286 /** 287 * planned | waitlist | active | onhold | finished | cancelled. 288 */ 289 @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false) 290 @Description(shortDefinition = "planned | waitlist | active | onhold | finished | cancelled | entered-in-error", formalDefinition = "planned | waitlist | active | onhold | finished | cancelled.") 291 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/episode-of-care-status") 292 protected Enumeration<EpisodeOfCareStatus> status; 293 294 /** 295 * The period during this EpisodeOfCare that the specific status applied. 296 */ 297 @Child(name = "period", type = { Period.class }, order = 2, min = 1, max = 1, modifier = false, summary = false) 298 @Description(shortDefinition = "Duration the EpisodeOfCare was in the specified status", formalDefinition = "The period during this EpisodeOfCare that the specific status applied.") 299 protected Period period; 300 301 private static final long serialVersionUID = -1192432864L; 302 303 /** 304 * Constructor 305 */ 306 public EpisodeOfCareStatusHistoryComponent() { 307 super(); 308 } 309 310 /** 311 * Constructor 312 */ 313 public EpisodeOfCareStatusHistoryComponent(Enumeration<EpisodeOfCareStatus> status, Period period) { 314 super(); 315 this.status = status; 316 this.period = period; 317 } 318 319 /** 320 * @return {@link #status} (planned | waitlist | active | onhold | finished | 321 * cancelled.). This is the underlying object with id, value and 322 * extensions. The accessor "getStatus" gives direct access to the value 323 */ 324 public Enumeration<EpisodeOfCareStatus> getStatusElement() { 325 if (this.status == null) 326 if (Configuration.errorOnAutoCreate()) 327 throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.status"); 328 else if (Configuration.doAutoCreate()) 329 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb 330 return this.status; 331 } 332 333 public boolean hasStatusElement() { 334 return this.status != null && !this.status.isEmpty(); 335 } 336 337 public boolean hasStatus() { 338 return this.status != null && !this.status.isEmpty(); 339 } 340 341 /** 342 * @param value {@link #status} (planned | waitlist | active | onhold | finished 343 * | cancelled.). This is the underlying object with id, value and 344 * extensions. The accessor "getStatus" gives direct access to the 345 * value 346 */ 347 public EpisodeOfCareStatusHistoryComponent setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 348 this.status = value; 349 return this; 350 } 351 352 /** 353 * @return planned | waitlist | active | onhold | finished | cancelled. 354 */ 355 public EpisodeOfCareStatus getStatus() { 356 return this.status == null ? null : this.status.getValue(); 357 } 358 359 /** 360 * @param value planned | waitlist | active | onhold | finished | cancelled. 361 */ 362 public EpisodeOfCareStatusHistoryComponent setStatus(EpisodeOfCareStatus value) { 363 if (this.status == null) 364 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); 365 this.status.setValue(value); 366 return this; 367 } 368 369 /** 370 * @return {@link #period} (The period during this EpisodeOfCare that the 371 * specific status applied.) 372 */ 373 public Period getPeriod() { 374 if (this.period == null) 375 if (Configuration.errorOnAutoCreate()) 376 throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.period"); 377 else if (Configuration.doAutoCreate()) 378 this.period = new Period(); // cc 379 return this.period; 380 } 381 382 public boolean hasPeriod() { 383 return this.period != null && !this.period.isEmpty(); 384 } 385 386 /** 387 * @param value {@link #period} (The period during this EpisodeOfCare that the 388 * specific status applied.) 389 */ 390 public EpisodeOfCareStatusHistoryComponent setPeriod(Period value) { 391 this.period = value; 392 return this; 393 } 394 395 protected void listChildren(List<Property> children) { 396 super.listChildren(children); 397 children.add( 398 new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, 1, status)); 399 children.add(new Property("period", "Period", 400 "The period during this EpisodeOfCare that the specific status applied.", 0, 1, period)); 401 } 402 403 @Override 404 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 405 switch (_hash) { 406 case -892481550: 407 /* status */ return new Property("status", "code", 408 "planned | waitlist | active | onhold | finished | cancelled.", 0, 1, status); 409 case -991726143: 410 /* period */ return new Property("period", "Period", 411 "The period during this EpisodeOfCare that the specific status applied.", 0, 1, period); 412 default: 413 return super.getNamedProperty(_hash, _name, _checkValid); 414 } 415 416 } 417 418 @Override 419 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 420 switch (hash) { 421 case -892481550: 422 /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<EpisodeOfCareStatus> 423 case -991726143: 424 /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period 425 default: 426 return super.getProperty(hash, name, checkValid); 427 } 428 429 } 430 431 @Override 432 public Base setProperty(int hash, String name, Base value) throws FHIRException { 433 switch (hash) { 434 case -892481550: // status 435 value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value)); 436 this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus> 437 return value; 438 case -991726143: // period 439 this.period = castToPeriod(value); // Period 440 return value; 441 default: 442 return super.setProperty(hash, name, value); 443 } 444 445 } 446 447 @Override 448 public Base setProperty(String name, Base value) throws FHIRException { 449 if (name.equals("status")) { 450 value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value)); 451 this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus> 452 } else if (name.equals("period")) { 453 this.period = castToPeriod(value); // Period 454 } else 455 return super.setProperty(name, value); 456 return value; 457 } 458 459 @Override 460 public Base makeProperty(int hash, String name) throws FHIRException { 461 switch (hash) { 462 case -892481550: 463 return getStatusElement(); 464 case -991726143: 465 return getPeriod(); 466 default: 467 return super.makeProperty(hash, name); 468 } 469 470 } 471 472 @Override 473 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 474 switch (hash) { 475 case -892481550: 476 /* status */ return new String[] { "code" }; 477 case -991726143: 478 /* period */ return new String[] { "Period" }; 479 default: 480 return super.getTypesForProperty(hash, name); 481 } 482 483 } 484 485 @Override 486 public Base addChild(String name) throws FHIRException { 487 if (name.equals("status")) { 488 throw new FHIRException("Cannot call addChild on a singleton property EpisodeOfCare.status"); 489 } else if (name.equals("period")) { 490 this.period = new Period(); 491 return this.period; 492 } else 493 return super.addChild(name); 494 } 495 496 public EpisodeOfCareStatusHistoryComponent copy() { 497 EpisodeOfCareStatusHistoryComponent dst = new EpisodeOfCareStatusHistoryComponent(); 498 copyValues(dst); 499 return dst; 500 } 501 502 public void copyValues(EpisodeOfCareStatusHistoryComponent dst) { 503 super.copyValues(dst); 504 dst.status = status == null ? null : status.copy(); 505 dst.period = period == null ? null : period.copy(); 506 } 507 508 @Override 509 public boolean equalsDeep(Base other_) { 510 if (!super.equalsDeep(other_)) 511 return false; 512 if (!(other_ instanceof EpisodeOfCareStatusHistoryComponent)) 513 return false; 514 EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other_; 515 return compareDeep(status, o.status, true) && compareDeep(period, o.period, true); 516 } 517 518 @Override 519 public boolean equalsShallow(Base other_) { 520 if (!super.equalsShallow(other_)) 521 return false; 522 if (!(other_ instanceof EpisodeOfCareStatusHistoryComponent)) 523 return false; 524 EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other_; 525 return compareValues(status, o.status, true); 526 } 527 528 public boolean isEmpty() { 529 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, period); 530 } 531 532 public String fhirType() { 533 return "EpisodeOfCare.statusHistory"; 534 535 } 536 537 } 538 539 @Block() 540 public static class DiagnosisComponent extends BackboneElement implements IBaseBackboneElement { 541 /** 542 * A list of conditions/problems/diagnoses that this episode of care is intended 543 * to be providing care for. 544 */ 545 @Child(name = "condition", type = { 546 Condition.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 547 @Description(shortDefinition = "Conditions/problems/diagnoses this episode of care is for", formalDefinition = "A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.") 548 protected Reference condition; 549 550 /** 551 * The actual object that is the target of the reference (A list of 552 * conditions/problems/diagnoses that this episode of care is intended to be 553 * providing care for.) 554 */ 555 protected Condition conditionTarget; 556 557 /** 558 * Role that this diagnosis has within the episode of care (e.g. admission, 559 * billing, discharge ?). 560 */ 561 @Child(name = "role", type = { 562 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 563 @Description(shortDefinition = "Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge ?)", formalDefinition = "Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge ?).") 564 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diagnosis-role") 565 protected CodeableConcept role; 566 567 /** 568 * Ranking of the diagnosis (for each role type). 569 */ 570 @Child(name = "rank", type = { 571 PositiveIntType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 572 @Description(shortDefinition = "Ranking of the diagnosis (for each role type)", formalDefinition = "Ranking of the diagnosis (for each role type).") 573 protected PositiveIntType rank; 574 575 private static final long serialVersionUID = 249445632L; 576 577 /** 578 * Constructor 579 */ 580 public DiagnosisComponent() { 581 super(); 582 } 583 584 /** 585 * Constructor 586 */ 587 public DiagnosisComponent(Reference condition) { 588 super(); 589 this.condition = condition; 590 } 591 592 /** 593 * @return {@link #condition} (A list of conditions/problems/diagnoses that this 594 * episode of care is intended to be providing care for.) 595 */ 596 public Reference getCondition() { 597 if (this.condition == null) 598 if (Configuration.errorOnAutoCreate()) 599 throw new Error("Attempt to auto-create DiagnosisComponent.condition"); 600 else if (Configuration.doAutoCreate()) 601 this.condition = new Reference(); // cc 602 return this.condition; 603 } 604 605 public boolean hasCondition() { 606 return this.condition != null && !this.condition.isEmpty(); 607 } 608 609 /** 610 * @param value {@link #condition} (A list of conditions/problems/diagnoses that 611 * this episode of care is intended to be providing care for.) 612 */ 613 public DiagnosisComponent setCondition(Reference value) { 614 this.condition = value; 615 return this; 616 } 617 618 /** 619 * @return {@link #condition} The actual object that is the target of the 620 * reference. The reference library doesn't populate this, but you can 621 * use it to hold the resource if you resolve it. (A list of 622 * conditions/problems/diagnoses that this episode of care is intended 623 * to be providing care for.) 624 */ 625 public Condition getConditionTarget() { 626 if (this.conditionTarget == null) 627 if (Configuration.errorOnAutoCreate()) 628 throw new Error("Attempt to auto-create DiagnosisComponent.condition"); 629 else if (Configuration.doAutoCreate()) 630 this.conditionTarget = new Condition(); // aa 631 return this.conditionTarget; 632 } 633 634 /** 635 * @param value {@link #condition} The actual object that is the target of the 636 * reference. The reference library doesn't use these, but you can 637 * use it to hold the resource if you resolve it. (A list of 638 * conditions/problems/diagnoses that this episode of care is 639 * intended to be providing care for.) 640 */ 641 public DiagnosisComponent setConditionTarget(Condition value) { 642 this.conditionTarget = value; 643 return this; 644 } 645 646 /** 647 * @return {@link #role} (Role that this diagnosis has within the episode of 648 * care (e.g. admission, billing, discharge ?).) 649 */ 650 public CodeableConcept getRole() { 651 if (this.role == null) 652 if (Configuration.errorOnAutoCreate()) 653 throw new Error("Attempt to auto-create DiagnosisComponent.role"); 654 else if (Configuration.doAutoCreate()) 655 this.role = new CodeableConcept(); // cc 656 return this.role; 657 } 658 659 public boolean hasRole() { 660 return this.role != null && !this.role.isEmpty(); 661 } 662 663 /** 664 * @param value {@link #role} (Role that this diagnosis has within the episode 665 * of care (e.g. admission, billing, discharge ?).) 666 */ 667 public DiagnosisComponent setRole(CodeableConcept value) { 668 this.role = value; 669 return this; 670 } 671 672 /** 673 * @return {@link #rank} (Ranking of the diagnosis (for each role type).). This 674 * is the underlying object with id, value and extensions. The accessor 675 * "getRank" gives direct access to the value 676 */ 677 public PositiveIntType getRankElement() { 678 if (this.rank == null) 679 if (Configuration.errorOnAutoCreate()) 680 throw new Error("Attempt to auto-create DiagnosisComponent.rank"); 681 else if (Configuration.doAutoCreate()) 682 this.rank = new PositiveIntType(); // bb 683 return this.rank; 684 } 685 686 public boolean hasRankElement() { 687 return this.rank != null && !this.rank.isEmpty(); 688 } 689 690 public boolean hasRank() { 691 return this.rank != null && !this.rank.isEmpty(); 692 } 693 694 /** 695 * @param value {@link #rank} (Ranking of the diagnosis (for each role type).). 696 * This is the underlying object with id, value and extensions. The 697 * accessor "getRank" gives direct access to the value 698 */ 699 public DiagnosisComponent setRankElement(PositiveIntType value) { 700 this.rank = value; 701 return this; 702 } 703 704 /** 705 * @return Ranking of the diagnosis (for each role type). 706 */ 707 public int getRank() { 708 return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue(); 709 } 710 711 /** 712 * @param value Ranking of the diagnosis (for each role type). 713 */ 714 public DiagnosisComponent setRank(int value) { 715 if (this.rank == null) 716 this.rank = new PositiveIntType(); 717 this.rank.setValue(value); 718 return this; 719 } 720 721 protected void listChildren(List<Property> children) { 722 super.listChildren(children); 723 children.add(new Property("condition", "Reference(Condition)", 724 "A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.", 0, 725 1, condition)); 726 children.add(new Property("role", "CodeableConcept", 727 "Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge ?).", 0, 1, 728 role)); 729 children.add(new Property("rank", "positiveInt", "Ranking of the diagnosis (for each role type).", 0, 1, rank)); 730 } 731 732 @Override 733 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 734 switch (_hash) { 735 case -861311717: 736 /* condition */ return new Property("condition", "Reference(Condition)", 737 "A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.", 738 0, 1, condition); 739 case 3506294: 740 /* role */ return new Property("role", "CodeableConcept", 741 "Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge ?).", 0, 1, 742 role); 743 case 3492908: 744 /* rank */ return new Property("rank", "positiveInt", "Ranking of the diagnosis (for each role type).", 0, 1, 745 rank); 746 default: 747 return super.getNamedProperty(_hash, _name, _checkValid); 748 } 749 750 } 751 752 @Override 753 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 754 switch (hash) { 755 case -861311717: 756 /* condition */ return this.condition == null ? new Base[0] : new Base[] { this.condition }; // Reference 757 case 3506294: 758 /* role */ return this.role == null ? new Base[0] : new Base[] { this.role }; // CodeableConcept 759 case 3492908: 760 /* rank */ return this.rank == null ? new Base[0] : new Base[] { this.rank }; // PositiveIntType 761 default: 762 return super.getProperty(hash, name, checkValid); 763 } 764 765 } 766 767 @Override 768 public Base setProperty(int hash, String name, Base value) throws FHIRException { 769 switch (hash) { 770 case -861311717: // condition 771 this.condition = castToReference(value); // Reference 772 return value; 773 case 3506294: // role 774 this.role = castToCodeableConcept(value); // CodeableConcept 775 return value; 776 case 3492908: // rank 777 this.rank = castToPositiveInt(value); // PositiveIntType 778 return value; 779 default: 780 return super.setProperty(hash, name, value); 781 } 782 783 } 784 785 @Override 786 public Base setProperty(String name, Base value) throws FHIRException { 787 if (name.equals("condition")) { 788 this.condition = castToReference(value); // Reference 789 } else if (name.equals("role")) { 790 this.role = castToCodeableConcept(value); // CodeableConcept 791 } else if (name.equals("rank")) { 792 this.rank = castToPositiveInt(value); // PositiveIntType 793 } else 794 return super.setProperty(name, value); 795 return value; 796 } 797 798 @Override 799 public Base makeProperty(int hash, String name) throws FHIRException { 800 switch (hash) { 801 case -861311717: 802 return getCondition(); 803 case 3506294: 804 return getRole(); 805 case 3492908: 806 return getRankElement(); 807 default: 808 return super.makeProperty(hash, name); 809 } 810 811 } 812 813 @Override 814 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 815 switch (hash) { 816 case -861311717: 817 /* condition */ return new String[] { "Reference" }; 818 case 3506294: 819 /* role */ return new String[] { "CodeableConcept" }; 820 case 3492908: 821 /* rank */ return new String[] { "positiveInt" }; 822 default: 823 return super.getTypesForProperty(hash, name); 824 } 825 826 } 827 828 @Override 829 public Base addChild(String name) throws FHIRException { 830 if (name.equals("condition")) { 831 this.condition = new Reference(); 832 return this.condition; 833 } else if (name.equals("role")) { 834 this.role = new CodeableConcept(); 835 return this.role; 836 } else if (name.equals("rank")) { 837 throw new FHIRException("Cannot call addChild on a singleton property EpisodeOfCare.rank"); 838 } else 839 return super.addChild(name); 840 } 841 842 public DiagnosisComponent copy() { 843 DiagnosisComponent dst = new DiagnosisComponent(); 844 copyValues(dst); 845 return dst; 846 } 847 848 public void copyValues(DiagnosisComponent dst) { 849 super.copyValues(dst); 850 dst.condition = condition == null ? null : condition.copy(); 851 dst.role = role == null ? null : role.copy(); 852 dst.rank = rank == null ? null : rank.copy(); 853 } 854 855 @Override 856 public boolean equalsDeep(Base other_) { 857 if (!super.equalsDeep(other_)) 858 return false; 859 if (!(other_ instanceof DiagnosisComponent)) 860 return false; 861 DiagnosisComponent o = (DiagnosisComponent) other_; 862 return compareDeep(condition, o.condition, true) && compareDeep(role, o.role, true) 863 && compareDeep(rank, o.rank, true); 864 } 865 866 @Override 867 public boolean equalsShallow(Base other_) { 868 if (!super.equalsShallow(other_)) 869 return false; 870 if (!(other_ instanceof DiagnosisComponent)) 871 return false; 872 DiagnosisComponent o = (DiagnosisComponent) other_; 873 return compareValues(rank, o.rank, true); 874 } 875 876 public boolean isEmpty() { 877 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(condition, role, rank); 878 } 879 880 public String fhirType() { 881 return "EpisodeOfCare.diagnosis"; 882 883 } 884 885 } 886 887 /** 888 * The EpisodeOfCare may be known by different identifiers for different 889 * contexts of use, such as when an external agency is tracking the Episode for 890 * funding purposes. 891 */ 892 @Child(name = "identifier", type = { 893 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 894 @Description(shortDefinition = "Business Identifier(s) relevant for this EpisodeOfCare", formalDefinition = "The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.") 895 protected List<Identifier> identifier; 896 897 /** 898 * planned | waitlist | active | onhold | finished | cancelled. 899 */ 900 @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true) 901 @Description(shortDefinition = "planned | waitlist | active | onhold | finished | cancelled | entered-in-error", formalDefinition = "planned | waitlist | active | onhold | finished | cancelled.") 902 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/episode-of-care-status") 903 protected Enumeration<EpisodeOfCareStatus> status; 904 905 /** 906 * The history of statuses that the EpisodeOfCare has been through (without 907 * requiring processing the history of the resource). 908 */ 909 @Child(name = "statusHistory", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 910 @Description(shortDefinition = "Past list of status codes (the current status may be included to cover the start date of the status)", formalDefinition = "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).") 911 protected List<EpisodeOfCareStatusHistoryComponent> statusHistory; 912 913 /** 914 * A classification of the type of episode of care; e.g. specialist referral, 915 * disease management, type of funded care. 916 */ 917 @Child(name = "type", type = { 918 CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 919 @Description(shortDefinition = "Type/class - e.g. specialist referral, disease management", formalDefinition = "A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.") 920 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/episodeofcare-type") 921 protected List<CodeableConcept> type; 922 923 /** 924 * The list of diagnosis relevant to this episode of care. 925 */ 926 @Child(name = "diagnosis", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 927 @Description(shortDefinition = "The list of diagnosis relevant to this episode of care", formalDefinition = "The list of diagnosis relevant to this episode of care.") 928 protected List<DiagnosisComponent> diagnosis; 929 930 /** 931 * The patient who is the focus of this episode of care. 932 */ 933 @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true) 934 @Description(shortDefinition = "The patient who is the focus of this episode of care", formalDefinition = "The patient who is the focus of this episode of care.") 935 protected Reference patient; 936 937 /** 938 * The actual object that is the target of the reference (The patient who is the 939 * focus of this episode of care.) 940 */ 941 protected Patient patientTarget; 942 943 /** 944 * The organization that has assumed the specific responsibilities for the 945 * specified duration. 946 */ 947 @Child(name = "managingOrganization", type = { 948 Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 949 @Description(shortDefinition = "Organization that assumes care", formalDefinition = "The organization that has assumed the specific responsibilities for the specified duration.") 950 protected Reference managingOrganization; 951 952 /** 953 * The actual object that is the target of the reference (The organization that 954 * has assumed the specific responsibilities for the specified duration.) 955 */ 956 protected Organization managingOrganizationTarget; 957 958 /** 959 * The interval during which the managing organization assumes the defined 960 * responsibility. 961 */ 962 @Child(name = "period", type = { Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = true) 963 @Description(shortDefinition = "Interval during responsibility is assumed", formalDefinition = "The interval during which the managing organization assumes the defined responsibility.") 964 protected Period period; 965 966 /** 967 * Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming 968 * referrals. 969 */ 970 @Child(name = "referralRequest", type = { 971 ServiceRequest.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 972 @Description(shortDefinition = "Originating Referral Request(s)", formalDefinition = "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.") 973 protected List<Reference> referralRequest; 974 /** 975 * The actual objects that are the target of the reference (Referral Request(s) 976 * that are fulfilled by this EpisodeOfCare, incoming referrals.) 977 */ 978 protected List<ServiceRequest> referralRequestTarget; 979 980 /** 981 * The practitioner that is the care manager/care coordinator for this patient. 982 */ 983 @Child(name = "careManager", type = { Practitioner.class, 984 PractitionerRole.class }, order = 9, min = 0, max = 1, modifier = false, summary = false) 985 @Description(shortDefinition = "Care manager/care coordinator for the patient", formalDefinition = "The practitioner that is the care manager/care coordinator for this patient.") 986 protected Reference careManager; 987 988 /** 989 * The actual object that is the target of the reference (The practitioner that 990 * is the care manager/care coordinator for this patient.) 991 */ 992 protected Resource careManagerTarget; 993 994 /** 995 * The list of practitioners that may be facilitating this episode of care for 996 * specific purposes. 997 */ 998 @Child(name = "team", type = { 999 CareTeam.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1000 @Description(shortDefinition = "Other practitioners facilitating this episode of care", formalDefinition = "The list of practitioners that may be facilitating this episode of care for specific purposes.") 1001 protected List<Reference> team; 1002 /** 1003 * The actual objects that are the target of the reference (The list of 1004 * practitioners that may be facilitating this episode of care for specific 1005 * purposes.) 1006 */ 1007 protected List<CareTeam> teamTarget; 1008 1009 /** 1010 * The set of accounts that may be used for billing for this EpisodeOfCare. 1011 */ 1012 @Child(name = "account", type = { 1013 Account.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1014 @Description(shortDefinition = "The set of accounts that may be used for billing for this EpisodeOfCare", formalDefinition = "The set of accounts that may be used for billing for this EpisodeOfCare.") 1015 protected List<Reference> account; 1016 /** 1017 * The actual objects that are the target of the reference (The set of accounts 1018 * that may be used for billing for this EpisodeOfCare.) 1019 */ 1020 protected List<Account> accountTarget; 1021 1022 private static final long serialVersionUID = 548033949L; 1023 1024 /** 1025 * Constructor 1026 */ 1027 public EpisodeOfCare() { 1028 super(); 1029 } 1030 1031 /** 1032 * Constructor 1033 */ 1034 public EpisodeOfCare(Enumeration<EpisodeOfCareStatus> status, Reference patient) { 1035 super(); 1036 this.status = status; 1037 this.patient = patient; 1038 } 1039 1040 /** 1041 * @return {@link #identifier} (The EpisodeOfCare may be known by different 1042 * identifiers for different contexts of use, such as when an external 1043 * agency is tracking the Episode for funding purposes.) 1044 */ 1045 public List<Identifier> getIdentifier() { 1046 if (this.identifier == null) 1047 this.identifier = new ArrayList<Identifier>(); 1048 return this.identifier; 1049 } 1050 1051 /** 1052 * @return Returns a reference to <code>this</code> for easy method chaining 1053 */ 1054 public EpisodeOfCare setIdentifier(List<Identifier> theIdentifier) { 1055 this.identifier = theIdentifier; 1056 return this; 1057 } 1058 1059 public boolean hasIdentifier() { 1060 if (this.identifier == null) 1061 return false; 1062 for (Identifier item : this.identifier) 1063 if (!item.isEmpty()) 1064 return true; 1065 return false; 1066 } 1067 1068 public Identifier addIdentifier() { // 3 1069 Identifier t = new Identifier(); 1070 if (this.identifier == null) 1071 this.identifier = new ArrayList<Identifier>(); 1072 this.identifier.add(t); 1073 return t; 1074 } 1075 1076 public EpisodeOfCare addIdentifier(Identifier t) { // 3 1077 if (t == null) 1078 return this; 1079 if (this.identifier == null) 1080 this.identifier = new ArrayList<Identifier>(); 1081 this.identifier.add(t); 1082 return this; 1083 } 1084 1085 /** 1086 * @return The first repetition of repeating field {@link #identifier}, creating 1087 * it if it does not already exist 1088 */ 1089 public Identifier getIdentifierFirstRep() { 1090 if (getIdentifier().isEmpty()) { 1091 addIdentifier(); 1092 } 1093 return getIdentifier().get(0); 1094 } 1095 1096 /** 1097 * @return {@link #status} (planned | waitlist | active | onhold | finished | 1098 * cancelled.). This is the underlying object with id, value and 1099 * extensions. The accessor "getStatus" gives direct access to the value 1100 */ 1101 public Enumeration<EpisodeOfCareStatus> getStatusElement() { 1102 if (this.status == null) 1103 if (Configuration.errorOnAutoCreate()) 1104 throw new Error("Attempt to auto-create EpisodeOfCare.status"); 1105 else if (Configuration.doAutoCreate()) 1106 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb 1107 return this.status; 1108 } 1109 1110 public boolean hasStatusElement() { 1111 return this.status != null && !this.status.isEmpty(); 1112 } 1113 1114 public boolean hasStatus() { 1115 return this.status != null && !this.status.isEmpty(); 1116 } 1117 1118 /** 1119 * @param value {@link #status} (planned | waitlist | active | onhold | finished 1120 * | cancelled.). This is the underlying object with id, value and 1121 * extensions. The accessor "getStatus" gives direct access to the 1122 * value 1123 */ 1124 public EpisodeOfCare setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 1125 this.status = value; 1126 return this; 1127 } 1128 1129 /** 1130 * @return planned | waitlist | active | onhold | finished | cancelled. 1131 */ 1132 public EpisodeOfCareStatus getStatus() { 1133 return this.status == null ? null : this.status.getValue(); 1134 } 1135 1136 /** 1137 * @param value planned | waitlist | active | onhold | finished | cancelled. 1138 */ 1139 public EpisodeOfCare setStatus(EpisodeOfCareStatus value) { 1140 if (this.status == null) 1141 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); 1142 this.status.setValue(value); 1143 return this; 1144 } 1145 1146 /** 1147 * @return {@link #statusHistory} (The history of statuses that the 1148 * EpisodeOfCare has been through (without requiring processing the 1149 * history of the resource).) 1150 */ 1151 public List<EpisodeOfCareStatusHistoryComponent> getStatusHistory() { 1152 if (this.statusHistory == null) 1153 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 1154 return this.statusHistory; 1155 } 1156 1157 /** 1158 * @return Returns a reference to <code>this</code> for easy method chaining 1159 */ 1160 public EpisodeOfCare setStatusHistory(List<EpisodeOfCareStatusHistoryComponent> theStatusHistory) { 1161 this.statusHistory = theStatusHistory; 1162 return this; 1163 } 1164 1165 public boolean hasStatusHistory() { 1166 if (this.statusHistory == null) 1167 return false; 1168 for (EpisodeOfCareStatusHistoryComponent item : this.statusHistory) 1169 if (!item.isEmpty()) 1170 return true; 1171 return false; 1172 } 1173 1174 public EpisodeOfCareStatusHistoryComponent addStatusHistory() { // 3 1175 EpisodeOfCareStatusHistoryComponent t = new EpisodeOfCareStatusHistoryComponent(); 1176 if (this.statusHistory == null) 1177 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 1178 this.statusHistory.add(t); 1179 return t; 1180 } 1181 1182 public EpisodeOfCare addStatusHistory(EpisodeOfCareStatusHistoryComponent t) { // 3 1183 if (t == null) 1184 return this; 1185 if (this.statusHistory == null) 1186 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 1187 this.statusHistory.add(t); 1188 return this; 1189 } 1190 1191 /** 1192 * @return The first repetition of repeating field {@link #statusHistory}, 1193 * creating it if it does not already exist 1194 */ 1195 public EpisodeOfCareStatusHistoryComponent getStatusHistoryFirstRep() { 1196 if (getStatusHistory().isEmpty()) { 1197 addStatusHistory(); 1198 } 1199 return getStatusHistory().get(0); 1200 } 1201 1202 /** 1203 * @return {@link #type} (A classification of the type of episode of care; e.g. 1204 * specialist referral, disease management, type of funded care.) 1205 */ 1206 public List<CodeableConcept> getType() { 1207 if (this.type == null) 1208 this.type = new ArrayList<CodeableConcept>(); 1209 return this.type; 1210 } 1211 1212 /** 1213 * @return Returns a reference to <code>this</code> for easy method chaining 1214 */ 1215 public EpisodeOfCare setType(List<CodeableConcept> theType) { 1216 this.type = theType; 1217 return this; 1218 } 1219 1220 public boolean hasType() { 1221 if (this.type == null) 1222 return false; 1223 for (CodeableConcept item : this.type) 1224 if (!item.isEmpty()) 1225 return true; 1226 return false; 1227 } 1228 1229 public CodeableConcept addType() { // 3 1230 CodeableConcept t = new CodeableConcept(); 1231 if (this.type == null) 1232 this.type = new ArrayList<CodeableConcept>(); 1233 this.type.add(t); 1234 return t; 1235 } 1236 1237 public EpisodeOfCare addType(CodeableConcept t) { // 3 1238 if (t == null) 1239 return this; 1240 if (this.type == null) 1241 this.type = new ArrayList<CodeableConcept>(); 1242 this.type.add(t); 1243 return this; 1244 } 1245 1246 /** 1247 * @return The first repetition of repeating field {@link #type}, creating it if 1248 * it does not already exist 1249 */ 1250 public CodeableConcept getTypeFirstRep() { 1251 if (getType().isEmpty()) { 1252 addType(); 1253 } 1254 return getType().get(0); 1255 } 1256 1257 /** 1258 * @return {@link #diagnosis} (The list of diagnosis relevant to this episode of 1259 * care.) 1260 */ 1261 public List<DiagnosisComponent> getDiagnosis() { 1262 if (this.diagnosis == null) 1263 this.diagnosis = new ArrayList<DiagnosisComponent>(); 1264 return this.diagnosis; 1265 } 1266 1267 /** 1268 * @return Returns a reference to <code>this</code> for easy method chaining 1269 */ 1270 public EpisodeOfCare setDiagnosis(List<DiagnosisComponent> theDiagnosis) { 1271 this.diagnosis = theDiagnosis; 1272 return this; 1273 } 1274 1275 public boolean hasDiagnosis() { 1276 if (this.diagnosis == null) 1277 return false; 1278 for (DiagnosisComponent item : this.diagnosis) 1279 if (!item.isEmpty()) 1280 return true; 1281 return false; 1282 } 1283 1284 public DiagnosisComponent addDiagnosis() { // 3 1285 DiagnosisComponent t = new DiagnosisComponent(); 1286 if (this.diagnosis == null) 1287 this.diagnosis = new ArrayList<DiagnosisComponent>(); 1288 this.diagnosis.add(t); 1289 return t; 1290 } 1291 1292 public EpisodeOfCare addDiagnosis(DiagnosisComponent t) { // 3 1293 if (t == null) 1294 return this; 1295 if (this.diagnosis == null) 1296 this.diagnosis = new ArrayList<DiagnosisComponent>(); 1297 this.diagnosis.add(t); 1298 return this; 1299 } 1300 1301 /** 1302 * @return The first repetition of repeating field {@link #diagnosis}, creating 1303 * it if it does not already exist 1304 */ 1305 public DiagnosisComponent getDiagnosisFirstRep() { 1306 if (getDiagnosis().isEmpty()) { 1307 addDiagnosis(); 1308 } 1309 return getDiagnosis().get(0); 1310 } 1311 1312 /** 1313 * @return {@link #patient} (The patient who is the focus of this episode of 1314 * care.) 1315 */ 1316 public Reference getPatient() { 1317 if (this.patient == null) 1318 if (Configuration.errorOnAutoCreate()) 1319 throw new Error("Attempt to auto-create EpisodeOfCare.patient"); 1320 else if (Configuration.doAutoCreate()) 1321 this.patient = new Reference(); // cc 1322 return this.patient; 1323 } 1324 1325 public boolean hasPatient() { 1326 return this.patient != null && !this.patient.isEmpty(); 1327 } 1328 1329 /** 1330 * @param value {@link #patient} (The patient who is the focus of this episode 1331 * of care.) 1332 */ 1333 public EpisodeOfCare setPatient(Reference value) { 1334 this.patient = value; 1335 return this; 1336 } 1337 1338 /** 1339 * @return {@link #patient} The actual object that is the target of the 1340 * reference. The reference library doesn't populate this, but you can 1341 * use it to hold the resource if you resolve it. (The patient who is 1342 * the focus of this episode of care.) 1343 */ 1344 public Patient getPatientTarget() { 1345 if (this.patientTarget == null) 1346 if (Configuration.errorOnAutoCreate()) 1347 throw new Error("Attempt to auto-create EpisodeOfCare.patient"); 1348 else if (Configuration.doAutoCreate()) 1349 this.patientTarget = new Patient(); // aa 1350 return this.patientTarget; 1351 } 1352 1353 /** 1354 * @param value {@link #patient} The actual object that is the target of the 1355 * reference. The reference library doesn't use these, but you can 1356 * use it to hold the resource if you resolve it. (The patient who 1357 * is the focus of this episode of care.) 1358 */ 1359 public EpisodeOfCare setPatientTarget(Patient value) { 1360 this.patientTarget = value; 1361 return this; 1362 } 1363 1364 /** 1365 * @return {@link #managingOrganization} (The organization that has assumed the 1366 * specific responsibilities for the specified duration.) 1367 */ 1368 public Reference getManagingOrganization() { 1369 if (this.managingOrganization == null) 1370 if (Configuration.errorOnAutoCreate()) 1371 throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization"); 1372 else if (Configuration.doAutoCreate()) 1373 this.managingOrganization = new Reference(); // cc 1374 return this.managingOrganization; 1375 } 1376 1377 public boolean hasManagingOrganization() { 1378 return this.managingOrganization != null && !this.managingOrganization.isEmpty(); 1379 } 1380 1381 /** 1382 * @param value {@link #managingOrganization} (The organization that has assumed 1383 * the specific responsibilities for the specified duration.) 1384 */ 1385 public EpisodeOfCare setManagingOrganization(Reference value) { 1386 this.managingOrganization = value; 1387 return this; 1388 } 1389 1390 /** 1391 * @return {@link #managingOrganization} The actual object that is the target of 1392 * the reference. The reference library doesn't populate this, but you 1393 * can use it to hold the resource if you resolve it. (The organization 1394 * that has assumed the specific responsibilities for the specified 1395 * duration.) 1396 */ 1397 public Organization getManagingOrganizationTarget() { 1398 if (this.managingOrganizationTarget == null) 1399 if (Configuration.errorOnAutoCreate()) 1400 throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization"); 1401 else if (Configuration.doAutoCreate()) 1402 this.managingOrganizationTarget = new Organization(); // aa 1403 return this.managingOrganizationTarget; 1404 } 1405 1406 /** 1407 * @param value {@link #managingOrganization} The actual object that is the 1408 * target of the reference. The reference library doesn't use 1409 * these, but you can use it to hold the resource if you resolve 1410 * it. (The organization that has assumed the specific 1411 * responsibilities for the specified duration.) 1412 */ 1413 public EpisodeOfCare setManagingOrganizationTarget(Organization value) { 1414 this.managingOrganizationTarget = value; 1415 return this; 1416 } 1417 1418 /** 1419 * @return {@link #period} (The interval during which the managing organization 1420 * assumes the defined responsibility.) 1421 */ 1422 public Period getPeriod() { 1423 if (this.period == null) 1424 if (Configuration.errorOnAutoCreate()) 1425 throw new Error("Attempt to auto-create EpisodeOfCare.period"); 1426 else if (Configuration.doAutoCreate()) 1427 this.period = new Period(); // cc 1428 return this.period; 1429 } 1430 1431 public boolean hasPeriod() { 1432 return this.period != null && !this.period.isEmpty(); 1433 } 1434 1435 /** 1436 * @param value {@link #period} (The interval during which the managing 1437 * organization assumes the defined responsibility.) 1438 */ 1439 public EpisodeOfCare setPeriod(Period value) { 1440 this.period = value; 1441 return this; 1442 } 1443 1444 /** 1445 * @return {@link #referralRequest} (Referral Request(s) that are fulfilled by 1446 * this EpisodeOfCare, incoming referrals.) 1447 */ 1448 public List<Reference> getReferralRequest() { 1449 if (this.referralRequest == null) 1450 this.referralRequest = new ArrayList<Reference>(); 1451 return this.referralRequest; 1452 } 1453 1454 /** 1455 * @return Returns a reference to <code>this</code> for easy method chaining 1456 */ 1457 public EpisodeOfCare setReferralRequest(List<Reference> theReferralRequest) { 1458 this.referralRequest = theReferralRequest; 1459 return this; 1460 } 1461 1462 public boolean hasReferralRequest() { 1463 if (this.referralRequest == null) 1464 return false; 1465 for (Reference item : this.referralRequest) 1466 if (!item.isEmpty()) 1467 return true; 1468 return false; 1469 } 1470 1471 public Reference addReferralRequest() { // 3 1472 Reference t = new Reference(); 1473 if (this.referralRequest == null) 1474 this.referralRequest = new ArrayList<Reference>(); 1475 this.referralRequest.add(t); 1476 return t; 1477 } 1478 1479 public EpisodeOfCare addReferralRequest(Reference t) { // 3 1480 if (t == null) 1481 return this; 1482 if (this.referralRequest == null) 1483 this.referralRequest = new ArrayList<Reference>(); 1484 this.referralRequest.add(t); 1485 return this; 1486 } 1487 1488 /** 1489 * @return The first repetition of repeating field {@link #referralRequest}, 1490 * creating it if it does not already exist 1491 */ 1492 public Reference getReferralRequestFirstRep() { 1493 if (getReferralRequest().isEmpty()) { 1494 addReferralRequest(); 1495 } 1496 return getReferralRequest().get(0); 1497 } 1498 1499 /** 1500 * @deprecated Use Reference#setResource(IBaseResource) instead 1501 */ 1502 @Deprecated 1503 public List<ServiceRequest> getReferralRequestTarget() { 1504 if (this.referralRequestTarget == null) 1505 this.referralRequestTarget = new ArrayList<ServiceRequest>(); 1506 return this.referralRequestTarget; 1507 } 1508 1509 /** 1510 * @deprecated Use Reference#setResource(IBaseResource) instead 1511 */ 1512 @Deprecated 1513 public ServiceRequest addReferralRequestTarget() { 1514 ServiceRequest r = new ServiceRequest(); 1515 if (this.referralRequestTarget == null) 1516 this.referralRequestTarget = new ArrayList<ServiceRequest>(); 1517 this.referralRequestTarget.add(r); 1518 return r; 1519 } 1520 1521 /** 1522 * @return {@link #careManager} (The practitioner that is the care manager/care 1523 * coordinator for this patient.) 1524 */ 1525 public Reference getCareManager() { 1526 if (this.careManager == null) 1527 if (Configuration.errorOnAutoCreate()) 1528 throw new Error("Attempt to auto-create EpisodeOfCare.careManager"); 1529 else if (Configuration.doAutoCreate()) 1530 this.careManager = new Reference(); // cc 1531 return this.careManager; 1532 } 1533 1534 public boolean hasCareManager() { 1535 return this.careManager != null && !this.careManager.isEmpty(); 1536 } 1537 1538 /** 1539 * @param value {@link #careManager} (The practitioner that is the care 1540 * manager/care coordinator for this patient.) 1541 */ 1542 public EpisodeOfCare setCareManager(Reference value) { 1543 this.careManager = value; 1544 return this; 1545 } 1546 1547 /** 1548 * @return {@link #careManager} The actual object that is the target of the 1549 * reference. The reference library doesn't populate this, but you can 1550 * use it to hold the resource if you resolve it. (The practitioner that 1551 * is the care manager/care coordinator for this patient.) 1552 */ 1553 public Resource getCareManagerTarget() { 1554 return this.careManagerTarget; 1555 } 1556 1557 /** 1558 * @param value {@link #careManager} The actual object that is the target of the 1559 * reference. The reference library doesn't use these, but you can 1560 * use it to hold the resource if you resolve it. (The practitioner 1561 * that is the care manager/care coordinator for this patient.) 1562 */ 1563 public EpisodeOfCare setCareManagerTarget(Resource value) { 1564 this.careManagerTarget = value; 1565 return this; 1566 } 1567 1568 /** 1569 * @return {@link #team} (The list of practitioners that may be facilitating 1570 * this episode of care for specific purposes.) 1571 */ 1572 public List<Reference> getTeam() { 1573 if (this.team == null) 1574 this.team = new ArrayList<Reference>(); 1575 return this.team; 1576 } 1577 1578 /** 1579 * @return Returns a reference to <code>this</code> for easy method chaining 1580 */ 1581 public EpisodeOfCare setTeam(List<Reference> theTeam) { 1582 this.team = theTeam; 1583 return this; 1584 } 1585 1586 public boolean hasTeam() { 1587 if (this.team == null) 1588 return false; 1589 for (Reference item : this.team) 1590 if (!item.isEmpty()) 1591 return true; 1592 return false; 1593 } 1594 1595 public Reference addTeam() { // 3 1596 Reference t = new Reference(); 1597 if (this.team == null) 1598 this.team = new ArrayList<Reference>(); 1599 this.team.add(t); 1600 return t; 1601 } 1602 1603 public EpisodeOfCare addTeam(Reference t) { // 3 1604 if (t == null) 1605 return this; 1606 if (this.team == null) 1607 this.team = new ArrayList<Reference>(); 1608 this.team.add(t); 1609 return this; 1610 } 1611 1612 /** 1613 * @return The first repetition of repeating field {@link #team}, creating it if 1614 * it does not already exist 1615 */ 1616 public Reference getTeamFirstRep() { 1617 if (getTeam().isEmpty()) { 1618 addTeam(); 1619 } 1620 return getTeam().get(0); 1621 } 1622 1623 /** 1624 * @deprecated Use Reference#setResource(IBaseResource) instead 1625 */ 1626 @Deprecated 1627 public List<CareTeam> getTeamTarget() { 1628 if (this.teamTarget == null) 1629 this.teamTarget = new ArrayList<CareTeam>(); 1630 return this.teamTarget; 1631 } 1632 1633 /** 1634 * @deprecated Use Reference#setResource(IBaseResource) instead 1635 */ 1636 @Deprecated 1637 public CareTeam addTeamTarget() { 1638 CareTeam r = new CareTeam(); 1639 if (this.teamTarget == null) 1640 this.teamTarget = new ArrayList<CareTeam>(); 1641 this.teamTarget.add(r); 1642 return r; 1643 } 1644 1645 /** 1646 * @return {@link #account} (The set of accounts that may be used for billing 1647 * for this EpisodeOfCare.) 1648 */ 1649 public List<Reference> getAccount() { 1650 if (this.account == null) 1651 this.account = new ArrayList<Reference>(); 1652 return this.account; 1653 } 1654 1655 /** 1656 * @return Returns a reference to <code>this</code> for easy method chaining 1657 */ 1658 public EpisodeOfCare setAccount(List<Reference> theAccount) { 1659 this.account = theAccount; 1660 return this; 1661 } 1662 1663 public boolean hasAccount() { 1664 if (this.account == null) 1665 return false; 1666 for (Reference item : this.account) 1667 if (!item.isEmpty()) 1668 return true; 1669 return false; 1670 } 1671 1672 public Reference addAccount() { // 3 1673 Reference t = new Reference(); 1674 if (this.account == null) 1675 this.account = new ArrayList<Reference>(); 1676 this.account.add(t); 1677 return t; 1678 } 1679 1680 public EpisodeOfCare addAccount(Reference t) { // 3 1681 if (t == null) 1682 return this; 1683 if (this.account == null) 1684 this.account = new ArrayList<Reference>(); 1685 this.account.add(t); 1686 return this; 1687 } 1688 1689 /** 1690 * @return The first repetition of repeating field {@link #account}, creating it 1691 * if it does not already exist 1692 */ 1693 public Reference getAccountFirstRep() { 1694 if (getAccount().isEmpty()) { 1695 addAccount(); 1696 } 1697 return getAccount().get(0); 1698 } 1699 1700 /** 1701 * @deprecated Use Reference#setResource(IBaseResource) instead 1702 */ 1703 @Deprecated 1704 public List<Account> getAccountTarget() { 1705 if (this.accountTarget == null) 1706 this.accountTarget = new ArrayList<Account>(); 1707 return this.accountTarget; 1708 } 1709 1710 /** 1711 * @deprecated Use Reference#setResource(IBaseResource) instead 1712 */ 1713 @Deprecated 1714 public Account addAccountTarget() { 1715 Account r = new Account(); 1716 if (this.accountTarget == null) 1717 this.accountTarget = new ArrayList<Account>(); 1718 this.accountTarget.add(r); 1719 return r; 1720 } 1721 1722 protected void listChildren(List<Property> children) { 1723 super.listChildren(children); 1724 children.add(new Property("identifier", "Identifier", 1725 "The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.", 1726 0, java.lang.Integer.MAX_VALUE, identifier)); 1727 children.add( 1728 new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, 1, status)); 1729 children.add(new Property("statusHistory", "", 1730 "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).", 1731 0, java.lang.Integer.MAX_VALUE, statusHistory)); 1732 children.add(new Property("type", "CodeableConcept", 1733 "A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.", 1734 0, java.lang.Integer.MAX_VALUE, type)); 1735 children.add(new Property("diagnosis", "", "The list of diagnosis relevant to this episode of care.", 0, 1736 java.lang.Integer.MAX_VALUE, diagnosis)); 1737 children.add(new Property("patient", "Reference(Patient)", "The patient who is the focus of this episode of care.", 1738 0, 1, patient)); 1739 children.add(new Property("managingOrganization", "Reference(Organization)", 1740 "The organization that has assumed the specific responsibilities for the specified duration.", 0, 1, 1741 managingOrganization)); 1742 children.add(new Property("period", "Period", 1743 "The interval during which the managing organization assumes the defined responsibility.", 0, 1, period)); 1744 children.add(new Property("referralRequest", "Reference(ServiceRequest)", 1745 "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.", 0, 1746 java.lang.Integer.MAX_VALUE, referralRequest)); 1747 children.add(new Property("careManager", "Reference(Practitioner|PractitionerRole)", 1748 "The practitioner that is the care manager/care coordinator for this patient.", 0, 1, careManager)); 1749 children.add(new Property("team", "Reference(CareTeam)", 1750 "The list of practitioners that may be facilitating this episode of care for specific purposes.", 0, 1751 java.lang.Integer.MAX_VALUE, team)); 1752 children.add(new Property("account", "Reference(Account)", 1753 "The set of accounts that may be used for billing for this EpisodeOfCare.", 0, java.lang.Integer.MAX_VALUE, 1754 account)); 1755 } 1756 1757 @Override 1758 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1759 switch (_hash) { 1760 case -1618432855: 1761 /* identifier */ return new Property("identifier", "Identifier", 1762 "The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.", 1763 0, java.lang.Integer.MAX_VALUE, identifier); 1764 case -892481550: 1765 /* status */ return new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 1766 0, 1, status); 1767 case -986695614: 1768 /* statusHistory */ return new Property("statusHistory", "", 1769 "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).", 1770 0, java.lang.Integer.MAX_VALUE, statusHistory); 1771 case 3575610: 1772 /* type */ return new Property("type", "CodeableConcept", 1773 "A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.", 1774 0, java.lang.Integer.MAX_VALUE, type); 1775 case 1196993265: 1776 /* diagnosis */ return new Property("diagnosis", "", "The list of diagnosis relevant to this episode of care.", 0, 1777 java.lang.Integer.MAX_VALUE, diagnosis); 1778 case -791418107: 1779 /* patient */ return new Property("patient", "Reference(Patient)", 1780 "The patient who is the focus of this episode of care.", 0, 1, patient); 1781 case -2058947787: 1782 /* managingOrganization */ return new Property("managingOrganization", "Reference(Organization)", 1783 "The organization that has assumed the specific responsibilities for the specified duration.", 0, 1, 1784 managingOrganization); 1785 case -991726143: 1786 /* period */ return new Property("period", "Period", 1787 "The interval during which the managing organization assumes the defined responsibility.", 0, 1, period); 1788 case -310299598: 1789 /* referralRequest */ return new Property("referralRequest", "Reference(ServiceRequest)", 1790 "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.", 0, 1791 java.lang.Integer.MAX_VALUE, referralRequest); 1792 case -1147746468: 1793 /* careManager */ return new Property("careManager", "Reference(Practitioner|PractitionerRole)", 1794 "The practitioner that is the care manager/care coordinator for this patient.", 0, 1, careManager); 1795 case 3555933: 1796 /* team */ return new Property("team", "Reference(CareTeam)", 1797 "The list of practitioners that may be facilitating this episode of care for specific purposes.", 0, 1798 java.lang.Integer.MAX_VALUE, team); 1799 case -1177318867: 1800 /* account */ return new Property("account", "Reference(Account)", 1801 "The set of accounts that may be used for billing for this EpisodeOfCare.", 0, java.lang.Integer.MAX_VALUE, 1802 account); 1803 default: 1804 return super.getNamedProperty(_hash, _name, _checkValid); 1805 } 1806 1807 } 1808 1809 @Override 1810 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1811 switch (hash) { 1812 case -1618432855: 1813 /* identifier */ return this.identifier == null ? new Base[0] 1814 : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1815 case -892481550: 1816 /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<EpisodeOfCareStatus> 1817 case -986695614: 1818 /* statusHistory */ return this.statusHistory == null ? new Base[0] 1819 : this.statusHistory.toArray(new Base[this.statusHistory.size()]); // EpisodeOfCareStatusHistoryComponent 1820 case 3575610: 1821 /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept 1822 case 1196993265: 1823 /* diagnosis */ return this.diagnosis == null ? new Base[0] 1824 : this.diagnosis.toArray(new Base[this.diagnosis.size()]); // DiagnosisComponent 1825 case -791418107: 1826 /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference 1827 case -2058947787: 1828 /* managingOrganization */ return this.managingOrganization == null ? new Base[0] 1829 : new Base[] { this.managingOrganization }; // Reference 1830 case -991726143: 1831 /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period 1832 case -310299598: 1833 /* referralRequest */ return this.referralRequest == null ? new Base[0] 1834 : this.referralRequest.toArray(new Base[this.referralRequest.size()]); // Reference 1835 case -1147746468: 1836 /* careManager */ return this.careManager == null ? new Base[0] : new Base[] { this.careManager }; // Reference 1837 case 3555933: 1838 /* team */ return this.team == null ? new Base[0] : this.team.toArray(new Base[this.team.size()]); // Reference 1839 case -1177318867: 1840 /* account */ return this.account == null ? new Base[0] : this.account.toArray(new Base[this.account.size()]); // Reference 1841 default: 1842 return super.getProperty(hash, name, checkValid); 1843 } 1844 1845 } 1846 1847 @Override 1848 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1849 switch (hash) { 1850 case -1618432855: // identifier 1851 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1852 return value; 1853 case -892481550: // status 1854 value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value)); 1855 this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus> 1856 return value; 1857 case -986695614: // statusHistory 1858 this.getStatusHistory().add((EpisodeOfCareStatusHistoryComponent) value); // EpisodeOfCareStatusHistoryComponent 1859 return value; 1860 case 3575610: // type 1861 this.getType().add(castToCodeableConcept(value)); // CodeableConcept 1862 return value; 1863 case 1196993265: // diagnosis 1864 this.getDiagnosis().add((DiagnosisComponent) value); // DiagnosisComponent 1865 return value; 1866 case -791418107: // patient 1867 this.patient = castToReference(value); // Reference 1868 return value; 1869 case -2058947787: // managingOrganization 1870 this.managingOrganization = castToReference(value); // Reference 1871 return value; 1872 case -991726143: // period 1873 this.period = castToPeriod(value); // Period 1874 return value; 1875 case -310299598: // referralRequest 1876 this.getReferralRequest().add(castToReference(value)); // Reference 1877 return value; 1878 case -1147746468: // careManager 1879 this.careManager = castToReference(value); // Reference 1880 return value; 1881 case 3555933: // team 1882 this.getTeam().add(castToReference(value)); // Reference 1883 return value; 1884 case -1177318867: // account 1885 this.getAccount().add(castToReference(value)); // Reference 1886 return value; 1887 default: 1888 return super.setProperty(hash, name, value); 1889 } 1890 1891 } 1892 1893 @Override 1894 public Base setProperty(String name, Base value) throws FHIRException { 1895 if (name.equals("identifier")) { 1896 this.getIdentifier().add(castToIdentifier(value)); 1897 } else if (name.equals("status")) { 1898 value = new EpisodeOfCareStatusEnumFactory().fromType(castToCode(value)); 1899 this.status = (Enumeration) value; // Enumeration<EpisodeOfCareStatus> 1900 } else if (name.equals("statusHistory")) { 1901 this.getStatusHistory().add((EpisodeOfCareStatusHistoryComponent) value); 1902 } else if (name.equals("type")) { 1903 this.getType().add(castToCodeableConcept(value)); 1904 } else if (name.equals("diagnosis")) { 1905 this.getDiagnosis().add((DiagnosisComponent) value); 1906 } else if (name.equals("patient")) { 1907 this.patient = castToReference(value); // Reference 1908 } else if (name.equals("managingOrganization")) { 1909 this.managingOrganization = castToReference(value); // Reference 1910 } else if (name.equals("period")) { 1911 this.period = castToPeriod(value); // Period 1912 } else if (name.equals("referralRequest")) { 1913 this.getReferralRequest().add(castToReference(value)); 1914 } else if (name.equals("careManager")) { 1915 this.careManager = castToReference(value); // Reference 1916 } else if (name.equals("team")) { 1917 this.getTeam().add(castToReference(value)); 1918 } else if (name.equals("account")) { 1919 this.getAccount().add(castToReference(value)); 1920 } else 1921 return super.setProperty(name, value); 1922 return value; 1923 } 1924 1925 @Override 1926 public Base makeProperty(int hash, String name) throws FHIRException { 1927 switch (hash) { 1928 case -1618432855: 1929 return addIdentifier(); 1930 case -892481550: 1931 return getStatusElement(); 1932 case -986695614: 1933 return addStatusHistory(); 1934 case 3575610: 1935 return addType(); 1936 case 1196993265: 1937 return addDiagnosis(); 1938 case -791418107: 1939 return getPatient(); 1940 case -2058947787: 1941 return getManagingOrganization(); 1942 case -991726143: 1943 return getPeriod(); 1944 case -310299598: 1945 return addReferralRequest(); 1946 case -1147746468: 1947 return getCareManager(); 1948 case 3555933: 1949 return addTeam(); 1950 case -1177318867: 1951 return addAccount(); 1952 default: 1953 return super.makeProperty(hash, name); 1954 } 1955 1956 } 1957 1958 @Override 1959 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1960 switch (hash) { 1961 case -1618432855: 1962 /* identifier */ return new String[] { "Identifier" }; 1963 case -892481550: 1964 /* status */ return new String[] { "code" }; 1965 case -986695614: 1966 /* statusHistory */ return new String[] {}; 1967 case 3575610: 1968 /* type */ return new String[] { "CodeableConcept" }; 1969 case 1196993265: 1970 /* diagnosis */ return new String[] {}; 1971 case -791418107: 1972 /* patient */ return new String[] { "Reference" }; 1973 case -2058947787: 1974 /* managingOrganization */ return new String[] { "Reference" }; 1975 case -991726143: 1976 /* period */ return new String[] { "Period" }; 1977 case -310299598: 1978 /* referralRequest */ return new String[] { "Reference" }; 1979 case -1147746468: 1980 /* careManager */ return new String[] { "Reference" }; 1981 case 3555933: 1982 /* team */ return new String[] { "Reference" }; 1983 case -1177318867: 1984 /* account */ return new String[] { "Reference" }; 1985 default: 1986 return super.getTypesForProperty(hash, name); 1987 } 1988 1989 } 1990 1991 @Override 1992 public Base addChild(String name) throws FHIRException { 1993 if (name.equals("identifier")) { 1994 return addIdentifier(); 1995 } else if (name.equals("status")) { 1996 throw new FHIRException("Cannot call addChild on a singleton property EpisodeOfCare.status"); 1997 } else if (name.equals("statusHistory")) { 1998 return addStatusHistory(); 1999 } else if (name.equals("type")) { 2000 return addType(); 2001 } else if (name.equals("diagnosis")) { 2002 return addDiagnosis(); 2003 } else if (name.equals("patient")) { 2004 this.patient = new Reference(); 2005 return this.patient; 2006 } else if (name.equals("managingOrganization")) { 2007 this.managingOrganization = new Reference(); 2008 return this.managingOrganization; 2009 } else if (name.equals("period")) { 2010 this.period = new Period(); 2011 return this.period; 2012 } else if (name.equals("referralRequest")) { 2013 return addReferralRequest(); 2014 } else if (name.equals("careManager")) { 2015 this.careManager = new Reference(); 2016 return this.careManager; 2017 } else if (name.equals("team")) { 2018 return addTeam(); 2019 } else if (name.equals("account")) { 2020 return addAccount(); 2021 } else 2022 return super.addChild(name); 2023 } 2024 2025 public String fhirType() { 2026 return "EpisodeOfCare"; 2027 2028 } 2029 2030 public EpisodeOfCare copy() { 2031 EpisodeOfCare dst = new EpisodeOfCare(); 2032 copyValues(dst); 2033 return dst; 2034 } 2035 2036 public void copyValues(EpisodeOfCare dst) { 2037 super.copyValues(dst); 2038 if (identifier != null) { 2039 dst.identifier = new ArrayList<Identifier>(); 2040 for (Identifier i : identifier) 2041 dst.identifier.add(i.copy()); 2042 } 2043 ; 2044 dst.status = status == null ? null : status.copy(); 2045 if (statusHistory != null) { 2046 dst.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 2047 for (EpisodeOfCareStatusHistoryComponent i : statusHistory) 2048 dst.statusHistory.add(i.copy()); 2049 } 2050 ; 2051 if (type != null) { 2052 dst.type = new ArrayList<CodeableConcept>(); 2053 for (CodeableConcept i : type) 2054 dst.type.add(i.copy()); 2055 } 2056 ; 2057 if (diagnosis != null) { 2058 dst.diagnosis = new ArrayList<DiagnosisComponent>(); 2059 for (DiagnosisComponent i : diagnosis) 2060 dst.diagnosis.add(i.copy()); 2061 } 2062 ; 2063 dst.patient = patient == null ? null : patient.copy(); 2064 dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy(); 2065 dst.period = period == null ? null : period.copy(); 2066 if (referralRequest != null) { 2067 dst.referralRequest = new ArrayList<Reference>(); 2068 for (Reference i : referralRequest) 2069 dst.referralRequest.add(i.copy()); 2070 } 2071 ; 2072 dst.careManager = careManager == null ? null : careManager.copy(); 2073 if (team != null) { 2074 dst.team = new ArrayList<Reference>(); 2075 for (Reference i : team) 2076 dst.team.add(i.copy()); 2077 } 2078 ; 2079 if (account != null) { 2080 dst.account = new ArrayList<Reference>(); 2081 for (Reference i : account) 2082 dst.account.add(i.copy()); 2083 } 2084 ; 2085 } 2086 2087 protected EpisodeOfCare typedCopy() { 2088 return copy(); 2089 } 2090 2091 @Override 2092 public boolean equalsDeep(Base other_) { 2093 if (!super.equalsDeep(other_)) 2094 return false; 2095 if (!(other_ instanceof EpisodeOfCare)) 2096 return false; 2097 EpisodeOfCare o = (EpisodeOfCare) other_; 2098 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) 2099 && compareDeep(statusHistory, o.statusHistory, true) && compareDeep(type, o.type, true) 2100 && compareDeep(diagnosis, o.diagnosis, true) && compareDeep(patient, o.patient, true) 2101 && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(period, o.period, true) 2102 && compareDeep(referralRequest, o.referralRequest, true) && compareDeep(careManager, o.careManager, true) 2103 && compareDeep(team, o.team, true) && compareDeep(account, o.account, true); 2104 } 2105 2106 @Override 2107 public boolean equalsShallow(Base other_) { 2108 if (!super.equalsShallow(other_)) 2109 return false; 2110 if (!(other_ instanceof EpisodeOfCare)) 2111 return false; 2112 EpisodeOfCare o = (EpisodeOfCare) other_; 2113 return compareValues(status, o.status, true); 2114 } 2115 2116 public boolean isEmpty() { 2117 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusHistory, type, diagnosis, 2118 patient, managingOrganization, period, referralRequest, careManager, team, account); 2119 } 2120 2121 @Override 2122 public ResourceType getResourceType() { 2123 return ResourceType.EpisodeOfCare; 2124 } 2125 2126 /** 2127 * Search parameter: <b>date</b> 2128 * <p> 2129 * Description: <b>The provided date search value falls within the episode of 2130 * care's period</b><br> 2131 * Type: <b>date</b><br> 2132 * Path: <b>EpisodeOfCare.period</b><br> 2133 * </p> 2134 */ 2135 @SearchParamDefinition(name = "date", path = "EpisodeOfCare.period", description = "The provided date search value falls within the episode of care's period", type = "date") 2136 public static final String SP_DATE = "date"; 2137 /** 2138 * <b>Fluent Client</b> search parameter constant for <b>date</b> 2139 * <p> 2140 * Description: <b>The provided date search value falls within the episode of 2141 * care's period</b><br> 2142 * Type: <b>date</b><br> 2143 * Path: <b>EpisodeOfCare.period</b><br> 2144 * </p> 2145 */ 2146 public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam( 2147 SP_DATE); 2148 2149 /** 2150 * Search parameter: <b>identifier</b> 2151 * <p> 2152 * Description: <b>Business Identifier(s) relevant for this 2153 * EpisodeOfCare</b><br> 2154 * Type: <b>token</b><br> 2155 * Path: <b>EpisodeOfCare.identifier</b><br> 2156 * </p> 2157 */ 2158 @SearchParamDefinition(name = "identifier", path = "EpisodeOfCare.identifier", description = "Business Identifier(s) relevant for this EpisodeOfCare", type = "token") 2159 public static final String SP_IDENTIFIER = "identifier"; 2160 /** 2161 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2162 * <p> 2163 * Description: <b>Business Identifier(s) relevant for this 2164 * EpisodeOfCare</b><br> 2165 * Type: <b>token</b><br> 2166 * Path: <b>EpisodeOfCare.identifier</b><br> 2167 * </p> 2168 */ 2169 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2170 SP_IDENTIFIER); 2171 2172 /** 2173 * Search parameter: <b>condition</b> 2174 * <p> 2175 * Description: <b>Conditions/problems/diagnoses this episode of care is 2176 * for</b><br> 2177 * Type: <b>reference</b><br> 2178 * Path: <b>EpisodeOfCare.diagnosis.condition</b><br> 2179 * </p> 2180 */ 2181 @SearchParamDefinition(name = "condition", path = "EpisodeOfCare.diagnosis.condition", description = "Conditions/problems/diagnoses this episode of care is for", type = "reference", target = { 2182 Condition.class }) 2183 public static final String SP_CONDITION = "condition"; 2184 /** 2185 * <b>Fluent Client</b> search parameter constant for <b>condition</b> 2186 * <p> 2187 * Description: <b>Conditions/problems/diagnoses this episode of care is 2188 * for</b><br> 2189 * Type: <b>reference</b><br> 2190 * Path: <b>EpisodeOfCare.diagnosis.condition</b><br> 2191 * </p> 2192 */ 2193 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2194 SP_CONDITION); 2195 2196 /** 2197 * Constant for fluent queries to be used to add include statements. Specifies 2198 * the path value of "<b>EpisodeOfCare:condition</b>". 2199 */ 2200 public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include( 2201 "EpisodeOfCare:condition").toLocked(); 2202 2203 /** 2204 * Search parameter: <b>patient</b> 2205 * <p> 2206 * Description: <b>The patient who is the focus of this episode of care</b><br> 2207 * Type: <b>reference</b><br> 2208 * Path: <b>EpisodeOfCare.patient</b><br> 2209 * </p> 2210 */ 2211 @SearchParamDefinition(name = "patient", path = "EpisodeOfCare.patient", description = "The patient who is the focus of this episode of care", type = "reference", providesMembershipIn = { 2212 @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class }) 2213 public static final String SP_PATIENT = "patient"; 2214 /** 2215 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 2216 * <p> 2217 * Description: <b>The patient who is the focus of this episode of care</b><br> 2218 * Type: <b>reference</b><br> 2219 * Path: <b>EpisodeOfCare.patient</b><br> 2220 * </p> 2221 */ 2222 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2223 SP_PATIENT); 2224 2225 /** 2226 * Constant for fluent queries to be used to add include statements. Specifies 2227 * the path value of "<b>EpisodeOfCare:patient</b>". 2228 */ 2229 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include( 2230 "EpisodeOfCare:patient").toLocked(); 2231 2232 /** 2233 * Search parameter: <b>organization</b> 2234 * <p> 2235 * Description: <b>The organization that has assumed the specific 2236 * responsibilities of this EpisodeOfCare</b><br> 2237 * Type: <b>reference</b><br> 2238 * Path: <b>EpisodeOfCare.managingOrganization</b><br> 2239 * </p> 2240 */ 2241 @SearchParamDefinition(name = "organization", path = "EpisodeOfCare.managingOrganization", description = "The organization that has assumed the specific responsibilities of this EpisodeOfCare", type = "reference", target = { 2242 Organization.class }) 2243 public static final String SP_ORGANIZATION = "organization"; 2244 /** 2245 * <b>Fluent Client</b> search parameter constant for <b>organization</b> 2246 * <p> 2247 * Description: <b>The organization that has assumed the specific 2248 * responsibilities of this EpisodeOfCare</b><br> 2249 * Type: <b>reference</b><br> 2250 * Path: <b>EpisodeOfCare.managingOrganization</b><br> 2251 * </p> 2252 */ 2253 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2254 SP_ORGANIZATION); 2255 2256 /** 2257 * Constant for fluent queries to be used to add include statements. Specifies 2258 * the path value of "<b>EpisodeOfCare:organization</b>". 2259 */ 2260 public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include( 2261 "EpisodeOfCare:organization").toLocked(); 2262 2263 /** 2264 * Search parameter: <b>type</b> 2265 * <p> 2266 * Description: <b>Type/class - e.g. specialist referral, disease 2267 * management</b><br> 2268 * Type: <b>token</b><br> 2269 * Path: <b>EpisodeOfCare.type</b><br> 2270 * </p> 2271 */ 2272 @SearchParamDefinition(name = "type", path = "EpisodeOfCare.type", description = "Type/class - e.g. specialist referral, disease management", type = "token") 2273 public static final String SP_TYPE = "type"; 2274 /** 2275 * <b>Fluent Client</b> search parameter constant for <b>type</b> 2276 * <p> 2277 * Description: <b>Type/class - e.g. specialist referral, disease 2278 * management</b><br> 2279 * Type: <b>token</b><br> 2280 * Path: <b>EpisodeOfCare.type</b><br> 2281 * </p> 2282 */ 2283 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2284 SP_TYPE); 2285 2286 /** 2287 * Search parameter: <b>care-manager</b> 2288 * <p> 2289 * Description: <b>Care manager/care coordinator for the patient</b><br> 2290 * Type: <b>reference</b><br> 2291 * Path: <b>EpisodeOfCare.careManager</b><br> 2292 * </p> 2293 */ 2294 @SearchParamDefinition(name = "care-manager", path = "EpisodeOfCare.careManager.where(resolve() is Practitioner)", description = "Care manager/care coordinator for the patient", type = "reference", providesMembershipIn = { 2295 @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class }) 2296 public static final String SP_CARE_MANAGER = "care-manager"; 2297 /** 2298 * <b>Fluent Client</b> search parameter constant for <b>care-manager</b> 2299 * <p> 2300 * Description: <b>Care manager/care coordinator for the patient</b><br> 2301 * Type: <b>reference</b><br> 2302 * Path: <b>EpisodeOfCare.careManager</b><br> 2303 * </p> 2304 */ 2305 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_MANAGER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2306 SP_CARE_MANAGER); 2307 2308 /** 2309 * Constant for fluent queries to be used to add include statements. Specifies 2310 * the path value of "<b>EpisodeOfCare:care-manager</b>". 2311 */ 2312 public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_MANAGER = new ca.uhn.fhir.model.api.Include( 2313 "EpisodeOfCare:care-manager").toLocked(); 2314 2315 /** 2316 * Search parameter: <b>status</b> 2317 * <p> 2318 * Description: <b>The current status of the Episode of Care as provided (does 2319 * not check the status history collection)</b><br> 2320 * Type: <b>token</b><br> 2321 * Path: <b>EpisodeOfCare.status</b><br> 2322 * </p> 2323 */ 2324 @SearchParamDefinition(name = "status", path = "EpisodeOfCare.status", description = "The current status of the Episode of Care as provided (does not check the status history collection)", type = "token") 2325 public static final String SP_STATUS = "status"; 2326 /** 2327 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2328 * <p> 2329 * Description: <b>The current status of the Episode of Care as provided (does 2330 * not check the status history collection)</b><br> 2331 * Type: <b>token</b><br> 2332 * Path: <b>EpisodeOfCare.status</b><br> 2333 * </p> 2334 */ 2335 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam( 2336 SP_STATUS); 2337 2338 /** 2339 * Search parameter: <b>incoming-referral</b> 2340 * <p> 2341 * Description: <b>Incoming Referral Request</b><br> 2342 * Type: <b>reference</b><br> 2343 * Path: <b>EpisodeOfCare.referralRequest</b><br> 2344 * </p> 2345 */ 2346 @SearchParamDefinition(name = "incoming-referral", path = "EpisodeOfCare.referralRequest", description = "Incoming Referral Request", type = "reference", target = { 2347 ServiceRequest.class }) 2348 public static final String SP_INCOMING_REFERRAL = "incoming-referral"; 2349 /** 2350 * <b>Fluent Client</b> search parameter constant for <b>incoming-referral</b> 2351 * <p> 2352 * Description: <b>Incoming Referral Request</b><br> 2353 * Type: <b>reference</b><br> 2354 * Path: <b>EpisodeOfCare.referralRequest</b><br> 2355 * </p> 2356 */ 2357 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INCOMING_REFERRAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 2358 SP_INCOMING_REFERRAL); 2359 2360 /** 2361 * Constant for fluent queries to be used to add include statements. Specifies 2362 * the path value of "<b>EpisodeOfCare:incoming-referral</b>". 2363 */ 2364 public static final ca.uhn.fhir.model.api.Include INCLUDE_INCOMING_REFERRAL = new ca.uhn.fhir.model.api.Include( 2365 "EpisodeOfCare:incoming-referral").toLocked(); 2366 2367}