001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGender;
041import org.hl7.fhir.dstu2.model.Enumerations.AdministrativeGenderEnumFactory;
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
048import org.hl7.fhir.exceptions.FHIRException;
049import org.hl7.fhir.utilities.Utilities;
050/**
051 * Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.
052 */
053@ResourceDef(name="FamilyMemberHistory", profile="http://hl7.org/fhir/Profile/FamilyMemberHistory")
054public class FamilyMemberHistory extends DomainResource {
055
056    public enum FamilyHistoryStatus {
057        /**
058         * Some health information is known and captured, but not complete - see notes for details.
059         */
060        PARTIAL, 
061        /**
062         * All relevant health information is known and captured.
063         */
064        COMPLETED, 
065        /**
066         * This instance should not have been part of this patient's medical record.
067         */
068        ENTEREDINERROR, 
069        /**
070         * Health information for this individual is unavailable/unknown.
071         */
072        HEALTHUNKNOWN, 
073        /**
074         * added to help the parsers
075         */
076        NULL;
077        public static FamilyHistoryStatus fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("partial".equals(codeString))
081          return PARTIAL;
082        if ("completed".equals(codeString))
083          return COMPLETED;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        if ("health-unknown".equals(codeString))
087          return HEALTHUNKNOWN;
088        throw new FHIRException("Unknown FamilyHistoryStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case PARTIAL: return "partial";
093            case COMPLETED: return "completed";
094            case ENTEREDINERROR: return "entered-in-error";
095            case HEALTHUNKNOWN: return "health-unknown";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case PARTIAL: return "http://hl7.org/fhir/history-status";
102            case COMPLETED: return "http://hl7.org/fhir/history-status";
103            case ENTEREDINERROR: return "http://hl7.org/fhir/history-status";
104            case HEALTHUNKNOWN: return "http://hl7.org/fhir/history-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case PARTIAL: return "Some health information is known and captured, but not complete - see notes for details.";
111            case COMPLETED: return "All relevant health information is known and captured.";
112            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
113            case HEALTHUNKNOWN: return "Health information for this individual is unavailable/unknown.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case PARTIAL: return "Partial";
120            case COMPLETED: return "Completed";
121            case ENTEREDINERROR: return "Entered in error";
122            case HEALTHUNKNOWN: return "Health unknown";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class FamilyHistoryStatusEnumFactory implements EnumFactory<FamilyHistoryStatus> {
129    public FamilyHistoryStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("partial".equals(codeString))
134          return FamilyHistoryStatus.PARTIAL;
135        if ("completed".equals(codeString))
136          return FamilyHistoryStatus.COMPLETED;
137        if ("entered-in-error".equals(codeString))
138          return FamilyHistoryStatus.ENTEREDINERROR;
139        if ("health-unknown".equals(codeString))
140          return FamilyHistoryStatus.HEALTHUNKNOWN;
141        throw new IllegalArgumentException("Unknown FamilyHistoryStatus code '"+codeString+"'");
142        }
143        public Enumeration<FamilyHistoryStatus> fromType(Base code) throws FHIRException {
144          if (code == null || code.isEmpty())
145            return null;
146          String codeString = ((PrimitiveType) code).asStringValue();
147          if (codeString == null || "".equals(codeString))
148            return null;
149        if ("partial".equals(codeString))
150          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.PARTIAL);
151        if ("completed".equals(codeString))
152          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.COMPLETED);
153        if ("entered-in-error".equals(codeString))
154          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.ENTEREDINERROR);
155        if ("health-unknown".equals(codeString))
156          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.HEALTHUNKNOWN);
157        throw new FHIRException("Unknown FamilyHistoryStatus code '"+codeString+"'");
158        }
159    public String toCode(FamilyHistoryStatus code) {
160      if (code == FamilyHistoryStatus.PARTIAL)
161        return "partial";
162      if (code == FamilyHistoryStatus.COMPLETED)
163        return "completed";
164      if (code == FamilyHistoryStatus.ENTEREDINERROR)
165        return "entered-in-error";
166      if (code == FamilyHistoryStatus.HEALTHUNKNOWN)
167        return "health-unknown";
168      return "?";
169      }
170    }
171
172    @Block()
173    public static class FamilyMemberHistoryConditionComponent extends BackboneElement implements IBaseBackboneElement {
174        /**
175         * The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.
176         */
177        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
178        @Description(shortDefinition="Condition suffered by relation", formalDefinition="The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system." )
179        protected CodeableConcept code;
180
181        /**
182         * Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.
183         */
184        @Child(name = "outcome", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
185        @Description(shortDefinition="deceased | permanent disability | etc.", formalDefinition="Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation." )
186        protected CodeableConcept outcome;
187
188        /**
189         * Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.
190         */
191        @Child(name = "onset", type = {Age.class, Range.class, Period.class, StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
192        @Description(shortDefinition="When condition first manifested", formalDefinition="Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence." )
193        protected Type onset;
194
195        /**
196         * An area where general notes can be placed about this specific condition.
197         */
198        @Child(name = "note", type = {Annotation.class}, order=4, min=0, max=1, modifier=false, summary=false)
199        @Description(shortDefinition="Extra information about condition", formalDefinition="An area where general notes can be placed about this specific condition." )
200        protected Annotation note;
201
202        private static final long serialVersionUID = -1221569121L;
203
204    /*
205     * Constructor
206     */
207      public FamilyMemberHistoryConditionComponent() {
208        super();
209      }
210
211    /*
212     * Constructor
213     */
214      public FamilyMemberHistoryConditionComponent(CodeableConcept code) {
215        super();
216        this.code = code;
217      }
218
219        /**
220         * @return {@link #code} (The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.)
221         */
222        public CodeableConcept getCode() { 
223          if (this.code == null)
224            if (Configuration.errorOnAutoCreate())
225              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.code");
226            else if (Configuration.doAutoCreate())
227              this.code = new CodeableConcept(); // cc
228          return this.code;
229        }
230
231        public boolean hasCode() { 
232          return this.code != null && !this.code.isEmpty();
233        }
234
235        /**
236         * @param value {@link #code} (The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.)
237         */
238        public FamilyMemberHistoryConditionComponent setCode(CodeableConcept value) { 
239          this.code = value;
240          return this;
241        }
242
243        /**
244         * @return {@link #outcome} (Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.)
245         */
246        public CodeableConcept getOutcome() { 
247          if (this.outcome == null)
248            if (Configuration.errorOnAutoCreate())
249              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.outcome");
250            else if (Configuration.doAutoCreate())
251              this.outcome = new CodeableConcept(); // cc
252          return this.outcome;
253        }
254
255        public boolean hasOutcome() { 
256          return this.outcome != null && !this.outcome.isEmpty();
257        }
258
259        /**
260         * @param value {@link #outcome} (Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.)
261         */
262        public FamilyMemberHistoryConditionComponent setOutcome(CodeableConcept value) { 
263          this.outcome = value;
264          return this;
265        }
266
267        /**
268         * @return {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
269         */
270        public Type getOnset() { 
271          return this.onset;
272        }
273
274        /**
275         * @return {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
276         */
277        public Age getOnsetAge() throws FHIRException { 
278          if (!(this.onset instanceof Age))
279            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.onset.getClass().getName()+" was encountered");
280          return (Age) this.onset;
281        }
282
283        public boolean hasOnsetAge() { 
284          return this.onset instanceof Age;
285        }
286
287        /**
288         * @return {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
289         */
290        public Range getOnsetRange() throws FHIRException { 
291          if (!(this.onset instanceof Range))
292            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.onset.getClass().getName()+" was encountered");
293          return (Range) this.onset;
294        }
295
296        public boolean hasOnsetRange() { 
297          return this.onset instanceof Range;
298        }
299
300        /**
301         * @return {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
302         */
303        public Period getOnsetPeriod() throws FHIRException { 
304          if (!(this.onset instanceof Period))
305            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.onset.getClass().getName()+" was encountered");
306          return (Period) this.onset;
307        }
308
309        public boolean hasOnsetPeriod() { 
310          return this.onset instanceof Period;
311        }
312
313        /**
314         * @return {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
315         */
316        public StringType getOnsetStringType() throws FHIRException { 
317          if (!(this.onset instanceof StringType))
318            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.onset.getClass().getName()+" was encountered");
319          return (StringType) this.onset;
320        }
321
322        public boolean hasOnsetStringType() { 
323          return this.onset instanceof StringType;
324        }
325
326        public boolean hasOnset() { 
327          return this.onset != null && !this.onset.isEmpty();
328        }
329
330        /**
331         * @param value {@link #onset} (Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.)
332         */
333        public FamilyMemberHistoryConditionComponent setOnset(Type value) { 
334          this.onset = value;
335          return this;
336        }
337
338        /**
339         * @return {@link #note} (An area where general notes can be placed about this specific condition.)
340         */
341        public Annotation getNote() { 
342          if (this.note == null)
343            if (Configuration.errorOnAutoCreate())
344              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.note");
345            else if (Configuration.doAutoCreate())
346              this.note = new Annotation(); // cc
347          return this.note;
348        }
349
350        public boolean hasNote() { 
351          return this.note != null && !this.note.isEmpty();
352        }
353
354        /**
355         * @param value {@link #note} (An area where general notes can be placed about this specific condition.)
356         */
357        public FamilyMemberHistoryConditionComponent setNote(Annotation value) { 
358          this.note = value;
359          return this;
360        }
361
362        protected void listChildren(List<Property> childrenList) {
363          super.listChildren(childrenList);
364          childrenList.add(new Property("code", "CodeableConcept", "The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.", 0, java.lang.Integer.MAX_VALUE, code));
365          childrenList.add(new Property("outcome", "CodeableConcept", "Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.", 0, java.lang.Integer.MAX_VALUE, outcome));
366          childrenList.add(new Property("onset[x]", "Age|Range|Period|string", "Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.", 0, java.lang.Integer.MAX_VALUE, onset));
367          childrenList.add(new Property("note", "Annotation", "An area where general notes can be placed about this specific condition.", 0, java.lang.Integer.MAX_VALUE, note));
368        }
369
370      @Override
371      public void setProperty(String name, Base value) throws FHIRException {
372        if (name.equals("code"))
373          this.code = castToCodeableConcept(value); // CodeableConcept
374        else if (name.equals("outcome"))
375          this.outcome = castToCodeableConcept(value); // CodeableConcept
376        else if (name.equals("onset[x]"))
377          this.onset = (Type) value; // Type
378        else if (name.equals("note"))
379          this.note = castToAnnotation(value); // Annotation
380        else
381          super.setProperty(name, value);
382      }
383
384      @Override
385      public Base addChild(String name) throws FHIRException {
386        if (name.equals("code")) {
387          this.code = new CodeableConcept();
388          return this.code;
389        }
390        else if (name.equals("outcome")) {
391          this.outcome = new CodeableConcept();
392          return this.outcome;
393        }
394        else if (name.equals("onsetAge")) {
395          this.onset = new Age();
396          return this.onset;
397        }
398        else if (name.equals("onsetRange")) {
399          this.onset = new Range();
400          return this.onset;
401        }
402        else if (name.equals("onsetPeriod")) {
403          this.onset = new Period();
404          return this.onset;
405        }
406        else if (name.equals("onsetString")) {
407          this.onset = new StringType();
408          return this.onset;
409        }
410        else if (name.equals("note")) {
411          this.note = new Annotation();
412          return this.note;
413        }
414        else
415          return super.addChild(name);
416      }
417
418      public FamilyMemberHistoryConditionComponent copy() {
419        FamilyMemberHistoryConditionComponent dst = new FamilyMemberHistoryConditionComponent();
420        copyValues(dst);
421        dst.code = code == null ? null : code.copy();
422        dst.outcome = outcome == null ? null : outcome.copy();
423        dst.onset = onset == null ? null : onset.copy();
424        dst.note = note == null ? null : note.copy();
425        return dst;
426      }
427
428      @Override
429      public boolean equalsDeep(Base other) {
430        if (!super.equalsDeep(other))
431          return false;
432        if (!(other instanceof FamilyMemberHistoryConditionComponent))
433          return false;
434        FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other;
435        return compareDeep(code, o.code, true) && compareDeep(outcome, o.outcome, true) && compareDeep(onset, o.onset, true)
436           && compareDeep(note, o.note, true);
437      }
438
439      @Override
440      public boolean equalsShallow(Base other) {
441        if (!super.equalsShallow(other))
442          return false;
443        if (!(other instanceof FamilyMemberHistoryConditionComponent))
444          return false;
445        FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other;
446        return true;
447      }
448
449      public boolean isEmpty() {
450        return super.isEmpty() && (code == null || code.isEmpty()) && (outcome == null || outcome.isEmpty())
451           && (onset == null || onset.isEmpty()) && (note == null || note.isEmpty());
452      }
453
454  public String fhirType() {
455    return "FamilyMemberHistory.condition";
456
457  }
458
459  }
460
461    /**
462     * This records identifiers associated with this family member history record 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).
463     */
464    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
465    @Description(shortDefinition="External Id(s) for this record", formalDefinition="This records identifiers associated with this family member history record 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)." )
466    protected List<Identifier> identifier;
467
468    /**
469     * The person who this history concerns.
470     */
471    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
472    @Description(shortDefinition="Patient history is about", formalDefinition="The person who this history concerns." )
473    protected Reference patient;
474
475    /**
476     * The actual object that is the target of the reference (The person who this history concerns.)
477     */
478    protected Patient patientTarget;
479
480    /**
481     * The date (and possibly time) when the family member history was taken.
482     */
483    @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
484    @Description(shortDefinition="When history was captured/updated", formalDefinition="The date (and possibly time) when the family member history was taken." )
485    protected DateTimeType date;
486
487    /**
488     * A code specifying a state of a Family Member History record.
489     */
490    @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true)
491    @Description(shortDefinition="partial | completed | entered-in-error | health-unknown", formalDefinition="A code specifying a state of a Family Member History record." )
492    protected Enumeration<FamilyHistoryStatus> status;
493
494    /**
495     * This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
496     */
497    @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
498    @Description(shortDefinition="The family member described", formalDefinition="This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\"." )
499    protected StringType name;
500
501    /**
502     * The type of relationship this person has to the patient (father, mother, brother etc.).
503     */
504    @Child(name = "relationship", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true)
505    @Description(shortDefinition="Relationship to the subject", formalDefinition="The type of relationship this person has to the patient (father, mother, brother etc.)." )
506    protected CodeableConcept relationship;
507
508    /**
509     * Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
510     */
511    @Child(name = "gender", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
512    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes." )
513    protected Enumeration<AdministrativeGender> gender;
514
515    /**
516     * The actual or approximate date of birth of the relative.
517     */
518    @Child(name = "born", type = {Period.class, DateType.class, StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
519    @Description(shortDefinition="(approximate) date of birth", formalDefinition="The actual or approximate date of birth of the relative." )
520    protected Type born;
521
522    /**
523     * The actual or approximate age of the relative at the time the family member history is recorded.
524     */
525    @Child(name = "age", type = {Age.class, Range.class, StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
526    @Description(shortDefinition="(approximate) age", formalDefinition="The actual or approximate age of the relative at the time the family member history is recorded." )
527    protected Type age;
528
529    /**
530     * Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.
531     */
532    @Child(name = "deceased", type = {BooleanType.class, Age.class, Range.class, DateType.class, StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
533    @Description(shortDefinition="Dead? How old/when?", formalDefinition="Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record." )
534    protected Type deceased;
535
536    /**
537     * This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.
538     */
539    @Child(name = "note", type = {Annotation.class}, order=10, min=0, max=1, modifier=false, summary=false)
540    @Description(shortDefinition="General note about related person", formalDefinition="This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible." )
541    protected Annotation note;
542
543    /**
544     * The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.
545     */
546    @Child(name = "condition", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
547    @Description(shortDefinition="Condition that the related person had", formalDefinition="The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition." )
548    protected List<FamilyMemberHistoryConditionComponent> condition;
549
550    private static final long serialVersionUID = -1799103041L;
551
552  /*
553   * Constructor
554   */
555    public FamilyMemberHistory() {
556      super();
557    }
558
559  /*
560   * Constructor
561   */
562    public FamilyMemberHistory(Reference patient, Enumeration<FamilyHistoryStatus> status, CodeableConcept relationship) {
563      super();
564      this.patient = patient;
565      this.status = status;
566      this.relationship = relationship;
567    }
568
569    /**
570     * @return {@link #identifier} (This records identifiers associated with this family member history record 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).)
571     */
572    public List<Identifier> getIdentifier() { 
573      if (this.identifier == null)
574        this.identifier = new ArrayList<Identifier>();
575      return this.identifier;
576    }
577
578    public boolean hasIdentifier() { 
579      if (this.identifier == null)
580        return false;
581      for (Identifier item : this.identifier)
582        if (!item.isEmpty())
583          return true;
584      return false;
585    }
586
587    /**
588     * @return {@link #identifier} (This records identifiers associated with this family member history record 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).)
589     */
590    // syntactic sugar
591    public Identifier addIdentifier() { //3
592      Identifier t = new Identifier();
593      if (this.identifier == null)
594        this.identifier = new ArrayList<Identifier>();
595      this.identifier.add(t);
596      return t;
597    }
598
599    // syntactic sugar
600    public FamilyMemberHistory addIdentifier(Identifier t) { //3
601      if (t == null)
602        return this;
603      if (this.identifier == null)
604        this.identifier = new ArrayList<Identifier>();
605      this.identifier.add(t);
606      return this;
607    }
608
609    /**
610     * @return {@link #patient} (The person who this history concerns.)
611     */
612    public Reference getPatient() { 
613      if (this.patient == null)
614        if (Configuration.errorOnAutoCreate())
615          throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
616        else if (Configuration.doAutoCreate())
617          this.patient = new Reference(); // cc
618      return this.patient;
619    }
620
621    public boolean hasPatient() { 
622      return this.patient != null && !this.patient.isEmpty();
623    }
624
625    /**
626     * @param value {@link #patient} (The person who this history concerns.)
627     */
628    public FamilyMemberHistory setPatient(Reference value) { 
629      this.patient = value;
630      return this;
631    }
632
633    /**
634     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person who this history concerns.)
635     */
636    public Patient getPatientTarget() { 
637      if (this.patientTarget == null)
638        if (Configuration.errorOnAutoCreate())
639          throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
640        else if (Configuration.doAutoCreate())
641          this.patientTarget = new Patient(); // aa
642      return this.patientTarget;
643    }
644
645    /**
646     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person who this history concerns.)
647     */
648    public FamilyMemberHistory setPatientTarget(Patient value) { 
649      this.patientTarget = value;
650      return this;
651    }
652
653    /**
654     * @return {@link #date} (The date (and possibly time) when the family member history was taken.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
655     */
656    public DateTimeType getDateElement() { 
657      if (this.date == null)
658        if (Configuration.errorOnAutoCreate())
659          throw new Error("Attempt to auto-create FamilyMemberHistory.date");
660        else if (Configuration.doAutoCreate())
661          this.date = new DateTimeType(); // bb
662      return this.date;
663    }
664
665    public boolean hasDateElement() { 
666      return this.date != null && !this.date.isEmpty();
667    }
668
669    public boolean hasDate() { 
670      return this.date != null && !this.date.isEmpty();
671    }
672
673    /**
674     * @param value {@link #date} (The date (and possibly time) when the family member history was taken.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
675     */
676    public FamilyMemberHistory setDateElement(DateTimeType value) { 
677      this.date = value;
678      return this;
679    }
680
681    /**
682     * @return The date (and possibly time) when the family member history was taken.
683     */
684    public Date getDate() { 
685      return this.date == null ? null : this.date.getValue();
686    }
687
688    /**
689     * @param value The date (and possibly time) when the family member history was taken.
690     */
691    public FamilyMemberHistory setDate(Date value) { 
692      if (value == null)
693        this.date = null;
694      else {
695        if (this.date == null)
696          this.date = new DateTimeType();
697        this.date.setValue(value);
698      }
699      return this;
700    }
701
702    /**
703     * @return {@link #status} (A code specifying a state of a Family Member History record.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
704     */
705    public Enumeration<FamilyHistoryStatus> getStatusElement() { 
706      if (this.status == null)
707        if (Configuration.errorOnAutoCreate())
708          throw new Error("Attempt to auto-create FamilyMemberHistory.status");
709        else if (Configuration.doAutoCreate())
710          this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory()); // bb
711      return this.status;
712    }
713
714    public boolean hasStatusElement() { 
715      return this.status != null && !this.status.isEmpty();
716    }
717
718    public boolean hasStatus() { 
719      return this.status != null && !this.status.isEmpty();
720    }
721
722    /**
723     * @param value {@link #status} (A code specifying a state of a Family Member History record.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
724     */
725    public FamilyMemberHistory setStatusElement(Enumeration<FamilyHistoryStatus> value) { 
726      this.status = value;
727      return this;
728    }
729
730    /**
731     * @return A code specifying a state of a Family Member History record.
732     */
733    public FamilyHistoryStatus getStatus() { 
734      return this.status == null ? null : this.status.getValue();
735    }
736
737    /**
738     * @param value A code specifying a state of a Family Member History record.
739     */
740    public FamilyMemberHistory setStatus(FamilyHistoryStatus value) { 
741        if (this.status == null)
742          this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory());
743        this.status.setValue(value);
744      return this;
745    }
746
747    /**
748     * @return {@link #name} (This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
749     */
750    public StringType getNameElement() { 
751      if (this.name == null)
752        if (Configuration.errorOnAutoCreate())
753          throw new Error("Attempt to auto-create FamilyMemberHistory.name");
754        else if (Configuration.doAutoCreate())
755          this.name = new StringType(); // bb
756      return this.name;
757    }
758
759    public boolean hasNameElement() { 
760      return this.name != null && !this.name.isEmpty();
761    }
762
763    public boolean hasName() { 
764      return this.name != null && !this.name.isEmpty();
765    }
766
767    /**
768     * @param value {@link #name} (This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
769     */
770    public FamilyMemberHistory setNameElement(StringType value) { 
771      this.name = value;
772      return this;
773    }
774
775    /**
776     * @return This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
777     */
778    public String getName() { 
779      return this.name == null ? null : this.name.getValue();
780    }
781
782    /**
783     * @param value This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
784     */
785    public FamilyMemberHistory setName(String value) { 
786      if (Utilities.noString(value))
787        this.name = null;
788      else {
789        if (this.name == null)
790          this.name = new StringType();
791        this.name.setValue(value);
792      }
793      return this;
794    }
795
796    /**
797     * @return {@link #relationship} (The type of relationship this person has to the patient (father, mother, brother etc.).)
798     */
799    public CodeableConcept getRelationship() { 
800      if (this.relationship == null)
801        if (Configuration.errorOnAutoCreate())
802          throw new Error("Attempt to auto-create FamilyMemberHistory.relationship");
803        else if (Configuration.doAutoCreate())
804          this.relationship = new CodeableConcept(); // cc
805      return this.relationship;
806    }
807
808    public boolean hasRelationship() { 
809      return this.relationship != null && !this.relationship.isEmpty();
810    }
811
812    /**
813     * @param value {@link #relationship} (The type of relationship this person has to the patient (father, mother, brother etc.).)
814     */
815    public FamilyMemberHistory setRelationship(CodeableConcept value) { 
816      this.relationship = value;
817      return this;
818    }
819
820    /**
821     * @return {@link #gender} (Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
822     */
823    public Enumeration<AdministrativeGender> getGenderElement() { 
824      if (this.gender == null)
825        if (Configuration.errorOnAutoCreate())
826          throw new Error("Attempt to auto-create FamilyMemberHistory.gender");
827        else if (Configuration.doAutoCreate())
828          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
829      return this.gender;
830    }
831
832    public boolean hasGenderElement() { 
833      return this.gender != null && !this.gender.isEmpty();
834    }
835
836    public boolean hasGender() { 
837      return this.gender != null && !this.gender.isEmpty();
838    }
839
840    /**
841     * @param value {@link #gender} (Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
842     */
843    public FamilyMemberHistory setGenderElement(Enumeration<AdministrativeGender> value) { 
844      this.gender = value;
845      return this;
846    }
847
848    /**
849     * @return Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
850     */
851    public AdministrativeGender getGender() { 
852      return this.gender == null ? null : this.gender.getValue();
853    }
854
855    /**
856     * @param value Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
857     */
858    public FamilyMemberHistory setGender(AdministrativeGender value) { 
859      if (value == null)
860        this.gender = null;
861      else {
862        if (this.gender == null)
863          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
864        this.gender.setValue(value);
865      }
866      return this;
867    }
868
869    /**
870     * @return {@link #born} (The actual or approximate date of birth of the relative.)
871     */
872    public Type getBorn() { 
873      return this.born;
874    }
875
876    /**
877     * @return {@link #born} (The actual or approximate date of birth of the relative.)
878     */
879    public Period getBornPeriod() throws FHIRException { 
880      if (!(this.born instanceof Period))
881        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.born.getClass().getName()+" was encountered");
882      return (Period) this.born;
883    }
884
885    public boolean hasBornPeriod() { 
886      return this.born instanceof Period;
887    }
888
889    /**
890     * @return {@link #born} (The actual or approximate date of birth of the relative.)
891     */
892    public DateType getBornDateType() throws FHIRException { 
893      if (!(this.born instanceof DateType))
894        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.born.getClass().getName()+" was encountered");
895      return (DateType) this.born;
896    }
897
898    public boolean hasBornDateType() { 
899      return this.born instanceof DateType;
900    }
901
902    /**
903     * @return {@link #born} (The actual or approximate date of birth of the relative.)
904     */
905    public StringType getBornStringType() throws FHIRException { 
906      if (!(this.born instanceof StringType))
907        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.born.getClass().getName()+" was encountered");
908      return (StringType) this.born;
909    }
910
911    public boolean hasBornStringType() { 
912      return this.born instanceof StringType;
913    }
914
915    public boolean hasBorn() { 
916      return this.born != null && !this.born.isEmpty();
917    }
918
919    /**
920     * @param value {@link #born} (The actual or approximate date of birth of the relative.)
921     */
922    public FamilyMemberHistory setBorn(Type value) { 
923      this.born = value;
924      return this;
925    }
926
927    /**
928     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
929     */
930    public Type getAge() { 
931      return this.age;
932    }
933
934    /**
935     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
936     */
937    public Age getAgeAge() throws FHIRException { 
938      if (!(this.age instanceof Age))
939        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.age.getClass().getName()+" was encountered");
940      return (Age) this.age;
941    }
942
943    public boolean hasAgeAge() { 
944      return this.age instanceof Age;
945    }
946
947    /**
948     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
949     */
950    public Range getAgeRange() throws FHIRException { 
951      if (!(this.age instanceof Range))
952        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.age.getClass().getName()+" was encountered");
953      return (Range) this.age;
954    }
955
956    public boolean hasAgeRange() { 
957      return this.age instanceof Range;
958    }
959
960    /**
961     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
962     */
963    public StringType getAgeStringType() throws FHIRException { 
964      if (!(this.age instanceof StringType))
965        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.age.getClass().getName()+" was encountered");
966      return (StringType) this.age;
967    }
968
969    public boolean hasAgeStringType() { 
970      return this.age instanceof StringType;
971    }
972
973    public boolean hasAge() { 
974      return this.age != null && !this.age.isEmpty();
975    }
976
977    /**
978     * @param value {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
979     */
980    public FamilyMemberHistory setAge(Type value) { 
981      this.age = value;
982      return this;
983    }
984
985    /**
986     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
987     */
988    public Type getDeceased() { 
989      return this.deceased;
990    }
991
992    /**
993     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
994     */
995    public BooleanType getDeceasedBooleanType() throws FHIRException { 
996      if (!(this.deceased instanceof BooleanType))
997        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.deceased.getClass().getName()+" was encountered");
998      return (BooleanType) this.deceased;
999    }
1000
1001    public boolean hasDeceasedBooleanType() { 
1002      return this.deceased instanceof BooleanType;
1003    }
1004
1005    /**
1006     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
1007     */
1008    public Age getDeceasedAge() throws FHIRException { 
1009      if (!(this.deceased instanceof Age))
1010        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.deceased.getClass().getName()+" was encountered");
1011      return (Age) this.deceased;
1012    }
1013
1014    public boolean hasDeceasedAge() { 
1015      return this.deceased instanceof Age;
1016    }
1017
1018    /**
1019     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
1020     */
1021    public Range getDeceasedRange() throws FHIRException { 
1022      if (!(this.deceased instanceof Range))
1023        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.deceased.getClass().getName()+" was encountered");
1024      return (Range) this.deceased;
1025    }
1026
1027    public boolean hasDeceasedRange() { 
1028      return this.deceased instanceof Range;
1029    }
1030
1031    /**
1032     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
1033     */
1034    public DateType getDeceasedDateType() throws FHIRException { 
1035      if (!(this.deceased instanceof DateType))
1036        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.deceased.getClass().getName()+" was encountered");
1037      return (DateType) this.deceased;
1038    }
1039
1040    public boolean hasDeceasedDateType() { 
1041      return this.deceased instanceof DateType;
1042    }
1043
1044    /**
1045     * @return {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
1046     */
1047    public StringType getDeceasedStringType() throws FHIRException { 
1048      if (!(this.deceased instanceof StringType))
1049        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.deceased.getClass().getName()+" was encountered");
1050      return (StringType) this.deceased;
1051    }
1052
1053    public boolean hasDeceasedStringType() { 
1054      return this.deceased instanceof StringType;
1055    }
1056
1057    public boolean hasDeceased() { 
1058      return this.deceased != null && !this.deceased.isEmpty();
1059    }
1060
1061    /**
1062     * @param value {@link #deceased} (Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.)
1063     */
1064    public FamilyMemberHistory setDeceased(Type value) { 
1065      this.deceased = value;
1066      return this;
1067    }
1068
1069    /**
1070     * @return {@link #note} (This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.)
1071     */
1072    public Annotation getNote() { 
1073      if (this.note == null)
1074        if (Configuration.errorOnAutoCreate())
1075          throw new Error("Attempt to auto-create FamilyMemberHistory.note");
1076        else if (Configuration.doAutoCreate())
1077          this.note = new Annotation(); // cc
1078      return this.note;
1079    }
1080
1081    public boolean hasNote() { 
1082      return this.note != null && !this.note.isEmpty();
1083    }
1084
1085    /**
1086     * @param value {@link #note} (This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.)
1087     */
1088    public FamilyMemberHistory setNote(Annotation value) { 
1089      this.note = value;
1090      return this;
1091    }
1092
1093    /**
1094     * @return {@link #condition} (The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.)
1095     */
1096    public List<FamilyMemberHistoryConditionComponent> getCondition() { 
1097      if (this.condition == null)
1098        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1099      return this.condition;
1100    }
1101
1102    public boolean hasCondition() { 
1103      if (this.condition == null)
1104        return false;
1105      for (FamilyMemberHistoryConditionComponent item : this.condition)
1106        if (!item.isEmpty())
1107          return true;
1108      return false;
1109    }
1110
1111    /**
1112     * @return {@link #condition} (The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.)
1113     */
1114    // syntactic sugar
1115    public FamilyMemberHistoryConditionComponent addCondition() { //3
1116      FamilyMemberHistoryConditionComponent t = new FamilyMemberHistoryConditionComponent();
1117      if (this.condition == null)
1118        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1119      this.condition.add(t);
1120      return t;
1121    }
1122
1123    // syntactic sugar
1124    public FamilyMemberHistory addCondition(FamilyMemberHistoryConditionComponent t) { //3
1125      if (t == null)
1126        return this;
1127      if (this.condition == null)
1128        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1129      this.condition.add(t);
1130      return this;
1131    }
1132
1133      protected void listChildren(List<Property> childrenList) {
1134        super.listChildren(childrenList);
1135        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this family member history record 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));
1136        childrenList.add(new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, java.lang.Integer.MAX_VALUE, patient));
1137        childrenList.add(new Property("date", "dateTime", "The date (and possibly time) when the family member history was taken.", 0, java.lang.Integer.MAX_VALUE, date));
1138        childrenList.add(new Property("status", "code", "A code specifying a state of a Family Member History record.", 0, java.lang.Integer.MAX_VALUE, status));
1139        childrenList.add(new Property("name", "string", "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".", 0, java.lang.Integer.MAX_VALUE, name));
1140        childrenList.add(new Property("relationship", "CodeableConcept", "The type of relationship this person has to the patient (father, mother, brother etc.).", 0, java.lang.Integer.MAX_VALUE, relationship));
1141        childrenList.add(new Property("gender", "code", "Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.", 0, java.lang.Integer.MAX_VALUE, gender));
1142        childrenList.add(new Property("born[x]", "Period|date|string", "The actual or approximate date of birth of the relative.", 0, java.lang.Integer.MAX_VALUE, born));
1143        childrenList.add(new Property("age[x]", "Age|Range|string", "The actual or approximate age of the relative at the time the family member history is recorded.", 0, java.lang.Integer.MAX_VALUE, age));
1144        childrenList.add(new Property("deceased[x]", "boolean|Age|Range|date|string", "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.", 0, java.lang.Integer.MAX_VALUE, deceased));
1145        childrenList.add(new Property("note", "Annotation", "This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.", 0, java.lang.Integer.MAX_VALUE, note));
1146        childrenList.add(new Property("condition", "", "The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.", 0, java.lang.Integer.MAX_VALUE, condition));
1147      }
1148
1149      @Override
1150      public void setProperty(String name, Base value) throws FHIRException {
1151        if (name.equals("identifier"))
1152          this.getIdentifier().add(castToIdentifier(value));
1153        else if (name.equals("patient"))
1154          this.patient = castToReference(value); // Reference
1155        else if (name.equals("date"))
1156          this.date = castToDateTime(value); // DateTimeType
1157        else if (name.equals("status"))
1158          this.status = new FamilyHistoryStatusEnumFactory().fromType(value); // Enumeration<FamilyHistoryStatus>
1159        else if (name.equals("name"))
1160          this.name = castToString(value); // StringType
1161        else if (name.equals("relationship"))
1162          this.relationship = castToCodeableConcept(value); // CodeableConcept
1163        else if (name.equals("gender"))
1164          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
1165        else if (name.equals("born[x]"))
1166          this.born = (Type) value; // Type
1167        else if (name.equals("age[x]"))
1168          this.age = (Type) value; // Type
1169        else if (name.equals("deceased[x]"))
1170          this.deceased = (Type) value; // Type
1171        else if (name.equals("note"))
1172          this.note = castToAnnotation(value); // Annotation
1173        else if (name.equals("condition"))
1174          this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
1175        else
1176          super.setProperty(name, value);
1177      }
1178
1179      @Override
1180      public Base addChild(String name) throws FHIRException {
1181        if (name.equals("identifier")) {
1182          return addIdentifier();
1183        }
1184        else if (name.equals("patient")) {
1185          this.patient = new Reference();
1186          return this.patient;
1187        }
1188        else if (name.equals("date")) {
1189          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.date");
1190        }
1191        else if (name.equals("status")) {
1192          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.status");
1193        }
1194        else if (name.equals("name")) {
1195          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.name");
1196        }
1197        else if (name.equals("relationship")) {
1198          this.relationship = new CodeableConcept();
1199          return this.relationship;
1200        }
1201        else if (name.equals("gender")) {
1202          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.gender");
1203        }
1204        else if (name.equals("bornPeriod")) {
1205          this.born = new Period();
1206          return this.born;
1207        }
1208        else if (name.equals("bornDate")) {
1209          this.born = new DateType();
1210          return this.born;
1211        }
1212        else if (name.equals("bornString")) {
1213          this.born = new StringType();
1214          return this.born;
1215        }
1216        else if (name.equals("ageAge")) {
1217          this.age = new Age();
1218          return this.age;
1219        }
1220        else if (name.equals("ageRange")) {
1221          this.age = new Range();
1222          return this.age;
1223        }
1224        else if (name.equals("ageString")) {
1225          this.age = new StringType();
1226          return this.age;
1227        }
1228        else if (name.equals("deceasedBoolean")) {
1229          this.deceased = new BooleanType();
1230          return this.deceased;
1231        }
1232        else if (name.equals("deceasedAge")) {
1233          this.deceased = new Age();
1234          return this.deceased;
1235        }
1236        else if (name.equals("deceasedRange")) {
1237          this.deceased = new Range();
1238          return this.deceased;
1239        }
1240        else if (name.equals("deceasedDate")) {
1241          this.deceased = new DateType();
1242          return this.deceased;
1243        }
1244        else if (name.equals("deceasedString")) {
1245          this.deceased = new StringType();
1246          return this.deceased;
1247        }
1248        else if (name.equals("note")) {
1249          this.note = new Annotation();
1250          return this.note;
1251        }
1252        else if (name.equals("condition")) {
1253          return addCondition();
1254        }
1255        else
1256          return super.addChild(name);
1257      }
1258
1259  public String fhirType() {
1260    return "FamilyMemberHistory";
1261
1262  }
1263
1264      public FamilyMemberHistory copy() {
1265        FamilyMemberHistory dst = new FamilyMemberHistory();
1266        copyValues(dst);
1267        if (identifier != null) {
1268          dst.identifier = new ArrayList<Identifier>();
1269          for (Identifier i : identifier)
1270            dst.identifier.add(i.copy());
1271        };
1272        dst.patient = patient == null ? null : patient.copy();
1273        dst.date = date == null ? null : date.copy();
1274        dst.status = status == null ? null : status.copy();
1275        dst.name = name == null ? null : name.copy();
1276        dst.relationship = relationship == null ? null : relationship.copy();
1277        dst.gender = gender == null ? null : gender.copy();
1278        dst.born = born == null ? null : born.copy();
1279        dst.age = age == null ? null : age.copy();
1280        dst.deceased = deceased == null ? null : deceased.copy();
1281        dst.note = note == null ? null : note.copy();
1282        if (condition != null) {
1283          dst.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1284          for (FamilyMemberHistoryConditionComponent i : condition)
1285            dst.condition.add(i.copy());
1286        };
1287        return dst;
1288      }
1289
1290      protected FamilyMemberHistory typedCopy() {
1291        return copy();
1292      }
1293
1294      @Override
1295      public boolean equalsDeep(Base other) {
1296        if (!super.equalsDeep(other))
1297          return false;
1298        if (!(other instanceof FamilyMemberHistory))
1299          return false;
1300        FamilyMemberHistory o = (FamilyMemberHistory) other;
1301        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(date, o.date, true)
1302           && compareDeep(status, o.status, true) && compareDeep(name, o.name, true) && compareDeep(relationship, o.relationship, true)
1303           && compareDeep(gender, o.gender, true) && compareDeep(born, o.born, true) && compareDeep(age, o.age, true)
1304           && compareDeep(deceased, o.deceased, true) && compareDeep(note, o.note, true) && compareDeep(condition, o.condition, true)
1305          ;
1306      }
1307
1308      @Override
1309      public boolean equalsShallow(Base other) {
1310        if (!super.equalsShallow(other))
1311          return false;
1312        if (!(other instanceof FamilyMemberHistory))
1313          return false;
1314        FamilyMemberHistory o = (FamilyMemberHistory) other;
1315        return compareValues(date, o.date, true) && compareValues(status, o.status, true) && compareValues(name, o.name, true)
1316           && compareValues(gender, o.gender, true);
1317      }
1318
1319      public boolean isEmpty() {
1320        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
1321           && (date == null || date.isEmpty()) && (status == null || status.isEmpty()) && (name == null || name.isEmpty())
1322           && (relationship == null || relationship.isEmpty()) && (gender == null || gender.isEmpty())
1323           && (born == null || born.isEmpty()) && (age == null || age.isEmpty()) && (deceased == null || deceased.isEmpty())
1324           && (note == null || note.isEmpty()) && (condition == null || condition.isEmpty());
1325      }
1326
1327  @Override
1328  public ResourceType getResourceType() {
1329    return ResourceType.FamilyMemberHistory;
1330   }
1331
1332  @SearchParamDefinition(name="date", path="FamilyMemberHistory.date", description="When history was captured/updated", type="date" )
1333  public static final String SP_DATE = "date";
1334  @SearchParamDefinition(name="identifier", path="FamilyMemberHistory.identifier", description="A search by a record identifier", type="token" )
1335  public static final String SP_IDENTIFIER = "identifier";
1336  @SearchParamDefinition(name="code", path="FamilyMemberHistory.condition.code", description="A search by a condition code", type="token" )
1337  public static final String SP_CODE = "code";
1338  @SearchParamDefinition(name="gender", path="FamilyMemberHistory.gender", description="A search by a gender code of a family member", type="token" )
1339  public static final String SP_GENDER = "gender";
1340  @SearchParamDefinition(name="patient", path="FamilyMemberHistory.patient", description="The identity of a subject to list family member history items for", type="reference" )
1341  public static final String SP_PATIENT = "patient";
1342  @SearchParamDefinition(name="relationship", path="FamilyMemberHistory.relationship", description="A search by a relationship type", type="token" )
1343  public static final String SP_RELATIONSHIP = "relationship";
1344
1345}