001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A sample to be used for analysis.
052 */
053@ResourceDef(name="Specimen", profile="http://hl7.org/fhir/StructureDefinition/Specimen")
054public class Specimen extends DomainResource {
055
056    public enum SpecimenCombined {
057        /**
058         * The specimen is in a group.
059         */
060        GROUPED, 
061        /**
062         * The specimen is pooled.
063         */
064        POOLED, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static SpecimenCombined fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("grouped".equals(codeString))
073          return GROUPED;
074        if ("pooled".equals(codeString))
075          return POOLED;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown SpecimenCombined code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case GROUPED: return "grouped";
084            case POOLED: return "pooled";
085            case NULL: return null;
086            default: return "?";
087          }
088        }
089        public String getSystem() {
090          switch (this) {
091            case GROUPED: return "http://hl7.org/fhir/specimen-combined";
092            case POOLED: return "http://hl7.org/fhir/specimen-combined";
093            case NULL: return null;
094            default: return "?";
095          }
096        }
097        public String getDefinition() {
098          switch (this) {
099            case GROUPED: return "The specimen is in a group.";
100            case POOLED: return "The specimen is pooled.";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDisplay() {
106          switch (this) {
107            case GROUPED: return "Grouped";
108            case POOLED: return "Pooled";
109            case NULL: return null;
110            default: return "?";
111          }
112        }
113    }
114
115  public static class SpecimenCombinedEnumFactory implements EnumFactory<SpecimenCombined> {
116    public SpecimenCombined fromCode(String codeString) throws IllegalArgumentException {
117      if (codeString == null || "".equals(codeString))
118            if (codeString == null || "".equals(codeString))
119                return null;
120        if ("grouped".equals(codeString))
121          return SpecimenCombined.GROUPED;
122        if ("pooled".equals(codeString))
123          return SpecimenCombined.POOLED;
124        throw new IllegalArgumentException("Unknown SpecimenCombined code '"+codeString+"'");
125        }
126        public Enumeration<SpecimenCombined> fromType(PrimitiveType<?> code) throws FHIRException {
127          if (code == null)
128            return null;
129          if (code.isEmpty())
130            return new Enumeration<SpecimenCombined>(this, SpecimenCombined.NULL, code);
131          String codeString = ((PrimitiveType) code).asStringValue();
132          if (codeString == null || "".equals(codeString))
133            return new Enumeration<SpecimenCombined>(this, SpecimenCombined.NULL, code);
134        if ("grouped".equals(codeString))
135          return new Enumeration<SpecimenCombined>(this, SpecimenCombined.GROUPED, code);
136        if ("pooled".equals(codeString))
137          return new Enumeration<SpecimenCombined>(this, SpecimenCombined.POOLED, code);
138        throw new FHIRException("Unknown SpecimenCombined code '"+codeString+"'");
139        }
140    public String toCode(SpecimenCombined code) {
141      if (code == SpecimenCombined.GROUPED)
142        return "grouped";
143      if (code == SpecimenCombined.POOLED)
144        return "pooled";
145      return "?";
146      }
147    public String toSystem(SpecimenCombined code) {
148      return code.getSystem();
149      }
150    }
151
152    public enum SpecimenStatus {
153        /**
154         * The physical specimen is present and in good condition.
155         */
156        AVAILABLE, 
157        /**
158         * There is no physical specimen because it is either lost, destroyed or consumed.
159         */
160        UNAVAILABLE, 
161        /**
162         * The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.
163         */
164        UNSATISFACTORY, 
165        /**
166         * The specimen was entered in error and therefore nullified.
167         */
168        ENTEREDINERROR, 
169        /**
170         * added to help the parsers with the generic types
171         */
172        NULL;
173        public static SpecimenStatus fromCode(String codeString) throws FHIRException {
174            if (codeString == null || "".equals(codeString))
175                return null;
176        if ("available".equals(codeString))
177          return AVAILABLE;
178        if ("unavailable".equals(codeString))
179          return UNAVAILABLE;
180        if ("unsatisfactory".equals(codeString))
181          return UNSATISFACTORY;
182        if ("entered-in-error".equals(codeString))
183          return ENTEREDINERROR;
184        if (Configuration.isAcceptInvalidEnums())
185          return null;
186        else
187          throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
188        }
189        public String toCode() {
190          switch (this) {
191            case AVAILABLE: return "available";
192            case UNAVAILABLE: return "unavailable";
193            case UNSATISFACTORY: return "unsatisfactory";
194            case ENTEREDINERROR: return "entered-in-error";
195            case NULL: return null;
196            default: return "?";
197          }
198        }
199        public String getSystem() {
200          switch (this) {
201            case AVAILABLE: return "http://hl7.org/fhir/specimen-status";
202            case UNAVAILABLE: return "http://hl7.org/fhir/specimen-status";
203            case UNSATISFACTORY: return "http://hl7.org/fhir/specimen-status";
204            case ENTEREDINERROR: return "http://hl7.org/fhir/specimen-status";
205            case NULL: return null;
206            default: return "?";
207          }
208        }
209        public String getDefinition() {
210          switch (this) {
211            case AVAILABLE: return "The physical specimen is present and in good condition.";
212            case UNAVAILABLE: return "There is no physical specimen because it is either lost, destroyed or consumed.";
213            case UNSATISFACTORY: return "The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.";
214            case ENTEREDINERROR: return "The specimen was entered in error and therefore nullified.";
215            case NULL: return null;
216            default: return "?";
217          }
218        }
219        public String getDisplay() {
220          switch (this) {
221            case AVAILABLE: return "Available";
222            case UNAVAILABLE: return "Unavailable";
223            case UNSATISFACTORY: return "Unsatisfactory";
224            case ENTEREDINERROR: return "Entered in Error";
225            case NULL: return null;
226            default: return "?";
227          }
228        }
229    }
230
231  public static class SpecimenStatusEnumFactory implements EnumFactory<SpecimenStatus> {
232    public SpecimenStatus fromCode(String codeString) throws IllegalArgumentException {
233      if (codeString == null || "".equals(codeString))
234            if (codeString == null || "".equals(codeString))
235                return null;
236        if ("available".equals(codeString))
237          return SpecimenStatus.AVAILABLE;
238        if ("unavailable".equals(codeString))
239          return SpecimenStatus.UNAVAILABLE;
240        if ("unsatisfactory".equals(codeString))
241          return SpecimenStatus.UNSATISFACTORY;
242        if ("entered-in-error".equals(codeString))
243          return SpecimenStatus.ENTEREDINERROR;
244        throw new IllegalArgumentException("Unknown SpecimenStatus code '"+codeString+"'");
245        }
246        public Enumeration<SpecimenStatus> fromType(PrimitiveType<?> code) throws FHIRException {
247          if (code == null)
248            return null;
249          if (code.isEmpty())
250            return new Enumeration<SpecimenStatus>(this, SpecimenStatus.NULL, code);
251          String codeString = ((PrimitiveType) code).asStringValue();
252          if (codeString == null || "".equals(codeString))
253            return new Enumeration<SpecimenStatus>(this, SpecimenStatus.NULL, code);
254        if ("available".equals(codeString))
255          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.AVAILABLE, code);
256        if ("unavailable".equals(codeString))
257          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNAVAILABLE, code);
258        if ("unsatisfactory".equals(codeString))
259          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNSATISFACTORY, code);
260        if ("entered-in-error".equals(codeString))
261          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.ENTEREDINERROR, code);
262        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
263        }
264    public String toCode(SpecimenStatus code) {
265      if (code == SpecimenStatus.AVAILABLE)
266        return "available";
267      if (code == SpecimenStatus.UNAVAILABLE)
268        return "unavailable";
269      if (code == SpecimenStatus.UNSATISFACTORY)
270        return "unsatisfactory";
271      if (code == SpecimenStatus.ENTEREDINERROR)
272        return "entered-in-error";
273      return "?";
274      }
275    public String toSystem(SpecimenStatus code) {
276      return code.getSystem();
277      }
278    }
279
280    @Block()
281    public static class SpecimenFeatureComponent extends BackboneElement implements IBaseBackboneElement {
282        /**
283         * The landmark or feature being highlighted.
284         */
285        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
286        @Description(shortDefinition="Highlighted feature", formalDefinition="The landmark or feature being highlighted." )
287        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
288        protected CodeableConcept type;
289
290        /**
291         * Description of the feature of the specimen.
292         */
293        @Child(name = "description", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
294        @Description(shortDefinition="Information about the feature", formalDefinition="Description of the feature of the specimen." )
295        protected StringType description;
296
297        private static final long serialVersionUID = 1762224562L;
298
299    /**
300     * Constructor
301     */
302      public SpecimenFeatureComponent() {
303        super();
304      }
305
306    /**
307     * Constructor
308     */
309      public SpecimenFeatureComponent(CodeableConcept type, String description) {
310        super();
311        this.setType(type);
312        this.setDescription(description);
313      }
314
315        /**
316         * @return {@link #type} (The landmark or feature being highlighted.)
317         */
318        public CodeableConcept getType() { 
319          if (this.type == null)
320            if (Configuration.errorOnAutoCreate())
321              throw new Error("Attempt to auto-create SpecimenFeatureComponent.type");
322            else if (Configuration.doAutoCreate())
323              this.type = new CodeableConcept(); // cc
324          return this.type;
325        }
326
327        public boolean hasType() { 
328          return this.type != null && !this.type.isEmpty();
329        }
330
331        /**
332         * @param value {@link #type} (The landmark or feature being highlighted.)
333         */
334        public SpecimenFeatureComponent setType(CodeableConcept value) { 
335          this.type = value;
336          return this;
337        }
338
339        /**
340         * @return {@link #description} (Description of the feature of the specimen.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
341         */
342        public StringType getDescriptionElement() { 
343          if (this.description == null)
344            if (Configuration.errorOnAutoCreate())
345              throw new Error("Attempt to auto-create SpecimenFeatureComponent.description");
346            else if (Configuration.doAutoCreate())
347              this.description = new StringType(); // bb
348          return this.description;
349        }
350
351        public boolean hasDescriptionElement() { 
352          return this.description != null && !this.description.isEmpty();
353        }
354
355        public boolean hasDescription() { 
356          return this.description != null && !this.description.isEmpty();
357        }
358
359        /**
360         * @param value {@link #description} (Description of the feature of the specimen.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
361         */
362        public SpecimenFeatureComponent setDescriptionElement(StringType value) { 
363          this.description = value;
364          return this;
365        }
366
367        /**
368         * @return Description of the feature of the specimen.
369         */
370        public String getDescription() { 
371          return this.description == null ? null : this.description.getValue();
372        }
373
374        /**
375         * @param value Description of the feature of the specimen.
376         */
377        public SpecimenFeatureComponent setDescription(String value) { 
378            if (this.description == null)
379              this.description = new StringType();
380            this.description.setValue(value);
381          return this;
382        }
383
384        protected void listChildren(List<Property> children) {
385          super.listChildren(children);
386          children.add(new Property("type", "CodeableConcept", "The landmark or feature being highlighted.", 0, 1, type));
387          children.add(new Property("description", "string", "Description of the feature of the specimen.", 0, 1, description));
388        }
389
390        @Override
391        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
392          switch (_hash) {
393          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The landmark or feature being highlighted.", 0, 1, type);
394          case -1724546052: /*description*/  return new Property("description", "string", "Description of the feature of the specimen.", 0, 1, description);
395          default: return super.getNamedProperty(_hash, _name, _checkValid);
396          }
397
398        }
399
400      @Override
401      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
402        switch (hash) {
403        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
404        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
405        default: return super.getProperty(hash, name, checkValid);
406        }
407
408      }
409
410      @Override
411      public Base setProperty(int hash, String name, Base value) throws FHIRException {
412        switch (hash) {
413        case 3575610: // type
414          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
415          return value;
416        case -1724546052: // description
417          this.description = TypeConvertor.castToString(value); // StringType
418          return value;
419        default: return super.setProperty(hash, name, value);
420        }
421
422      }
423
424      @Override
425      public Base setProperty(String name, Base value) throws FHIRException {
426        if (name.equals("type")) {
427          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
428        } else if (name.equals("description")) {
429          this.description = TypeConvertor.castToString(value); // StringType
430        } else
431          return super.setProperty(name, value);
432        return value;
433      }
434
435  @Override
436  public void removeChild(String name, Base value) throws FHIRException {
437        if (name.equals("type")) {
438          this.type = null;
439        } else if (name.equals("description")) {
440          this.description = null;
441        } else
442          super.removeChild(name, value);
443        
444      }
445
446      @Override
447      public Base makeProperty(int hash, String name) throws FHIRException {
448        switch (hash) {
449        case 3575610:  return getType();
450        case -1724546052:  return getDescriptionElement();
451        default: return super.makeProperty(hash, name);
452        }
453
454      }
455
456      @Override
457      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
458        switch (hash) {
459        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
460        case -1724546052: /*description*/ return new String[] {"string"};
461        default: return super.getTypesForProperty(hash, name);
462        }
463
464      }
465
466      @Override
467      public Base addChild(String name) throws FHIRException {
468        if (name.equals("type")) {
469          this.type = new CodeableConcept();
470          return this.type;
471        }
472        else if (name.equals("description")) {
473          throw new FHIRException("Cannot call addChild on a singleton property Specimen.feature.description");
474        }
475        else
476          return super.addChild(name);
477      }
478
479      public SpecimenFeatureComponent copy() {
480        SpecimenFeatureComponent dst = new SpecimenFeatureComponent();
481        copyValues(dst);
482        return dst;
483      }
484
485      public void copyValues(SpecimenFeatureComponent dst) {
486        super.copyValues(dst);
487        dst.type = type == null ? null : type.copy();
488        dst.description = description == null ? null : description.copy();
489      }
490
491      @Override
492      public boolean equalsDeep(Base other_) {
493        if (!super.equalsDeep(other_))
494          return false;
495        if (!(other_ instanceof SpecimenFeatureComponent))
496          return false;
497        SpecimenFeatureComponent o = (SpecimenFeatureComponent) other_;
498        return compareDeep(type, o.type, true) && compareDeep(description, o.description, true);
499      }
500
501      @Override
502      public boolean equalsShallow(Base other_) {
503        if (!super.equalsShallow(other_))
504          return false;
505        if (!(other_ instanceof SpecimenFeatureComponent))
506          return false;
507        SpecimenFeatureComponent o = (SpecimenFeatureComponent) other_;
508        return compareValues(description, o.description, true);
509      }
510
511      public boolean isEmpty() {
512        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, description);
513      }
514
515  public String fhirType() {
516    return "Specimen.feature";
517
518  }
519
520  }
521
522    @Block()
523    public static class SpecimenCollectionComponent extends BackboneElement implements IBaseBackboneElement {
524        /**
525         * Person who collected the specimen.
526         */
527        @Child(name = "collector", type = {Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class}, order=1, min=0, max=1, modifier=false, summary=true)
528        @Description(shortDefinition="Who collected the specimen", formalDefinition="Person who collected the specimen." )
529        protected Reference collector;
530
531        /**
532         * Time when specimen was collected from subject - the physiologically relevant time.
533         */
534        @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
535        @Description(shortDefinition="Collection time", formalDefinition="Time when specimen was collected from subject - the physiologically relevant time." )
536        protected DataType collected;
537
538        /**
539         * The span of time over which the collection of a specimen occurred.
540         */
541        @Child(name = "duration", type = {Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
542        @Description(shortDefinition="How long it took to collect specimen", formalDefinition="The span of time over which the collection of a specimen occurred." )
543        protected Duration duration;
544
545        /**
546         * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.
547         */
548        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
549        @Description(shortDefinition="The quantity of specimen collected", formalDefinition="The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample." )
550        protected Quantity quantity;
551
552        /**
553         * A coded value specifying the technique that is used to perform the procedure.
554         */
555        @Child(name = "method", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
556        @Description(shortDefinition="Technique used to perform collection", formalDefinition="A coded value specifying the technique that is used to perform the procedure." )
557        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-collection-method")
558        protected CodeableConcept method;
559
560        /**
561         * A coded value specifying the technique that is used to perform the procedure.
562         */
563        @Child(name = "device", type = {CodeableReference.class}, order=6, min=0, max=1, modifier=false, summary=false)
564        @Description(shortDefinition="Device used to perform collection", formalDefinition="A coded value specifying the technique that is used to perform the procedure." )
565        protected CodeableReference device;
566
567        /**
568         * The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).
569         */
570        @Child(name = "procedure", type = {Procedure.class}, order=7, min=0, max=1, modifier=false, summary=false)
571        @Description(shortDefinition="The procedure that collects the specimen", formalDefinition="The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample)." )
572        protected Reference procedure;
573
574        /**
575         * Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.
576         */
577        @Child(name = "bodySite", type = {CodeableReference.class}, order=8, min=0, max=1, modifier=false, summary=false)
578        @Description(shortDefinition="Anatomical collection site", formalDefinition="Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens." )
579        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
580        protected CodeableReference bodySite;
581
582        /**
583         * Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.
584         */
585        @Child(name = "fastingStatus", type = {CodeableConcept.class, Duration.class}, order=9, min=0, max=1, modifier=false, summary=true)
586        @Description(shortDefinition="Whether or how long patient abstained from food and/or drink", formalDefinition="Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection." )
587        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0916")
588        protected DataType fastingStatus;
589
590        private static final long serialVersionUID = 953983070L;
591
592    /**
593     * Constructor
594     */
595      public SpecimenCollectionComponent() {
596        super();
597      }
598
599        /**
600         * @return {@link #collector} (Person who collected the specimen.)
601         */
602        public Reference getCollector() { 
603          if (this.collector == null)
604            if (Configuration.errorOnAutoCreate())
605              throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector");
606            else if (Configuration.doAutoCreate())
607              this.collector = new Reference(); // cc
608          return this.collector;
609        }
610
611        public boolean hasCollector() { 
612          return this.collector != null && !this.collector.isEmpty();
613        }
614
615        /**
616         * @param value {@link #collector} (Person who collected the specimen.)
617         */
618        public SpecimenCollectionComponent setCollector(Reference value) { 
619          this.collector = value;
620          return this;
621        }
622
623        /**
624         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
625         */
626        public DataType getCollected() { 
627          return this.collected;
628        }
629
630        /**
631         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
632         */
633        public DateTimeType getCollectedDateTimeType() throws FHIRException { 
634          if (this.collected == null)
635            this.collected = new DateTimeType();
636          if (!(this.collected instanceof DateTimeType))
637            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered");
638          return (DateTimeType) this.collected;
639        }
640
641        public boolean hasCollectedDateTimeType() { 
642          return this != null && this.collected instanceof DateTimeType;
643        }
644
645        /**
646         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
647         */
648        public Period getCollectedPeriod() throws FHIRException { 
649          if (this.collected == null)
650            this.collected = new Period();
651          if (!(this.collected instanceof Period))
652            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered");
653          return (Period) this.collected;
654        }
655
656        public boolean hasCollectedPeriod() { 
657          return this != null && this.collected instanceof Period;
658        }
659
660        public boolean hasCollected() { 
661          return this.collected != null && !this.collected.isEmpty();
662        }
663
664        /**
665         * @param value {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
666         */
667        public SpecimenCollectionComponent setCollected(DataType value) { 
668          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
669            throw new FHIRException("Not the right type for Specimen.collection.collected[x]: "+value.fhirType());
670          this.collected = value;
671          return this;
672        }
673
674        /**
675         * @return {@link #duration} (The span of time over which the collection of a specimen occurred.)
676         */
677        public Duration getDuration() { 
678          if (this.duration == null)
679            if (Configuration.errorOnAutoCreate())
680              throw new Error("Attempt to auto-create SpecimenCollectionComponent.duration");
681            else if (Configuration.doAutoCreate())
682              this.duration = new Duration(); // cc
683          return this.duration;
684        }
685
686        public boolean hasDuration() { 
687          return this.duration != null && !this.duration.isEmpty();
688        }
689
690        /**
691         * @param value {@link #duration} (The span of time over which the collection of a specimen occurred.)
692         */
693        public SpecimenCollectionComponent setDuration(Duration value) { 
694          this.duration = value;
695          return this;
696        }
697
698        /**
699         * @return {@link #quantity} (The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.)
700         */
701        public Quantity getQuantity() { 
702          if (this.quantity == null)
703            if (Configuration.errorOnAutoCreate())
704              throw new Error("Attempt to auto-create SpecimenCollectionComponent.quantity");
705            else if (Configuration.doAutoCreate())
706              this.quantity = new Quantity(); // cc
707          return this.quantity;
708        }
709
710        public boolean hasQuantity() { 
711          return this.quantity != null && !this.quantity.isEmpty();
712        }
713
714        /**
715         * @param value {@link #quantity} (The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.)
716         */
717        public SpecimenCollectionComponent setQuantity(Quantity value) { 
718          this.quantity = value;
719          return this;
720        }
721
722        /**
723         * @return {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
724         */
725        public CodeableConcept getMethod() { 
726          if (this.method == null)
727            if (Configuration.errorOnAutoCreate())
728              throw new Error("Attempt to auto-create SpecimenCollectionComponent.method");
729            else if (Configuration.doAutoCreate())
730              this.method = new CodeableConcept(); // cc
731          return this.method;
732        }
733
734        public boolean hasMethod() { 
735          return this.method != null && !this.method.isEmpty();
736        }
737
738        /**
739         * @param value {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
740         */
741        public SpecimenCollectionComponent setMethod(CodeableConcept value) { 
742          this.method = value;
743          return this;
744        }
745
746        /**
747         * @return {@link #device} (A coded value specifying the technique that is used to perform the procedure.)
748         */
749        public CodeableReference getDevice() { 
750          if (this.device == null)
751            if (Configuration.errorOnAutoCreate())
752              throw new Error("Attempt to auto-create SpecimenCollectionComponent.device");
753            else if (Configuration.doAutoCreate())
754              this.device = new CodeableReference(); // cc
755          return this.device;
756        }
757
758        public boolean hasDevice() { 
759          return this.device != null && !this.device.isEmpty();
760        }
761
762        /**
763         * @param value {@link #device} (A coded value specifying the technique that is used to perform the procedure.)
764         */
765        public SpecimenCollectionComponent setDevice(CodeableReference value) { 
766          this.device = value;
767          return this;
768        }
769
770        /**
771         * @return {@link #procedure} (The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).)
772         */
773        public Reference getProcedure() { 
774          if (this.procedure == null)
775            if (Configuration.errorOnAutoCreate())
776              throw new Error("Attempt to auto-create SpecimenCollectionComponent.procedure");
777            else if (Configuration.doAutoCreate())
778              this.procedure = new Reference(); // cc
779          return this.procedure;
780        }
781
782        public boolean hasProcedure() { 
783          return this.procedure != null && !this.procedure.isEmpty();
784        }
785
786        /**
787         * @param value {@link #procedure} (The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).)
788         */
789        public SpecimenCollectionComponent setProcedure(Reference value) { 
790          this.procedure = value;
791          return this;
792        }
793
794        /**
795         * @return {@link #bodySite} (Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.)
796         */
797        public CodeableReference getBodySite() { 
798          if (this.bodySite == null)
799            if (Configuration.errorOnAutoCreate())
800              throw new Error("Attempt to auto-create SpecimenCollectionComponent.bodySite");
801            else if (Configuration.doAutoCreate())
802              this.bodySite = new CodeableReference(); // cc
803          return this.bodySite;
804        }
805
806        public boolean hasBodySite() { 
807          return this.bodySite != null && !this.bodySite.isEmpty();
808        }
809
810        /**
811         * @param value {@link #bodySite} (Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.)
812         */
813        public SpecimenCollectionComponent setBodySite(CodeableReference value) { 
814          this.bodySite = value;
815          return this;
816        }
817
818        /**
819         * @return {@link #fastingStatus} (Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.)
820         */
821        public DataType getFastingStatus() { 
822          return this.fastingStatus;
823        }
824
825        /**
826         * @return {@link #fastingStatus} (Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.)
827         */
828        public CodeableConcept getFastingStatusCodeableConcept() throws FHIRException { 
829          if (this.fastingStatus == null)
830            this.fastingStatus = new CodeableConcept();
831          if (!(this.fastingStatus instanceof CodeableConcept))
832            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.fastingStatus.getClass().getName()+" was encountered");
833          return (CodeableConcept) this.fastingStatus;
834        }
835
836        public boolean hasFastingStatusCodeableConcept() { 
837          return this != null && this.fastingStatus instanceof CodeableConcept;
838        }
839
840        /**
841         * @return {@link #fastingStatus} (Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.)
842         */
843        public Duration getFastingStatusDuration() throws FHIRException { 
844          if (this.fastingStatus == null)
845            this.fastingStatus = new Duration();
846          if (!(this.fastingStatus instanceof Duration))
847            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.fastingStatus.getClass().getName()+" was encountered");
848          return (Duration) this.fastingStatus;
849        }
850
851        public boolean hasFastingStatusDuration() { 
852          return this != null && this.fastingStatus instanceof Duration;
853        }
854
855        public boolean hasFastingStatus() { 
856          return this.fastingStatus != null && !this.fastingStatus.isEmpty();
857        }
858
859        /**
860         * @param value {@link #fastingStatus} (Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.)
861         */
862        public SpecimenCollectionComponent setFastingStatus(DataType value) { 
863          if (value != null && !(value instanceof CodeableConcept || value instanceof Duration))
864            throw new FHIRException("Not the right type for Specimen.collection.fastingStatus[x]: "+value.fhirType());
865          this.fastingStatus = value;
866          return this;
867        }
868
869        protected void listChildren(List<Property> children) {
870          super.listChildren(children);
871          children.add(new Property("collector", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Person who collected the specimen.", 0, 1, collector));
872          children.add(new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected));
873          children.add(new Property("duration", "Duration", "The span of time over which the collection of a specimen occurred.", 0, 1, duration));
874          children.add(new Property("quantity", "Quantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, 1, quantity));
875          children.add(new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, method));
876          children.add(new Property("device", "CodeableReference(Device)", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, device));
877          children.add(new Property("procedure", "Reference(Procedure)", "The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).", 0, 1, procedure));
878          children.add(new Property("bodySite", "CodeableReference(BodyStructure)", "Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.", 0, 1, bodySite));
879          children.add(new Property("fastingStatus[x]", "CodeableConcept|Duration", "Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.", 0, 1, fastingStatus));
880        }
881
882        @Override
883        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
884          switch (_hash) {
885          case 1883491469: /*collector*/  return new Property("collector", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "Person who collected the specimen.", 0, 1, collector);
886          case 1632037015: /*collected[x]*/  return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected);
887          case 1883491145: /*collected*/  return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected);
888          case 2005009924: /*collectedDateTime*/  return new Property("collected[x]", "dateTime", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected);
889          case 653185642: /*collectedPeriod*/  return new Property("collected[x]", "Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected);
890          case -1992012396: /*duration*/  return new Property("duration", "Duration", "The span of time over which the collection of a specimen occurred.", 0, 1, duration);
891          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, 1, quantity);
892          case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, method);
893          case -1335157162: /*device*/  return new Property("device", "CodeableReference(Device)", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, device);
894          case -1095204141: /*procedure*/  return new Property("procedure", "Reference(Procedure)", "The procedure event during which the specimen was collected (e.g. the surgery leading to the collection of a pathology sample).", 0, 1, procedure);
895          case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableReference(BodyStructure)", "Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.", 0, 1, bodySite);
896          case -570577944: /*fastingStatus[x]*/  return new Property("fastingStatus[x]", "CodeableConcept|Duration", "Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.", 0, 1, fastingStatus);
897          case -701550184: /*fastingStatus*/  return new Property("fastingStatus[x]", "CodeableConcept|Duration", "Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.", 0, 1, fastingStatus);
898          case -1153232151: /*fastingStatusCodeableConcept*/  return new Property("fastingStatus[x]", "CodeableConcept", "Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.", 0, 1, fastingStatus);
899          case -433140916: /*fastingStatusDuration*/  return new Property("fastingStatus[x]", "Duration", "Abstinence or reduction from some or all food, drink, or both, for a period of time prior to sample collection.", 0, 1, fastingStatus);
900          default: return super.getNamedProperty(_hash, _name, _checkValid);
901          }
902
903        }
904
905      @Override
906      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
907        switch (hash) {
908        case 1883491469: /*collector*/ return this.collector == null ? new Base[0] : new Base[] {this.collector}; // Reference
909        case 1883491145: /*collected*/ return this.collected == null ? new Base[0] : new Base[] {this.collected}; // DataType
910        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Duration
911        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
912        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
913        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // CodeableReference
914        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // Reference
915        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableReference
916        case -701550184: /*fastingStatus*/ return this.fastingStatus == null ? new Base[0] : new Base[] {this.fastingStatus}; // DataType
917        default: return super.getProperty(hash, name, checkValid);
918        }
919
920      }
921
922      @Override
923      public Base setProperty(int hash, String name, Base value) throws FHIRException {
924        switch (hash) {
925        case 1883491469: // collector
926          this.collector = TypeConvertor.castToReference(value); // Reference
927          return value;
928        case 1883491145: // collected
929          this.collected = TypeConvertor.castToType(value); // DataType
930          return value;
931        case -1992012396: // duration
932          this.duration = TypeConvertor.castToDuration(value); // Duration
933          return value;
934        case -1285004149: // quantity
935          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
936          return value;
937        case -1077554975: // method
938          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
939          return value;
940        case -1335157162: // device
941          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
942          return value;
943        case -1095204141: // procedure
944          this.procedure = TypeConvertor.castToReference(value); // Reference
945          return value;
946        case 1702620169: // bodySite
947          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
948          return value;
949        case -701550184: // fastingStatus
950          this.fastingStatus = TypeConvertor.castToType(value); // DataType
951          return value;
952        default: return super.setProperty(hash, name, value);
953        }
954
955      }
956
957      @Override
958      public Base setProperty(String name, Base value) throws FHIRException {
959        if (name.equals("collector")) {
960          this.collector = TypeConvertor.castToReference(value); // Reference
961        } else if (name.equals("collected[x]")) {
962          this.collected = TypeConvertor.castToType(value); // DataType
963        } else if (name.equals("duration")) {
964          this.duration = TypeConvertor.castToDuration(value); // Duration
965        } else if (name.equals("quantity")) {
966          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
967        } else if (name.equals("method")) {
968          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
969        } else if (name.equals("device")) {
970          this.device = TypeConvertor.castToCodeableReference(value); // CodeableReference
971        } else if (name.equals("procedure")) {
972          this.procedure = TypeConvertor.castToReference(value); // Reference
973        } else if (name.equals("bodySite")) {
974          this.bodySite = TypeConvertor.castToCodeableReference(value); // CodeableReference
975        } else if (name.equals("fastingStatus[x]")) {
976          this.fastingStatus = TypeConvertor.castToType(value); // DataType
977        } else
978          return super.setProperty(name, value);
979        return value;
980      }
981
982  @Override
983  public void removeChild(String name, Base value) throws FHIRException {
984        if (name.equals("collector")) {
985          this.collector = null;
986        } else if (name.equals("collected[x]")) {
987          this.collected = null;
988        } else if (name.equals("duration")) {
989          this.duration = null;
990        } else if (name.equals("quantity")) {
991          this.quantity = null;
992        } else if (name.equals("method")) {
993          this.method = null;
994        } else if (name.equals("device")) {
995          this.device = null;
996        } else if (name.equals("procedure")) {
997          this.procedure = null;
998        } else if (name.equals("bodySite")) {
999          this.bodySite = null;
1000        } else if (name.equals("fastingStatus[x]")) {
1001          this.fastingStatus = null;
1002        } else
1003          super.removeChild(name, value);
1004        
1005      }
1006
1007      @Override
1008      public Base makeProperty(int hash, String name) throws FHIRException {
1009        switch (hash) {
1010        case 1883491469:  return getCollector();
1011        case 1632037015:  return getCollected();
1012        case 1883491145:  return getCollected();
1013        case -1992012396:  return getDuration();
1014        case -1285004149:  return getQuantity();
1015        case -1077554975:  return getMethod();
1016        case -1335157162:  return getDevice();
1017        case -1095204141:  return getProcedure();
1018        case 1702620169:  return getBodySite();
1019        case -570577944:  return getFastingStatus();
1020        case -701550184:  return getFastingStatus();
1021        default: return super.makeProperty(hash, name);
1022        }
1023
1024      }
1025
1026      @Override
1027      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1028        switch (hash) {
1029        case 1883491469: /*collector*/ return new String[] {"Reference"};
1030        case 1883491145: /*collected*/ return new String[] {"dateTime", "Period"};
1031        case -1992012396: /*duration*/ return new String[] {"Duration"};
1032        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1033        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
1034        case -1335157162: /*device*/ return new String[] {"CodeableReference"};
1035        case -1095204141: /*procedure*/ return new String[] {"Reference"};
1036        case 1702620169: /*bodySite*/ return new String[] {"CodeableReference"};
1037        case -701550184: /*fastingStatus*/ return new String[] {"CodeableConcept", "Duration"};
1038        default: return super.getTypesForProperty(hash, name);
1039        }
1040
1041      }
1042
1043      @Override
1044      public Base addChild(String name) throws FHIRException {
1045        if (name.equals("collector")) {
1046          this.collector = new Reference();
1047          return this.collector;
1048        }
1049        else if (name.equals("collectedDateTime")) {
1050          this.collected = new DateTimeType();
1051          return this.collected;
1052        }
1053        else if (name.equals("collectedPeriod")) {
1054          this.collected = new Period();
1055          return this.collected;
1056        }
1057        else if (name.equals("duration")) {
1058          this.duration = new Duration();
1059          return this.duration;
1060        }
1061        else if (name.equals("quantity")) {
1062          this.quantity = new Quantity();
1063          return this.quantity;
1064        }
1065        else if (name.equals("method")) {
1066          this.method = new CodeableConcept();
1067          return this.method;
1068        }
1069        else if (name.equals("device")) {
1070          this.device = new CodeableReference();
1071          return this.device;
1072        }
1073        else if (name.equals("procedure")) {
1074          this.procedure = new Reference();
1075          return this.procedure;
1076        }
1077        else if (name.equals("bodySite")) {
1078          this.bodySite = new CodeableReference();
1079          return this.bodySite;
1080        }
1081        else if (name.equals("fastingStatusCodeableConcept")) {
1082          this.fastingStatus = new CodeableConcept();
1083          return this.fastingStatus;
1084        }
1085        else if (name.equals("fastingStatusDuration")) {
1086          this.fastingStatus = new Duration();
1087          return this.fastingStatus;
1088        }
1089        else
1090          return super.addChild(name);
1091      }
1092
1093      public SpecimenCollectionComponent copy() {
1094        SpecimenCollectionComponent dst = new SpecimenCollectionComponent();
1095        copyValues(dst);
1096        return dst;
1097      }
1098
1099      public void copyValues(SpecimenCollectionComponent dst) {
1100        super.copyValues(dst);
1101        dst.collector = collector == null ? null : collector.copy();
1102        dst.collected = collected == null ? null : collected.copy();
1103        dst.duration = duration == null ? null : duration.copy();
1104        dst.quantity = quantity == null ? null : quantity.copy();
1105        dst.method = method == null ? null : method.copy();
1106        dst.device = device == null ? null : device.copy();
1107        dst.procedure = procedure == null ? null : procedure.copy();
1108        dst.bodySite = bodySite == null ? null : bodySite.copy();
1109        dst.fastingStatus = fastingStatus == null ? null : fastingStatus.copy();
1110      }
1111
1112      @Override
1113      public boolean equalsDeep(Base other_) {
1114        if (!super.equalsDeep(other_))
1115          return false;
1116        if (!(other_ instanceof SpecimenCollectionComponent))
1117          return false;
1118        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other_;
1119        return compareDeep(collector, o.collector, true) && compareDeep(collected, o.collected, true) && compareDeep(duration, o.duration, true)
1120           && compareDeep(quantity, o.quantity, true) && compareDeep(method, o.method, true) && compareDeep(device, o.device, true)
1121           && compareDeep(procedure, o.procedure, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(fastingStatus, o.fastingStatus, true)
1122          ;
1123      }
1124
1125      @Override
1126      public boolean equalsShallow(Base other_) {
1127        if (!super.equalsShallow(other_))
1128          return false;
1129        if (!(other_ instanceof SpecimenCollectionComponent))
1130          return false;
1131        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other_;
1132        return true;
1133      }
1134
1135      public boolean isEmpty() {
1136        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(collector, collected, duration
1137          , quantity, method, device, procedure, bodySite, fastingStatus);
1138      }
1139
1140  public String fhirType() {
1141    return "Specimen.collection";
1142
1143  }
1144
1145  }
1146
1147    @Block()
1148    public static class SpecimenProcessingComponent extends BackboneElement implements IBaseBackboneElement {
1149        /**
1150         * Textual description of procedure.
1151         */
1152        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1153        @Description(shortDefinition="Textual description of procedure", formalDefinition="Textual description of procedure." )
1154        protected StringType description;
1155
1156        /**
1157         * A coded value specifying the method used to process the specimen.
1158         */
1159        @Child(name = "method", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1160        @Description(shortDefinition="Indicates the treatment step  applied to the specimen", formalDefinition="A coded value specifying the method used to process the specimen." )
1161        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-processing-method")
1162        protected CodeableConcept method;
1163
1164        /**
1165         * Material used in the processing step.
1166         */
1167        @Child(name = "additive", type = {Substance.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1168        @Description(shortDefinition="Material used in the processing step", formalDefinition="Material used in the processing step." )
1169        protected List<Reference> additive;
1170
1171        /**
1172         * A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.
1173         */
1174        @Child(name = "time", type = {DateTimeType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1175        @Description(shortDefinition="Date and time of specimen processing", formalDefinition="A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin." )
1176        protected DataType time;
1177
1178        private static final long serialVersionUID = -329044827L;
1179
1180    /**
1181     * Constructor
1182     */
1183      public SpecimenProcessingComponent() {
1184        super();
1185      }
1186
1187        /**
1188         * @return {@link #description} (Textual description of procedure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1189         */
1190        public StringType getDescriptionElement() { 
1191          if (this.description == null)
1192            if (Configuration.errorOnAutoCreate())
1193              throw new Error("Attempt to auto-create SpecimenProcessingComponent.description");
1194            else if (Configuration.doAutoCreate())
1195              this.description = new StringType(); // bb
1196          return this.description;
1197        }
1198
1199        public boolean hasDescriptionElement() { 
1200          return this.description != null && !this.description.isEmpty();
1201        }
1202
1203        public boolean hasDescription() { 
1204          return this.description != null && !this.description.isEmpty();
1205        }
1206
1207        /**
1208         * @param value {@link #description} (Textual description of procedure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1209         */
1210        public SpecimenProcessingComponent setDescriptionElement(StringType value) { 
1211          this.description = value;
1212          return this;
1213        }
1214
1215        /**
1216         * @return Textual description of procedure.
1217         */
1218        public String getDescription() { 
1219          return this.description == null ? null : this.description.getValue();
1220        }
1221
1222        /**
1223         * @param value Textual description of procedure.
1224         */
1225        public SpecimenProcessingComponent setDescription(String value) { 
1226          if (Utilities.noString(value))
1227            this.description = null;
1228          else {
1229            if (this.description == null)
1230              this.description = new StringType();
1231            this.description.setValue(value);
1232          }
1233          return this;
1234        }
1235
1236        /**
1237         * @return {@link #method} (A coded value specifying the method used to process the specimen.)
1238         */
1239        public CodeableConcept getMethod() { 
1240          if (this.method == null)
1241            if (Configuration.errorOnAutoCreate())
1242              throw new Error("Attempt to auto-create SpecimenProcessingComponent.method");
1243            else if (Configuration.doAutoCreate())
1244              this.method = new CodeableConcept(); // cc
1245          return this.method;
1246        }
1247
1248        public boolean hasMethod() { 
1249          return this.method != null && !this.method.isEmpty();
1250        }
1251
1252        /**
1253         * @param value {@link #method} (A coded value specifying the method used to process the specimen.)
1254         */
1255        public SpecimenProcessingComponent setMethod(CodeableConcept value) { 
1256          this.method = value;
1257          return this;
1258        }
1259
1260        /**
1261         * @return {@link #additive} (Material used in the processing step.)
1262         */
1263        public List<Reference> getAdditive() { 
1264          if (this.additive == null)
1265            this.additive = new ArrayList<Reference>();
1266          return this.additive;
1267        }
1268
1269        /**
1270         * @return Returns a reference to <code>this</code> for easy method chaining
1271         */
1272        public SpecimenProcessingComponent setAdditive(List<Reference> theAdditive) { 
1273          this.additive = theAdditive;
1274          return this;
1275        }
1276
1277        public boolean hasAdditive() { 
1278          if (this.additive == null)
1279            return false;
1280          for (Reference item : this.additive)
1281            if (!item.isEmpty())
1282              return true;
1283          return false;
1284        }
1285
1286        public Reference addAdditive() { //3
1287          Reference t = new Reference();
1288          if (this.additive == null)
1289            this.additive = new ArrayList<Reference>();
1290          this.additive.add(t);
1291          return t;
1292        }
1293
1294        public SpecimenProcessingComponent addAdditive(Reference t) { //3
1295          if (t == null)
1296            return this;
1297          if (this.additive == null)
1298            this.additive = new ArrayList<Reference>();
1299          this.additive.add(t);
1300          return this;
1301        }
1302
1303        /**
1304         * @return The first repetition of repeating field {@link #additive}, creating it if it does not already exist {3}
1305         */
1306        public Reference getAdditiveFirstRep() { 
1307          if (getAdditive().isEmpty()) {
1308            addAdditive();
1309          }
1310          return getAdditive().get(0);
1311        }
1312
1313        /**
1314         * @return {@link #time} (A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.)
1315         */
1316        public DataType getTime() { 
1317          return this.time;
1318        }
1319
1320        /**
1321         * @return {@link #time} (A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.)
1322         */
1323        public DateTimeType getTimeDateTimeType() throws FHIRException { 
1324          if (this.time == null)
1325            this.time = new DateTimeType();
1326          if (!(this.time instanceof DateTimeType))
1327            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.time.getClass().getName()+" was encountered");
1328          return (DateTimeType) this.time;
1329        }
1330
1331        public boolean hasTimeDateTimeType() { 
1332          return this != null && this.time instanceof DateTimeType;
1333        }
1334
1335        /**
1336         * @return {@link #time} (A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.)
1337         */
1338        public Period getTimePeriod() throws FHIRException { 
1339          if (this.time == null)
1340            this.time = new Period();
1341          if (!(this.time instanceof Period))
1342            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered");
1343          return (Period) this.time;
1344        }
1345
1346        public boolean hasTimePeriod() { 
1347          return this != null && this.time instanceof Period;
1348        }
1349
1350        public boolean hasTime() { 
1351          return this.time != null && !this.time.isEmpty();
1352        }
1353
1354        /**
1355         * @param value {@link #time} (A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.)
1356         */
1357        public SpecimenProcessingComponent setTime(DataType value) { 
1358          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1359            throw new FHIRException("Not the right type for Specimen.processing.time[x]: "+value.fhirType());
1360          this.time = value;
1361          return this;
1362        }
1363
1364        protected void listChildren(List<Property> children) {
1365          super.listChildren(children);
1366          children.add(new Property("description", "string", "Textual description of procedure.", 0, 1, description));
1367          children.add(new Property("method", "CodeableConcept", "A coded value specifying the method used to process the specimen.", 0, 1, method));
1368          children.add(new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive));
1369          children.add(new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time));
1370        }
1371
1372        @Override
1373        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1374          switch (_hash) {
1375          case -1724546052: /*description*/  return new Property("description", "string", "Textual description of procedure.", 0, 1, description);
1376          case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "A coded value specifying the method used to process the specimen.", 0, 1, method);
1377          case -1226589236: /*additive*/  return new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive);
1378          case -1313930605: /*time[x]*/  return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time);
1379          case 3560141: /*time*/  return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time);
1380          case 2135345544: /*timeDateTime*/  return new Property("time[x]", "dateTime", "A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time);
1381          case 693544686: /*timePeriod*/  return new Property("time[x]", "Period", "A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time);
1382          default: return super.getNamedProperty(_hash, _name, _checkValid);
1383          }
1384
1385        }
1386
1387      @Override
1388      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1389        switch (hash) {
1390        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1391        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
1392        case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : this.additive.toArray(new Base[this.additive.size()]); // Reference
1393        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DataType
1394        default: return super.getProperty(hash, name, checkValid);
1395        }
1396
1397      }
1398
1399      @Override
1400      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1401        switch (hash) {
1402        case -1724546052: // description
1403          this.description = TypeConvertor.castToString(value); // StringType
1404          return value;
1405        case -1077554975: // method
1406          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1407          return value;
1408        case -1226589236: // additive
1409          this.getAdditive().add(TypeConvertor.castToReference(value)); // Reference
1410          return value;
1411        case 3560141: // time
1412          this.time = TypeConvertor.castToType(value); // DataType
1413          return value;
1414        default: return super.setProperty(hash, name, value);
1415        }
1416
1417      }
1418
1419      @Override
1420      public Base setProperty(String name, Base value) throws FHIRException {
1421        if (name.equals("description")) {
1422          this.description = TypeConvertor.castToString(value); // StringType
1423        } else if (name.equals("method")) {
1424          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1425        } else if (name.equals("additive")) {
1426          this.getAdditive().add(TypeConvertor.castToReference(value));
1427        } else if (name.equals("time[x]")) {
1428          this.time = TypeConvertor.castToType(value); // DataType
1429        } else
1430          return super.setProperty(name, value);
1431        return value;
1432      }
1433
1434  @Override
1435  public void removeChild(String name, Base value) throws FHIRException {
1436        if (name.equals("description")) {
1437          this.description = null;
1438        } else if (name.equals("method")) {
1439          this.method = null;
1440        } else if (name.equals("additive")) {
1441          this.getAdditive().remove(value);
1442        } else if (name.equals("time[x]")) {
1443          this.time = null;
1444        } else
1445          super.removeChild(name, value);
1446        
1447      }
1448
1449      @Override
1450      public Base makeProperty(int hash, String name) throws FHIRException {
1451        switch (hash) {
1452        case -1724546052:  return getDescriptionElement();
1453        case -1077554975:  return getMethod();
1454        case -1226589236:  return addAdditive(); 
1455        case -1313930605:  return getTime();
1456        case 3560141:  return getTime();
1457        default: return super.makeProperty(hash, name);
1458        }
1459
1460      }
1461
1462      @Override
1463      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1464        switch (hash) {
1465        case -1724546052: /*description*/ return new String[] {"string"};
1466        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
1467        case -1226589236: /*additive*/ return new String[] {"Reference"};
1468        case 3560141: /*time*/ return new String[] {"dateTime", "Period"};
1469        default: return super.getTypesForProperty(hash, name);
1470        }
1471
1472      }
1473
1474      @Override
1475      public Base addChild(String name) throws FHIRException {
1476        if (name.equals("description")) {
1477          throw new FHIRException("Cannot call addChild on a singleton property Specimen.processing.description");
1478        }
1479        else if (name.equals("method")) {
1480          this.method = new CodeableConcept();
1481          return this.method;
1482        }
1483        else if (name.equals("additive")) {
1484          return addAdditive();
1485        }
1486        else if (name.equals("timeDateTime")) {
1487          this.time = new DateTimeType();
1488          return this.time;
1489        }
1490        else if (name.equals("timePeriod")) {
1491          this.time = new Period();
1492          return this.time;
1493        }
1494        else
1495          return super.addChild(name);
1496      }
1497
1498      public SpecimenProcessingComponent copy() {
1499        SpecimenProcessingComponent dst = new SpecimenProcessingComponent();
1500        copyValues(dst);
1501        return dst;
1502      }
1503
1504      public void copyValues(SpecimenProcessingComponent dst) {
1505        super.copyValues(dst);
1506        dst.description = description == null ? null : description.copy();
1507        dst.method = method == null ? null : method.copy();
1508        if (additive != null) {
1509          dst.additive = new ArrayList<Reference>();
1510          for (Reference i : additive)
1511            dst.additive.add(i.copy());
1512        };
1513        dst.time = time == null ? null : time.copy();
1514      }
1515
1516      @Override
1517      public boolean equalsDeep(Base other_) {
1518        if (!super.equalsDeep(other_))
1519          return false;
1520        if (!(other_ instanceof SpecimenProcessingComponent))
1521          return false;
1522        SpecimenProcessingComponent o = (SpecimenProcessingComponent) other_;
1523        return compareDeep(description, o.description, true) && compareDeep(method, o.method, true) && compareDeep(additive, o.additive, true)
1524           && compareDeep(time, o.time, true);
1525      }
1526
1527      @Override
1528      public boolean equalsShallow(Base other_) {
1529        if (!super.equalsShallow(other_))
1530          return false;
1531        if (!(other_ instanceof SpecimenProcessingComponent))
1532          return false;
1533        SpecimenProcessingComponent o = (SpecimenProcessingComponent) other_;
1534        return compareValues(description, o.description, true);
1535      }
1536
1537      public boolean isEmpty() {
1538        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, method, additive
1539          , time);
1540      }
1541
1542  public String fhirType() {
1543    return "Specimen.processing";
1544
1545  }
1546
1547  }
1548
1549    @Block()
1550    public static class SpecimenContainerComponent extends BackboneElement implements IBaseBackboneElement {
1551        /**
1552         * The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.
1553         */
1554        @Child(name = "device", type = {Device.class}, order=1, min=1, max=1, modifier=false, summary=false)
1555        @Description(shortDefinition="Device resource for the container", formalDefinition="The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device." )
1556        protected Reference device;
1557
1558        /**
1559         * The location of the container holding the specimen.
1560         */
1561        @Child(name = "location", type = {Location.class}, order=2, min=0, max=1, modifier=false, summary=false)
1562        @Description(shortDefinition="Where the container is", formalDefinition="The location of the container holding the specimen." )
1563        protected Reference location;
1564
1565        /**
1566         * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.
1567         */
1568        @Child(name = "specimenQuantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
1569        @Description(shortDefinition="Quantity of specimen within container", formalDefinition="The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type." )
1570        protected Quantity specimenQuantity;
1571
1572        private static final long serialVersionUID = 1973387427L;
1573
1574    /**
1575     * Constructor
1576     */
1577      public SpecimenContainerComponent() {
1578        super();
1579      }
1580
1581    /**
1582     * Constructor
1583     */
1584      public SpecimenContainerComponent(Reference device) {
1585        super();
1586        this.setDevice(device);
1587      }
1588
1589        /**
1590         * @return {@link #device} (The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.)
1591         */
1592        public Reference getDevice() { 
1593          if (this.device == null)
1594            if (Configuration.errorOnAutoCreate())
1595              throw new Error("Attempt to auto-create SpecimenContainerComponent.device");
1596            else if (Configuration.doAutoCreate())
1597              this.device = new Reference(); // cc
1598          return this.device;
1599        }
1600
1601        public boolean hasDevice() { 
1602          return this.device != null && !this.device.isEmpty();
1603        }
1604
1605        /**
1606         * @param value {@link #device} (The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.)
1607         */
1608        public SpecimenContainerComponent setDevice(Reference value) { 
1609          this.device = value;
1610          return this;
1611        }
1612
1613        /**
1614         * @return {@link #location} (The location of the container holding the specimen.)
1615         */
1616        public Reference getLocation() { 
1617          if (this.location == null)
1618            if (Configuration.errorOnAutoCreate())
1619              throw new Error("Attempt to auto-create SpecimenContainerComponent.location");
1620            else if (Configuration.doAutoCreate())
1621              this.location = new Reference(); // cc
1622          return this.location;
1623        }
1624
1625        public boolean hasLocation() { 
1626          return this.location != null && !this.location.isEmpty();
1627        }
1628
1629        /**
1630         * @param value {@link #location} (The location of the container holding the specimen.)
1631         */
1632        public SpecimenContainerComponent setLocation(Reference value) { 
1633          this.location = value;
1634          return this;
1635        }
1636
1637        /**
1638         * @return {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
1639         */
1640        public Quantity getSpecimenQuantity() { 
1641          if (this.specimenQuantity == null)
1642            if (Configuration.errorOnAutoCreate())
1643              throw new Error("Attempt to auto-create SpecimenContainerComponent.specimenQuantity");
1644            else if (Configuration.doAutoCreate())
1645              this.specimenQuantity = new Quantity(); // cc
1646          return this.specimenQuantity;
1647        }
1648
1649        public boolean hasSpecimenQuantity() { 
1650          return this.specimenQuantity != null && !this.specimenQuantity.isEmpty();
1651        }
1652
1653        /**
1654         * @param value {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
1655         */
1656        public SpecimenContainerComponent setSpecimenQuantity(Quantity value) { 
1657          this.specimenQuantity = value;
1658          return this;
1659        }
1660
1661        protected void listChildren(List<Property> children) {
1662          super.listChildren(children);
1663          children.add(new Property("device", "Reference(Device)", "The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.", 0, 1, device));
1664          children.add(new Property("location", "Reference(Location)", "The location of the container holding the specimen.", 0, 1, location));
1665          children.add(new Property("specimenQuantity", "Quantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, 1, specimenQuantity));
1666        }
1667
1668        @Override
1669        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1670          switch (_hash) {
1671          case -1335157162: /*device*/  return new Property("device", "Reference(Device)", "The device resource for the the container holding the specimen. If the container is in a holder then the referenced device will point to a parent device.", 0, 1, device);
1672          case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The location of the container holding the specimen.", 0, 1, location);
1673          case 1485980595: /*specimenQuantity*/  return new Property("specimenQuantity", "Quantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, 1, specimenQuantity);
1674          default: return super.getNamedProperty(_hash, _name, _checkValid);
1675          }
1676
1677        }
1678
1679      @Override
1680      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1681        switch (hash) {
1682        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
1683        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1684        case 1485980595: /*specimenQuantity*/ return this.specimenQuantity == null ? new Base[0] : new Base[] {this.specimenQuantity}; // Quantity
1685        default: return super.getProperty(hash, name, checkValid);
1686        }
1687
1688      }
1689
1690      @Override
1691      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1692        switch (hash) {
1693        case -1335157162: // device
1694          this.device = TypeConvertor.castToReference(value); // Reference
1695          return value;
1696        case 1901043637: // location
1697          this.location = TypeConvertor.castToReference(value); // Reference
1698          return value;
1699        case 1485980595: // specimenQuantity
1700          this.specimenQuantity = TypeConvertor.castToQuantity(value); // Quantity
1701          return value;
1702        default: return super.setProperty(hash, name, value);
1703        }
1704
1705      }
1706
1707      @Override
1708      public Base setProperty(String name, Base value) throws FHIRException {
1709        if (name.equals("device")) {
1710          this.device = TypeConvertor.castToReference(value); // Reference
1711        } else if (name.equals("location")) {
1712          this.location = TypeConvertor.castToReference(value); // Reference
1713        } else if (name.equals("specimenQuantity")) {
1714          this.specimenQuantity = TypeConvertor.castToQuantity(value); // Quantity
1715        } else
1716          return super.setProperty(name, value);
1717        return value;
1718      }
1719
1720  @Override
1721  public void removeChild(String name, Base value) throws FHIRException {
1722        if (name.equals("device")) {
1723          this.device = null;
1724        } else if (name.equals("location")) {
1725          this.location = null;
1726        } else if (name.equals("specimenQuantity")) {
1727          this.specimenQuantity = null;
1728        } else
1729          super.removeChild(name, value);
1730        
1731      }
1732
1733      @Override
1734      public Base makeProperty(int hash, String name) throws FHIRException {
1735        switch (hash) {
1736        case -1335157162:  return getDevice();
1737        case 1901043637:  return getLocation();
1738        case 1485980595:  return getSpecimenQuantity();
1739        default: return super.makeProperty(hash, name);
1740        }
1741
1742      }
1743
1744      @Override
1745      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1746        switch (hash) {
1747        case -1335157162: /*device*/ return new String[] {"Reference"};
1748        case 1901043637: /*location*/ return new String[] {"Reference"};
1749        case 1485980595: /*specimenQuantity*/ return new String[] {"Quantity"};
1750        default: return super.getTypesForProperty(hash, name);
1751        }
1752
1753      }
1754
1755      @Override
1756      public Base addChild(String name) throws FHIRException {
1757        if (name.equals("device")) {
1758          this.device = new Reference();
1759          return this.device;
1760        }
1761        else if (name.equals("location")) {
1762          this.location = new Reference();
1763          return this.location;
1764        }
1765        else if (name.equals("specimenQuantity")) {
1766          this.specimenQuantity = new Quantity();
1767          return this.specimenQuantity;
1768        }
1769        else
1770          return super.addChild(name);
1771      }
1772
1773      public SpecimenContainerComponent copy() {
1774        SpecimenContainerComponent dst = new SpecimenContainerComponent();
1775        copyValues(dst);
1776        return dst;
1777      }
1778
1779      public void copyValues(SpecimenContainerComponent dst) {
1780        super.copyValues(dst);
1781        dst.device = device == null ? null : device.copy();
1782        dst.location = location == null ? null : location.copy();
1783        dst.specimenQuantity = specimenQuantity == null ? null : specimenQuantity.copy();
1784      }
1785
1786      @Override
1787      public boolean equalsDeep(Base other_) {
1788        if (!super.equalsDeep(other_))
1789          return false;
1790        if (!(other_ instanceof SpecimenContainerComponent))
1791          return false;
1792        SpecimenContainerComponent o = (SpecimenContainerComponent) other_;
1793        return compareDeep(device, o.device, true) && compareDeep(location, o.location, true) && compareDeep(specimenQuantity, o.specimenQuantity, true)
1794          ;
1795      }
1796
1797      @Override
1798      public boolean equalsShallow(Base other_) {
1799        if (!super.equalsShallow(other_))
1800          return false;
1801        if (!(other_ instanceof SpecimenContainerComponent))
1802          return false;
1803        SpecimenContainerComponent o = (SpecimenContainerComponent) other_;
1804        return true;
1805      }
1806
1807      public boolean isEmpty() {
1808        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(device, location, specimenQuantity
1809          );
1810      }
1811
1812  public String fhirType() {
1813    return "Specimen.container";
1814
1815  }
1816
1817  }
1818
1819    /**
1820     * Id for specimen.
1821     */
1822    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1823    @Description(shortDefinition="External Identifier", formalDefinition="Id for specimen." )
1824    protected List<Identifier> identifier;
1825
1826    /**
1827     * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.
1828     */
1829    @Child(name = "accessionIdentifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1830    @Description(shortDefinition="Identifier assigned by the lab", formalDefinition="The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures." )
1831    protected Identifier accessionIdentifier;
1832
1833    /**
1834     * The availability of the specimen.
1835     */
1836    @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
1837    @Description(shortDefinition="available | unavailable | unsatisfactory | entered-in-error", formalDefinition="The availability of the specimen." )
1838    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-status")
1839    protected Enumeration<SpecimenStatus> status;
1840
1841    /**
1842     * The kind of material that forms the specimen.
1843     */
1844    @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1845    @Description(shortDefinition="Kind of material that forms the specimen", formalDefinition="The kind of material that forms the specimen." )
1846    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0487")
1847    protected CodeableConcept type;
1848
1849    /**
1850     * Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.
1851     */
1852    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, BiologicallyDerivedProduct.class, Substance.class, Location.class}, order=4, min=0, max=1, modifier=false, summary=true)
1853    @Description(shortDefinition="Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device", formalDefinition="Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device." )
1854    protected Reference subject;
1855
1856    /**
1857     * Time when specimen is received by the testing laboratory for processing or testing.
1858     */
1859    @Child(name = "receivedTime", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1860    @Description(shortDefinition="The time when specimen is received by the testing laboratory", formalDefinition="Time when specimen is received by the testing laboratory for processing or testing." )
1861    protected DateTimeType receivedTime;
1862
1863    /**
1864     * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
1865     */
1866    @Child(name = "parent", type = {Specimen.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1867    @Description(shortDefinition="Specimen from which this specimen originated", formalDefinition="Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen." )
1868    protected List<Reference> parent;
1869
1870    /**
1871     * Details concerning a service request that required a specimen to be collected.
1872     */
1873    @Child(name = "request", type = {ServiceRequest.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1874    @Description(shortDefinition="Why the specimen was collected", formalDefinition="Details concerning a service request that required a specimen to be collected." )
1875    protected List<Reference> request;
1876
1877    /**
1878     * This element signifies if the specimen is part of a group or pooled.
1879     */
1880    @Child(name = "combined", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1881    @Description(shortDefinition="grouped | pooled", formalDefinition="This element signifies if the specimen is part of a group or pooled." )
1882    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-combined")
1883    protected Enumeration<SpecimenCombined> combined;
1884
1885    /**
1886     * The role or reason for the specimen in the testing workflow.
1887     */
1888    @Child(name = "role", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1889    @Description(shortDefinition="The role the specimen serves", formalDefinition="The role or reason for the specimen in the testing workflow." )
1890    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-role")
1891    protected List<CodeableConcept> role;
1892
1893    /**
1894     * A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).
1895     */
1896    @Child(name = "feature", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1897    @Description(shortDefinition="The physical feature of a specimen", formalDefinition="A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location)." )
1898    protected List<SpecimenFeatureComponent> feature;
1899
1900    /**
1901     * Details concerning the specimen collection.
1902     */
1903    @Child(name = "collection", type = {}, order=11, min=0, max=1, modifier=false, summary=false)
1904    @Description(shortDefinition="Collection details", formalDefinition="Details concerning the specimen collection." )
1905    protected SpecimenCollectionComponent collection;
1906
1907    /**
1908     * Details concerning processing and processing steps for the specimen.
1909     */
1910    @Child(name = "processing", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1911    @Description(shortDefinition="Processing and processing step details", formalDefinition="Details concerning processing and processing steps for the specimen." )
1912    protected List<SpecimenProcessingComponent> processing;
1913
1914    /**
1915     * The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
1916     */
1917    @Child(name = "container", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1918    @Description(shortDefinition="Direct container of specimen (tube/slide, etc.)", formalDefinition="The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here." )
1919    protected List<SpecimenContainerComponent> container;
1920
1921    /**
1922     * A mode or state of being that describes the nature of the specimen.
1923     */
1924    @Child(name = "condition", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1925    @Description(shortDefinition="State of the specimen", formalDefinition="A mode or state of being that describes the nature of the specimen." )
1926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0493")
1927    protected List<CodeableConcept> condition;
1928
1929    /**
1930     * To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).
1931     */
1932    @Child(name = "note", type = {Annotation.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1933    @Description(shortDefinition="Comments", formalDefinition="To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen)." )
1934    protected List<Annotation> note;
1935
1936    private static final long serialVersionUID = -445425000L;
1937
1938  /**
1939   * Constructor
1940   */
1941    public Specimen() {
1942      super();
1943    }
1944
1945    /**
1946     * @return {@link #identifier} (Id for specimen.)
1947     */
1948    public List<Identifier> getIdentifier() { 
1949      if (this.identifier == null)
1950        this.identifier = new ArrayList<Identifier>();
1951      return this.identifier;
1952    }
1953
1954    /**
1955     * @return Returns a reference to <code>this</code> for easy method chaining
1956     */
1957    public Specimen setIdentifier(List<Identifier> theIdentifier) { 
1958      this.identifier = theIdentifier;
1959      return this;
1960    }
1961
1962    public boolean hasIdentifier() { 
1963      if (this.identifier == null)
1964        return false;
1965      for (Identifier item : this.identifier)
1966        if (!item.isEmpty())
1967          return true;
1968      return false;
1969    }
1970
1971    public Identifier addIdentifier() { //3
1972      Identifier t = new Identifier();
1973      if (this.identifier == null)
1974        this.identifier = new ArrayList<Identifier>();
1975      this.identifier.add(t);
1976      return t;
1977    }
1978
1979    public Specimen addIdentifier(Identifier t) { //3
1980      if (t == null)
1981        return this;
1982      if (this.identifier == null)
1983        this.identifier = new ArrayList<Identifier>();
1984      this.identifier.add(t);
1985      return this;
1986    }
1987
1988    /**
1989     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1990     */
1991    public Identifier getIdentifierFirstRep() { 
1992      if (getIdentifier().isEmpty()) {
1993        addIdentifier();
1994      }
1995      return getIdentifier().get(0);
1996    }
1997
1998    /**
1999     * @return {@link #accessionIdentifier} (The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.)
2000     */
2001    public Identifier getAccessionIdentifier() { 
2002      if (this.accessionIdentifier == null)
2003        if (Configuration.errorOnAutoCreate())
2004          throw new Error("Attempt to auto-create Specimen.accessionIdentifier");
2005        else if (Configuration.doAutoCreate())
2006          this.accessionIdentifier = new Identifier(); // cc
2007      return this.accessionIdentifier;
2008    }
2009
2010    public boolean hasAccessionIdentifier() { 
2011      return this.accessionIdentifier != null && !this.accessionIdentifier.isEmpty();
2012    }
2013
2014    /**
2015     * @param value {@link #accessionIdentifier} (The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.)
2016     */
2017    public Specimen setAccessionIdentifier(Identifier value) { 
2018      this.accessionIdentifier = value;
2019      return this;
2020    }
2021
2022    /**
2023     * @return {@link #status} (The availability of the specimen.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2024     */
2025    public Enumeration<SpecimenStatus> getStatusElement() { 
2026      if (this.status == null)
2027        if (Configuration.errorOnAutoCreate())
2028          throw new Error("Attempt to auto-create Specimen.status");
2029        else if (Configuration.doAutoCreate())
2030          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory()); // bb
2031      return this.status;
2032    }
2033
2034    public boolean hasStatusElement() { 
2035      return this.status != null && !this.status.isEmpty();
2036    }
2037
2038    public boolean hasStatus() { 
2039      return this.status != null && !this.status.isEmpty();
2040    }
2041
2042    /**
2043     * @param value {@link #status} (The availability of the specimen.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2044     */
2045    public Specimen setStatusElement(Enumeration<SpecimenStatus> value) { 
2046      this.status = value;
2047      return this;
2048    }
2049
2050    /**
2051     * @return The availability of the specimen.
2052     */
2053    public SpecimenStatus getStatus() { 
2054      return this.status == null ? null : this.status.getValue();
2055    }
2056
2057    /**
2058     * @param value The availability of the specimen.
2059     */
2060    public Specimen setStatus(SpecimenStatus value) { 
2061      if (value == null)
2062        this.status = null;
2063      else {
2064        if (this.status == null)
2065          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory());
2066        this.status.setValue(value);
2067      }
2068      return this;
2069    }
2070
2071    /**
2072     * @return {@link #type} (The kind of material that forms the specimen.)
2073     */
2074    public CodeableConcept getType() { 
2075      if (this.type == null)
2076        if (Configuration.errorOnAutoCreate())
2077          throw new Error("Attempt to auto-create Specimen.type");
2078        else if (Configuration.doAutoCreate())
2079          this.type = new CodeableConcept(); // cc
2080      return this.type;
2081    }
2082
2083    public boolean hasType() { 
2084      return this.type != null && !this.type.isEmpty();
2085    }
2086
2087    /**
2088     * @param value {@link #type} (The kind of material that forms the specimen.)
2089     */
2090    public Specimen setType(CodeableConcept value) { 
2091      this.type = value;
2092      return this;
2093    }
2094
2095    /**
2096     * @return {@link #subject} (Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.)
2097     */
2098    public Reference getSubject() { 
2099      if (this.subject == null)
2100        if (Configuration.errorOnAutoCreate())
2101          throw new Error("Attempt to auto-create Specimen.subject");
2102        else if (Configuration.doAutoCreate())
2103          this.subject = new Reference(); // cc
2104      return this.subject;
2105    }
2106
2107    public boolean hasSubject() { 
2108      return this.subject != null && !this.subject.isEmpty();
2109    }
2110
2111    /**
2112     * @param value {@link #subject} (Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.)
2113     */
2114    public Specimen setSubject(Reference value) { 
2115      this.subject = value;
2116      return this;
2117    }
2118
2119    /**
2120     * @return {@link #receivedTime} (Time when specimen is received by the testing laboratory for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
2121     */
2122    public DateTimeType getReceivedTimeElement() { 
2123      if (this.receivedTime == null)
2124        if (Configuration.errorOnAutoCreate())
2125          throw new Error("Attempt to auto-create Specimen.receivedTime");
2126        else if (Configuration.doAutoCreate())
2127          this.receivedTime = new DateTimeType(); // bb
2128      return this.receivedTime;
2129    }
2130
2131    public boolean hasReceivedTimeElement() { 
2132      return this.receivedTime != null && !this.receivedTime.isEmpty();
2133    }
2134
2135    public boolean hasReceivedTime() { 
2136      return this.receivedTime != null && !this.receivedTime.isEmpty();
2137    }
2138
2139    /**
2140     * @param value {@link #receivedTime} (Time when specimen is received by the testing laboratory for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
2141     */
2142    public Specimen setReceivedTimeElement(DateTimeType value) { 
2143      this.receivedTime = value;
2144      return this;
2145    }
2146
2147    /**
2148     * @return Time when specimen is received by the testing laboratory for processing or testing.
2149     */
2150    public Date getReceivedTime() { 
2151      return this.receivedTime == null ? null : this.receivedTime.getValue();
2152    }
2153
2154    /**
2155     * @param value Time when specimen is received by the testing laboratory for processing or testing.
2156     */
2157    public Specimen setReceivedTime(Date value) { 
2158      if (value == null)
2159        this.receivedTime = null;
2160      else {
2161        if (this.receivedTime == null)
2162          this.receivedTime = new DateTimeType();
2163        this.receivedTime.setValue(value);
2164      }
2165      return this;
2166    }
2167
2168    /**
2169     * @return {@link #parent} (Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
2170     */
2171    public List<Reference> getParent() { 
2172      if (this.parent == null)
2173        this.parent = new ArrayList<Reference>();
2174      return this.parent;
2175    }
2176
2177    /**
2178     * @return Returns a reference to <code>this</code> for easy method chaining
2179     */
2180    public Specimen setParent(List<Reference> theParent) { 
2181      this.parent = theParent;
2182      return this;
2183    }
2184
2185    public boolean hasParent() { 
2186      if (this.parent == null)
2187        return false;
2188      for (Reference item : this.parent)
2189        if (!item.isEmpty())
2190          return true;
2191      return false;
2192    }
2193
2194    public Reference addParent() { //3
2195      Reference t = new Reference();
2196      if (this.parent == null)
2197        this.parent = new ArrayList<Reference>();
2198      this.parent.add(t);
2199      return t;
2200    }
2201
2202    public Specimen addParent(Reference t) { //3
2203      if (t == null)
2204        return this;
2205      if (this.parent == null)
2206        this.parent = new ArrayList<Reference>();
2207      this.parent.add(t);
2208      return this;
2209    }
2210
2211    /**
2212     * @return The first repetition of repeating field {@link #parent}, creating it if it does not already exist {3}
2213     */
2214    public Reference getParentFirstRep() { 
2215      if (getParent().isEmpty()) {
2216        addParent();
2217      }
2218      return getParent().get(0);
2219    }
2220
2221    /**
2222     * @return {@link #request} (Details concerning a service request that required a specimen to be collected.)
2223     */
2224    public List<Reference> getRequest() { 
2225      if (this.request == null)
2226        this.request = new ArrayList<Reference>();
2227      return this.request;
2228    }
2229
2230    /**
2231     * @return Returns a reference to <code>this</code> for easy method chaining
2232     */
2233    public Specimen setRequest(List<Reference> theRequest) { 
2234      this.request = theRequest;
2235      return this;
2236    }
2237
2238    public boolean hasRequest() { 
2239      if (this.request == null)
2240        return false;
2241      for (Reference item : this.request)
2242        if (!item.isEmpty())
2243          return true;
2244      return false;
2245    }
2246
2247    public Reference addRequest() { //3
2248      Reference t = new Reference();
2249      if (this.request == null)
2250        this.request = new ArrayList<Reference>();
2251      this.request.add(t);
2252      return t;
2253    }
2254
2255    public Specimen addRequest(Reference t) { //3
2256      if (t == null)
2257        return this;
2258      if (this.request == null)
2259        this.request = new ArrayList<Reference>();
2260      this.request.add(t);
2261      return this;
2262    }
2263
2264    /**
2265     * @return The first repetition of repeating field {@link #request}, creating it if it does not already exist {3}
2266     */
2267    public Reference getRequestFirstRep() { 
2268      if (getRequest().isEmpty()) {
2269        addRequest();
2270      }
2271      return getRequest().get(0);
2272    }
2273
2274    /**
2275     * @return {@link #combined} (This element signifies if the specimen is part of a group or pooled.). This is the underlying object with id, value and extensions. The accessor "getCombined" gives direct access to the value
2276     */
2277    public Enumeration<SpecimenCombined> getCombinedElement() { 
2278      if (this.combined == null)
2279        if (Configuration.errorOnAutoCreate())
2280          throw new Error("Attempt to auto-create Specimen.combined");
2281        else if (Configuration.doAutoCreate())
2282          this.combined = new Enumeration<SpecimenCombined>(new SpecimenCombinedEnumFactory()); // bb
2283      return this.combined;
2284    }
2285
2286    public boolean hasCombinedElement() { 
2287      return this.combined != null && !this.combined.isEmpty();
2288    }
2289
2290    public boolean hasCombined() { 
2291      return this.combined != null && !this.combined.isEmpty();
2292    }
2293
2294    /**
2295     * @param value {@link #combined} (This element signifies if the specimen is part of a group or pooled.). This is the underlying object with id, value and extensions. The accessor "getCombined" gives direct access to the value
2296     */
2297    public Specimen setCombinedElement(Enumeration<SpecimenCombined> value) { 
2298      this.combined = value;
2299      return this;
2300    }
2301
2302    /**
2303     * @return This element signifies if the specimen is part of a group or pooled.
2304     */
2305    public SpecimenCombined getCombined() { 
2306      return this.combined == null ? null : this.combined.getValue();
2307    }
2308
2309    /**
2310     * @param value This element signifies if the specimen is part of a group or pooled.
2311     */
2312    public Specimen setCombined(SpecimenCombined value) { 
2313      if (value == null)
2314        this.combined = null;
2315      else {
2316        if (this.combined == null)
2317          this.combined = new Enumeration<SpecimenCombined>(new SpecimenCombinedEnumFactory());
2318        this.combined.setValue(value);
2319      }
2320      return this;
2321    }
2322
2323    /**
2324     * @return {@link #role} (The role or reason for the specimen in the testing workflow.)
2325     */
2326    public List<CodeableConcept> getRole() { 
2327      if (this.role == null)
2328        this.role = new ArrayList<CodeableConcept>();
2329      return this.role;
2330    }
2331
2332    /**
2333     * @return Returns a reference to <code>this</code> for easy method chaining
2334     */
2335    public Specimen setRole(List<CodeableConcept> theRole) { 
2336      this.role = theRole;
2337      return this;
2338    }
2339
2340    public boolean hasRole() { 
2341      if (this.role == null)
2342        return false;
2343      for (CodeableConcept item : this.role)
2344        if (!item.isEmpty())
2345          return true;
2346      return false;
2347    }
2348
2349    public CodeableConcept addRole() { //3
2350      CodeableConcept t = new CodeableConcept();
2351      if (this.role == null)
2352        this.role = new ArrayList<CodeableConcept>();
2353      this.role.add(t);
2354      return t;
2355    }
2356
2357    public Specimen addRole(CodeableConcept t) { //3
2358      if (t == null)
2359        return this;
2360      if (this.role == null)
2361        this.role = new ArrayList<CodeableConcept>();
2362      this.role.add(t);
2363      return this;
2364    }
2365
2366    /**
2367     * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist {3}
2368     */
2369    public CodeableConcept getRoleFirstRep() { 
2370      if (getRole().isEmpty()) {
2371        addRole();
2372      }
2373      return getRole().get(0);
2374    }
2375
2376    /**
2377     * @return {@link #feature} (A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).)
2378     */
2379    public List<SpecimenFeatureComponent> getFeature() { 
2380      if (this.feature == null)
2381        this.feature = new ArrayList<SpecimenFeatureComponent>();
2382      return this.feature;
2383    }
2384
2385    /**
2386     * @return Returns a reference to <code>this</code> for easy method chaining
2387     */
2388    public Specimen setFeature(List<SpecimenFeatureComponent> theFeature) { 
2389      this.feature = theFeature;
2390      return this;
2391    }
2392
2393    public boolean hasFeature() { 
2394      if (this.feature == null)
2395        return false;
2396      for (SpecimenFeatureComponent item : this.feature)
2397        if (!item.isEmpty())
2398          return true;
2399      return false;
2400    }
2401
2402    public SpecimenFeatureComponent addFeature() { //3
2403      SpecimenFeatureComponent t = new SpecimenFeatureComponent();
2404      if (this.feature == null)
2405        this.feature = new ArrayList<SpecimenFeatureComponent>();
2406      this.feature.add(t);
2407      return t;
2408    }
2409
2410    public Specimen addFeature(SpecimenFeatureComponent t) { //3
2411      if (t == null)
2412        return this;
2413      if (this.feature == null)
2414        this.feature = new ArrayList<SpecimenFeatureComponent>();
2415      this.feature.add(t);
2416      return this;
2417    }
2418
2419    /**
2420     * @return The first repetition of repeating field {@link #feature}, creating it if it does not already exist {3}
2421     */
2422    public SpecimenFeatureComponent getFeatureFirstRep() { 
2423      if (getFeature().isEmpty()) {
2424        addFeature();
2425      }
2426      return getFeature().get(0);
2427    }
2428
2429    /**
2430     * @return {@link #collection} (Details concerning the specimen collection.)
2431     */
2432    public SpecimenCollectionComponent getCollection() { 
2433      if (this.collection == null)
2434        if (Configuration.errorOnAutoCreate())
2435          throw new Error("Attempt to auto-create Specimen.collection");
2436        else if (Configuration.doAutoCreate())
2437          this.collection = new SpecimenCollectionComponent(); // cc
2438      return this.collection;
2439    }
2440
2441    public boolean hasCollection() { 
2442      return this.collection != null && !this.collection.isEmpty();
2443    }
2444
2445    /**
2446     * @param value {@link #collection} (Details concerning the specimen collection.)
2447     */
2448    public Specimen setCollection(SpecimenCollectionComponent value) { 
2449      this.collection = value;
2450      return this;
2451    }
2452
2453    /**
2454     * @return {@link #processing} (Details concerning processing and processing steps for the specimen.)
2455     */
2456    public List<SpecimenProcessingComponent> getProcessing() { 
2457      if (this.processing == null)
2458        this.processing = new ArrayList<SpecimenProcessingComponent>();
2459      return this.processing;
2460    }
2461
2462    /**
2463     * @return Returns a reference to <code>this</code> for easy method chaining
2464     */
2465    public Specimen setProcessing(List<SpecimenProcessingComponent> theProcessing) { 
2466      this.processing = theProcessing;
2467      return this;
2468    }
2469
2470    public boolean hasProcessing() { 
2471      if (this.processing == null)
2472        return false;
2473      for (SpecimenProcessingComponent item : this.processing)
2474        if (!item.isEmpty())
2475          return true;
2476      return false;
2477    }
2478
2479    public SpecimenProcessingComponent addProcessing() { //3
2480      SpecimenProcessingComponent t = new SpecimenProcessingComponent();
2481      if (this.processing == null)
2482        this.processing = new ArrayList<SpecimenProcessingComponent>();
2483      this.processing.add(t);
2484      return t;
2485    }
2486
2487    public Specimen addProcessing(SpecimenProcessingComponent t) { //3
2488      if (t == null)
2489        return this;
2490      if (this.processing == null)
2491        this.processing = new ArrayList<SpecimenProcessingComponent>();
2492      this.processing.add(t);
2493      return this;
2494    }
2495
2496    /**
2497     * @return The first repetition of repeating field {@link #processing}, creating it if it does not already exist {3}
2498     */
2499    public SpecimenProcessingComponent getProcessingFirstRep() { 
2500      if (getProcessing().isEmpty()) {
2501        addProcessing();
2502      }
2503      return getProcessing().get(0);
2504    }
2505
2506    /**
2507     * @return {@link #container} (The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.)
2508     */
2509    public List<SpecimenContainerComponent> getContainer() { 
2510      if (this.container == null)
2511        this.container = new ArrayList<SpecimenContainerComponent>();
2512      return this.container;
2513    }
2514
2515    /**
2516     * @return Returns a reference to <code>this</code> for easy method chaining
2517     */
2518    public Specimen setContainer(List<SpecimenContainerComponent> theContainer) { 
2519      this.container = theContainer;
2520      return this;
2521    }
2522
2523    public boolean hasContainer() { 
2524      if (this.container == null)
2525        return false;
2526      for (SpecimenContainerComponent item : this.container)
2527        if (!item.isEmpty())
2528          return true;
2529      return false;
2530    }
2531
2532    public SpecimenContainerComponent addContainer() { //3
2533      SpecimenContainerComponent t = new SpecimenContainerComponent();
2534      if (this.container == null)
2535        this.container = new ArrayList<SpecimenContainerComponent>();
2536      this.container.add(t);
2537      return t;
2538    }
2539
2540    public Specimen addContainer(SpecimenContainerComponent t) { //3
2541      if (t == null)
2542        return this;
2543      if (this.container == null)
2544        this.container = new ArrayList<SpecimenContainerComponent>();
2545      this.container.add(t);
2546      return this;
2547    }
2548
2549    /**
2550     * @return The first repetition of repeating field {@link #container}, creating it if it does not already exist {3}
2551     */
2552    public SpecimenContainerComponent getContainerFirstRep() { 
2553      if (getContainer().isEmpty()) {
2554        addContainer();
2555      }
2556      return getContainer().get(0);
2557    }
2558
2559    /**
2560     * @return {@link #condition} (A mode or state of being that describes the nature of the specimen.)
2561     */
2562    public List<CodeableConcept> getCondition() { 
2563      if (this.condition == null)
2564        this.condition = new ArrayList<CodeableConcept>();
2565      return this.condition;
2566    }
2567
2568    /**
2569     * @return Returns a reference to <code>this</code> for easy method chaining
2570     */
2571    public Specimen setCondition(List<CodeableConcept> theCondition) { 
2572      this.condition = theCondition;
2573      return this;
2574    }
2575
2576    public boolean hasCondition() { 
2577      if (this.condition == null)
2578        return false;
2579      for (CodeableConcept item : this.condition)
2580        if (!item.isEmpty())
2581          return true;
2582      return false;
2583    }
2584
2585    public CodeableConcept addCondition() { //3
2586      CodeableConcept t = new CodeableConcept();
2587      if (this.condition == null)
2588        this.condition = new ArrayList<CodeableConcept>();
2589      this.condition.add(t);
2590      return t;
2591    }
2592
2593    public Specimen addCondition(CodeableConcept t) { //3
2594      if (t == null)
2595        return this;
2596      if (this.condition == null)
2597        this.condition = new ArrayList<CodeableConcept>();
2598      this.condition.add(t);
2599      return this;
2600    }
2601
2602    /**
2603     * @return The first repetition of repeating field {@link #condition}, creating it if it does not already exist {3}
2604     */
2605    public CodeableConcept getConditionFirstRep() { 
2606      if (getCondition().isEmpty()) {
2607        addCondition();
2608      }
2609      return getCondition().get(0);
2610    }
2611
2612    /**
2613     * @return {@link #note} (To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).)
2614     */
2615    public List<Annotation> getNote() { 
2616      if (this.note == null)
2617        this.note = new ArrayList<Annotation>();
2618      return this.note;
2619    }
2620
2621    /**
2622     * @return Returns a reference to <code>this</code> for easy method chaining
2623     */
2624    public Specimen setNote(List<Annotation> theNote) { 
2625      this.note = theNote;
2626      return this;
2627    }
2628
2629    public boolean hasNote() { 
2630      if (this.note == null)
2631        return false;
2632      for (Annotation item : this.note)
2633        if (!item.isEmpty())
2634          return true;
2635      return false;
2636    }
2637
2638    public Annotation addNote() { //3
2639      Annotation t = new Annotation();
2640      if (this.note == null)
2641        this.note = new ArrayList<Annotation>();
2642      this.note.add(t);
2643      return t;
2644    }
2645
2646    public Specimen addNote(Annotation t) { //3
2647      if (t == null)
2648        return this;
2649      if (this.note == null)
2650        this.note = new ArrayList<Annotation>();
2651      this.note.add(t);
2652      return this;
2653    }
2654
2655    /**
2656     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
2657     */
2658    public Annotation getNoteFirstRep() { 
2659      if (getNote().isEmpty()) {
2660        addNote();
2661      }
2662      return getNote().get(0);
2663    }
2664
2665      protected void listChildren(List<Property> children) {
2666        super.listChildren(children);
2667        children.add(new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier));
2668        children.add(new Property("accessionIdentifier", "Identifier", "The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.", 0, 1, accessionIdentifier));
2669        children.add(new Property("status", "code", "The availability of the specimen.", 0, 1, status));
2670        children.add(new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, 1, type));
2671        children.add(new Property("subject", "Reference(Patient|Group|Device|BiologicallyDerivedProduct|Substance|Location)", "Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.", 0, 1, subject));
2672        children.add(new Property("receivedTime", "dateTime", "Time when specimen is received by the testing laboratory for processing or testing.", 0, 1, receivedTime));
2673        children.add(new Property("parent", "Reference(Specimen)", "Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.", 0, java.lang.Integer.MAX_VALUE, parent));
2674        children.add(new Property("request", "Reference(ServiceRequest)", "Details concerning a service request that required a specimen to be collected.", 0, java.lang.Integer.MAX_VALUE, request));
2675        children.add(new Property("combined", "code", "This element signifies if the specimen is part of a group or pooled.", 0, 1, combined));
2676        children.add(new Property("role", "CodeableConcept", "The role or reason for the specimen in the testing workflow.", 0, java.lang.Integer.MAX_VALUE, role));
2677        children.add(new Property("feature", "", "A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).", 0, java.lang.Integer.MAX_VALUE, feature));
2678        children.add(new Property("collection", "", "Details concerning the specimen collection.", 0, 1, collection));
2679        children.add(new Property("processing", "", "Details concerning processing and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, processing));
2680        children.add(new Property("container", "", "The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.", 0, java.lang.Integer.MAX_VALUE, container));
2681        children.add(new Property("condition", "CodeableConcept", "A mode or state of being that describes the nature of the specimen.", 0, java.lang.Integer.MAX_VALUE, condition));
2682        children.add(new Property("note", "Annotation", "To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).", 0, java.lang.Integer.MAX_VALUE, note));
2683      }
2684
2685      @Override
2686      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2687        switch (_hash) {
2688        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier);
2689        case 818734061: /*accessionIdentifier*/  return new Property("accessionIdentifier", "Identifier", "The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.", 0, 1, accessionIdentifier);
2690        case -892481550: /*status*/  return new Property("status", "code", "The availability of the specimen.", 0, 1, status);
2691        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, 1, type);
2692        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Device|BiologicallyDerivedProduct|Substance|Location)", "Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device.", 0, 1, subject);
2693        case -767961010: /*receivedTime*/  return new Property("receivedTime", "dateTime", "Time when specimen is received by the testing laboratory for processing or testing.", 0, 1, receivedTime);
2694        case -995424086: /*parent*/  return new Property("parent", "Reference(Specimen)", "Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.", 0, java.lang.Integer.MAX_VALUE, parent);
2695        case 1095692943: /*request*/  return new Property("request", "Reference(ServiceRequest)", "Details concerning a service request that required a specimen to be collected.", 0, java.lang.Integer.MAX_VALUE, request);
2696        case -612455675: /*combined*/  return new Property("combined", "code", "This element signifies if the specimen is part of a group or pooled.", 0, 1, combined);
2697        case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The role or reason for the specimen in the testing workflow.", 0, java.lang.Integer.MAX_VALUE, role);
2698        case -979207434: /*feature*/  return new Property("feature", "", "A physical feature or landmark on a specimen, highlighted for context by the collector of the specimen (e.g. surgeon), that identifies the type of feature as well as its meaning (e.g. the red ink indicating the resection margin of the right lobe of the excised prostate tissue or wire loop at radiologically suspected tumor location).", 0, java.lang.Integer.MAX_VALUE, feature);
2699        case -1741312354: /*collection*/  return new Property("collection", "", "Details concerning the specimen collection.", 0, 1, collection);
2700        case 422194963: /*processing*/  return new Property("processing", "", "Details concerning processing and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, processing);
2701        case -410956671: /*container*/  return new Property("container", "", "The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.", 0, java.lang.Integer.MAX_VALUE, container);
2702        case -861311717: /*condition*/  return new Property("condition", "CodeableConcept", "A mode or state of being that describes the nature of the specimen.", 0, java.lang.Integer.MAX_VALUE, condition);
2703        case 3387378: /*note*/  return new Property("note", "Annotation", "To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).", 0, java.lang.Integer.MAX_VALUE, note);
2704        default: return super.getNamedProperty(_hash, _name, _checkValid);
2705        }
2706
2707      }
2708
2709      @Override
2710      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2711        switch (hash) {
2712        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2713        case 818734061: /*accessionIdentifier*/ return this.accessionIdentifier == null ? new Base[0] : new Base[] {this.accessionIdentifier}; // Identifier
2714        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SpecimenStatus>
2715        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2716        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2717        case -767961010: /*receivedTime*/ return this.receivedTime == null ? new Base[0] : new Base[] {this.receivedTime}; // DateTimeType
2718        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : this.parent.toArray(new Base[this.parent.size()]); // Reference
2719        case 1095692943: /*request*/ return this.request == null ? new Base[0] : this.request.toArray(new Base[this.request.size()]); // Reference
2720        case -612455675: /*combined*/ return this.combined == null ? new Base[0] : new Base[] {this.combined}; // Enumeration<SpecimenCombined>
2721        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
2722        case -979207434: /*feature*/ return this.feature == null ? new Base[0] : this.feature.toArray(new Base[this.feature.size()]); // SpecimenFeatureComponent
2723        case -1741312354: /*collection*/ return this.collection == null ? new Base[0] : new Base[] {this.collection}; // SpecimenCollectionComponent
2724        case 422194963: /*processing*/ return this.processing == null ? new Base[0] : this.processing.toArray(new Base[this.processing.size()]); // SpecimenProcessingComponent
2725        case -410956671: /*container*/ return this.container == null ? new Base[0] : this.container.toArray(new Base[this.container.size()]); // SpecimenContainerComponent
2726        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // CodeableConcept
2727        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2728        default: return super.getProperty(hash, name, checkValid);
2729        }
2730
2731      }
2732
2733      @Override
2734      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2735        switch (hash) {
2736        case -1618432855: // identifier
2737          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2738          return value;
2739        case 818734061: // accessionIdentifier
2740          this.accessionIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
2741          return value;
2742        case -892481550: // status
2743          value = new SpecimenStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2744          this.status = (Enumeration) value; // Enumeration<SpecimenStatus>
2745          return value;
2746        case 3575610: // type
2747          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2748          return value;
2749        case -1867885268: // subject
2750          this.subject = TypeConvertor.castToReference(value); // Reference
2751          return value;
2752        case -767961010: // receivedTime
2753          this.receivedTime = TypeConvertor.castToDateTime(value); // DateTimeType
2754          return value;
2755        case -995424086: // parent
2756          this.getParent().add(TypeConvertor.castToReference(value)); // Reference
2757          return value;
2758        case 1095692943: // request
2759          this.getRequest().add(TypeConvertor.castToReference(value)); // Reference
2760          return value;
2761        case -612455675: // combined
2762          value = new SpecimenCombinedEnumFactory().fromType(TypeConvertor.castToCode(value));
2763          this.combined = (Enumeration) value; // Enumeration<SpecimenCombined>
2764          return value;
2765        case 3506294: // role
2766          this.getRole().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2767          return value;
2768        case -979207434: // feature
2769          this.getFeature().add((SpecimenFeatureComponent) value); // SpecimenFeatureComponent
2770          return value;
2771        case -1741312354: // collection
2772          this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent
2773          return value;
2774        case 422194963: // processing
2775          this.getProcessing().add((SpecimenProcessingComponent) value); // SpecimenProcessingComponent
2776          return value;
2777        case -410956671: // container
2778          this.getContainer().add((SpecimenContainerComponent) value); // SpecimenContainerComponent
2779          return value;
2780        case -861311717: // condition
2781          this.getCondition().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2782          return value;
2783        case 3387378: // note
2784          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2785          return value;
2786        default: return super.setProperty(hash, name, value);
2787        }
2788
2789      }
2790
2791      @Override
2792      public Base setProperty(String name, Base value) throws FHIRException {
2793        if (name.equals("identifier")) {
2794          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2795        } else if (name.equals("accessionIdentifier")) {
2796          this.accessionIdentifier = TypeConvertor.castToIdentifier(value); // Identifier
2797        } else if (name.equals("status")) {
2798          value = new SpecimenStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2799          this.status = (Enumeration) value; // Enumeration<SpecimenStatus>
2800        } else if (name.equals("type")) {
2801          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2802        } else if (name.equals("subject")) {
2803          this.subject = TypeConvertor.castToReference(value); // Reference
2804        } else if (name.equals("receivedTime")) {
2805          this.receivedTime = TypeConvertor.castToDateTime(value); // DateTimeType
2806        } else if (name.equals("parent")) {
2807          this.getParent().add(TypeConvertor.castToReference(value));
2808        } else if (name.equals("request")) {
2809          this.getRequest().add(TypeConvertor.castToReference(value));
2810        } else if (name.equals("combined")) {
2811          value = new SpecimenCombinedEnumFactory().fromType(TypeConvertor.castToCode(value));
2812          this.combined = (Enumeration) value; // Enumeration<SpecimenCombined>
2813        } else if (name.equals("role")) {
2814          this.getRole().add(TypeConvertor.castToCodeableConcept(value));
2815        } else if (name.equals("feature")) {
2816          this.getFeature().add((SpecimenFeatureComponent) value);
2817        } else if (name.equals("collection")) {
2818          this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent
2819        } else if (name.equals("processing")) {
2820          this.getProcessing().add((SpecimenProcessingComponent) value);
2821        } else if (name.equals("container")) {
2822          this.getContainer().add((SpecimenContainerComponent) value);
2823        } else if (name.equals("condition")) {
2824          this.getCondition().add(TypeConvertor.castToCodeableConcept(value));
2825        } else if (name.equals("note")) {
2826          this.getNote().add(TypeConvertor.castToAnnotation(value));
2827        } else
2828          return super.setProperty(name, value);
2829        return value;
2830      }
2831
2832  @Override
2833  public void removeChild(String name, Base value) throws FHIRException {
2834        if (name.equals("identifier")) {
2835          this.getIdentifier().remove(value);
2836        } else if (name.equals("accessionIdentifier")) {
2837          this.accessionIdentifier = null;
2838        } else if (name.equals("status")) {
2839          value = new SpecimenStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2840          this.status = (Enumeration) value; // Enumeration<SpecimenStatus>
2841        } else if (name.equals("type")) {
2842          this.type = null;
2843        } else if (name.equals("subject")) {
2844          this.subject = null;
2845        } else if (name.equals("receivedTime")) {
2846          this.receivedTime = null;
2847        } else if (name.equals("parent")) {
2848          this.getParent().remove(value);
2849        } else if (name.equals("request")) {
2850          this.getRequest().remove(value);
2851        } else if (name.equals("combined")) {
2852          value = new SpecimenCombinedEnumFactory().fromType(TypeConvertor.castToCode(value));
2853          this.combined = (Enumeration) value; // Enumeration<SpecimenCombined>
2854        } else if (name.equals("role")) {
2855          this.getRole().remove(value);
2856        } else if (name.equals("feature")) {
2857          this.getFeature().remove((SpecimenFeatureComponent) value);
2858        } else if (name.equals("collection")) {
2859          this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent
2860        } else if (name.equals("processing")) {
2861          this.getProcessing().remove((SpecimenProcessingComponent) value);
2862        } else if (name.equals("container")) {
2863          this.getContainer().remove((SpecimenContainerComponent) value);
2864        } else if (name.equals("condition")) {
2865          this.getCondition().remove(value);
2866        } else if (name.equals("note")) {
2867          this.getNote().remove(value);
2868        } else
2869          super.removeChild(name, value);
2870        
2871      }
2872
2873      @Override
2874      public Base makeProperty(int hash, String name) throws FHIRException {
2875        switch (hash) {
2876        case -1618432855:  return addIdentifier(); 
2877        case 818734061:  return getAccessionIdentifier();
2878        case -892481550:  return getStatusElement();
2879        case 3575610:  return getType();
2880        case -1867885268:  return getSubject();
2881        case -767961010:  return getReceivedTimeElement();
2882        case -995424086:  return addParent(); 
2883        case 1095692943:  return addRequest(); 
2884        case -612455675:  return getCombinedElement();
2885        case 3506294:  return addRole(); 
2886        case -979207434:  return addFeature(); 
2887        case -1741312354:  return getCollection();
2888        case 422194963:  return addProcessing(); 
2889        case -410956671:  return addContainer(); 
2890        case -861311717:  return addCondition(); 
2891        case 3387378:  return addNote(); 
2892        default: return super.makeProperty(hash, name);
2893        }
2894
2895      }
2896
2897      @Override
2898      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2899        switch (hash) {
2900        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2901        case 818734061: /*accessionIdentifier*/ return new String[] {"Identifier"};
2902        case -892481550: /*status*/ return new String[] {"code"};
2903        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2904        case -1867885268: /*subject*/ return new String[] {"Reference"};
2905        case -767961010: /*receivedTime*/ return new String[] {"dateTime"};
2906        case -995424086: /*parent*/ return new String[] {"Reference"};
2907        case 1095692943: /*request*/ return new String[] {"Reference"};
2908        case -612455675: /*combined*/ return new String[] {"code"};
2909        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2910        case -979207434: /*feature*/ return new String[] {};
2911        case -1741312354: /*collection*/ return new String[] {};
2912        case 422194963: /*processing*/ return new String[] {};
2913        case -410956671: /*container*/ return new String[] {};
2914        case -861311717: /*condition*/ return new String[] {"CodeableConcept"};
2915        case 3387378: /*note*/ return new String[] {"Annotation"};
2916        default: return super.getTypesForProperty(hash, name);
2917        }
2918
2919      }
2920
2921      @Override
2922      public Base addChild(String name) throws FHIRException {
2923        if (name.equals("identifier")) {
2924          return addIdentifier();
2925        }
2926        else if (name.equals("accessionIdentifier")) {
2927          this.accessionIdentifier = new Identifier();
2928          return this.accessionIdentifier;
2929        }
2930        else if (name.equals("status")) {
2931          throw new FHIRException("Cannot call addChild on a singleton property Specimen.status");
2932        }
2933        else if (name.equals("type")) {
2934          this.type = new CodeableConcept();
2935          return this.type;
2936        }
2937        else if (name.equals("subject")) {
2938          this.subject = new Reference();
2939          return this.subject;
2940        }
2941        else if (name.equals("receivedTime")) {
2942          throw new FHIRException("Cannot call addChild on a singleton property Specimen.receivedTime");
2943        }
2944        else if (name.equals("parent")) {
2945          return addParent();
2946        }
2947        else if (name.equals("request")) {
2948          return addRequest();
2949        }
2950        else if (name.equals("combined")) {
2951          throw new FHIRException("Cannot call addChild on a singleton property Specimen.combined");
2952        }
2953        else if (name.equals("role")) {
2954          return addRole();
2955        }
2956        else if (name.equals("feature")) {
2957          return addFeature();
2958        }
2959        else if (name.equals("collection")) {
2960          this.collection = new SpecimenCollectionComponent();
2961          return this.collection;
2962        }
2963        else if (name.equals("processing")) {
2964          return addProcessing();
2965        }
2966        else if (name.equals("container")) {
2967          return addContainer();
2968        }
2969        else if (name.equals("condition")) {
2970          return addCondition();
2971        }
2972        else if (name.equals("note")) {
2973          return addNote();
2974        }
2975        else
2976          return super.addChild(name);
2977      }
2978
2979  public String fhirType() {
2980    return "Specimen";
2981
2982  }
2983
2984      public Specimen copy() {
2985        Specimen dst = new Specimen();
2986        copyValues(dst);
2987        return dst;
2988      }
2989
2990      public void copyValues(Specimen dst) {
2991        super.copyValues(dst);
2992        if (identifier != null) {
2993          dst.identifier = new ArrayList<Identifier>();
2994          for (Identifier i : identifier)
2995            dst.identifier.add(i.copy());
2996        };
2997        dst.accessionIdentifier = accessionIdentifier == null ? null : accessionIdentifier.copy();
2998        dst.status = status == null ? null : status.copy();
2999        dst.type = type == null ? null : type.copy();
3000        dst.subject = subject == null ? null : subject.copy();
3001        dst.receivedTime = receivedTime == null ? null : receivedTime.copy();
3002        if (parent != null) {
3003          dst.parent = new ArrayList<Reference>();
3004          for (Reference i : parent)
3005            dst.parent.add(i.copy());
3006        };
3007        if (request != null) {
3008          dst.request = new ArrayList<Reference>();
3009          for (Reference i : request)
3010            dst.request.add(i.copy());
3011        };
3012        dst.combined = combined == null ? null : combined.copy();
3013        if (role != null) {
3014          dst.role = new ArrayList<CodeableConcept>();
3015          for (CodeableConcept i : role)
3016            dst.role.add(i.copy());
3017        };
3018        if (feature != null) {
3019          dst.feature = new ArrayList<SpecimenFeatureComponent>();
3020          for (SpecimenFeatureComponent i : feature)
3021            dst.feature.add(i.copy());
3022        };
3023        dst.collection = collection == null ? null : collection.copy();
3024        if (processing != null) {
3025          dst.processing = new ArrayList<SpecimenProcessingComponent>();
3026          for (SpecimenProcessingComponent i : processing)
3027            dst.processing.add(i.copy());
3028        };
3029        if (container != null) {
3030          dst.container = new ArrayList<SpecimenContainerComponent>();
3031          for (SpecimenContainerComponent i : container)
3032            dst.container.add(i.copy());
3033        };
3034        if (condition != null) {
3035          dst.condition = new ArrayList<CodeableConcept>();
3036          for (CodeableConcept i : condition)
3037            dst.condition.add(i.copy());
3038        };
3039        if (note != null) {
3040          dst.note = new ArrayList<Annotation>();
3041          for (Annotation i : note)
3042            dst.note.add(i.copy());
3043        };
3044      }
3045
3046      protected Specimen typedCopy() {
3047        return copy();
3048      }
3049
3050      @Override
3051      public boolean equalsDeep(Base other_) {
3052        if (!super.equalsDeep(other_))
3053          return false;
3054        if (!(other_ instanceof Specimen))
3055          return false;
3056        Specimen o = (Specimen) other_;
3057        return compareDeep(identifier, o.identifier, true) && compareDeep(accessionIdentifier, o.accessionIdentifier, true)
3058           && compareDeep(status, o.status, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
3059           && compareDeep(receivedTime, o.receivedTime, true) && compareDeep(parent, o.parent, true) && compareDeep(request, o.request, true)
3060           && compareDeep(combined, o.combined, true) && compareDeep(role, o.role, true) && compareDeep(feature, o.feature, true)
3061           && compareDeep(collection, o.collection, true) && compareDeep(processing, o.processing, true) && compareDeep(container, o.container, true)
3062           && compareDeep(condition, o.condition, true) && compareDeep(note, o.note, true);
3063      }
3064
3065      @Override
3066      public boolean equalsShallow(Base other_) {
3067        if (!super.equalsShallow(other_))
3068          return false;
3069        if (!(other_ instanceof Specimen))
3070          return false;
3071        Specimen o = (Specimen) other_;
3072        return compareValues(status, o.status, true) && compareValues(receivedTime, o.receivedTime, true) && compareValues(combined, o.combined, true)
3073          ;
3074      }
3075
3076      public boolean isEmpty() {
3077        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, accessionIdentifier
3078          , status, type, subject, receivedTime, parent, request, combined, role, feature
3079          , collection, processing, container, condition, note);
3080      }
3081
3082  @Override
3083  public ResourceType getResourceType() {
3084    return ResourceType.Specimen;
3085   }
3086
3087 /**
3088   * Search parameter: <b>accession</b>
3089   * <p>
3090   * Description: <b>The accession number associated with the specimen</b><br>
3091   * Type: <b>token</b><br>
3092   * Path: <b>Specimen.accessionIdentifier</b><br>
3093   * </p>
3094   */
3095  @SearchParamDefinition(name="accession", path="Specimen.accessionIdentifier", description="The accession number associated with the specimen", type="token" )
3096  public static final String SP_ACCESSION = "accession";
3097 /**
3098   * <b>Fluent Client</b> search parameter constant for <b>accession</b>
3099   * <p>
3100   * Description: <b>The accession number associated with the specimen</b><br>
3101   * Type: <b>token</b><br>
3102   * Path: <b>Specimen.accessionIdentifier</b><br>
3103   * </p>
3104   */
3105  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACCESSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACCESSION);
3106
3107 /**
3108   * Search parameter: <b>bodysite</b>
3109   * <p>
3110   * Description: <b>Reference to a resource (by instance)</b><br>
3111   * Type: <b>reference</b><br>
3112   * Path: <b>Specimen.collection.bodySite.reference</b><br>
3113   * </p>
3114   */
3115  @SearchParamDefinition(name="bodysite", path="Specimen.collection.bodySite.reference", description="Reference to a resource (by instance)", type="reference", target={BodyStructure.class } )
3116  public static final String SP_BODYSITE = "bodysite";
3117 /**
3118   * <b>Fluent Client</b> search parameter constant for <b>bodysite</b>
3119   * <p>
3120   * Description: <b>Reference to a resource (by instance)</b><br>
3121   * Type: <b>reference</b><br>
3122   * Path: <b>Specimen.collection.bodySite.reference</b><br>
3123   * </p>
3124   */
3125  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BODYSITE);
3126
3127/**
3128   * Constant for fluent queries to be used to add include statements. Specifies
3129   * the path value of "<b>Specimen:bodysite</b>".
3130   */
3131  public static final ca.uhn.fhir.model.api.Include INCLUDE_BODYSITE = new ca.uhn.fhir.model.api.Include("Specimen:bodysite").toLocked();
3132
3133 /**
3134   * Search parameter: <b>collected</b>
3135   * <p>
3136   * Description: <b>The date the specimen was collected</b><br>
3137   * Type: <b>date</b><br>
3138   * Path: <b>Specimen.collection.collected.ofType(dateTime) | Specimen.collection.collected.ofType(Period)</b><br>
3139   * </p>
3140   */
3141  @SearchParamDefinition(name="collected", path="Specimen.collection.collected.ofType(dateTime) | Specimen.collection.collected.ofType(Period)", description="The date the specimen was collected", type="date" )
3142  public static final String SP_COLLECTED = "collected";
3143 /**
3144   * <b>Fluent Client</b> search parameter constant for <b>collected</b>
3145   * <p>
3146   * Description: <b>The date the specimen was collected</b><br>
3147   * Type: <b>date</b><br>
3148   * Path: <b>Specimen.collection.collected.ofType(dateTime) | Specimen.collection.collected.ofType(Period)</b><br>
3149   * </p>
3150   */
3151  public static final ca.uhn.fhir.rest.gclient.DateClientParam COLLECTED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_COLLECTED);
3152
3153 /**
3154   * Search parameter: <b>collector</b>
3155   * <p>
3156   * Description: <b>Who collected the specimen</b><br>
3157   * Type: <b>reference</b><br>
3158   * Path: <b>Specimen.collection.collector</b><br>
3159   * </p>
3160   */
3161  @SearchParamDefinition(name="collector", path="Specimen.collection.collector", description="Who collected the specimen", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3162  public static final String SP_COLLECTOR = "collector";
3163 /**
3164   * <b>Fluent Client</b> search parameter constant for <b>collector</b>
3165   * <p>
3166   * Description: <b>Who collected the specimen</b><br>
3167   * Type: <b>reference</b><br>
3168   * Path: <b>Specimen.collection.collector</b><br>
3169   * </p>
3170   */
3171  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COLLECTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COLLECTOR);
3172
3173/**
3174   * Constant for fluent queries to be used to add include statements. Specifies
3175   * the path value of "<b>Specimen:collector</b>".
3176   */
3177  public static final ca.uhn.fhir.model.api.Include INCLUDE_COLLECTOR = new ca.uhn.fhir.model.api.Include("Specimen:collector").toLocked();
3178
3179 /**
3180   * Search parameter: <b>container-device</b>
3181   * <p>
3182   * Description: <b>The unique identifier associated with the specimen container</b><br>
3183   * Type: <b>reference</b><br>
3184   * Path: <b>Specimen.container.device.where(resolve() is Device)</b><br>
3185   * </p>
3186   */
3187  @SearchParamDefinition(name="container-device", path="Specimen.container.device.where(resolve() is Device)", description="The unique identifier associated with the specimen container", type="reference", target={Device.class } )
3188  public static final String SP_CONTAINER_DEVICE = "container-device";
3189 /**
3190   * <b>Fluent Client</b> search parameter constant for <b>container-device</b>
3191   * <p>
3192   * Description: <b>The unique identifier associated with the specimen container</b><br>
3193   * Type: <b>reference</b><br>
3194   * Path: <b>Specimen.container.device.where(resolve() is Device)</b><br>
3195   * </p>
3196   */
3197  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTAINER_DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTAINER_DEVICE);
3198
3199/**
3200   * Constant for fluent queries to be used to add include statements. Specifies
3201   * the path value of "<b>Specimen:container-device</b>".
3202   */
3203  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTAINER_DEVICE = new ca.uhn.fhir.model.api.Include("Specimen:container-device").toLocked();
3204
3205 /**
3206   * Search parameter: <b>parent</b>
3207   * <p>
3208   * Description: <b>The parent of the specimen</b><br>
3209   * Type: <b>reference</b><br>
3210   * Path: <b>Specimen.parent</b><br>
3211   * </p>
3212   */
3213  @SearchParamDefinition(name="parent", path="Specimen.parent", description="The parent of the specimen", type="reference", target={Specimen.class } )
3214  public static final String SP_PARENT = "parent";
3215 /**
3216   * <b>Fluent Client</b> search parameter constant for <b>parent</b>
3217   * <p>
3218   * Description: <b>The parent of the specimen</b><br>
3219   * Type: <b>reference</b><br>
3220   * Path: <b>Specimen.parent</b><br>
3221   * </p>
3222   */
3223  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT);
3224
3225/**
3226   * Constant for fluent queries to be used to add include statements. Specifies
3227   * the path value of "<b>Specimen:parent</b>".
3228   */
3229  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("Specimen:parent").toLocked();
3230
3231 /**
3232   * Search parameter: <b>procedure</b>
3233   * <p>
3234   * Description: <b>The procedure that collected the specimen</b><br>
3235   * Type: <b>reference</b><br>
3236   * Path: <b>Specimen.collection.procedure</b><br>
3237   * </p>
3238   */
3239  @SearchParamDefinition(name="procedure", path="Specimen.collection.procedure", description="The procedure that collected the specimen", type="reference", target={Procedure.class } )
3240  public static final String SP_PROCEDURE = "procedure";
3241 /**
3242   * <b>Fluent Client</b> search parameter constant for <b>procedure</b>
3243   * <p>
3244   * Description: <b>The procedure that collected the specimen</b><br>
3245   * Type: <b>reference</b><br>
3246   * Path: <b>Specimen.collection.procedure</b><br>
3247   * </p>
3248   */
3249  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROCEDURE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROCEDURE);
3250
3251/**
3252   * Constant for fluent queries to be used to add include statements. Specifies
3253   * the path value of "<b>Specimen:procedure</b>".
3254   */
3255  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROCEDURE = new ca.uhn.fhir.model.api.Include("Specimen:procedure").toLocked();
3256
3257 /**
3258   * Search parameter: <b>status</b>
3259   * <p>
3260   * Description: <b>available | unavailable | unsatisfactory | entered-in-error</b><br>
3261   * Type: <b>token</b><br>
3262   * Path: <b>Specimen.status</b><br>
3263   * </p>
3264   */
3265  @SearchParamDefinition(name="status", path="Specimen.status", description="available | unavailable | unsatisfactory | entered-in-error", type="token" )
3266  public static final String SP_STATUS = "status";
3267 /**
3268   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3269   * <p>
3270   * Description: <b>available | unavailable | unsatisfactory | entered-in-error</b><br>
3271   * Type: <b>token</b><br>
3272   * Path: <b>Specimen.status</b><br>
3273   * </p>
3274   */
3275  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3276
3277 /**
3278   * Search parameter: <b>subject</b>
3279   * <p>
3280   * Description: <b>The subject of the specimen</b><br>
3281   * Type: <b>reference</b><br>
3282   * Path: <b>Specimen.subject</b><br>
3283   * </p>
3284   */
3285  @SearchParamDefinition(name="subject", path="Specimen.subject", description="The subject of the specimen", 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") }, target={BiologicallyDerivedProduct.class, Device.class, Group.class, Location.class, Patient.class, Substance.class } )
3286  public static final String SP_SUBJECT = "subject";
3287 /**
3288   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3289   * <p>
3290   * Description: <b>The subject of the specimen</b><br>
3291   * Type: <b>reference</b><br>
3292   * Path: <b>Specimen.subject</b><br>
3293   * </p>
3294   */
3295  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3296
3297/**
3298   * Constant for fluent queries to be used to add include statements. Specifies
3299   * the path value of "<b>Specimen:subject</b>".
3300   */
3301  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Specimen:subject").toLocked();
3302
3303 /**
3304   * Search parameter: <b>identifier</b>
3305   * <p>
3306   * Description: <b>Multiple Resources: 
3307
3308* [Account](account.html): Account number
3309* [AdverseEvent](adverseevent.html): Business identifier for the event
3310* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3311* [Appointment](appointment.html): An Identifier of the Appointment
3312* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
3313* [Basic](basic.html): Business identifier
3314* [BodyStructure](bodystructure.html): Bodystructure identifier
3315* [CarePlan](careplan.html): External Ids for this plan
3316* [CareTeam](careteam.html): External Ids for this team
3317* [ChargeItem](chargeitem.html): Business Identifier for item
3318* [Claim](claim.html): The primary identifier of the financial resource
3319* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
3320* [ClinicalImpression](clinicalimpression.html): Business identifier
3321* [Communication](communication.html): Unique identifier
3322* [CommunicationRequest](communicationrequest.html): Unique identifier
3323* [Composition](composition.html): Version-independent identifier for the Composition
3324* [Condition](condition.html): A unique identifier of the condition record
3325* [Consent](consent.html): Identifier for this record (external references)
3326* [Contract](contract.html): The identity of the contract
3327* [Coverage](coverage.html): The primary identifier of the insured and the coverage
3328* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
3329* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
3330* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3331* [DeviceRequest](devicerequest.html): Business identifier for request/order
3332* [DeviceUsage](deviceusage.html): Search by identifier
3333* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3334* [DocumentReference](documentreference.html): Identifier of the attachment binary
3335* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3336* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
3337* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3338* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
3339* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3340* [Flag](flag.html): Business identifier
3341* [Goal](goal.html): External Ids for this goal
3342* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
3343* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
3344* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3345* [Immunization](immunization.html): Business identifier
3346* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
3347* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
3348* [Invoice](invoice.html): Business Identifier for item
3349* [List](list.html): Business identifier
3350* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
3351* [Medication](medication.html): Returns medications with this external identifier
3352* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3353* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3354* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3355* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3356* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
3357* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
3358* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3359* [Observation](observation.html): The unique id for a particular observation
3360* [Person](person.html): A person Identifier
3361* [Procedure](procedure.html): A unique identifier for a procedure
3362* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
3363* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
3364* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
3365* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
3366* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3367* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3368* [Specimen](specimen.html): The unique identifier associated with the specimen
3369* [SupplyDelivery](supplydelivery.html): External identifier
3370* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3371* [Task](task.html): Search for a task instance by its business identifier
3372* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3373</b><br>
3374   * Type: <b>token</b><br>
3375   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
3376   * </p>
3377   */
3378  @SearchParamDefinition(name="identifier", path="Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [Account](account.html): Account number\r\n* [AdverseEvent](adverseevent.html): Business identifier for the event\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [Appointment](appointment.html): An Identifier of the Appointment\r\n* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response\r\n* [Basic](basic.html): Business identifier\r\n* [BodyStructure](bodystructure.html): Bodystructure identifier\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [ChargeItem](chargeitem.html): Business Identifier for item\r\n* [Claim](claim.html): The primary identifier of the financial resource\r\n* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse\r\n* [ClinicalImpression](clinicalimpression.html): Business identifier\r\n* [Communication](communication.html): Unique identifier\r\n* [CommunicationRequest](communicationrequest.html): Unique identifier\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* [Contract](contract.html): The identity of the contract\r\n* [Coverage](coverage.html): The primary identifier of the insured and the coverage\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DeviceUsage](deviceusage.html): Search by identifier\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Flag](flag.html): Business identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response\r\n* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier\r\n* [Invoice](invoice.html): Business Identifier for item\r\n* [List](list.html): Business identifier\r\n* [MeasureReport](measurereport.html): External identifier of the measure report to be returned\r\n* [Medication](medication.html): Returns medications with this external 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* [MedicationStatement](medicationstatement.html): Return statements with this external identifier\r\n* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence\r\n* [NutritionIntake](nutritionintake.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* [Person](person.html): A person Identifier\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response\r\n* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson\r\n* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration\r\n* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [Specimen](specimen.html): The unique identifier associated with the specimen\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [Task](task.html): Search for a task instance by its business identifier\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
3379  public static final String SP_IDENTIFIER = "identifier";
3380 /**
3381   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3382   * <p>
3383   * Description: <b>Multiple Resources: 
3384
3385* [Account](account.html): Account number
3386* [AdverseEvent](adverseevent.html): Business identifier for the event
3387* [AllergyIntolerance](allergyintolerance.html): External ids for this item
3388* [Appointment](appointment.html): An Identifier of the Appointment
3389* [AppointmentResponse](appointmentresponse.html): An Identifier in this appointment response
3390* [Basic](basic.html): Business identifier
3391* [BodyStructure](bodystructure.html): Bodystructure identifier
3392* [CarePlan](careplan.html): External Ids for this plan
3393* [CareTeam](careteam.html): External Ids for this team
3394* [ChargeItem](chargeitem.html): Business Identifier for item
3395* [Claim](claim.html): The primary identifier of the financial resource
3396* [ClaimResponse](claimresponse.html): The identity of the ClaimResponse
3397* [ClinicalImpression](clinicalimpression.html): Business identifier
3398* [Communication](communication.html): Unique identifier
3399* [CommunicationRequest](communicationrequest.html): Unique identifier
3400* [Composition](composition.html): Version-independent identifier for the Composition
3401* [Condition](condition.html): A unique identifier of the condition record
3402* [Consent](consent.html): Identifier for this record (external references)
3403* [Contract](contract.html): The identity of the contract
3404* [Coverage](coverage.html): The primary identifier of the insured and the coverage
3405* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The business identifier of the Eligibility
3406* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The business identifier
3407* [DetectedIssue](detectedissue.html): Unique id for the detected issue
3408* [DeviceRequest](devicerequest.html): Business identifier for request/order
3409* [DeviceUsage](deviceusage.html): Search by identifier
3410* [DiagnosticReport](diagnosticreport.html): An identifier for the report
3411* [DocumentReference](documentreference.html): Identifier of the attachment binary
3412* [Encounter](encounter.html): Identifier(s) by which this encounter is known
3413* [EnrollmentRequest](enrollmentrequest.html): The business identifier of the Enrollment
3414* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
3415* [ExplanationOfBenefit](explanationofbenefit.html): The business identifier of the Explanation of Benefit
3416* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
3417* [Flag](flag.html): Business identifier
3418* [Goal](goal.html): External Ids for this goal
3419* [GuidanceResponse](guidanceresponse.html): The identifier of the guidance response
3420* [ImagingSelection](imagingselection.html): Identifiers for the imaging selection
3421* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
3422* [Immunization](immunization.html): Business identifier
3423* [ImmunizationEvaluation](immunizationevaluation.html): ID of the evaluation
3424* [ImmunizationRecommendation](immunizationrecommendation.html): Business identifier
3425* [Invoice](invoice.html): Business Identifier for item
3426* [List](list.html): Business identifier
3427* [MeasureReport](measurereport.html): External identifier of the measure report to be returned
3428* [Medication](medication.html): Returns medications with this external identifier
3429* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
3430* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
3431* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
3432* [MedicationStatement](medicationstatement.html): Return statements with this external identifier
3433* [MolecularSequence](molecularsequence.html): The unique identity for a particular sequence
3434* [NutritionIntake](nutritionintake.html): Return statements with this external identifier
3435* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
3436* [Observation](observation.html): The unique id for a particular observation
3437* [Person](person.html): A person Identifier
3438* [Procedure](procedure.html): A unique identifier for a procedure
3439* [QuestionnaireResponse](questionnaireresponse.html): The unique identifier for the questionnaire response
3440* [RelatedPerson](relatedperson.html): An Identifier of the RelatedPerson
3441* [RequestOrchestration](requestorchestration.html): External identifiers for the request orchestration
3442* [ResearchSubject](researchsubject.html): Business Identifier for research subject in a study
3443* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
3444* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
3445* [Specimen](specimen.html): The unique identifier associated with the specimen
3446* [SupplyDelivery](supplydelivery.html): External identifier
3447* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
3448* [Task](task.html): Search for a task instance by its business identifier
3449* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
3450</b><br>
3451   * Type: <b>token</b><br>
3452   * Path: <b>Account.identifier | AdverseEvent.identifier | AllergyIntolerance.identifier | Appointment.identifier | AppointmentResponse.identifier | Basic.identifier | BodyStructure.identifier | CarePlan.identifier | CareTeam.identifier | ChargeItem.identifier | Claim.identifier | ClaimResponse.identifier | ClinicalImpression.identifier | Communication.identifier | CommunicationRequest.identifier | Composition.identifier | Condition.identifier | Consent.identifier | Contract.identifier | Coverage.identifier | CoverageEligibilityRequest.identifier | CoverageEligibilityResponse.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DeviceUsage.identifier | DiagnosticReport.identifier | DocumentReference.identifier | Encounter.identifier | EnrollmentRequest.identifier | EpisodeOfCare.identifier | ExplanationOfBenefit.identifier | FamilyMemberHistory.identifier | Flag.identifier | Goal.identifier | GuidanceResponse.identifier | ImagingSelection.identifier | ImagingStudy.identifier | Immunization.identifier | ImmunizationEvaluation.identifier | ImmunizationRecommendation.identifier | Invoice.identifier | List.identifier | MeasureReport.identifier | Medication.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationStatement.identifier | MolecularSequence.identifier | NutritionIntake.identifier | NutritionOrder.identifier | Observation.identifier | Person.identifier | Procedure.identifier | QuestionnaireResponse.identifier | RelatedPerson.identifier | RequestOrchestration.identifier | ResearchSubject.identifier | RiskAssessment.identifier | ServiceRequest.identifier | Specimen.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | Task.identifier | VisionPrescription.identifier</b><br>
3453   * </p>
3454   */
3455  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3456
3457 /**
3458   * Search parameter: <b>patient</b>
3459   * <p>
3460   * Description: <b>Multiple Resources: 
3461
3462* [Account](account.html): The entity that caused the expenses
3463* [AdverseEvent](adverseevent.html): Subject impacted by event
3464* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3465* [Appointment](appointment.html): One of the individuals of the appointment is this patient
3466* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
3467* [AuditEvent](auditevent.html): Where the activity involved patient data
3468* [Basic](basic.html): Identifies the focus of this resource
3469* [BodyStructure](bodystructure.html): Who this is about
3470* [CarePlan](careplan.html): Who the care plan is for
3471* [CareTeam](careteam.html): Who care team is for
3472* [ChargeItem](chargeitem.html): Individual service was done for/to
3473* [Claim](claim.html): Patient receiving the products or services
3474* [ClaimResponse](claimresponse.html): The subject of care
3475* [ClinicalImpression](clinicalimpression.html): Patient assessed
3476* [Communication](communication.html): Focus of message
3477* [CommunicationRequest](communicationrequest.html): Focus of message
3478* [Composition](composition.html): Who and/or what the composition is about
3479* [Condition](condition.html): Who has the condition?
3480* [Consent](consent.html): Who the consent applies to
3481* [Contract](contract.html): The identity of the subject of the contract (if a patient)
3482* [Coverage](coverage.html): Retrieve coverages for a patient
3483* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
3484* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
3485* [DetectedIssue](detectedissue.html): Associated patient
3486* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3487* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
3488* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3489* [DocumentReference](documentreference.html): Who/what is the subject of the document
3490* [Encounter](encounter.html): The patient present at the encounter
3491* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
3492* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3493* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
3494* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3495* [Flag](flag.html): The identity of a subject to list flags for
3496* [Goal](goal.html): Who this goal is intended for
3497* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
3498* [ImagingSelection](imagingselection.html): Who the study is about
3499* [ImagingStudy](imagingstudy.html): Who the study is about
3500* [Immunization](immunization.html): The patient for the vaccination record
3501* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
3502* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
3503* [Invoice](invoice.html): Recipient(s) of goods and services
3504* [List](list.html): If all resources have the same subject
3505* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
3506* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3507* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3508* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3509* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3510* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
3511* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
3512* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
3513* [Observation](observation.html): The subject that the observation is about (if patient)
3514* [Person](person.html): The Person links to this Patient
3515* [Procedure](procedure.html): Search by subject - a patient
3516* [Provenance](provenance.html): Where the activity involved patient data
3517* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
3518* [RelatedPerson](relatedperson.html): The patient this related person is related to
3519* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
3520* [ResearchSubject](researchsubject.html): Who or what is part of study
3521* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3522* [ServiceRequest](servicerequest.html): Search by subject - a patient
3523* [Specimen](specimen.html): The patient the specimen comes from
3524* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3525* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
3526* [Task](task.html): Search by patient
3527* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3528</b><br>
3529   * Type: <b>reference</b><br>
3530   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
3531   * </p>
3532   */
3533  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [Account](account.html): The entity that caused the expenses\r\n* [AdverseEvent](adverseevent.html): Subject impacted by event\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [Appointment](appointment.html): One of the individuals of the appointment is this patient\r\n* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient\r\n* [AuditEvent](auditevent.html): Where the activity involved patient data\r\n* [Basic](basic.html): Identifies the focus of this resource\r\n* [BodyStructure](bodystructure.html): Who this is about\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ChargeItem](chargeitem.html): Individual service was done for/to\r\n* [Claim](claim.html): Patient receiving the products or services\r\n* [ClaimResponse](claimresponse.html): The subject of care\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Communication](communication.html): Focus of message\r\n* [CommunicationRequest](communicationrequest.html): Focus of message\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* [Contract](contract.html): The identity of the subject of the contract (if a patient)\r\n* [Coverage](coverage.html): Retrieve coverages for a patient\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient\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* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results\r\n* [ImagingSelection](imagingselection.html): Who the study is about\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for\r\n* [Invoice](invoice.html): Recipient(s) of goods and services\r\n* [List](list.html): If all resources have the same subject\r\n* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for\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* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [MolecularSequence](molecularsequence.html): The subject that the sequence is about\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Person](person.html): The Person links to this Patient\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [Provenance](provenance.html): Where the activity involved patient data\r\n* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response\r\n* [RelatedPerson](relatedperson.html): The patient this related person is related to\r\n* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations\r\n* [ResearchSubject](researchsubject.html): Who or what is part of study\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [Specimen](specimen.html): The patient the specimen comes from\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [Task](task.html): Search by patient\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", target={Patient.class } )
3534  public static final String SP_PATIENT = "patient";
3535 /**
3536   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3537   * <p>
3538   * Description: <b>Multiple Resources: 
3539
3540* [Account](account.html): The entity that caused the expenses
3541* [AdverseEvent](adverseevent.html): Subject impacted by event
3542* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
3543* [Appointment](appointment.html): One of the individuals of the appointment is this patient
3544* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
3545* [AuditEvent](auditevent.html): Where the activity involved patient data
3546* [Basic](basic.html): Identifies the focus of this resource
3547* [BodyStructure](bodystructure.html): Who this is about
3548* [CarePlan](careplan.html): Who the care plan is for
3549* [CareTeam](careteam.html): Who care team is for
3550* [ChargeItem](chargeitem.html): Individual service was done for/to
3551* [Claim](claim.html): Patient receiving the products or services
3552* [ClaimResponse](claimresponse.html): The subject of care
3553* [ClinicalImpression](clinicalimpression.html): Patient assessed
3554* [Communication](communication.html): Focus of message
3555* [CommunicationRequest](communicationrequest.html): Focus of message
3556* [Composition](composition.html): Who and/or what the composition is about
3557* [Condition](condition.html): Who has the condition?
3558* [Consent](consent.html): Who the consent applies to
3559* [Contract](contract.html): The identity of the subject of the contract (if a patient)
3560* [Coverage](coverage.html): Retrieve coverages for a patient
3561* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
3562* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
3563* [DetectedIssue](detectedissue.html): Associated patient
3564* [DeviceRequest](devicerequest.html): Individual the service is ordered for
3565* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
3566* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
3567* [DocumentReference](documentreference.html): Who/what is the subject of the document
3568* [Encounter](encounter.html): The patient present at the encounter
3569* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
3570* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
3571* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
3572* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
3573* [Flag](flag.html): The identity of a subject to list flags for
3574* [Goal](goal.html): Who this goal is intended for
3575* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
3576* [ImagingSelection](imagingselection.html): Who the study is about
3577* [ImagingStudy](imagingstudy.html): Who the study is about
3578* [Immunization](immunization.html): The patient for the vaccination record
3579* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
3580* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
3581* [Invoice](invoice.html): Recipient(s) of goods and services
3582* [List](list.html): If all resources have the same subject
3583* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
3584* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
3585* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
3586* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
3587* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
3588* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
3589* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
3590* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
3591* [Observation](observation.html): The subject that the observation is about (if patient)
3592* [Person](person.html): The Person links to this Patient
3593* [Procedure](procedure.html): Search by subject - a patient
3594* [Provenance](provenance.html): Where the activity involved patient data
3595* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
3596* [RelatedPerson](relatedperson.html): The patient this related person is related to
3597* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
3598* [ResearchSubject](researchsubject.html): Who or what is part of study
3599* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
3600* [ServiceRequest](servicerequest.html): Search by subject - a patient
3601* [Specimen](specimen.html): The patient the specimen comes from
3602* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
3603* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
3604* [Task](task.html): Search by patient
3605* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
3606</b><br>
3607   * Type: <b>reference</b><br>
3608   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
3609   * </p>
3610   */
3611  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3612
3613/**
3614   * Constant for fluent queries to be used to add include statements. Specifies
3615   * the path value of "<b>Specimen:patient</b>".
3616   */
3617  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Specimen:patient").toLocked();
3618
3619 /**
3620   * Search parameter: <b>type</b>
3621   * <p>
3622   * Description: <b>Multiple Resources: 
3623
3624* [Account](account.html): E.g. patient, expense, depreciation
3625* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3626* [Composition](composition.html): Kind of composition (LOINC if possible)
3627* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)
3628* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3629* [Encounter](encounter.html): Specific type of encounter
3630* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3631* [Invoice](invoice.html): Type of Invoice
3632* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type
3633* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence
3634* [Specimen](specimen.html): The specimen type
3635</b><br>
3636   * Type: <b>token</b><br>
3637   * Path: <b>Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type</b><br>
3638   * </p>
3639   */
3640  @SearchParamDefinition(name="type", path="Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type", description="Multiple Resources: \r\n\r\n* [Account](account.html): E.g. patient, expense, depreciation\r\n* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)\r\n* [Composition](composition.html): Kind of composition (LOINC if possible)\r\n* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)\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* [Invoice](invoice.html): Type of Invoice\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type\r\n* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence\r\n* [Specimen](specimen.html): The specimen type\r\n", type="token" )
3641  public static final String SP_TYPE = "type";
3642 /**
3643   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3644   * <p>
3645   * Description: <b>Multiple Resources: 
3646
3647* [Account](account.html): E.g. patient, expense, depreciation
3648* [AllergyIntolerance](allergyintolerance.html): allergy | intolerance - Underlying mechanism (if known)
3649* [Composition](composition.html): Kind of composition (LOINC if possible)
3650* [Coverage](coverage.html): The kind of coverage (health plan, auto, Workers Compensation)
3651* [DocumentReference](documentreference.html): Kind of document (LOINC if possible)
3652* [Encounter](encounter.html): Specific type of encounter
3653* [EpisodeOfCare](episodeofcare.html): Type/class  - e.g. specialist referral, disease management
3654* [Invoice](invoice.html): Type of Invoice
3655* [MedicationDispense](medicationdispense.html): Returns dispenses of a specific type
3656* [MolecularSequence](molecularsequence.html): Amino Acid Sequence/ DNA Sequence / RNA Sequence
3657* [Specimen](specimen.html): The specimen type
3658</b><br>
3659   * Type: <b>token</b><br>
3660   * Path: <b>Account.type | AllergyIntolerance.type | Composition.type | Coverage.type | DocumentReference.type | Encounter.type | EpisodeOfCare.type | Invoice.type | MedicationDispense.type | MolecularSequence.type | Specimen.type</b><br>
3661   * </p>
3662   */
3663  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3664
3665
3666}
3667