001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 035import java.util.ArrayList; 036import java.util.Date; 037import java.util.List; 038 039import ca.uhn.fhir.model.api.annotation.Block; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import org.hl7.fhir.exceptions.FHIRException; 046import org.hl7.fhir.utilities.Utilities; 047 048/** 049 * An authorization for the supply of glasses and/or contact lenses to a 050 * patient. 051 */ 052@ResourceDef(name = "VisionPrescription", profile = "http://hl7.org/fhir/Profile/VisionPrescription") 053public class VisionPrescription extends DomainResource { 054 055 public enum VisionEyes { 056 /** 057 * Right Eye 058 */ 059 RIGHT, 060 /** 061 * Left Eye 062 */ 063 LEFT, 064 /** 065 * added to help the parsers 066 */ 067 NULL; 068 069 public static VisionEyes fromCode(String codeString) throws FHIRException { 070 if (codeString == null || "".equals(codeString)) 071 return null; 072 if ("right".equals(codeString)) 073 return RIGHT; 074 if ("left".equals(codeString)) 075 return LEFT; 076 throw new FHIRException("Unknown VisionEyes code '" + codeString + "'"); 077 } 078 079 public String toCode() { 080 switch (this) { 081 case RIGHT: 082 return "right"; 083 case LEFT: 084 return "left"; 085 case NULL: 086 return null; 087 default: 088 return "?"; 089 } 090 } 091 092 public String getSystem() { 093 switch (this) { 094 case RIGHT: 095 return "http://hl7.org/fhir/vision-eye-codes"; 096 case LEFT: 097 return "http://hl7.org/fhir/vision-eye-codes"; 098 case NULL: 099 return null; 100 default: 101 return "?"; 102 } 103 } 104 105 public String getDefinition() { 106 switch (this) { 107 case RIGHT: 108 return "Right Eye"; 109 case LEFT: 110 return "Left Eye"; 111 case NULL: 112 return null; 113 default: 114 return "?"; 115 } 116 } 117 118 public String getDisplay() { 119 switch (this) { 120 case RIGHT: 121 return "Right Eye"; 122 case LEFT: 123 return "Left Eye"; 124 case NULL: 125 return null; 126 default: 127 return "?"; 128 } 129 } 130 } 131 132 public static class VisionEyesEnumFactory implements EnumFactory<VisionEyes> { 133 public VisionEyes fromCode(String codeString) throws IllegalArgumentException { 134 if (codeString == null || "".equals(codeString)) 135 if (codeString == null || "".equals(codeString)) 136 return null; 137 if ("right".equals(codeString)) 138 return VisionEyes.RIGHT; 139 if ("left".equals(codeString)) 140 return VisionEyes.LEFT; 141 throw new IllegalArgumentException("Unknown VisionEyes code '" + codeString + "'"); 142 } 143 144 public Enumeration<VisionEyes> fromType(Base code) throws FHIRException { 145 if (code == null || code.isEmpty()) 146 return null; 147 String codeString = ((PrimitiveType) code).asStringValue(); 148 if (codeString == null || "".equals(codeString)) 149 return null; 150 if ("right".equals(codeString)) 151 return new Enumeration<VisionEyes>(this, VisionEyes.RIGHT); 152 if ("left".equals(codeString)) 153 return new Enumeration<VisionEyes>(this, VisionEyes.LEFT); 154 throw new FHIRException("Unknown VisionEyes code '" + codeString + "'"); 155 } 156 157 public String toCode(VisionEyes code) { 158 if (code == VisionEyes.RIGHT) 159 return "right"; 160 if (code == VisionEyes.LEFT) 161 return "left"; 162 return "?"; 163 } 164 } 165 166 public enum VisionBase { 167 /** 168 * top 169 */ 170 UP, 171 /** 172 * bottom 173 */ 174 DOWN, 175 /** 176 * inner edge 177 */ 178 IN, 179 /** 180 * outer edge 181 */ 182 OUT, 183 /** 184 * added to help the parsers 185 */ 186 NULL; 187 188 public static VisionBase fromCode(String codeString) throws FHIRException { 189 if (codeString == null || "".equals(codeString)) 190 return null; 191 if ("up".equals(codeString)) 192 return UP; 193 if ("down".equals(codeString)) 194 return DOWN; 195 if ("in".equals(codeString)) 196 return IN; 197 if ("out".equals(codeString)) 198 return OUT; 199 throw new FHIRException("Unknown VisionBase code '" + codeString + "'"); 200 } 201 202 public String toCode() { 203 switch (this) { 204 case UP: 205 return "up"; 206 case DOWN: 207 return "down"; 208 case IN: 209 return "in"; 210 case OUT: 211 return "out"; 212 case NULL: 213 return null; 214 default: 215 return "?"; 216 } 217 } 218 219 public String getSystem() { 220 switch (this) { 221 case UP: 222 return "http://hl7.org/fhir/vision-base-codes"; 223 case DOWN: 224 return "http://hl7.org/fhir/vision-base-codes"; 225 case IN: 226 return "http://hl7.org/fhir/vision-base-codes"; 227 case OUT: 228 return "http://hl7.org/fhir/vision-base-codes"; 229 case NULL: 230 return null; 231 default: 232 return "?"; 233 } 234 } 235 236 public String getDefinition() { 237 switch (this) { 238 case UP: 239 return "top"; 240 case DOWN: 241 return "bottom"; 242 case IN: 243 return "inner edge"; 244 case OUT: 245 return "outer edge"; 246 case NULL: 247 return null; 248 default: 249 return "?"; 250 } 251 } 252 253 public String getDisplay() { 254 switch (this) { 255 case UP: 256 return "Up"; 257 case DOWN: 258 return "Down"; 259 case IN: 260 return "In"; 261 case OUT: 262 return "Out"; 263 case NULL: 264 return null; 265 default: 266 return "?"; 267 } 268 } 269 } 270 271 public static class VisionBaseEnumFactory implements EnumFactory<VisionBase> { 272 public VisionBase fromCode(String codeString) throws IllegalArgumentException { 273 if (codeString == null || "".equals(codeString)) 274 if (codeString == null || "".equals(codeString)) 275 return null; 276 if ("up".equals(codeString)) 277 return VisionBase.UP; 278 if ("down".equals(codeString)) 279 return VisionBase.DOWN; 280 if ("in".equals(codeString)) 281 return VisionBase.IN; 282 if ("out".equals(codeString)) 283 return VisionBase.OUT; 284 throw new IllegalArgumentException("Unknown VisionBase code '" + codeString + "'"); 285 } 286 287 public Enumeration<VisionBase> fromType(Base code) throws FHIRException { 288 if (code == null || code.isEmpty()) 289 return null; 290 String codeString = ((PrimitiveType) code).asStringValue(); 291 if (codeString == null || "".equals(codeString)) 292 return null; 293 if ("up".equals(codeString)) 294 return new Enumeration<VisionBase>(this, VisionBase.UP); 295 if ("down".equals(codeString)) 296 return new Enumeration<VisionBase>(this, VisionBase.DOWN); 297 if ("in".equals(codeString)) 298 return new Enumeration<VisionBase>(this, VisionBase.IN); 299 if ("out".equals(codeString)) 300 return new Enumeration<VisionBase>(this, VisionBase.OUT); 301 throw new FHIRException("Unknown VisionBase code '" + codeString + "'"); 302 } 303 304 public String toCode(VisionBase code) { 305 if (code == VisionBase.UP) 306 return "up"; 307 if (code == VisionBase.DOWN) 308 return "down"; 309 if (code == VisionBase.IN) 310 return "in"; 311 if (code == VisionBase.OUT) 312 return "out"; 313 return "?"; 314 } 315 } 316 317 @Block() 318 public static class VisionPrescriptionDispenseComponent extends BackboneElement implements IBaseBackboneElement { 319 /** 320 * Identifies the type of vision correction product which is required for the 321 * patient. 322 */ 323 @Child(name = "product", type = { Coding.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 324 @Description(shortDefinition = "Product to be supplied", formalDefinition = "Identifies the type of vision correction product which is required for the patient.") 325 protected Coding product; 326 327 /** 328 * The eye for which the lens applies. 329 */ 330 @Child(name = "eye", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 331 @Description(shortDefinition = "right | left", formalDefinition = "The eye for which the lens applies.") 332 protected Enumeration<VisionEyes> eye; 333 334 /** 335 * Lens power measured in diopters (0.25 units). 336 */ 337 @Child(name = "sphere", type = { DecimalType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 338 @Description(shortDefinition = "Lens sphere", formalDefinition = "Lens power measured in diopters (0.25 units).") 339 protected DecimalType sphere; 340 341 /** 342 * Power adjustment for astigmatism measured in diopters (0.25 units). 343 */ 344 @Child(name = "cylinder", type = { 345 DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 346 @Description(shortDefinition = "Lens cylinder", formalDefinition = "Power adjustment for astigmatism measured in diopters (0.25 units).") 347 protected DecimalType cylinder; 348 349 /** 350 * Adjustment for astigmatism measured in integer degrees. 351 */ 352 @Child(name = "axis", type = { IntegerType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 353 @Description(shortDefinition = "Lens axis", formalDefinition = "Adjustment for astigmatism measured in integer degrees.") 354 protected IntegerType axis; 355 356 /** 357 * Amount of prism to compensate for eye alignment in fractional units. 358 */ 359 @Child(name = "prism", type = { DecimalType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 360 @Description(shortDefinition = "Lens prism", formalDefinition = "Amount of prism to compensate for eye alignment in fractional units.") 361 protected DecimalType prism; 362 363 /** 364 * The relative base, or reference lens edge, for the prism. 365 */ 366 @Child(name = "base", type = { CodeType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true) 367 @Description(shortDefinition = "up | down | in | out", formalDefinition = "The relative base, or reference lens edge, for the prism.") 368 protected Enumeration<VisionBase> base; 369 370 /** 371 * Power adjustment for multifocal lenses measured in diopters (0.25 units). 372 */ 373 @Child(name = "add", type = { DecimalType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true) 374 @Description(shortDefinition = "Lens add", formalDefinition = "Power adjustment for multifocal lenses measured in diopters (0.25 units).") 375 protected DecimalType add; 376 377 /** 378 * Contact lens power measured in diopters (0.25 units). 379 */ 380 @Child(name = "power", type = { DecimalType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true) 381 @Description(shortDefinition = "Contact lens power", formalDefinition = "Contact lens power measured in diopters (0.25 units).") 382 protected DecimalType power; 383 384 /** 385 * Back curvature measured in millimeters. 386 */ 387 @Child(name = "backCurve", type = { 388 DecimalType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true) 389 @Description(shortDefinition = "Contact lens back curvature", formalDefinition = "Back curvature measured in millimeters.") 390 protected DecimalType backCurve; 391 392 /** 393 * Contact lens diameter measured in millimeters. 394 */ 395 @Child(name = "diameter", type = { 396 DecimalType.class }, order = 11, min = 0, max = 1, modifier = false, summary = true) 397 @Description(shortDefinition = "Contact lens diameter", formalDefinition = "Contact lens diameter measured in millimeters.") 398 protected DecimalType diameter; 399 400 /** 401 * The recommended maximum wear period for the lens. 402 */ 403 @Child(name = "duration", type = { 404 SimpleQuantity.class }, order = 12, min = 0, max = 1, modifier = false, summary = true) 405 @Description(shortDefinition = "Lens wear duration", formalDefinition = "The recommended maximum wear period for the lens.") 406 protected SimpleQuantity duration; 407 408 /** 409 * Special color or pattern. 410 */ 411 @Child(name = "color", type = { StringType.class }, order = 13, min = 0, max = 1, modifier = false, summary = true) 412 @Description(shortDefinition = "Lens add", formalDefinition = "Special color or pattern.") 413 protected StringType color; 414 415 /** 416 * Brand recommendations or restrictions. 417 */ 418 @Child(name = "brand", type = { StringType.class }, order = 14, min = 0, max = 1, modifier = false, summary = true) 419 @Description(shortDefinition = "Lens add", formalDefinition = "Brand recommendations or restrictions.") 420 protected StringType brand; 421 422 /** 423 * Notes for special requirements such as coatings and lens materials. 424 */ 425 @Child(name = "notes", type = { StringType.class }, order = 15, min = 0, max = 1, modifier = false, summary = true) 426 @Description(shortDefinition = "Notes for coatings", formalDefinition = "Notes for special requirements such as coatings and lens materials.") 427 protected StringType notes; 428 429 private static final long serialVersionUID = -1586392610L; 430 431 /* 432 * Constructor 433 */ 434 public VisionPrescriptionDispenseComponent() { 435 super(); 436 } 437 438 /* 439 * Constructor 440 */ 441 public VisionPrescriptionDispenseComponent(Coding product) { 442 super(); 443 this.product = product; 444 } 445 446 /** 447 * @return {@link #product} (Identifies the type of vision correction product 448 * which is required for the patient.) 449 */ 450 public Coding getProduct() { 451 if (this.product == null) 452 if (Configuration.errorOnAutoCreate()) 453 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.product"); 454 else if (Configuration.doAutoCreate()) 455 this.product = new Coding(); // cc 456 return this.product; 457 } 458 459 public boolean hasProduct() { 460 return this.product != null && !this.product.isEmpty(); 461 } 462 463 /** 464 * @param value {@link #product} (Identifies the type of vision correction 465 * product which is required for the patient.) 466 */ 467 public VisionPrescriptionDispenseComponent setProduct(Coding value) { 468 this.product = value; 469 return this; 470 } 471 472 /** 473 * @return {@link #eye} (The eye for which the lens applies.). This is the 474 * underlying object with id, value and extensions. The accessor 475 * "getEye" gives direct access to the value 476 */ 477 public Enumeration<VisionEyes> getEyeElement() { 478 if (this.eye == null) 479 if (Configuration.errorOnAutoCreate()) 480 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.eye"); 481 else if (Configuration.doAutoCreate()) 482 this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory()); // bb 483 return this.eye; 484 } 485 486 public boolean hasEyeElement() { 487 return this.eye != null && !this.eye.isEmpty(); 488 } 489 490 public boolean hasEye() { 491 return this.eye != null && !this.eye.isEmpty(); 492 } 493 494 /** 495 * @param value {@link #eye} (The eye for which the lens applies.). This is the 496 * underlying object with id, value and extensions. The accessor 497 * "getEye" gives direct access to the value 498 */ 499 public VisionPrescriptionDispenseComponent setEyeElement(Enumeration<VisionEyes> value) { 500 this.eye = value; 501 return this; 502 } 503 504 /** 505 * @return The eye for which the lens applies. 506 */ 507 public VisionEyes getEye() { 508 return this.eye == null ? null : this.eye.getValue(); 509 } 510 511 /** 512 * @param value The eye for which the lens applies. 513 */ 514 public VisionPrescriptionDispenseComponent setEye(VisionEyes value) { 515 if (value == null) 516 this.eye = null; 517 else { 518 if (this.eye == null) 519 this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory()); 520 this.eye.setValue(value); 521 } 522 return this; 523 } 524 525 /** 526 * @return {@link #sphere} (Lens power measured in diopters (0.25 units).). This 527 * is the underlying object with id, value and extensions. The accessor 528 * "getSphere" gives direct access to the value 529 */ 530 public DecimalType getSphereElement() { 531 if (this.sphere == null) 532 if (Configuration.errorOnAutoCreate()) 533 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.sphere"); 534 else if (Configuration.doAutoCreate()) 535 this.sphere = new DecimalType(); // bb 536 return this.sphere; 537 } 538 539 public boolean hasSphereElement() { 540 return this.sphere != null && !this.sphere.isEmpty(); 541 } 542 543 public boolean hasSphere() { 544 return this.sphere != null && !this.sphere.isEmpty(); 545 } 546 547 /** 548 * @param value {@link #sphere} (Lens power measured in diopters (0.25 units).). 549 * This is the underlying object with id, value and extensions. The 550 * accessor "getSphere" gives direct access to the value 551 */ 552 public VisionPrescriptionDispenseComponent setSphereElement(DecimalType value) { 553 this.sphere = value; 554 return this; 555 } 556 557 /** 558 * @return Lens power measured in diopters (0.25 units). 559 */ 560 public BigDecimal getSphere() { 561 return this.sphere == null ? null : this.sphere.getValue(); 562 } 563 564 /** 565 * @param value Lens power measured in diopters (0.25 units). 566 */ 567 public VisionPrescriptionDispenseComponent setSphere(BigDecimal value) { 568 if (value == null) 569 this.sphere = null; 570 else { 571 if (this.sphere == null) 572 this.sphere = new DecimalType(); 573 this.sphere.setValue(value); 574 } 575 return this; 576 } 577 578 /** 579 * @return {@link #cylinder} (Power adjustment for astigmatism measured in 580 * diopters (0.25 units).). This is the underlying object with id, value 581 * and extensions. The accessor "getCylinder" gives direct access to the 582 * value 583 */ 584 public DecimalType getCylinderElement() { 585 if (this.cylinder == null) 586 if (Configuration.errorOnAutoCreate()) 587 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.cylinder"); 588 else if (Configuration.doAutoCreate()) 589 this.cylinder = new DecimalType(); // bb 590 return this.cylinder; 591 } 592 593 public boolean hasCylinderElement() { 594 return this.cylinder != null && !this.cylinder.isEmpty(); 595 } 596 597 public boolean hasCylinder() { 598 return this.cylinder != null && !this.cylinder.isEmpty(); 599 } 600 601 /** 602 * @param value {@link #cylinder} (Power adjustment for astigmatism measured in 603 * diopters (0.25 units).). This is the underlying object with id, 604 * value and extensions. The accessor "getCylinder" gives direct 605 * access to the value 606 */ 607 public VisionPrescriptionDispenseComponent setCylinderElement(DecimalType value) { 608 this.cylinder = value; 609 return this; 610 } 611 612 /** 613 * @return Power adjustment for astigmatism measured in diopters (0.25 units). 614 */ 615 public BigDecimal getCylinder() { 616 return this.cylinder == null ? null : this.cylinder.getValue(); 617 } 618 619 /** 620 * @param value Power adjustment for astigmatism measured in diopters (0.25 621 * units). 622 */ 623 public VisionPrescriptionDispenseComponent setCylinder(BigDecimal value) { 624 if (value == null) 625 this.cylinder = null; 626 else { 627 if (this.cylinder == null) 628 this.cylinder = new DecimalType(); 629 this.cylinder.setValue(value); 630 } 631 return this; 632 } 633 634 /** 635 * @return {@link #axis} (Adjustment for astigmatism measured in integer 636 * degrees.). This is the underlying object with id, value and 637 * extensions. The accessor "getAxis" gives direct access to the value 638 */ 639 public IntegerType getAxisElement() { 640 if (this.axis == null) 641 if (Configuration.errorOnAutoCreate()) 642 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.axis"); 643 else if (Configuration.doAutoCreate()) 644 this.axis = new IntegerType(); // bb 645 return this.axis; 646 } 647 648 public boolean hasAxisElement() { 649 return this.axis != null && !this.axis.isEmpty(); 650 } 651 652 public boolean hasAxis() { 653 return this.axis != null && !this.axis.isEmpty(); 654 } 655 656 /** 657 * @param value {@link #axis} (Adjustment for astigmatism measured in integer 658 * degrees.). This is the underlying object with id, value and 659 * extensions. The accessor "getAxis" gives direct access to the 660 * value 661 */ 662 public VisionPrescriptionDispenseComponent setAxisElement(IntegerType value) { 663 this.axis = value; 664 return this; 665 } 666 667 /** 668 * @return Adjustment for astigmatism measured in integer degrees. 669 */ 670 public int getAxis() { 671 return this.axis == null || this.axis.isEmpty() ? 0 : this.axis.getValue(); 672 } 673 674 /** 675 * @param value Adjustment for astigmatism measured in integer degrees. 676 */ 677 public VisionPrescriptionDispenseComponent setAxis(int value) { 678 if (this.axis == null) 679 this.axis = new IntegerType(); 680 this.axis.setValue(value); 681 return this; 682 } 683 684 /** 685 * @return {@link #prism} (Amount of prism to compensate for eye alignment in 686 * fractional units.). This is the underlying object with id, value and 687 * extensions. The accessor "getPrism" gives direct access to the value 688 */ 689 public DecimalType getPrismElement() { 690 if (this.prism == null) 691 if (Configuration.errorOnAutoCreate()) 692 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.prism"); 693 else if (Configuration.doAutoCreate()) 694 this.prism = new DecimalType(); // bb 695 return this.prism; 696 } 697 698 public boolean hasPrismElement() { 699 return this.prism != null && !this.prism.isEmpty(); 700 } 701 702 public boolean hasPrism() { 703 return this.prism != null && !this.prism.isEmpty(); 704 } 705 706 /** 707 * @param value {@link #prism} (Amount of prism to compensate for eye alignment 708 * in fractional units.). This is the underlying object with id, 709 * value and extensions. The accessor "getPrism" gives direct 710 * access to the value 711 */ 712 public VisionPrescriptionDispenseComponent setPrismElement(DecimalType value) { 713 this.prism = value; 714 return this; 715 } 716 717 /** 718 * @return Amount of prism to compensate for eye alignment in fractional units. 719 */ 720 public BigDecimal getPrism() { 721 return this.prism == null ? null : this.prism.getValue(); 722 } 723 724 /** 725 * @param value Amount of prism to compensate for eye alignment in fractional 726 * units. 727 */ 728 public VisionPrescriptionDispenseComponent setPrism(BigDecimal value) { 729 if (value == null) 730 this.prism = null; 731 else { 732 if (this.prism == null) 733 this.prism = new DecimalType(); 734 this.prism.setValue(value); 735 } 736 return this; 737 } 738 739 /** 740 * @return {@link #base} (The relative base, or reference lens edge, for the 741 * prism.). This is the underlying object with id, value and extensions. 742 * The accessor "getBase" gives direct access to the value 743 */ 744 public Enumeration<VisionBase> getBaseElement() { 745 if (this.base == null) 746 if (Configuration.errorOnAutoCreate()) 747 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.base"); 748 else if (Configuration.doAutoCreate()) 749 this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory()); // bb 750 return this.base; 751 } 752 753 public boolean hasBaseElement() { 754 return this.base != null && !this.base.isEmpty(); 755 } 756 757 public boolean hasBase() { 758 return this.base != null && !this.base.isEmpty(); 759 } 760 761 /** 762 * @param value {@link #base} (The relative base, or reference lens edge, for 763 * the prism.). This is the underlying object with id, value and 764 * extensions. The accessor "getBase" gives direct access to the 765 * value 766 */ 767 public VisionPrescriptionDispenseComponent setBaseElement(Enumeration<VisionBase> value) { 768 this.base = value; 769 return this; 770 } 771 772 /** 773 * @return The relative base, or reference lens edge, for the prism. 774 */ 775 public VisionBase getBase() { 776 return this.base == null ? null : this.base.getValue(); 777 } 778 779 /** 780 * @param value The relative base, or reference lens edge, for the prism. 781 */ 782 public VisionPrescriptionDispenseComponent setBase(VisionBase value) { 783 if (value == null) 784 this.base = null; 785 else { 786 if (this.base == null) 787 this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory()); 788 this.base.setValue(value); 789 } 790 return this; 791 } 792 793 /** 794 * @return {@link #add} (Power adjustment for multifocal lenses measured in 795 * diopters (0.25 units).). This is the underlying object with id, value 796 * and extensions. The accessor "getAdd" gives direct access to the 797 * value 798 */ 799 public DecimalType getAddElement() { 800 if (this.add == null) 801 if (Configuration.errorOnAutoCreate()) 802 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.add"); 803 else if (Configuration.doAutoCreate()) 804 this.add = new DecimalType(); // bb 805 return this.add; 806 } 807 808 public boolean hasAddElement() { 809 return this.add != null && !this.add.isEmpty(); 810 } 811 812 public boolean hasAdd() { 813 return this.add != null && !this.add.isEmpty(); 814 } 815 816 /** 817 * @param value {@link #add} (Power adjustment for multifocal lenses measured in 818 * diopters (0.25 units).). This is the underlying object with id, 819 * value and extensions. The accessor "getAdd" gives direct access 820 * to the value 821 */ 822 public VisionPrescriptionDispenseComponent setAddElement(DecimalType value) { 823 this.add = value; 824 return this; 825 } 826 827 /** 828 * @return Power adjustment for multifocal lenses measured in diopters (0.25 829 * units). 830 */ 831 public BigDecimal getAdd() { 832 return this.add == null ? null : this.add.getValue(); 833 } 834 835 /** 836 * @param value Power adjustment for multifocal lenses measured in diopters 837 * (0.25 units). 838 */ 839 public VisionPrescriptionDispenseComponent setAdd(BigDecimal value) { 840 if (value == null) 841 this.add = null; 842 else { 843 if (this.add == null) 844 this.add = new DecimalType(); 845 this.add.setValue(value); 846 } 847 return this; 848 } 849 850 /** 851 * @return {@link #power} (Contact lens power measured in diopters (0.25 852 * units).). This is the underlying object with id, value and 853 * extensions. The accessor "getPower" gives direct access to the value 854 */ 855 public DecimalType getPowerElement() { 856 if (this.power == null) 857 if (Configuration.errorOnAutoCreate()) 858 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.power"); 859 else if (Configuration.doAutoCreate()) 860 this.power = new DecimalType(); // bb 861 return this.power; 862 } 863 864 public boolean hasPowerElement() { 865 return this.power != null && !this.power.isEmpty(); 866 } 867 868 public boolean hasPower() { 869 return this.power != null && !this.power.isEmpty(); 870 } 871 872 /** 873 * @param value {@link #power} (Contact lens power measured in diopters (0.25 874 * units).). This is the underlying object with id, value and 875 * extensions. The accessor "getPower" gives direct access to the 876 * value 877 */ 878 public VisionPrescriptionDispenseComponent setPowerElement(DecimalType value) { 879 this.power = value; 880 return this; 881 } 882 883 /** 884 * @return Contact lens power measured in diopters (0.25 units). 885 */ 886 public BigDecimal getPower() { 887 return this.power == null ? null : this.power.getValue(); 888 } 889 890 /** 891 * @param value Contact lens power measured in diopters (0.25 units). 892 */ 893 public VisionPrescriptionDispenseComponent setPower(BigDecimal value) { 894 if (value == null) 895 this.power = null; 896 else { 897 if (this.power == null) 898 this.power = new DecimalType(); 899 this.power.setValue(value); 900 } 901 return this; 902 } 903 904 /** 905 * @return {@link #backCurve} (Back curvature measured in millimeters.). This is 906 * the underlying object with id, value and extensions. The accessor 907 * "getBackCurve" gives direct access to the value 908 */ 909 public DecimalType getBackCurveElement() { 910 if (this.backCurve == null) 911 if (Configuration.errorOnAutoCreate()) 912 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.backCurve"); 913 else if (Configuration.doAutoCreate()) 914 this.backCurve = new DecimalType(); // bb 915 return this.backCurve; 916 } 917 918 public boolean hasBackCurveElement() { 919 return this.backCurve != null && !this.backCurve.isEmpty(); 920 } 921 922 public boolean hasBackCurve() { 923 return this.backCurve != null && !this.backCurve.isEmpty(); 924 } 925 926 /** 927 * @param value {@link #backCurve} (Back curvature measured in millimeters.). 928 * This is the underlying object with id, value and extensions. The 929 * accessor "getBackCurve" gives direct access to the value 930 */ 931 public VisionPrescriptionDispenseComponent setBackCurveElement(DecimalType value) { 932 this.backCurve = value; 933 return this; 934 } 935 936 /** 937 * @return Back curvature measured in millimeters. 938 */ 939 public BigDecimal getBackCurve() { 940 return this.backCurve == null ? null : this.backCurve.getValue(); 941 } 942 943 /** 944 * @param value Back curvature measured in millimeters. 945 */ 946 public VisionPrescriptionDispenseComponent setBackCurve(BigDecimal value) { 947 if (value == null) 948 this.backCurve = null; 949 else { 950 if (this.backCurve == null) 951 this.backCurve = new DecimalType(); 952 this.backCurve.setValue(value); 953 } 954 return this; 955 } 956 957 /** 958 * @return {@link #diameter} (Contact lens diameter measured in millimeters.). 959 * This is the underlying object with id, value and extensions. The 960 * accessor "getDiameter" gives direct access to the value 961 */ 962 public DecimalType getDiameterElement() { 963 if (this.diameter == null) 964 if (Configuration.errorOnAutoCreate()) 965 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.diameter"); 966 else if (Configuration.doAutoCreate()) 967 this.diameter = new DecimalType(); // bb 968 return this.diameter; 969 } 970 971 public boolean hasDiameterElement() { 972 return this.diameter != null && !this.diameter.isEmpty(); 973 } 974 975 public boolean hasDiameter() { 976 return this.diameter != null && !this.diameter.isEmpty(); 977 } 978 979 /** 980 * @param value {@link #diameter} (Contact lens diameter measured in 981 * millimeters.). This is the underlying object with id, value and 982 * extensions. The accessor "getDiameter" gives direct access to 983 * the value 984 */ 985 public VisionPrescriptionDispenseComponent setDiameterElement(DecimalType value) { 986 this.diameter = value; 987 return this; 988 } 989 990 /** 991 * @return Contact lens diameter measured in millimeters. 992 */ 993 public BigDecimal getDiameter() { 994 return this.diameter == null ? null : this.diameter.getValue(); 995 } 996 997 /** 998 * @param value Contact lens diameter measured in millimeters. 999 */ 1000 public VisionPrescriptionDispenseComponent setDiameter(BigDecimal value) { 1001 if (value == null) 1002 this.diameter = null; 1003 else { 1004 if (this.diameter == null) 1005 this.diameter = new DecimalType(); 1006 this.diameter.setValue(value); 1007 } 1008 return this; 1009 } 1010 1011 /** 1012 * @return {@link #duration} (The recommended maximum wear period for the lens.) 1013 */ 1014 public SimpleQuantity getDuration() { 1015 if (this.duration == null) 1016 if (Configuration.errorOnAutoCreate()) 1017 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.duration"); 1018 else if (Configuration.doAutoCreate()) 1019 this.duration = new SimpleQuantity(); // cc 1020 return this.duration; 1021 } 1022 1023 public boolean hasDuration() { 1024 return this.duration != null && !this.duration.isEmpty(); 1025 } 1026 1027 /** 1028 * @param value {@link #duration} (The recommended maximum wear period for the 1029 * lens.) 1030 */ 1031 public VisionPrescriptionDispenseComponent setDuration(SimpleQuantity value) { 1032 this.duration = value; 1033 return this; 1034 } 1035 1036 /** 1037 * @return {@link #color} (Special color or pattern.). This is the underlying 1038 * object with id, value and extensions. The accessor "getColor" gives 1039 * direct access to the value 1040 */ 1041 public StringType getColorElement() { 1042 if (this.color == null) 1043 if (Configuration.errorOnAutoCreate()) 1044 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.color"); 1045 else if (Configuration.doAutoCreate()) 1046 this.color = new StringType(); // bb 1047 return this.color; 1048 } 1049 1050 public boolean hasColorElement() { 1051 return this.color != null && !this.color.isEmpty(); 1052 } 1053 1054 public boolean hasColor() { 1055 return this.color != null && !this.color.isEmpty(); 1056 } 1057 1058 /** 1059 * @param value {@link #color} (Special color or pattern.). This is the 1060 * underlying object with id, value and extensions. The accessor 1061 * "getColor" gives direct access to the value 1062 */ 1063 public VisionPrescriptionDispenseComponent setColorElement(StringType value) { 1064 this.color = value; 1065 return this; 1066 } 1067 1068 /** 1069 * @return Special color or pattern. 1070 */ 1071 public String getColor() { 1072 return this.color == null ? null : this.color.getValue(); 1073 } 1074 1075 /** 1076 * @param value Special color or pattern. 1077 */ 1078 public VisionPrescriptionDispenseComponent setColor(String value) { 1079 if (Utilities.noString(value)) 1080 this.color = null; 1081 else { 1082 if (this.color == null) 1083 this.color = new StringType(); 1084 this.color.setValue(value); 1085 } 1086 return this; 1087 } 1088 1089 /** 1090 * @return {@link #brand} (Brand recommendations or restrictions.). This is the 1091 * underlying object with id, value and extensions. The accessor 1092 * "getBrand" gives direct access to the value 1093 */ 1094 public StringType getBrandElement() { 1095 if (this.brand == null) 1096 if (Configuration.errorOnAutoCreate()) 1097 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.brand"); 1098 else if (Configuration.doAutoCreate()) 1099 this.brand = new StringType(); // bb 1100 return this.brand; 1101 } 1102 1103 public boolean hasBrandElement() { 1104 return this.brand != null && !this.brand.isEmpty(); 1105 } 1106 1107 public boolean hasBrand() { 1108 return this.brand != null && !this.brand.isEmpty(); 1109 } 1110 1111 /** 1112 * @param value {@link #brand} (Brand recommendations or restrictions.). This is 1113 * the underlying object with id, value and extensions. The 1114 * accessor "getBrand" gives direct access to the value 1115 */ 1116 public VisionPrescriptionDispenseComponent setBrandElement(StringType value) { 1117 this.brand = value; 1118 return this; 1119 } 1120 1121 /** 1122 * @return Brand recommendations or restrictions. 1123 */ 1124 public String getBrand() { 1125 return this.brand == null ? null : this.brand.getValue(); 1126 } 1127 1128 /** 1129 * @param value Brand recommendations or restrictions. 1130 */ 1131 public VisionPrescriptionDispenseComponent setBrand(String value) { 1132 if (Utilities.noString(value)) 1133 this.brand = null; 1134 else { 1135 if (this.brand == null) 1136 this.brand = new StringType(); 1137 this.brand.setValue(value); 1138 } 1139 return this; 1140 } 1141 1142 /** 1143 * @return {@link #notes} (Notes for special requirements such as coatings and 1144 * lens materials.). This is the underlying object with id, value and 1145 * extensions. The accessor "getNotes" gives direct access to the value 1146 */ 1147 public StringType getNotesElement() { 1148 if (this.notes == null) 1149 if (Configuration.errorOnAutoCreate()) 1150 throw new Error("Attempt to auto-create VisionPrescriptionDispenseComponent.notes"); 1151 else if (Configuration.doAutoCreate()) 1152 this.notes = new StringType(); // bb 1153 return this.notes; 1154 } 1155 1156 public boolean hasNotesElement() { 1157 return this.notes != null && !this.notes.isEmpty(); 1158 } 1159 1160 public boolean hasNotes() { 1161 return this.notes != null && !this.notes.isEmpty(); 1162 } 1163 1164 /** 1165 * @param value {@link #notes} (Notes for special requirements such as coatings 1166 * and lens materials.). This is the underlying object with id, 1167 * value and extensions. The accessor "getNotes" gives direct 1168 * access to the value 1169 */ 1170 public VisionPrescriptionDispenseComponent setNotesElement(StringType value) { 1171 this.notes = value; 1172 return this; 1173 } 1174 1175 /** 1176 * @return Notes for special requirements such as coatings and lens materials. 1177 */ 1178 public String getNotes() { 1179 return this.notes == null ? null : this.notes.getValue(); 1180 } 1181 1182 /** 1183 * @param value Notes for special requirements such as coatings and lens 1184 * materials. 1185 */ 1186 public VisionPrescriptionDispenseComponent setNotes(String value) { 1187 if (Utilities.noString(value)) 1188 this.notes = null; 1189 else { 1190 if (this.notes == null) 1191 this.notes = new StringType(); 1192 this.notes.setValue(value); 1193 } 1194 return this; 1195 } 1196 1197 protected void listChildren(List<Property> childrenList) { 1198 super.listChildren(childrenList); 1199 childrenList.add(new Property("product", "Coding", 1200 "Identifies the type of vision correction product which is required for the patient.", 0, 1201 java.lang.Integer.MAX_VALUE, product)); 1202 childrenList 1203 .add(new Property("eye", "code", "The eye for which the lens applies.", 0, java.lang.Integer.MAX_VALUE, eye)); 1204 childrenList.add(new Property("sphere", "decimal", "Lens power measured in diopters (0.25 units).", 0, 1205 java.lang.Integer.MAX_VALUE, sphere)); 1206 childrenList.add( 1207 new Property("cylinder", "decimal", "Power adjustment for astigmatism measured in diopters (0.25 units).", 0, 1208 java.lang.Integer.MAX_VALUE, cylinder)); 1209 childrenList.add(new Property("axis", "integer", "Adjustment for astigmatism measured in integer degrees.", 0, 1210 java.lang.Integer.MAX_VALUE, axis)); 1211 childrenList 1212 .add(new Property("prism", "decimal", "Amount of prism to compensate for eye alignment in fractional units.", 1213 0, java.lang.Integer.MAX_VALUE, prism)); 1214 childrenList.add(new Property("base", "code", "The relative base, or reference lens edge, for the prism.", 0, 1215 java.lang.Integer.MAX_VALUE, base)); 1216 childrenList.add( 1217 new Property("add", "decimal", "Power adjustment for multifocal lenses measured in diopters (0.25 units).", 0, 1218 java.lang.Integer.MAX_VALUE, add)); 1219 childrenList.add(new Property("power", "decimal", "Contact lens power measured in diopters (0.25 units).", 0, 1220 java.lang.Integer.MAX_VALUE, power)); 1221 childrenList.add(new Property("backCurve", "decimal", "Back curvature measured in millimeters.", 0, 1222 java.lang.Integer.MAX_VALUE, backCurve)); 1223 childrenList.add(new Property("diameter", "decimal", "Contact lens diameter measured in millimeters.", 0, 1224 java.lang.Integer.MAX_VALUE, diameter)); 1225 childrenList.add(new Property("duration", "SimpleQuantity", "The recommended maximum wear period for the lens.", 1226 0, java.lang.Integer.MAX_VALUE, duration)); 1227 childrenList 1228 .add(new Property("color", "string", "Special color or pattern.", 0, java.lang.Integer.MAX_VALUE, color)); 1229 childrenList.add(new Property("brand", "string", "Brand recommendations or restrictions.", 0, 1230 java.lang.Integer.MAX_VALUE, brand)); 1231 childrenList 1232 .add(new Property("notes", "string", "Notes for special requirements such as coatings and lens materials.", 0, 1233 java.lang.Integer.MAX_VALUE, notes)); 1234 } 1235 1236 @Override 1237 public void setProperty(String name, Base value) throws FHIRException { 1238 if (name.equals("product")) 1239 this.product = castToCoding(value); // Coding 1240 else if (name.equals("eye")) 1241 this.eye = new VisionEyesEnumFactory().fromType(value); // Enumeration<VisionEyes> 1242 else if (name.equals("sphere")) 1243 this.sphere = castToDecimal(value); // DecimalType 1244 else if (name.equals("cylinder")) 1245 this.cylinder = castToDecimal(value); // DecimalType 1246 else if (name.equals("axis")) 1247 this.axis = castToInteger(value); // IntegerType 1248 else if (name.equals("prism")) 1249 this.prism = castToDecimal(value); // DecimalType 1250 else if (name.equals("base")) 1251 this.base = new VisionBaseEnumFactory().fromType(value); // Enumeration<VisionBase> 1252 else if (name.equals("add")) 1253 this.add = castToDecimal(value); // DecimalType 1254 else if (name.equals("power")) 1255 this.power = castToDecimal(value); // DecimalType 1256 else if (name.equals("backCurve")) 1257 this.backCurve = castToDecimal(value); // DecimalType 1258 else if (name.equals("diameter")) 1259 this.diameter = castToDecimal(value); // DecimalType 1260 else if (name.equals("duration")) 1261 this.duration = castToSimpleQuantity(value); // SimpleQuantity 1262 else if (name.equals("color")) 1263 this.color = castToString(value); // StringType 1264 else if (name.equals("brand")) 1265 this.brand = castToString(value); // StringType 1266 else if (name.equals("notes")) 1267 this.notes = castToString(value); // StringType 1268 else 1269 super.setProperty(name, value); 1270 } 1271 1272 @Override 1273 public Base addChild(String name) throws FHIRException { 1274 if (name.equals("product")) { 1275 this.product = new Coding(); 1276 return this.product; 1277 } else if (name.equals("eye")) { 1278 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.eye"); 1279 } else if (name.equals("sphere")) { 1280 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.sphere"); 1281 } else if (name.equals("cylinder")) { 1282 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.cylinder"); 1283 } else if (name.equals("axis")) { 1284 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.axis"); 1285 } else if (name.equals("prism")) { 1286 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.prism"); 1287 } else if (name.equals("base")) { 1288 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.base"); 1289 } else if (name.equals("add")) { 1290 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.add"); 1291 } else if (name.equals("power")) { 1292 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.power"); 1293 } else if (name.equals("backCurve")) { 1294 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.backCurve"); 1295 } else if (name.equals("diameter")) { 1296 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.diameter"); 1297 } else if (name.equals("duration")) { 1298 this.duration = new SimpleQuantity(); 1299 return this.duration; 1300 } else if (name.equals("color")) { 1301 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.color"); 1302 } else if (name.equals("brand")) { 1303 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.brand"); 1304 } else if (name.equals("notes")) { 1305 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.notes"); 1306 } else 1307 return super.addChild(name); 1308 } 1309 1310 public VisionPrescriptionDispenseComponent copy() { 1311 VisionPrescriptionDispenseComponent dst = new VisionPrescriptionDispenseComponent(); 1312 copyValues(dst); 1313 dst.product = product == null ? null : product.copy(); 1314 dst.eye = eye == null ? null : eye.copy(); 1315 dst.sphere = sphere == null ? null : sphere.copy(); 1316 dst.cylinder = cylinder == null ? null : cylinder.copy(); 1317 dst.axis = axis == null ? null : axis.copy(); 1318 dst.prism = prism == null ? null : prism.copy(); 1319 dst.base = base == null ? null : base.copy(); 1320 dst.add = add == null ? null : add.copy(); 1321 dst.power = power == null ? null : power.copy(); 1322 dst.backCurve = backCurve == null ? null : backCurve.copy(); 1323 dst.diameter = diameter == null ? null : diameter.copy(); 1324 dst.duration = duration == null ? null : duration.copy(); 1325 dst.color = color == null ? null : color.copy(); 1326 dst.brand = brand == null ? null : brand.copy(); 1327 dst.notes = notes == null ? null : notes.copy(); 1328 return dst; 1329 } 1330 1331 @Override 1332 public boolean equalsDeep(Base other) { 1333 if (!super.equalsDeep(other)) 1334 return false; 1335 if (!(other instanceof VisionPrescriptionDispenseComponent)) 1336 return false; 1337 VisionPrescriptionDispenseComponent o = (VisionPrescriptionDispenseComponent) other; 1338 return compareDeep(product, o.product, true) && compareDeep(eye, o.eye, true) 1339 && compareDeep(sphere, o.sphere, true) && compareDeep(cylinder, o.cylinder, true) 1340 && compareDeep(axis, o.axis, true) && compareDeep(prism, o.prism, true) && compareDeep(base, o.base, true) 1341 && compareDeep(add, o.add, true) && compareDeep(power, o.power, true) 1342 && compareDeep(backCurve, o.backCurve, true) && compareDeep(diameter, o.diameter, true) 1343 && compareDeep(duration, o.duration, true) && compareDeep(color, o.color, true) 1344 && compareDeep(brand, o.brand, true) && compareDeep(notes, o.notes, true); 1345 } 1346 1347 @Override 1348 public boolean equalsShallow(Base other) { 1349 if (!super.equalsShallow(other)) 1350 return false; 1351 if (!(other instanceof VisionPrescriptionDispenseComponent)) 1352 return false; 1353 VisionPrescriptionDispenseComponent o = (VisionPrescriptionDispenseComponent) other; 1354 return compareValues(eye, o.eye, true) && compareValues(sphere, o.sphere, true) 1355 && compareValues(cylinder, o.cylinder, true) && compareValues(axis, o.axis, true) 1356 && compareValues(prism, o.prism, true) && compareValues(base, o.base, true) && compareValues(add, o.add, true) 1357 && compareValues(power, o.power, true) && compareValues(backCurve, o.backCurve, true) 1358 && compareValues(diameter, o.diameter, true) && compareValues(color, o.color, true) 1359 && compareValues(brand, o.brand, true) && compareValues(notes, o.notes, true); 1360 } 1361 1362 public boolean isEmpty() { 1363 return super.isEmpty() && (product == null || product.isEmpty()) && (eye == null || eye.isEmpty()) 1364 && (sphere == null || sphere.isEmpty()) && (cylinder == null || cylinder.isEmpty()) 1365 && (axis == null || axis.isEmpty()) && (prism == null || prism.isEmpty()) && (base == null || base.isEmpty()) 1366 && (add == null || add.isEmpty()) && (power == null || power.isEmpty()) 1367 && (backCurve == null || backCurve.isEmpty()) && (diameter == null || diameter.isEmpty()) 1368 && (duration == null || duration.isEmpty()) && (color == null || color.isEmpty()) 1369 && (brand == null || brand.isEmpty()) && (notes == null || notes.isEmpty()); 1370 } 1371 1372 public String fhirType() { 1373 return "VisionPrescription.dispense"; 1374 1375 } 1376 1377 } 1378 1379 /** 1380 * Business identifier which may be used by other parties to reference or 1381 * identify the prescription. 1382 */ 1383 @Child(name = "identifier", type = { 1384 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1385 @Description(shortDefinition = "Business identifier", formalDefinition = "Business identifier which may be used by other parties to reference or identify the prescription.") 1386 protected List<Identifier> identifier; 1387 1388 /** 1389 * The date (and perhaps time) when the prescription was written. 1390 */ 1391 @Child(name = "dateWritten", type = { 1392 DateTimeType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 1393 @Description(shortDefinition = "When prescription was authorized", formalDefinition = "The date (and perhaps time) when the prescription was written.") 1394 protected DateTimeType dateWritten; 1395 1396 /** 1397 * A link to a resource representing the person to whom the vision products will 1398 * be supplied. 1399 */ 1400 @Child(name = "patient", type = { Patient.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 1401 @Description(shortDefinition = "Who prescription is for", formalDefinition = "A link to a resource representing the person to whom the vision products will be supplied.") 1402 protected Reference patient; 1403 1404 /** 1405 * The actual object that is the target of the reference (A link to a resource 1406 * representing the person to whom the vision products will be supplied.) 1407 */ 1408 protected Patient patientTarget; 1409 1410 /** 1411 * The healthcare professional responsible for authorizing the prescription. 1412 */ 1413 @Child(name = "prescriber", type = { 1414 Practitioner.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 1415 @Description(shortDefinition = "Who authorizes the vision product", formalDefinition = "The healthcare professional responsible for authorizing the prescription.") 1416 protected Reference prescriber; 1417 1418 /** 1419 * The actual object that is the target of the reference (The healthcare 1420 * professional responsible for authorizing the prescription.) 1421 */ 1422 protected Practitioner prescriberTarget; 1423 1424 /** 1425 * A link to a resource that identifies the particular occurrence of contact 1426 * between patient and health care provider. 1427 */ 1428 @Child(name = "encounter", type = { Encounter.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 1429 @Description(shortDefinition = "Created during encounter / admission / stay", formalDefinition = "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.") 1430 protected Reference encounter; 1431 1432 /** 1433 * The actual object that is the target of the reference (A link to a resource 1434 * that identifies the particular occurrence of contact between patient and 1435 * health care provider.) 1436 */ 1437 protected Encounter encounterTarget; 1438 1439 /** 1440 * Can be the reason or the indication for writing the prescription. 1441 */ 1442 @Child(name = "reason", type = { CodeableConcept.class, 1443 Condition.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 1444 @Description(shortDefinition = "Reason or indication for writing the prescription", formalDefinition = "Can be the reason or the indication for writing the prescription.") 1445 protected Type reason; 1446 1447 /** 1448 * Deals with details of the dispense part of the supply specification. 1449 */ 1450 @Child(name = "dispense", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1451 @Description(shortDefinition = "Vision supply authorization", formalDefinition = "Deals with details of the dispense part of the supply specification.") 1452 protected List<VisionPrescriptionDispenseComponent> dispense; 1453 1454 private static final long serialVersionUID = -1108276057L; 1455 1456 /* 1457 * Constructor 1458 */ 1459 public VisionPrescription() { 1460 super(); 1461 } 1462 1463 /** 1464 * @return {@link #identifier} (Business identifier which may be used by other 1465 * parties to reference or identify the prescription.) 1466 */ 1467 public List<Identifier> getIdentifier() { 1468 if (this.identifier == null) 1469 this.identifier = new ArrayList<Identifier>(); 1470 return this.identifier; 1471 } 1472 1473 public boolean hasIdentifier() { 1474 if (this.identifier == null) 1475 return false; 1476 for (Identifier item : this.identifier) 1477 if (!item.isEmpty()) 1478 return true; 1479 return false; 1480 } 1481 1482 /** 1483 * @return {@link #identifier} (Business identifier which may be used by other 1484 * parties to reference or identify the prescription.) 1485 */ 1486 // syntactic sugar 1487 public Identifier addIdentifier() { // 3 1488 Identifier t = new Identifier(); 1489 if (this.identifier == null) 1490 this.identifier = new ArrayList<Identifier>(); 1491 this.identifier.add(t); 1492 return t; 1493 } 1494 1495 // syntactic sugar 1496 public VisionPrescription addIdentifier(Identifier t) { // 3 1497 if (t == null) 1498 return this; 1499 if (this.identifier == null) 1500 this.identifier = new ArrayList<Identifier>(); 1501 this.identifier.add(t); 1502 return this; 1503 } 1504 1505 /** 1506 * @return {@link #dateWritten} (The date (and perhaps time) when the 1507 * prescription was written.). This is the underlying object with id, 1508 * value and extensions. The accessor "getDateWritten" gives direct 1509 * access to the value 1510 */ 1511 public DateTimeType getDateWrittenElement() { 1512 if (this.dateWritten == null) 1513 if (Configuration.errorOnAutoCreate()) 1514 throw new Error("Attempt to auto-create VisionPrescription.dateWritten"); 1515 else if (Configuration.doAutoCreate()) 1516 this.dateWritten = new DateTimeType(); // bb 1517 return this.dateWritten; 1518 } 1519 1520 public boolean hasDateWrittenElement() { 1521 return this.dateWritten != null && !this.dateWritten.isEmpty(); 1522 } 1523 1524 public boolean hasDateWritten() { 1525 return this.dateWritten != null && !this.dateWritten.isEmpty(); 1526 } 1527 1528 /** 1529 * @param value {@link #dateWritten} (The date (and perhaps time) when the 1530 * prescription was written.). This is the underlying object with 1531 * id, value and extensions. The accessor "getDateWritten" gives 1532 * direct access to the value 1533 */ 1534 public VisionPrescription setDateWrittenElement(DateTimeType value) { 1535 this.dateWritten = value; 1536 return this; 1537 } 1538 1539 /** 1540 * @return The date (and perhaps time) when the prescription was written. 1541 */ 1542 public Date getDateWritten() { 1543 return this.dateWritten == null ? null : this.dateWritten.getValue(); 1544 } 1545 1546 /** 1547 * @param value The date (and perhaps time) when the prescription was written. 1548 */ 1549 public VisionPrescription setDateWritten(Date value) { 1550 if (value == null) 1551 this.dateWritten = null; 1552 else { 1553 if (this.dateWritten == null) 1554 this.dateWritten = new DateTimeType(); 1555 this.dateWritten.setValue(value); 1556 } 1557 return this; 1558 } 1559 1560 /** 1561 * @return {@link #patient} (A link to a resource representing the person to 1562 * whom the vision products will be supplied.) 1563 */ 1564 public Reference getPatient() { 1565 if (this.patient == null) 1566 if (Configuration.errorOnAutoCreate()) 1567 throw new Error("Attempt to auto-create VisionPrescription.patient"); 1568 else if (Configuration.doAutoCreate()) 1569 this.patient = new Reference(); // cc 1570 return this.patient; 1571 } 1572 1573 public boolean hasPatient() { 1574 return this.patient != null && !this.patient.isEmpty(); 1575 } 1576 1577 /** 1578 * @param value {@link #patient} (A link to a resource representing the person 1579 * to whom the vision products will be supplied.) 1580 */ 1581 public VisionPrescription setPatient(Reference value) { 1582 this.patient = value; 1583 return this; 1584 } 1585 1586 /** 1587 * @return {@link #patient} The actual object that is the target of the 1588 * reference. The reference library doesn't populate this, but you can 1589 * use it to hold the resource if you resolve it. (A link to a resource 1590 * representing the person to whom the vision products will be 1591 * supplied.) 1592 */ 1593 public Patient getPatientTarget() { 1594 if (this.patientTarget == null) 1595 if (Configuration.errorOnAutoCreate()) 1596 throw new Error("Attempt to auto-create VisionPrescription.patient"); 1597 else if (Configuration.doAutoCreate()) 1598 this.patientTarget = new Patient(); // aa 1599 return this.patientTarget; 1600 } 1601 1602 /** 1603 * @param value {@link #patient} The actual object that is the target of the 1604 * reference. The reference library doesn't use these, but you can 1605 * use it to hold the resource if you resolve it. (A link to a 1606 * resource representing the person to whom the vision products 1607 * will be supplied.) 1608 */ 1609 public VisionPrescription setPatientTarget(Patient value) { 1610 this.patientTarget = value; 1611 return this; 1612 } 1613 1614 /** 1615 * @return {@link #prescriber} (The healthcare professional responsible for 1616 * authorizing the prescription.) 1617 */ 1618 public Reference getPrescriber() { 1619 if (this.prescriber == null) 1620 if (Configuration.errorOnAutoCreate()) 1621 throw new Error("Attempt to auto-create VisionPrescription.prescriber"); 1622 else if (Configuration.doAutoCreate()) 1623 this.prescriber = new Reference(); // cc 1624 return this.prescriber; 1625 } 1626 1627 public boolean hasPrescriber() { 1628 return this.prescriber != null && !this.prescriber.isEmpty(); 1629 } 1630 1631 /** 1632 * @param value {@link #prescriber} (The healthcare professional responsible for 1633 * authorizing the prescription.) 1634 */ 1635 public VisionPrescription setPrescriber(Reference value) { 1636 this.prescriber = value; 1637 return this; 1638 } 1639 1640 /** 1641 * @return {@link #prescriber} The actual object that is the target of the 1642 * reference. The reference library doesn't populate this, but you can 1643 * use it to hold the resource if you resolve it. (The healthcare 1644 * professional responsible for authorizing the prescription.) 1645 */ 1646 public Practitioner getPrescriberTarget() { 1647 if (this.prescriberTarget == null) 1648 if (Configuration.errorOnAutoCreate()) 1649 throw new Error("Attempt to auto-create VisionPrescription.prescriber"); 1650 else if (Configuration.doAutoCreate()) 1651 this.prescriberTarget = new Practitioner(); // aa 1652 return this.prescriberTarget; 1653 } 1654 1655 /** 1656 * @param value {@link #prescriber} The actual object that is the target of the 1657 * reference. The reference library doesn't use these, but you can 1658 * use it to hold the resource if you resolve it. (The healthcare 1659 * professional responsible for authorizing the prescription.) 1660 */ 1661 public VisionPrescription setPrescriberTarget(Practitioner value) { 1662 this.prescriberTarget = value; 1663 return this; 1664 } 1665 1666 /** 1667 * @return {@link #encounter} (A link to a resource that identifies the 1668 * particular occurrence of contact between patient and health care 1669 * provider.) 1670 */ 1671 public Reference getEncounter() { 1672 if (this.encounter == null) 1673 if (Configuration.errorOnAutoCreate()) 1674 throw new Error("Attempt to auto-create VisionPrescription.encounter"); 1675 else if (Configuration.doAutoCreate()) 1676 this.encounter = new Reference(); // cc 1677 return this.encounter; 1678 } 1679 1680 public boolean hasEncounter() { 1681 return this.encounter != null && !this.encounter.isEmpty(); 1682 } 1683 1684 /** 1685 * @param value {@link #encounter} (A link to a resource that identifies the 1686 * particular occurrence of contact between patient and health care 1687 * provider.) 1688 */ 1689 public VisionPrescription setEncounter(Reference value) { 1690 this.encounter = value; 1691 return this; 1692 } 1693 1694 /** 1695 * @return {@link #encounter} The actual object that is the target of the 1696 * reference. The reference library doesn't populate this, but you can 1697 * use it to hold the resource if you resolve it. (A link to a resource 1698 * that identifies the particular occurrence of contact between patient 1699 * and health care provider.) 1700 */ 1701 public Encounter getEncounterTarget() { 1702 if (this.encounterTarget == null) 1703 if (Configuration.errorOnAutoCreate()) 1704 throw new Error("Attempt to auto-create VisionPrescription.encounter"); 1705 else if (Configuration.doAutoCreate()) 1706 this.encounterTarget = new Encounter(); // aa 1707 return this.encounterTarget; 1708 } 1709 1710 /** 1711 * @param value {@link #encounter} The actual object that is the target of the 1712 * reference. The reference library doesn't use these, but you can 1713 * use it to hold the resource if you resolve it. (A link to a 1714 * resource that identifies the particular occurrence of contact 1715 * between patient and health care provider.) 1716 */ 1717 public VisionPrescription setEncounterTarget(Encounter value) { 1718 this.encounterTarget = value; 1719 return this; 1720 } 1721 1722 /** 1723 * @return {@link #reason} (Can be the reason or the indication for writing the 1724 * prescription.) 1725 */ 1726 public Type getReason() { 1727 return this.reason; 1728 } 1729 1730 /** 1731 * @return {@link #reason} (Can be the reason or the indication for writing the 1732 * prescription.) 1733 */ 1734 public CodeableConcept getReasonCodeableConcept() throws FHIRException { 1735 if (!(this.reason instanceof CodeableConcept)) 1736 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but " 1737 + this.reason.getClass().getName() + " was encountered"); 1738 return (CodeableConcept) this.reason; 1739 } 1740 1741 public boolean hasReasonCodeableConcept() { 1742 return this.reason instanceof CodeableConcept; 1743 } 1744 1745 /** 1746 * @return {@link #reason} (Can be the reason or the indication for writing the 1747 * prescription.) 1748 */ 1749 public Reference getReasonReference() throws FHIRException { 1750 if (!(this.reason instanceof Reference)) 1751 throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.reason.getClass().getName() 1752 + " was encountered"); 1753 return (Reference) this.reason; 1754 } 1755 1756 public boolean hasReasonReference() { 1757 return this.reason instanceof Reference; 1758 } 1759 1760 public boolean hasReason() { 1761 return this.reason != null && !this.reason.isEmpty(); 1762 } 1763 1764 /** 1765 * @param value {@link #reason} (Can be the reason or the indication for writing 1766 * the prescription.) 1767 */ 1768 public VisionPrescription setReason(Type value) { 1769 this.reason = value; 1770 return this; 1771 } 1772 1773 /** 1774 * @return {@link #dispense} (Deals with details of the dispense part of the 1775 * supply specification.) 1776 */ 1777 public List<VisionPrescriptionDispenseComponent> getDispense() { 1778 if (this.dispense == null) 1779 this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>(); 1780 return this.dispense; 1781 } 1782 1783 public boolean hasDispense() { 1784 if (this.dispense == null) 1785 return false; 1786 for (VisionPrescriptionDispenseComponent item : this.dispense) 1787 if (!item.isEmpty()) 1788 return true; 1789 return false; 1790 } 1791 1792 /** 1793 * @return {@link #dispense} (Deals with details of the dispense part of the 1794 * supply specification.) 1795 */ 1796 // syntactic sugar 1797 public VisionPrescriptionDispenseComponent addDispense() { // 3 1798 VisionPrescriptionDispenseComponent t = new VisionPrescriptionDispenseComponent(); 1799 if (this.dispense == null) 1800 this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>(); 1801 this.dispense.add(t); 1802 return t; 1803 } 1804 1805 // syntactic sugar 1806 public VisionPrescription addDispense(VisionPrescriptionDispenseComponent t) { // 3 1807 if (t == null) 1808 return this; 1809 if (this.dispense == null) 1810 this.dispense = new ArrayList<VisionPrescriptionDispenseComponent>(); 1811 this.dispense.add(t); 1812 return this; 1813 } 1814 1815 protected void listChildren(List<Property> childrenList) { 1816 super.listChildren(childrenList); 1817 childrenList.add(new Property("identifier", "Identifier", 1818 "Business identifier which may be used by other parties to reference or identify the prescription.", 0, 1819 java.lang.Integer.MAX_VALUE, identifier)); 1820 childrenList.add(new Property("dateWritten", "dateTime", 1821 "The date (and perhaps time) when the prescription was written.", 0, java.lang.Integer.MAX_VALUE, dateWritten)); 1822 childrenList.add(new Property("patient", "Reference(Patient)", 1823 "A link to a resource representing the person to whom the vision products will be supplied.", 0, 1824 java.lang.Integer.MAX_VALUE, patient)); 1825 childrenList.add(new Property("prescriber", "Reference(Practitioner)", 1826 "The healthcare professional responsible for authorizing the prescription.", 0, java.lang.Integer.MAX_VALUE, 1827 prescriber)); 1828 childrenList.add(new Property("encounter", "Reference(Encounter)", 1829 "A link to a resource that identifies the particular occurrence of contact between patient and health care provider.", 1830 0, java.lang.Integer.MAX_VALUE, encounter)); 1831 childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Condition)", 1832 "Can be the reason or the indication for writing the prescription.", 0, java.lang.Integer.MAX_VALUE, reason)); 1833 childrenList 1834 .add(new Property("dispense", "", "Deals with details of the dispense part of the supply specification.", 0, 1835 java.lang.Integer.MAX_VALUE, dispense)); 1836 } 1837 1838 @Override 1839 public void setProperty(String name, Base value) throws FHIRException { 1840 if (name.equals("identifier")) 1841 this.getIdentifier().add(castToIdentifier(value)); 1842 else if (name.equals("dateWritten")) 1843 this.dateWritten = castToDateTime(value); // DateTimeType 1844 else if (name.equals("patient")) 1845 this.patient = castToReference(value); // Reference 1846 else if (name.equals("prescriber")) 1847 this.prescriber = castToReference(value); // Reference 1848 else if (name.equals("encounter")) 1849 this.encounter = castToReference(value); // Reference 1850 else if (name.equals("reason[x]")) 1851 this.reason = (Type) value; // Type 1852 else if (name.equals("dispense")) 1853 this.getDispense().add((VisionPrescriptionDispenseComponent) value); 1854 else 1855 super.setProperty(name, value); 1856 } 1857 1858 @Override 1859 public Base addChild(String name) throws FHIRException { 1860 if (name.equals("identifier")) { 1861 return addIdentifier(); 1862 } else if (name.equals("dateWritten")) { 1863 throw new FHIRException("Cannot call addChild on a singleton property VisionPrescription.dateWritten"); 1864 } else if (name.equals("patient")) { 1865 this.patient = new Reference(); 1866 return this.patient; 1867 } else if (name.equals("prescriber")) { 1868 this.prescriber = new Reference(); 1869 return this.prescriber; 1870 } else if (name.equals("encounter")) { 1871 this.encounter = new Reference(); 1872 return this.encounter; 1873 } else if (name.equals("reasonCodeableConcept")) { 1874 this.reason = new CodeableConcept(); 1875 return this.reason; 1876 } else if (name.equals("reasonReference")) { 1877 this.reason = new Reference(); 1878 return this.reason; 1879 } else if (name.equals("dispense")) { 1880 return addDispense(); 1881 } else 1882 return super.addChild(name); 1883 } 1884 1885 public String fhirType() { 1886 return "VisionPrescription"; 1887 1888 } 1889 1890 public VisionPrescription copy() { 1891 VisionPrescription dst = new VisionPrescription(); 1892 copyValues(dst); 1893 if (identifier != null) { 1894 dst.identifier = new ArrayList<Identifier>(); 1895 for (Identifier i : identifier) 1896 dst.identifier.add(i.copy()); 1897 } 1898 ; 1899 dst.dateWritten = dateWritten == null ? null : dateWritten.copy(); 1900 dst.patient = patient == null ? null : patient.copy(); 1901 dst.prescriber = prescriber == null ? null : prescriber.copy(); 1902 dst.encounter = encounter == null ? null : encounter.copy(); 1903 dst.reason = reason == null ? null : reason.copy(); 1904 if (dispense != null) { 1905 dst.dispense = new ArrayList<VisionPrescriptionDispenseComponent>(); 1906 for (VisionPrescriptionDispenseComponent i : dispense) 1907 dst.dispense.add(i.copy()); 1908 } 1909 ; 1910 return dst; 1911 } 1912 1913 protected VisionPrescription typedCopy() { 1914 return copy(); 1915 } 1916 1917 @Override 1918 public boolean equalsDeep(Base other) { 1919 if (!super.equalsDeep(other)) 1920 return false; 1921 if (!(other instanceof VisionPrescription)) 1922 return false; 1923 VisionPrescription o = (VisionPrescription) other; 1924 return compareDeep(identifier, o.identifier, true) && compareDeep(dateWritten, o.dateWritten, true) 1925 && compareDeep(patient, o.patient, true) && compareDeep(prescriber, o.prescriber, true) 1926 && compareDeep(encounter, o.encounter, true) && compareDeep(reason, o.reason, true) 1927 && compareDeep(dispense, o.dispense, true); 1928 } 1929 1930 @Override 1931 public boolean equalsShallow(Base other) { 1932 if (!super.equalsShallow(other)) 1933 return false; 1934 if (!(other instanceof VisionPrescription)) 1935 return false; 1936 VisionPrescription o = (VisionPrescription) other; 1937 return compareValues(dateWritten, o.dateWritten, true); 1938 } 1939 1940 public boolean isEmpty() { 1941 return super.isEmpty() && (identifier == null || identifier.isEmpty()) 1942 && (dateWritten == null || dateWritten.isEmpty()) && (patient == null || patient.isEmpty()) 1943 && (prescriber == null || prescriber.isEmpty()) && (encounter == null || encounter.isEmpty()) 1944 && (reason == null || reason.isEmpty()) && (dispense == null || dispense.isEmpty()); 1945 } 1946 1947 @Override 1948 public ResourceType getResourceType() { 1949 return ResourceType.VisionPrescription; 1950 } 1951 1952 @SearchParamDefinition(name = "prescriber", path = "VisionPrescription.prescriber", description = "Who authorizes the vision product", type = "reference") 1953 public static final String SP_PRESCRIBER = "prescriber"; 1954 @SearchParamDefinition(name = "identifier", path = "VisionPrescription.identifier", description = "Return prescriptions with this external identifier", type = "token") 1955 public static final String SP_IDENTIFIER = "identifier"; 1956 @SearchParamDefinition(name = "patient", path = "VisionPrescription.patient", description = "The identity of a patient to list dispenses for", type = "reference") 1957 public static final String SP_PATIENT = "patient"; 1958 @SearchParamDefinition(name = "datewritten", path = "VisionPrescription.dateWritten", description = "Return prescriptions written on this date", type = "date") 1959 public static final String SP_DATEWRITTEN = "datewritten"; 1960 @SearchParamDefinition(name = "encounter", path = "VisionPrescription.encounter", description = "Return prescriptions with this encounter identifier", type = "reference") 1961 public static final String SP_ENCOUNTER = "encounter"; 1962 1963}