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