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