![](/hapi-fhir/images/logos/raccoon-forwards.png)
001package org.hl7.fhir.r4.model; 002 003import java.math.BigDecimal; 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 035import java.util.ArrayList; 036import java.util.List; 037 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 040import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender; 041import org.hl7.fhir.r4.model.Enumerations.AdministrativeGenderEnumFactory; 042import org.hl7.fhir.utilities.Utilities; 043 044import ca.uhn.fhir.model.api.annotation.Block; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.Description; 047import ca.uhn.fhir.model.api.annotation.ResourceDef; 048 049/** 050 * Set of definitional characteristics for a kind of observation or measurement 051 * produced or consumed by an orderable health care service. 052 */ 053@ResourceDef(name = "ObservationDefinition", profile = "http://hl7.org/fhir/StructureDefinition/ObservationDefinition") 054public class ObservationDefinition extends DomainResource { 055 056 public enum ObservationDataType { 057 /** 058 * A measured amount. 059 */ 060 QUANTITY, 061 /** 062 * A coded concept from a reference terminology and/or text. 063 */ 064 CODEABLECONCEPT, 065 /** 066 * A sequence of Unicode characters. 067 */ 068 STRING, 069 /** 070 * true or false. 071 */ 072 BOOLEAN, 073 /** 074 * A signed integer. 075 */ 076 INTEGER, 077 /** 078 * A set of values bounded by low and high. 079 */ 080 RANGE, 081 /** 082 * A ratio of two Quantity values - a numerator and a denominator. 083 */ 084 RATIO, 085 /** 086 * A series of measurements taken by a device. 087 */ 088 SAMPLEDDATA, 089 /** 090 * A time during the day, in the format hh:mm:ss. 091 */ 092 TIME, 093 /** 094 * A date, date-time or partial date (e.g. just year or year + month) as used in 095 * human communication. 096 */ 097 DATETIME, 098 /** 099 * A time range defined by start and end date/time. 100 */ 101 PERIOD, 102 /** 103 * added to help the parsers with the generic types 104 */ 105 NULL; 106 107 public static ObservationDataType fromCode(String codeString) throws FHIRException { 108 if (codeString == null || "".equals(codeString)) 109 return null; 110 if ("Quantity".equals(codeString)) 111 return QUANTITY; 112 if ("CodeableConcept".equals(codeString)) 113 return CODEABLECONCEPT; 114 if ("string".equals(codeString)) 115 return STRING; 116 if ("boolean".equals(codeString)) 117 return BOOLEAN; 118 if ("integer".equals(codeString)) 119 return INTEGER; 120 if ("Range".equals(codeString)) 121 return RANGE; 122 if ("Ratio".equals(codeString)) 123 return RATIO; 124 if ("SampledData".equals(codeString)) 125 return SAMPLEDDATA; 126 if ("time".equals(codeString)) 127 return TIME; 128 if ("dateTime".equals(codeString)) 129 return DATETIME; 130 if ("Period".equals(codeString)) 131 return PERIOD; 132 if (Configuration.isAcceptInvalidEnums()) 133 return null; 134 else 135 throw new FHIRException("Unknown ObservationDataType code '" + codeString + "'"); 136 } 137 138 public String toCode() { 139 switch (this) { 140 case QUANTITY: 141 return "Quantity"; 142 case CODEABLECONCEPT: 143 return "CodeableConcept"; 144 case STRING: 145 return "string"; 146 case BOOLEAN: 147 return "boolean"; 148 case INTEGER: 149 return "integer"; 150 case RANGE: 151 return "Range"; 152 case RATIO: 153 return "Ratio"; 154 case SAMPLEDDATA: 155 return "SampledData"; 156 case TIME: 157 return "time"; 158 case DATETIME: 159 return "dateTime"; 160 case PERIOD: 161 return "Period"; 162 case NULL: 163 return null; 164 default: 165 return "?"; 166 } 167 } 168 169 public String getSystem() { 170 switch (this) { 171 case QUANTITY: 172 return "http://hl7.org/fhir/permitted-data-type"; 173 case CODEABLECONCEPT: 174 return "http://hl7.org/fhir/permitted-data-type"; 175 case STRING: 176 return "http://hl7.org/fhir/permitted-data-type"; 177 case BOOLEAN: 178 return "http://hl7.org/fhir/permitted-data-type"; 179 case INTEGER: 180 return "http://hl7.org/fhir/permitted-data-type"; 181 case RANGE: 182 return "http://hl7.org/fhir/permitted-data-type"; 183 case RATIO: 184 return "http://hl7.org/fhir/permitted-data-type"; 185 case SAMPLEDDATA: 186 return "http://hl7.org/fhir/permitted-data-type"; 187 case TIME: 188 return "http://hl7.org/fhir/permitted-data-type"; 189 case DATETIME: 190 return "http://hl7.org/fhir/permitted-data-type"; 191 case PERIOD: 192 return "http://hl7.org/fhir/permitted-data-type"; 193 case NULL: 194 return null; 195 default: 196 return "?"; 197 } 198 } 199 200 public String getDefinition() { 201 switch (this) { 202 case QUANTITY: 203 return "A measured amount."; 204 case CODEABLECONCEPT: 205 return "A coded concept from a reference terminology and/or text."; 206 case STRING: 207 return "A sequence of Unicode characters."; 208 case BOOLEAN: 209 return "true or false."; 210 case INTEGER: 211 return "A signed integer."; 212 case RANGE: 213 return "A set of values bounded by low and high."; 214 case RATIO: 215 return "A ratio of two Quantity values - a numerator and a denominator."; 216 case SAMPLEDDATA: 217 return "A series of measurements taken by a device."; 218 case TIME: 219 return "A time during the day, in the format hh:mm:ss."; 220 case DATETIME: 221 return "A date, date-time or partial date (e.g. just year or year + month) as used in human communication."; 222 case PERIOD: 223 return "A time range defined by start and end date/time."; 224 case NULL: 225 return null; 226 default: 227 return "?"; 228 } 229 } 230 231 public String getDisplay() { 232 switch (this) { 233 case QUANTITY: 234 return "Quantity"; 235 case CODEABLECONCEPT: 236 return "CodeableConcept"; 237 case STRING: 238 return "string"; 239 case BOOLEAN: 240 return "boolean"; 241 case INTEGER: 242 return "integer"; 243 case RANGE: 244 return "Range"; 245 case RATIO: 246 return "Ratio"; 247 case SAMPLEDDATA: 248 return "SampledData"; 249 case TIME: 250 return "time"; 251 case DATETIME: 252 return "dateTime"; 253 case PERIOD: 254 return "Period"; 255 case NULL: 256 return null; 257 default: 258 return "?"; 259 } 260 } 261 } 262 263 public static class ObservationDataTypeEnumFactory implements EnumFactory<ObservationDataType> { 264 public ObservationDataType fromCode(String codeString) throws IllegalArgumentException { 265 if (codeString == null || "".equals(codeString)) 266 if (codeString == null || "".equals(codeString)) 267 return null; 268 if ("Quantity".equals(codeString)) 269 return ObservationDataType.QUANTITY; 270 if ("CodeableConcept".equals(codeString)) 271 return ObservationDataType.CODEABLECONCEPT; 272 if ("string".equals(codeString)) 273 return ObservationDataType.STRING; 274 if ("boolean".equals(codeString)) 275 return ObservationDataType.BOOLEAN; 276 if ("integer".equals(codeString)) 277 return ObservationDataType.INTEGER; 278 if ("Range".equals(codeString)) 279 return ObservationDataType.RANGE; 280 if ("Ratio".equals(codeString)) 281 return ObservationDataType.RATIO; 282 if ("SampledData".equals(codeString)) 283 return ObservationDataType.SAMPLEDDATA; 284 if ("time".equals(codeString)) 285 return ObservationDataType.TIME; 286 if ("dateTime".equals(codeString)) 287 return ObservationDataType.DATETIME; 288 if ("Period".equals(codeString)) 289 return ObservationDataType.PERIOD; 290 throw new IllegalArgumentException("Unknown ObservationDataType code '" + codeString + "'"); 291 } 292 293 public Enumeration<ObservationDataType> fromType(PrimitiveType<?> code) throws FHIRException { 294 if (code == null) 295 return null; 296 if (code.isEmpty()) 297 return new Enumeration<ObservationDataType>(this, ObservationDataType.NULL, code); 298 String codeString = code.asStringValue(); 299 if (codeString == null || "".equals(codeString)) 300 return new Enumeration<ObservationDataType>(this, ObservationDataType.NULL, code); 301 if ("Quantity".equals(codeString)) 302 return new Enumeration<ObservationDataType>(this, ObservationDataType.QUANTITY, code); 303 if ("CodeableConcept".equals(codeString)) 304 return new Enumeration<ObservationDataType>(this, ObservationDataType.CODEABLECONCEPT, code); 305 if ("string".equals(codeString)) 306 return new Enumeration<ObservationDataType>(this, ObservationDataType.STRING, code); 307 if ("boolean".equals(codeString)) 308 return new Enumeration<ObservationDataType>(this, ObservationDataType.BOOLEAN, code); 309 if ("integer".equals(codeString)) 310 return new Enumeration<ObservationDataType>(this, ObservationDataType.INTEGER, code); 311 if ("Range".equals(codeString)) 312 return new Enumeration<ObservationDataType>(this, ObservationDataType.RANGE, code); 313 if ("Ratio".equals(codeString)) 314 return new Enumeration<ObservationDataType>(this, ObservationDataType.RATIO, code); 315 if ("SampledData".equals(codeString)) 316 return new Enumeration<ObservationDataType>(this, ObservationDataType.SAMPLEDDATA, code); 317 if ("time".equals(codeString)) 318 return new Enumeration<ObservationDataType>(this, ObservationDataType.TIME, code); 319 if ("dateTime".equals(codeString)) 320 return new Enumeration<ObservationDataType>(this, ObservationDataType.DATETIME, code); 321 if ("Period".equals(codeString)) 322 return new Enumeration<ObservationDataType>(this, ObservationDataType.PERIOD, code); 323 throw new FHIRException("Unknown ObservationDataType code '" + codeString + "'"); 324 } 325 326 public String toCode(ObservationDataType code) { 327 if (code == ObservationDataType.QUANTITY) 328 return "Quantity"; 329 if (code == ObservationDataType.CODEABLECONCEPT) 330 return "CodeableConcept"; 331 if (code == ObservationDataType.STRING) 332 return "string"; 333 if (code == ObservationDataType.BOOLEAN) 334 return "boolean"; 335 if (code == ObservationDataType.INTEGER) 336 return "integer"; 337 if (code == ObservationDataType.RANGE) 338 return "Range"; 339 if (code == ObservationDataType.RATIO) 340 return "Ratio"; 341 if (code == ObservationDataType.SAMPLEDDATA) 342 return "SampledData"; 343 if (code == ObservationDataType.TIME) 344 return "time"; 345 if (code == ObservationDataType.DATETIME) 346 return "dateTime"; 347 if (code == ObservationDataType.PERIOD) 348 return "Period"; 349 return "?"; 350 } 351 352 public String toSystem(ObservationDataType code) { 353 return code.getSystem(); 354 } 355 } 356 357 public enum ObservationRangeCategory { 358 /** 359 * Reference (Normal) Range for Ordinal and Continuous Observations. 360 */ 361 REFERENCE, 362 /** 363 * Critical Range for Ordinal and Continuous Observations. 364 */ 365 CRITICAL, 366 /** 367 * Absolute Range for Ordinal and Continuous Observations. Results outside this 368 * range are not possible. 369 */ 370 ABSOLUTE, 371 /** 372 * added to help the parsers with the generic types 373 */ 374 NULL; 375 376 public static ObservationRangeCategory fromCode(String codeString) throws FHIRException { 377 if (codeString == null || "".equals(codeString)) 378 return null; 379 if ("reference".equals(codeString)) 380 return REFERENCE; 381 if ("critical".equals(codeString)) 382 return CRITICAL; 383 if ("absolute".equals(codeString)) 384 return ABSOLUTE; 385 if (Configuration.isAcceptInvalidEnums()) 386 return null; 387 else 388 throw new FHIRException("Unknown ObservationRangeCategory code '" + codeString + "'"); 389 } 390 391 public String toCode() { 392 switch (this) { 393 case REFERENCE: 394 return "reference"; 395 case CRITICAL: 396 return "critical"; 397 case ABSOLUTE: 398 return "absolute"; 399 case NULL: 400 return null; 401 default: 402 return "?"; 403 } 404 } 405 406 public String getSystem() { 407 switch (this) { 408 case REFERENCE: 409 return "http://hl7.org/fhir/observation-range-category"; 410 case CRITICAL: 411 return "http://hl7.org/fhir/observation-range-category"; 412 case ABSOLUTE: 413 return "http://hl7.org/fhir/observation-range-category"; 414 case NULL: 415 return null; 416 default: 417 return "?"; 418 } 419 } 420 421 public String getDefinition() { 422 switch (this) { 423 case REFERENCE: 424 return "Reference (Normal) Range for Ordinal and Continuous Observations."; 425 case CRITICAL: 426 return "Critical Range for Ordinal and Continuous Observations."; 427 case ABSOLUTE: 428 return "Absolute Range for Ordinal and Continuous Observations. Results outside this range are not possible."; 429 case NULL: 430 return null; 431 default: 432 return "?"; 433 } 434 } 435 436 public String getDisplay() { 437 switch (this) { 438 case REFERENCE: 439 return "reference range"; 440 case CRITICAL: 441 return "critical range"; 442 case ABSOLUTE: 443 return "absolute range"; 444 case NULL: 445 return null; 446 default: 447 return "?"; 448 } 449 } 450 } 451 452 public static class ObservationRangeCategoryEnumFactory implements EnumFactory<ObservationRangeCategory> { 453 public ObservationRangeCategory fromCode(String codeString) throws IllegalArgumentException { 454 if (codeString == null || "".equals(codeString)) 455 if (codeString == null || "".equals(codeString)) 456 return null; 457 if ("reference".equals(codeString)) 458 return ObservationRangeCategory.REFERENCE; 459 if ("critical".equals(codeString)) 460 return ObservationRangeCategory.CRITICAL; 461 if ("absolute".equals(codeString)) 462 return ObservationRangeCategory.ABSOLUTE; 463 throw new IllegalArgumentException("Unknown ObservationRangeCategory code '" + codeString + "'"); 464 } 465 466 public Enumeration<ObservationRangeCategory> fromType(PrimitiveType<?> code) throws FHIRException { 467 if (code == null) 468 return null; 469 if (code.isEmpty()) 470 return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.NULL, code); 471 String codeString = code.asStringValue(); 472 if (codeString == null || "".equals(codeString)) 473 return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.NULL, code); 474 if ("reference".equals(codeString)) 475 return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.REFERENCE, code); 476 if ("critical".equals(codeString)) 477 return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.CRITICAL, code); 478 if ("absolute".equals(codeString)) 479 return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.ABSOLUTE, code); 480 throw new FHIRException("Unknown ObservationRangeCategory code '" + codeString + "'"); 481 } 482 483 public String toCode(ObservationRangeCategory code) { 484 if (code == ObservationRangeCategory.REFERENCE) 485 return "reference"; 486 if (code == ObservationRangeCategory.CRITICAL) 487 return "critical"; 488 if (code == ObservationRangeCategory.ABSOLUTE) 489 return "absolute"; 490 return "?"; 491 } 492 493 public String toSystem(ObservationRangeCategory code) { 494 return code.getSystem(); 495 } 496 } 497 498 @Block() 499 public static class ObservationDefinitionQuantitativeDetailsComponent extends BackboneElement 500 implements IBaseBackboneElement { 501 /** 502 * Customary unit used to report quantitative results of observations conforming 503 * to this ObservationDefinition. 504 */ 505 @Child(name = "customaryUnit", type = { 506 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false) 507 @Description(shortDefinition = "Customary unit for quantitative results", formalDefinition = "Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.") 508 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ucum-units") 509 protected CodeableConcept customaryUnit; 510 511 /** 512 * SI unit used to report quantitative results of observations conforming to 513 * this ObservationDefinition. 514 */ 515 @Child(name = "unit", type = { 516 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false) 517 @Description(shortDefinition = "SI unit for quantitative results", formalDefinition = "SI unit used to report quantitative results of observations conforming to this ObservationDefinition.") 518 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ucum-units") 519 protected CodeableConcept unit; 520 521 /** 522 * Factor for converting value expressed with SI unit to value expressed with 523 * customary unit. 524 */ 525 @Child(name = "conversionFactor", type = { 526 DecimalType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false) 527 @Description(shortDefinition = "SI to Customary unit conversion factor", formalDefinition = "Factor for converting value expressed with SI unit to value expressed with customary unit.") 528 protected DecimalType conversionFactor; 529 530 /** 531 * Number of digits after decimal separator when the results of such 532 * observations are of type Quantity. 533 */ 534 @Child(name = "decimalPrecision", type = { 535 IntegerType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false) 536 @Description(shortDefinition = "Decimal precision of observation quantitative results", formalDefinition = "Number of digits after decimal separator when the results of such observations are of type Quantity.") 537 protected IntegerType decimalPrecision; 538 539 private static final long serialVersionUID = 1790019610L; 540 541 /** 542 * Constructor 543 */ 544 public ObservationDefinitionQuantitativeDetailsComponent() { 545 super(); 546 } 547 548 /** 549 * @return {@link #customaryUnit} (Customary unit used to report quantitative 550 * results of observations conforming to this ObservationDefinition.) 551 */ 552 public CodeableConcept getCustomaryUnit() { 553 if (this.customaryUnit == null) 554 if (Configuration.errorOnAutoCreate()) 555 throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.customaryUnit"); 556 else if (Configuration.doAutoCreate()) 557 this.customaryUnit = new CodeableConcept(); // cc 558 return this.customaryUnit; 559 } 560 561 public boolean hasCustomaryUnit() { 562 return this.customaryUnit != null && !this.customaryUnit.isEmpty(); 563 } 564 565 /** 566 * @param value {@link #customaryUnit} (Customary unit used to report 567 * quantitative results of observations conforming to this 568 * ObservationDefinition.) 569 */ 570 public ObservationDefinitionQuantitativeDetailsComponent setCustomaryUnit(CodeableConcept value) { 571 this.customaryUnit = value; 572 return this; 573 } 574 575 /** 576 * @return {@link #unit} (SI unit used to report quantitative results of 577 * observations conforming to this ObservationDefinition.) 578 */ 579 public CodeableConcept getUnit() { 580 if (this.unit == null) 581 if (Configuration.errorOnAutoCreate()) 582 throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.unit"); 583 else if (Configuration.doAutoCreate()) 584 this.unit = new CodeableConcept(); // cc 585 return this.unit; 586 } 587 588 public boolean hasUnit() { 589 return this.unit != null && !this.unit.isEmpty(); 590 } 591 592 /** 593 * @param value {@link #unit} (SI unit used to report quantitative results of 594 * observations conforming to this ObservationDefinition.) 595 */ 596 public ObservationDefinitionQuantitativeDetailsComponent setUnit(CodeableConcept value) { 597 this.unit = value; 598 return this; 599 } 600 601 /** 602 * @return {@link #conversionFactor} (Factor for converting value expressed with 603 * SI unit to value expressed with customary unit.). This is the 604 * underlying object with id, value and extensions. The accessor 605 * "getConversionFactor" gives direct access to the value 606 */ 607 public DecimalType getConversionFactorElement() { 608 if (this.conversionFactor == null) 609 if (Configuration.errorOnAutoCreate()) 610 throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.conversionFactor"); 611 else if (Configuration.doAutoCreate()) 612 this.conversionFactor = new DecimalType(); // bb 613 return this.conversionFactor; 614 } 615 616 public boolean hasConversionFactorElement() { 617 return this.conversionFactor != null && !this.conversionFactor.isEmpty(); 618 } 619 620 public boolean hasConversionFactor() { 621 return this.conversionFactor != null && !this.conversionFactor.isEmpty(); 622 } 623 624 /** 625 * @param value {@link #conversionFactor} (Factor for converting value expressed 626 * with SI unit to value expressed with customary unit.). This is 627 * the underlying object with id, value and extensions. The 628 * accessor "getConversionFactor" gives direct access to the value 629 */ 630 public ObservationDefinitionQuantitativeDetailsComponent setConversionFactorElement(DecimalType value) { 631 this.conversionFactor = value; 632 return this; 633 } 634 635 /** 636 * @return Factor for converting value expressed with SI unit to value expressed 637 * with customary unit. 638 */ 639 public BigDecimal getConversionFactor() { 640 return this.conversionFactor == null ? null : this.conversionFactor.getValue(); 641 } 642 643 /** 644 * @param value Factor for converting value expressed with SI unit to value 645 * expressed with customary unit. 646 */ 647 public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(BigDecimal value) { 648 if (value == null) 649 this.conversionFactor = null; 650 else { 651 if (this.conversionFactor == null) 652 this.conversionFactor = new DecimalType(); 653 this.conversionFactor.setValue(value); 654 } 655 return this; 656 } 657 658 /** 659 * @param value Factor for converting value expressed with SI unit to value 660 * expressed with customary unit. 661 */ 662 public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(long value) { 663 this.conversionFactor = new DecimalType(); 664 this.conversionFactor.setValue(value); 665 return this; 666 } 667 668 /** 669 * @param value Factor for converting value expressed with SI unit to value 670 * expressed with customary unit. 671 */ 672 public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(double value) { 673 this.conversionFactor = new DecimalType(); 674 this.conversionFactor.setValue(value); 675 return this; 676 } 677 678 /** 679 * @return {@link #decimalPrecision} (Number of digits after decimal separator 680 * when the results of such observations are of type Quantity.). This is 681 * the underlying object with id, value and extensions. The accessor 682 * "getDecimalPrecision" gives direct access to the value 683 */ 684 public IntegerType getDecimalPrecisionElement() { 685 if (this.decimalPrecision == null) 686 if (Configuration.errorOnAutoCreate()) 687 throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.decimalPrecision"); 688 else if (Configuration.doAutoCreate()) 689 this.decimalPrecision = new IntegerType(); // bb 690 return this.decimalPrecision; 691 } 692 693 public boolean hasDecimalPrecisionElement() { 694 return this.decimalPrecision != null && !this.decimalPrecision.isEmpty(); 695 } 696 697 public boolean hasDecimalPrecision() { 698 return this.decimalPrecision != null && !this.decimalPrecision.isEmpty(); 699 } 700 701 /** 702 * @param value {@link #decimalPrecision} (Number of digits after decimal 703 * separator when the results of such observations are of type 704 * Quantity.). This is the underlying object with id, value and 705 * extensions. The accessor "getDecimalPrecision" gives direct 706 * access to the value 707 */ 708 public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecisionElement(IntegerType value) { 709 this.decimalPrecision = value; 710 return this; 711 } 712 713 /** 714 * @return Number of digits after decimal separator when the results of such 715 * observations are of type Quantity. 716 */ 717 public int getDecimalPrecision() { 718 return this.decimalPrecision == null || this.decimalPrecision.isEmpty() ? 0 : this.decimalPrecision.getValue(); 719 } 720 721 /** 722 * @param value Number of digits after decimal separator when the results of 723 * such observations are of type Quantity. 724 */ 725 public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecision(int value) { 726 if (this.decimalPrecision == null) 727 this.decimalPrecision = new IntegerType(); 728 this.decimalPrecision.setValue(value); 729 return this; 730 } 731 732 protected void listChildren(List<Property> children) { 733 super.listChildren(children); 734 children.add(new Property("customaryUnit", "CodeableConcept", 735 "Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 736 0, 1, customaryUnit)); 737 children.add(new Property("unit", "CodeableConcept", 738 "SI unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, 739 unit)); 740 children.add(new Property("conversionFactor", "decimal", 741 "Factor for converting value expressed with SI unit to value expressed with customary unit.", 0, 1, 742 conversionFactor)); 743 children.add(new Property("decimalPrecision", "integer", 744 "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 1, 745 decimalPrecision)); 746 } 747 748 @Override 749 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 750 switch (_hash) { 751 case -1375586437: 752 /* customaryUnit */ return new Property("customaryUnit", "CodeableConcept", 753 "Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 754 0, 1, customaryUnit); 755 case 3594628: 756 /* unit */ return new Property("unit", "CodeableConcept", 757 "SI unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 758 1, unit); 759 case 1438876165: 760 /* conversionFactor */ return new Property("conversionFactor", "decimal", 761 "Factor for converting value expressed with SI unit to value expressed with customary unit.", 0, 1, 762 conversionFactor); 763 case -1564447699: 764 /* decimalPrecision */ return new Property("decimalPrecision", "integer", 765 "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 766 1, decimalPrecision); 767 default: 768 return super.getNamedProperty(_hash, _name, _checkValid); 769 } 770 771 } 772 773 @Override 774 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 775 switch (hash) { 776 case -1375586437: 777 /* customaryUnit */ return this.customaryUnit == null ? new Base[0] : new Base[] { this.customaryUnit }; // CodeableConcept 778 case 3594628: 779 /* unit */ return this.unit == null ? new Base[0] : new Base[] { this.unit }; // CodeableConcept 780 case 1438876165: 781 /* conversionFactor */ return this.conversionFactor == null ? new Base[0] 782 : new Base[] { this.conversionFactor }; // DecimalType 783 case -1564447699: 784 /* decimalPrecision */ return this.decimalPrecision == null ? new Base[0] 785 : new Base[] { this.decimalPrecision }; // IntegerType 786 default: 787 return super.getProperty(hash, name, checkValid); 788 } 789 790 } 791 792 @Override 793 public Base setProperty(int hash, String name, Base value) throws FHIRException { 794 switch (hash) { 795 case -1375586437: // customaryUnit 796 this.customaryUnit = castToCodeableConcept(value); // CodeableConcept 797 return value; 798 case 3594628: // unit 799 this.unit = castToCodeableConcept(value); // CodeableConcept 800 return value; 801 case 1438876165: // conversionFactor 802 this.conversionFactor = castToDecimal(value); // DecimalType 803 return value; 804 case -1564447699: // decimalPrecision 805 this.decimalPrecision = castToInteger(value); // IntegerType 806 return value; 807 default: 808 return super.setProperty(hash, name, value); 809 } 810 811 } 812 813 @Override 814 public Base setProperty(String name, Base value) throws FHIRException { 815 if (name.equals("customaryUnit")) { 816 this.customaryUnit = castToCodeableConcept(value); // CodeableConcept 817 } else if (name.equals("unit")) { 818 this.unit = castToCodeableConcept(value); // CodeableConcept 819 } else if (name.equals("conversionFactor")) { 820 this.conversionFactor = castToDecimal(value); // DecimalType 821 } else if (name.equals("decimalPrecision")) { 822 this.decimalPrecision = castToInteger(value); // IntegerType 823 } else 824 return super.setProperty(name, value); 825 return value; 826 } 827 828 @Override 829 public void removeChild(String name, Base value) throws FHIRException { 830 if (name.equals("customaryUnit")) { 831 this.customaryUnit = null; 832 } else if (name.equals("unit")) { 833 this.unit = null; 834 } else if (name.equals("conversionFactor")) { 835 this.conversionFactor = null; 836 } else if (name.equals("decimalPrecision")) { 837 this.decimalPrecision = null; 838 } else 839 super.removeChild(name, value); 840 841 } 842 843 @Override 844 public Base makeProperty(int hash, String name) throws FHIRException { 845 switch (hash) { 846 case -1375586437: 847 return getCustomaryUnit(); 848 case 3594628: 849 return getUnit(); 850 case 1438876165: 851 return getConversionFactorElement(); 852 case -1564447699: 853 return getDecimalPrecisionElement(); 854 default: 855 return super.makeProperty(hash, name); 856 } 857 858 } 859 860 @Override 861 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 862 switch (hash) { 863 case -1375586437: 864 /* customaryUnit */ return new String[] { "CodeableConcept" }; 865 case 3594628: 866 /* unit */ return new String[] { "CodeableConcept" }; 867 case 1438876165: 868 /* conversionFactor */ return new String[] { "decimal" }; 869 case -1564447699: 870 /* decimalPrecision */ return new String[] { "integer" }; 871 default: 872 return super.getTypesForProperty(hash, name); 873 } 874 875 } 876 877 @Override 878 public Base addChild(String name) throws FHIRException { 879 if (name.equals("customaryUnit")) { 880 this.customaryUnit = new CodeableConcept(); 881 return this.customaryUnit; 882 } else if (name.equals("unit")) { 883 this.unit = new CodeableConcept(); 884 return this.unit; 885 } else if (name.equals("conversionFactor")) { 886 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.conversionFactor"); 887 } else if (name.equals("decimalPrecision")) { 888 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.decimalPrecision"); 889 } else 890 return super.addChild(name); 891 } 892 893 public ObservationDefinitionQuantitativeDetailsComponent copy() { 894 ObservationDefinitionQuantitativeDetailsComponent dst = new ObservationDefinitionQuantitativeDetailsComponent(); 895 copyValues(dst); 896 return dst; 897 } 898 899 public void copyValues(ObservationDefinitionQuantitativeDetailsComponent dst) { 900 super.copyValues(dst); 901 dst.customaryUnit = customaryUnit == null ? null : customaryUnit.copy(); 902 dst.unit = unit == null ? null : unit.copy(); 903 dst.conversionFactor = conversionFactor == null ? null : conversionFactor.copy(); 904 dst.decimalPrecision = decimalPrecision == null ? null : decimalPrecision.copy(); 905 } 906 907 @Override 908 public boolean equalsDeep(Base other_) { 909 if (!super.equalsDeep(other_)) 910 return false; 911 if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent)) 912 return false; 913 ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_; 914 return compareDeep(customaryUnit, o.customaryUnit, true) && compareDeep(unit, o.unit, true) 915 && compareDeep(conversionFactor, o.conversionFactor, true) 916 && compareDeep(decimalPrecision, o.decimalPrecision, true); 917 } 918 919 @Override 920 public boolean equalsShallow(Base other_) { 921 if (!super.equalsShallow(other_)) 922 return false; 923 if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent)) 924 return false; 925 ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_; 926 return compareValues(conversionFactor, o.conversionFactor, true) 927 && compareValues(decimalPrecision, o.decimalPrecision, true); 928 } 929 930 public boolean isEmpty() { 931 return super.isEmpty() 932 && ca.uhn.fhir.util.ElementUtil.isEmpty(customaryUnit, unit, conversionFactor, decimalPrecision); 933 } 934 935 public String fhirType() { 936 return "ObservationDefinition.quantitativeDetails"; 937 938 } 939 940 } 941 942 @Block() 943 public static class ObservationDefinitionQualifiedIntervalComponent extends BackboneElement 944 implements IBaseBackboneElement { 945 /** 946 * The category of interval of values for continuous or ordinal observations 947 * conforming to this ObservationDefinition. 948 */ 949 @Child(name = "category", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false) 950 @Description(shortDefinition = "reference | critical | absolute", formalDefinition = "The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.") 951 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-range-category") 952 protected Enumeration<ObservationRangeCategory> category; 953 954 /** 955 * The low and high values determining the interval. There may be only one of 956 * the two. 957 */ 958 @Child(name = "range", type = { Range.class }, order = 2, min = 0, max = 1, modifier = false, summary = false) 959 @Description(shortDefinition = "The interval itself, for continuous or ordinal observations", formalDefinition = "The low and high values determining the interval. There may be only one of the two.") 960 protected Range range; 961 962 /** 963 * Codes to indicate the health context the range applies to. For example, the 964 * normal or therapeutic range. 965 */ 966 @Child(name = "context", type = { 967 CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false) 968 @Description(shortDefinition = "Range context qualifier", formalDefinition = "Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.") 969 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/referencerange-meaning") 970 protected CodeableConcept context; 971 972 /** 973 * Codes to indicate the target population this reference range applies to. 974 */ 975 @Child(name = "appliesTo", type = { 976 CodeableConcept.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 977 @Description(shortDefinition = "Targetted population of the range", formalDefinition = "Codes to indicate the target population this reference range applies to.") 978 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/referencerange-appliesto") 979 protected List<CodeableConcept> appliesTo; 980 981 /** 982 * Sex of the population the range applies to. 983 */ 984 @Child(name = "gender", type = { CodeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false) 985 @Description(shortDefinition = "male | female | other | unknown", formalDefinition = "Sex of the population the range applies to.") 986 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender") 987 protected Enumeration<AdministrativeGender> gender; 988 989 /** 990 * The age at which this reference range is applicable. This is a neonatal age 991 * (e.g. number of weeks at term) if the meaning says so. 992 */ 993 @Child(name = "age", type = { Range.class }, order = 6, min = 0, max = 1, modifier = false, summary = false) 994 @Description(shortDefinition = "Applicable age range, if relevant", formalDefinition = "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.") 995 protected Range age; 996 997 /** 998 * The gestational age to which this reference range is applicable, in the 999 * context of pregnancy. 1000 */ 1001 @Child(name = "gestationalAge", type = { 1002 Range.class }, order = 7, min = 0, max = 1, modifier = false, summary = false) 1003 @Description(shortDefinition = "Applicable gestational age range, if relevant", formalDefinition = "The gestational age to which this reference range is applicable, in the context of pregnancy.") 1004 protected Range gestationalAge; 1005 1006 /** 1007 * Text based condition for which the reference range is valid. 1008 */ 1009 @Child(name = "condition", type = { 1010 StringType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false) 1011 @Description(shortDefinition = "Condition associated with the reference range", formalDefinition = "Text based condition for which the reference range is valid.") 1012 protected StringType condition; 1013 1014 private static final long serialVersionUID = -416423468L; 1015 1016 /** 1017 * Constructor 1018 */ 1019 public ObservationDefinitionQualifiedIntervalComponent() { 1020 super(); 1021 } 1022 1023 /** 1024 * @return {@link #category} (The category of interval of values for continuous 1025 * or ordinal observations conforming to this ObservationDefinition.). 1026 * This is the underlying object with id, value and extensions. The 1027 * accessor "getCategory" gives direct access to the value 1028 */ 1029 public Enumeration<ObservationRangeCategory> getCategoryElement() { 1030 if (this.category == null) 1031 if (Configuration.errorOnAutoCreate()) 1032 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.category"); 1033 else if (Configuration.doAutoCreate()) 1034 this.category = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory()); // bb 1035 return this.category; 1036 } 1037 1038 public boolean hasCategoryElement() { 1039 return this.category != null && !this.category.isEmpty(); 1040 } 1041 1042 public boolean hasCategory() { 1043 return this.category != null && !this.category.isEmpty(); 1044 } 1045 1046 /** 1047 * @param value {@link #category} (The category of interval of values for 1048 * continuous or ordinal observations conforming to this 1049 * ObservationDefinition.). This is the underlying object with id, 1050 * value and extensions. The accessor "getCategory" gives direct 1051 * access to the value 1052 */ 1053 public ObservationDefinitionQualifiedIntervalComponent setCategoryElement( 1054 Enumeration<ObservationRangeCategory> value) { 1055 this.category = value; 1056 return this; 1057 } 1058 1059 /** 1060 * @return The category of interval of values for continuous or ordinal 1061 * observations conforming to this ObservationDefinition. 1062 */ 1063 public ObservationRangeCategory getCategory() { 1064 return this.category == null ? null : this.category.getValue(); 1065 } 1066 1067 /** 1068 * @param value The category of interval of values for continuous or ordinal 1069 * observations conforming to this ObservationDefinition. 1070 */ 1071 public ObservationDefinitionQualifiedIntervalComponent setCategory(ObservationRangeCategory value) { 1072 if (value == null) 1073 this.category = null; 1074 else { 1075 if (this.category == null) 1076 this.category = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory()); 1077 this.category.setValue(value); 1078 } 1079 return this; 1080 } 1081 1082 /** 1083 * @return {@link #range} (The low and high values determining the interval. 1084 * There may be only one of the two.) 1085 */ 1086 public Range getRange() { 1087 if (this.range == null) 1088 if (Configuration.errorOnAutoCreate()) 1089 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.range"); 1090 else if (Configuration.doAutoCreate()) 1091 this.range = new Range(); // cc 1092 return this.range; 1093 } 1094 1095 public boolean hasRange() { 1096 return this.range != null && !this.range.isEmpty(); 1097 } 1098 1099 /** 1100 * @param value {@link #range} (The low and high values determining the 1101 * interval. There may be only one of the two.) 1102 */ 1103 public ObservationDefinitionQualifiedIntervalComponent setRange(Range value) { 1104 this.range = value; 1105 return this; 1106 } 1107 1108 /** 1109 * @return {@link #context} (Codes to indicate the health context the range 1110 * applies to. For example, the normal or therapeutic range.) 1111 */ 1112 public CodeableConcept getContext() { 1113 if (this.context == null) 1114 if (Configuration.errorOnAutoCreate()) 1115 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.context"); 1116 else if (Configuration.doAutoCreate()) 1117 this.context = new CodeableConcept(); // cc 1118 return this.context; 1119 } 1120 1121 public boolean hasContext() { 1122 return this.context != null && !this.context.isEmpty(); 1123 } 1124 1125 /** 1126 * @param value {@link #context} (Codes to indicate the health context the range 1127 * applies to. For example, the normal or therapeutic range.) 1128 */ 1129 public ObservationDefinitionQualifiedIntervalComponent setContext(CodeableConcept value) { 1130 this.context = value; 1131 return this; 1132 } 1133 1134 /** 1135 * @return {@link #appliesTo} (Codes to indicate the target population this 1136 * reference range applies to.) 1137 */ 1138 public List<CodeableConcept> getAppliesTo() { 1139 if (this.appliesTo == null) 1140 this.appliesTo = new ArrayList<CodeableConcept>(); 1141 return this.appliesTo; 1142 } 1143 1144 /** 1145 * @return Returns a reference to <code>this</code> for easy method chaining 1146 */ 1147 public ObservationDefinitionQualifiedIntervalComponent setAppliesTo(List<CodeableConcept> theAppliesTo) { 1148 this.appliesTo = theAppliesTo; 1149 return this; 1150 } 1151 1152 public boolean hasAppliesTo() { 1153 if (this.appliesTo == null) 1154 return false; 1155 for (CodeableConcept item : this.appliesTo) 1156 if (!item.isEmpty()) 1157 return true; 1158 return false; 1159 } 1160 1161 public CodeableConcept addAppliesTo() { // 3 1162 CodeableConcept t = new CodeableConcept(); 1163 if (this.appliesTo == null) 1164 this.appliesTo = new ArrayList<CodeableConcept>(); 1165 this.appliesTo.add(t); 1166 return t; 1167 } 1168 1169 public ObservationDefinitionQualifiedIntervalComponent addAppliesTo(CodeableConcept t) { // 3 1170 if (t == null) 1171 return this; 1172 if (this.appliesTo == null) 1173 this.appliesTo = new ArrayList<CodeableConcept>(); 1174 this.appliesTo.add(t); 1175 return this; 1176 } 1177 1178 /** 1179 * @return The first repetition of repeating field {@link #appliesTo}, creating 1180 * it if it does not already exist 1181 */ 1182 public CodeableConcept getAppliesToFirstRep() { 1183 if (getAppliesTo().isEmpty()) { 1184 addAppliesTo(); 1185 } 1186 return getAppliesTo().get(0); 1187 } 1188 1189 /** 1190 * @return {@link #gender} (Sex of the population the range applies to.). This 1191 * is the underlying object with id, value and extensions. The accessor 1192 * "getGender" gives direct access to the value 1193 */ 1194 public Enumeration<AdministrativeGender> getGenderElement() { 1195 if (this.gender == null) 1196 if (Configuration.errorOnAutoCreate()) 1197 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.gender"); 1198 else if (Configuration.doAutoCreate()) 1199 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb 1200 return this.gender; 1201 } 1202 1203 public boolean hasGenderElement() { 1204 return this.gender != null && !this.gender.isEmpty(); 1205 } 1206 1207 public boolean hasGender() { 1208 return this.gender != null && !this.gender.isEmpty(); 1209 } 1210 1211 /** 1212 * @param value {@link #gender} (Sex of the population the range applies to.). 1213 * This is the underlying object with id, value and extensions. The 1214 * accessor "getGender" gives direct access to the value 1215 */ 1216 public ObservationDefinitionQualifiedIntervalComponent setGenderElement(Enumeration<AdministrativeGender> value) { 1217 this.gender = value; 1218 return this; 1219 } 1220 1221 /** 1222 * @return Sex of the population the range applies to. 1223 */ 1224 public AdministrativeGender getGender() { 1225 return this.gender == null ? null : this.gender.getValue(); 1226 } 1227 1228 /** 1229 * @param value Sex of the population the range applies to. 1230 */ 1231 public ObservationDefinitionQualifiedIntervalComponent setGender(AdministrativeGender value) { 1232 if (value == null) 1233 this.gender = null; 1234 else { 1235 if (this.gender == null) 1236 this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); 1237 this.gender.setValue(value); 1238 } 1239 return this; 1240 } 1241 1242 /** 1243 * @return {@link #age} (The age at which this reference range is applicable. 1244 * This is a neonatal age (e.g. number of weeks at term) if the meaning 1245 * says so.) 1246 */ 1247 public Range getAge() { 1248 if (this.age == null) 1249 if (Configuration.errorOnAutoCreate()) 1250 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.age"); 1251 else if (Configuration.doAutoCreate()) 1252 this.age = new Range(); // cc 1253 return this.age; 1254 } 1255 1256 public boolean hasAge() { 1257 return this.age != null && !this.age.isEmpty(); 1258 } 1259 1260 /** 1261 * @param value {@link #age} (The age at which this reference range is 1262 * applicable. This is a neonatal age (e.g. number of weeks at 1263 * term) if the meaning says so.) 1264 */ 1265 public ObservationDefinitionQualifiedIntervalComponent setAge(Range value) { 1266 this.age = value; 1267 return this; 1268 } 1269 1270 /** 1271 * @return {@link #gestationalAge} (The gestational age to which this reference 1272 * range is applicable, in the context of pregnancy.) 1273 */ 1274 public Range getGestationalAge() { 1275 if (this.gestationalAge == null) 1276 if (Configuration.errorOnAutoCreate()) 1277 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.gestationalAge"); 1278 else if (Configuration.doAutoCreate()) 1279 this.gestationalAge = new Range(); // cc 1280 return this.gestationalAge; 1281 } 1282 1283 public boolean hasGestationalAge() { 1284 return this.gestationalAge != null && !this.gestationalAge.isEmpty(); 1285 } 1286 1287 /** 1288 * @param value {@link #gestationalAge} (The gestational age to which this 1289 * reference range is applicable, in the context of pregnancy.) 1290 */ 1291 public ObservationDefinitionQualifiedIntervalComponent setGestationalAge(Range value) { 1292 this.gestationalAge = value; 1293 return this; 1294 } 1295 1296 /** 1297 * @return {@link #condition} (Text based condition for which the reference 1298 * range is valid.). This is the underlying object with id, value and 1299 * extensions. The accessor "getCondition" gives direct access to the 1300 * value 1301 */ 1302 public StringType getConditionElement() { 1303 if (this.condition == null) 1304 if (Configuration.errorOnAutoCreate()) 1305 throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.condition"); 1306 else if (Configuration.doAutoCreate()) 1307 this.condition = new StringType(); // bb 1308 return this.condition; 1309 } 1310 1311 public boolean hasConditionElement() { 1312 return this.condition != null && !this.condition.isEmpty(); 1313 } 1314 1315 public boolean hasCondition() { 1316 return this.condition != null && !this.condition.isEmpty(); 1317 } 1318 1319 /** 1320 * @param value {@link #condition} (Text based condition for which the reference 1321 * range is valid.). This is the underlying object with id, value 1322 * and extensions. The accessor "getCondition" gives direct access 1323 * to the value 1324 */ 1325 public ObservationDefinitionQualifiedIntervalComponent setConditionElement(StringType value) { 1326 this.condition = value; 1327 return this; 1328 } 1329 1330 /** 1331 * @return Text based condition for which the reference range is valid. 1332 */ 1333 public String getCondition() { 1334 return this.condition == null ? null : this.condition.getValue(); 1335 } 1336 1337 /** 1338 * @param value Text based condition for which the reference range is valid. 1339 */ 1340 public ObservationDefinitionQualifiedIntervalComponent setCondition(String value) { 1341 if (Utilities.noString(value)) 1342 this.condition = null; 1343 else { 1344 if (this.condition == null) 1345 this.condition = new StringType(); 1346 this.condition.setValue(value); 1347 } 1348 return this; 1349 } 1350 1351 protected void listChildren(List<Property> children) { 1352 super.listChildren(children); 1353 children.add(new Property("category", "code", 1354 "The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.", 1355 0, 1, category)); 1356 children.add(new Property("range", "Range", 1357 "The low and high values determining the interval. There may be only one of the two.", 0, 1, range)); 1358 children.add(new Property("context", "CodeableConcept", 1359 "Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.", 0, 1360 1, context)); 1361 children.add(new Property("appliesTo", "CodeableConcept", 1362 "Codes to indicate the target population this reference range applies to.", 0, java.lang.Integer.MAX_VALUE, 1363 appliesTo)); 1364 children.add(new Property("gender", "code", "Sex of the population the range applies to.", 0, 1, gender)); 1365 children.add(new Property("age", "Range", 1366 "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", 1367 0, 1, age)); 1368 children.add(new Property("gestationalAge", "Range", 1369 "The gestational age to which this reference range is applicable, in the context of pregnancy.", 0, 1, 1370 gestationalAge)); 1371 children.add(new Property("condition", "string", "Text based condition for which the reference range is valid.", 1372 0, 1, condition)); 1373 } 1374 1375 @Override 1376 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1377 switch (_hash) { 1378 case 50511102: 1379 /* category */ return new Property("category", "code", 1380 "The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.", 1381 0, 1, category); 1382 case 108280125: 1383 /* range */ return new Property("range", "Range", 1384 "The low and high values determining the interval. There may be only one of the two.", 0, 1, range); 1385 case 951530927: 1386 /* context */ return new Property("context", "CodeableConcept", 1387 "Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.", 1388 0, 1, context); 1389 case -2089924569: 1390 /* appliesTo */ return new Property("appliesTo", "CodeableConcept", 1391 "Codes to indicate the target population this reference range applies to.", 0, java.lang.Integer.MAX_VALUE, 1392 appliesTo); 1393 case -1249512767: 1394 /* gender */ return new Property("gender", "code", "Sex of the population the range applies to.", 0, 1, gender); 1395 case 96511: 1396 /* age */ return new Property("age", "Range", 1397 "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", 1398 0, 1, age); 1399 case -241217538: 1400 /* gestationalAge */ return new Property("gestationalAge", "Range", 1401 "The gestational age to which this reference range is applicable, in the context of pregnancy.", 0, 1, 1402 gestationalAge); 1403 case -861311717: 1404 /* condition */ return new Property("condition", "string", 1405 "Text based condition for which the reference range is valid.", 0, 1, condition); 1406 default: 1407 return super.getNamedProperty(_hash, _name, _checkValid); 1408 } 1409 1410 } 1411 1412 @Override 1413 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1414 switch (hash) { 1415 case 50511102: 1416 /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // Enumeration<ObservationRangeCategory> 1417 case 108280125: 1418 /* range */ return this.range == null ? new Base[0] : new Base[] { this.range }; // Range 1419 case 951530927: 1420 /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // CodeableConcept 1421 case -2089924569: 1422 /* appliesTo */ return this.appliesTo == null ? new Base[0] 1423 : this.appliesTo.toArray(new Base[this.appliesTo.size()]); // CodeableConcept 1424 case -1249512767: 1425 /* gender */ return this.gender == null ? new Base[0] : new Base[] { this.gender }; // Enumeration<AdministrativeGender> 1426 case 96511: 1427 /* age */ return this.age == null ? new Base[0] : new Base[] { this.age }; // Range 1428 case -241217538: 1429 /* gestationalAge */ return this.gestationalAge == null ? new Base[0] : new Base[] { this.gestationalAge }; // Range 1430 case -861311717: 1431 /* condition */ return this.condition == null ? new Base[0] : new Base[] { this.condition }; // StringType 1432 default: 1433 return super.getProperty(hash, name, checkValid); 1434 } 1435 1436 } 1437 1438 @Override 1439 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1440 switch (hash) { 1441 case 50511102: // category 1442 value = new ObservationRangeCategoryEnumFactory().fromType(castToCode(value)); 1443 this.category = (Enumeration) value; // Enumeration<ObservationRangeCategory> 1444 return value; 1445 case 108280125: // range 1446 this.range = castToRange(value); // Range 1447 return value; 1448 case 951530927: // context 1449 this.context = castToCodeableConcept(value); // CodeableConcept 1450 return value; 1451 case -2089924569: // appliesTo 1452 this.getAppliesTo().add(castToCodeableConcept(value)); // CodeableConcept 1453 return value; 1454 case -1249512767: // gender 1455 value = new AdministrativeGenderEnumFactory().fromType(castToCode(value)); 1456 this.gender = (Enumeration) value; // Enumeration<AdministrativeGender> 1457 return value; 1458 case 96511: // age 1459 this.age = castToRange(value); // Range 1460 return value; 1461 case -241217538: // gestationalAge 1462 this.gestationalAge = castToRange(value); // Range 1463 return value; 1464 case -861311717: // condition 1465 this.condition = castToString(value); // StringType 1466 return value; 1467 default: 1468 return super.setProperty(hash, name, value); 1469 } 1470 1471 } 1472 1473 @Override 1474 public Base setProperty(String name, Base value) throws FHIRException { 1475 if (name.equals("category")) { 1476 value = new ObservationRangeCategoryEnumFactory().fromType(castToCode(value)); 1477 this.category = (Enumeration) value; // Enumeration<ObservationRangeCategory> 1478 } else if (name.equals("range")) { 1479 this.range = castToRange(value); // Range 1480 } else if (name.equals("context")) { 1481 this.context = castToCodeableConcept(value); // CodeableConcept 1482 } else if (name.equals("appliesTo")) { 1483 this.getAppliesTo().add(castToCodeableConcept(value)); 1484 } else if (name.equals("gender")) { 1485 value = new AdministrativeGenderEnumFactory().fromType(castToCode(value)); 1486 this.gender = (Enumeration) value; // Enumeration<AdministrativeGender> 1487 } else if (name.equals("age")) { 1488 this.age = castToRange(value); // Range 1489 } else if (name.equals("gestationalAge")) { 1490 this.gestationalAge = castToRange(value); // Range 1491 } else if (name.equals("condition")) { 1492 this.condition = castToString(value); // StringType 1493 } else 1494 return super.setProperty(name, value); 1495 return value; 1496 } 1497 1498 @Override 1499 public void removeChild(String name, Base value) throws FHIRException { 1500 if (name.equals("category")) { 1501 this.category = null; 1502 } else if (name.equals("range")) { 1503 this.range = null; 1504 } else if (name.equals("context")) { 1505 this.context = null; 1506 } else if (name.equals("appliesTo")) { 1507 this.getAppliesTo().remove(castToCodeableConcept(value)); 1508 } else if (name.equals("gender")) { 1509 this.gender = null; 1510 } else if (name.equals("age")) { 1511 this.age = null; 1512 } else if (name.equals("gestationalAge")) { 1513 this.gestationalAge = null; 1514 } else if (name.equals("condition")) { 1515 this.condition = null; 1516 } else 1517 super.removeChild(name, value); 1518 1519 } 1520 1521 @Override 1522 public Base makeProperty(int hash, String name) throws FHIRException { 1523 switch (hash) { 1524 case 50511102: 1525 return getCategoryElement(); 1526 case 108280125: 1527 return getRange(); 1528 case 951530927: 1529 return getContext(); 1530 case -2089924569: 1531 return addAppliesTo(); 1532 case -1249512767: 1533 return getGenderElement(); 1534 case 96511: 1535 return getAge(); 1536 case -241217538: 1537 return getGestationalAge(); 1538 case -861311717: 1539 return getConditionElement(); 1540 default: 1541 return super.makeProperty(hash, name); 1542 } 1543 1544 } 1545 1546 @Override 1547 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1548 switch (hash) { 1549 case 50511102: 1550 /* category */ return new String[] { "code" }; 1551 case 108280125: 1552 /* range */ return new String[] { "Range" }; 1553 case 951530927: 1554 /* context */ return new String[] { "CodeableConcept" }; 1555 case -2089924569: 1556 /* appliesTo */ return new String[] { "CodeableConcept" }; 1557 case -1249512767: 1558 /* gender */ return new String[] { "code" }; 1559 case 96511: 1560 /* age */ return new String[] { "Range" }; 1561 case -241217538: 1562 /* gestationalAge */ return new String[] { "Range" }; 1563 case -861311717: 1564 /* condition */ return new String[] { "string" }; 1565 default: 1566 return super.getTypesForProperty(hash, name); 1567 } 1568 1569 } 1570 1571 @Override 1572 public Base addChild(String name) throws FHIRException { 1573 if (name.equals("category")) { 1574 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.category"); 1575 } else if (name.equals("range")) { 1576 this.range = new Range(); 1577 return this.range; 1578 } else if (name.equals("context")) { 1579 this.context = new CodeableConcept(); 1580 return this.context; 1581 } else if (name.equals("appliesTo")) { 1582 return addAppliesTo(); 1583 } else if (name.equals("gender")) { 1584 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.gender"); 1585 } else if (name.equals("age")) { 1586 this.age = new Range(); 1587 return this.age; 1588 } else if (name.equals("gestationalAge")) { 1589 this.gestationalAge = new Range(); 1590 return this.gestationalAge; 1591 } else if (name.equals("condition")) { 1592 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.condition"); 1593 } else 1594 return super.addChild(name); 1595 } 1596 1597 public ObservationDefinitionQualifiedIntervalComponent copy() { 1598 ObservationDefinitionQualifiedIntervalComponent dst = new ObservationDefinitionQualifiedIntervalComponent(); 1599 copyValues(dst); 1600 return dst; 1601 } 1602 1603 public void copyValues(ObservationDefinitionQualifiedIntervalComponent dst) { 1604 super.copyValues(dst); 1605 dst.category = category == null ? null : category.copy(); 1606 dst.range = range == null ? null : range.copy(); 1607 dst.context = context == null ? null : context.copy(); 1608 if (appliesTo != null) { 1609 dst.appliesTo = new ArrayList<CodeableConcept>(); 1610 for (CodeableConcept i : appliesTo) 1611 dst.appliesTo.add(i.copy()); 1612 } 1613 ; 1614 dst.gender = gender == null ? null : gender.copy(); 1615 dst.age = age == null ? null : age.copy(); 1616 dst.gestationalAge = gestationalAge == null ? null : gestationalAge.copy(); 1617 dst.condition = condition == null ? null : condition.copy(); 1618 } 1619 1620 @Override 1621 public boolean equalsDeep(Base other_) { 1622 if (!super.equalsDeep(other_)) 1623 return false; 1624 if (!(other_ instanceof ObservationDefinitionQualifiedIntervalComponent)) 1625 return false; 1626 ObservationDefinitionQualifiedIntervalComponent o = (ObservationDefinitionQualifiedIntervalComponent) other_; 1627 return compareDeep(category, o.category, true) && compareDeep(range, o.range, true) 1628 && compareDeep(context, o.context, true) && compareDeep(appliesTo, o.appliesTo, true) 1629 && compareDeep(gender, o.gender, true) && compareDeep(age, o.age, true) 1630 && compareDeep(gestationalAge, o.gestationalAge, true) && compareDeep(condition, o.condition, true); 1631 } 1632 1633 @Override 1634 public boolean equalsShallow(Base other_) { 1635 if (!super.equalsShallow(other_)) 1636 return false; 1637 if (!(other_ instanceof ObservationDefinitionQualifiedIntervalComponent)) 1638 return false; 1639 ObservationDefinitionQualifiedIntervalComponent o = (ObservationDefinitionQualifiedIntervalComponent) other_; 1640 return compareValues(category, o.category, true) && compareValues(gender, o.gender, true) 1641 && compareValues(condition, o.condition, true); 1642 } 1643 1644 public boolean isEmpty() { 1645 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, range, context, appliesTo, gender, age, 1646 gestationalAge, condition); 1647 } 1648 1649 public String fhirType() { 1650 return "ObservationDefinition.qualifiedInterval"; 1651 1652 } 1653 1654 } 1655 1656 /** 1657 * A code that classifies the general type of observation. 1658 */ 1659 @Child(name = "category", type = { 1660 CodeableConcept.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1661 @Description(shortDefinition = "Category of observation", formalDefinition = "A code that classifies the general type of observation.") 1662 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-category") 1663 protected List<CodeableConcept> category; 1664 1665 /** 1666 * Describes what will be observed. Sometimes this is called the observation 1667 * "name". 1668 */ 1669 @Child(name = "code", type = { CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 1670 @Description(shortDefinition = "Type of observation (code / type)", formalDefinition = "Describes what will be observed. Sometimes this is called the observation \"name\".") 1671 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-codes") 1672 protected CodeableConcept code; 1673 1674 /** 1675 * A unique identifier assigned to this ObservationDefinition artifact. 1676 */ 1677 @Child(name = "identifier", type = { 1678 Identifier.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1679 @Description(shortDefinition = "Business identifier for this ObservationDefinition instance", formalDefinition = "A unique identifier assigned to this ObservationDefinition artifact.") 1680 protected List<Identifier> identifier; 1681 1682 /** 1683 * The data types allowed for the value element of the instance observations 1684 * conforming to this ObservationDefinition. 1685 */ 1686 @Child(name = "permittedDataType", type = { 1687 CodeType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1688 @Description(shortDefinition = "Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period", formalDefinition = "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.") 1689 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/permitted-data-type") 1690 protected List<Enumeration<ObservationDataType>> permittedDataType; 1691 1692 /** 1693 * Multiple results allowed for observations conforming to this 1694 * ObservationDefinition. 1695 */ 1696 @Child(name = "multipleResultsAllowed", type = { 1697 BooleanType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false) 1698 @Description(shortDefinition = "Multiple results allowed", formalDefinition = "Multiple results allowed for observations conforming to this ObservationDefinition.") 1699 protected BooleanType multipleResultsAllowed; 1700 1701 /** 1702 * The method or technique used to perform the observation. 1703 */ 1704 @Child(name = "method", type = { 1705 CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false) 1706 @Description(shortDefinition = "Method used to produce the observation", formalDefinition = "The method or technique used to perform the observation.") 1707 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-methods") 1708 protected CodeableConcept method; 1709 1710 /** 1711 * The preferred name to be used when reporting the results of observations 1712 * conforming to this ObservationDefinition. 1713 */ 1714 @Child(name = "preferredReportName", type = { 1715 StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false) 1716 @Description(shortDefinition = "Preferred report name", formalDefinition = "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.") 1717 protected StringType preferredReportName; 1718 1719 /** 1720 * Characteristics for quantitative results of this observation. 1721 */ 1722 @Child(name = "quantitativeDetails", type = {}, order = 7, min = 0, max = 1, modifier = false, summary = false) 1723 @Description(shortDefinition = "Characteristics of quantitative results", formalDefinition = "Characteristics for quantitative results of this observation.") 1724 protected ObservationDefinitionQuantitativeDetailsComponent quantitativeDetails; 1725 1726 /** 1727 * Multiple ranges of results qualified by different contexts for ordinal or 1728 * continuous observations conforming to this ObservationDefinition. 1729 */ 1730 @Child(name = "qualifiedInterval", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) 1731 @Description(shortDefinition = "Qualified range for continuous and ordinal observation results", formalDefinition = "Multiple ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.") 1732 protected List<ObservationDefinitionQualifiedIntervalComponent> qualifiedInterval; 1733 1734 /** 1735 * The set of valid coded results for the observations conforming to this 1736 * ObservationDefinition. 1737 */ 1738 @Child(name = "validCodedValueSet", type = { 1739 ValueSet.class }, order = 9, min = 0, max = 1, modifier = false, summary = false) 1740 @Description(shortDefinition = "Value set of valid coded values for the observations conforming to this ObservationDefinition", formalDefinition = "The set of valid coded results for the observations conforming to this ObservationDefinition.") 1741 protected Reference validCodedValueSet; 1742 1743 /** 1744 * The actual object that is the target of the reference (The set of valid coded 1745 * results for the observations conforming to this ObservationDefinition.) 1746 */ 1747 protected ValueSet validCodedValueSetTarget; 1748 1749 /** 1750 * The set of normal coded results for the observations conforming to this 1751 * ObservationDefinition. 1752 */ 1753 @Child(name = "normalCodedValueSet", type = { 1754 ValueSet.class }, order = 10, min = 0, max = 1, modifier = false, summary = false) 1755 @Description(shortDefinition = "Value set of normal coded values for the observations conforming to this ObservationDefinition", formalDefinition = "The set of normal coded results for the observations conforming to this ObservationDefinition.") 1756 protected Reference normalCodedValueSet; 1757 1758 /** 1759 * The actual object that is the target of the reference (The set of normal 1760 * coded results for the observations conforming to this ObservationDefinition.) 1761 */ 1762 protected ValueSet normalCodedValueSetTarget; 1763 1764 /** 1765 * The set of abnormal coded results for the observation conforming to this 1766 * ObservationDefinition. 1767 */ 1768 @Child(name = "abnormalCodedValueSet", type = { 1769 ValueSet.class }, order = 11, min = 0, max = 1, modifier = false, summary = false) 1770 @Description(shortDefinition = "Value set of abnormal coded values for the observations conforming to this ObservationDefinition", formalDefinition = "The set of abnormal coded results for the observation conforming to this ObservationDefinition.") 1771 protected Reference abnormalCodedValueSet; 1772 1773 /** 1774 * The actual object that is the target of the reference (The set of abnormal 1775 * coded results for the observation conforming to this ObservationDefinition.) 1776 */ 1777 protected ValueSet abnormalCodedValueSetTarget; 1778 1779 /** 1780 * The set of critical coded results for the observation conforming to this 1781 * ObservationDefinition. 1782 */ 1783 @Child(name = "criticalCodedValueSet", type = { 1784 ValueSet.class }, order = 12, min = 0, max = 1, modifier = false, summary = false) 1785 @Description(shortDefinition = "Value set of critical coded values for the observations conforming to this ObservationDefinition", formalDefinition = "The set of critical coded results for the observation conforming to this ObservationDefinition.") 1786 protected Reference criticalCodedValueSet; 1787 1788 /** 1789 * The actual object that is the target of the reference (The set of critical 1790 * coded results for the observation conforming to this ObservationDefinition.) 1791 */ 1792 protected ValueSet criticalCodedValueSetTarget; 1793 1794 private static final long serialVersionUID = 2136752757L; 1795 1796 /** 1797 * Constructor 1798 */ 1799 public ObservationDefinition() { 1800 super(); 1801 } 1802 1803 /** 1804 * Constructor 1805 */ 1806 public ObservationDefinition(CodeableConcept code) { 1807 super(); 1808 this.code = code; 1809 } 1810 1811 /** 1812 * @return {@link #category} (A code that classifies the general type of 1813 * observation.) 1814 */ 1815 public List<CodeableConcept> getCategory() { 1816 if (this.category == null) 1817 this.category = new ArrayList<CodeableConcept>(); 1818 return this.category; 1819 } 1820 1821 /** 1822 * @return Returns a reference to <code>this</code> for easy method chaining 1823 */ 1824 public ObservationDefinition setCategory(List<CodeableConcept> theCategory) { 1825 this.category = theCategory; 1826 return this; 1827 } 1828 1829 public boolean hasCategory() { 1830 if (this.category == null) 1831 return false; 1832 for (CodeableConcept item : this.category) 1833 if (!item.isEmpty()) 1834 return true; 1835 return false; 1836 } 1837 1838 public CodeableConcept addCategory() { // 3 1839 CodeableConcept t = new CodeableConcept(); 1840 if (this.category == null) 1841 this.category = new ArrayList<CodeableConcept>(); 1842 this.category.add(t); 1843 return t; 1844 } 1845 1846 public ObservationDefinition addCategory(CodeableConcept t) { // 3 1847 if (t == null) 1848 return this; 1849 if (this.category == null) 1850 this.category = new ArrayList<CodeableConcept>(); 1851 this.category.add(t); 1852 return this; 1853 } 1854 1855 /** 1856 * @return The first repetition of repeating field {@link #category}, creating 1857 * it if it does not already exist 1858 */ 1859 public CodeableConcept getCategoryFirstRep() { 1860 if (getCategory().isEmpty()) { 1861 addCategory(); 1862 } 1863 return getCategory().get(0); 1864 } 1865 1866 /** 1867 * @return {@link #code} (Describes what will be observed. Sometimes this is 1868 * called the observation "name".) 1869 */ 1870 public CodeableConcept getCode() { 1871 if (this.code == null) 1872 if (Configuration.errorOnAutoCreate()) 1873 throw new Error("Attempt to auto-create ObservationDefinition.code"); 1874 else if (Configuration.doAutoCreate()) 1875 this.code = new CodeableConcept(); // cc 1876 return this.code; 1877 } 1878 1879 public boolean hasCode() { 1880 return this.code != null && !this.code.isEmpty(); 1881 } 1882 1883 /** 1884 * @param value {@link #code} (Describes what will be observed. Sometimes this 1885 * is called the observation "name".) 1886 */ 1887 public ObservationDefinition setCode(CodeableConcept value) { 1888 this.code = value; 1889 return this; 1890 } 1891 1892 /** 1893 * @return {@link #identifier} (A unique identifier assigned to this 1894 * ObservationDefinition artifact.) 1895 */ 1896 public List<Identifier> getIdentifier() { 1897 if (this.identifier == null) 1898 this.identifier = new ArrayList<Identifier>(); 1899 return this.identifier; 1900 } 1901 1902 /** 1903 * @return Returns a reference to <code>this</code> for easy method chaining 1904 */ 1905 public ObservationDefinition setIdentifier(List<Identifier> theIdentifier) { 1906 this.identifier = theIdentifier; 1907 return this; 1908 } 1909 1910 public boolean hasIdentifier() { 1911 if (this.identifier == null) 1912 return false; 1913 for (Identifier item : this.identifier) 1914 if (!item.isEmpty()) 1915 return true; 1916 return false; 1917 } 1918 1919 public Identifier addIdentifier() { // 3 1920 Identifier t = new Identifier(); 1921 if (this.identifier == null) 1922 this.identifier = new ArrayList<Identifier>(); 1923 this.identifier.add(t); 1924 return t; 1925 } 1926 1927 public ObservationDefinition addIdentifier(Identifier t) { // 3 1928 if (t == null) 1929 return this; 1930 if (this.identifier == null) 1931 this.identifier = new ArrayList<Identifier>(); 1932 this.identifier.add(t); 1933 return this; 1934 } 1935 1936 /** 1937 * @return The first repetition of repeating field {@link #identifier}, creating 1938 * it if it does not already exist 1939 */ 1940 public Identifier getIdentifierFirstRep() { 1941 if (getIdentifier().isEmpty()) { 1942 addIdentifier(); 1943 } 1944 return getIdentifier().get(0); 1945 } 1946 1947 /** 1948 * @return {@link #permittedDataType} (The data types allowed for the value 1949 * element of the instance observations conforming to this 1950 * ObservationDefinition.) 1951 */ 1952 public List<Enumeration<ObservationDataType>> getPermittedDataType() { 1953 if (this.permittedDataType == null) 1954 this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>(); 1955 return this.permittedDataType; 1956 } 1957 1958 /** 1959 * @return Returns a reference to <code>this</code> for easy method chaining 1960 */ 1961 public ObservationDefinition setPermittedDataType(List<Enumeration<ObservationDataType>> thePermittedDataType) { 1962 this.permittedDataType = thePermittedDataType; 1963 return this; 1964 } 1965 1966 public boolean hasPermittedDataType() { 1967 if (this.permittedDataType == null) 1968 return false; 1969 for (Enumeration<ObservationDataType> item : this.permittedDataType) 1970 if (!item.isEmpty()) 1971 return true; 1972 return false; 1973 } 1974 1975 /** 1976 * @return {@link #permittedDataType} (The data types allowed for the value 1977 * element of the instance observations conforming to this 1978 * ObservationDefinition.) 1979 */ 1980 public Enumeration<ObservationDataType> addPermittedDataTypeElement() {// 2 1981 Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory()); 1982 if (this.permittedDataType == null) 1983 this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>(); 1984 this.permittedDataType.add(t); 1985 return t; 1986 } 1987 1988 /** 1989 * @param value {@link #permittedDataType} (The data types allowed for the value 1990 * element of the instance observations conforming to this 1991 * ObservationDefinition.) 1992 */ 1993 public ObservationDefinition addPermittedDataType(ObservationDataType value) { // 1 1994 Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory()); 1995 t.setValue(value); 1996 if (this.permittedDataType == null) 1997 this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>(); 1998 this.permittedDataType.add(t); 1999 return this; 2000 } 2001 2002 /** 2003 * @param value {@link #permittedDataType} (The data types allowed for the value 2004 * element of the instance observations conforming to this 2005 * ObservationDefinition.) 2006 */ 2007 public boolean hasPermittedDataType(ObservationDataType value) { 2008 if (this.permittedDataType == null) 2009 return false; 2010 for (Enumeration<ObservationDataType> v : this.permittedDataType) 2011 if (v.getValue().equals(value)) // code 2012 return true; 2013 return false; 2014 } 2015 2016 /** 2017 * @return {@link #multipleResultsAllowed} (Multiple results allowed for 2018 * observations conforming to this ObservationDefinition.). This is the 2019 * underlying object with id, value and extensions. The accessor 2020 * "getMultipleResultsAllowed" gives direct access to the value 2021 */ 2022 public BooleanType getMultipleResultsAllowedElement() { 2023 if (this.multipleResultsAllowed == null) 2024 if (Configuration.errorOnAutoCreate()) 2025 throw new Error("Attempt to auto-create ObservationDefinition.multipleResultsAllowed"); 2026 else if (Configuration.doAutoCreate()) 2027 this.multipleResultsAllowed = new BooleanType(); // bb 2028 return this.multipleResultsAllowed; 2029 } 2030 2031 public boolean hasMultipleResultsAllowedElement() { 2032 return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty(); 2033 } 2034 2035 public boolean hasMultipleResultsAllowed() { 2036 return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty(); 2037 } 2038 2039 /** 2040 * @param value {@link #multipleResultsAllowed} (Multiple results allowed for 2041 * observations conforming to this ObservationDefinition.). This is 2042 * the underlying object with id, value and extensions. The 2043 * accessor "getMultipleResultsAllowed" gives direct access to the 2044 * value 2045 */ 2046 public ObservationDefinition setMultipleResultsAllowedElement(BooleanType value) { 2047 this.multipleResultsAllowed = value; 2048 return this; 2049 } 2050 2051 /** 2052 * @return Multiple results allowed for observations conforming to this 2053 * ObservationDefinition. 2054 */ 2055 public boolean getMultipleResultsAllowed() { 2056 return this.multipleResultsAllowed == null || this.multipleResultsAllowed.isEmpty() ? false 2057 : this.multipleResultsAllowed.getValue(); 2058 } 2059 2060 /** 2061 * @param value Multiple results allowed for observations conforming to this 2062 * ObservationDefinition. 2063 */ 2064 public ObservationDefinition setMultipleResultsAllowed(boolean value) { 2065 if (this.multipleResultsAllowed == null) 2066 this.multipleResultsAllowed = new BooleanType(); 2067 this.multipleResultsAllowed.setValue(value); 2068 return this; 2069 } 2070 2071 /** 2072 * @return {@link #method} (The method or technique used to perform the 2073 * observation.) 2074 */ 2075 public CodeableConcept getMethod() { 2076 if (this.method == null) 2077 if (Configuration.errorOnAutoCreate()) 2078 throw new Error("Attempt to auto-create ObservationDefinition.method"); 2079 else if (Configuration.doAutoCreate()) 2080 this.method = new CodeableConcept(); // cc 2081 return this.method; 2082 } 2083 2084 public boolean hasMethod() { 2085 return this.method != null && !this.method.isEmpty(); 2086 } 2087 2088 /** 2089 * @param value {@link #method} (The method or technique used to perform the 2090 * observation.) 2091 */ 2092 public ObservationDefinition setMethod(CodeableConcept value) { 2093 this.method = value; 2094 return this; 2095 } 2096 2097 /** 2098 * @return {@link #preferredReportName} (The preferred name to be used when 2099 * reporting the results of observations conforming to this 2100 * ObservationDefinition.). This is the underlying object with id, value 2101 * and extensions. The accessor "getPreferredReportName" gives direct 2102 * access to the value 2103 */ 2104 public StringType getPreferredReportNameElement() { 2105 if (this.preferredReportName == null) 2106 if (Configuration.errorOnAutoCreate()) 2107 throw new Error("Attempt to auto-create ObservationDefinition.preferredReportName"); 2108 else if (Configuration.doAutoCreate()) 2109 this.preferredReportName = new StringType(); // bb 2110 return this.preferredReportName; 2111 } 2112 2113 public boolean hasPreferredReportNameElement() { 2114 return this.preferredReportName != null && !this.preferredReportName.isEmpty(); 2115 } 2116 2117 public boolean hasPreferredReportName() { 2118 return this.preferredReportName != null && !this.preferredReportName.isEmpty(); 2119 } 2120 2121 /** 2122 * @param value {@link #preferredReportName} (The preferred name to be used when 2123 * reporting the results of observations conforming to this 2124 * ObservationDefinition.). This is the underlying object with id, 2125 * value and extensions. The accessor "getPreferredReportName" 2126 * gives direct access to the value 2127 */ 2128 public ObservationDefinition setPreferredReportNameElement(StringType value) { 2129 this.preferredReportName = value; 2130 return this; 2131 } 2132 2133 /** 2134 * @return The preferred name to be used when reporting the results of 2135 * observations conforming to this ObservationDefinition. 2136 */ 2137 public String getPreferredReportName() { 2138 return this.preferredReportName == null ? null : this.preferredReportName.getValue(); 2139 } 2140 2141 /** 2142 * @param value The preferred name to be used when reporting the results of 2143 * observations conforming to this ObservationDefinition. 2144 */ 2145 public ObservationDefinition setPreferredReportName(String value) { 2146 if (Utilities.noString(value)) 2147 this.preferredReportName = null; 2148 else { 2149 if (this.preferredReportName == null) 2150 this.preferredReportName = new StringType(); 2151 this.preferredReportName.setValue(value); 2152 } 2153 return this; 2154 } 2155 2156 /** 2157 * @return {@link #quantitativeDetails} (Characteristics for quantitative 2158 * results of this observation.) 2159 */ 2160 public ObservationDefinitionQuantitativeDetailsComponent getQuantitativeDetails() { 2161 if (this.quantitativeDetails == null) 2162 if (Configuration.errorOnAutoCreate()) 2163 throw new Error("Attempt to auto-create ObservationDefinition.quantitativeDetails"); 2164 else if (Configuration.doAutoCreate()) 2165 this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); // cc 2166 return this.quantitativeDetails; 2167 } 2168 2169 public boolean hasQuantitativeDetails() { 2170 return this.quantitativeDetails != null && !this.quantitativeDetails.isEmpty(); 2171 } 2172 2173 /** 2174 * @param value {@link #quantitativeDetails} (Characteristics for quantitative 2175 * results of this observation.) 2176 */ 2177 public ObservationDefinition setQuantitativeDetails(ObservationDefinitionQuantitativeDetailsComponent value) { 2178 this.quantitativeDetails = value; 2179 return this; 2180 } 2181 2182 /** 2183 * @return {@link #qualifiedInterval} (Multiple ranges of results qualified by 2184 * different contexts for ordinal or continuous observations conforming 2185 * to this ObservationDefinition.) 2186 */ 2187 public List<ObservationDefinitionQualifiedIntervalComponent> getQualifiedInterval() { 2188 if (this.qualifiedInterval == null) 2189 this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>(); 2190 return this.qualifiedInterval; 2191 } 2192 2193 /** 2194 * @return Returns a reference to <code>this</code> for easy method chaining 2195 */ 2196 public ObservationDefinition setQualifiedInterval( 2197 List<ObservationDefinitionQualifiedIntervalComponent> theQualifiedInterval) { 2198 this.qualifiedInterval = theQualifiedInterval; 2199 return this; 2200 } 2201 2202 public boolean hasQualifiedInterval() { 2203 if (this.qualifiedInterval == null) 2204 return false; 2205 for (ObservationDefinitionQualifiedIntervalComponent item : this.qualifiedInterval) 2206 if (!item.isEmpty()) 2207 return true; 2208 return false; 2209 } 2210 2211 public ObservationDefinitionQualifiedIntervalComponent addQualifiedInterval() { // 3 2212 ObservationDefinitionQualifiedIntervalComponent t = new ObservationDefinitionQualifiedIntervalComponent(); 2213 if (this.qualifiedInterval == null) 2214 this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>(); 2215 this.qualifiedInterval.add(t); 2216 return t; 2217 } 2218 2219 public ObservationDefinition addQualifiedInterval(ObservationDefinitionQualifiedIntervalComponent t) { // 3 2220 if (t == null) 2221 return this; 2222 if (this.qualifiedInterval == null) 2223 this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>(); 2224 this.qualifiedInterval.add(t); 2225 return this; 2226 } 2227 2228 /** 2229 * @return The first repetition of repeating field {@link #qualifiedInterval}, 2230 * creating it if it does not already exist 2231 */ 2232 public ObservationDefinitionQualifiedIntervalComponent getQualifiedIntervalFirstRep() { 2233 if (getQualifiedInterval().isEmpty()) { 2234 addQualifiedInterval(); 2235 } 2236 return getQualifiedInterval().get(0); 2237 } 2238 2239 /** 2240 * @return {@link #validCodedValueSet} (The set of valid coded results for the 2241 * observations conforming to this ObservationDefinition.) 2242 */ 2243 public Reference getValidCodedValueSet() { 2244 if (this.validCodedValueSet == null) 2245 if (Configuration.errorOnAutoCreate()) 2246 throw new Error("Attempt to auto-create ObservationDefinition.validCodedValueSet"); 2247 else if (Configuration.doAutoCreate()) 2248 this.validCodedValueSet = new Reference(); // cc 2249 return this.validCodedValueSet; 2250 } 2251 2252 public boolean hasValidCodedValueSet() { 2253 return this.validCodedValueSet != null && !this.validCodedValueSet.isEmpty(); 2254 } 2255 2256 /** 2257 * @param value {@link #validCodedValueSet} (The set of valid coded results for 2258 * the observations conforming to this ObservationDefinition.) 2259 */ 2260 public ObservationDefinition setValidCodedValueSet(Reference value) { 2261 this.validCodedValueSet = value; 2262 return this; 2263 } 2264 2265 /** 2266 * @return {@link #validCodedValueSet} The actual object that is the target of 2267 * the reference. The reference library doesn't populate this, but you 2268 * can use it to hold the resource if you resolve it. (The set of valid 2269 * coded results for the observations conforming to this 2270 * ObservationDefinition.) 2271 */ 2272 public ValueSet getValidCodedValueSetTarget() { 2273 if (this.validCodedValueSetTarget == null) 2274 if (Configuration.errorOnAutoCreate()) 2275 throw new Error("Attempt to auto-create ObservationDefinition.validCodedValueSet"); 2276 else if (Configuration.doAutoCreate()) 2277 this.validCodedValueSetTarget = new ValueSet(); // aa 2278 return this.validCodedValueSetTarget; 2279 } 2280 2281 /** 2282 * @param value {@link #validCodedValueSet} The actual object that is the target 2283 * of the reference. The reference library doesn't use these, but 2284 * you can use it to hold the resource if you resolve it. (The set 2285 * of valid coded results for the observations conforming to this 2286 * ObservationDefinition.) 2287 */ 2288 public ObservationDefinition setValidCodedValueSetTarget(ValueSet value) { 2289 this.validCodedValueSetTarget = value; 2290 return this; 2291 } 2292 2293 /** 2294 * @return {@link #normalCodedValueSet} (The set of normal coded results for the 2295 * observations conforming to this ObservationDefinition.) 2296 */ 2297 public Reference getNormalCodedValueSet() { 2298 if (this.normalCodedValueSet == null) 2299 if (Configuration.errorOnAutoCreate()) 2300 throw new Error("Attempt to auto-create ObservationDefinition.normalCodedValueSet"); 2301 else if (Configuration.doAutoCreate()) 2302 this.normalCodedValueSet = new Reference(); // cc 2303 return this.normalCodedValueSet; 2304 } 2305 2306 public boolean hasNormalCodedValueSet() { 2307 return this.normalCodedValueSet != null && !this.normalCodedValueSet.isEmpty(); 2308 } 2309 2310 /** 2311 * @param value {@link #normalCodedValueSet} (The set of normal coded results 2312 * for the observations conforming to this ObservationDefinition.) 2313 */ 2314 public ObservationDefinition setNormalCodedValueSet(Reference value) { 2315 this.normalCodedValueSet = value; 2316 return this; 2317 } 2318 2319 /** 2320 * @return {@link #normalCodedValueSet} The actual object that is the target of 2321 * the reference. The reference library doesn't populate this, but you 2322 * can use it to hold the resource if you resolve it. (The set of normal 2323 * coded results for the observations conforming to this 2324 * ObservationDefinition.) 2325 */ 2326 public ValueSet getNormalCodedValueSetTarget() { 2327 if (this.normalCodedValueSetTarget == null) 2328 if (Configuration.errorOnAutoCreate()) 2329 throw new Error("Attempt to auto-create ObservationDefinition.normalCodedValueSet"); 2330 else if (Configuration.doAutoCreate()) 2331 this.normalCodedValueSetTarget = new ValueSet(); // aa 2332 return this.normalCodedValueSetTarget; 2333 } 2334 2335 /** 2336 * @param value {@link #normalCodedValueSet} The actual object that is the 2337 * target of the reference. The reference library doesn't use 2338 * these, but you can use it to hold the resource if you resolve 2339 * it. (The set of normal coded results for the observations 2340 * conforming to this ObservationDefinition.) 2341 */ 2342 public ObservationDefinition setNormalCodedValueSetTarget(ValueSet value) { 2343 this.normalCodedValueSetTarget = value; 2344 return this; 2345 } 2346 2347 /** 2348 * @return {@link #abnormalCodedValueSet} (The set of abnormal coded results for 2349 * the observation conforming to this ObservationDefinition.) 2350 */ 2351 public Reference getAbnormalCodedValueSet() { 2352 if (this.abnormalCodedValueSet == null) 2353 if (Configuration.errorOnAutoCreate()) 2354 throw new Error("Attempt to auto-create ObservationDefinition.abnormalCodedValueSet"); 2355 else if (Configuration.doAutoCreate()) 2356 this.abnormalCodedValueSet = new Reference(); // cc 2357 return this.abnormalCodedValueSet; 2358 } 2359 2360 public boolean hasAbnormalCodedValueSet() { 2361 return this.abnormalCodedValueSet != null && !this.abnormalCodedValueSet.isEmpty(); 2362 } 2363 2364 /** 2365 * @param value {@link #abnormalCodedValueSet} (The set of abnormal coded 2366 * results for the observation conforming to this 2367 * ObservationDefinition.) 2368 */ 2369 public ObservationDefinition setAbnormalCodedValueSet(Reference value) { 2370 this.abnormalCodedValueSet = value; 2371 return this; 2372 } 2373 2374 /** 2375 * @return {@link #abnormalCodedValueSet} The actual object that is the target 2376 * of the reference. The reference library doesn't populate this, but 2377 * you can use it to hold the resource if you resolve it. (The set of 2378 * abnormal coded results for the observation conforming to this 2379 * ObservationDefinition.) 2380 */ 2381 public ValueSet getAbnormalCodedValueSetTarget() { 2382 if (this.abnormalCodedValueSetTarget == null) 2383 if (Configuration.errorOnAutoCreate()) 2384 throw new Error("Attempt to auto-create ObservationDefinition.abnormalCodedValueSet"); 2385 else if (Configuration.doAutoCreate()) 2386 this.abnormalCodedValueSetTarget = new ValueSet(); // aa 2387 return this.abnormalCodedValueSetTarget; 2388 } 2389 2390 /** 2391 * @param value {@link #abnormalCodedValueSet} The actual object that is the 2392 * target of the reference. The reference library doesn't use 2393 * these, but you can use it to hold the resource if you resolve 2394 * it. (The set of abnormal coded results for the observation 2395 * conforming to this ObservationDefinition.) 2396 */ 2397 public ObservationDefinition setAbnormalCodedValueSetTarget(ValueSet value) { 2398 this.abnormalCodedValueSetTarget = value; 2399 return this; 2400 } 2401 2402 /** 2403 * @return {@link #criticalCodedValueSet} (The set of critical coded results for 2404 * the observation conforming to this ObservationDefinition.) 2405 */ 2406 public Reference getCriticalCodedValueSet() { 2407 if (this.criticalCodedValueSet == null) 2408 if (Configuration.errorOnAutoCreate()) 2409 throw new Error("Attempt to auto-create ObservationDefinition.criticalCodedValueSet"); 2410 else if (Configuration.doAutoCreate()) 2411 this.criticalCodedValueSet = new Reference(); // cc 2412 return this.criticalCodedValueSet; 2413 } 2414 2415 public boolean hasCriticalCodedValueSet() { 2416 return this.criticalCodedValueSet != null && !this.criticalCodedValueSet.isEmpty(); 2417 } 2418 2419 /** 2420 * @param value {@link #criticalCodedValueSet} (The set of critical coded 2421 * results for the observation conforming to this 2422 * ObservationDefinition.) 2423 */ 2424 public ObservationDefinition setCriticalCodedValueSet(Reference value) { 2425 this.criticalCodedValueSet = value; 2426 return this; 2427 } 2428 2429 /** 2430 * @return {@link #criticalCodedValueSet} The actual object that is the target 2431 * of the reference. The reference library doesn't populate this, but 2432 * you can use it to hold the resource if you resolve it. (The set of 2433 * critical coded results for the observation conforming to this 2434 * ObservationDefinition.) 2435 */ 2436 public ValueSet getCriticalCodedValueSetTarget() { 2437 if (this.criticalCodedValueSetTarget == null) 2438 if (Configuration.errorOnAutoCreate()) 2439 throw new Error("Attempt to auto-create ObservationDefinition.criticalCodedValueSet"); 2440 else if (Configuration.doAutoCreate()) 2441 this.criticalCodedValueSetTarget = new ValueSet(); // aa 2442 return this.criticalCodedValueSetTarget; 2443 } 2444 2445 /** 2446 * @param value {@link #criticalCodedValueSet} The actual object that is the 2447 * target of the reference. The reference library doesn't use 2448 * these, but you can use it to hold the resource if you resolve 2449 * it. (The set of critical coded results for the observation 2450 * conforming to this ObservationDefinition.) 2451 */ 2452 public ObservationDefinition setCriticalCodedValueSetTarget(ValueSet value) { 2453 this.criticalCodedValueSetTarget = value; 2454 return this; 2455 } 2456 2457 protected void listChildren(List<Property> children) { 2458 super.listChildren(children); 2459 children.add(new Property("category", "CodeableConcept", "A code that classifies the general type of observation.", 2460 0, java.lang.Integer.MAX_VALUE, category)); 2461 children.add(new Property("code", "CodeableConcept", 2462 "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code)); 2463 children.add( 2464 new Property("identifier", "Identifier", "A unique identifier assigned to this ObservationDefinition artifact.", 2465 0, java.lang.Integer.MAX_VALUE, identifier)); 2466 children.add(new Property("permittedDataType", "code", 2467 "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 2468 0, java.lang.Integer.MAX_VALUE, permittedDataType)); 2469 children.add(new Property("multipleResultsAllowed", "boolean", 2470 "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, 2471 multipleResultsAllowed)); 2472 children.add(new Property("method", "CodeableConcept", "The method or technique used to perform the observation.", 2473 0, 1, method)); 2474 children.add(new Property("preferredReportName", "string", 2475 "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 2476 0, 1, preferredReportName)); 2477 children.add(new Property("quantitativeDetails", "", 2478 "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails)); 2479 children.add(new Property("qualifiedInterval", "", 2480 "Multiple ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.", 2481 0, java.lang.Integer.MAX_VALUE, qualifiedInterval)); 2482 children.add(new Property("validCodedValueSet", "Reference(ValueSet)", 2483 "The set of valid coded results for the observations conforming to this ObservationDefinition.", 0, 1, 2484 validCodedValueSet)); 2485 children.add(new Property("normalCodedValueSet", "Reference(ValueSet)", 2486 "The set of normal coded results for the observations conforming to this ObservationDefinition.", 0, 1, 2487 normalCodedValueSet)); 2488 children.add(new Property("abnormalCodedValueSet", "Reference(ValueSet)", 2489 "The set of abnormal coded results for the observation conforming to this ObservationDefinition.", 0, 1, 2490 abnormalCodedValueSet)); 2491 children.add(new Property("criticalCodedValueSet", "Reference(ValueSet)", 2492 "The set of critical coded results for the observation conforming to this ObservationDefinition.", 0, 1, 2493 criticalCodedValueSet)); 2494 } 2495 2496 @Override 2497 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2498 switch (_hash) { 2499 case 50511102: 2500 /* category */ return new Property("category", "CodeableConcept", 2501 "A code that classifies the general type of observation.", 0, java.lang.Integer.MAX_VALUE, category); 2502 case 3059181: 2503 /* code */ return new Property("code", "CodeableConcept", 2504 "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code); 2505 case -1618432855: 2506 /* identifier */ return new Property("identifier", "Identifier", 2507 "A unique identifier assigned to this ObservationDefinition artifact.", 0, java.lang.Integer.MAX_VALUE, 2508 identifier); 2509 case -99492804: 2510 /* permittedDataType */ return new Property("permittedDataType", "code", 2511 "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 2512 0, java.lang.Integer.MAX_VALUE, permittedDataType); 2513 case -2102414590: 2514 /* multipleResultsAllowed */ return new Property("multipleResultsAllowed", "boolean", 2515 "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, 2516 multipleResultsAllowed); 2517 case -1077554975: 2518 /* method */ return new Property("method", "CodeableConcept", 2519 "The method or technique used to perform the observation.", 0, 1, method); 2520 case -1851030208: 2521 /* preferredReportName */ return new Property("preferredReportName", "string", 2522 "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 2523 0, 1, preferredReportName); 2524 case 842150763: 2525 /* quantitativeDetails */ return new Property("quantitativeDetails", "", 2526 "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails); 2527 case 1882971521: 2528 /* qualifiedInterval */ return new Property("qualifiedInterval", "", 2529 "Multiple ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.", 2530 0, java.lang.Integer.MAX_VALUE, qualifiedInterval); 2531 case 1374640076: 2532 /* validCodedValueSet */ return new Property("validCodedValueSet", "Reference(ValueSet)", 2533 "The set of valid coded results for the observations conforming to this ObservationDefinition.", 0, 1, 2534 validCodedValueSet); 2535 case -837500735: 2536 /* normalCodedValueSet */ return new Property("normalCodedValueSet", "Reference(ValueSet)", 2537 "The set of normal coded results for the observations conforming to this ObservationDefinition.", 0, 1, 2538 normalCodedValueSet); 2539 case 1073600256: 2540 /* abnormalCodedValueSet */ return new Property("abnormalCodedValueSet", "Reference(ValueSet)", 2541 "The set of abnormal coded results for the observation conforming to this ObservationDefinition.", 0, 1, 2542 abnormalCodedValueSet); 2543 case 2568457: 2544 /* criticalCodedValueSet */ return new Property("criticalCodedValueSet", "Reference(ValueSet)", 2545 "The set of critical coded results for the observation conforming to this ObservationDefinition.", 0, 1, 2546 criticalCodedValueSet); 2547 default: 2548 return super.getNamedProperty(_hash, _name, _checkValid); 2549 } 2550 2551 } 2552 2553 @Override 2554 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2555 switch (hash) { 2556 case 50511102: 2557 /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept 2558 case 3059181: 2559 /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept 2560 case -1618432855: 2561 /* identifier */ return this.identifier == null ? new Base[0] 2562 : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 2563 case -99492804: 2564 /* permittedDataType */ return this.permittedDataType == null ? new Base[0] 2565 : this.permittedDataType.toArray(new Base[this.permittedDataType.size()]); // Enumeration<ObservationDataType> 2566 case -2102414590: 2567 /* multipleResultsAllowed */ return this.multipleResultsAllowed == null ? new Base[0] 2568 : new Base[] { this.multipleResultsAllowed }; // BooleanType 2569 case -1077554975: 2570 /* method */ return this.method == null ? new Base[0] : new Base[] { this.method }; // CodeableConcept 2571 case -1851030208: 2572 /* preferredReportName */ return this.preferredReportName == null ? new Base[0] 2573 : new Base[] { this.preferredReportName }; // StringType 2574 case 842150763: 2575 /* quantitativeDetails */ return this.quantitativeDetails == null ? new Base[0] 2576 : new Base[] { this.quantitativeDetails }; // ObservationDefinitionQuantitativeDetailsComponent 2577 case 1882971521: 2578 /* qualifiedInterval */ return this.qualifiedInterval == null ? new Base[0] 2579 : this.qualifiedInterval.toArray(new Base[this.qualifiedInterval.size()]); // ObservationDefinitionQualifiedIntervalComponent 2580 case 1374640076: 2581 /* validCodedValueSet */ return this.validCodedValueSet == null ? new Base[0] 2582 : new Base[] { this.validCodedValueSet }; // Reference 2583 case -837500735: 2584 /* normalCodedValueSet */ return this.normalCodedValueSet == null ? new Base[0] 2585 : new Base[] { this.normalCodedValueSet }; // Reference 2586 case 1073600256: 2587 /* abnormalCodedValueSet */ return this.abnormalCodedValueSet == null ? new Base[0] 2588 : new Base[] { this.abnormalCodedValueSet }; // Reference 2589 case 2568457: 2590 /* criticalCodedValueSet */ return this.criticalCodedValueSet == null ? new Base[0] 2591 : new Base[] { this.criticalCodedValueSet }; // Reference 2592 default: 2593 return super.getProperty(hash, name, checkValid); 2594 } 2595 2596 } 2597 2598 @Override 2599 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2600 switch (hash) { 2601 case 50511102: // category 2602 this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept 2603 return value; 2604 case 3059181: // code 2605 this.code = castToCodeableConcept(value); // CodeableConcept 2606 return value; 2607 case -1618432855: // identifier 2608 this.getIdentifier().add(castToIdentifier(value)); // Identifier 2609 return value; 2610 case -99492804: // permittedDataType 2611 value = new ObservationDataTypeEnumFactory().fromType(castToCode(value)); 2612 this.getPermittedDataType().add((Enumeration) value); // Enumeration<ObservationDataType> 2613 return value; 2614 case -2102414590: // multipleResultsAllowed 2615 this.multipleResultsAllowed = castToBoolean(value); // BooleanType 2616 return value; 2617 case -1077554975: // method 2618 this.method = castToCodeableConcept(value); // CodeableConcept 2619 return value; 2620 case -1851030208: // preferredReportName 2621 this.preferredReportName = castToString(value); // StringType 2622 return value; 2623 case 842150763: // quantitativeDetails 2624 this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent 2625 return value; 2626 case 1882971521: // qualifiedInterval 2627 this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value); // ObservationDefinitionQualifiedIntervalComponent 2628 return value; 2629 case 1374640076: // validCodedValueSet 2630 this.validCodedValueSet = castToReference(value); // Reference 2631 return value; 2632 case -837500735: // normalCodedValueSet 2633 this.normalCodedValueSet = castToReference(value); // Reference 2634 return value; 2635 case 1073600256: // abnormalCodedValueSet 2636 this.abnormalCodedValueSet = castToReference(value); // Reference 2637 return value; 2638 case 2568457: // criticalCodedValueSet 2639 this.criticalCodedValueSet = castToReference(value); // Reference 2640 return value; 2641 default: 2642 return super.setProperty(hash, name, value); 2643 } 2644 2645 } 2646 2647 @Override 2648 public Base setProperty(String name, Base value) throws FHIRException { 2649 if (name.equals("category")) { 2650 this.getCategory().add(castToCodeableConcept(value)); 2651 } else if (name.equals("code")) { 2652 this.code = castToCodeableConcept(value); // CodeableConcept 2653 } else if (name.equals("identifier")) { 2654 this.getIdentifier().add(castToIdentifier(value)); 2655 } else if (name.equals("permittedDataType")) { 2656 value = new ObservationDataTypeEnumFactory().fromType(castToCode(value)); 2657 this.getPermittedDataType().add((Enumeration) value); 2658 } else if (name.equals("multipleResultsAllowed")) { 2659 this.multipleResultsAllowed = castToBoolean(value); // BooleanType 2660 } else if (name.equals("method")) { 2661 this.method = castToCodeableConcept(value); // CodeableConcept 2662 } else if (name.equals("preferredReportName")) { 2663 this.preferredReportName = castToString(value); // StringType 2664 } else if (name.equals("quantitativeDetails")) { 2665 this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent 2666 } else if (name.equals("qualifiedInterval")) { 2667 this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value); 2668 } else if (name.equals("validCodedValueSet")) { 2669 this.validCodedValueSet = castToReference(value); // Reference 2670 } else if (name.equals("normalCodedValueSet")) { 2671 this.normalCodedValueSet = castToReference(value); // Reference 2672 } else if (name.equals("abnormalCodedValueSet")) { 2673 this.abnormalCodedValueSet = castToReference(value); // Reference 2674 } else if (name.equals("criticalCodedValueSet")) { 2675 this.criticalCodedValueSet = castToReference(value); // Reference 2676 } else 2677 return super.setProperty(name, value); 2678 return value; 2679 } 2680 2681 @Override 2682 public void removeChild(String name, Base value) throws FHIRException { 2683 if (name.equals("category")) { 2684 this.getCategory().remove(castToCodeableConcept(value)); 2685 } else if (name.equals("code")) { 2686 this.code = null; 2687 } else if (name.equals("identifier")) { 2688 this.getIdentifier().remove(castToIdentifier(value)); 2689 } else if (name.equals("permittedDataType")) { 2690 this.getPermittedDataType().remove((Enumeration) value); 2691 } else if (name.equals("multipleResultsAllowed")) { 2692 this.multipleResultsAllowed = null; 2693 } else if (name.equals("method")) { 2694 this.method = null; 2695 } else if (name.equals("preferredReportName")) { 2696 this.preferredReportName = null; 2697 } else if (name.equals("quantitativeDetails")) { 2698 this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent 2699 } else if (name.equals("qualifiedInterval")) { 2700 this.getQualifiedInterval().remove((ObservationDefinitionQualifiedIntervalComponent) value); 2701 } else if (name.equals("validCodedValueSet")) { 2702 this.validCodedValueSet = null; 2703 } else if (name.equals("normalCodedValueSet")) { 2704 this.normalCodedValueSet = null; 2705 } else if (name.equals("abnormalCodedValueSet")) { 2706 this.abnormalCodedValueSet = null; 2707 } else if (name.equals("criticalCodedValueSet")) { 2708 this.criticalCodedValueSet = null; 2709 } else 2710 super.removeChild(name, value); 2711 2712 } 2713 2714 @Override 2715 public Base makeProperty(int hash, String name) throws FHIRException { 2716 switch (hash) { 2717 case 50511102: 2718 return addCategory(); 2719 case 3059181: 2720 return getCode(); 2721 case -1618432855: 2722 return addIdentifier(); 2723 case -99492804: 2724 return addPermittedDataTypeElement(); 2725 case -2102414590: 2726 return getMultipleResultsAllowedElement(); 2727 case -1077554975: 2728 return getMethod(); 2729 case -1851030208: 2730 return getPreferredReportNameElement(); 2731 case 842150763: 2732 return getQuantitativeDetails(); 2733 case 1882971521: 2734 return addQualifiedInterval(); 2735 case 1374640076: 2736 return getValidCodedValueSet(); 2737 case -837500735: 2738 return getNormalCodedValueSet(); 2739 case 1073600256: 2740 return getAbnormalCodedValueSet(); 2741 case 2568457: 2742 return getCriticalCodedValueSet(); 2743 default: 2744 return super.makeProperty(hash, name); 2745 } 2746 2747 } 2748 2749 @Override 2750 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2751 switch (hash) { 2752 case 50511102: 2753 /* category */ return new String[] { "CodeableConcept" }; 2754 case 3059181: 2755 /* code */ return new String[] { "CodeableConcept" }; 2756 case -1618432855: 2757 /* identifier */ return new String[] { "Identifier" }; 2758 case -99492804: 2759 /* permittedDataType */ return new String[] { "code" }; 2760 case -2102414590: 2761 /* multipleResultsAllowed */ return new String[] { "boolean" }; 2762 case -1077554975: 2763 /* method */ return new String[] { "CodeableConcept" }; 2764 case -1851030208: 2765 /* preferredReportName */ return new String[] { "string" }; 2766 case 842150763: 2767 /* quantitativeDetails */ return new String[] {}; 2768 case 1882971521: 2769 /* qualifiedInterval */ return new String[] {}; 2770 case 1374640076: 2771 /* validCodedValueSet */ return new String[] { "Reference" }; 2772 case -837500735: 2773 /* normalCodedValueSet */ return new String[] { "Reference" }; 2774 case 1073600256: 2775 /* abnormalCodedValueSet */ return new String[] { "Reference" }; 2776 case 2568457: 2777 /* criticalCodedValueSet */ return new String[] { "Reference" }; 2778 default: 2779 return super.getTypesForProperty(hash, name); 2780 } 2781 2782 } 2783 2784 @Override 2785 public Base addChild(String name) throws FHIRException { 2786 if (name.equals("category")) { 2787 return addCategory(); 2788 } else if (name.equals("code")) { 2789 this.code = new CodeableConcept(); 2790 return this.code; 2791 } else if (name.equals("identifier")) { 2792 return addIdentifier(); 2793 } else if (name.equals("permittedDataType")) { 2794 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.permittedDataType"); 2795 } else if (name.equals("multipleResultsAllowed")) { 2796 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.multipleResultsAllowed"); 2797 } else if (name.equals("method")) { 2798 this.method = new CodeableConcept(); 2799 return this.method; 2800 } else if (name.equals("preferredReportName")) { 2801 throw new FHIRException("Cannot call addChild on a singleton property ObservationDefinition.preferredReportName"); 2802 } else if (name.equals("quantitativeDetails")) { 2803 this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); 2804 return this.quantitativeDetails; 2805 } else if (name.equals("qualifiedInterval")) { 2806 return addQualifiedInterval(); 2807 } else if (name.equals("validCodedValueSet")) { 2808 this.validCodedValueSet = new Reference(); 2809 return this.validCodedValueSet; 2810 } else if (name.equals("normalCodedValueSet")) { 2811 this.normalCodedValueSet = new Reference(); 2812 return this.normalCodedValueSet; 2813 } else if (name.equals("abnormalCodedValueSet")) { 2814 this.abnormalCodedValueSet = new Reference(); 2815 return this.abnormalCodedValueSet; 2816 } else if (name.equals("criticalCodedValueSet")) { 2817 this.criticalCodedValueSet = new Reference(); 2818 return this.criticalCodedValueSet; 2819 } else 2820 return super.addChild(name); 2821 } 2822 2823 public String fhirType() { 2824 return "ObservationDefinition"; 2825 2826 } 2827 2828 public ObservationDefinition copy() { 2829 ObservationDefinition dst = new ObservationDefinition(); 2830 copyValues(dst); 2831 return dst; 2832 } 2833 2834 public void copyValues(ObservationDefinition dst) { 2835 super.copyValues(dst); 2836 if (category != null) { 2837 dst.category = new ArrayList<CodeableConcept>(); 2838 for (CodeableConcept i : category) 2839 dst.category.add(i.copy()); 2840 } 2841 ; 2842 dst.code = code == null ? null : code.copy(); 2843 if (identifier != null) { 2844 dst.identifier = new ArrayList<Identifier>(); 2845 for (Identifier i : identifier) 2846 dst.identifier.add(i.copy()); 2847 } 2848 ; 2849 if (permittedDataType != null) { 2850 dst.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>(); 2851 for (Enumeration<ObservationDataType> i : permittedDataType) 2852 dst.permittedDataType.add(i.copy()); 2853 } 2854 ; 2855 dst.multipleResultsAllowed = multipleResultsAllowed == null ? null : multipleResultsAllowed.copy(); 2856 dst.method = method == null ? null : method.copy(); 2857 dst.preferredReportName = preferredReportName == null ? null : preferredReportName.copy(); 2858 dst.quantitativeDetails = quantitativeDetails == null ? null : quantitativeDetails.copy(); 2859 if (qualifiedInterval != null) { 2860 dst.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>(); 2861 for (ObservationDefinitionQualifiedIntervalComponent i : qualifiedInterval) 2862 dst.qualifiedInterval.add(i.copy()); 2863 } 2864 ; 2865 dst.validCodedValueSet = validCodedValueSet == null ? null : validCodedValueSet.copy(); 2866 dst.normalCodedValueSet = normalCodedValueSet == null ? null : normalCodedValueSet.copy(); 2867 dst.abnormalCodedValueSet = abnormalCodedValueSet == null ? null : abnormalCodedValueSet.copy(); 2868 dst.criticalCodedValueSet = criticalCodedValueSet == null ? null : criticalCodedValueSet.copy(); 2869 } 2870 2871 protected ObservationDefinition typedCopy() { 2872 return copy(); 2873 } 2874 2875 @Override 2876 public boolean equalsDeep(Base other_) { 2877 if (!super.equalsDeep(other_)) 2878 return false; 2879 if (!(other_ instanceof ObservationDefinition)) 2880 return false; 2881 ObservationDefinition o = (ObservationDefinition) other_; 2882 return compareDeep(category, o.category, true) && compareDeep(code, o.code, true) 2883 && compareDeep(identifier, o.identifier, true) && compareDeep(permittedDataType, o.permittedDataType, true) 2884 && compareDeep(multipleResultsAllowed, o.multipleResultsAllowed, true) && compareDeep(method, o.method, true) 2885 && compareDeep(preferredReportName, o.preferredReportName, true) 2886 && compareDeep(quantitativeDetails, o.quantitativeDetails, true) 2887 && compareDeep(qualifiedInterval, o.qualifiedInterval, true) 2888 && compareDeep(validCodedValueSet, o.validCodedValueSet, true) 2889 && compareDeep(normalCodedValueSet, o.normalCodedValueSet, true) 2890 && compareDeep(abnormalCodedValueSet, o.abnormalCodedValueSet, true) 2891 && compareDeep(criticalCodedValueSet, o.criticalCodedValueSet, true); 2892 } 2893 2894 @Override 2895 public boolean equalsShallow(Base other_) { 2896 if (!super.equalsShallow(other_)) 2897 return false; 2898 if (!(other_ instanceof ObservationDefinition)) 2899 return false; 2900 ObservationDefinition o = (ObservationDefinition) other_; 2901 return compareValues(permittedDataType, o.permittedDataType, true) 2902 && compareValues(multipleResultsAllowed, o.multipleResultsAllowed, true) 2903 && compareValues(preferredReportName, o.preferredReportName, true); 2904 } 2905 2906 public boolean isEmpty() { 2907 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, code, identifier, permittedDataType, 2908 multipleResultsAllowed, method, preferredReportName, quantitativeDetails, qualifiedInterval, validCodedValueSet, 2909 normalCodedValueSet, abnormalCodedValueSet, criticalCodedValueSet); 2910 } 2911 2912 @Override 2913 public ResourceType getResourceType() { 2914 return ResourceType.ObservationDefinition; 2915 } 2916 2917}