001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGender;
038import org.hl7.fhir.dstu2016may.model.Enumerations.AdministrativeGenderEnumFactory;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.
050 */
051@ResourceDef(name="FamilyMemberHistory", profile="http://hl7.org/fhir/Profile/FamilyMemberHistory")
052public class FamilyMemberHistory extends DomainResource {
053
054    public enum FamilyHistoryStatus {
055        /**
056         * Some health information is known and captured, but not complete - see notes for details.
057         */
058        PARTIAL, 
059        /**
060         * All relevant health information is known and captured.
061         */
062        COMPLETED, 
063        /**
064         * This instance should not have been part of this patient's medical record.
065         */
066        ENTEREDINERROR, 
067        /**
068         * Health information for this individual is unavailable/unknown.
069         */
070        HEALTHUNKNOWN, 
071        /**
072         * added to help the parsers
073         */
074        NULL;
075        public static FamilyHistoryStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("partial".equals(codeString))
079          return PARTIAL;
080        if ("completed".equals(codeString))
081          return COMPLETED;
082        if ("entered-in-error".equals(codeString))
083          return ENTEREDINERROR;
084        if ("health-unknown".equals(codeString))
085          return HEALTHUNKNOWN;
086        throw new FHIRException("Unknown FamilyHistoryStatus code '"+codeString+"'");
087        }
088        public String toCode() {
089          switch (this) {
090            case PARTIAL: return "partial";
091            case COMPLETED: return "completed";
092            case ENTEREDINERROR: return "entered-in-error";
093            case HEALTHUNKNOWN: return "health-unknown";
094            default: return "?";
095          }
096        }
097        public String getSystem() {
098          switch (this) {
099            case PARTIAL: return "http://hl7.org/fhir/history-status";
100            case COMPLETED: return "http://hl7.org/fhir/history-status";
101            case ENTEREDINERROR: return "http://hl7.org/fhir/history-status";
102            case HEALTHUNKNOWN: return "http://hl7.org/fhir/history-status";
103            default: return "?";
104          }
105        }
106        public String getDefinition() {
107          switch (this) {
108            case PARTIAL: return "Some health information is known and captured, but not complete - see notes for details.";
109            case COMPLETED: return "All relevant health information is known and captured.";
110            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
111            case HEALTHUNKNOWN: return "Health information for this individual is unavailable/unknown.";
112            default: return "?";
113          }
114        }
115        public String getDisplay() {
116          switch (this) {
117            case PARTIAL: return "Partial";
118            case COMPLETED: return "Completed";
119            case ENTEREDINERROR: return "Entered in error";
120            case HEALTHUNKNOWN: return "Health unknown";
121            default: return "?";
122          }
123        }
124    }
125
126  public static class FamilyHistoryStatusEnumFactory implements EnumFactory<FamilyHistoryStatus> {
127    public FamilyHistoryStatus fromCode(String codeString) throws IllegalArgumentException {
128      if (codeString == null || "".equals(codeString))
129            if (codeString == null || "".equals(codeString))
130                return null;
131        if ("partial".equals(codeString))
132          return FamilyHistoryStatus.PARTIAL;
133        if ("completed".equals(codeString))
134          return FamilyHistoryStatus.COMPLETED;
135        if ("entered-in-error".equals(codeString))
136          return FamilyHistoryStatus.ENTEREDINERROR;
137        if ("health-unknown".equals(codeString))
138          return FamilyHistoryStatus.HEALTHUNKNOWN;
139        throw new IllegalArgumentException("Unknown FamilyHistoryStatus code '"+codeString+"'");
140        }
141        public Enumeration<FamilyHistoryStatus> fromType(Base code) throws FHIRException {
142          if (code == null || code.isEmpty())
143            return null;
144          String codeString = ((PrimitiveType) code).asStringValue();
145          if (codeString == null || "".equals(codeString))
146            return null;
147        if ("partial".equals(codeString))
148          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.PARTIAL);
149        if ("completed".equals(codeString))
150          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.COMPLETED);
151        if ("entered-in-error".equals(codeString))
152          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.ENTEREDINERROR);
153        if ("health-unknown".equals(codeString))
154          return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.HEALTHUNKNOWN);
155        throw new FHIRException("Unknown FamilyHistoryStatus code '"+codeString+"'");
156        }
157    public String toCode(FamilyHistoryStatus code) {
158      if (code == FamilyHistoryStatus.PARTIAL)
159        return "partial";
160      if (code == FamilyHistoryStatus.COMPLETED)
161        return "completed";
162      if (code == FamilyHistoryStatus.ENTEREDINERROR)
163        return "entered-in-error";
164      if (code == FamilyHistoryStatus.HEALTHUNKNOWN)
165        return "health-unknown";
166      return "?";
167      }
168    public String toSystem(FamilyHistoryStatus code) {
169      return code.getSystem();
170      }
171    }
172
173    @Block()
174    public static class FamilyMemberHistoryConditionComponent extends BackboneElement implements IBaseBackboneElement {
175        /**
176         * 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.
177         */
178        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
179        @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." )
180        protected CodeableConcept code;
181
182        /**
183         * Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.
184         */
185        @Child(name = "outcome", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
186        @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." )
187        protected CodeableConcept outcome;
188
189        /**
190         * 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.
191         */
192        @Child(name = "onset", type = {Age.class, Range.class, Period.class, StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
193        @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." )
194        protected Type onset;
195
196        /**
197         * An area where general notes can be placed about this specific condition.
198         */
199        @Child(name = "note", type = {Annotation.class}, order=4, min=0, max=1, modifier=false, summary=false)
200        @Description(shortDefinition="Extra information about condition", formalDefinition="An area where general notes can be placed about this specific condition." )
201        protected Annotation note;
202
203        private static final long serialVersionUID = -1221569121L;
204
205    /**
206     * Constructor
207     */
208      public FamilyMemberHistoryConditionComponent() {
209        super();
210      }
211
212    /**
213     * Constructor
214     */
215      public FamilyMemberHistoryConditionComponent(CodeableConcept code) {
216        super();
217        this.code = code;
218      }
219
220        /**
221         * @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.)
222         */
223        public CodeableConcept getCode() { 
224          if (this.code == null)
225            if (Configuration.errorOnAutoCreate())
226              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.code");
227            else if (Configuration.doAutoCreate())
228              this.code = new CodeableConcept(); // cc
229          return this.code;
230        }
231
232        public boolean hasCode() { 
233          return this.code != null && !this.code.isEmpty();
234        }
235
236        /**
237         * @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.)
238         */
239        public FamilyMemberHistoryConditionComponent setCode(CodeableConcept value) { 
240          this.code = value;
241          return this;
242        }
243
244        /**
245         * @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.)
246         */
247        public CodeableConcept getOutcome() { 
248          if (this.outcome == null)
249            if (Configuration.errorOnAutoCreate())
250              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.outcome");
251            else if (Configuration.doAutoCreate())
252              this.outcome = new CodeableConcept(); // cc
253          return this.outcome;
254        }
255
256        public boolean hasOutcome() { 
257          return this.outcome != null && !this.outcome.isEmpty();
258        }
259
260        /**
261         * @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.)
262         */
263        public FamilyMemberHistoryConditionComponent setOutcome(CodeableConcept value) { 
264          this.outcome = value;
265          return this;
266        }
267
268        /**
269         * @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.)
270         */
271        public Type getOnset() { 
272          return this.onset;
273        }
274
275        /**
276         * @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.)
277         */
278        public Age getOnsetAge() throws FHIRException { 
279          if (!(this.onset instanceof Age))
280            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.onset.getClass().getName()+" was encountered");
281          return (Age) this.onset;
282        }
283
284        public boolean hasOnsetAge() { 
285          return this.onset instanceof Age;
286        }
287
288        /**
289         * @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.)
290         */
291        public Range getOnsetRange() throws FHIRException { 
292          if (!(this.onset instanceof Range))
293            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.onset.getClass().getName()+" was encountered");
294          return (Range) this.onset;
295        }
296
297        public boolean hasOnsetRange() { 
298          return this.onset instanceof Range;
299        }
300
301        /**
302         * @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.)
303         */
304        public Period getOnsetPeriod() throws FHIRException { 
305          if (!(this.onset instanceof Period))
306            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.onset.getClass().getName()+" was encountered");
307          return (Period) this.onset;
308        }
309
310        public boolean hasOnsetPeriod() { 
311          return this.onset instanceof Period;
312        }
313
314        /**
315         * @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.)
316         */
317        public StringType getOnsetStringType() throws FHIRException { 
318          if (!(this.onset instanceof StringType))
319            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.onset.getClass().getName()+" was encountered");
320          return (StringType) this.onset;
321        }
322
323        public boolean hasOnsetStringType() { 
324          return this.onset instanceof StringType;
325        }
326
327        public boolean hasOnset() { 
328          return this.onset != null && !this.onset.isEmpty();
329        }
330
331        /**
332         * @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.)
333         */
334        public FamilyMemberHistoryConditionComponent setOnset(Type value) { 
335          this.onset = value;
336          return this;
337        }
338
339        /**
340         * @return {@link #note} (An area where general notes can be placed about this specific condition.)
341         */
342        public Annotation getNote() { 
343          if (this.note == null)
344            if (Configuration.errorOnAutoCreate())
345              throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.note");
346            else if (Configuration.doAutoCreate())
347              this.note = new Annotation(); // cc
348          return this.note;
349        }
350
351        public boolean hasNote() { 
352          return this.note != null && !this.note.isEmpty();
353        }
354
355        /**
356         * @param value {@link #note} (An area where general notes can be placed about this specific condition.)
357         */
358        public FamilyMemberHistoryConditionComponent setNote(Annotation value) { 
359          this.note = value;
360          return this;
361        }
362
363        protected void listChildren(List<Property> childrenList) {
364          super.listChildren(childrenList);
365          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));
366          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));
367          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));
368          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));
369        }
370
371      @Override
372      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
373        switch (hash) {
374        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
375        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
376        case 105901603: /*onset*/ return this.onset == null ? new Base[0] : new Base[] {this.onset}; // Type
377        case 3387378: /*note*/ return this.note == null ? new Base[0] : new Base[] {this.note}; // Annotation
378        default: return super.getProperty(hash, name, checkValid);
379        }
380
381      }
382
383      @Override
384      public void setProperty(int hash, String name, Base value) throws FHIRException {
385        switch (hash) {
386        case 3059181: // code
387          this.code = castToCodeableConcept(value); // CodeableConcept
388          break;
389        case -1106507950: // outcome
390          this.outcome = castToCodeableConcept(value); // CodeableConcept
391          break;
392        case 105901603: // onset
393          this.onset = (Type) value; // Type
394          break;
395        case 3387378: // note
396          this.note = castToAnnotation(value); // Annotation
397          break;
398        default: super.setProperty(hash, name, value);
399        }
400
401      }
402
403      @Override
404      public void setProperty(String name, Base value) throws FHIRException {
405        if (name.equals("code"))
406          this.code = castToCodeableConcept(value); // CodeableConcept
407        else if (name.equals("outcome"))
408          this.outcome = castToCodeableConcept(value); // CodeableConcept
409        else if (name.equals("onset[x]"))
410          this.onset = (Type) value; // Type
411        else if (name.equals("note"))
412          this.note = castToAnnotation(value); // Annotation
413        else
414          super.setProperty(name, value);
415      }
416
417      @Override
418      public Base makeProperty(int hash, String name) throws FHIRException {
419        switch (hash) {
420        case 3059181:  return getCode(); // CodeableConcept
421        case -1106507950:  return getOutcome(); // CodeableConcept
422        case -1886216323:  return getOnset(); // Type
423        case 3387378:  return getNote(); // Annotation
424        default: return super.makeProperty(hash, name);
425        }
426
427      }
428
429      @Override
430      public Base addChild(String name) throws FHIRException {
431        if (name.equals("code")) {
432          this.code = new CodeableConcept();
433          return this.code;
434        }
435        else if (name.equals("outcome")) {
436          this.outcome = new CodeableConcept();
437          return this.outcome;
438        }
439        else if (name.equals("onsetAge")) {
440          this.onset = new Age();
441          return this.onset;
442        }
443        else if (name.equals("onsetRange")) {
444          this.onset = new Range();
445          return this.onset;
446        }
447        else if (name.equals("onsetPeriod")) {
448          this.onset = new Period();
449          return this.onset;
450        }
451        else if (name.equals("onsetString")) {
452          this.onset = new StringType();
453          return this.onset;
454        }
455        else if (name.equals("note")) {
456          this.note = new Annotation();
457          return this.note;
458        }
459        else
460          return super.addChild(name);
461      }
462
463      public FamilyMemberHistoryConditionComponent copy() {
464        FamilyMemberHistoryConditionComponent dst = new FamilyMemberHistoryConditionComponent();
465        copyValues(dst);
466        dst.code = code == null ? null : code.copy();
467        dst.outcome = outcome == null ? null : outcome.copy();
468        dst.onset = onset == null ? null : onset.copy();
469        dst.note = note == null ? null : note.copy();
470        return dst;
471      }
472
473      @Override
474      public boolean equalsDeep(Base other) {
475        if (!super.equalsDeep(other))
476          return false;
477        if (!(other instanceof FamilyMemberHistoryConditionComponent))
478          return false;
479        FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other;
480        return compareDeep(code, o.code, true) && compareDeep(outcome, o.outcome, true) && compareDeep(onset, o.onset, true)
481           && compareDeep(note, o.note, true);
482      }
483
484      @Override
485      public boolean equalsShallow(Base other) {
486        if (!super.equalsShallow(other))
487          return false;
488        if (!(other instanceof FamilyMemberHistoryConditionComponent))
489          return false;
490        FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other;
491        return true;
492      }
493
494      public boolean isEmpty() {
495        return super.isEmpty() && (code == null || code.isEmpty()) && (outcome == null || outcome.isEmpty())
496           && (onset == null || onset.isEmpty()) && (note == null || note.isEmpty());
497      }
498
499  public String fhirType() {
500    return "FamilyMemberHistory.condition";
501
502  }
503
504  }
505
506    /**
507     * 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).
508     */
509    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
510    @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)." )
511    protected List<Identifier> identifier;
512
513    /**
514     * The person who this history concerns.
515     */
516    @Child(name = "patient", type = {Patient.class}, order=1, min=1, max=1, modifier=false, summary=true)
517    @Description(shortDefinition="Patient history is about", formalDefinition="The person who this history concerns." )
518    protected Reference patient;
519
520    /**
521     * The actual object that is the target of the reference (The person who this history concerns.)
522     */
523    protected Patient patientTarget;
524
525    /**
526     * The date (and possibly time) when the family member history was taken.
527     */
528    @Child(name = "date", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
529    @Description(shortDefinition="When history was captured/updated", formalDefinition="The date (and possibly time) when the family member history was taken." )
530    protected DateTimeType date;
531
532    /**
533     * A code specifying a state of a Family Member History record.
534     */
535    @Child(name = "status", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true)
536    @Description(shortDefinition="partial | completed | entered-in-error | health-unknown", formalDefinition="A code specifying a state of a Family Member History record." )
537    protected Enumeration<FamilyHistoryStatus> status;
538
539    /**
540     * This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
541     */
542    @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
543    @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\"." )
544    protected StringType name;
545
546    /**
547     * The type of relationship this person has to the patient (father, mother, brother etc.).
548     */
549    @Child(name = "relationship", type = {CodeableConcept.class}, order=5, min=1, max=1, modifier=false, summary=true)
550    @Description(shortDefinition="Relationship to the subject", formalDefinition="The type of relationship this person has to the patient (father, mother, brother etc.)." )
551    protected CodeableConcept relationship;
552
553    /**
554     * Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
555     */
556    @Child(name = "gender", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
557    @Description(shortDefinition="male | female | other | unknown", formalDefinition="Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes." )
558    protected Enumeration<AdministrativeGender> gender;
559
560    /**
561     * The actual or approximate date of birth of the relative.
562     */
563    @Child(name = "born", type = {Period.class, DateType.class, StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
564    @Description(shortDefinition="(approximate) date of birth", formalDefinition="The actual or approximate date of birth of the relative." )
565    protected Type born;
566
567    /**
568     * The actual or approximate age of the relative at the time the family member history is recorded.
569     */
570    @Child(name = "age", type = {Age.class, Range.class, StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
571    @Description(shortDefinition="(approximate) age", formalDefinition="The actual or approximate age of the relative at the time the family member history is recorded." )
572    protected Type age;
573
574    /**
575     * Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.
576     */
577    @Child(name = "deceased", type = {BooleanType.class, Age.class, Range.class, DateType.class, StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
578    @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." )
579    protected Type deceased;
580
581    /**
582     * 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.
583     */
584    @Child(name = "note", type = {Annotation.class}, order=10, min=0, max=1, modifier=false, summary=false)
585    @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." )
586    protected Annotation note;
587
588    /**
589     * 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.
590     */
591    @Child(name = "condition", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
592    @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." )
593    protected List<FamilyMemberHistoryConditionComponent> condition;
594
595    private static final long serialVersionUID = -1799103041L;
596
597  /**
598   * Constructor
599   */
600    public FamilyMemberHistory() {
601      super();
602    }
603
604  /**
605   * Constructor
606   */
607    public FamilyMemberHistory(Reference patient, Enumeration<FamilyHistoryStatus> status, CodeableConcept relationship) {
608      super();
609      this.patient = patient;
610      this.status = status;
611      this.relationship = relationship;
612    }
613
614    /**
615     * @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).)
616     */
617    public List<Identifier> getIdentifier() { 
618      if (this.identifier == null)
619        this.identifier = new ArrayList<Identifier>();
620      return this.identifier;
621    }
622
623    public boolean hasIdentifier() { 
624      if (this.identifier == null)
625        return false;
626      for (Identifier item : this.identifier)
627        if (!item.isEmpty())
628          return true;
629      return false;
630    }
631
632    /**
633     * @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).)
634     */
635    // syntactic sugar
636    public Identifier addIdentifier() { //3
637      Identifier t = new Identifier();
638      if (this.identifier == null)
639        this.identifier = new ArrayList<Identifier>();
640      this.identifier.add(t);
641      return t;
642    }
643
644    // syntactic sugar
645    public FamilyMemberHistory addIdentifier(Identifier t) { //3
646      if (t == null)
647        return this;
648      if (this.identifier == null)
649        this.identifier = new ArrayList<Identifier>();
650      this.identifier.add(t);
651      return this;
652    }
653
654    /**
655     * @return {@link #patient} (The person who this history concerns.)
656     */
657    public Reference getPatient() { 
658      if (this.patient == null)
659        if (Configuration.errorOnAutoCreate())
660          throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
661        else if (Configuration.doAutoCreate())
662          this.patient = new Reference(); // cc
663      return this.patient;
664    }
665
666    public boolean hasPatient() { 
667      return this.patient != null && !this.patient.isEmpty();
668    }
669
670    /**
671     * @param value {@link #patient} (The person who this history concerns.)
672     */
673    public FamilyMemberHistory setPatient(Reference value) { 
674      this.patient = value;
675      return this;
676    }
677
678    /**
679     * @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.)
680     */
681    public Patient getPatientTarget() { 
682      if (this.patientTarget == null)
683        if (Configuration.errorOnAutoCreate())
684          throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
685        else if (Configuration.doAutoCreate())
686          this.patientTarget = new Patient(); // aa
687      return this.patientTarget;
688    }
689
690    /**
691     * @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.)
692     */
693    public FamilyMemberHistory setPatientTarget(Patient value) { 
694      this.patientTarget = value;
695      return this;
696    }
697
698    /**
699     * @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
700     */
701    public DateTimeType getDateElement() { 
702      if (this.date == null)
703        if (Configuration.errorOnAutoCreate())
704          throw new Error("Attempt to auto-create FamilyMemberHistory.date");
705        else if (Configuration.doAutoCreate())
706          this.date = new DateTimeType(); // bb
707      return this.date;
708    }
709
710    public boolean hasDateElement() { 
711      return this.date != null && !this.date.isEmpty();
712    }
713
714    public boolean hasDate() { 
715      return this.date != null && !this.date.isEmpty();
716    }
717
718    /**
719     * @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
720     */
721    public FamilyMemberHistory setDateElement(DateTimeType value) { 
722      this.date = value;
723      return this;
724    }
725
726    /**
727     * @return The date (and possibly time) when the family member history was taken.
728     */
729    public Date getDate() { 
730      return this.date == null ? null : this.date.getValue();
731    }
732
733    /**
734     * @param value The date (and possibly time) when the family member history was taken.
735     */
736    public FamilyMemberHistory setDate(Date value) { 
737      if (value == null)
738        this.date = null;
739      else {
740        if (this.date == null)
741          this.date = new DateTimeType();
742        this.date.setValue(value);
743      }
744      return this;
745    }
746
747    /**
748     * @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
749     */
750    public Enumeration<FamilyHistoryStatus> getStatusElement() { 
751      if (this.status == null)
752        if (Configuration.errorOnAutoCreate())
753          throw new Error("Attempt to auto-create FamilyMemberHistory.status");
754        else if (Configuration.doAutoCreate())
755          this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory()); // bb
756      return this.status;
757    }
758
759    public boolean hasStatusElement() { 
760      return this.status != null && !this.status.isEmpty();
761    }
762
763    public boolean hasStatus() { 
764      return this.status != null && !this.status.isEmpty();
765    }
766
767    /**
768     * @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
769     */
770    public FamilyMemberHistory setStatusElement(Enumeration<FamilyHistoryStatus> value) { 
771      this.status = value;
772      return this;
773    }
774
775    /**
776     * @return A code specifying a state of a Family Member History record.
777     */
778    public FamilyHistoryStatus getStatus() { 
779      return this.status == null ? null : this.status.getValue();
780    }
781
782    /**
783     * @param value A code specifying a state of a Family Member History record.
784     */
785    public FamilyMemberHistory setStatus(FamilyHistoryStatus value) { 
786        if (this.status == null)
787          this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory());
788        this.status.setValue(value);
789      return this;
790    }
791
792    /**
793     * @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
794     */
795    public StringType getNameElement() { 
796      if (this.name == null)
797        if (Configuration.errorOnAutoCreate())
798          throw new Error("Attempt to auto-create FamilyMemberHistory.name");
799        else if (Configuration.doAutoCreate())
800          this.name = new StringType(); // bb
801      return this.name;
802    }
803
804    public boolean hasNameElement() { 
805      return this.name != null && !this.name.isEmpty();
806    }
807
808    public boolean hasName() { 
809      return this.name != null && !this.name.isEmpty();
810    }
811
812    /**
813     * @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
814     */
815    public FamilyMemberHistory setNameElement(StringType value) { 
816      this.name = value;
817      return this;
818    }
819
820    /**
821     * @return This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
822     */
823    public String getName() { 
824      return this.name == null ? null : this.name.getValue();
825    }
826
827    /**
828     * @param value This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".
829     */
830    public FamilyMemberHistory setName(String value) { 
831      if (Utilities.noString(value))
832        this.name = null;
833      else {
834        if (this.name == null)
835          this.name = new StringType();
836        this.name.setValue(value);
837      }
838      return this;
839    }
840
841    /**
842     * @return {@link #relationship} (The type of relationship this person has to the patient (father, mother, brother etc.).)
843     */
844    public CodeableConcept getRelationship() { 
845      if (this.relationship == null)
846        if (Configuration.errorOnAutoCreate())
847          throw new Error("Attempt to auto-create FamilyMemberHistory.relationship");
848        else if (Configuration.doAutoCreate())
849          this.relationship = new CodeableConcept(); // cc
850      return this.relationship;
851    }
852
853    public boolean hasRelationship() { 
854      return this.relationship != null && !this.relationship.isEmpty();
855    }
856
857    /**
858     * @param value {@link #relationship} (The type of relationship this person has to the patient (father, mother, brother etc.).)
859     */
860    public FamilyMemberHistory setRelationship(CodeableConcept value) { 
861      this.relationship = value;
862      return this;
863    }
864
865    /**
866     * @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
867     */
868    public Enumeration<AdministrativeGender> getGenderElement() { 
869      if (this.gender == null)
870        if (Configuration.errorOnAutoCreate())
871          throw new Error("Attempt to auto-create FamilyMemberHistory.gender");
872        else if (Configuration.doAutoCreate())
873          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
874      return this.gender;
875    }
876
877    public boolean hasGenderElement() { 
878      return this.gender != null && !this.gender.isEmpty();
879    }
880
881    public boolean hasGender() { 
882      return this.gender != null && !this.gender.isEmpty();
883    }
884
885    /**
886     * @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
887     */
888    public FamilyMemberHistory setGenderElement(Enumeration<AdministrativeGender> value) { 
889      this.gender = value;
890      return this;
891    }
892
893    /**
894     * @return Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
895     */
896    public AdministrativeGender getGender() { 
897      return this.gender == null ? null : this.gender.getValue();
898    }
899
900    /**
901     * @param value Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.
902     */
903    public FamilyMemberHistory setGender(AdministrativeGender value) { 
904      if (value == null)
905        this.gender = null;
906      else {
907        if (this.gender == null)
908          this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
909        this.gender.setValue(value);
910      }
911      return this;
912    }
913
914    /**
915     * @return {@link #born} (The actual or approximate date of birth of the relative.)
916     */
917    public Type getBorn() { 
918      return this.born;
919    }
920
921    /**
922     * @return {@link #born} (The actual or approximate date of birth of the relative.)
923     */
924    public Period getBornPeriod() throws FHIRException { 
925      if (!(this.born instanceof Period))
926        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.born.getClass().getName()+" was encountered");
927      return (Period) this.born;
928    }
929
930    public boolean hasBornPeriod() { 
931      return this.born instanceof Period;
932    }
933
934    /**
935     * @return {@link #born} (The actual or approximate date of birth of the relative.)
936     */
937    public DateType getBornDateType() throws FHIRException { 
938      if (!(this.born instanceof DateType))
939        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.born.getClass().getName()+" was encountered");
940      return (DateType) this.born;
941    }
942
943    public boolean hasBornDateType() { 
944      return this.born instanceof DateType;
945    }
946
947    /**
948     * @return {@link #born} (The actual or approximate date of birth of the relative.)
949     */
950    public StringType getBornStringType() throws FHIRException { 
951      if (!(this.born instanceof StringType))
952        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.born.getClass().getName()+" was encountered");
953      return (StringType) this.born;
954    }
955
956    public boolean hasBornStringType() { 
957      return this.born instanceof StringType;
958    }
959
960    public boolean hasBorn() { 
961      return this.born != null && !this.born.isEmpty();
962    }
963
964    /**
965     * @param value {@link #born} (The actual or approximate date of birth of the relative.)
966     */
967    public FamilyMemberHistory setBorn(Type value) { 
968      this.born = value;
969      return this;
970    }
971
972    /**
973     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
974     */
975    public Type getAge() { 
976      return this.age;
977    }
978
979    /**
980     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
981     */
982    public Age getAgeAge() throws FHIRException { 
983      if (!(this.age instanceof Age))
984        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.age.getClass().getName()+" was encountered");
985      return (Age) this.age;
986    }
987
988    public boolean hasAgeAge() { 
989      return this.age instanceof Age;
990    }
991
992    /**
993     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
994     */
995    public Range getAgeRange() throws FHIRException { 
996      if (!(this.age instanceof Range))
997        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.age.getClass().getName()+" was encountered");
998      return (Range) this.age;
999    }
1000
1001    public boolean hasAgeRange() { 
1002      return this.age instanceof Range;
1003    }
1004
1005    /**
1006     * @return {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
1007     */
1008    public StringType getAgeStringType() throws FHIRException { 
1009      if (!(this.age instanceof StringType))
1010        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.age.getClass().getName()+" was encountered");
1011      return (StringType) this.age;
1012    }
1013
1014    public boolean hasAgeStringType() { 
1015      return this.age instanceof StringType;
1016    }
1017
1018    public boolean hasAge() { 
1019      return this.age != null && !this.age.isEmpty();
1020    }
1021
1022    /**
1023     * @param value {@link #age} (The actual or approximate age of the relative at the time the family member history is recorded.)
1024     */
1025    public FamilyMemberHistory setAge(Type value) { 
1026      this.age = value;
1027      return this;
1028    }
1029
1030    /**
1031     * @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.)
1032     */
1033    public Type getDeceased() { 
1034      return this.deceased;
1035    }
1036
1037    /**
1038     * @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.)
1039     */
1040    public BooleanType getDeceasedBooleanType() throws FHIRException { 
1041      if (!(this.deceased instanceof BooleanType))
1042        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.deceased.getClass().getName()+" was encountered");
1043      return (BooleanType) this.deceased;
1044    }
1045
1046    public boolean hasDeceasedBooleanType() { 
1047      return this.deceased instanceof BooleanType;
1048    }
1049
1050    /**
1051     * @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.)
1052     */
1053    public Age getDeceasedAge() throws FHIRException { 
1054      if (!(this.deceased instanceof Age))
1055        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.deceased.getClass().getName()+" was encountered");
1056      return (Age) this.deceased;
1057    }
1058
1059    public boolean hasDeceasedAge() { 
1060      return this.deceased instanceof Age;
1061    }
1062
1063    /**
1064     * @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.)
1065     */
1066    public Range getDeceasedRange() throws FHIRException { 
1067      if (!(this.deceased instanceof Range))
1068        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.deceased.getClass().getName()+" was encountered");
1069      return (Range) this.deceased;
1070    }
1071
1072    public boolean hasDeceasedRange() { 
1073      return this.deceased instanceof Range;
1074    }
1075
1076    /**
1077     * @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.)
1078     */
1079    public DateType getDeceasedDateType() throws FHIRException { 
1080      if (!(this.deceased instanceof DateType))
1081        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.deceased.getClass().getName()+" was encountered");
1082      return (DateType) this.deceased;
1083    }
1084
1085    public boolean hasDeceasedDateType() { 
1086      return this.deceased instanceof DateType;
1087    }
1088
1089    /**
1090     * @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.)
1091     */
1092    public StringType getDeceasedStringType() throws FHIRException { 
1093      if (!(this.deceased instanceof StringType))
1094        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.deceased.getClass().getName()+" was encountered");
1095      return (StringType) this.deceased;
1096    }
1097
1098    public boolean hasDeceasedStringType() { 
1099      return this.deceased instanceof StringType;
1100    }
1101
1102    public boolean hasDeceased() { 
1103      return this.deceased != null && !this.deceased.isEmpty();
1104    }
1105
1106    /**
1107     * @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.)
1108     */
1109    public FamilyMemberHistory setDeceased(Type value) { 
1110      this.deceased = value;
1111      return this;
1112    }
1113
1114    /**
1115     * @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.)
1116     */
1117    public Annotation getNote() { 
1118      if (this.note == null)
1119        if (Configuration.errorOnAutoCreate())
1120          throw new Error("Attempt to auto-create FamilyMemberHistory.note");
1121        else if (Configuration.doAutoCreate())
1122          this.note = new Annotation(); // cc
1123      return this.note;
1124    }
1125
1126    public boolean hasNote() { 
1127      return this.note != null && !this.note.isEmpty();
1128    }
1129
1130    /**
1131     * @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.)
1132     */
1133    public FamilyMemberHistory setNote(Annotation value) { 
1134      this.note = value;
1135      return this;
1136    }
1137
1138    /**
1139     * @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.)
1140     */
1141    public List<FamilyMemberHistoryConditionComponent> getCondition() { 
1142      if (this.condition == null)
1143        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1144      return this.condition;
1145    }
1146
1147    public boolean hasCondition() { 
1148      if (this.condition == null)
1149        return false;
1150      for (FamilyMemberHistoryConditionComponent item : this.condition)
1151        if (!item.isEmpty())
1152          return true;
1153      return false;
1154    }
1155
1156    /**
1157     * @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.)
1158     */
1159    // syntactic sugar
1160    public FamilyMemberHistoryConditionComponent addCondition() { //3
1161      FamilyMemberHistoryConditionComponent t = new FamilyMemberHistoryConditionComponent();
1162      if (this.condition == null)
1163        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1164      this.condition.add(t);
1165      return t;
1166    }
1167
1168    // syntactic sugar
1169    public FamilyMemberHistory addCondition(FamilyMemberHistoryConditionComponent t) { //3
1170      if (t == null)
1171        return this;
1172      if (this.condition == null)
1173        this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1174      this.condition.add(t);
1175      return this;
1176    }
1177
1178      protected void listChildren(List<Property> childrenList) {
1179        super.listChildren(childrenList);
1180        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));
1181        childrenList.add(new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, java.lang.Integer.MAX_VALUE, patient));
1182        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));
1183        childrenList.add(new Property("status", "code", "A code specifying a state of a Family Member History record.", 0, java.lang.Integer.MAX_VALUE, status));
1184        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));
1185        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));
1186        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));
1187        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));
1188        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));
1189        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));
1190        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));
1191        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));
1192      }
1193
1194      @Override
1195      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1196        switch (hash) {
1197        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1198        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1199        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1200        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FamilyHistoryStatus>
1201        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1202        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
1203        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
1204        case 3029833: /*born*/ return this.born == null ? new Base[0] : new Base[] {this.born}; // Type
1205        case 96511: /*age*/ return this.age == null ? new Base[0] : new Base[] {this.age}; // Type
1206        case 561497972: /*deceased*/ return this.deceased == null ? new Base[0] : new Base[] {this.deceased}; // Type
1207        case 3387378: /*note*/ return this.note == null ? new Base[0] : new Base[] {this.note}; // Annotation
1208        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // FamilyMemberHistoryConditionComponent
1209        default: return super.getProperty(hash, name, checkValid);
1210        }
1211
1212      }
1213
1214      @Override
1215      public void setProperty(int hash, String name, Base value) throws FHIRException {
1216        switch (hash) {
1217        case -1618432855: // identifier
1218          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1219          break;
1220        case -791418107: // patient
1221          this.patient = castToReference(value); // Reference
1222          break;
1223        case 3076014: // date
1224          this.date = castToDateTime(value); // DateTimeType
1225          break;
1226        case -892481550: // status
1227          this.status = new FamilyHistoryStatusEnumFactory().fromType(value); // Enumeration<FamilyHistoryStatus>
1228          break;
1229        case 3373707: // name
1230          this.name = castToString(value); // StringType
1231          break;
1232        case -261851592: // relationship
1233          this.relationship = castToCodeableConcept(value); // CodeableConcept
1234          break;
1235        case -1249512767: // gender
1236          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
1237          break;
1238        case 3029833: // born
1239          this.born = (Type) value; // Type
1240          break;
1241        case 96511: // age
1242          this.age = (Type) value; // Type
1243          break;
1244        case 561497972: // deceased
1245          this.deceased = (Type) value; // Type
1246          break;
1247        case 3387378: // note
1248          this.note = castToAnnotation(value); // Annotation
1249          break;
1250        case -861311717: // condition
1251          this.getCondition().add((FamilyMemberHistoryConditionComponent) value); // FamilyMemberHistoryConditionComponent
1252          break;
1253        default: super.setProperty(hash, name, value);
1254        }
1255
1256      }
1257
1258      @Override
1259      public void setProperty(String name, Base value) throws FHIRException {
1260        if (name.equals("identifier"))
1261          this.getIdentifier().add(castToIdentifier(value));
1262        else if (name.equals("patient"))
1263          this.patient = castToReference(value); // Reference
1264        else if (name.equals("date"))
1265          this.date = castToDateTime(value); // DateTimeType
1266        else if (name.equals("status"))
1267          this.status = new FamilyHistoryStatusEnumFactory().fromType(value); // Enumeration<FamilyHistoryStatus>
1268        else if (name.equals("name"))
1269          this.name = castToString(value); // StringType
1270        else if (name.equals("relationship"))
1271          this.relationship = castToCodeableConcept(value); // CodeableConcept
1272        else if (name.equals("gender"))
1273          this.gender = new AdministrativeGenderEnumFactory().fromType(value); // Enumeration<AdministrativeGender>
1274        else if (name.equals("born[x]"))
1275          this.born = (Type) value; // Type
1276        else if (name.equals("age[x]"))
1277          this.age = (Type) value; // Type
1278        else if (name.equals("deceased[x]"))
1279          this.deceased = (Type) value; // Type
1280        else if (name.equals("note"))
1281          this.note = castToAnnotation(value); // Annotation
1282        else if (name.equals("condition"))
1283          this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
1284        else
1285          super.setProperty(name, value);
1286      }
1287
1288      @Override
1289      public Base makeProperty(int hash, String name) throws FHIRException {
1290        switch (hash) {
1291        case -1618432855:  return addIdentifier(); // Identifier
1292        case -791418107:  return getPatient(); // Reference
1293        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
1294        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<FamilyHistoryStatus>
1295        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
1296        case -261851592:  return getRelationship(); // CodeableConcept
1297        case -1249512767: throw new FHIRException("Cannot make property gender as it is not a complex type"); // Enumeration<AdministrativeGender>
1298        case 67532951:  return getBorn(); // Type
1299        case -1419716831:  return getAge(); // Type
1300        case -1311442804:  return getDeceased(); // Type
1301        case 3387378:  return getNote(); // Annotation
1302        case -861311717:  return addCondition(); // FamilyMemberHistoryConditionComponent
1303        default: return super.makeProperty(hash, name);
1304        }
1305
1306      }
1307
1308      @Override
1309      public Base addChild(String name) throws FHIRException {
1310        if (name.equals("identifier")) {
1311          return addIdentifier();
1312        }
1313        else if (name.equals("patient")) {
1314          this.patient = new Reference();
1315          return this.patient;
1316        }
1317        else if (name.equals("date")) {
1318          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.date");
1319        }
1320        else if (name.equals("status")) {
1321          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.status");
1322        }
1323        else if (name.equals("name")) {
1324          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.name");
1325        }
1326        else if (name.equals("relationship")) {
1327          this.relationship = new CodeableConcept();
1328          return this.relationship;
1329        }
1330        else if (name.equals("gender")) {
1331          throw new FHIRException("Cannot call addChild on a primitive type FamilyMemberHistory.gender");
1332        }
1333        else if (name.equals("bornPeriod")) {
1334          this.born = new Period();
1335          return this.born;
1336        }
1337        else if (name.equals("bornDate")) {
1338          this.born = new DateType();
1339          return this.born;
1340        }
1341        else if (name.equals("bornString")) {
1342          this.born = new StringType();
1343          return this.born;
1344        }
1345        else if (name.equals("ageAge")) {
1346          this.age = new Age();
1347          return this.age;
1348        }
1349        else if (name.equals("ageRange")) {
1350          this.age = new Range();
1351          return this.age;
1352        }
1353        else if (name.equals("ageString")) {
1354          this.age = new StringType();
1355          return this.age;
1356        }
1357        else if (name.equals("deceasedBoolean")) {
1358          this.deceased = new BooleanType();
1359          return this.deceased;
1360        }
1361        else if (name.equals("deceasedAge")) {
1362          this.deceased = new Age();
1363          return this.deceased;
1364        }
1365        else if (name.equals("deceasedRange")) {
1366          this.deceased = new Range();
1367          return this.deceased;
1368        }
1369        else if (name.equals("deceasedDate")) {
1370          this.deceased = new DateType();
1371          return this.deceased;
1372        }
1373        else if (name.equals("deceasedString")) {
1374          this.deceased = new StringType();
1375          return this.deceased;
1376        }
1377        else if (name.equals("note")) {
1378          this.note = new Annotation();
1379          return this.note;
1380        }
1381        else if (name.equals("condition")) {
1382          return addCondition();
1383        }
1384        else
1385          return super.addChild(name);
1386      }
1387
1388  public String fhirType() {
1389    return "FamilyMemberHistory";
1390
1391  }
1392
1393      public FamilyMemberHistory copy() {
1394        FamilyMemberHistory dst = new FamilyMemberHistory();
1395        copyValues(dst);
1396        if (identifier != null) {
1397          dst.identifier = new ArrayList<Identifier>();
1398          for (Identifier i : identifier)
1399            dst.identifier.add(i.copy());
1400        };
1401        dst.patient = patient == null ? null : patient.copy();
1402        dst.date = date == null ? null : date.copy();
1403        dst.status = status == null ? null : status.copy();
1404        dst.name = name == null ? null : name.copy();
1405        dst.relationship = relationship == null ? null : relationship.copy();
1406        dst.gender = gender == null ? null : gender.copy();
1407        dst.born = born == null ? null : born.copy();
1408        dst.age = age == null ? null : age.copy();
1409        dst.deceased = deceased == null ? null : deceased.copy();
1410        dst.note = note == null ? null : note.copy();
1411        if (condition != null) {
1412          dst.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
1413          for (FamilyMemberHistoryConditionComponent i : condition)
1414            dst.condition.add(i.copy());
1415        };
1416        return dst;
1417      }
1418
1419      protected FamilyMemberHistory typedCopy() {
1420        return copy();
1421      }
1422
1423      @Override
1424      public boolean equalsDeep(Base other) {
1425        if (!super.equalsDeep(other))
1426          return false;
1427        if (!(other instanceof FamilyMemberHistory))
1428          return false;
1429        FamilyMemberHistory o = (FamilyMemberHistory) other;
1430        return compareDeep(identifier, o.identifier, true) && compareDeep(patient, o.patient, true) && compareDeep(date, o.date, true)
1431           && compareDeep(status, o.status, true) && compareDeep(name, o.name, true) && compareDeep(relationship, o.relationship, true)
1432           && compareDeep(gender, o.gender, true) && compareDeep(born, o.born, true) && compareDeep(age, o.age, true)
1433           && compareDeep(deceased, o.deceased, true) && compareDeep(note, o.note, true) && compareDeep(condition, o.condition, true)
1434          ;
1435      }
1436
1437      @Override
1438      public boolean equalsShallow(Base other) {
1439        if (!super.equalsShallow(other))
1440          return false;
1441        if (!(other instanceof FamilyMemberHistory))
1442          return false;
1443        FamilyMemberHistory o = (FamilyMemberHistory) other;
1444        return compareValues(date, o.date, true) && compareValues(status, o.status, true) && compareValues(name, o.name, true)
1445           && compareValues(gender, o.gender, true);
1446      }
1447
1448      public boolean isEmpty() {
1449        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (patient == null || patient.isEmpty())
1450           && (date == null || date.isEmpty()) && (status == null || status.isEmpty()) && (name == null || name.isEmpty())
1451           && (relationship == null || relationship.isEmpty()) && (gender == null || gender.isEmpty())
1452           && (born == null || born.isEmpty()) && (age == null || age.isEmpty()) && (deceased == null || deceased.isEmpty())
1453           && (note == null || note.isEmpty()) && (condition == null || condition.isEmpty());
1454      }
1455
1456  @Override
1457  public ResourceType getResourceType() {
1458    return ResourceType.FamilyMemberHistory;
1459   }
1460
1461 /**
1462   * Search parameter: <b>relationship</b>
1463   * <p>
1464   * Description: <b>A search by a relationship type</b><br>
1465   * Type: <b>token</b><br>
1466   * Path: <b>FamilyMemberHistory.relationship</b><br>
1467   * </p>
1468   */
1469  @SearchParamDefinition(name="relationship", path="FamilyMemberHistory.relationship", description="A search by a relationship type", type="token" )
1470  public static final String SP_RELATIONSHIP = "relationship";
1471 /**
1472   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
1473   * <p>
1474   * Description: <b>A search by a relationship type</b><br>
1475   * Type: <b>token</b><br>
1476   * Path: <b>FamilyMemberHistory.relationship</b><br>
1477   * </p>
1478   */
1479  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATIONSHIP = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATIONSHIP);
1480
1481 /**
1482   * Search parameter: <b>patient</b>
1483   * <p>
1484   * Description: <b>The identity of a subject to list family member history items for</b><br>
1485   * Type: <b>reference</b><br>
1486   * Path: <b>FamilyMemberHistory.patient</b><br>
1487   * </p>
1488   */
1489  @SearchParamDefinition(name="patient", path="FamilyMemberHistory.patient", description="The identity of a subject to list family member history items for", type="reference" )
1490  public static final String SP_PATIENT = "patient";
1491 /**
1492   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1493   * <p>
1494   * Description: <b>The identity of a subject to list family member history items for</b><br>
1495   * Type: <b>reference</b><br>
1496   * Path: <b>FamilyMemberHistory.patient</b><br>
1497   * </p>
1498   */
1499  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1500
1501/**
1502   * Constant for fluent queries to be used to add include statements. Specifies
1503   * the path value of "<b>FamilyMemberHistory:patient</b>".
1504   */
1505  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("FamilyMemberHistory:patient").toLocked();
1506
1507 /**
1508   * Search parameter: <b>gender</b>
1509   * <p>
1510   * Description: <b>A search by a gender code of a family member</b><br>
1511   * Type: <b>token</b><br>
1512   * Path: <b>FamilyMemberHistory.gender</b><br>
1513   * </p>
1514   */
1515  @SearchParamDefinition(name="gender", path="FamilyMemberHistory.gender", description="A search by a gender code of a family member", type="token" )
1516  public static final String SP_GENDER = "gender";
1517 /**
1518   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
1519   * <p>
1520   * Description: <b>A search by a gender code of a family member</b><br>
1521   * Type: <b>token</b><br>
1522   * Path: <b>FamilyMemberHistory.gender</b><br>
1523   * </p>
1524   */
1525  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GENDER);
1526
1527 /**
1528   * Search parameter: <b>code</b>
1529   * <p>
1530   * Description: <b>A search by a condition code</b><br>
1531   * Type: <b>token</b><br>
1532   * Path: <b>FamilyMemberHistory.condition.code</b><br>
1533   * </p>
1534   */
1535  @SearchParamDefinition(name="code", path="FamilyMemberHistory.condition.code", description="A search by a condition code", type="token" )
1536  public static final String SP_CODE = "code";
1537 /**
1538   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1539   * <p>
1540   * Description: <b>A search by a condition code</b><br>
1541   * Type: <b>token</b><br>
1542   * Path: <b>FamilyMemberHistory.condition.code</b><br>
1543   * </p>
1544   */
1545  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1546
1547 /**
1548   * Search parameter: <b>date</b>
1549   * <p>
1550   * Description: <b>When history was captured/updated</b><br>
1551   * Type: <b>date</b><br>
1552   * Path: <b>FamilyMemberHistory.date</b><br>
1553   * </p>
1554   */
1555  @SearchParamDefinition(name="date", path="FamilyMemberHistory.date", description="When history was captured/updated", type="date" )
1556  public static final String SP_DATE = "date";
1557 /**
1558   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1559   * <p>
1560   * Description: <b>When history was captured/updated</b><br>
1561   * Type: <b>date</b><br>
1562   * Path: <b>FamilyMemberHistory.date</b><br>
1563   * </p>
1564   */
1565  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1566
1567 /**
1568   * Search parameter: <b>identifier</b>
1569   * <p>
1570   * Description: <b>A search by a record identifier</b><br>
1571   * Type: <b>token</b><br>
1572   * Path: <b>FamilyMemberHistory.identifier</b><br>
1573   * </p>
1574   */
1575  @SearchParamDefinition(name="identifier", path="FamilyMemberHistory.identifier", description="A search by a record identifier", type="token" )
1576  public static final String SP_IDENTIFIER = "identifier";
1577 /**
1578   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1579   * <p>
1580   * Description: <b>A search by a record identifier</b><br>
1581   * Type: <b>token</b><br>
1582   * Path: <b>FamilyMemberHistory.identifier</b><br>
1583   * </p>
1584   */
1585  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1586
1587
1588}
1589