001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import ca.uhn.fhir.model.api.annotation.Block; 037import ca.uhn.fhir.model.api.annotation.Child; 038import ca.uhn.fhir.model.api.annotation.Description; 039import ca.uhn.fhir.model.api.annotation.ResourceDef; 040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 041import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 042import org.hl7.fhir.exceptions.FHIRException; 043 044/** 045 * An association between a patient and an organization / healthcare provider(s) 046 * during which time encounters may occur. The managing organization assumes a 047 * level of responsibility for the patient during this time. 048 */ 049@ResourceDef(name = "EpisodeOfCare", profile = "http://hl7.org/fhir/Profile/EpisodeOfCare") 050public class EpisodeOfCare extends DomainResource { 051 052 public enum EpisodeOfCareStatus { 053 /** 054 * This episode of care is planned to start at the date specified in the 055 * period.start. During this status an organization may perform assessments to 056 * determine if they are eligible to receive services, or be organizing to make 057 * resources available to provide care services. 058 */ 059 PLANNED, 060 /** 061 * This episode has been placed on a waitlist, pending the episode being made 062 * active (or cancelled). 063 */ 064 WAITLIST, 065 /** 066 * This episode of care is current. 067 */ 068 ACTIVE, 069 /** 070 * This episode of care is on hold, the organization has limited responsibility 071 * for the patient (such as while on respite). 072 */ 073 ONHOLD, 074 /** 075 * This episode of care is finished at the organization is not expecting to be 076 * providing care to the patient. Can also be known as "closed", "completed" or 077 * other similar terms. 078 */ 079 FINISHED, 080 /** 081 * The episode of care was cancelled, or withdrawn from service, often selected 082 * during the planned stage as the patient may have gone elsewhere, or the 083 * circumstances have changed and the organization is unable to provide the 084 * care. It indicates that services terminated outside the planned/expected 085 * workflow. 086 */ 087 CANCELLED, 088 /** 089 * added to help the parsers 090 */ 091 NULL; 092 093 public static EpisodeOfCareStatus fromCode(String codeString) throws FHIRException { 094 if (codeString == null || "".equals(codeString)) 095 return null; 096 if ("planned".equals(codeString)) 097 return PLANNED; 098 if ("waitlist".equals(codeString)) 099 return WAITLIST; 100 if ("active".equals(codeString)) 101 return ACTIVE; 102 if ("onhold".equals(codeString)) 103 return ONHOLD; 104 if ("finished".equals(codeString)) 105 return FINISHED; 106 if ("cancelled".equals(codeString)) 107 return CANCELLED; 108 throw new FHIRException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 109 } 110 111 public String toCode() { 112 switch (this) { 113 case PLANNED: 114 return "planned"; 115 case WAITLIST: 116 return "waitlist"; 117 case ACTIVE: 118 return "active"; 119 case ONHOLD: 120 return "onhold"; 121 case FINISHED: 122 return "finished"; 123 case CANCELLED: 124 return "cancelled"; 125 case NULL: 126 return null; 127 default: 128 return "?"; 129 } 130 } 131 132 public String getSystem() { 133 switch (this) { 134 case PLANNED: 135 return "http://hl7.org/fhir/episode-of-care-status"; 136 case WAITLIST: 137 return "http://hl7.org/fhir/episode-of-care-status"; 138 case ACTIVE: 139 return "http://hl7.org/fhir/episode-of-care-status"; 140 case ONHOLD: 141 return "http://hl7.org/fhir/episode-of-care-status"; 142 case FINISHED: 143 return "http://hl7.org/fhir/episode-of-care-status"; 144 case CANCELLED: 145 return "http://hl7.org/fhir/episode-of-care-status"; 146 case NULL: 147 return null; 148 default: 149 return "?"; 150 } 151 } 152 153 public String getDefinition() { 154 switch (this) { 155 case PLANNED: 156 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 they are eligible to receive services, or be organizing to make resources available to provide care services."; 157 case WAITLIST: 158 return "This episode has been placed on a waitlist, pending the episode being made active (or cancelled)."; 159 case ACTIVE: 160 return "This episode of care is current."; 161 case ONHOLD: 162 return "This episode of care is on hold, the organization has limited responsibility for the patient (such as while on respite)."; 163 case FINISHED: 164 return "This episode of care is finished at the organization is not expecting to be providing care to the patient. Can also be known as \"closed\", \"completed\" or other similar terms."; 165 case CANCELLED: 166 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."; 167 case NULL: 168 return null; 169 default: 170 return "?"; 171 } 172 } 173 174 public String getDisplay() { 175 switch (this) { 176 case PLANNED: 177 return "Planned"; 178 case WAITLIST: 179 return "Waitlist"; 180 case ACTIVE: 181 return "Active"; 182 case ONHOLD: 183 return "On Hold"; 184 case FINISHED: 185 return "Finished"; 186 case CANCELLED: 187 return "Cancelled"; 188 case NULL: 189 return null; 190 default: 191 return "?"; 192 } 193 } 194 } 195 196 public static class EpisodeOfCareStatusEnumFactory implements EnumFactory<EpisodeOfCareStatus> { 197 public EpisodeOfCareStatus fromCode(String codeString) throws IllegalArgumentException { 198 if (codeString == null || "".equals(codeString)) 199 if (codeString == null || "".equals(codeString)) 200 return null; 201 if ("planned".equals(codeString)) 202 return EpisodeOfCareStatus.PLANNED; 203 if ("waitlist".equals(codeString)) 204 return EpisodeOfCareStatus.WAITLIST; 205 if ("active".equals(codeString)) 206 return EpisodeOfCareStatus.ACTIVE; 207 if ("onhold".equals(codeString)) 208 return EpisodeOfCareStatus.ONHOLD; 209 if ("finished".equals(codeString)) 210 return EpisodeOfCareStatus.FINISHED; 211 if ("cancelled".equals(codeString)) 212 return EpisodeOfCareStatus.CANCELLED; 213 throw new IllegalArgumentException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 214 } 215 216 public Enumeration<EpisodeOfCareStatus> fromType(Base code) throws FHIRException { 217 if (code == null || code.isEmpty()) 218 return null; 219 String codeString = ((PrimitiveType) code).asStringValue(); 220 if (codeString == null || "".equals(codeString)) 221 return null; 222 if ("planned".equals(codeString)) 223 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.PLANNED); 224 if ("waitlist".equals(codeString)) 225 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.WAITLIST); 226 if ("active".equals(codeString)) 227 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ACTIVE); 228 if ("onhold".equals(codeString)) 229 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.ONHOLD); 230 if ("finished".equals(codeString)) 231 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.FINISHED); 232 if ("cancelled".equals(codeString)) 233 return new Enumeration<EpisodeOfCareStatus>(this, EpisodeOfCareStatus.CANCELLED); 234 throw new FHIRException("Unknown EpisodeOfCareStatus code '" + codeString + "'"); 235 } 236 237 public String toCode(EpisodeOfCareStatus code) { 238 if (code == EpisodeOfCareStatus.PLANNED) 239 return "planned"; 240 if (code == EpisodeOfCareStatus.WAITLIST) 241 return "waitlist"; 242 if (code == EpisodeOfCareStatus.ACTIVE) 243 return "active"; 244 if (code == EpisodeOfCareStatus.ONHOLD) 245 return "onhold"; 246 if (code == EpisodeOfCareStatus.FINISHED) 247 return "finished"; 248 if (code == EpisodeOfCareStatus.CANCELLED) 249 return "cancelled"; 250 return "?"; 251 } 252 } 253 254 @Block() 255 public static class EpisodeOfCareStatusHistoryComponent extends BackboneElement implements IBaseBackboneElement { 256 /** 257 * planned | waitlist | active | onhold | finished | cancelled. 258 */ 259 @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false) 260 @Description(shortDefinition = "planned | waitlist | active | onhold | finished | cancelled", formalDefinition = "planned | waitlist | active | onhold | finished | cancelled.") 261 protected Enumeration<EpisodeOfCareStatus> status; 262 263 /** 264 * The period during this EpisodeOfCare that the specific status applied. 265 */ 266 @Child(name = "period", type = { Period.class }, order = 2, min = 1, max = 1, modifier = false, summary = false) 267 @Description(shortDefinition = "Period for the status", formalDefinition = "The period during this EpisodeOfCare that the specific status applied.") 268 protected Period period; 269 270 private static final long serialVersionUID = -1192432864L; 271 272 /* 273 * Constructor 274 */ 275 public EpisodeOfCareStatusHistoryComponent() { 276 super(); 277 } 278 279 /* 280 * Constructor 281 */ 282 public EpisodeOfCareStatusHistoryComponent(Enumeration<EpisodeOfCareStatus> status, Period period) { 283 super(); 284 this.status = status; 285 this.period = period; 286 } 287 288 /** 289 * @return {@link #status} (planned | waitlist | active | onhold | finished | 290 * cancelled.). This is the underlying object with id, value and 291 * extensions. The accessor "getStatus" gives direct access to the value 292 */ 293 public Enumeration<EpisodeOfCareStatus> getStatusElement() { 294 if (this.status == null) 295 if (Configuration.errorOnAutoCreate()) 296 throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.status"); 297 else if (Configuration.doAutoCreate()) 298 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb 299 return this.status; 300 } 301 302 public boolean hasStatusElement() { 303 return this.status != null && !this.status.isEmpty(); 304 } 305 306 public boolean hasStatus() { 307 return this.status != null && !this.status.isEmpty(); 308 } 309 310 /** 311 * @param value {@link #status} (planned | waitlist | active | onhold | finished 312 * | cancelled.). This is the underlying object with id, value and 313 * extensions. The accessor "getStatus" gives direct access to the 314 * value 315 */ 316 public EpisodeOfCareStatusHistoryComponent setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 317 this.status = value; 318 return this; 319 } 320 321 /** 322 * @return planned | waitlist | active | onhold | finished | cancelled. 323 */ 324 public EpisodeOfCareStatus getStatus() { 325 return this.status == null ? null : this.status.getValue(); 326 } 327 328 /** 329 * @param value planned | waitlist | active | onhold | finished | cancelled. 330 */ 331 public EpisodeOfCareStatusHistoryComponent setStatus(EpisodeOfCareStatus value) { 332 if (this.status == null) 333 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); 334 this.status.setValue(value); 335 return this; 336 } 337 338 /** 339 * @return {@link #period} (The period during this EpisodeOfCare that the 340 * specific status applied.) 341 */ 342 public Period getPeriod() { 343 if (this.period == null) 344 if (Configuration.errorOnAutoCreate()) 345 throw new Error("Attempt to auto-create EpisodeOfCareStatusHistoryComponent.period"); 346 else if (Configuration.doAutoCreate()) 347 this.period = new Period(); // cc 348 return this.period; 349 } 350 351 public boolean hasPeriod() { 352 return this.period != null && !this.period.isEmpty(); 353 } 354 355 /** 356 * @param value {@link #period} (The period during this EpisodeOfCare that the 357 * specific status applied.) 358 */ 359 public EpisodeOfCareStatusHistoryComponent setPeriod(Period value) { 360 this.period = value; 361 return this; 362 } 363 364 protected void listChildren(List<Property> childrenList) { 365 super.listChildren(childrenList); 366 childrenList.add(new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, 367 java.lang.Integer.MAX_VALUE, status)); 368 childrenList.add( 369 new Property("period", "Period", "The period during this EpisodeOfCare that the specific status applied.", 0, 370 java.lang.Integer.MAX_VALUE, period)); 371 } 372 373 @Override 374 public void setProperty(String name, Base value) throws FHIRException { 375 if (name.equals("status")) 376 this.status = new EpisodeOfCareStatusEnumFactory().fromType(value); // Enumeration<EpisodeOfCareStatus> 377 else if (name.equals("period")) 378 this.period = castToPeriod(value); // Period 379 else 380 super.setProperty(name, value); 381 } 382 383 @Override 384 public Base addChild(String name) throws FHIRException { 385 if (name.equals("status")) { 386 throw new FHIRException("Cannot call addChild on a singleton property EpisodeOfCare.status"); 387 } else if (name.equals("period")) { 388 this.period = new Period(); 389 return this.period; 390 } else 391 return super.addChild(name); 392 } 393 394 public EpisodeOfCareStatusHistoryComponent copy() { 395 EpisodeOfCareStatusHistoryComponent dst = new EpisodeOfCareStatusHistoryComponent(); 396 copyValues(dst); 397 dst.status = status == null ? null : status.copy(); 398 dst.period = period == null ? null : period.copy(); 399 return dst; 400 } 401 402 @Override 403 public boolean equalsDeep(Base other) { 404 if (!super.equalsDeep(other)) 405 return false; 406 if (!(other instanceof EpisodeOfCareStatusHistoryComponent)) 407 return false; 408 EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other; 409 return compareDeep(status, o.status, true) && compareDeep(period, o.period, true); 410 } 411 412 @Override 413 public boolean equalsShallow(Base other) { 414 if (!super.equalsShallow(other)) 415 return false; 416 if (!(other instanceof EpisodeOfCareStatusHistoryComponent)) 417 return false; 418 EpisodeOfCareStatusHistoryComponent o = (EpisodeOfCareStatusHistoryComponent) other; 419 return compareValues(status, o.status, true); 420 } 421 422 public boolean isEmpty() { 423 return super.isEmpty() && (status == null || status.isEmpty()) && (period == null || period.isEmpty()); 424 } 425 426 public String fhirType() { 427 return "EpisodeOfCare.statusHistory"; 428 429 } 430 431 } 432 433 @Block() 434 public static class EpisodeOfCareCareTeamComponent extends BackboneElement implements IBaseBackboneElement { 435 /** 436 * The role this team member is taking within this episode of care. 437 */ 438 @Child(name = "role", type = { 439 CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 440 @Description(shortDefinition = "Role taken by this team member", formalDefinition = "The role this team member is taking within this episode of care.") 441 protected List<CodeableConcept> role; 442 443 /** 444 * The period of time this practitioner is performing some role within the 445 * episode of care. 446 */ 447 @Child(name = "period", type = { Period.class }, order = 2, min = 0, max = 1, modifier = false, summary = false) 448 @Description(shortDefinition = "Period of time for this role", formalDefinition = "The period of time this practitioner is performing some role within the episode of care.") 449 protected Period period; 450 451 /** 452 * The practitioner (or Organization) within the team. 453 */ 454 @Child(name = "member", type = { Practitioner.class, 455 Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = false) 456 @Description(shortDefinition = "The practitioner (or Organization) within the team", formalDefinition = "The practitioner (or Organization) within the team.") 457 protected Reference member; 458 459 /** 460 * The actual object that is the target of the reference (The practitioner (or 461 * Organization) within the team.) 462 */ 463 protected Resource memberTarget; 464 465 private static final long serialVersionUID = -437303089L; 466 467 /* 468 * Constructor 469 */ 470 public EpisodeOfCareCareTeamComponent() { 471 super(); 472 } 473 474 /** 475 * @return {@link #role} (The role this team member is taking within this 476 * episode of care.) 477 */ 478 public List<CodeableConcept> getRole() { 479 if (this.role == null) 480 this.role = new ArrayList<CodeableConcept>(); 481 return this.role; 482 } 483 484 public boolean hasRole() { 485 if (this.role == null) 486 return false; 487 for (CodeableConcept item : this.role) 488 if (!item.isEmpty()) 489 return true; 490 return false; 491 } 492 493 /** 494 * @return {@link #role} (The role this team member is taking within this 495 * episode of care.) 496 */ 497 // syntactic sugar 498 public CodeableConcept addRole() { // 3 499 CodeableConcept t = new CodeableConcept(); 500 if (this.role == null) 501 this.role = new ArrayList<CodeableConcept>(); 502 this.role.add(t); 503 return t; 504 } 505 506 // syntactic sugar 507 public EpisodeOfCareCareTeamComponent addRole(CodeableConcept t) { // 3 508 if (t == null) 509 return this; 510 if (this.role == null) 511 this.role = new ArrayList<CodeableConcept>(); 512 this.role.add(t); 513 return this; 514 } 515 516 /** 517 * @return {@link #period} (The period of time this practitioner is performing 518 * some role within the episode of care.) 519 */ 520 public Period getPeriod() { 521 if (this.period == null) 522 if (Configuration.errorOnAutoCreate()) 523 throw new Error("Attempt to auto-create EpisodeOfCareCareTeamComponent.period"); 524 else if (Configuration.doAutoCreate()) 525 this.period = new Period(); // cc 526 return this.period; 527 } 528 529 public boolean hasPeriod() { 530 return this.period != null && !this.period.isEmpty(); 531 } 532 533 /** 534 * @param value {@link #period} (The period of time this practitioner is 535 * performing some role within the episode of care.) 536 */ 537 public EpisodeOfCareCareTeamComponent setPeriod(Period value) { 538 this.period = value; 539 return this; 540 } 541 542 /** 543 * @return {@link #member} (The practitioner (or Organization) within the team.) 544 */ 545 public Reference getMember() { 546 if (this.member == null) 547 if (Configuration.errorOnAutoCreate()) 548 throw new Error("Attempt to auto-create EpisodeOfCareCareTeamComponent.member"); 549 else if (Configuration.doAutoCreate()) 550 this.member = new Reference(); // cc 551 return this.member; 552 } 553 554 public boolean hasMember() { 555 return this.member != null && !this.member.isEmpty(); 556 } 557 558 /** 559 * @param value {@link #member} (The practitioner (or Organization) within the 560 * team.) 561 */ 562 public EpisodeOfCareCareTeamComponent setMember(Reference value) { 563 this.member = value; 564 return this; 565 } 566 567 /** 568 * @return {@link #member} The actual object that is the target of the 569 * reference. The reference library doesn't populate this, but you can 570 * use it to hold the resource if you resolve it. (The practitioner (or 571 * Organization) within the team.) 572 */ 573 public Resource getMemberTarget() { 574 return this.memberTarget; 575 } 576 577 /** 578 * @param value {@link #member} The actual object that is the target of the 579 * reference. The reference library doesn't use these, but you can 580 * use it to hold the resource if you resolve it. (The practitioner 581 * (or Organization) within the team.) 582 */ 583 public EpisodeOfCareCareTeamComponent setMemberTarget(Resource value) { 584 this.memberTarget = value; 585 return this; 586 } 587 588 protected void listChildren(List<Property> childrenList) { 589 super.listChildren(childrenList); 590 childrenList.add(new Property("role", "CodeableConcept", 591 "The role this team member is taking within this episode of care.", 0, java.lang.Integer.MAX_VALUE, role)); 592 childrenList.add(new Property("period", "Period", 593 "The period of time this practitioner is performing some role within the episode of care.", 0, 594 java.lang.Integer.MAX_VALUE, period)); 595 childrenList.add(new Property("member", "Reference(Practitioner|Organization)", 596 "The practitioner (or Organization) within the team.", 0, java.lang.Integer.MAX_VALUE, member)); 597 } 598 599 @Override 600 public void setProperty(String name, Base value) throws FHIRException { 601 if (name.equals("role")) 602 this.getRole().add(castToCodeableConcept(value)); 603 else if (name.equals("period")) 604 this.period = castToPeriod(value); // Period 605 else if (name.equals("member")) 606 this.member = castToReference(value); // Reference 607 else 608 super.setProperty(name, value); 609 } 610 611 @Override 612 public Base addChild(String name) throws FHIRException { 613 if (name.equals("role")) { 614 return addRole(); 615 } else if (name.equals("period")) { 616 this.period = new Period(); 617 return this.period; 618 } else if (name.equals("member")) { 619 this.member = new Reference(); 620 return this.member; 621 } else 622 return super.addChild(name); 623 } 624 625 public EpisodeOfCareCareTeamComponent copy() { 626 EpisodeOfCareCareTeamComponent dst = new EpisodeOfCareCareTeamComponent(); 627 copyValues(dst); 628 if (role != null) { 629 dst.role = new ArrayList<CodeableConcept>(); 630 for (CodeableConcept i : role) 631 dst.role.add(i.copy()); 632 } 633 ; 634 dst.period = period == null ? null : period.copy(); 635 dst.member = member == null ? null : member.copy(); 636 return dst; 637 } 638 639 @Override 640 public boolean equalsDeep(Base other) { 641 if (!super.equalsDeep(other)) 642 return false; 643 if (!(other instanceof EpisodeOfCareCareTeamComponent)) 644 return false; 645 EpisodeOfCareCareTeamComponent o = (EpisodeOfCareCareTeamComponent) other; 646 return compareDeep(role, o.role, true) && compareDeep(period, o.period, true) 647 && compareDeep(member, o.member, true); 648 } 649 650 @Override 651 public boolean equalsShallow(Base other) { 652 if (!super.equalsShallow(other)) 653 return false; 654 if (!(other instanceof EpisodeOfCareCareTeamComponent)) 655 return false; 656 EpisodeOfCareCareTeamComponent o = (EpisodeOfCareCareTeamComponent) other; 657 return true; 658 } 659 660 public boolean isEmpty() { 661 return super.isEmpty() && (role == null || role.isEmpty()) && (period == null || period.isEmpty()) 662 && (member == null || member.isEmpty()); 663 } 664 665 public String fhirType() { 666 return "EpisodeOfCare.careTeam"; 667 668 } 669 670 } 671 672 /** 673 * Identifier(s) by which this EpisodeOfCare is known. 674 */ 675 @Child(name = "identifier", type = { 676 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 677 @Description(shortDefinition = "Identifier(s) for the EpisodeOfCare", formalDefinition = "Identifier(s) by which this EpisodeOfCare is known.") 678 protected List<Identifier> identifier; 679 680 /** 681 * planned | waitlist | active | onhold | finished | cancelled. 682 */ 683 @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true) 684 @Description(shortDefinition = "planned | waitlist | active | onhold | finished | cancelled", formalDefinition = "planned | waitlist | active | onhold | finished | cancelled.") 685 protected Enumeration<EpisodeOfCareStatus> status; 686 687 /** 688 * The history of statuses that the EpisodeOfCare has been through (without 689 * requiring processing the history of the resource). 690 */ 691 @Child(name = "statusHistory", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 692 @Description(shortDefinition = "Past list of status codes", formalDefinition = "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).") 693 protected List<EpisodeOfCareStatusHistoryComponent> statusHistory; 694 695 /** 696 * A classification of the type of encounter; e.g. specialist referral, disease 697 * management, type of funded care. 698 */ 699 @Child(name = "type", type = { 700 CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 701 @Description(shortDefinition = "Type/class - e.g. specialist referral, disease management", formalDefinition = "A classification of the type of encounter; e.g. specialist referral, disease management, type of funded care.") 702 protected List<CodeableConcept> type; 703 704 /** 705 * A list of conditions/problems/diagnoses that this episode of care is intended 706 * to be providing care for. 707 */ 708 @Child(name = "condition", type = { 709 Condition.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 710 @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.") 711 protected List<Reference> condition; 712 /** 713 * The actual objects that are the target of the reference (A list of 714 * conditions/problems/diagnoses that this episode of care is intended to be 715 * providing care for.) 716 */ 717 protected List<Condition> conditionTarget; 718 719 /** 720 * The patient that this EpisodeOfCare applies to. 721 */ 722 @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true) 723 @Description(shortDefinition = "Patient for this episode of care", formalDefinition = "The patient that this EpisodeOfCare applies to.") 724 protected Reference patient; 725 726 /** 727 * The actual object that is the target of the reference (The patient that this 728 * EpisodeOfCare applies to.) 729 */ 730 protected Patient patientTarget; 731 732 /** 733 * The organization that has assumed the specific responsibilities for the 734 * specified duration. 735 */ 736 @Child(name = "managingOrganization", type = { 737 Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 738 @Description(shortDefinition = "Organization that assumes care", formalDefinition = "The organization that has assumed the specific responsibilities for the specified duration.") 739 protected Reference managingOrganization; 740 741 /** 742 * The actual object that is the target of the reference (The organization that 743 * has assumed the specific responsibilities for the specified duration.) 744 */ 745 protected Organization managingOrganizationTarget; 746 747 /** 748 * The interval during which the managing organization assumes the defined 749 * responsibility. 750 */ 751 @Child(name = "period", type = { Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = true) 752 @Description(shortDefinition = "Interval during responsibility is assumed", formalDefinition = "The interval during which the managing organization assumes the defined responsibility.") 753 protected Period period; 754 755 /** 756 * Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming 757 * referrals. 758 */ 759 @Child(name = "referralRequest", type = { 760 ReferralRequest.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 761 @Description(shortDefinition = "Originating Referral Request(s)", formalDefinition = "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.") 762 protected List<Reference> referralRequest; 763 /** 764 * The actual objects that are the target of the reference (Referral Request(s) 765 * that are fulfilled by this EpisodeOfCare, incoming referrals.) 766 */ 767 protected List<ReferralRequest> referralRequestTarget; 768 769 /** 770 * The practitioner that is the care manager/care co-ordinator for this patient. 771 */ 772 @Child(name = "careManager", type = { 773 Practitioner.class }, order = 9, min = 0, max = 1, modifier = false, summary = false) 774 @Description(shortDefinition = "Care manager/care co-ordinator for the patient", formalDefinition = "The practitioner that is the care manager/care co-ordinator for this patient.") 775 protected Reference careManager; 776 777 /** 778 * The actual object that is the target of the reference (The practitioner that 779 * is the care manager/care co-ordinator for this patient.) 780 */ 781 protected Practitioner careManagerTarget; 782 783 /** 784 * The list of practitioners that may be facilitating this episode of care for 785 * specific purposes. 786 */ 787 @Child(name = "careTeam", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 788 @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.") 789 protected List<EpisodeOfCareCareTeamComponent> careTeam; 790 791 private static final long serialVersionUID = 1652653406L; 792 793 /* 794 * Constructor 795 */ 796 public EpisodeOfCare() { 797 super(); 798 } 799 800 /* 801 * Constructor 802 */ 803 public EpisodeOfCare(Enumeration<EpisodeOfCareStatus> status, Reference patient) { 804 super(); 805 this.status = status; 806 this.patient = patient; 807 } 808 809 /** 810 * @return {@link #identifier} (Identifier(s) by which this EpisodeOfCare is 811 * known.) 812 */ 813 public List<Identifier> getIdentifier() { 814 if (this.identifier == null) 815 this.identifier = new ArrayList<Identifier>(); 816 return this.identifier; 817 } 818 819 public boolean hasIdentifier() { 820 if (this.identifier == null) 821 return false; 822 for (Identifier item : this.identifier) 823 if (!item.isEmpty()) 824 return true; 825 return false; 826 } 827 828 /** 829 * @return {@link #identifier} (Identifier(s) by which this EpisodeOfCare is 830 * known.) 831 */ 832 // syntactic sugar 833 public Identifier addIdentifier() { // 3 834 Identifier t = new Identifier(); 835 if (this.identifier == null) 836 this.identifier = new ArrayList<Identifier>(); 837 this.identifier.add(t); 838 return t; 839 } 840 841 // syntactic sugar 842 public EpisodeOfCare addIdentifier(Identifier t) { // 3 843 if (t == null) 844 return this; 845 if (this.identifier == null) 846 this.identifier = new ArrayList<Identifier>(); 847 this.identifier.add(t); 848 return this; 849 } 850 851 /** 852 * @return {@link #status} (planned | waitlist | active | onhold | finished | 853 * cancelled.). This is the underlying object with id, value and 854 * extensions. The accessor "getStatus" gives direct access to the value 855 */ 856 public Enumeration<EpisodeOfCareStatus> getStatusElement() { 857 if (this.status == null) 858 if (Configuration.errorOnAutoCreate()) 859 throw new Error("Attempt to auto-create EpisodeOfCare.status"); 860 else if (Configuration.doAutoCreate()) 861 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); // bb 862 return this.status; 863 } 864 865 public boolean hasStatusElement() { 866 return this.status != null && !this.status.isEmpty(); 867 } 868 869 public boolean hasStatus() { 870 return this.status != null && !this.status.isEmpty(); 871 } 872 873 /** 874 * @param value {@link #status} (planned | waitlist | active | onhold | finished 875 * | cancelled.). This is the underlying object with id, value and 876 * extensions. The accessor "getStatus" gives direct access to the 877 * value 878 */ 879 public EpisodeOfCare setStatusElement(Enumeration<EpisodeOfCareStatus> value) { 880 this.status = value; 881 return this; 882 } 883 884 /** 885 * @return planned | waitlist | active | onhold | finished | cancelled. 886 */ 887 public EpisodeOfCareStatus getStatus() { 888 return this.status == null ? null : this.status.getValue(); 889 } 890 891 /** 892 * @param value planned | waitlist | active | onhold | finished | cancelled. 893 */ 894 public EpisodeOfCare setStatus(EpisodeOfCareStatus value) { 895 if (this.status == null) 896 this.status = new Enumeration<EpisodeOfCareStatus>(new EpisodeOfCareStatusEnumFactory()); 897 this.status.setValue(value); 898 return this; 899 } 900 901 /** 902 * @return {@link #statusHistory} (The history of statuses that the 903 * EpisodeOfCare has been through (without requiring processing the 904 * history of the resource).) 905 */ 906 public List<EpisodeOfCareStatusHistoryComponent> getStatusHistory() { 907 if (this.statusHistory == null) 908 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 909 return this.statusHistory; 910 } 911 912 public boolean hasStatusHistory() { 913 if (this.statusHistory == null) 914 return false; 915 for (EpisodeOfCareStatusHistoryComponent item : this.statusHistory) 916 if (!item.isEmpty()) 917 return true; 918 return false; 919 } 920 921 /** 922 * @return {@link #statusHistory} (The history of statuses that the 923 * EpisodeOfCare has been through (without requiring processing the 924 * history of the resource).) 925 */ 926 // syntactic sugar 927 public EpisodeOfCareStatusHistoryComponent addStatusHistory() { // 3 928 EpisodeOfCareStatusHistoryComponent t = new EpisodeOfCareStatusHistoryComponent(); 929 if (this.statusHistory == null) 930 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 931 this.statusHistory.add(t); 932 return t; 933 } 934 935 // syntactic sugar 936 public EpisodeOfCare addStatusHistory(EpisodeOfCareStatusHistoryComponent t) { // 3 937 if (t == null) 938 return this; 939 if (this.statusHistory == null) 940 this.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 941 this.statusHistory.add(t); 942 return this; 943 } 944 945 /** 946 * @return {@link #type} (A classification of the type of encounter; e.g. 947 * specialist referral, disease management, type of funded care.) 948 */ 949 public List<CodeableConcept> getType() { 950 if (this.type == null) 951 this.type = new ArrayList<CodeableConcept>(); 952 return this.type; 953 } 954 955 public boolean hasType() { 956 if (this.type == null) 957 return false; 958 for (CodeableConcept item : this.type) 959 if (!item.isEmpty()) 960 return true; 961 return false; 962 } 963 964 /** 965 * @return {@link #type} (A classification of the type of encounter; e.g. 966 * specialist referral, disease management, type of funded care.) 967 */ 968 // syntactic sugar 969 public CodeableConcept addType() { // 3 970 CodeableConcept t = new CodeableConcept(); 971 if (this.type == null) 972 this.type = new ArrayList<CodeableConcept>(); 973 this.type.add(t); 974 return t; 975 } 976 977 // syntactic sugar 978 public EpisodeOfCare addType(CodeableConcept t) { // 3 979 if (t == null) 980 return this; 981 if (this.type == null) 982 this.type = new ArrayList<CodeableConcept>(); 983 this.type.add(t); 984 return this; 985 } 986 987 /** 988 * @return {@link #condition} (A list of conditions/problems/diagnoses that this 989 * episode of care is intended to be providing care for.) 990 */ 991 public List<Reference> getCondition() { 992 if (this.condition == null) 993 this.condition = new ArrayList<Reference>(); 994 return this.condition; 995 } 996 997 public boolean hasCondition() { 998 if (this.condition == null) 999 return false; 1000 for (Reference item : this.condition) 1001 if (!item.isEmpty()) 1002 return true; 1003 return false; 1004 } 1005 1006 /** 1007 * @return {@link #condition} (A list of conditions/problems/diagnoses that this 1008 * episode of care is intended to be providing care for.) 1009 */ 1010 // syntactic sugar 1011 public Reference addCondition() { // 3 1012 Reference t = new Reference(); 1013 if (this.condition == null) 1014 this.condition = new ArrayList<Reference>(); 1015 this.condition.add(t); 1016 return t; 1017 } 1018 1019 // syntactic sugar 1020 public EpisodeOfCare addCondition(Reference t) { // 3 1021 if (t == null) 1022 return this; 1023 if (this.condition == null) 1024 this.condition = new ArrayList<Reference>(); 1025 this.condition.add(t); 1026 return this; 1027 } 1028 1029 /** 1030 * @return {@link #condition} (The actual objects that are the target of the 1031 * reference. The reference library doesn't populate this, but you can 1032 * use this to hold the resources if you resolvethemt. A list of 1033 * conditions/problems/diagnoses that this episode of care is intended 1034 * to be providing care for.) 1035 */ 1036 public List<Condition> getConditionTarget() { 1037 if (this.conditionTarget == null) 1038 this.conditionTarget = new ArrayList<Condition>(); 1039 return this.conditionTarget; 1040 } 1041 1042 // syntactic sugar 1043 /** 1044 * @return {@link #condition} (Add an actual object that is the target of the 1045 * reference. The reference library doesn't use these, but you can use 1046 * this to hold the resources if you resolvethemt. A list of 1047 * conditions/problems/diagnoses that this episode of care is intended 1048 * to be providing care for.) 1049 */ 1050 public Condition addConditionTarget() { 1051 Condition r = new Condition(); 1052 if (this.conditionTarget == null) 1053 this.conditionTarget = new ArrayList<Condition>(); 1054 this.conditionTarget.add(r); 1055 return r; 1056 } 1057 1058 /** 1059 * @return {@link #patient} (The patient that this EpisodeOfCare applies to.) 1060 */ 1061 public Reference getPatient() { 1062 if (this.patient == null) 1063 if (Configuration.errorOnAutoCreate()) 1064 throw new Error("Attempt to auto-create EpisodeOfCare.patient"); 1065 else if (Configuration.doAutoCreate()) 1066 this.patient = new Reference(); // cc 1067 return this.patient; 1068 } 1069 1070 public boolean hasPatient() { 1071 return this.patient != null && !this.patient.isEmpty(); 1072 } 1073 1074 /** 1075 * @param value {@link #patient} (The patient that this EpisodeOfCare applies 1076 * to.) 1077 */ 1078 public EpisodeOfCare setPatient(Reference value) { 1079 this.patient = value; 1080 return this; 1081 } 1082 1083 /** 1084 * @return {@link #patient} The actual object that is the target of the 1085 * reference. The reference library doesn't populate this, but you can 1086 * use it to hold the resource if you resolve it. (The patient that this 1087 * EpisodeOfCare applies to.) 1088 */ 1089 public Patient getPatientTarget() { 1090 if (this.patientTarget == null) 1091 if (Configuration.errorOnAutoCreate()) 1092 throw new Error("Attempt to auto-create EpisodeOfCare.patient"); 1093 else if (Configuration.doAutoCreate()) 1094 this.patientTarget = new Patient(); // aa 1095 return this.patientTarget; 1096 } 1097 1098 /** 1099 * @param value {@link #patient} The actual object that is the target of the 1100 * reference. The reference library doesn't use these, but you can 1101 * use it to hold the resource if you resolve it. (The patient that 1102 * this EpisodeOfCare applies to.) 1103 */ 1104 public EpisodeOfCare setPatientTarget(Patient value) { 1105 this.patientTarget = value; 1106 return this; 1107 } 1108 1109 /** 1110 * @return {@link #managingOrganization} (The organization that has assumed the 1111 * specific responsibilities for the specified duration.) 1112 */ 1113 public Reference getManagingOrganization() { 1114 if (this.managingOrganization == null) 1115 if (Configuration.errorOnAutoCreate()) 1116 throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization"); 1117 else if (Configuration.doAutoCreate()) 1118 this.managingOrganization = new Reference(); // cc 1119 return this.managingOrganization; 1120 } 1121 1122 public boolean hasManagingOrganization() { 1123 return this.managingOrganization != null && !this.managingOrganization.isEmpty(); 1124 } 1125 1126 /** 1127 * @param value {@link #managingOrganization} (The organization that has assumed 1128 * the specific responsibilities for the specified duration.) 1129 */ 1130 public EpisodeOfCare setManagingOrganization(Reference value) { 1131 this.managingOrganization = value; 1132 return this; 1133 } 1134 1135 /** 1136 * @return {@link #managingOrganization} The actual object that is the target of 1137 * the reference. The reference library doesn't populate this, but you 1138 * can use it to hold the resource if you resolve it. (The organization 1139 * that has assumed the specific responsibilities for the specified 1140 * duration.) 1141 */ 1142 public Organization getManagingOrganizationTarget() { 1143 if (this.managingOrganizationTarget == null) 1144 if (Configuration.errorOnAutoCreate()) 1145 throw new Error("Attempt to auto-create EpisodeOfCare.managingOrganization"); 1146 else if (Configuration.doAutoCreate()) 1147 this.managingOrganizationTarget = new Organization(); // aa 1148 return this.managingOrganizationTarget; 1149 } 1150 1151 /** 1152 * @param value {@link #managingOrganization} The actual object that is the 1153 * target of the reference. The reference library doesn't use 1154 * these, but you can use it to hold the resource if you resolve 1155 * it. (The organization that has assumed the specific 1156 * responsibilities for the specified duration.) 1157 */ 1158 public EpisodeOfCare setManagingOrganizationTarget(Organization value) { 1159 this.managingOrganizationTarget = value; 1160 return this; 1161 } 1162 1163 /** 1164 * @return {@link #period} (The interval during which the managing organization 1165 * assumes the defined responsibility.) 1166 */ 1167 public Period getPeriod() { 1168 if (this.period == null) 1169 if (Configuration.errorOnAutoCreate()) 1170 throw new Error("Attempt to auto-create EpisodeOfCare.period"); 1171 else if (Configuration.doAutoCreate()) 1172 this.period = new Period(); // cc 1173 return this.period; 1174 } 1175 1176 public boolean hasPeriod() { 1177 return this.period != null && !this.period.isEmpty(); 1178 } 1179 1180 /** 1181 * @param value {@link #period} (The interval during which the managing 1182 * organization assumes the defined responsibility.) 1183 */ 1184 public EpisodeOfCare setPeriod(Period value) { 1185 this.period = value; 1186 return this; 1187 } 1188 1189 /** 1190 * @return {@link #referralRequest} (Referral Request(s) that are fulfilled by 1191 * this EpisodeOfCare, incoming referrals.) 1192 */ 1193 public List<Reference> getReferralRequest() { 1194 if (this.referralRequest == null) 1195 this.referralRequest = new ArrayList<Reference>(); 1196 return this.referralRequest; 1197 } 1198 1199 public boolean hasReferralRequest() { 1200 if (this.referralRequest == null) 1201 return false; 1202 for (Reference item : this.referralRequest) 1203 if (!item.isEmpty()) 1204 return true; 1205 return false; 1206 } 1207 1208 /** 1209 * @return {@link #referralRequest} (Referral Request(s) that are fulfilled by 1210 * this EpisodeOfCare, incoming referrals.) 1211 */ 1212 // syntactic sugar 1213 public Reference addReferralRequest() { // 3 1214 Reference t = new Reference(); 1215 if (this.referralRequest == null) 1216 this.referralRequest = new ArrayList<Reference>(); 1217 this.referralRequest.add(t); 1218 return t; 1219 } 1220 1221 // syntactic sugar 1222 public EpisodeOfCare addReferralRequest(Reference t) { // 3 1223 if (t == null) 1224 return this; 1225 if (this.referralRequest == null) 1226 this.referralRequest = new ArrayList<Reference>(); 1227 this.referralRequest.add(t); 1228 return this; 1229 } 1230 1231 /** 1232 * @return {@link #referralRequest} (The actual objects that are the target of 1233 * the reference. The reference library doesn't populate this, but you 1234 * can use this to hold the resources if you resolvethemt. Referral 1235 * Request(s) that are fulfilled by this EpisodeOfCare, incoming 1236 * referrals.) 1237 */ 1238 public List<ReferralRequest> getReferralRequestTarget() { 1239 if (this.referralRequestTarget == null) 1240 this.referralRequestTarget = new ArrayList<ReferralRequest>(); 1241 return this.referralRequestTarget; 1242 } 1243 1244 // syntactic sugar 1245 /** 1246 * @return {@link #referralRequest} (Add an actual object that is the target of 1247 * the reference. The reference library doesn't use these, but you can 1248 * use this to hold the resources if you resolvethemt. Referral 1249 * Request(s) that are fulfilled by this EpisodeOfCare, incoming 1250 * referrals.) 1251 */ 1252 public ReferralRequest addReferralRequestTarget() { 1253 ReferralRequest r = new ReferralRequest(); 1254 if (this.referralRequestTarget == null) 1255 this.referralRequestTarget = new ArrayList<ReferralRequest>(); 1256 this.referralRequestTarget.add(r); 1257 return r; 1258 } 1259 1260 /** 1261 * @return {@link #careManager} (The practitioner that is the care manager/care 1262 * co-ordinator for this patient.) 1263 */ 1264 public Reference getCareManager() { 1265 if (this.careManager == null) 1266 if (Configuration.errorOnAutoCreate()) 1267 throw new Error("Attempt to auto-create EpisodeOfCare.careManager"); 1268 else if (Configuration.doAutoCreate()) 1269 this.careManager = new Reference(); // cc 1270 return this.careManager; 1271 } 1272 1273 public boolean hasCareManager() { 1274 return this.careManager != null && !this.careManager.isEmpty(); 1275 } 1276 1277 /** 1278 * @param value {@link #careManager} (The practitioner that is the care 1279 * manager/care co-ordinator for this patient.) 1280 */ 1281 public EpisodeOfCare setCareManager(Reference value) { 1282 this.careManager = value; 1283 return this; 1284 } 1285 1286 /** 1287 * @return {@link #careManager} The actual object that is the target of the 1288 * reference. The reference library doesn't populate this, but you can 1289 * use it to hold the resource if you resolve it. (The practitioner that 1290 * is the care manager/care co-ordinator for this patient.) 1291 */ 1292 public Practitioner getCareManagerTarget() { 1293 if (this.careManagerTarget == null) 1294 if (Configuration.errorOnAutoCreate()) 1295 throw new Error("Attempt to auto-create EpisodeOfCare.careManager"); 1296 else if (Configuration.doAutoCreate()) 1297 this.careManagerTarget = new Practitioner(); // aa 1298 return this.careManagerTarget; 1299 } 1300 1301 /** 1302 * @param value {@link #careManager} The actual object that is the target of the 1303 * reference. The reference library doesn't use these, but you can 1304 * use it to hold the resource if you resolve it. (The practitioner 1305 * that is the care manager/care co-ordinator for this patient.) 1306 */ 1307 public EpisodeOfCare setCareManagerTarget(Practitioner value) { 1308 this.careManagerTarget = value; 1309 return this; 1310 } 1311 1312 /** 1313 * @return {@link #careTeam} (The list of practitioners that may be facilitating 1314 * this episode of care for specific purposes.) 1315 */ 1316 public List<EpisodeOfCareCareTeamComponent> getCareTeam() { 1317 if (this.careTeam == null) 1318 this.careTeam = new ArrayList<EpisodeOfCareCareTeamComponent>(); 1319 return this.careTeam; 1320 } 1321 1322 public boolean hasCareTeam() { 1323 if (this.careTeam == null) 1324 return false; 1325 for (EpisodeOfCareCareTeamComponent item : this.careTeam) 1326 if (!item.isEmpty()) 1327 return true; 1328 return false; 1329 } 1330 1331 /** 1332 * @return {@link #careTeam} (The list of practitioners that may be facilitating 1333 * this episode of care for specific purposes.) 1334 */ 1335 // syntactic sugar 1336 public EpisodeOfCareCareTeamComponent addCareTeam() { // 3 1337 EpisodeOfCareCareTeamComponent t = new EpisodeOfCareCareTeamComponent(); 1338 if (this.careTeam == null) 1339 this.careTeam = new ArrayList<EpisodeOfCareCareTeamComponent>(); 1340 this.careTeam.add(t); 1341 return t; 1342 } 1343 1344 // syntactic sugar 1345 public EpisodeOfCare addCareTeam(EpisodeOfCareCareTeamComponent t) { // 3 1346 if (t == null) 1347 return this; 1348 if (this.careTeam == null) 1349 this.careTeam = new ArrayList<EpisodeOfCareCareTeamComponent>(); 1350 this.careTeam.add(t); 1351 return this; 1352 } 1353 1354 protected void listChildren(List<Property> childrenList) { 1355 super.listChildren(childrenList); 1356 childrenList.add(new Property("identifier", "Identifier", "Identifier(s) by which this EpisodeOfCare is known.", 0, 1357 java.lang.Integer.MAX_VALUE, identifier)); 1358 childrenList.add(new Property("status", "code", "planned | waitlist | active | onhold | finished | cancelled.", 0, 1359 java.lang.Integer.MAX_VALUE, status)); 1360 childrenList.add(new Property("statusHistory", "", 1361 "The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).", 1362 0, java.lang.Integer.MAX_VALUE, statusHistory)); 1363 childrenList.add(new Property("type", "CodeableConcept", 1364 "A classification of the type of encounter; e.g. specialist referral, disease management, type of funded care.", 1365 0, java.lang.Integer.MAX_VALUE, type)); 1366 childrenList.add(new Property("condition", "Reference(Condition)", 1367 "A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.", 0, 1368 java.lang.Integer.MAX_VALUE, condition)); 1369 childrenList.add(new Property("patient", "Reference(Patient)", "The patient that this EpisodeOfCare applies to.", 0, 1370 java.lang.Integer.MAX_VALUE, patient)); 1371 childrenList.add(new Property("managingOrganization", "Reference(Organization)", 1372 "The organization that has assumed the specific responsibilities for the specified duration.", 0, 1373 java.lang.Integer.MAX_VALUE, managingOrganization)); 1374 childrenList.add(new Property("period", "Period", 1375 "The interval during which the managing organization assumes the defined responsibility.", 0, 1376 java.lang.Integer.MAX_VALUE, period)); 1377 childrenList.add(new Property("referralRequest", "Reference(ReferralRequest)", 1378 "Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.", 0, 1379 java.lang.Integer.MAX_VALUE, referralRequest)); 1380 childrenList.add(new Property("careManager", "Reference(Practitioner)", 1381 "The practitioner that is the care manager/care co-ordinator for this patient.", 0, java.lang.Integer.MAX_VALUE, 1382 careManager)); 1383 childrenList.add(new Property("careTeam", "", 1384 "The list of practitioners that may be facilitating this episode of care for specific purposes.", 0, 1385 java.lang.Integer.MAX_VALUE, careTeam)); 1386 } 1387 1388 @Override 1389 public void setProperty(String name, Base value) throws FHIRException { 1390 if (name.equals("identifier")) 1391 this.getIdentifier().add(castToIdentifier(value)); 1392 else if (name.equals("status")) 1393 this.status = new EpisodeOfCareStatusEnumFactory().fromType(value); // Enumeration<EpisodeOfCareStatus> 1394 else if (name.equals("statusHistory")) 1395 this.getStatusHistory().add((EpisodeOfCareStatusHistoryComponent) value); 1396 else if (name.equals("type")) 1397 this.getType().add(castToCodeableConcept(value)); 1398 else if (name.equals("condition")) 1399 this.getCondition().add(castToReference(value)); 1400 else if (name.equals("patient")) 1401 this.patient = castToReference(value); // Reference 1402 else if (name.equals("managingOrganization")) 1403 this.managingOrganization = castToReference(value); // Reference 1404 else if (name.equals("period")) 1405 this.period = castToPeriod(value); // Period 1406 else if (name.equals("referralRequest")) 1407 this.getReferralRequest().add(castToReference(value)); 1408 else if (name.equals("careManager")) 1409 this.careManager = castToReference(value); // Reference 1410 else if (name.equals("careTeam")) 1411 this.getCareTeam().add((EpisodeOfCareCareTeamComponent) value); 1412 else 1413 super.setProperty(name, value); 1414 } 1415 1416 @Override 1417 public Base addChild(String name) throws FHIRException { 1418 if (name.equals("identifier")) { 1419 return addIdentifier(); 1420 } else if (name.equals("status")) { 1421 throw new FHIRException("Cannot call addChild on a singleton property EpisodeOfCare.status"); 1422 } else if (name.equals("statusHistory")) { 1423 return addStatusHistory(); 1424 } else if (name.equals("type")) { 1425 return addType(); 1426 } else if (name.equals("condition")) { 1427 return addCondition(); 1428 } else if (name.equals("patient")) { 1429 this.patient = new Reference(); 1430 return this.patient; 1431 } else if (name.equals("managingOrganization")) { 1432 this.managingOrganization = new Reference(); 1433 return this.managingOrganization; 1434 } else if (name.equals("period")) { 1435 this.period = new Period(); 1436 return this.period; 1437 } else if (name.equals("referralRequest")) { 1438 return addReferralRequest(); 1439 } else if (name.equals("careManager")) { 1440 this.careManager = new Reference(); 1441 return this.careManager; 1442 } else if (name.equals("careTeam")) { 1443 return addCareTeam(); 1444 } else 1445 return super.addChild(name); 1446 } 1447 1448 public String fhirType() { 1449 return "EpisodeOfCare"; 1450 1451 } 1452 1453 public EpisodeOfCare copy() { 1454 EpisodeOfCare dst = new EpisodeOfCare(); 1455 copyValues(dst); 1456 if (identifier != null) { 1457 dst.identifier = new ArrayList<Identifier>(); 1458 for (Identifier i : identifier) 1459 dst.identifier.add(i.copy()); 1460 } 1461 ; 1462 dst.status = status == null ? null : status.copy(); 1463 if (statusHistory != null) { 1464 dst.statusHistory = new ArrayList<EpisodeOfCareStatusHistoryComponent>(); 1465 for (EpisodeOfCareStatusHistoryComponent i : statusHistory) 1466 dst.statusHistory.add(i.copy()); 1467 } 1468 ; 1469 if (type != null) { 1470 dst.type = new ArrayList<CodeableConcept>(); 1471 for (CodeableConcept i : type) 1472 dst.type.add(i.copy()); 1473 } 1474 ; 1475 if (condition != null) { 1476 dst.condition = new ArrayList<Reference>(); 1477 for (Reference i : condition) 1478 dst.condition.add(i.copy()); 1479 } 1480 ; 1481 dst.patient = patient == null ? null : patient.copy(); 1482 dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy(); 1483 dst.period = period == null ? null : period.copy(); 1484 if (referralRequest != null) { 1485 dst.referralRequest = new ArrayList<Reference>(); 1486 for (Reference i : referralRequest) 1487 dst.referralRequest.add(i.copy()); 1488 } 1489 ; 1490 dst.careManager = careManager == null ? null : careManager.copy(); 1491 if (careTeam != null) { 1492 dst.careTeam = new ArrayList<EpisodeOfCareCareTeamComponent>(); 1493 for (EpisodeOfCareCareTeamComponent i : careTeam) 1494 dst.careTeam.add(i.copy()); 1495 } 1496 ; 1497 return dst; 1498 } 1499 1500 protected EpisodeOfCare typedCopy() { 1501 return copy(); 1502 } 1503 1504 @Override 1505 public boolean equalsDeep(Base other) { 1506 if (!super.equalsDeep(other)) 1507 return false; 1508 if (!(other instanceof EpisodeOfCare)) 1509 return false; 1510 EpisodeOfCare o = (EpisodeOfCare) other; 1511 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) 1512 && compareDeep(statusHistory, o.statusHistory, true) && compareDeep(type, o.type, true) 1513 && compareDeep(condition, o.condition, true) && compareDeep(patient, o.patient, true) 1514 && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(period, o.period, true) 1515 && compareDeep(referralRequest, o.referralRequest, true) && compareDeep(careManager, o.careManager, true) 1516 && compareDeep(careTeam, o.careTeam, true); 1517 } 1518 1519 @Override 1520 public boolean equalsShallow(Base other) { 1521 if (!super.equalsShallow(other)) 1522 return false; 1523 if (!(other instanceof EpisodeOfCare)) 1524 return false; 1525 EpisodeOfCare o = (EpisodeOfCare) other; 1526 return compareValues(status, o.status, true); 1527 } 1528 1529 public boolean isEmpty() { 1530 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty()) 1531 && (statusHistory == null || statusHistory.isEmpty()) && (type == null || type.isEmpty()) 1532 && (condition == null || condition.isEmpty()) && (patient == null || patient.isEmpty()) 1533 && (managingOrganization == null || managingOrganization.isEmpty()) && (period == null || period.isEmpty()) 1534 && (referralRequest == null || referralRequest.isEmpty()) && (careManager == null || careManager.isEmpty()) 1535 && (careTeam == null || careTeam.isEmpty()); 1536 } 1537 1538 @Override 1539 public ResourceType getResourceType() { 1540 return ResourceType.EpisodeOfCare; 1541 } 1542 1543 @SearchParamDefinition(name = "date", path = "EpisodeOfCare.period", description = "The provided date search value falls within the episode of care's period", type = "date") 1544 public static final String SP_DATE = "date"; 1545 @SearchParamDefinition(name = "identifier", path = "EpisodeOfCare.identifier", description = "Identifier(s) for the EpisodeOfCare", type = "token") 1546 public static final String SP_IDENTIFIER = "identifier"; 1547 @SearchParamDefinition(name = "condition", path = "EpisodeOfCare.condition", description = "Conditions/problems/diagnoses this episode of care is for", type = "reference") 1548 public static final String SP_CONDITION = "condition"; 1549 @SearchParamDefinition(name = "incomingreferral", path = "EpisodeOfCare.referralRequest", description = "Incoming Referral Request", type = "reference") 1550 public static final String SP_INCOMINGREFERRAL = "incomingreferral"; 1551 @SearchParamDefinition(name = "patient", path = "EpisodeOfCare.patient", description = "Patient for this episode of care", type = "reference") 1552 public static final String SP_PATIENT = "patient"; 1553 @SearchParamDefinition(name = "organization", path = "EpisodeOfCare.managingOrganization", description = "The organization that has assumed the specific responsibilities of this EpisodeOfCare", type = "reference") 1554 public static final String SP_ORGANIZATION = "organization"; 1555 @SearchParamDefinition(name = "team-member", path = "EpisodeOfCare.careTeam.member", description = "A Practitioner or Organization allocated to the care team for this EpisodeOfCare", type = "reference") 1556 public static final String SP_TEAMMEMBER = "team-member"; 1557 @SearchParamDefinition(name = "type", path = "EpisodeOfCare.type", description = "Type/class - e.g. specialist referral, disease management", type = "token") 1558 public static final String SP_TYPE = "type"; 1559 @SearchParamDefinition(name = "care-manager", path = "EpisodeOfCare.careManager", description = "Care manager/care co-ordinator for the patient", type = "reference") 1560 public static final String SP_CAREMANAGER = "care-manager"; 1561 @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") 1562 public static final String SP_STATUS = "status"; 1563 1564}