001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044/**
045 * A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.
046 */
047@ResourceDef(name="ResearchSubject", profile="http://hl7.org/fhir/Profile/ResearchSubject")
048public class ResearchSubject extends DomainResource {
049
050    public enum ResearchSubjectStatus {
051        /**
052         * The subject has been identified as a potential participant in the study but has not yet agreed to participate
053         */
054        CANDIDATE, 
055        /**
056         * The subject has agreed to participate in the study but has not yet begun performing any action within the study
057         */
058        ENROLLED, 
059        /**
060         * The subject is currently being monitored and/or subject to treatment as part of the study
061         */
062        ACTIVE, 
063        /**
064         * The subject has temporarily discontinued monitoring/treatment as part of the study
065         */
066        SUSPENDED, 
067        /**
068         * The subject has permanently ended participation in the study prior to completion of the intended monitoring/treatment
069         */
070        WITHDRAWN, 
071        /**
072         * All intended monitoring/treatment of the subject has been completed and their engagement with the study is now ended
073         */
074        COMPLETED, 
075        /**
076         * added to help the parsers with the generic types
077         */
078        NULL;
079        public static ResearchSubjectStatus fromCode(String codeString) throws FHIRException {
080            if (codeString == null || "".equals(codeString))
081                return null;
082        if ("candidate".equals(codeString))
083          return CANDIDATE;
084        if ("enrolled".equals(codeString))
085          return ENROLLED;
086        if ("active".equals(codeString))
087          return ACTIVE;
088        if ("suspended".equals(codeString))
089          return SUSPENDED;
090        if ("withdrawn".equals(codeString))
091          return WITHDRAWN;
092        if ("completed".equals(codeString))
093          return COMPLETED;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown ResearchSubjectStatus code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case CANDIDATE: return "candidate";
102            case ENROLLED: return "enrolled";
103            case ACTIVE: return "active";
104            case SUSPENDED: return "suspended";
105            case WITHDRAWN: return "withdrawn";
106            case COMPLETED: return "completed";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getSystem() {
112          switch (this) {
113            case CANDIDATE: return "http://hl7.org/fhir/research-subject-status";
114            case ENROLLED: return "http://hl7.org/fhir/research-subject-status";
115            case ACTIVE: return "http://hl7.org/fhir/research-subject-status";
116            case SUSPENDED: return "http://hl7.org/fhir/research-subject-status";
117            case WITHDRAWN: return "http://hl7.org/fhir/research-subject-status";
118            case COMPLETED: return "http://hl7.org/fhir/research-subject-status";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123        public String getDefinition() {
124          switch (this) {
125            case CANDIDATE: return "The subject has been identified as a potential participant in the study but has not yet agreed to participate";
126            case ENROLLED: return "The subject has agreed to participate in the study but has not yet begun performing any action within the study";
127            case ACTIVE: return "The subject is currently being monitored and/or subject to treatment as part of the study";
128            case SUSPENDED: return "The subject has temporarily discontinued monitoring/treatment as part of the study";
129            case WITHDRAWN: return "The subject has permanently ended participation in the study prior to completion of the intended monitoring/treatment";
130            case COMPLETED: return "All intended monitoring/treatment of the subject has been completed and their engagement with the study is now ended";
131            case NULL: return null;
132            default: return "?";
133          }
134        }
135        public String getDisplay() {
136          switch (this) {
137            case CANDIDATE: return "Candidate";
138            case ENROLLED: return "Enrolled";
139            case ACTIVE: return "Active";
140            case SUSPENDED: return "Suspended";
141            case WITHDRAWN: return "Withdrawn";
142            case COMPLETED: return "Completed";
143            case NULL: return null;
144            default: return "?";
145          }
146        }
147    }
148
149  public static class ResearchSubjectStatusEnumFactory implements EnumFactory<ResearchSubjectStatus> {
150    public ResearchSubjectStatus fromCode(String codeString) throws IllegalArgumentException {
151      if (codeString == null || "".equals(codeString))
152            if (codeString == null || "".equals(codeString))
153                return null;
154        if ("candidate".equals(codeString))
155          return ResearchSubjectStatus.CANDIDATE;
156        if ("enrolled".equals(codeString))
157          return ResearchSubjectStatus.ENROLLED;
158        if ("active".equals(codeString))
159          return ResearchSubjectStatus.ACTIVE;
160        if ("suspended".equals(codeString))
161          return ResearchSubjectStatus.SUSPENDED;
162        if ("withdrawn".equals(codeString))
163          return ResearchSubjectStatus.WITHDRAWN;
164        if ("completed".equals(codeString))
165          return ResearchSubjectStatus.COMPLETED;
166        throw new IllegalArgumentException("Unknown ResearchSubjectStatus code '"+codeString+"'");
167        }
168        public Enumeration<ResearchSubjectStatus> fromType(PrimitiveType<?> code) throws FHIRException {
169          if (code == null)
170            return null;
171          if (code.isEmpty())
172            return new Enumeration<ResearchSubjectStatus>(this);
173          String codeString = code.asStringValue();
174          if (codeString == null || "".equals(codeString))
175            return null;
176        if ("candidate".equals(codeString))
177          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.CANDIDATE);
178        if ("enrolled".equals(codeString))
179          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ENROLLED);
180        if ("active".equals(codeString))
181          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ACTIVE);
182        if ("suspended".equals(codeString))
183          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.SUSPENDED);
184        if ("withdrawn".equals(codeString))
185          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.WITHDRAWN);
186        if ("completed".equals(codeString))
187          return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.COMPLETED);
188        throw new FHIRException("Unknown ResearchSubjectStatus code '"+codeString+"'");
189        }
190    public String toCode(ResearchSubjectStatus code) {
191      if (code == ResearchSubjectStatus.CANDIDATE)
192        return "candidate";
193      if (code == ResearchSubjectStatus.ENROLLED)
194        return "enrolled";
195      if (code == ResearchSubjectStatus.ACTIVE)
196        return "active";
197      if (code == ResearchSubjectStatus.SUSPENDED)
198        return "suspended";
199      if (code == ResearchSubjectStatus.WITHDRAWN)
200        return "withdrawn";
201      if (code == ResearchSubjectStatus.COMPLETED)
202        return "completed";
203      return "?";
204      }
205    public String toSystem(ResearchSubjectStatus code) {
206      return code.getSystem();
207      }
208    }
209
210    /**
211     * Identifiers assigned to this research study by the sponsor or other systems.
212     */
213    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
214    @Description(shortDefinition="Business Identifier for research subject", formalDefinition="Identifiers assigned to this research study by the sponsor or other systems." )
215    protected Identifier identifier;
216
217    /**
218     * The current state of the subject.
219     */
220    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
221    @Description(shortDefinition="candidate | enrolled | active | suspended | withdrawn | completed", formalDefinition="The current state of the subject." )
222    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-subject-status")
223    protected Enumeration<ResearchSubjectStatus> status;
224
225    /**
226     * The dates the subject began and ended their participation in the study.
227     */
228    @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
229    @Description(shortDefinition="Start and end of participation", formalDefinition="The dates the subject began and ended their participation in the study." )
230    protected Period period;
231
232    /**
233     * Reference to the study the subject is participating in.
234     */
235    @Child(name = "study", type = {ResearchStudy.class}, order=3, min=1, max=1, modifier=false, summary=true)
236    @Description(shortDefinition="Study subject is part of", formalDefinition="Reference to the study the subject is participating in." )
237    protected Reference study;
238
239    /**
240     * The actual object that is the target of the reference (Reference to the study the subject is participating in.)
241     */
242    protected ResearchStudy studyTarget;
243
244    /**
245     * The record of the person or animal who is involved in the study.
246     */
247    @Child(name = "individual", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true)
248    @Description(shortDefinition="Who is part of study", formalDefinition="The record of the person or animal who is involved in the study." )
249    protected Reference individual;
250
251    /**
252     * The actual object that is the target of the reference (The record of the person or animal who is involved in the study.)
253     */
254    protected Patient individualTarget;
255
256    /**
257     * The name of the arm in the study the subject is expected to follow as part of this study.
258     */
259    @Child(name = "assignedArm", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
260    @Description(shortDefinition="What path should be followed", formalDefinition="The name of the arm in the study the subject is expected to follow as part of this study." )
261    protected StringType assignedArm;
262
263    /**
264     * The name of the arm in the study the subject actually followed as part of this study.
265     */
266    @Child(name = "actualArm", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
267    @Description(shortDefinition="What path was followed", formalDefinition="The name of the arm in the study the subject actually followed as part of this study." )
268    protected StringType actualArm;
269
270    /**
271     * A record of the patient's informed agreement to participate in the study.
272     */
273    @Child(name = "consent", type = {Consent.class}, order=7, min=0, max=1, modifier=false, summary=false)
274    @Description(shortDefinition="Agreement to participate in study", formalDefinition="A record of the patient's informed agreement to participate in the study." )
275    protected Reference consent;
276
277    /**
278     * The actual object that is the target of the reference (A record of the patient's informed agreement to participate in the study.)
279     */
280    protected Consent consentTarget;
281
282    private static final long serialVersionUID = -1730128953L;
283
284  /**
285   * Constructor
286   */
287    public ResearchSubject() {
288      super();
289    }
290
291  /**
292   * Constructor
293   */
294    public ResearchSubject(Enumeration<ResearchSubjectStatus> status, Reference study, Reference individual) {
295      super();
296      this.status = status;
297      this.study = study;
298      this.individual = individual;
299    }
300
301    /**
302     * @return {@link #identifier} (Identifiers assigned to this research study by the sponsor or other systems.)
303     */
304    public Identifier getIdentifier() { 
305      if (this.identifier == null)
306        if (Configuration.errorOnAutoCreate())
307          throw new Error("Attempt to auto-create ResearchSubject.identifier");
308        else if (Configuration.doAutoCreate())
309          this.identifier = new Identifier(); // cc
310      return this.identifier;
311    }
312
313    public boolean hasIdentifier() { 
314      return this.identifier != null && !this.identifier.isEmpty();
315    }
316
317    /**
318     * @param value {@link #identifier} (Identifiers assigned to this research study by the sponsor or other systems.)
319     */
320    public ResearchSubject setIdentifier(Identifier value)  { 
321      this.identifier = value;
322      return this;
323    }
324
325    /**
326     * @return {@link #status} (The current state of the subject.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
327     */
328    public Enumeration<ResearchSubjectStatus> getStatusElement() { 
329      if (this.status == null)
330        if (Configuration.errorOnAutoCreate())
331          throw new Error("Attempt to auto-create ResearchSubject.status");
332        else if (Configuration.doAutoCreate())
333          this.status = new Enumeration<ResearchSubjectStatus>(new ResearchSubjectStatusEnumFactory()); // bb
334      return this.status;
335    }
336
337    public boolean hasStatusElement() { 
338      return this.status != null && !this.status.isEmpty();
339    }
340
341    public boolean hasStatus() { 
342      return this.status != null && !this.status.isEmpty();
343    }
344
345    /**
346     * @param value {@link #status} (The current state of the subject.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
347     */
348    public ResearchSubject setStatusElement(Enumeration<ResearchSubjectStatus> value) { 
349      this.status = value;
350      return this;
351    }
352
353    /**
354     * @return The current state of the subject.
355     */
356    public ResearchSubjectStatus getStatus() { 
357      return this.status == null ? null : this.status.getValue();
358    }
359
360    /**
361     * @param value The current state of the subject.
362     */
363    public ResearchSubject setStatus(ResearchSubjectStatus value) { 
364        if (this.status == null)
365          this.status = new Enumeration<ResearchSubjectStatus>(new ResearchSubjectStatusEnumFactory());
366        this.status.setValue(value);
367      return this;
368    }
369
370    /**
371     * @return {@link #period} (The dates the subject began and ended their participation in the study.)
372     */
373    public Period getPeriod() { 
374      if (this.period == null)
375        if (Configuration.errorOnAutoCreate())
376          throw new Error("Attempt to auto-create ResearchSubject.period");
377        else if (Configuration.doAutoCreate())
378          this.period = new Period(); // cc
379      return this.period;
380    }
381
382    public boolean hasPeriod() { 
383      return this.period != null && !this.period.isEmpty();
384    }
385
386    /**
387     * @param value {@link #period} (The dates the subject began and ended their participation in the study.)
388     */
389    public ResearchSubject setPeriod(Period value)  { 
390      this.period = value;
391      return this;
392    }
393
394    /**
395     * @return {@link #study} (Reference to the study the subject is participating in.)
396     */
397    public Reference getStudy() { 
398      if (this.study == null)
399        if (Configuration.errorOnAutoCreate())
400          throw new Error("Attempt to auto-create ResearchSubject.study");
401        else if (Configuration.doAutoCreate())
402          this.study = new Reference(); // cc
403      return this.study;
404    }
405
406    public boolean hasStudy() { 
407      return this.study != null && !this.study.isEmpty();
408    }
409
410    /**
411     * @param value {@link #study} (Reference to the study the subject is participating in.)
412     */
413    public ResearchSubject setStudy(Reference value)  { 
414      this.study = value;
415      return this;
416    }
417
418    /**
419     * @return {@link #study} 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. (Reference to the study the subject is participating in.)
420     */
421    public ResearchStudy getStudyTarget() { 
422      if (this.studyTarget == null)
423        if (Configuration.errorOnAutoCreate())
424          throw new Error("Attempt to auto-create ResearchSubject.study");
425        else if (Configuration.doAutoCreate())
426          this.studyTarget = new ResearchStudy(); // aa
427      return this.studyTarget;
428    }
429
430    /**
431     * @param value {@link #study} 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. (Reference to the study the subject is participating in.)
432     */
433    public ResearchSubject setStudyTarget(ResearchStudy value) { 
434      this.studyTarget = value;
435      return this;
436    }
437
438    /**
439     * @return {@link #individual} (The record of the person or animal who is involved in the study.)
440     */
441    public Reference getIndividual() { 
442      if (this.individual == null)
443        if (Configuration.errorOnAutoCreate())
444          throw new Error("Attempt to auto-create ResearchSubject.individual");
445        else if (Configuration.doAutoCreate())
446          this.individual = new Reference(); // cc
447      return this.individual;
448    }
449
450    public boolean hasIndividual() { 
451      return this.individual != null && !this.individual.isEmpty();
452    }
453
454    /**
455     * @param value {@link #individual} (The record of the person or animal who is involved in the study.)
456     */
457    public ResearchSubject setIndividual(Reference value)  { 
458      this.individual = value;
459      return this;
460    }
461
462    /**
463     * @return {@link #individual} 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 record of the person or animal who is involved in the study.)
464     */
465    public Patient getIndividualTarget() { 
466      if (this.individualTarget == null)
467        if (Configuration.errorOnAutoCreate())
468          throw new Error("Attempt to auto-create ResearchSubject.individual");
469        else if (Configuration.doAutoCreate())
470          this.individualTarget = new Patient(); // aa
471      return this.individualTarget;
472    }
473
474    /**
475     * @param value {@link #individual} 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 record of the person or animal who is involved in the study.)
476     */
477    public ResearchSubject setIndividualTarget(Patient value) { 
478      this.individualTarget = value;
479      return this;
480    }
481
482    /**
483     * @return {@link #assignedArm} (The name of the arm in the study the subject is expected to follow as part of this study.). This is the underlying object with id, value and extensions. The accessor "getAssignedArm" gives direct access to the value
484     */
485    public StringType getAssignedArmElement() { 
486      if (this.assignedArm == null)
487        if (Configuration.errorOnAutoCreate())
488          throw new Error("Attempt to auto-create ResearchSubject.assignedArm");
489        else if (Configuration.doAutoCreate())
490          this.assignedArm = new StringType(); // bb
491      return this.assignedArm;
492    }
493
494    public boolean hasAssignedArmElement() { 
495      return this.assignedArm != null && !this.assignedArm.isEmpty();
496    }
497
498    public boolean hasAssignedArm() { 
499      return this.assignedArm != null && !this.assignedArm.isEmpty();
500    }
501
502    /**
503     * @param value {@link #assignedArm} (The name of the arm in the study the subject is expected to follow as part of this study.). This is the underlying object with id, value and extensions. The accessor "getAssignedArm" gives direct access to the value
504     */
505    public ResearchSubject setAssignedArmElement(StringType value) { 
506      this.assignedArm = value;
507      return this;
508    }
509
510    /**
511     * @return The name of the arm in the study the subject is expected to follow as part of this study.
512     */
513    public String getAssignedArm() { 
514      return this.assignedArm == null ? null : this.assignedArm.getValue();
515    }
516
517    /**
518     * @param value The name of the arm in the study the subject is expected to follow as part of this study.
519     */
520    public ResearchSubject setAssignedArm(String value) { 
521      if (Utilities.noString(value))
522        this.assignedArm = null;
523      else {
524        if (this.assignedArm == null)
525          this.assignedArm = new StringType();
526        this.assignedArm.setValue(value);
527      }
528      return this;
529    }
530
531    /**
532     * @return {@link #actualArm} (The name of the arm in the study the subject actually followed as part of this study.). This is the underlying object with id, value and extensions. The accessor "getActualArm" gives direct access to the value
533     */
534    public StringType getActualArmElement() { 
535      if (this.actualArm == null)
536        if (Configuration.errorOnAutoCreate())
537          throw new Error("Attempt to auto-create ResearchSubject.actualArm");
538        else if (Configuration.doAutoCreate())
539          this.actualArm = new StringType(); // bb
540      return this.actualArm;
541    }
542
543    public boolean hasActualArmElement() { 
544      return this.actualArm != null && !this.actualArm.isEmpty();
545    }
546
547    public boolean hasActualArm() { 
548      return this.actualArm != null && !this.actualArm.isEmpty();
549    }
550
551    /**
552     * @param value {@link #actualArm} (The name of the arm in the study the subject actually followed as part of this study.). This is the underlying object with id, value and extensions. The accessor "getActualArm" gives direct access to the value
553     */
554    public ResearchSubject setActualArmElement(StringType value) { 
555      this.actualArm = value;
556      return this;
557    }
558
559    /**
560     * @return The name of the arm in the study the subject actually followed as part of this study.
561     */
562    public String getActualArm() { 
563      return this.actualArm == null ? null : this.actualArm.getValue();
564    }
565
566    /**
567     * @param value The name of the arm in the study the subject actually followed as part of this study.
568     */
569    public ResearchSubject setActualArm(String value) { 
570      if (Utilities.noString(value))
571        this.actualArm = null;
572      else {
573        if (this.actualArm == null)
574          this.actualArm = new StringType();
575        this.actualArm.setValue(value);
576      }
577      return this;
578    }
579
580    /**
581     * @return {@link #consent} (A record of the patient's informed agreement to participate in the study.)
582     */
583    public Reference getConsent() { 
584      if (this.consent == null)
585        if (Configuration.errorOnAutoCreate())
586          throw new Error("Attempt to auto-create ResearchSubject.consent");
587        else if (Configuration.doAutoCreate())
588          this.consent = new Reference(); // cc
589      return this.consent;
590    }
591
592    public boolean hasConsent() { 
593      return this.consent != null && !this.consent.isEmpty();
594    }
595
596    /**
597     * @param value {@link #consent} (A record of the patient's informed agreement to participate in the study.)
598     */
599    public ResearchSubject setConsent(Reference value)  { 
600      this.consent = value;
601      return this;
602    }
603
604    /**
605     * @return {@link #consent} 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. (A record of the patient's informed agreement to participate in the study.)
606     */
607    public Consent getConsentTarget() { 
608      if (this.consentTarget == null)
609        if (Configuration.errorOnAutoCreate())
610          throw new Error("Attempt to auto-create ResearchSubject.consent");
611        else if (Configuration.doAutoCreate())
612          this.consentTarget = new Consent(); // aa
613      return this.consentTarget;
614    }
615
616    /**
617     * @param value {@link #consent} 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. (A record of the patient's informed agreement to participate in the study.)
618     */
619    public ResearchSubject setConsentTarget(Consent value) { 
620      this.consentTarget = value;
621      return this;
622    }
623
624      protected void listChildren(List<Property> children) {
625        super.listChildren(children);
626        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this research study by the sponsor or other systems.", 0, 1, identifier));
627        children.add(new Property("status", "code", "The current state of the subject.", 0, 1, status));
628        children.add(new Property("period", "Period", "The dates the subject began and ended their participation in the study.", 0, 1, period));
629        children.add(new Property("study", "Reference(ResearchStudy)", "Reference to the study the subject is participating in.", 0, 1, study));
630        children.add(new Property("individual", "Reference(Patient)", "The record of the person or animal who is involved in the study.", 0, 1, individual));
631        children.add(new Property("assignedArm", "string", "The name of the arm in the study the subject is expected to follow as part of this study.", 0, 1, assignedArm));
632        children.add(new Property("actualArm", "string", "The name of the arm in the study the subject actually followed as part of this study.", 0, 1, actualArm));
633        children.add(new Property("consent", "Reference(Consent)", "A record of the patient's informed agreement to participate in the study.", 0, 1, consent));
634      }
635
636      @Override
637      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
638        switch (_hash) {
639        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this research study by the sponsor or other systems.", 0, 1, identifier);
640        case -892481550: /*status*/  return new Property("status", "code", "The current state of the subject.", 0, 1, status);
641        case -991726143: /*period*/  return new Property("period", "Period", "The dates the subject began and ended their participation in the study.", 0, 1, period);
642        case 109776329: /*study*/  return new Property("study", "Reference(ResearchStudy)", "Reference to the study the subject is participating in.", 0, 1, study);
643        case -46292327: /*individual*/  return new Property("individual", "Reference(Patient)", "The record of the person or animal who is involved in the study.", 0, 1, individual);
644        case 1741912494: /*assignedArm*/  return new Property("assignedArm", "string", "The name of the arm in the study the subject is expected to follow as part of this study.", 0, 1, assignedArm);
645        case 528827886: /*actualArm*/  return new Property("actualArm", "string", "The name of the arm in the study the subject actually followed as part of this study.", 0, 1, actualArm);
646        case 951500826: /*consent*/  return new Property("consent", "Reference(Consent)", "A record of the patient's informed agreement to participate in the study.", 0, 1, consent);
647        default: return super.getNamedProperty(_hash, _name, _checkValid);
648        }
649
650      }
651
652      @Override
653      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
654        switch (hash) {
655        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
656        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ResearchSubjectStatus>
657        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
658        case 109776329: /*study*/ return this.study == null ? new Base[0] : new Base[] {this.study}; // Reference
659        case -46292327: /*individual*/ return this.individual == null ? new Base[0] : new Base[] {this.individual}; // Reference
660        case 1741912494: /*assignedArm*/ return this.assignedArm == null ? new Base[0] : new Base[] {this.assignedArm}; // StringType
661        case 528827886: /*actualArm*/ return this.actualArm == null ? new Base[0] : new Base[] {this.actualArm}; // StringType
662        case 951500826: /*consent*/ return this.consent == null ? new Base[0] : new Base[] {this.consent}; // Reference
663        default: return super.getProperty(hash, name, checkValid);
664        }
665
666      }
667
668      @Override
669      public Base setProperty(int hash, String name, Base value) throws FHIRException {
670        switch (hash) {
671        case -1618432855: // identifier
672          this.identifier = castToIdentifier(value); // Identifier
673          return value;
674        case -892481550: // status
675          value = new ResearchSubjectStatusEnumFactory().fromType(castToCode(value));
676          this.status = (Enumeration) value; // Enumeration<ResearchSubjectStatus>
677          return value;
678        case -991726143: // period
679          this.period = castToPeriod(value); // Period
680          return value;
681        case 109776329: // study
682          this.study = castToReference(value); // Reference
683          return value;
684        case -46292327: // individual
685          this.individual = castToReference(value); // Reference
686          return value;
687        case 1741912494: // assignedArm
688          this.assignedArm = castToString(value); // StringType
689          return value;
690        case 528827886: // actualArm
691          this.actualArm = castToString(value); // StringType
692          return value;
693        case 951500826: // consent
694          this.consent = castToReference(value); // Reference
695          return value;
696        default: return super.setProperty(hash, name, value);
697        }
698
699      }
700
701      @Override
702      public Base setProperty(String name, Base value) throws FHIRException {
703        if (name.equals("identifier")) {
704          this.identifier = castToIdentifier(value); // Identifier
705        } else if (name.equals("status")) {
706          value = new ResearchSubjectStatusEnumFactory().fromType(castToCode(value));
707          this.status = (Enumeration) value; // Enumeration<ResearchSubjectStatus>
708        } else if (name.equals("period")) {
709          this.period = castToPeriod(value); // Period
710        } else if (name.equals("study")) {
711          this.study = castToReference(value); // Reference
712        } else if (name.equals("individual")) {
713          this.individual = castToReference(value); // Reference
714        } else if (name.equals("assignedArm")) {
715          this.assignedArm = castToString(value); // StringType
716        } else if (name.equals("actualArm")) {
717          this.actualArm = castToString(value); // StringType
718        } else if (name.equals("consent")) {
719          this.consent = castToReference(value); // Reference
720        } else
721          return super.setProperty(name, value);
722        return value;
723      }
724
725      @Override
726      public Base makeProperty(int hash, String name) throws FHIRException {
727        switch (hash) {
728        case -1618432855:  return getIdentifier(); 
729        case -892481550:  return getStatusElement();
730        case -991726143:  return getPeriod(); 
731        case 109776329:  return getStudy(); 
732        case -46292327:  return getIndividual(); 
733        case 1741912494:  return getAssignedArmElement();
734        case 528827886:  return getActualArmElement();
735        case 951500826:  return getConsent(); 
736        default: return super.makeProperty(hash, name);
737        }
738
739      }
740
741      @Override
742      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
743        switch (hash) {
744        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
745        case -892481550: /*status*/ return new String[] {"code"};
746        case -991726143: /*period*/ return new String[] {"Period"};
747        case 109776329: /*study*/ return new String[] {"Reference"};
748        case -46292327: /*individual*/ return new String[] {"Reference"};
749        case 1741912494: /*assignedArm*/ return new String[] {"string"};
750        case 528827886: /*actualArm*/ return new String[] {"string"};
751        case 951500826: /*consent*/ return new String[] {"Reference"};
752        default: return super.getTypesForProperty(hash, name);
753        }
754
755      }
756
757      @Override
758      public Base addChild(String name) throws FHIRException {
759        if (name.equals("identifier")) {
760          this.identifier = new Identifier();
761          return this.identifier;
762        }
763        else if (name.equals("status")) {
764          throw new FHIRException("Cannot call addChild on a singleton property ResearchSubject.status");
765        }
766        else if (name.equals("period")) {
767          this.period = new Period();
768          return this.period;
769        }
770        else if (name.equals("study")) {
771          this.study = new Reference();
772          return this.study;
773        }
774        else if (name.equals("individual")) {
775          this.individual = new Reference();
776          return this.individual;
777        }
778        else if (name.equals("assignedArm")) {
779          throw new FHIRException("Cannot call addChild on a singleton property ResearchSubject.assignedArm");
780        }
781        else if (name.equals("actualArm")) {
782          throw new FHIRException("Cannot call addChild on a singleton property ResearchSubject.actualArm");
783        }
784        else if (name.equals("consent")) {
785          this.consent = new Reference();
786          return this.consent;
787        }
788        else
789          return super.addChild(name);
790      }
791
792  public String fhirType() {
793    return "ResearchSubject";
794
795  }
796
797      public ResearchSubject copy() {
798        ResearchSubject dst = new ResearchSubject();
799        copyValues(dst);
800        dst.identifier = identifier == null ? null : identifier.copy();
801        dst.status = status == null ? null : status.copy();
802        dst.period = period == null ? null : period.copy();
803        dst.study = study == null ? null : study.copy();
804        dst.individual = individual == null ? null : individual.copy();
805        dst.assignedArm = assignedArm == null ? null : assignedArm.copy();
806        dst.actualArm = actualArm == null ? null : actualArm.copy();
807        dst.consent = consent == null ? null : consent.copy();
808        return dst;
809      }
810
811      protected ResearchSubject typedCopy() {
812        return copy();
813      }
814
815      @Override
816      public boolean equalsDeep(Base other_) {
817        if (!super.equalsDeep(other_))
818          return false;
819        if (!(other_ instanceof ResearchSubject))
820          return false;
821        ResearchSubject o = (ResearchSubject) other_;
822        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(period, o.period, true)
823           && compareDeep(study, o.study, true) && compareDeep(individual, o.individual, true) && compareDeep(assignedArm, o.assignedArm, true)
824           && compareDeep(actualArm, o.actualArm, true) && compareDeep(consent, o.consent, true);
825      }
826
827      @Override
828      public boolean equalsShallow(Base other_) {
829        if (!super.equalsShallow(other_))
830          return false;
831        if (!(other_ instanceof ResearchSubject))
832          return false;
833        ResearchSubject o = (ResearchSubject) other_;
834        return compareValues(status, o.status, true) && compareValues(assignedArm, o.assignedArm, true) && compareValues(actualArm, o.actualArm, true)
835          ;
836      }
837
838      public boolean isEmpty() {
839        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, period
840          , study, individual, assignedArm, actualArm, consent);
841      }
842
843  @Override
844  public ResourceType getResourceType() {
845    return ResourceType.ResearchSubject;
846   }
847
848 /**
849   * Search parameter: <b>date</b>
850   * <p>
851   * Description: <b>Start and end of participation</b><br>
852   * Type: <b>date</b><br>
853   * Path: <b>ResearchSubject.period</b><br>
854   * </p>
855   */
856  @SearchParamDefinition(name="date", path="ResearchSubject.period", description="Start and end of participation", type="date" )
857  public static final String SP_DATE = "date";
858 /**
859   * <b>Fluent Client</b> search parameter constant for <b>date</b>
860   * <p>
861   * Description: <b>Start and end of participation</b><br>
862   * Type: <b>date</b><br>
863   * Path: <b>ResearchSubject.period</b><br>
864   * </p>
865   */
866  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
867
868 /**
869   * Search parameter: <b>identifier</b>
870   * <p>
871   * Description: <b>Business Identifier for research subject</b><br>
872   * Type: <b>token</b><br>
873   * Path: <b>ResearchSubject.identifier</b><br>
874   * </p>
875   */
876  @SearchParamDefinition(name="identifier", path="ResearchSubject.identifier", description="Business Identifier for research subject", type="token" )
877  public static final String SP_IDENTIFIER = "identifier";
878 /**
879   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
880   * <p>
881   * Description: <b>Business Identifier for research subject</b><br>
882   * Type: <b>token</b><br>
883   * Path: <b>ResearchSubject.identifier</b><br>
884   * </p>
885   */
886  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
887
888 /**
889   * Search parameter: <b>individual</b>
890   * <p>
891   * Description: <b>Who is part of study</b><br>
892   * Type: <b>reference</b><br>
893   * Path: <b>ResearchSubject.individual</b><br>
894   * </p>
895   */
896  @SearchParamDefinition(name="individual", path="ResearchSubject.individual", description="Who is part of study", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
897  public static final String SP_INDIVIDUAL = "individual";
898 /**
899   * <b>Fluent Client</b> search parameter constant for <b>individual</b>
900   * <p>
901   * Description: <b>Who is part of study</b><br>
902   * Type: <b>reference</b><br>
903   * Path: <b>ResearchSubject.individual</b><br>
904   * </p>
905   */
906  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INDIVIDUAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INDIVIDUAL);
907
908/**
909   * Constant for fluent queries to be used to add include statements. Specifies
910   * the path value of "<b>ResearchSubject:individual</b>".
911   */
912  public static final ca.uhn.fhir.model.api.Include INCLUDE_INDIVIDUAL = new ca.uhn.fhir.model.api.Include("ResearchSubject:individual").toLocked();
913
914 /**
915   * Search parameter: <b>patient</b>
916   * <p>
917   * Description: <b>Who is part of study</b><br>
918   * Type: <b>reference</b><br>
919   * Path: <b>ResearchSubject.individual</b><br>
920   * </p>
921   */
922  @SearchParamDefinition(name="patient", path="ResearchSubject.individual", description="Who is part of study", type="reference", target={Patient.class } )
923  public static final String SP_PATIENT = "patient";
924 /**
925   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
926   * <p>
927   * Description: <b>Who is part of study</b><br>
928   * Type: <b>reference</b><br>
929   * Path: <b>ResearchSubject.individual</b><br>
930   * </p>
931   */
932  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
933
934/**
935   * Constant for fluent queries to be used to add include statements. Specifies
936   * the path value of "<b>ResearchSubject:patient</b>".
937   */
938  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ResearchSubject:patient").toLocked();
939
940 /**
941   * Search parameter: <b>status</b>
942   * <p>
943   * Description: <b>candidate | enrolled | active | suspended | withdrawn | completed</b><br>
944   * Type: <b>token</b><br>
945   * Path: <b>ResearchSubject.status</b><br>
946   * </p>
947   */
948  @SearchParamDefinition(name="status", path="ResearchSubject.status", description="candidate | enrolled | active | suspended | withdrawn | completed", type="token" )
949  public static final String SP_STATUS = "status";
950 /**
951   * <b>Fluent Client</b> search parameter constant for <b>status</b>
952   * <p>
953   * Description: <b>candidate | enrolled | active | suspended | withdrawn | completed</b><br>
954   * Type: <b>token</b><br>
955   * Path: <b>ResearchSubject.status</b><br>
956   * </p>
957   */
958  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
959
960
961}