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