001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import org.hl7.fhir.exceptions.FHIRException;
047import org.hl7.fhir.utilities.Utilities;
048/**
049 * A sample to be used for analysis.
050 */
051@ResourceDef(name="Specimen", profile="http://hl7.org/fhir/Profile/Specimen")
052public class Specimen extends DomainResource {
053
054    public enum SpecimenStatus {
055        /**
056         * The physical specimen is present and in good condition.
057         */
058        AVAILABLE, 
059        /**
060         * There is no physical specimen because it is either lost, destroyed or consumed.
061         */
062        UNAVAILABLE, 
063        /**
064         * The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.
065         */
066        UNSATISFACTORY, 
067        /**
068         * The specimen was entered in error and therefore nullified.
069         */
070        ENTEREDINERROR, 
071        /**
072         * added to help the parsers
073         */
074        NULL;
075        public static SpecimenStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("available".equals(codeString))
079          return AVAILABLE;
080        if ("unavailable".equals(codeString))
081          return UNAVAILABLE;
082        if ("unsatisfactory".equals(codeString))
083          return UNSATISFACTORY;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
087        }
088        public String toCode() {
089          switch (this) {
090            case AVAILABLE: return "available";
091            case UNAVAILABLE: return "unavailable";
092            case UNSATISFACTORY: return "unsatisfactory";
093            case ENTEREDINERROR: return "entered-in-error";
094            case NULL: return null;
095            default: return "?";
096          }
097        }
098        public String getSystem() {
099          switch (this) {
100            case AVAILABLE: return "http://hl7.org/fhir/specimen-status";
101            case UNAVAILABLE: return "http://hl7.org/fhir/specimen-status";
102            case UNSATISFACTORY: return "http://hl7.org/fhir/specimen-status";
103            case ENTEREDINERROR: return "http://hl7.org/fhir/specimen-status";
104            case NULL: return null;
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case AVAILABLE: return "The physical specimen is present and in good condition.";
111            case UNAVAILABLE: return "There is no physical specimen because it is either lost, destroyed or consumed.";
112            case UNSATISFACTORY: return "The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.";
113            case ENTEREDINERROR: return "The specimen was entered in error and therefore nullified.";
114            case NULL: return null;
115            default: return "?";
116          }
117        }
118        public String getDisplay() {
119          switch (this) {
120            case AVAILABLE: return "Available";
121            case UNAVAILABLE: return "Unavailable";
122            case UNSATISFACTORY: return "Unsatisfactory";
123            case ENTEREDINERROR: return "Entered-in-error";
124            case NULL: return null;
125            default: return "?";
126          }
127        }
128    }
129
130  public static class SpecimenStatusEnumFactory implements EnumFactory<SpecimenStatus> {
131    public SpecimenStatus fromCode(String codeString) throws IllegalArgumentException {
132      if (codeString == null || "".equals(codeString))
133            if (codeString == null || "".equals(codeString))
134                return null;
135        if ("available".equals(codeString))
136          return SpecimenStatus.AVAILABLE;
137        if ("unavailable".equals(codeString))
138          return SpecimenStatus.UNAVAILABLE;
139        if ("unsatisfactory".equals(codeString))
140          return SpecimenStatus.UNSATISFACTORY;
141        if ("entered-in-error".equals(codeString))
142          return SpecimenStatus.ENTEREDINERROR;
143        throw new IllegalArgumentException("Unknown SpecimenStatus code '"+codeString+"'");
144        }
145        public Enumeration<SpecimenStatus> fromType(Base code) throws FHIRException {
146          if (code == null || code.isEmpty())
147            return null;
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("available".equals(codeString))
152          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.AVAILABLE);
153        if ("unavailable".equals(codeString))
154          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNAVAILABLE);
155        if ("unsatisfactory".equals(codeString))
156          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNSATISFACTORY);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
160        }
161    public String toCode(SpecimenStatus code) {
162      if (code == SpecimenStatus.AVAILABLE)
163        return "available";
164      if (code == SpecimenStatus.UNAVAILABLE)
165        return "unavailable";
166      if (code == SpecimenStatus.UNSATISFACTORY)
167        return "unsatisfactory";
168      if (code == SpecimenStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    }
173
174    @Block()
175    public static class SpecimenCollectionComponent extends BackboneElement implements IBaseBackboneElement {
176        /**
177         * Person who collected the specimen.
178         */
179        @Child(name = "collector", type = {Practitioner.class}, order=1, min=0, max=1, modifier=false, summary=true)
180        @Description(shortDefinition="Who collected the specimen", formalDefinition="Person who collected the specimen." )
181        protected Reference collector;
182
183        /**
184         * The actual object that is the target of the reference (Person who collected the specimen.)
185         */
186        protected Practitioner collectorTarget;
187
188        /**
189         * To communicate any details or issues encountered during the specimen collection procedure.
190         */
191        @Child(name = "comment", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
192        @Description(shortDefinition="Collector comments", formalDefinition="To communicate any details or issues encountered during the specimen collection procedure." )
193        protected List<StringType> comment;
194
195        /**
196         * Time when specimen was collected from subject - the physiologically relevant time.
197         */
198        @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
199        @Description(shortDefinition="Collection time", formalDefinition="Time when specimen was collected from subject - the physiologically relevant time." )
200        protected Type collected;
201
202        /**
203         * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.
204         */
205        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
206        @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." )
207        protected SimpleQuantity quantity;
208
209        /**
210         * A coded value specifying the technique that is used to perform the procedure.
211         */
212        @Child(name = "method", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
213        @Description(shortDefinition="Technique used to perform collection", formalDefinition="A coded value specifying the technique that is used to perform the procedure." )
214        protected CodeableConcept method;
215
216        /**
217         * 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.
218         */
219        @Child(name = "bodySite", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
220        @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." )
221        protected CodeableConcept bodySite;
222
223        private static final long serialVersionUID = -1418734687L;
224
225    /*
226     * Constructor
227     */
228      public SpecimenCollectionComponent() {
229        super();
230      }
231
232        /**
233         * @return {@link #collector} (Person who collected the specimen.)
234         */
235        public Reference getCollector() { 
236          if (this.collector == null)
237            if (Configuration.errorOnAutoCreate())
238              throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector");
239            else if (Configuration.doAutoCreate())
240              this.collector = new Reference(); // cc
241          return this.collector;
242        }
243
244        public boolean hasCollector() { 
245          return this.collector != null && !this.collector.isEmpty();
246        }
247
248        /**
249         * @param value {@link #collector} (Person who collected the specimen.)
250         */
251        public SpecimenCollectionComponent setCollector(Reference value) { 
252          this.collector = value;
253          return this;
254        }
255
256        /**
257         * @return {@link #collector} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Person who collected the specimen.)
258         */
259        public Practitioner getCollectorTarget() { 
260          if (this.collectorTarget == null)
261            if (Configuration.errorOnAutoCreate())
262              throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector");
263            else if (Configuration.doAutoCreate())
264              this.collectorTarget = new Practitioner(); // aa
265          return this.collectorTarget;
266        }
267
268        /**
269         * @param value {@link #collector} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Person who collected the specimen.)
270         */
271        public SpecimenCollectionComponent setCollectorTarget(Practitioner value) { 
272          this.collectorTarget = value;
273          return this;
274        }
275
276        /**
277         * @return {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
278         */
279        public List<StringType> getComment() { 
280          if (this.comment == null)
281            this.comment = new ArrayList<StringType>();
282          return this.comment;
283        }
284
285        public boolean hasComment() { 
286          if (this.comment == null)
287            return false;
288          for (StringType item : this.comment)
289            if (!item.isEmpty())
290              return true;
291          return false;
292        }
293
294        /**
295         * @return {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
296         */
297    // syntactic sugar
298        public StringType addCommentElement() {//2 
299          StringType t = new StringType();
300          if (this.comment == null)
301            this.comment = new ArrayList<StringType>();
302          this.comment.add(t);
303          return t;
304        }
305
306        /**
307         * @param value {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
308         */
309        public SpecimenCollectionComponent addComment(String value) { //1
310          StringType t = new StringType();
311          t.setValue(value);
312          if (this.comment == null)
313            this.comment = new ArrayList<StringType>();
314          this.comment.add(t);
315          return this;
316        }
317
318        /**
319         * @param value {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
320         */
321        public boolean hasComment(String value) { 
322          if (this.comment == null)
323            return false;
324          for (StringType v : this.comment)
325            if (v.equals(value)) // string
326              return true;
327          return false;
328        }
329
330        /**
331         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
332         */
333        public Type getCollected() { 
334          return this.collected;
335        }
336
337        /**
338         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
339         */
340        public DateTimeType getCollectedDateTimeType() throws FHIRException { 
341          if (!(this.collected instanceof DateTimeType))
342            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered");
343          return (DateTimeType) this.collected;
344        }
345
346        public boolean hasCollectedDateTimeType() { 
347          return this.collected instanceof DateTimeType;
348        }
349
350        /**
351         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
352         */
353        public Period getCollectedPeriod() throws FHIRException { 
354          if (!(this.collected instanceof Period))
355            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered");
356          return (Period) this.collected;
357        }
358
359        public boolean hasCollectedPeriod() { 
360          return this.collected instanceof Period;
361        }
362
363        public boolean hasCollected() { 
364          return this.collected != null && !this.collected.isEmpty();
365        }
366
367        /**
368         * @param value {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
369         */
370        public SpecimenCollectionComponent setCollected(Type value) { 
371          this.collected = value;
372          return this;
373        }
374
375        /**
376         * @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.)
377         */
378        public SimpleQuantity getQuantity() { 
379          if (this.quantity == null)
380            if (Configuration.errorOnAutoCreate())
381              throw new Error("Attempt to auto-create SpecimenCollectionComponent.quantity");
382            else if (Configuration.doAutoCreate())
383              this.quantity = new SimpleQuantity(); // cc
384          return this.quantity;
385        }
386
387        public boolean hasQuantity() { 
388          return this.quantity != null && !this.quantity.isEmpty();
389        }
390
391        /**
392         * @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.)
393         */
394        public SpecimenCollectionComponent setQuantity(SimpleQuantity value) { 
395          this.quantity = value;
396          return this;
397        }
398
399        /**
400         * @return {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
401         */
402        public CodeableConcept getMethod() { 
403          if (this.method == null)
404            if (Configuration.errorOnAutoCreate())
405              throw new Error("Attempt to auto-create SpecimenCollectionComponent.method");
406            else if (Configuration.doAutoCreate())
407              this.method = new CodeableConcept(); // cc
408          return this.method;
409        }
410
411        public boolean hasMethod() { 
412          return this.method != null && !this.method.isEmpty();
413        }
414
415        /**
416         * @param value {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
417         */
418        public SpecimenCollectionComponent setMethod(CodeableConcept value) { 
419          this.method = value;
420          return this;
421        }
422
423        /**
424         * @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.)
425         */
426        public CodeableConcept getBodySite() { 
427          if (this.bodySite == null)
428            if (Configuration.errorOnAutoCreate())
429              throw new Error("Attempt to auto-create SpecimenCollectionComponent.bodySite");
430            else if (Configuration.doAutoCreate())
431              this.bodySite = new CodeableConcept(); // cc
432          return this.bodySite;
433        }
434
435        public boolean hasBodySite() { 
436          return this.bodySite != null && !this.bodySite.isEmpty();
437        }
438
439        /**
440         * @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.)
441         */
442        public SpecimenCollectionComponent setBodySite(CodeableConcept value) { 
443          this.bodySite = value;
444          return this;
445        }
446
447        protected void listChildren(List<Property> childrenList) {
448          super.listChildren(childrenList);
449          childrenList.add(new Property("collector", "Reference(Practitioner)", "Person who collected the specimen.", 0, java.lang.Integer.MAX_VALUE, collector));
450          childrenList.add(new Property("comment", "string", "To communicate any details or issues encountered during the specimen collection procedure.", 0, java.lang.Integer.MAX_VALUE, comment));
451          childrenList.add(new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, java.lang.Integer.MAX_VALUE, collected));
452          childrenList.add(new Property("quantity", "SimpleQuantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, java.lang.Integer.MAX_VALUE, quantity));
453          childrenList.add(new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, java.lang.Integer.MAX_VALUE, method));
454          childrenList.add(new Property("bodySite", "CodeableConcept", "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, java.lang.Integer.MAX_VALUE, bodySite));
455        }
456
457      @Override
458      public void setProperty(String name, Base value) throws FHIRException {
459        if (name.equals("collector"))
460          this.collector = castToReference(value); // Reference
461        else if (name.equals("comment"))
462          this.getComment().add(castToString(value));
463        else if (name.equals("collected[x]"))
464          this.collected = (Type) value; // Type
465        else if (name.equals("quantity"))
466          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
467        else if (name.equals("method"))
468          this.method = castToCodeableConcept(value); // CodeableConcept
469        else if (name.equals("bodySite"))
470          this.bodySite = castToCodeableConcept(value); // CodeableConcept
471        else
472          super.setProperty(name, value);
473      }
474
475      @Override
476      public Base addChild(String name) throws FHIRException {
477        if (name.equals("collector")) {
478          this.collector = new Reference();
479          return this.collector;
480        }
481        else if (name.equals("comment")) {
482          throw new FHIRException("Cannot call addChild on a primitive type Specimen.comment");
483        }
484        else if (name.equals("collectedDateTime")) {
485          this.collected = new DateTimeType();
486          return this.collected;
487        }
488        else if (name.equals("collectedPeriod")) {
489          this.collected = new Period();
490          return this.collected;
491        }
492        else if (name.equals("quantity")) {
493          this.quantity = new SimpleQuantity();
494          return this.quantity;
495        }
496        else if (name.equals("method")) {
497          this.method = new CodeableConcept();
498          return this.method;
499        }
500        else if (name.equals("bodySite")) {
501          this.bodySite = new CodeableConcept();
502          return this.bodySite;
503        }
504        else
505          return super.addChild(name);
506      }
507
508      public SpecimenCollectionComponent copy() {
509        SpecimenCollectionComponent dst = new SpecimenCollectionComponent();
510        copyValues(dst);
511        dst.collector = collector == null ? null : collector.copy();
512        if (comment != null) {
513          dst.comment = new ArrayList<StringType>();
514          for (StringType i : comment)
515            dst.comment.add(i.copy());
516        };
517        dst.collected = collected == null ? null : collected.copy();
518        dst.quantity = quantity == null ? null : quantity.copy();
519        dst.method = method == null ? null : method.copy();
520        dst.bodySite = bodySite == null ? null : bodySite.copy();
521        return dst;
522      }
523
524      @Override
525      public boolean equalsDeep(Base other) {
526        if (!super.equalsDeep(other))
527          return false;
528        if (!(other instanceof SpecimenCollectionComponent))
529          return false;
530        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other;
531        return compareDeep(collector, o.collector, true) && compareDeep(comment, o.comment, true) && compareDeep(collected, o.collected, true)
532           && compareDeep(quantity, o.quantity, true) && compareDeep(method, o.method, true) && compareDeep(bodySite, o.bodySite, true)
533          ;
534      }
535
536      @Override
537      public boolean equalsShallow(Base other) {
538        if (!super.equalsShallow(other))
539          return false;
540        if (!(other instanceof SpecimenCollectionComponent))
541          return false;
542        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other;
543        return compareValues(comment, o.comment, true);
544      }
545
546      public boolean isEmpty() {
547        return super.isEmpty() && (collector == null || collector.isEmpty()) && (comment == null || comment.isEmpty())
548           && (collected == null || collected.isEmpty()) && (quantity == null || quantity.isEmpty())
549           && (method == null || method.isEmpty()) && (bodySite == null || bodySite.isEmpty());
550      }
551
552  public String fhirType() {
553    return "Specimen.collection";
554
555  }
556
557  }
558
559    @Block()
560    public static class SpecimenTreatmentComponent extends BackboneElement implements IBaseBackboneElement {
561        /**
562         * Textual description of procedure.
563         */
564        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
565        @Description(shortDefinition="Textual description of procedure", formalDefinition="Textual description of procedure." )
566        protected StringType description;
567
568        /**
569         * A coded value specifying the procedure used to process the specimen.
570         */
571        @Child(name = "procedure", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
572        @Description(shortDefinition="Indicates the treatment or processing step  applied to the specimen", formalDefinition="A coded value specifying the procedure used to process the specimen." )
573        protected CodeableConcept procedure;
574
575        /**
576         * Material used in the processing step.
577         */
578        @Child(name = "additive", type = {Substance.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
579        @Description(shortDefinition="Material used in the processing step", formalDefinition="Material used in the processing step." )
580        protected List<Reference> additive;
581        /**
582         * The actual objects that are the target of the reference (Material used in the processing step.)
583         */
584        protected List<Substance> additiveTarget;
585
586
587        private static final long serialVersionUID = -373251521L;
588
589    /*
590     * Constructor
591     */
592      public SpecimenTreatmentComponent() {
593        super();
594      }
595
596        /**
597         * @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
598         */
599        public StringType getDescriptionElement() { 
600          if (this.description == null)
601            if (Configuration.errorOnAutoCreate())
602              throw new Error("Attempt to auto-create SpecimenTreatmentComponent.description");
603            else if (Configuration.doAutoCreate())
604              this.description = new StringType(); // bb
605          return this.description;
606        }
607
608        public boolean hasDescriptionElement() { 
609          return this.description != null && !this.description.isEmpty();
610        }
611
612        public boolean hasDescription() { 
613          return this.description != null && !this.description.isEmpty();
614        }
615
616        /**
617         * @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
618         */
619        public SpecimenTreatmentComponent setDescriptionElement(StringType value) { 
620          this.description = value;
621          return this;
622        }
623
624        /**
625         * @return Textual description of procedure.
626         */
627        public String getDescription() { 
628          return this.description == null ? null : this.description.getValue();
629        }
630
631        /**
632         * @param value Textual description of procedure.
633         */
634        public SpecimenTreatmentComponent setDescription(String value) { 
635          if (Utilities.noString(value))
636            this.description = null;
637          else {
638            if (this.description == null)
639              this.description = new StringType();
640            this.description.setValue(value);
641          }
642          return this;
643        }
644
645        /**
646         * @return {@link #procedure} (A coded value specifying the procedure used to process the specimen.)
647         */
648        public CodeableConcept getProcedure() { 
649          if (this.procedure == null)
650            if (Configuration.errorOnAutoCreate())
651              throw new Error("Attempt to auto-create SpecimenTreatmentComponent.procedure");
652            else if (Configuration.doAutoCreate())
653              this.procedure = new CodeableConcept(); // cc
654          return this.procedure;
655        }
656
657        public boolean hasProcedure() { 
658          return this.procedure != null && !this.procedure.isEmpty();
659        }
660
661        /**
662         * @param value {@link #procedure} (A coded value specifying the procedure used to process the specimen.)
663         */
664        public SpecimenTreatmentComponent setProcedure(CodeableConcept value) { 
665          this.procedure = value;
666          return this;
667        }
668
669        /**
670         * @return {@link #additive} (Material used in the processing step.)
671         */
672        public List<Reference> getAdditive() { 
673          if (this.additive == null)
674            this.additive = new ArrayList<Reference>();
675          return this.additive;
676        }
677
678        public boolean hasAdditive() { 
679          if (this.additive == null)
680            return false;
681          for (Reference item : this.additive)
682            if (!item.isEmpty())
683              return true;
684          return false;
685        }
686
687        /**
688         * @return {@link #additive} (Material used in the processing step.)
689         */
690    // syntactic sugar
691        public Reference addAdditive() { //3
692          Reference t = new Reference();
693          if (this.additive == null)
694            this.additive = new ArrayList<Reference>();
695          this.additive.add(t);
696          return t;
697        }
698
699    // syntactic sugar
700        public SpecimenTreatmentComponent addAdditive(Reference t) { //3
701          if (t == null)
702            return this;
703          if (this.additive == null)
704            this.additive = new ArrayList<Reference>();
705          this.additive.add(t);
706          return this;
707        }
708
709        /**
710         * @return {@link #additive} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Material used in the processing step.)
711         */
712        public List<Substance> getAdditiveTarget() { 
713          if (this.additiveTarget == null)
714            this.additiveTarget = new ArrayList<Substance>();
715          return this.additiveTarget;
716        }
717
718    // syntactic sugar
719        /**
720         * @return {@link #additive} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Material used in the processing step.)
721         */
722        public Substance addAdditiveTarget() { 
723          Substance r = new Substance();
724          if (this.additiveTarget == null)
725            this.additiveTarget = new ArrayList<Substance>();
726          this.additiveTarget.add(r);
727          return r;
728        }
729
730        protected void listChildren(List<Property> childrenList) {
731          super.listChildren(childrenList);
732          childrenList.add(new Property("description", "string", "Textual description of procedure.", 0, java.lang.Integer.MAX_VALUE, description));
733          childrenList.add(new Property("procedure", "CodeableConcept", "A coded value specifying the procedure used to process the specimen.", 0, java.lang.Integer.MAX_VALUE, procedure));
734          childrenList.add(new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive));
735        }
736
737      @Override
738      public void setProperty(String name, Base value) throws FHIRException {
739        if (name.equals("description"))
740          this.description = castToString(value); // StringType
741        else if (name.equals("procedure"))
742          this.procedure = castToCodeableConcept(value); // CodeableConcept
743        else if (name.equals("additive"))
744          this.getAdditive().add(castToReference(value));
745        else
746          super.setProperty(name, value);
747      }
748
749      @Override
750      public Base addChild(String name) throws FHIRException {
751        if (name.equals("description")) {
752          throw new FHIRException("Cannot call addChild on a primitive type Specimen.description");
753        }
754        else if (name.equals("procedure")) {
755          this.procedure = new CodeableConcept();
756          return this.procedure;
757        }
758        else if (name.equals("additive")) {
759          return addAdditive();
760        }
761        else
762          return super.addChild(name);
763      }
764
765      public SpecimenTreatmentComponent copy() {
766        SpecimenTreatmentComponent dst = new SpecimenTreatmentComponent();
767        copyValues(dst);
768        dst.description = description == null ? null : description.copy();
769        dst.procedure = procedure == null ? null : procedure.copy();
770        if (additive != null) {
771          dst.additive = new ArrayList<Reference>();
772          for (Reference i : additive)
773            dst.additive.add(i.copy());
774        };
775        return dst;
776      }
777
778      @Override
779      public boolean equalsDeep(Base other) {
780        if (!super.equalsDeep(other))
781          return false;
782        if (!(other instanceof SpecimenTreatmentComponent))
783          return false;
784        SpecimenTreatmentComponent o = (SpecimenTreatmentComponent) other;
785        return compareDeep(description, o.description, true) && compareDeep(procedure, o.procedure, true)
786           && compareDeep(additive, o.additive, true);
787      }
788
789      @Override
790      public boolean equalsShallow(Base other) {
791        if (!super.equalsShallow(other))
792          return false;
793        if (!(other instanceof SpecimenTreatmentComponent))
794          return false;
795        SpecimenTreatmentComponent o = (SpecimenTreatmentComponent) other;
796        return compareValues(description, o.description, true);
797      }
798
799      public boolean isEmpty() {
800        return super.isEmpty() && (description == null || description.isEmpty()) && (procedure == null || procedure.isEmpty())
801           && (additive == null || additive.isEmpty());
802      }
803
804  public String fhirType() {
805    return "Specimen.treatment";
806
807  }
808
809  }
810
811    @Block()
812    public static class SpecimenContainerComponent extends BackboneElement implements IBaseBackboneElement {
813        /**
814         * Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.
815         */
816        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
817        @Description(shortDefinition="Id for the container", formalDefinition="Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances." )
818        protected List<Identifier> identifier;
819
820        /**
821         * Textual description of the container.
822         */
823        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
824        @Description(shortDefinition="Textual description of the container", formalDefinition="Textual description of the container." )
825        protected StringType description;
826
827        /**
828         * The type of container associated with the specimen (e.g. slide, aliquot, etc.).
829         */
830        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
831        @Description(shortDefinition="Kind of container directly associated with specimen", formalDefinition="The type of container associated with the specimen (e.g. slide, aliquot, etc.)." )
832        protected CodeableConcept type;
833
834        /**
835         * The capacity (volume or other measure) the container may contain.
836         */
837        @Child(name = "capacity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
838        @Description(shortDefinition="Container volume or size", formalDefinition="The capacity (volume or other measure) the container may contain." )
839        protected SimpleQuantity capacity;
840
841        /**
842         * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.
843         */
844        @Child(name = "specimenQuantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
845        @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." )
846        protected SimpleQuantity specimenQuantity;
847
848        /**
849         * Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.
850         */
851        @Child(name = "additive", type = {CodeableConcept.class, Substance.class}, order=6, min=0, max=1, modifier=false, summary=false)
852        @Description(shortDefinition="Additive associated with container", formalDefinition="Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA." )
853        protected Type additive;
854
855        private static final long serialVersionUID = 187274879L;
856
857    /*
858     * Constructor
859     */
860      public SpecimenContainerComponent() {
861        super();
862      }
863
864        /**
865         * @return {@link #identifier} (Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.)
866         */
867        public List<Identifier> getIdentifier() { 
868          if (this.identifier == null)
869            this.identifier = new ArrayList<Identifier>();
870          return this.identifier;
871        }
872
873        public boolean hasIdentifier() { 
874          if (this.identifier == null)
875            return false;
876          for (Identifier item : this.identifier)
877            if (!item.isEmpty())
878              return true;
879          return false;
880        }
881
882        /**
883         * @return {@link #identifier} (Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.)
884         */
885    // syntactic sugar
886        public Identifier addIdentifier() { //3
887          Identifier t = new Identifier();
888          if (this.identifier == null)
889            this.identifier = new ArrayList<Identifier>();
890          this.identifier.add(t);
891          return t;
892        }
893
894    // syntactic sugar
895        public SpecimenContainerComponent addIdentifier(Identifier t) { //3
896          if (t == null)
897            return this;
898          if (this.identifier == null)
899            this.identifier = new ArrayList<Identifier>();
900          this.identifier.add(t);
901          return this;
902        }
903
904        /**
905         * @return {@link #description} (Textual description of the container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
906         */
907        public StringType getDescriptionElement() { 
908          if (this.description == null)
909            if (Configuration.errorOnAutoCreate())
910              throw new Error("Attempt to auto-create SpecimenContainerComponent.description");
911            else if (Configuration.doAutoCreate())
912              this.description = new StringType(); // bb
913          return this.description;
914        }
915
916        public boolean hasDescriptionElement() { 
917          return this.description != null && !this.description.isEmpty();
918        }
919
920        public boolean hasDescription() { 
921          return this.description != null && !this.description.isEmpty();
922        }
923
924        /**
925         * @param value {@link #description} (Textual description of the container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
926         */
927        public SpecimenContainerComponent setDescriptionElement(StringType value) { 
928          this.description = value;
929          return this;
930        }
931
932        /**
933         * @return Textual description of the container.
934         */
935        public String getDescription() { 
936          return this.description == null ? null : this.description.getValue();
937        }
938
939        /**
940         * @param value Textual description of the container.
941         */
942        public SpecimenContainerComponent setDescription(String value) { 
943          if (Utilities.noString(value))
944            this.description = null;
945          else {
946            if (this.description == null)
947              this.description = new StringType();
948            this.description.setValue(value);
949          }
950          return this;
951        }
952
953        /**
954         * @return {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).)
955         */
956        public CodeableConcept getType() { 
957          if (this.type == null)
958            if (Configuration.errorOnAutoCreate())
959              throw new Error("Attempt to auto-create SpecimenContainerComponent.type");
960            else if (Configuration.doAutoCreate())
961              this.type = new CodeableConcept(); // cc
962          return this.type;
963        }
964
965        public boolean hasType() { 
966          return this.type != null && !this.type.isEmpty();
967        }
968
969        /**
970         * @param value {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).)
971         */
972        public SpecimenContainerComponent setType(CodeableConcept value) { 
973          this.type = value;
974          return this;
975        }
976
977        /**
978         * @return {@link #capacity} (The capacity (volume or other measure) the container may contain.)
979         */
980        public SimpleQuantity getCapacity() { 
981          if (this.capacity == null)
982            if (Configuration.errorOnAutoCreate())
983              throw new Error("Attempt to auto-create SpecimenContainerComponent.capacity");
984            else if (Configuration.doAutoCreate())
985              this.capacity = new SimpleQuantity(); // cc
986          return this.capacity;
987        }
988
989        public boolean hasCapacity() { 
990          return this.capacity != null && !this.capacity.isEmpty();
991        }
992
993        /**
994         * @param value {@link #capacity} (The capacity (volume or other measure) the container may contain.)
995         */
996        public SpecimenContainerComponent setCapacity(SimpleQuantity value) { 
997          this.capacity = value;
998          return this;
999        }
1000
1001        /**
1002         * @return {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
1003         */
1004        public SimpleQuantity getSpecimenQuantity() { 
1005          if (this.specimenQuantity == null)
1006            if (Configuration.errorOnAutoCreate())
1007              throw new Error("Attempt to auto-create SpecimenContainerComponent.specimenQuantity");
1008            else if (Configuration.doAutoCreate())
1009              this.specimenQuantity = new SimpleQuantity(); // cc
1010          return this.specimenQuantity;
1011        }
1012
1013        public boolean hasSpecimenQuantity() { 
1014          return this.specimenQuantity != null && !this.specimenQuantity.isEmpty();
1015        }
1016
1017        /**
1018         * @param value {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
1019         */
1020        public SpecimenContainerComponent setSpecimenQuantity(SimpleQuantity value) { 
1021          this.specimenQuantity = value;
1022          return this;
1023        }
1024
1025        /**
1026         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1027         */
1028        public Type getAdditive() { 
1029          return this.additive;
1030        }
1031
1032        /**
1033         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1034         */
1035        public CodeableConcept getAdditiveCodeableConcept() throws FHIRException { 
1036          if (!(this.additive instanceof CodeableConcept))
1037            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.additive.getClass().getName()+" was encountered");
1038          return (CodeableConcept) this.additive;
1039        }
1040
1041        public boolean hasAdditiveCodeableConcept() { 
1042          return this.additive instanceof CodeableConcept;
1043        }
1044
1045        /**
1046         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1047         */
1048        public Reference getAdditiveReference() throws FHIRException { 
1049          if (!(this.additive instanceof Reference))
1050            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.additive.getClass().getName()+" was encountered");
1051          return (Reference) this.additive;
1052        }
1053
1054        public boolean hasAdditiveReference() { 
1055          return this.additive instanceof Reference;
1056        }
1057
1058        public boolean hasAdditive() { 
1059          return this.additive != null && !this.additive.isEmpty();
1060        }
1061
1062        /**
1063         * @param value {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1064         */
1065        public SpecimenContainerComponent setAdditive(Type value) { 
1066          this.additive = value;
1067          return this;
1068        }
1069
1070        protected void listChildren(List<Property> childrenList) {
1071          super.listChildren(childrenList);
1072          childrenList.add(new Property("identifier", "Identifier", "Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.", 0, java.lang.Integer.MAX_VALUE, identifier));
1073          childrenList.add(new Property("description", "string", "Textual description of the container.", 0, java.lang.Integer.MAX_VALUE, description));
1074          childrenList.add(new Property("type", "CodeableConcept", "The type of container associated with the specimen (e.g. slide, aliquot, etc.).", 0, java.lang.Integer.MAX_VALUE, type));
1075          childrenList.add(new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) the container may contain.", 0, java.lang.Integer.MAX_VALUE, capacity));
1076          childrenList.add(new Property("specimenQuantity", "SimpleQuantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, java.lang.Integer.MAX_VALUE, specimenQuantity));
1077          childrenList.add(new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, java.lang.Integer.MAX_VALUE, additive));
1078        }
1079
1080      @Override
1081      public void setProperty(String name, Base value) throws FHIRException {
1082        if (name.equals("identifier"))
1083          this.getIdentifier().add(castToIdentifier(value));
1084        else if (name.equals("description"))
1085          this.description = castToString(value); // StringType
1086        else if (name.equals("type"))
1087          this.type = castToCodeableConcept(value); // CodeableConcept
1088        else if (name.equals("capacity"))
1089          this.capacity = castToSimpleQuantity(value); // SimpleQuantity
1090        else if (name.equals("specimenQuantity"))
1091          this.specimenQuantity = castToSimpleQuantity(value); // SimpleQuantity
1092        else if (name.equals("additive[x]"))
1093          this.additive = (Type) value; // Type
1094        else
1095          super.setProperty(name, value);
1096      }
1097
1098      @Override
1099      public Base addChild(String name) throws FHIRException {
1100        if (name.equals("identifier")) {
1101          return addIdentifier();
1102        }
1103        else if (name.equals("description")) {
1104          throw new FHIRException("Cannot call addChild on a primitive type Specimen.description");
1105        }
1106        else if (name.equals("type")) {
1107          this.type = new CodeableConcept();
1108          return this.type;
1109        }
1110        else if (name.equals("capacity")) {
1111          this.capacity = new SimpleQuantity();
1112          return this.capacity;
1113        }
1114        else if (name.equals("specimenQuantity")) {
1115          this.specimenQuantity = new SimpleQuantity();
1116          return this.specimenQuantity;
1117        }
1118        else if (name.equals("additiveCodeableConcept")) {
1119          this.additive = new CodeableConcept();
1120          return this.additive;
1121        }
1122        else if (name.equals("additiveReference")) {
1123          this.additive = new Reference();
1124          return this.additive;
1125        }
1126        else
1127          return super.addChild(name);
1128      }
1129
1130      public SpecimenContainerComponent copy() {
1131        SpecimenContainerComponent dst = new SpecimenContainerComponent();
1132        copyValues(dst);
1133        if (identifier != null) {
1134          dst.identifier = new ArrayList<Identifier>();
1135          for (Identifier i : identifier)
1136            dst.identifier.add(i.copy());
1137        };
1138        dst.description = description == null ? null : description.copy();
1139        dst.type = type == null ? null : type.copy();
1140        dst.capacity = capacity == null ? null : capacity.copy();
1141        dst.specimenQuantity = specimenQuantity == null ? null : specimenQuantity.copy();
1142        dst.additive = additive == null ? null : additive.copy();
1143        return dst;
1144      }
1145
1146      @Override
1147      public boolean equalsDeep(Base other) {
1148        if (!super.equalsDeep(other))
1149          return false;
1150        if (!(other instanceof SpecimenContainerComponent))
1151          return false;
1152        SpecimenContainerComponent o = (SpecimenContainerComponent) other;
1153        return compareDeep(identifier, o.identifier, true) && compareDeep(description, o.description, true)
1154           && compareDeep(type, o.type, true) && compareDeep(capacity, o.capacity, true) && compareDeep(specimenQuantity, o.specimenQuantity, true)
1155           && compareDeep(additive, o.additive, true);
1156      }
1157
1158      @Override
1159      public boolean equalsShallow(Base other) {
1160        if (!super.equalsShallow(other))
1161          return false;
1162        if (!(other instanceof SpecimenContainerComponent))
1163          return false;
1164        SpecimenContainerComponent o = (SpecimenContainerComponent) other;
1165        return compareValues(description, o.description, true);
1166      }
1167
1168      public boolean isEmpty() {
1169        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (description == null || description.isEmpty())
1170           && (type == null || type.isEmpty()) && (capacity == null || capacity.isEmpty()) && (specimenQuantity == null || specimenQuantity.isEmpty())
1171           && (additive == null || additive.isEmpty());
1172      }
1173
1174  public String fhirType() {
1175    return "Specimen.container";
1176
1177  }
1178
1179  }
1180
1181    /**
1182     * Id for specimen.
1183     */
1184    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1185    @Description(shortDefinition="External Identifier", formalDefinition="Id for specimen." )
1186    protected List<Identifier> identifier;
1187
1188    /**
1189     * The availability of the specimen.
1190     */
1191    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1192    @Description(shortDefinition="available | unavailable | unsatisfactory | entered-in-error", formalDefinition="The availability of the specimen." )
1193    protected Enumeration<SpecimenStatus> status;
1194
1195    /**
1196     * The kind of material that forms the specimen.
1197     */
1198    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1199    @Description(shortDefinition="Kind of material that forms the specimen", formalDefinition="The kind of material that forms the specimen." )
1200    protected CodeableConcept type;
1201
1202    /**
1203     * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
1204     */
1205    @Child(name = "parent", type = {Specimen.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1206    @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." )
1207    protected List<Reference> parent;
1208    /**
1209     * The actual objects that are the target of the reference (Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1210     */
1211    protected List<Specimen> parentTarget;
1212
1213
1214    /**
1215     * Where the specimen came from. This may be from the patient(s) or from the environment or a device.
1216     */
1217    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=4, min=1, max=1, modifier=false, summary=true)
1218    @Description(shortDefinition="Where the specimen came from. This may be from the patient(s) or from the environment or a device", formalDefinition="Where the specimen came from. This may be from the patient(s) or from the environment or a device." )
1219    protected Reference subject;
1220
1221    /**
1222     * The actual object that is the target of the reference (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1223     */
1224    protected Resource subjectTarget;
1225
1226    /**
1227     * 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.
1228     */
1229    @Child(name = "accessionIdentifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
1230    @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." )
1231    protected Identifier accessionIdentifier;
1232
1233    /**
1234     * Time when specimen was received for processing or testing.
1235     */
1236    @Child(name = "receivedTime", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1237    @Description(shortDefinition="The time when specimen was received for processing", formalDefinition="Time when specimen was received for processing or testing." )
1238    protected DateTimeType receivedTime;
1239
1240    /**
1241     * Details concerning the specimen collection.
1242     */
1243    @Child(name = "collection", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
1244    @Description(shortDefinition="Collection details", formalDefinition="Details concerning the specimen collection." )
1245    protected SpecimenCollectionComponent collection;
1246
1247    /**
1248     * Details concerning treatment and processing steps for the specimen.
1249     */
1250    @Child(name = "treatment", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1251    @Description(shortDefinition="Treatment and processing step details", formalDefinition="Details concerning treatment and processing steps for the specimen." )
1252    protected List<SpecimenTreatmentComponent> treatment;
1253
1254    /**
1255     * The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
1256     */
1257    @Child(name = "container", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1258    @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." )
1259    protected List<SpecimenContainerComponent> container;
1260
1261    private static final long serialVersionUID = 1025605602L;
1262
1263  /*
1264   * Constructor
1265   */
1266    public Specimen() {
1267      super();
1268    }
1269
1270  /*
1271   * Constructor
1272   */
1273    public Specimen(Reference subject) {
1274      super();
1275      this.subject = subject;
1276    }
1277
1278    /**
1279     * @return {@link #identifier} (Id for specimen.)
1280     */
1281    public List<Identifier> getIdentifier() { 
1282      if (this.identifier == null)
1283        this.identifier = new ArrayList<Identifier>();
1284      return this.identifier;
1285    }
1286
1287    public boolean hasIdentifier() { 
1288      if (this.identifier == null)
1289        return false;
1290      for (Identifier item : this.identifier)
1291        if (!item.isEmpty())
1292          return true;
1293      return false;
1294    }
1295
1296    /**
1297     * @return {@link #identifier} (Id for specimen.)
1298     */
1299    // syntactic sugar
1300    public Identifier addIdentifier() { //3
1301      Identifier t = new Identifier();
1302      if (this.identifier == null)
1303        this.identifier = new ArrayList<Identifier>();
1304      this.identifier.add(t);
1305      return t;
1306    }
1307
1308    // syntactic sugar
1309    public Specimen addIdentifier(Identifier t) { //3
1310      if (t == null)
1311        return this;
1312      if (this.identifier == null)
1313        this.identifier = new ArrayList<Identifier>();
1314      this.identifier.add(t);
1315      return this;
1316    }
1317
1318    /**
1319     * @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
1320     */
1321    public Enumeration<SpecimenStatus> getStatusElement() { 
1322      if (this.status == null)
1323        if (Configuration.errorOnAutoCreate())
1324          throw new Error("Attempt to auto-create Specimen.status");
1325        else if (Configuration.doAutoCreate())
1326          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory()); // bb
1327      return this.status;
1328    }
1329
1330    public boolean hasStatusElement() { 
1331      return this.status != null && !this.status.isEmpty();
1332    }
1333
1334    public boolean hasStatus() { 
1335      return this.status != null && !this.status.isEmpty();
1336    }
1337
1338    /**
1339     * @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
1340     */
1341    public Specimen setStatusElement(Enumeration<SpecimenStatus> value) { 
1342      this.status = value;
1343      return this;
1344    }
1345
1346    /**
1347     * @return The availability of the specimen.
1348     */
1349    public SpecimenStatus getStatus() { 
1350      return this.status == null ? null : this.status.getValue();
1351    }
1352
1353    /**
1354     * @param value The availability of the specimen.
1355     */
1356    public Specimen setStatus(SpecimenStatus value) { 
1357      if (value == null)
1358        this.status = null;
1359      else {
1360        if (this.status == null)
1361          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory());
1362        this.status.setValue(value);
1363      }
1364      return this;
1365    }
1366
1367    /**
1368     * @return {@link #type} (The kind of material that forms the specimen.)
1369     */
1370    public CodeableConcept getType() { 
1371      if (this.type == null)
1372        if (Configuration.errorOnAutoCreate())
1373          throw new Error("Attempt to auto-create Specimen.type");
1374        else if (Configuration.doAutoCreate())
1375          this.type = new CodeableConcept(); // cc
1376      return this.type;
1377    }
1378
1379    public boolean hasType() { 
1380      return this.type != null && !this.type.isEmpty();
1381    }
1382
1383    /**
1384     * @param value {@link #type} (The kind of material that forms the specimen.)
1385     */
1386    public Specimen setType(CodeableConcept value) { 
1387      this.type = value;
1388      return this;
1389    }
1390
1391    /**
1392     * @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.)
1393     */
1394    public List<Reference> getParent() { 
1395      if (this.parent == null)
1396        this.parent = new ArrayList<Reference>();
1397      return this.parent;
1398    }
1399
1400    public boolean hasParent() { 
1401      if (this.parent == null)
1402        return false;
1403      for (Reference item : this.parent)
1404        if (!item.isEmpty())
1405          return true;
1406      return false;
1407    }
1408
1409    /**
1410     * @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.)
1411     */
1412    // syntactic sugar
1413    public Reference addParent() { //3
1414      Reference t = new Reference();
1415      if (this.parent == null)
1416        this.parent = new ArrayList<Reference>();
1417      this.parent.add(t);
1418      return t;
1419    }
1420
1421    // syntactic sugar
1422    public Specimen addParent(Reference t) { //3
1423      if (t == null)
1424        return this;
1425      if (this.parent == null)
1426        this.parent = new ArrayList<Reference>();
1427      this.parent.add(t);
1428      return this;
1429    }
1430
1431    /**
1432     * @return {@link #parent} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1433     */
1434    public List<Specimen> getParentTarget() { 
1435      if (this.parentTarget == null)
1436        this.parentTarget = new ArrayList<Specimen>();
1437      return this.parentTarget;
1438    }
1439
1440    // syntactic sugar
1441    /**
1442     * @return {@link #parent} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1443     */
1444    public Specimen addParentTarget() { 
1445      Specimen r = new Specimen();
1446      if (this.parentTarget == null)
1447        this.parentTarget = new ArrayList<Specimen>();
1448      this.parentTarget.add(r);
1449      return r;
1450    }
1451
1452    /**
1453     * @return {@link #subject} (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1454     */
1455    public Reference getSubject() { 
1456      if (this.subject == null)
1457        if (Configuration.errorOnAutoCreate())
1458          throw new Error("Attempt to auto-create Specimen.subject");
1459        else if (Configuration.doAutoCreate())
1460          this.subject = new Reference(); // cc
1461      return this.subject;
1462    }
1463
1464    public boolean hasSubject() { 
1465      return this.subject != null && !this.subject.isEmpty();
1466    }
1467
1468    /**
1469     * @param value {@link #subject} (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1470     */
1471    public Specimen setSubject(Reference value) { 
1472      this.subject = value;
1473      return this;
1474    }
1475
1476    /**
1477     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1478     */
1479    public Resource getSubjectTarget() { 
1480      return this.subjectTarget;
1481    }
1482
1483    /**
1484     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1485     */
1486    public Specimen setSubjectTarget(Resource value) { 
1487      this.subjectTarget = value;
1488      return this;
1489    }
1490
1491    /**
1492     * @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.)
1493     */
1494    public Identifier getAccessionIdentifier() { 
1495      if (this.accessionIdentifier == null)
1496        if (Configuration.errorOnAutoCreate())
1497          throw new Error("Attempt to auto-create Specimen.accessionIdentifier");
1498        else if (Configuration.doAutoCreate())
1499          this.accessionIdentifier = new Identifier(); // cc
1500      return this.accessionIdentifier;
1501    }
1502
1503    public boolean hasAccessionIdentifier() { 
1504      return this.accessionIdentifier != null && !this.accessionIdentifier.isEmpty();
1505    }
1506
1507    /**
1508     * @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.)
1509     */
1510    public Specimen setAccessionIdentifier(Identifier value) { 
1511      this.accessionIdentifier = value;
1512      return this;
1513    }
1514
1515    /**
1516     * @return {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
1517     */
1518    public DateTimeType getReceivedTimeElement() { 
1519      if (this.receivedTime == null)
1520        if (Configuration.errorOnAutoCreate())
1521          throw new Error("Attempt to auto-create Specimen.receivedTime");
1522        else if (Configuration.doAutoCreate())
1523          this.receivedTime = new DateTimeType(); // bb
1524      return this.receivedTime;
1525    }
1526
1527    public boolean hasReceivedTimeElement() { 
1528      return this.receivedTime != null && !this.receivedTime.isEmpty();
1529    }
1530
1531    public boolean hasReceivedTime() { 
1532      return this.receivedTime != null && !this.receivedTime.isEmpty();
1533    }
1534
1535    /**
1536     * @param value {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
1537     */
1538    public Specimen setReceivedTimeElement(DateTimeType value) { 
1539      this.receivedTime = value;
1540      return this;
1541    }
1542
1543    /**
1544     * @return Time when specimen was received for processing or testing.
1545     */
1546    public Date getReceivedTime() { 
1547      return this.receivedTime == null ? null : this.receivedTime.getValue();
1548    }
1549
1550    /**
1551     * @param value Time when specimen was received for processing or testing.
1552     */
1553    public Specimen setReceivedTime(Date value) { 
1554      if (value == null)
1555        this.receivedTime = null;
1556      else {
1557        if (this.receivedTime == null)
1558          this.receivedTime = new DateTimeType();
1559        this.receivedTime.setValue(value);
1560      }
1561      return this;
1562    }
1563
1564    /**
1565     * @return {@link #collection} (Details concerning the specimen collection.)
1566     */
1567    public SpecimenCollectionComponent getCollection() { 
1568      if (this.collection == null)
1569        if (Configuration.errorOnAutoCreate())
1570          throw new Error("Attempt to auto-create Specimen.collection");
1571        else if (Configuration.doAutoCreate())
1572          this.collection = new SpecimenCollectionComponent(); // cc
1573      return this.collection;
1574    }
1575
1576    public boolean hasCollection() { 
1577      return this.collection != null && !this.collection.isEmpty();
1578    }
1579
1580    /**
1581     * @param value {@link #collection} (Details concerning the specimen collection.)
1582     */
1583    public Specimen setCollection(SpecimenCollectionComponent value) { 
1584      this.collection = value;
1585      return this;
1586    }
1587
1588    /**
1589     * @return {@link #treatment} (Details concerning treatment and processing steps for the specimen.)
1590     */
1591    public List<SpecimenTreatmentComponent> getTreatment() { 
1592      if (this.treatment == null)
1593        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1594      return this.treatment;
1595    }
1596
1597    public boolean hasTreatment() { 
1598      if (this.treatment == null)
1599        return false;
1600      for (SpecimenTreatmentComponent item : this.treatment)
1601        if (!item.isEmpty())
1602          return true;
1603      return false;
1604    }
1605
1606    /**
1607     * @return {@link #treatment} (Details concerning treatment and processing steps for the specimen.)
1608     */
1609    // syntactic sugar
1610    public SpecimenTreatmentComponent addTreatment() { //3
1611      SpecimenTreatmentComponent t = new SpecimenTreatmentComponent();
1612      if (this.treatment == null)
1613        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1614      this.treatment.add(t);
1615      return t;
1616    }
1617
1618    // syntactic sugar
1619    public Specimen addTreatment(SpecimenTreatmentComponent t) { //3
1620      if (t == null)
1621        return this;
1622      if (this.treatment == null)
1623        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1624      this.treatment.add(t);
1625      return this;
1626    }
1627
1628    /**
1629     * @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.)
1630     */
1631    public List<SpecimenContainerComponent> getContainer() { 
1632      if (this.container == null)
1633        this.container = new ArrayList<SpecimenContainerComponent>();
1634      return this.container;
1635    }
1636
1637    public boolean hasContainer() { 
1638      if (this.container == null)
1639        return false;
1640      for (SpecimenContainerComponent item : this.container)
1641        if (!item.isEmpty())
1642          return true;
1643      return false;
1644    }
1645
1646    /**
1647     * @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.)
1648     */
1649    // syntactic sugar
1650    public SpecimenContainerComponent addContainer() { //3
1651      SpecimenContainerComponent t = new SpecimenContainerComponent();
1652      if (this.container == null)
1653        this.container = new ArrayList<SpecimenContainerComponent>();
1654      this.container.add(t);
1655      return t;
1656    }
1657
1658    // syntactic sugar
1659    public Specimen addContainer(SpecimenContainerComponent t) { //3
1660      if (t == null)
1661        return this;
1662      if (this.container == null)
1663        this.container = new ArrayList<SpecimenContainerComponent>();
1664      this.container.add(t);
1665      return this;
1666    }
1667
1668      protected void listChildren(List<Property> childrenList) {
1669        super.listChildren(childrenList);
1670        childrenList.add(new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier));
1671        childrenList.add(new Property("status", "code", "The availability of the specimen.", 0, java.lang.Integer.MAX_VALUE, status));
1672        childrenList.add(new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, java.lang.Integer.MAX_VALUE, type));
1673        childrenList.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));
1674        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Where the specimen came from. This may be from the patient(s) or from the environment or a device.", 0, java.lang.Integer.MAX_VALUE, subject));
1675        childrenList.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, java.lang.Integer.MAX_VALUE, accessionIdentifier));
1676        childrenList.add(new Property("receivedTime", "dateTime", "Time when specimen was received for processing or testing.", 0, java.lang.Integer.MAX_VALUE, receivedTime));
1677        childrenList.add(new Property("collection", "", "Details concerning the specimen collection.", 0, java.lang.Integer.MAX_VALUE, collection));
1678        childrenList.add(new Property("treatment", "", "Details concerning treatment and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, treatment));
1679        childrenList.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));
1680      }
1681
1682      @Override
1683      public void setProperty(String name, Base value) throws FHIRException {
1684        if (name.equals("identifier"))
1685          this.getIdentifier().add(castToIdentifier(value));
1686        else if (name.equals("status"))
1687          this.status = new SpecimenStatusEnumFactory().fromType(value); // Enumeration<SpecimenStatus>
1688        else if (name.equals("type"))
1689          this.type = castToCodeableConcept(value); // CodeableConcept
1690        else if (name.equals("parent"))
1691          this.getParent().add(castToReference(value));
1692        else if (name.equals("subject"))
1693          this.subject = castToReference(value); // Reference
1694        else if (name.equals("accessionIdentifier"))
1695          this.accessionIdentifier = castToIdentifier(value); // Identifier
1696        else if (name.equals("receivedTime"))
1697          this.receivedTime = castToDateTime(value); // DateTimeType
1698        else if (name.equals("collection"))
1699          this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent
1700        else if (name.equals("treatment"))
1701          this.getTreatment().add((SpecimenTreatmentComponent) value);
1702        else if (name.equals("container"))
1703          this.getContainer().add((SpecimenContainerComponent) value);
1704        else
1705          super.setProperty(name, value);
1706      }
1707
1708      @Override
1709      public Base addChild(String name) throws FHIRException {
1710        if (name.equals("identifier")) {
1711          return addIdentifier();
1712        }
1713        else if (name.equals("status")) {
1714          throw new FHIRException("Cannot call addChild on a primitive type Specimen.status");
1715        }
1716        else if (name.equals("type")) {
1717          this.type = new CodeableConcept();
1718          return this.type;
1719        }
1720        else if (name.equals("parent")) {
1721          return addParent();
1722        }
1723        else if (name.equals("subject")) {
1724          this.subject = new Reference();
1725          return this.subject;
1726        }
1727        else if (name.equals("accessionIdentifier")) {
1728          this.accessionIdentifier = new Identifier();
1729          return this.accessionIdentifier;
1730        }
1731        else if (name.equals("receivedTime")) {
1732          throw new FHIRException("Cannot call addChild on a primitive type Specimen.receivedTime");
1733        }
1734        else if (name.equals("collection")) {
1735          this.collection = new SpecimenCollectionComponent();
1736          return this.collection;
1737        }
1738        else if (name.equals("treatment")) {
1739          return addTreatment();
1740        }
1741        else if (name.equals("container")) {
1742          return addContainer();
1743        }
1744        else
1745          return super.addChild(name);
1746      }
1747
1748  public String fhirType() {
1749    return "Specimen";
1750
1751  }
1752
1753      public Specimen copy() {
1754        Specimen dst = new Specimen();
1755        copyValues(dst);
1756        if (identifier != null) {
1757          dst.identifier = new ArrayList<Identifier>();
1758          for (Identifier i : identifier)
1759            dst.identifier.add(i.copy());
1760        };
1761        dst.status = status == null ? null : status.copy();
1762        dst.type = type == null ? null : type.copy();
1763        if (parent != null) {
1764          dst.parent = new ArrayList<Reference>();
1765          for (Reference i : parent)
1766            dst.parent.add(i.copy());
1767        };
1768        dst.subject = subject == null ? null : subject.copy();
1769        dst.accessionIdentifier = accessionIdentifier == null ? null : accessionIdentifier.copy();
1770        dst.receivedTime = receivedTime == null ? null : receivedTime.copy();
1771        dst.collection = collection == null ? null : collection.copy();
1772        if (treatment != null) {
1773          dst.treatment = new ArrayList<SpecimenTreatmentComponent>();
1774          for (SpecimenTreatmentComponent i : treatment)
1775            dst.treatment.add(i.copy());
1776        };
1777        if (container != null) {
1778          dst.container = new ArrayList<SpecimenContainerComponent>();
1779          for (SpecimenContainerComponent i : container)
1780            dst.container.add(i.copy());
1781        };
1782        return dst;
1783      }
1784
1785      protected Specimen typedCopy() {
1786        return copy();
1787      }
1788
1789      @Override
1790      public boolean equalsDeep(Base other) {
1791        if (!super.equalsDeep(other))
1792          return false;
1793        if (!(other instanceof Specimen))
1794          return false;
1795        Specimen o = (Specimen) other;
1796        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
1797           && compareDeep(parent, o.parent, true) && compareDeep(subject, o.subject, true) && compareDeep(accessionIdentifier, o.accessionIdentifier, true)
1798           && compareDeep(receivedTime, o.receivedTime, true) && compareDeep(collection, o.collection, true)
1799           && compareDeep(treatment, o.treatment, true) && compareDeep(container, o.container, true);
1800      }
1801
1802      @Override
1803      public boolean equalsShallow(Base other) {
1804        if (!super.equalsShallow(other))
1805          return false;
1806        if (!(other instanceof Specimen))
1807          return false;
1808        Specimen o = (Specimen) other;
1809        return compareValues(status, o.status, true) && compareValues(receivedTime, o.receivedTime, true);
1810      }
1811
1812      public boolean isEmpty() {
1813        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1814           && (type == null || type.isEmpty()) && (parent == null || parent.isEmpty()) && (subject == null || subject.isEmpty())
1815           && (accessionIdentifier == null || accessionIdentifier.isEmpty()) && (receivedTime == null || receivedTime.isEmpty())
1816           && (collection == null || collection.isEmpty()) && (treatment == null || treatment.isEmpty())
1817           && (container == null || container.isEmpty());
1818      }
1819
1820  @Override
1821  public ResourceType getResourceType() {
1822    return ResourceType.Specimen;
1823   }
1824
1825  @SearchParamDefinition(name="container", path="Specimen.container.type", description="The kind of specimen container", type="token" )
1826  public static final String SP_CONTAINER = "container";
1827  @SearchParamDefinition(name="identifier", path="Specimen.identifier", description="The unique identifier associated with the specimen", type="token" )
1828  public static final String SP_IDENTIFIER = "identifier";
1829  @SearchParamDefinition(name="parent", path="Specimen.parent", description="The parent of the specimen", type="reference" )
1830  public static final String SP_PARENT = "parent";
1831  @SearchParamDefinition(name="container-id", path="Specimen.container.identifier", description="The unique identifier associated with the specimen container", type="token" )
1832  public static final String SP_CONTAINERID = "container-id";
1833  @SearchParamDefinition(name="bodysite", path="Specimen.collection.bodySite", description="The code for the body site from where the specimen originated", type="token" )
1834  public static final String SP_BODYSITE = "bodysite";
1835  @SearchParamDefinition(name="subject", path="Specimen.subject", description="The subject of the specimen", type="reference" )
1836  public static final String SP_SUBJECT = "subject";
1837  @SearchParamDefinition(name="patient", path="Specimen.subject", description="The patient the specimen comes from", type="reference" )
1838  public static final String SP_PATIENT = "patient";
1839  @SearchParamDefinition(name="collected", path="Specimen.collection.collected[x]", description="The date the specimen was collected", type="date" )
1840  public static final String SP_COLLECTED = "collected";
1841  @SearchParamDefinition(name="accession", path="Specimen.accessionIdentifier", description="The accession number associated with the specimen", type="token" )
1842  public static final String SP_ACCESSION = "accession";
1843  @SearchParamDefinition(name="type", path="Specimen.type", description="The specimen type", type="token" )
1844  public static final String SP_TYPE = "type";
1845  @SearchParamDefinition(name="collector", path="Specimen.collection.collector", description="Who collected the specimen", type="reference" )
1846  public static final String SP_COLLECTOR = "collector";
1847
1848}