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