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