001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A record of a clinical assessment performed to determine what problem(s) may affect the patient and before planning the treatments or management strategies that are best to manage a patient's condition. Assessments are often 1:1 with a clinical consultation / encounter,  but this varies greatly depending on the clinical workflow. This resource is called "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion with the recording of assessment tools such as Apgar score.
050 */
051@ResourceDef(name="ClinicalImpression", profile="http://hl7.org/fhir/StructureDefinition/ClinicalImpression")
052public class ClinicalImpression extends DomainResource {
053
054    public enum ClinicalImpressionStatus {
055        /**
056         * null
057         */
058        INPROGRESS, 
059        /**
060         * null
061         */
062        COMPLETED, 
063        /**
064         * null
065         */
066        ENTEREDINERROR, 
067        /**
068         * added to help the parsers with the generic types
069         */
070        NULL;
071        public static ClinicalImpressionStatus fromCode(String codeString) throws FHIRException {
072            if (codeString == null || "".equals(codeString))
073                return null;
074        if ("in-progress".equals(codeString))
075          return INPROGRESS;
076        if ("completed".equals(codeString))
077          return COMPLETED;
078        if ("entered-in-error".equals(codeString))
079          return ENTEREDINERROR;
080        if (Configuration.isAcceptInvalidEnums())
081          return null;
082        else
083          throw new FHIRException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
084        }
085        public String toCode() {
086          switch (this) {
087            case INPROGRESS: return "in-progress";
088            case COMPLETED: return "completed";
089            case ENTEREDINERROR: return "entered-in-error";
090            default: return "?";
091          }
092        }
093        public String getSystem() {
094          switch (this) {
095            case INPROGRESS: return "http://hl7.org/fhir/event-status";
096            case COMPLETED: return "http://hl7.org/fhir/event-status";
097            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
098            default: return "?";
099          }
100        }
101        public String getDefinition() {
102          switch (this) {
103            case INPROGRESS: return "";
104            case COMPLETED: return "";
105            case ENTEREDINERROR: return "";
106            default: return "?";
107          }
108        }
109        public String getDisplay() {
110          switch (this) {
111            case INPROGRESS: return "in-progress";
112            case COMPLETED: return "completed";
113            case ENTEREDINERROR: return "entered-in-error";
114            default: return "?";
115          }
116        }
117    }
118
119  public static class ClinicalImpressionStatusEnumFactory implements EnumFactory<ClinicalImpressionStatus> {
120    public ClinicalImpressionStatus fromCode(String codeString) throws IllegalArgumentException {
121      if (codeString == null || "".equals(codeString))
122            if (codeString == null || "".equals(codeString))
123                return null;
124        if ("in-progress".equals(codeString))
125          return ClinicalImpressionStatus.INPROGRESS;
126        if ("completed".equals(codeString))
127          return ClinicalImpressionStatus.COMPLETED;
128        if ("entered-in-error".equals(codeString))
129          return ClinicalImpressionStatus.ENTEREDINERROR;
130        throw new IllegalArgumentException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
131        }
132        public Enumeration<ClinicalImpressionStatus> fromType(Base code) throws FHIRException {
133          if (code == null)
134            return null;
135          if (code.isEmpty())
136            return new Enumeration<ClinicalImpressionStatus>(this);
137          String codeString = ((PrimitiveType) code).asStringValue();
138          if (codeString == null || "".equals(codeString))
139            return null;
140        if ("in-progress".equals(codeString))
141          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.INPROGRESS);
142        if ("completed".equals(codeString))
143          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.COMPLETED);
144        if ("entered-in-error".equals(codeString))
145          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.ENTEREDINERROR);
146        throw new FHIRException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
147        }
148    public String toCode(ClinicalImpressionStatus code) {
149      if (code == ClinicalImpressionStatus.INPROGRESS)
150        return "in-progress";
151      if (code == ClinicalImpressionStatus.COMPLETED)
152        return "completed";
153      if (code == ClinicalImpressionStatus.ENTEREDINERROR)
154        return "entered-in-error";
155      return "?";
156      }
157    public String toSystem(ClinicalImpressionStatus code) {
158      return code.getSystem();
159      }
160    }
161
162    @Block()
163    public static class ClinicalImpressionInvestigationComponent extends BackboneElement implements IBaseBackboneElement {
164        /**
165         * A name/code for the group ("set") of investigations. Typically, this will be something like "signs", "symptoms", "clinical", "diagnostic", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used.
166         */
167        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
168        @Description(shortDefinition="A name/code for the set", formalDefinition="A name/code for the group (\"set\") of investigations. Typically, this will be something like \"signs\", \"symptoms\", \"clinical\", \"diagnostic\", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used." )
169        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/investigation-sets")
170        protected CodeableConcept code;
171
172        /**
173         * A record of a specific investigation that was undertaken.
174         */
175        @Child(name = "item", type = {Observation.class, QuestionnaireResponse.class, FamilyMemberHistory.class, DiagnosticReport.class, RiskAssessment.class, ImagingStudy.class, Media.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
176        @Description(shortDefinition="Record of a specific investigation", formalDefinition="A record of a specific investigation that was undertaken." )
177        protected List<Reference> item;
178        /**
179         * The actual objects that are the target of the reference (A record of a specific investigation that was undertaken.)
180         */
181        protected List<Resource> itemTarget;
182
183
184        private static final long serialVersionUID = -301363326L;
185
186    /**
187     * Constructor
188     */
189      public ClinicalImpressionInvestigationComponent() {
190        super();
191      }
192
193    /**
194     * Constructor
195     */
196      public ClinicalImpressionInvestigationComponent(CodeableConcept code) {
197        super();
198        this.code = code;
199      }
200
201        /**
202         * @return {@link #code} (A name/code for the group ("set") of investigations. Typically, this will be something like "signs", "symptoms", "clinical", "diagnostic", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used.)
203         */
204        public CodeableConcept getCode() { 
205          if (this.code == null)
206            if (Configuration.errorOnAutoCreate())
207              throw new Error("Attempt to auto-create ClinicalImpressionInvestigationComponent.code");
208            else if (Configuration.doAutoCreate())
209              this.code = new CodeableConcept(); // cc
210          return this.code;
211        }
212
213        public boolean hasCode() { 
214          return this.code != null && !this.code.isEmpty();
215        }
216
217        /**
218         * @param value {@link #code} (A name/code for the group ("set") of investigations. Typically, this will be something like "signs", "symptoms", "clinical", "diagnostic", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used.)
219         */
220        public ClinicalImpressionInvestigationComponent setCode(CodeableConcept value) { 
221          this.code = value;
222          return this;
223        }
224
225        /**
226         * @return {@link #item} (A record of a specific investigation that was undertaken.)
227         */
228        public List<Reference> getItem() { 
229          if (this.item == null)
230            this.item = new ArrayList<Reference>();
231          return this.item;
232        }
233
234        /**
235         * @return Returns a reference to <code>this</code> for easy method chaining
236         */
237        public ClinicalImpressionInvestigationComponent setItem(List<Reference> theItem) { 
238          this.item = theItem;
239          return this;
240        }
241
242        public boolean hasItem() { 
243          if (this.item == null)
244            return false;
245          for (Reference item : this.item)
246            if (!item.isEmpty())
247              return true;
248          return false;
249        }
250
251        public Reference addItem() { //3
252          Reference t = new Reference();
253          if (this.item == null)
254            this.item = new ArrayList<Reference>();
255          this.item.add(t);
256          return t;
257        }
258
259        public ClinicalImpressionInvestigationComponent addItem(Reference t) { //3
260          if (t == null)
261            return this;
262          if (this.item == null)
263            this.item = new ArrayList<Reference>();
264          this.item.add(t);
265          return this;
266        }
267
268        /**
269         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
270         */
271        public Reference getItemFirstRep() { 
272          if (getItem().isEmpty()) {
273            addItem();
274          }
275          return getItem().get(0);
276        }
277
278        /**
279         * @deprecated Use Reference#setResource(IBaseResource) instead
280         */
281        @Deprecated
282        public List<Resource> getItemTarget() { 
283          if (this.itemTarget == null)
284            this.itemTarget = new ArrayList<Resource>();
285          return this.itemTarget;
286        }
287
288        protected void listChildren(List<Property> children) {
289          super.listChildren(children);
290          children.add(new Property("code", "CodeableConcept", "A name/code for the group (\"set\") of investigations. Typically, this will be something like \"signs\", \"symptoms\", \"clinical\", \"diagnostic\", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used.", 0, 1, code));
291          children.add(new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy|Media)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
292        }
293
294        @Override
295        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
296          switch (_hash) {
297          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A name/code for the group (\"set\") of investigations. Typically, this will be something like \"signs\", \"symptoms\", \"clinical\", \"diagnostic\", but the list is not constrained, and others such groups such as (exposure|family|travel|nutritional) history may be used.", 0, 1, code);
298          case 3242771: /*item*/  return new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport|RiskAssessment|ImagingStudy|Media)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item);
299          default: return super.getNamedProperty(_hash, _name, _checkValid);
300          }
301
302        }
303
304      @Override
305      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
306        switch (hash) {
307        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
308        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // Reference
309        default: return super.getProperty(hash, name, checkValid);
310        }
311
312      }
313
314      @Override
315      public Base setProperty(int hash, String name, Base value) throws FHIRException {
316        switch (hash) {
317        case 3059181: // code
318          this.code = castToCodeableConcept(value); // CodeableConcept
319          return value;
320        case 3242771: // item
321          this.getItem().add(castToReference(value)); // Reference
322          return value;
323        default: return super.setProperty(hash, name, value);
324        }
325
326      }
327
328      @Override
329      public Base setProperty(String name, Base value) throws FHIRException {
330        if (name.equals("code")) {
331          this.code = castToCodeableConcept(value); // CodeableConcept
332        } else if (name.equals("item")) {
333          this.getItem().add(castToReference(value));
334        } else
335          return super.setProperty(name, value);
336        return value;
337      }
338
339      @Override
340      public Base makeProperty(int hash, String name) throws FHIRException {
341        switch (hash) {
342        case 3059181:  return getCode(); 
343        case 3242771:  return addItem(); 
344        default: return super.makeProperty(hash, name);
345        }
346
347      }
348
349      @Override
350      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
351        switch (hash) {
352        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
353        case 3242771: /*item*/ return new String[] {"Reference"};
354        default: return super.getTypesForProperty(hash, name);
355        }
356
357      }
358
359      @Override
360      public Base addChild(String name) throws FHIRException {
361        if (name.equals("code")) {
362          this.code = new CodeableConcept();
363          return this.code;
364        }
365        else if (name.equals("item")) {
366          return addItem();
367        }
368        else
369          return super.addChild(name);
370      }
371
372      public ClinicalImpressionInvestigationComponent copy() {
373        ClinicalImpressionInvestigationComponent dst = new ClinicalImpressionInvestigationComponent();
374        copyValues(dst);
375        return dst;
376      }
377
378      public void copyValues(ClinicalImpressionInvestigationComponent dst) {
379        super.copyValues(dst);
380        dst.code = code == null ? null : code.copy();
381        if (item != null) {
382          dst.item = new ArrayList<Reference>();
383          for (Reference i : item)
384            dst.item.add(i.copy());
385        };
386      }
387
388      @Override
389      public boolean equalsDeep(Base other_) {
390        if (!super.equalsDeep(other_))
391          return false;
392        if (!(other_ instanceof ClinicalImpressionInvestigationComponent))
393          return false;
394        ClinicalImpressionInvestigationComponent o = (ClinicalImpressionInvestigationComponent) other_;
395        return compareDeep(code, o.code, true) && compareDeep(item, o.item, true);
396      }
397
398      @Override
399      public boolean equalsShallow(Base other_) {
400        if (!super.equalsShallow(other_))
401          return false;
402        if (!(other_ instanceof ClinicalImpressionInvestigationComponent))
403          return false;
404        ClinicalImpressionInvestigationComponent o = (ClinicalImpressionInvestigationComponent) other_;
405        return true;
406      }
407
408      public boolean isEmpty() {
409        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, item);
410      }
411
412  public String fhirType() {
413    return "ClinicalImpression.investigation";
414
415  }
416
417  }
418
419    @Block()
420    public static class ClinicalImpressionFindingComponent extends BackboneElement implements IBaseBackboneElement {
421        /**
422         * Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.
423         */
424        @Child(name = "itemCodeableConcept", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
425        @Description(shortDefinition="What was found", formalDefinition="Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions." )
426        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
427        protected CodeableConcept itemCodeableConcept;
428
429        /**
430         * Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.
431         */
432        @Child(name = "itemReference", type = {Condition.class, Observation.class, Media.class}, order=2, min=0, max=1, modifier=false, summary=false)
433        @Description(shortDefinition="What was found", formalDefinition="Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions." )
434        protected Reference itemReference;
435
436        /**
437         * The actual object that is the target of the reference (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
438         */
439        protected Resource itemReferenceTarget;
440
441        /**
442         * Which investigations support finding or diagnosis.
443         */
444        @Child(name = "basis", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
445        @Description(shortDefinition="Which investigations support finding", formalDefinition="Which investigations support finding or diagnosis." )
446        protected StringType basis;
447
448        private static final long serialVersionUID = -1578446448L;
449
450    /**
451     * Constructor
452     */
453      public ClinicalImpressionFindingComponent() {
454        super();
455      }
456
457        /**
458         * @return {@link #itemCodeableConcept} (Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.)
459         */
460        public CodeableConcept getItemCodeableConcept() { 
461          if (this.itemCodeableConcept == null)
462            if (Configuration.errorOnAutoCreate())
463              throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.itemCodeableConcept");
464            else if (Configuration.doAutoCreate())
465              this.itemCodeableConcept = new CodeableConcept(); // cc
466          return this.itemCodeableConcept;
467        }
468
469        public boolean hasItemCodeableConcept() { 
470          return this.itemCodeableConcept != null && !this.itemCodeableConcept.isEmpty();
471        }
472
473        /**
474         * @param value {@link #itemCodeableConcept} (Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.)
475         */
476        public ClinicalImpressionFindingComponent setItemCodeableConcept(CodeableConcept value) { 
477          this.itemCodeableConcept = value;
478          return this;
479        }
480
481        /**
482         * @return {@link #itemReference} (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
483         */
484        public Reference getItemReference() { 
485          if (this.itemReference == null)
486            if (Configuration.errorOnAutoCreate())
487              throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.itemReference");
488            else if (Configuration.doAutoCreate())
489              this.itemReference = new Reference(); // cc
490          return this.itemReference;
491        }
492
493        public boolean hasItemReference() { 
494          return this.itemReference != null && !this.itemReference.isEmpty();
495        }
496
497        /**
498         * @param value {@link #itemReference} (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
499         */
500        public ClinicalImpressionFindingComponent setItemReference(Reference value) { 
501          this.itemReference = value;
502          return this;
503        }
504
505        /**
506         * @return {@link #itemReference} 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. (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
507         */
508        public Resource getItemReferenceTarget() { 
509          return this.itemReferenceTarget;
510        }
511
512        /**
513         * @param value {@link #itemReference} 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. (Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.)
514         */
515        public ClinicalImpressionFindingComponent setItemReferenceTarget(Resource value) { 
516          this.itemReferenceTarget = value;
517          return this;
518        }
519
520        /**
521         * @return {@link #basis} (Which investigations support finding or diagnosis.). This is the underlying object with id, value and extensions. The accessor "getBasis" gives direct access to the value
522         */
523        public StringType getBasisElement() { 
524          if (this.basis == null)
525            if (Configuration.errorOnAutoCreate())
526              throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.basis");
527            else if (Configuration.doAutoCreate())
528              this.basis = new StringType(); // bb
529          return this.basis;
530        }
531
532        public boolean hasBasisElement() { 
533          return this.basis != null && !this.basis.isEmpty();
534        }
535
536        public boolean hasBasis() { 
537          return this.basis != null && !this.basis.isEmpty();
538        }
539
540        /**
541         * @param value {@link #basis} (Which investigations support finding or diagnosis.). This is the underlying object with id, value and extensions. The accessor "getBasis" gives direct access to the value
542         */
543        public ClinicalImpressionFindingComponent setBasisElement(StringType value) { 
544          this.basis = value;
545          return this;
546        }
547
548        /**
549         * @return Which investigations support finding or diagnosis.
550         */
551        public String getBasis() { 
552          return this.basis == null ? null : this.basis.getValue();
553        }
554
555        /**
556         * @param value Which investigations support finding or diagnosis.
557         */
558        public ClinicalImpressionFindingComponent setBasis(String value) { 
559          if (Utilities.noString(value))
560            this.basis = null;
561          else {
562            if (this.basis == null)
563              this.basis = new StringType();
564            this.basis.setValue(value);
565          }
566          return this;
567        }
568
569        protected void listChildren(List<Property> children) {
570          super.listChildren(children);
571          children.add(new Property("itemCodeableConcept", "CodeableConcept", "Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemCodeableConcept));
572          children.add(new Property("itemReference", "Reference(Condition|Observation|Media)", "Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemReference));
573          children.add(new Property("basis", "string", "Which investigations support finding or diagnosis.", 0, 1, basis));
574        }
575
576        @Override
577        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
578          switch (_hash) {
579          case 106644494: /*itemCodeableConcept*/  return new Property("itemCodeableConcept", "CodeableConcept", "Specific text or code for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemCodeableConcept);
580          case 1376364920: /*itemReference*/  return new Property("itemReference", "Reference(Condition|Observation|Media)", "Specific reference for finding or diagnosis, which may include ruled-out or resolved conditions.", 0, 1, itemReference);
581          case 93508670: /*basis*/  return new Property("basis", "string", "Which investigations support finding or diagnosis.", 0, 1, basis);
582          default: return super.getNamedProperty(_hash, _name, _checkValid);
583          }
584
585        }
586
587      @Override
588      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
589        switch (hash) {
590        case 106644494: /*itemCodeableConcept*/ return this.itemCodeableConcept == null ? new Base[0] : new Base[] {this.itemCodeableConcept}; // CodeableConcept
591        case 1376364920: /*itemReference*/ return this.itemReference == null ? new Base[0] : new Base[] {this.itemReference}; // Reference
592        case 93508670: /*basis*/ return this.basis == null ? new Base[0] : new Base[] {this.basis}; // StringType
593        default: return super.getProperty(hash, name, checkValid);
594        }
595
596      }
597
598      @Override
599      public Base setProperty(int hash, String name, Base value) throws FHIRException {
600        switch (hash) {
601        case 106644494: // itemCodeableConcept
602          this.itemCodeableConcept = castToCodeableConcept(value); // CodeableConcept
603          return value;
604        case 1376364920: // itemReference
605          this.itemReference = castToReference(value); // Reference
606          return value;
607        case 93508670: // basis
608          this.basis = castToString(value); // StringType
609          return value;
610        default: return super.setProperty(hash, name, value);
611        }
612
613      }
614
615      @Override
616      public Base setProperty(String name, Base value) throws FHIRException {
617        if (name.equals("itemCodeableConcept")) {
618          this.itemCodeableConcept = castToCodeableConcept(value); // CodeableConcept
619        } else if (name.equals("itemReference")) {
620          this.itemReference = castToReference(value); // Reference
621        } else if (name.equals("basis")) {
622          this.basis = castToString(value); // StringType
623        } else
624          return super.setProperty(name, value);
625        return value;
626      }
627
628      @Override
629      public Base makeProperty(int hash, String name) throws FHIRException {
630        switch (hash) {
631        case 106644494:  return getItemCodeableConcept(); 
632        case 1376364920:  return getItemReference(); 
633        case 93508670:  return getBasisElement();
634        default: return super.makeProperty(hash, name);
635        }
636
637      }
638
639      @Override
640      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
641        switch (hash) {
642        case 106644494: /*itemCodeableConcept*/ return new String[] {"CodeableConcept"};
643        case 1376364920: /*itemReference*/ return new String[] {"Reference"};
644        case 93508670: /*basis*/ return new String[] {"string"};
645        default: return super.getTypesForProperty(hash, name);
646        }
647
648      }
649
650      @Override
651      public Base addChild(String name) throws FHIRException {
652        if (name.equals("itemCodeableConcept")) {
653          this.itemCodeableConcept = new CodeableConcept();
654          return this.itemCodeableConcept;
655        }
656        else if (name.equals("itemReference")) {
657          this.itemReference = new Reference();
658          return this.itemReference;
659        }
660        else if (name.equals("basis")) {
661          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.basis");
662        }
663        else
664          return super.addChild(name);
665      }
666
667      public ClinicalImpressionFindingComponent copy() {
668        ClinicalImpressionFindingComponent dst = new ClinicalImpressionFindingComponent();
669        copyValues(dst);
670        return dst;
671      }
672
673      public void copyValues(ClinicalImpressionFindingComponent dst) {
674        super.copyValues(dst);
675        dst.itemCodeableConcept = itemCodeableConcept == null ? null : itemCodeableConcept.copy();
676        dst.itemReference = itemReference == null ? null : itemReference.copy();
677        dst.basis = basis == null ? null : basis.copy();
678      }
679
680      @Override
681      public boolean equalsDeep(Base other_) {
682        if (!super.equalsDeep(other_))
683          return false;
684        if (!(other_ instanceof ClinicalImpressionFindingComponent))
685          return false;
686        ClinicalImpressionFindingComponent o = (ClinicalImpressionFindingComponent) other_;
687        return compareDeep(itemCodeableConcept, o.itemCodeableConcept, true) && compareDeep(itemReference, o.itemReference, true)
688           && compareDeep(basis, o.basis, true);
689      }
690
691      @Override
692      public boolean equalsShallow(Base other_) {
693        if (!super.equalsShallow(other_))
694          return false;
695        if (!(other_ instanceof ClinicalImpressionFindingComponent))
696          return false;
697        ClinicalImpressionFindingComponent o = (ClinicalImpressionFindingComponent) other_;
698        return compareValues(basis, o.basis, true);
699      }
700
701      public boolean isEmpty() {
702        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemCodeableConcept, itemReference
703          , basis);
704      }
705
706  public String fhirType() {
707    return "ClinicalImpression.finding";
708
709  }
710
711  }
712
713    /**
714     * Business identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server.
715     */
716    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
717    @Description(shortDefinition="Business identifier", formalDefinition="Business identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server." )
718    protected List<Identifier> identifier;
719
720    /**
721     * Identifies the workflow status of the assessment.
722     */
723    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
724    @Description(shortDefinition="in-progress | completed | entered-in-error", formalDefinition="Identifies the workflow status of the assessment." )
725    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinicalimpression-status")
726    protected Enumeration<ClinicalImpressionStatus> status;
727
728    /**
729     * Captures the reason for the current state of the ClinicalImpression.
730     */
731    @Child(name = "statusReason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
732    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current state of the ClinicalImpression." )
733    protected CodeableConcept statusReason;
734
735    /**
736     * Categorizes the type of clinical assessment performed.
737     */
738    @Child(name = "code", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
739    @Description(shortDefinition="Kind of assessment performed", formalDefinition="Categorizes the type of clinical assessment performed." )
740    protected CodeableConcept code;
741
742    /**
743     * A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.
744     */
745    @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
746    @Description(shortDefinition="Why/how the assessment was performed", formalDefinition="A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it." )
747    protected StringType description;
748
749    /**
750     * The patient or group of individuals assessed as part of this record.
751     */
752    @Child(name = "subject", type = {Patient.class, Group.class}, order=5, min=1, max=1, modifier=false, summary=true)
753    @Description(shortDefinition="Patient or group assessed", formalDefinition="The patient or group of individuals assessed as part of this record." )
754    protected Reference subject;
755
756    /**
757     * The actual object that is the target of the reference (The patient or group of individuals assessed as part of this record.)
758     */
759    protected Resource subjectTarget;
760
761    /**
762     * The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.
763     */
764    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
765    @Description(shortDefinition="Encounter created as part of", formalDefinition="The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated." )
766    protected Reference encounter;
767
768    /**
769     * The actual object that is the target of the reference (The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.)
770     */
771    protected Encounter encounterTarget;
772
773    /**
774     * The point in time or period over which the subject was assessed.
775     */
776    @Child(name = "effective", type = {DateTimeType.class, Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
777    @Description(shortDefinition="Time of assessment", formalDefinition="The point in time or period over which the subject was assessed." )
778    protected Type effective;
779
780    /**
781     * Indicates when the documentation of the assessment was complete.
782     */
783    @Child(name = "date", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
784    @Description(shortDefinition="When the assessment was documented", formalDefinition="Indicates when the documentation of the assessment was complete." )
785    protected DateTimeType date;
786
787    /**
788     * The clinician performing the assessment.
789     */
790    @Child(name = "assessor", type = {Practitioner.class, PractitionerRole.class}, order=9, min=0, max=1, modifier=false, summary=true)
791    @Description(shortDefinition="The clinician performing the assessment", formalDefinition="The clinician performing the assessment." )
792    protected Reference assessor;
793
794    /**
795     * The actual object that is the target of the reference (The clinician performing the assessment.)
796     */
797    protected Resource assessorTarget;
798
799    /**
800     * A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.
801     */
802    @Child(name = "previous", type = {ClinicalImpression.class}, order=10, min=0, max=1, modifier=false, summary=false)
803    @Description(shortDefinition="Reference to last assessment", formalDefinition="A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes." )
804    protected Reference previous;
805
806    /**
807     * The actual object that is the target of the reference (A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.)
808     */
809    protected ClinicalImpression previousTarget;
810
811    /**
812     * A list of the relevant problems/conditions for a patient.
813     */
814    @Child(name = "problem", type = {Condition.class, AllergyIntolerance.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
815    @Description(shortDefinition="Relevant impressions of patient state", formalDefinition="A list of the relevant problems/conditions for a patient." )
816    protected List<Reference> problem;
817    /**
818     * The actual objects that are the target of the reference (A list of the relevant problems/conditions for a patient.)
819     */
820    protected List<Resource> problemTarget;
821
822
823    /**
824     * One or more sets of investigations (signs, symptoms, etc.). The actual grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes.
825     */
826    @Child(name = "investigation", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
827    @Description(shortDefinition="One or more sets of investigations (signs, symptoms, etc.)", formalDefinition="One or more sets of investigations (signs, symptoms, etc.). The actual grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes." )
828    protected List<ClinicalImpressionInvestigationComponent> investigation;
829
830    /**
831     * Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.
832     */
833    @Child(name = "protocol", type = {UriType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
834    @Description(shortDefinition="Clinical Protocol followed", formalDefinition="Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis." )
835    protected List<UriType> protocol;
836
837    /**
838     * A text summary of the investigations and the diagnosis.
839     */
840    @Child(name = "summary", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
841    @Description(shortDefinition="Summary of the assessment", formalDefinition="A text summary of the investigations and the diagnosis." )
842    protected StringType summary;
843
844    /**
845     * Specific findings or diagnoses that were considered likely or relevant to ongoing treatment.
846     */
847    @Child(name = "finding", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
848    @Description(shortDefinition="Possible or likely findings and diagnoses", formalDefinition="Specific findings or diagnoses that were considered likely or relevant to ongoing treatment." )
849    protected List<ClinicalImpressionFindingComponent> finding;
850
851    /**
852     * Estimate of likely outcome.
853     */
854    @Child(name = "prognosisCodeableConcept", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
855    @Description(shortDefinition="Estimate of likely outcome", formalDefinition="Estimate of likely outcome." )
856    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinicalimpression-prognosis")
857    protected List<CodeableConcept> prognosisCodeableConcept;
858
859    /**
860     * RiskAssessment expressing likely outcome.
861     */
862    @Child(name = "prognosisReference", type = {RiskAssessment.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
863    @Description(shortDefinition="RiskAssessment expressing likely outcome", formalDefinition="RiskAssessment expressing likely outcome." )
864    protected List<Reference> prognosisReference;
865    /**
866     * The actual objects that are the target of the reference (RiskAssessment expressing likely outcome.)
867     */
868    protected List<RiskAssessment> prognosisReferenceTarget;
869
870
871    /**
872     * Information supporting the clinical impression.
873     */
874    @Child(name = "supportingInfo", type = {Reference.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
875    @Description(shortDefinition="Information supporting the clinical impression", formalDefinition="Information supporting the clinical impression." )
876    protected List<Reference> supportingInfo;
877    /**
878     * The actual objects that are the target of the reference (Information supporting the clinical impression.)
879     */
880    protected List<Resource> supportingInfoTarget;
881
882
883    /**
884     * Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear.
885     */
886    @Child(name = "note", type = {Annotation.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
887    @Description(shortDefinition="Comments made about the ClinicalImpression", formalDefinition="Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear." )
888    protected List<Annotation> note;
889
890    private static final long serialVersionUID = 1158874575L;
891
892  /**
893   * Constructor
894   */
895    public ClinicalImpression() {
896      super();
897    }
898
899  /**
900   * Constructor
901   */
902    public ClinicalImpression(Enumeration<ClinicalImpressionStatus> status, Reference subject) {
903      super();
904      this.status = status;
905      this.subject = subject;
906    }
907
908    /**
909     * @return {@link #identifier} (Business identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server.)
910     */
911    public List<Identifier> getIdentifier() { 
912      if (this.identifier == null)
913        this.identifier = new ArrayList<Identifier>();
914      return this.identifier;
915    }
916
917    /**
918     * @return Returns a reference to <code>this</code> for easy method chaining
919     */
920    public ClinicalImpression setIdentifier(List<Identifier> theIdentifier) { 
921      this.identifier = theIdentifier;
922      return this;
923    }
924
925    public boolean hasIdentifier() { 
926      if (this.identifier == null)
927        return false;
928      for (Identifier item : this.identifier)
929        if (!item.isEmpty())
930          return true;
931      return false;
932    }
933
934    public Identifier addIdentifier() { //3
935      Identifier t = new Identifier();
936      if (this.identifier == null)
937        this.identifier = new ArrayList<Identifier>();
938      this.identifier.add(t);
939      return t;
940    }
941
942    public ClinicalImpression addIdentifier(Identifier t) { //3
943      if (t == null)
944        return this;
945      if (this.identifier == null)
946        this.identifier = new ArrayList<Identifier>();
947      this.identifier.add(t);
948      return this;
949    }
950
951    /**
952     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
953     */
954    public Identifier getIdentifierFirstRep() { 
955      if (getIdentifier().isEmpty()) {
956        addIdentifier();
957      }
958      return getIdentifier().get(0);
959    }
960
961    /**
962     * @return {@link #status} (Identifies the workflow status of the assessment.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
963     */
964    public Enumeration<ClinicalImpressionStatus> getStatusElement() { 
965      if (this.status == null)
966        if (Configuration.errorOnAutoCreate())
967          throw new Error("Attempt to auto-create ClinicalImpression.status");
968        else if (Configuration.doAutoCreate())
969          this.status = new Enumeration<ClinicalImpressionStatus>(new ClinicalImpressionStatusEnumFactory()); // bb
970      return this.status;
971    }
972
973    public boolean hasStatusElement() { 
974      return this.status != null && !this.status.isEmpty();
975    }
976
977    public boolean hasStatus() { 
978      return this.status != null && !this.status.isEmpty();
979    }
980
981    /**
982     * @param value {@link #status} (Identifies the workflow status of the assessment.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
983     */
984    public ClinicalImpression setStatusElement(Enumeration<ClinicalImpressionStatus> value) { 
985      this.status = value;
986      return this;
987    }
988
989    /**
990     * @return Identifies the workflow status of the assessment.
991     */
992    public ClinicalImpressionStatus getStatus() { 
993      return this.status == null ? null : this.status.getValue();
994    }
995
996    /**
997     * @param value Identifies the workflow status of the assessment.
998     */
999    public ClinicalImpression setStatus(ClinicalImpressionStatus value) { 
1000        if (this.status == null)
1001          this.status = new Enumeration<ClinicalImpressionStatus>(new ClinicalImpressionStatusEnumFactory());
1002        this.status.setValue(value);
1003      return this;
1004    }
1005
1006    /**
1007     * @return {@link #statusReason} (Captures the reason for the current state of the ClinicalImpression.)
1008     */
1009    public CodeableConcept getStatusReason() { 
1010      if (this.statusReason == null)
1011        if (Configuration.errorOnAutoCreate())
1012          throw new Error("Attempt to auto-create ClinicalImpression.statusReason");
1013        else if (Configuration.doAutoCreate())
1014          this.statusReason = new CodeableConcept(); // cc
1015      return this.statusReason;
1016    }
1017
1018    public boolean hasStatusReason() { 
1019      return this.statusReason != null && !this.statusReason.isEmpty();
1020    }
1021
1022    /**
1023     * @param value {@link #statusReason} (Captures the reason for the current state of the ClinicalImpression.)
1024     */
1025    public ClinicalImpression setStatusReason(CodeableConcept value) { 
1026      this.statusReason = value;
1027      return this;
1028    }
1029
1030    /**
1031     * @return {@link #code} (Categorizes the type of clinical assessment performed.)
1032     */
1033    public CodeableConcept getCode() { 
1034      if (this.code == null)
1035        if (Configuration.errorOnAutoCreate())
1036          throw new Error("Attempt to auto-create ClinicalImpression.code");
1037        else if (Configuration.doAutoCreate())
1038          this.code = new CodeableConcept(); // cc
1039      return this.code;
1040    }
1041
1042    public boolean hasCode() { 
1043      return this.code != null && !this.code.isEmpty();
1044    }
1045
1046    /**
1047     * @param value {@link #code} (Categorizes the type of clinical assessment performed.)
1048     */
1049    public ClinicalImpression setCode(CodeableConcept value) { 
1050      this.code = value;
1051      return this;
1052    }
1053
1054    /**
1055     * @return {@link #description} (A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1056     */
1057    public StringType getDescriptionElement() { 
1058      if (this.description == null)
1059        if (Configuration.errorOnAutoCreate())
1060          throw new Error("Attempt to auto-create ClinicalImpression.description");
1061        else if (Configuration.doAutoCreate())
1062          this.description = new StringType(); // bb
1063      return this.description;
1064    }
1065
1066    public boolean hasDescriptionElement() { 
1067      return this.description != null && !this.description.isEmpty();
1068    }
1069
1070    public boolean hasDescription() { 
1071      return this.description != null && !this.description.isEmpty();
1072    }
1073
1074    /**
1075     * @param value {@link #description} (A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1076     */
1077    public ClinicalImpression setDescriptionElement(StringType value) { 
1078      this.description = value;
1079      return this;
1080    }
1081
1082    /**
1083     * @return A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.
1084     */
1085    public String getDescription() { 
1086      return this.description == null ? null : this.description.getValue();
1087    }
1088
1089    /**
1090     * @param value A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.
1091     */
1092    public ClinicalImpression setDescription(String value) { 
1093      if (Utilities.noString(value))
1094        this.description = null;
1095      else {
1096        if (this.description == null)
1097          this.description = new StringType();
1098        this.description.setValue(value);
1099      }
1100      return this;
1101    }
1102
1103    /**
1104     * @return {@link #subject} (The patient or group of individuals assessed as part of this record.)
1105     */
1106    public Reference getSubject() { 
1107      if (this.subject == null)
1108        if (Configuration.errorOnAutoCreate())
1109          throw new Error("Attempt to auto-create ClinicalImpression.subject");
1110        else if (Configuration.doAutoCreate())
1111          this.subject = new Reference(); // cc
1112      return this.subject;
1113    }
1114
1115    public boolean hasSubject() { 
1116      return this.subject != null && !this.subject.isEmpty();
1117    }
1118
1119    /**
1120     * @param value {@link #subject} (The patient or group of individuals assessed as part of this record.)
1121     */
1122    public ClinicalImpression setSubject(Reference value) { 
1123      this.subject = value;
1124      return this;
1125    }
1126
1127    /**
1128     * @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. (The patient or group of individuals assessed as part of this record.)
1129     */
1130    public Resource getSubjectTarget() { 
1131      return this.subjectTarget;
1132    }
1133
1134    /**
1135     * @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. (The patient or group of individuals assessed as part of this record.)
1136     */
1137    public ClinicalImpression setSubjectTarget(Resource value) { 
1138      this.subjectTarget = value;
1139      return this;
1140    }
1141
1142    /**
1143     * @return {@link #encounter} (The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.)
1144     */
1145    public Reference getEncounter() { 
1146      if (this.encounter == null)
1147        if (Configuration.errorOnAutoCreate())
1148          throw new Error("Attempt to auto-create ClinicalImpression.encounter");
1149        else if (Configuration.doAutoCreate())
1150          this.encounter = new Reference(); // cc
1151      return this.encounter;
1152    }
1153
1154    public boolean hasEncounter() { 
1155      return this.encounter != null && !this.encounter.isEmpty();
1156    }
1157
1158    /**
1159     * @param value {@link #encounter} (The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.)
1160     */
1161    public ClinicalImpression setEncounter(Reference value) { 
1162      this.encounter = value;
1163      return this;
1164    }
1165
1166    /**
1167     * @return {@link #encounter} 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. (The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.)
1168     */
1169    public Encounter getEncounterTarget() { 
1170      if (this.encounterTarget == null)
1171        if (Configuration.errorOnAutoCreate())
1172          throw new Error("Attempt to auto-create ClinicalImpression.encounter");
1173        else if (Configuration.doAutoCreate())
1174          this.encounterTarget = new Encounter(); // aa
1175      return this.encounterTarget;
1176    }
1177
1178    /**
1179     * @param value {@link #encounter} 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. (The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.)
1180     */
1181    public ClinicalImpression setEncounterTarget(Encounter value) { 
1182      this.encounterTarget = value;
1183      return this;
1184    }
1185
1186    /**
1187     * @return {@link #effective} (The point in time or period over which the subject was assessed.)
1188     */
1189    public Type getEffective() { 
1190      return this.effective;
1191    }
1192
1193    /**
1194     * @return {@link #effective} (The point in time or period over which the subject was assessed.)
1195     */
1196    public DateTimeType getEffectiveDateTimeType() throws FHIRException { 
1197      if (this.effective == null)
1198        this.effective = new DateTimeType();
1199      if (!(this.effective instanceof DateTimeType))
1200        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.effective.getClass().getName()+" was encountered");
1201      return (DateTimeType) this.effective;
1202    }
1203
1204    public boolean hasEffectiveDateTimeType() { 
1205      return this != null && this.effective instanceof DateTimeType;
1206    }
1207
1208    /**
1209     * @return {@link #effective} (The point in time or period over which the subject was assessed.)
1210     */
1211    public Period getEffectivePeriod() throws FHIRException { 
1212      if (this.effective == null)
1213        this.effective = new Period();
1214      if (!(this.effective instanceof Period))
1215        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.effective.getClass().getName()+" was encountered");
1216      return (Period) this.effective;
1217    }
1218
1219    public boolean hasEffectivePeriod() { 
1220      return this != null && this.effective instanceof Period;
1221    }
1222
1223    public boolean hasEffective() { 
1224      return this.effective != null && !this.effective.isEmpty();
1225    }
1226
1227    /**
1228     * @param value {@link #effective} (The point in time or period over which the subject was assessed.)
1229     */
1230    public ClinicalImpression setEffective(Type value) { 
1231      if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1232        throw new Error("Not the right type for ClinicalImpression.effective[x]: "+value.fhirType());
1233      this.effective = value;
1234      return this;
1235    }
1236
1237    /**
1238     * @return {@link #date} (Indicates when the documentation of the assessment was complete.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1239     */
1240    public DateTimeType getDateElement() { 
1241      if (this.date == null)
1242        if (Configuration.errorOnAutoCreate())
1243          throw new Error("Attempt to auto-create ClinicalImpression.date");
1244        else if (Configuration.doAutoCreate())
1245          this.date = new DateTimeType(); // bb
1246      return this.date;
1247    }
1248
1249    public boolean hasDateElement() { 
1250      return this.date != null && !this.date.isEmpty();
1251    }
1252
1253    public boolean hasDate() { 
1254      return this.date != null && !this.date.isEmpty();
1255    }
1256
1257    /**
1258     * @param value {@link #date} (Indicates when the documentation of the assessment was complete.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1259     */
1260    public ClinicalImpression setDateElement(DateTimeType value) { 
1261      this.date = value;
1262      return this;
1263    }
1264
1265    /**
1266     * @return Indicates when the documentation of the assessment was complete.
1267     */
1268    public Date getDate() { 
1269      return this.date == null ? null : this.date.getValue();
1270    }
1271
1272    /**
1273     * @param value Indicates when the documentation of the assessment was complete.
1274     */
1275    public ClinicalImpression setDate(Date value) { 
1276      if (value == null)
1277        this.date = null;
1278      else {
1279        if (this.date == null)
1280          this.date = new DateTimeType();
1281        this.date.setValue(value);
1282      }
1283      return this;
1284    }
1285
1286    /**
1287     * @return {@link #assessor} (The clinician performing the assessment.)
1288     */
1289    public Reference getAssessor() { 
1290      if (this.assessor == null)
1291        if (Configuration.errorOnAutoCreate())
1292          throw new Error("Attempt to auto-create ClinicalImpression.assessor");
1293        else if (Configuration.doAutoCreate())
1294          this.assessor = new Reference(); // cc
1295      return this.assessor;
1296    }
1297
1298    public boolean hasAssessor() { 
1299      return this.assessor != null && !this.assessor.isEmpty();
1300    }
1301
1302    /**
1303     * @param value {@link #assessor} (The clinician performing the assessment.)
1304     */
1305    public ClinicalImpression setAssessor(Reference value) { 
1306      this.assessor = value;
1307      return this;
1308    }
1309
1310    /**
1311     * @return {@link #assessor} 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. (The clinician performing the assessment.)
1312     */
1313    public Resource getAssessorTarget() { 
1314      return this.assessorTarget;
1315    }
1316
1317    /**
1318     * @param value {@link #assessor} 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. (The clinician performing the assessment.)
1319     */
1320    public ClinicalImpression setAssessorTarget(Resource value) { 
1321      this.assessorTarget = value;
1322      return this;
1323    }
1324
1325    /**
1326     * @return {@link #previous} (A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.)
1327     */
1328    public Reference getPrevious() { 
1329      if (this.previous == null)
1330        if (Configuration.errorOnAutoCreate())
1331          throw new Error("Attempt to auto-create ClinicalImpression.previous");
1332        else if (Configuration.doAutoCreate())
1333          this.previous = new Reference(); // cc
1334      return this.previous;
1335    }
1336
1337    public boolean hasPrevious() { 
1338      return this.previous != null && !this.previous.isEmpty();
1339    }
1340
1341    /**
1342     * @param value {@link #previous} (A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.)
1343     */
1344    public ClinicalImpression setPrevious(Reference value) { 
1345      this.previous = value;
1346      return this;
1347    }
1348
1349    /**
1350     * @return {@link #previous} 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. (A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.)
1351     */
1352    public ClinicalImpression getPreviousTarget() { 
1353      if (this.previousTarget == null)
1354        if (Configuration.errorOnAutoCreate())
1355          throw new Error("Attempt to auto-create ClinicalImpression.previous");
1356        else if (Configuration.doAutoCreate())
1357          this.previousTarget = new ClinicalImpression(); // aa
1358      return this.previousTarget;
1359    }
1360
1361    /**
1362     * @param value {@link #previous} 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. (A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.)
1363     */
1364    public ClinicalImpression setPreviousTarget(ClinicalImpression value) { 
1365      this.previousTarget = value;
1366      return this;
1367    }
1368
1369    /**
1370     * @return {@link #problem} (A list of the relevant problems/conditions for a patient.)
1371     */
1372    public List<Reference> getProblem() { 
1373      if (this.problem == null)
1374        this.problem = new ArrayList<Reference>();
1375      return this.problem;
1376    }
1377
1378    /**
1379     * @return Returns a reference to <code>this</code> for easy method chaining
1380     */
1381    public ClinicalImpression setProblem(List<Reference> theProblem) { 
1382      this.problem = theProblem;
1383      return this;
1384    }
1385
1386    public boolean hasProblem() { 
1387      if (this.problem == null)
1388        return false;
1389      for (Reference item : this.problem)
1390        if (!item.isEmpty())
1391          return true;
1392      return false;
1393    }
1394
1395    public Reference addProblem() { //3
1396      Reference t = new Reference();
1397      if (this.problem == null)
1398        this.problem = new ArrayList<Reference>();
1399      this.problem.add(t);
1400      return t;
1401    }
1402
1403    public ClinicalImpression addProblem(Reference t) { //3
1404      if (t == null)
1405        return this;
1406      if (this.problem == null)
1407        this.problem = new ArrayList<Reference>();
1408      this.problem.add(t);
1409      return this;
1410    }
1411
1412    /**
1413     * @return The first repetition of repeating field {@link #problem}, creating it if it does not already exist
1414     */
1415    public Reference getProblemFirstRep() { 
1416      if (getProblem().isEmpty()) {
1417        addProblem();
1418      }
1419      return getProblem().get(0);
1420    }
1421
1422    /**
1423     * @deprecated Use Reference#setResource(IBaseResource) instead
1424     */
1425    @Deprecated
1426    public List<Resource> getProblemTarget() { 
1427      if (this.problemTarget == null)
1428        this.problemTarget = new ArrayList<Resource>();
1429      return this.problemTarget;
1430    }
1431
1432    /**
1433     * @return {@link #investigation} (One or more sets of investigations (signs, symptoms, etc.). The actual grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes.)
1434     */
1435    public List<ClinicalImpressionInvestigationComponent> getInvestigation() { 
1436      if (this.investigation == null)
1437        this.investigation = new ArrayList<ClinicalImpressionInvestigationComponent>();
1438      return this.investigation;
1439    }
1440
1441    /**
1442     * @return Returns a reference to <code>this</code> for easy method chaining
1443     */
1444    public ClinicalImpression setInvestigation(List<ClinicalImpressionInvestigationComponent> theInvestigation) { 
1445      this.investigation = theInvestigation;
1446      return this;
1447    }
1448
1449    public boolean hasInvestigation() { 
1450      if (this.investigation == null)
1451        return false;
1452      for (ClinicalImpressionInvestigationComponent item : this.investigation)
1453        if (!item.isEmpty())
1454          return true;
1455      return false;
1456    }
1457
1458    public ClinicalImpressionInvestigationComponent addInvestigation() { //3
1459      ClinicalImpressionInvestigationComponent t = new ClinicalImpressionInvestigationComponent();
1460      if (this.investigation == null)
1461        this.investigation = new ArrayList<ClinicalImpressionInvestigationComponent>();
1462      this.investigation.add(t);
1463      return t;
1464    }
1465
1466    public ClinicalImpression addInvestigation(ClinicalImpressionInvestigationComponent t) { //3
1467      if (t == null)
1468        return this;
1469      if (this.investigation == null)
1470        this.investigation = new ArrayList<ClinicalImpressionInvestigationComponent>();
1471      this.investigation.add(t);
1472      return this;
1473    }
1474
1475    /**
1476     * @return The first repetition of repeating field {@link #investigation}, creating it if it does not already exist
1477     */
1478    public ClinicalImpressionInvestigationComponent getInvestigationFirstRep() { 
1479      if (getInvestigation().isEmpty()) {
1480        addInvestigation();
1481      }
1482      return getInvestigation().get(0);
1483    }
1484
1485    /**
1486     * @return {@link #protocol} (Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.)
1487     */
1488    public List<UriType> getProtocol() { 
1489      if (this.protocol == null)
1490        this.protocol = new ArrayList<UriType>();
1491      return this.protocol;
1492    }
1493
1494    /**
1495     * @return Returns a reference to <code>this</code> for easy method chaining
1496     */
1497    public ClinicalImpression setProtocol(List<UriType> theProtocol) { 
1498      this.protocol = theProtocol;
1499      return this;
1500    }
1501
1502    public boolean hasProtocol() { 
1503      if (this.protocol == null)
1504        return false;
1505      for (UriType item : this.protocol)
1506        if (!item.isEmpty())
1507          return true;
1508      return false;
1509    }
1510
1511    /**
1512     * @return {@link #protocol} (Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.)
1513     */
1514    public UriType addProtocolElement() {//2 
1515      UriType t = new UriType();
1516      if (this.protocol == null)
1517        this.protocol = new ArrayList<UriType>();
1518      this.protocol.add(t);
1519      return t;
1520    }
1521
1522    /**
1523     * @param value {@link #protocol} (Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.)
1524     */
1525    public ClinicalImpression addProtocol(String value) { //1
1526      UriType t = new UriType();
1527      t.setValue(value);
1528      if (this.protocol == null)
1529        this.protocol = new ArrayList<UriType>();
1530      this.protocol.add(t);
1531      return this;
1532    }
1533
1534    /**
1535     * @param value {@link #protocol} (Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.)
1536     */
1537    public boolean hasProtocol(String value) { 
1538      if (this.protocol == null)
1539        return false;
1540      for (UriType v : this.protocol)
1541        if (v.getValue().equals(value)) // uri
1542          return true;
1543      return false;
1544    }
1545
1546    /**
1547     * @return {@link #summary} (A text summary of the investigations and the diagnosis.). This is the underlying object with id, value and extensions. The accessor "getSummary" gives direct access to the value
1548     */
1549    public StringType getSummaryElement() { 
1550      if (this.summary == null)
1551        if (Configuration.errorOnAutoCreate())
1552          throw new Error("Attempt to auto-create ClinicalImpression.summary");
1553        else if (Configuration.doAutoCreate())
1554          this.summary = new StringType(); // bb
1555      return this.summary;
1556    }
1557
1558    public boolean hasSummaryElement() { 
1559      return this.summary != null && !this.summary.isEmpty();
1560    }
1561
1562    public boolean hasSummary() { 
1563      return this.summary != null && !this.summary.isEmpty();
1564    }
1565
1566    /**
1567     * @param value {@link #summary} (A text summary of the investigations and the diagnosis.). This is the underlying object with id, value and extensions. The accessor "getSummary" gives direct access to the value
1568     */
1569    public ClinicalImpression setSummaryElement(StringType value) { 
1570      this.summary = value;
1571      return this;
1572    }
1573
1574    /**
1575     * @return A text summary of the investigations and the diagnosis.
1576     */
1577    public String getSummary() { 
1578      return this.summary == null ? null : this.summary.getValue();
1579    }
1580
1581    /**
1582     * @param value A text summary of the investigations and the diagnosis.
1583     */
1584    public ClinicalImpression setSummary(String value) { 
1585      if (Utilities.noString(value))
1586        this.summary = null;
1587      else {
1588        if (this.summary == null)
1589          this.summary = new StringType();
1590        this.summary.setValue(value);
1591      }
1592      return this;
1593    }
1594
1595    /**
1596     * @return {@link #finding} (Specific findings or diagnoses that were considered likely or relevant to ongoing treatment.)
1597     */
1598    public List<ClinicalImpressionFindingComponent> getFinding() { 
1599      if (this.finding == null)
1600        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1601      return this.finding;
1602    }
1603
1604    /**
1605     * @return Returns a reference to <code>this</code> for easy method chaining
1606     */
1607    public ClinicalImpression setFinding(List<ClinicalImpressionFindingComponent> theFinding) { 
1608      this.finding = theFinding;
1609      return this;
1610    }
1611
1612    public boolean hasFinding() { 
1613      if (this.finding == null)
1614        return false;
1615      for (ClinicalImpressionFindingComponent item : this.finding)
1616        if (!item.isEmpty())
1617          return true;
1618      return false;
1619    }
1620
1621    public ClinicalImpressionFindingComponent addFinding() { //3
1622      ClinicalImpressionFindingComponent t = new ClinicalImpressionFindingComponent();
1623      if (this.finding == null)
1624        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1625      this.finding.add(t);
1626      return t;
1627    }
1628
1629    public ClinicalImpression addFinding(ClinicalImpressionFindingComponent t) { //3
1630      if (t == null)
1631        return this;
1632      if (this.finding == null)
1633        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1634      this.finding.add(t);
1635      return this;
1636    }
1637
1638    /**
1639     * @return The first repetition of repeating field {@link #finding}, creating it if it does not already exist
1640     */
1641    public ClinicalImpressionFindingComponent getFindingFirstRep() { 
1642      if (getFinding().isEmpty()) {
1643        addFinding();
1644      }
1645      return getFinding().get(0);
1646    }
1647
1648    /**
1649     * @return {@link #prognosisCodeableConcept} (Estimate of likely outcome.)
1650     */
1651    public List<CodeableConcept> getPrognosisCodeableConcept() { 
1652      if (this.prognosisCodeableConcept == null)
1653        this.prognosisCodeableConcept = new ArrayList<CodeableConcept>();
1654      return this.prognosisCodeableConcept;
1655    }
1656
1657    /**
1658     * @return Returns a reference to <code>this</code> for easy method chaining
1659     */
1660    public ClinicalImpression setPrognosisCodeableConcept(List<CodeableConcept> thePrognosisCodeableConcept) { 
1661      this.prognosisCodeableConcept = thePrognosisCodeableConcept;
1662      return this;
1663    }
1664
1665    public boolean hasPrognosisCodeableConcept() { 
1666      if (this.prognosisCodeableConcept == null)
1667        return false;
1668      for (CodeableConcept item : this.prognosisCodeableConcept)
1669        if (!item.isEmpty())
1670          return true;
1671      return false;
1672    }
1673
1674    public CodeableConcept addPrognosisCodeableConcept() { //3
1675      CodeableConcept t = new CodeableConcept();
1676      if (this.prognosisCodeableConcept == null)
1677        this.prognosisCodeableConcept = new ArrayList<CodeableConcept>();
1678      this.prognosisCodeableConcept.add(t);
1679      return t;
1680    }
1681
1682    public ClinicalImpression addPrognosisCodeableConcept(CodeableConcept t) { //3
1683      if (t == null)
1684        return this;
1685      if (this.prognosisCodeableConcept == null)
1686        this.prognosisCodeableConcept = new ArrayList<CodeableConcept>();
1687      this.prognosisCodeableConcept.add(t);
1688      return this;
1689    }
1690
1691    /**
1692     * @return The first repetition of repeating field {@link #prognosisCodeableConcept}, creating it if it does not already exist
1693     */
1694    public CodeableConcept getPrognosisCodeableConceptFirstRep() { 
1695      if (getPrognosisCodeableConcept().isEmpty()) {
1696        addPrognosisCodeableConcept();
1697      }
1698      return getPrognosisCodeableConcept().get(0);
1699    }
1700
1701    /**
1702     * @return {@link #prognosisReference} (RiskAssessment expressing likely outcome.)
1703     */
1704    public List<Reference> getPrognosisReference() { 
1705      if (this.prognosisReference == null)
1706        this.prognosisReference = new ArrayList<Reference>();
1707      return this.prognosisReference;
1708    }
1709
1710    /**
1711     * @return Returns a reference to <code>this</code> for easy method chaining
1712     */
1713    public ClinicalImpression setPrognosisReference(List<Reference> thePrognosisReference) { 
1714      this.prognosisReference = thePrognosisReference;
1715      return this;
1716    }
1717
1718    public boolean hasPrognosisReference() { 
1719      if (this.prognosisReference == null)
1720        return false;
1721      for (Reference item : this.prognosisReference)
1722        if (!item.isEmpty())
1723          return true;
1724      return false;
1725    }
1726
1727    public Reference addPrognosisReference() { //3
1728      Reference t = new Reference();
1729      if (this.prognosisReference == null)
1730        this.prognosisReference = new ArrayList<Reference>();
1731      this.prognosisReference.add(t);
1732      return t;
1733    }
1734
1735    public ClinicalImpression addPrognosisReference(Reference t) { //3
1736      if (t == null)
1737        return this;
1738      if (this.prognosisReference == null)
1739        this.prognosisReference = new ArrayList<Reference>();
1740      this.prognosisReference.add(t);
1741      return this;
1742    }
1743
1744    /**
1745     * @return The first repetition of repeating field {@link #prognosisReference}, creating it if it does not already exist
1746     */
1747    public Reference getPrognosisReferenceFirstRep() { 
1748      if (getPrognosisReference().isEmpty()) {
1749        addPrognosisReference();
1750      }
1751      return getPrognosisReference().get(0);
1752    }
1753
1754    /**
1755     * @deprecated Use Reference#setResource(IBaseResource) instead
1756     */
1757    @Deprecated
1758    public List<RiskAssessment> getPrognosisReferenceTarget() { 
1759      if (this.prognosisReferenceTarget == null)
1760        this.prognosisReferenceTarget = new ArrayList<RiskAssessment>();
1761      return this.prognosisReferenceTarget;
1762    }
1763
1764    /**
1765     * @deprecated Use Reference#setResource(IBaseResource) instead
1766     */
1767    @Deprecated
1768    public RiskAssessment addPrognosisReferenceTarget() { 
1769      RiskAssessment r = new RiskAssessment();
1770      if (this.prognosisReferenceTarget == null)
1771        this.prognosisReferenceTarget = new ArrayList<RiskAssessment>();
1772      this.prognosisReferenceTarget.add(r);
1773      return r;
1774    }
1775
1776    /**
1777     * @return {@link #supportingInfo} (Information supporting the clinical impression.)
1778     */
1779    public List<Reference> getSupportingInfo() { 
1780      if (this.supportingInfo == null)
1781        this.supportingInfo = new ArrayList<Reference>();
1782      return this.supportingInfo;
1783    }
1784
1785    /**
1786     * @return Returns a reference to <code>this</code> for easy method chaining
1787     */
1788    public ClinicalImpression setSupportingInfo(List<Reference> theSupportingInfo) { 
1789      this.supportingInfo = theSupportingInfo;
1790      return this;
1791    }
1792
1793    public boolean hasSupportingInfo() { 
1794      if (this.supportingInfo == null)
1795        return false;
1796      for (Reference item : this.supportingInfo)
1797        if (!item.isEmpty())
1798          return true;
1799      return false;
1800    }
1801
1802    public Reference addSupportingInfo() { //3
1803      Reference t = new Reference();
1804      if (this.supportingInfo == null)
1805        this.supportingInfo = new ArrayList<Reference>();
1806      this.supportingInfo.add(t);
1807      return t;
1808    }
1809
1810    public ClinicalImpression addSupportingInfo(Reference t) { //3
1811      if (t == null)
1812        return this;
1813      if (this.supportingInfo == null)
1814        this.supportingInfo = new ArrayList<Reference>();
1815      this.supportingInfo.add(t);
1816      return this;
1817    }
1818
1819    /**
1820     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
1821     */
1822    public Reference getSupportingInfoFirstRep() { 
1823      if (getSupportingInfo().isEmpty()) {
1824        addSupportingInfo();
1825      }
1826      return getSupportingInfo().get(0);
1827    }
1828
1829    /**
1830     * @deprecated Use Reference#setResource(IBaseResource) instead
1831     */
1832    @Deprecated
1833    public List<Resource> getSupportingInfoTarget() { 
1834      if (this.supportingInfoTarget == null)
1835        this.supportingInfoTarget = new ArrayList<Resource>();
1836      return this.supportingInfoTarget;
1837    }
1838
1839    /**
1840     * @return {@link #note} (Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear.)
1841     */
1842    public List<Annotation> getNote() { 
1843      if (this.note == null)
1844        this.note = new ArrayList<Annotation>();
1845      return this.note;
1846    }
1847
1848    /**
1849     * @return Returns a reference to <code>this</code> for easy method chaining
1850     */
1851    public ClinicalImpression setNote(List<Annotation> theNote) { 
1852      this.note = theNote;
1853      return this;
1854    }
1855
1856    public boolean hasNote() { 
1857      if (this.note == null)
1858        return false;
1859      for (Annotation item : this.note)
1860        if (!item.isEmpty())
1861          return true;
1862      return false;
1863    }
1864
1865    public Annotation addNote() { //3
1866      Annotation t = new Annotation();
1867      if (this.note == null)
1868        this.note = new ArrayList<Annotation>();
1869      this.note.add(t);
1870      return t;
1871    }
1872
1873    public ClinicalImpression addNote(Annotation t) { //3
1874      if (t == null)
1875        return this;
1876      if (this.note == null)
1877        this.note = new ArrayList<Annotation>();
1878      this.note.add(t);
1879      return this;
1880    }
1881
1882    /**
1883     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1884     */
1885    public Annotation getNoteFirstRep() { 
1886      if (getNote().isEmpty()) {
1887        addNote();
1888      }
1889      return getNote().get(0);
1890    }
1891
1892      protected void listChildren(List<Property> children) {
1893        super.listChildren(children);
1894        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
1895        children.add(new Property("status", "code", "Identifies the workflow status of the assessment.", 0, 1, status));
1896        children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the ClinicalImpression.", 0, 1, statusReason));
1897        children.add(new Property("code", "CodeableConcept", "Categorizes the type of clinical assessment performed.", 0, 1, code));
1898        children.add(new Property("description", "string", "A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.", 0, 1, description));
1899        children.add(new Property("subject", "Reference(Patient|Group)", "The patient or group of individuals assessed as part of this record.", 0, 1, subject));
1900        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
1901        children.add(new Property("effective[x]", "dateTime|Period", "The point in time or period over which the subject was assessed.", 0, 1, effective));
1902        children.add(new Property("date", "dateTime", "Indicates when the documentation of the assessment was complete.", 0, 1, date));
1903        children.add(new Property("assessor", "Reference(Practitioner|PractitionerRole)", "The clinician performing the assessment.", 0, 1, assessor));
1904        children.add(new Property("previous", "Reference(ClinicalImpression)", "A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.", 0, 1, previous));
1905        children.add(new Property("problem", "Reference(Condition|AllergyIntolerance)", "A list of the relevant problems/conditions for a patient.", 0, java.lang.Integer.MAX_VALUE, problem));
1906        children.add(new Property("investigation", "", "One or more sets of investigations (signs, symptoms, etc.). The actual grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes.", 0, java.lang.Integer.MAX_VALUE, investigation));
1907        children.add(new Property("protocol", "uri", "Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.", 0, java.lang.Integer.MAX_VALUE, protocol));
1908        children.add(new Property("summary", "string", "A text summary of the investigations and the diagnosis.", 0, 1, summary));
1909        children.add(new Property("finding", "", "Specific findings or diagnoses that were considered likely or relevant to ongoing treatment.", 0, java.lang.Integer.MAX_VALUE, finding));
1910        children.add(new Property("prognosisCodeableConcept", "CodeableConcept", "Estimate of likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosisCodeableConcept));
1911        children.add(new Property("prognosisReference", "Reference(RiskAssessment)", "RiskAssessment expressing likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosisReference));
1912        children.add(new Property("supportingInfo", "Reference(Any)", "Information supporting the clinical impression.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
1913        children.add(new Property("note", "Annotation", "Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear.", 0, java.lang.Integer.MAX_VALUE, note));
1914      }
1915
1916      @Override
1917      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1918        switch (_hash) {
1919        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this clinical impression by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
1920        case -892481550: /*status*/  return new Property("status", "code", "Identifies the workflow status of the assessment.", 0, 1, status);
1921        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the ClinicalImpression.", 0, 1, statusReason);
1922        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Categorizes the type of clinical assessment performed.", 0, 1, code);
1923        case -1724546052: /*description*/  return new Property("description", "string", "A summary of the context and/or cause of the assessment - why / where it was performed, and what patient events/status prompted it.", 0, 1, description);
1924        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The patient or group of individuals assessed as part of this record.", 0, 1, subject);
1925        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which this ClinicalImpression was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
1926        case 247104889: /*effective[x]*/  return new Property("effective[x]", "dateTime|Period", "The point in time or period over which the subject was assessed.", 0, 1, effective);
1927        case -1468651097: /*effective*/  return new Property("effective[x]", "dateTime|Period", "The point in time or period over which the subject was assessed.", 0, 1, effective);
1928        case -275306910: /*effectiveDateTime*/  return new Property("effective[x]", "dateTime|Period", "The point in time or period over which the subject was assessed.", 0, 1, effective);
1929        case -403934648: /*effectivePeriod*/  return new Property("effective[x]", "dateTime|Period", "The point in time or period over which the subject was assessed.", 0, 1, effective);
1930        case 3076014: /*date*/  return new Property("date", "dateTime", "Indicates when the documentation of the assessment was complete.", 0, 1, date);
1931        case -373213113: /*assessor*/  return new Property("assessor", "Reference(Practitioner|PractitionerRole)", "The clinician performing the assessment.", 0, 1, assessor);
1932        case -1273775369: /*previous*/  return new Property("previous", "Reference(ClinicalImpression)", "A reference to the last assessment that was conducted on this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.", 0, 1, previous);
1933        case -309542241: /*problem*/  return new Property("problem", "Reference(Condition|AllergyIntolerance)", "A list of the relevant problems/conditions for a patient.", 0, java.lang.Integer.MAX_VALUE, problem);
1934        case 956015362: /*investigation*/  return new Property("investigation", "", "One or more sets of investigations (signs, symptoms, etc.). The actual grouping of investigations varies greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes.", 0, java.lang.Integer.MAX_VALUE, investigation);
1935        case -989163880: /*protocol*/  return new Property("protocol", "uri", "Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.", 0, java.lang.Integer.MAX_VALUE, protocol);
1936        case -1857640538: /*summary*/  return new Property("summary", "string", "A text summary of the investigations and the diagnosis.", 0, 1, summary);
1937        case -853173367: /*finding*/  return new Property("finding", "", "Specific findings or diagnoses that were considered likely or relevant to ongoing treatment.", 0, java.lang.Integer.MAX_VALUE, finding);
1938        case -676337953: /*prognosisCodeableConcept*/  return new Property("prognosisCodeableConcept", "CodeableConcept", "Estimate of likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosisCodeableConcept);
1939        case -587137783: /*prognosisReference*/  return new Property("prognosisReference", "Reference(RiskAssessment)", "RiskAssessment expressing likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosisReference);
1940        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Information supporting the clinical impression.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
1941        case 3387378: /*note*/  return new Property("note", "Annotation", "Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear.", 0, java.lang.Integer.MAX_VALUE, note);
1942        default: return super.getNamedProperty(_hash, _name, _checkValid);
1943        }
1944
1945      }
1946
1947      @Override
1948      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1949        switch (hash) {
1950        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1951        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ClinicalImpressionStatus>
1952        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
1953        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1954        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1955        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1956        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1957        case -1468651097: /*effective*/ return this.effective == null ? new Base[0] : new Base[] {this.effective}; // Type
1958        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1959        case -373213113: /*assessor*/ return this.assessor == null ? new Base[0] : new Base[] {this.assessor}; // Reference
1960        case -1273775369: /*previous*/ return this.previous == null ? new Base[0] : new Base[] {this.previous}; // Reference
1961        case -309542241: /*problem*/ return this.problem == null ? new Base[0] : this.problem.toArray(new Base[this.problem.size()]); // Reference
1962        case 956015362: /*investigation*/ return this.investigation == null ? new Base[0] : this.investigation.toArray(new Base[this.investigation.size()]); // ClinicalImpressionInvestigationComponent
1963        case -989163880: /*protocol*/ return this.protocol == null ? new Base[0] : this.protocol.toArray(new Base[this.protocol.size()]); // UriType
1964        case -1857640538: /*summary*/ return this.summary == null ? new Base[0] : new Base[] {this.summary}; // StringType
1965        case -853173367: /*finding*/ return this.finding == null ? new Base[0] : this.finding.toArray(new Base[this.finding.size()]); // ClinicalImpressionFindingComponent
1966        case -676337953: /*prognosisCodeableConcept*/ return this.prognosisCodeableConcept == null ? new Base[0] : this.prognosisCodeableConcept.toArray(new Base[this.prognosisCodeableConcept.size()]); // CodeableConcept
1967        case -587137783: /*prognosisReference*/ return this.prognosisReference == null ? new Base[0] : this.prognosisReference.toArray(new Base[this.prognosisReference.size()]); // Reference
1968        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
1969        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1970        default: return super.getProperty(hash, name, checkValid);
1971        }
1972
1973      }
1974
1975      @Override
1976      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1977        switch (hash) {
1978        case -1618432855: // identifier
1979          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1980          return value;
1981        case -892481550: // status
1982          value = new ClinicalImpressionStatusEnumFactory().fromType(castToCode(value));
1983          this.status = (Enumeration) value; // Enumeration<ClinicalImpressionStatus>
1984          return value;
1985        case 2051346646: // statusReason
1986          this.statusReason = castToCodeableConcept(value); // CodeableConcept
1987          return value;
1988        case 3059181: // code
1989          this.code = castToCodeableConcept(value); // CodeableConcept
1990          return value;
1991        case -1724546052: // description
1992          this.description = castToString(value); // StringType
1993          return value;
1994        case -1867885268: // subject
1995          this.subject = castToReference(value); // Reference
1996          return value;
1997        case 1524132147: // encounter
1998          this.encounter = castToReference(value); // Reference
1999          return value;
2000        case -1468651097: // effective
2001          this.effective = castToType(value); // Type
2002          return value;
2003        case 3076014: // date
2004          this.date = castToDateTime(value); // DateTimeType
2005          return value;
2006        case -373213113: // assessor
2007          this.assessor = castToReference(value); // Reference
2008          return value;
2009        case -1273775369: // previous
2010          this.previous = castToReference(value); // Reference
2011          return value;
2012        case -309542241: // problem
2013          this.getProblem().add(castToReference(value)); // Reference
2014          return value;
2015        case 956015362: // investigation
2016          this.getInvestigation().add((ClinicalImpressionInvestigationComponent) value); // ClinicalImpressionInvestigationComponent
2017          return value;
2018        case -989163880: // protocol
2019          this.getProtocol().add(castToUri(value)); // UriType
2020          return value;
2021        case -1857640538: // summary
2022          this.summary = castToString(value); // StringType
2023          return value;
2024        case -853173367: // finding
2025          this.getFinding().add((ClinicalImpressionFindingComponent) value); // ClinicalImpressionFindingComponent
2026          return value;
2027        case -676337953: // prognosisCodeableConcept
2028          this.getPrognosisCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept
2029          return value;
2030        case -587137783: // prognosisReference
2031          this.getPrognosisReference().add(castToReference(value)); // Reference
2032          return value;
2033        case 1922406657: // supportingInfo
2034          this.getSupportingInfo().add(castToReference(value)); // Reference
2035          return value;
2036        case 3387378: // note
2037          this.getNote().add(castToAnnotation(value)); // Annotation
2038          return value;
2039        default: return super.setProperty(hash, name, value);
2040        }
2041
2042      }
2043
2044      @Override
2045      public Base setProperty(String name, Base value) throws FHIRException {
2046        if (name.equals("identifier")) {
2047          this.getIdentifier().add(castToIdentifier(value));
2048        } else if (name.equals("status")) {
2049          value = new ClinicalImpressionStatusEnumFactory().fromType(castToCode(value));
2050          this.status = (Enumeration) value; // Enumeration<ClinicalImpressionStatus>
2051        } else if (name.equals("statusReason")) {
2052          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2053        } else if (name.equals("code")) {
2054          this.code = castToCodeableConcept(value); // CodeableConcept
2055        } else if (name.equals("description")) {
2056          this.description = castToString(value); // StringType
2057        } else if (name.equals("subject")) {
2058          this.subject = castToReference(value); // Reference
2059        } else if (name.equals("encounter")) {
2060          this.encounter = castToReference(value); // Reference
2061        } else if (name.equals("effective[x]")) {
2062          this.effective = castToType(value); // Type
2063        } else if (name.equals("date")) {
2064          this.date = castToDateTime(value); // DateTimeType
2065        } else if (name.equals("assessor")) {
2066          this.assessor = castToReference(value); // Reference
2067        } else if (name.equals("previous")) {
2068          this.previous = castToReference(value); // Reference
2069        } else if (name.equals("problem")) {
2070          this.getProblem().add(castToReference(value));
2071        } else if (name.equals("investigation")) {
2072          this.getInvestigation().add((ClinicalImpressionInvestigationComponent) value);
2073        } else if (name.equals("protocol")) {
2074          this.getProtocol().add(castToUri(value));
2075        } else if (name.equals("summary")) {
2076          this.summary = castToString(value); // StringType
2077        } else if (name.equals("finding")) {
2078          this.getFinding().add((ClinicalImpressionFindingComponent) value);
2079        } else if (name.equals("prognosisCodeableConcept")) {
2080          this.getPrognosisCodeableConcept().add(castToCodeableConcept(value));
2081        } else if (name.equals("prognosisReference")) {
2082          this.getPrognosisReference().add(castToReference(value));
2083        } else if (name.equals("supportingInfo")) {
2084          this.getSupportingInfo().add(castToReference(value));
2085        } else if (name.equals("note")) {
2086          this.getNote().add(castToAnnotation(value));
2087        } else
2088          return super.setProperty(name, value);
2089        return value;
2090      }
2091
2092      @Override
2093      public Base makeProperty(int hash, String name) throws FHIRException {
2094        switch (hash) {
2095        case -1618432855:  return addIdentifier(); 
2096        case -892481550:  return getStatusElement();
2097        case 2051346646:  return getStatusReason(); 
2098        case 3059181:  return getCode(); 
2099        case -1724546052:  return getDescriptionElement();
2100        case -1867885268:  return getSubject(); 
2101        case 1524132147:  return getEncounter(); 
2102        case 247104889:  return getEffective(); 
2103        case -1468651097:  return getEffective(); 
2104        case 3076014:  return getDateElement();
2105        case -373213113:  return getAssessor(); 
2106        case -1273775369:  return getPrevious(); 
2107        case -309542241:  return addProblem(); 
2108        case 956015362:  return addInvestigation(); 
2109        case -989163880:  return addProtocolElement();
2110        case -1857640538:  return getSummaryElement();
2111        case -853173367:  return addFinding(); 
2112        case -676337953:  return addPrognosisCodeableConcept(); 
2113        case -587137783:  return addPrognosisReference(); 
2114        case 1922406657:  return addSupportingInfo(); 
2115        case 3387378:  return addNote(); 
2116        default: return super.makeProperty(hash, name);
2117        }
2118
2119      }
2120
2121      @Override
2122      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2123        switch (hash) {
2124        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2125        case -892481550: /*status*/ return new String[] {"code"};
2126        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2127        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2128        case -1724546052: /*description*/ return new String[] {"string"};
2129        case -1867885268: /*subject*/ return new String[] {"Reference"};
2130        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2131        case -1468651097: /*effective*/ return new String[] {"dateTime", "Period"};
2132        case 3076014: /*date*/ return new String[] {"dateTime"};
2133        case -373213113: /*assessor*/ return new String[] {"Reference"};
2134        case -1273775369: /*previous*/ return new String[] {"Reference"};
2135        case -309542241: /*problem*/ return new String[] {"Reference"};
2136        case 956015362: /*investigation*/ return new String[] {};
2137        case -989163880: /*protocol*/ return new String[] {"uri"};
2138        case -1857640538: /*summary*/ return new String[] {"string"};
2139        case -853173367: /*finding*/ return new String[] {};
2140        case -676337953: /*prognosisCodeableConcept*/ return new String[] {"CodeableConcept"};
2141        case -587137783: /*prognosisReference*/ return new String[] {"Reference"};
2142        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
2143        case 3387378: /*note*/ return new String[] {"Annotation"};
2144        default: return super.getTypesForProperty(hash, name);
2145        }
2146
2147      }
2148
2149      @Override
2150      public Base addChild(String name) throws FHIRException {
2151        if (name.equals("identifier")) {
2152          return addIdentifier();
2153        }
2154        else if (name.equals("status")) {
2155          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.status");
2156        }
2157        else if (name.equals("statusReason")) {
2158          this.statusReason = new CodeableConcept();
2159          return this.statusReason;
2160        }
2161        else if (name.equals("code")) {
2162          this.code = new CodeableConcept();
2163          return this.code;
2164        }
2165        else if (name.equals("description")) {
2166          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.description");
2167        }
2168        else if (name.equals("subject")) {
2169          this.subject = new Reference();
2170          return this.subject;
2171        }
2172        else if (name.equals("encounter")) {
2173          this.encounter = new Reference();
2174          return this.encounter;
2175        }
2176        else if (name.equals("effectiveDateTime")) {
2177          this.effective = new DateTimeType();
2178          return this.effective;
2179        }
2180        else if (name.equals("effectivePeriod")) {
2181          this.effective = new Period();
2182          return this.effective;
2183        }
2184        else if (name.equals("date")) {
2185          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.date");
2186        }
2187        else if (name.equals("assessor")) {
2188          this.assessor = new Reference();
2189          return this.assessor;
2190        }
2191        else if (name.equals("previous")) {
2192          this.previous = new Reference();
2193          return this.previous;
2194        }
2195        else if (name.equals("problem")) {
2196          return addProblem();
2197        }
2198        else if (name.equals("investigation")) {
2199          return addInvestigation();
2200        }
2201        else if (name.equals("protocol")) {
2202          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.protocol");
2203        }
2204        else if (name.equals("summary")) {
2205          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.summary");
2206        }
2207        else if (name.equals("finding")) {
2208          return addFinding();
2209        }
2210        else if (name.equals("prognosisCodeableConcept")) {
2211          return addPrognosisCodeableConcept();
2212        }
2213        else if (name.equals("prognosisReference")) {
2214          return addPrognosisReference();
2215        }
2216        else if (name.equals("supportingInfo")) {
2217          return addSupportingInfo();
2218        }
2219        else if (name.equals("note")) {
2220          return addNote();
2221        }
2222        else
2223          return super.addChild(name);
2224      }
2225
2226  public String fhirType() {
2227    return "ClinicalImpression";
2228
2229  }
2230
2231      public ClinicalImpression copy() {
2232        ClinicalImpression dst = new ClinicalImpression();
2233        copyValues(dst);
2234        return dst;
2235      }
2236
2237      public void copyValues(ClinicalImpression dst) {
2238        super.copyValues(dst);
2239        if (identifier != null) {
2240          dst.identifier = new ArrayList<Identifier>();
2241          for (Identifier i : identifier)
2242            dst.identifier.add(i.copy());
2243        };
2244        dst.status = status == null ? null : status.copy();
2245        dst.statusReason = statusReason == null ? null : statusReason.copy();
2246        dst.code = code == null ? null : code.copy();
2247        dst.description = description == null ? null : description.copy();
2248        dst.subject = subject == null ? null : subject.copy();
2249        dst.encounter = encounter == null ? null : encounter.copy();
2250        dst.effective = effective == null ? null : effective.copy();
2251        dst.date = date == null ? null : date.copy();
2252        dst.assessor = assessor == null ? null : assessor.copy();
2253        dst.previous = previous == null ? null : previous.copy();
2254        if (problem != null) {
2255          dst.problem = new ArrayList<Reference>();
2256          for (Reference i : problem)
2257            dst.problem.add(i.copy());
2258        };
2259        if (investigation != null) {
2260          dst.investigation = new ArrayList<ClinicalImpressionInvestigationComponent>();
2261          for (ClinicalImpressionInvestigationComponent i : investigation)
2262            dst.investigation.add(i.copy());
2263        };
2264        if (protocol != null) {
2265          dst.protocol = new ArrayList<UriType>();
2266          for (UriType i : protocol)
2267            dst.protocol.add(i.copy());
2268        };
2269        dst.summary = summary == null ? null : summary.copy();
2270        if (finding != null) {
2271          dst.finding = new ArrayList<ClinicalImpressionFindingComponent>();
2272          for (ClinicalImpressionFindingComponent i : finding)
2273            dst.finding.add(i.copy());
2274        };
2275        if (prognosisCodeableConcept != null) {
2276          dst.prognosisCodeableConcept = new ArrayList<CodeableConcept>();
2277          for (CodeableConcept i : prognosisCodeableConcept)
2278            dst.prognosisCodeableConcept.add(i.copy());
2279        };
2280        if (prognosisReference != null) {
2281          dst.prognosisReference = new ArrayList<Reference>();
2282          for (Reference i : prognosisReference)
2283            dst.prognosisReference.add(i.copy());
2284        };
2285        if (supportingInfo != null) {
2286          dst.supportingInfo = new ArrayList<Reference>();
2287          for (Reference i : supportingInfo)
2288            dst.supportingInfo.add(i.copy());
2289        };
2290        if (note != null) {
2291          dst.note = new ArrayList<Annotation>();
2292          for (Annotation i : note)
2293            dst.note.add(i.copy());
2294        };
2295      }
2296
2297      protected ClinicalImpression typedCopy() {
2298        return copy();
2299      }
2300
2301      @Override
2302      public boolean equalsDeep(Base other_) {
2303        if (!super.equalsDeep(other_))
2304          return false;
2305        if (!(other_ instanceof ClinicalImpression))
2306          return false;
2307        ClinicalImpression o = (ClinicalImpression) other_;
2308        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
2309           && compareDeep(code, o.code, true) && compareDeep(description, o.description, true) && compareDeep(subject, o.subject, true)
2310           && compareDeep(encounter, o.encounter, true) && compareDeep(effective, o.effective, true) && compareDeep(date, o.date, true)
2311           && compareDeep(assessor, o.assessor, true) && compareDeep(previous, o.previous, true) && compareDeep(problem, o.problem, true)
2312           && compareDeep(investigation, o.investigation, true) && compareDeep(protocol, o.protocol, true)
2313           && compareDeep(summary, o.summary, true) && compareDeep(finding, o.finding, true) && compareDeep(prognosisCodeableConcept, o.prognosisCodeableConcept, true)
2314           && compareDeep(prognosisReference, o.prognosisReference, true) && compareDeep(supportingInfo, o.supportingInfo, true)
2315           && compareDeep(note, o.note, true);
2316      }
2317
2318      @Override
2319      public boolean equalsShallow(Base other_) {
2320        if (!super.equalsShallow(other_))
2321          return false;
2322        if (!(other_ instanceof ClinicalImpression))
2323          return false;
2324        ClinicalImpression o = (ClinicalImpression) other_;
2325        return compareValues(status, o.status, true) && compareValues(description, o.description, true) && compareValues(date, o.date, true)
2326           && compareValues(protocol, o.protocol, true) && compareValues(summary, o.summary, true);
2327      }
2328
2329      public boolean isEmpty() {
2330        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusReason
2331          , code, description, subject, encounter, effective, date, assessor, previous
2332          , problem, investigation, protocol, summary, finding, prognosisCodeableConcept, prognosisReference
2333          , supportingInfo, note);
2334      }
2335
2336  @Override
2337  public ResourceType getResourceType() {
2338    return ResourceType.ClinicalImpression;
2339   }
2340
2341 /**
2342   * Search parameter: <b>date</b>
2343   * <p>
2344   * Description: <b>When the assessment was documented</b><br>
2345   * Type: <b>date</b><br>
2346   * Path: <b>ClinicalImpression.date</b><br>
2347   * </p>
2348   */
2349  @SearchParamDefinition(name="date", path="ClinicalImpression.date", description="When the assessment was documented", type="date" )
2350  public static final String SP_DATE = "date";
2351 /**
2352   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2353   * <p>
2354   * Description: <b>When the assessment was documented</b><br>
2355   * Type: <b>date</b><br>
2356   * Path: <b>ClinicalImpression.date</b><br>
2357   * </p>
2358   */
2359  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2360
2361 /**
2362   * Search parameter: <b>identifier</b>
2363   * <p>
2364   * Description: <b>Business identifier</b><br>
2365   * Type: <b>token</b><br>
2366   * Path: <b>ClinicalImpression.identifier</b><br>
2367   * </p>
2368   */
2369  @SearchParamDefinition(name="identifier", path="ClinicalImpression.identifier", description="Business identifier", type="token" )
2370  public static final String SP_IDENTIFIER = "identifier";
2371 /**
2372   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2373   * <p>
2374   * Description: <b>Business identifier</b><br>
2375   * Type: <b>token</b><br>
2376   * Path: <b>ClinicalImpression.identifier</b><br>
2377   * </p>
2378   */
2379  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2380
2381 /**
2382   * Search parameter: <b>previous</b>
2383   * <p>
2384   * Description: <b>Reference to last assessment</b><br>
2385   * Type: <b>reference</b><br>
2386   * Path: <b>ClinicalImpression.previous</b><br>
2387   * </p>
2388   */
2389  @SearchParamDefinition(name="previous", path="ClinicalImpression.previous", description="Reference to last assessment", type="reference", target={ClinicalImpression.class } )
2390  public static final String SP_PREVIOUS = "previous";
2391 /**
2392   * <b>Fluent Client</b> search parameter constant for <b>previous</b>
2393   * <p>
2394   * Description: <b>Reference to last assessment</b><br>
2395   * Type: <b>reference</b><br>
2396   * Path: <b>ClinicalImpression.previous</b><br>
2397   * </p>
2398   */
2399  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PREVIOUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PREVIOUS);
2400
2401/**
2402   * Constant for fluent queries to be used to add include statements. Specifies
2403   * the path value of "<b>ClinicalImpression:previous</b>".
2404   */
2405  public static final ca.uhn.fhir.model.api.Include INCLUDE_PREVIOUS = new ca.uhn.fhir.model.api.Include("ClinicalImpression:previous").toLocked();
2406
2407 /**
2408   * Search parameter: <b>finding-code</b>
2409   * <p>
2410   * Description: <b>What was found</b><br>
2411   * Type: <b>token</b><br>
2412   * Path: <b>ClinicalImpression.finding.itemCodeableConcept</b><br>
2413   * </p>
2414   */
2415  @SearchParamDefinition(name="finding-code", path="ClinicalImpression.finding.itemCodeableConcept", description="What was found", type="token" )
2416  public static final String SP_FINDING_CODE = "finding-code";
2417 /**
2418   * <b>Fluent Client</b> search parameter constant for <b>finding-code</b>
2419   * <p>
2420   * Description: <b>What was found</b><br>
2421   * Type: <b>token</b><br>
2422   * Path: <b>ClinicalImpression.finding.itemCodeableConcept</b><br>
2423   * </p>
2424   */
2425  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FINDING_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FINDING_CODE);
2426
2427 /**
2428   * Search parameter: <b>assessor</b>
2429   * <p>
2430   * Description: <b>The clinician performing the assessment</b><br>
2431   * Type: <b>reference</b><br>
2432   * Path: <b>ClinicalImpression.assessor</b><br>
2433   * </p>
2434   */
2435  @SearchParamDefinition(name="assessor", path="ClinicalImpression.assessor", description="The clinician performing the assessment", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
2436  public static final String SP_ASSESSOR = "assessor";
2437 /**
2438   * <b>Fluent Client</b> search parameter constant for <b>assessor</b>
2439   * <p>
2440   * Description: <b>The clinician performing the assessment</b><br>
2441   * Type: <b>reference</b><br>
2442   * Path: <b>ClinicalImpression.assessor</b><br>
2443   * </p>
2444   */
2445  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ASSESSOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ASSESSOR);
2446
2447/**
2448   * Constant for fluent queries to be used to add include statements. Specifies
2449   * the path value of "<b>ClinicalImpression:assessor</b>".
2450   */
2451  public static final ca.uhn.fhir.model.api.Include INCLUDE_ASSESSOR = new ca.uhn.fhir.model.api.Include("ClinicalImpression:assessor").toLocked();
2452
2453 /**
2454   * Search parameter: <b>subject</b>
2455   * <p>
2456   * Description: <b>Patient or group assessed</b><br>
2457   * Type: <b>reference</b><br>
2458   * Path: <b>ClinicalImpression.subject</b><br>
2459   * </p>
2460   */
2461  @SearchParamDefinition(name="subject", path="ClinicalImpression.subject", description="Patient or group assessed", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } )
2462  public static final String SP_SUBJECT = "subject";
2463 /**
2464   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2465   * <p>
2466   * Description: <b>Patient or group assessed</b><br>
2467   * Type: <b>reference</b><br>
2468   * Path: <b>ClinicalImpression.subject</b><br>
2469   * </p>
2470   */
2471  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2472
2473/**
2474   * Constant for fluent queries to be used to add include statements. Specifies
2475   * the path value of "<b>ClinicalImpression:subject</b>".
2476   */
2477  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ClinicalImpression:subject").toLocked();
2478
2479 /**
2480   * Search parameter: <b>encounter</b>
2481   * <p>
2482   * Description: <b>Encounter created as part of</b><br>
2483   * Type: <b>reference</b><br>
2484   * Path: <b>ClinicalImpression.encounter</b><br>
2485   * </p>
2486   */
2487  @SearchParamDefinition(name="encounter", path="ClinicalImpression.encounter", description="Encounter created as part of", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
2488  public static final String SP_ENCOUNTER = "encounter";
2489 /**
2490   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2491   * <p>
2492   * Description: <b>Encounter created as part of</b><br>
2493   * Type: <b>reference</b><br>
2494   * Path: <b>ClinicalImpression.encounter</b><br>
2495   * </p>
2496   */
2497  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2498
2499/**
2500   * Constant for fluent queries to be used to add include statements. Specifies
2501   * the path value of "<b>ClinicalImpression:encounter</b>".
2502   */
2503  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ClinicalImpression:encounter").toLocked();
2504
2505 /**
2506   * Search parameter: <b>finding-ref</b>
2507   * <p>
2508   * Description: <b>What was found</b><br>
2509   * Type: <b>reference</b><br>
2510   * Path: <b>ClinicalImpression.finding.itemReference</b><br>
2511   * </p>
2512   */
2513  @SearchParamDefinition(name="finding-ref", path="ClinicalImpression.finding.itemReference", description="What was found", type="reference", target={Condition.class, Media.class, Observation.class } )
2514  public static final String SP_FINDING_REF = "finding-ref";
2515 /**
2516   * <b>Fluent Client</b> search parameter constant for <b>finding-ref</b>
2517   * <p>
2518   * Description: <b>What was found</b><br>
2519   * Type: <b>reference</b><br>
2520   * Path: <b>ClinicalImpression.finding.itemReference</b><br>
2521   * </p>
2522   */
2523  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FINDING_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FINDING_REF);
2524
2525/**
2526   * Constant for fluent queries to be used to add include statements. Specifies
2527   * the path value of "<b>ClinicalImpression:finding-ref</b>".
2528   */
2529  public static final ca.uhn.fhir.model.api.Include INCLUDE_FINDING_REF = new ca.uhn.fhir.model.api.Include("ClinicalImpression:finding-ref").toLocked();
2530
2531 /**
2532   * Search parameter: <b>problem</b>
2533   * <p>
2534   * Description: <b>Relevant impressions of patient state</b><br>
2535   * Type: <b>reference</b><br>
2536   * Path: <b>ClinicalImpression.problem</b><br>
2537   * </p>
2538   */
2539  @SearchParamDefinition(name="problem", path="ClinicalImpression.problem", description="Relevant impressions of patient state", type="reference", target={AllergyIntolerance.class, Condition.class } )
2540  public static final String SP_PROBLEM = "problem";
2541 /**
2542   * <b>Fluent Client</b> search parameter constant for <b>problem</b>
2543   * <p>
2544   * Description: <b>Relevant impressions of patient state</b><br>
2545   * Type: <b>reference</b><br>
2546   * Path: <b>ClinicalImpression.problem</b><br>
2547   * </p>
2548   */
2549  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROBLEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROBLEM);
2550
2551/**
2552   * Constant for fluent queries to be used to add include statements. Specifies
2553   * the path value of "<b>ClinicalImpression:problem</b>".
2554   */
2555  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROBLEM = new ca.uhn.fhir.model.api.Include("ClinicalImpression:problem").toLocked();
2556
2557 /**
2558   * Search parameter: <b>patient</b>
2559   * <p>
2560   * Description: <b>Patient or group assessed</b><br>
2561   * Type: <b>reference</b><br>
2562   * Path: <b>ClinicalImpression.subject</b><br>
2563   * </p>
2564   */
2565  @SearchParamDefinition(name="patient", path="ClinicalImpression.subject.where(resolve() is Patient)", description="Patient or group assessed", type="reference", target={Patient.class } )
2566  public static final String SP_PATIENT = "patient";
2567 /**
2568   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2569   * <p>
2570   * Description: <b>Patient or group assessed</b><br>
2571   * Type: <b>reference</b><br>
2572   * Path: <b>ClinicalImpression.subject</b><br>
2573   * </p>
2574   */
2575  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2576
2577/**
2578   * Constant for fluent queries to be used to add include statements. Specifies
2579   * the path value of "<b>ClinicalImpression:patient</b>".
2580   */
2581  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ClinicalImpression:patient").toLocked();
2582
2583 /**
2584   * Search parameter: <b>supporting-info</b>
2585   * <p>
2586   * Description: <b>Information supporting the clinical impression</b><br>
2587   * Type: <b>reference</b><br>
2588   * Path: <b>ClinicalImpression.supportingInfo</b><br>
2589   * </p>
2590   */
2591  @SearchParamDefinition(name="supporting-info", path="ClinicalImpression.supportingInfo", description="Information supporting the clinical impression", type="reference" )
2592  public static final String SP_SUPPORTING_INFO = "supporting-info";
2593 /**
2594   * <b>Fluent Client</b> search parameter constant for <b>supporting-info</b>
2595   * <p>
2596   * Description: <b>Information supporting the clinical impression</b><br>
2597   * Type: <b>reference</b><br>
2598   * Path: <b>ClinicalImpression.supportingInfo</b><br>
2599   * </p>
2600   */
2601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPORTING_INFO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPORTING_INFO);
2602
2603/**
2604   * Constant for fluent queries to be used to add include statements. Specifies
2605   * the path value of "<b>ClinicalImpression:supporting-info</b>".
2606   */
2607  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPORTING_INFO = new ca.uhn.fhir.model.api.Include("ClinicalImpression:supporting-info").toLocked();
2608
2609 /**
2610   * Search parameter: <b>investigation</b>
2611   * <p>
2612   * Description: <b>Record of a specific investigation</b><br>
2613   * Type: <b>reference</b><br>
2614   * Path: <b>ClinicalImpression.investigation.item</b><br>
2615   * </p>
2616   */
2617  @SearchParamDefinition(name="investigation", path="ClinicalImpression.investigation.item", description="Record of a specific investigation", type="reference", target={DiagnosticReport.class, FamilyMemberHistory.class, ImagingStudy.class, Media.class, Observation.class, QuestionnaireResponse.class, RiskAssessment.class } )
2618  public static final String SP_INVESTIGATION = "investigation";
2619 /**
2620   * <b>Fluent Client</b> search parameter constant for <b>investigation</b>
2621   * <p>
2622   * Description: <b>Record of a specific investigation</b><br>
2623   * Type: <b>reference</b><br>
2624   * Path: <b>ClinicalImpression.investigation.item</b><br>
2625   * </p>
2626   */
2627  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INVESTIGATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INVESTIGATION);
2628
2629/**
2630   * Constant for fluent queries to be used to add include statements. Specifies
2631   * the path value of "<b>ClinicalImpression:investigation</b>".
2632   */
2633  public static final ca.uhn.fhir.model.api.Include INCLUDE_INVESTIGATION = new ca.uhn.fhir.model.api.Include("ClinicalImpression:investigation").toLocked();
2634
2635 /**
2636   * Search parameter: <b>status</b>
2637   * <p>
2638   * Description: <b>in-progress | completed | entered-in-error</b><br>
2639   * Type: <b>token</b><br>
2640   * Path: <b>ClinicalImpression.status</b><br>
2641   * </p>
2642   */
2643  @SearchParamDefinition(name="status", path="ClinicalImpression.status", description="in-progress | completed | entered-in-error", type="token" )
2644  public static final String SP_STATUS = "status";
2645 /**
2646   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2647   * <p>
2648   * Description: <b>in-progress | completed | entered-in-error</b><br>
2649   * Type: <b>token</b><br>
2650   * Path: <b>ClinicalImpression.status</b><br>
2651   * </p>
2652   */
2653  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2654
2655
2656}