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