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