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