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