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