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