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