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