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