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