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