001package org.hl7.fhir.r5.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, \
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this \
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, \
016     this list of conditions and the following disclaimer in the documentation \
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
031  POSSIBILITY OF SUCH DAMAGE.
032  */
033
034// Generated on Mon, May 11, 2020 09:58+1000 for FHIR vcurrent
035
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r5.model.Enumerations.*;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.instance.model.api.ICompositeType;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
047import ca.uhn.fhir.model.api.annotation.Child;
048import ca.uhn.fhir.model.api.annotation.ChildOrder;
049import ca.uhn.fhir.model.api.annotation.Description;
050import ca.uhn.fhir.model.api.annotation.Block;
051
052/**
053 * A reference to a document of any kind for any purpose. While the term “document” implies a more narrow focus, for this resource this "document" encompasses *any* serialized object with a mime-type, it includes formal patient-centric documents (CDA), clinical notes, scanned paper, non-patient specific documents like policy text, as well as a photo, video, or audio recording acquired or used in healthcare.  The DocumentReference resource provides metadata about the document so that the document can be discovered and managed.  The actual content may be inline base64 encoded data or provided by direct reference.
054 */
055@ResourceDef(name="DocumentReference", profile="http://hl7.org/fhir/StructureDefinition/DocumentReference")
056public class DocumentReference extends DomainResource {
057
058    @Block()
059    public static class DocumentReferenceRelatesToComponent extends BackboneElement implements IBaseBackboneElement {
060        /**
061         * The type of relationship that this document has with anther document.
062         */
063        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
064        @Description(shortDefinition="replaces | transforms | signs | appends", formalDefinition="The type of relationship that this document has with anther document." )
065        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/document-relationship-type")
066        protected Enumeration<DocumentRelationshipType> code;
067
068        /**
069         * The target document of this relationship.
070         */
071        @Child(name = "target", type = {DocumentReference.class}, order=2, min=1, max=1, modifier=false, summary=true)
072        @Description(shortDefinition="Target of the relationship", formalDefinition="The target document of this relationship." )
073        protected Reference target;
074
075        private static final long serialVersionUID = 1212070475L;
076
077    /**
078     * Constructor
079     */
080      public DocumentReferenceRelatesToComponent() {
081        super();
082      }
083
084    /**
085     * Constructor
086     */
087      public DocumentReferenceRelatesToComponent(DocumentRelationshipType code, Reference target) {
088        super();
089        this.setCode(code);
090        this.setTarget(target);
091      }
092
093        /**
094         * @return {@link #code} (The type of relationship that this document has with anther document.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
095         */
096        public Enumeration<DocumentRelationshipType> getCodeElement() { 
097          if (this.code == null)
098            if (Configuration.errorOnAutoCreate())
099              throw new Error("Attempt to auto-create DocumentReferenceRelatesToComponent.code");
100            else if (Configuration.doAutoCreate())
101              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory()); // bb
102          return this.code;
103        }
104
105        public boolean hasCodeElement() { 
106          return this.code != null && !this.code.isEmpty();
107        }
108
109        public boolean hasCode() { 
110          return this.code != null && !this.code.isEmpty();
111        }
112
113        /**
114         * @param value {@link #code} (The type of relationship that this document has with anther document.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
115         */
116        public DocumentReferenceRelatesToComponent setCodeElement(Enumeration<DocumentRelationshipType> value) { 
117          this.code = value;
118          return this;
119        }
120
121        /**
122         * @return The type of relationship that this document has with anther document.
123         */
124        public DocumentRelationshipType getCode() { 
125          return this.code == null ? null : this.code.getValue();
126        }
127
128        /**
129         * @param value The type of relationship that this document has with anther document.
130         */
131        public DocumentReferenceRelatesToComponent setCode(DocumentRelationshipType value) { 
132            if (this.code == null)
133              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory());
134            this.code.setValue(value);
135          return this;
136        }
137
138        /**
139         * @return {@link #target} (The target document of this relationship.)
140         */
141        public Reference getTarget() { 
142          if (this.target == null)
143            if (Configuration.errorOnAutoCreate())
144              throw new Error("Attempt to auto-create DocumentReferenceRelatesToComponent.target");
145            else if (Configuration.doAutoCreate())
146              this.target = new Reference(); // cc
147          return this.target;
148        }
149
150        public boolean hasTarget() { 
151          return this.target != null && !this.target.isEmpty();
152        }
153
154        /**
155         * @param value {@link #target} (The target document of this relationship.)
156         */
157        public DocumentReferenceRelatesToComponent setTarget(Reference value) { 
158          this.target = value;
159          return this;
160        }
161
162        protected void listChildren(List<Property> children) {
163          super.listChildren(children);
164          children.add(new Property("code", "code", "The type of relationship that this document has with anther document.", 0, 1, code));
165          children.add(new Property("target", "Reference(DocumentReference)", "The target document of this relationship.", 0, 1, target));
166        }
167
168        @Override
169        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
170          switch (_hash) {
171          case 3059181: /*code*/  return new Property("code", "code", "The type of relationship that this document has with anther document.", 0, 1, code);
172          case -880905839: /*target*/  return new Property("target", "Reference(DocumentReference)", "The target document of this relationship.", 0, 1, target);
173          default: return super.getNamedProperty(_hash, _name, _checkValid);
174          }
175
176        }
177
178      @Override
179      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
180        switch (hash) {
181        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<DocumentRelationshipType>
182        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference
183        default: return super.getProperty(hash, name, checkValid);
184        }
185
186      }
187
188      @Override
189      public Base setProperty(int hash, String name, Base value) throws FHIRException {
190        switch (hash) {
191        case 3059181: // code
192          value = new DocumentRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
193          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
194          return value;
195        case -880905839: // target
196          this.target = TypeConvertor.castToReference(value); // Reference
197          return value;
198        default: return super.setProperty(hash, name, value);
199        }
200
201      }
202
203      @Override
204      public Base setProperty(String name, Base value) throws FHIRException {
205        if (name.equals("code")) {
206          value = new DocumentRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
207          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
208        } else if (name.equals("target")) {
209          this.target = TypeConvertor.castToReference(value); // Reference
210        } else
211          return super.setProperty(name, value);
212        return value;
213      }
214
215      @Override
216      public Base makeProperty(int hash, String name) throws FHIRException {
217        switch (hash) {
218        case 3059181:  return getCodeElement();
219        case -880905839:  return getTarget();
220        default: return super.makeProperty(hash, name);
221        }
222
223      }
224
225      @Override
226      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
227        switch (hash) {
228        case 3059181: /*code*/ return new String[] {"code"};
229        case -880905839: /*target*/ return new String[] {"Reference"};
230        default: return super.getTypesForProperty(hash, name);
231        }
232
233      }
234
235      @Override
236      public Base addChild(String name) throws FHIRException {
237        if (name.equals("code")) {
238          throw new FHIRException("Cannot call addChild on a primitive type DocumentReference.relatesTo.code");
239        }
240        else if (name.equals("target")) {
241          this.target = new Reference();
242          return this.target;
243        }
244        else
245          return super.addChild(name);
246      }
247
248      public DocumentReferenceRelatesToComponent copy() {
249        DocumentReferenceRelatesToComponent dst = new DocumentReferenceRelatesToComponent();
250        copyValues(dst);
251        return dst;
252      }
253
254      public void copyValues(DocumentReferenceRelatesToComponent dst) {
255        super.copyValues(dst);
256        dst.code = code == null ? null : code.copy();
257        dst.target = target == null ? null : target.copy();
258      }
259
260      @Override
261      public boolean equalsDeep(Base other_) {
262        if (!super.equalsDeep(other_))
263          return false;
264        if (!(other_ instanceof DocumentReferenceRelatesToComponent))
265          return false;
266        DocumentReferenceRelatesToComponent o = (DocumentReferenceRelatesToComponent) other_;
267        return compareDeep(code, o.code, true) && compareDeep(target, o.target, true);
268      }
269
270      @Override
271      public boolean equalsShallow(Base other_) {
272        if (!super.equalsShallow(other_))
273          return false;
274        if (!(other_ instanceof DocumentReferenceRelatesToComponent))
275          return false;
276        DocumentReferenceRelatesToComponent o = (DocumentReferenceRelatesToComponent) other_;
277        return compareValues(code, o.code, true);
278      }
279
280      public boolean isEmpty() {
281        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, target);
282      }
283
284  public String fhirType() {
285    return "DocumentReference.relatesTo";
286
287  }
288
289  }
290
291    @Block()
292    public static class DocumentReferenceContentComponent extends BackboneElement implements IBaseBackboneElement {
293        /**
294         * The document or URL of the document along with critical metadata to prove content has integrity.
295         */
296        @Child(name = "attachment", type = {Attachment.class}, order=1, min=1, max=1, modifier=false, summary=true)
297        @Description(shortDefinition="Where to access the document", formalDefinition="The document or URL of the document along with critical metadata to prove content has integrity." )
298        protected Attachment attachment;
299
300        /**
301         * An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.
302         */
303        @Child(name = "format", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
304        @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." )
305        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/formatcodes")
306        protected Coding format;
307
308        private static final long serialVersionUID = -1313860217L;
309
310    /**
311     * Constructor
312     */
313      public DocumentReferenceContentComponent() {
314        super();
315      }
316
317    /**
318     * Constructor
319     */
320      public DocumentReferenceContentComponent(Attachment attachment) {
321        super();
322        this.setAttachment(attachment);
323      }
324
325        /**
326         * @return {@link #attachment} (The document or URL of the document along with critical metadata to prove content has integrity.)
327         */
328        public Attachment getAttachment() { 
329          if (this.attachment == null)
330            if (Configuration.errorOnAutoCreate())
331              throw new Error("Attempt to auto-create DocumentReferenceContentComponent.attachment");
332            else if (Configuration.doAutoCreate())
333              this.attachment = new Attachment(); // cc
334          return this.attachment;
335        }
336
337        public boolean hasAttachment() { 
338          return this.attachment != null && !this.attachment.isEmpty();
339        }
340
341        /**
342         * @param value {@link #attachment} (The document or URL of the document along with critical metadata to prove content has integrity.)
343         */
344        public DocumentReferenceContentComponent setAttachment(Attachment value) { 
345          this.attachment = value;
346          return this;
347        }
348
349        /**
350         * @return {@link #format} (An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.)
351         */
352        public Coding getFormat() { 
353          if (this.format == null)
354            if (Configuration.errorOnAutoCreate())
355              throw new Error("Attempt to auto-create DocumentReferenceContentComponent.format");
356            else if (Configuration.doAutoCreate())
357              this.format = new Coding(); // cc
358          return this.format;
359        }
360
361        public boolean hasFormat() { 
362          return this.format != null && !this.format.isEmpty();
363        }
364
365        /**
366         * @param value {@link #format} (An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.)
367         */
368        public DocumentReferenceContentComponent setFormat(Coding value) { 
369          this.format = value;
370          return this;
371        }
372
373        protected void listChildren(List<Property> children) {
374          super.listChildren(children);
375          children.add(new Property("attachment", "Attachment", "The document or URL of the document along with critical metadata to prove content has integrity.", 0, 1, attachment));
376          children.add(new Property("format", "Coding", "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.", 0, 1, format));
377        }
378
379        @Override
380        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
381          switch (_hash) {
382          case -1963501277: /*attachment*/  return new Property("attachment", "Attachment", "The document or URL of the document along with critical metadata to prove content has integrity.", 0, 1, attachment);
383          case -1268779017: /*format*/  return new Property("format", "Coding", "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.", 0, 1, format);
384          default: return super.getNamedProperty(_hash, _name, _checkValid);
385          }
386
387        }
388
389      @Override
390      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
391        switch (hash) {
392        case -1963501277: /*attachment*/ return this.attachment == null ? new Base[0] : new Base[] {this.attachment}; // Attachment
393        case -1268779017: /*format*/ return this.format == null ? new Base[0] : new Base[] {this.format}; // Coding
394        default: return super.getProperty(hash, name, checkValid);
395        }
396
397      }
398
399      @Override
400      public Base setProperty(int hash, String name, Base value) throws FHIRException {
401        switch (hash) {
402        case -1963501277: // attachment
403          this.attachment = TypeConvertor.castToAttachment(value); // Attachment
404          return value;
405        case -1268779017: // format
406          this.format = TypeConvertor.castToCoding(value); // Coding
407          return value;
408        default: return super.setProperty(hash, name, value);
409        }
410
411      }
412
413      @Override
414      public Base setProperty(String name, Base value) throws FHIRException {
415        if (name.equals("attachment")) {
416          this.attachment = TypeConvertor.castToAttachment(value); // Attachment
417        } else if (name.equals("format")) {
418          this.format = TypeConvertor.castToCoding(value); // Coding
419        } else
420          return super.setProperty(name, value);
421        return value;
422      }
423
424      @Override
425      public Base makeProperty(int hash, String name) throws FHIRException {
426        switch (hash) {
427        case -1963501277:  return getAttachment();
428        case -1268779017:  return getFormat();
429        default: return super.makeProperty(hash, name);
430        }
431
432      }
433
434      @Override
435      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
436        switch (hash) {
437        case -1963501277: /*attachment*/ return new String[] {"Attachment"};
438        case -1268779017: /*format*/ return new String[] {"Coding"};
439        default: return super.getTypesForProperty(hash, name);
440        }
441
442      }
443
444      @Override
445      public Base addChild(String name) throws FHIRException {
446        if (name.equals("attachment")) {
447          this.attachment = new Attachment();
448          return this.attachment;
449        }
450        else if (name.equals("format")) {
451          this.format = new Coding();
452          return this.format;
453        }
454        else
455          return super.addChild(name);
456      }
457
458      public DocumentReferenceContentComponent copy() {
459        DocumentReferenceContentComponent dst = new DocumentReferenceContentComponent();
460        copyValues(dst);
461        return dst;
462      }
463
464      public void copyValues(DocumentReferenceContentComponent dst) {
465        super.copyValues(dst);
466        dst.attachment = attachment == null ? null : attachment.copy();
467        dst.format = format == null ? null : format.copy();
468      }
469
470      @Override
471      public boolean equalsDeep(Base other_) {
472        if (!super.equalsDeep(other_))
473          return false;
474        if (!(other_ instanceof DocumentReferenceContentComponent))
475          return false;
476        DocumentReferenceContentComponent o = (DocumentReferenceContentComponent) other_;
477        return compareDeep(attachment, o.attachment, true) && compareDeep(format, o.format, true);
478      }
479
480      @Override
481      public boolean equalsShallow(Base other_) {
482        if (!super.equalsShallow(other_))
483          return false;
484        if (!(other_ instanceof DocumentReferenceContentComponent))
485          return false;
486        DocumentReferenceContentComponent o = (DocumentReferenceContentComponent) other_;
487        return true;
488      }
489
490      public boolean isEmpty() {
491        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(attachment, format);
492      }
493
494  public String fhirType() {
495    return "DocumentReference.content";
496
497  }
498
499  }
500
501    @Block()
502    public static class DocumentReferenceContextComponent extends BackboneElement implements IBaseBackboneElement {
503        /**
504         * Describes the clinical encounter or type of care that the document content is associated with.
505         */
506        @Child(name = "encounter", type = {Encounter.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
507        @Description(shortDefinition="Context of the document  content", formalDefinition="Describes the clinical encounter or type of care that the document content is associated with." )
508        protected List<Reference> encounter;
509
510        /**
511         * 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 type Code, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.
512         */
513        @Child(name = "event", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
514        @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 type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act." )
515        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActCode")
516        protected List<CodeableConcept> event;
517
518        /**
519         * The time period over which the service that is described by the document was provided.
520         */
521        @Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
522        @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." )
523        protected Period period;
524
525        /**
526         * The kind of facility where the patient was seen.
527         */
528        @Child(name = "facilityType", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
529        @Description(shortDefinition="Kind of facility where patient was seen", formalDefinition="The kind of facility where the patient was seen." )
530        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-facilitycodes")
531        protected CodeableConcept facilityType;
532
533        /**
534         * This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.
535         */
536        @Child(name = "practiceSetting", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
537        @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." )
538        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-practice-codes")
539        protected CodeableConcept practiceSetting;
540
541        /**
542         * The Patient Information as known when the document was published. May be a reference to a version specific, or contained.
543         */
544        @Child(name = "sourcePatientInfo", type = {Patient.class}, order=6, min=0, max=1, modifier=false, summary=false)
545        @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." )
546        protected Reference sourcePatientInfo;
547
548        /**
549         * Related identifiers or resources associated with the DocumentReference.
550         */
551        @Child(name = "related", type = {Reference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
552        @Description(shortDefinition="Related identifiers or resources", formalDefinition="Related identifiers or resources associated with the DocumentReference." )
553        protected List<Reference> related;
554
555        /**
556         * A procedure that is fulfilled in whole or in part by the creation of this media.
557         */
558        @Child(name = "basedOn", type = {ServiceRequest.class, CarePlan.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
559        @Description(shortDefinition="Procedure that caused this media to be created", formalDefinition="A procedure that is fulfilled in whole or in part by the creation of this media." )
560        protected List<Reference> basedOn;
561
562        private static final long serialVersionUID = 1499534389L;
563
564    /**
565     * Constructor
566     */
567      public DocumentReferenceContextComponent() {
568        super();
569      }
570
571        /**
572         * @return {@link #encounter} (Describes the clinical encounter or type of care that the document content is associated with.)
573         */
574        public List<Reference> getEncounter() { 
575          if (this.encounter == null)
576            this.encounter = new ArrayList<Reference>();
577          return this.encounter;
578        }
579
580        /**
581         * @return Returns a reference to <code>this</code> for easy method chaining
582         */
583        public DocumentReferenceContextComponent setEncounter(List<Reference> theEncounter) { 
584          this.encounter = theEncounter;
585          return this;
586        }
587
588        public boolean hasEncounter() { 
589          if (this.encounter == null)
590            return false;
591          for (Reference item : this.encounter)
592            if (!item.isEmpty())
593              return true;
594          return false;
595        }
596
597        public Reference addEncounter() { //3
598          Reference t = new Reference();
599          if (this.encounter == null)
600            this.encounter = new ArrayList<Reference>();
601          this.encounter.add(t);
602          return t;
603        }
604
605        public DocumentReferenceContextComponent addEncounter(Reference t) { //3
606          if (t == null)
607            return this;
608          if (this.encounter == null)
609            this.encounter = new ArrayList<Reference>();
610          this.encounter.add(t);
611          return this;
612        }
613
614        /**
615         * @return The first repetition of repeating field {@link #encounter}, creating it if it does not already exist {3}
616         */
617        public Reference getEncounterFirstRep() { 
618          if (getEncounter().isEmpty()) {
619            addEncounter();
620          }
621          return getEncounter().get(0);
622        }
623
624        /**
625         * @return {@link #event} (This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.)
626         */
627        public List<CodeableConcept> getEvent() { 
628          if (this.event == null)
629            this.event = new ArrayList<CodeableConcept>();
630          return this.event;
631        }
632
633        /**
634         * @return Returns a reference to <code>this</code> for easy method chaining
635         */
636        public DocumentReferenceContextComponent setEvent(List<CodeableConcept> theEvent) { 
637          this.event = theEvent;
638          return this;
639        }
640
641        public boolean hasEvent() { 
642          if (this.event == null)
643            return false;
644          for (CodeableConcept item : this.event)
645            if (!item.isEmpty())
646              return true;
647          return false;
648        }
649
650        public CodeableConcept addEvent() { //3
651          CodeableConcept t = new CodeableConcept();
652          if (this.event == null)
653            this.event = new ArrayList<CodeableConcept>();
654          this.event.add(t);
655          return t;
656        }
657
658        public DocumentReferenceContextComponent addEvent(CodeableConcept t) { //3
659          if (t == null)
660            return this;
661          if (this.event == null)
662            this.event = new ArrayList<CodeableConcept>();
663          this.event.add(t);
664          return this;
665        }
666
667        /**
668         * @return The first repetition of repeating field {@link #event}, creating it if it does not already exist {3}
669         */
670        public CodeableConcept getEventFirstRep() { 
671          if (getEvent().isEmpty()) {
672            addEvent();
673          }
674          return getEvent().get(0);
675        }
676
677        /**
678         * @return {@link #period} (The time period over which the service that is described by the document was provided.)
679         */
680        public Period getPeriod() { 
681          if (this.period == null)
682            if (Configuration.errorOnAutoCreate())
683              throw new Error("Attempt to auto-create DocumentReferenceContextComponent.period");
684            else if (Configuration.doAutoCreate())
685              this.period = new Period(); // cc
686          return this.period;
687        }
688
689        public boolean hasPeriod() { 
690          return this.period != null && !this.period.isEmpty();
691        }
692
693        /**
694         * @param value {@link #period} (The time period over which the service that is described by the document was provided.)
695         */
696        public DocumentReferenceContextComponent setPeriod(Period value) { 
697          this.period = value;
698          return this;
699        }
700
701        /**
702         * @return {@link #facilityType} (The kind of facility where the patient was seen.)
703         */
704        public CodeableConcept getFacilityType() { 
705          if (this.facilityType == null)
706            if (Configuration.errorOnAutoCreate())
707              throw new Error("Attempt to auto-create DocumentReferenceContextComponent.facilityType");
708            else if (Configuration.doAutoCreate())
709              this.facilityType = new CodeableConcept(); // cc
710          return this.facilityType;
711        }
712
713        public boolean hasFacilityType() { 
714          return this.facilityType != null && !this.facilityType.isEmpty();
715        }
716
717        /**
718         * @param value {@link #facilityType} (The kind of facility where the patient was seen.)
719         */
720        public DocumentReferenceContextComponent setFacilityType(CodeableConcept value) { 
721          this.facilityType = value;
722          return this;
723        }
724
725        /**
726         * @return {@link #practiceSetting} (This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.)
727         */
728        public CodeableConcept getPracticeSetting() { 
729          if (this.practiceSetting == null)
730            if (Configuration.errorOnAutoCreate())
731              throw new Error("Attempt to auto-create DocumentReferenceContextComponent.practiceSetting");
732            else if (Configuration.doAutoCreate())
733              this.practiceSetting = new CodeableConcept(); // cc
734          return this.practiceSetting;
735        }
736
737        public boolean hasPracticeSetting() { 
738          return this.practiceSetting != null && !this.practiceSetting.isEmpty();
739        }
740
741        /**
742         * @param value {@link #practiceSetting} (This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.)
743         */
744        public DocumentReferenceContextComponent setPracticeSetting(CodeableConcept value) { 
745          this.practiceSetting = value;
746          return this;
747        }
748
749        /**
750         * @return {@link #sourcePatientInfo} (The Patient Information as known when the document was published. May be a reference to a version specific, or contained.)
751         */
752        public Reference getSourcePatientInfo() { 
753          if (this.sourcePatientInfo == null)
754            if (Configuration.errorOnAutoCreate())
755              throw new Error("Attempt to auto-create DocumentReferenceContextComponent.sourcePatientInfo");
756            else if (Configuration.doAutoCreate())
757              this.sourcePatientInfo = new Reference(); // cc
758          return this.sourcePatientInfo;
759        }
760
761        public boolean hasSourcePatientInfo() { 
762          return this.sourcePatientInfo != null && !this.sourcePatientInfo.isEmpty();
763        }
764
765        /**
766         * @param value {@link #sourcePatientInfo} (The Patient Information as known when the document was published. May be a reference to a version specific, or contained.)
767         */
768        public DocumentReferenceContextComponent setSourcePatientInfo(Reference value) { 
769          this.sourcePatientInfo = value;
770          return this;
771        }
772
773        /**
774         * @return {@link #related} (Related identifiers or resources associated with the DocumentReference.)
775         */
776        public List<Reference> getRelated() { 
777          if (this.related == null)
778            this.related = new ArrayList<Reference>();
779          return this.related;
780        }
781
782        /**
783         * @return Returns a reference to <code>this</code> for easy method chaining
784         */
785        public DocumentReferenceContextComponent setRelated(List<Reference> theRelated) { 
786          this.related = theRelated;
787          return this;
788        }
789
790        public boolean hasRelated() { 
791          if (this.related == null)
792            return false;
793          for (Reference item : this.related)
794            if (!item.isEmpty())
795              return true;
796          return false;
797        }
798
799        public Reference addRelated() { //3
800          Reference t = new Reference();
801          if (this.related == null)
802            this.related = new ArrayList<Reference>();
803          this.related.add(t);
804          return t;
805        }
806
807        public DocumentReferenceContextComponent addRelated(Reference t) { //3
808          if (t == null)
809            return this;
810          if (this.related == null)
811            this.related = new ArrayList<Reference>();
812          this.related.add(t);
813          return this;
814        }
815
816        /**
817         * @return The first repetition of repeating field {@link #related}, creating it if it does not already exist {3}
818         */
819        public Reference getRelatedFirstRep() { 
820          if (getRelated().isEmpty()) {
821            addRelated();
822          }
823          return getRelated().get(0);
824        }
825
826        /**
827         * @return {@link #basedOn} (A procedure that is fulfilled in whole or in part by the creation of this media.)
828         */
829        public List<Reference> getBasedOn() { 
830          if (this.basedOn == null)
831            this.basedOn = new ArrayList<Reference>();
832          return this.basedOn;
833        }
834
835        /**
836         * @return Returns a reference to <code>this</code> for easy method chaining
837         */
838        public DocumentReferenceContextComponent setBasedOn(List<Reference> theBasedOn) { 
839          this.basedOn = theBasedOn;
840          return this;
841        }
842
843        public boolean hasBasedOn() { 
844          if (this.basedOn == null)
845            return false;
846          for (Reference item : this.basedOn)
847            if (!item.isEmpty())
848              return true;
849          return false;
850        }
851
852        public Reference addBasedOn() { //3
853          Reference t = new Reference();
854          if (this.basedOn == null)
855            this.basedOn = new ArrayList<Reference>();
856          this.basedOn.add(t);
857          return t;
858        }
859
860        public DocumentReferenceContextComponent addBasedOn(Reference t) { //3
861          if (t == null)
862            return this;
863          if (this.basedOn == null)
864            this.basedOn = new ArrayList<Reference>();
865          this.basedOn.add(t);
866          return this;
867        }
868
869        /**
870         * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
871         */
872        public Reference getBasedOnFirstRep() { 
873          if (getBasedOn().isEmpty()) {
874            addBasedOn();
875          }
876          return getBasedOn().get(0);
877        }
878
879        protected void listChildren(List<Property> children) {
880          super.listChildren(children);
881          children.add(new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care that the document content is associated with.", 0, java.lang.Integer.MAX_VALUE, encounter));
882          children.add(new Property("event", "CodeableConcept", "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 0, java.lang.Integer.MAX_VALUE, event));
883          children.add(new Property("period", "Period", "The time period over which the service that is described by the document was provided.", 0, 1, period));
884          children.add(new Property("facilityType", "CodeableConcept", "The kind of facility where the patient was seen.", 0, 1, facilityType));
885          children.add(new Property("practiceSetting", "CodeableConcept", "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.", 0, 1, practiceSetting));
886          children.add(new Property("sourcePatientInfo", "Reference(Patient)", "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.", 0, 1, sourcePatientInfo));
887          children.add(new Property("related", "Reference(Any)", "Related identifiers or resources associated with the DocumentReference.", 0, java.lang.Integer.MAX_VALUE, related));
888          children.add(new Property("basedOn", "Reference(ServiceRequest|CarePlan)", "A procedure that is fulfilled in whole or in part by the creation of this media.", 0, java.lang.Integer.MAX_VALUE, basedOn));
889        }
890
891        @Override
892        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
893          switch (_hash) {
894          case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care that the document content is associated with.", 0, java.lang.Integer.MAX_VALUE, encounter);
895          case 96891546: /*event*/  return new Property("event", "CodeableConcept", "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 0, java.lang.Integer.MAX_VALUE, event);
896          case -991726143: /*period*/  return new Property("period", "Period", "The time period over which the service that is described by the document was provided.", 0, 1, period);
897          case 370698365: /*facilityType*/  return new Property("facilityType", "CodeableConcept", "The kind of facility where the patient was seen.", 0, 1, facilityType);
898          case 331373717: /*practiceSetting*/  return new Property("practiceSetting", "CodeableConcept", "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.", 0, 1, practiceSetting);
899          case 2031381048: /*sourcePatientInfo*/  return new Property("sourcePatientInfo", "Reference(Patient)", "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.", 0, 1, sourcePatientInfo);
900          case 1090493483: /*related*/  return new Property("related", "Reference(Any)", "Related identifiers or resources associated with the DocumentReference.", 0, java.lang.Integer.MAX_VALUE, related);
901          case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(ServiceRequest|CarePlan)", "A procedure that is fulfilled in whole or in part by the creation of this media.", 0, java.lang.Integer.MAX_VALUE, basedOn);
902          default: return super.getNamedProperty(_hash, _name, _checkValid);
903          }
904
905        }
906
907      @Override
908      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
909        switch (hash) {
910        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
911        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CodeableConcept
912        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
913        case 370698365: /*facilityType*/ return this.facilityType == null ? new Base[0] : new Base[] {this.facilityType}; // CodeableConcept
914        case 331373717: /*practiceSetting*/ return this.practiceSetting == null ? new Base[0] : new Base[] {this.practiceSetting}; // CodeableConcept
915        case 2031381048: /*sourcePatientInfo*/ return this.sourcePatientInfo == null ? new Base[0] : new Base[] {this.sourcePatientInfo}; // Reference
916        case 1090493483: /*related*/ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // Reference
917        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
918        default: return super.getProperty(hash, name, checkValid);
919        }
920
921      }
922
923      @Override
924      public Base setProperty(int hash, String name, Base value) throws FHIRException {
925        switch (hash) {
926        case 1524132147: // encounter
927          this.getEncounter().add(TypeConvertor.castToReference(value)); // Reference
928          return value;
929        case 96891546: // event
930          this.getEvent().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
931          return value;
932        case -991726143: // period
933          this.period = TypeConvertor.castToPeriod(value); // Period
934          return value;
935        case 370698365: // facilityType
936          this.facilityType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
937          return value;
938        case 331373717: // practiceSetting
939          this.practiceSetting = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
940          return value;
941        case 2031381048: // sourcePatientInfo
942          this.sourcePatientInfo = TypeConvertor.castToReference(value); // Reference
943          return value;
944        case 1090493483: // related
945          this.getRelated().add(TypeConvertor.castToReference(value)); // Reference
946          return value;
947        case -332612366: // basedOn
948          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
949          return value;
950        default: return super.setProperty(hash, name, value);
951        }
952
953      }
954
955      @Override
956      public Base setProperty(String name, Base value) throws FHIRException {
957        if (name.equals("encounter")) {
958          this.getEncounter().add(TypeConvertor.castToReference(value));
959        } else if (name.equals("event")) {
960          this.getEvent().add(TypeConvertor.castToCodeableConcept(value));
961        } else if (name.equals("period")) {
962          this.period = TypeConvertor.castToPeriod(value); // Period
963        } else if (name.equals("facilityType")) {
964          this.facilityType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
965        } else if (name.equals("practiceSetting")) {
966          this.practiceSetting = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
967        } else if (name.equals("sourcePatientInfo")) {
968          this.sourcePatientInfo = TypeConvertor.castToReference(value); // Reference
969        } else if (name.equals("related")) {
970          this.getRelated().add(TypeConvertor.castToReference(value));
971        } else if (name.equals("basedOn")) {
972          this.getBasedOn().add(TypeConvertor.castToReference(value));
973        } else
974          return super.setProperty(name, value);
975        return value;
976      }
977
978      @Override
979      public Base makeProperty(int hash, String name) throws FHIRException {
980        switch (hash) {
981        case 1524132147:  return addEncounter(); 
982        case 96891546:  return addEvent(); 
983        case -991726143:  return getPeriod();
984        case 370698365:  return getFacilityType();
985        case 331373717:  return getPracticeSetting();
986        case 2031381048:  return getSourcePatientInfo();
987        case 1090493483:  return addRelated(); 
988        case -332612366:  return addBasedOn(); 
989        default: return super.makeProperty(hash, name);
990        }
991
992      }
993
994      @Override
995      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
996        switch (hash) {
997        case 1524132147: /*encounter*/ return new String[] {"Reference"};
998        case 96891546: /*event*/ return new String[] {"CodeableConcept"};
999        case -991726143: /*period*/ return new String[] {"Period"};
1000        case 370698365: /*facilityType*/ return new String[] {"CodeableConcept"};
1001        case 331373717: /*practiceSetting*/ return new String[] {"CodeableConcept"};
1002        case 2031381048: /*sourcePatientInfo*/ return new String[] {"Reference"};
1003        case 1090493483: /*related*/ return new String[] {"Reference"};
1004        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1005        default: return super.getTypesForProperty(hash, name);
1006        }
1007
1008      }
1009
1010      @Override
1011      public Base addChild(String name) throws FHIRException {
1012        if (name.equals("encounter")) {
1013          return addEncounter();
1014        }
1015        else if (name.equals("event")) {
1016          return addEvent();
1017        }
1018        else if (name.equals("period")) {
1019          this.period = new Period();
1020          return this.period;
1021        }
1022        else if (name.equals("facilityType")) {
1023          this.facilityType = new CodeableConcept();
1024          return this.facilityType;
1025        }
1026        else if (name.equals("practiceSetting")) {
1027          this.practiceSetting = new CodeableConcept();
1028          return this.practiceSetting;
1029        }
1030        else if (name.equals("sourcePatientInfo")) {
1031          this.sourcePatientInfo = new Reference();
1032          return this.sourcePatientInfo;
1033        }
1034        else if (name.equals("related")) {
1035          return addRelated();
1036        }
1037        else if (name.equals("basedOn")) {
1038          return addBasedOn();
1039        }
1040        else
1041          return super.addChild(name);
1042      }
1043
1044      public DocumentReferenceContextComponent copy() {
1045        DocumentReferenceContextComponent dst = new DocumentReferenceContextComponent();
1046        copyValues(dst);
1047        return dst;
1048      }
1049
1050      public void copyValues(DocumentReferenceContextComponent dst) {
1051        super.copyValues(dst);
1052        if (encounter != null) {
1053          dst.encounter = new ArrayList<Reference>();
1054          for (Reference i : encounter)
1055            dst.encounter.add(i.copy());
1056        };
1057        if (event != null) {
1058          dst.event = new ArrayList<CodeableConcept>();
1059          for (CodeableConcept i : event)
1060            dst.event.add(i.copy());
1061        };
1062        dst.period = period == null ? null : period.copy();
1063        dst.facilityType = facilityType == null ? null : facilityType.copy();
1064        dst.practiceSetting = practiceSetting == null ? null : practiceSetting.copy();
1065        dst.sourcePatientInfo = sourcePatientInfo == null ? null : sourcePatientInfo.copy();
1066        if (related != null) {
1067          dst.related = new ArrayList<Reference>();
1068          for (Reference i : related)
1069            dst.related.add(i.copy());
1070        };
1071        if (basedOn != null) {
1072          dst.basedOn = new ArrayList<Reference>();
1073          for (Reference i : basedOn)
1074            dst.basedOn.add(i.copy());
1075        };
1076      }
1077
1078      @Override
1079      public boolean equalsDeep(Base other_) {
1080        if (!super.equalsDeep(other_))
1081          return false;
1082        if (!(other_ instanceof DocumentReferenceContextComponent))
1083          return false;
1084        DocumentReferenceContextComponent o = (DocumentReferenceContextComponent) other_;
1085        return compareDeep(encounter, o.encounter, true) && compareDeep(event, o.event, true) && compareDeep(period, o.period, true)
1086           && compareDeep(facilityType, o.facilityType, true) && compareDeep(practiceSetting, o.practiceSetting, true)
1087           && compareDeep(sourcePatientInfo, o.sourcePatientInfo, true) && compareDeep(related, o.related, true)
1088           && compareDeep(basedOn, o.basedOn, true);
1089      }
1090
1091      @Override
1092      public boolean equalsShallow(Base other_) {
1093        if (!super.equalsShallow(other_))
1094          return false;
1095        if (!(other_ instanceof DocumentReferenceContextComponent))
1096          return false;
1097        DocumentReferenceContextComponent o = (DocumentReferenceContextComponent) other_;
1098        return true;
1099      }
1100
1101      public boolean isEmpty() {
1102        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(encounter, event, period
1103          , facilityType, practiceSetting, sourcePatientInfo, related, basedOn);
1104      }
1105
1106  public String fhirType() {
1107    return "DocumentReference.context";
1108
1109  }
1110
1111  }
1112
1113    /**
1114     * 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.
1115     */
1116    @Child(name = "masterIdentifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1117    @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." )
1118    protected Identifier masterIdentifier;
1119
1120    /**
1121     * Other identifiers associated with the document, including version independent identifiers.
1122     */
1123    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1124    @Description(shortDefinition="Other identifiers for the document", formalDefinition="Other identifiers associated with the document, including version independent identifiers." )
1125    protected List<Identifier> identifier;
1126
1127    /**
1128     * The status of this document reference.
1129     */
1130    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1131    @Description(shortDefinition="current | superseded | entered-in-error", formalDefinition="The status of this document reference." )
1132    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/document-reference-status")
1133    protected Enumeration<DocumentReferenceStatus> status;
1134
1135    /**
1136     * The status of the underlying document.
1137     */
1138    @Child(name = "docStatus", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1139    @Description(shortDefinition="preliminary | final | amended | entered-in-error", formalDefinition="The status of the underlying document." )
1140    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/composition-status")
1141    protected Enumeration<CompositionStatus> docStatus;
1142
1143    /**
1144     * 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.
1145     */
1146    @Child(name = "type", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1147    @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." )
1148    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/c80-doc-typecodes")
1149    protected CodeableConcept type;
1150
1151    /**
1152     * 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.
1153     */
1154    @Child(name = "category", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1155    @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." )
1156    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/document-classcodes")
1157    protected List<CodeableConcept> category;
1158
1159    /**
1160     * 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).
1161     */
1162    @Child(name = "subject", type = {Patient.class, Practitioner.class, Group.class, Device.class, PractitionerRole.class, Specimen.class, Organization.class, Location.class}, order=6, min=0, max=1, modifier=false, summary=true)
1163    @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)." )
1164    protected Reference subject;
1165
1166    /**
1167     * When the document reference was created.
1168     */
1169    @Child(name = "date", type = {InstantType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1170    @Description(shortDefinition="When this document reference was created", formalDefinition="When the document reference was created." )
1171    protected InstantType date;
1172
1173    /**
1174     * Identifies who is responsible for adding the information to the document.
1175     */
1176    @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Organization.class, Device.class, Patient.class, RelatedPerson.class, CareTeam.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1177    @Description(shortDefinition="Who and/or what authored the document", formalDefinition="Identifies who is responsible for adding the information to the document." )
1178    protected List<Reference> author;
1179
1180    /**
1181     * Which person or organization authenticates that this document is valid.
1182     */
1183    @Child(name = "authenticator", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
1184    @Description(shortDefinition="Who/what authenticated the document", formalDefinition="Which person or organization authenticates that this document is valid." )
1185    protected Reference authenticator;
1186
1187    /**
1188     * Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.
1189     */
1190    @Child(name = "custodian", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=false)
1191    @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." )
1192    protected Reference custodian;
1193
1194    /**
1195     * Relationships that this document has with other document references that already exist.
1196     */
1197    @Child(name = "relatesTo", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1198    @Description(shortDefinition="Relationships to other documents", formalDefinition="Relationships that this document has with other document references that already exist." )
1199    protected List<DocumentReferenceRelatesToComponent> relatesTo;
1200
1201    /**
1202     * Human-readable description of the source document.
1203     */
1204    @Child(name = "description", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1205    @Description(shortDefinition="Human-readable description", formalDefinition="Human-readable description of the source document." )
1206    protected StringType description;
1207
1208    /**
1209     * 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.
1210     */
1211    @Child(name = "securityLabel", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1212    @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." )
1213    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
1214    protected List<CodeableConcept> securityLabel;
1215
1216    /**
1217     * The document and format referenced.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.
1218     */
1219    @Child(name = "content", type = {}, order=14, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1220    @Description(shortDefinition="Document referenced", formalDefinition="The document and format referenced.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata." )
1221    protected List<DocumentReferenceContentComponent> content;
1222
1223    /**
1224     * The clinical context in which the document was prepared.
1225     */
1226    @Child(name = "context", type = {}, order=15, min=0, max=1, modifier=false, summary=true)
1227    @Description(shortDefinition="Clinical context of document", formalDefinition="The clinical context in which the document was prepared." )
1228    protected DocumentReferenceContextComponent context;
1229
1230    private static final long serialVersionUID = -521547148L;
1231
1232  /**
1233   * Constructor
1234   */
1235    public DocumentReference() {
1236      super();
1237    }
1238
1239  /**
1240   * Constructor
1241   */
1242    public DocumentReference(DocumentReferenceStatus status, DocumentReferenceContentComponent content) {
1243      super();
1244      this.setStatus(status);
1245      this.addContent(content);
1246    }
1247
1248    /**
1249     * @return {@link #masterIdentifier} (Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.)
1250     */
1251    public Identifier getMasterIdentifier() { 
1252      if (this.masterIdentifier == null)
1253        if (Configuration.errorOnAutoCreate())
1254          throw new Error("Attempt to auto-create DocumentReference.masterIdentifier");
1255        else if (Configuration.doAutoCreate())
1256          this.masterIdentifier = new Identifier(); // cc
1257      return this.masterIdentifier;
1258    }
1259
1260    public boolean hasMasterIdentifier() { 
1261      return this.masterIdentifier != null && !this.masterIdentifier.isEmpty();
1262    }
1263
1264    /**
1265     * @param value {@link #masterIdentifier} (Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.)
1266     */
1267    public DocumentReference setMasterIdentifier(Identifier value) { 
1268      this.masterIdentifier = value;
1269      return this;
1270    }
1271
1272    /**
1273     * @return {@link #identifier} (Other identifiers associated with the document, including version independent identifiers.)
1274     */
1275    public List<Identifier> getIdentifier() { 
1276      if (this.identifier == null)
1277        this.identifier = new ArrayList<Identifier>();
1278      return this.identifier;
1279    }
1280
1281    /**
1282     * @return Returns a reference to <code>this</code> for easy method chaining
1283     */
1284    public DocumentReference setIdentifier(List<Identifier> theIdentifier) { 
1285      this.identifier = theIdentifier;
1286      return this;
1287    }
1288
1289    public boolean hasIdentifier() { 
1290      if (this.identifier == null)
1291        return false;
1292      for (Identifier item : this.identifier)
1293        if (!item.isEmpty())
1294          return true;
1295      return false;
1296    }
1297
1298    public Identifier addIdentifier() { //3
1299      Identifier t = new Identifier();
1300      if (this.identifier == null)
1301        this.identifier = new ArrayList<Identifier>();
1302      this.identifier.add(t);
1303      return t;
1304    }
1305
1306    public DocumentReference addIdentifier(Identifier t) { //3
1307      if (t == null)
1308        return this;
1309      if (this.identifier == null)
1310        this.identifier = new ArrayList<Identifier>();
1311      this.identifier.add(t);
1312      return this;
1313    }
1314
1315    /**
1316     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1317     */
1318    public Identifier getIdentifierFirstRep() { 
1319      if (getIdentifier().isEmpty()) {
1320        addIdentifier();
1321      }
1322      return getIdentifier().get(0);
1323    }
1324
1325    /**
1326     * @return {@link #status} (The status of this document reference.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1327     */
1328    public Enumeration<DocumentReferenceStatus> getStatusElement() { 
1329      if (this.status == null)
1330        if (Configuration.errorOnAutoCreate())
1331          throw new Error("Attempt to auto-create DocumentReference.status");
1332        else if (Configuration.doAutoCreate())
1333          this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory()); // bb
1334      return this.status;
1335    }
1336
1337    public boolean hasStatusElement() { 
1338      return this.status != null && !this.status.isEmpty();
1339    }
1340
1341    public boolean hasStatus() { 
1342      return this.status != null && !this.status.isEmpty();
1343    }
1344
1345    /**
1346     * @param value {@link #status} (The status of this document reference.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1347     */
1348    public DocumentReference setStatusElement(Enumeration<DocumentReferenceStatus> value) { 
1349      this.status = value;
1350      return this;
1351    }
1352
1353    /**
1354     * @return The status of this document reference.
1355     */
1356    public DocumentReferenceStatus getStatus() { 
1357      return this.status == null ? null : this.status.getValue();
1358    }
1359
1360    /**
1361     * @param value The status of this document reference.
1362     */
1363    public DocumentReference setStatus(DocumentReferenceStatus value) { 
1364        if (this.status == null)
1365          this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory());
1366        this.status.setValue(value);
1367      return this;
1368    }
1369
1370    /**
1371     * @return {@link #docStatus} (The status of the underlying document.). This is the underlying object with id, value and extensions. The accessor "getDocStatus" gives direct access to the value
1372     */
1373    public Enumeration<CompositionStatus> getDocStatusElement() { 
1374      if (this.docStatus == null)
1375        if (Configuration.errorOnAutoCreate())
1376          throw new Error("Attempt to auto-create DocumentReference.docStatus");
1377        else if (Configuration.doAutoCreate())
1378          this.docStatus = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); // bb
1379      return this.docStatus;
1380    }
1381
1382    public boolean hasDocStatusElement() { 
1383      return this.docStatus != null && !this.docStatus.isEmpty();
1384    }
1385
1386    public boolean hasDocStatus() { 
1387      return this.docStatus != null && !this.docStatus.isEmpty();
1388    }
1389
1390    /**
1391     * @param value {@link #docStatus} (The status of the underlying document.). This is the underlying object with id, value and extensions. The accessor "getDocStatus" gives direct access to the value
1392     */
1393    public DocumentReference setDocStatusElement(Enumeration<CompositionStatus> value) { 
1394      this.docStatus = value;
1395      return this;
1396    }
1397
1398    /**
1399     * @return The status of the underlying document.
1400     */
1401    public CompositionStatus getDocStatus() { 
1402      return this.docStatus == null ? null : this.docStatus.getValue();
1403    }
1404
1405    /**
1406     * @param value The status of the underlying document.
1407     */
1408    public DocumentReference setDocStatus(CompositionStatus value) { 
1409      if (value == null)
1410        this.docStatus = null;
1411      else {
1412        if (this.docStatus == null)
1413          this.docStatus = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory());
1414        this.docStatus.setValue(value);
1415      }
1416      return this;
1417    }
1418
1419    /**
1420     * @return {@link #type} (Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.)
1421     */
1422    public CodeableConcept getType() { 
1423      if (this.type == null)
1424        if (Configuration.errorOnAutoCreate())
1425          throw new Error("Attempt to auto-create DocumentReference.type");
1426        else if (Configuration.doAutoCreate())
1427          this.type = new CodeableConcept(); // cc
1428      return this.type;
1429    }
1430
1431    public boolean hasType() { 
1432      return this.type != null && !this.type.isEmpty();
1433    }
1434
1435    /**
1436     * @param value {@link #type} (Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.)
1437     */
1438    public DocumentReference setType(CodeableConcept value) { 
1439      this.type = value;
1440      return this;
1441    }
1442
1443    /**
1444     * @return {@link #category} (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.)
1445     */
1446    public List<CodeableConcept> getCategory() { 
1447      if (this.category == null)
1448        this.category = new ArrayList<CodeableConcept>();
1449      return this.category;
1450    }
1451
1452    /**
1453     * @return Returns a reference to <code>this</code> for easy method chaining
1454     */
1455    public DocumentReference setCategory(List<CodeableConcept> theCategory) { 
1456      this.category = theCategory;
1457      return this;
1458    }
1459
1460    public boolean hasCategory() { 
1461      if (this.category == null)
1462        return false;
1463      for (CodeableConcept item : this.category)
1464        if (!item.isEmpty())
1465          return true;
1466      return false;
1467    }
1468
1469    public CodeableConcept addCategory() { //3
1470      CodeableConcept t = new CodeableConcept();
1471      if (this.category == null)
1472        this.category = new ArrayList<CodeableConcept>();
1473      this.category.add(t);
1474      return t;
1475    }
1476
1477    public DocumentReference addCategory(CodeableConcept t) { //3
1478      if (t == null)
1479        return this;
1480      if (this.category == null)
1481        this.category = new ArrayList<CodeableConcept>();
1482      this.category.add(t);
1483      return this;
1484    }
1485
1486    /**
1487     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
1488     */
1489    public CodeableConcept getCategoryFirstRep() { 
1490      if (getCategory().isEmpty()) {
1491        addCategory();
1492      }
1493      return getCategory().get(0);
1494    }
1495
1496    /**
1497     * @return {@link #subject} (Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).)
1498     */
1499    public Reference getSubject() { 
1500      if (this.subject == null)
1501        if (Configuration.errorOnAutoCreate())
1502          throw new Error("Attempt to auto-create DocumentReference.subject");
1503        else if (Configuration.doAutoCreate())
1504          this.subject = new Reference(); // cc
1505      return this.subject;
1506    }
1507
1508    public boolean hasSubject() { 
1509      return this.subject != null && !this.subject.isEmpty();
1510    }
1511
1512    /**
1513     * @param value {@link #subject} (Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).)
1514     */
1515    public DocumentReference setSubject(Reference value) { 
1516      this.subject = value;
1517      return this;
1518    }
1519
1520    /**
1521     * @return {@link #date} (When the document reference was created.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1522     */
1523    public InstantType getDateElement() { 
1524      if (this.date == null)
1525        if (Configuration.errorOnAutoCreate())
1526          throw new Error("Attempt to auto-create DocumentReference.date");
1527        else if (Configuration.doAutoCreate())
1528          this.date = new InstantType(); // bb
1529      return this.date;
1530    }
1531
1532    public boolean hasDateElement() { 
1533      return this.date != null && !this.date.isEmpty();
1534    }
1535
1536    public boolean hasDate() { 
1537      return this.date != null && !this.date.isEmpty();
1538    }
1539
1540    /**
1541     * @param value {@link #date} (When the document reference was created.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1542     */
1543    public DocumentReference setDateElement(InstantType value) { 
1544      this.date = value;
1545      return this;
1546    }
1547
1548    /**
1549     * @return When the document reference was created.
1550     */
1551    public Date getDate() { 
1552      return this.date == null ? null : this.date.getValue();
1553    }
1554
1555    /**
1556     * @param value When the document reference was created.
1557     */
1558    public DocumentReference setDate(Date value) { 
1559      if (value == null)
1560        this.date = null;
1561      else {
1562        if (this.date == null)
1563          this.date = new InstantType();
1564        this.date.setValue(value);
1565      }
1566      return this;
1567    }
1568
1569    /**
1570     * @return {@link #author} (Identifies who is responsible for adding the information to the document.)
1571     */
1572    public List<Reference> getAuthor() { 
1573      if (this.author == null)
1574        this.author = new ArrayList<Reference>();
1575      return this.author;
1576    }
1577
1578    /**
1579     * @return Returns a reference to <code>this</code> for easy method chaining
1580     */
1581    public DocumentReference setAuthor(List<Reference> theAuthor) { 
1582      this.author = theAuthor;
1583      return this;
1584    }
1585
1586    public boolean hasAuthor() { 
1587      if (this.author == null)
1588        return false;
1589      for (Reference item : this.author)
1590        if (!item.isEmpty())
1591          return true;
1592      return false;
1593    }
1594
1595    public Reference addAuthor() { //3
1596      Reference t = new Reference();
1597      if (this.author == null)
1598        this.author = new ArrayList<Reference>();
1599      this.author.add(t);
1600      return t;
1601    }
1602
1603    public DocumentReference addAuthor(Reference t) { //3
1604      if (t == null)
1605        return this;
1606      if (this.author == null)
1607        this.author = new ArrayList<Reference>();
1608      this.author.add(t);
1609      return this;
1610    }
1611
1612    /**
1613     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist {3}
1614     */
1615    public Reference getAuthorFirstRep() { 
1616      if (getAuthor().isEmpty()) {
1617        addAuthor();
1618      }
1619      return getAuthor().get(0);
1620    }
1621
1622    /**
1623     * @return {@link #authenticator} (Which person or organization authenticates that this document is valid.)
1624     */
1625    public Reference getAuthenticator() { 
1626      if (this.authenticator == null)
1627        if (Configuration.errorOnAutoCreate())
1628          throw new Error("Attempt to auto-create DocumentReference.authenticator");
1629        else if (Configuration.doAutoCreate())
1630          this.authenticator = new Reference(); // cc
1631      return this.authenticator;
1632    }
1633
1634    public boolean hasAuthenticator() { 
1635      return this.authenticator != null && !this.authenticator.isEmpty();
1636    }
1637
1638    /**
1639     * @param value {@link #authenticator} (Which person or organization authenticates that this document is valid.)
1640     */
1641    public DocumentReference setAuthenticator(Reference value) { 
1642      this.authenticator = value;
1643      return this;
1644    }
1645
1646    /**
1647     * @return {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.)
1648     */
1649    public Reference getCustodian() { 
1650      if (this.custodian == null)
1651        if (Configuration.errorOnAutoCreate())
1652          throw new Error("Attempt to auto-create DocumentReference.custodian");
1653        else if (Configuration.doAutoCreate())
1654          this.custodian = new Reference(); // cc
1655      return this.custodian;
1656    }
1657
1658    public boolean hasCustodian() { 
1659      return this.custodian != null && !this.custodian.isEmpty();
1660    }
1661
1662    /**
1663     * @param value {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.)
1664     */
1665    public DocumentReference setCustodian(Reference value) { 
1666      this.custodian = value;
1667      return this;
1668    }
1669
1670    /**
1671     * @return {@link #relatesTo} (Relationships that this document has with other document references that already exist.)
1672     */
1673    public List<DocumentReferenceRelatesToComponent> getRelatesTo() { 
1674      if (this.relatesTo == null)
1675        this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
1676      return this.relatesTo;
1677    }
1678
1679    /**
1680     * @return Returns a reference to <code>this</code> for easy method chaining
1681     */
1682    public DocumentReference setRelatesTo(List<DocumentReferenceRelatesToComponent> theRelatesTo) { 
1683      this.relatesTo = theRelatesTo;
1684      return this;
1685    }
1686
1687    public boolean hasRelatesTo() { 
1688      if (this.relatesTo == null)
1689        return false;
1690      for (DocumentReferenceRelatesToComponent item : this.relatesTo)
1691        if (!item.isEmpty())
1692          return true;
1693      return false;
1694    }
1695
1696    public DocumentReferenceRelatesToComponent addRelatesTo() { //3
1697      DocumentReferenceRelatesToComponent t = new DocumentReferenceRelatesToComponent();
1698      if (this.relatesTo == null)
1699        this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
1700      this.relatesTo.add(t);
1701      return t;
1702    }
1703
1704    public DocumentReference addRelatesTo(DocumentReferenceRelatesToComponent t) { //3
1705      if (t == null)
1706        return this;
1707      if (this.relatesTo == null)
1708        this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
1709      this.relatesTo.add(t);
1710      return this;
1711    }
1712
1713    /**
1714     * @return The first repetition of repeating field {@link #relatesTo}, creating it if it does not already exist {3}
1715     */
1716    public DocumentReferenceRelatesToComponent getRelatesToFirstRep() { 
1717      if (getRelatesTo().isEmpty()) {
1718        addRelatesTo();
1719      }
1720      return getRelatesTo().get(0);
1721    }
1722
1723    /**
1724     * @return {@link #description} (Human-readable description of the source document.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1725     */
1726    public StringType getDescriptionElement() { 
1727      if (this.description == null)
1728        if (Configuration.errorOnAutoCreate())
1729          throw new Error("Attempt to auto-create DocumentReference.description");
1730        else if (Configuration.doAutoCreate())
1731          this.description = new StringType(); // bb
1732      return this.description;
1733    }
1734
1735    public boolean hasDescriptionElement() { 
1736      return this.description != null && !this.description.isEmpty();
1737    }
1738
1739    public boolean hasDescription() { 
1740      return this.description != null && !this.description.isEmpty();
1741    }
1742
1743    /**
1744     * @param value {@link #description} (Human-readable description of the source document.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1745     */
1746    public DocumentReference setDescriptionElement(StringType value) { 
1747      this.description = value;
1748      return this;
1749    }
1750
1751    /**
1752     * @return Human-readable description of the source document.
1753     */
1754    public String getDescription() { 
1755      return this.description == null ? null : this.description.getValue();
1756    }
1757
1758    /**
1759     * @param value Human-readable description of the source document.
1760     */
1761    public DocumentReference setDescription(String value) { 
1762      if (Utilities.noString(value))
1763        this.description = null;
1764      else {
1765        if (this.description == null)
1766          this.description = new StringType();
1767        this.description.setValue(value);
1768      }
1769      return this;
1770    }
1771
1772    /**
1773     * @return {@link #securityLabel} (A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the "reference" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.)
1774     */
1775    public List<CodeableConcept> getSecurityLabel() { 
1776      if (this.securityLabel == null)
1777        this.securityLabel = new ArrayList<CodeableConcept>();
1778      return this.securityLabel;
1779    }
1780
1781    /**
1782     * @return Returns a reference to <code>this</code> for easy method chaining
1783     */
1784    public DocumentReference setSecurityLabel(List<CodeableConcept> theSecurityLabel) { 
1785      this.securityLabel = theSecurityLabel;
1786      return this;
1787    }
1788
1789    public boolean hasSecurityLabel() { 
1790      if (this.securityLabel == null)
1791        return false;
1792      for (CodeableConcept item : this.securityLabel)
1793        if (!item.isEmpty())
1794          return true;
1795      return false;
1796    }
1797
1798    public CodeableConcept addSecurityLabel() { //3
1799      CodeableConcept t = new CodeableConcept();
1800      if (this.securityLabel == null)
1801        this.securityLabel = new ArrayList<CodeableConcept>();
1802      this.securityLabel.add(t);
1803      return t;
1804    }
1805
1806    public DocumentReference addSecurityLabel(CodeableConcept t) { //3
1807      if (t == null)
1808        return this;
1809      if (this.securityLabel == null)
1810        this.securityLabel = new ArrayList<CodeableConcept>();
1811      this.securityLabel.add(t);
1812      return this;
1813    }
1814
1815    /**
1816     * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist {3}
1817     */
1818    public CodeableConcept getSecurityLabelFirstRep() { 
1819      if (getSecurityLabel().isEmpty()) {
1820        addSecurityLabel();
1821      }
1822      return getSecurityLabel().get(0);
1823    }
1824
1825    /**
1826     * @return {@link #content} (The document and format referenced.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.)
1827     */
1828    public List<DocumentReferenceContentComponent> getContent() { 
1829      if (this.content == null)
1830        this.content = new ArrayList<DocumentReferenceContentComponent>();
1831      return this.content;
1832    }
1833
1834    /**
1835     * @return Returns a reference to <code>this</code> for easy method chaining
1836     */
1837    public DocumentReference setContent(List<DocumentReferenceContentComponent> theContent) { 
1838      this.content = theContent;
1839      return this;
1840    }
1841
1842    public boolean hasContent() { 
1843      if (this.content == null)
1844        return false;
1845      for (DocumentReferenceContentComponent item : this.content)
1846        if (!item.isEmpty())
1847          return true;
1848      return false;
1849    }
1850
1851    public DocumentReferenceContentComponent addContent() { //3
1852      DocumentReferenceContentComponent t = new DocumentReferenceContentComponent();
1853      if (this.content == null)
1854        this.content = new ArrayList<DocumentReferenceContentComponent>();
1855      this.content.add(t);
1856      return t;
1857    }
1858
1859    public DocumentReference addContent(DocumentReferenceContentComponent t) { //3
1860      if (t == null)
1861        return this;
1862      if (this.content == null)
1863        this.content = new ArrayList<DocumentReferenceContentComponent>();
1864      this.content.add(t);
1865      return this;
1866    }
1867
1868    /**
1869     * @return The first repetition of repeating field {@link #content}, creating it if it does not already exist {3}
1870     */
1871    public DocumentReferenceContentComponent getContentFirstRep() { 
1872      if (getContent().isEmpty()) {
1873        addContent();
1874      }
1875      return getContent().get(0);
1876    }
1877
1878    /**
1879     * @return {@link #context} (The clinical context in which the document was prepared.)
1880     */
1881    public DocumentReferenceContextComponent getContext() { 
1882      if (this.context == null)
1883        if (Configuration.errorOnAutoCreate())
1884          throw new Error("Attempt to auto-create DocumentReference.context");
1885        else if (Configuration.doAutoCreate())
1886          this.context = new DocumentReferenceContextComponent(); // cc
1887      return this.context;
1888    }
1889
1890    public boolean hasContext() { 
1891      return this.context != null && !this.context.isEmpty();
1892    }
1893
1894    /**
1895     * @param value {@link #context} (The clinical context in which the document was prepared.)
1896     */
1897    public DocumentReference setContext(DocumentReferenceContextComponent value) { 
1898      this.context = value;
1899      return this;
1900    }
1901
1902      protected void listChildren(List<Property> children) {
1903        super.listChildren(children);
1904        children.add(new Property("masterIdentifier", "Identifier", "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.", 0, 1, masterIdentifier));
1905        children.add(new Property("identifier", "Identifier", "Other identifiers associated with the document, including version independent identifiers.", 0, java.lang.Integer.MAX_VALUE, identifier));
1906        children.add(new Property("status", "code", "The status of this document reference.", 0, 1, status));
1907        children.add(new Property("docStatus", "code", "The status of the underlying document.", 0, 1, docStatus));
1908        children.add(new Property("type", "CodeableConcept", "Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.", 0, 1, type));
1909        children.add(new Property("category", "CodeableConcept", "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.", 0, java.lang.Integer.MAX_VALUE, category));
1910        children.add(new Property("subject", "Reference(Patient|Practitioner|Group|Device|PractitionerRole|Specimen|Organization|Location)", "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).", 0, 1, subject));
1911        children.add(new Property("date", "instant", "When the document reference was created.", 0, 1, date));
1912        children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson|CareTeam)", "Identifies who is responsible for adding the information to the document.", 0, java.lang.Integer.MAX_VALUE, author));
1913        children.add(new Property("authenticator", "Reference(Practitioner|PractitionerRole|Organization)", "Which person or organization authenticates that this document is valid.", 0, 1, authenticator));
1914        children.add(new Property("custodian", "Reference(Organization)", "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.", 0, 1, custodian));
1915        children.add(new Property("relatesTo", "", "Relationships that this document has with other document references that already exist.", 0, java.lang.Integer.MAX_VALUE, relatesTo));
1916        children.add(new Property("description", "string", "Human-readable description of the source document.", 0, 1, description));
1917        children.add(new Property("securityLabel", "CodeableConcept", "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
1918        children.add(new Property("content", "", "The document and format referenced.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.", 0, java.lang.Integer.MAX_VALUE, content));
1919        children.add(new Property("context", "", "The clinical context in which the document was prepared.", 0, 1, context));
1920      }
1921
1922      @Override
1923      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1924        switch (_hash) {
1925        case 243769515: /*masterIdentifier*/  return new Property("masterIdentifier", "Identifier", "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.", 0, 1, masterIdentifier);
1926        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Other identifiers associated with the document, including version independent identifiers.", 0, java.lang.Integer.MAX_VALUE, identifier);
1927        case -892481550: /*status*/  return new Property("status", "code", "The status of this document reference.", 0, 1, status);
1928        case -23496886: /*docStatus*/  return new Property("docStatus", "code", "The status of the underlying document.", 0, 1, docStatus);
1929        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.", 0, 1, type);
1930        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.", 0, java.lang.Integer.MAX_VALUE, category);
1931        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Practitioner|Group|Device|PractitionerRole|Specimen|Organization|Location)", "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).", 0, 1, subject);
1932        case 3076014: /*date*/  return new Property("date", "instant", "When the document reference was created.", 0, 1, date);
1933        case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson|CareTeam)", "Identifies who is responsible for adding the information to the document.", 0, java.lang.Integer.MAX_VALUE, author);
1934        case 1815000435: /*authenticator*/  return new Property("authenticator", "Reference(Practitioner|PractitionerRole|Organization)", "Which person or organization authenticates that this document is valid.", 0, 1, authenticator);
1935        case 1611297262: /*custodian*/  return new Property("custodian", "Reference(Organization)", "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.", 0, 1, custodian);
1936        case -7765931: /*relatesTo*/  return new Property("relatesTo", "", "Relationships that this document has with other document references that already exist.", 0, java.lang.Integer.MAX_VALUE, relatesTo);
1937        case -1724546052: /*description*/  return new Property("description", "string", "Human-readable description of the source document.", 0, 1, description);
1938        case -722296940: /*securityLabel*/  return new Property("securityLabel", "CodeableConcept", "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
1939        case 951530617: /*content*/  return new Property("content", "", "The document and format referenced.  If there are multiple content element repetitions, these must all represent the same document in different format, or attachment metadata.", 0, java.lang.Integer.MAX_VALUE, content);
1940        case 951530927: /*context*/  return new Property("context", "", "The clinical context in which the document was prepared.", 0, 1, context);
1941        default: return super.getNamedProperty(_hash, _name, _checkValid);
1942        }
1943
1944      }
1945
1946      @Override
1947      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1948        switch (hash) {
1949        case 243769515: /*masterIdentifier*/ return this.masterIdentifier == null ? new Base[0] : new Base[] {this.masterIdentifier}; // Identifier
1950        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1951        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<DocumentReferenceStatus>
1952        case -23496886: /*docStatus*/ return this.docStatus == null ? new Base[0] : new Base[] {this.docStatus}; // Enumeration<CompositionStatus>
1953        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1954        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1955        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1956        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // InstantType
1957        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
1958        case 1815000435: /*authenticator*/ return this.authenticator == null ? new Base[0] : new Base[] {this.authenticator}; // Reference
1959        case 1611297262: /*custodian*/ return this.custodian == null ? new Base[0] : new Base[] {this.custodian}; // Reference
1960        case -7765931: /*relatesTo*/ return this.relatesTo == null ? new Base[0] : this.relatesTo.toArray(new Base[this.relatesTo.size()]); // DocumentReferenceRelatesToComponent
1961        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1962        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // CodeableConcept
1963        case 951530617: /*content*/ return this.content == null ? new Base[0] : this.content.toArray(new Base[this.content.size()]); // DocumentReferenceContentComponent
1964        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // DocumentReferenceContextComponent
1965        default: return super.getProperty(hash, name, checkValid);
1966        }
1967
1968      }
1969
1970      @Override
1971      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1972        switch (hash) {
1973        case 243769515: // masterIdentifier
1974          this.masterIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
1975          return value;
1976        case -1618432855: // identifier
1977          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1978          return value;
1979        case -892481550: // status
1980          value = new DocumentReferenceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1981          this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
1982          return value;
1983        case -23496886: // docStatus
1984          value = new CompositionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1985          this.docStatus = (Enumeration) value; // Enumeration<CompositionStatus>
1986          return value;
1987        case 3575610: // type
1988          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1989          return value;
1990        case 50511102: // category
1991          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1992          return value;
1993        case -1867885268: // subject
1994          this.subject = TypeConvertor.castToReference(value); // Reference
1995          return value;
1996        case 3076014: // date
1997          this.date = TypeConvertor.castToInstant(value); // InstantType
1998          return value;
1999        case -1406328437: // author
2000          this.getAuthor().add(TypeConvertor.castToReference(value)); // Reference
2001          return value;
2002        case 1815000435: // authenticator
2003          this.authenticator = TypeConvertor.castToReference(value); // Reference
2004          return value;
2005        case 1611297262: // custodian
2006          this.custodian = TypeConvertor.castToReference(value); // Reference
2007          return value;
2008        case -7765931: // relatesTo
2009          this.getRelatesTo().add((DocumentReferenceRelatesToComponent) value); // DocumentReferenceRelatesToComponent
2010          return value;
2011        case -1724546052: // description
2012          this.description = TypeConvertor.castToString(value); // StringType
2013          return value;
2014        case -722296940: // securityLabel
2015          this.getSecurityLabel().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2016          return value;
2017        case 951530617: // content
2018          this.getContent().add((DocumentReferenceContentComponent) value); // DocumentReferenceContentComponent
2019          return value;
2020        case 951530927: // context
2021          this.context = (DocumentReferenceContextComponent) value; // DocumentReferenceContextComponent
2022          return value;
2023        default: return super.setProperty(hash, name, value);
2024        }
2025
2026      }
2027
2028      @Override
2029      public Base setProperty(String name, Base value) throws FHIRException {
2030        if (name.equals("masterIdentifier")) {
2031          this.masterIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
2032        } else if (name.equals("identifier")) {
2033          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2034        } else if (name.equals("status")) {
2035          value = new DocumentReferenceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2036          this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
2037        } else if (name.equals("docStatus")) {
2038          value = new CompositionStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2039          this.docStatus = (Enumeration) value; // Enumeration<CompositionStatus>
2040        } else if (name.equals("type")) {
2041          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2042        } else if (name.equals("category")) {
2043          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
2044        } else if (name.equals("subject")) {
2045          this.subject = TypeConvertor.castToReference(value); // Reference
2046        } else if (name.equals("date")) {
2047          this.date = TypeConvertor.castToInstant(value); // InstantType
2048        } else if (name.equals("author")) {
2049          this.getAuthor().add(TypeConvertor.castToReference(value));
2050        } else if (name.equals("authenticator")) {
2051          this.authenticator = TypeConvertor.castToReference(value); // Reference
2052        } else if (name.equals("custodian")) {
2053          this.custodian = TypeConvertor.castToReference(value); // Reference
2054        } else if (name.equals("relatesTo")) {
2055          this.getRelatesTo().add((DocumentReferenceRelatesToComponent) value);
2056        } else if (name.equals("description")) {
2057          this.description = TypeConvertor.castToString(value); // StringType
2058        } else if (name.equals("securityLabel")) {
2059          this.getSecurityLabel().add(TypeConvertor.castToCodeableConcept(value));
2060        } else if (name.equals("content")) {
2061          this.getContent().add((DocumentReferenceContentComponent) value);
2062        } else if (name.equals("context")) {
2063          this.context = (DocumentReferenceContextComponent) value; // DocumentReferenceContextComponent
2064        } else
2065          return super.setProperty(name, value);
2066        return value;
2067      }
2068
2069      @Override
2070      public Base makeProperty(int hash, String name) throws FHIRException {
2071        switch (hash) {
2072        case 243769515:  return getMasterIdentifier();
2073        case -1618432855:  return addIdentifier(); 
2074        case -892481550:  return getStatusElement();
2075        case -23496886:  return getDocStatusElement();
2076        case 3575610:  return getType();
2077        case 50511102:  return addCategory(); 
2078        case -1867885268:  return getSubject();
2079        case 3076014:  return getDateElement();
2080        case -1406328437:  return addAuthor(); 
2081        case 1815000435:  return getAuthenticator();
2082        case 1611297262:  return getCustodian();
2083        case -7765931:  return addRelatesTo(); 
2084        case -1724546052:  return getDescriptionElement();
2085        case -722296940:  return addSecurityLabel(); 
2086        case 951530617:  return addContent(); 
2087        case 951530927:  return getContext();
2088        default: return super.makeProperty(hash, name);
2089        }
2090
2091      }
2092
2093      @Override
2094      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2095        switch (hash) {
2096        case 243769515: /*masterIdentifier*/ return new String[] {"Identifier"};
2097        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2098        case -892481550: /*status*/ return new String[] {"code"};
2099        case -23496886: /*docStatus*/ return new String[] {"code"};
2100        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2101        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2102        case -1867885268: /*subject*/ return new String[] {"Reference"};
2103        case 3076014: /*date*/ return new String[] {"instant"};
2104        case -1406328437: /*author*/ return new String[] {"Reference"};
2105        case 1815000435: /*authenticator*/ return new String[] {"Reference"};
2106        case 1611297262: /*custodian*/ return new String[] {"Reference"};
2107        case -7765931: /*relatesTo*/ return new String[] {};
2108        case -1724546052: /*description*/ return new String[] {"string"};
2109        case -722296940: /*securityLabel*/ return new String[] {"CodeableConcept"};
2110        case 951530617: /*content*/ return new String[] {};
2111        case 951530927: /*context*/ return new String[] {};
2112        default: return super.getTypesForProperty(hash, name);
2113        }
2114
2115      }
2116
2117      @Override
2118      public Base addChild(String name) throws FHIRException {
2119        if (name.equals("masterIdentifier")) {
2120          this.masterIdentifier = new Identifier();
2121          return this.masterIdentifier;
2122        }
2123        else if (name.equals("identifier")) {
2124          return addIdentifier();
2125        }
2126        else if (name.equals("status")) {
2127          throw new FHIRException("Cannot call addChild on a primitive type DocumentReference.status");
2128        }
2129        else if (name.equals("docStatus")) {
2130          throw new FHIRException("Cannot call addChild on a primitive type DocumentReference.docStatus");
2131        }
2132        else if (name.equals("type")) {
2133          this.type = new CodeableConcept();
2134          return this.type;
2135        }
2136        else if (name.equals("category")) {
2137          return addCategory();
2138        }
2139        else if (name.equals("subject")) {
2140          this.subject = new Reference();
2141          return this.subject;
2142        }
2143        else if (name.equals("date")) {
2144          throw new FHIRException("Cannot call addChild on a primitive type DocumentReference.date");
2145        }
2146        else if (name.equals("author")) {
2147          return addAuthor();
2148        }
2149        else if (name.equals("authenticator")) {
2150          this.authenticator = new Reference();
2151          return this.authenticator;
2152        }
2153        else if (name.equals("custodian")) {
2154          this.custodian = new Reference();
2155          return this.custodian;
2156        }
2157        else if (name.equals("relatesTo")) {
2158          return addRelatesTo();
2159        }
2160        else if (name.equals("description")) {
2161          throw new FHIRException("Cannot call addChild on a primitive type DocumentReference.description");
2162        }
2163        else if (name.equals("securityLabel")) {
2164          return addSecurityLabel();
2165        }
2166        else if (name.equals("content")) {
2167          return addContent();
2168        }
2169        else if (name.equals("context")) {
2170          this.context = new DocumentReferenceContextComponent();
2171          return this.context;
2172        }
2173        else
2174          return super.addChild(name);
2175      }
2176
2177  public String fhirType() {
2178    return "DocumentReference";
2179
2180  }
2181
2182      public DocumentReference copy() {
2183        DocumentReference dst = new DocumentReference();
2184        copyValues(dst);
2185        return dst;
2186      }
2187
2188      public void copyValues(DocumentReference dst) {
2189        super.copyValues(dst);
2190        dst.masterIdentifier = masterIdentifier == null ? null : masterIdentifier.copy();
2191        if (identifier != null) {
2192          dst.identifier = new ArrayList<Identifier>();
2193          for (Identifier i : identifier)
2194            dst.identifier.add(i.copy());
2195        };
2196        dst.status = status == null ? null : status.copy();
2197        dst.docStatus = docStatus == null ? null : docStatus.copy();
2198        dst.type = type == null ? null : type.copy();
2199        if (category != null) {
2200          dst.category = new ArrayList<CodeableConcept>();
2201          for (CodeableConcept i : category)
2202            dst.category.add(i.copy());
2203        };
2204        dst.subject = subject == null ? null : subject.copy();
2205        dst.date = date == null ? null : date.copy();
2206        if (author != null) {
2207          dst.author = new ArrayList<Reference>();
2208          for (Reference i : author)
2209            dst.author.add(i.copy());
2210        };
2211        dst.authenticator = authenticator == null ? null : authenticator.copy();
2212        dst.custodian = custodian == null ? null : custodian.copy();
2213        if (relatesTo != null) {
2214          dst.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
2215          for (DocumentReferenceRelatesToComponent i : relatesTo)
2216            dst.relatesTo.add(i.copy());
2217        };
2218        dst.description = description == null ? null : description.copy();
2219        if (securityLabel != null) {
2220          dst.securityLabel = new ArrayList<CodeableConcept>();
2221          for (CodeableConcept i : securityLabel)
2222            dst.securityLabel.add(i.copy());
2223        };
2224        if (content != null) {
2225          dst.content = new ArrayList<DocumentReferenceContentComponent>();
2226          for (DocumentReferenceContentComponent i : content)
2227            dst.content.add(i.copy());
2228        };
2229        dst.context = context == null ? null : context.copy();
2230      }
2231
2232      protected DocumentReference typedCopy() {
2233        return copy();
2234      }
2235
2236      @Override
2237      public boolean equalsDeep(Base other_) {
2238        if (!super.equalsDeep(other_))
2239          return false;
2240        if (!(other_ instanceof DocumentReference))
2241          return false;
2242        DocumentReference o = (DocumentReference) other_;
2243        return compareDeep(masterIdentifier, o.masterIdentifier, true) && compareDeep(identifier, o.identifier, true)
2244           && compareDeep(status, o.status, true) && compareDeep(docStatus, o.docStatus, true) && compareDeep(type, o.type, true)
2245           && compareDeep(category, o.category, true) && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true)
2246           && compareDeep(author, o.author, true) && compareDeep(authenticator, o.authenticator, true) && compareDeep(custodian, o.custodian, true)
2247           && compareDeep(relatesTo, o.relatesTo, true) && compareDeep(description, o.description, true) && compareDeep(securityLabel, o.securityLabel, true)
2248           && compareDeep(content, o.content, true) && compareDeep(context, o.context, true);
2249      }
2250
2251      @Override
2252      public boolean equalsShallow(Base other_) {
2253        if (!super.equalsShallow(other_))
2254          return false;
2255        if (!(other_ instanceof DocumentReference))
2256          return false;
2257        DocumentReference o = (DocumentReference) other_;
2258        return compareValues(status, o.status, true) && compareValues(docStatus, o.docStatus, true) && compareValues(date, o.date, true)
2259           && compareValues(description, o.description, true);
2260      }
2261
2262      public boolean isEmpty() {
2263        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(masterIdentifier, identifier
2264          , status, docStatus, type, category, subject, date, author, authenticator, custodian
2265          , relatesTo, description, securityLabel, content, context);
2266      }
2267
2268  @Override
2269  public ResourceType getResourceType() {
2270    return ResourceType.DocumentReference;
2271   }
2272
2273 /**
2274   * Search parameter: <b>authenticator</b>
2275   * <p>
2276   * Description: <b>Who/what authenticated the document</b><br>
2277   * Type: <b>reference</b><br>
2278   * Path: <b>DocumentReference.authenticator</b><br>
2279   * </p>
2280   */
2281  @SearchParamDefinition(name="authenticator", path="DocumentReference.authenticator", description="Who/what authenticated the document", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } )
2282  public static final String SP_AUTHENTICATOR = "authenticator";
2283 /**
2284   * <b>Fluent Client</b> search parameter constant for <b>authenticator</b>
2285   * <p>
2286   * Description: <b>Who/what authenticated the document</b><br>
2287   * Type: <b>reference</b><br>
2288   * Path: <b>DocumentReference.authenticator</b><br>
2289   * </p>
2290   */
2291  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHENTICATOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHENTICATOR);
2292
2293/**
2294   * Constant for fluent queries to be used to add include statements. Specifies
2295   * the path value of "<b>DocumentReference:authenticator</b>".
2296   */
2297  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHENTICATOR = new ca.uhn.fhir.model.api.Include("DocumentReference:authenticator").toLocked();
2298
2299 /**
2300   * Search parameter: <b>author</b>
2301   * <p>
2302   * Description: <b>Who and/or what authored the document</b><br>
2303   * Type: <b>reference</b><br>
2304   * Path: <b>DocumentReference.author</b><br>
2305   * </p>
2306   */
2307  @SearchParamDefinition(name="author", path="DocumentReference.author", description="Who and/or what authored the document", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
2308  public static final String SP_AUTHOR = "author";
2309 /**
2310   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2311   * <p>
2312   * Description: <b>Who and/or what authored the document</b><br>
2313   * Type: <b>reference</b><br>
2314   * Path: <b>DocumentReference.author</b><br>
2315   * </p>
2316   */
2317  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
2318
2319/**
2320   * Constant for fluent queries to be used to add include statements. Specifies
2321   * the path value of "<b>DocumentReference:author</b>".
2322   */
2323  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("DocumentReference:author").toLocked();
2324
2325 /**
2326   * Search parameter: <b>based-on</b>
2327   * <p>
2328   * Description: <b>Procedure that caused this media to be created</b><br>
2329   * Type: <b>reference</b><br>
2330   * Path: <b>DocumentReference.context.basedOn</b><br>
2331   * </p>
2332   */
2333  @SearchParamDefinition(name="based-on", path="DocumentReference.context.basedOn", description="Procedure that caused this media to be created", type="reference", target={CarePlan.class, ServiceRequest.class } )
2334  public static final String SP_BASED_ON = "based-on";
2335 /**
2336   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2337   * <p>
2338   * Description: <b>Procedure that caused this media to be created</b><br>
2339   * Type: <b>reference</b><br>
2340   * Path: <b>DocumentReference.context.basedOn</b><br>
2341   * </p>
2342   */
2343  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2344
2345/**
2346   * Constant for fluent queries to be used to add include statements. Specifies
2347   * the path value of "<b>DocumentReference:based-on</b>".
2348   */
2349  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("DocumentReference:based-on").toLocked();
2350
2351 /**
2352   * Search parameter: <b>category</b>
2353   * <p>
2354   * Description: <b>Categorization of document</b><br>
2355   * Type: <b>token</b><br>
2356   * Path: <b>DocumentReference.category</b><br>
2357   * </p>
2358   */
2359  @SearchParamDefinition(name="category", path="DocumentReference.category", description="Categorization of document", type="token" )
2360  public static final String SP_CATEGORY = "category";
2361 /**
2362   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2363   * <p>
2364   * Description: <b>Categorization of document</b><br>
2365   * Type: <b>token</b><br>
2366   * Path: <b>DocumentReference.category</b><br>
2367   * </p>
2368   */
2369  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2370
2371 /**
2372   * Search parameter: <b>contenttype</b>
2373   * <p>
2374   * Description: <b>Mime type of the content, with charset etc.</b><br>
2375   * Type: <b>token</b><br>
2376   * Path: <b>DocumentReference.content.attachment.contentType</b><br>
2377   * </p>
2378   */
2379  @SearchParamDefinition(name="contenttype", path="DocumentReference.content.attachment.contentType", description="Mime type of the content, with charset etc.", type="token" )
2380  public static final String SP_CONTENTTYPE = "contenttype";
2381 /**
2382   * <b>Fluent Client</b> search parameter constant for <b>contenttype</b>
2383   * <p>
2384   * Description: <b>Mime type of the content, with charset etc.</b><br>
2385   * Type: <b>token</b><br>
2386   * Path: <b>DocumentReference.content.attachment.contentType</b><br>
2387   * </p>
2388   */
2389  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTENTTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTENTTYPE);
2390
2391 /**
2392   * Search parameter: <b>creation</b>
2393   * <p>
2394   * Description: <b>Date attachment was first created</b><br>
2395   * Type: <b>date</b><br>
2396   * Path: <b>DocumentReference.content.attachment.creation</b><br>
2397   * </p>
2398   */
2399  @SearchParamDefinition(name="creation", path="DocumentReference.content.attachment.creation", description="Date attachment was first created", type="date" )
2400  public static final String SP_CREATION = "creation";
2401 /**
2402   * <b>Fluent Client</b> search parameter constant for <b>creation</b>
2403   * <p>
2404   * Description: <b>Date attachment was first created</b><br>
2405   * Type: <b>date</b><br>
2406   * Path: <b>DocumentReference.content.attachment.creation</b><br>
2407   * </p>
2408   */
2409  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATION = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATION);
2410
2411 /**
2412   * Search parameter: <b>custodian</b>
2413   * <p>
2414   * Description: <b>Organization which maintains the document</b><br>
2415   * Type: <b>reference</b><br>
2416   * Path: <b>DocumentReference.custodian</b><br>
2417   * </p>
2418   */
2419  @SearchParamDefinition(name="custodian", path="DocumentReference.custodian", description="Organization which maintains the document", type="reference", target={Organization.class } )
2420  public static final String SP_CUSTODIAN = "custodian";
2421 /**
2422   * <b>Fluent Client</b> search parameter constant for <b>custodian</b>
2423   * <p>
2424   * Description: <b>Organization which maintains the document</b><br>
2425   * Type: <b>reference</b><br>
2426   * Path: <b>DocumentReference.custodian</b><br>
2427   * </p>
2428   */
2429  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CUSTODIAN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CUSTODIAN);
2430
2431/**
2432   * Constant for fluent queries to be used to add include statements. Specifies
2433   * the path value of "<b>DocumentReference:custodian</b>".
2434   */
2435  public static final ca.uhn.fhir.model.api.Include INCLUDE_CUSTODIAN = new ca.uhn.fhir.model.api.Include("DocumentReference:custodian").toLocked();
2436
2437 /**
2438   * Search parameter: <b>date</b>
2439   * <p>
2440   * Description: <b>When this document reference was created</b><br>
2441   * Type: <b>date</b><br>
2442   * Path: <b>DocumentReference.date</b><br>
2443   * </p>
2444   */
2445  @SearchParamDefinition(name="date", path="DocumentReference.date", description="When this document reference was created", type="date" )
2446  public static final String SP_DATE = "date";
2447 /**
2448   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2449   * <p>
2450   * Description: <b>When this document reference was created</b><br>
2451   * Type: <b>date</b><br>
2452   * Path: <b>DocumentReference.date</b><br>
2453   * </p>
2454   */
2455  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2456
2457 /**
2458   * Search parameter: <b>description</b>
2459   * <p>
2460   * Description: <b>Human-readable description</b><br>
2461   * Type: <b>string</b><br>
2462   * Path: <b>DocumentReference.description</b><br>
2463   * </p>
2464   */
2465  @SearchParamDefinition(name="description", path="DocumentReference.description", description="Human-readable description", type="string" )
2466  public static final String SP_DESCRIPTION = "description";
2467 /**
2468   * <b>Fluent Client</b> search parameter constant for <b>description</b>
2469   * <p>
2470   * Description: <b>Human-readable description</b><br>
2471   * Type: <b>string</b><br>
2472   * Path: <b>DocumentReference.description</b><br>
2473   * </p>
2474   */
2475  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
2476
2477 /**
2478   * Search parameter: <b>doc-status</b>
2479   * <p>
2480   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
2481   * Type: <b>token</b><br>
2482   * Path: <b>DocumentReference.docStatus</b><br>
2483   * </p>
2484   */
2485  @SearchParamDefinition(name="doc-status", path="DocumentReference.docStatus", description="preliminary | final | amended | entered-in-error", type="token" )
2486  public static final String SP_DOC_STATUS = "doc-status";
2487 /**
2488   * <b>Fluent Client</b> search parameter constant for <b>doc-status</b>
2489   * <p>
2490   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
2491   * Type: <b>token</b><br>
2492   * Path: <b>DocumentReference.docStatus</b><br>
2493   * </p>
2494   */
2495  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DOC_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DOC_STATUS);
2496
2497 /**
2498   * Search parameter: <b>event</b>
2499   * <p>
2500   * Description: <b>Main clinical acts documented</b><br>
2501   * Type: <b>token</b><br>
2502   * Path: <b>DocumentReference.context.event</b><br>
2503   * </p>
2504   */
2505  @SearchParamDefinition(name="event", path="DocumentReference.context.event", description="Main clinical acts documented", type="token" )
2506  public static final String SP_EVENT = "event";
2507 /**
2508   * <b>Fluent Client</b> search parameter constant for <b>event</b>
2509   * <p>
2510   * Description: <b>Main clinical acts documented</b><br>
2511   * Type: <b>token</b><br>
2512   * Path: <b>DocumentReference.context.event</b><br>
2513   * </p>
2514   */
2515  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EVENT);
2516
2517 /**
2518   * Search parameter: <b>facility</b>
2519   * <p>
2520   * Description: <b>Kind of facility where patient was seen</b><br>
2521   * Type: <b>token</b><br>
2522   * Path: <b>DocumentReference.context.facilityType</b><br>
2523   * </p>
2524   */
2525  @SearchParamDefinition(name="facility", path="DocumentReference.context.facilityType", description="Kind of facility where patient was seen", type="token" )
2526  public static final String SP_FACILITY = "facility";
2527 /**
2528   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
2529   * <p>
2530   * Description: <b>Kind of facility where patient was seen</b><br>
2531   * Type: <b>token</b><br>
2532   * Path: <b>DocumentReference.context.facilityType</b><br>
2533   * </p>
2534   */
2535  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FACILITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FACILITY);
2536
2537 /**
2538   * Search parameter: <b>format</b>
2539   * <p>
2540   * Description: <b>Format/content rules for the document</b><br>
2541   * Type: <b>token</b><br>
2542   * Path: <b>DocumentReference.content.format</b><br>
2543   * </p>
2544   */
2545  @SearchParamDefinition(name="format", path="DocumentReference.content.format", description="Format/content rules for the document", type="token" )
2546  public static final String SP_FORMAT = "format";
2547 /**
2548   * <b>Fluent Client</b> search parameter constant for <b>format</b>
2549   * <p>
2550   * Description: <b>Format/content rules for the document</b><br>
2551   * Type: <b>token</b><br>
2552   * Path: <b>DocumentReference.content.format</b><br>
2553   * </p>
2554   */
2555  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMAT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMAT);
2556
2557 /**
2558   * Search parameter: <b>language</b>
2559   * <p>
2560   * Description: <b>Human language of the content (BCP-47)</b><br>
2561   * Type: <b>token</b><br>
2562   * Path: <b>DocumentReference.content.attachment.language</b><br>
2563   * </p>
2564   */
2565  @SearchParamDefinition(name="language", path="DocumentReference.content.attachment.language", description="Human language of the content (BCP-47)", type="token" )
2566  public static final String SP_LANGUAGE = "language";
2567 /**
2568   * <b>Fluent Client</b> search parameter constant for <b>language</b>
2569   * <p>
2570   * Description: <b>Human language of the content (BCP-47)</b><br>
2571   * Type: <b>token</b><br>
2572   * Path: <b>DocumentReference.content.attachment.language</b><br>
2573   * </p>
2574   */
2575  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LANGUAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LANGUAGE);
2576
2577 /**
2578   * Search parameter: <b>location</b>
2579   * <p>
2580   * Description: <b>Uri where the data can be found</b><br>
2581   * Type: <b>uri</b><br>
2582   * Path: <b>DocumentReference.content.attachment.url</b><br>
2583   * </p>
2584   */
2585  @SearchParamDefinition(name="location", path="DocumentReference.content.attachment.url", description="Uri where the data can be found", type="uri" )
2586  public static final String SP_LOCATION = "location";
2587 /**
2588   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2589   * <p>
2590   * Description: <b>Uri where the data can be found</b><br>
2591   * Type: <b>uri</b><br>
2592   * Path: <b>DocumentReference.content.attachment.url</b><br>
2593   * </p>
2594   */
2595  public static final ca.uhn.fhir.rest.gclient.UriClientParam LOCATION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_LOCATION);
2596
2597 /**
2598   * Search parameter: <b>period</b>
2599   * <p>
2600   * Description: <b>Time of service that is being documented</b><br>
2601   * Type: <b>date</b><br>
2602   * Path: <b>DocumentReference.context.period</b><br>
2603   * </p>
2604   */
2605  @SearchParamDefinition(name="period", path="DocumentReference.context.period", description="Time of service that is being documented", type="date" )
2606  public static final String SP_PERIOD = "period";
2607 /**
2608   * <b>Fluent Client</b> search parameter constant for <b>period</b>
2609   * <p>
2610   * Description: <b>Time of service that is being documented</b><br>
2611   * Type: <b>date</b><br>
2612   * Path: <b>DocumentReference.context.period</b><br>
2613   * </p>
2614   */
2615  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
2616
2617 /**
2618   * Search parameter: <b>related</b>
2619   * <p>
2620   * Description: <b>Related identifiers or resources</b><br>
2621   * Type: <b>reference</b><br>
2622   * Path: <b>DocumentReference.context.related</b><br>
2623   * </p>
2624   */
2625  @SearchParamDefinition(name="related", path="DocumentReference.context.related", description="Related identifiers or resources", type="reference", target={Account.class, ActivityDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CapabilityStatement2.class, CarePlan.class, CareTeam.class, CatalogEntry.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseIssue.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceDefinition.class, DeviceMetric.class, DeviceRequest.class, DeviceUseStatement.class, DiagnosticReport.class, DocumentManifest.class, DocumentReference.class, Encounter.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceFocus.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationUsage.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestGroup.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestReport.class, TestScript.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
2626  public static final String SP_RELATED = "related";
2627 /**
2628   * <b>Fluent Client</b> search parameter constant for <b>related</b>
2629   * <p>
2630   * Description: <b>Related identifiers or resources</b><br>
2631   * Type: <b>reference</b><br>
2632   * Path: <b>DocumentReference.context.related</b><br>
2633   * </p>
2634   */
2635  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATED);
2636
2637/**
2638   * Constant for fluent queries to be used to add include statements. Specifies
2639   * the path value of "<b>DocumentReference:related</b>".
2640   */
2641  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED = new ca.uhn.fhir.model.api.Include("DocumentReference:related").toLocked();
2642
2643 /**
2644   * Search parameter: <b>relatesto</b>
2645   * <p>
2646   * Description: <b>Target of the relationship</b><br>
2647   * Type: <b>reference</b><br>
2648   * Path: <b>DocumentReference.relatesTo.target</b><br>
2649   * </p>
2650   */
2651  @SearchParamDefinition(name="relatesto", path="DocumentReference.relatesTo.target", description="Target of the relationship", type="reference", target={DocumentReference.class } )
2652  public static final String SP_RELATESTO = "relatesto";
2653 /**
2654   * <b>Fluent Client</b> search parameter constant for <b>relatesto</b>
2655   * <p>
2656   * Description: <b>Target of the relationship</b><br>
2657   * Type: <b>reference</b><br>
2658   * Path: <b>DocumentReference.relatesTo.target</b><br>
2659   * </p>
2660   */
2661  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATESTO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATESTO);
2662
2663/**
2664   * Constant for fluent queries to be used to add include statements. Specifies
2665   * the path value of "<b>DocumentReference:relatesto</b>".
2666   */
2667  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATESTO = new ca.uhn.fhir.model.api.Include("DocumentReference:relatesto").toLocked();
2668
2669 /**
2670   * Search parameter: <b>relation</b>
2671   * <p>
2672   * Description: <b>replaces | transforms | signs | appends</b><br>
2673   * Type: <b>token</b><br>
2674   * Path: <b>DocumentReference.relatesTo.code</b><br>
2675   * </p>
2676   */
2677  @SearchParamDefinition(name="relation", path="DocumentReference.relatesTo.code", description="replaces | transforms | signs | appends", type="token" )
2678  public static final String SP_RELATION = "relation";
2679 /**
2680   * <b>Fluent Client</b> search parameter constant for <b>relation</b>
2681   * <p>
2682   * Description: <b>replaces | transforms | signs | appends</b><br>
2683   * Type: <b>token</b><br>
2684   * Path: <b>DocumentReference.relatesTo.code</b><br>
2685   * </p>
2686   */
2687  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATION);
2688
2689 /**
2690   * Search parameter: <b>relationship</b>
2691   * <p>
2692   * Description: <b>Combination of relation and relatesTo</b><br>
2693   * Type: <b>composite</b><br>
2694   * Path: <b>DocumentReference.relatesTo</b><br>
2695   * </p>
2696   */
2697  @SearchParamDefinition(name="relationship", path="DocumentReference.relatesTo", description="Combination of relation and relatesTo", type="composite", compositeOf={"relatesto", "relation"} )
2698  public static final String SP_RELATIONSHIP = "relationship";
2699 /**
2700   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
2701   * <p>
2702   * Description: <b>Combination of relation and relatesTo</b><br>
2703   * Type: <b>composite</b><br>
2704   * Path: <b>DocumentReference.relatesTo</b><br>
2705   * </p>
2706   */
2707  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> RELATIONSHIP = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_RELATIONSHIP);
2708
2709 /**
2710   * Search parameter: <b>security-label</b>
2711   * <p>
2712   * Description: <b>Document security-tags</b><br>
2713   * Type: <b>token</b><br>
2714   * Path: <b>DocumentReference.securityLabel</b><br>
2715   * </p>
2716   */
2717  @SearchParamDefinition(name="security-label", path="DocumentReference.securityLabel", description="Document security-tags", type="token" )
2718  public static final String SP_SECURITY_LABEL = "security-label";
2719 /**
2720   * <b>Fluent Client</b> search parameter constant for <b>security-label</b>
2721   * <p>
2722   * Description: <b>Document security-tags</b><br>
2723   * Type: <b>token</b><br>
2724   * Path: <b>DocumentReference.securityLabel</b><br>
2725   * </p>
2726   */
2727  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECURITY_LABEL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECURITY_LABEL);
2728
2729 /**
2730   * Search parameter: <b>setting</b>
2731   * <p>
2732   * Description: <b>Additional details about where the content was created (e.g. clinical specialty)</b><br>
2733   * Type: <b>token</b><br>
2734   * Path: <b>DocumentReference.context.practiceSetting</b><br>
2735   * </p>
2736   */
2737  @SearchParamDefinition(name="setting", path="DocumentReference.context.practiceSetting", description="Additional details about where the content was created (e.g. clinical specialty)", type="token" )
2738  public static final String SP_SETTING = "setting";
2739 /**
2740   * <b>Fluent Client</b> search parameter constant for <b>setting</b>
2741   * <p>
2742   * Description: <b>Additional details about where the content was created (e.g. clinical specialty)</b><br>
2743   * Type: <b>token</b><br>
2744   * Path: <b>DocumentReference.context.practiceSetting</b><br>
2745   * </p>
2746   */
2747  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SETTING = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SETTING);
2748
2749 /**
2750   * Search parameter: <b>status</b>
2751   * <p>
2752   * Description: <b>current | superseded | entered-in-error</b><br>
2753   * Type: <b>token</b><br>
2754   * Path: <b>DocumentReference.status</b><br>
2755   * </p>
2756   */
2757  @SearchParamDefinition(name="status", path="DocumentReference.status", description="current | superseded | entered-in-error", type="token" )
2758  public static final String SP_STATUS = "status";
2759 /**
2760   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2761   * <p>
2762   * Description: <b>current | superseded | entered-in-error</b><br>
2763   * Type: <b>token</b><br>
2764   * Path: <b>DocumentReference.status</b><br>
2765   * </p>
2766   */
2767  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2768
2769 /**
2770   * Search parameter: <b>subject</b>
2771   * <p>
2772   * Description: <b>Who/what is the subject of the document</b><br>
2773   * Type: <b>reference</b><br>
2774   * Path: <b>DocumentReference.subject</b><br>
2775   * </p>
2776   */
2777  @SearchParamDefinition(name="subject", path="DocumentReference.subject", description="Who/what is the subject of the document", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, Specimen.class } )
2778  public static final String SP_SUBJECT = "subject";
2779 /**
2780   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2781   * <p>
2782   * Description: <b>Who/what is the subject of the document</b><br>
2783   * Type: <b>reference</b><br>
2784   * Path: <b>DocumentReference.subject</b><br>
2785   * </p>
2786   */
2787  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2788
2789/**
2790   * Constant for fluent queries to be used to add include statements. Specifies
2791   * the path value of "<b>DocumentReference:subject</b>".
2792   */
2793  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DocumentReference:subject").toLocked();
2794
2795 /**
2796   * Search parameter: <b>encounter</b>
2797   * <p>
2798   * Description: <b>Multiple Resources: 
2799
2800* [Composition](composition.html): Context of the Composition
2801* [DeviceRequest](devicerequest.html): Encounter during which request was created
2802* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2803* [DocumentReference](documentreference.html): Context of the document  content
2804* [Flag](flag.html): Alert relevant during encounter
2805* [List](list.html): Context in which list created
2806* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2807* [Observation](observation.html): Encounter related to the observation
2808* [Procedure](procedure.html): The Encounter during which this Procedure was created
2809* [RiskAssessment](riskassessment.html): Where was assessment performed?
2810* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2811* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2812</b><br>
2813   * Type: <b>reference</b><br>
2814   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
2815   * </p>
2816   */
2817  @SearchParamDefinition(name="encounter", path="Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [Composition](composition.html): Context of the Composition\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [DocumentReference](documentreference.html): Context of the document  content\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [List](list.html): Context in which list created\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
2818  public static final String SP_ENCOUNTER = "encounter";
2819 /**
2820   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2821   * <p>
2822   * Description: <b>Multiple Resources: 
2823
2824* [Composition](composition.html): Context of the Composition
2825* [DeviceRequest](devicerequest.html): Encounter during which request was created
2826* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2827* [DocumentReference](documentreference.html): Context of the document  content
2828* [Flag](flag.html): Alert relevant during encounter
2829* [List](list.html): Context in which list created
2830* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2831* [Observation](observation.html): Encounter related to the observation
2832* [Procedure](procedure.html): The Encounter during which this Procedure was created
2833* [RiskAssessment](riskassessment.html): Where was assessment performed?
2834* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2835* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2836</b><br>
2837   * Type: <b>reference</b><br>
2838   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | DocumentReference.context.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
2839   * </p>
2840   */
2841  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2842
2843/**
2844   * Constant for fluent queries to be used to add include statements. Specifies
2845   * the path value of "<b>DocumentReference:encounter</b>".
2846   */
2847  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("DocumentReference:encounter").toLocked();
2848
2849 /**
2850   * Search parameter: <b>identifier</b>
2851   * <p>
2852   * Description: <b>Multiple Resources: 
2853
2854* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2855* [CarePlan](careplan.html): External Ids for this plan
2856* [CareTeam](careteam.html): External Ids for this team
2857* [Composition](composition.html): Version-independent identifier for the Composition
2858* [Condition](condition.html): A unique identifier of the condition record
2859* [Consent](consent.html): Identifier for this record (external references)
2860* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2861* [DeviceRequest](devicerequest.html): Business identifier for request/order
2862* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2863* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2864* [DocumentReference](documentreference.html): Master Version Specific Identifier
2865* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2866* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2867* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2868* [Goal](goal.html): External Ids for this goal
2869* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
2870* [Immunization](immunization.html): Business identifier
2871* [List](list.html): Business identifier
2872* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2873* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2874* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2875* [MedicationUsage](medicationusage.html): Return statements with this external identifier
2876* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2877* [Observation](observation.html): The unique id for a particular observation
2878* [Procedure](procedure.html): A unique identifier for a procedure
2879* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2880* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2881* [SupplyDelivery](supplydelivery.html): External identifier
2882* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2883* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2884</b><br>
2885   * Type: <b>token</b><br>
2886   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2887   * </p>
2888   */
2889  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Master Version Specific Identifier\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
2890  public static final String SP_IDENTIFIER = "identifier";
2891 /**
2892   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2893   * <p>
2894   * Description: <b>Multiple Resources: 
2895
2896* [AllergyIntolerance](allergyintolerance.html): External ids for this item
2897* [CarePlan](careplan.html): External Ids for this plan
2898* [CareTeam](careteam.html): External Ids for this team
2899* [Composition](composition.html): Version-independent identifier for the Composition
2900* [Condition](condition.html): A unique identifier of the condition record
2901* [Consent](consent.html): Identifier for this record (external references)
2902* [DetectedIssue](detectedissue.html): Unique id for the detected issue
2903* [DeviceRequest](devicerequest.html): Business identifier for request/order
2904* [DiagnosticReport](diagnosticreport.html): An identifier for the report
2905* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
2906* [DocumentReference](documentreference.html): Master Version Specific Identifier
2907* [Encounter](encounter.html): Identifier(s) by which this encounter is known
2908* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
2909* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
2910* [Goal](goal.html): External Ids for this goal
2911* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID and Accession number
2912* [Immunization](immunization.html): Business identifier
2913* [List](list.html): Business identifier
2914* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
2915* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
2916* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
2917* [MedicationUsage](medicationusage.html): Return statements with this external identifier
2918* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
2919* [Observation](observation.html): The unique id for a particular observation
2920* [Procedure](procedure.html): A unique identifier for a procedure
2921* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
2922* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
2923* [SupplyDelivery](supplydelivery.html): External identifier
2924* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
2925* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
2926</b><br>
2927   * Type: <b>token</b><br>
2928   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.masterIdentifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
2929   * </p>
2930   */
2931  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2932
2933 /**
2934   * Search parameter: <b>patient</b>
2935   * <p>
2936   * Description: <b>Multiple Resources: 
2937
2938* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2939* [CarePlan](careplan.html): Who the care plan is for
2940* [CareTeam](careteam.html): Who care team is for
2941* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
2942* [Composition](composition.html): Who and/or what the composition is about
2943* [Condition](condition.html): Who has the condition?
2944* [Consent](consent.html): Who the consent applies to
2945* [DetectedIssue](detectedissue.html): Associated patient
2946* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2947* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
2948* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2949* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2950* [DocumentReference](documentreference.html): Who/what is the subject of the document
2951* [Encounter](encounter.html): The patient or group present at the encounter
2952* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2953* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2954* [Flag](flag.html): The identity of a subject to list flags for
2955* [Goal](goal.html): Who this goal is intended for
2956* [ImagingStudy](imagingstudy.html): Who the study is about
2957* [Immunization](immunization.html): The patient for the vaccination record
2958* [List](list.html): If all resources have the same subject
2959* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2960* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2961* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2962* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
2963* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
2964* [Observation](observation.html): The subject that the observation is about (if patient)
2965* [Procedure](procedure.html): Search by subject - a patient
2966* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2967* [ServiceRequest](servicerequest.html): Search by subject - a patient
2968* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2969* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2970</b><br>
2971   * Type: <b>reference</b><br>
2972   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
2973   * </p>
2974   */
2975  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient or group assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient or group present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={Group.class, Patient.class } )
2976  public static final String SP_PATIENT = "patient";
2977 /**
2978   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2979   * <p>
2980   * Description: <b>Multiple Resources: 
2981
2982* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2983* [CarePlan](careplan.html): Who the care plan is for
2984* [CareTeam](careteam.html): Who care team is for
2985* [ClinicalImpression](clinicalimpression.html): Patient or group assessed
2986* [Composition](composition.html): Who and/or what the composition is about
2987* [Condition](condition.html): Who has the condition?
2988* [Consent](consent.html): Who the consent applies to
2989* [DetectedIssue](detectedissue.html): Associated patient
2990* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2991* [DeviceUseStatement](deviceusestatement.html): Search by subject - a patient
2992* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2993* [DocumentManifest](documentmanifest.html): The subject of the set of documents
2994* [DocumentReference](documentreference.html): Who/what is the subject of the document
2995* [Encounter](encounter.html): The patient or group present at the encounter
2996* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2997* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2998* [Flag](flag.html): The identity of a subject to list flags for
2999* [Goal](goal.html): Who this goal is intended for
3000* [ImagingStudy](imagingstudy.html): Who the study is about
3001* [Immunization](immunization.html): The patient for the vaccination record
3002* [List](list.html): If all resources have the same subject
3003* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3004* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3005* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3006* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
3007* [NutritionOrder](nutritionorder.html): The identity of the person who requires the diet, formula or nutritional supplement
3008* [Observation](observation.html): The subject that the observation is about (if patient)
3009* [Procedure](procedure.html): Search by subject - a patient
3010* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3011* [ServiceRequest](servicerequest.html): Search by subject - a patient
3012* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3013* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3014</b><br>
3015   * Type: <b>reference</b><br>
3016   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.patient | DeviceRequest.subject.where(resolve() is Patient) | DeviceUseStatement.subject | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.patient | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
3017   * </p>
3018   */
3019  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3020
3021/**
3022   * Constant for fluent queries to be used to add include statements. Specifies
3023   * the path value of "<b>DocumentReference:patient</b>".
3024   */
3025  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DocumentReference:patient").toLocked();
3026
3027 /**
3028   * Search parameter: <b>type</b>
3029   * <p>
3030   * Description: <b>Multiple Resources: 
3031
3032* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3033* [Composition](composition.html): Kind of composition (LOINC if possible)
3034* [DocumentManifest](documentmanifest.html): Kind of document set
3035* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3036* [Encounter](encounter.html): Specific type of encounter
3037* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3038</b><br>
3039   * Type: <b>token</b><br>
3040   * Path: <b>AllergyIntolerance.type | Composition.type | DocumentManifest.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type</b><br>
3041   * </p>
3042   */
3043  @SearchParamDefinition(name="type", path="AllergyIntolerance.type | Composition.type | DocumentManifest.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)\r\n* [Composition](composition.html): Kind of composition (LOINC if possible)\r\n* [DocumentManifest](documentmanifest.html): Kind of document set\r\n* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)\r\n* [Encounter](encounter.html): Specific type of encounter\r\n* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management\r\n", type="token" )
3044  public static final String SP_TYPE = "type";
3045 /**
3046   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3047   * <p>
3048   * Description: <b>Multiple Resources: 
3049
3050* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3051* [Composition](composition.html): Kind of composition (LOINC if possible)
3052* [DocumentManifest](documentmanifest.html): Kind of document set
3053* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3054* [Encounter](encounter.html): Specific type of encounter
3055* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3056</b><br>
3057   * Type: <b>token</b><br>
3058   * Path: <b>AllergyIntolerance.type | Composition.type | DocumentManifest.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type</b><br>
3059   * </p>
3060   */
3061  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3062
3063
3064}