001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * Significant health conditions for a person related to the patient relevant in
049 * the context of care for the patient.
050 */
051@ResourceDef(name = "FamilyMemberHistory", profile = "http://hl7.org/fhir/StructureDefinition/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
057     * for details.
058     */
059    PARTIAL,
060    /**
061     * All available related health information is captured as of the date (and
062     * possibly time) when the family member history was taken.
063     */
064    COMPLETED,
065    /**
066     * This instance should not have been part of this patient's medical record.
067     */
068    ENTEREDINERROR,
069    /**
070     * Health information for this family member is unavailable/unknown.
071     */
072    HEALTHUNKNOWN,
073    /**
074     * added to help the parsers with the generic types
075     */
076    NULL;
077
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      if (Configuration.isAcceptInvalidEnums())
090        return null;
091      else
092        throw new FHIRException("Unknown FamilyHistoryStatus code '" + codeString + "'");
093    }
094
095    public String toCode() {
096      switch (this) {
097      case PARTIAL:
098        return "partial";
099      case COMPLETED:
100        return "completed";
101      case ENTEREDINERROR:
102        return "entered-in-error";
103      case HEALTHUNKNOWN:
104        return "health-unknown";
105      case NULL:
106        return null;
107      default:
108        return "?";
109      }
110    }
111
112    public String getSystem() {
113      switch (this) {
114      case PARTIAL:
115        return "http://hl7.org/fhir/history-status";
116      case COMPLETED:
117        return "http://hl7.org/fhir/history-status";
118      case ENTEREDINERROR:
119        return "http://hl7.org/fhir/history-status";
120      case HEALTHUNKNOWN:
121        return "http://hl7.org/fhir/history-status";
122      case NULL:
123        return null;
124      default:
125        return "?";
126      }
127    }
128
129    public String getDefinition() {
130      switch (this) {
131      case PARTIAL:
132        return "Some health information is known and captured, but not complete - see notes for details.";
133      case COMPLETED:
134        return "All available related health information is captured as of the date (and possibly time) when the family member history was taken.";
135      case ENTEREDINERROR:
136        return "This instance should not have been part of this patient's medical record.";
137      case HEALTHUNKNOWN:
138        return "Health information for this family member is unavailable/unknown.";
139      case NULL:
140        return null;
141      default:
142        return "?";
143      }
144    }
145
146    public String getDisplay() {
147      switch (this) {
148      case PARTIAL:
149        return "Partial";
150      case COMPLETED:
151        return "Completed";
152      case ENTEREDINERROR:
153        return "Entered in Error";
154      case HEALTHUNKNOWN:
155        return "Health Unknown";
156      case NULL:
157        return null;
158      default:
159        return "?";
160      }
161    }
162  }
163
164  public static class FamilyHistoryStatusEnumFactory implements EnumFactory<FamilyHistoryStatus> {
165    public FamilyHistoryStatus fromCode(String codeString) throws IllegalArgumentException {
166      if (codeString == null || "".equals(codeString))
167        if (codeString == null || "".equals(codeString))
168          return null;
169      if ("partial".equals(codeString))
170        return FamilyHistoryStatus.PARTIAL;
171      if ("completed".equals(codeString))
172        return FamilyHistoryStatus.COMPLETED;
173      if ("entered-in-error".equals(codeString))
174        return FamilyHistoryStatus.ENTEREDINERROR;
175      if ("health-unknown".equals(codeString))
176        return FamilyHistoryStatus.HEALTHUNKNOWN;
177      throw new IllegalArgumentException("Unknown FamilyHistoryStatus code '" + codeString + "'");
178    }
179
180    public Enumeration<FamilyHistoryStatus> fromType(PrimitiveType<?> code) throws FHIRException {
181      if (code == null)
182        return null;
183      if (code.isEmpty())
184        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.NULL, code);
185      String codeString = code.asStringValue();
186      if (codeString == null || "".equals(codeString))
187        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.NULL, code);
188      if ("partial".equals(codeString))
189        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.PARTIAL, code);
190      if ("completed".equals(codeString))
191        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.COMPLETED, code);
192      if ("entered-in-error".equals(codeString))
193        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.ENTEREDINERROR, code);
194      if ("health-unknown".equals(codeString))
195        return new Enumeration<FamilyHistoryStatus>(this, FamilyHistoryStatus.HEALTHUNKNOWN, code);
196      throw new FHIRException("Unknown FamilyHistoryStatus code '" + codeString + "'");
197    }
198
199    public String toCode(FamilyHistoryStatus code) {
200      if (code == FamilyHistoryStatus.PARTIAL)
201        return "partial";
202      if (code == FamilyHistoryStatus.COMPLETED)
203        return "completed";
204      if (code == FamilyHistoryStatus.ENTEREDINERROR)
205        return "entered-in-error";
206      if (code == FamilyHistoryStatus.HEALTHUNKNOWN)
207        return "health-unknown";
208      return "?";
209    }
210
211    public String toSystem(FamilyHistoryStatus code) {
212      return code.getSystem();
213    }
214  }
215
216  @Block()
217  public static class FamilyMemberHistoryConditionComponent extends BackboneElement implements IBaseBackboneElement {
218    /**
219     * The actual condition specified. Could be a coded condition (like MI or
220     * Diabetes) or a less specific string like 'cancer' depending on how much is
221     * known about the condition and the capabilities of the creating system.
222     */
223    @Child(name = "code", type = {
224        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
225    @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.")
226    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code")
227    protected CodeableConcept code;
228
229    /**
230     * Indicates what happened following the condition. If the condition resulted in
231     * death, deceased date is captured on the relation.
232     */
233    @Child(name = "outcome", type = {
234        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
235    @Description(shortDefinition = "deceased | permanent disability | etc.", formalDefinition = "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.")
236    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-outcome")
237    protected CodeableConcept outcome;
238
239    /**
240     * This condition contributed to the cause of death of the related person. If
241     * contributedToDeath is not populated, then it is unknown.
242     */
243    @Child(name = "contributedToDeath", type = {
244        BooleanType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
245    @Description(shortDefinition = "Whether the condition contributed to the cause of death", formalDefinition = "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.")
246    protected BooleanType contributedToDeath;
247
248    /**
249     * Either the age of onset, range of approximate age or descriptive string can
250     * be recorded. For conditions with multiple occurrences, this describes the
251     * first known occurrence.
252     */
253    @Child(name = "onset", type = { Age.class, Range.class, Period.class,
254        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
255    @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.")
256    protected Type onset;
257
258    /**
259     * An area where general notes can be placed about this specific condition.
260     */
261    @Child(name = "note", type = {
262        Annotation.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
263    @Description(shortDefinition = "Extra information about condition", formalDefinition = "An area where general notes can be placed about this specific condition.")
264    protected List<Annotation> note;
265
266    private static final long serialVersionUID = 1230182301L;
267
268    /**
269     * Constructor
270     */
271    public FamilyMemberHistoryConditionComponent() {
272      super();
273    }
274
275    /**
276     * Constructor
277     */
278    public FamilyMemberHistoryConditionComponent(CodeableConcept code) {
279      super();
280      this.code = code;
281    }
282
283    /**
284     * @return {@link #code} (The actual condition specified. Could be a coded
285     *         condition (like MI or Diabetes) or a less specific string like
286     *         'cancer' depending on how much is known about the condition and the
287     *         capabilities of the creating system.)
288     */
289    public CodeableConcept getCode() {
290      if (this.code == null)
291        if (Configuration.errorOnAutoCreate())
292          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.code");
293        else if (Configuration.doAutoCreate())
294          this.code = new CodeableConcept(); // cc
295      return this.code;
296    }
297
298    public boolean hasCode() {
299      return this.code != null && !this.code.isEmpty();
300    }
301
302    /**
303     * @param value {@link #code} (The actual condition specified. Could be a coded
304     *              condition (like MI or Diabetes) or a less specific string like
305     *              'cancer' depending on how much is known about the condition and
306     *              the capabilities of the creating system.)
307     */
308    public FamilyMemberHistoryConditionComponent setCode(CodeableConcept value) {
309      this.code = value;
310      return this;
311    }
312
313    /**
314     * @return {@link #outcome} (Indicates what happened following the condition. If
315     *         the condition resulted in death, deceased date is captured on the
316     *         relation.)
317     */
318    public CodeableConcept getOutcome() {
319      if (this.outcome == null)
320        if (Configuration.errorOnAutoCreate())
321          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.outcome");
322        else if (Configuration.doAutoCreate())
323          this.outcome = new CodeableConcept(); // cc
324      return this.outcome;
325    }
326
327    public boolean hasOutcome() {
328      return this.outcome != null && !this.outcome.isEmpty();
329    }
330
331    /**
332     * @param value {@link #outcome} (Indicates what happened following the
333     *              condition. If the condition resulted in death, deceased date is
334     *              captured on the relation.)
335     */
336    public FamilyMemberHistoryConditionComponent setOutcome(CodeableConcept value) {
337      this.outcome = value;
338      return this;
339    }
340
341    /**
342     * @return {@link #contributedToDeath} (This condition contributed to the cause
343     *         of death of the related person. If contributedToDeath is not
344     *         populated, then it is unknown.). This is the underlying object with
345     *         id, value and extensions. The accessor "getContributedToDeath" gives
346     *         direct access to the value
347     */
348    public BooleanType getContributedToDeathElement() {
349      if (this.contributedToDeath == null)
350        if (Configuration.errorOnAutoCreate())
351          throw new Error("Attempt to auto-create FamilyMemberHistoryConditionComponent.contributedToDeath");
352        else if (Configuration.doAutoCreate())
353          this.contributedToDeath = new BooleanType(); // bb
354      return this.contributedToDeath;
355    }
356
357    public boolean hasContributedToDeathElement() {
358      return this.contributedToDeath != null && !this.contributedToDeath.isEmpty();
359    }
360
361    public boolean hasContributedToDeath() {
362      return this.contributedToDeath != null && !this.contributedToDeath.isEmpty();
363    }
364
365    /**
366     * @param value {@link #contributedToDeath} (This condition contributed to the
367     *              cause of death of the related person. If contributedToDeath is
368     *              not populated, then it is unknown.). This is the underlying
369     *              object with id, value and extensions. The accessor
370     *              "getContributedToDeath" gives direct access to the value
371     */
372    public FamilyMemberHistoryConditionComponent setContributedToDeathElement(BooleanType value) {
373      this.contributedToDeath = value;
374      return this;
375    }
376
377    /**
378     * @return This condition contributed to the cause of death of the related
379     *         person. If contributedToDeath is not populated, then it is unknown.
380     */
381    public boolean getContributedToDeath() {
382      return this.contributedToDeath == null || this.contributedToDeath.isEmpty() ? false
383          : this.contributedToDeath.getValue();
384    }
385
386    /**
387     * @param value This condition contributed to the cause of death of the related
388     *              person. If contributedToDeath is not populated, then it is
389     *              unknown.
390     */
391    public FamilyMemberHistoryConditionComponent setContributedToDeath(boolean value) {
392      if (this.contributedToDeath == null)
393        this.contributedToDeath = new BooleanType();
394      this.contributedToDeath.setValue(value);
395      return this;
396    }
397
398    /**
399     * @return {@link #onset} (Either the age of onset, range of approximate age or
400     *         descriptive string can be recorded. For conditions with multiple
401     *         occurrences, this describes the first known occurrence.)
402     */
403    public Type getOnset() {
404      return this.onset;
405    }
406
407    /**
408     * @return {@link #onset} (Either the age of onset, range of approximate age or
409     *         descriptive string can be recorded. For conditions with multiple
410     *         occurrences, this describes the first known occurrence.)
411     */
412    public Age getOnsetAge() throws FHIRException {
413      if (this.onset == null)
414        this.onset = new Age();
415      if (!(this.onset instanceof Age))
416        throw new FHIRException(
417            "Type mismatch: the type Age was expected, but " + this.onset.getClass().getName() + " was encountered");
418      return (Age) this.onset;
419    }
420
421    public boolean hasOnsetAge() {
422      return this != null && this.onset instanceof Age;
423    }
424
425    /**
426     * @return {@link #onset} (Either the age of onset, range of approximate age or
427     *         descriptive string can be recorded. For conditions with multiple
428     *         occurrences, this describes the first known occurrence.)
429     */
430    public Range getOnsetRange() throws FHIRException {
431      if (this.onset == null)
432        this.onset = new Range();
433      if (!(this.onset instanceof Range))
434        throw new FHIRException(
435            "Type mismatch: the type Range was expected, but " + this.onset.getClass().getName() + " was encountered");
436      return (Range) this.onset;
437    }
438
439    public boolean hasOnsetRange() {
440      return this != null && this.onset instanceof Range;
441    }
442
443    /**
444     * @return {@link #onset} (Either the age of onset, range of approximate age or
445     *         descriptive string can be recorded. For conditions with multiple
446     *         occurrences, this describes the first known occurrence.)
447     */
448    public Period getOnsetPeriod() throws FHIRException {
449      if (this.onset == null)
450        this.onset = new Period();
451      if (!(this.onset instanceof Period))
452        throw new FHIRException(
453            "Type mismatch: the type Period was expected, but " + this.onset.getClass().getName() + " was encountered");
454      return (Period) this.onset;
455    }
456
457    public boolean hasOnsetPeriod() {
458      return this != null && this.onset instanceof Period;
459    }
460
461    /**
462     * @return {@link #onset} (Either the age of onset, range of approximate age or
463     *         descriptive string can be recorded. For conditions with multiple
464     *         occurrences, this describes the first known occurrence.)
465     */
466    public StringType getOnsetStringType() throws FHIRException {
467      if (this.onset == null)
468        this.onset = new StringType();
469      if (!(this.onset instanceof StringType))
470        throw new FHIRException("Type mismatch: the type StringType was expected, but "
471            + this.onset.getClass().getName() + " was encountered");
472      return (StringType) this.onset;
473    }
474
475    public boolean hasOnsetStringType() {
476      return this != null && this.onset instanceof StringType;
477    }
478
479    public boolean hasOnset() {
480      return this.onset != null && !this.onset.isEmpty();
481    }
482
483    /**
484     * @param value {@link #onset} (Either the age of onset, range of approximate
485     *              age or descriptive string can be recorded. For conditions with
486     *              multiple occurrences, this describes the first known
487     *              occurrence.)
488     */
489    public FamilyMemberHistoryConditionComponent setOnset(Type value) {
490      if (value != null && !(value instanceof Age || value instanceof Range || value instanceof Period
491          || value instanceof StringType))
492        throw new Error("Not the right type for FamilyMemberHistory.condition.onset[x]: " + value.fhirType());
493      this.onset = value;
494      return this;
495    }
496
497    /**
498     * @return {@link #note} (An area where general notes can be placed about this
499     *         specific condition.)
500     */
501    public List<Annotation> getNote() {
502      if (this.note == null)
503        this.note = new ArrayList<Annotation>();
504      return this.note;
505    }
506
507    /**
508     * @return Returns a reference to <code>this</code> for easy method chaining
509     */
510    public FamilyMemberHistoryConditionComponent setNote(List<Annotation> theNote) {
511      this.note = theNote;
512      return this;
513    }
514
515    public boolean hasNote() {
516      if (this.note == null)
517        return false;
518      for (Annotation item : this.note)
519        if (!item.isEmpty())
520          return true;
521      return false;
522    }
523
524    public Annotation addNote() { // 3
525      Annotation t = new Annotation();
526      if (this.note == null)
527        this.note = new ArrayList<Annotation>();
528      this.note.add(t);
529      return t;
530    }
531
532    public FamilyMemberHistoryConditionComponent addNote(Annotation t) { // 3
533      if (t == null)
534        return this;
535      if (this.note == null)
536        this.note = new ArrayList<Annotation>();
537      this.note.add(t);
538      return this;
539    }
540
541    /**
542     * @return The first repetition of repeating field {@link #note}, creating it if
543     *         it does not already exist
544     */
545    public Annotation getNoteFirstRep() {
546      if (getNote().isEmpty()) {
547        addNote();
548      }
549      return getNote().get(0);
550    }
551
552    protected void listChildren(List<Property> children) {
553      super.listChildren(children);
554      children.add(new Property("code", "CodeableConcept",
555          "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.",
556          0, 1, code));
557      children.add(new Property("outcome", "CodeableConcept",
558          "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.",
559          0, 1, outcome));
560      children.add(new Property("contributedToDeath", "boolean",
561          "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.",
562          0, 1, contributedToDeath));
563      children.add(new Property("onset[x]", "Age|Range|Period|string",
564          "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.",
565          0, 1, onset));
566      children.add(
567          new Property("note", "Annotation", "An area where general notes can be placed about this specific condition.",
568              0, java.lang.Integer.MAX_VALUE, note));
569    }
570
571    @Override
572    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
573      switch (_hash) {
574      case 3059181:
575        /* code */ return new Property("code", "CodeableConcept",
576            "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.",
577            0, 1, code);
578      case -1106507950:
579        /* outcome */ return new Property("outcome", "CodeableConcept",
580            "Indicates what happened following the condition.  If the condition resulted in death, deceased date is captured on the relation.",
581            0, 1, outcome);
582      case -363644638:
583        /* contributedToDeath */ return new Property("contributedToDeath", "boolean",
584            "This condition contributed to the cause of death of the related person. If contributedToDeath is not populated, then it is unknown.",
585            0, 1, contributedToDeath);
586      case -1886216323:
587        /* onset[x] */ return new Property("onset[x]", "Age|Range|Period|string",
588            "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.",
589            0, 1, onset);
590      case 105901603:
591        /* onset */ return new Property("onset[x]", "Age|Range|Period|string",
592            "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.",
593            0, 1, onset);
594      case -1886241828:
595        /* onsetAge */ return new Property("onset[x]", "Age|Range|Period|string",
596            "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.",
597            0, 1, onset);
598      case -186664742:
599        /* onsetRange */ return new Property("onset[x]", "Age|Range|Period|string",
600            "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.",
601            0, 1, onset);
602      case -1545082428:
603        /* onsetPeriod */ return new Property("onset[x]", "Age|Range|Period|string",
604            "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.",
605            0, 1, onset);
606      case -1445342188:
607        /* onsetString */ return new Property("onset[x]", "Age|Range|Period|string",
608            "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.",
609            0, 1, onset);
610      case 3387378:
611        /* note */ return new Property("note", "Annotation",
612            "An area where general notes can be placed about this specific condition.", 0, java.lang.Integer.MAX_VALUE,
613            note);
614      default:
615        return super.getNamedProperty(_hash, _name, _checkValid);
616      }
617
618    }
619
620    @Override
621    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
622      switch (hash) {
623      case 3059181:
624        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
625      case -1106507950:
626        /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // CodeableConcept
627      case -363644638:
628        /* contributedToDeath */ return this.contributedToDeath == null ? new Base[0]
629            : new Base[] { this.contributedToDeath }; // BooleanType
630      case 105901603:
631        /* onset */ return this.onset == null ? new Base[0] : new Base[] { this.onset }; // Type
632      case 3387378:
633        /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
634      default:
635        return super.getProperty(hash, name, checkValid);
636      }
637
638    }
639
640    @Override
641    public Base setProperty(int hash, String name, Base value) throws FHIRException {
642      switch (hash) {
643      case 3059181: // code
644        this.code = castToCodeableConcept(value); // CodeableConcept
645        return value;
646      case -1106507950: // outcome
647        this.outcome = castToCodeableConcept(value); // CodeableConcept
648        return value;
649      case -363644638: // contributedToDeath
650        this.contributedToDeath = castToBoolean(value); // BooleanType
651        return value;
652      case 105901603: // onset
653        this.onset = castToType(value); // Type
654        return value;
655      case 3387378: // note
656        this.getNote().add(castToAnnotation(value)); // Annotation
657        return value;
658      default:
659        return super.setProperty(hash, name, value);
660      }
661
662    }
663
664    @Override
665    public Base setProperty(String name, Base value) throws FHIRException {
666      if (name.equals("code")) {
667        this.code = castToCodeableConcept(value); // CodeableConcept
668      } else if (name.equals("outcome")) {
669        this.outcome = castToCodeableConcept(value); // CodeableConcept
670      } else if (name.equals("contributedToDeath")) {
671        this.contributedToDeath = castToBoolean(value); // BooleanType
672      } else if (name.equals("onset[x]")) {
673        this.onset = castToType(value); // Type
674      } else if (name.equals("note")) {
675        this.getNote().add(castToAnnotation(value));
676      } else
677        return super.setProperty(name, value);
678      return value;
679    }
680
681  @Override
682  public void removeChild(String name, Base value) throws FHIRException {
683      if (name.equals("code")) {
684        this.code = null;
685      } else if (name.equals("outcome")) {
686        this.outcome = null;
687      } else if (name.equals("contributedToDeath")) {
688        this.contributedToDeath = null;
689      } else if (name.equals("onset[x]")) {
690        this.onset = null;
691      } else if (name.equals("note")) {
692        this.getNote().remove(castToAnnotation(value));
693      } else
694        super.removeChild(name, value);
695      
696    }
697
698    @Override
699    public Base makeProperty(int hash, String name) throws FHIRException {
700      switch (hash) {
701      case 3059181:
702        return getCode();
703      case -1106507950:
704        return getOutcome();
705      case -363644638:
706        return getContributedToDeathElement();
707      case -1886216323:
708        return getOnset();
709      case 105901603:
710        return getOnset();
711      case 3387378:
712        return addNote();
713      default:
714        return super.makeProperty(hash, name);
715      }
716
717    }
718
719    @Override
720    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
721      switch (hash) {
722      case 3059181:
723        /* code */ return new String[] { "CodeableConcept" };
724      case -1106507950:
725        /* outcome */ return new String[] { "CodeableConcept" };
726      case -363644638:
727        /* contributedToDeath */ return new String[] { "boolean" };
728      case 105901603:
729        /* onset */ return new String[] { "Age", "Range", "Period", "string" };
730      case 3387378:
731        /* note */ return new String[] { "Annotation" };
732      default:
733        return super.getTypesForProperty(hash, name);
734      }
735
736    }
737
738    @Override
739    public Base addChild(String name) throws FHIRException {
740      if (name.equals("code")) {
741        this.code = new CodeableConcept();
742        return this.code;
743      } else if (name.equals("outcome")) {
744        this.outcome = new CodeableConcept();
745        return this.outcome;
746      } else if (name.equals("contributedToDeath")) {
747        throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.contributedToDeath");
748      } else if (name.equals("onsetAge")) {
749        this.onset = new Age();
750        return this.onset;
751      } else if (name.equals("onsetRange")) {
752        this.onset = new Range();
753        return this.onset;
754      } else if (name.equals("onsetPeriod")) {
755        this.onset = new Period();
756        return this.onset;
757      } else if (name.equals("onsetString")) {
758        this.onset = new StringType();
759        return this.onset;
760      } else if (name.equals("note")) {
761        return addNote();
762      } else
763        return super.addChild(name);
764    }
765
766    public FamilyMemberHistoryConditionComponent copy() {
767      FamilyMemberHistoryConditionComponent dst = new FamilyMemberHistoryConditionComponent();
768      copyValues(dst);
769      return dst;
770    }
771
772    public void copyValues(FamilyMemberHistoryConditionComponent dst) {
773      super.copyValues(dst);
774      dst.code = code == null ? null : code.copy();
775      dst.outcome = outcome == null ? null : outcome.copy();
776      dst.contributedToDeath = contributedToDeath == null ? null : contributedToDeath.copy();
777      dst.onset = onset == null ? null : onset.copy();
778      if (note != null) {
779        dst.note = new ArrayList<Annotation>();
780        for (Annotation i : note)
781          dst.note.add(i.copy());
782      }
783      ;
784    }
785
786    @Override
787    public boolean equalsDeep(Base other_) {
788      if (!super.equalsDeep(other_))
789        return false;
790      if (!(other_ instanceof FamilyMemberHistoryConditionComponent))
791        return false;
792      FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other_;
793      return compareDeep(code, o.code, true) && compareDeep(outcome, o.outcome, true)
794          && compareDeep(contributedToDeath, o.contributedToDeath, true) && compareDeep(onset, o.onset, true)
795          && compareDeep(note, o.note, true);
796    }
797
798    @Override
799    public boolean equalsShallow(Base other_) {
800      if (!super.equalsShallow(other_))
801        return false;
802      if (!(other_ instanceof FamilyMemberHistoryConditionComponent))
803        return false;
804      FamilyMemberHistoryConditionComponent o = (FamilyMemberHistoryConditionComponent) other_;
805      return compareValues(contributedToDeath, o.contributedToDeath, true);
806    }
807
808    public boolean isEmpty() {
809      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, outcome, contributedToDeath, onset, note);
810    }
811
812    public String fhirType() {
813      return "FamilyMemberHistory.condition";
814
815    }
816
817  }
818
819  /**
820   * Business identifiers assigned to this family member history by the performer
821   * or other systems which remain constant as the resource is updated and
822   * propagates from server to server.
823   */
824  @Child(name = "identifier", type = {
825      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
826  @Description(shortDefinition = "External Id(s) for this record", formalDefinition = "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.")
827  protected List<Identifier> identifier;
828
829  /**
830   * The URL pointing to a FHIR-defined protocol, guideline, orderset or other
831   * definition that is adhered to in whole or in part by this
832   * FamilyMemberHistory.
833   */
834  @Child(name = "instantiatesCanonical", type = {
835      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
836  @Description(shortDefinition = "Instantiates FHIR protocol or definition", formalDefinition = "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.")
837  protected List<CanonicalType> instantiatesCanonical;
838
839  /**
840   * The URL pointing to an externally maintained protocol, guideline, orderset or
841   * other definition that is adhered to in whole or in part by this
842   * FamilyMemberHistory.
843   */
844  @Child(name = "instantiatesUri", type = {
845      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
846  @Description(shortDefinition = "Instantiates external protocol or definition", formalDefinition = "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.")
847  protected List<UriType> instantiatesUri;
848
849  /**
850   * A code specifying the status of the record of the family history of a
851   * specific family member.
852   */
853  @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = true, summary = true)
854  @Description(shortDefinition = "partial | completed | entered-in-error | health-unknown", formalDefinition = "A code specifying the status of the record of the family history of a specific family member.")
855  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/history-status")
856  protected Enumeration<FamilyHistoryStatus> status;
857
858  /**
859   * Describes why the family member's history is not available.
860   */
861  @Child(name = "dataAbsentReason", type = {
862      CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
863  @Description(shortDefinition = "subject-unknown | withheld | unable-to-obtain | deferred", formalDefinition = "Describes why the family member's history is not available.")
864  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/history-absent-reason")
865  protected CodeableConcept dataAbsentReason;
866
867  /**
868   * The person who this history concerns.
869   */
870  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
871  @Description(shortDefinition = "Patient history is about", formalDefinition = "The person who this history concerns.")
872  protected Reference patient;
873
874  /**
875   * The actual object that is the target of the reference (The person who this
876   * history concerns.)
877   */
878  protected Patient patientTarget;
879
880  /**
881   * The date (and possibly time) when the family member history was recorded or
882   * last updated.
883   */
884  @Child(name = "date", type = { DateTimeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
885  @Description(shortDefinition = "When history was recorded or last updated", formalDefinition = "The date (and possibly time) when the family member history was recorded or last updated.")
886  protected DateTimeType date;
887
888  /**
889   * This will either be a name or a description; e.g. "Aunt Susan", "my cousin
890   * with the red hair".
891   */
892  @Child(name = "name", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
893  @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\".")
894  protected StringType name;
895
896  /**
897   * The type of relationship this person has to the patient (father, mother,
898   * brother etc.).
899   */
900  @Child(name = "relationship", type = {
901      CodeableConcept.class }, order = 8, min = 1, max = 1, modifier = false, summary = true)
902  @Description(shortDefinition = "Relationship to the subject", formalDefinition = "The type of relationship this person has to the patient (father, mother, brother etc.).")
903  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-FamilyMember")
904  protected CodeableConcept relationship;
905
906  /**
907   * The birth sex of the family member.
908   */
909  @Child(name = "sex", type = { CodeableConcept.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
910  @Description(shortDefinition = "male | female | other | unknown", formalDefinition = "The birth sex of the family member.")
911  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender")
912  protected CodeableConcept sex;
913
914  /**
915   * The actual or approximate date of birth of the relative.
916   */
917  @Child(name = "born", type = { Period.class, DateType.class,
918      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
919  @Description(shortDefinition = "(approximate) date of birth", formalDefinition = "The actual or approximate date of birth of the relative.")
920  protected Type born;
921
922  /**
923   * The age of the relative at the time the family member history is recorded.
924   */
925  @Child(name = "age", type = { Age.class, Range.class,
926      StringType.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
927  @Description(shortDefinition = "(approximate) age", formalDefinition = "The age of the relative at the time the family member history is recorded.")
928  protected Type age;
929
930  /**
931   * If true, indicates that the age value specified is an estimated value.
932   */
933  @Child(name = "estimatedAge", type = {
934      BooleanType.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
935  @Description(shortDefinition = "Age is estimated?", formalDefinition = "If true, indicates that the age value specified is an estimated value.")
936  protected BooleanType estimatedAge;
937
938  /**
939   * Deceased flag or the actual or approximate age of the relative at the time of
940   * death for the family member history record.
941   */
942  @Child(name = "deceased", type = { BooleanType.class, Age.class, Range.class, DateType.class,
943      StringType.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
944  @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.")
945  protected Type deceased;
946
947  /**
948   * Describes why the family member history occurred in coded or textual form.
949   */
950  @Child(name = "reasonCode", type = {
951      CodeableConcept.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
952  @Description(shortDefinition = "Why was family member history performed?", formalDefinition = "Describes why the family member history occurred in coded or textual form.")
953  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/clinical-findings")
954  protected List<CodeableConcept> reasonCode;
955
956  /**
957   * Indicates a Condition, Observation, AllergyIntolerance, or
958   * QuestionnaireResponse that justifies this family member history event.
959   */
960  @Child(name = "reasonReference", type = { Condition.class, Observation.class, AllergyIntolerance.class,
961      QuestionnaireResponse.class, DiagnosticReport.class,
962      DocumentReference.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
963  @Description(shortDefinition = "Why was family member history performed?", formalDefinition = "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.")
964  protected List<Reference> reasonReference;
965  /**
966   * The actual objects that are the target of the reference (Indicates a
967   * Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that
968   * justifies this family member history event.)
969   */
970  protected List<Resource> reasonReferenceTarget;
971
972  /**
973   * This property allows a non condition-specific note to the made about the
974   * related person. Ideally, the note would be in the condition property, but
975   * this is not always possible.
976   */
977  @Child(name = "note", type = {
978      Annotation.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
979  @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.")
980  protected List<Annotation> note;
981
982  /**
983   * The significant Conditions (or condition) that the family member had. This is
984   * a repeating section to allow a system to represent more than one condition
985   * per resource, though there is nothing stopping multiple resources - one per
986   * condition.
987   */
988  @Child(name = "condition", type = {}, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
989  @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.")
990  protected List<FamilyMemberHistoryConditionComponent> condition;
991
992  private static final long serialVersionUID = -455261406L;
993
994  /**
995   * Constructor
996   */
997  public FamilyMemberHistory() {
998    super();
999  }
1000
1001  /**
1002   * Constructor
1003   */
1004  public FamilyMemberHistory(Enumeration<FamilyHistoryStatus> status, Reference patient, CodeableConcept relationship) {
1005    super();
1006    this.status = status;
1007    this.patient = patient;
1008    this.relationship = relationship;
1009  }
1010
1011  /**
1012   * @return {@link #identifier} (Business identifiers assigned to this family
1013   *         member history by the performer or other systems which remain
1014   *         constant as the resource is updated and propagates from server to
1015   *         server.)
1016   */
1017  public List<Identifier> getIdentifier() {
1018    if (this.identifier == null)
1019      this.identifier = new ArrayList<Identifier>();
1020    return this.identifier;
1021  }
1022
1023  /**
1024   * @return Returns a reference to <code>this</code> for easy method chaining
1025   */
1026  public FamilyMemberHistory setIdentifier(List<Identifier> theIdentifier) {
1027    this.identifier = theIdentifier;
1028    return this;
1029  }
1030
1031  public boolean hasIdentifier() {
1032    if (this.identifier == null)
1033      return false;
1034    for (Identifier item : this.identifier)
1035      if (!item.isEmpty())
1036        return true;
1037    return false;
1038  }
1039
1040  public Identifier addIdentifier() { // 3
1041    Identifier t = new Identifier();
1042    if (this.identifier == null)
1043      this.identifier = new ArrayList<Identifier>();
1044    this.identifier.add(t);
1045    return t;
1046  }
1047
1048  public FamilyMemberHistory addIdentifier(Identifier t) { // 3
1049    if (t == null)
1050      return this;
1051    if (this.identifier == null)
1052      this.identifier = new ArrayList<Identifier>();
1053    this.identifier.add(t);
1054    return this;
1055  }
1056
1057  /**
1058   * @return The first repetition of repeating field {@link #identifier}, creating
1059   *         it if it does not already exist
1060   */
1061  public Identifier getIdentifierFirstRep() {
1062    if (getIdentifier().isEmpty()) {
1063      addIdentifier();
1064    }
1065    return getIdentifier().get(0);
1066  }
1067
1068  /**
1069   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1070   *         protocol, guideline, orderset or other definition that is adhered to
1071   *         in whole or in part by this FamilyMemberHistory.)
1072   */
1073  public List<CanonicalType> getInstantiatesCanonical() {
1074    if (this.instantiatesCanonical == null)
1075      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1076    return this.instantiatesCanonical;
1077  }
1078
1079  /**
1080   * @return Returns a reference to <code>this</code> for easy method chaining
1081   */
1082  public FamilyMemberHistory setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) {
1083    this.instantiatesCanonical = theInstantiatesCanonical;
1084    return this;
1085  }
1086
1087  public boolean hasInstantiatesCanonical() {
1088    if (this.instantiatesCanonical == null)
1089      return false;
1090    for (CanonicalType item : this.instantiatesCanonical)
1091      if (!item.isEmpty())
1092        return true;
1093    return false;
1094  }
1095
1096  /**
1097   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
1098   *         protocol, guideline, orderset or other definition that is adhered to
1099   *         in whole or in part by this FamilyMemberHistory.)
1100   */
1101  public CanonicalType addInstantiatesCanonicalElement() {// 2
1102    CanonicalType t = new CanonicalType();
1103    if (this.instantiatesCanonical == null)
1104      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1105    this.instantiatesCanonical.add(t);
1106    return t;
1107  }
1108
1109  /**
1110   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1111   *              FHIR-defined protocol, guideline, orderset or other definition
1112   *              that is adhered to in whole or in part by this
1113   *              FamilyMemberHistory.)
1114   */
1115  public FamilyMemberHistory addInstantiatesCanonical(String value) { // 1
1116    CanonicalType t = new CanonicalType();
1117    t.setValue(value);
1118    if (this.instantiatesCanonical == null)
1119      this.instantiatesCanonical = new ArrayList<CanonicalType>();
1120    this.instantiatesCanonical.add(t);
1121    return this;
1122  }
1123
1124  /**
1125   * @param value {@link #instantiatesCanonical} (The URL pointing to a
1126   *              FHIR-defined protocol, guideline, orderset or other definition
1127   *              that is adhered to in whole or in part by this
1128   *              FamilyMemberHistory.)
1129   */
1130  public boolean hasInstantiatesCanonical(String value) {
1131    if (this.instantiatesCanonical == null)
1132      return false;
1133    for (CanonicalType v : this.instantiatesCanonical)
1134      if (v.getValue().equals(value)) // canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)
1135        return true;
1136    return false;
1137  }
1138
1139  /**
1140   * @return {@link #instantiatesUri} (The URL pointing to an externally
1141   *         maintained protocol, guideline, orderset or other definition that is
1142   *         adhered to in whole or in part by this FamilyMemberHistory.)
1143   */
1144  public List<UriType> getInstantiatesUri() {
1145    if (this.instantiatesUri == null)
1146      this.instantiatesUri = new ArrayList<UriType>();
1147    return this.instantiatesUri;
1148  }
1149
1150  /**
1151   * @return Returns a reference to <code>this</code> for easy method chaining
1152   */
1153  public FamilyMemberHistory setInstantiatesUri(List<UriType> theInstantiatesUri) {
1154    this.instantiatesUri = theInstantiatesUri;
1155    return this;
1156  }
1157
1158  public boolean hasInstantiatesUri() {
1159    if (this.instantiatesUri == null)
1160      return false;
1161    for (UriType item : this.instantiatesUri)
1162      if (!item.isEmpty())
1163        return true;
1164    return false;
1165  }
1166
1167  /**
1168   * @return {@link #instantiatesUri} (The URL pointing to an externally
1169   *         maintained protocol, guideline, orderset or other definition that is
1170   *         adhered to in whole or in part by this FamilyMemberHistory.)
1171   */
1172  public UriType addInstantiatesUriElement() {// 2
1173    UriType t = new UriType();
1174    if (this.instantiatesUri == null)
1175      this.instantiatesUri = new ArrayList<UriType>();
1176    this.instantiatesUri.add(t);
1177    return t;
1178  }
1179
1180  /**
1181   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1182   *              maintained protocol, guideline, orderset or other definition
1183   *              that is adhered to in whole or in part by this
1184   *              FamilyMemberHistory.)
1185   */
1186  public FamilyMemberHistory addInstantiatesUri(String value) { // 1
1187    UriType t = new UriType();
1188    t.setValue(value);
1189    if (this.instantiatesUri == null)
1190      this.instantiatesUri = new ArrayList<UriType>();
1191    this.instantiatesUri.add(t);
1192    return this;
1193  }
1194
1195  /**
1196   * @param value {@link #instantiatesUri} (The URL pointing to an externally
1197   *              maintained protocol, guideline, orderset or other definition
1198   *              that is adhered to in whole or in part by this
1199   *              FamilyMemberHistory.)
1200   */
1201  public boolean hasInstantiatesUri(String value) {
1202    if (this.instantiatesUri == null)
1203      return false;
1204    for (UriType v : this.instantiatesUri)
1205      if (v.getValue().equals(value)) // uri
1206        return true;
1207    return false;
1208  }
1209
1210  /**
1211   * @return {@link #status} (A code specifying the status of the record of the
1212   *         family history of a specific family member.). This is the underlying
1213   *         object with id, value and extensions. The accessor "getStatus" gives
1214   *         direct access to the value
1215   */
1216  public Enumeration<FamilyHistoryStatus> getStatusElement() {
1217    if (this.status == null)
1218      if (Configuration.errorOnAutoCreate())
1219        throw new Error("Attempt to auto-create FamilyMemberHistory.status");
1220      else if (Configuration.doAutoCreate())
1221        this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory()); // bb
1222    return this.status;
1223  }
1224
1225  public boolean hasStatusElement() {
1226    return this.status != null && !this.status.isEmpty();
1227  }
1228
1229  public boolean hasStatus() {
1230    return this.status != null && !this.status.isEmpty();
1231  }
1232
1233  /**
1234   * @param value {@link #status} (A code specifying the status of the record of
1235   *              the family history of a specific family member.). This is the
1236   *              underlying object with id, value and extensions. The accessor
1237   *              "getStatus" gives direct access to the value
1238   */
1239  public FamilyMemberHistory setStatusElement(Enumeration<FamilyHistoryStatus> value) {
1240    this.status = value;
1241    return this;
1242  }
1243
1244  /**
1245   * @return A code specifying the status of the record of the family history of a
1246   *         specific family member.
1247   */
1248  public FamilyHistoryStatus getStatus() {
1249    return this.status == null ? null : this.status.getValue();
1250  }
1251
1252  /**
1253   * @param value A code specifying the status of the record of the family history
1254   *              of a specific family member.
1255   */
1256  public FamilyMemberHistory setStatus(FamilyHistoryStatus value) {
1257    if (this.status == null)
1258      this.status = new Enumeration<FamilyHistoryStatus>(new FamilyHistoryStatusEnumFactory());
1259    this.status.setValue(value);
1260    return this;
1261  }
1262
1263  /**
1264   * @return {@link #dataAbsentReason} (Describes why the family member's history
1265   *         is not available.)
1266   */
1267  public CodeableConcept getDataAbsentReason() {
1268    if (this.dataAbsentReason == null)
1269      if (Configuration.errorOnAutoCreate())
1270        throw new Error("Attempt to auto-create FamilyMemberHistory.dataAbsentReason");
1271      else if (Configuration.doAutoCreate())
1272        this.dataAbsentReason = new CodeableConcept(); // cc
1273    return this.dataAbsentReason;
1274  }
1275
1276  public boolean hasDataAbsentReason() {
1277    return this.dataAbsentReason != null && !this.dataAbsentReason.isEmpty();
1278  }
1279
1280  /**
1281   * @param value {@link #dataAbsentReason} (Describes why the family member's
1282   *              history is not available.)
1283   */
1284  public FamilyMemberHistory setDataAbsentReason(CodeableConcept value) {
1285    this.dataAbsentReason = value;
1286    return this;
1287  }
1288
1289  /**
1290   * @return {@link #patient} (The person who this history concerns.)
1291   */
1292  public Reference getPatient() {
1293    if (this.patient == null)
1294      if (Configuration.errorOnAutoCreate())
1295        throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
1296      else if (Configuration.doAutoCreate())
1297        this.patient = new Reference(); // cc
1298    return this.patient;
1299  }
1300
1301  public boolean hasPatient() {
1302    return this.patient != null && !this.patient.isEmpty();
1303  }
1304
1305  /**
1306   * @param value {@link #patient} (The person who this history concerns.)
1307   */
1308  public FamilyMemberHistory setPatient(Reference value) {
1309    this.patient = value;
1310    return this;
1311  }
1312
1313  /**
1314   * @return {@link #patient} The actual object that is the target of the
1315   *         reference. The reference library doesn't populate this, but you can
1316   *         use it to hold the resource if you resolve it. (The person who this
1317   *         history concerns.)
1318   */
1319  public Patient getPatientTarget() {
1320    if (this.patientTarget == null)
1321      if (Configuration.errorOnAutoCreate())
1322        throw new Error("Attempt to auto-create FamilyMemberHistory.patient");
1323      else if (Configuration.doAutoCreate())
1324        this.patientTarget = new Patient(); // aa
1325    return this.patientTarget;
1326  }
1327
1328  /**
1329   * @param value {@link #patient} The actual object that is the target of the
1330   *              reference. The reference library doesn't use these, but you can
1331   *              use it to hold the resource if you resolve it. (The person who
1332   *              this history concerns.)
1333   */
1334  public FamilyMemberHistory setPatientTarget(Patient value) {
1335    this.patientTarget = value;
1336    return this;
1337  }
1338
1339  /**
1340   * @return {@link #date} (The date (and possibly time) when the family member
1341   *         history was recorded or last updated.). This is the underlying object
1342   *         with id, value and extensions. The accessor "getDate" gives direct
1343   *         access to the value
1344   */
1345  public DateTimeType getDateElement() {
1346    if (this.date == null)
1347      if (Configuration.errorOnAutoCreate())
1348        throw new Error("Attempt to auto-create FamilyMemberHistory.date");
1349      else if (Configuration.doAutoCreate())
1350        this.date = new DateTimeType(); // bb
1351    return this.date;
1352  }
1353
1354  public boolean hasDateElement() {
1355    return this.date != null && !this.date.isEmpty();
1356  }
1357
1358  public boolean hasDate() {
1359    return this.date != null && !this.date.isEmpty();
1360  }
1361
1362  /**
1363   * @param value {@link #date} (The date (and possibly time) when the family
1364   *              member history was recorded or last updated.). This is the
1365   *              underlying object with id, value and extensions. The accessor
1366   *              "getDate" gives direct access to the value
1367   */
1368  public FamilyMemberHistory setDateElement(DateTimeType value) {
1369    this.date = value;
1370    return this;
1371  }
1372
1373  /**
1374   * @return The date (and possibly time) when the family member history was
1375   *         recorded or last updated.
1376   */
1377  public Date getDate() {
1378    return this.date == null ? null : this.date.getValue();
1379  }
1380
1381  /**
1382   * @param value The date (and possibly time) when the family member history was
1383   *              recorded or last updated.
1384   */
1385  public FamilyMemberHistory setDate(Date value) {
1386    if (value == null)
1387      this.date = null;
1388    else {
1389      if (this.date == null)
1390        this.date = new DateTimeType();
1391      this.date.setValue(value);
1392    }
1393    return this;
1394  }
1395
1396  /**
1397   * @return {@link #name} (This will either be a name or a description; e.g.
1398   *         "Aunt Susan", "my cousin with the red hair".). This is the underlying
1399   *         object with id, value and extensions. The accessor "getName" gives
1400   *         direct access to the value
1401   */
1402  public StringType getNameElement() {
1403    if (this.name == null)
1404      if (Configuration.errorOnAutoCreate())
1405        throw new Error("Attempt to auto-create FamilyMemberHistory.name");
1406      else if (Configuration.doAutoCreate())
1407        this.name = new StringType(); // bb
1408    return this.name;
1409  }
1410
1411  public boolean hasNameElement() {
1412    return this.name != null && !this.name.isEmpty();
1413  }
1414
1415  public boolean hasName() {
1416    return this.name != null && !this.name.isEmpty();
1417  }
1418
1419  /**
1420   * @param value {@link #name} (This will either be a name or a description; e.g.
1421   *              "Aunt Susan", "my cousin with the red hair".). This is the
1422   *              underlying object with id, value and extensions. The accessor
1423   *              "getName" gives direct access to the value
1424   */
1425  public FamilyMemberHistory setNameElement(StringType value) {
1426    this.name = value;
1427    return this;
1428  }
1429
1430  /**
1431   * @return This will either be a name or a description; e.g. "Aunt Susan", "my
1432   *         cousin with the red hair".
1433   */
1434  public String getName() {
1435    return this.name == null ? null : this.name.getValue();
1436  }
1437
1438  /**
1439   * @param value This will either be a name or a description; e.g. "Aunt Susan",
1440   *              "my cousin with the red hair".
1441   */
1442  public FamilyMemberHistory setName(String value) {
1443    if (Utilities.noString(value))
1444      this.name = null;
1445    else {
1446      if (this.name == null)
1447        this.name = new StringType();
1448      this.name.setValue(value);
1449    }
1450    return this;
1451  }
1452
1453  /**
1454   * @return {@link #relationship} (The type of relationship this person has to
1455   *         the patient (father, mother, brother etc.).)
1456   */
1457  public CodeableConcept getRelationship() {
1458    if (this.relationship == null)
1459      if (Configuration.errorOnAutoCreate())
1460        throw new Error("Attempt to auto-create FamilyMemberHistory.relationship");
1461      else if (Configuration.doAutoCreate())
1462        this.relationship = new CodeableConcept(); // cc
1463    return this.relationship;
1464  }
1465
1466  public boolean hasRelationship() {
1467    return this.relationship != null && !this.relationship.isEmpty();
1468  }
1469
1470  /**
1471   * @param value {@link #relationship} (The type of relationship this person has
1472   *              to the patient (father, mother, brother etc.).)
1473   */
1474  public FamilyMemberHistory setRelationship(CodeableConcept value) {
1475    this.relationship = value;
1476    return this;
1477  }
1478
1479  /**
1480   * @return {@link #sex} (The birth sex of the family member.)
1481   */
1482  public CodeableConcept getSex() {
1483    if (this.sex == null)
1484      if (Configuration.errorOnAutoCreate())
1485        throw new Error("Attempt to auto-create FamilyMemberHistory.sex");
1486      else if (Configuration.doAutoCreate())
1487        this.sex = new CodeableConcept(); // cc
1488    return this.sex;
1489  }
1490
1491  public boolean hasSex() {
1492    return this.sex != null && !this.sex.isEmpty();
1493  }
1494
1495  /**
1496   * @param value {@link #sex} (The birth sex of the family member.)
1497   */
1498  public FamilyMemberHistory setSex(CodeableConcept value) {
1499    this.sex = value;
1500    return this;
1501  }
1502
1503  /**
1504   * @return {@link #born} (The actual or approximate date of birth of the
1505   *         relative.)
1506   */
1507  public Type getBorn() {
1508    return this.born;
1509  }
1510
1511  /**
1512   * @return {@link #born} (The actual or approximate date of birth of the
1513   *         relative.)
1514   */
1515  public Period getBornPeriod() throws FHIRException {
1516    if (this.born == null)
1517      this.born = new Period();
1518    if (!(this.born instanceof Period))
1519      throw new FHIRException(
1520          "Type mismatch: the type Period was expected, but " + this.born.getClass().getName() + " was encountered");
1521    return (Period) this.born;
1522  }
1523
1524  public boolean hasBornPeriod() {
1525    return this != null && this.born instanceof Period;
1526  }
1527
1528  /**
1529   * @return {@link #born} (The actual or approximate date of birth of the
1530   *         relative.)
1531   */
1532  public DateType getBornDateType() throws FHIRException {
1533    if (this.born == null)
1534      this.born = new DateType();
1535    if (!(this.born instanceof DateType))
1536      throw new FHIRException(
1537          "Type mismatch: the type DateType was expected, but " + this.born.getClass().getName() + " was encountered");
1538    return (DateType) this.born;
1539  }
1540
1541  public boolean hasBornDateType() {
1542    return this != null && this.born instanceof DateType;
1543  }
1544
1545  /**
1546   * @return {@link #born} (The actual or approximate date of birth of the
1547   *         relative.)
1548   */
1549  public StringType getBornStringType() throws FHIRException {
1550    if (this.born == null)
1551      this.born = new StringType();
1552    if (!(this.born instanceof StringType))
1553      throw new FHIRException("Type mismatch: the type StringType was expected, but " + this.born.getClass().getName()
1554          + " was encountered");
1555    return (StringType) this.born;
1556  }
1557
1558  public boolean hasBornStringType() {
1559    return this != null && this.born instanceof StringType;
1560  }
1561
1562  public boolean hasBorn() {
1563    return this.born != null && !this.born.isEmpty();
1564  }
1565
1566  /**
1567   * @param value {@link #born} (The actual or approximate date of birth of the
1568   *              relative.)
1569   */
1570  public FamilyMemberHistory setBorn(Type value) {
1571    if (value != null && !(value instanceof Period || value instanceof DateType || value instanceof StringType))
1572      throw new Error("Not the right type for FamilyMemberHistory.born[x]: " + value.fhirType());
1573    this.born = value;
1574    return this;
1575  }
1576
1577  /**
1578   * @return {@link #age} (The age of the relative at the time the family member
1579   *         history is recorded.)
1580   */
1581  public Type getAge() {
1582    return this.age;
1583  }
1584
1585  /**
1586   * @return {@link #age} (The age of the relative at the time the family member
1587   *         history is recorded.)
1588   */
1589  public Age getAgeAge() throws FHIRException {
1590    if (this.age == null)
1591      this.age = new Age();
1592    if (!(this.age instanceof Age))
1593      throw new FHIRException(
1594          "Type mismatch: the type Age was expected, but " + this.age.getClass().getName() + " was encountered");
1595    return (Age) this.age;
1596  }
1597
1598  public boolean hasAgeAge() {
1599    return this != null && this.age instanceof Age;
1600  }
1601
1602  /**
1603   * @return {@link #age} (The age of the relative at the time the family member
1604   *         history is recorded.)
1605   */
1606  public Range getAgeRange() throws FHIRException {
1607    if (this.age == null)
1608      this.age = new Range();
1609    if (!(this.age instanceof Range))
1610      throw new FHIRException(
1611          "Type mismatch: the type Range was expected, but " + this.age.getClass().getName() + " was encountered");
1612    return (Range) this.age;
1613  }
1614
1615  public boolean hasAgeRange() {
1616    return this != null && this.age instanceof Range;
1617  }
1618
1619  /**
1620   * @return {@link #age} (The age of the relative at the time the family member
1621   *         history is recorded.)
1622   */
1623  public StringType getAgeStringType() throws FHIRException {
1624    if (this.age == null)
1625      this.age = new StringType();
1626    if (!(this.age instanceof StringType))
1627      throw new FHIRException(
1628          "Type mismatch: the type StringType was expected, but " + this.age.getClass().getName() + " was encountered");
1629    return (StringType) this.age;
1630  }
1631
1632  public boolean hasAgeStringType() {
1633    return this != null && this.age instanceof StringType;
1634  }
1635
1636  public boolean hasAge() {
1637    return this.age != null && !this.age.isEmpty();
1638  }
1639
1640  /**
1641   * @param value {@link #age} (The age of the relative at the time the family
1642   *              member history is recorded.)
1643   */
1644  public FamilyMemberHistory setAge(Type value) {
1645    if (value != null && !(value instanceof Age || value instanceof Range || value instanceof StringType))
1646      throw new Error("Not the right type for FamilyMemberHistory.age[x]: " + value.fhirType());
1647    this.age = value;
1648    return this;
1649  }
1650
1651  /**
1652   * @return {@link #estimatedAge} (If true, indicates that the age value
1653   *         specified is an estimated value.). This is the underlying object with
1654   *         id, value and extensions. The accessor "getEstimatedAge" gives direct
1655   *         access to the value
1656   */
1657  public BooleanType getEstimatedAgeElement() {
1658    if (this.estimatedAge == null)
1659      if (Configuration.errorOnAutoCreate())
1660        throw new Error("Attempt to auto-create FamilyMemberHistory.estimatedAge");
1661      else if (Configuration.doAutoCreate())
1662        this.estimatedAge = new BooleanType(); // bb
1663    return this.estimatedAge;
1664  }
1665
1666  public boolean hasEstimatedAgeElement() {
1667    return this.estimatedAge != null && !this.estimatedAge.isEmpty();
1668  }
1669
1670  public boolean hasEstimatedAge() {
1671    return this.estimatedAge != null && !this.estimatedAge.isEmpty();
1672  }
1673
1674  /**
1675   * @param value {@link #estimatedAge} (If true, indicates that the age value
1676   *              specified is an estimated value.). This is the underlying object
1677   *              with id, value and extensions. The accessor "getEstimatedAge"
1678   *              gives direct access to the value
1679   */
1680  public FamilyMemberHistory setEstimatedAgeElement(BooleanType value) {
1681    this.estimatedAge = value;
1682    return this;
1683  }
1684
1685  /**
1686   * @return If true, indicates that the age value specified is an estimated
1687   *         value.
1688   */
1689  public boolean getEstimatedAge() {
1690    return this.estimatedAge == null || this.estimatedAge.isEmpty() ? false : this.estimatedAge.getValue();
1691  }
1692
1693  /**
1694   * @param value If true, indicates that the age value specified is an estimated
1695   *              value.
1696   */
1697  public FamilyMemberHistory setEstimatedAge(boolean value) {
1698    if (this.estimatedAge == null)
1699      this.estimatedAge = new BooleanType();
1700    this.estimatedAge.setValue(value);
1701    return this;
1702  }
1703
1704  /**
1705   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1706   *         the relative at the time of death for the family member history
1707   *         record.)
1708   */
1709  public Type getDeceased() {
1710    return this.deceased;
1711  }
1712
1713  /**
1714   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1715   *         the relative at the time of death for the family member history
1716   *         record.)
1717   */
1718  public BooleanType getDeceasedBooleanType() throws FHIRException {
1719    if (this.deceased == null)
1720      this.deceased = new BooleanType();
1721    if (!(this.deceased instanceof BooleanType))
1722      throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
1723          + this.deceased.getClass().getName() + " was encountered");
1724    return (BooleanType) this.deceased;
1725  }
1726
1727  public boolean hasDeceasedBooleanType() {
1728    return this != null && this.deceased instanceof BooleanType;
1729  }
1730
1731  /**
1732   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1733   *         the relative at the time of death for the family member history
1734   *         record.)
1735   */
1736  public Age getDeceasedAge() throws FHIRException {
1737    if (this.deceased == null)
1738      this.deceased = new Age();
1739    if (!(this.deceased instanceof Age))
1740      throw new FHIRException(
1741          "Type mismatch: the type Age was expected, but " + this.deceased.getClass().getName() + " was encountered");
1742    return (Age) this.deceased;
1743  }
1744
1745  public boolean hasDeceasedAge() {
1746    return this != null && this.deceased instanceof Age;
1747  }
1748
1749  /**
1750   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1751   *         the relative at the time of death for the family member history
1752   *         record.)
1753   */
1754  public Range getDeceasedRange() throws FHIRException {
1755    if (this.deceased == null)
1756      this.deceased = new Range();
1757    if (!(this.deceased instanceof Range))
1758      throw new FHIRException(
1759          "Type mismatch: the type Range was expected, but " + this.deceased.getClass().getName() + " was encountered");
1760    return (Range) this.deceased;
1761  }
1762
1763  public boolean hasDeceasedRange() {
1764    return this != null && this.deceased instanceof Range;
1765  }
1766
1767  /**
1768   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1769   *         the relative at the time of death for the family member history
1770   *         record.)
1771   */
1772  public DateType getDeceasedDateType() throws FHIRException {
1773    if (this.deceased == null)
1774      this.deceased = new DateType();
1775    if (!(this.deceased instanceof DateType))
1776      throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.deceased.getClass().getName()
1777          + " was encountered");
1778    return (DateType) this.deceased;
1779  }
1780
1781  public boolean hasDeceasedDateType() {
1782    return this != null && this.deceased instanceof DateType;
1783  }
1784
1785  /**
1786   * @return {@link #deceased} (Deceased flag or the actual or approximate age of
1787   *         the relative at the time of death for the family member history
1788   *         record.)
1789   */
1790  public StringType getDeceasedStringType() throws FHIRException {
1791    if (this.deceased == null)
1792      this.deceased = new StringType();
1793    if (!(this.deceased instanceof StringType))
1794      throw new FHIRException("Type mismatch: the type StringType was expected, but "
1795          + this.deceased.getClass().getName() + " was encountered");
1796    return (StringType) this.deceased;
1797  }
1798
1799  public boolean hasDeceasedStringType() {
1800    return this != null && this.deceased instanceof StringType;
1801  }
1802
1803  public boolean hasDeceased() {
1804    return this.deceased != null && !this.deceased.isEmpty();
1805  }
1806
1807  /**
1808   * @param value {@link #deceased} (Deceased flag or the actual or approximate
1809   *              age of the relative at the time of death for the family member
1810   *              history record.)
1811   */
1812  public FamilyMemberHistory setDeceased(Type value) {
1813    if (value != null && !(value instanceof BooleanType || value instanceof Age || value instanceof Range
1814        || value instanceof DateType || value instanceof StringType))
1815      throw new Error("Not the right type for FamilyMemberHistory.deceased[x]: " + value.fhirType());
1816    this.deceased = value;
1817    return this;
1818  }
1819
1820  /**
1821   * @return {@link #reasonCode} (Describes why the family member history occurred
1822   *         in coded or textual form.)
1823   */
1824  public List<CodeableConcept> getReasonCode() {
1825    if (this.reasonCode == null)
1826      this.reasonCode = new ArrayList<CodeableConcept>();
1827    return this.reasonCode;
1828  }
1829
1830  /**
1831   * @return Returns a reference to <code>this</code> for easy method chaining
1832   */
1833  public FamilyMemberHistory setReasonCode(List<CodeableConcept> theReasonCode) {
1834    this.reasonCode = theReasonCode;
1835    return this;
1836  }
1837
1838  public boolean hasReasonCode() {
1839    if (this.reasonCode == null)
1840      return false;
1841    for (CodeableConcept item : this.reasonCode)
1842      if (!item.isEmpty())
1843        return true;
1844    return false;
1845  }
1846
1847  public CodeableConcept addReasonCode() { // 3
1848    CodeableConcept t = new CodeableConcept();
1849    if (this.reasonCode == null)
1850      this.reasonCode = new ArrayList<CodeableConcept>();
1851    this.reasonCode.add(t);
1852    return t;
1853  }
1854
1855  public FamilyMemberHistory addReasonCode(CodeableConcept t) { // 3
1856    if (t == null)
1857      return this;
1858    if (this.reasonCode == null)
1859      this.reasonCode = new ArrayList<CodeableConcept>();
1860    this.reasonCode.add(t);
1861    return this;
1862  }
1863
1864  /**
1865   * @return The first repetition of repeating field {@link #reasonCode}, creating
1866   *         it if it does not already exist
1867   */
1868  public CodeableConcept getReasonCodeFirstRep() {
1869    if (getReasonCode().isEmpty()) {
1870      addReasonCode();
1871    }
1872    return getReasonCode().get(0);
1873  }
1874
1875  /**
1876   * @return {@link #reasonReference} (Indicates a Condition, Observation,
1877   *         AllergyIntolerance, or QuestionnaireResponse that justifies this
1878   *         family member history event.)
1879   */
1880  public List<Reference> getReasonReference() {
1881    if (this.reasonReference == null)
1882      this.reasonReference = new ArrayList<Reference>();
1883    return this.reasonReference;
1884  }
1885
1886  /**
1887   * @return Returns a reference to <code>this</code> for easy method chaining
1888   */
1889  public FamilyMemberHistory setReasonReference(List<Reference> theReasonReference) {
1890    this.reasonReference = theReasonReference;
1891    return this;
1892  }
1893
1894  public boolean hasReasonReference() {
1895    if (this.reasonReference == null)
1896      return false;
1897    for (Reference item : this.reasonReference)
1898      if (!item.isEmpty())
1899        return true;
1900    return false;
1901  }
1902
1903  public Reference addReasonReference() { // 3
1904    Reference t = new Reference();
1905    if (this.reasonReference == null)
1906      this.reasonReference = new ArrayList<Reference>();
1907    this.reasonReference.add(t);
1908    return t;
1909  }
1910
1911  public FamilyMemberHistory addReasonReference(Reference t) { // 3
1912    if (t == null)
1913      return this;
1914    if (this.reasonReference == null)
1915      this.reasonReference = new ArrayList<Reference>();
1916    this.reasonReference.add(t);
1917    return this;
1918  }
1919
1920  /**
1921   * @return The first repetition of repeating field {@link #reasonReference},
1922   *         creating it if it does not already exist
1923   */
1924  public Reference getReasonReferenceFirstRep() {
1925    if (getReasonReference().isEmpty()) {
1926      addReasonReference();
1927    }
1928    return getReasonReference().get(0);
1929  }
1930
1931  /**
1932   * @deprecated Use Reference#setResource(IBaseResource) instead
1933   */
1934  @Deprecated
1935  public List<Resource> getReasonReferenceTarget() {
1936    if (this.reasonReferenceTarget == null)
1937      this.reasonReferenceTarget = new ArrayList<Resource>();
1938    return this.reasonReferenceTarget;
1939  }
1940
1941  /**
1942   * @return {@link #note} (This property allows a non condition-specific note to
1943   *         the made about the related person. Ideally, the note would be in the
1944   *         condition property, but this is not always possible.)
1945   */
1946  public List<Annotation> getNote() {
1947    if (this.note == null)
1948      this.note = new ArrayList<Annotation>();
1949    return this.note;
1950  }
1951
1952  /**
1953   * @return Returns a reference to <code>this</code> for easy method chaining
1954   */
1955  public FamilyMemberHistory setNote(List<Annotation> theNote) {
1956    this.note = theNote;
1957    return this;
1958  }
1959
1960  public boolean hasNote() {
1961    if (this.note == null)
1962      return false;
1963    for (Annotation item : this.note)
1964      if (!item.isEmpty())
1965        return true;
1966    return false;
1967  }
1968
1969  public Annotation addNote() { // 3
1970    Annotation t = new Annotation();
1971    if (this.note == null)
1972      this.note = new ArrayList<Annotation>();
1973    this.note.add(t);
1974    return t;
1975  }
1976
1977  public FamilyMemberHistory addNote(Annotation t) { // 3
1978    if (t == null)
1979      return this;
1980    if (this.note == null)
1981      this.note = new ArrayList<Annotation>();
1982    this.note.add(t);
1983    return this;
1984  }
1985
1986  /**
1987   * @return The first repetition of repeating field {@link #note}, creating it if
1988   *         it does not already exist
1989   */
1990  public Annotation getNoteFirstRep() {
1991    if (getNote().isEmpty()) {
1992      addNote();
1993    }
1994    return getNote().get(0);
1995  }
1996
1997  /**
1998   * @return {@link #condition} (The significant Conditions (or condition) that
1999   *         the family member had. This is a repeating section to allow a system
2000   *         to represent more than one condition per resource, though there is
2001   *         nothing stopping multiple resources - one per condition.)
2002   */
2003  public List<FamilyMemberHistoryConditionComponent> getCondition() {
2004    if (this.condition == null)
2005      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2006    return this.condition;
2007  }
2008
2009  /**
2010   * @return Returns a reference to <code>this</code> for easy method chaining
2011   */
2012  public FamilyMemberHistory setCondition(List<FamilyMemberHistoryConditionComponent> theCondition) {
2013    this.condition = theCondition;
2014    return this;
2015  }
2016
2017  public boolean hasCondition() {
2018    if (this.condition == null)
2019      return false;
2020    for (FamilyMemberHistoryConditionComponent item : this.condition)
2021      if (!item.isEmpty())
2022        return true;
2023    return false;
2024  }
2025
2026  public FamilyMemberHistoryConditionComponent addCondition() { // 3
2027    FamilyMemberHistoryConditionComponent t = new FamilyMemberHistoryConditionComponent();
2028    if (this.condition == null)
2029      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2030    this.condition.add(t);
2031    return t;
2032  }
2033
2034  public FamilyMemberHistory addCondition(FamilyMemberHistoryConditionComponent t) { // 3
2035    if (t == null)
2036      return this;
2037    if (this.condition == null)
2038      this.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2039    this.condition.add(t);
2040    return this;
2041  }
2042
2043  /**
2044   * @return The first repetition of repeating field {@link #condition}, creating
2045   *         it if it does not already exist
2046   */
2047  public FamilyMemberHistoryConditionComponent getConditionFirstRep() {
2048    if (getCondition().isEmpty()) {
2049      addCondition();
2050    }
2051    return getCondition().get(0);
2052  }
2053
2054  protected void listChildren(List<Property> children) {
2055    super.listChildren(children);
2056    children.add(new Property("identifier", "Identifier",
2057        "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
2058        0, java.lang.Integer.MAX_VALUE, identifier));
2059    children.add(new Property("instantiatesCanonical",
2060        "canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)",
2061        "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2062        0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2063    children.add(new Property("instantiatesUri", "uri",
2064        "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2065        0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2066    children.add(new Property("status", "code",
2067        "A code specifying the status of the record of the family history of a specific family member.", 0, 1, status));
2068    children.add(new Property("dataAbsentReason", "CodeableConcept",
2069        "Describes why the family member's history is not available.", 0, 1, dataAbsentReason));
2070    children.add(new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, 1, patient));
2071    children.add(new Property("date", "dateTime",
2072        "The date (and possibly time) when the family member history was recorded or last updated.", 0, 1, date));
2073    children.add(new Property("name", "string",
2074        "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".", 0, 1,
2075        name));
2076    children.add(new Property("relationship", "CodeableConcept",
2077        "The type of relationship this person has to the patient (father, mother, brother etc.).", 0, 1, relationship));
2078    children.add(new Property("sex", "CodeableConcept", "The birth sex of the family member.", 0, 1, sex));
2079    children.add(new Property("born[x]", "Period|date|string",
2080        "The actual or approximate date of birth of the relative.", 0, 1, born));
2081    children.add(new Property("age[x]", "Age|Range|string",
2082        "The age of the relative at the time the family member history is recorded.", 0, 1, age));
2083    children.add(new Property("estimatedAge", "boolean",
2084        "If true, indicates that the age value specified is an estimated value.", 0, 1, estimatedAge));
2085    children.add(new Property("deceased[x]", "boolean|Age|Range|date|string",
2086        "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2087        0, 1, deceased));
2088    children.add(new Property("reasonCode", "CodeableConcept",
2089        "Describes why the family member history occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE,
2090        reasonCode));
2091    children.add(new Property("reasonReference",
2092        "Reference(Condition|Observation|AllergyIntolerance|QuestionnaireResponse|DiagnosticReport|DocumentReference)",
2093        "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.",
2094        0, java.lang.Integer.MAX_VALUE, reasonReference));
2095    children.add(new Property("note", "Annotation",
2096        "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.",
2097        0, java.lang.Integer.MAX_VALUE, note));
2098    children.add(new Property("condition", "",
2099        "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.",
2100        0, java.lang.Integer.MAX_VALUE, condition));
2101  }
2102
2103  @Override
2104  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2105    switch (_hash) {
2106    case -1618432855:
2107      /* identifier */ return new Property("identifier", "Identifier",
2108          "Business identifiers assigned to this family member history by the performer or other systems which remain constant as the resource is updated and propagates from server to server.",
2109          0, java.lang.Integer.MAX_VALUE, identifier);
2110    case 8911915:
2111      /* instantiatesCanonical */ return new Property("instantiatesCanonical",
2112          "canonical(PlanDefinition|Questionnaire|ActivityDefinition|Measure|OperationDefinition)",
2113          "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2114          0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2115    case -1926393373:
2116      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
2117          "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this FamilyMemberHistory.",
2118          0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2119    case -892481550:
2120      /* status */ return new Property("status", "code",
2121          "A code specifying the status of the record of the family history of a specific family member.", 0, 1,
2122          status);
2123    case 1034315687:
2124      /* dataAbsentReason */ return new Property("dataAbsentReason", "CodeableConcept",
2125          "Describes why the family member's history is not available.", 0, 1, dataAbsentReason);
2126    case -791418107:
2127      /* patient */ return new Property("patient", "Reference(Patient)", "The person who this history concerns.", 0, 1,
2128          patient);
2129    case 3076014:
2130      /* date */ return new Property("date", "dateTime",
2131          "The date (and possibly time) when the family member history was recorded or last updated.", 0, 1, date);
2132    case 3373707:
2133      /* name */ return new Property("name", "string",
2134          "This will either be a name or a description; e.g. \"Aunt Susan\", \"my cousin with the red hair\".", 0, 1,
2135          name);
2136    case -261851592:
2137      /* relationship */ return new Property("relationship", "CodeableConcept",
2138          "The type of relationship this person has to the patient (father, mother, brother etc.).", 0, 1,
2139          relationship);
2140    case 113766:
2141      /* sex */ return new Property("sex", "CodeableConcept", "The birth sex of the family member.", 0, 1, sex);
2142    case 67532951:
2143      /* born[x] */ return new Property("born[x]", "Period|date|string",
2144          "The actual or approximate date of birth of the relative.", 0, 1, born);
2145    case 3029833:
2146      /* born */ return new Property("born[x]", "Period|date|string",
2147          "The actual or approximate date of birth of the relative.", 0, 1, born);
2148    case 1497711210:
2149      /* bornPeriod */ return new Property("born[x]", "Period|date|string",
2150          "The actual or approximate date of birth of the relative.", 0, 1, born);
2151    case 2092814999:
2152      /* bornDate */ return new Property("born[x]", "Period|date|string",
2153          "The actual or approximate date of birth of the relative.", 0, 1, born);
2154    case 1597451450:
2155      /* bornString */ return new Property("born[x]", "Period|date|string",
2156          "The actual or approximate date of birth of the relative.", 0, 1, born);
2157    case -1419716831:
2158      /* age[x] */ return new Property("age[x]", "Age|Range|string",
2159          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2160    case 96511:
2161      /* age */ return new Property("age[x]", "Age|Range|string",
2162          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2163    case -1419742336:
2164      /* ageAge */ return new Property("age[x]", "Age|Range|string",
2165          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2166    case 1442748286:
2167      /* ageRange */ return new Property("age[x]", "Age|Range|string",
2168          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2169    case 1821821424:
2170      /* ageString */ return new Property("age[x]", "Age|Range|string",
2171          "The age of the relative at the time the family member history is recorded.", 0, 1, age);
2172    case 2130167587:
2173      /* estimatedAge */ return new Property("estimatedAge", "boolean",
2174          "If true, indicates that the age value specified is an estimated value.", 0, 1, estimatedAge);
2175    case -1311442804:
2176      /* deceased[x] */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2177          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2178          0, 1, deceased);
2179    case 561497972:
2180      /* deceased */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2181          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2182          0, 1, deceased);
2183    case 497463828:
2184      /* deceasedBoolean */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2185          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2186          0, 1, deceased);
2187    case -1311468309:
2188      /* deceasedAge */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2189          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2190          0, 1, deceased);
2191    case -1880094167:
2192      /* deceasedRange */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2193          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2194          0, 1, deceased);
2195    case -2000727742:
2196      /* deceasedDate */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2197          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2198          0, 1, deceased);
2199    case 1892920485:
2200      /* deceasedString */ return new Property("deceased[x]", "boolean|Age|Range|date|string",
2201          "Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.",
2202          0, 1, deceased);
2203    case 722137681:
2204      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
2205          "Describes why the family member history occurred in coded or textual form.", 0, java.lang.Integer.MAX_VALUE,
2206          reasonCode);
2207    case -1146218137:
2208      /* reasonReference */ return new Property("reasonReference",
2209          "Reference(Condition|Observation|AllergyIntolerance|QuestionnaireResponse|DiagnosticReport|DocumentReference)",
2210          "Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.",
2211          0, java.lang.Integer.MAX_VALUE, reasonReference);
2212    case 3387378:
2213      /* note */ return new Property("note", "Annotation",
2214          "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.",
2215          0, java.lang.Integer.MAX_VALUE, note);
2216    case -861311717:
2217      /* condition */ return new Property("condition", "",
2218          "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.",
2219          0, java.lang.Integer.MAX_VALUE, condition);
2220    default:
2221      return super.getNamedProperty(_hash, _name, _checkValid);
2222    }
2223
2224  }
2225
2226  @Override
2227  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2228    switch (hash) {
2229    case -1618432855:
2230      /* identifier */ return this.identifier == null ? new Base[0]
2231          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2232    case 8911915:
2233      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
2234          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2235    case -1926393373:
2236      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
2237          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2238    case -892481550:
2239      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<FamilyHistoryStatus>
2240    case 1034315687:
2241      /* dataAbsentReason */ return this.dataAbsentReason == null ? new Base[0] : new Base[] { this.dataAbsentReason }; // CodeableConcept
2242    case -791418107:
2243      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
2244    case 3076014:
2245      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
2246    case 3373707:
2247      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
2248    case -261851592:
2249      /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // CodeableConcept
2250    case 113766:
2251      /* sex */ return this.sex == null ? new Base[0] : new Base[] { this.sex }; // CodeableConcept
2252    case 3029833:
2253      /* born */ return this.born == null ? new Base[0] : new Base[] { this.born }; // Type
2254    case 96511:
2255      /* age */ return this.age == null ? new Base[0] : new Base[] { this.age }; // Type
2256    case 2130167587:
2257      /* estimatedAge */ return this.estimatedAge == null ? new Base[0] : new Base[] { this.estimatedAge }; // BooleanType
2258    case 561497972:
2259      /* deceased */ return this.deceased == null ? new Base[0] : new Base[] { this.deceased }; // Type
2260    case 722137681:
2261      /* reasonCode */ return this.reasonCode == null ? new Base[0]
2262          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2263    case -1146218137:
2264      /* reasonReference */ return this.reasonReference == null ? new Base[0]
2265          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2266    case 3387378:
2267      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2268    case -861311717:
2269      /* condition */ return this.condition == null ? new Base[0]
2270          : this.condition.toArray(new Base[this.condition.size()]); // FamilyMemberHistoryConditionComponent
2271    default:
2272      return super.getProperty(hash, name, checkValid);
2273    }
2274
2275  }
2276
2277  @Override
2278  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2279    switch (hash) {
2280    case -1618432855: // identifier
2281      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2282      return value;
2283    case 8911915: // instantiatesCanonical
2284      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2285      return value;
2286    case -1926393373: // instantiatesUri
2287      this.getInstantiatesUri().add(castToUri(value)); // UriType
2288      return value;
2289    case -892481550: // status
2290      value = new FamilyHistoryStatusEnumFactory().fromType(castToCode(value));
2291      this.status = (Enumeration) value; // Enumeration<FamilyHistoryStatus>
2292      return value;
2293    case 1034315687: // dataAbsentReason
2294      this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2295      return value;
2296    case -791418107: // patient
2297      this.patient = castToReference(value); // Reference
2298      return value;
2299    case 3076014: // date
2300      this.date = castToDateTime(value); // DateTimeType
2301      return value;
2302    case 3373707: // name
2303      this.name = castToString(value); // StringType
2304      return value;
2305    case -261851592: // relationship
2306      this.relationship = castToCodeableConcept(value); // CodeableConcept
2307      return value;
2308    case 113766: // sex
2309      this.sex = castToCodeableConcept(value); // CodeableConcept
2310      return value;
2311    case 3029833: // born
2312      this.born = castToType(value); // Type
2313      return value;
2314    case 96511: // age
2315      this.age = castToType(value); // Type
2316      return value;
2317    case 2130167587: // estimatedAge
2318      this.estimatedAge = castToBoolean(value); // BooleanType
2319      return value;
2320    case 561497972: // deceased
2321      this.deceased = castToType(value); // Type
2322      return value;
2323    case 722137681: // reasonCode
2324      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2325      return value;
2326    case -1146218137: // reasonReference
2327      this.getReasonReference().add(castToReference(value)); // Reference
2328      return value;
2329    case 3387378: // note
2330      this.getNote().add(castToAnnotation(value)); // Annotation
2331      return value;
2332    case -861311717: // condition
2333      this.getCondition().add((FamilyMemberHistoryConditionComponent) value); // FamilyMemberHistoryConditionComponent
2334      return value;
2335    default:
2336      return super.setProperty(hash, name, value);
2337    }
2338
2339  }
2340
2341  @Override
2342  public Base setProperty(String name, Base value) throws FHIRException {
2343    if (name.equals("identifier")) {
2344      this.getIdentifier().add(castToIdentifier(value));
2345    } else if (name.equals("instantiatesCanonical")) {
2346      this.getInstantiatesCanonical().add(castToCanonical(value));
2347    } else if (name.equals("instantiatesUri")) {
2348      this.getInstantiatesUri().add(castToUri(value));
2349    } else if (name.equals("status")) {
2350      value = new FamilyHistoryStatusEnumFactory().fromType(castToCode(value));
2351      this.status = (Enumeration) value; // Enumeration<FamilyHistoryStatus>
2352    } else if (name.equals("dataAbsentReason")) {
2353      this.dataAbsentReason = castToCodeableConcept(value); // CodeableConcept
2354    } else if (name.equals("patient")) {
2355      this.patient = castToReference(value); // Reference
2356    } else if (name.equals("date")) {
2357      this.date = castToDateTime(value); // DateTimeType
2358    } else if (name.equals("name")) {
2359      this.name = castToString(value); // StringType
2360    } else if (name.equals("relationship")) {
2361      this.relationship = castToCodeableConcept(value); // CodeableConcept
2362    } else if (name.equals("sex")) {
2363      this.sex = castToCodeableConcept(value); // CodeableConcept
2364    } else if (name.equals("born[x]")) {
2365      this.born = castToType(value); // Type
2366    } else if (name.equals("age[x]")) {
2367      this.age = castToType(value); // Type
2368    } else if (name.equals("estimatedAge")) {
2369      this.estimatedAge = castToBoolean(value); // BooleanType
2370    } else if (name.equals("deceased[x]")) {
2371      this.deceased = castToType(value); // Type
2372    } else if (name.equals("reasonCode")) {
2373      this.getReasonCode().add(castToCodeableConcept(value));
2374    } else if (name.equals("reasonReference")) {
2375      this.getReasonReference().add(castToReference(value));
2376    } else if (name.equals("note")) {
2377      this.getNote().add(castToAnnotation(value));
2378    } else if (name.equals("condition")) {
2379      this.getCondition().add((FamilyMemberHistoryConditionComponent) value);
2380    } else
2381      return super.setProperty(name, value);
2382    return value;
2383  }
2384
2385  @Override
2386  public void removeChild(String name, Base value) throws FHIRException {
2387    if (name.equals("identifier")) {
2388      this.getIdentifier().remove(castToIdentifier(value));
2389    } else if (name.equals("instantiatesCanonical")) {
2390      this.getInstantiatesCanonical().remove(castToCanonical(value));
2391    } else if (name.equals("instantiatesUri")) {
2392      this.getInstantiatesUri().remove(castToUri(value));
2393    } else if (name.equals("status")) {
2394      this.status = null;
2395    } else if (name.equals("dataAbsentReason")) {
2396      this.dataAbsentReason = null;
2397    } else if (name.equals("patient")) {
2398      this.patient = null;
2399    } else if (name.equals("date")) {
2400      this.date = null;
2401    } else if (name.equals("name")) {
2402      this.name = null;
2403    } else if (name.equals("relationship")) {
2404      this.relationship = null;
2405    } else if (name.equals("sex")) {
2406      this.sex = null;
2407    } else if (name.equals("born[x]")) {
2408      this.born = null;
2409    } else if (name.equals("age[x]")) {
2410      this.age = null;
2411    } else if (name.equals("estimatedAge")) {
2412      this.estimatedAge = null;
2413    } else if (name.equals("deceased[x]")) {
2414      this.deceased = null;
2415    } else if (name.equals("reasonCode")) {
2416      this.getReasonCode().remove(castToCodeableConcept(value));
2417    } else if (name.equals("reasonReference")) {
2418      this.getReasonReference().remove(castToReference(value));
2419    } else if (name.equals("note")) {
2420      this.getNote().remove(castToAnnotation(value));
2421    } else if (name.equals("condition")) {
2422      this.getCondition().remove((FamilyMemberHistoryConditionComponent) value);
2423    } else
2424      super.removeChild(name, value);
2425    
2426  }
2427
2428  @Override
2429  public Base makeProperty(int hash, String name) throws FHIRException {
2430    switch (hash) {
2431    case -1618432855:
2432      return addIdentifier();
2433    case 8911915:
2434      return addInstantiatesCanonicalElement();
2435    case -1926393373:
2436      return addInstantiatesUriElement();
2437    case -892481550:
2438      return getStatusElement();
2439    case 1034315687:
2440      return getDataAbsentReason();
2441    case -791418107:
2442      return getPatient();
2443    case 3076014:
2444      return getDateElement();
2445    case 3373707:
2446      return getNameElement();
2447    case -261851592:
2448      return getRelationship();
2449    case 113766:
2450      return getSex();
2451    case 67532951:
2452      return getBorn();
2453    case 3029833:
2454      return getBorn();
2455    case -1419716831:
2456      return getAge();
2457    case 96511:
2458      return getAge();
2459    case 2130167587:
2460      return getEstimatedAgeElement();
2461    case -1311442804:
2462      return getDeceased();
2463    case 561497972:
2464      return getDeceased();
2465    case 722137681:
2466      return addReasonCode();
2467    case -1146218137:
2468      return addReasonReference();
2469    case 3387378:
2470      return addNote();
2471    case -861311717:
2472      return addCondition();
2473    default:
2474      return super.makeProperty(hash, name);
2475    }
2476
2477  }
2478
2479  @Override
2480  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2481    switch (hash) {
2482    case -1618432855:
2483      /* identifier */ return new String[] { "Identifier" };
2484    case 8911915:
2485      /* instantiatesCanonical */ return new String[] { "canonical" };
2486    case -1926393373:
2487      /* instantiatesUri */ return new String[] { "uri" };
2488    case -892481550:
2489      /* status */ return new String[] { "code" };
2490    case 1034315687:
2491      /* dataAbsentReason */ return new String[] { "CodeableConcept" };
2492    case -791418107:
2493      /* patient */ return new String[] { "Reference" };
2494    case 3076014:
2495      /* date */ return new String[] { "dateTime" };
2496    case 3373707:
2497      /* name */ return new String[] { "string" };
2498    case -261851592:
2499      /* relationship */ return new String[] { "CodeableConcept" };
2500    case 113766:
2501      /* sex */ return new String[] { "CodeableConcept" };
2502    case 3029833:
2503      /* born */ return new String[] { "Period", "date", "string" };
2504    case 96511:
2505      /* age */ return new String[] { "Age", "Range", "string" };
2506    case 2130167587:
2507      /* estimatedAge */ return new String[] { "boolean" };
2508    case 561497972:
2509      /* deceased */ return new String[] { "boolean", "Age", "Range", "date", "string" };
2510    case 722137681:
2511      /* reasonCode */ return new String[] { "CodeableConcept" };
2512    case -1146218137:
2513      /* reasonReference */ return new String[] { "Reference" };
2514    case 3387378:
2515      /* note */ return new String[] { "Annotation" };
2516    case -861311717:
2517      /* condition */ return new String[] {};
2518    default:
2519      return super.getTypesForProperty(hash, name);
2520    }
2521
2522  }
2523
2524  @Override
2525  public Base addChild(String name) throws FHIRException {
2526    if (name.equals("identifier")) {
2527      return addIdentifier();
2528    } else if (name.equals("instantiatesCanonical")) {
2529      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.instantiatesCanonical");
2530    } else if (name.equals("instantiatesUri")) {
2531      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.instantiatesUri");
2532    } else if (name.equals("status")) {
2533      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.status");
2534    } else if (name.equals("dataAbsentReason")) {
2535      this.dataAbsentReason = new CodeableConcept();
2536      return this.dataAbsentReason;
2537    } else if (name.equals("patient")) {
2538      this.patient = new Reference();
2539      return this.patient;
2540    } else if (name.equals("date")) {
2541      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.date");
2542    } else if (name.equals("name")) {
2543      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.name");
2544    } else if (name.equals("relationship")) {
2545      this.relationship = new CodeableConcept();
2546      return this.relationship;
2547    } else if (name.equals("sex")) {
2548      this.sex = new CodeableConcept();
2549      return this.sex;
2550    } else if (name.equals("bornPeriod")) {
2551      this.born = new Period();
2552      return this.born;
2553    } else if (name.equals("bornDate")) {
2554      this.born = new DateType();
2555      return this.born;
2556    } else if (name.equals("bornString")) {
2557      this.born = new StringType();
2558      return this.born;
2559    } else if (name.equals("ageAge")) {
2560      this.age = new Age();
2561      return this.age;
2562    } else if (name.equals("ageRange")) {
2563      this.age = new Range();
2564      return this.age;
2565    } else if (name.equals("ageString")) {
2566      this.age = new StringType();
2567      return this.age;
2568    } else if (name.equals("estimatedAge")) {
2569      throw new FHIRException("Cannot call addChild on a singleton property FamilyMemberHistory.estimatedAge");
2570    } else if (name.equals("deceasedBoolean")) {
2571      this.deceased = new BooleanType();
2572      return this.deceased;
2573    } else if (name.equals("deceasedAge")) {
2574      this.deceased = new Age();
2575      return this.deceased;
2576    } else if (name.equals("deceasedRange")) {
2577      this.deceased = new Range();
2578      return this.deceased;
2579    } else if (name.equals("deceasedDate")) {
2580      this.deceased = new DateType();
2581      return this.deceased;
2582    } else if (name.equals("deceasedString")) {
2583      this.deceased = new StringType();
2584      return this.deceased;
2585    } else if (name.equals("reasonCode")) {
2586      return addReasonCode();
2587    } else if (name.equals("reasonReference")) {
2588      return addReasonReference();
2589    } else if (name.equals("note")) {
2590      return addNote();
2591    } else if (name.equals("condition")) {
2592      return addCondition();
2593    } else
2594      return super.addChild(name);
2595  }
2596
2597  public String fhirType() {
2598    return "FamilyMemberHistory";
2599
2600  }
2601
2602  public FamilyMemberHistory copy() {
2603    FamilyMemberHistory dst = new FamilyMemberHistory();
2604    copyValues(dst);
2605    return dst;
2606  }
2607
2608  public void copyValues(FamilyMemberHistory dst) {
2609    super.copyValues(dst);
2610    if (identifier != null) {
2611      dst.identifier = new ArrayList<Identifier>();
2612      for (Identifier i : identifier)
2613        dst.identifier.add(i.copy());
2614    }
2615    ;
2616    if (instantiatesCanonical != null) {
2617      dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2618      for (CanonicalType i : instantiatesCanonical)
2619        dst.instantiatesCanonical.add(i.copy());
2620    }
2621    ;
2622    if (instantiatesUri != null) {
2623      dst.instantiatesUri = new ArrayList<UriType>();
2624      for (UriType i : instantiatesUri)
2625        dst.instantiatesUri.add(i.copy());
2626    }
2627    ;
2628    dst.status = status == null ? null : status.copy();
2629    dst.dataAbsentReason = dataAbsentReason == null ? null : dataAbsentReason.copy();
2630    dst.patient = patient == null ? null : patient.copy();
2631    dst.date = date == null ? null : date.copy();
2632    dst.name = name == null ? null : name.copy();
2633    dst.relationship = relationship == null ? null : relationship.copy();
2634    dst.sex = sex == null ? null : sex.copy();
2635    dst.born = born == null ? null : born.copy();
2636    dst.age = age == null ? null : age.copy();
2637    dst.estimatedAge = estimatedAge == null ? null : estimatedAge.copy();
2638    dst.deceased = deceased == null ? null : deceased.copy();
2639    if (reasonCode != null) {
2640      dst.reasonCode = new ArrayList<CodeableConcept>();
2641      for (CodeableConcept i : reasonCode)
2642        dst.reasonCode.add(i.copy());
2643    }
2644    ;
2645    if (reasonReference != null) {
2646      dst.reasonReference = new ArrayList<Reference>();
2647      for (Reference i : reasonReference)
2648        dst.reasonReference.add(i.copy());
2649    }
2650    ;
2651    if (note != null) {
2652      dst.note = new ArrayList<Annotation>();
2653      for (Annotation i : note)
2654        dst.note.add(i.copy());
2655    }
2656    ;
2657    if (condition != null) {
2658      dst.condition = new ArrayList<FamilyMemberHistoryConditionComponent>();
2659      for (FamilyMemberHistoryConditionComponent i : condition)
2660        dst.condition.add(i.copy());
2661    }
2662    ;
2663  }
2664
2665  protected FamilyMemberHistory typedCopy() {
2666    return copy();
2667  }
2668
2669  @Override
2670  public boolean equalsDeep(Base other_) {
2671    if (!super.equalsDeep(other_))
2672      return false;
2673    if (!(other_ instanceof FamilyMemberHistory))
2674      return false;
2675    FamilyMemberHistory o = (FamilyMemberHistory) other_;
2676    return compareDeep(identifier, o.identifier, true)
2677        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2678        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(status, o.status, true)
2679        && compareDeep(dataAbsentReason, o.dataAbsentReason, true) && compareDeep(patient, o.patient, true)
2680        && compareDeep(date, o.date, true) && compareDeep(name, o.name, true)
2681        && compareDeep(relationship, o.relationship, true) && compareDeep(sex, o.sex, true)
2682        && compareDeep(born, o.born, true) && compareDeep(age, o.age, true)
2683        && compareDeep(estimatedAge, o.estimatedAge, true) && compareDeep(deceased, o.deceased, true)
2684        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
2685        && compareDeep(note, o.note, true) && compareDeep(condition, o.condition, true);
2686  }
2687
2688  @Override
2689  public boolean equalsShallow(Base other_) {
2690    if (!super.equalsShallow(other_))
2691      return false;
2692    if (!(other_ instanceof FamilyMemberHistory))
2693      return false;
2694    FamilyMemberHistory o = (FamilyMemberHistory) other_;
2695    return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
2696        && compareValues(date, o.date, true) && compareValues(name, o.name, true)
2697        && compareValues(estimatedAge, o.estimatedAge, true);
2698  }
2699
2700  public boolean isEmpty() {
2701    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
2702        status, dataAbsentReason, patient, date, name, relationship, sex, born, age, estimatedAge, deceased, reasonCode,
2703        reasonReference, note, condition);
2704  }
2705
2706  @Override
2707  public ResourceType getResourceType() {
2708    return ResourceType.FamilyMemberHistory;
2709  }
2710
2711  /**
2712   * Search parameter: <b>date</b>
2713   * <p>
2714   * Description: <b>When history was recorded or last updated</b><br>
2715   * Type: <b>date</b><br>
2716   * Path: <b>FamilyMemberHistory.date</b><br>
2717   * </p>
2718   */
2719  @SearchParamDefinition(name = "date", path = "FamilyMemberHistory.date", description = "When history was recorded or last updated", type = "date")
2720  public static final String SP_DATE = "date";
2721  /**
2722   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2723   * <p>
2724   * Description: <b>When history was recorded or last updated</b><br>
2725   * Type: <b>date</b><br>
2726   * Path: <b>FamilyMemberHistory.date</b><br>
2727   * </p>
2728   */
2729  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
2730      SP_DATE);
2731
2732  /**
2733   * Search parameter: <b>identifier</b>
2734   * <p>
2735   * Description: <b>A search by a record identifier</b><br>
2736   * Type: <b>token</b><br>
2737   * Path: <b>FamilyMemberHistory.identifier</b><br>
2738   * </p>
2739   */
2740  @SearchParamDefinition(name = "identifier", path = "FamilyMemberHistory.identifier", description = "A search by a record identifier", type = "token")
2741  public static final String SP_IDENTIFIER = "identifier";
2742  /**
2743   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2744   * <p>
2745   * Description: <b>A search by a record identifier</b><br>
2746   * Type: <b>token</b><br>
2747   * Path: <b>FamilyMemberHistory.identifier</b><br>
2748   * </p>
2749   */
2750  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2751      SP_IDENTIFIER);
2752
2753  /**
2754   * Search parameter: <b>code</b>
2755   * <p>
2756   * Description: <b>A search by a condition code</b><br>
2757   * Type: <b>token</b><br>
2758   * Path: <b>FamilyMemberHistory.condition.code</b><br>
2759   * </p>
2760   */
2761  @SearchParamDefinition(name = "code", path = "FamilyMemberHistory.condition.code", description = "A search by a condition code", type = "token")
2762  public static final String SP_CODE = "code";
2763  /**
2764   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2765   * <p>
2766   * Description: <b>A search by a condition code</b><br>
2767   * Type: <b>token</b><br>
2768   * Path: <b>FamilyMemberHistory.condition.code</b><br>
2769   * </p>
2770   */
2771  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2772      SP_CODE);
2773
2774  /**
2775   * Search parameter: <b>patient</b>
2776   * <p>
2777   * Description: <b>The identity of a subject to list family member history items
2778   * for</b><br>
2779   * Type: <b>reference</b><br>
2780   * Path: <b>FamilyMemberHistory.patient</b><br>
2781   * </p>
2782   */
2783  @SearchParamDefinition(name = "patient", path = "FamilyMemberHistory.patient", description = "The identity of a subject to list family member history items for", type = "reference", providesMembershipIn = {
2784      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
2785  public static final String SP_PATIENT = "patient";
2786  /**
2787   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2788   * <p>
2789   * Description: <b>The identity of a subject to list family member history items
2790   * for</b><br>
2791   * Type: <b>reference</b><br>
2792   * Path: <b>FamilyMemberHistory.patient</b><br>
2793   * </p>
2794   */
2795  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2796      SP_PATIENT);
2797
2798  /**
2799   * Constant for fluent queries to be used to add include statements. Specifies
2800   * the path value of "<b>FamilyMemberHistory:patient</b>".
2801   */
2802  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2803      "FamilyMemberHistory:patient").toLocked();
2804
2805  /**
2806   * Search parameter: <b>sex</b>
2807   * <p>
2808   * Description: <b>A search by a sex code of a family member</b><br>
2809   * Type: <b>token</b><br>
2810   * Path: <b>FamilyMemberHistory.sex</b><br>
2811   * </p>
2812   */
2813  @SearchParamDefinition(name = "sex", path = "FamilyMemberHistory.sex", description = "A search by a sex code of a family member", type = "token")
2814  public static final String SP_SEX = "sex";
2815  /**
2816   * <b>Fluent Client</b> search parameter constant for <b>sex</b>
2817   * <p>
2818   * Description: <b>A search by a sex code of a family member</b><br>
2819   * Type: <b>token</b><br>
2820   * Path: <b>FamilyMemberHistory.sex</b><br>
2821   * </p>
2822   */
2823  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SEX = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2824      SP_SEX);
2825
2826  /**
2827   * Search parameter: <b>instantiates-canonical</b>
2828   * <p>
2829   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2830   * Type: <b>reference</b><br>
2831   * Path: <b>FamilyMemberHistory.instantiatesCanonical</b><br>
2832   * </p>
2833   */
2834  @SearchParamDefinition(name = "instantiates-canonical", path = "FamilyMemberHistory.instantiatesCanonical", description = "Instantiates FHIR protocol or definition", type = "reference", target = {
2835      ActivityDefinition.class, Measure.class, OperationDefinition.class, PlanDefinition.class, Questionnaire.class })
2836  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
2837  /**
2838   * <b>Fluent Client</b> search parameter constant for
2839   * <b>instantiates-canonical</b>
2840   * <p>
2841   * Description: <b>Instantiates FHIR protocol or definition</b><br>
2842   * Type: <b>reference</b><br>
2843   * Path: <b>FamilyMemberHistory.instantiatesCanonical</b><br>
2844   * </p>
2845   */
2846  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2847      SP_INSTANTIATES_CANONICAL);
2848
2849  /**
2850   * Constant for fluent queries to be used to add include statements. Specifies
2851   * the path value of "<b>FamilyMemberHistory:instantiates-canonical</b>".
2852   */
2853  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include(
2854      "FamilyMemberHistory:instantiates-canonical").toLocked();
2855
2856  /**
2857   * Search parameter: <b>instantiates-uri</b>
2858   * <p>
2859   * Description: <b>Instantiates external protocol or definition</b><br>
2860   * Type: <b>uri</b><br>
2861   * Path: <b>FamilyMemberHistory.instantiatesUri</b><br>
2862   * </p>
2863   */
2864  @SearchParamDefinition(name = "instantiates-uri", path = "FamilyMemberHistory.instantiatesUri", description = "Instantiates external protocol or definition", type = "uri")
2865  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
2866  /**
2867   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
2868   * <p>
2869   * Description: <b>Instantiates external protocol or definition</b><br>
2870   * Type: <b>uri</b><br>
2871   * Path: <b>FamilyMemberHistory.instantiatesUri</b><br>
2872   * </p>
2873   */
2874  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
2875      SP_INSTANTIATES_URI);
2876
2877  /**
2878   * Search parameter: <b>relationship</b>
2879   * <p>
2880   * Description: <b>A search by a relationship type</b><br>
2881   * Type: <b>token</b><br>
2882   * Path: <b>FamilyMemberHistory.relationship</b><br>
2883   * </p>
2884   */
2885  @SearchParamDefinition(name = "relationship", path = "FamilyMemberHistory.relationship", description = "A search by a relationship type", type = "token")
2886  public static final String SP_RELATIONSHIP = "relationship";
2887  /**
2888   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
2889   * <p>
2890   * Description: <b>A search by a relationship type</b><br>
2891   * Type: <b>token</b><br>
2892   * Path: <b>FamilyMemberHistory.relationship</b><br>
2893   * </p>
2894   */
2895  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATIONSHIP = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2896      SP_RELATIONSHIP);
2897
2898  /**
2899   * Search parameter: <b>status</b>
2900   * <p>
2901   * Description: <b>partial | completed | entered-in-error |
2902   * health-unknown</b><br>
2903   * Type: <b>token</b><br>
2904   * Path: <b>FamilyMemberHistory.status</b><br>
2905   * </p>
2906   */
2907  @SearchParamDefinition(name = "status", path = "FamilyMemberHistory.status", description = "partial | completed | entered-in-error | health-unknown", type = "token")
2908  public static final String SP_STATUS = "status";
2909  /**
2910   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2911   * <p>
2912   * Description: <b>partial | completed | entered-in-error |
2913   * health-unknown</b><br>
2914   * Type: <b>token</b><br>
2915   * Path: <b>FamilyMemberHistory.status</b><br>
2916   * </p>
2917   */
2918  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2919      SP_STATUS);
2920
2921}