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