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