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.Date; 035import java.util.List; 036 037import ca.uhn.fhir.model.api.annotation.Block; 038import ca.uhn.fhir.model.api.annotation.Child; 039import ca.uhn.fhir.model.api.annotation.Description; 040import ca.uhn.fhir.model.api.annotation.ResourceDef; 041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 042import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 043import org.hl7.fhir.exceptions.FHIRException; 044import org.hl7.fhir.utilities.Utilities; 045 046/** 047 * A set of healthcare-related information that is assembled together into a 048 * single logical document that provides a single coherent statement of meaning, 049 * establishes its own context and that has clinical attestation with regard to 050 * who is making the statement. While a Composition defines the structure, it 051 * does not actually contain the content: rather the full content of a document 052 * is contained in a Bundle, of which the Composition is the first resource 053 * contained. 054 */ 055@ResourceDef(name = "Composition", profile = "http://hl7.org/fhir/Profile/Composition") 056public class Composition extends DomainResource { 057 058 public enum CompositionStatus { 059 /** 060 * This is a preliminary composition or document (also known as initial or 061 * interim). The content may be incomplete or unverified. 062 */ 063 PRELIMINARY, 064 /** 065 * This version of the composition is complete and verified by an appropriate 066 * person and no further work is planned. Any subsequent updates would be on a 067 * new version of the composition. 068 */ 069 FINAL, 070 /** 071 * The composition content or the referenced resources have been modified 072 * (edited or added to) subsequent to being released as "final" and the 073 * composition is complete and verified by an authorized person. 074 */ 075 AMENDED, 076 /** 077 * The composition or document was originally created/issued in error, and this 078 * is an amendment that marks that the entire series should not be considered as 079 * valid. 080 */ 081 ENTEREDINERROR, 082 /** 083 * added to help the parsers 084 */ 085 NULL; 086 087 public static CompositionStatus fromCode(String codeString) throws FHIRException { 088 if (codeString == null || "".equals(codeString)) 089 return null; 090 if ("preliminary".equals(codeString)) 091 return PRELIMINARY; 092 if ("final".equals(codeString)) 093 return FINAL; 094 if ("amended".equals(codeString)) 095 return AMENDED; 096 if ("entered-in-error".equals(codeString)) 097 return ENTEREDINERROR; 098 throw new FHIRException("Unknown CompositionStatus code '" + codeString + "'"); 099 } 100 101 public String toCode() { 102 switch (this) { 103 case PRELIMINARY: 104 return "preliminary"; 105 case FINAL: 106 return "final"; 107 case AMENDED: 108 return "amended"; 109 case ENTEREDINERROR: 110 return "entered-in-error"; 111 case NULL: 112 return null; 113 default: 114 return "?"; 115 } 116 } 117 118 public String getSystem() { 119 switch (this) { 120 case PRELIMINARY: 121 return "http://hl7.org/fhir/composition-status"; 122 case FINAL: 123 return "http://hl7.org/fhir/composition-status"; 124 case AMENDED: 125 return "http://hl7.org/fhir/composition-status"; 126 case ENTEREDINERROR: 127 return "http://hl7.org/fhir/composition-status"; 128 case NULL: 129 return null; 130 default: 131 return "?"; 132 } 133 } 134 135 public String getDefinition() { 136 switch (this) { 137 case PRELIMINARY: 138 return "This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified."; 139 case FINAL: 140 return "This version of the composition is complete and verified by an appropriate person and no further work is planned. Any subsequent updates would be on a new version of the composition."; 141 case AMENDED: 142 return "The composition content or the referenced resources have been modified (edited or added to) subsequent to being released as \"final\" and the composition is complete and verified by an authorized person."; 143 case ENTEREDINERROR: 144 return "The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid."; 145 case NULL: 146 return null; 147 default: 148 return "?"; 149 } 150 } 151 152 public String getDisplay() { 153 switch (this) { 154 case PRELIMINARY: 155 return "Preliminary"; 156 case FINAL: 157 return "Final"; 158 case AMENDED: 159 return "Amended"; 160 case ENTEREDINERROR: 161 return "Entered in Error"; 162 case NULL: 163 return null; 164 default: 165 return "?"; 166 } 167 } 168 } 169 170 public static class CompositionStatusEnumFactory implements EnumFactory<CompositionStatus> { 171 public CompositionStatus fromCode(String codeString) throws IllegalArgumentException { 172 if (codeString == null || "".equals(codeString)) 173 if (codeString == null || "".equals(codeString)) 174 return null; 175 if ("preliminary".equals(codeString)) 176 return CompositionStatus.PRELIMINARY; 177 if ("final".equals(codeString)) 178 return CompositionStatus.FINAL; 179 if ("amended".equals(codeString)) 180 return CompositionStatus.AMENDED; 181 if ("entered-in-error".equals(codeString)) 182 return CompositionStatus.ENTEREDINERROR; 183 throw new IllegalArgumentException("Unknown CompositionStatus code '" + codeString + "'"); 184 } 185 186 public Enumeration<CompositionStatus> fromType(Base code) throws FHIRException { 187 if (code == null || code.isEmpty()) 188 return null; 189 String codeString = ((PrimitiveType) code).asStringValue(); 190 if (codeString == null || "".equals(codeString)) 191 return null; 192 if ("preliminary".equals(codeString)) 193 return new Enumeration<CompositionStatus>(this, CompositionStatus.PRELIMINARY); 194 if ("final".equals(codeString)) 195 return new Enumeration<CompositionStatus>(this, CompositionStatus.FINAL); 196 if ("amended".equals(codeString)) 197 return new Enumeration<CompositionStatus>(this, CompositionStatus.AMENDED); 198 if ("entered-in-error".equals(codeString)) 199 return new Enumeration<CompositionStatus>(this, CompositionStatus.ENTEREDINERROR); 200 throw new FHIRException("Unknown CompositionStatus code '" + codeString + "'"); 201 } 202 203 public String toCode(CompositionStatus code) { 204 if (code == CompositionStatus.PRELIMINARY) 205 return "preliminary"; 206 if (code == CompositionStatus.FINAL) 207 return "final"; 208 if (code == CompositionStatus.AMENDED) 209 return "amended"; 210 if (code == CompositionStatus.ENTEREDINERROR) 211 return "entered-in-error"; 212 return "?"; 213 } 214 } 215 216 public enum CompositionAttestationMode { 217 /** 218 * The person authenticated the content in their personal capacity. 219 */ 220 PERSONAL, 221 /** 222 * The person authenticated the content in their professional capacity. 223 */ 224 PROFESSIONAL, 225 /** 226 * The person authenticated the content and accepted legal responsibility for 227 * its content. 228 */ 229 LEGAL, 230 /** 231 * The organization authenticated the content as consistent with their policies 232 * and procedures. 233 */ 234 OFFICIAL, 235 /** 236 * added to help the parsers 237 */ 238 NULL; 239 240 public static CompositionAttestationMode fromCode(String codeString) throws FHIRException { 241 if (codeString == null || "".equals(codeString)) 242 return null; 243 if ("personal".equals(codeString)) 244 return PERSONAL; 245 if ("professional".equals(codeString)) 246 return PROFESSIONAL; 247 if ("legal".equals(codeString)) 248 return LEGAL; 249 if ("official".equals(codeString)) 250 return OFFICIAL; 251 throw new FHIRException("Unknown CompositionAttestationMode code '" + codeString + "'"); 252 } 253 254 public String toCode() { 255 switch (this) { 256 case PERSONAL: 257 return "personal"; 258 case PROFESSIONAL: 259 return "professional"; 260 case LEGAL: 261 return "legal"; 262 case OFFICIAL: 263 return "official"; 264 case NULL: 265 return null; 266 default: 267 return "?"; 268 } 269 } 270 271 public String getSystem() { 272 switch (this) { 273 case PERSONAL: 274 return "http://hl7.org/fhir/composition-attestation-mode"; 275 case PROFESSIONAL: 276 return "http://hl7.org/fhir/composition-attestation-mode"; 277 case LEGAL: 278 return "http://hl7.org/fhir/composition-attestation-mode"; 279 case OFFICIAL: 280 return "http://hl7.org/fhir/composition-attestation-mode"; 281 case NULL: 282 return null; 283 default: 284 return "?"; 285 } 286 } 287 288 public String getDefinition() { 289 switch (this) { 290 case PERSONAL: 291 return "The person authenticated the content in their personal capacity."; 292 case PROFESSIONAL: 293 return "The person authenticated the content in their professional capacity."; 294 case LEGAL: 295 return "The person authenticated the content and accepted legal responsibility for its content."; 296 case OFFICIAL: 297 return "The organization authenticated the content as consistent with their policies and procedures."; 298 case NULL: 299 return null; 300 default: 301 return "?"; 302 } 303 } 304 305 public String getDisplay() { 306 switch (this) { 307 case PERSONAL: 308 return "Personal"; 309 case PROFESSIONAL: 310 return "Professional"; 311 case LEGAL: 312 return "Legal"; 313 case OFFICIAL: 314 return "Official"; 315 case NULL: 316 return null; 317 default: 318 return "?"; 319 } 320 } 321 } 322 323 public static class CompositionAttestationModeEnumFactory implements EnumFactory<CompositionAttestationMode> { 324 public CompositionAttestationMode fromCode(String codeString) throws IllegalArgumentException { 325 if (codeString == null || "".equals(codeString)) 326 if (codeString == null || "".equals(codeString)) 327 return null; 328 if ("personal".equals(codeString)) 329 return CompositionAttestationMode.PERSONAL; 330 if ("professional".equals(codeString)) 331 return CompositionAttestationMode.PROFESSIONAL; 332 if ("legal".equals(codeString)) 333 return CompositionAttestationMode.LEGAL; 334 if ("official".equals(codeString)) 335 return CompositionAttestationMode.OFFICIAL; 336 throw new IllegalArgumentException("Unknown CompositionAttestationMode code '" + codeString + "'"); 337 } 338 339 public Enumeration<CompositionAttestationMode> fromType(Base code) throws FHIRException { 340 if (code == null || code.isEmpty()) 341 return null; 342 String codeString = ((PrimitiveType) code).asStringValue(); 343 if (codeString == null || "".equals(codeString)) 344 return null; 345 if ("personal".equals(codeString)) 346 return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PERSONAL); 347 if ("professional".equals(codeString)) 348 return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PROFESSIONAL); 349 if ("legal".equals(codeString)) 350 return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.LEGAL); 351 if ("official".equals(codeString)) 352 return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.OFFICIAL); 353 throw new FHIRException("Unknown CompositionAttestationMode code '" + codeString + "'"); 354 } 355 356 public String toCode(CompositionAttestationMode code) { 357 if (code == CompositionAttestationMode.PERSONAL) 358 return "personal"; 359 if (code == CompositionAttestationMode.PROFESSIONAL) 360 return "professional"; 361 if (code == CompositionAttestationMode.LEGAL) 362 return "legal"; 363 if (code == CompositionAttestationMode.OFFICIAL) 364 return "official"; 365 return "?"; 366 } 367 } 368 369 @Block() 370 public static class CompositionAttesterComponent extends BackboneElement implements IBaseBackboneElement { 371 /** 372 * The type of attestation the authenticator offers. 373 */ 374 @Child(name = "mode", type = { 375 CodeType.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 376 @Description(shortDefinition = "personal | professional | legal | official", formalDefinition = "The type of attestation the authenticator offers.") 377 protected List<Enumeration<CompositionAttestationMode>> mode; 378 379 /** 380 * When composition was attested by the party. 381 */ 382 @Child(name = "time", type = { DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 383 @Description(shortDefinition = "When composition attested", formalDefinition = "When composition was attested by the party.") 384 protected DateTimeType time; 385 386 /** 387 * Who attested the composition in the specified way. 388 */ 389 @Child(name = "party", type = { Patient.class, Practitioner.class, 390 Organization.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 391 @Description(shortDefinition = "Who attested the composition", formalDefinition = "Who attested the composition in the specified way.") 392 protected Reference party; 393 394 /** 395 * The actual object that is the target of the reference (Who attested the 396 * composition in the specified way.) 397 */ 398 protected Resource partyTarget; 399 400 private static final long serialVersionUID = -436604745L; 401 402 /* 403 * Constructor 404 */ 405 public CompositionAttesterComponent() { 406 super(); 407 } 408 409 /** 410 * @return {@link #mode} (The type of attestation the authenticator offers.) 411 */ 412 public List<Enumeration<CompositionAttestationMode>> getMode() { 413 if (this.mode == null) 414 this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>(); 415 return this.mode; 416 } 417 418 public boolean hasMode() { 419 if (this.mode == null) 420 return false; 421 for (Enumeration<CompositionAttestationMode> item : this.mode) 422 if (!item.isEmpty()) 423 return true; 424 return false; 425 } 426 427 /** 428 * @return Returns a reference to <code>this</code> for easy method chaining 429 */ 430 public CompositionAttesterComponent setMode(List<Enumeration<CompositionAttestationMode>> mode) { 431 this.mode = mode; 432 return this; 433 } 434 435 /** 436 * @return {@link #mode} (The type of attestation the authenticator offers.) 437 */ 438 // syntactic sugar 439 public Enumeration<CompositionAttestationMode> addModeElement() {// 2 440 Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>( 441 new CompositionAttestationModeEnumFactory()); 442 if (this.mode == null) 443 this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>(); 444 this.mode.add(t); 445 return t; 446 } 447 448 /** 449 * @param value {@link #mode} (The type of attestation the authenticator 450 * offers.) 451 */ 452 public CompositionAttesterComponent addMode(CompositionAttestationMode value) { // 1 453 Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>( 454 new CompositionAttestationModeEnumFactory()); 455 t.setValue(value); 456 if (this.mode == null) 457 this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>(); 458 this.mode.add(t); 459 return this; 460 } 461 462 /** 463 * @param value {@link #mode} (The type of attestation the authenticator 464 * offers.) 465 */ 466 public boolean hasMode(CompositionAttestationMode value) { 467 if (this.mode == null) 468 return false; 469 for (Enumeration<CompositionAttestationMode> v : this.mode) 470 if (v.equals(value)) // code 471 return true; 472 return false; 473 } 474 475 /** 476 * @return {@link #time} (When composition was attested by the party.). This is 477 * the underlying object with id, value and extensions. The accessor 478 * "getTime" gives direct access to the value 479 */ 480 public DateTimeType getTimeElement() { 481 if (this.time == null) 482 if (Configuration.errorOnAutoCreate()) 483 throw new Error("Attempt to auto-create CompositionAttesterComponent.time"); 484 else if (Configuration.doAutoCreate()) 485 this.time = new DateTimeType(); // bb 486 return this.time; 487 } 488 489 public boolean hasTimeElement() { 490 return this.time != null && !this.time.isEmpty(); 491 } 492 493 public boolean hasTime() { 494 return this.time != null && !this.time.isEmpty(); 495 } 496 497 /** 498 * @param value {@link #time} (When composition was attested by the party.). 499 * This is the underlying object with id, value and extensions. The 500 * accessor "getTime" gives direct access to the value 501 */ 502 public CompositionAttesterComponent setTimeElement(DateTimeType value) { 503 this.time = value; 504 return this; 505 } 506 507 /** 508 * @return When composition was attested by the party. 509 */ 510 public Date getTime() { 511 return this.time == null ? null : this.time.getValue(); 512 } 513 514 /** 515 * @param value When composition was attested by the party. 516 */ 517 public CompositionAttesterComponent setTime(Date value) { 518 if (value == null) 519 this.time = null; 520 else { 521 if (this.time == null) 522 this.time = new DateTimeType(); 523 this.time.setValue(value); 524 } 525 return this; 526 } 527 528 /** 529 * @return {@link #party} (Who attested the composition in the specified way.) 530 */ 531 public Reference getParty() { 532 if (this.party == null) 533 if (Configuration.errorOnAutoCreate()) 534 throw new Error("Attempt to auto-create CompositionAttesterComponent.party"); 535 else if (Configuration.doAutoCreate()) 536 this.party = new Reference(); // cc 537 return this.party; 538 } 539 540 public boolean hasParty() { 541 return this.party != null && !this.party.isEmpty(); 542 } 543 544 /** 545 * @param value {@link #party} (Who attested the composition in the specified 546 * way.) 547 */ 548 public CompositionAttesterComponent setParty(Reference value) { 549 this.party = value; 550 return this; 551 } 552 553 /** 554 * @return {@link #party} The actual object that is the target of the reference. 555 * The reference library doesn't populate this, but you can use it to 556 * hold the resource if you resolve it. (Who attested the composition in 557 * the specified way.) 558 */ 559 public Resource getPartyTarget() { 560 return this.partyTarget; 561 } 562 563 /** 564 * @param value {@link #party} The actual object that is the target of the 565 * reference. The reference library doesn't use these, but you can 566 * use it to hold the resource if you resolve it. (Who attested the 567 * composition in the specified way.) 568 */ 569 public CompositionAttesterComponent setPartyTarget(Resource value) { 570 this.partyTarget = value; 571 return this; 572 } 573 574 protected void listChildren(List<Property> childrenList) { 575 super.listChildren(childrenList); 576 childrenList.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, 577 java.lang.Integer.MAX_VALUE, mode)); 578 childrenList.add(new Property("time", "dateTime", "When composition was attested by the party.", 0, 579 java.lang.Integer.MAX_VALUE, time)); 580 childrenList.add(new Property("party", "Reference(Patient|Practitioner|Organization)", 581 "Who attested the composition in the specified way.", 0, java.lang.Integer.MAX_VALUE, party)); 582 } 583 584 @Override 585 public void setProperty(String name, Base value) throws FHIRException { 586 if (name.equals("mode")) 587 this.getMode().add(new CompositionAttestationModeEnumFactory().fromType(value)); 588 else if (name.equals("time")) 589 this.time = castToDateTime(value); // DateTimeType 590 else if (name.equals("party")) 591 this.party = castToReference(value); // Reference 592 else 593 super.setProperty(name, value); 594 } 595 596 @Override 597 public Base addChild(String name) throws FHIRException { 598 if (name.equals("mode")) { 599 throw new FHIRException("Cannot call addChild on a singleton property Composition.mode"); 600 } else if (name.equals("time")) { 601 throw new FHIRException("Cannot call addChild on a singleton property Composition.time"); 602 } else if (name.equals("party")) { 603 this.party = new Reference(); 604 return this.party; 605 } else 606 return super.addChild(name); 607 } 608 609 public CompositionAttesterComponent copy() { 610 CompositionAttesterComponent dst = new CompositionAttesterComponent(); 611 copyValues(dst); 612 if (mode != null) { 613 dst.mode = new ArrayList<Enumeration<CompositionAttestationMode>>(); 614 for (Enumeration<CompositionAttestationMode> i : mode) 615 dst.mode.add(i.copy()); 616 } 617 ; 618 dst.time = time == null ? null : time.copy(); 619 dst.party = party == null ? null : party.copy(); 620 return dst; 621 } 622 623 @Override 624 public boolean equalsDeep(Base other) { 625 if (!super.equalsDeep(other)) 626 return false; 627 if (!(other instanceof CompositionAttesterComponent)) 628 return false; 629 CompositionAttesterComponent o = (CompositionAttesterComponent) other; 630 return compareDeep(mode, o.mode, true) && compareDeep(time, o.time, true) && compareDeep(party, o.party, true); 631 } 632 633 @Override 634 public boolean equalsShallow(Base other) { 635 if (!super.equalsShallow(other)) 636 return false; 637 if (!(other instanceof CompositionAttesterComponent)) 638 return false; 639 CompositionAttesterComponent o = (CompositionAttesterComponent) other; 640 return compareValues(mode, o.mode, true) && compareValues(time, o.time, true); 641 } 642 643 public boolean isEmpty() { 644 return super.isEmpty() && (mode == null || mode.isEmpty()) && (time == null || time.isEmpty()) 645 && (party == null || party.isEmpty()); 646 } 647 648 public String fhirType() { 649 return "Composition.attester"; 650 651 } 652 653 } 654 655 @Block() 656 public static class CompositionEventComponent extends BackboneElement implements IBaseBackboneElement { 657 /** 658 * This list of codes represents the main clinical acts, such as a colonoscopy 659 * or an appendectomy, being documented. In some cases, the event is inherent in 660 * the typeCode, such as a "History and Physical Report" in which the procedure 661 * being documented is necessarily a "History and Physical" act. 662 */ 663 @Child(name = "code", type = { 664 CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 665 @Description(shortDefinition = "Code(s) that apply to the event being documented", formalDefinition = "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.") 666 protected List<CodeableConcept> code; 667 668 /** 669 * The period of time covered by the documentation. There is no assertion that 670 * the documentation is a complete representation for this period, only that it 671 * documents events during this time. 672 */ 673 @Child(name = "period", type = { Period.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 674 @Description(shortDefinition = "The period covered by the documentation", formalDefinition = "The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.") 675 protected Period period; 676 677 /** 678 * The description and/or reference of the event(s) being documented. For 679 * example, this could be used to document such a colonoscopy or an 680 * appendectomy. 681 */ 682 @Child(name = "detail", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 683 @Description(shortDefinition = "The event(s) being documented", formalDefinition = "The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.") 684 protected List<Reference> detail; 685 /** 686 * The actual objects that are the target of the reference (The description 687 * and/or reference of the event(s) being documented. For example, this could be 688 * used to document such a colonoscopy or an appendectomy.) 689 */ 690 protected List<Resource> detailTarget; 691 692 private static final long serialVersionUID = -1581379774L; 693 694 /* 695 * Constructor 696 */ 697 public CompositionEventComponent() { 698 super(); 699 } 700 701 /** 702 * @return {@link #code} (This list of codes represents the main clinical acts, 703 * such as a colonoscopy or an appendectomy, being documented. In some 704 * cases, the event is inherent in the typeCode, such as a "History and 705 * Physical Report" in which the procedure being documented is 706 * necessarily a "History and Physical" act.) 707 */ 708 public List<CodeableConcept> getCode() { 709 if (this.code == null) 710 this.code = new ArrayList<CodeableConcept>(); 711 return this.code; 712 } 713 714 public boolean hasCode() { 715 if (this.code == null) 716 return false; 717 for (CodeableConcept item : this.code) 718 if (!item.isEmpty()) 719 return true; 720 return false; 721 } 722 723 /** 724 * @return {@link #code} (This list of codes represents the main clinical acts, 725 * such as a colonoscopy or an appendectomy, being documented. In some 726 * cases, the event is inherent in the typeCode, such as a "History and 727 * Physical Report" in which the procedure being documented is 728 * necessarily a "History and Physical" act.) 729 */ 730 // syntactic sugar 731 public CodeableConcept addCode() { // 3 732 CodeableConcept t = new CodeableConcept(); 733 if (this.code == null) 734 this.code = new ArrayList<CodeableConcept>(); 735 this.code.add(t); 736 return t; 737 } 738 739 // syntactic sugar 740 public CompositionEventComponent addCode(CodeableConcept t) { // 3 741 if (t == null) 742 return this; 743 if (this.code == null) 744 this.code = new ArrayList<CodeableConcept>(); 745 this.code.add(t); 746 return this; 747 } 748 749 /** 750 * @return {@link #period} (The period of time covered by the documentation. 751 * There is no assertion that the documentation is a complete 752 * representation for this period, only that it documents events during 753 * this time.) 754 */ 755 public Period getPeriod() { 756 if (this.period == null) 757 if (Configuration.errorOnAutoCreate()) 758 throw new Error("Attempt to auto-create CompositionEventComponent.period"); 759 else if (Configuration.doAutoCreate()) 760 this.period = new Period(); // cc 761 return this.period; 762 } 763 764 public boolean hasPeriod() { 765 return this.period != null && !this.period.isEmpty(); 766 } 767 768 /** 769 * @param value {@link #period} (The period of time covered by the 770 * documentation. There is no assertion that the documentation is a 771 * complete representation for this period, only that it documents 772 * events during this time.) 773 */ 774 public CompositionEventComponent setPeriod(Period value) { 775 this.period = value; 776 return this; 777 } 778 779 /** 780 * @return {@link #detail} (The description and/or reference of the event(s) 781 * being documented. For example, this could be used to document such a 782 * colonoscopy or an appendectomy.) 783 */ 784 public List<Reference> getDetail() { 785 if (this.detail == null) 786 this.detail = new ArrayList<Reference>(); 787 return this.detail; 788 } 789 790 public boolean hasDetail() { 791 if (this.detail == null) 792 return false; 793 for (Reference item : this.detail) 794 if (!item.isEmpty()) 795 return true; 796 return false; 797 } 798 799 /** 800 * @return {@link #detail} (The description and/or reference of the event(s) 801 * being documented. For example, this could be used to document such a 802 * colonoscopy or an appendectomy.) 803 */ 804 // syntactic sugar 805 public Reference addDetail() { // 3 806 Reference t = new Reference(); 807 if (this.detail == null) 808 this.detail = new ArrayList<Reference>(); 809 this.detail.add(t); 810 return t; 811 } 812 813 // syntactic sugar 814 public CompositionEventComponent addDetail(Reference t) { // 3 815 if (t == null) 816 return this; 817 if (this.detail == null) 818 this.detail = new ArrayList<Reference>(); 819 this.detail.add(t); 820 return this; 821 } 822 823 /** 824 * @return {@link #detail} (The actual objects that are the target of the 825 * reference. The reference library doesn't populate this, but you can 826 * use this to hold the resources if you resolvethemt. The description 827 * and/or reference of the event(s) being documented. For example, this 828 * could be used to document such a colonoscopy or an appendectomy.) 829 */ 830 public List<Resource> getDetailTarget() { 831 if (this.detailTarget == null) 832 this.detailTarget = new ArrayList<Resource>(); 833 return this.detailTarget; 834 } 835 836 protected void listChildren(List<Property> childrenList) { 837 super.listChildren(childrenList); 838 childrenList.add(new Property("code", "CodeableConcept", 839 "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 840 0, java.lang.Integer.MAX_VALUE, code)); 841 childrenList.add(new Property("period", "Period", 842 "The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.", 843 0, java.lang.Integer.MAX_VALUE, period)); 844 childrenList.add(new Property("detail", "Reference(Any)", 845 "The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.", 846 0, java.lang.Integer.MAX_VALUE, detail)); 847 } 848 849 @Override 850 public void setProperty(String name, Base value) throws FHIRException { 851 if (name.equals("code")) 852 this.getCode().add(castToCodeableConcept(value)); 853 else if (name.equals("period")) 854 this.period = castToPeriod(value); // Period 855 else if (name.equals("detail")) 856 this.getDetail().add(castToReference(value)); 857 else 858 super.setProperty(name, value); 859 } 860 861 @Override 862 public Base addChild(String name) throws FHIRException { 863 if (name.equals("code")) { 864 return addCode(); 865 } else if (name.equals("period")) { 866 this.period = new Period(); 867 return this.period; 868 } else if (name.equals("detail")) { 869 return addDetail(); 870 } else 871 return super.addChild(name); 872 } 873 874 public CompositionEventComponent copy() { 875 CompositionEventComponent dst = new CompositionEventComponent(); 876 copyValues(dst); 877 if (code != null) { 878 dst.code = new ArrayList<CodeableConcept>(); 879 for (CodeableConcept i : code) 880 dst.code.add(i.copy()); 881 } 882 ; 883 dst.period = period == null ? null : period.copy(); 884 if (detail != null) { 885 dst.detail = new ArrayList<Reference>(); 886 for (Reference i : detail) 887 dst.detail.add(i.copy()); 888 } 889 ; 890 return dst; 891 } 892 893 @Override 894 public boolean equalsDeep(Base other) { 895 if (!super.equalsDeep(other)) 896 return false; 897 if (!(other instanceof CompositionEventComponent)) 898 return false; 899 CompositionEventComponent o = (CompositionEventComponent) other; 900 return compareDeep(code, o.code, true) && compareDeep(period, o.period, true) 901 && compareDeep(detail, o.detail, true); 902 } 903 904 @Override 905 public boolean equalsShallow(Base other) { 906 if (!super.equalsShallow(other)) 907 return false; 908 if (!(other instanceof CompositionEventComponent)) 909 return false; 910 CompositionEventComponent o = (CompositionEventComponent) other; 911 return true; 912 } 913 914 public boolean isEmpty() { 915 return super.isEmpty() && (code == null || code.isEmpty()) && (period == null || period.isEmpty()) 916 && (detail == null || detail.isEmpty()); 917 } 918 919 public String fhirType() { 920 return "Composition.event"; 921 922 } 923 924 } 925 926 @Block() 927 public static class SectionComponent extends BackboneElement implements IBaseBackboneElement { 928 /** 929 * The label for this particular section. This will be part of the rendered 930 * content for the document, and is often used to build a table of contents. 931 */ 932 @Child(name = "title", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false) 933 @Description(shortDefinition = "Label for section (e.g. for ToC)", formalDefinition = "The label for this particular section. This will be part of the rendered content for the document, and is often used to build a table of contents.") 934 protected StringType title; 935 936 /** 937 * A code identifying the kind of content contained within the section. This 938 * must be consistent with the section title. 939 */ 940 @Child(name = "code", type = { 941 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false) 942 @Description(shortDefinition = "Classification of section (recommended)", formalDefinition = "A code identifying the kind of content contained within the section. This must be consistent with the section title.") 943 protected CodeableConcept code; 944 945 /** 946 * A human-readable narrative that contains the attested content of the section, 947 * used to represent the content of the resource to a human. The narrative need 948 * not encode all the structured data, but is required to contain sufficient 949 * detail to make it "clinically safe" for a human to just read the narrative. 950 */ 951 @Child(name = "text", type = { Narrative.class }, order = 3, min = 0, max = 1, modifier = false, summary = false) 952 @Description(shortDefinition = "Text summary of the section, for human interpretation", formalDefinition = "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.") 953 protected Narrative text; 954 955 /** 956 * How the entry list was prepared - whether it is a working list that is 957 * suitable for being maintained on an ongoing basis, or if it represents a 958 * snapshot of a list of items from another source, or whether it is a prepared 959 * list where items may be marked as added, modified or deleted. 960 */ 961 @Child(name = "mode", type = { CodeType.class }, order = 4, min = 0, max = 1, modifier = true, summary = true) 962 @Description(shortDefinition = "working | snapshot | changes", formalDefinition = "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.") 963 protected CodeType mode; 964 965 /** 966 * Specifies the order applied to the items in the section entries. 967 */ 968 @Child(name = "orderedBy", type = { 969 CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false) 970 @Description(shortDefinition = "Order of section entries", formalDefinition = "Specifies the order applied to the items in the section entries.") 971 protected CodeableConcept orderedBy; 972 973 /** 974 * A reference to the actual resource from which the narrative in the section is 975 * derived. 976 */ 977 @Child(name = "entry", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 978 @Description(shortDefinition = "A reference to data that supports this section", formalDefinition = "A reference to the actual resource from which the narrative in the section is derived.") 979 protected List<Reference> entry; 980 /** 981 * The actual objects that are the target of the reference (A reference to the 982 * actual resource from which the narrative in the section is derived.) 983 */ 984 protected List<Resource> entryTarget; 985 986 /** 987 * If the section is empty, why the list is empty. An empty section typically 988 * has some text explaining the empty reason. 989 */ 990 @Child(name = "emptyReason", type = { 991 CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = false) 992 @Description(shortDefinition = "Why the section is empty", formalDefinition = "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.") 993 protected CodeableConcept emptyReason; 994 995 /** 996 * A nested sub-section within this section. 997 */ 998 @Child(name = "section", type = { 999 SectionComponent.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1000 @Description(shortDefinition = "Nested Section", formalDefinition = "A nested sub-section within this section.") 1001 protected List<SectionComponent> section; 1002 1003 private static final long serialVersionUID = -726390626L; 1004 1005 /* 1006 * Constructor 1007 */ 1008 public SectionComponent() { 1009 super(); 1010 } 1011 1012 /** 1013 * @return {@link #title} (The label for this particular section. This will be 1014 * part of the rendered content for the document, and is often used to 1015 * build a table of contents.). This is the underlying object with id, 1016 * value and extensions. The accessor "getTitle" gives direct access to 1017 * the value 1018 */ 1019 public StringType getTitleElement() { 1020 if (this.title == null) 1021 if (Configuration.errorOnAutoCreate()) 1022 throw new Error("Attempt to auto-create SectionComponent.title"); 1023 else if (Configuration.doAutoCreate()) 1024 this.title = new StringType(); // bb 1025 return this.title; 1026 } 1027 1028 public boolean hasTitleElement() { 1029 return this.title != null && !this.title.isEmpty(); 1030 } 1031 1032 public boolean hasTitle() { 1033 return this.title != null && !this.title.isEmpty(); 1034 } 1035 1036 /** 1037 * @param value {@link #title} (The label for this particular section. This will 1038 * be part of the rendered content for the document, and is often 1039 * used to build a table of contents.). This is the underlying 1040 * object with id, value and extensions. The accessor "getTitle" 1041 * gives direct access to the value 1042 */ 1043 public SectionComponent setTitleElement(StringType value) { 1044 this.title = value; 1045 return this; 1046 } 1047 1048 /** 1049 * @return The label for this particular section. This will be part of the 1050 * rendered content for the document, and is often used to build a table 1051 * of contents. 1052 */ 1053 public String getTitle() { 1054 return this.title == null ? null : this.title.getValue(); 1055 } 1056 1057 /** 1058 * @param value The label for this particular section. This will be part of the 1059 * rendered content for the document, and is often used to build a 1060 * table of contents. 1061 */ 1062 public SectionComponent setTitle(String value) { 1063 if (Utilities.noString(value)) 1064 this.title = null; 1065 else { 1066 if (this.title == null) 1067 this.title = new StringType(); 1068 this.title.setValue(value); 1069 } 1070 return this; 1071 } 1072 1073 /** 1074 * @return {@link #code} (A code identifying the kind of content contained 1075 * within the section. This must be consistent with the section title.) 1076 */ 1077 public CodeableConcept getCode() { 1078 if (this.code == null) 1079 if (Configuration.errorOnAutoCreate()) 1080 throw new Error("Attempt to auto-create SectionComponent.code"); 1081 else if (Configuration.doAutoCreate()) 1082 this.code = new CodeableConcept(); // cc 1083 return this.code; 1084 } 1085 1086 public boolean hasCode() { 1087 return this.code != null && !this.code.isEmpty(); 1088 } 1089 1090 /** 1091 * @param value {@link #code} (A code identifying the kind of content contained 1092 * within the section. This must be consistent with the section 1093 * title.) 1094 */ 1095 public SectionComponent setCode(CodeableConcept value) { 1096 this.code = value; 1097 return this; 1098 } 1099 1100 /** 1101 * @return {@link #text} (A human-readable narrative that contains the attested 1102 * content of the section, used to represent the content of the resource 1103 * to a human. The narrative need not encode all the structured data, 1104 * but is required to contain sufficient detail to make it "clinically 1105 * safe" for a human to just read the narrative.) 1106 */ 1107 public Narrative getText() { 1108 if (this.text == null) 1109 if (Configuration.errorOnAutoCreate()) 1110 throw new Error("Attempt to auto-create SectionComponent.text"); 1111 else if (Configuration.doAutoCreate()) 1112 this.text = new Narrative(); // cc 1113 return this.text; 1114 } 1115 1116 public boolean hasText() { 1117 return this.text != null && !this.text.isEmpty(); 1118 } 1119 1120 /** 1121 * @param value {@link #text} (A human-readable narrative that contains the 1122 * attested content of the section, used to represent the content 1123 * of the resource to a human. The narrative need not encode all 1124 * the structured data, but is required to contain sufficient 1125 * detail to make it "clinically safe" for a human to just read the 1126 * narrative.) 1127 */ 1128 public SectionComponent setText(Narrative value) { 1129 this.text = value; 1130 return this; 1131 } 1132 1133 /** 1134 * @return {@link #mode} (How the entry list was prepared - whether it is a 1135 * working list that is suitable for being maintained on an ongoing 1136 * basis, or if it represents a snapshot of a list of items from another 1137 * source, or whether it is a prepared list where items may be marked as 1138 * added, modified or deleted.). This is the underlying object with id, 1139 * value and extensions. The accessor "getMode" gives direct access to 1140 * the value 1141 */ 1142 public CodeType getModeElement() { 1143 if (this.mode == null) 1144 if (Configuration.errorOnAutoCreate()) 1145 throw new Error("Attempt to auto-create SectionComponent.mode"); 1146 else if (Configuration.doAutoCreate()) 1147 this.mode = new CodeType(); // bb 1148 return this.mode; 1149 } 1150 1151 public boolean hasModeElement() { 1152 return this.mode != null && !this.mode.isEmpty(); 1153 } 1154 1155 public boolean hasMode() { 1156 return this.mode != null && !this.mode.isEmpty(); 1157 } 1158 1159 /** 1160 * @param value {@link #mode} (How the entry list was prepared - whether it is a 1161 * working list that is suitable for being maintained on an ongoing 1162 * basis, or if it represents a snapshot of a list of items from 1163 * another source, or whether it is a prepared list where items may 1164 * be marked as added, modified or deleted.). This is the 1165 * underlying object with id, value and extensions. The accessor 1166 * "getMode" gives direct access to the value 1167 */ 1168 public SectionComponent setModeElement(CodeType value) { 1169 this.mode = value; 1170 return this; 1171 } 1172 1173 /** 1174 * @return How the entry list was prepared - whether it is a working list that 1175 * is suitable for being maintained on an ongoing basis, or if it 1176 * represents a snapshot of a list of items from another source, or 1177 * whether it is a prepared list where items may be marked as added, 1178 * modified or deleted. 1179 */ 1180 public String getMode() { 1181 return this.mode == null ? null : this.mode.getValue(); 1182 } 1183 1184 /** 1185 * @param value How the entry list was prepared - whether it is a working list 1186 * that is suitable for being maintained on an ongoing basis, or if 1187 * it represents a snapshot of a list of items from another source, 1188 * or whether it is a prepared list where items may be marked as 1189 * added, modified or deleted. 1190 */ 1191 public SectionComponent setMode(String value) { 1192 if (Utilities.noString(value)) 1193 this.mode = null; 1194 else { 1195 if (this.mode == null) 1196 this.mode = new CodeType(); 1197 this.mode.setValue(value); 1198 } 1199 return this; 1200 } 1201 1202 /** 1203 * @return {@link #orderedBy} (Specifies the order applied to the items in the 1204 * section entries.) 1205 */ 1206 public CodeableConcept getOrderedBy() { 1207 if (this.orderedBy == null) 1208 if (Configuration.errorOnAutoCreate()) 1209 throw new Error("Attempt to auto-create SectionComponent.orderedBy"); 1210 else if (Configuration.doAutoCreate()) 1211 this.orderedBy = new CodeableConcept(); // cc 1212 return this.orderedBy; 1213 } 1214 1215 public boolean hasOrderedBy() { 1216 return this.orderedBy != null && !this.orderedBy.isEmpty(); 1217 } 1218 1219 /** 1220 * @param value {@link #orderedBy} (Specifies the order applied to the items in 1221 * the section entries.) 1222 */ 1223 public SectionComponent setOrderedBy(CodeableConcept value) { 1224 this.orderedBy = value; 1225 return this; 1226 } 1227 1228 /** 1229 * @return {@link #entry} (A reference to the actual resource from which the 1230 * narrative in the section is derived.) 1231 */ 1232 public List<Reference> getEntry() { 1233 if (this.entry == null) 1234 this.entry = new ArrayList<Reference>(); 1235 return this.entry; 1236 } 1237 1238 public boolean hasEntry() { 1239 if (this.entry == null) 1240 return false; 1241 for (Reference item : this.entry) 1242 if (!item.isEmpty()) 1243 return true; 1244 return false; 1245 } 1246 1247 /** 1248 * @return {@link #entry} (A reference to the actual resource from which the 1249 * narrative in the section is derived.) 1250 */ 1251 // syntactic sugar 1252 public Reference addEntry() { // 3 1253 Reference t = new Reference(); 1254 if (this.entry == null) 1255 this.entry = new ArrayList<Reference>(); 1256 this.entry.add(t); 1257 return t; 1258 } 1259 1260 // syntactic sugar 1261 public SectionComponent addEntry(Reference t) { // 3 1262 if (t == null) 1263 return this; 1264 if (this.entry == null) 1265 this.entry = new ArrayList<Reference>(); 1266 this.entry.add(t); 1267 return this; 1268 } 1269 1270 /** 1271 * @return {@link #entry} (The actual objects that are the target of the 1272 * reference. The reference library doesn't populate this, but you can 1273 * use this to hold the resources if you resolvethemt. A reference to 1274 * the actual resource from which the narrative in the section is 1275 * derived.) 1276 */ 1277 public List<Resource> getEntryTarget() { 1278 if (this.entryTarget == null) 1279 this.entryTarget = new ArrayList<Resource>(); 1280 return this.entryTarget; 1281 } 1282 1283 /** 1284 * @return {@link #emptyReason} (If the section is empty, why the list is empty. 1285 * An empty section typically has some text explaining the empty 1286 * reason.) 1287 */ 1288 public CodeableConcept getEmptyReason() { 1289 if (this.emptyReason == null) 1290 if (Configuration.errorOnAutoCreate()) 1291 throw new Error("Attempt to auto-create SectionComponent.emptyReason"); 1292 else if (Configuration.doAutoCreate()) 1293 this.emptyReason = new CodeableConcept(); // cc 1294 return this.emptyReason; 1295 } 1296 1297 public boolean hasEmptyReason() { 1298 return this.emptyReason != null && !this.emptyReason.isEmpty(); 1299 } 1300 1301 /** 1302 * @param value {@link #emptyReason} (If the section is empty, why the list is 1303 * empty. An empty section typically has some text explaining the 1304 * empty reason.) 1305 */ 1306 public SectionComponent setEmptyReason(CodeableConcept value) { 1307 this.emptyReason = value; 1308 return this; 1309 } 1310 1311 /** 1312 * @return {@link #section} (A nested sub-section within this section.) 1313 */ 1314 public List<SectionComponent> getSection() { 1315 if (this.section == null) 1316 this.section = new ArrayList<SectionComponent>(); 1317 return this.section; 1318 } 1319 1320 public boolean hasSection() { 1321 if (this.section == null) 1322 return false; 1323 for (SectionComponent item : this.section) 1324 if (!item.isEmpty()) 1325 return true; 1326 return false; 1327 } 1328 1329 /** 1330 * @return {@link #section} (A nested sub-section within this section.) 1331 */ 1332 // syntactic sugar 1333 public SectionComponent addSection() { // 3 1334 SectionComponent t = new SectionComponent(); 1335 if (this.section == null) 1336 this.section = new ArrayList<SectionComponent>(); 1337 this.section.add(t); 1338 return t; 1339 } 1340 1341 // syntactic sugar 1342 public SectionComponent addSection(SectionComponent t) { // 3 1343 if (t == null) 1344 return this; 1345 if (this.section == null) 1346 this.section = new ArrayList<SectionComponent>(); 1347 this.section.add(t); 1348 return this; 1349 } 1350 1351 protected void listChildren(List<Property> childrenList) { 1352 super.listChildren(childrenList); 1353 childrenList.add(new Property("title", "string", 1354 "The label for this particular section. This will be part of the rendered content for the document, and is often used to build a table of contents.", 1355 0, java.lang.Integer.MAX_VALUE, title)); 1356 childrenList.add(new Property("code", "CodeableConcept", 1357 "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 1358 0, java.lang.Integer.MAX_VALUE, code)); 1359 childrenList.add(new Property("text", "Narrative", 1360 "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 1361 0, java.lang.Integer.MAX_VALUE, text)); 1362 childrenList.add(new Property("mode", "code", 1363 "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 1364 0, java.lang.Integer.MAX_VALUE, mode)); 1365 childrenList.add(new Property("orderedBy", "CodeableConcept", 1366 "Specifies the order applied to the items in the section entries.", 0, java.lang.Integer.MAX_VALUE, 1367 orderedBy)); 1368 childrenList.add(new Property("entry", "Reference(Any)", 1369 "A reference to the actual resource from which the narrative in the section is derived.", 0, 1370 java.lang.Integer.MAX_VALUE, entry)); 1371 childrenList.add(new Property("emptyReason", "CodeableConcept", 1372 "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.", 1373 0, java.lang.Integer.MAX_VALUE, emptyReason)); 1374 childrenList.add(new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, 1375 java.lang.Integer.MAX_VALUE, section)); 1376 } 1377 1378 @Override 1379 public void setProperty(String name, Base value) throws FHIRException { 1380 if (name.equals("title")) 1381 this.title = castToString(value); // StringType 1382 else if (name.equals("code")) 1383 this.code = castToCodeableConcept(value); // CodeableConcept 1384 else if (name.equals("text")) 1385 this.text = castToNarrative(value); // Narrative 1386 else if (name.equals("mode")) 1387 this.mode = castToCode(value); // CodeType 1388 else if (name.equals("orderedBy")) 1389 this.orderedBy = castToCodeableConcept(value); // CodeableConcept 1390 else if (name.equals("entry")) 1391 this.getEntry().add(castToReference(value)); 1392 else if (name.equals("emptyReason")) 1393 this.emptyReason = castToCodeableConcept(value); // CodeableConcept 1394 else if (name.equals("section")) 1395 this.getSection().add((SectionComponent) value); 1396 else 1397 super.setProperty(name, value); 1398 } 1399 1400 @Override 1401 public Base addChild(String name) throws FHIRException { 1402 if (name.equals("title")) { 1403 throw new FHIRException("Cannot call addChild on a singleton property Composition.title"); 1404 } else if (name.equals("code")) { 1405 this.code = new CodeableConcept(); 1406 return this.code; 1407 } else if (name.equals("text")) { 1408 this.text = new Narrative(); 1409 return this.text; 1410 } else if (name.equals("mode")) { 1411 throw new FHIRException("Cannot call addChild on a singleton property Composition.mode"); 1412 } else if (name.equals("orderedBy")) { 1413 this.orderedBy = new CodeableConcept(); 1414 return this.orderedBy; 1415 } else if (name.equals("entry")) { 1416 return addEntry(); 1417 } else if (name.equals("emptyReason")) { 1418 this.emptyReason = new CodeableConcept(); 1419 return this.emptyReason; 1420 } else if (name.equals("section")) { 1421 return addSection(); 1422 } else 1423 return super.addChild(name); 1424 } 1425 1426 public SectionComponent copy() { 1427 SectionComponent dst = new SectionComponent(); 1428 copyValues(dst); 1429 dst.title = title == null ? null : title.copy(); 1430 dst.code = code == null ? null : code.copy(); 1431 dst.text = text == null ? null : text.copy(); 1432 dst.mode = mode == null ? null : mode.copy(); 1433 dst.orderedBy = orderedBy == null ? null : orderedBy.copy(); 1434 if (entry != null) { 1435 dst.entry = new ArrayList<Reference>(); 1436 for (Reference i : entry) 1437 dst.entry.add(i.copy()); 1438 } 1439 ; 1440 dst.emptyReason = emptyReason == null ? null : emptyReason.copy(); 1441 if (section != null) { 1442 dst.section = new ArrayList<SectionComponent>(); 1443 for (SectionComponent i : section) 1444 dst.section.add(i.copy()); 1445 } 1446 ; 1447 return dst; 1448 } 1449 1450 @Override 1451 public boolean equalsDeep(Base other) { 1452 if (!super.equalsDeep(other)) 1453 return false; 1454 if (!(other instanceof SectionComponent)) 1455 return false; 1456 SectionComponent o = (SectionComponent) other; 1457 return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true) 1458 && compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) 1459 && compareDeep(entry, o.entry, true) && compareDeep(emptyReason, o.emptyReason, true) 1460 && compareDeep(section, o.section, true); 1461 } 1462 1463 @Override 1464 public boolean equalsShallow(Base other) { 1465 if (!super.equalsShallow(other)) 1466 return false; 1467 if (!(other instanceof SectionComponent)) 1468 return false; 1469 SectionComponent o = (SectionComponent) other; 1470 return compareValues(title, o.title, true) && compareValues(mode, o.mode, true); 1471 } 1472 1473 public boolean isEmpty() { 1474 return super.isEmpty() && (title == null || title.isEmpty()) && (code == null || code.isEmpty()) 1475 && (text == null || text.isEmpty()) && (mode == null || mode.isEmpty()) 1476 && (orderedBy == null || orderedBy.isEmpty()) && (entry == null || entry.isEmpty()) 1477 && (emptyReason == null || emptyReason.isEmpty()) && (section == null || section.isEmpty()); 1478 } 1479 1480 public String fhirType() { 1481 return "Composition.section"; 1482 1483 } 1484 1485 } 1486 1487 /** 1488 * Logical identifier for the composition, assigned when created. This 1489 * identifier stays constant as the composition is changed over time. 1490 */ 1491 @Child(name = "identifier", type = { 1492 Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true) 1493 @Description(shortDefinition = "Logical identifier of composition (version-independent)", formalDefinition = "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.") 1494 protected Identifier identifier; 1495 1496 /** 1497 * The composition editing time, when the composition was last logically changed 1498 * by the author. 1499 */ 1500 @Child(name = "date", type = { DateTimeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 1501 @Description(shortDefinition = "Composition editing time", formalDefinition = "The composition editing time, when the composition was last logically changed by the author.") 1502 protected DateTimeType date; 1503 1504 /** 1505 * Specifies the particular kind of composition (e.g. History and Physical, 1506 * Discharge Summary, Progress Note). This usually equates to the purpose of 1507 * making the composition. 1508 */ 1509 @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true) 1510 @Description(shortDefinition = "Kind of composition (LOINC if possible)", formalDefinition = "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.") 1511 protected CodeableConcept type; 1512 1513 /** 1514 * A categorization for the type of the composition - helps for indexing and 1515 * searching. This may be implied by or derived from the code specified in the 1516 * Composition Type. 1517 */ 1518 @Child(name = "class", type = { 1519 CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 1520 @Description(shortDefinition = "Categorization of Composition", formalDefinition = "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.") 1521 protected CodeableConcept class_; 1522 1523 /** 1524 * Official human-readable label for the composition. 1525 */ 1526 @Child(name = "title", type = { StringType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true) 1527 @Description(shortDefinition = "Human Readable name/title", formalDefinition = "Official human-readable label for the composition.") 1528 protected StringType title; 1529 1530 /** 1531 * The workflow/clinical status of this composition. The status is a marker for 1532 * the clinical standing of the document. 1533 */ 1534 @Child(name = "status", type = { CodeType.class }, order = 5, min = 1, max = 1, modifier = true, summary = true) 1535 @Description(shortDefinition = "preliminary | final | amended | entered-in-error", formalDefinition = "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.") 1536 protected Enumeration<CompositionStatus> status; 1537 1538 /** 1539 * The code specifying the level of confidentiality of the Composition. 1540 */ 1541 @Child(name = "confidentiality", type = { 1542 CodeType.class }, order = 6, min = 0, max = 1, modifier = true, summary = true) 1543 @Description(shortDefinition = "As defined by affinity domain", formalDefinition = "The code specifying the level of confidentiality of the Composition.") 1544 protected CodeType confidentiality; 1545 1546 /** 1547 * Who or what the composition is about. The composition can be about a person, 1548 * (patient or healthcare practitioner), a device (e.g. a machine) or even a 1549 * group of subjects (such as a document about a herd of livestock, or a set of 1550 * patients that share a common exposure). 1551 */ 1552 @Child(name = "subject", type = {}, order = 7, min = 1, max = 1, modifier = false, summary = true) 1553 @Description(shortDefinition = "Who and/or what the composition is about", formalDefinition = "Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).") 1554 protected Reference subject; 1555 1556 /** 1557 * The actual object that is the target of the reference (Who or what the 1558 * composition is about. The composition can be about a person, (patient or 1559 * healthcare practitioner), a device (e.g. a machine) or even a group of 1560 * subjects (such as a document about a herd of livestock, or a set of patients 1561 * that share a common exposure).) 1562 */ 1563 protected Resource subjectTarget; 1564 1565 /** 1566 * Identifies who is responsible for the information in the composition, not 1567 * necessarily who typed it in. 1568 */ 1569 @Child(name = "author", type = { Practitioner.class, Device.class, Patient.class, 1570 RelatedPerson.class }, order = 8, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1571 @Description(shortDefinition = "Who and/or what authored the composition", formalDefinition = "Identifies who is responsible for the information in the composition, not necessarily who typed it in.") 1572 protected List<Reference> author; 1573 /** 1574 * The actual objects that are the target of the reference (Identifies who is 1575 * responsible for the information in the composition, not necessarily who typed 1576 * it in.) 1577 */ 1578 protected List<Resource> authorTarget; 1579 1580 /** 1581 * A participant who has attested to the accuracy of the composition/document. 1582 */ 1583 @Child(name = "attester", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1584 @Description(shortDefinition = "Attests to accuracy of composition", formalDefinition = "A participant who has attested to the accuracy of the composition/document.") 1585 protected List<CompositionAttesterComponent> attester; 1586 1587 /** 1588 * Identifies the organization or group who is responsible for ongoing 1589 * maintenance of and access to the composition/document information. 1590 */ 1591 @Child(name = "custodian", type = { 1592 Organization.class }, order = 10, min = 0, max = 1, modifier = false, summary = true) 1593 @Description(shortDefinition = "Organization which maintains the composition", formalDefinition = "Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.") 1594 protected Reference custodian; 1595 1596 /** 1597 * The actual object that is the target of the reference (Identifies the 1598 * organization or group who is responsible for ongoing maintenance of and 1599 * access to the composition/document information.) 1600 */ 1601 protected Organization custodianTarget; 1602 1603 /** 1604 * The clinical service, such as a colonoscopy or an appendectomy, being 1605 * documented. 1606 */ 1607 @Child(name = "event", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1608 @Description(shortDefinition = "The clinical service(s) being documented", formalDefinition = "The clinical service, such as a colonoscopy or an appendectomy, being documented.") 1609 protected List<CompositionEventComponent> event; 1610 1611 /** 1612 * Describes the clinical encounter or type of care this documentation is 1613 * associated with. 1614 */ 1615 @Child(name = "encounter", type = { Encounter.class }, order = 12, min = 0, max = 1, modifier = false, summary = true) 1616 @Description(shortDefinition = "Context of the Composition", formalDefinition = "Describes the clinical encounter or type of care this documentation is associated with.") 1617 protected Reference encounter; 1618 1619 /** 1620 * The actual object that is the target of the reference (Describes the clinical 1621 * encounter or type of care this documentation is associated with.) 1622 */ 1623 protected Encounter encounterTarget; 1624 1625 /** 1626 * The root of the sections that make up the composition. 1627 */ 1628 @Child(name = "section", type = {}, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1629 @Description(shortDefinition = "Composition is broken into sections", formalDefinition = "The root of the sections that make up the composition.") 1630 protected List<SectionComponent> section; 1631 1632 private static final long serialVersionUID = 2127852326L; 1633 1634 /* 1635 * Constructor 1636 */ 1637 public Composition() { 1638 super(); 1639 } 1640 1641 /* 1642 * Constructor 1643 */ 1644 public Composition(DateTimeType date, CodeableConcept type, StringType title, Enumeration<CompositionStatus> status, 1645 Reference subject) { 1646 super(); 1647 this.date = date; 1648 this.type = type; 1649 this.title = title; 1650 this.status = status; 1651 this.subject = subject; 1652 } 1653 1654 /** 1655 * @return {@link #identifier} (Logical identifier for the composition, assigned 1656 * when created. This identifier stays constant as the composition is 1657 * changed over time.) 1658 */ 1659 public Identifier getIdentifier() { 1660 if (this.identifier == null) 1661 if (Configuration.errorOnAutoCreate()) 1662 throw new Error("Attempt to auto-create Composition.identifier"); 1663 else if (Configuration.doAutoCreate()) 1664 this.identifier = new Identifier(); // cc 1665 return this.identifier; 1666 } 1667 1668 public boolean hasIdentifier() { 1669 return this.identifier != null && !this.identifier.isEmpty(); 1670 } 1671 1672 /** 1673 * @param value {@link #identifier} (Logical identifier for the composition, 1674 * assigned when created. This identifier stays constant as the 1675 * composition is changed over time.) 1676 */ 1677 public Composition setIdentifier(Identifier value) { 1678 this.identifier = value; 1679 return this; 1680 } 1681 1682 /** 1683 * @return {@link #date} (The composition editing time, when the composition was 1684 * last logically changed by the author.). This is the underlying object 1685 * with id, value and extensions. The accessor "getDate" gives direct 1686 * access to the value 1687 */ 1688 public DateTimeType getDateElement() { 1689 if (this.date == null) 1690 if (Configuration.errorOnAutoCreate()) 1691 throw new Error("Attempt to auto-create Composition.date"); 1692 else if (Configuration.doAutoCreate()) 1693 this.date = new DateTimeType(); // bb 1694 return this.date; 1695 } 1696 1697 public boolean hasDateElement() { 1698 return this.date != null && !this.date.isEmpty(); 1699 } 1700 1701 public boolean hasDate() { 1702 return this.date != null && !this.date.isEmpty(); 1703 } 1704 1705 /** 1706 * @param value {@link #date} (The composition editing time, when the 1707 * composition was last logically changed by the author.). This is 1708 * the underlying object with id, value and extensions. The 1709 * accessor "getDate" gives direct access to the value 1710 */ 1711 public Composition setDateElement(DateTimeType value) { 1712 this.date = value; 1713 return this; 1714 } 1715 1716 /** 1717 * @return The composition editing time, when the composition was last logically 1718 * changed by the author. 1719 */ 1720 public Date getDate() { 1721 return this.date == null ? null : this.date.getValue(); 1722 } 1723 1724 /** 1725 * @param value The composition editing time, when the composition was last 1726 * logically changed by the author. 1727 */ 1728 public Composition setDate(Date value) { 1729 if (this.date == null) 1730 this.date = new DateTimeType(); 1731 this.date.setValue(value); 1732 return this; 1733 } 1734 1735 /** 1736 * @return {@link #type} (Specifies the particular kind of composition (e.g. 1737 * History and Physical, Discharge Summary, Progress Note). This usually 1738 * equates to the purpose of making the composition.) 1739 */ 1740 public CodeableConcept getType() { 1741 if (this.type == null) 1742 if (Configuration.errorOnAutoCreate()) 1743 throw new Error("Attempt to auto-create Composition.type"); 1744 else if (Configuration.doAutoCreate()) 1745 this.type = new CodeableConcept(); // cc 1746 return this.type; 1747 } 1748 1749 public boolean hasType() { 1750 return this.type != null && !this.type.isEmpty(); 1751 } 1752 1753 /** 1754 * @param value {@link #type} (Specifies the particular kind of composition 1755 * (e.g. History and Physical, Discharge Summary, Progress Note). 1756 * This usually equates to the purpose of making the composition.) 1757 */ 1758 public Composition setType(CodeableConcept value) { 1759 this.type = value; 1760 return this; 1761 } 1762 1763 /** 1764 * @return {@link #class_} (A categorization for the type of the composition - 1765 * helps for indexing and searching. This may be implied by or derived 1766 * from the code specified in the Composition Type.) 1767 */ 1768 public CodeableConcept getClass_() { 1769 if (this.class_ == null) 1770 if (Configuration.errorOnAutoCreate()) 1771 throw new Error("Attempt to auto-create Composition.class_"); 1772 else if (Configuration.doAutoCreate()) 1773 this.class_ = new CodeableConcept(); // cc 1774 return this.class_; 1775 } 1776 1777 public boolean hasClass_() { 1778 return this.class_ != null && !this.class_.isEmpty(); 1779 } 1780 1781 /** 1782 * @param value {@link #class_} (A categorization for the type of the 1783 * composition - helps for indexing and searching. This may be 1784 * implied by or derived from the code specified in the Composition 1785 * Type.) 1786 */ 1787 public Composition setClass_(CodeableConcept value) { 1788 this.class_ = value; 1789 return this; 1790 } 1791 1792 /** 1793 * @return {@link #title} (Official human-readable label for the composition.). 1794 * This is the underlying object with id, value and extensions. The 1795 * accessor "getTitle" gives direct access to the value 1796 */ 1797 public StringType getTitleElement() { 1798 if (this.title == null) 1799 if (Configuration.errorOnAutoCreate()) 1800 throw new Error("Attempt to auto-create Composition.title"); 1801 else if (Configuration.doAutoCreate()) 1802 this.title = new StringType(); // bb 1803 return this.title; 1804 } 1805 1806 public boolean hasTitleElement() { 1807 return this.title != null && !this.title.isEmpty(); 1808 } 1809 1810 public boolean hasTitle() { 1811 return this.title != null && !this.title.isEmpty(); 1812 } 1813 1814 /** 1815 * @param value {@link #title} (Official human-readable label for the 1816 * composition.). This is the underlying object with id, value and 1817 * extensions. The accessor "getTitle" gives direct access to the 1818 * value 1819 */ 1820 public Composition setTitleElement(StringType value) { 1821 this.title = value; 1822 return this; 1823 } 1824 1825 /** 1826 * @return Official human-readable label for the composition. 1827 */ 1828 public String getTitle() { 1829 return this.title == null ? null : this.title.getValue(); 1830 } 1831 1832 /** 1833 * @param value Official human-readable label for the composition. 1834 */ 1835 public Composition setTitle(String value) { 1836 if (this.title == null) 1837 this.title = new StringType(); 1838 this.title.setValue(value); 1839 return this; 1840 } 1841 1842 /** 1843 * @return {@link #status} (The workflow/clinical status of this composition. 1844 * The status is a marker for the clinical standing of the document.). 1845 * This is the underlying object with id, value and extensions. The 1846 * accessor "getStatus" gives direct access to the value 1847 */ 1848 public Enumeration<CompositionStatus> getStatusElement() { 1849 if (this.status == null) 1850 if (Configuration.errorOnAutoCreate()) 1851 throw new Error("Attempt to auto-create Composition.status"); 1852 else if (Configuration.doAutoCreate()) 1853 this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); // bb 1854 return this.status; 1855 } 1856 1857 public boolean hasStatusElement() { 1858 return this.status != null && !this.status.isEmpty(); 1859 } 1860 1861 public boolean hasStatus() { 1862 return this.status != null && !this.status.isEmpty(); 1863 } 1864 1865 /** 1866 * @param value {@link #status} (The workflow/clinical status of this 1867 * composition. The status is a marker for the clinical standing of 1868 * the document.). This is the underlying object with id, value and 1869 * extensions. The accessor "getStatus" gives direct access to the 1870 * value 1871 */ 1872 public Composition setStatusElement(Enumeration<CompositionStatus> value) { 1873 this.status = value; 1874 return this; 1875 } 1876 1877 /** 1878 * @return The workflow/clinical status of this composition. The status is a 1879 * marker for the clinical standing of the document. 1880 */ 1881 public CompositionStatus getStatus() { 1882 return this.status == null ? null : this.status.getValue(); 1883 } 1884 1885 /** 1886 * @param value The workflow/clinical status of this composition. The status is 1887 * a marker for the clinical standing of the document. 1888 */ 1889 public Composition setStatus(CompositionStatus value) { 1890 if (this.status == null) 1891 this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); 1892 this.status.setValue(value); 1893 return this; 1894 } 1895 1896 /** 1897 * @return {@link #confidentiality} (The code specifying the level of 1898 * confidentiality of the Composition.). This is the underlying object 1899 * with id, value and extensions. The accessor "getConfidentiality" 1900 * gives direct access to the value 1901 */ 1902 public CodeType getConfidentialityElement() { 1903 if (this.confidentiality == null) 1904 if (Configuration.errorOnAutoCreate()) 1905 throw new Error("Attempt to auto-create Composition.confidentiality"); 1906 else if (Configuration.doAutoCreate()) 1907 this.confidentiality = new CodeType(); // bb 1908 return this.confidentiality; 1909 } 1910 1911 public boolean hasConfidentialityElement() { 1912 return this.confidentiality != null && !this.confidentiality.isEmpty(); 1913 } 1914 1915 public boolean hasConfidentiality() { 1916 return this.confidentiality != null && !this.confidentiality.isEmpty(); 1917 } 1918 1919 /** 1920 * @param value {@link #confidentiality} (The code specifying the level of 1921 * confidentiality of the Composition.). This is the underlying 1922 * object with id, value and extensions. The accessor 1923 * "getConfidentiality" gives direct access to the value 1924 */ 1925 public Composition setConfidentialityElement(CodeType value) { 1926 this.confidentiality = value; 1927 return this; 1928 } 1929 1930 /** 1931 * @return The code specifying the level of confidentiality of the Composition. 1932 */ 1933 public String getConfidentiality() { 1934 return this.confidentiality == null ? null : this.confidentiality.getValue(); 1935 } 1936 1937 /** 1938 * @param value The code specifying the level of confidentiality of the 1939 * Composition. 1940 */ 1941 public Composition setConfidentiality(String value) { 1942 if (Utilities.noString(value)) 1943 this.confidentiality = null; 1944 else { 1945 if (this.confidentiality == null) 1946 this.confidentiality = new CodeType(); 1947 this.confidentiality.setValue(value); 1948 } 1949 return this; 1950 } 1951 1952 /** 1953 * @return {@link #subject} (Who or what the composition is about. The 1954 * composition can be about a person, (patient or healthcare 1955 * practitioner), a device (e.g. a machine) or even a group of subjects 1956 * (such as a document about a herd of livestock, or a set of patients 1957 * that share a common exposure).) 1958 */ 1959 public Reference getSubject() { 1960 if (this.subject == null) 1961 if (Configuration.errorOnAutoCreate()) 1962 throw new Error("Attempt to auto-create Composition.subject"); 1963 else if (Configuration.doAutoCreate()) 1964 this.subject = new Reference(); // cc 1965 return this.subject; 1966 } 1967 1968 public boolean hasSubject() { 1969 return this.subject != null && !this.subject.isEmpty(); 1970 } 1971 1972 /** 1973 * @param value {@link #subject} (Who or what the composition is about. The 1974 * composition can be about a person, (patient or healthcare 1975 * practitioner), a device (e.g. a machine) or even a group of 1976 * subjects (such as a document about a herd of livestock, or a set 1977 * of patients that share a common exposure).) 1978 */ 1979 public Composition setSubject(Reference value) { 1980 this.subject = value; 1981 return this; 1982 } 1983 1984 /** 1985 * @return {@link #subject} The actual object that is the target of the 1986 * reference. The reference library doesn't populate this, but you can 1987 * use it to hold the resource if you resolve it. (Who or what the 1988 * composition is about. The composition can be about a person, (patient 1989 * or healthcare practitioner), a device (e.g. a machine) or even a 1990 * group of subjects (such as a document about a herd of livestock, or a 1991 * set of patients that share a common exposure).) 1992 */ 1993 public Resource getSubjectTarget() { 1994 return this.subjectTarget; 1995 } 1996 1997 /** 1998 * @param value {@link #subject} The actual object that is the target of the 1999 * reference. The reference library doesn't use these, but you can 2000 * use it to hold the resource if you resolve it. (Who or what the 2001 * composition is about. The composition can be about a person, 2002 * (patient or healthcare practitioner), a device (e.g. a machine) 2003 * or even a group of subjects (such as a document about a herd of 2004 * livestock, or a set of patients that share a common exposure).) 2005 */ 2006 public Composition setSubjectTarget(Resource value) { 2007 this.subjectTarget = value; 2008 return this; 2009 } 2010 2011 /** 2012 * @return {@link #author} (Identifies who is responsible for the information in 2013 * the composition, not necessarily who typed it in.) 2014 */ 2015 public List<Reference> getAuthor() { 2016 if (this.author == null) 2017 this.author = new ArrayList<Reference>(); 2018 return this.author; 2019 } 2020 2021 public boolean hasAuthor() { 2022 if (this.author == null) 2023 return false; 2024 for (Reference item : this.author) 2025 if (!item.isEmpty()) 2026 return true; 2027 return false; 2028 } 2029 2030 /** 2031 * @return {@link #author} (Identifies who is responsible for the information in 2032 * the composition, not necessarily who typed it in.) 2033 */ 2034 // syntactic sugar 2035 public Reference addAuthor() { // 3 2036 Reference t = new Reference(); 2037 if (this.author == null) 2038 this.author = new ArrayList<Reference>(); 2039 this.author.add(t); 2040 return t; 2041 } 2042 2043 // syntactic sugar 2044 public Composition addAuthor(Reference t) { // 3 2045 if (t == null) 2046 return this; 2047 if (this.author == null) 2048 this.author = new ArrayList<Reference>(); 2049 this.author.add(t); 2050 return this; 2051 } 2052 2053 /** 2054 * @return {@link #author} (The actual objects that are the target of the 2055 * reference. The reference library doesn't populate this, but you can 2056 * use this to hold the resources if you resolvethemt. Identifies who is 2057 * responsible for the information in the composition, not necessarily 2058 * who typed it in.) 2059 */ 2060 public List<Resource> getAuthorTarget() { 2061 if (this.authorTarget == null) 2062 this.authorTarget = new ArrayList<Resource>(); 2063 return this.authorTarget; 2064 } 2065 2066 /** 2067 * @return {@link #attester} (A participant who has attested to the accuracy of 2068 * the composition/document.) 2069 */ 2070 public List<CompositionAttesterComponent> getAttester() { 2071 if (this.attester == null) 2072 this.attester = new ArrayList<CompositionAttesterComponent>(); 2073 return this.attester; 2074 } 2075 2076 public boolean hasAttester() { 2077 if (this.attester == null) 2078 return false; 2079 for (CompositionAttesterComponent item : this.attester) 2080 if (!item.isEmpty()) 2081 return true; 2082 return false; 2083 } 2084 2085 /** 2086 * @return {@link #attester} (A participant who has attested to the accuracy of 2087 * the composition/document.) 2088 */ 2089 // syntactic sugar 2090 public CompositionAttesterComponent addAttester() { // 3 2091 CompositionAttesterComponent t = new CompositionAttesterComponent(); 2092 if (this.attester == null) 2093 this.attester = new ArrayList<CompositionAttesterComponent>(); 2094 this.attester.add(t); 2095 return t; 2096 } 2097 2098 // syntactic sugar 2099 public Composition addAttester(CompositionAttesterComponent t) { // 3 2100 if (t == null) 2101 return this; 2102 if (this.attester == null) 2103 this.attester = new ArrayList<CompositionAttesterComponent>(); 2104 this.attester.add(t); 2105 return this; 2106 } 2107 2108 /** 2109 * @return {@link #custodian} (Identifies the organization or group who is 2110 * responsible for ongoing maintenance of and access to the 2111 * composition/document information.) 2112 */ 2113 public Reference getCustodian() { 2114 if (this.custodian == null) 2115 if (Configuration.errorOnAutoCreate()) 2116 throw new Error("Attempt to auto-create Composition.custodian"); 2117 else if (Configuration.doAutoCreate()) 2118 this.custodian = new Reference(); // cc 2119 return this.custodian; 2120 } 2121 2122 public boolean hasCustodian() { 2123 return this.custodian != null && !this.custodian.isEmpty(); 2124 } 2125 2126 /** 2127 * @param value {@link #custodian} (Identifies the organization or group who is 2128 * responsible for ongoing maintenance of and access to the 2129 * composition/document information.) 2130 */ 2131 public Composition setCustodian(Reference value) { 2132 this.custodian = value; 2133 return this; 2134 } 2135 2136 /** 2137 * @return {@link #custodian} The actual object that is the target of the 2138 * reference. The reference library doesn't populate this, but you can 2139 * use it to hold the resource if you resolve it. (Identifies the 2140 * organization or group who is responsible for ongoing maintenance of 2141 * and access to the composition/document information.) 2142 */ 2143 public Organization getCustodianTarget() { 2144 if (this.custodianTarget == null) 2145 if (Configuration.errorOnAutoCreate()) 2146 throw new Error("Attempt to auto-create Composition.custodian"); 2147 else if (Configuration.doAutoCreate()) 2148 this.custodianTarget = new Organization(); // aa 2149 return this.custodianTarget; 2150 } 2151 2152 /** 2153 * @param value {@link #custodian} The actual object that is the target of the 2154 * reference. The reference library doesn't use these, but you can 2155 * use it to hold the resource if you resolve it. (Identifies the 2156 * organization or group who is responsible for ongoing maintenance 2157 * of and access to the composition/document information.) 2158 */ 2159 public Composition setCustodianTarget(Organization value) { 2160 this.custodianTarget = value; 2161 return this; 2162 } 2163 2164 /** 2165 * @return {@link #event} (The clinical service, such as a colonoscopy or an 2166 * appendectomy, being documented.) 2167 */ 2168 public List<CompositionEventComponent> getEvent() { 2169 if (this.event == null) 2170 this.event = new ArrayList<CompositionEventComponent>(); 2171 return this.event; 2172 } 2173 2174 public boolean hasEvent() { 2175 if (this.event == null) 2176 return false; 2177 for (CompositionEventComponent item : this.event) 2178 if (!item.isEmpty()) 2179 return true; 2180 return false; 2181 } 2182 2183 /** 2184 * @return {@link #event} (The clinical service, such as a colonoscopy or an 2185 * appendectomy, being documented.) 2186 */ 2187 // syntactic sugar 2188 public CompositionEventComponent addEvent() { // 3 2189 CompositionEventComponent t = new CompositionEventComponent(); 2190 if (this.event == null) 2191 this.event = new ArrayList<CompositionEventComponent>(); 2192 this.event.add(t); 2193 return t; 2194 } 2195 2196 // syntactic sugar 2197 public Composition addEvent(CompositionEventComponent t) { // 3 2198 if (t == null) 2199 return this; 2200 if (this.event == null) 2201 this.event = new ArrayList<CompositionEventComponent>(); 2202 this.event.add(t); 2203 return this; 2204 } 2205 2206 /** 2207 * @return {@link #encounter} (Describes the clinical encounter or type of care 2208 * this documentation is associated with.) 2209 */ 2210 public Reference getEncounter() { 2211 if (this.encounter == null) 2212 if (Configuration.errorOnAutoCreate()) 2213 throw new Error("Attempt to auto-create Composition.encounter"); 2214 else if (Configuration.doAutoCreate()) 2215 this.encounter = new Reference(); // cc 2216 return this.encounter; 2217 } 2218 2219 public boolean hasEncounter() { 2220 return this.encounter != null && !this.encounter.isEmpty(); 2221 } 2222 2223 /** 2224 * @param value {@link #encounter} (Describes the clinical encounter or type of 2225 * care this documentation is associated with.) 2226 */ 2227 public Composition setEncounter(Reference value) { 2228 this.encounter = value; 2229 return this; 2230 } 2231 2232 /** 2233 * @return {@link #encounter} The actual object that is the target of the 2234 * reference. The reference library doesn't populate this, but you can 2235 * use it to hold the resource if you resolve it. (Describes the 2236 * clinical encounter or type of care this documentation is associated 2237 * with.) 2238 */ 2239 public Encounter getEncounterTarget() { 2240 if (this.encounterTarget == null) 2241 if (Configuration.errorOnAutoCreate()) 2242 throw new Error("Attempt to auto-create Composition.encounter"); 2243 else if (Configuration.doAutoCreate()) 2244 this.encounterTarget = new Encounter(); // aa 2245 return this.encounterTarget; 2246 } 2247 2248 /** 2249 * @param value {@link #encounter} The actual object that is the target of the 2250 * reference. The reference library doesn't use these, but you can 2251 * use it to hold the resource if you resolve it. (Describes the 2252 * clinical encounter or type of care this documentation is 2253 * associated with.) 2254 */ 2255 public Composition setEncounterTarget(Encounter value) { 2256 this.encounterTarget = value; 2257 return this; 2258 } 2259 2260 /** 2261 * @return {@link #section} (The root of the sections that make up the 2262 * composition.) 2263 */ 2264 public List<SectionComponent> getSection() { 2265 if (this.section == null) 2266 this.section = new ArrayList<SectionComponent>(); 2267 return this.section; 2268 } 2269 2270 public boolean hasSection() { 2271 if (this.section == null) 2272 return false; 2273 for (SectionComponent item : this.section) 2274 if (!item.isEmpty()) 2275 return true; 2276 return false; 2277 } 2278 2279 /** 2280 * @return {@link #section} (The root of the sections that make up the 2281 * composition.) 2282 */ 2283 // syntactic sugar 2284 public SectionComponent addSection() { // 3 2285 SectionComponent t = new SectionComponent(); 2286 if (this.section == null) 2287 this.section = new ArrayList<SectionComponent>(); 2288 this.section.add(t); 2289 return t; 2290 } 2291 2292 // syntactic sugar 2293 public Composition addSection(SectionComponent t) { // 3 2294 if (t == null) 2295 return this; 2296 if (this.section == null) 2297 this.section = new ArrayList<SectionComponent>(); 2298 this.section.add(t); 2299 return this; 2300 } 2301 2302 protected void listChildren(List<Property> childrenList) { 2303 super.listChildren(childrenList); 2304 childrenList.add(new Property("identifier", "Identifier", 2305 "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 2306 0, java.lang.Integer.MAX_VALUE, identifier)); 2307 childrenList.add(new Property("date", "dateTime", 2308 "The composition editing time, when the composition was last logically changed by the author.", 0, 2309 java.lang.Integer.MAX_VALUE, date)); 2310 childrenList.add(new Property("type", "CodeableConcept", 2311 "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 2312 0, java.lang.Integer.MAX_VALUE, type)); 2313 childrenList.add(new Property("class", "CodeableConcept", 2314 "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 2315 0, java.lang.Integer.MAX_VALUE, class_)); 2316 childrenList.add(new Property("title", "string", "Official human-readable label for the composition.", 0, 2317 java.lang.Integer.MAX_VALUE, title)); 2318 childrenList.add(new Property("status", "code", 2319 "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 2320 0, java.lang.Integer.MAX_VALUE, status)); 2321 childrenList.add( 2322 new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 2323 0, java.lang.Integer.MAX_VALUE, confidentiality)); 2324 childrenList.add(new Property("subject", "Reference(Any)", 2325 "Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).", 2326 0, java.lang.Integer.MAX_VALUE, subject)); 2327 childrenList.add(new Property("author", "Reference(Practitioner|Device|Patient|RelatedPerson)", 2328 "Identifies who is responsible for the information in the composition, not necessarily who typed it in.", 0, 2329 java.lang.Integer.MAX_VALUE, author)); 2330 childrenList 2331 .add(new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 2332 0, java.lang.Integer.MAX_VALUE, attester)); 2333 childrenList.add(new Property("custodian", "Reference(Organization)", 2334 "Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.", 2335 0, java.lang.Integer.MAX_VALUE, custodian)); 2336 childrenList.add( 2337 new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 2338 0, java.lang.Integer.MAX_VALUE, event)); 2339 childrenList.add(new Property("encounter", "Reference(Encounter)", 2340 "Describes the clinical encounter or type of care this documentation is associated with.", 0, 2341 java.lang.Integer.MAX_VALUE, encounter)); 2342 childrenList.add(new Property("section", "", "The root of the sections that make up the composition.", 0, 2343 java.lang.Integer.MAX_VALUE, section)); 2344 } 2345 2346 @Override 2347 public void setProperty(String name, Base value) throws FHIRException { 2348 if (name.equals("identifier")) 2349 this.identifier = castToIdentifier(value); // Identifier 2350 else if (name.equals("date")) 2351 this.date = castToDateTime(value); // DateTimeType 2352 else if (name.equals("type")) 2353 this.type = castToCodeableConcept(value); // CodeableConcept 2354 else if (name.equals("class")) 2355 this.class_ = castToCodeableConcept(value); // CodeableConcept 2356 else if (name.equals("title")) 2357 this.title = castToString(value); // StringType 2358 else if (name.equals("status")) 2359 this.status = new CompositionStatusEnumFactory().fromType(value); // Enumeration<CompositionStatus> 2360 else if (name.equals("confidentiality")) 2361 this.confidentiality = castToCode(value); // CodeType 2362 else if (name.equals("subject")) 2363 this.subject = castToReference(value); // Reference 2364 else if (name.equals("author")) 2365 this.getAuthor().add(castToReference(value)); 2366 else if (name.equals("attester")) 2367 this.getAttester().add((CompositionAttesterComponent) value); 2368 else if (name.equals("custodian")) 2369 this.custodian = castToReference(value); // Reference 2370 else if (name.equals("event")) 2371 this.getEvent().add((CompositionEventComponent) value); 2372 else if (name.equals("encounter")) 2373 this.encounter = castToReference(value); // Reference 2374 else if (name.equals("section")) 2375 this.getSection().add((SectionComponent) value); 2376 else 2377 super.setProperty(name, value); 2378 } 2379 2380 @Override 2381 public Base addChild(String name) throws FHIRException { 2382 if (name.equals("identifier")) { 2383 this.identifier = new Identifier(); 2384 return this.identifier; 2385 } else if (name.equals("date")) { 2386 throw new FHIRException("Cannot call addChild on a singleton property Composition.date"); 2387 } else if (name.equals("type")) { 2388 this.type = new CodeableConcept(); 2389 return this.type; 2390 } else if (name.equals("class")) { 2391 this.class_ = new CodeableConcept(); 2392 return this.class_; 2393 } else if (name.equals("title")) { 2394 throw new FHIRException("Cannot call addChild on a singleton property Composition.title"); 2395 } else if (name.equals("status")) { 2396 throw new FHIRException("Cannot call addChild on a singleton property Composition.status"); 2397 } else if (name.equals("confidentiality")) { 2398 throw new FHIRException("Cannot call addChild on a singleton property Composition.confidentiality"); 2399 } else if (name.equals("subject")) { 2400 this.subject = new Reference(); 2401 return this.subject; 2402 } else if (name.equals("author")) { 2403 return addAuthor(); 2404 } else if (name.equals("attester")) { 2405 return addAttester(); 2406 } else if (name.equals("custodian")) { 2407 this.custodian = new Reference(); 2408 return this.custodian; 2409 } else if (name.equals("event")) { 2410 return addEvent(); 2411 } else if (name.equals("encounter")) { 2412 this.encounter = new Reference(); 2413 return this.encounter; 2414 } else if (name.equals("section")) { 2415 return addSection(); 2416 } else 2417 return super.addChild(name); 2418 } 2419 2420 public String fhirType() { 2421 return "Composition"; 2422 2423 } 2424 2425 public Composition copy() { 2426 Composition dst = new Composition(); 2427 copyValues(dst); 2428 dst.identifier = identifier == null ? null : identifier.copy(); 2429 dst.date = date == null ? null : date.copy(); 2430 dst.type = type == null ? null : type.copy(); 2431 dst.class_ = class_ == null ? null : class_.copy(); 2432 dst.title = title == null ? null : title.copy(); 2433 dst.status = status == null ? null : status.copy(); 2434 dst.confidentiality = confidentiality == null ? null : confidentiality.copy(); 2435 dst.subject = subject == null ? null : subject.copy(); 2436 if (author != null) { 2437 dst.author = new ArrayList<Reference>(); 2438 for (Reference i : author) 2439 dst.author.add(i.copy()); 2440 } 2441 ; 2442 if (attester != null) { 2443 dst.attester = new ArrayList<CompositionAttesterComponent>(); 2444 for (CompositionAttesterComponent i : attester) 2445 dst.attester.add(i.copy()); 2446 } 2447 ; 2448 dst.custodian = custodian == null ? null : custodian.copy(); 2449 if (event != null) { 2450 dst.event = new ArrayList<CompositionEventComponent>(); 2451 for (CompositionEventComponent i : event) 2452 dst.event.add(i.copy()); 2453 } 2454 ; 2455 dst.encounter = encounter == null ? null : encounter.copy(); 2456 if (section != null) { 2457 dst.section = new ArrayList<SectionComponent>(); 2458 for (SectionComponent i : section) 2459 dst.section.add(i.copy()); 2460 } 2461 ; 2462 return dst; 2463 } 2464 2465 protected Composition typedCopy() { 2466 return copy(); 2467 } 2468 2469 @Override 2470 public boolean equalsDeep(Base other) { 2471 if (!super.equalsDeep(other)) 2472 return false; 2473 if (!(other instanceof Composition)) 2474 return false; 2475 Composition o = (Composition) other; 2476 return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) 2477 && compareDeep(type, o.type, true) && compareDeep(class_, o.class_, true) && compareDeep(title, o.title, true) 2478 && compareDeep(status, o.status, true) && compareDeep(confidentiality, o.confidentiality, true) 2479 && compareDeep(subject, o.subject, true) && compareDeep(author, o.author, true) 2480 && compareDeep(attester, o.attester, true) && compareDeep(custodian, o.custodian, true) 2481 && compareDeep(event, o.event, true) && compareDeep(encounter, o.encounter, true) 2482 && compareDeep(section, o.section, true); 2483 } 2484 2485 @Override 2486 public boolean equalsShallow(Base other) { 2487 if (!super.equalsShallow(other)) 2488 return false; 2489 if (!(other instanceof Composition)) 2490 return false; 2491 Composition o = (Composition) other; 2492 return compareValues(date, o.date, true) && compareValues(title, o.title, true) 2493 && compareValues(status, o.status, true) && compareValues(confidentiality, o.confidentiality, true); 2494 } 2495 2496 public boolean isEmpty() { 2497 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty()) 2498 && (type == null || type.isEmpty()) && (class_ == null || class_.isEmpty()) 2499 && (title == null || title.isEmpty()) && (status == null || status.isEmpty()) 2500 && (confidentiality == null || confidentiality.isEmpty()) && (subject == null || subject.isEmpty()) 2501 && (author == null || author.isEmpty()) && (attester == null || attester.isEmpty()) 2502 && (custodian == null || custodian.isEmpty()) && (event == null || event.isEmpty()) 2503 && (encounter == null || encounter.isEmpty()) && (section == null || section.isEmpty()); 2504 } 2505 2506 @Override 2507 public ResourceType getResourceType() { 2508 return ResourceType.Composition; 2509 } 2510 2511 @SearchParamDefinition(name = "date", path = "Composition.date", description = "Composition editing time", type = "date") 2512 public static final String SP_DATE = "date"; 2513 @SearchParamDefinition(name = "identifier", path = "Composition.identifier", description = "Logical identifier of composition (version-independent)", type = "token") 2514 public static final String SP_IDENTIFIER = "identifier"; 2515 @SearchParamDefinition(name = "period", path = "Composition.event.period", description = "The period covered by the documentation", type = "date") 2516 public static final String SP_PERIOD = "period"; 2517 @SearchParamDefinition(name = "subject", path = "Composition.subject", description = "Who and/or what the composition is about", type = "reference") 2518 public static final String SP_SUBJECT = "subject"; 2519 @SearchParamDefinition(name = "author", path = "Composition.author", description = "Who and/or what authored the composition", type = "reference") 2520 public static final String SP_AUTHOR = "author"; 2521 @SearchParamDefinition(name = "confidentiality", path = "Composition.confidentiality", description = "As defined by affinity domain", type = "token") 2522 public static final String SP_CONFIDENTIALITY = "confidentiality"; 2523 @SearchParamDefinition(name = "section", path = "Composition.section.code", description = "Classification of section (recommended)", type = "token") 2524 public static final String SP_SECTION = "section"; 2525 @SearchParamDefinition(name = "encounter", path = "Composition.encounter", description = "Context of the Composition", type = "reference") 2526 public static final String SP_ENCOUNTER = "encounter"; 2527 @SearchParamDefinition(name = "type", path = "Composition.type", description = "Kind of composition (LOINC if possible)", type = "token") 2528 public static final String SP_TYPE = "type"; 2529 @SearchParamDefinition(name = "title", path = "Composition.title", description = "Human Readable name/title", type = "string") 2530 public static final String SP_TITLE = "title"; 2531 @SearchParamDefinition(name = "attester", path = "Composition.attester.party", description = "Who attested the composition", type = "reference") 2532 public static final String SP_ATTESTER = "attester"; 2533 @SearchParamDefinition(name = "entry", path = "Composition.section.entry", description = "A reference to data that supports this section", type = "reference") 2534 public static final String SP_ENTRY = "entry"; 2535 @SearchParamDefinition(name = "patient", path = "Composition.subject", description = "Who and/or what the composition is about", type = "reference") 2536 public static final String SP_PATIENT = "patient"; 2537 @SearchParamDefinition(name = "context", path = "Composition.event.code", description = "Code(s) that apply to the event being documented", type = "token") 2538 public static final String SP_CONTEXT = "context"; 2539 @SearchParamDefinition(name = "class", path = "Composition.class", description = "Categorization of Composition", type = "token") 2540 public static final String SP_CLASS = "class"; 2541 @SearchParamDefinition(name = "status", path = "Composition.status", description = "preliminary | final | amended | entered-in-error", type = "token") 2542 public static final String SP_STATUS = "status"; 2543 2544}