001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046/**
047 * Use to record detailed information about conditions, problems or diagnoses recognized by a clinician. There are many uses including: recording a diagnosis during an encounter; populating a problem list or a summary statement, such as a discharge summary.
048 */
049@ResourceDef(name="Condition", profile="http://hl7.org/fhir/Profile/Condition")
050public class Condition extends DomainResource {
051
052    public enum ConditionVerificationStatus {
053        /**
054         * This is a tentative diagnosis - still a candidate that is under consideration.
055         */
056        PROVISIONAL, 
057        /**
058         * One of a set of potential (and typically mutually exclusive) diagnosis asserted to further guide the diagnostic process and preliminary treatment.
059         */
060        DIFFERENTIAL, 
061        /**
062         * There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.
063         */
064        CONFIRMED, 
065        /**
066         * This condition has been ruled out by diagnostic and clinical evidence.
067         */
068        REFUTED, 
069        /**
070         * The statement was entered in error and is not valid.
071         */
072        ENTEREDINERROR, 
073        /**
074         * The condition status is unknown.  Note that "unknown" is a value of last resort and every attempt should be made to provide a meaningful value other than "unknown".
075         */
076        UNKNOWN, 
077        /**
078         * added to help the parsers
079         */
080        NULL;
081        public static ConditionVerificationStatus fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("provisional".equals(codeString))
085          return PROVISIONAL;
086        if ("differential".equals(codeString))
087          return DIFFERENTIAL;
088        if ("confirmed".equals(codeString))
089          return CONFIRMED;
090        if ("refuted".equals(codeString))
091          return REFUTED;
092        if ("entered-in-error".equals(codeString))
093          return ENTEREDINERROR;
094        if ("unknown".equals(codeString))
095          return UNKNOWN;
096        throw new FHIRException("Unknown ConditionVerificationStatus code '"+codeString+"'");
097        }
098        public String toCode() {
099          switch (this) {
100            case PROVISIONAL: return "provisional";
101            case DIFFERENTIAL: return "differential";
102            case CONFIRMED: return "confirmed";
103            case REFUTED: return "refuted";
104            case ENTEREDINERROR: return "entered-in-error";
105            case UNKNOWN: return "unknown";
106            default: return "?";
107          }
108        }
109        public String getSystem() {
110          switch (this) {
111            case PROVISIONAL: return "http://hl7.org/fhir/condition-ver-status";
112            case DIFFERENTIAL: return "http://hl7.org/fhir/condition-ver-status";
113            case CONFIRMED: return "http://hl7.org/fhir/condition-ver-status";
114            case REFUTED: return "http://hl7.org/fhir/condition-ver-status";
115            case ENTEREDINERROR: return "http://hl7.org/fhir/condition-ver-status";
116            case UNKNOWN: return "http://hl7.org/fhir/condition-ver-status";
117            default: return "?";
118          }
119        }
120        public String getDefinition() {
121          switch (this) {
122            case PROVISIONAL: return "This is a tentative diagnosis - still a candidate that is under consideration.";
123            case DIFFERENTIAL: return "One of a set of potential (and typically mutually exclusive) diagnosis asserted to further guide the diagnostic process and preliminary treatment.";
124            case CONFIRMED: return "There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.";
125            case REFUTED: return "This condition has been ruled out by diagnostic and clinical evidence.";
126            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
127            case UNKNOWN: return "The condition status is unknown.  Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\".";
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case PROVISIONAL: return "Provisional";
134            case DIFFERENTIAL: return "Differential";
135            case CONFIRMED: return "Confirmed";
136            case REFUTED: return "Refuted";
137            case ENTEREDINERROR: return "Entered In Error";
138            case UNKNOWN: return "Unknown";
139            default: return "?";
140          }
141        }
142    }
143
144  public static class ConditionVerificationStatusEnumFactory implements EnumFactory<ConditionVerificationStatus> {
145    public ConditionVerificationStatus fromCode(String codeString) throws IllegalArgumentException {
146      if (codeString == null || "".equals(codeString))
147            if (codeString == null || "".equals(codeString))
148                return null;
149        if ("provisional".equals(codeString))
150          return ConditionVerificationStatus.PROVISIONAL;
151        if ("differential".equals(codeString))
152          return ConditionVerificationStatus.DIFFERENTIAL;
153        if ("confirmed".equals(codeString))
154          return ConditionVerificationStatus.CONFIRMED;
155        if ("refuted".equals(codeString))
156          return ConditionVerificationStatus.REFUTED;
157        if ("entered-in-error".equals(codeString))
158          return ConditionVerificationStatus.ENTEREDINERROR;
159        if ("unknown".equals(codeString))
160          return ConditionVerificationStatus.UNKNOWN;
161        throw new IllegalArgumentException("Unknown ConditionVerificationStatus code '"+codeString+"'");
162        }
163        public Enumeration<ConditionVerificationStatus> fromType(Base code) throws FHIRException {
164          if (code == null || code.isEmpty())
165            return null;
166          String codeString = ((PrimitiveType) code).asStringValue();
167          if (codeString == null || "".equals(codeString))
168            return null;
169        if ("provisional".equals(codeString))
170          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.PROVISIONAL);
171        if ("differential".equals(codeString))
172          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.DIFFERENTIAL);
173        if ("confirmed".equals(codeString))
174          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.CONFIRMED);
175        if ("refuted".equals(codeString))
176          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.REFUTED);
177        if ("entered-in-error".equals(codeString))
178          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.ENTEREDINERROR);
179        if ("unknown".equals(codeString))
180          return new Enumeration<ConditionVerificationStatus>(this, ConditionVerificationStatus.UNKNOWN);
181        throw new FHIRException("Unknown ConditionVerificationStatus code '"+codeString+"'");
182        }
183    public String toCode(ConditionVerificationStatus code) {
184      if (code == ConditionVerificationStatus.PROVISIONAL)
185        return "provisional";
186      if (code == ConditionVerificationStatus.DIFFERENTIAL)
187        return "differential";
188      if (code == ConditionVerificationStatus.CONFIRMED)
189        return "confirmed";
190      if (code == ConditionVerificationStatus.REFUTED)
191        return "refuted";
192      if (code == ConditionVerificationStatus.ENTEREDINERROR)
193        return "entered-in-error";
194      if (code == ConditionVerificationStatus.UNKNOWN)
195        return "unknown";
196      return "?";
197      }
198    public String toSystem(ConditionVerificationStatus code) {
199      return code.getSystem();
200      }
201    }
202
203    @Block()
204    public static class ConditionStageComponent extends BackboneElement implements IBaseBackboneElement {
205        /**
206         * A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.
207         */
208        @Child(name = "summary", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
209        @Description(shortDefinition="Simple summary (disease specific)", formalDefinition="A simple summary of the stage such as \"Stage 3\". The determination of the stage is disease-specific." )
210        protected CodeableConcept summary;
211
212        /**
213         * Reference to a formal record of the evidence on which the staging assessment is based.
214         */
215        @Child(name = "assessment", type = {ClinicalImpression.class, DiagnosticReport.class, Observation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
216        @Description(shortDefinition="Formal record of assessment", formalDefinition="Reference to a formal record of the evidence on which the staging assessment is based." )
217        protected List<Reference> assessment;
218        /**
219         * The actual objects that are the target of the reference (Reference to a formal record of the evidence on which the staging assessment is based.)
220         */
221        protected List<Resource> assessmentTarget;
222
223
224        private static final long serialVersionUID = -1961530405L;
225
226    /**
227     * Constructor
228     */
229      public ConditionStageComponent() {
230        super();
231      }
232
233        /**
234         * @return {@link #summary} (A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.)
235         */
236        public CodeableConcept getSummary() { 
237          if (this.summary == null)
238            if (Configuration.errorOnAutoCreate())
239              throw new Error("Attempt to auto-create ConditionStageComponent.summary");
240            else if (Configuration.doAutoCreate())
241              this.summary = new CodeableConcept(); // cc
242          return this.summary;
243        }
244
245        public boolean hasSummary() { 
246          return this.summary != null && !this.summary.isEmpty();
247        }
248
249        /**
250         * @param value {@link #summary} (A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.)
251         */
252        public ConditionStageComponent setSummary(CodeableConcept value) { 
253          this.summary = value;
254          return this;
255        }
256
257        /**
258         * @return {@link #assessment} (Reference to a formal record of the evidence on which the staging assessment is based.)
259         */
260        public List<Reference> getAssessment() { 
261          if (this.assessment == null)
262            this.assessment = new ArrayList<Reference>();
263          return this.assessment;
264        }
265
266        public boolean hasAssessment() { 
267          if (this.assessment == null)
268            return false;
269          for (Reference item : this.assessment)
270            if (!item.isEmpty())
271              return true;
272          return false;
273        }
274
275        /**
276         * @return {@link #assessment} (Reference to a formal record of the evidence on which the staging assessment is based.)
277         */
278    // syntactic sugar
279        public Reference addAssessment() { //3
280          Reference t = new Reference();
281          if (this.assessment == null)
282            this.assessment = new ArrayList<Reference>();
283          this.assessment.add(t);
284          return t;
285        }
286
287    // syntactic sugar
288        public ConditionStageComponent addAssessment(Reference t) { //3
289          if (t == null)
290            return this;
291          if (this.assessment == null)
292            this.assessment = new ArrayList<Reference>();
293          this.assessment.add(t);
294          return this;
295        }
296
297        /**
298         * @return {@link #assessment} (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. Reference to a formal record of the evidence on which the staging assessment is based.)
299         */
300        public List<Resource> getAssessmentTarget() { 
301          if (this.assessmentTarget == null)
302            this.assessmentTarget = new ArrayList<Resource>();
303          return this.assessmentTarget;
304        }
305
306        protected void listChildren(List<Property> childrenList) {
307          super.listChildren(childrenList);
308          childrenList.add(new Property("summary", "CodeableConcept", "A simple summary of the stage such as \"Stage 3\". The determination of the stage is disease-specific.", 0, java.lang.Integer.MAX_VALUE, summary));
309          childrenList.add(new Property("assessment", "Reference(ClinicalImpression|DiagnosticReport|Observation)", "Reference to a formal record of the evidence on which the staging assessment is based.", 0, java.lang.Integer.MAX_VALUE, assessment));
310        }
311
312      @Override
313      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
314        switch (hash) {
315        case -1857640538: /*summary*/ return this.summary == null ? new Base[0] : new Base[] {this.summary}; // CodeableConcept
316        case 2119382722: /*assessment*/ return this.assessment == null ? new Base[0] : this.assessment.toArray(new Base[this.assessment.size()]); // Reference
317        default: return super.getProperty(hash, name, checkValid);
318        }
319
320      }
321
322      @Override
323      public void setProperty(int hash, String name, Base value) throws FHIRException {
324        switch (hash) {
325        case -1857640538: // summary
326          this.summary = castToCodeableConcept(value); // CodeableConcept
327          break;
328        case 2119382722: // assessment
329          this.getAssessment().add(castToReference(value)); // Reference
330          break;
331        default: super.setProperty(hash, name, value);
332        }
333
334      }
335
336      @Override
337      public void setProperty(String name, Base value) throws FHIRException {
338        if (name.equals("summary"))
339          this.summary = castToCodeableConcept(value); // CodeableConcept
340        else if (name.equals("assessment"))
341          this.getAssessment().add(castToReference(value));
342        else
343          super.setProperty(name, value);
344      }
345
346      @Override
347      public Base makeProperty(int hash, String name) throws FHIRException {
348        switch (hash) {
349        case -1857640538:  return getSummary(); // CodeableConcept
350        case 2119382722:  return addAssessment(); // Reference
351        default: return super.makeProperty(hash, name);
352        }
353
354      }
355
356      @Override
357      public Base addChild(String name) throws FHIRException {
358        if (name.equals("summary")) {
359          this.summary = new CodeableConcept();
360          return this.summary;
361        }
362        else if (name.equals("assessment")) {
363          return addAssessment();
364        }
365        else
366          return super.addChild(name);
367      }
368
369      public ConditionStageComponent copy() {
370        ConditionStageComponent dst = new ConditionStageComponent();
371        copyValues(dst);
372        dst.summary = summary == null ? null : summary.copy();
373        if (assessment != null) {
374          dst.assessment = new ArrayList<Reference>();
375          for (Reference i : assessment)
376            dst.assessment.add(i.copy());
377        };
378        return dst;
379      }
380
381      @Override
382      public boolean equalsDeep(Base other) {
383        if (!super.equalsDeep(other))
384          return false;
385        if (!(other instanceof ConditionStageComponent))
386          return false;
387        ConditionStageComponent o = (ConditionStageComponent) other;
388        return compareDeep(summary, o.summary, true) && compareDeep(assessment, o.assessment, true);
389      }
390
391      @Override
392      public boolean equalsShallow(Base other) {
393        if (!super.equalsShallow(other))
394          return false;
395        if (!(other instanceof ConditionStageComponent))
396          return false;
397        ConditionStageComponent o = (ConditionStageComponent) other;
398        return true;
399      }
400
401      public boolean isEmpty() {
402        return super.isEmpty() && (summary == null || summary.isEmpty()) && (assessment == null || assessment.isEmpty())
403          ;
404      }
405
406  public String fhirType() {
407    return "Condition.stage";
408
409  }
410
411  }
412
413    @Block()
414    public static class ConditionEvidenceComponent extends BackboneElement implements IBaseBackboneElement {
415        /**
416         * A manifestation or symptom that led to the recording of this condition.
417         */
418        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
419        @Description(shortDefinition="Manifestation/symptom", formalDefinition="A manifestation or symptom that led to the recording of this condition." )
420        protected CodeableConcept code;
421
422        /**
423         * Links to other relevant information, including pathology reports.
424         */
425        @Child(name = "detail", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
426        @Description(shortDefinition="Supporting information found elsewhere", formalDefinition="Links to other relevant information, including pathology reports." )
427        protected List<Reference> detail;
428        /**
429         * The actual objects that are the target of the reference (Links to other relevant information, including pathology reports.)
430         */
431        protected List<Resource> detailTarget;
432
433
434        private static final long serialVersionUID = 945689926L;
435
436    /**
437     * Constructor
438     */
439      public ConditionEvidenceComponent() {
440        super();
441      }
442
443        /**
444         * @return {@link #code} (A manifestation or symptom that led to the recording of this condition.)
445         */
446        public CodeableConcept getCode() { 
447          if (this.code == null)
448            if (Configuration.errorOnAutoCreate())
449              throw new Error("Attempt to auto-create ConditionEvidenceComponent.code");
450            else if (Configuration.doAutoCreate())
451              this.code = new CodeableConcept(); // cc
452          return this.code;
453        }
454
455        public boolean hasCode() { 
456          return this.code != null && !this.code.isEmpty();
457        }
458
459        /**
460         * @param value {@link #code} (A manifestation or symptom that led to the recording of this condition.)
461         */
462        public ConditionEvidenceComponent setCode(CodeableConcept value) { 
463          this.code = value;
464          return this;
465        }
466
467        /**
468         * @return {@link #detail} (Links to other relevant information, including pathology reports.)
469         */
470        public List<Reference> getDetail() { 
471          if (this.detail == null)
472            this.detail = new ArrayList<Reference>();
473          return this.detail;
474        }
475
476        public boolean hasDetail() { 
477          if (this.detail == null)
478            return false;
479          for (Reference item : this.detail)
480            if (!item.isEmpty())
481              return true;
482          return false;
483        }
484
485        /**
486         * @return {@link #detail} (Links to other relevant information, including pathology reports.)
487         */
488    // syntactic sugar
489        public Reference addDetail() { //3
490          Reference t = new Reference();
491          if (this.detail == null)
492            this.detail = new ArrayList<Reference>();
493          this.detail.add(t);
494          return t;
495        }
496
497    // syntactic sugar
498        public ConditionEvidenceComponent addDetail(Reference t) { //3
499          if (t == null)
500            return this;
501          if (this.detail == null)
502            this.detail = new ArrayList<Reference>();
503          this.detail.add(t);
504          return this;
505        }
506
507        /**
508         * @return {@link #detail} (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. Links to other relevant information, including pathology reports.)
509         */
510        public List<Resource> getDetailTarget() { 
511          if (this.detailTarget == null)
512            this.detailTarget = new ArrayList<Resource>();
513          return this.detailTarget;
514        }
515
516        protected void listChildren(List<Property> childrenList) {
517          super.listChildren(childrenList);
518          childrenList.add(new Property("code", "CodeableConcept", "A manifestation or symptom that led to the recording of this condition.", 0, java.lang.Integer.MAX_VALUE, code));
519          childrenList.add(new Property("detail", "Reference(Any)", "Links to other relevant information, including pathology reports.", 0, java.lang.Integer.MAX_VALUE, detail));
520        }
521
522      @Override
523      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
524        switch (hash) {
525        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
526        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
527        default: return super.getProperty(hash, name, checkValid);
528        }
529
530      }
531
532      @Override
533      public void setProperty(int hash, String name, Base value) throws FHIRException {
534        switch (hash) {
535        case 3059181: // code
536          this.code = castToCodeableConcept(value); // CodeableConcept
537          break;
538        case -1335224239: // detail
539          this.getDetail().add(castToReference(value)); // Reference
540          break;
541        default: super.setProperty(hash, name, value);
542        }
543
544      }
545
546      @Override
547      public void setProperty(String name, Base value) throws FHIRException {
548        if (name.equals("code"))
549          this.code = castToCodeableConcept(value); // CodeableConcept
550        else if (name.equals("detail"))
551          this.getDetail().add(castToReference(value));
552        else
553          super.setProperty(name, value);
554      }
555
556      @Override
557      public Base makeProperty(int hash, String name) throws FHIRException {
558        switch (hash) {
559        case 3059181:  return getCode(); // CodeableConcept
560        case -1335224239:  return addDetail(); // Reference
561        default: return super.makeProperty(hash, name);
562        }
563
564      }
565
566      @Override
567      public Base addChild(String name) throws FHIRException {
568        if (name.equals("code")) {
569          this.code = new CodeableConcept();
570          return this.code;
571        }
572        else if (name.equals("detail")) {
573          return addDetail();
574        }
575        else
576          return super.addChild(name);
577      }
578
579      public ConditionEvidenceComponent copy() {
580        ConditionEvidenceComponent dst = new ConditionEvidenceComponent();
581        copyValues(dst);
582        dst.code = code == null ? null : code.copy();
583        if (detail != null) {
584          dst.detail = new ArrayList<Reference>();
585          for (Reference i : detail)
586            dst.detail.add(i.copy());
587        };
588        return dst;
589      }
590
591      @Override
592      public boolean equalsDeep(Base other) {
593        if (!super.equalsDeep(other))
594          return false;
595        if (!(other instanceof ConditionEvidenceComponent))
596          return false;
597        ConditionEvidenceComponent o = (ConditionEvidenceComponent) other;
598        return compareDeep(code, o.code, true) && compareDeep(detail, o.detail, true);
599      }
600
601      @Override
602      public boolean equalsShallow(Base other) {
603        if (!super.equalsShallow(other))
604          return false;
605        if (!(other instanceof ConditionEvidenceComponent))
606          return false;
607        ConditionEvidenceComponent o = (ConditionEvidenceComponent) other;
608        return true;
609      }
610
611      public boolean isEmpty() {
612        return super.isEmpty() && (code == null || code.isEmpty()) && (detail == null || detail.isEmpty())
613          ;
614      }
615
616  public String fhirType() {
617    return "Condition.evidence";
618
619  }
620
621  }
622
623    /**
624     * This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
625     */
626    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
627    @Description(shortDefinition="External Ids for this condition", formalDefinition="This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
628    protected List<Identifier> identifier;
629
630    /**
631     * Indicates the patient who the condition record is associated with.
632     */
633    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
634    @Description(shortDefinition="Who has the condition?", formalDefinition="Indicates the patient who the condition record is associated with." )
635    protected Reference patient;
636
637    /**
638     * The actual object that is the target of the reference (Indicates the patient who the condition record is associated with.)
639     */
640    protected Patient patientTarget;
641
642    /**
643     * Encounter during which the condition was first asserted.
644     */
645    @Child(name = "encounter", type = {Encounter.class}, order=2, min=0, max=1, modifier=false, summary=true)
646    @Description(shortDefinition="Encounter when condition first asserted", formalDefinition="Encounter during which the condition was first asserted." )
647    protected Reference encounter;
648
649    /**
650     * The actual object that is the target of the reference (Encounter during which the condition was first asserted.)
651     */
652    protected Encounter encounterTarget;
653
654    /**
655     * Individual who is making the condition statement.
656     */
657    @Child(name = "asserter", type = {Practitioner.class, Patient.class}, order=3, min=0, max=1, modifier=false, summary=true)
658    @Description(shortDefinition="Person who asserts this condition", formalDefinition="Individual who is making the condition statement." )
659    protected Reference asserter;
660
661    /**
662     * The actual object that is the target of the reference (Individual who is making the condition statement.)
663     */
664    protected Resource asserterTarget;
665
666    /**
667     * A date, when  the Condition statement was documented.
668     */
669    @Child(name = "dateRecorded", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=true)
670    @Description(shortDefinition="When first entered", formalDefinition="A date, when  the Condition statement was documented." )
671    protected DateType dateRecorded;
672
673    /**
674     * Identification of the condition, problem or diagnosis.
675     */
676    @Child(name = "code", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true)
677    @Description(shortDefinition="Identification of the condition, problem or diagnosis", formalDefinition="Identification of the condition, problem or diagnosis." )
678    protected CodeableConcept code;
679
680    /**
681     * A category assigned to the condition.
682     */
683    @Child(name = "category", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
684    @Description(shortDefinition="complaint | symptom | finding | diagnosis", formalDefinition="A category assigned to the condition." )
685    protected CodeableConcept category;
686
687    /**
688     * The clinical status of the condition.
689     */
690    @Child(name = "clinicalStatus", type = {CodeType.class}, order=7, min=0, max=1, modifier=true, summary=true)
691    @Description(shortDefinition="active | relapse | remission | resolved", formalDefinition="The clinical status of the condition." )
692    protected CodeType clinicalStatus;
693
694    /**
695     * The verification status to support the clinical status of the condition.
696     */
697    @Child(name = "verificationStatus", type = {CodeType.class}, order=8, min=1, max=1, modifier=true, summary=true)
698    @Description(shortDefinition="provisional | differential | confirmed | refuted | entered-in-error | unknown", formalDefinition="The verification status to support the clinical status of the condition." )
699    protected Enumeration<ConditionVerificationStatus> verificationStatus;
700
701    /**
702     * A subjective assessment of the severity of the condition as evaluated by the clinician.
703     */
704    @Child(name = "severity", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
705    @Description(shortDefinition="Subjective severity of condition", formalDefinition="A subjective assessment of the severity of the condition as evaluated by the clinician." )
706    protected CodeableConcept severity;
707
708    /**
709     * Estimated or actual date or date-time  the condition began, in the opinion of the clinician.
710     */
711    @Child(name = "onset", type = {DateTimeType.class, Age.class, Period.class, Range.class, StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
712    @Description(shortDefinition="Estimated or actual date,  date-time, or age", formalDefinition="Estimated or actual date or date-time  the condition began, in the opinion of the clinician." )
713    protected Type onset;
714
715    /**
716     * The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.
717     */
718    @Child(name = "abatement", type = {DateTimeType.class, Age.class, BooleanType.class, Period.class, Range.class, StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
719    @Description(shortDefinition="If/when in resolution/remission", formalDefinition="The date or estimated date that the condition resolved or went into remission. This is called \"abatement\" because of the many overloaded connotations associated with \"remission\" or \"resolution\" - Conditions are never really resolved, but they can abate." )
720    protected Type abatement;
721
722    /**
723     * Clinical stage or grade of a condition. May include formal severity assessments.
724     */
725    @Child(name = "stage", type = {}, order=12, min=0, max=1, modifier=false, summary=true)
726    @Description(shortDefinition="Stage/grade, usually assessed formally", formalDefinition="Clinical stage or grade of a condition. May include formal severity assessments." )
727    protected ConditionStageComponent stage;
728
729    /**
730     * Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.
731     */
732    @Child(name = "evidence", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
733    @Description(shortDefinition="Supporting evidence", formalDefinition="Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed." )
734    protected List<ConditionEvidenceComponent> evidence;
735
736    /**
737     * The anatomical location where this condition manifests itself.
738     */
739    @Child(name = "bodySite", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
740    @Description(shortDefinition="Anatomical location, if relevant", formalDefinition="The anatomical location where this condition manifests itself." )
741    protected List<CodeableConcept> bodySite;
742
743    /**
744     * Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.
745     */
746    @Child(name = "notes", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
747    @Description(shortDefinition="Additional information about the Condition", formalDefinition="Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis." )
748    protected StringType notes;
749
750    private static final long serialVersionUID = -341227215L;
751
752  /**
753   * Constructor
754   */
755    public Condition() {
756      super();
757    }
758
759  /**
760   * Constructor
761   */
762    public Condition(Reference patient, CodeableConcept code, Enumeration<ConditionVerificationStatus> verificationStatus) {
763      super();
764      this.patient = patient;
765      this.code = code;
766      this.verificationStatus = verificationStatus;
767    }
768
769    /**
770     * @return {@link #identifier} (This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
771     */
772    public List<Identifier> getIdentifier() { 
773      if (this.identifier == null)
774        this.identifier = new ArrayList<Identifier>();
775      return this.identifier;
776    }
777
778    public boolean hasIdentifier() { 
779      if (this.identifier == null)
780        return false;
781      for (Identifier item : this.identifier)
782        if (!item.isEmpty())
783          return true;
784      return false;
785    }
786
787    /**
788     * @return {@link #identifier} (This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
789     */
790    // syntactic sugar
791    public Identifier addIdentifier() { //3
792      Identifier t = new Identifier();
793      if (this.identifier == null)
794        this.identifier = new ArrayList<Identifier>();
795      this.identifier.add(t);
796      return t;
797    }
798
799    // syntactic sugar
800    public Condition addIdentifier(Identifier t) { //3
801      if (t == null)
802        return this;
803      if (this.identifier == null)
804        this.identifier = new ArrayList<Identifier>();
805      this.identifier.add(t);
806      return this;
807    }
808
809    /**
810     * @return {@link #patient} (Indicates the patient who the condition record is associated with.)
811     */
812    public Reference getPatient() { 
813      if (this.patient == null)
814        if (Configuration.errorOnAutoCreate())
815          throw new Error("Attempt to auto-create Condition.patient");
816        else if (Configuration.doAutoCreate())
817          this.patient = new Reference(); // cc
818      return this.patient;
819    }
820
821    public boolean hasPatient() { 
822      return this.patient != null && !this.patient.isEmpty();
823    }
824
825    /**
826     * @param value {@link #patient} (Indicates the patient who the condition record is associated with.)
827     */
828    public Condition setPatient(Reference value) { 
829      this.patient = value;
830      return this;
831    }
832
833    /**
834     * @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. (Indicates the patient who the condition record is associated with.)
835     */
836    public Patient getPatientTarget() { 
837      if (this.patientTarget == null)
838        if (Configuration.errorOnAutoCreate())
839          throw new Error("Attempt to auto-create Condition.patient");
840        else if (Configuration.doAutoCreate())
841          this.patientTarget = new Patient(); // aa
842      return this.patientTarget;
843    }
844
845    /**
846     * @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. (Indicates the patient who the condition record is associated with.)
847     */
848    public Condition setPatientTarget(Patient value) { 
849      this.patientTarget = value;
850      return this;
851    }
852
853    /**
854     * @return {@link #encounter} (Encounter during which the condition was first asserted.)
855     */
856    public Reference getEncounter() { 
857      if (this.encounter == null)
858        if (Configuration.errorOnAutoCreate())
859          throw new Error("Attempt to auto-create Condition.encounter");
860        else if (Configuration.doAutoCreate())
861          this.encounter = new Reference(); // cc
862      return this.encounter;
863    }
864
865    public boolean hasEncounter() { 
866      return this.encounter != null && !this.encounter.isEmpty();
867    }
868
869    /**
870     * @param value {@link #encounter} (Encounter during which the condition was first asserted.)
871     */
872    public Condition setEncounter(Reference value) { 
873      this.encounter = value;
874      return this;
875    }
876
877    /**
878     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Encounter during which the condition was first asserted.)
879     */
880    public Encounter getEncounterTarget() { 
881      if (this.encounterTarget == null)
882        if (Configuration.errorOnAutoCreate())
883          throw new Error("Attempt to auto-create Condition.encounter");
884        else if (Configuration.doAutoCreate())
885          this.encounterTarget = new Encounter(); // aa
886      return this.encounterTarget;
887    }
888
889    /**
890     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Encounter during which the condition was first asserted.)
891     */
892    public Condition setEncounterTarget(Encounter value) { 
893      this.encounterTarget = value;
894      return this;
895    }
896
897    /**
898     * @return {@link #asserter} (Individual who is making the condition statement.)
899     */
900    public Reference getAsserter() { 
901      if (this.asserter == null)
902        if (Configuration.errorOnAutoCreate())
903          throw new Error("Attempt to auto-create Condition.asserter");
904        else if (Configuration.doAutoCreate())
905          this.asserter = new Reference(); // cc
906      return this.asserter;
907    }
908
909    public boolean hasAsserter() { 
910      return this.asserter != null && !this.asserter.isEmpty();
911    }
912
913    /**
914     * @param value {@link #asserter} (Individual who is making the condition statement.)
915     */
916    public Condition setAsserter(Reference value) { 
917      this.asserter = value;
918      return this;
919    }
920
921    /**
922     * @return {@link #asserter} 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. (Individual who is making the condition statement.)
923     */
924    public Resource getAsserterTarget() { 
925      return this.asserterTarget;
926    }
927
928    /**
929     * @param value {@link #asserter} 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. (Individual who is making the condition statement.)
930     */
931    public Condition setAsserterTarget(Resource value) { 
932      this.asserterTarget = value;
933      return this;
934    }
935
936    /**
937     * @return {@link #dateRecorded} (A date, when  the Condition statement was documented.). This is the underlying object with id, value and extensions. The accessor "getDateRecorded" gives direct access to the value
938     */
939    public DateType getDateRecordedElement() { 
940      if (this.dateRecorded == null)
941        if (Configuration.errorOnAutoCreate())
942          throw new Error("Attempt to auto-create Condition.dateRecorded");
943        else if (Configuration.doAutoCreate())
944          this.dateRecorded = new DateType(); // bb
945      return this.dateRecorded;
946    }
947
948    public boolean hasDateRecordedElement() { 
949      return this.dateRecorded != null && !this.dateRecorded.isEmpty();
950    }
951
952    public boolean hasDateRecorded() { 
953      return this.dateRecorded != null && !this.dateRecorded.isEmpty();
954    }
955
956    /**
957     * @param value {@link #dateRecorded} (A date, when  the Condition statement was documented.). This is the underlying object with id, value and extensions. The accessor "getDateRecorded" gives direct access to the value
958     */
959    public Condition setDateRecordedElement(DateType value) { 
960      this.dateRecorded = value;
961      return this;
962    }
963
964    /**
965     * @return A date, when  the Condition statement was documented.
966     */
967    public Date getDateRecorded() { 
968      return this.dateRecorded == null ? null : this.dateRecorded.getValue();
969    }
970
971    /**
972     * @param value A date, when  the Condition statement was documented.
973     */
974    public Condition setDateRecorded(Date value) { 
975      if (value == null)
976        this.dateRecorded = null;
977      else {
978        if (this.dateRecorded == null)
979          this.dateRecorded = new DateType();
980        this.dateRecorded.setValue(value);
981      }
982      return this;
983    }
984
985    /**
986     * @return {@link #code} (Identification of the condition, problem or diagnosis.)
987     */
988    public CodeableConcept getCode() { 
989      if (this.code == null)
990        if (Configuration.errorOnAutoCreate())
991          throw new Error("Attempt to auto-create Condition.code");
992        else if (Configuration.doAutoCreate())
993          this.code = new CodeableConcept(); // cc
994      return this.code;
995    }
996
997    public boolean hasCode() { 
998      return this.code != null && !this.code.isEmpty();
999    }
1000
1001    /**
1002     * @param value {@link #code} (Identification of the condition, problem or diagnosis.)
1003     */
1004    public Condition setCode(CodeableConcept value) { 
1005      this.code = value;
1006      return this;
1007    }
1008
1009    /**
1010     * @return {@link #category} (A category assigned to the condition.)
1011     */
1012    public CodeableConcept getCategory() { 
1013      if (this.category == null)
1014        if (Configuration.errorOnAutoCreate())
1015          throw new Error("Attempt to auto-create Condition.category");
1016        else if (Configuration.doAutoCreate())
1017          this.category = new CodeableConcept(); // cc
1018      return this.category;
1019    }
1020
1021    public boolean hasCategory() { 
1022      return this.category != null && !this.category.isEmpty();
1023    }
1024
1025    /**
1026     * @param value {@link #category} (A category assigned to the condition.)
1027     */
1028    public Condition setCategory(CodeableConcept value) { 
1029      this.category = value;
1030      return this;
1031    }
1032
1033    /**
1034     * @return {@link #clinicalStatus} (The clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value
1035     */
1036    public CodeType getClinicalStatusElement() { 
1037      if (this.clinicalStatus == null)
1038        if (Configuration.errorOnAutoCreate())
1039          throw new Error("Attempt to auto-create Condition.clinicalStatus");
1040        else if (Configuration.doAutoCreate())
1041          this.clinicalStatus = new CodeType(); // bb
1042      return this.clinicalStatus;
1043    }
1044
1045    public boolean hasClinicalStatusElement() { 
1046      return this.clinicalStatus != null && !this.clinicalStatus.isEmpty();
1047    }
1048
1049    public boolean hasClinicalStatus() { 
1050      return this.clinicalStatus != null && !this.clinicalStatus.isEmpty();
1051    }
1052
1053    /**
1054     * @param value {@link #clinicalStatus} (The clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getClinicalStatus" gives direct access to the value
1055     */
1056    public Condition setClinicalStatusElement(CodeType value) { 
1057      this.clinicalStatus = value;
1058      return this;
1059    }
1060
1061    /**
1062     * @return The clinical status of the condition.
1063     */
1064    public String getClinicalStatus() { 
1065      return this.clinicalStatus == null ? null : this.clinicalStatus.getValue();
1066    }
1067
1068    /**
1069     * @param value The clinical status of the condition.
1070     */
1071    public Condition setClinicalStatus(String value) { 
1072      if (Utilities.noString(value))
1073        this.clinicalStatus = null;
1074      else {
1075        if (this.clinicalStatus == null)
1076          this.clinicalStatus = new CodeType();
1077        this.clinicalStatus.setValue(value);
1078      }
1079      return this;
1080    }
1081
1082    /**
1083     * @return {@link #verificationStatus} (The verification status to support the clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value
1084     */
1085    public Enumeration<ConditionVerificationStatus> getVerificationStatusElement() { 
1086      if (this.verificationStatus == null)
1087        if (Configuration.errorOnAutoCreate())
1088          throw new Error("Attempt to auto-create Condition.verificationStatus");
1089        else if (Configuration.doAutoCreate())
1090          this.verificationStatus = new Enumeration<ConditionVerificationStatus>(new ConditionVerificationStatusEnumFactory()); // bb
1091      return this.verificationStatus;
1092    }
1093
1094    public boolean hasVerificationStatusElement() { 
1095      return this.verificationStatus != null && !this.verificationStatus.isEmpty();
1096    }
1097
1098    public boolean hasVerificationStatus() { 
1099      return this.verificationStatus != null && !this.verificationStatus.isEmpty();
1100    }
1101
1102    /**
1103     * @param value {@link #verificationStatus} (The verification status to support the clinical status of the condition.). This is the underlying object with id, value and extensions. The accessor "getVerificationStatus" gives direct access to the value
1104     */
1105    public Condition setVerificationStatusElement(Enumeration<ConditionVerificationStatus> value) { 
1106      this.verificationStatus = value;
1107      return this;
1108    }
1109
1110    /**
1111     * @return The verification status to support the clinical status of the condition.
1112     */
1113    public ConditionVerificationStatus getVerificationStatus() { 
1114      return this.verificationStatus == null ? null : this.verificationStatus.getValue();
1115    }
1116
1117    /**
1118     * @param value The verification status to support the clinical status of the condition.
1119     */
1120    public Condition setVerificationStatus(ConditionVerificationStatus value) { 
1121        if (this.verificationStatus == null)
1122          this.verificationStatus = new Enumeration<ConditionVerificationStatus>(new ConditionVerificationStatusEnumFactory());
1123        this.verificationStatus.setValue(value);
1124      return this;
1125    }
1126
1127    /**
1128     * @return {@link #severity} (A subjective assessment of the severity of the condition as evaluated by the clinician.)
1129     */
1130    public CodeableConcept getSeverity() { 
1131      if (this.severity == null)
1132        if (Configuration.errorOnAutoCreate())
1133          throw new Error("Attempt to auto-create Condition.severity");
1134        else if (Configuration.doAutoCreate())
1135          this.severity = new CodeableConcept(); // cc
1136      return this.severity;
1137    }
1138
1139    public boolean hasSeverity() { 
1140      return this.severity != null && !this.severity.isEmpty();
1141    }
1142
1143    /**
1144     * @param value {@link #severity} (A subjective assessment of the severity of the condition as evaluated by the clinician.)
1145     */
1146    public Condition setSeverity(CodeableConcept value) { 
1147      this.severity = value;
1148      return this;
1149    }
1150
1151    /**
1152     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1153     */
1154    public Type getOnset() { 
1155      return this.onset;
1156    }
1157
1158    /**
1159     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1160     */
1161    public DateTimeType getOnsetDateTimeType() throws FHIRException { 
1162      if (!(this.onset instanceof DateTimeType))
1163        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.onset.getClass().getName()+" was encountered");
1164      return (DateTimeType) this.onset;
1165    }
1166
1167    public boolean hasOnsetDateTimeType() { 
1168      return this.onset instanceof DateTimeType;
1169    }
1170
1171    /**
1172     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1173     */
1174    public Age getOnsetAge() throws FHIRException { 
1175      if (!(this.onset instanceof Age))
1176        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.onset.getClass().getName()+" was encountered");
1177      return (Age) this.onset;
1178    }
1179
1180    public boolean hasOnsetAge() { 
1181      return this.onset instanceof Age;
1182    }
1183
1184    /**
1185     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1186     */
1187    public Period getOnsetPeriod() throws FHIRException { 
1188      if (!(this.onset instanceof Period))
1189        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.onset.getClass().getName()+" was encountered");
1190      return (Period) this.onset;
1191    }
1192
1193    public boolean hasOnsetPeriod() { 
1194      return this.onset instanceof Period;
1195    }
1196
1197    /**
1198     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1199     */
1200    public Range getOnsetRange() throws FHIRException { 
1201      if (!(this.onset instanceof Range))
1202        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.onset.getClass().getName()+" was encountered");
1203      return (Range) this.onset;
1204    }
1205
1206    public boolean hasOnsetRange() { 
1207      return this.onset instanceof Range;
1208    }
1209
1210    /**
1211     * @return {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1212     */
1213    public StringType getOnsetStringType() throws FHIRException { 
1214      if (!(this.onset instanceof StringType))
1215        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.onset.getClass().getName()+" was encountered");
1216      return (StringType) this.onset;
1217    }
1218
1219    public boolean hasOnsetStringType() { 
1220      return this.onset instanceof StringType;
1221    }
1222
1223    public boolean hasOnset() { 
1224      return this.onset != null && !this.onset.isEmpty();
1225    }
1226
1227    /**
1228     * @param value {@link #onset} (Estimated or actual date or date-time  the condition began, in the opinion of the clinician.)
1229     */
1230    public Condition setOnset(Type value) { 
1231      this.onset = value;
1232      return this;
1233    }
1234
1235    /**
1236     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1237     */
1238    public Type getAbatement() { 
1239      return this.abatement;
1240    }
1241
1242    /**
1243     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1244     */
1245    public DateTimeType getAbatementDateTimeType() throws FHIRException { 
1246      if (!(this.abatement instanceof DateTimeType))
1247        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.abatement.getClass().getName()+" was encountered");
1248      return (DateTimeType) this.abatement;
1249    }
1250
1251    public boolean hasAbatementDateTimeType() { 
1252      return this.abatement instanceof DateTimeType;
1253    }
1254
1255    /**
1256     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1257     */
1258    public Age getAbatementAge() throws FHIRException { 
1259      if (!(this.abatement instanceof Age))
1260        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.abatement.getClass().getName()+" was encountered");
1261      return (Age) this.abatement;
1262    }
1263
1264    public boolean hasAbatementAge() { 
1265      return this.abatement instanceof Age;
1266    }
1267
1268    /**
1269     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1270     */
1271    public BooleanType getAbatementBooleanType() throws FHIRException { 
1272      if (!(this.abatement instanceof BooleanType))
1273        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.abatement.getClass().getName()+" was encountered");
1274      return (BooleanType) this.abatement;
1275    }
1276
1277    public boolean hasAbatementBooleanType() { 
1278      return this.abatement instanceof BooleanType;
1279    }
1280
1281    /**
1282     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1283     */
1284    public Period getAbatementPeriod() throws FHIRException { 
1285      if (!(this.abatement instanceof Period))
1286        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.abatement.getClass().getName()+" was encountered");
1287      return (Period) this.abatement;
1288    }
1289
1290    public boolean hasAbatementPeriod() { 
1291      return this.abatement instanceof Period;
1292    }
1293
1294    /**
1295     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1296     */
1297    public Range getAbatementRange() throws FHIRException { 
1298      if (!(this.abatement instanceof Range))
1299        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.abatement.getClass().getName()+" was encountered");
1300      return (Range) this.abatement;
1301    }
1302
1303    public boolean hasAbatementRange() { 
1304      return this.abatement instanceof Range;
1305    }
1306
1307    /**
1308     * @return {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1309     */
1310    public StringType getAbatementStringType() throws FHIRException { 
1311      if (!(this.abatement instanceof StringType))
1312        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.abatement.getClass().getName()+" was encountered");
1313      return (StringType) this.abatement;
1314    }
1315
1316    public boolean hasAbatementStringType() { 
1317      return this.abatement instanceof StringType;
1318    }
1319
1320    public boolean hasAbatement() { 
1321      return this.abatement != null && !this.abatement.isEmpty();
1322    }
1323
1324    /**
1325     * @param value {@link #abatement} (The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.)
1326     */
1327    public Condition setAbatement(Type value) { 
1328      this.abatement = value;
1329      return this;
1330    }
1331
1332    /**
1333     * @return {@link #stage} (Clinical stage or grade of a condition. May include formal severity assessments.)
1334     */
1335    public ConditionStageComponent getStage() { 
1336      if (this.stage == null)
1337        if (Configuration.errorOnAutoCreate())
1338          throw new Error("Attempt to auto-create Condition.stage");
1339        else if (Configuration.doAutoCreate())
1340          this.stage = new ConditionStageComponent(); // cc
1341      return this.stage;
1342    }
1343
1344    public boolean hasStage() { 
1345      return this.stage != null && !this.stage.isEmpty();
1346    }
1347
1348    /**
1349     * @param value {@link #stage} (Clinical stage or grade of a condition. May include formal severity assessments.)
1350     */
1351    public Condition setStage(ConditionStageComponent value) { 
1352      this.stage = value;
1353      return this;
1354    }
1355
1356    /**
1357     * @return {@link #evidence} (Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.)
1358     */
1359    public List<ConditionEvidenceComponent> getEvidence() { 
1360      if (this.evidence == null)
1361        this.evidence = new ArrayList<ConditionEvidenceComponent>();
1362      return this.evidence;
1363    }
1364
1365    public boolean hasEvidence() { 
1366      if (this.evidence == null)
1367        return false;
1368      for (ConditionEvidenceComponent item : this.evidence)
1369        if (!item.isEmpty())
1370          return true;
1371      return false;
1372    }
1373
1374    /**
1375     * @return {@link #evidence} (Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.)
1376     */
1377    // syntactic sugar
1378    public ConditionEvidenceComponent addEvidence() { //3
1379      ConditionEvidenceComponent t = new ConditionEvidenceComponent();
1380      if (this.evidence == null)
1381        this.evidence = new ArrayList<ConditionEvidenceComponent>();
1382      this.evidence.add(t);
1383      return t;
1384    }
1385
1386    // syntactic sugar
1387    public Condition addEvidence(ConditionEvidenceComponent t) { //3
1388      if (t == null)
1389        return this;
1390      if (this.evidence == null)
1391        this.evidence = new ArrayList<ConditionEvidenceComponent>();
1392      this.evidence.add(t);
1393      return this;
1394    }
1395
1396    /**
1397     * @return {@link #bodySite} (The anatomical location where this condition manifests itself.)
1398     */
1399    public List<CodeableConcept> getBodySite() { 
1400      if (this.bodySite == null)
1401        this.bodySite = new ArrayList<CodeableConcept>();
1402      return this.bodySite;
1403    }
1404
1405    public boolean hasBodySite() { 
1406      if (this.bodySite == null)
1407        return false;
1408      for (CodeableConcept item : this.bodySite)
1409        if (!item.isEmpty())
1410          return true;
1411      return false;
1412    }
1413
1414    /**
1415     * @return {@link #bodySite} (The anatomical location where this condition manifests itself.)
1416     */
1417    // syntactic sugar
1418    public CodeableConcept addBodySite() { //3
1419      CodeableConcept t = new CodeableConcept();
1420      if (this.bodySite == null)
1421        this.bodySite = new ArrayList<CodeableConcept>();
1422      this.bodySite.add(t);
1423      return t;
1424    }
1425
1426    // syntactic sugar
1427    public Condition addBodySite(CodeableConcept t) { //3
1428      if (t == null)
1429        return this;
1430      if (this.bodySite == null)
1431        this.bodySite = new ArrayList<CodeableConcept>();
1432      this.bodySite.add(t);
1433      return this;
1434    }
1435
1436    /**
1437     * @return {@link #notes} (Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.). This is the underlying object with id, value and extensions. The accessor "getNotes" gives direct access to the value
1438     */
1439    public StringType getNotesElement() { 
1440      if (this.notes == null)
1441        if (Configuration.errorOnAutoCreate())
1442          throw new Error("Attempt to auto-create Condition.notes");
1443        else if (Configuration.doAutoCreate())
1444          this.notes = new StringType(); // bb
1445      return this.notes;
1446    }
1447
1448    public boolean hasNotesElement() { 
1449      return this.notes != null && !this.notes.isEmpty();
1450    }
1451
1452    public boolean hasNotes() { 
1453      return this.notes != null && !this.notes.isEmpty();
1454    }
1455
1456    /**
1457     * @param value {@link #notes} (Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.). This is the underlying object with id, value and extensions. The accessor "getNotes" gives direct access to the value
1458     */
1459    public Condition setNotesElement(StringType value) { 
1460      this.notes = value;
1461      return this;
1462    }
1463
1464    /**
1465     * @return Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.
1466     */
1467    public String getNotes() { 
1468      return this.notes == null ? null : this.notes.getValue();
1469    }
1470
1471    /**
1472     * @param value Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.
1473     */
1474    public Condition setNotes(String value) { 
1475      if (Utilities.noString(value))
1476        this.notes = null;
1477      else {
1478        if (this.notes == null)
1479          this.notes = new StringType();
1480        this.notes.setValue(value);
1481      }
1482      return this;
1483    }
1484
1485      protected void listChildren(List<Property> childrenList) {
1486        super.listChildren(childrenList);
1487        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
1488        childrenList.add(new Property("patient", "Reference(Patient)", "Indicates the patient who the condition record is associated with.", 0, java.lang.Integer.MAX_VALUE, patient));
1489        childrenList.add(new Property("encounter", "Reference(Encounter)", "Encounter during which the condition was first asserted.", 0, java.lang.Integer.MAX_VALUE, encounter));
1490        childrenList.add(new Property("asserter", "Reference(Practitioner|Patient)", "Individual who is making the condition statement.", 0, java.lang.Integer.MAX_VALUE, asserter));
1491        childrenList.add(new Property("dateRecorded", "date", "A date, when  the Condition statement was documented.", 0, java.lang.Integer.MAX_VALUE, dateRecorded));
1492        childrenList.add(new Property("code", "CodeableConcept", "Identification of the condition, problem or diagnosis.", 0, java.lang.Integer.MAX_VALUE, code));
1493        childrenList.add(new Property("category", "CodeableConcept", "A category assigned to the condition.", 0, java.lang.Integer.MAX_VALUE, category));
1494        childrenList.add(new Property("clinicalStatus", "code", "The clinical status of the condition.", 0, java.lang.Integer.MAX_VALUE, clinicalStatus));
1495        childrenList.add(new Property("verificationStatus", "code", "The verification status to support the clinical status of the condition.", 0, java.lang.Integer.MAX_VALUE, verificationStatus));
1496        childrenList.add(new Property("severity", "CodeableConcept", "A subjective assessment of the severity of the condition as evaluated by the clinician.", 0, java.lang.Integer.MAX_VALUE, severity));
1497        childrenList.add(new Property("onset[x]", "dateTime|Age|Period|Range|string", "Estimated or actual date or date-time  the condition began, in the opinion of the clinician.", 0, java.lang.Integer.MAX_VALUE, onset));
1498        childrenList.add(new Property("abatement[x]", "dateTime|Age|boolean|Period|Range|string", "The date or estimated date that the condition resolved or went into remission. This is called \"abatement\" because of the many overloaded connotations associated with \"remission\" or \"resolution\" - Conditions are never really resolved, but they can abate.", 0, java.lang.Integer.MAX_VALUE, abatement));
1499        childrenList.add(new Property("stage", "", "Clinical stage or grade of a condition. May include formal severity assessments.", 0, java.lang.Integer.MAX_VALUE, stage));
1500        childrenList.add(new Property("evidence", "", "Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.", 0, java.lang.Integer.MAX_VALUE, evidence));
1501        childrenList.add(new Property("bodySite", "CodeableConcept", "The anatomical location where this condition manifests itself.", 0, java.lang.Integer.MAX_VALUE, bodySite));
1502        childrenList.add(new Property("notes", "string", "Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.", 0, java.lang.Integer.MAX_VALUE, notes));
1503      }
1504
1505      @Override
1506      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1507        switch (hash) {
1508        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1509        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1510        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1511        case -373242253: /*asserter*/ return this.asserter == null ? new Base[0] : new Base[] {this.asserter}; // Reference
1512        case 1888120446: /*dateRecorded*/ return this.dateRecorded == null ? new Base[0] : new Base[] {this.dateRecorded}; // DateType
1513        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1514        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1515        case -462853915: /*clinicalStatus*/ return this.clinicalStatus == null ? new Base[0] : new Base[] {this.clinicalStatus}; // CodeType
1516        case -842509843: /*verificationStatus*/ return this.verificationStatus == null ? new Base[0] : new Base[] {this.verificationStatus}; // Enumeration<ConditionVerificationStatus>
1517        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // CodeableConcept
1518        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // Type
1519        case -921554001: /*abatement*/ return this.abatement == null ? new Base[0] : new Base[] {this.abatement}; // Type
1520        case 109757182: /*stage*/ return this.stage == null ? new Base[0] : new Base[] {this.stage}; // ConditionStageComponent
1521        case 382967383: /*evidence*/ return this.evidence == null ? new Base[0] : this.evidence.toArray(new Base[this.evidence.size()]); // ConditionEvidenceComponent
1522        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : this.bodySite.toArray(new Base[this.bodySite.size()]); // CodeableConcept
1523        case 105008833: /*notes*/ return this.notes == null ? new Base[0] : new Base[] {this.notes}; // StringType
1524        default: return super.getProperty(hash, name, checkValid);
1525        }
1526
1527      }
1528
1529      @Override
1530      public void setProperty(int hash, String name, Base value) throws FHIRException {
1531        switch (hash) {
1532        case -1618432855: // identifier
1533          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1534          break;
1535        case -791418107: // patient
1536          this.patient = castToReference(value); // Reference
1537          break;
1538        case 1524132147: // encounter
1539          this.encounter = castToReference(value); // Reference
1540          break;
1541        case -373242253: // asserter
1542          this.asserter = castToReference(value); // Reference
1543          break;
1544        case 1888120446: // dateRecorded
1545          this.dateRecorded = castToDate(value); // DateType
1546          break;
1547        case 3059181: // code
1548          this.code = castToCodeableConcept(value); // CodeableConcept
1549          break;
1550        case 50511102: // category
1551          this.category = castToCodeableConcept(value); // CodeableConcept
1552          break;
1553        case -462853915: // clinicalStatus
1554          this.clinicalStatus = castToCode(value); // CodeType
1555          break;
1556        case -842509843: // verificationStatus
1557          this.verificationStatus = new ConditionVerificationStatusEnumFactory().fromType(value); // Enumeration<ConditionVerificationStatus>
1558          break;
1559        case 1478300413: // severity
1560          this.severity = castToCodeableConcept(value); // CodeableConcept
1561          break;
1562        case 105901603: // onset
1563          this.onset = (Type) value; // Type
1564          break;
1565        case -921554001: // abatement
1566          this.abatement = (Type) value; // Type
1567          break;
1568        case 109757182: // stage
1569          this.stage = (ConditionStageComponent) value; // ConditionStageComponent
1570          break;
1571        case 382967383: // evidence
1572          this.getEvidence().add((ConditionEvidenceComponent) value); // ConditionEvidenceComponent
1573          break;
1574        case 1702620169: // bodySite
1575          this.getBodySite().add(castToCodeableConcept(value)); // CodeableConcept
1576          break;
1577        case 105008833: // notes
1578          this.notes = castToString(value); // StringType
1579          break;
1580        default: super.setProperty(hash, name, value);
1581        }
1582
1583      }
1584
1585      @Override
1586      public void setProperty(String name, Base value) throws FHIRException {
1587        if (name.equals("identifier"))
1588          this.getIdentifier().add(castToIdentifier(value));
1589        else if (name.equals("patient"))
1590          this.patient = castToReference(value); // Reference
1591        else if (name.equals("encounter"))
1592          this.encounter = castToReference(value); // Reference
1593        else if (name.equals("asserter"))
1594          this.asserter = castToReference(value); // Reference
1595        else if (name.equals("dateRecorded"))
1596          this.dateRecorded = castToDate(value); // DateType
1597        else if (name.equals("code"))
1598          this.code = castToCodeableConcept(value); // CodeableConcept
1599        else if (name.equals("category"))
1600          this.category = castToCodeableConcept(value); // CodeableConcept
1601        else if (name.equals("clinicalStatus"))
1602          this.clinicalStatus = castToCode(value); // CodeType
1603        else if (name.equals("verificationStatus"))
1604          this.verificationStatus = new ConditionVerificationStatusEnumFactory().fromType(value); // Enumeration<ConditionVerificationStatus>
1605        else if (name.equals("severity"))
1606          this.severity = castToCodeableConcept(value); // CodeableConcept
1607        else if (name.equals("onset[x]"))
1608          this.onset = (Type) value; // Type
1609        else if (name.equals("abatement[x]"))
1610          this.abatement = (Type) value; // Type
1611        else if (name.equals("stage"))
1612          this.stage = (ConditionStageComponent) value; // ConditionStageComponent
1613        else if (name.equals("evidence"))
1614          this.getEvidence().add((ConditionEvidenceComponent) value);
1615        else if (name.equals("bodySite"))
1616          this.getBodySite().add(castToCodeableConcept(value));
1617        else if (name.equals("notes"))
1618          this.notes = castToString(value); // StringType
1619        else
1620          super.setProperty(name, value);
1621      }
1622
1623      @Override
1624      public Base makeProperty(int hash, String name) throws FHIRException {
1625        switch (hash) {
1626        case -1618432855:  return addIdentifier(); // Identifier
1627        case -791418107:  return getPatient(); // Reference
1628        case 1524132147:  return getEncounter(); // Reference
1629        case -373242253:  return getAsserter(); // Reference
1630        case 1888120446: throw new FHIRException("Cannot make property dateRecorded as it is not a complex type"); // DateType
1631        case 3059181:  return getCode(); // CodeableConcept
1632        case 50511102:  return getCategory(); // CodeableConcept
1633        case -462853915: throw new FHIRException("Cannot make property clinicalStatus as it is not a complex type"); // CodeType
1634        case -842509843: throw new FHIRException("Cannot make property verificationStatus as it is not a complex type"); // Enumeration<ConditionVerificationStatus>
1635        case 1478300413:  return getSeverity(); // CodeableConcept
1636        case -1886216323:  return getOnset(); // Type
1637        case -584196495:  return getAbatement(); // Type
1638        case 109757182:  return getStage(); // ConditionStageComponent
1639        case 382967383:  return addEvidence(); // ConditionEvidenceComponent
1640        case 1702620169:  return addBodySite(); // CodeableConcept
1641        case 105008833: throw new FHIRException("Cannot make property notes as it is not a complex type"); // StringType
1642        default: return super.makeProperty(hash, name);
1643        }
1644
1645      }
1646
1647      @Override
1648      public Base addChild(String name) throws FHIRException {
1649        if (name.equals("identifier")) {
1650          return addIdentifier();
1651        }
1652        else if (name.equals("patient")) {
1653          this.patient = new Reference();
1654          return this.patient;
1655        }
1656        else if (name.equals("encounter")) {
1657          this.encounter = new Reference();
1658          return this.encounter;
1659        }
1660        else if (name.equals("asserter")) {
1661          this.asserter = new Reference();
1662          return this.asserter;
1663        }
1664        else if (name.equals("dateRecorded")) {
1665          throw new FHIRException("Cannot call addChild on a primitive type Condition.dateRecorded");
1666        }
1667        else if (name.equals("code")) {
1668          this.code = new CodeableConcept();
1669          return this.code;
1670        }
1671        else if (name.equals("category")) {
1672          this.category = new CodeableConcept();
1673          return this.category;
1674        }
1675        else if (name.equals("clinicalStatus")) {
1676          throw new FHIRException("Cannot call addChild on a primitive type Condition.clinicalStatus");
1677        }
1678        else if (name.equals("verificationStatus")) {
1679          throw new FHIRException("Cannot call addChild on a primitive type Condition.verificationStatus");
1680        }
1681        else if (name.equals("severity")) {
1682          this.severity = new CodeableConcept();
1683          return this.severity;
1684        }
1685        else if (name.equals("onsetDateTime")) {
1686          this.onset = new DateTimeType();
1687          return this.onset;
1688        }
1689        else if (name.equals("onsetAge")) {
1690          this.onset = new Age();
1691          return this.onset;
1692        }
1693        else if (name.equals("onsetPeriod")) {
1694          this.onset = new Period();
1695          return this.onset;
1696        }
1697        else if (name.equals("onsetRange")) {
1698          this.onset = new Range();
1699          return this.onset;
1700        }
1701        else if (name.equals("onsetString")) {
1702          this.onset = new StringType();
1703          return this.onset;
1704        }
1705        else if (name.equals("abatementDateTime")) {
1706          this.abatement = new DateTimeType();
1707          return this.abatement;
1708        }
1709        else if (name.equals("abatementAge")) {
1710          this.abatement = new Age();
1711          return this.abatement;
1712        }
1713        else if (name.equals("abatementBoolean")) {
1714          this.abatement = new BooleanType();
1715          return this.abatement;
1716        }
1717        else if (name.equals("abatementPeriod")) {
1718          this.abatement = new Period();
1719          return this.abatement;
1720        }
1721        else if (name.equals("abatementRange")) {
1722          this.abatement = new Range();
1723          return this.abatement;
1724        }
1725        else if (name.equals("abatementString")) {
1726          this.abatement = new StringType();
1727          return this.abatement;
1728        }
1729        else if (name.equals("stage")) {
1730          this.stage = new ConditionStageComponent();
1731          return this.stage;
1732        }
1733        else if (name.equals("evidence")) {
1734          return addEvidence();
1735        }
1736        else if (name.equals("bodySite")) {
1737          return addBodySite();
1738        }
1739        else if (name.equals("notes")) {
1740          throw new FHIRException("Cannot call addChild on a primitive type Condition.notes");
1741        }
1742        else
1743          return super.addChild(name);
1744      }
1745
1746  public String fhirType() {
1747    return "Condition";
1748
1749  }
1750
1751      public Condition copy() {
1752        Condition dst = new Condition();
1753        copyValues(dst);
1754        if (identifier != null) {
1755          dst.identifier = new ArrayList<Identifier>();
1756          for (Identifier i : identifier)
1757            dst.identifier.add(i.copy());
1758        };
1759        dst.patient = patient == null ? null : patient.copy();
1760        dst.encounter = encounter == null ? null : encounter.copy();
1761        dst.asserter = asserter == null ? null : asserter.copy();
1762        dst.dateRecorded = dateRecorded == null ? null : dateRecorded.copy();
1763        dst.code = code == null ? null : code.copy();
1764        dst.category = category == null ? null : category.copy();
1765        dst.clinicalStatus = clinicalStatus == null ? null : clinicalStatus.copy();
1766        dst.verificationStatus = verificationStatus == null ? null : verificationStatus.copy();
1767        dst.severity = severity == null ? null : severity.copy();
1768        dst.onset = onset == null ? null : onset.copy();
1769        dst.abatement = abatement == null ? null : abatement.copy();
1770        dst.stage = stage == null ? null : stage.copy();
1771        if (evidence != null) {
1772          dst.evidence = new ArrayList<ConditionEvidenceComponent>();
1773          for (ConditionEvidenceComponent i : evidence)
1774            dst.evidence.add(i.copy());
1775        };
1776        if (bodySite != null) {
1777          dst.bodySite = new ArrayList<CodeableConcept>();
1778          for (CodeableConcept i : bodySite)
1779            dst.bodySite.add(i.copy());
1780        };
1781        dst.notes = notes == null ? null : notes.copy();
1782        return dst;
1783      }
1784
1785      protected Condition typedCopy() {
1786        return copy();
1787      }
1788
1789      @Override
1790      public boolean equalsDeep(Base other) {
1791        if (!super.equalsDeep(other))
1792          return false;
1793        if (!(other instanceof Condition))
1794          return false;
1795        Condition o = (Condition) other;
1796        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true)
1797           && compareDeep(asserter, o.asserter, true) && compareDeep(dateRecorded, o.dateRecorded, true) && compareDeep(code, o.code, true)
1798           && compareDeep(category, o.category, true) && compareDeep(clinicalStatus, o.clinicalStatus, true)
1799           && compareDeep(verificationStatus, o.verificationStatus, true) && compareDeep(severity, o.severity, true)
1800           && compareDeep(onset, o.onset, true) && compareDeep(abatement, o.abatement, true) && compareDeep(stage, o.stage, true)
1801           && compareDeep(evidence, o.evidence, true) && compareDeep(bodySite, o.bodySite, true) && compareDeep(notes, o.notes, true)
1802          ;
1803      }
1804
1805      @Override
1806      public boolean equalsShallow(Base other) {
1807        if (!super.equalsShallow(other))
1808          return false;
1809        if (!(other instanceof Condition))
1810          return false;
1811        Condition o = (Condition) other;
1812        return compareValues(dateRecorded, o.dateRecorded, true) && compareValues(clinicalStatus, o.clinicalStatus, true)
1813           && compareValues(verificationStatus, o.verificationStatus, true) && compareValues(notes, o.notes, true)
1814          ;
1815      }
1816
1817      public boolean isEmpty() {
1818        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
1819           && (encounter == null || encounter.isEmpty()) && (asserter == null || asserter.isEmpty())
1820           && (dateRecorded == null || dateRecorded.isEmpty()) && (code == null || code.isEmpty()) && (category == null || category.isEmpty())
1821           && (clinicalStatus == null || clinicalStatus.isEmpty()) && (verificationStatus == null || verificationStatus.isEmpty())
1822           && (severity == null || severity.isEmpty()) && (onset == null || onset.isEmpty()) && (abatement == null || abatement.isEmpty())
1823           && (stage == null || stage.isEmpty()) && (evidence == null || evidence.isEmpty()) && (bodySite == null || bodySite.isEmpty())
1824           && (notes == null || notes.isEmpty());
1825      }
1826
1827  @Override
1828  public ResourceType getResourceType() {
1829    return ResourceType.Condition;
1830   }
1831
1832 /**
1833   * Search parameter: <b>date-recorded</b>
1834   * <p>
1835   * Description: <b>A date, when the Condition statement was documented</b><br>
1836   * Type: <b>date</b><br>
1837   * Path: <b>Condition.dateRecorded</b><br>
1838   * </p>
1839   */
1840  @SearchParamDefinition(name="date-recorded", path="Condition.dateRecorded", description="A date, when the Condition statement was documented", type="date" )
1841  public static final String SP_DATE_RECORDED = "date-recorded";
1842 /**
1843   * <b>Fluent Client</b> search parameter constant for <b>date-recorded</b>
1844   * <p>
1845   * Description: <b>A date, when the Condition statement was documented</b><br>
1846   * Type: <b>date</b><br>
1847   * Path: <b>Condition.dateRecorded</b><br>
1848   * </p>
1849   */
1850  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE_RECORDED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE_RECORDED);
1851
1852 /**
1853   * Search parameter: <b>asserter</b>
1854   * <p>
1855   * Description: <b>Person who asserts this condition</b><br>
1856   * Type: <b>reference</b><br>
1857   * Path: <b>Condition.asserter</b><br>
1858   * </p>
1859   */
1860  @SearchParamDefinition(name="asserter", path="Condition.asserter", description="Person who asserts this condition", type="reference" )
1861  public static final String SP_ASSERTER = "asserter";
1862 /**
1863   * <b>Fluent Client</b> search parameter constant for <b>asserter</b>
1864   * <p>
1865   * Description: <b>Person who asserts this condition</b><br>
1866   * Type: <b>reference</b><br>
1867   * Path: <b>Condition.asserter</b><br>
1868   * </p>
1869   */
1870  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ASSERTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ASSERTER);
1871
1872/**
1873   * Constant for fluent queries to be used to add include statements. Specifies
1874   * the path value of "<b>Condition:asserter</b>".
1875   */
1876  public static final ca.uhn.fhir.model.api.Include INCLUDE_ASSERTER = new ca.uhn.fhir.model.api.Include("Condition:asserter").toLocked();
1877
1878 /**
1879   * Search parameter: <b>onset</b>
1880   * <p>
1881   * Description: <b>Date related onsets (dateTime and Period)</b><br>
1882   * Type: <b>date</b><br>
1883   * Path: <b>Condition.onset[x]</b><br>
1884   * </p>
1885   */
1886  @SearchParamDefinition(name="onset", path="Condition.onset.as(dateTime) | Condition.onset.as(Period)", description="Date related onsets (dateTime and Period)", type="date" )
1887  public static final String SP_ONSET = "onset";
1888 /**
1889   * <b>Fluent Client</b> search parameter constant for <b>onset</b>
1890   * <p>
1891   * Description: <b>Date related onsets (dateTime and Period)</b><br>
1892   * Type: <b>date</b><br>
1893   * Path: <b>Condition.onset[x]</b><br>
1894   * </p>
1895   */
1896  public static final ca.uhn.fhir.rest.gclient.DateClientParam ONSET = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ONSET);
1897
1898 /**
1899   * Search parameter: <b>evidence</b>
1900   * <p>
1901   * Description: <b>Manifestation/symptom</b><br>
1902   * Type: <b>token</b><br>
1903   * Path: <b>Condition.evidence.code</b><br>
1904   * </p>
1905   */
1906  @SearchParamDefinition(name="evidence", path="Condition.evidence.code", description="Manifestation/symptom", type="token" )
1907  public static final String SP_EVIDENCE = "evidence";
1908 /**
1909   * <b>Fluent Client</b> search parameter constant for <b>evidence</b>
1910   * <p>
1911   * Description: <b>Manifestation/symptom</b><br>
1912   * Type: <b>token</b><br>
1913   * Path: <b>Condition.evidence.code</b><br>
1914   * </p>
1915   */
1916  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVIDENCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EVIDENCE);
1917
1918 /**
1919   * Search parameter: <b>body-site</b>
1920   * <p>
1921   * Description: <b>Anatomical location, if relevant</b><br>
1922   * Type: <b>token</b><br>
1923   * Path: <b>Condition.bodySite</b><br>
1924   * </p>
1925   */
1926  @SearchParamDefinition(name="body-site", path="Condition.bodySite", description="Anatomical location, if relevant", type="token" )
1927  public static final String SP_BODY_SITE = "body-site";
1928 /**
1929   * <b>Fluent Client</b> search parameter constant for <b>body-site</b>
1930   * <p>
1931   * Description: <b>Anatomical location, if relevant</b><br>
1932   * Type: <b>token</b><br>
1933   * Path: <b>Condition.bodySite</b><br>
1934   * </p>
1935   */
1936  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODY_SITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODY_SITE);
1937
1938 /**
1939   * Search parameter: <b>onset-info</b>
1940   * <p>
1941   * Description: <b>Other onsets (boolean, age, range, string)</b><br>
1942   * Type: <b>string</b><br>
1943   * Path: <b>Condition.onset[x]</b><br>
1944   * </p>
1945   */
1946  @SearchParamDefinition(name="onset-info", path="Condition.onset.as(boolean) | Condition.onset.as(Quantity) | Condition.onset.as(Range) | Condition.onset.as(string)", description="Other onsets (boolean, age, range, string)", type="string" )
1947  public static final String SP_ONSET_INFO = "onset-info";
1948 /**
1949   * <b>Fluent Client</b> search parameter constant for <b>onset-info</b>
1950   * <p>
1951   * Description: <b>Other onsets (boolean, age, range, string)</b><br>
1952   * Type: <b>string</b><br>
1953   * Path: <b>Condition.onset[x]</b><br>
1954   * </p>
1955   */
1956  public static final ca.uhn.fhir.rest.gclient.StringClientParam ONSET_INFO = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ONSET_INFO);
1957
1958 /**
1959   * Search parameter: <b>severity</b>
1960   * <p>
1961   * Description: <b>The severity of the condition</b><br>
1962   * Type: <b>token</b><br>
1963   * Path: <b>Condition.severity</b><br>
1964   * </p>
1965   */
1966  @SearchParamDefinition(name="severity", path="Condition.severity", description="The severity of the condition", type="token" )
1967  public static final String SP_SEVERITY = "severity";
1968 /**
1969   * <b>Fluent Client</b> search parameter constant for <b>severity</b>
1970   * <p>
1971   * Description: <b>The severity of the condition</b><br>
1972   * Type: <b>token</b><br>
1973   * Path: <b>Condition.severity</b><br>
1974   * </p>
1975   */
1976  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEVERITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SEVERITY);
1977
1978 /**
1979   * Search parameter: <b>code</b>
1980   * <p>
1981   * Description: <b>Code for the condition</b><br>
1982   * Type: <b>token</b><br>
1983   * Path: <b>Condition.code</b><br>
1984   * </p>
1985   */
1986  @SearchParamDefinition(name="code", path="Condition.code", description="Code for the condition", type="token" )
1987  public static final String SP_CODE = "code";
1988 /**
1989   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1990   * <p>
1991   * Description: <b>Code for the condition</b><br>
1992   * Type: <b>token</b><br>
1993   * Path: <b>Condition.code</b><br>
1994   * </p>
1995   */
1996  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1997
1998 /**
1999   * Search parameter: <b>encounter</b>
2000   * <p>
2001   * Description: <b>Encounter when condition first asserted</b><br>
2002   * Type: <b>reference</b><br>
2003   * Path: <b>Condition.encounter</b><br>
2004   * </p>
2005   */
2006  @SearchParamDefinition(name="encounter", path="Condition.encounter", description="Encounter when condition first asserted", type="reference" )
2007  public static final String SP_ENCOUNTER = "encounter";
2008 /**
2009   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2010   * <p>
2011   * Description: <b>Encounter when condition first asserted</b><br>
2012   * Type: <b>reference</b><br>
2013   * Path: <b>Condition.encounter</b><br>
2014   * </p>
2015   */
2016  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2017
2018/**
2019   * Constant for fluent queries to be used to add include statements. Specifies
2020   * the path value of "<b>Condition:encounter</b>".
2021   */
2022  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Condition:encounter").toLocked();
2023
2024 /**
2025   * Search parameter: <b>stage</b>
2026   * <p>
2027   * Description: <b>Simple summary (disease specific)</b><br>
2028   * Type: <b>token</b><br>
2029   * Path: <b>Condition.stage.summary</b><br>
2030   * </p>
2031   */
2032  @SearchParamDefinition(name="stage", path="Condition.stage.summary", description="Simple summary (disease specific)", type="token" )
2033  public static final String SP_STAGE = "stage";
2034 /**
2035   * <b>Fluent Client</b> search parameter constant for <b>stage</b>
2036   * <p>
2037   * Description: <b>Simple summary (disease specific)</b><br>
2038   * Type: <b>token</b><br>
2039   * Path: <b>Condition.stage.summary</b><br>
2040   * </p>
2041   */
2042  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STAGE);
2043
2044 /**
2045   * Search parameter: <b>category</b>
2046   * <p>
2047   * Description: <b>The category of the condition</b><br>
2048   * Type: <b>token</b><br>
2049   * Path: <b>Condition.category</b><br>
2050   * </p>
2051   */
2052  @SearchParamDefinition(name="category", path="Condition.category", description="The category of the condition", type="token" )
2053  public static final String SP_CATEGORY = "category";
2054 /**
2055   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2056   * <p>
2057   * Description: <b>The category of the condition</b><br>
2058   * Type: <b>token</b><br>
2059   * Path: <b>Condition.category</b><br>
2060   * </p>
2061   */
2062  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2063
2064 /**
2065   * Search parameter: <b>patient</b>
2066   * <p>
2067   * Description: <b>Who has the condition?</b><br>
2068   * Type: <b>reference</b><br>
2069   * Path: <b>Condition.patient</b><br>
2070   * </p>
2071   */
2072  @SearchParamDefinition(name="patient", path="Condition.patient", description="Who has the condition?", type="reference" )
2073  public static final String SP_PATIENT = "patient";
2074 /**
2075   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2076   * <p>
2077   * Description: <b>Who has the condition?</b><br>
2078   * Type: <b>reference</b><br>
2079   * Path: <b>Condition.patient</b><br>
2080   * </p>
2081   */
2082  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2083
2084/**
2085   * Constant for fluent queries to be used to add include statements. Specifies
2086   * the path value of "<b>Condition:patient</b>".
2087   */
2088  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Condition:patient").toLocked();
2089
2090 /**
2091   * Search parameter: <b>clinicalstatus</b>
2092   * <p>
2093   * Description: <b>The clinical status of the condition</b><br>
2094   * Type: <b>token</b><br>
2095   * Path: <b>Condition.clinicalStatus</b><br>
2096   * </p>
2097   */
2098  @SearchParamDefinition(name="clinicalstatus", path="Condition.clinicalStatus", description="The clinical status of the condition", type="token" )
2099  public static final String SP_CLINICALSTATUS = "clinicalstatus";
2100 /**
2101   * <b>Fluent Client</b> search parameter constant for <b>clinicalstatus</b>
2102   * <p>
2103   * Description: <b>The clinical status of the condition</b><br>
2104   * Type: <b>token</b><br>
2105   * Path: <b>Condition.clinicalStatus</b><br>
2106   * </p>
2107   */
2108  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLINICALSTATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLINICALSTATUS);
2109
2110 /**
2111   * Search parameter: <b>identifier</b>
2112   * <p>
2113   * Description: <b>A unique identifier of the condition record</b><br>
2114   * Type: <b>token</b><br>
2115   * Path: <b>Condition.identifier</b><br>
2116   * </p>
2117   */
2118  @SearchParamDefinition(name="identifier", path="Condition.identifier", description="A unique identifier of the condition record", type="token" )
2119  public static final String SP_IDENTIFIER = "identifier";
2120 /**
2121   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2122   * <p>
2123   * Description: <b>A unique identifier of the condition record</b><br>
2124   * Type: <b>token</b><br>
2125   * Path: <b>Condition.identifier</b><br>
2126   * </p>
2127   */
2128  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2129
2130
2131}
2132