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