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