001package org.hl7.fhir.instance.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * 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.
042 */
043@ResourceDef(name="ClinicalImpression", profile="http://hl7.org/fhir/Profile/ClinicalImpression")
044public class ClinicalImpression extends DomainResource {
045
046    public enum ClinicalImpressionStatus {
047        /**
048         * The assessment is still on-going and results are not yet final.
049         */
050        INPROGRESS, 
051        /**
052         * The assessment is done and the results are final.
053         */
054        COMPLETED, 
055        /**
056         * This assessment was never actually done and the record is erroneous (e.g. Wrong patient).
057         */
058        ENTEREDINERROR, 
059        /**
060         * added to help the parsers
061         */
062        NULL;
063        public static ClinicalImpressionStatus fromCode(String codeString) throws FHIRException {
064            if (codeString == null || "".equals(codeString))
065                return null;
066        if ("in-progress".equals(codeString))
067          return INPROGRESS;
068        if ("completed".equals(codeString))
069          return COMPLETED;
070        if ("entered-in-error".equals(codeString))
071          return ENTEREDINERROR;
072        throw new FHIRException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
073        }
074        public String toCode() {
075          switch (this) {
076            case INPROGRESS: return "in-progress";
077            case COMPLETED: return "completed";
078            case ENTEREDINERROR: return "entered-in-error";
079            default: return "?";
080          }
081        }
082        public String getSystem() {
083          switch (this) {
084            case INPROGRESS: return "http://hl7.org/fhir/clinical-impression-status";
085            case COMPLETED: return "http://hl7.org/fhir/clinical-impression-status";
086            case ENTEREDINERROR: return "http://hl7.org/fhir/clinical-impression-status";
087            default: return "?";
088          }
089        }
090        public String getDefinition() {
091          switch (this) {
092            case INPROGRESS: return "The assessment is still on-going and results are not yet final.";
093            case COMPLETED: return "The assessment is done and the results are final.";
094            case ENTEREDINERROR: return "This assessment was never actually done and the record is erroneous (e.g. Wrong patient).";
095            default: return "?";
096          }
097        }
098        public String getDisplay() {
099          switch (this) {
100            case INPROGRESS: return "In progress";
101            case COMPLETED: return "Completed";
102            case ENTEREDINERROR: return "Entered in Error";
103            default: return "?";
104          }
105        }
106    }
107
108  public static class ClinicalImpressionStatusEnumFactory implements EnumFactory<ClinicalImpressionStatus> {
109    public ClinicalImpressionStatus fromCode(String codeString) throws IllegalArgumentException {
110      if (codeString == null || "".equals(codeString))
111            if (codeString == null || "".equals(codeString))
112                return null;
113        if ("in-progress".equals(codeString))
114          return ClinicalImpressionStatus.INPROGRESS;
115        if ("completed".equals(codeString))
116          return ClinicalImpressionStatus.COMPLETED;
117        if ("entered-in-error".equals(codeString))
118          return ClinicalImpressionStatus.ENTEREDINERROR;
119        throw new IllegalArgumentException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
120        }
121        public Enumeration<ClinicalImpressionStatus> fromType(Base code) throws FHIRException {
122          if (code == null || code.isEmpty())
123            return null;
124          String codeString = ((PrimitiveType) code).asStringValue();
125          if (codeString == null || "".equals(codeString))
126            return null;
127        if ("in-progress".equals(codeString))
128          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.INPROGRESS);
129        if ("completed".equals(codeString))
130          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.COMPLETED);
131        if ("entered-in-error".equals(codeString))
132          return new Enumeration<ClinicalImpressionStatus>(this, ClinicalImpressionStatus.ENTEREDINERROR);
133        throw new FHIRException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
134        }
135    public String toCode(ClinicalImpressionStatus code) {
136      if (code == ClinicalImpressionStatus.INPROGRESS)
137        return "in-progress";
138      if (code == ClinicalImpressionStatus.COMPLETED)
139        return "completed";
140      if (code == ClinicalImpressionStatus.ENTEREDINERROR)
141        return "entered-in-error";
142      return "?";
143      }
144    }
145
146    @Block()
147    public static class ClinicalImpressionInvestigationsComponent extends BackboneElement implements IBaseBackboneElement {
148        /**
149         * 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|nutitirional) history may be used.
150         */
151        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
152        @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|nutitirional) history may be used." )
153        protected CodeableConcept code;
154
155        /**
156         * A record of a specific investigation that was undertaken.
157         */
158        @Child(name = "item", type = {Observation.class, QuestionnaireResponse.class, FamilyMemberHistory.class, DiagnosticReport.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
159        @Description(shortDefinition="Record of a specific investigation", formalDefinition="A record of a specific investigation that was undertaken." )
160        protected List<Reference> item;
161        /**
162         * The actual objects that are the target of the reference (A record of a specific investigation that was undertaken.)
163         */
164        protected List<Resource> itemTarget;
165
166
167        private static final long serialVersionUID = -301363326L;
168
169    /*
170     * Constructor
171     */
172      public ClinicalImpressionInvestigationsComponent() {
173        super();
174      }
175
176    /*
177     * Constructor
178     */
179      public ClinicalImpressionInvestigationsComponent(CodeableConcept code) {
180        super();
181        this.code = code;
182      }
183
184        /**
185         * @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|nutitirional) history may be used.)
186         */
187        public CodeableConcept getCode() { 
188          if (this.code == null)
189            if (Configuration.errorOnAutoCreate())
190              throw new Error("Attempt to auto-create ClinicalImpressionInvestigationsComponent.code");
191            else if (Configuration.doAutoCreate())
192              this.code = new CodeableConcept(); // cc
193          return this.code;
194        }
195
196        public boolean hasCode() { 
197          return this.code != null && !this.code.isEmpty();
198        }
199
200        /**
201         * @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|nutitirional) history may be used.)
202         */
203        public ClinicalImpressionInvestigationsComponent setCode(CodeableConcept value) { 
204          this.code = value;
205          return this;
206        }
207
208        /**
209         * @return {@link #item} (A record of a specific investigation that was undertaken.)
210         */
211        public List<Reference> getItem() { 
212          if (this.item == null)
213            this.item = new ArrayList<Reference>();
214          return this.item;
215        }
216
217        public boolean hasItem() { 
218          if (this.item == null)
219            return false;
220          for (Reference item : this.item)
221            if (!item.isEmpty())
222              return true;
223          return false;
224        }
225
226        /**
227         * @return {@link #item} (A record of a specific investigation that was undertaken.)
228         */
229    // syntactic sugar
230        public Reference addItem() { //3
231          Reference t = new Reference();
232          if (this.item == null)
233            this.item = new ArrayList<Reference>();
234          this.item.add(t);
235          return t;
236        }
237
238    // syntactic sugar
239        public ClinicalImpressionInvestigationsComponent addItem(Reference t) { //3
240          if (t == null)
241            return this;
242          if (this.item == null)
243            this.item = new ArrayList<Reference>();
244          this.item.add(t);
245          return this;
246        }
247
248        /**
249         * @return {@link #item} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A record of a specific investigation that was undertaken.)
250         */
251        public List<Resource> getItemTarget() { 
252          if (this.itemTarget == null)
253            this.itemTarget = new ArrayList<Resource>();
254          return this.itemTarget;
255        }
256
257        protected void listChildren(List<Property> childrenList) {
258          super.listChildren(childrenList);
259          childrenList.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|nutitirional) history may be used.", 0, java.lang.Integer.MAX_VALUE, code));
260          childrenList.add(new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
261        }
262
263      @Override
264      public void setProperty(String name, Base value) throws FHIRException {
265        if (name.equals("code"))
266          this.code = castToCodeableConcept(value); // CodeableConcept
267        else if (name.equals("item"))
268          this.getItem().add(castToReference(value));
269        else
270          super.setProperty(name, value);
271      }
272
273      @Override
274      public Base addChild(String name) throws FHIRException {
275        if (name.equals("code")) {
276          this.code = new CodeableConcept();
277          return this.code;
278        }
279        else if (name.equals("item")) {
280          return addItem();
281        }
282        else
283          return super.addChild(name);
284      }
285
286      public ClinicalImpressionInvestigationsComponent copy() {
287        ClinicalImpressionInvestigationsComponent dst = new ClinicalImpressionInvestigationsComponent();
288        copyValues(dst);
289        dst.code = code == null ? null : code.copy();
290        if (item != null) {
291          dst.item = new ArrayList<Reference>();
292          for (Reference i : item)
293            dst.item.add(i.copy());
294        };
295        return dst;
296      }
297
298      @Override
299      public boolean equalsDeep(Base other) {
300        if (!super.equalsDeep(other))
301          return false;
302        if (!(other instanceof ClinicalImpressionInvestigationsComponent))
303          return false;
304        ClinicalImpressionInvestigationsComponent o = (ClinicalImpressionInvestigationsComponent) other;
305        return compareDeep(code, o.code, true) && compareDeep(item, o.item, true);
306      }
307
308      @Override
309      public boolean equalsShallow(Base other) {
310        if (!super.equalsShallow(other))
311          return false;
312        if (!(other instanceof ClinicalImpressionInvestigationsComponent))
313          return false;
314        ClinicalImpressionInvestigationsComponent o = (ClinicalImpressionInvestigationsComponent) other;
315        return true;
316      }
317
318      public boolean isEmpty() {
319        return super.isEmpty() && (code == null || code.isEmpty()) && (item == null || item.isEmpty())
320          ;
321      }
322
323  public String fhirType() {
324    return "ClinicalImpression.investigations";
325
326  }
327
328  }
329
330    @Block()
331    public static class ClinicalImpressionFindingComponent extends BackboneElement implements IBaseBackboneElement {
332        /**
333         * Specific text of code for finding or diagnosis.
334         */
335        @Child(name = "item", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
336        @Description(shortDefinition="Specific text or code for finding", formalDefinition="Specific text of code for finding or diagnosis." )
337        protected CodeableConcept item;
338
339        /**
340         * Which investigations support finding or diagnosis.
341         */
342        @Child(name = "cause", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
343        @Description(shortDefinition="Which investigations support finding", formalDefinition="Which investigations support finding or diagnosis." )
344        protected StringType cause;
345
346        private static final long serialVersionUID = -888590978L;
347
348    /*
349     * Constructor
350     */
351      public ClinicalImpressionFindingComponent() {
352        super();
353      }
354
355    /*
356     * Constructor
357     */
358      public ClinicalImpressionFindingComponent(CodeableConcept item) {
359        super();
360        this.item = item;
361      }
362
363        /**
364         * @return {@link #item} (Specific text of code for finding or diagnosis.)
365         */
366        public CodeableConcept getItem() { 
367          if (this.item == null)
368            if (Configuration.errorOnAutoCreate())
369              throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.item");
370            else if (Configuration.doAutoCreate())
371              this.item = new CodeableConcept(); // cc
372          return this.item;
373        }
374
375        public boolean hasItem() { 
376          return this.item != null && !this.item.isEmpty();
377        }
378
379        /**
380         * @param value {@link #item} (Specific text of code for finding or diagnosis.)
381         */
382        public ClinicalImpressionFindingComponent setItem(CodeableConcept value) { 
383          this.item = value;
384          return this;
385        }
386
387        /**
388         * @return {@link #cause} (Which investigations support finding or diagnosis.). This is the underlying object with id, value and extensions. The accessor "getCause" gives direct access to the value
389         */
390        public StringType getCauseElement() { 
391          if (this.cause == null)
392            if (Configuration.errorOnAutoCreate())
393              throw new Error("Attempt to auto-create ClinicalImpressionFindingComponent.cause");
394            else if (Configuration.doAutoCreate())
395              this.cause = new StringType(); // bb
396          return this.cause;
397        }
398
399        public boolean hasCauseElement() { 
400          return this.cause != null && !this.cause.isEmpty();
401        }
402
403        public boolean hasCause() { 
404          return this.cause != null && !this.cause.isEmpty();
405        }
406
407        /**
408         * @param value {@link #cause} (Which investigations support finding or diagnosis.). This is the underlying object with id, value and extensions. The accessor "getCause" gives direct access to the value
409         */
410        public ClinicalImpressionFindingComponent setCauseElement(StringType value) { 
411          this.cause = value;
412          return this;
413        }
414
415        /**
416         * @return Which investigations support finding or diagnosis.
417         */
418        public String getCause() { 
419          return this.cause == null ? null : this.cause.getValue();
420        }
421
422        /**
423         * @param value Which investigations support finding or diagnosis.
424         */
425        public ClinicalImpressionFindingComponent setCause(String value) { 
426          if (Utilities.noString(value))
427            this.cause = null;
428          else {
429            if (this.cause == null)
430              this.cause = new StringType();
431            this.cause.setValue(value);
432          }
433          return this;
434        }
435
436        protected void listChildren(List<Property> childrenList) {
437          super.listChildren(childrenList);
438          childrenList.add(new Property("item", "CodeableConcept", "Specific text of code for finding or diagnosis.", 0, java.lang.Integer.MAX_VALUE, item));
439          childrenList.add(new Property("cause", "string", "Which investigations support finding or diagnosis.", 0, java.lang.Integer.MAX_VALUE, cause));
440        }
441
442      @Override
443      public void setProperty(String name, Base value) throws FHIRException {
444        if (name.equals("item"))
445          this.item = castToCodeableConcept(value); // CodeableConcept
446        else if (name.equals("cause"))
447          this.cause = castToString(value); // StringType
448        else
449          super.setProperty(name, value);
450      }
451
452      @Override
453      public Base addChild(String name) throws FHIRException {
454        if (name.equals("item")) {
455          this.item = new CodeableConcept();
456          return this.item;
457        }
458        else if (name.equals("cause")) {
459          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.cause");
460        }
461        else
462          return super.addChild(name);
463      }
464
465      public ClinicalImpressionFindingComponent copy() {
466        ClinicalImpressionFindingComponent dst = new ClinicalImpressionFindingComponent();
467        copyValues(dst);
468        dst.item = item == null ? null : item.copy();
469        dst.cause = cause == null ? null : cause.copy();
470        return dst;
471      }
472
473      @Override
474      public boolean equalsDeep(Base other) {
475        if (!super.equalsDeep(other))
476          return false;
477        if (!(other instanceof ClinicalImpressionFindingComponent))
478          return false;
479        ClinicalImpressionFindingComponent o = (ClinicalImpressionFindingComponent) other;
480        return compareDeep(item, o.item, true) && compareDeep(cause, o.cause, true);
481      }
482
483      @Override
484      public boolean equalsShallow(Base other) {
485        if (!super.equalsShallow(other))
486          return false;
487        if (!(other instanceof ClinicalImpressionFindingComponent))
488          return false;
489        ClinicalImpressionFindingComponent o = (ClinicalImpressionFindingComponent) other;
490        return compareValues(cause, o.cause, true);
491      }
492
493      public boolean isEmpty() {
494        return super.isEmpty() && (item == null || item.isEmpty()) && (cause == null || cause.isEmpty())
495          ;
496      }
497
498  public String fhirType() {
499    return "ClinicalImpression.finding";
500
501  }
502
503  }
504
505    @Block()
506    public static class ClinicalImpressionRuledOutComponent extends BackboneElement implements IBaseBackboneElement {
507        /**
508         * Specific text of code for diagnosis.
509         */
510        @Child(name = "item", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
511        @Description(shortDefinition="Specific text of code for diagnosis", formalDefinition="Specific text of code for diagnosis." )
512        protected CodeableConcept item;
513
514        /**
515         * Grounds for elimination.
516         */
517        @Child(name = "reason", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
518        @Description(shortDefinition="Grounds for elimination", formalDefinition="Grounds for elimination." )
519        protected StringType reason;
520
521        private static final long serialVersionUID = -1001661243L;
522
523    /*
524     * Constructor
525     */
526      public ClinicalImpressionRuledOutComponent() {
527        super();
528      }
529
530    /*
531     * Constructor
532     */
533      public ClinicalImpressionRuledOutComponent(CodeableConcept item) {
534        super();
535        this.item = item;
536      }
537
538        /**
539         * @return {@link #item} (Specific text of code for diagnosis.)
540         */
541        public CodeableConcept getItem() { 
542          if (this.item == null)
543            if (Configuration.errorOnAutoCreate())
544              throw new Error("Attempt to auto-create ClinicalImpressionRuledOutComponent.item");
545            else if (Configuration.doAutoCreate())
546              this.item = new CodeableConcept(); // cc
547          return this.item;
548        }
549
550        public boolean hasItem() { 
551          return this.item != null && !this.item.isEmpty();
552        }
553
554        /**
555         * @param value {@link #item} (Specific text of code for diagnosis.)
556         */
557        public ClinicalImpressionRuledOutComponent setItem(CodeableConcept value) { 
558          this.item = value;
559          return this;
560        }
561
562        /**
563         * @return {@link #reason} (Grounds for elimination.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
564         */
565        public StringType getReasonElement() { 
566          if (this.reason == null)
567            if (Configuration.errorOnAutoCreate())
568              throw new Error("Attempt to auto-create ClinicalImpressionRuledOutComponent.reason");
569            else if (Configuration.doAutoCreate())
570              this.reason = new StringType(); // bb
571          return this.reason;
572        }
573
574        public boolean hasReasonElement() { 
575          return this.reason != null && !this.reason.isEmpty();
576        }
577
578        public boolean hasReason() { 
579          return this.reason != null && !this.reason.isEmpty();
580        }
581
582        /**
583         * @param value {@link #reason} (Grounds for elimination.). This is the underlying object with id, value and extensions. The accessor "getReason" gives direct access to the value
584         */
585        public ClinicalImpressionRuledOutComponent setReasonElement(StringType value) { 
586          this.reason = value;
587          return this;
588        }
589
590        /**
591         * @return Grounds for elimination.
592         */
593        public String getReason() { 
594          return this.reason == null ? null : this.reason.getValue();
595        }
596
597        /**
598         * @param value Grounds for elimination.
599         */
600        public ClinicalImpressionRuledOutComponent setReason(String value) { 
601          if (Utilities.noString(value))
602            this.reason = null;
603          else {
604            if (this.reason == null)
605              this.reason = new StringType();
606            this.reason.setValue(value);
607          }
608          return this;
609        }
610
611        protected void listChildren(List<Property> childrenList) {
612          super.listChildren(childrenList);
613          childrenList.add(new Property("item", "CodeableConcept", "Specific text of code for diagnosis.", 0, java.lang.Integer.MAX_VALUE, item));
614          childrenList.add(new Property("reason", "string", "Grounds for elimination.", 0, java.lang.Integer.MAX_VALUE, reason));
615        }
616
617      @Override
618      public void setProperty(String name, Base value) throws FHIRException {
619        if (name.equals("item"))
620          this.item = castToCodeableConcept(value); // CodeableConcept
621        else if (name.equals("reason"))
622          this.reason = castToString(value); // StringType
623        else
624          super.setProperty(name, value);
625      }
626
627      @Override
628      public Base addChild(String name) throws FHIRException {
629        if (name.equals("item")) {
630          this.item = new CodeableConcept();
631          return this.item;
632        }
633        else if (name.equals("reason")) {
634          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.reason");
635        }
636        else
637          return super.addChild(name);
638      }
639
640      public ClinicalImpressionRuledOutComponent copy() {
641        ClinicalImpressionRuledOutComponent dst = new ClinicalImpressionRuledOutComponent();
642        copyValues(dst);
643        dst.item = item == null ? null : item.copy();
644        dst.reason = reason == null ? null : reason.copy();
645        return dst;
646      }
647
648      @Override
649      public boolean equalsDeep(Base other) {
650        if (!super.equalsDeep(other))
651          return false;
652        if (!(other instanceof ClinicalImpressionRuledOutComponent))
653          return false;
654        ClinicalImpressionRuledOutComponent o = (ClinicalImpressionRuledOutComponent) other;
655        return compareDeep(item, o.item, true) && compareDeep(reason, o.reason, true);
656      }
657
658      @Override
659      public boolean equalsShallow(Base other) {
660        if (!super.equalsShallow(other))
661          return false;
662        if (!(other instanceof ClinicalImpressionRuledOutComponent))
663          return false;
664        ClinicalImpressionRuledOutComponent o = (ClinicalImpressionRuledOutComponent) other;
665        return compareValues(reason, o.reason, true);
666      }
667
668      public boolean isEmpty() {
669        return super.isEmpty() && (item == null || item.isEmpty()) && (reason == null || reason.isEmpty())
670          ;
671      }
672
673  public String fhirType() {
674    return "ClinicalImpression.ruledOut";
675
676  }
677
678  }
679
680    /**
681     * The patient being assessed.
682     */
683    @Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1, modifier=false, summary=true)
684    @Description(shortDefinition="The patient being assessed", formalDefinition="The patient being assessed." )
685    protected Reference patient;
686
687    /**
688     * The actual object that is the target of the reference (The patient being assessed.)
689     */
690    protected Patient patientTarget;
691
692    /**
693     * The clinician performing the assessment.
694     */
695    @Child(name = "assessor", type = {Practitioner.class}, order=1, min=0, max=1, modifier=false, summary=true)
696    @Description(shortDefinition="The clinician performing the assessment", formalDefinition="The clinician performing the assessment." )
697    protected Reference assessor;
698
699    /**
700     * The actual object that is the target of the reference (The clinician performing the assessment.)
701     */
702    protected Practitioner assessorTarget;
703
704    /**
705     * Identifies the workflow status of the assessment.
706     */
707    @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
708    @Description(shortDefinition="in-progress | completed | entered-in-error", formalDefinition="Identifies the workflow status of the assessment." )
709    protected Enumeration<ClinicalImpressionStatus> status;
710
711    /**
712     * The point in time at which the assessment was concluded (not when it was recorded).
713     */
714    @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
715    @Description(shortDefinition="When the assessment occurred", formalDefinition="The point in time at which the assessment was concluded (not when it was recorded)." )
716    protected DateTimeType date;
717
718    /**
719     * A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.
720     */
721    @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
722    @Description(shortDefinition="Why/how the assessment was performed", formalDefinition="A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it." )
723    protected StringType description;
724
725    /**
726     * A reference to the last assesment that was conducted bon 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.
727     */
728    @Child(name = "previous", type = {ClinicalImpression.class}, order=5, min=0, max=1, modifier=false, summary=false)
729    @Description(shortDefinition="Reference to last assessment", formalDefinition="A reference to the last assesment that was conducted bon 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." )
730    protected Reference previous;
731
732    /**
733     * The actual object that is the target of the reference (A reference to the last assesment that was conducted bon 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.)
734     */
735    protected ClinicalImpression previousTarget;
736
737    /**
738     * This a list of the general problems/conditions for a patient.
739     */
740    @Child(name = "problem", type = {Condition.class, AllergyIntolerance.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
741    @Description(shortDefinition="General assessment of patient state", formalDefinition="This a list of the general problems/conditions for a patient." )
742    protected List<Reference> problem;
743    /**
744     * The actual objects that are the target of the reference (This a list of the general problems/conditions for a patient.)
745     */
746    protected List<Resource> problemTarget;
747
748
749    /**
750     * The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.
751     */
752    @Child(name = "trigger", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
753    @Description(shortDefinition="Request or event that necessitated this assessment", formalDefinition="The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource." )
754    protected Type trigger;
755
756    /**
757     * One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary 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.
758     */
759    @Child(name = "investigations", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
760    @Description(shortDefinition="One or more sets of investigations (signs, symptions, etc.)", formalDefinition="One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary 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." )
761    protected List<ClinicalImpressionInvestigationsComponent> investigations;
762
763    /**
764     * Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.
765     */
766    @Child(name = "protocol", type = {UriType.class}, order=9, min=0, max=1, modifier=false, summary=false)
767    @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." )
768    protected UriType protocol;
769
770    /**
771     * A text summary of the investigations and the diagnosis.
772     */
773    @Child(name = "summary", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
774    @Description(shortDefinition="Summary of the assessment", formalDefinition="A text summary of the investigations and the diagnosis." )
775    protected StringType summary;
776
777    /**
778     * Specific findings or diagnoses that was considered likely or relevant to ongoing treatment.
779     */
780    @Child(name = "finding", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
781    @Description(shortDefinition="Possible or likely findings and diagnoses", formalDefinition="Specific findings or diagnoses that was considered likely or relevant to ongoing treatment." )
782    protected List<ClinicalImpressionFindingComponent> finding;
783
784    /**
785     * Diagnoses/conditions resolved since the last assessment.
786     */
787    @Child(name = "resolved", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
788    @Description(shortDefinition="Diagnoses/conditions resolved since previous assessment", formalDefinition="Diagnoses/conditions resolved since the last assessment." )
789    protected List<CodeableConcept> resolved;
790
791    /**
792     * Diagnosis considered not possible.
793     */
794    @Child(name = "ruledOut", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
795    @Description(shortDefinition="Diagnosis considered not possible", formalDefinition="Diagnosis considered not possible." )
796    protected List<ClinicalImpressionRuledOutComponent> ruledOut;
797
798    /**
799     * Estimate of likely outcome.
800     */
801    @Child(name = "prognosis", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=false)
802    @Description(shortDefinition="Estimate of likely outcome", formalDefinition="Estimate of likely outcome." )
803    protected StringType prognosis;
804
805    /**
806     * Plan of action after assessment.
807     */
808    @Child(name = "plan", type = {CarePlan.class, Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationOrder.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, SupplyRequest.class, VisionPrescription.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
809    @Description(shortDefinition="Plan of action after assessment", formalDefinition="Plan of action after assessment." )
810    protected List<Reference> plan;
811    /**
812     * The actual objects that are the target of the reference (Plan of action after assessment.)
813     */
814    protected List<Resource> planTarget;
815
816
817    /**
818     * Actions taken during assessment.
819     */
820    @Child(name = "action", type = {ReferralRequest.class, ProcedureRequest.class, Procedure.class, MedicationOrder.class, DiagnosticOrder.class, NutritionOrder.class, SupplyRequest.class, Appointment.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
821    @Description(shortDefinition="Actions taken during assessment", formalDefinition="Actions taken during assessment." )
822    protected List<Reference> action;
823    /**
824     * The actual objects that are the target of the reference (Actions taken during assessment.)
825     */
826    protected List<Resource> actionTarget;
827
828
829    private static final long serialVersionUID = 1650458630L;
830
831  /*
832   * Constructor
833   */
834    public ClinicalImpression() {
835      super();
836    }
837
838  /*
839   * Constructor
840   */
841    public ClinicalImpression(Reference patient, Enumeration<ClinicalImpressionStatus> status) {
842      super();
843      this.patient = patient;
844      this.status = status;
845    }
846
847    /**
848     * @return {@link #patient} (The patient being assessed.)
849     */
850    public Reference getPatient() { 
851      if (this.patient == null)
852        if (Configuration.errorOnAutoCreate())
853          throw new Error("Attempt to auto-create ClinicalImpression.patient");
854        else if (Configuration.doAutoCreate())
855          this.patient = new Reference(); // cc
856      return this.patient;
857    }
858
859    public boolean hasPatient() { 
860      return this.patient != null && !this.patient.isEmpty();
861    }
862
863    /**
864     * @param value {@link #patient} (The patient being assessed.)
865     */
866    public ClinicalImpression setPatient(Reference value) { 
867      this.patient = value;
868      return this;
869    }
870
871    /**
872     * @return {@link #patient} 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 being assessed.)
873     */
874    public Patient getPatientTarget() { 
875      if (this.patientTarget == null)
876        if (Configuration.errorOnAutoCreate())
877          throw new Error("Attempt to auto-create ClinicalImpression.patient");
878        else if (Configuration.doAutoCreate())
879          this.patientTarget = new Patient(); // aa
880      return this.patientTarget;
881    }
882
883    /**
884     * @param value {@link #patient} 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 being assessed.)
885     */
886    public ClinicalImpression setPatientTarget(Patient value) { 
887      this.patientTarget = value;
888      return this;
889    }
890
891    /**
892     * @return {@link #assessor} (The clinician performing the assessment.)
893     */
894    public Reference getAssessor() { 
895      if (this.assessor == null)
896        if (Configuration.errorOnAutoCreate())
897          throw new Error("Attempt to auto-create ClinicalImpression.assessor");
898        else if (Configuration.doAutoCreate())
899          this.assessor = new Reference(); // cc
900      return this.assessor;
901    }
902
903    public boolean hasAssessor() { 
904      return this.assessor != null && !this.assessor.isEmpty();
905    }
906
907    /**
908     * @param value {@link #assessor} (The clinician performing the assessment.)
909     */
910    public ClinicalImpression setAssessor(Reference value) { 
911      this.assessor = value;
912      return this;
913    }
914
915    /**
916     * @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.)
917     */
918    public Practitioner getAssessorTarget() { 
919      if (this.assessorTarget == null)
920        if (Configuration.errorOnAutoCreate())
921          throw new Error("Attempt to auto-create ClinicalImpression.assessor");
922        else if (Configuration.doAutoCreate())
923          this.assessorTarget = new Practitioner(); // aa
924      return this.assessorTarget;
925    }
926
927    /**
928     * @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.)
929     */
930    public ClinicalImpression setAssessorTarget(Practitioner value) { 
931      this.assessorTarget = value;
932      return this;
933    }
934
935    /**
936     * @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
937     */
938    public Enumeration<ClinicalImpressionStatus> getStatusElement() { 
939      if (this.status == null)
940        if (Configuration.errorOnAutoCreate())
941          throw new Error("Attempt to auto-create ClinicalImpression.status");
942        else if (Configuration.doAutoCreate())
943          this.status = new Enumeration<ClinicalImpressionStatus>(new ClinicalImpressionStatusEnumFactory()); // bb
944      return this.status;
945    }
946
947    public boolean hasStatusElement() { 
948      return this.status != null && !this.status.isEmpty();
949    }
950
951    public boolean hasStatus() { 
952      return this.status != null && !this.status.isEmpty();
953    }
954
955    /**
956     * @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
957     */
958    public ClinicalImpression setStatusElement(Enumeration<ClinicalImpressionStatus> value) { 
959      this.status = value;
960      return this;
961    }
962
963    /**
964     * @return Identifies the workflow status of the assessment.
965     */
966    public ClinicalImpressionStatus getStatus() { 
967      return this.status == null ? null : this.status.getValue();
968    }
969
970    /**
971     * @param value Identifies the workflow status of the assessment.
972     */
973    public ClinicalImpression setStatus(ClinicalImpressionStatus value) { 
974        if (this.status == null)
975          this.status = new Enumeration<ClinicalImpressionStatus>(new ClinicalImpressionStatusEnumFactory());
976        this.status.setValue(value);
977      return this;
978    }
979
980    /**
981     * @return {@link #date} (The point in time at which the assessment was concluded (not when it was recorded).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
982     */
983    public DateTimeType getDateElement() { 
984      if (this.date == null)
985        if (Configuration.errorOnAutoCreate())
986          throw new Error("Attempt to auto-create ClinicalImpression.date");
987        else if (Configuration.doAutoCreate())
988          this.date = new DateTimeType(); // bb
989      return this.date;
990    }
991
992    public boolean hasDateElement() { 
993      return this.date != null && !this.date.isEmpty();
994    }
995
996    public boolean hasDate() { 
997      return this.date != null && !this.date.isEmpty();
998    }
999
1000    /**
1001     * @param value {@link #date} (The point in time at which the assessment was concluded (not when it was recorded).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1002     */
1003    public ClinicalImpression setDateElement(DateTimeType value) { 
1004      this.date = value;
1005      return this;
1006    }
1007
1008    /**
1009     * @return The point in time at which the assessment was concluded (not when it was recorded).
1010     */
1011    public Date getDate() { 
1012      return this.date == null ? null : this.date.getValue();
1013    }
1014
1015    /**
1016     * @param value The point in time at which the assessment was concluded (not when it was recorded).
1017     */
1018    public ClinicalImpression setDate(Date value) { 
1019      if (value == null)
1020        this.date = null;
1021      else {
1022        if (this.date == null)
1023          this.date = new DateTimeType();
1024        this.date.setValue(value);
1025      }
1026      return this;
1027    }
1028
1029    /**
1030     * @return {@link #description} (A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1031     */
1032    public StringType getDescriptionElement() { 
1033      if (this.description == null)
1034        if (Configuration.errorOnAutoCreate())
1035          throw new Error("Attempt to auto-create ClinicalImpression.description");
1036        else if (Configuration.doAutoCreate())
1037          this.description = new StringType(); // bb
1038      return this.description;
1039    }
1040
1041    public boolean hasDescriptionElement() { 
1042      return this.description != null && !this.description.isEmpty();
1043    }
1044
1045    public boolean hasDescription() { 
1046      return this.description != null && !this.description.isEmpty();
1047    }
1048
1049    /**
1050     * @param value {@link #description} (A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1051     */
1052    public ClinicalImpression setDescriptionElement(StringType value) { 
1053      this.description = value;
1054      return this;
1055    }
1056
1057    /**
1058     * @return A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.
1059     */
1060    public String getDescription() { 
1061      return this.description == null ? null : this.description.getValue();
1062    }
1063
1064    /**
1065     * @param value A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.
1066     */
1067    public ClinicalImpression setDescription(String value) { 
1068      if (Utilities.noString(value))
1069        this.description = null;
1070      else {
1071        if (this.description == null)
1072          this.description = new StringType();
1073        this.description.setValue(value);
1074      }
1075      return this;
1076    }
1077
1078    /**
1079     * @return {@link #previous} (A reference to the last assesment that was conducted bon 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.)
1080     */
1081    public Reference getPrevious() { 
1082      if (this.previous == null)
1083        if (Configuration.errorOnAutoCreate())
1084          throw new Error("Attempt to auto-create ClinicalImpression.previous");
1085        else if (Configuration.doAutoCreate())
1086          this.previous = new Reference(); // cc
1087      return this.previous;
1088    }
1089
1090    public boolean hasPrevious() { 
1091      return this.previous != null && !this.previous.isEmpty();
1092    }
1093
1094    /**
1095     * @param value {@link #previous} (A reference to the last assesment that was conducted bon 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.)
1096     */
1097    public ClinicalImpression setPrevious(Reference value) { 
1098      this.previous = value;
1099      return this;
1100    }
1101
1102    /**
1103     * @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 assesment that was conducted bon 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.)
1104     */
1105    public ClinicalImpression getPreviousTarget() { 
1106      if (this.previousTarget == null)
1107        if (Configuration.errorOnAutoCreate())
1108          throw new Error("Attempt to auto-create ClinicalImpression.previous");
1109        else if (Configuration.doAutoCreate())
1110          this.previousTarget = new ClinicalImpression(); // aa
1111      return this.previousTarget;
1112    }
1113
1114    /**
1115     * @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 assesment that was conducted bon 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.)
1116     */
1117    public ClinicalImpression setPreviousTarget(ClinicalImpression value) { 
1118      this.previousTarget = value;
1119      return this;
1120    }
1121
1122    /**
1123     * @return {@link #problem} (This a list of the general problems/conditions for a patient.)
1124     */
1125    public List<Reference> getProblem() { 
1126      if (this.problem == null)
1127        this.problem = new ArrayList<Reference>();
1128      return this.problem;
1129    }
1130
1131    public boolean hasProblem() { 
1132      if (this.problem == null)
1133        return false;
1134      for (Reference item : this.problem)
1135        if (!item.isEmpty())
1136          return true;
1137      return false;
1138    }
1139
1140    /**
1141     * @return {@link #problem} (This a list of the general problems/conditions for a patient.)
1142     */
1143    // syntactic sugar
1144    public Reference addProblem() { //3
1145      Reference t = new Reference();
1146      if (this.problem == null)
1147        this.problem = new ArrayList<Reference>();
1148      this.problem.add(t);
1149      return t;
1150    }
1151
1152    // syntactic sugar
1153    public ClinicalImpression addProblem(Reference t) { //3
1154      if (t == null)
1155        return this;
1156      if (this.problem == null)
1157        this.problem = new ArrayList<Reference>();
1158      this.problem.add(t);
1159      return this;
1160    }
1161
1162    /**
1163     * @return {@link #problem} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. This a list of the general problems/conditions for a patient.)
1164     */
1165    public List<Resource> getProblemTarget() { 
1166      if (this.problemTarget == null)
1167        this.problemTarget = new ArrayList<Resource>();
1168      return this.problemTarget;
1169    }
1170
1171    /**
1172     * @return {@link #trigger} (The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.)
1173     */
1174    public Type getTrigger() { 
1175      return this.trigger;
1176    }
1177
1178    /**
1179     * @return {@link #trigger} (The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.)
1180     */
1181    public CodeableConcept getTriggerCodeableConcept() throws FHIRException { 
1182      if (!(this.trigger instanceof CodeableConcept))
1183        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.trigger.getClass().getName()+" was encountered");
1184      return (CodeableConcept) this.trigger;
1185    }
1186
1187    public boolean hasTriggerCodeableConcept() { 
1188      return this.trigger instanceof CodeableConcept;
1189    }
1190
1191    /**
1192     * @return {@link #trigger} (The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.)
1193     */
1194    public Reference getTriggerReference() throws FHIRException { 
1195      if (!(this.trigger instanceof Reference))
1196        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.trigger.getClass().getName()+" was encountered");
1197      return (Reference) this.trigger;
1198    }
1199
1200    public boolean hasTriggerReference() { 
1201      return this.trigger instanceof Reference;
1202    }
1203
1204    public boolean hasTrigger() { 
1205      return this.trigger != null && !this.trigger.isEmpty();
1206    }
1207
1208    /**
1209     * @param value {@link #trigger} (The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.)
1210     */
1211    public ClinicalImpression setTrigger(Type value) { 
1212      this.trigger = value;
1213      return this;
1214    }
1215
1216    /**
1217     * @return {@link #investigations} (One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary 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.)
1218     */
1219    public List<ClinicalImpressionInvestigationsComponent> getInvestigations() { 
1220      if (this.investigations == null)
1221        this.investigations = new ArrayList<ClinicalImpressionInvestigationsComponent>();
1222      return this.investigations;
1223    }
1224
1225    public boolean hasInvestigations() { 
1226      if (this.investigations == null)
1227        return false;
1228      for (ClinicalImpressionInvestigationsComponent item : this.investigations)
1229        if (!item.isEmpty())
1230          return true;
1231      return false;
1232    }
1233
1234    /**
1235     * @return {@link #investigations} (One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary 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.)
1236     */
1237    // syntactic sugar
1238    public ClinicalImpressionInvestigationsComponent addInvestigations() { //3
1239      ClinicalImpressionInvestigationsComponent t = new ClinicalImpressionInvestigationsComponent();
1240      if (this.investigations == null)
1241        this.investigations = new ArrayList<ClinicalImpressionInvestigationsComponent>();
1242      this.investigations.add(t);
1243      return t;
1244    }
1245
1246    // syntactic sugar
1247    public ClinicalImpression addInvestigations(ClinicalImpressionInvestigationsComponent t) { //3
1248      if (t == null)
1249        return this;
1250      if (this.investigations == null)
1251        this.investigations = new ArrayList<ClinicalImpressionInvestigationsComponent>();
1252      this.investigations.add(t);
1253      return this;
1254    }
1255
1256    /**
1257     * @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.). This is the underlying object with id, value and extensions. The accessor "getProtocol" gives direct access to the value
1258     */
1259    public UriType getProtocolElement() { 
1260      if (this.protocol == null)
1261        if (Configuration.errorOnAutoCreate())
1262          throw new Error("Attempt to auto-create ClinicalImpression.protocol");
1263        else if (Configuration.doAutoCreate())
1264          this.protocol = new UriType(); // bb
1265      return this.protocol;
1266    }
1267
1268    public boolean hasProtocolElement() { 
1269      return this.protocol != null && !this.protocol.isEmpty();
1270    }
1271
1272    public boolean hasProtocol() { 
1273      return this.protocol != null && !this.protocol.isEmpty();
1274    }
1275
1276    /**
1277     * @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.). This is the underlying object with id, value and extensions. The accessor "getProtocol" gives direct access to the value
1278     */
1279    public ClinicalImpression setProtocolElement(UriType value) { 
1280      this.protocol = value;
1281      return this;
1282    }
1283
1284    /**
1285     * @return Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.
1286     */
1287    public String getProtocol() { 
1288      return this.protocol == null ? null : this.protocol.getValue();
1289    }
1290
1291    /**
1292     * @param value Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.
1293     */
1294    public ClinicalImpression setProtocol(String value) { 
1295      if (Utilities.noString(value))
1296        this.protocol = null;
1297      else {
1298        if (this.protocol == null)
1299          this.protocol = new UriType();
1300        this.protocol.setValue(value);
1301      }
1302      return this;
1303    }
1304
1305    /**
1306     * @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
1307     */
1308    public StringType getSummaryElement() { 
1309      if (this.summary == null)
1310        if (Configuration.errorOnAutoCreate())
1311          throw new Error("Attempt to auto-create ClinicalImpression.summary");
1312        else if (Configuration.doAutoCreate())
1313          this.summary = new StringType(); // bb
1314      return this.summary;
1315    }
1316
1317    public boolean hasSummaryElement() { 
1318      return this.summary != null && !this.summary.isEmpty();
1319    }
1320
1321    public boolean hasSummary() { 
1322      return this.summary != null && !this.summary.isEmpty();
1323    }
1324
1325    /**
1326     * @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
1327     */
1328    public ClinicalImpression setSummaryElement(StringType value) { 
1329      this.summary = value;
1330      return this;
1331    }
1332
1333    /**
1334     * @return A text summary of the investigations and the diagnosis.
1335     */
1336    public String getSummary() { 
1337      return this.summary == null ? null : this.summary.getValue();
1338    }
1339
1340    /**
1341     * @param value A text summary of the investigations and the diagnosis.
1342     */
1343    public ClinicalImpression setSummary(String value) { 
1344      if (Utilities.noString(value))
1345        this.summary = null;
1346      else {
1347        if (this.summary == null)
1348          this.summary = new StringType();
1349        this.summary.setValue(value);
1350      }
1351      return this;
1352    }
1353
1354    /**
1355     * @return {@link #finding} (Specific findings or diagnoses that was considered likely or relevant to ongoing treatment.)
1356     */
1357    public List<ClinicalImpressionFindingComponent> getFinding() { 
1358      if (this.finding == null)
1359        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1360      return this.finding;
1361    }
1362
1363    public boolean hasFinding() { 
1364      if (this.finding == null)
1365        return false;
1366      for (ClinicalImpressionFindingComponent item : this.finding)
1367        if (!item.isEmpty())
1368          return true;
1369      return false;
1370    }
1371
1372    /**
1373     * @return {@link #finding} (Specific findings or diagnoses that was considered likely or relevant to ongoing treatment.)
1374     */
1375    // syntactic sugar
1376    public ClinicalImpressionFindingComponent addFinding() { //3
1377      ClinicalImpressionFindingComponent t = new ClinicalImpressionFindingComponent();
1378      if (this.finding == null)
1379        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1380      this.finding.add(t);
1381      return t;
1382    }
1383
1384    // syntactic sugar
1385    public ClinicalImpression addFinding(ClinicalImpressionFindingComponent t) { //3
1386      if (t == null)
1387        return this;
1388      if (this.finding == null)
1389        this.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1390      this.finding.add(t);
1391      return this;
1392    }
1393
1394    /**
1395     * @return {@link #resolved} (Diagnoses/conditions resolved since the last assessment.)
1396     */
1397    public List<CodeableConcept> getResolved() { 
1398      if (this.resolved == null)
1399        this.resolved = new ArrayList<CodeableConcept>();
1400      return this.resolved;
1401    }
1402
1403    public boolean hasResolved() { 
1404      if (this.resolved == null)
1405        return false;
1406      for (CodeableConcept item : this.resolved)
1407        if (!item.isEmpty())
1408          return true;
1409      return false;
1410    }
1411
1412    /**
1413     * @return {@link #resolved} (Diagnoses/conditions resolved since the last assessment.)
1414     */
1415    // syntactic sugar
1416    public CodeableConcept addResolved() { //3
1417      CodeableConcept t = new CodeableConcept();
1418      if (this.resolved == null)
1419        this.resolved = new ArrayList<CodeableConcept>();
1420      this.resolved.add(t);
1421      return t;
1422    }
1423
1424    // syntactic sugar
1425    public ClinicalImpression addResolved(CodeableConcept t) { //3
1426      if (t == null)
1427        return this;
1428      if (this.resolved == null)
1429        this.resolved = new ArrayList<CodeableConcept>();
1430      this.resolved.add(t);
1431      return this;
1432    }
1433
1434    /**
1435     * @return {@link #ruledOut} (Diagnosis considered not possible.)
1436     */
1437    public List<ClinicalImpressionRuledOutComponent> getRuledOut() { 
1438      if (this.ruledOut == null)
1439        this.ruledOut = new ArrayList<ClinicalImpressionRuledOutComponent>();
1440      return this.ruledOut;
1441    }
1442
1443    public boolean hasRuledOut() { 
1444      if (this.ruledOut == null)
1445        return false;
1446      for (ClinicalImpressionRuledOutComponent item : this.ruledOut)
1447        if (!item.isEmpty())
1448          return true;
1449      return false;
1450    }
1451
1452    /**
1453     * @return {@link #ruledOut} (Diagnosis considered not possible.)
1454     */
1455    // syntactic sugar
1456    public ClinicalImpressionRuledOutComponent addRuledOut() { //3
1457      ClinicalImpressionRuledOutComponent t = new ClinicalImpressionRuledOutComponent();
1458      if (this.ruledOut == null)
1459        this.ruledOut = new ArrayList<ClinicalImpressionRuledOutComponent>();
1460      this.ruledOut.add(t);
1461      return t;
1462    }
1463
1464    // syntactic sugar
1465    public ClinicalImpression addRuledOut(ClinicalImpressionRuledOutComponent t) { //3
1466      if (t == null)
1467        return this;
1468      if (this.ruledOut == null)
1469        this.ruledOut = new ArrayList<ClinicalImpressionRuledOutComponent>();
1470      this.ruledOut.add(t);
1471      return this;
1472    }
1473
1474    /**
1475     * @return {@link #prognosis} (Estimate of likely outcome.). This is the underlying object with id, value and extensions. The accessor "getPrognosis" gives direct access to the value
1476     */
1477    public StringType getPrognosisElement() { 
1478      if (this.prognosis == null)
1479        if (Configuration.errorOnAutoCreate())
1480          throw new Error("Attempt to auto-create ClinicalImpression.prognosis");
1481        else if (Configuration.doAutoCreate())
1482          this.prognosis = new StringType(); // bb
1483      return this.prognosis;
1484    }
1485
1486    public boolean hasPrognosisElement() { 
1487      return this.prognosis != null && !this.prognosis.isEmpty();
1488    }
1489
1490    public boolean hasPrognosis() { 
1491      return this.prognosis != null && !this.prognosis.isEmpty();
1492    }
1493
1494    /**
1495     * @param value {@link #prognosis} (Estimate of likely outcome.). This is the underlying object with id, value and extensions. The accessor "getPrognosis" gives direct access to the value
1496     */
1497    public ClinicalImpression setPrognosisElement(StringType value) { 
1498      this.prognosis = value;
1499      return this;
1500    }
1501
1502    /**
1503     * @return Estimate of likely outcome.
1504     */
1505    public String getPrognosis() { 
1506      return this.prognosis == null ? null : this.prognosis.getValue();
1507    }
1508
1509    /**
1510     * @param value Estimate of likely outcome.
1511     */
1512    public ClinicalImpression setPrognosis(String value) { 
1513      if (Utilities.noString(value))
1514        this.prognosis = null;
1515      else {
1516        if (this.prognosis == null)
1517          this.prognosis = new StringType();
1518        this.prognosis.setValue(value);
1519      }
1520      return this;
1521    }
1522
1523    /**
1524     * @return {@link #plan} (Plan of action after assessment.)
1525     */
1526    public List<Reference> getPlan() { 
1527      if (this.plan == null)
1528        this.plan = new ArrayList<Reference>();
1529      return this.plan;
1530    }
1531
1532    public boolean hasPlan() { 
1533      if (this.plan == null)
1534        return false;
1535      for (Reference item : this.plan)
1536        if (!item.isEmpty())
1537          return true;
1538      return false;
1539    }
1540
1541    /**
1542     * @return {@link #plan} (Plan of action after assessment.)
1543     */
1544    // syntactic sugar
1545    public Reference addPlan() { //3
1546      Reference t = new Reference();
1547      if (this.plan == null)
1548        this.plan = new ArrayList<Reference>();
1549      this.plan.add(t);
1550      return t;
1551    }
1552
1553    // syntactic sugar
1554    public ClinicalImpression addPlan(Reference t) { //3
1555      if (t == null)
1556        return this;
1557      if (this.plan == null)
1558        this.plan = new ArrayList<Reference>();
1559      this.plan.add(t);
1560      return this;
1561    }
1562
1563    /**
1564     * @return {@link #plan} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Plan of action after assessment.)
1565     */
1566    public List<Resource> getPlanTarget() { 
1567      if (this.planTarget == null)
1568        this.planTarget = new ArrayList<Resource>();
1569      return this.planTarget;
1570    }
1571
1572    /**
1573     * @return {@link #action} (Actions taken during assessment.)
1574     */
1575    public List<Reference> getAction() { 
1576      if (this.action == null)
1577        this.action = new ArrayList<Reference>();
1578      return this.action;
1579    }
1580
1581    public boolean hasAction() { 
1582      if (this.action == null)
1583        return false;
1584      for (Reference item : this.action)
1585        if (!item.isEmpty())
1586          return true;
1587      return false;
1588    }
1589
1590    /**
1591     * @return {@link #action} (Actions taken during assessment.)
1592     */
1593    // syntactic sugar
1594    public Reference addAction() { //3
1595      Reference t = new Reference();
1596      if (this.action == null)
1597        this.action = new ArrayList<Reference>();
1598      this.action.add(t);
1599      return t;
1600    }
1601
1602    // syntactic sugar
1603    public ClinicalImpression addAction(Reference t) { //3
1604      if (t == null)
1605        return this;
1606      if (this.action == null)
1607        this.action = new ArrayList<Reference>();
1608      this.action.add(t);
1609      return this;
1610    }
1611
1612    /**
1613     * @return {@link #action} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Actions taken during assessment.)
1614     */
1615    public List<Resource> getActionTarget() { 
1616      if (this.actionTarget == null)
1617        this.actionTarget = new ArrayList<Resource>();
1618      return this.actionTarget;
1619    }
1620
1621      protected void listChildren(List<Property> childrenList) {
1622        super.listChildren(childrenList);
1623        childrenList.add(new Property("patient", "Reference(Patient)", "The patient being assessed.", 0, java.lang.Integer.MAX_VALUE, patient));
1624        childrenList.add(new Property("assessor", "Reference(Practitioner)", "The clinician performing the assessment.", 0, java.lang.Integer.MAX_VALUE, assessor));
1625        childrenList.add(new Property("status", "code", "Identifies the workflow status of the assessment.", 0, java.lang.Integer.MAX_VALUE, status));
1626        childrenList.add(new Property("date", "dateTime", "The point in time at which the assessment was concluded (not when it was recorded).", 0, java.lang.Integer.MAX_VALUE, date));
1627        childrenList.add(new Property("description", "string", "A summary of the context and/or cause of the assessment - why / where was it peformed, and what patient events/sstatus prompted it.", 0, java.lang.Integer.MAX_VALUE, description));
1628        childrenList.add(new Property("previous", "Reference(ClinicalImpression)", "A reference to the last assesment that was conducted bon 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, java.lang.Integer.MAX_VALUE, previous));
1629        childrenList.add(new Property("problem", "Reference(Condition|AllergyIntolerance)", "This a list of the general problems/conditions for a patient.", 0, java.lang.Integer.MAX_VALUE, problem));
1630        childrenList.add(new Property("trigger[x]", "CodeableConcept|Reference(Any)", "The request or event that necessitated this assessment. This may be a diagnosis, a Care Plan, a Request Referral, or some other resource.", 0, java.lang.Integer.MAX_VALUE, trigger));
1631        childrenList.add(new Property("investigations", "", "One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary 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, investigations));
1632        childrenList.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));
1633        childrenList.add(new Property("summary", "string", "A text summary of the investigations and the diagnosis.", 0, java.lang.Integer.MAX_VALUE, summary));
1634        childrenList.add(new Property("finding", "", "Specific findings or diagnoses that was considered likely or relevant to ongoing treatment.", 0, java.lang.Integer.MAX_VALUE, finding));
1635        childrenList.add(new Property("resolved", "CodeableConcept", "Diagnoses/conditions resolved since the last assessment.", 0, java.lang.Integer.MAX_VALUE, resolved));
1636        childrenList.add(new Property("ruledOut", "", "Diagnosis considered not possible.", 0, java.lang.Integer.MAX_VALUE, ruledOut));
1637        childrenList.add(new Property("prognosis", "string", "Estimate of likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosis));
1638        childrenList.add(new Property("plan", "Reference(CarePlan|Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationOrder|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|SupplyRequest|VisionPrescription)", "Plan of action after assessment.", 0, java.lang.Integer.MAX_VALUE, plan));
1639        childrenList.add(new Property("action", "Reference(ReferralRequest|ProcedureRequest|Procedure|MedicationOrder|DiagnosticOrder|NutritionOrder|SupplyRequest|Appointment)", "Actions taken during assessment.", 0, java.lang.Integer.MAX_VALUE, action));
1640      }
1641
1642      @Override
1643      public void setProperty(String name, Base value) throws FHIRException {
1644        if (name.equals("patient"))
1645          this.patient = castToReference(value); // Reference
1646        else if (name.equals("assessor"))
1647          this.assessor = castToReference(value); // Reference
1648        else if (name.equals("status"))
1649          this.status = new ClinicalImpressionStatusEnumFactory().fromType(value); // Enumeration<ClinicalImpressionStatus>
1650        else if (name.equals("date"))
1651          this.date = castToDateTime(value); // DateTimeType
1652        else if (name.equals("description"))
1653          this.description = castToString(value); // StringType
1654        else if (name.equals("previous"))
1655          this.previous = castToReference(value); // Reference
1656        else if (name.equals("problem"))
1657          this.getProblem().add(castToReference(value));
1658        else if (name.equals("trigger[x]"))
1659          this.trigger = (Type) value; // Type
1660        else if (name.equals("investigations"))
1661          this.getInvestigations().add((ClinicalImpressionInvestigationsComponent) value);
1662        else if (name.equals("protocol"))
1663          this.protocol = castToUri(value); // UriType
1664        else if (name.equals("summary"))
1665          this.summary = castToString(value); // StringType
1666        else if (name.equals("finding"))
1667          this.getFinding().add((ClinicalImpressionFindingComponent) value);
1668        else if (name.equals("resolved"))
1669          this.getResolved().add(castToCodeableConcept(value));
1670        else if (name.equals("ruledOut"))
1671          this.getRuledOut().add((ClinicalImpressionRuledOutComponent) value);
1672        else if (name.equals("prognosis"))
1673          this.prognosis = castToString(value); // StringType
1674        else if (name.equals("plan"))
1675          this.getPlan().add(castToReference(value));
1676        else if (name.equals("action"))
1677          this.getAction().add(castToReference(value));
1678        else
1679          super.setProperty(name, value);
1680      }
1681
1682      @Override
1683      public Base addChild(String name) throws FHIRException {
1684        if (name.equals("patient")) {
1685          this.patient = new Reference();
1686          return this.patient;
1687        }
1688        else if (name.equals("assessor")) {
1689          this.assessor = new Reference();
1690          return this.assessor;
1691        }
1692        else if (name.equals("status")) {
1693          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.status");
1694        }
1695        else if (name.equals("date")) {
1696          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.date");
1697        }
1698        else if (name.equals("description")) {
1699          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.description");
1700        }
1701        else if (name.equals("previous")) {
1702          this.previous = new Reference();
1703          return this.previous;
1704        }
1705        else if (name.equals("problem")) {
1706          return addProblem();
1707        }
1708        else if (name.equals("triggerCodeableConcept")) {
1709          this.trigger = new CodeableConcept();
1710          return this.trigger;
1711        }
1712        else if (name.equals("triggerReference")) {
1713          this.trigger = new Reference();
1714          return this.trigger;
1715        }
1716        else if (name.equals("investigations")) {
1717          return addInvestigations();
1718        }
1719        else if (name.equals("protocol")) {
1720          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.protocol");
1721        }
1722        else if (name.equals("summary")) {
1723          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.summary");
1724        }
1725        else if (name.equals("finding")) {
1726          return addFinding();
1727        }
1728        else if (name.equals("resolved")) {
1729          return addResolved();
1730        }
1731        else if (name.equals("ruledOut")) {
1732          return addRuledOut();
1733        }
1734        else if (name.equals("prognosis")) {
1735          throw new FHIRException("Cannot call addChild on a primitive type ClinicalImpression.prognosis");
1736        }
1737        else if (name.equals("plan")) {
1738          return addPlan();
1739        }
1740        else if (name.equals("action")) {
1741          return addAction();
1742        }
1743        else
1744          return super.addChild(name);
1745      }
1746
1747  public String fhirType() {
1748    return "ClinicalImpression";
1749
1750  }
1751
1752      public ClinicalImpression copy() {
1753        ClinicalImpression dst = new ClinicalImpression();
1754        copyValues(dst);
1755        dst.patient = patient == null ? null : patient.copy();
1756        dst.assessor = assessor == null ? null : assessor.copy();
1757        dst.status = status == null ? null : status.copy();
1758        dst.date = date == null ? null : date.copy();
1759        dst.description = description == null ? null : description.copy();
1760        dst.previous = previous == null ? null : previous.copy();
1761        if (problem != null) {
1762          dst.problem = new ArrayList<Reference>();
1763          for (Reference i : problem)
1764            dst.problem.add(i.copy());
1765        };
1766        dst.trigger = trigger == null ? null : trigger.copy();
1767        if (investigations != null) {
1768          dst.investigations = new ArrayList<ClinicalImpressionInvestigationsComponent>();
1769          for (ClinicalImpressionInvestigationsComponent i : investigations)
1770            dst.investigations.add(i.copy());
1771        };
1772        dst.protocol = protocol == null ? null : protocol.copy();
1773        dst.summary = summary == null ? null : summary.copy();
1774        if (finding != null) {
1775          dst.finding = new ArrayList<ClinicalImpressionFindingComponent>();
1776          for (ClinicalImpressionFindingComponent i : finding)
1777            dst.finding.add(i.copy());
1778        };
1779        if (resolved != null) {
1780          dst.resolved = new ArrayList<CodeableConcept>();
1781          for (CodeableConcept i : resolved)
1782            dst.resolved.add(i.copy());
1783        };
1784        if (ruledOut != null) {
1785          dst.ruledOut = new ArrayList<ClinicalImpressionRuledOutComponent>();
1786          for (ClinicalImpressionRuledOutComponent i : ruledOut)
1787            dst.ruledOut.add(i.copy());
1788        };
1789        dst.prognosis = prognosis == null ? null : prognosis.copy();
1790        if (plan != null) {
1791          dst.plan = new ArrayList<Reference>();
1792          for (Reference i : plan)
1793            dst.plan.add(i.copy());
1794        };
1795        if (action != null) {
1796          dst.action = new ArrayList<Reference>();
1797          for (Reference i : action)
1798            dst.action.add(i.copy());
1799        };
1800        return dst;
1801      }
1802
1803      protected ClinicalImpression typedCopy() {
1804        return copy();
1805      }
1806
1807      @Override
1808      public boolean equalsDeep(Base other) {
1809        if (!super.equalsDeep(other))
1810          return false;
1811        if (!(other instanceof ClinicalImpression))
1812          return false;
1813        ClinicalImpression o = (ClinicalImpression) other;
1814        return compareDeep(patient, o.patient, true) && compareDeep(assessor, o.assessor, true) && compareDeep(status, o.status, true)
1815           && compareDeep(date, o.date, true) && compareDeep(description, o.description, true) && compareDeep(previous, o.previous, true)
1816           && compareDeep(problem, o.problem, true) && compareDeep(trigger, o.trigger, true) && compareDeep(investigations, o.investigations, true)
1817           && compareDeep(protocol, o.protocol, true) && compareDeep(summary, o.summary, true) && compareDeep(finding, o.finding, true)
1818           && compareDeep(resolved, o.resolved, true) && compareDeep(ruledOut, o.ruledOut, true) && compareDeep(prognosis, o.prognosis, true)
1819           && compareDeep(plan, o.plan, true) && compareDeep(action, o.action, true);
1820      }
1821
1822      @Override
1823      public boolean equalsShallow(Base other) {
1824        if (!super.equalsShallow(other))
1825          return false;
1826        if (!(other instanceof ClinicalImpression))
1827          return false;
1828        ClinicalImpression o = (ClinicalImpression) other;
1829        return compareValues(status, o.status, true) && compareValues(date, o.date, true) && compareValues(description, o.description, true)
1830           && compareValues(protocol, o.protocol, true) && compareValues(summary, o.summary, true) && compareValues(prognosis, o.prognosis, true)
1831          ;
1832      }
1833
1834      public boolean isEmpty() {
1835        return super.isEmpty() && (patient == null || patient.isEmpty()) && (assessor == null || assessor.isEmpty())
1836           && (status == null || status.isEmpty()) && (date == null || date.isEmpty()) && (description == null || description.isEmpty())
1837           && (previous == null || previous.isEmpty()) && (problem == null || problem.isEmpty()) && (trigger == null || trigger.isEmpty())
1838           && (investigations == null || investigations.isEmpty()) && (protocol == null || protocol.isEmpty())
1839           && (summary == null || summary.isEmpty()) && (finding == null || finding.isEmpty()) && (resolved == null || resolved.isEmpty())
1840           && (ruledOut == null || ruledOut.isEmpty()) && (prognosis == null || prognosis.isEmpty())
1841           && (plan == null || plan.isEmpty()) && (action == null || action.isEmpty());
1842      }
1843
1844  @Override
1845  public ResourceType getResourceType() {
1846    return ResourceType.ClinicalImpression;
1847   }
1848
1849  @SearchParamDefinition(name="date", path="ClinicalImpression.date", description="When the assessment occurred", type="date" )
1850  public static final String SP_DATE = "date";
1851  @SearchParamDefinition(name="previous", path="ClinicalImpression.previous", description="Reference to last assessment", type="reference" )
1852  public static final String SP_PREVIOUS = "previous";
1853  @SearchParamDefinition(name="assessor", path="ClinicalImpression.assessor", description="The clinician performing the assessment", type="reference" )
1854  public static final String SP_ASSESSOR = "assessor";
1855  @SearchParamDefinition(name="trigger", path="ClinicalImpression.triggerReference", description="Request or event that necessitated this assessment", type="reference" )
1856  public static final String SP_TRIGGER = "trigger";
1857  @SearchParamDefinition(name="finding", path="ClinicalImpression.finding.item", description="Specific text or code for finding", type="token" )
1858  public static final String SP_FINDING = "finding";
1859  @SearchParamDefinition(name="ruledout", path="ClinicalImpression.ruledOut.item", description="Specific text of code for diagnosis", type="token" )
1860  public static final String SP_RULEDOUT = "ruledout";
1861  @SearchParamDefinition(name="problem", path="ClinicalImpression.problem", description="General assessment of patient state", type="reference" )
1862  public static final String SP_PROBLEM = "problem";
1863  @SearchParamDefinition(name="patient", path="ClinicalImpression.patient", description="The patient being assessed", type="reference" )
1864  public static final String SP_PATIENT = "patient";
1865  @SearchParamDefinition(name="investigation", path="ClinicalImpression.investigations.item", description="Record of a specific investigation", type="reference" )
1866  public static final String SP_INVESTIGATION = "investigation";
1867  @SearchParamDefinition(name="action", path="ClinicalImpression.action", description="Actions taken during assessment", type="reference" )
1868  public static final String SP_ACTION = "action";
1869  @SearchParamDefinition(name="trigger-code", path="ClinicalImpression.triggerCodeableConcept", description="Request or event that necessitated this assessment", type="token" )
1870  public static final String SP_TRIGGERCODE = "trigger-code";
1871  @SearchParamDefinition(name="plan", path="ClinicalImpression.plan", description="Plan of action after assessment", type="reference" )
1872  public static final String SP_PLAN = "plan";
1873  @SearchParamDefinition(name="resolved", path="ClinicalImpression.resolved", description="Diagnoses/conditions resolved since previous assessment", type="token" )
1874  public static final String SP_RESOLVED = "resolved";
1875  @SearchParamDefinition(name="status", path="ClinicalImpression.status", description="in-progress | completed | entered-in-error", type="token" )
1876  public static final String SP_STATUS = "status";
1877
1878}
1879