001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * A sample to be used for analysis. 047 */ 048@ResourceDef(name="Specimen", profile="http://hl7.org/fhir/Profile/Specimen") 049public class Specimen extends DomainResource { 050 051 public enum SpecimenStatus { 052 /** 053 * The physical specimen is present and in good condition. 054 */ 055 AVAILABLE, 056 /** 057 * There is no physical specimen because it is either lost, destroyed or consumed. 058 */ 059 UNAVAILABLE, 060 /** 061 * The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old. 062 */ 063 UNSATISFACTORY, 064 /** 065 * The specimen was entered in error and therefore nullified. 066 */ 067 ENTEREDINERROR, 068 /** 069 * added to help the parsers with the generic types 070 */ 071 NULL; 072 public static SpecimenStatus fromCode(String codeString) throws FHIRException { 073 if (codeString == null || "".equals(codeString)) 074 return null; 075 if ("available".equals(codeString)) 076 return AVAILABLE; 077 if ("unavailable".equals(codeString)) 078 return UNAVAILABLE; 079 if ("unsatisfactory".equals(codeString)) 080 return UNSATISFACTORY; 081 if ("entered-in-error".equals(codeString)) 082 return ENTEREDINERROR; 083 if (Configuration.isAcceptInvalidEnums()) 084 return null; 085 else 086 throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'"); 087 } 088 public String toCode() { 089 switch (this) { 090 case AVAILABLE: return "available"; 091 case UNAVAILABLE: return "unavailable"; 092 case UNSATISFACTORY: return "unsatisfactory"; 093 case ENTEREDINERROR: return "entered-in-error"; 094 default: return "?"; 095 } 096 } 097 public String getSystem() { 098 switch (this) { 099 case AVAILABLE: return "http://hl7.org/fhir/specimen-status"; 100 case UNAVAILABLE: return "http://hl7.org/fhir/specimen-status"; 101 case UNSATISFACTORY: return "http://hl7.org/fhir/specimen-status"; 102 case ENTEREDINERROR: return "http://hl7.org/fhir/specimen-status"; 103 default: return "?"; 104 } 105 } 106 public String getDefinition() { 107 switch (this) { 108 case AVAILABLE: return "The physical specimen is present and in good condition."; 109 case UNAVAILABLE: return "There is no physical specimen because it is either lost, destroyed or consumed."; 110 case UNSATISFACTORY: return "The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old."; 111 case ENTEREDINERROR: return "The specimen was entered in error and therefore nullified."; 112 default: return "?"; 113 } 114 } 115 public String getDisplay() { 116 switch (this) { 117 case AVAILABLE: return "Available"; 118 case UNAVAILABLE: return "Unavailable"; 119 case UNSATISFACTORY: return "Unsatisfactory"; 120 case ENTEREDINERROR: return "Entered in Error"; 121 default: return "?"; 122 } 123 } 124 } 125 126 public static class SpecimenStatusEnumFactory implements EnumFactory<SpecimenStatus> { 127 public SpecimenStatus fromCode(String codeString) throws IllegalArgumentException { 128 if (codeString == null || "".equals(codeString)) 129 if (codeString == null || "".equals(codeString)) 130 return null; 131 if ("available".equals(codeString)) 132 return SpecimenStatus.AVAILABLE; 133 if ("unavailable".equals(codeString)) 134 return SpecimenStatus.UNAVAILABLE; 135 if ("unsatisfactory".equals(codeString)) 136 return SpecimenStatus.UNSATISFACTORY; 137 if ("entered-in-error".equals(codeString)) 138 return SpecimenStatus.ENTEREDINERROR; 139 throw new IllegalArgumentException("Unknown SpecimenStatus code '"+codeString+"'"); 140 } 141 public Enumeration<SpecimenStatus> fromType(Base code) throws FHIRException { 142 if (code == null) 143 return null; 144 if (code.isEmpty()) 145 return new Enumeration<SpecimenStatus>(this); 146 String codeString = ((PrimitiveType) code).asStringValue(); 147 if (codeString == null || "".equals(codeString)) 148 return null; 149 if ("available".equals(codeString)) 150 return new Enumeration<SpecimenStatus>(this, SpecimenStatus.AVAILABLE); 151 if ("unavailable".equals(codeString)) 152 return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNAVAILABLE); 153 if ("unsatisfactory".equals(codeString)) 154 return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNSATISFACTORY); 155 if ("entered-in-error".equals(codeString)) 156 return new Enumeration<SpecimenStatus>(this, SpecimenStatus.ENTEREDINERROR); 157 throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'"); 158 } 159 public String toCode(SpecimenStatus code) { 160 if (code == SpecimenStatus.AVAILABLE) 161 return "available"; 162 if (code == SpecimenStatus.UNAVAILABLE) 163 return "unavailable"; 164 if (code == SpecimenStatus.UNSATISFACTORY) 165 return "unsatisfactory"; 166 if (code == SpecimenStatus.ENTEREDINERROR) 167 return "entered-in-error"; 168 return "?"; 169 } 170 public String toSystem(SpecimenStatus code) { 171 return code.getSystem(); 172 } 173 } 174 175 @Block() 176 public static class SpecimenCollectionComponent extends BackboneElement implements IBaseBackboneElement { 177 /** 178 * Person who collected the specimen. 179 */ 180 @Child(name = "collector", type = {Practitioner.class}, order=1, min=0, max=1, modifier=false, summary=true) 181 @Description(shortDefinition="Who collected the specimen", formalDefinition="Person who collected the specimen." ) 182 protected Reference collector; 183 184 /** 185 * The actual object that is the target of the reference (Person who collected the specimen.) 186 */ 187 protected Practitioner collectorTarget; 188 189 /** 190 * Time when specimen was collected from subject - the physiologically relevant time. 191 */ 192 @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=true) 193 @Description(shortDefinition="Collection time", formalDefinition="Time when specimen was collected from subject - the physiologically relevant time." ) 194 protected Type collected; 195 196 /** 197 * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample. 198 */ 199 @Child(name = "quantity", type = {SimpleQuantity.class}, order=3, min=0, max=1, modifier=false, summary=false) 200 @Description(shortDefinition="The quantity of specimen collected", formalDefinition="The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample." ) 201 protected SimpleQuantity quantity; 202 203 /** 204 * A coded value specifying the technique that is used to perform the procedure. 205 */ 206 @Child(name = "method", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false) 207 @Description(shortDefinition="Technique used to perform collection", formalDefinition="A coded value specifying the technique that is used to perform the procedure." ) 208 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-collection-method") 209 protected CodeableConcept method; 210 211 /** 212 * Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens. 213 */ 214 @Child(name = "bodySite", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false) 215 @Description(shortDefinition="Anatomical collection site", formalDefinition="Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens." ) 216 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site") 217 protected CodeableConcept bodySite; 218 219 private static final long serialVersionUID = -1324142853L; 220 221 /** 222 * Constructor 223 */ 224 public SpecimenCollectionComponent() { 225 super(); 226 } 227 228 /** 229 * @return {@link #collector} (Person who collected the specimen.) 230 */ 231 public Reference getCollector() { 232 if (this.collector == null) 233 if (Configuration.errorOnAutoCreate()) 234 throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector"); 235 else if (Configuration.doAutoCreate()) 236 this.collector = new Reference(); // cc 237 return this.collector; 238 } 239 240 public boolean hasCollector() { 241 return this.collector != null && !this.collector.isEmpty(); 242 } 243 244 /** 245 * @param value {@link #collector} (Person who collected the specimen.) 246 */ 247 public SpecimenCollectionComponent setCollector(Reference value) { 248 this.collector = value; 249 return this; 250 } 251 252 /** 253 * @return {@link #collector} 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. (Person who collected the specimen.) 254 */ 255 public Practitioner getCollectorTarget() { 256 if (this.collectorTarget == null) 257 if (Configuration.errorOnAutoCreate()) 258 throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector"); 259 else if (Configuration.doAutoCreate()) 260 this.collectorTarget = new Practitioner(); // aa 261 return this.collectorTarget; 262 } 263 264 /** 265 * @param value {@link #collector} 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. (Person who collected the specimen.) 266 */ 267 public SpecimenCollectionComponent setCollectorTarget(Practitioner value) { 268 this.collectorTarget = value; 269 return this; 270 } 271 272 /** 273 * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.) 274 */ 275 public Type getCollected() { 276 return this.collected; 277 } 278 279 /** 280 * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.) 281 */ 282 public DateTimeType getCollectedDateTimeType() throws FHIRException { 283 if (this.collected == null) 284 return null; 285 if (!(this.collected instanceof DateTimeType)) 286 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered"); 287 return (DateTimeType) this.collected; 288 } 289 290 public boolean hasCollectedDateTimeType() { 291 return this != null && this.collected instanceof DateTimeType; 292 } 293 294 /** 295 * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.) 296 */ 297 public Period getCollectedPeriod() throws FHIRException { 298 if (this.collected == null) 299 return null; 300 if (!(this.collected instanceof Period)) 301 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered"); 302 return (Period) this.collected; 303 } 304 305 public boolean hasCollectedPeriod() { 306 return this != null && this.collected instanceof Period; 307 } 308 309 public boolean hasCollected() { 310 return this.collected != null && !this.collected.isEmpty(); 311 } 312 313 /** 314 * @param value {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.) 315 */ 316 public SpecimenCollectionComponent setCollected(Type value) { 317 if (value != null && !(value instanceof DateTimeType || value instanceof Period)) 318 throw new Error("Not the right type for Specimen.collection.collected[x]: "+value.fhirType()); 319 this.collected = value; 320 return this; 321 } 322 323 /** 324 * @return {@link #quantity} (The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.) 325 */ 326 public SimpleQuantity getQuantity() { 327 if (this.quantity == null) 328 if (Configuration.errorOnAutoCreate()) 329 throw new Error("Attempt to auto-create SpecimenCollectionComponent.quantity"); 330 else if (Configuration.doAutoCreate()) 331 this.quantity = new SimpleQuantity(); // cc 332 return this.quantity; 333 } 334 335 public boolean hasQuantity() { 336 return this.quantity != null && !this.quantity.isEmpty(); 337 } 338 339 /** 340 * @param value {@link #quantity} (The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.) 341 */ 342 public SpecimenCollectionComponent setQuantity(SimpleQuantity value) { 343 this.quantity = value; 344 return this; 345 } 346 347 /** 348 * @return {@link #method} (A coded value specifying the technique that is used to perform the procedure.) 349 */ 350 public CodeableConcept getMethod() { 351 if (this.method == null) 352 if (Configuration.errorOnAutoCreate()) 353 throw new Error("Attempt to auto-create SpecimenCollectionComponent.method"); 354 else if (Configuration.doAutoCreate()) 355 this.method = new CodeableConcept(); // cc 356 return this.method; 357 } 358 359 public boolean hasMethod() { 360 return this.method != null && !this.method.isEmpty(); 361 } 362 363 /** 364 * @param value {@link #method} (A coded value specifying the technique that is used to perform the procedure.) 365 */ 366 public SpecimenCollectionComponent setMethod(CodeableConcept value) { 367 this.method = value; 368 return this; 369 } 370 371 /** 372 * @return {@link #bodySite} (Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens.) 373 */ 374 public CodeableConcept getBodySite() { 375 if (this.bodySite == null) 376 if (Configuration.errorOnAutoCreate()) 377 throw new Error("Attempt to auto-create SpecimenCollectionComponent.bodySite"); 378 else if (Configuration.doAutoCreate()) 379 this.bodySite = new CodeableConcept(); // cc 380 return this.bodySite; 381 } 382 383 public boolean hasBodySite() { 384 return this.bodySite != null && !this.bodySite.isEmpty(); 385 } 386 387 /** 388 * @param value {@link #bodySite} (Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens.) 389 */ 390 public SpecimenCollectionComponent setBodySite(CodeableConcept value) { 391 this.bodySite = value; 392 return this; 393 } 394 395 protected void listChildren(List<Property> children) { 396 super.listChildren(children); 397 children.add(new Property("collector", "Reference(Practitioner)", "Person who collected the specimen.", 0, 1, collector)); 398 children.add(new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected)); 399 children.add(new Property("quantity", "SimpleQuantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, 1, quantity)); 400 children.add(new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, method)); 401 children.add(new Property("bodySite", "CodeableConcept", "Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens.", 0, 1, bodySite)); 402 } 403 404 @Override 405 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 406 switch (_hash) { 407 case 1883491469: /*collector*/ return new Property("collector", "Reference(Practitioner)", "Person who collected the specimen.", 0, 1, collector); 408 case 1632037015: /*collected[x]*/ return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected); 409 case 1883491145: /*collected*/ return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected); 410 case 2005009924: /*collectedDateTime*/ return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected); 411 case 653185642: /*collectedPeriod*/ return new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, 1, collected); 412 case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, 1, quantity); 413 case -1077554975: /*method*/ return new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, 1, method); 414 case 1702620169: /*bodySite*/ return new Property("bodySite", "CodeableConcept", "Anatomical location from which the specimen was collected (if subject is a patient). This is the target site. This element is not used for environmental specimens.", 0, 1, bodySite); 415 default: return super.getNamedProperty(_hash, _name, _checkValid); 416 } 417 418 } 419 420 @Override 421 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 422 switch (hash) { 423 case 1883491469: /*collector*/ return this.collector == null ? new Base[0] : new Base[] {this.collector}; // Reference 424 case 1883491145: /*collected*/ return this.collected == null ? new Base[0] : new Base[] {this.collected}; // Type 425 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 426 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept 427 case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept 428 default: return super.getProperty(hash, name, checkValid); 429 } 430 431 } 432 433 @Override 434 public Base setProperty(int hash, String name, Base value) throws FHIRException { 435 switch (hash) { 436 case 1883491469: // collector 437 this.collector = castToReference(value); // Reference 438 return value; 439 case 1883491145: // collected 440 this.collected = castToType(value); // Type 441 return value; 442 case -1285004149: // quantity 443 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 444 return value; 445 case -1077554975: // method 446 this.method = castToCodeableConcept(value); // CodeableConcept 447 return value; 448 case 1702620169: // bodySite 449 this.bodySite = castToCodeableConcept(value); // CodeableConcept 450 return value; 451 default: return super.setProperty(hash, name, value); 452 } 453 454 } 455 456 @Override 457 public Base setProperty(String name, Base value) throws FHIRException { 458 if (name.equals("collector")) { 459 this.collector = castToReference(value); // Reference 460 } else if (name.equals("collected[x]")) { 461 this.collected = castToType(value); // Type 462 } else if (name.equals("quantity")) { 463 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 464 } else if (name.equals("method")) { 465 this.method = castToCodeableConcept(value); // CodeableConcept 466 } else if (name.equals("bodySite")) { 467 this.bodySite = castToCodeableConcept(value); // CodeableConcept 468 } else 469 return super.setProperty(name, value); 470 return value; 471 } 472 473 @Override 474 public Base makeProperty(int hash, String name) throws FHIRException { 475 switch (hash) { 476 case 1883491469: return getCollector(); 477 case 1632037015: return getCollected(); 478 case 1883491145: return getCollected(); 479 case -1285004149: return getQuantity(); 480 case -1077554975: return getMethod(); 481 case 1702620169: return getBodySite(); 482 default: return super.makeProperty(hash, name); 483 } 484 485 } 486 487 @Override 488 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 489 switch (hash) { 490 case 1883491469: /*collector*/ return new String[] {"Reference"}; 491 case 1883491145: /*collected*/ return new String[] {"dateTime", "Period"}; 492 case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; 493 case -1077554975: /*method*/ return new String[] {"CodeableConcept"}; 494 case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"}; 495 default: return super.getTypesForProperty(hash, name); 496 } 497 498 } 499 500 @Override 501 public Base addChild(String name) throws FHIRException { 502 if (name.equals("collector")) { 503 this.collector = new Reference(); 504 return this.collector; 505 } 506 else if (name.equals("collectedDateTime")) { 507 this.collected = new DateTimeType(); 508 return this.collected; 509 } 510 else if (name.equals("collectedPeriod")) { 511 this.collected = new Period(); 512 return this.collected; 513 } 514 else if (name.equals("quantity")) { 515 this.quantity = new SimpleQuantity(); 516 return this.quantity; 517 } 518 else if (name.equals("method")) { 519 this.method = new CodeableConcept(); 520 return this.method; 521 } 522 else if (name.equals("bodySite")) { 523 this.bodySite = new CodeableConcept(); 524 return this.bodySite; 525 } 526 else 527 return super.addChild(name); 528 } 529 530 public SpecimenCollectionComponent copy() { 531 SpecimenCollectionComponent dst = new SpecimenCollectionComponent(); 532 copyValues(dst); 533 dst.collector = collector == null ? null : collector.copy(); 534 dst.collected = collected == null ? null : collected.copy(); 535 dst.quantity = quantity == null ? null : quantity.copy(); 536 dst.method = method == null ? null : method.copy(); 537 dst.bodySite = bodySite == null ? null : bodySite.copy(); 538 return dst; 539 } 540 541 @Override 542 public boolean equalsDeep(Base other_) { 543 if (!super.equalsDeep(other_)) 544 return false; 545 if (!(other_ instanceof SpecimenCollectionComponent)) 546 return false; 547 SpecimenCollectionComponent o = (SpecimenCollectionComponent) other_; 548 return compareDeep(collector, o.collector, true) && compareDeep(collected, o.collected, true) && compareDeep(quantity, o.quantity, true) 549 && compareDeep(method, o.method, true) && compareDeep(bodySite, o.bodySite, true); 550 } 551 552 @Override 553 public boolean equalsShallow(Base other_) { 554 if (!super.equalsShallow(other_)) 555 return false; 556 if (!(other_ instanceof SpecimenCollectionComponent)) 557 return false; 558 SpecimenCollectionComponent o = (SpecimenCollectionComponent) other_; 559 return true; 560 } 561 562 public boolean isEmpty() { 563 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(collector, collected, quantity 564 , method, bodySite); 565 } 566 567 public String fhirType() { 568 return "Specimen.collection"; 569 570 } 571 572 } 573 574 @Block() 575 public static class SpecimenProcessingComponent extends BackboneElement implements IBaseBackboneElement { 576 /** 577 * Textual description of procedure. 578 */ 579 @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false) 580 @Description(shortDefinition="Textual description of procedure", formalDefinition="Textual description of procedure." ) 581 protected StringType description; 582 583 /** 584 * A coded value specifying the procedure used to process the specimen. 585 */ 586 @Child(name = "procedure", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) 587 @Description(shortDefinition="Indicates the treatment step applied to the specimen", formalDefinition="A coded value specifying the procedure used to process the specimen." ) 588 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-processing-procedure") 589 protected CodeableConcept procedure; 590 591 /** 592 * Material used in the processing step. 593 */ 594 @Child(name = "additive", type = {Substance.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 595 @Description(shortDefinition="Material used in the processing step", formalDefinition="Material used in the processing step." ) 596 protected List<Reference> additive; 597 /** 598 * The actual objects that are the target of the reference (Material used in the processing step.) 599 */ 600 protected List<Substance> additiveTarget; 601 602 603 /** 604 * A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin. 605 */ 606 @Child(name = "time", type = {DateTimeType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false) 607 @Description(shortDefinition="Date and time of specimen processing", formalDefinition="A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin." ) 608 protected Type time; 609 610 private static final long serialVersionUID = 1467214742L; 611 612 /** 613 * Constructor 614 */ 615 public SpecimenProcessingComponent() { 616 super(); 617 } 618 619 /** 620 * @return {@link #description} (Textual description of procedure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 621 */ 622 public StringType getDescriptionElement() { 623 if (this.description == null) 624 if (Configuration.errorOnAutoCreate()) 625 throw new Error("Attempt to auto-create SpecimenProcessingComponent.description"); 626 else if (Configuration.doAutoCreate()) 627 this.description = new StringType(); // bb 628 return this.description; 629 } 630 631 public boolean hasDescriptionElement() { 632 return this.description != null && !this.description.isEmpty(); 633 } 634 635 public boolean hasDescription() { 636 return this.description != null && !this.description.isEmpty(); 637 } 638 639 /** 640 * @param value {@link #description} (Textual description of procedure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 641 */ 642 public SpecimenProcessingComponent setDescriptionElement(StringType value) { 643 this.description = value; 644 return this; 645 } 646 647 /** 648 * @return Textual description of procedure. 649 */ 650 public String getDescription() { 651 return this.description == null ? null : this.description.getValue(); 652 } 653 654 /** 655 * @param value Textual description of procedure. 656 */ 657 public SpecimenProcessingComponent setDescription(String value) { 658 if (Utilities.noString(value)) 659 this.description = null; 660 else { 661 if (this.description == null) 662 this.description = new StringType(); 663 this.description.setValue(value); 664 } 665 return this; 666 } 667 668 /** 669 * @return {@link #procedure} (A coded value specifying the procedure used to process the specimen.) 670 */ 671 public CodeableConcept getProcedure() { 672 if (this.procedure == null) 673 if (Configuration.errorOnAutoCreate()) 674 throw new Error("Attempt to auto-create SpecimenProcessingComponent.procedure"); 675 else if (Configuration.doAutoCreate()) 676 this.procedure = new CodeableConcept(); // cc 677 return this.procedure; 678 } 679 680 public boolean hasProcedure() { 681 return this.procedure != null && !this.procedure.isEmpty(); 682 } 683 684 /** 685 * @param value {@link #procedure} (A coded value specifying the procedure used to process the specimen.) 686 */ 687 public SpecimenProcessingComponent setProcedure(CodeableConcept value) { 688 this.procedure = value; 689 return this; 690 } 691 692 /** 693 * @return {@link #additive} (Material used in the processing step.) 694 */ 695 public List<Reference> getAdditive() { 696 if (this.additive == null) 697 this.additive = new ArrayList<Reference>(); 698 return this.additive; 699 } 700 701 /** 702 * @return Returns a reference to <code>this</code> for easy method chaining 703 */ 704 public SpecimenProcessingComponent setAdditive(List<Reference> theAdditive) { 705 this.additive = theAdditive; 706 return this; 707 } 708 709 public boolean hasAdditive() { 710 if (this.additive == null) 711 return false; 712 for (Reference item : this.additive) 713 if (!item.isEmpty()) 714 return true; 715 return false; 716 } 717 718 public Reference addAdditive() { //3 719 Reference t = new Reference(); 720 if (this.additive == null) 721 this.additive = new ArrayList<Reference>(); 722 this.additive.add(t); 723 return t; 724 } 725 726 public SpecimenProcessingComponent addAdditive(Reference t) { //3 727 if (t == null) 728 return this; 729 if (this.additive == null) 730 this.additive = new ArrayList<Reference>(); 731 this.additive.add(t); 732 return this; 733 } 734 735 /** 736 * @return The first repetition of repeating field {@link #additive}, creating it if it does not already exist 737 */ 738 public Reference getAdditiveFirstRep() { 739 if (getAdditive().isEmpty()) { 740 addAdditive(); 741 } 742 return getAdditive().get(0); 743 } 744 745 /** 746 * @deprecated Use Reference#setResource(IBaseResource) instead 747 */ 748 @Deprecated 749 public List<Substance> getAdditiveTarget() { 750 if (this.additiveTarget == null) 751 this.additiveTarget = new ArrayList<Substance>(); 752 return this.additiveTarget; 753 } 754 755 /** 756 * @deprecated Use Reference#setResource(IBaseResource) instead 757 */ 758 @Deprecated 759 public Substance addAdditiveTarget() { 760 Substance r = new Substance(); 761 if (this.additiveTarget == null) 762 this.additiveTarget = new ArrayList<Substance>(); 763 this.additiveTarget.add(r); 764 return r; 765 } 766 767 /** 768 * @return {@link #time} (A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.) 769 */ 770 public Type getTime() { 771 return this.time; 772 } 773 774 /** 775 * @return {@link #time} (A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.) 776 */ 777 public DateTimeType getTimeDateTimeType() throws FHIRException { 778 if (this.time == null) 779 return null; 780 if (!(this.time instanceof DateTimeType)) 781 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.time.getClass().getName()+" was encountered"); 782 return (DateTimeType) this.time; 783 } 784 785 public boolean hasTimeDateTimeType() { 786 return this != null && this.time instanceof DateTimeType; 787 } 788 789 /** 790 * @return {@link #time} (A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.) 791 */ 792 public Period getTimePeriod() throws FHIRException { 793 if (this.time == null) 794 return null; 795 if (!(this.time instanceof Period)) 796 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered"); 797 return (Period) this.time; 798 } 799 800 public boolean hasTimePeriod() { 801 return this != null && this.time instanceof Period; 802 } 803 804 public boolean hasTime() { 805 return this.time != null && !this.time.isEmpty(); 806 } 807 808 /** 809 * @param value {@link #time} (A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.) 810 */ 811 public SpecimenProcessingComponent setTime(Type value) { 812 if (value != null && !(value instanceof DateTimeType || value instanceof Period)) 813 throw new Error("Not the right type for Specimen.processing.time[x]: "+value.fhirType()); 814 this.time = value; 815 return this; 816 } 817 818 protected void listChildren(List<Property> children) { 819 super.listChildren(children); 820 children.add(new Property("description", "string", "Textual description of procedure.", 0, 1, description)); 821 children.add(new Property("procedure", "CodeableConcept", "A coded value specifying the procedure used to process the specimen.", 0, 1, procedure)); 822 children.add(new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive)); 823 children.add(new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time)); 824 } 825 826 @Override 827 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 828 switch (_hash) { 829 case -1724546052: /*description*/ return new Property("description", "string", "Textual description of procedure.", 0, 1, description); 830 case -1095204141: /*procedure*/ return new Property("procedure", "CodeableConcept", "A coded value specifying the procedure used to process the specimen.", 0, 1, procedure); 831 case -1226589236: /*additive*/ return new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive); 832 case -1313930605: /*time[x]*/ return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time); 833 case 3560141: /*time*/ return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time); 834 case 2135345544: /*timeDateTime*/ return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time); 835 case 693544686: /*timePeriod*/ return new Property("time[x]", "dateTime|Period", "A record of the time or period when the specimen processing occurred. For example the time of sample fixation or the period of time the sample was in formalin.", 0, 1, time); 836 default: return super.getNamedProperty(_hash, _name, _checkValid); 837 } 838 839 } 840 841 @Override 842 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 843 switch (hash) { 844 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 845 case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // CodeableConcept 846 case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : this.additive.toArray(new Base[this.additive.size()]); // Reference 847 case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // Type 848 default: return super.getProperty(hash, name, checkValid); 849 } 850 851 } 852 853 @Override 854 public Base setProperty(int hash, String name, Base value) throws FHIRException { 855 switch (hash) { 856 case -1724546052: // description 857 this.description = castToString(value); // StringType 858 return value; 859 case -1095204141: // procedure 860 this.procedure = castToCodeableConcept(value); // CodeableConcept 861 return value; 862 case -1226589236: // additive 863 this.getAdditive().add(castToReference(value)); // Reference 864 return value; 865 case 3560141: // time 866 this.time = castToType(value); // Type 867 return value; 868 default: return super.setProperty(hash, name, value); 869 } 870 871 } 872 873 @Override 874 public Base setProperty(String name, Base value) throws FHIRException { 875 if (name.equals("description")) { 876 this.description = castToString(value); // StringType 877 } else if (name.equals("procedure")) { 878 this.procedure = castToCodeableConcept(value); // CodeableConcept 879 } else if (name.equals("additive")) { 880 this.getAdditive().add(castToReference(value)); 881 } else if (name.equals("time[x]")) { 882 this.time = castToType(value); // Type 883 } else 884 return super.setProperty(name, value); 885 return value; 886 } 887 888 @Override 889 public Base makeProperty(int hash, String name) throws FHIRException { 890 switch (hash) { 891 case -1724546052: return getDescriptionElement(); 892 case -1095204141: return getProcedure(); 893 case -1226589236: return addAdditive(); 894 case -1313930605: return getTime(); 895 case 3560141: return getTime(); 896 default: return super.makeProperty(hash, name); 897 } 898 899 } 900 901 @Override 902 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 903 switch (hash) { 904 case -1724546052: /*description*/ return new String[] {"string"}; 905 case -1095204141: /*procedure*/ return new String[] {"CodeableConcept"}; 906 case -1226589236: /*additive*/ return new String[] {"Reference"}; 907 case 3560141: /*time*/ return new String[] {"dateTime", "Period"}; 908 default: return super.getTypesForProperty(hash, name); 909 } 910 911 } 912 913 @Override 914 public Base addChild(String name) throws FHIRException { 915 if (name.equals("description")) { 916 throw new FHIRException("Cannot call addChild on a primitive type Specimen.description"); 917 } 918 else if (name.equals("procedure")) { 919 this.procedure = new CodeableConcept(); 920 return this.procedure; 921 } 922 else if (name.equals("additive")) { 923 return addAdditive(); 924 } 925 else if (name.equals("timeDateTime")) { 926 this.time = new DateTimeType(); 927 return this.time; 928 } 929 else if (name.equals("timePeriod")) { 930 this.time = new Period(); 931 return this.time; 932 } 933 else 934 return super.addChild(name); 935 } 936 937 public SpecimenProcessingComponent copy() { 938 SpecimenProcessingComponent dst = new SpecimenProcessingComponent(); 939 copyValues(dst); 940 dst.description = description == null ? null : description.copy(); 941 dst.procedure = procedure == null ? null : procedure.copy(); 942 if (additive != null) { 943 dst.additive = new ArrayList<Reference>(); 944 for (Reference i : additive) 945 dst.additive.add(i.copy()); 946 }; 947 dst.time = time == null ? null : time.copy(); 948 return dst; 949 } 950 951 @Override 952 public boolean equalsDeep(Base other_) { 953 if (!super.equalsDeep(other_)) 954 return false; 955 if (!(other_ instanceof SpecimenProcessingComponent)) 956 return false; 957 SpecimenProcessingComponent o = (SpecimenProcessingComponent) other_; 958 return compareDeep(description, o.description, true) && compareDeep(procedure, o.procedure, true) 959 && compareDeep(additive, o.additive, true) && compareDeep(time, o.time, true); 960 } 961 962 @Override 963 public boolean equalsShallow(Base other_) { 964 if (!super.equalsShallow(other_)) 965 return false; 966 if (!(other_ instanceof SpecimenProcessingComponent)) 967 return false; 968 SpecimenProcessingComponent o = (SpecimenProcessingComponent) other_; 969 return compareValues(description, o.description, true); 970 } 971 972 public boolean isEmpty() { 973 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, procedure, additive 974 , time); 975 } 976 977 public String fhirType() { 978 return "Specimen.processing"; 979 980 } 981 982 } 983 984 @Block() 985 public static class SpecimenContainerComponent extends BackboneElement implements IBaseBackboneElement { 986 /** 987 * Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances. 988 */ 989 @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 990 @Description(shortDefinition="Id for the container", formalDefinition="Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances." ) 991 protected List<Identifier> identifier; 992 993 /** 994 * Textual description of the container. 995 */ 996 @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false) 997 @Description(shortDefinition="Textual description of the container", formalDefinition="Textual description of the container." ) 998 protected StringType description; 999 1000 /** 1001 * The type of container associated with the specimen (e.g. slide, aliquot, etc.). 1002 */ 1003 @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false) 1004 @Description(shortDefinition="Kind of container directly associated with specimen", formalDefinition="The type of container associated with the specimen (e.g. slide, aliquot, etc.)." ) 1005 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-container-type") 1006 protected CodeableConcept type; 1007 1008 /** 1009 * The capacity (volume or other measure) the container may contain. 1010 */ 1011 @Child(name = "capacity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false) 1012 @Description(shortDefinition="Container volume or size", formalDefinition="The capacity (volume or other measure) the container may contain." ) 1013 protected SimpleQuantity capacity; 1014 1015 /** 1016 * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type. 1017 */ 1018 @Child(name = "specimenQuantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=false) 1019 @Description(shortDefinition="Quantity of specimen within container", formalDefinition="The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type." ) 1020 protected SimpleQuantity specimenQuantity; 1021 1022 /** 1023 * Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA. 1024 */ 1025 @Child(name = "additive", type = {CodeableConcept.class, Substance.class}, order=6, min=0, max=1, modifier=false, summary=false) 1026 @Description(shortDefinition="Additive associated with container", formalDefinition="Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA." ) 1027 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v2-0371") 1028 protected Type additive; 1029 1030 private static final long serialVersionUID = 187274879L; 1031 1032 /** 1033 * Constructor 1034 */ 1035 public SpecimenContainerComponent() { 1036 super(); 1037 } 1038 1039 /** 1040 * @return {@link #identifier} (Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.) 1041 */ 1042 public List<Identifier> getIdentifier() { 1043 if (this.identifier == null) 1044 this.identifier = new ArrayList<Identifier>(); 1045 return this.identifier; 1046 } 1047 1048 /** 1049 * @return Returns a reference to <code>this</code> for easy method chaining 1050 */ 1051 public SpecimenContainerComponent setIdentifier(List<Identifier> theIdentifier) { 1052 this.identifier = theIdentifier; 1053 return this; 1054 } 1055 1056 public boolean hasIdentifier() { 1057 if (this.identifier == null) 1058 return false; 1059 for (Identifier item : this.identifier) 1060 if (!item.isEmpty()) 1061 return true; 1062 return false; 1063 } 1064 1065 public Identifier addIdentifier() { //3 1066 Identifier t = new Identifier(); 1067 if (this.identifier == null) 1068 this.identifier = new ArrayList<Identifier>(); 1069 this.identifier.add(t); 1070 return t; 1071 } 1072 1073 public SpecimenContainerComponent addIdentifier(Identifier t) { //3 1074 if (t == null) 1075 return this; 1076 if (this.identifier == null) 1077 this.identifier = new ArrayList<Identifier>(); 1078 this.identifier.add(t); 1079 return this; 1080 } 1081 1082 /** 1083 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 1084 */ 1085 public Identifier getIdentifierFirstRep() { 1086 if (getIdentifier().isEmpty()) { 1087 addIdentifier(); 1088 } 1089 return getIdentifier().get(0); 1090 } 1091 1092 /** 1093 * @return {@link #description} (Textual description of the container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 1094 */ 1095 public StringType getDescriptionElement() { 1096 if (this.description == null) 1097 if (Configuration.errorOnAutoCreate()) 1098 throw new Error("Attempt to auto-create SpecimenContainerComponent.description"); 1099 else if (Configuration.doAutoCreate()) 1100 this.description = new StringType(); // bb 1101 return this.description; 1102 } 1103 1104 public boolean hasDescriptionElement() { 1105 return this.description != null && !this.description.isEmpty(); 1106 } 1107 1108 public boolean hasDescription() { 1109 return this.description != null && !this.description.isEmpty(); 1110 } 1111 1112 /** 1113 * @param value {@link #description} (Textual description of the container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 1114 */ 1115 public SpecimenContainerComponent setDescriptionElement(StringType value) { 1116 this.description = value; 1117 return this; 1118 } 1119 1120 /** 1121 * @return Textual description of the container. 1122 */ 1123 public String getDescription() { 1124 return this.description == null ? null : this.description.getValue(); 1125 } 1126 1127 /** 1128 * @param value Textual description of the container. 1129 */ 1130 public SpecimenContainerComponent setDescription(String value) { 1131 if (Utilities.noString(value)) 1132 this.description = null; 1133 else { 1134 if (this.description == null) 1135 this.description = new StringType(); 1136 this.description.setValue(value); 1137 } 1138 return this; 1139 } 1140 1141 /** 1142 * @return {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).) 1143 */ 1144 public CodeableConcept getType() { 1145 if (this.type == null) 1146 if (Configuration.errorOnAutoCreate()) 1147 throw new Error("Attempt to auto-create SpecimenContainerComponent.type"); 1148 else if (Configuration.doAutoCreate()) 1149 this.type = new CodeableConcept(); // cc 1150 return this.type; 1151 } 1152 1153 public boolean hasType() { 1154 return this.type != null && !this.type.isEmpty(); 1155 } 1156 1157 /** 1158 * @param value {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).) 1159 */ 1160 public SpecimenContainerComponent setType(CodeableConcept value) { 1161 this.type = value; 1162 return this; 1163 } 1164 1165 /** 1166 * @return {@link #capacity} (The capacity (volume or other measure) the container may contain.) 1167 */ 1168 public SimpleQuantity getCapacity() { 1169 if (this.capacity == null) 1170 if (Configuration.errorOnAutoCreate()) 1171 throw new Error("Attempt to auto-create SpecimenContainerComponent.capacity"); 1172 else if (Configuration.doAutoCreate()) 1173 this.capacity = new SimpleQuantity(); // cc 1174 return this.capacity; 1175 } 1176 1177 public boolean hasCapacity() { 1178 return this.capacity != null && !this.capacity.isEmpty(); 1179 } 1180 1181 /** 1182 * @param value {@link #capacity} (The capacity (volume or other measure) the container may contain.) 1183 */ 1184 public SpecimenContainerComponent setCapacity(SimpleQuantity value) { 1185 this.capacity = value; 1186 return this; 1187 } 1188 1189 /** 1190 * @return {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.) 1191 */ 1192 public SimpleQuantity getSpecimenQuantity() { 1193 if (this.specimenQuantity == null) 1194 if (Configuration.errorOnAutoCreate()) 1195 throw new Error("Attempt to auto-create SpecimenContainerComponent.specimenQuantity"); 1196 else if (Configuration.doAutoCreate()) 1197 this.specimenQuantity = new SimpleQuantity(); // cc 1198 return this.specimenQuantity; 1199 } 1200 1201 public boolean hasSpecimenQuantity() { 1202 return this.specimenQuantity != null && !this.specimenQuantity.isEmpty(); 1203 } 1204 1205 /** 1206 * @param value {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.) 1207 */ 1208 public SpecimenContainerComponent setSpecimenQuantity(SimpleQuantity value) { 1209 this.specimenQuantity = value; 1210 return this; 1211 } 1212 1213 /** 1214 * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.) 1215 */ 1216 public Type getAdditive() { 1217 return this.additive; 1218 } 1219 1220 /** 1221 * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.) 1222 */ 1223 public CodeableConcept getAdditiveCodeableConcept() throws FHIRException { 1224 if (this.additive == null) 1225 return null; 1226 if (!(this.additive instanceof CodeableConcept)) 1227 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.additive.getClass().getName()+" was encountered"); 1228 return (CodeableConcept) this.additive; 1229 } 1230 1231 public boolean hasAdditiveCodeableConcept() { 1232 return this != null && this.additive instanceof CodeableConcept; 1233 } 1234 1235 /** 1236 * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.) 1237 */ 1238 public Reference getAdditiveReference() throws FHIRException { 1239 if (this.additive == null) 1240 return null; 1241 if (!(this.additive instanceof Reference)) 1242 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.additive.getClass().getName()+" was encountered"); 1243 return (Reference) this.additive; 1244 } 1245 1246 public boolean hasAdditiveReference() { 1247 return this != null && this.additive instanceof Reference; 1248 } 1249 1250 public boolean hasAdditive() { 1251 return this.additive != null && !this.additive.isEmpty(); 1252 } 1253 1254 /** 1255 * @param value {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.) 1256 */ 1257 public SpecimenContainerComponent setAdditive(Type value) { 1258 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 1259 throw new Error("Not the right type for Specimen.container.additive[x]: "+value.fhirType()); 1260 this.additive = value; 1261 return this; 1262 } 1263 1264 protected void listChildren(List<Property> children) { 1265 super.listChildren(children); 1266 children.add(new Property("identifier", "Identifier", "Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1267 children.add(new Property("description", "string", "Textual description of the container.", 0, 1, description)); 1268 children.add(new Property("type", "CodeableConcept", "The type of container associated with the specimen (e.g. slide, aliquot, etc.).", 0, 1, type)); 1269 children.add(new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) the container may contain.", 0, 1, capacity)); 1270 children.add(new Property("specimenQuantity", "SimpleQuantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, 1, specimenQuantity)); 1271 children.add(new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive)); 1272 } 1273 1274 @Override 1275 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1276 switch (_hash) { 1277 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.", 0, java.lang.Integer.MAX_VALUE, identifier); 1278 case -1724546052: /*description*/ return new Property("description", "string", "Textual description of the container.", 0, 1, description); 1279 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "The type of container associated with the specimen (e.g. slide, aliquot, etc.).", 0, 1, type); 1280 case -67824454: /*capacity*/ return new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) the container may contain.", 0, 1, capacity); 1281 case 1485980595: /*specimenQuantity*/ return new Property("specimenQuantity", "SimpleQuantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, 1, specimenQuantity); 1282 case 261915956: /*additive[x]*/ return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive); 1283 case -1226589236: /*additive*/ return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive); 1284 case 1330272821: /*additiveCodeableConcept*/ return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive); 1285 case -386783009: /*additiveReference*/ return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive); 1286 default: return super.getNamedProperty(_hash, _name, _checkValid); 1287 } 1288 1289 } 1290 1291 @Override 1292 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1293 switch (hash) { 1294 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1295 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 1296 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1297 case -67824454: /*capacity*/ return this.capacity == null ? new Base[0] : new Base[] {this.capacity}; // SimpleQuantity 1298 case 1485980595: /*specimenQuantity*/ return this.specimenQuantity == null ? new Base[0] : new Base[] {this.specimenQuantity}; // SimpleQuantity 1299 case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : new Base[] {this.additive}; // Type 1300 default: return super.getProperty(hash, name, checkValid); 1301 } 1302 1303 } 1304 1305 @Override 1306 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1307 switch (hash) { 1308 case -1618432855: // identifier 1309 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1310 return value; 1311 case -1724546052: // description 1312 this.description = castToString(value); // StringType 1313 return value; 1314 case 3575610: // type 1315 this.type = castToCodeableConcept(value); // CodeableConcept 1316 return value; 1317 case -67824454: // capacity 1318 this.capacity = castToSimpleQuantity(value); // SimpleQuantity 1319 return value; 1320 case 1485980595: // specimenQuantity 1321 this.specimenQuantity = castToSimpleQuantity(value); // SimpleQuantity 1322 return value; 1323 case -1226589236: // additive 1324 this.additive = castToType(value); // Type 1325 return value; 1326 default: return super.setProperty(hash, name, value); 1327 } 1328 1329 } 1330 1331 @Override 1332 public Base setProperty(String name, Base value) throws FHIRException { 1333 if (name.equals("identifier")) { 1334 this.getIdentifier().add(castToIdentifier(value)); 1335 } else if (name.equals("description")) { 1336 this.description = castToString(value); // StringType 1337 } else if (name.equals("type")) { 1338 this.type = castToCodeableConcept(value); // CodeableConcept 1339 } else if (name.equals("capacity")) { 1340 this.capacity = castToSimpleQuantity(value); // SimpleQuantity 1341 } else if (name.equals("specimenQuantity")) { 1342 this.specimenQuantity = castToSimpleQuantity(value); // SimpleQuantity 1343 } else if (name.equals("additive[x]")) { 1344 this.additive = castToType(value); // Type 1345 } else 1346 return super.setProperty(name, value); 1347 return value; 1348 } 1349 1350 @Override 1351 public Base makeProperty(int hash, String name) throws FHIRException { 1352 switch (hash) { 1353 case -1618432855: return addIdentifier(); 1354 case -1724546052: return getDescriptionElement(); 1355 case 3575610: return getType(); 1356 case -67824454: return getCapacity(); 1357 case 1485980595: return getSpecimenQuantity(); 1358 case 261915956: return getAdditive(); 1359 case -1226589236: return getAdditive(); 1360 default: return super.makeProperty(hash, name); 1361 } 1362 1363 } 1364 1365 @Override 1366 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1367 switch (hash) { 1368 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1369 case -1724546052: /*description*/ return new String[] {"string"}; 1370 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 1371 case -67824454: /*capacity*/ return new String[] {"SimpleQuantity"}; 1372 case 1485980595: /*specimenQuantity*/ return new String[] {"SimpleQuantity"}; 1373 case -1226589236: /*additive*/ return new String[] {"CodeableConcept", "Reference"}; 1374 default: return super.getTypesForProperty(hash, name); 1375 } 1376 1377 } 1378 1379 @Override 1380 public Base addChild(String name) throws FHIRException { 1381 if (name.equals("identifier")) { 1382 return addIdentifier(); 1383 } 1384 else if (name.equals("description")) { 1385 throw new FHIRException("Cannot call addChild on a primitive type Specimen.description"); 1386 } 1387 else if (name.equals("type")) { 1388 this.type = new CodeableConcept(); 1389 return this.type; 1390 } 1391 else if (name.equals("capacity")) { 1392 this.capacity = new SimpleQuantity(); 1393 return this.capacity; 1394 } 1395 else if (name.equals("specimenQuantity")) { 1396 this.specimenQuantity = new SimpleQuantity(); 1397 return this.specimenQuantity; 1398 } 1399 else if (name.equals("additiveCodeableConcept")) { 1400 this.additive = new CodeableConcept(); 1401 return this.additive; 1402 } 1403 else if (name.equals("additiveReference")) { 1404 this.additive = new Reference(); 1405 return this.additive; 1406 } 1407 else 1408 return super.addChild(name); 1409 } 1410 1411 public SpecimenContainerComponent copy() { 1412 SpecimenContainerComponent dst = new SpecimenContainerComponent(); 1413 copyValues(dst); 1414 if (identifier != null) { 1415 dst.identifier = new ArrayList<Identifier>(); 1416 for (Identifier i : identifier) 1417 dst.identifier.add(i.copy()); 1418 }; 1419 dst.description = description == null ? null : description.copy(); 1420 dst.type = type == null ? null : type.copy(); 1421 dst.capacity = capacity == null ? null : capacity.copy(); 1422 dst.specimenQuantity = specimenQuantity == null ? null : specimenQuantity.copy(); 1423 dst.additive = additive == null ? null : additive.copy(); 1424 return dst; 1425 } 1426 1427 @Override 1428 public boolean equalsDeep(Base other_) { 1429 if (!super.equalsDeep(other_)) 1430 return false; 1431 if (!(other_ instanceof SpecimenContainerComponent)) 1432 return false; 1433 SpecimenContainerComponent o = (SpecimenContainerComponent) other_; 1434 return compareDeep(identifier, o.identifier, true) && compareDeep(description, o.description, true) 1435 && compareDeep(type, o.type, true) && compareDeep(capacity, o.capacity, true) && compareDeep(specimenQuantity, o.specimenQuantity, true) 1436 && compareDeep(additive, o.additive, true); 1437 } 1438 1439 @Override 1440 public boolean equalsShallow(Base other_) { 1441 if (!super.equalsShallow(other_)) 1442 return false; 1443 if (!(other_ instanceof SpecimenContainerComponent)) 1444 return false; 1445 SpecimenContainerComponent o = (SpecimenContainerComponent) other_; 1446 return compareValues(description, o.description, true); 1447 } 1448 1449 public boolean isEmpty() { 1450 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, description, type 1451 , capacity, specimenQuantity, additive); 1452 } 1453 1454 public String fhirType() { 1455 return "Specimen.container"; 1456 1457 } 1458 1459 } 1460 1461 /** 1462 * Id for specimen. 1463 */ 1464 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1465 @Description(shortDefinition="External Identifier", formalDefinition="Id for specimen." ) 1466 protected List<Identifier> identifier; 1467 1468 /** 1469 * The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures. 1470 */ 1471 @Child(name = "accessionIdentifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true) 1472 @Description(shortDefinition="Identifier assigned by the lab", formalDefinition="The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures." ) 1473 protected Identifier accessionIdentifier; 1474 1475 /** 1476 * The availability of the specimen. 1477 */ 1478 @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true) 1479 @Description(shortDefinition="available | unavailable | unsatisfactory | entered-in-error", formalDefinition="The availability of the specimen." ) 1480 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-status") 1481 protected Enumeration<SpecimenStatus> status; 1482 1483 /** 1484 * The kind of material that forms the specimen. 1485 */ 1486 @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 1487 @Description(shortDefinition="Kind of material that forms the specimen", formalDefinition="The kind of material that forms the specimen." ) 1488 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v2-0487") 1489 protected CodeableConcept type; 1490 1491 /** 1492 * Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device. 1493 */ 1494 @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class, Location.class}, order=4, min=1, max=1, modifier=false, summary=true) 1495 @Description(shortDefinition="Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device", formalDefinition="Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device." ) 1496 protected Reference subject; 1497 1498 /** 1499 * The actual object that is the target of the reference (Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.) 1500 */ 1501 protected Resource subjectTarget; 1502 1503 /** 1504 * Time when specimen was received for processing or testing. 1505 */ 1506 @Child(name = "receivedTime", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1507 @Description(shortDefinition="The time when specimen was received for processing", formalDefinition="Time when specimen was received for processing or testing." ) 1508 protected DateTimeType receivedTime; 1509 1510 /** 1511 * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen. 1512 */ 1513 @Child(name = "parent", type = {Specimen.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1514 @Description(shortDefinition="Specimen from which this specimen originated", formalDefinition="Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen." ) 1515 protected List<Reference> parent; 1516 /** 1517 * The actual objects that are the target of the reference (Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.) 1518 */ 1519 protected List<Specimen> parentTarget; 1520 1521 1522 /** 1523 * Details concerning a service request that required a specimen to be collected. 1524 */ 1525 @Child(name = "request", type = {ServiceRequest.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1526 @Description(shortDefinition="Why the specimen was collected", formalDefinition="Details concerning a service request that required a specimen to be collected." ) 1527 protected List<Reference> request; 1528 /** 1529 * The actual objects that are the target of the reference (Details concerning a service request that required a specimen to be collected.) 1530 */ 1531 protected List<ServiceRequest> requestTarget; 1532 1533 1534 /** 1535 * Details concerning the specimen collection. 1536 */ 1537 @Child(name = "collection", type = {}, order=8, min=0, max=1, modifier=false, summary=false) 1538 @Description(shortDefinition="Collection details", formalDefinition="Details concerning the specimen collection." ) 1539 protected SpecimenCollectionComponent collection; 1540 1541 /** 1542 * Details concerning processing and processing steps for the specimen. 1543 */ 1544 @Child(name = "processing", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1545 @Description(shortDefinition="Processing and processing step details", formalDefinition="Details concerning processing and processing steps for the specimen." ) 1546 protected List<SpecimenProcessingComponent> processing; 1547 1548 /** 1549 * The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here. 1550 */ 1551 @Child(name = "container", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1552 @Description(shortDefinition="Direct container of specimen (tube/slide, etc.)", formalDefinition="The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here." ) 1553 protected List<SpecimenContainerComponent> container; 1554 1555 /** 1556 * To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen). 1557 */ 1558 @Child(name = "note", type = {Annotation.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1559 @Description(shortDefinition="Comments", formalDefinition="To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen)." ) 1560 protected List<Annotation> note; 1561 1562 private static final long serialVersionUID = -621357717L; 1563 1564 /** 1565 * Constructor 1566 */ 1567 public Specimen() { 1568 super(); 1569 } 1570 1571 /** 1572 * Constructor 1573 */ 1574 public Specimen(Reference subject) { 1575 super(); 1576 this.subject = subject; 1577 } 1578 1579 /** 1580 * @return {@link #identifier} (Id for specimen.) 1581 */ 1582 public List<Identifier> getIdentifier() { 1583 if (this.identifier == null) 1584 this.identifier = new ArrayList<Identifier>(); 1585 return this.identifier; 1586 } 1587 1588 /** 1589 * @return Returns a reference to <code>this</code> for easy method chaining 1590 */ 1591 public Specimen setIdentifier(List<Identifier> theIdentifier) { 1592 this.identifier = theIdentifier; 1593 return this; 1594 } 1595 1596 public boolean hasIdentifier() { 1597 if (this.identifier == null) 1598 return false; 1599 for (Identifier item : this.identifier) 1600 if (!item.isEmpty()) 1601 return true; 1602 return false; 1603 } 1604 1605 public Identifier addIdentifier() { //3 1606 Identifier t = new Identifier(); 1607 if (this.identifier == null) 1608 this.identifier = new ArrayList<Identifier>(); 1609 this.identifier.add(t); 1610 return t; 1611 } 1612 1613 public Specimen addIdentifier(Identifier t) { //3 1614 if (t == null) 1615 return this; 1616 if (this.identifier == null) 1617 this.identifier = new ArrayList<Identifier>(); 1618 this.identifier.add(t); 1619 return this; 1620 } 1621 1622 /** 1623 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 1624 */ 1625 public Identifier getIdentifierFirstRep() { 1626 if (getIdentifier().isEmpty()) { 1627 addIdentifier(); 1628 } 1629 return getIdentifier().get(0); 1630 } 1631 1632 /** 1633 * @return {@link #accessionIdentifier} (The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.) 1634 */ 1635 public Identifier getAccessionIdentifier() { 1636 if (this.accessionIdentifier == null) 1637 if (Configuration.errorOnAutoCreate()) 1638 throw new Error("Attempt to auto-create Specimen.accessionIdentifier"); 1639 else if (Configuration.doAutoCreate()) 1640 this.accessionIdentifier = new Identifier(); // cc 1641 return this.accessionIdentifier; 1642 } 1643 1644 public boolean hasAccessionIdentifier() { 1645 return this.accessionIdentifier != null && !this.accessionIdentifier.isEmpty(); 1646 } 1647 1648 /** 1649 * @param value {@link #accessionIdentifier} (The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.) 1650 */ 1651 public Specimen setAccessionIdentifier(Identifier value) { 1652 this.accessionIdentifier = value; 1653 return this; 1654 } 1655 1656 /** 1657 * @return {@link #status} (The availability of the specimen.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1658 */ 1659 public Enumeration<SpecimenStatus> getStatusElement() { 1660 if (this.status == null) 1661 if (Configuration.errorOnAutoCreate()) 1662 throw new Error("Attempt to auto-create Specimen.status"); 1663 else if (Configuration.doAutoCreate()) 1664 this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory()); // bb 1665 return this.status; 1666 } 1667 1668 public boolean hasStatusElement() { 1669 return this.status != null && !this.status.isEmpty(); 1670 } 1671 1672 public boolean hasStatus() { 1673 return this.status != null && !this.status.isEmpty(); 1674 } 1675 1676 /** 1677 * @param value {@link #status} (The availability of the specimen.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1678 */ 1679 public Specimen setStatusElement(Enumeration<SpecimenStatus> value) { 1680 this.status = value; 1681 return this; 1682 } 1683 1684 /** 1685 * @return The availability of the specimen. 1686 */ 1687 public SpecimenStatus getStatus() { 1688 return this.status == null ? null : this.status.getValue(); 1689 } 1690 1691 /** 1692 * @param value The availability of the specimen. 1693 */ 1694 public Specimen setStatus(SpecimenStatus value) { 1695 if (value == null) 1696 this.status = null; 1697 else { 1698 if (this.status == null) 1699 this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory()); 1700 this.status.setValue(value); 1701 } 1702 return this; 1703 } 1704 1705 /** 1706 * @return {@link #type} (The kind of material that forms the specimen.) 1707 */ 1708 public CodeableConcept getType() { 1709 if (this.type == null) 1710 if (Configuration.errorOnAutoCreate()) 1711 throw new Error("Attempt to auto-create Specimen.type"); 1712 else if (Configuration.doAutoCreate()) 1713 this.type = new CodeableConcept(); // cc 1714 return this.type; 1715 } 1716 1717 public boolean hasType() { 1718 return this.type != null && !this.type.isEmpty(); 1719 } 1720 1721 /** 1722 * @param value {@link #type} (The kind of material that forms the specimen.) 1723 */ 1724 public Specimen setType(CodeableConcept value) { 1725 this.type = value; 1726 return this; 1727 } 1728 1729 /** 1730 * @return {@link #subject} (Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.) 1731 */ 1732 public Reference getSubject() { 1733 if (this.subject == null) 1734 if (Configuration.errorOnAutoCreate()) 1735 throw new Error("Attempt to auto-create Specimen.subject"); 1736 else if (Configuration.doAutoCreate()) 1737 this.subject = new Reference(); // cc 1738 return this.subject; 1739 } 1740 1741 public boolean hasSubject() { 1742 return this.subject != null && !this.subject.isEmpty(); 1743 } 1744 1745 /** 1746 * @param value {@link #subject} (Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.) 1747 */ 1748 public Specimen setSubject(Reference value) { 1749 this.subject = value; 1750 return this; 1751 } 1752 1753 /** 1754 * @return {@link #subject} 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. (Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.) 1755 */ 1756 public Resource getSubjectTarget() { 1757 return this.subjectTarget; 1758 } 1759 1760 /** 1761 * @param value {@link #subject} 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. (Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.) 1762 */ 1763 public Specimen setSubjectTarget(Resource value) { 1764 this.subjectTarget = value; 1765 return this; 1766 } 1767 1768 /** 1769 * @return {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value 1770 */ 1771 public DateTimeType getReceivedTimeElement() { 1772 if (this.receivedTime == null) 1773 if (Configuration.errorOnAutoCreate()) 1774 throw new Error("Attempt to auto-create Specimen.receivedTime"); 1775 else if (Configuration.doAutoCreate()) 1776 this.receivedTime = new DateTimeType(); // bb 1777 return this.receivedTime; 1778 } 1779 1780 public boolean hasReceivedTimeElement() { 1781 return this.receivedTime != null && !this.receivedTime.isEmpty(); 1782 } 1783 1784 public boolean hasReceivedTime() { 1785 return this.receivedTime != null && !this.receivedTime.isEmpty(); 1786 } 1787 1788 /** 1789 * @param value {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value 1790 */ 1791 public Specimen setReceivedTimeElement(DateTimeType value) { 1792 this.receivedTime = value; 1793 return this; 1794 } 1795 1796 /** 1797 * @return Time when specimen was received for processing or testing. 1798 */ 1799 public Date getReceivedTime() { 1800 return this.receivedTime == null ? null : this.receivedTime.getValue(); 1801 } 1802 1803 /** 1804 * @param value Time when specimen was received for processing or testing. 1805 */ 1806 public Specimen setReceivedTime(Date value) { 1807 if (value == null) 1808 this.receivedTime = null; 1809 else { 1810 if (this.receivedTime == null) 1811 this.receivedTime = new DateTimeType(); 1812 this.receivedTime.setValue(value); 1813 } 1814 return this; 1815 } 1816 1817 /** 1818 * @return {@link #parent} (Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.) 1819 */ 1820 public List<Reference> getParent() { 1821 if (this.parent == null) 1822 this.parent = new ArrayList<Reference>(); 1823 return this.parent; 1824 } 1825 1826 /** 1827 * @return Returns a reference to <code>this</code> for easy method chaining 1828 */ 1829 public Specimen setParent(List<Reference> theParent) { 1830 this.parent = theParent; 1831 return this; 1832 } 1833 1834 public boolean hasParent() { 1835 if (this.parent == null) 1836 return false; 1837 for (Reference item : this.parent) 1838 if (!item.isEmpty()) 1839 return true; 1840 return false; 1841 } 1842 1843 public Reference addParent() { //3 1844 Reference t = new Reference(); 1845 if (this.parent == null) 1846 this.parent = new ArrayList<Reference>(); 1847 this.parent.add(t); 1848 return t; 1849 } 1850 1851 public Specimen addParent(Reference t) { //3 1852 if (t == null) 1853 return this; 1854 if (this.parent == null) 1855 this.parent = new ArrayList<Reference>(); 1856 this.parent.add(t); 1857 return this; 1858 } 1859 1860 /** 1861 * @return The first repetition of repeating field {@link #parent}, creating it if it does not already exist 1862 */ 1863 public Reference getParentFirstRep() { 1864 if (getParent().isEmpty()) { 1865 addParent(); 1866 } 1867 return getParent().get(0); 1868 } 1869 1870 /** 1871 * @deprecated Use Reference#setResource(IBaseResource) instead 1872 */ 1873 @Deprecated 1874 public List<Specimen> getParentTarget() { 1875 if (this.parentTarget == null) 1876 this.parentTarget = new ArrayList<Specimen>(); 1877 return this.parentTarget; 1878 } 1879 1880 /** 1881 * @deprecated Use Reference#setResource(IBaseResource) instead 1882 */ 1883 @Deprecated 1884 public Specimen addParentTarget() { 1885 Specimen r = new Specimen(); 1886 if (this.parentTarget == null) 1887 this.parentTarget = new ArrayList<Specimen>(); 1888 this.parentTarget.add(r); 1889 return r; 1890 } 1891 1892 /** 1893 * @return {@link #request} (Details concerning a service request that required a specimen to be collected.) 1894 */ 1895 public List<Reference> getRequest() { 1896 if (this.request == null) 1897 this.request = new ArrayList<Reference>(); 1898 return this.request; 1899 } 1900 1901 /** 1902 * @return Returns a reference to <code>this</code> for easy method chaining 1903 */ 1904 public Specimen setRequest(List<Reference> theRequest) { 1905 this.request = theRequest; 1906 return this; 1907 } 1908 1909 public boolean hasRequest() { 1910 if (this.request == null) 1911 return false; 1912 for (Reference item : this.request) 1913 if (!item.isEmpty()) 1914 return true; 1915 return false; 1916 } 1917 1918 public Reference addRequest() { //3 1919 Reference t = new Reference(); 1920 if (this.request == null) 1921 this.request = new ArrayList<Reference>(); 1922 this.request.add(t); 1923 return t; 1924 } 1925 1926 public Specimen addRequest(Reference t) { //3 1927 if (t == null) 1928 return this; 1929 if (this.request == null) 1930 this.request = new ArrayList<Reference>(); 1931 this.request.add(t); 1932 return this; 1933 } 1934 1935 /** 1936 * @return The first repetition of repeating field {@link #request}, creating it if it does not already exist 1937 */ 1938 public Reference getRequestFirstRep() { 1939 if (getRequest().isEmpty()) { 1940 addRequest(); 1941 } 1942 return getRequest().get(0); 1943 } 1944 1945 /** 1946 * @deprecated Use Reference#setResource(IBaseResource) instead 1947 */ 1948 @Deprecated 1949 public List<ServiceRequest> getRequestTarget() { 1950 if (this.requestTarget == null) 1951 this.requestTarget = new ArrayList<ServiceRequest>(); 1952 return this.requestTarget; 1953 } 1954 1955 /** 1956 * @deprecated Use Reference#setResource(IBaseResource) instead 1957 */ 1958 @Deprecated 1959 public ServiceRequest addRequestTarget() { 1960 ServiceRequest r = new ServiceRequest(); 1961 if (this.requestTarget == null) 1962 this.requestTarget = new ArrayList<ServiceRequest>(); 1963 this.requestTarget.add(r); 1964 return r; 1965 } 1966 1967 /** 1968 * @return {@link #collection} (Details concerning the specimen collection.) 1969 */ 1970 public SpecimenCollectionComponent getCollection() { 1971 if (this.collection == null) 1972 if (Configuration.errorOnAutoCreate()) 1973 throw new Error("Attempt to auto-create Specimen.collection"); 1974 else if (Configuration.doAutoCreate()) 1975 this.collection = new SpecimenCollectionComponent(); // cc 1976 return this.collection; 1977 } 1978 1979 public boolean hasCollection() { 1980 return this.collection != null && !this.collection.isEmpty(); 1981 } 1982 1983 /** 1984 * @param value {@link #collection} (Details concerning the specimen collection.) 1985 */ 1986 public Specimen setCollection(SpecimenCollectionComponent value) { 1987 this.collection = value; 1988 return this; 1989 } 1990 1991 /** 1992 * @return {@link #processing} (Details concerning processing and processing steps for the specimen.) 1993 */ 1994 public List<SpecimenProcessingComponent> getProcessing() { 1995 if (this.processing == null) 1996 this.processing = new ArrayList<SpecimenProcessingComponent>(); 1997 return this.processing; 1998 } 1999 2000 /** 2001 * @return Returns a reference to <code>this</code> for easy method chaining 2002 */ 2003 public Specimen setProcessing(List<SpecimenProcessingComponent> theProcessing) { 2004 this.processing = theProcessing; 2005 return this; 2006 } 2007 2008 public boolean hasProcessing() { 2009 if (this.processing == null) 2010 return false; 2011 for (SpecimenProcessingComponent item : this.processing) 2012 if (!item.isEmpty()) 2013 return true; 2014 return false; 2015 } 2016 2017 public SpecimenProcessingComponent addProcessing() { //3 2018 SpecimenProcessingComponent t = new SpecimenProcessingComponent(); 2019 if (this.processing == null) 2020 this.processing = new ArrayList<SpecimenProcessingComponent>(); 2021 this.processing.add(t); 2022 return t; 2023 } 2024 2025 public Specimen addProcessing(SpecimenProcessingComponent t) { //3 2026 if (t == null) 2027 return this; 2028 if (this.processing == null) 2029 this.processing = new ArrayList<SpecimenProcessingComponent>(); 2030 this.processing.add(t); 2031 return this; 2032 } 2033 2034 /** 2035 * @return The first repetition of repeating field {@link #processing}, creating it if it does not already exist 2036 */ 2037 public SpecimenProcessingComponent getProcessingFirstRep() { 2038 if (getProcessing().isEmpty()) { 2039 addProcessing(); 2040 } 2041 return getProcessing().get(0); 2042 } 2043 2044 /** 2045 * @return {@link #container} (The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.) 2046 */ 2047 public List<SpecimenContainerComponent> getContainer() { 2048 if (this.container == null) 2049 this.container = new ArrayList<SpecimenContainerComponent>(); 2050 return this.container; 2051 } 2052 2053 /** 2054 * @return Returns a reference to <code>this</code> for easy method chaining 2055 */ 2056 public Specimen setContainer(List<SpecimenContainerComponent> theContainer) { 2057 this.container = theContainer; 2058 return this; 2059 } 2060 2061 public boolean hasContainer() { 2062 if (this.container == null) 2063 return false; 2064 for (SpecimenContainerComponent item : this.container) 2065 if (!item.isEmpty()) 2066 return true; 2067 return false; 2068 } 2069 2070 public SpecimenContainerComponent addContainer() { //3 2071 SpecimenContainerComponent t = new SpecimenContainerComponent(); 2072 if (this.container == null) 2073 this.container = new ArrayList<SpecimenContainerComponent>(); 2074 this.container.add(t); 2075 return t; 2076 } 2077 2078 public Specimen addContainer(SpecimenContainerComponent t) { //3 2079 if (t == null) 2080 return this; 2081 if (this.container == null) 2082 this.container = new ArrayList<SpecimenContainerComponent>(); 2083 this.container.add(t); 2084 return this; 2085 } 2086 2087 /** 2088 * @return The first repetition of repeating field {@link #container}, creating it if it does not already exist 2089 */ 2090 public SpecimenContainerComponent getContainerFirstRep() { 2091 if (getContainer().isEmpty()) { 2092 addContainer(); 2093 } 2094 return getContainer().get(0); 2095 } 2096 2097 /** 2098 * @return {@link #note} (To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).) 2099 */ 2100 public List<Annotation> getNote() { 2101 if (this.note == null) 2102 this.note = new ArrayList<Annotation>(); 2103 return this.note; 2104 } 2105 2106 /** 2107 * @return Returns a reference to <code>this</code> for easy method chaining 2108 */ 2109 public Specimen setNote(List<Annotation> theNote) { 2110 this.note = theNote; 2111 return this; 2112 } 2113 2114 public boolean hasNote() { 2115 if (this.note == null) 2116 return false; 2117 for (Annotation item : this.note) 2118 if (!item.isEmpty()) 2119 return true; 2120 return false; 2121 } 2122 2123 public Annotation addNote() { //3 2124 Annotation t = new Annotation(); 2125 if (this.note == null) 2126 this.note = new ArrayList<Annotation>(); 2127 this.note.add(t); 2128 return t; 2129 } 2130 2131 public Specimen addNote(Annotation t) { //3 2132 if (t == null) 2133 return this; 2134 if (this.note == null) 2135 this.note = new ArrayList<Annotation>(); 2136 this.note.add(t); 2137 return this; 2138 } 2139 2140 /** 2141 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist 2142 */ 2143 public Annotation getNoteFirstRep() { 2144 if (getNote().isEmpty()) { 2145 addNote(); 2146 } 2147 return getNote().get(0); 2148 } 2149 2150 protected void listChildren(List<Property> children) { 2151 super.listChildren(children); 2152 children.add(new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier)); 2153 children.add(new Property("accessionIdentifier", "Identifier", "The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.", 0, 1, accessionIdentifier)); 2154 children.add(new Property("status", "code", "The availability of the specimen.", 0, 1, status)); 2155 children.add(new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, 1, type)); 2156 children.add(new Property("subject", "Reference(Patient|Group|Device|Substance|Location)", "Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.", 0, 1, subject)); 2157 children.add(new Property("receivedTime", "dateTime", "Time when specimen was received for processing or testing.", 0, 1, receivedTime)); 2158 children.add(new Property("parent", "Reference(Specimen)", "Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.", 0, java.lang.Integer.MAX_VALUE, parent)); 2159 children.add(new Property("request", "Reference(ServiceRequest)", "Details concerning a service request that required a specimen to be collected.", 0, java.lang.Integer.MAX_VALUE, request)); 2160 children.add(new Property("collection", "", "Details concerning the specimen collection.", 0, 1, collection)); 2161 children.add(new Property("processing", "", "Details concerning processing and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, processing)); 2162 children.add(new Property("container", "", "The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.", 0, java.lang.Integer.MAX_VALUE, container)); 2163 children.add(new Property("note", "Annotation", "To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).", 0, java.lang.Integer.MAX_VALUE, note)); 2164 } 2165 2166 @Override 2167 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2168 switch (_hash) { 2169 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier); 2170 case 818734061: /*accessionIdentifier*/ return new Property("accessionIdentifier", "Identifier", "The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.", 0, 1, accessionIdentifier); 2171 case -892481550: /*status*/ return new Property("status", "code", "The availability of the specimen.", 0, 1, status); 2172 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, 1, type); 2173 case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group|Device|Substance|Location)", "Where the specimen came from. This may be from patient(s),from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device.", 0, 1, subject); 2174 case -767961010: /*receivedTime*/ return new Property("receivedTime", "dateTime", "Time when specimen was received for processing or testing.", 0, 1, receivedTime); 2175 case -995424086: /*parent*/ return new Property("parent", "Reference(Specimen)", "Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.", 0, java.lang.Integer.MAX_VALUE, parent); 2176 case 1095692943: /*request*/ return new Property("request", "Reference(ServiceRequest)", "Details concerning a service request that required a specimen to be collected.", 0, java.lang.Integer.MAX_VALUE, request); 2177 case -1741312354: /*collection*/ return new Property("collection", "", "Details concerning the specimen collection.", 0, 1, collection); 2178 case 422194963: /*processing*/ return new Property("processing", "", "Details concerning processing and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, processing); 2179 case -410956671: /*container*/ return new Property("container", "", "The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.", 0, java.lang.Integer.MAX_VALUE, container); 2180 case 3387378: /*note*/ return new Property("note", "Annotation", "To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).", 0, java.lang.Integer.MAX_VALUE, note); 2181 default: return super.getNamedProperty(_hash, _name, _checkValid); 2182 } 2183 2184 } 2185 2186 @Override 2187 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2188 switch (hash) { 2189 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 2190 case 818734061: /*accessionIdentifier*/ return this.accessionIdentifier == null ? new Base[0] : new Base[] {this.accessionIdentifier}; // Identifier 2191 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SpecimenStatus> 2192 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 2193 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 2194 case -767961010: /*receivedTime*/ return this.receivedTime == null ? new Base[0] : new Base[] {this.receivedTime}; // DateTimeType 2195 case -995424086: /*parent*/ return this.parent == null ? new Base[0] : this.parent.toArray(new Base[this.parent.size()]); // Reference 2196 case 1095692943: /*request*/ return this.request == null ? new Base[0] : this.request.toArray(new Base[this.request.size()]); // Reference 2197 case -1741312354: /*collection*/ return this.collection == null ? new Base[0] : new Base[] {this.collection}; // SpecimenCollectionComponent 2198 case 422194963: /*processing*/ return this.processing == null ? new Base[0] : this.processing.toArray(new Base[this.processing.size()]); // SpecimenProcessingComponent 2199 case -410956671: /*container*/ return this.container == null ? new Base[0] : this.container.toArray(new Base[this.container.size()]); // SpecimenContainerComponent 2200 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 2201 default: return super.getProperty(hash, name, checkValid); 2202 } 2203 2204 } 2205 2206 @Override 2207 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2208 switch (hash) { 2209 case -1618432855: // identifier 2210 this.getIdentifier().add(castToIdentifier(value)); // Identifier 2211 return value; 2212 case 818734061: // accessionIdentifier 2213 this.accessionIdentifier = castToIdentifier(value); // Identifier 2214 return value; 2215 case -892481550: // status 2216 value = new SpecimenStatusEnumFactory().fromType(castToCode(value)); 2217 this.status = (Enumeration) value; // Enumeration<SpecimenStatus> 2218 return value; 2219 case 3575610: // type 2220 this.type = castToCodeableConcept(value); // CodeableConcept 2221 return value; 2222 case -1867885268: // subject 2223 this.subject = castToReference(value); // Reference 2224 return value; 2225 case -767961010: // receivedTime 2226 this.receivedTime = castToDateTime(value); // DateTimeType 2227 return value; 2228 case -995424086: // parent 2229 this.getParent().add(castToReference(value)); // Reference 2230 return value; 2231 case 1095692943: // request 2232 this.getRequest().add(castToReference(value)); // Reference 2233 return value; 2234 case -1741312354: // collection 2235 this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent 2236 return value; 2237 case 422194963: // processing 2238 this.getProcessing().add((SpecimenProcessingComponent) value); // SpecimenProcessingComponent 2239 return value; 2240 case -410956671: // container 2241 this.getContainer().add((SpecimenContainerComponent) value); // SpecimenContainerComponent 2242 return value; 2243 case 3387378: // note 2244 this.getNote().add(castToAnnotation(value)); // Annotation 2245 return value; 2246 default: return super.setProperty(hash, name, value); 2247 } 2248 2249 } 2250 2251 @Override 2252 public Base setProperty(String name, Base value) throws FHIRException { 2253 if (name.equals("identifier")) { 2254 this.getIdentifier().add(castToIdentifier(value)); 2255 } else if (name.equals("accessionIdentifier")) { 2256 this.accessionIdentifier = castToIdentifier(value); // Identifier 2257 } else if (name.equals("status")) { 2258 value = new SpecimenStatusEnumFactory().fromType(castToCode(value)); 2259 this.status = (Enumeration) value; // Enumeration<SpecimenStatus> 2260 } else if (name.equals("type")) { 2261 this.type = castToCodeableConcept(value); // CodeableConcept 2262 } else if (name.equals("subject")) { 2263 this.subject = castToReference(value); // Reference 2264 } else if (name.equals("receivedTime")) { 2265 this.receivedTime = castToDateTime(value); // DateTimeType 2266 } else if (name.equals("parent")) { 2267 this.getParent().add(castToReference(value)); 2268 } else if (name.equals("request")) { 2269 this.getRequest().add(castToReference(value)); 2270 } else if (name.equals("collection")) { 2271 this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent 2272 } else if (name.equals("processing")) { 2273 this.getProcessing().add((SpecimenProcessingComponent) value); 2274 } else if (name.equals("container")) { 2275 this.getContainer().add((SpecimenContainerComponent) value); 2276 } else if (name.equals("note")) { 2277 this.getNote().add(castToAnnotation(value)); 2278 } else 2279 return super.setProperty(name, value); 2280 return value; 2281 } 2282 2283 @Override 2284 public Base makeProperty(int hash, String name) throws FHIRException { 2285 switch (hash) { 2286 case -1618432855: return addIdentifier(); 2287 case 818734061: return getAccessionIdentifier(); 2288 case -892481550: return getStatusElement(); 2289 case 3575610: return getType(); 2290 case -1867885268: return getSubject(); 2291 case -767961010: return getReceivedTimeElement(); 2292 case -995424086: return addParent(); 2293 case 1095692943: return addRequest(); 2294 case -1741312354: return getCollection(); 2295 case 422194963: return addProcessing(); 2296 case -410956671: return addContainer(); 2297 case 3387378: return addNote(); 2298 default: return super.makeProperty(hash, name); 2299 } 2300 2301 } 2302 2303 @Override 2304 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2305 switch (hash) { 2306 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 2307 case 818734061: /*accessionIdentifier*/ return new String[] {"Identifier"}; 2308 case -892481550: /*status*/ return new String[] {"code"}; 2309 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 2310 case -1867885268: /*subject*/ return new String[] {"Reference"}; 2311 case -767961010: /*receivedTime*/ return new String[] {"dateTime"}; 2312 case -995424086: /*parent*/ return new String[] {"Reference"}; 2313 case 1095692943: /*request*/ return new String[] {"Reference"}; 2314 case -1741312354: /*collection*/ return new String[] {}; 2315 case 422194963: /*processing*/ return new String[] {}; 2316 case -410956671: /*container*/ return new String[] {}; 2317 case 3387378: /*note*/ return new String[] {"Annotation"}; 2318 default: return super.getTypesForProperty(hash, name); 2319 } 2320 2321 } 2322 2323 @Override 2324 public Base addChild(String name) throws FHIRException { 2325 if (name.equals("identifier")) { 2326 return addIdentifier(); 2327 } 2328 else if (name.equals("accessionIdentifier")) { 2329 this.accessionIdentifier = new Identifier(); 2330 return this.accessionIdentifier; 2331 } 2332 else if (name.equals("status")) { 2333 throw new FHIRException("Cannot call addChild on a primitive type Specimen.status"); 2334 } 2335 else if (name.equals("type")) { 2336 this.type = new CodeableConcept(); 2337 return this.type; 2338 } 2339 else if (name.equals("subject")) { 2340 this.subject = new Reference(); 2341 return this.subject; 2342 } 2343 else if (name.equals("receivedTime")) { 2344 throw new FHIRException("Cannot call addChild on a primitive type Specimen.receivedTime"); 2345 } 2346 else if (name.equals("parent")) { 2347 return addParent(); 2348 } 2349 else if (name.equals("request")) { 2350 return addRequest(); 2351 } 2352 else if (name.equals("collection")) { 2353 this.collection = new SpecimenCollectionComponent(); 2354 return this.collection; 2355 } 2356 else if (name.equals("processing")) { 2357 return addProcessing(); 2358 } 2359 else if (name.equals("container")) { 2360 return addContainer(); 2361 } 2362 else if (name.equals("note")) { 2363 return addNote(); 2364 } 2365 else 2366 return super.addChild(name); 2367 } 2368 2369 public String fhirType() { 2370 return "Specimen"; 2371 2372 } 2373 2374 public Specimen copy() { 2375 Specimen dst = new Specimen(); 2376 copyValues(dst); 2377 if (identifier != null) { 2378 dst.identifier = new ArrayList<Identifier>(); 2379 for (Identifier i : identifier) 2380 dst.identifier.add(i.copy()); 2381 }; 2382 dst.accessionIdentifier = accessionIdentifier == null ? null : accessionIdentifier.copy(); 2383 dst.status = status == null ? null : status.copy(); 2384 dst.type = type == null ? null : type.copy(); 2385 dst.subject = subject == null ? null : subject.copy(); 2386 dst.receivedTime = receivedTime == null ? null : receivedTime.copy(); 2387 if (parent != null) { 2388 dst.parent = new ArrayList<Reference>(); 2389 for (Reference i : parent) 2390 dst.parent.add(i.copy()); 2391 }; 2392 if (request != null) { 2393 dst.request = new ArrayList<Reference>(); 2394 for (Reference i : request) 2395 dst.request.add(i.copy()); 2396 }; 2397 dst.collection = collection == null ? null : collection.copy(); 2398 if (processing != null) { 2399 dst.processing = new ArrayList<SpecimenProcessingComponent>(); 2400 for (SpecimenProcessingComponent i : processing) 2401 dst.processing.add(i.copy()); 2402 }; 2403 if (container != null) { 2404 dst.container = new ArrayList<SpecimenContainerComponent>(); 2405 for (SpecimenContainerComponent i : container) 2406 dst.container.add(i.copy()); 2407 }; 2408 if (note != null) { 2409 dst.note = new ArrayList<Annotation>(); 2410 for (Annotation i : note) 2411 dst.note.add(i.copy()); 2412 }; 2413 return dst; 2414 } 2415 2416 protected Specimen typedCopy() { 2417 return copy(); 2418 } 2419 2420 @Override 2421 public boolean equalsDeep(Base other_) { 2422 if (!super.equalsDeep(other_)) 2423 return false; 2424 if (!(other_ instanceof Specimen)) 2425 return false; 2426 Specimen o = (Specimen) other_; 2427 return compareDeep(identifier, o.identifier, true) && compareDeep(accessionIdentifier, o.accessionIdentifier, true) 2428 && compareDeep(status, o.status, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true) 2429 && compareDeep(receivedTime, o.receivedTime, true) && compareDeep(parent, o.parent, true) && compareDeep(request, o.request, true) 2430 && compareDeep(collection, o.collection, true) && compareDeep(processing, o.processing, true) && compareDeep(container, o.container, true) 2431 && compareDeep(note, o.note, true); 2432 } 2433 2434 @Override 2435 public boolean equalsShallow(Base other_) { 2436 if (!super.equalsShallow(other_)) 2437 return false; 2438 if (!(other_ instanceof Specimen)) 2439 return false; 2440 Specimen o = (Specimen) other_; 2441 return compareValues(status, o.status, true) && compareValues(receivedTime, o.receivedTime, true); 2442 } 2443 2444 public boolean isEmpty() { 2445 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, accessionIdentifier 2446 , status, type, subject, receivedTime, parent, request, collection, processing 2447 , container, note); 2448 } 2449 2450 @Override 2451 public ResourceType getResourceType() { 2452 return ResourceType.Specimen; 2453 } 2454 2455 /** 2456 * Search parameter: <b>container</b> 2457 * <p> 2458 * Description: <b>The kind of specimen container</b><br> 2459 * Type: <b>token</b><br> 2460 * Path: <b>Specimen.container.type</b><br> 2461 * </p> 2462 */ 2463 @SearchParamDefinition(name="container", path="Specimen.container.type", description="The kind of specimen container", type="token" ) 2464 public static final String SP_CONTAINER = "container"; 2465 /** 2466 * <b>Fluent Client</b> search parameter constant for <b>container</b> 2467 * <p> 2468 * Description: <b>The kind of specimen container</b><br> 2469 * Type: <b>token</b><br> 2470 * Path: <b>Specimen.container.type</b><br> 2471 * </p> 2472 */ 2473 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTAINER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTAINER); 2474 2475 /** 2476 * Search parameter: <b>identifier</b> 2477 * <p> 2478 * Description: <b>The unique identifier associated with the specimen</b><br> 2479 * Type: <b>token</b><br> 2480 * Path: <b>Specimen.identifier</b><br> 2481 * </p> 2482 */ 2483 @SearchParamDefinition(name="identifier", path="Specimen.identifier", description="The unique identifier associated with the specimen", type="token" ) 2484 public static final String SP_IDENTIFIER = "identifier"; 2485 /** 2486 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2487 * <p> 2488 * Description: <b>The unique identifier associated with the specimen</b><br> 2489 * Type: <b>token</b><br> 2490 * Path: <b>Specimen.identifier</b><br> 2491 * </p> 2492 */ 2493 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 2494 2495 /** 2496 * Search parameter: <b>parent</b> 2497 * <p> 2498 * Description: <b>The parent of the specimen</b><br> 2499 * Type: <b>reference</b><br> 2500 * Path: <b>Specimen.parent</b><br> 2501 * </p> 2502 */ 2503 @SearchParamDefinition(name="parent", path="Specimen.parent", description="The parent of the specimen", type="reference", target={Specimen.class } ) 2504 public static final String SP_PARENT = "parent"; 2505 /** 2506 * <b>Fluent Client</b> search parameter constant for <b>parent</b> 2507 * <p> 2508 * Description: <b>The parent of the specimen</b><br> 2509 * Type: <b>reference</b><br> 2510 * Path: <b>Specimen.parent</b><br> 2511 * </p> 2512 */ 2513 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT); 2514 2515/** 2516 * Constant for fluent queries to be used to add include statements. Specifies 2517 * the path value of "<b>Specimen:parent</b>". 2518 */ 2519 public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("Specimen:parent").toLocked(); 2520 2521 /** 2522 * Search parameter: <b>container-id</b> 2523 * <p> 2524 * Description: <b>The unique identifier associated with the specimen container</b><br> 2525 * Type: <b>token</b><br> 2526 * Path: <b>Specimen.container.identifier</b><br> 2527 * </p> 2528 */ 2529 @SearchParamDefinition(name="container-id", path="Specimen.container.identifier", description="The unique identifier associated with the specimen container", type="token" ) 2530 public static final String SP_CONTAINER_ID = "container-id"; 2531 /** 2532 * <b>Fluent Client</b> search parameter constant for <b>container-id</b> 2533 * <p> 2534 * Description: <b>The unique identifier associated with the specimen container</b><br> 2535 * Type: <b>token</b><br> 2536 * Path: <b>Specimen.container.identifier</b><br> 2537 * </p> 2538 */ 2539 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTAINER_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTAINER_ID); 2540 2541 /** 2542 * Search parameter: <b>bodysite</b> 2543 * <p> 2544 * Description: <b>The code for the body site from where the specimen originated</b><br> 2545 * Type: <b>token</b><br> 2546 * Path: <b>Specimen.collection.bodySite</b><br> 2547 * </p> 2548 */ 2549 @SearchParamDefinition(name="bodysite", path="Specimen.collection.bodySite", description="The code for the body site from where the specimen originated", type="token" ) 2550 public static final String SP_BODYSITE = "bodysite"; 2551 /** 2552 * <b>Fluent Client</b> search parameter constant for <b>bodysite</b> 2553 * <p> 2554 * Description: <b>The code for the body site from where the specimen originated</b><br> 2555 * Type: <b>token</b><br> 2556 * Path: <b>Specimen.collection.bodySite</b><br> 2557 * </p> 2558 */ 2559 public static final ca.uhn.fhir.rest.gclient.TokenClientParam BODYSITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BODYSITE); 2560 2561 /** 2562 * Search parameter: <b>subject</b> 2563 * <p> 2564 * Description: <b>The subject of the specimen</b><br> 2565 * Type: <b>reference</b><br> 2566 * Path: <b>Specimen.subject</b><br> 2567 * </p> 2568 */ 2569 @SearchParamDefinition(name="subject", path="Specimen.subject", description="The subject of the specimen", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Device.class, Group.class, Location.class, Patient.class, Substance.class } ) 2570 public static final String SP_SUBJECT = "subject"; 2571 /** 2572 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 2573 * <p> 2574 * Description: <b>The subject of the specimen</b><br> 2575 * Type: <b>reference</b><br> 2576 * Path: <b>Specimen.subject</b><br> 2577 * </p> 2578 */ 2579 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 2580 2581/** 2582 * Constant for fluent queries to be used to add include statements. Specifies 2583 * the path value of "<b>Specimen:subject</b>". 2584 */ 2585 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Specimen:subject").toLocked(); 2586 2587 /** 2588 * Search parameter: <b>patient</b> 2589 * <p> 2590 * Description: <b>The patient the specimen comes from</b><br> 2591 * Type: <b>reference</b><br> 2592 * Path: <b>Specimen.subject</b><br> 2593 * </p> 2594 */ 2595 @SearchParamDefinition(name="patient", path="Specimen.subject", description="The patient the specimen comes from", type="reference", target={Patient.class } ) 2596 public static final String SP_PATIENT = "patient"; 2597 /** 2598 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 2599 * <p> 2600 * Description: <b>The patient the specimen comes from</b><br> 2601 * Type: <b>reference</b><br> 2602 * Path: <b>Specimen.subject</b><br> 2603 * </p> 2604 */ 2605 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 2606 2607/** 2608 * Constant for fluent queries to be used to add include statements. Specifies 2609 * the path value of "<b>Specimen:patient</b>". 2610 */ 2611 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Specimen:patient").toLocked(); 2612 2613 /** 2614 * Search parameter: <b>collected</b> 2615 * <p> 2616 * Description: <b>The date the specimen was collected</b><br> 2617 * Type: <b>date</b><br> 2618 * Path: <b>Specimen.collection.collected[x]</b><br> 2619 * </p> 2620 */ 2621 @SearchParamDefinition(name="collected", path="Specimen.collection.collected", description="The date the specimen was collected", type="date" ) 2622 public static final String SP_COLLECTED = "collected"; 2623 /** 2624 * <b>Fluent Client</b> search parameter constant for <b>collected</b> 2625 * <p> 2626 * Description: <b>The date the specimen was collected</b><br> 2627 * Type: <b>date</b><br> 2628 * Path: <b>Specimen.collection.collected[x]</b><br> 2629 * </p> 2630 */ 2631 public static final ca.uhn.fhir.rest.gclient.DateClientParam COLLECTED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_COLLECTED); 2632 2633 /** 2634 * Search parameter: <b>accession</b> 2635 * <p> 2636 * Description: <b>The accession number associated with the specimen</b><br> 2637 * Type: <b>token</b><br> 2638 * Path: <b>Specimen.accessionIdentifier</b><br> 2639 * </p> 2640 */ 2641 @SearchParamDefinition(name="accession", path="Specimen.accessionIdentifier", description="The accession number associated with the specimen", type="token" ) 2642 public static final String SP_ACCESSION = "accession"; 2643 /** 2644 * <b>Fluent Client</b> search parameter constant for <b>accession</b> 2645 * <p> 2646 * Description: <b>The accession number associated with the specimen</b><br> 2647 * Type: <b>token</b><br> 2648 * Path: <b>Specimen.accessionIdentifier</b><br> 2649 * </p> 2650 */ 2651 public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACCESSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACCESSION); 2652 2653 /** 2654 * Search parameter: <b>type</b> 2655 * <p> 2656 * Description: <b>The specimen type</b><br> 2657 * Type: <b>token</b><br> 2658 * Path: <b>Specimen.type</b><br> 2659 * </p> 2660 */ 2661 @SearchParamDefinition(name="type", path="Specimen.type", description="The specimen type", type="token" ) 2662 public static final String SP_TYPE = "type"; 2663 /** 2664 * <b>Fluent Client</b> search parameter constant for <b>type</b> 2665 * <p> 2666 * Description: <b>The specimen type</b><br> 2667 * Type: <b>token</b><br> 2668 * Path: <b>Specimen.type</b><br> 2669 * </p> 2670 */ 2671 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 2672 2673 /** 2674 * Search parameter: <b>collector</b> 2675 * <p> 2676 * Description: <b>Who collected the specimen</b><br> 2677 * Type: <b>reference</b><br> 2678 * Path: <b>Specimen.collection.collector</b><br> 2679 * </p> 2680 */ 2681 @SearchParamDefinition(name="collector", path="Specimen.collection.collector", description="Who collected the specimen", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } ) 2682 public static final String SP_COLLECTOR = "collector"; 2683 /** 2684 * <b>Fluent Client</b> search parameter constant for <b>collector</b> 2685 * <p> 2686 * Description: <b>Who collected the specimen</b><br> 2687 * Type: <b>reference</b><br> 2688 * Path: <b>Specimen.collection.collector</b><br> 2689 * </p> 2690 */ 2691 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COLLECTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COLLECTOR); 2692 2693/** 2694 * Constant for fluent queries to be used to add include statements. Specifies 2695 * the path value of "<b>Specimen:collector</b>". 2696 */ 2697 public static final ca.uhn.fhir.model.api.Include INCLUDE_COLLECTOR = new ca.uhn.fhir.model.api.Include("Specimen:collector").toLocked(); 2698 2699 /** 2700 * Search parameter: <b>status</b> 2701 * <p> 2702 * Description: <b>available | unavailable | unsatisfactory | entered-in-error</b><br> 2703 * Type: <b>token</b><br> 2704 * Path: <b>Specimen.status</b><br> 2705 * </p> 2706 */ 2707 @SearchParamDefinition(name="status", path="Specimen.status", description="available | unavailable | unsatisfactory | entered-in-error", type="token" ) 2708 public static final String SP_STATUS = "status"; 2709 /** 2710 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2711 * <p> 2712 * Description: <b>available | unavailable | unsatisfactory | entered-in-error</b><br> 2713 * Type: <b>token</b><br> 2714 * Path: <b>Specimen.status</b><br> 2715 * </p> 2716 */ 2717 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 2718 2719 2720} 2721