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