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