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