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