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