001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 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.exceptions.FHIRException; 045/** 046 * A record of a device being used by a patient where the record is the result of a report from the patient or another clinician. 047 */ 048@ResourceDef(name="DeviceUseStatement", profile="http://hl7.org/fhir/Profile/DeviceUseStatement") 049public class DeviceUseStatement extends DomainResource { 050 051 /** 052 * Indicates the site on the subject's body where the device was used ( i.e. the target site). 053 */ 054 @Child(name = "bodySite", type = {CodeableConcept.class, BodySite.class}, order=0, min=0, max=1, modifier=false, summary=true) 055 @Description(shortDefinition="Target body site", formalDefinition="Indicates the site on the subject's body where the device was used ( i.e. the target site)." ) 056 protected Type bodySite; 057 058 /** 059 * The time period over which the device was used. 060 */ 061 @Child(name = "whenUsed", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 062 @Description(shortDefinition="", formalDefinition="The time period over which the device was used." ) 063 protected Period whenUsed; 064 065 /** 066 * The details of the device used. 067 */ 068 @Child(name = "device", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=true) 069 @Description(shortDefinition="", formalDefinition="The details of the device used." ) 070 protected Reference device; 071 072 /** 073 * The actual object that is the target of the reference (The details of the device used.) 074 */ 075 protected Device deviceTarget; 076 077 /** 078 * An external identifier for this statement such as an IRI. 079 */ 080 @Child(name = "identifier", type = {Identifier.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 081 @Description(shortDefinition="", formalDefinition="An external identifier for this statement such as an IRI." ) 082 protected List<Identifier> identifier; 083 084 /** 085 * Reason or justification for the use of the device. 086 */ 087 @Child(name = "indication", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 088 @Description(shortDefinition="", formalDefinition="Reason or justification for the use of the device." ) 089 protected List<CodeableConcept> indication; 090 091 /** 092 * Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement. 093 */ 094 @Child(name = "notes", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 095 @Description(shortDefinition="", formalDefinition="Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." ) 096 protected List<StringType> notes; 097 098 /** 099 * The time at which the statement was made/recorded. 100 */ 101 @Child(name = "recordedOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 102 @Description(shortDefinition="", formalDefinition="The time at which the statement was made/recorded." ) 103 protected DateTimeType recordedOn; 104 105 /** 106 * The patient who used the device. 107 */ 108 @Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true) 109 @Description(shortDefinition="", formalDefinition="The patient who used the device." ) 110 protected Reference subject; 111 112 /** 113 * The actual object that is the target of the reference (The patient who used the device.) 114 */ 115 protected Patient subjectTarget; 116 117 /** 118 * How often the device was used. 119 */ 120 @Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 121 @Description(shortDefinition="", formalDefinition="How often the device was used." ) 122 protected Type timing; 123 124 private static final long serialVersionUID = -1668571635L; 125 126 /* 127 * Constructor 128 */ 129 public DeviceUseStatement() { 130 super(); 131 } 132 133 /* 134 * Constructor 135 */ 136 public DeviceUseStatement(Reference device, Reference subject) { 137 super(); 138 this.device = device; 139 this.subject = subject; 140 } 141 142 /** 143 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 144 */ 145 public Type getBodySite() { 146 return this.bodySite; 147 } 148 149 /** 150 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 151 */ 152 public CodeableConcept getBodySiteCodeableConcept() throws FHIRException { 153 if (!(this.bodySite instanceof CodeableConcept)) 154 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 155 return (CodeableConcept) this.bodySite; 156 } 157 158 public boolean hasBodySiteCodeableConcept() { 159 return this.bodySite instanceof CodeableConcept; 160 } 161 162 /** 163 * @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 164 */ 165 public Reference getBodySiteReference() throws FHIRException { 166 if (!(this.bodySite instanceof Reference)) 167 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.bodySite.getClass().getName()+" was encountered"); 168 return (Reference) this.bodySite; 169 } 170 171 public boolean hasBodySiteReference() { 172 return this.bodySite instanceof Reference; 173 } 174 175 public boolean hasBodySite() { 176 return this.bodySite != null && !this.bodySite.isEmpty(); 177 } 178 179 /** 180 * @param value {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).) 181 */ 182 public DeviceUseStatement setBodySite(Type value) { 183 this.bodySite = value; 184 return this; 185 } 186 187 /** 188 * @return {@link #whenUsed} (The time period over which the device was used.) 189 */ 190 public Period getWhenUsed() { 191 if (this.whenUsed == null) 192 if (Configuration.errorOnAutoCreate()) 193 throw new Error("Attempt to auto-create DeviceUseStatement.whenUsed"); 194 else if (Configuration.doAutoCreate()) 195 this.whenUsed = new Period(); // cc 196 return this.whenUsed; 197 } 198 199 public boolean hasWhenUsed() { 200 return this.whenUsed != null && !this.whenUsed.isEmpty(); 201 } 202 203 /** 204 * @param value {@link #whenUsed} (The time period over which the device was used.) 205 */ 206 public DeviceUseStatement setWhenUsed(Period value) { 207 this.whenUsed = value; 208 return this; 209 } 210 211 /** 212 * @return {@link #device} (The details of the device used.) 213 */ 214 public Reference getDevice() { 215 if (this.device == null) 216 if (Configuration.errorOnAutoCreate()) 217 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 218 else if (Configuration.doAutoCreate()) 219 this.device = new Reference(); // cc 220 return this.device; 221 } 222 223 public boolean hasDevice() { 224 return this.device != null && !this.device.isEmpty(); 225 } 226 227 /** 228 * @param value {@link #device} (The details of the device used.) 229 */ 230 public DeviceUseStatement setDevice(Reference value) { 231 this.device = value; 232 return this; 233 } 234 235 /** 236 * @return {@link #device} 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 details of the device used.) 237 */ 238 public Device getDeviceTarget() { 239 if (this.deviceTarget == null) 240 if (Configuration.errorOnAutoCreate()) 241 throw new Error("Attempt to auto-create DeviceUseStatement.device"); 242 else if (Configuration.doAutoCreate()) 243 this.deviceTarget = new Device(); // aa 244 return this.deviceTarget; 245 } 246 247 /** 248 * @param value {@link #device} 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 details of the device used.) 249 */ 250 public DeviceUseStatement setDeviceTarget(Device value) { 251 this.deviceTarget = value; 252 return this; 253 } 254 255 /** 256 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 257 */ 258 public List<Identifier> getIdentifier() { 259 if (this.identifier == null) 260 this.identifier = new ArrayList<Identifier>(); 261 return this.identifier; 262 } 263 264 public boolean hasIdentifier() { 265 if (this.identifier == null) 266 return false; 267 for (Identifier item : this.identifier) 268 if (!item.isEmpty()) 269 return true; 270 return false; 271 } 272 273 /** 274 * @return {@link #identifier} (An external identifier for this statement such as an IRI.) 275 */ 276 // syntactic sugar 277 public Identifier addIdentifier() { //3 278 Identifier t = new Identifier(); 279 if (this.identifier == null) 280 this.identifier = new ArrayList<Identifier>(); 281 this.identifier.add(t); 282 return t; 283 } 284 285 // syntactic sugar 286 public DeviceUseStatement addIdentifier(Identifier t) { //3 287 if (t == null) 288 return this; 289 if (this.identifier == null) 290 this.identifier = new ArrayList<Identifier>(); 291 this.identifier.add(t); 292 return this; 293 } 294 295 /** 296 * @return {@link #indication} (Reason or justification for the use of the device.) 297 */ 298 public List<CodeableConcept> getIndication() { 299 if (this.indication == null) 300 this.indication = new ArrayList<CodeableConcept>(); 301 return this.indication; 302 } 303 304 public boolean hasIndication() { 305 if (this.indication == null) 306 return false; 307 for (CodeableConcept item : this.indication) 308 if (!item.isEmpty()) 309 return true; 310 return false; 311 } 312 313 /** 314 * @return {@link #indication} (Reason or justification for the use of the device.) 315 */ 316 // syntactic sugar 317 public CodeableConcept addIndication() { //3 318 CodeableConcept t = new CodeableConcept(); 319 if (this.indication == null) 320 this.indication = new ArrayList<CodeableConcept>(); 321 this.indication.add(t); 322 return t; 323 } 324 325 // syntactic sugar 326 public DeviceUseStatement addIndication(CodeableConcept t) { //3 327 if (t == null) 328 return this; 329 if (this.indication == null) 330 this.indication = new ArrayList<CodeableConcept>(); 331 this.indication.add(t); 332 return this; 333 } 334 335 /** 336 * @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 337 */ 338 public List<StringType> getNotes() { 339 if (this.notes == null) 340 this.notes = new ArrayList<StringType>(); 341 return this.notes; 342 } 343 344 public boolean hasNotes() { 345 if (this.notes == null) 346 return false; 347 for (StringType item : this.notes) 348 if (!item.isEmpty()) 349 return true; 350 return false; 351 } 352 353 /** 354 * @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 355 */ 356 // syntactic sugar 357 public StringType addNotesElement() {//2 358 StringType t = new StringType(); 359 if (this.notes == null) 360 this.notes = new ArrayList<StringType>(); 361 this.notes.add(t); 362 return t; 363 } 364 365 /** 366 * @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 367 */ 368 public DeviceUseStatement addNotes(String value) { //1 369 StringType t = new StringType(); 370 t.setValue(value); 371 if (this.notes == null) 372 this.notes = new ArrayList<StringType>(); 373 this.notes.add(t); 374 return this; 375 } 376 377 /** 378 * @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.) 379 */ 380 public boolean hasNotes(String value) { 381 if (this.notes == null) 382 return false; 383 for (StringType v : this.notes) 384 if (v.equals(value)) // string 385 return true; 386 return false; 387 } 388 389 /** 390 * @return {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 391 */ 392 public DateTimeType getRecordedOnElement() { 393 if (this.recordedOn == null) 394 if (Configuration.errorOnAutoCreate()) 395 throw new Error("Attempt to auto-create DeviceUseStatement.recordedOn"); 396 else if (Configuration.doAutoCreate()) 397 this.recordedOn = new DateTimeType(); // bb 398 return this.recordedOn; 399 } 400 401 public boolean hasRecordedOnElement() { 402 return this.recordedOn != null && !this.recordedOn.isEmpty(); 403 } 404 405 public boolean hasRecordedOn() { 406 return this.recordedOn != null && !this.recordedOn.isEmpty(); 407 } 408 409 /** 410 * @param value {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value 411 */ 412 public DeviceUseStatement setRecordedOnElement(DateTimeType value) { 413 this.recordedOn = value; 414 return this; 415 } 416 417 /** 418 * @return The time at which the statement was made/recorded. 419 */ 420 public Date getRecordedOn() { 421 return this.recordedOn == null ? null : this.recordedOn.getValue(); 422 } 423 424 /** 425 * @param value The time at which the statement was made/recorded. 426 */ 427 public DeviceUseStatement setRecordedOn(Date value) { 428 if (value == null) 429 this.recordedOn = null; 430 else { 431 if (this.recordedOn == null) 432 this.recordedOn = new DateTimeType(); 433 this.recordedOn.setValue(value); 434 } 435 return this; 436 } 437 438 /** 439 * @return {@link #subject} (The patient who used the device.) 440 */ 441 public Reference getSubject() { 442 if (this.subject == null) 443 if (Configuration.errorOnAutoCreate()) 444 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 445 else if (Configuration.doAutoCreate()) 446 this.subject = new Reference(); // cc 447 return this.subject; 448 } 449 450 public boolean hasSubject() { 451 return this.subject != null && !this.subject.isEmpty(); 452 } 453 454 /** 455 * @param value {@link #subject} (The patient who used the device.) 456 */ 457 public DeviceUseStatement setSubject(Reference value) { 458 this.subject = value; 459 return this; 460 } 461 462 /** 463 * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient who used the device.) 464 */ 465 public Patient getSubjectTarget() { 466 if (this.subjectTarget == null) 467 if (Configuration.errorOnAutoCreate()) 468 throw new Error("Attempt to auto-create DeviceUseStatement.subject"); 469 else if (Configuration.doAutoCreate()) 470 this.subjectTarget = new Patient(); // aa 471 return this.subjectTarget; 472 } 473 474 /** 475 * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient who used the device.) 476 */ 477 public DeviceUseStatement setSubjectTarget(Patient value) { 478 this.subjectTarget = value; 479 return this; 480 } 481 482 /** 483 * @return {@link #timing} (How often the device was used.) 484 */ 485 public Type getTiming() { 486 return this.timing; 487 } 488 489 /** 490 * @return {@link #timing} (How often the device was used.) 491 */ 492 public Timing getTimingTiming() throws FHIRException { 493 if (!(this.timing instanceof Timing)) 494 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 495 return (Timing) this.timing; 496 } 497 498 public boolean hasTimingTiming() { 499 return this.timing instanceof Timing; 500 } 501 502 /** 503 * @return {@link #timing} (How often the device was used.) 504 */ 505 public Period getTimingPeriod() throws FHIRException { 506 if (!(this.timing instanceof Period)) 507 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered"); 508 return (Period) this.timing; 509 } 510 511 public boolean hasTimingPeriod() { 512 return this.timing instanceof Period; 513 } 514 515 /** 516 * @return {@link #timing} (How often the device was used.) 517 */ 518 public DateTimeType getTimingDateTimeType() throws FHIRException { 519 if (!(this.timing instanceof DateTimeType)) 520 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered"); 521 return (DateTimeType) this.timing; 522 } 523 524 public boolean hasTimingDateTimeType() { 525 return this.timing instanceof DateTimeType; 526 } 527 528 public boolean hasTiming() { 529 return this.timing != null && !this.timing.isEmpty(); 530 } 531 532 /** 533 * @param value {@link #timing} (How often the device was used.) 534 */ 535 public DeviceUseStatement setTiming(Type value) { 536 this.timing = value; 537 return this; 538 } 539 540 protected void listChildren(List<Property> childrenList) { 541 super.listChildren(childrenList); 542 childrenList.add(new Property("bodySite[x]", "CodeableConcept|Reference(BodySite)", "Indicates the site on the subject's body where the device was used ( i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, bodySite)); 543 childrenList.add(new Property("whenUsed", "Period", "The time period over which the device was used.", 0, java.lang.Integer.MAX_VALUE, whenUsed)); 544 childrenList.add(new Property("device", "Reference(Device)", "The details of the device used.", 0, java.lang.Integer.MAX_VALUE, device)); 545 childrenList.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier)); 546 childrenList.add(new Property("indication", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, indication)); 547 childrenList.add(new Property("notes", "string", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, notes)); 548 childrenList.add(new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, java.lang.Integer.MAX_VALUE, recordedOn)); 549 childrenList.add(new Property("subject", "Reference(Patient)", "The patient who used the device.", 0, java.lang.Integer.MAX_VALUE, subject)); 550 childrenList.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, java.lang.Integer.MAX_VALUE, timing)); 551 } 552 553 @Override 554 public void setProperty(String name, Base value) throws FHIRException { 555 if (name.equals("bodySite[x]")) 556 this.bodySite = (Type) value; // Type 557 else if (name.equals("whenUsed")) 558 this.whenUsed = castToPeriod(value); // Period 559 else if (name.equals("device")) 560 this.device = castToReference(value); // Reference 561 else if (name.equals("identifier")) 562 this.getIdentifier().add(castToIdentifier(value)); 563 else if (name.equals("indication")) 564 this.getIndication().add(castToCodeableConcept(value)); 565 else if (name.equals("notes")) 566 this.getNotes().add(castToString(value)); 567 else if (name.equals("recordedOn")) 568 this.recordedOn = castToDateTime(value); // DateTimeType 569 else if (name.equals("subject")) 570 this.subject = castToReference(value); // Reference 571 else if (name.equals("timing[x]")) 572 this.timing = (Type) value; // Type 573 else 574 super.setProperty(name, value); 575 } 576 577 @Override 578 public Base addChild(String name) throws FHIRException { 579 if (name.equals("bodySiteCodeableConcept")) { 580 this.bodySite = new CodeableConcept(); 581 return this.bodySite; 582 } 583 else if (name.equals("bodySiteReference")) { 584 this.bodySite = new Reference(); 585 return this.bodySite; 586 } 587 else if (name.equals("whenUsed")) { 588 this.whenUsed = new Period(); 589 return this.whenUsed; 590 } 591 else if (name.equals("device")) { 592 this.device = new Reference(); 593 return this.device; 594 } 595 else if (name.equals("identifier")) { 596 return addIdentifier(); 597 } 598 else if (name.equals("indication")) { 599 return addIndication(); 600 } 601 else if (name.equals("notes")) { 602 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.notes"); 603 } 604 else if (name.equals("recordedOn")) { 605 throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.recordedOn"); 606 } 607 else if (name.equals("subject")) { 608 this.subject = new Reference(); 609 return this.subject; 610 } 611 else if (name.equals("timingTiming")) { 612 this.timing = new Timing(); 613 return this.timing; 614 } 615 else if (name.equals("timingPeriod")) { 616 this.timing = new Period(); 617 return this.timing; 618 } 619 else if (name.equals("timingDateTime")) { 620 this.timing = new DateTimeType(); 621 return this.timing; 622 } 623 else 624 return super.addChild(name); 625 } 626 627 public String fhirType() { 628 return "DeviceUseStatement"; 629 630 } 631 632 public DeviceUseStatement copy() { 633 DeviceUseStatement dst = new DeviceUseStatement(); 634 copyValues(dst); 635 dst.bodySite = bodySite == null ? null : bodySite.copy(); 636 dst.whenUsed = whenUsed == null ? null : whenUsed.copy(); 637 dst.device = device == null ? null : device.copy(); 638 if (identifier != null) { 639 dst.identifier = new ArrayList<Identifier>(); 640 for (Identifier i : identifier) 641 dst.identifier.add(i.copy()); 642 }; 643 if (indication != null) { 644 dst.indication = new ArrayList<CodeableConcept>(); 645 for (CodeableConcept i : indication) 646 dst.indication.add(i.copy()); 647 }; 648 if (notes != null) { 649 dst.notes = new ArrayList<StringType>(); 650 for (StringType i : notes) 651 dst.notes.add(i.copy()); 652 }; 653 dst.recordedOn = recordedOn == null ? null : recordedOn.copy(); 654 dst.subject = subject == null ? null : subject.copy(); 655 dst.timing = timing == null ? null : timing.copy(); 656 return dst; 657 } 658 659 protected DeviceUseStatement typedCopy() { 660 return copy(); 661 } 662 663 @Override 664 public boolean equalsDeep(Base other) { 665 if (!super.equalsDeep(other)) 666 return false; 667 if (!(other instanceof DeviceUseStatement)) 668 return false; 669 DeviceUseStatement o = (DeviceUseStatement) other; 670 return compareDeep(bodySite, o.bodySite, true) && compareDeep(whenUsed, o.whenUsed, true) && compareDeep(device, o.device, true) 671 && compareDeep(identifier, o.identifier, true) && compareDeep(indication, o.indication, true) && compareDeep(notes, o.notes, true) 672 && compareDeep(recordedOn, o.recordedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(timing, o.timing, true) 673 ; 674 } 675 676 @Override 677 public boolean equalsShallow(Base other) { 678 if (!super.equalsShallow(other)) 679 return false; 680 if (!(other instanceof DeviceUseStatement)) 681 return false; 682 DeviceUseStatement o = (DeviceUseStatement) other; 683 return compareValues(notes, o.notes, true) && compareValues(recordedOn, o.recordedOn, true); 684 } 685 686 public boolean isEmpty() { 687 return super.isEmpty() && (bodySite == null || bodySite.isEmpty()) && (whenUsed == null || whenUsed.isEmpty()) 688 && (device == null || device.isEmpty()) && (identifier == null || identifier.isEmpty()) && (indication == null || indication.isEmpty()) 689 && (notes == null || notes.isEmpty()) && (recordedOn == null || recordedOn.isEmpty()) && (subject == null || subject.isEmpty()) 690 && (timing == null || timing.isEmpty()); 691 } 692 693 @Override 694 public ResourceType getResourceType() { 695 return ResourceType.DeviceUseStatement; 696 } 697 698 @SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference" ) 699 public static final String SP_SUBJECT = "subject"; 700 @SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference" ) 701 public static final String SP_PATIENT = "patient"; 702 @SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference" ) 703 public static final String SP_DEVICE = "device"; 704 705}