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