001package org.hl7.fhir.r5.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.r5 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023/* 024 Copyright (c) 2011+, HL7, Inc. 025 All rights reserved. 026 027 Redistribution and use in source and binary forms, with or without modification, 028 are permitted provided that the following conditions are met: 029 030 * Redistributions of source code must retain the above copyright notice, this 031 list of conditions and the following disclaimer. 032 * Redistributions in binary form must reproduce the above copyright notice, 033 this list of conditions and the following disclaimer in the documentation 034 and/or other materials provided with the distribution. 035 * Neither the name of HL7 nor the names of its contributors may be used to 036 endorse or promote products derived from this software without specific 037 prior written permission. 038 039 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 040 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 041 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 042 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 043 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 044 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 045 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 046 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 047 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 048 POSSIBILITY OF SUCH DAMAGE. 049 050*/ 051 052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0 053import java.util.ArrayList; 054import java.util.Date; 055import java.util.List; 056import org.hl7.fhir.exceptions.FHIRException; 057import org.hl7.fhir.instance.model.api.ICompositeType; 058 059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 060import org.hl7.fhir.utilities.Utilities; 061import ca.uhn.fhir.model.api.annotation.ResourceDef; 062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 063import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 064import ca.uhn.fhir.model.api.annotation.Child; 065import ca.uhn.fhir.model.api.annotation.ChildOrder; 066import ca.uhn.fhir.model.api.annotation.Description; 067import ca.uhn.fhir.model.api.annotation.Block; 068/** 069 * A physical entity which is the primary unit of operational and/or administrative interest in a study. 070 */ 071@ResourceDef(name="ResearchSubject", profile="http://hl7.org/fhir/StructureDefinition/ResearchSubject") 072public class ResearchSubject extends DomainResource { 073 074 public enum ResearchSubjectStatus { 075 /** 076 * An identified person that can be considered for inclusion in a study. 077 */ 078 CANDIDATE, 079 /** 080 * A person that has met the eligibility criteria for inclusion in a study. 081 */ 082 ELIGIBLE, 083 /** 084 * A person is no longer receiving study intervention and/or being evaluated with tests and procedures according to the protocol, but they are being monitored on a protocol-prescribed schedule. 085 */ 086 FOLLOWUP, 087 /** 088 * A person who did not meet one or more criteria required for participation in a study is considered to have failed screening or 089is ineligible for the study. 090 */ 091 INELIGIBLE, 092 /** 093 * A person for whom registration was not completed. 094 */ 095 NOTREGISTERED, 096 /** 097 * A person that has ended their participation on a study either because their treatment/observation is complete or through not 098responding, withdrawal, non-compliance and/or adverse event. 099 */ 100 OFFSTUDY, 101 /** 102 * A person that is enrolled or registered on a study. 103 */ 104 ONSTUDY, 105 /** 106 * The person is receiving the treatment or participating in an activity (e.g. yoga, diet, etc.) that the study is evaluating. 107 */ 108 ONSTUDYINTERVENTION, 109 /** 110 * The subject is being evaluated via tests and assessments according to the study calendar, but is not receiving any intervention. Note that this state is study-dependent and might not exist in all studies. A synonym for this is "short-term follow-up". 111 */ 112 ONSTUDYOBSERVATION, 113 /** 114 * A person is pre-registered for a study. 115 */ 116 PENDINGONSTUDY, 117 /** 118 * A person that is potentially eligible for participation in the study. 119 */ 120 POTENTIALCANDIDATE, 121 /** 122 * A person who is being evaluated for eligibility for a study. 123 */ 124 SCREENING, 125 /** 126 * The person has withdrawn their participation in the study before registration. 127 */ 128 WITHDRAWN, 129 /** 130 * added to help the parsers with the generic types 131 */ 132 NULL; 133 public static ResearchSubjectStatus fromCode(String codeString) throws FHIRException { 134 if (codeString == null || "".equals(codeString)) 135 return null; 136 if ("candidate".equals(codeString)) 137 return CANDIDATE; 138 if ("eligible".equals(codeString)) 139 return ELIGIBLE; 140 if ("follow-up".equals(codeString)) 141 return FOLLOWUP; 142 if ("ineligible".equals(codeString)) 143 return INELIGIBLE; 144 if ("not-registered".equals(codeString)) 145 return NOTREGISTERED; 146 if ("off-study".equals(codeString)) 147 return OFFSTUDY; 148 if ("on-study".equals(codeString)) 149 return ONSTUDY; 150 if ("on-study-intervention".equals(codeString)) 151 return ONSTUDYINTERVENTION; 152 if ("on-study-observation".equals(codeString)) 153 return ONSTUDYOBSERVATION; 154 if ("pending-on-study".equals(codeString)) 155 return PENDINGONSTUDY; 156 if ("potential-candidate".equals(codeString)) 157 return POTENTIALCANDIDATE; 158 if ("screening".equals(codeString)) 159 return SCREENING; 160 if ("withdrawn".equals(codeString)) 161 return WITHDRAWN; 162 if (Configuration.isAcceptInvalidEnums()) 163 return null; 164 else 165 throw new FHIRException("Unknown ResearchSubjectStatus code '"+codeString+"'"); 166 } 167 public String toCode() { 168 switch (this) { 169 case CANDIDATE: return "candidate"; 170 case ELIGIBLE: return "eligible"; 171 case FOLLOWUP: return "follow-up"; 172 case INELIGIBLE: return "ineligible"; 173 case NOTREGISTERED: return "not-registered"; 174 case OFFSTUDY: return "off-study"; 175 case ONSTUDY: return "on-study"; 176 case ONSTUDYINTERVENTION: return "on-study-intervention"; 177 case ONSTUDYOBSERVATION: return "on-study-observation"; 178 case PENDINGONSTUDY: return "pending-on-study"; 179 case POTENTIALCANDIDATE: return "potential-candidate"; 180 case SCREENING: return "screening"; 181 case WITHDRAWN: return "withdrawn"; 182 default: return "?"; 183 } 184 } 185 public String getSystem() { 186 switch (this) { 187 case CANDIDATE: return "http://hl7.org/fhir/research-subject-status"; 188 case ELIGIBLE: return "http://hl7.org/fhir/research-subject-status"; 189 case FOLLOWUP: return "http://hl7.org/fhir/research-subject-status"; 190 case INELIGIBLE: return "http://hl7.org/fhir/research-subject-status"; 191 case NOTREGISTERED: return "http://hl7.org/fhir/research-subject-status"; 192 case OFFSTUDY: return "http://hl7.org/fhir/research-subject-status"; 193 case ONSTUDY: return "http://hl7.org/fhir/research-subject-status"; 194 case ONSTUDYINTERVENTION: return "http://hl7.org/fhir/research-subject-status"; 195 case ONSTUDYOBSERVATION: return "http://hl7.org/fhir/research-subject-status"; 196 case PENDINGONSTUDY: return "http://hl7.org/fhir/research-subject-status"; 197 case POTENTIALCANDIDATE: return "http://hl7.org/fhir/research-subject-status"; 198 case SCREENING: return "http://hl7.org/fhir/research-subject-status"; 199 case WITHDRAWN: return "http://hl7.org/fhir/research-subject-status"; 200 default: return "?"; 201 } 202 } 203 public String getDefinition() { 204 switch (this) { 205 case CANDIDATE: return "An identified person that can be considered for inclusion in a study."; 206 case ELIGIBLE: return "A person that has met the eligibility criteria for inclusion in a study."; 207 case FOLLOWUP: return "A person is no longer receiving study intervention and/or being evaluated with tests and procedures according to the protocol, but they are being monitored on a protocol-prescribed schedule."; 208 case INELIGIBLE: return "A person who did not meet one or more criteria required for participation in a study is considered to have failed screening or\nis ineligible for the study."; 209 case NOTREGISTERED: return "A person for whom registration was not completed."; 210 case OFFSTUDY: return "A person that has ended their participation on a study either because their treatment/observation is complete or through not\nresponding, withdrawal, non-compliance and/or adverse event."; 211 case ONSTUDY: return "A person that is enrolled or registered on a study."; 212 case ONSTUDYINTERVENTION: return "The person is receiving the treatment or participating in an activity (e.g. yoga, diet, etc.) that the study is evaluating."; 213 case ONSTUDYOBSERVATION: return "The subject is being evaluated via tests and assessments according to the study calendar, but is not receiving any intervention. Note that this state is study-dependent and might not exist in all studies. A synonym for this is \"short-term follow-up\"."; 214 case PENDINGONSTUDY: return "A person is pre-registered for a study."; 215 case POTENTIALCANDIDATE: return "A person that is potentially eligible for participation in the study."; 216 case SCREENING: return "A person who is being evaluated for eligibility for a study."; 217 case WITHDRAWN: return "The person has withdrawn their participation in the study before registration."; 218 default: return "?"; 219 } 220 } 221 public String getDisplay() { 222 switch (this) { 223 case CANDIDATE: return "Candidate"; 224 case ELIGIBLE: return "Eligible"; 225 case FOLLOWUP: return "Follow-up"; 226 case INELIGIBLE: return "Ineligible"; 227 case NOTREGISTERED: return "Not Registered"; 228 case OFFSTUDY: return "Off-study"; 229 case ONSTUDY: return "On-study"; 230 case ONSTUDYINTERVENTION: return "On-study-intervention"; 231 case ONSTUDYOBSERVATION: return "On-study-observation"; 232 case PENDINGONSTUDY: return "Pending on-study"; 233 case POTENTIALCANDIDATE: return "Potential Candidate"; 234 case SCREENING: return "Screening"; 235 case WITHDRAWN: return "Withdrawn"; 236 default: return "?"; 237 } 238 } 239 } 240 241 public static class ResearchSubjectStatusEnumFactory implements EnumFactory<ResearchSubjectStatus> { 242 public ResearchSubjectStatus fromCode(String codeString) throws IllegalArgumentException { 243 if (codeString == null || "".equals(codeString)) 244 if (codeString == null || "".equals(codeString)) 245 return null; 246 if ("candidate".equals(codeString)) 247 return ResearchSubjectStatus.CANDIDATE; 248 if ("eligible".equals(codeString)) 249 return ResearchSubjectStatus.ELIGIBLE; 250 if ("follow-up".equals(codeString)) 251 return ResearchSubjectStatus.FOLLOWUP; 252 if ("ineligible".equals(codeString)) 253 return ResearchSubjectStatus.INELIGIBLE; 254 if ("not-registered".equals(codeString)) 255 return ResearchSubjectStatus.NOTREGISTERED; 256 if ("off-study".equals(codeString)) 257 return ResearchSubjectStatus.OFFSTUDY; 258 if ("on-study".equals(codeString)) 259 return ResearchSubjectStatus.ONSTUDY; 260 if ("on-study-intervention".equals(codeString)) 261 return ResearchSubjectStatus.ONSTUDYINTERVENTION; 262 if ("on-study-observation".equals(codeString)) 263 return ResearchSubjectStatus.ONSTUDYOBSERVATION; 264 if ("pending-on-study".equals(codeString)) 265 return ResearchSubjectStatus.PENDINGONSTUDY; 266 if ("potential-candidate".equals(codeString)) 267 return ResearchSubjectStatus.POTENTIALCANDIDATE; 268 if ("screening".equals(codeString)) 269 return ResearchSubjectStatus.SCREENING; 270 if ("withdrawn".equals(codeString)) 271 return ResearchSubjectStatus.WITHDRAWN; 272 throw new IllegalArgumentException("Unknown ResearchSubjectStatus code '"+codeString+"'"); 273 } 274 public Enumeration<ResearchSubjectStatus> fromType(Base code) throws FHIRException { 275 if (code == null) 276 return null; 277 if (code.isEmpty()) 278 return new Enumeration<ResearchSubjectStatus>(this); 279 String codeString = ((PrimitiveType) code).asStringValue(); 280 if (codeString == null || "".equals(codeString)) 281 return null; 282 if ("candidate".equals(codeString)) 283 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.CANDIDATE); 284 if ("eligible".equals(codeString)) 285 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ELIGIBLE); 286 if ("follow-up".equals(codeString)) 287 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.FOLLOWUP); 288 if ("ineligible".equals(codeString)) 289 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.INELIGIBLE); 290 if ("not-registered".equals(codeString)) 291 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.NOTREGISTERED); 292 if ("off-study".equals(codeString)) 293 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.OFFSTUDY); 294 if ("on-study".equals(codeString)) 295 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ONSTUDY); 296 if ("on-study-intervention".equals(codeString)) 297 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ONSTUDYINTERVENTION); 298 if ("on-study-observation".equals(codeString)) 299 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.ONSTUDYOBSERVATION); 300 if ("pending-on-study".equals(codeString)) 301 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.PENDINGONSTUDY); 302 if ("potential-candidate".equals(codeString)) 303 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.POTENTIALCANDIDATE); 304 if ("screening".equals(codeString)) 305 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.SCREENING); 306 if ("withdrawn".equals(codeString)) 307 return new Enumeration<ResearchSubjectStatus>(this, ResearchSubjectStatus.WITHDRAWN); 308 throw new FHIRException("Unknown ResearchSubjectStatus code '"+codeString+"'"); 309 } 310 public String toCode(ResearchSubjectStatus code) { 311 if (code == ResearchSubjectStatus.CANDIDATE) 312 return "candidate"; 313 if (code == ResearchSubjectStatus.ELIGIBLE) 314 return "eligible"; 315 if (code == ResearchSubjectStatus.FOLLOWUP) 316 return "follow-up"; 317 if (code == ResearchSubjectStatus.INELIGIBLE) 318 return "ineligible"; 319 if (code == ResearchSubjectStatus.NOTREGISTERED) 320 return "not-registered"; 321 if (code == ResearchSubjectStatus.OFFSTUDY) 322 return "off-study"; 323 if (code == ResearchSubjectStatus.ONSTUDY) 324 return "on-study"; 325 if (code == ResearchSubjectStatus.ONSTUDYINTERVENTION) 326 return "on-study-intervention"; 327 if (code == ResearchSubjectStatus.ONSTUDYOBSERVATION) 328 return "on-study-observation"; 329 if (code == ResearchSubjectStatus.PENDINGONSTUDY) 330 return "pending-on-study"; 331 if (code == ResearchSubjectStatus.POTENTIALCANDIDATE) 332 return "potential-candidate"; 333 if (code == ResearchSubjectStatus.SCREENING) 334 return "screening"; 335 if (code == ResearchSubjectStatus.WITHDRAWN) 336 return "withdrawn"; 337 return "?"; 338 } 339 public String toSystem(ResearchSubjectStatus code) { 340 return code.getSystem(); 341 } 342 } 343 344 /** 345 * Identifiers assigned to this research subject for a study. 346 */ 347 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 348 @Description(shortDefinition="Business Identifier for research subject in a study", formalDefinition="Identifiers assigned to this research subject for a study." ) 349 protected List<Identifier> identifier; 350 351 /** 352 * The current state of the subject. 353 */ 354 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 355 @Description(shortDefinition="candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn", formalDefinition="The current state of the subject." ) 356 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/research-subject-status") 357 protected Enumeration<ResearchSubjectStatus> status; 358 359 /** 360 * The dates the subject began and ended their participation in the study. 361 */ 362 @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true) 363 @Description(shortDefinition="Start and end of participation", formalDefinition="The dates the subject began and ended their participation in the study." ) 364 protected Period period; 365 366 /** 367 * Reference to the study the subject is participating in. 368 */ 369 @Child(name = "study", type = {ResearchStudy.class}, order=3, min=1, max=1, modifier=false, summary=true) 370 @Description(shortDefinition="Study subject is part of", formalDefinition="Reference to the study the subject is participating in." ) 371 protected Reference study; 372 373 /** 374 * The record of the person or animal who is involved in the study. 375 */ 376 @Child(name = "individual", type = {Patient.class}, order=4, min=1, max=1, modifier=false, summary=true) 377 @Description(shortDefinition="Who is part of study", formalDefinition="The record of the person or animal who is involved in the study." ) 378 protected Reference individual; 379 380 /** 381 * The name of the arm in the study the subject is expected to follow as part of this study. 382 */ 383 @Child(name = "assignedArm", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false) 384 @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." ) 385 protected StringType assignedArm; 386 387 /** 388 * The name of the arm in the study the subject actually followed as part of this study. 389 */ 390 @Child(name = "actualArm", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false) 391 @Description(shortDefinition="What path was followed", formalDefinition="The name of the arm in the study the subject actually followed as part of this study." ) 392 protected StringType actualArm; 393 394 /** 395 * A record of the patient's informed agreement to participate in the study. 396 */ 397 @Child(name = "consent", type = {Consent.class}, order=7, min=0, max=1, modifier=false, summary=false) 398 @Description(shortDefinition="Agreement to participate in study", formalDefinition="A record of the patient's informed agreement to participate in the study." ) 399 protected Reference consent; 400 401 private static final long serialVersionUID = 2129823357L; 402 403 /** 404 * Constructor 405 */ 406 public ResearchSubject() { 407 super(); 408 } 409 410 /** 411 * Constructor 412 */ 413 public ResearchSubject(Enumeration<ResearchSubjectStatus> status, Reference study, Reference individual) { 414 super(); 415 this.status = status; 416 this.study = study; 417 this.individual = individual; 418 } 419 420 /** 421 * @return {@link #identifier} (Identifiers assigned to this research subject for a study.) 422 */ 423 public List<Identifier> getIdentifier() { 424 if (this.identifier == null) 425 this.identifier = new ArrayList<Identifier>(); 426 return this.identifier; 427 } 428 429 /** 430 * @return Returns a reference to <code>this</code> for easy method chaining 431 */ 432 public ResearchSubject setIdentifier(List<Identifier> theIdentifier) { 433 this.identifier = theIdentifier; 434 return this; 435 } 436 437 public boolean hasIdentifier() { 438 if (this.identifier == null) 439 return false; 440 for (Identifier item : this.identifier) 441 if (!item.isEmpty()) 442 return true; 443 return false; 444 } 445 446 public Identifier addIdentifier() { //3 447 Identifier t = new Identifier(); 448 if (this.identifier == null) 449 this.identifier = new ArrayList<Identifier>(); 450 this.identifier.add(t); 451 return t; 452 } 453 454 public ResearchSubject addIdentifier(Identifier t) { //3 455 if (t == null) 456 return this; 457 if (this.identifier == null) 458 this.identifier = new ArrayList<Identifier>(); 459 this.identifier.add(t); 460 return this; 461 } 462 463 /** 464 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 465 */ 466 public Identifier getIdentifierFirstRep() { 467 if (getIdentifier().isEmpty()) { 468 addIdentifier(); 469 } 470 return getIdentifier().get(0); 471 } 472 473 /** 474 * @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 475 */ 476 public Enumeration<ResearchSubjectStatus> getStatusElement() { 477 if (this.status == null) 478 if (Configuration.errorOnAutoCreate()) 479 throw new Error("Attempt to auto-create ResearchSubject.status"); 480 else if (Configuration.doAutoCreate()) 481 this.status = new Enumeration<ResearchSubjectStatus>(new ResearchSubjectStatusEnumFactory()); // bb 482 return this.status; 483 } 484 485 public boolean hasStatusElement() { 486 return this.status != null && !this.status.isEmpty(); 487 } 488 489 public boolean hasStatus() { 490 return this.status != null && !this.status.isEmpty(); 491 } 492 493 /** 494 * @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 495 */ 496 public ResearchSubject setStatusElement(Enumeration<ResearchSubjectStatus> value) { 497 this.status = value; 498 return this; 499 } 500 501 /** 502 * @return The current state of the subject. 503 */ 504 public ResearchSubjectStatus getStatus() { 505 return this.status == null ? null : this.status.getValue(); 506 } 507 508 /** 509 * @param value The current state of the subject. 510 */ 511 public ResearchSubject setStatus(ResearchSubjectStatus value) { 512 if (this.status == null) 513 this.status = new Enumeration<ResearchSubjectStatus>(new ResearchSubjectStatusEnumFactory()); 514 this.status.setValue(value); 515 return this; 516 } 517 518 /** 519 * @return {@link #period} (The dates the subject began and ended their participation in the study.) 520 */ 521 public Period getPeriod() { 522 if (this.period == null) 523 if (Configuration.errorOnAutoCreate()) 524 throw new Error("Attempt to auto-create ResearchSubject.period"); 525 else if (Configuration.doAutoCreate()) 526 this.period = new Period(); // cc 527 return this.period; 528 } 529 530 public boolean hasPeriod() { 531 return this.period != null && !this.period.isEmpty(); 532 } 533 534 /** 535 * @param value {@link #period} (The dates the subject began and ended their participation in the study.) 536 */ 537 public ResearchSubject setPeriod(Period value) { 538 this.period = value; 539 return this; 540 } 541 542 /** 543 * @return {@link #study} (Reference to the study the subject is participating in.) 544 */ 545 public Reference getStudy() { 546 if (this.study == null) 547 if (Configuration.errorOnAutoCreate()) 548 throw new Error("Attempt to auto-create ResearchSubject.study"); 549 else if (Configuration.doAutoCreate()) 550 this.study = new Reference(); // cc 551 return this.study; 552 } 553 554 public boolean hasStudy() { 555 return this.study != null && !this.study.isEmpty(); 556 } 557 558 /** 559 * @param value {@link #study} (Reference to the study the subject is participating in.) 560 */ 561 public ResearchSubject setStudy(Reference value) { 562 this.study = value; 563 return this; 564 } 565 566 /** 567 * @return {@link #individual} (The record of the person or animal who is involved in the study.) 568 */ 569 public Reference getIndividual() { 570 if (this.individual == null) 571 if (Configuration.errorOnAutoCreate()) 572 throw new Error("Attempt to auto-create ResearchSubject.individual"); 573 else if (Configuration.doAutoCreate()) 574 this.individual = new Reference(); // cc 575 return this.individual; 576 } 577 578 public boolean hasIndividual() { 579 return this.individual != null && !this.individual.isEmpty(); 580 } 581 582 /** 583 * @param value {@link #individual} (The record of the person or animal who is involved in the study.) 584 */ 585 public ResearchSubject setIndividual(Reference value) { 586 this.individual = value; 587 return this; 588 } 589 590 /** 591 * @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 592 */ 593 public StringType getAssignedArmElement() { 594 if (this.assignedArm == null) 595 if (Configuration.errorOnAutoCreate()) 596 throw new Error("Attempt to auto-create ResearchSubject.assignedArm"); 597 else if (Configuration.doAutoCreate()) 598 this.assignedArm = new StringType(); // bb 599 return this.assignedArm; 600 } 601 602 public boolean hasAssignedArmElement() { 603 return this.assignedArm != null && !this.assignedArm.isEmpty(); 604 } 605 606 public boolean hasAssignedArm() { 607 return this.assignedArm != null && !this.assignedArm.isEmpty(); 608 } 609 610 /** 611 * @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 612 */ 613 public ResearchSubject setAssignedArmElement(StringType value) { 614 this.assignedArm = value; 615 return this; 616 } 617 618 /** 619 * @return The name of the arm in the study the subject is expected to follow as part of this study. 620 */ 621 public String getAssignedArm() { 622 return this.assignedArm == null ? null : this.assignedArm.getValue(); 623 } 624 625 /** 626 * @param value The name of the arm in the study the subject is expected to follow as part of this study. 627 */ 628 public ResearchSubject setAssignedArm(String value) { 629 if (Utilities.noString(value)) 630 this.assignedArm = null; 631 else { 632 if (this.assignedArm == null) 633 this.assignedArm = new StringType(); 634 this.assignedArm.setValue(value); 635 } 636 return this; 637 } 638 639 /** 640 * @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 641 */ 642 public StringType getActualArmElement() { 643 if (this.actualArm == null) 644 if (Configuration.errorOnAutoCreate()) 645 throw new Error("Attempt to auto-create ResearchSubject.actualArm"); 646 else if (Configuration.doAutoCreate()) 647 this.actualArm = new StringType(); // bb 648 return this.actualArm; 649 } 650 651 public boolean hasActualArmElement() { 652 return this.actualArm != null && !this.actualArm.isEmpty(); 653 } 654 655 public boolean hasActualArm() { 656 return this.actualArm != null && !this.actualArm.isEmpty(); 657 } 658 659 /** 660 * @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 661 */ 662 public ResearchSubject setActualArmElement(StringType value) { 663 this.actualArm = value; 664 return this; 665 } 666 667 /** 668 * @return The name of the arm in the study the subject actually followed as part of this study. 669 */ 670 public String getActualArm() { 671 return this.actualArm == null ? null : this.actualArm.getValue(); 672 } 673 674 /** 675 * @param value The name of the arm in the study the subject actually followed as part of this study. 676 */ 677 public ResearchSubject setActualArm(String value) { 678 if (Utilities.noString(value)) 679 this.actualArm = null; 680 else { 681 if (this.actualArm == null) 682 this.actualArm = new StringType(); 683 this.actualArm.setValue(value); 684 } 685 return this; 686 } 687 688 /** 689 * @return {@link #consent} (A record of the patient's informed agreement to participate in the study.) 690 */ 691 public Reference getConsent() { 692 if (this.consent == null) 693 if (Configuration.errorOnAutoCreate()) 694 throw new Error("Attempt to auto-create ResearchSubject.consent"); 695 else if (Configuration.doAutoCreate()) 696 this.consent = new Reference(); // cc 697 return this.consent; 698 } 699 700 public boolean hasConsent() { 701 return this.consent != null && !this.consent.isEmpty(); 702 } 703 704 /** 705 * @param value {@link #consent} (A record of the patient's informed agreement to participate in the study.) 706 */ 707 public ResearchSubject setConsent(Reference value) { 708 this.consent = value; 709 return this; 710 } 711 712 protected void listChildren(List<Property> children) { 713 super.listChildren(children); 714 children.add(new Property("identifier", "Identifier", "Identifiers assigned to this research subject for a study.", 0, java.lang.Integer.MAX_VALUE, identifier)); 715 children.add(new Property("status", "code", "The current state of the subject.", 0, 1, status)); 716 children.add(new Property("period", "Period", "The dates the subject began and ended their participation in the study.", 0, 1, period)); 717 children.add(new Property("study", "Reference(ResearchStudy)", "Reference to the study the subject is participating in.", 0, 1, study)); 718 children.add(new Property("individual", "Reference(Patient)", "The record of the person or animal who is involved in the study.", 0, 1, individual)); 719 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)); 720 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)); 721 children.add(new Property("consent", "Reference(Consent)", "A record of the patient's informed agreement to participate in the study.", 0, 1, consent)); 722 } 723 724 @Override 725 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 726 switch (_hash) { 727 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifiers assigned to this research subject for a study.", 0, java.lang.Integer.MAX_VALUE, identifier); 728 case -892481550: /*status*/ return new Property("status", "code", "The current state of the subject.", 0, 1, status); 729 case -991726143: /*period*/ return new Property("period", "Period", "The dates the subject began and ended their participation in the study.", 0, 1, period); 730 case 109776329: /*study*/ return new Property("study", "Reference(ResearchStudy)", "Reference to the study the subject is participating in.", 0, 1, study); 731 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); 732 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); 733 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); 734 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); 735 default: return super.getNamedProperty(_hash, _name, _checkValid); 736 } 737 738 } 739 740 @Override 741 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 742 switch (hash) { 743 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 744 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ResearchSubjectStatus> 745 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 746 case 109776329: /*study*/ return this.study == null ? new Base[0] : new Base[] {this.study}; // Reference 747 case -46292327: /*individual*/ return this.individual == null ? new Base[0] : new Base[] {this.individual}; // Reference 748 case 1741912494: /*assignedArm*/ return this.assignedArm == null ? new Base[0] : new Base[] {this.assignedArm}; // StringType 749 case 528827886: /*actualArm*/ return this.actualArm == null ? new Base[0] : new Base[] {this.actualArm}; // StringType 750 case 951500826: /*consent*/ return this.consent == null ? new Base[0] : new Base[] {this.consent}; // Reference 751 default: return super.getProperty(hash, name, checkValid); 752 } 753 754 } 755 756 @Override 757 public Base setProperty(int hash, String name, Base value) throws FHIRException { 758 switch (hash) { 759 case -1618432855: // identifier 760 this.getIdentifier().add(castToIdentifier(value)); // Identifier 761 return value; 762 case -892481550: // status 763 value = new ResearchSubjectStatusEnumFactory().fromType(castToCode(value)); 764 this.status = (Enumeration) value; // Enumeration<ResearchSubjectStatus> 765 return value; 766 case -991726143: // period 767 this.period = castToPeriod(value); // Period 768 return value; 769 case 109776329: // study 770 this.study = castToReference(value); // Reference 771 return value; 772 case -46292327: // individual 773 this.individual = castToReference(value); // Reference 774 return value; 775 case 1741912494: // assignedArm 776 this.assignedArm = castToString(value); // StringType 777 return value; 778 case 528827886: // actualArm 779 this.actualArm = castToString(value); // StringType 780 return value; 781 case 951500826: // consent 782 this.consent = castToReference(value); // Reference 783 return value; 784 default: return super.setProperty(hash, name, value); 785 } 786 787 } 788 789 @Override 790 public Base setProperty(String name, Base value) throws FHIRException { 791 if (name.equals("identifier")) { 792 this.getIdentifier().add(castToIdentifier(value)); 793 } else if (name.equals("status")) { 794 value = new ResearchSubjectStatusEnumFactory().fromType(castToCode(value)); 795 this.status = (Enumeration) value; // Enumeration<ResearchSubjectStatus> 796 } else if (name.equals("period")) { 797 this.period = castToPeriod(value); // Period 798 } else if (name.equals("study")) { 799 this.study = castToReference(value); // Reference 800 } else if (name.equals("individual")) { 801 this.individual = castToReference(value); // Reference 802 } else if (name.equals("assignedArm")) { 803 this.assignedArm = castToString(value); // StringType 804 } else if (name.equals("actualArm")) { 805 this.actualArm = castToString(value); // StringType 806 } else if (name.equals("consent")) { 807 this.consent = castToReference(value); // Reference 808 } else 809 return super.setProperty(name, value); 810 return value; 811 } 812 813 @Override 814 public Base makeProperty(int hash, String name) throws FHIRException { 815 switch (hash) { 816 case -1618432855: return addIdentifier(); 817 case -892481550: return getStatusElement(); 818 case -991726143: return getPeriod(); 819 case 109776329: return getStudy(); 820 case -46292327: return getIndividual(); 821 case 1741912494: return getAssignedArmElement(); 822 case 528827886: return getActualArmElement(); 823 case 951500826: return getConsent(); 824 default: return super.makeProperty(hash, name); 825 } 826 827 } 828 829 @Override 830 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 831 switch (hash) { 832 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 833 case -892481550: /*status*/ return new String[] {"code"}; 834 case -991726143: /*period*/ return new String[] {"Period"}; 835 case 109776329: /*study*/ return new String[] {"Reference"}; 836 case -46292327: /*individual*/ return new String[] {"Reference"}; 837 case 1741912494: /*assignedArm*/ return new String[] {"string"}; 838 case 528827886: /*actualArm*/ return new String[] {"string"}; 839 case 951500826: /*consent*/ return new String[] {"Reference"}; 840 default: return super.getTypesForProperty(hash, name); 841 } 842 843 } 844 845 @Override 846 public Base addChild(String name) throws FHIRException { 847 if (name.equals("identifier")) { 848 return addIdentifier(); 849 } 850 else if (name.equals("status")) { 851 throw new FHIRException("Cannot call addChild on a primitive type ResearchSubject.status"); 852 } 853 else if (name.equals("period")) { 854 this.period = new Period(); 855 return this.period; 856 } 857 else if (name.equals("study")) { 858 this.study = new Reference(); 859 return this.study; 860 } 861 else if (name.equals("individual")) { 862 this.individual = new Reference(); 863 return this.individual; 864 } 865 else if (name.equals("assignedArm")) { 866 throw new FHIRException("Cannot call addChild on a primitive type ResearchSubject.assignedArm"); 867 } 868 else if (name.equals("actualArm")) { 869 throw new FHIRException("Cannot call addChild on a primitive type ResearchSubject.actualArm"); 870 } 871 else if (name.equals("consent")) { 872 this.consent = new Reference(); 873 return this.consent; 874 } 875 else 876 return super.addChild(name); 877 } 878 879 public String fhirType() { 880 return "ResearchSubject"; 881 882 } 883 884 public ResearchSubject copy() { 885 ResearchSubject dst = new ResearchSubject(); 886 copyValues(dst); 887 return dst; 888 } 889 890 public void copyValues(ResearchSubject dst) { 891 super.copyValues(dst); 892 if (identifier != null) { 893 dst.identifier = new ArrayList<Identifier>(); 894 for (Identifier i : identifier) 895 dst.identifier.add(i.copy()); 896 }; 897 dst.status = status == null ? null : status.copy(); 898 dst.period = period == null ? null : period.copy(); 899 dst.study = study == null ? null : study.copy(); 900 dst.individual = individual == null ? null : individual.copy(); 901 dst.assignedArm = assignedArm == null ? null : assignedArm.copy(); 902 dst.actualArm = actualArm == null ? null : actualArm.copy(); 903 dst.consent = consent == null ? null : consent.copy(); 904 } 905 906 protected ResearchSubject typedCopy() { 907 return copy(); 908 } 909 910 @Override 911 public boolean equalsDeep(Base other_) { 912 if (!super.equalsDeep(other_)) 913 return false; 914 if (!(other_ instanceof ResearchSubject)) 915 return false; 916 ResearchSubject o = (ResearchSubject) other_; 917 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(period, o.period, true) 918 && compareDeep(study, o.study, true) && compareDeep(individual, o.individual, true) && compareDeep(assignedArm, o.assignedArm, true) 919 && compareDeep(actualArm, o.actualArm, true) && compareDeep(consent, o.consent, true); 920 } 921 922 @Override 923 public boolean equalsShallow(Base other_) { 924 if (!super.equalsShallow(other_)) 925 return false; 926 if (!(other_ instanceof ResearchSubject)) 927 return false; 928 ResearchSubject o = (ResearchSubject) other_; 929 return compareValues(status, o.status, true) && compareValues(assignedArm, o.assignedArm, true) && compareValues(actualArm, o.actualArm, true) 930 ; 931 } 932 933 public boolean isEmpty() { 934 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, period 935 , study, individual, assignedArm, actualArm, consent); 936 } 937 938 @Override 939 public ResourceType getResourceType() { 940 return ResourceType.ResearchSubject; 941 } 942 943 /** 944 * Search parameter: <b>date</b> 945 * <p> 946 * Description: <b>Start and end of participation</b><br> 947 * Type: <b>date</b><br> 948 * Path: <b>ResearchSubject.period</b><br> 949 * </p> 950 */ 951 @SearchParamDefinition(name="date", path="ResearchSubject.period", description="Start and end of participation", type="date" ) 952 public static final String SP_DATE = "date"; 953 /** 954 * <b>Fluent Client</b> search parameter constant for <b>date</b> 955 * <p> 956 * Description: <b>Start and end of participation</b><br> 957 * Type: <b>date</b><br> 958 * Path: <b>ResearchSubject.period</b><br> 959 * </p> 960 */ 961 public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE); 962 963 /** 964 * Search parameter: <b>identifier</b> 965 * <p> 966 * Description: <b>Business Identifier for research subject in a study</b><br> 967 * Type: <b>token</b><br> 968 * Path: <b>ResearchSubject.identifier</b><br> 969 * </p> 970 */ 971 @SearchParamDefinition(name="identifier", path="ResearchSubject.identifier", description="Business Identifier for research subject in a study", type="token" ) 972 public static final String SP_IDENTIFIER = "identifier"; 973 /** 974 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 975 * <p> 976 * Description: <b>Business Identifier for research subject in a study</b><br> 977 * Type: <b>token</b><br> 978 * Path: <b>ResearchSubject.identifier</b><br> 979 * </p> 980 */ 981 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 982 983 /** 984 * Search parameter: <b>study</b> 985 * <p> 986 * Description: <b>Study subject is part of</b><br> 987 * Type: <b>reference</b><br> 988 * Path: <b>ResearchSubject.study</b><br> 989 * </p> 990 */ 991 @SearchParamDefinition(name="study", path="ResearchSubject.study", description="Study subject is part of", type="reference", target={ResearchStudy.class } ) 992 public static final String SP_STUDY = "study"; 993 /** 994 * <b>Fluent Client</b> search parameter constant for <b>study</b> 995 * <p> 996 * Description: <b>Study subject is part of</b><br> 997 * Type: <b>reference</b><br> 998 * Path: <b>ResearchSubject.study</b><br> 999 * </p> 1000 */ 1001 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam STUDY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_STUDY); 1002 1003/** 1004 * Constant for fluent queries to be used to add include statements. Specifies 1005 * the path value of "<b>ResearchSubject:study</b>". 1006 */ 1007 public static final ca.uhn.fhir.model.api.Include INCLUDE_STUDY = new ca.uhn.fhir.model.api.Include("ResearchSubject:study").toLocked(); 1008 1009 /** 1010 * Search parameter: <b>individual</b> 1011 * <p> 1012 * Description: <b>Who is part of study</b><br> 1013 * Type: <b>reference</b><br> 1014 * Path: <b>ResearchSubject.individual</b><br> 1015 * </p> 1016 */ 1017 @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 } ) 1018 public static final String SP_INDIVIDUAL = "individual"; 1019 /** 1020 * <b>Fluent Client</b> search parameter constant for <b>individual</b> 1021 * <p> 1022 * Description: <b>Who is part of study</b><br> 1023 * Type: <b>reference</b><br> 1024 * Path: <b>ResearchSubject.individual</b><br> 1025 * </p> 1026 */ 1027 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INDIVIDUAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INDIVIDUAL); 1028 1029/** 1030 * Constant for fluent queries to be used to add include statements. Specifies 1031 * the path value of "<b>ResearchSubject:individual</b>". 1032 */ 1033 public static final ca.uhn.fhir.model.api.Include INCLUDE_INDIVIDUAL = new ca.uhn.fhir.model.api.Include("ResearchSubject:individual").toLocked(); 1034 1035 /** 1036 * Search parameter: <b>patient</b> 1037 * <p> 1038 * Description: <b>Who is part of study</b><br> 1039 * Type: <b>reference</b><br> 1040 * Path: <b>ResearchSubject.individual</b><br> 1041 * </p> 1042 */ 1043 @SearchParamDefinition(name="patient", path="ResearchSubject.individual", description="Who is part of study", type="reference", target={Patient.class } ) 1044 public static final String SP_PATIENT = "patient"; 1045 /** 1046 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1047 * <p> 1048 * Description: <b>Who is part of study</b><br> 1049 * Type: <b>reference</b><br> 1050 * Path: <b>ResearchSubject.individual</b><br> 1051 * </p> 1052 */ 1053 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1054 1055/** 1056 * Constant for fluent queries to be used to add include statements. Specifies 1057 * the path value of "<b>ResearchSubject:patient</b>". 1058 */ 1059 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ResearchSubject:patient").toLocked(); 1060 1061 /** 1062 * Search parameter: <b>status</b> 1063 * <p> 1064 * Description: <b>candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn</b><br> 1065 * Type: <b>token</b><br> 1066 * Path: <b>ResearchSubject.status</b><br> 1067 * </p> 1068 */ 1069 @SearchParamDefinition(name="status", path="ResearchSubject.status", description="candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn", type="token" ) 1070 public static final String SP_STATUS = "status"; 1071 /** 1072 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1073 * <p> 1074 * Description: <b>candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn</b><br> 1075 * Type: <b>token</b><br> 1076 * Path: <b>ResearchSubject.status</b><br> 1077 * </p> 1078 */ 1079 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1080 1081 1082} 1083