All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hl7.fhir.r4.model.DeviceRequest Maven / Gradle / Ivy

Go to download

Builds the hapi fhir r4. Requires hapi-fhir-base and hapi-fhir-utilities be built first and be excluded from any other poms requiring it.

The newest version!
package org.hl7.fhir.r4.model;

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  
*/

// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;

import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;

/**
 * Represents a request for a patient to employ a medical device. The device may
 * be an implantable device, or an external assistive device, such as a walker.
 */
@ResourceDef(name = "DeviceRequest", profile = "http://hl7.org/fhir/StructureDefinition/DeviceRequest")
public class DeviceRequest extends DomainResource {

  public enum DeviceRequestStatus {
    /**
     * The request has been created but is not yet complete or ready for action.
     */
    DRAFT,
    /**
     * The request is in force and ready to be acted upon.
     */
    ACTIVE,
    /**
     * The request (and any implicit authorization to act) has been temporarily
     * withdrawn but is expected to resume in the future.
     */
    ONHOLD,
    /**
     * The request (and any implicit authorization to act) has been terminated prior
     * to the known full completion of the intended actions. No further activity
     * should occur.
     */
    REVOKED,
    /**
     * The activity described by the request has been fully performed. No further
     * activity will occur.
     */
    COMPLETED,
    /**
     * This request should never have existed and should be considered 'void'. (It
     * is possible that real-world decisions were based on it. If real-world
     * activity has occurred, the status should be "revoked" rather than
     * "entered-in-error".).
     */
    ENTEREDINERROR,
    /**
     * The authoring/source system does not know which of the status values
     * currently applies for this request. Note: This concept is not to be used for
     * "other" - one of the listed statuses is presumed to apply, but the
     * authoring/source system does not know which.
     */
    UNKNOWN,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static DeviceRequestStatus fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("draft".equals(codeString))
        return DRAFT;
      if ("active".equals(codeString))
        return ACTIVE;
      if ("on-hold".equals(codeString))
        return ONHOLD;
      if ("revoked".equals(codeString))
        return REVOKED;
      if ("completed".equals(codeString))
        return COMPLETED;
      if ("entered-in-error".equals(codeString))
        return ENTEREDINERROR;
      if ("unknown".equals(codeString))
        return UNKNOWN;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown DeviceRequestStatus code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case DRAFT:
        return "draft";
      case ACTIVE:
        return "active";
      case ONHOLD:
        return "on-hold";
      case REVOKED:
        return "revoked";
      case COMPLETED:
        return "completed";
      case ENTEREDINERROR:
        return "entered-in-error";
      case UNKNOWN:
        return "unknown";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case DRAFT:
        return "http://hl7.org/fhir/request-status";
      case ACTIVE:
        return "http://hl7.org/fhir/request-status";
      case ONHOLD:
        return "http://hl7.org/fhir/request-status";
      case REVOKED:
        return "http://hl7.org/fhir/request-status";
      case COMPLETED:
        return "http://hl7.org/fhir/request-status";
      case ENTEREDINERROR:
        return "http://hl7.org/fhir/request-status";
      case UNKNOWN:
        return "http://hl7.org/fhir/request-status";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case DRAFT:
        return "The request has been created but is not yet complete or ready for action.";
      case ACTIVE:
        return "The request is in force and ready to be acted upon.";
      case ONHOLD:
        return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
      case REVOKED:
        return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
      case COMPLETED:
        return "The activity described by the request has been fully performed.  No further activity will occur.";
      case ENTEREDINERROR:
        return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"revoked\" rather than \"entered-in-error\".).";
      case UNKNOWN:
        return "The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case DRAFT:
        return "Draft";
      case ACTIVE:
        return "Active";
      case ONHOLD:
        return "On Hold";
      case REVOKED:
        return "Revoked";
      case COMPLETED:
        return "Completed";
      case ENTEREDINERROR:
        return "Entered in Error";
      case UNKNOWN:
        return "Unknown";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class DeviceRequestStatusEnumFactory implements EnumFactory {
    public DeviceRequestStatus fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("draft".equals(codeString))
        return DeviceRequestStatus.DRAFT;
      if ("active".equals(codeString))
        return DeviceRequestStatus.ACTIVE;
      if ("on-hold".equals(codeString))
        return DeviceRequestStatus.ONHOLD;
      if ("revoked".equals(codeString))
        return DeviceRequestStatus.REVOKED;
      if ("completed".equals(codeString))
        return DeviceRequestStatus.COMPLETED;
      if ("entered-in-error".equals(codeString))
        return DeviceRequestStatus.ENTEREDINERROR;
      if ("unknown".equals(codeString))
        return DeviceRequestStatus.UNKNOWN;
      throw new IllegalArgumentException("Unknown DeviceRequestStatus code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, DeviceRequestStatus.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.NULL, code);
      if ("draft".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.DRAFT, code);
      if ("active".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.ACTIVE, code);
      if ("on-hold".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.ONHOLD, code);
      if ("revoked".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.REVOKED, code);
      if ("completed".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.COMPLETED, code);
      if ("entered-in-error".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.ENTEREDINERROR, code);
      if ("unknown".equals(codeString))
        return new Enumeration(this, DeviceRequestStatus.UNKNOWN, code);
      throw new FHIRException("Unknown DeviceRequestStatus code '" + codeString + "'");
    }

    public String toCode(DeviceRequestStatus code) {
      if (code == DeviceRequestStatus.DRAFT)
        return "draft";
      if (code == DeviceRequestStatus.ACTIVE)
        return "active";
      if (code == DeviceRequestStatus.ONHOLD)
        return "on-hold";
      if (code == DeviceRequestStatus.REVOKED)
        return "revoked";
      if (code == DeviceRequestStatus.COMPLETED)
        return "completed";
      if (code == DeviceRequestStatus.ENTEREDINERROR)
        return "entered-in-error";
      if (code == DeviceRequestStatus.UNKNOWN)
        return "unknown";
      return "?";
    }

    public String toSystem(DeviceRequestStatus code) {
      return code.getSystem();
    }
  }

  public enum RequestIntent {
    /**
     * The request is a suggestion made by someone/something that does not have an
     * intention to ensure it occurs and without providing an authorization to act.
     */
    PROPOSAL,
    /**
     * The request represents an intention to ensure something occurs without
     * providing an authorization for others to act.
     */
    PLAN,
    /**
     * The request represents a legally binding instruction authored by a Patient or
     * RelatedPerson.
     */
    DIRECTIVE,
    /**
     * The request represents a request/demand and authorization for action by a
     * Practitioner.
     */
    ORDER,
    /**
     * The request represents an original authorization for action.
     */
    ORIGINALORDER,
    /**
     * The request represents an automatically generated supplemental authorization
     * for action based on a parent authorization together with initial results of
     * the action taken against that parent authorization.
     */
    REFLEXORDER,
    /**
     * The request represents the view of an authorization instantiated by a
     * fulfilling system representing the details of the fulfiller's intention to
     * act upon a submitted order.
     */
    FILLERORDER,
    /**
     * An order created in fulfillment of a broader order that represents the
     * authorization for a single activity occurrence. E.g. The administration of a
     * single dose of a drug.
     */
    INSTANCEORDER,
    /**
     * The request represents a component or option for a RequestGroup that
     * establishes timing, conditionality and/or other constraints among a set of
     * requests. Refer to [[[RequestGroup]]] for additional information on how this
     * status is used.
     */
    OPTION,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static RequestIntent fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("proposal".equals(codeString))
        return PROPOSAL;
      if ("plan".equals(codeString))
        return PLAN;
      if ("directive".equals(codeString))
        return DIRECTIVE;
      if ("order".equals(codeString))
        return ORDER;
      if ("original-order".equals(codeString))
        return ORIGINALORDER;
      if ("reflex-order".equals(codeString))
        return REFLEXORDER;
      if ("filler-order".equals(codeString))
        return FILLERORDER;
      if ("instance-order".equals(codeString))
        return INSTANCEORDER;
      if ("option".equals(codeString))
        return OPTION;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown RequestIntent code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case PROPOSAL:
        return "proposal";
      case PLAN:
        return "plan";
      case DIRECTIVE:
        return "directive";
      case ORDER:
        return "order";
      case ORIGINALORDER:
        return "original-order";
      case REFLEXORDER:
        return "reflex-order";
      case FILLERORDER:
        return "filler-order";
      case INSTANCEORDER:
        return "instance-order";
      case OPTION:
        return "option";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case PROPOSAL:
        return "http://hl7.org/fhir/request-intent";
      case PLAN:
        return "http://hl7.org/fhir/request-intent";
      case DIRECTIVE:
        return "http://hl7.org/fhir/request-intent";
      case ORDER:
        return "http://hl7.org/fhir/request-intent";
      case ORIGINALORDER:
        return "http://hl7.org/fhir/request-intent";
      case REFLEXORDER:
        return "http://hl7.org/fhir/request-intent";
      case FILLERORDER:
        return "http://hl7.org/fhir/request-intent";
      case INSTANCEORDER:
        return "http://hl7.org/fhir/request-intent";
      case OPTION:
        return "http://hl7.org/fhir/request-intent";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case PROPOSAL:
        return "The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.";
      case PLAN:
        return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
      case DIRECTIVE:
        return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
      case ORDER:
        return "The request represents a request/demand and authorization for action by a Practitioner.";
      case ORIGINALORDER:
        return "The request represents an original authorization for action.";
      case REFLEXORDER:
        return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.";
      case FILLERORDER:
        return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.";
      case INSTANCEORDER:
        return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
      case OPTION:
        return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case PROPOSAL:
        return "Proposal";
      case PLAN:
        return "Plan";
      case DIRECTIVE:
        return "Directive";
      case ORDER:
        return "Order";
      case ORIGINALORDER:
        return "Original Order";
      case REFLEXORDER:
        return "Reflex Order";
      case FILLERORDER:
        return "Filler Order";
      case INSTANCEORDER:
        return "Instance Order";
      case OPTION:
        return "Option";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class RequestIntentEnumFactory implements EnumFactory {
    public RequestIntent fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("proposal".equals(codeString))
        return RequestIntent.PROPOSAL;
      if ("plan".equals(codeString))
        return RequestIntent.PLAN;
      if ("directive".equals(codeString))
        return RequestIntent.DIRECTIVE;
      if ("order".equals(codeString))
        return RequestIntent.ORDER;
      if ("original-order".equals(codeString))
        return RequestIntent.ORIGINALORDER;
      if ("reflex-order".equals(codeString))
        return RequestIntent.REFLEXORDER;
      if ("filler-order".equals(codeString))
        return RequestIntent.FILLERORDER;
      if ("instance-order".equals(codeString))
        return RequestIntent.INSTANCEORDER;
      if ("option".equals(codeString))
        return RequestIntent.OPTION;
      throw new IllegalArgumentException("Unknown RequestIntent code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, RequestIntent.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, RequestIntent.NULL, code);
      if ("proposal".equals(codeString))
        return new Enumeration(this, RequestIntent.PROPOSAL, code);
      if ("plan".equals(codeString))
        return new Enumeration(this, RequestIntent.PLAN, code);
      if ("directive".equals(codeString))
        return new Enumeration(this, RequestIntent.DIRECTIVE, code);
      if ("order".equals(codeString))
        return new Enumeration(this, RequestIntent.ORDER, code);
      if ("original-order".equals(codeString))
        return new Enumeration(this, RequestIntent.ORIGINALORDER, code);
      if ("reflex-order".equals(codeString))
        return new Enumeration(this, RequestIntent.REFLEXORDER, code);
      if ("filler-order".equals(codeString))
        return new Enumeration(this, RequestIntent.FILLERORDER, code);
      if ("instance-order".equals(codeString))
        return new Enumeration(this, RequestIntent.INSTANCEORDER, code);
      if ("option".equals(codeString))
        return new Enumeration(this, RequestIntent.OPTION, code);
      throw new FHIRException("Unknown RequestIntent code '" + codeString + "'");
    }

    public String toCode(RequestIntent code) {
      if (code == RequestIntent.PROPOSAL)
        return "proposal";
      if (code == RequestIntent.PLAN)
        return "plan";
      if (code == RequestIntent.DIRECTIVE)
        return "directive";
      if (code == RequestIntent.ORDER)
        return "order";
      if (code == RequestIntent.ORIGINALORDER)
        return "original-order";
      if (code == RequestIntent.REFLEXORDER)
        return "reflex-order";
      if (code == RequestIntent.FILLERORDER)
        return "filler-order";
      if (code == RequestIntent.INSTANCEORDER)
        return "instance-order";
      if (code == RequestIntent.OPTION)
        return "option";
      return "?";
    }

    public String toSystem(RequestIntent code) {
      return code.getSystem();
    }
  }

  public enum RequestPriority {
    /**
     * The request has normal priority.
     */
    ROUTINE,
    /**
     * The request should be actioned promptly - higher priority than routine.
     */
    URGENT,
    /**
     * The request should be actioned as soon as possible - higher priority than
     * urgent.
     */
    ASAP,
    /**
     * The request should be actioned immediately - highest possible priority. E.g.
     * an emergency.
     */
    STAT,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static RequestPriority fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("routine".equals(codeString))
        return ROUTINE;
      if ("urgent".equals(codeString))
        return URGENT;
      if ("asap".equals(codeString))
        return ASAP;
      if ("stat".equals(codeString))
        return STAT;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown RequestPriority code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case ROUTINE:
        return "routine";
      case URGENT:
        return "urgent";
      case ASAP:
        return "asap";
      case STAT:
        return "stat";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case ROUTINE:
        return "http://hl7.org/fhir/request-priority";
      case URGENT:
        return "http://hl7.org/fhir/request-priority";
      case ASAP:
        return "http://hl7.org/fhir/request-priority";
      case STAT:
        return "http://hl7.org/fhir/request-priority";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case ROUTINE:
        return "The request has normal priority.";
      case URGENT:
        return "The request should be actioned promptly - higher priority than routine.";
      case ASAP:
        return "The request should be actioned as soon as possible - higher priority than urgent.";
      case STAT:
        return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case ROUTINE:
        return "Routine";
      case URGENT:
        return "Urgent";
      case ASAP:
        return "ASAP";
      case STAT:
        return "STAT";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class RequestPriorityEnumFactory implements EnumFactory {
    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("routine".equals(codeString))
        return RequestPriority.ROUTINE;
      if ("urgent".equals(codeString))
        return RequestPriority.URGENT;
      if ("asap".equals(codeString))
        return RequestPriority.ASAP;
      if ("stat".equals(codeString))
        return RequestPriority.STAT;
      throw new IllegalArgumentException("Unknown RequestPriority code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, RequestPriority.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, RequestPriority.NULL, code);
      if ("routine".equals(codeString))
        return new Enumeration(this, RequestPriority.ROUTINE, code);
      if ("urgent".equals(codeString))
        return new Enumeration(this, RequestPriority.URGENT, code);
      if ("asap".equals(codeString))
        return new Enumeration(this, RequestPriority.ASAP, code);
      if ("stat".equals(codeString))
        return new Enumeration(this, RequestPriority.STAT, code);
      throw new FHIRException("Unknown RequestPriority code '" + codeString + "'");
    }

    public String toCode(RequestPriority code) {
      if (code == RequestPriority.ROUTINE)
        return "routine";
      if (code == RequestPriority.URGENT)
        return "urgent";
      if (code == RequestPriority.ASAP)
        return "asap";
      if (code == RequestPriority.STAT)
        return "stat";
      return "?";
    }

    public String toSystem(RequestPriority code) {
      return code.getSystem();
    }
  }

  @Block()
  public static class DeviceRequestParameterComponent extends BackboneElement implements IBaseBackboneElement {
    /**
     * A code or string that identifies the device detail being asserted.
     */
    @Child(name = "code", type = {
        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "Device detail", formalDefinition = "A code or string that identifies the device detail being asserted.")
    protected CodeableConcept code;

    /**
     * The value of the device detail.
     */
    @Child(name = "value", type = { CodeableConcept.class, Quantity.class, Range.class,
        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "Value of detail", formalDefinition = "The value of the device detail.")
    protected Type value;

    private static final long serialVersionUID = 884525025L;

    /**
     * Constructor
     */
    public DeviceRequestParameterComponent() {
      super();
    }

    /**
     * @return {@link #code} (A code or string that identifies the device detail
     *         being asserted.)
     */
    public CodeableConcept getCode() {
      if (this.code == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create DeviceRequestParameterComponent.code");
        else if (Configuration.doAutoCreate())
          this.code = new CodeableConcept(); // cc
      return this.code;
    }

    public boolean hasCode() {
      return this.code != null && !this.code.isEmpty();
    }

    /**
     * @param value {@link #code} (A code or string that identifies the device
     *              detail being asserted.)
     */
    public DeviceRequestParameterComponent setCode(CodeableConcept value) {
      this.code = value;
      return this;
    }

    /**
     * @return {@link #value} (The value of the device detail.)
     */
    public Type getValue() {
      return this.value;
    }

    /**
     * @return {@link #value} (The value of the device detail.)
     */
    public CodeableConcept getValueCodeableConcept() throws FHIRException {
      if (this.value == null)
        this.value = new CodeableConcept();
      if (!(this.value instanceof CodeableConcept))
        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
            + this.value.getClass().getName() + " was encountered");
      return (CodeableConcept) this.value;
    }

    public boolean hasValueCodeableConcept() {
      return this != null && this.value instanceof CodeableConcept;
    }

    /**
     * @return {@link #value} (The value of the device detail.)
     */
    public Quantity getValueQuantity() throws FHIRException {
      if (this.value == null)
        this.value = new Quantity();
      if (!(this.value instanceof Quantity))
        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
            + " was encountered");
      return (Quantity) this.value;
    }

    public boolean hasValueQuantity() {
      return this != null && this.value instanceof Quantity;
    }

    /**
     * @return {@link #value} (The value of the device detail.)
     */
    public Range getValueRange() throws FHIRException {
      if (this.value == null)
        this.value = new Range();
      if (!(this.value instanceof Range))
        throw new FHIRException(
            "Type mismatch: the type Range was expected, but " + this.value.getClass().getName() + " was encountered");
      return (Range) this.value;
    }

    public boolean hasValueRange() {
      return this != null && this.value instanceof Range;
    }

    /**
     * @return {@link #value} (The value of the device detail.)
     */
    public BooleanType getValueBooleanType() throws FHIRException {
      if (this.value == null)
        this.value = new BooleanType();
      if (!(this.value instanceof BooleanType))
        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
            + this.value.getClass().getName() + " was encountered");
      return (BooleanType) this.value;
    }

    public boolean hasValueBooleanType() {
      return this != null && this.value instanceof BooleanType;
    }

    public boolean hasValue() {
      return this.value != null && !this.value.isEmpty();
    }

    /**
     * @param value {@link #value} (The value of the device detail.)
     */
    public DeviceRequestParameterComponent setValue(Type value) {
      if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity || value instanceof Range
          || value instanceof BooleanType))
        throw new Error("Not the right type for DeviceRequest.parameter.value[x]: " + value.fhirType());
      this.value = value;
      return this;
    }

    protected void listChildren(List children) {
      super.listChildren(children);
      children.add(new Property("code", "CodeableConcept",
          "A code or string that identifies the device detail being asserted.", 0, 1, code));
      children.add(new Property("value[x]", "CodeableConcept|Quantity|Range|boolean", "The value of the device detail.",
          0, 1, value));
    }

    @Override
    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
      switch (_hash) {
      case 3059181:
        /* code */ return new Property("code", "CodeableConcept",
            "A code or string that identifies the device detail being asserted.", 0, 1, code);
      case -1410166417:
        /* value[x] */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      case 111972721:
        /* value */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      case 924902896:
        /* valueCodeableConcept */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      case -2029823716:
        /* valueQuantity */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      case 2030761548:
        /* valueRange */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      case 733421943:
        /* valueBoolean */ return new Property("value[x]", "CodeableConcept|Quantity|Range|boolean",
            "The value of the device detail.", 0, 1, value);
      default:
        return super.getNamedProperty(_hash, _name, _checkValid);
      }

    }

    @Override
    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
      switch (hash) {
      case 3059181:
        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
      case 111972721:
        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
      default:
        return super.getProperty(hash, name, checkValid);
      }

    }

    @Override
    public Base setProperty(int hash, String name, Base value) throws FHIRException {
      switch (hash) {
      case 3059181: // code
        this.code = castToCodeableConcept(value); // CodeableConcept
        return value;
      case 111972721: // value
        this.value = castToType(value); // Type
        return value;
      default:
        return super.setProperty(hash, name, value);
      }

    }

    @Override
    public Base setProperty(String name, Base value) throws FHIRException {
      if (name.equals("code")) {
        this.code = castToCodeableConcept(value); // CodeableConcept
      } else if (name.equals("value[x]")) {
        this.value = castToType(value); // Type
      } else
        return super.setProperty(name, value);
      return value;
    }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
      if (name.equals("code")) {
        this.code = null;
      } else if (name.equals("value[x]")) {
        this.value = null;
      } else
        super.removeChild(name, value);
      
    }

    @Override
    public Base makeProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3059181:
        return getCode();
      case -1410166417:
        return getValue();
      case 111972721:
        return getValue();
      default:
        return super.makeProperty(hash, name);
      }

    }

    @Override
    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3059181:
        /* code */ return new String[] { "CodeableConcept" };
      case 111972721:
        /* value */ return new String[] { "CodeableConcept", "Quantity", "Range", "boolean" };
      default:
        return super.getTypesForProperty(hash, name);
      }

    }

    @Override
    public Base addChild(String name) throws FHIRException {
      if (name.equals("code")) {
        this.code = new CodeableConcept();
        return this.code;
      } else if (name.equals("valueCodeableConcept")) {
        this.value = new CodeableConcept();
        return this.value;
      } else if (name.equals("valueQuantity")) {
        this.value = new Quantity();
        return this.value;
      } else if (name.equals("valueRange")) {
        this.value = new Range();
        return this.value;
      } else if (name.equals("valueBoolean")) {
        this.value = new BooleanType();
        return this.value;
      } else
        return super.addChild(name);
    }

    public DeviceRequestParameterComponent copy() {
      DeviceRequestParameterComponent dst = new DeviceRequestParameterComponent();
      copyValues(dst);
      return dst;
    }

    public void copyValues(DeviceRequestParameterComponent dst) {
      super.copyValues(dst);
      dst.code = code == null ? null : code.copy();
      dst.value = value == null ? null : value.copy();
    }

    @Override
    public boolean equalsDeep(Base other_) {
      if (!super.equalsDeep(other_))
        return false;
      if (!(other_ instanceof DeviceRequestParameterComponent))
        return false;
      DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
    }

    @Override
    public boolean equalsShallow(Base other_) {
      if (!super.equalsShallow(other_))
        return false;
      if (!(other_ instanceof DeviceRequestParameterComponent))
        return false;
      DeviceRequestParameterComponent o = (DeviceRequestParameterComponent) other_;
      return true;
    }

    public boolean isEmpty() {
      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
    }

    public String fhirType() {
      return "DeviceRequest.parameter";

    }

  }

  /**
   * Identifiers assigned to this order by the orderer or by the receiver.
   */
  @Child(name = "identifier", type = {
      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "External Request identifier", formalDefinition = "Identifiers assigned to this order by the orderer or by the receiver.")
  protected List identifier;

  /**
   * The URL pointing to a FHIR-defined protocol, guideline, orderset or other
   * definition that is adhered to in whole or in part by this DeviceRequest.
   */
  @Child(name = "instantiatesCanonical", type = {
      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "Instantiates FHIR protocol or definition", formalDefinition = "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.")
  protected List instantiatesCanonical;

  /**
   * The URL pointing to an externally maintained protocol, guideline, orderset or
   * other definition that is adhered to in whole or in part by this
   * DeviceRequest.
   */
  @Child(name = "instantiatesUri", type = {
      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "Instantiates external protocol or definition", formalDefinition = "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.")
  protected List instantiatesUri;

  /**
   * Plan/proposal/order fulfilled by this request.
   */
  @Child(name = "basedOn", type = {
      Reference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "What request fulfills", formalDefinition = "Plan/proposal/order fulfilled by this request.")
  protected List basedOn;
  /**
   * The actual objects that are the target of the reference (Plan/proposal/order
   * fulfilled by this request.)
   */
  protected List basedOnTarget;

  /**
   * The request takes the place of the referenced completed or terminated
   * request(s).
   */
  @Child(name = "priorRequest", type = {
      Reference.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "What request replaces", formalDefinition = "The request takes the place of the referenced completed or terminated request(s).")
  protected List priorRequest;
  /**
   * The actual objects that are the target of the reference (The request takes
   * the place of the referenced completed or terminated request(s).)
   */
  protected List priorRequestTarget;

  /**
   * Composite request this is part of.
   */
  @Child(name = "groupIdentifier", type = {
      Identifier.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Identifier of composite request", formalDefinition = "Composite request this is part of.")
  protected Identifier groupIdentifier;

  /**
   * The status of the request.
   */
  @Child(name = "status", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition = "The status of the request.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-status")
  protected Enumeration status;

  /**
   * Whether the request is a proposal, plan, an original order or a reflex order.
   */
  @Child(name = "intent", type = { CodeType.class }, order = 7, min = 1, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition = "Whether the request is a proposal, plan, an original order or a reflex order.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-intent")
  protected Enumeration intent;

  /**
   * Indicates how quickly the {{title}} should be addressed with respect to other
   * requests.
   */
  @Child(name = "priority", type = { CodeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "routine | urgent | asap | stat", formalDefinition = "Indicates how quickly the {{title}} should be addressed with respect to other requests.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-priority")
  protected Enumeration priority;

  /**
   * The details of the device to be used.
   */
  @Child(name = "code", type = { Device.class,
      CodeableConcept.class }, order = 9, min = 1, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Device requested", formalDefinition = "The details of the device to be used.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/device-kind")
  protected Type code;

  /**
   * Specific parameters for the ordered item. For example, the prism value for
   * lenses.
   */
  @Child(name = "parameter", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Device details", formalDefinition = "Specific parameters for the ordered item.  For example, the prism value for lenses.")
  protected List parameter;

  /**
   * The patient who will use the device.
   */
  @Child(name = "subject", type = { Patient.class, Group.class, Location.class,
      Device.class }, order = 11, min = 1, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Focus of request", formalDefinition = "The patient who will use the device.")
  protected Reference subject;

  /**
   * The actual object that is the target of the reference (The patient who will
   * use the device.)
   */
  protected Resource subjectTarget;

  /**
   * An encounter that provides additional context in which this request is made.
   */
  @Child(name = "encounter", type = { Encounter.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Encounter motivating request", formalDefinition = "An encounter that provides additional context in which this request is made.")
  protected Reference encounter;

  /**
   * The actual object that is the target of the reference (An encounter that
   * provides additional context in which this request is made.)
   */
  protected Encounter encounterTarget;

  /**
   * The timing schedule for the use of the device. The Schedule data type allows
   * many different expressions, for example. "Every 8 hours"; "Three times a
   * day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct
   * 2013, 17 Oct 2013 and 1 Nov 2013".
   */
  @Child(name = "occurrence", type = { DateTimeType.class, Period.class,
      Timing.class }, order = 13, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Desired time or schedule for use", formalDefinition = "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".")
  protected Type occurrence;

  /**
   * When the request transitioned to being actionable.
   */
  @Child(name = "authoredOn", type = {
      DateTimeType.class }, order = 14, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "When recorded", formalDefinition = "When the request transitioned to being actionable.")
  protected DateTimeType authoredOn;

  /**
   * The individual who initiated the request and has responsibility for its
   * activation.
   */
  @Child(name = "requester", type = { Device.class, Practitioner.class, PractitionerRole.class,
      Organization.class }, order = 15, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Who/what is requesting diagnostics", formalDefinition = "The individual who initiated the request and has responsibility for its activation.")
  protected Reference requester;

  /**
   * The actual object that is the target of the reference (The individual who
   * initiated the request and has responsibility for its activation.)
   */
  protected Resource requesterTarget;

  /**
   * Desired type of performer for doing the diagnostic testing.
   */
  @Child(name = "performerType", type = {
      CodeableConcept.class }, order = 16, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Filler role", formalDefinition = "Desired type of performer for doing the diagnostic testing.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/participant-role")
  protected CodeableConcept performerType;

  /**
   * The desired performer for doing the diagnostic testing.
   */
  @Child(name = "performer", type = { Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class,
      HealthcareService.class, Patient.class, Device.class,
      RelatedPerson.class }, order = 17, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "Requested Filler", formalDefinition = "The desired performer for doing the diagnostic testing.")
  protected Reference performer;

  /**
   * The actual object that is the target of the reference (The desired performer
   * for doing the diagnostic testing.)
   */
  protected Resource performerTarget;

  /**
   * Reason or justification for the use of this device.
   */
  @Child(name = "reasonCode", type = {
      CodeableConcept.class }, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "Coded Reason for request", formalDefinition = "Reason or justification for the use of this device.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code")
  protected List reasonCode;

  /**
   * Reason or justification for the use of this device.
   */
  @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
      DocumentReference.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "Linked Reason for request", formalDefinition = "Reason or justification for the use of this device.")
  protected List reasonReference;
  /**
   * The actual objects that are the target of the reference (Reason or
   * justification for the use of this device.)
   */
  protected List reasonReferenceTarget;

  /**
   * Insurance plans, coverage extensions, pre-authorizations and/or
   * pre-determinations that may be required for delivering the requested service.
   */
  @Child(name = "insurance", type = { Coverage.class,
      ClaimResponse.class }, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Associated insurance coverage", formalDefinition = "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.")
  protected List insurance;
  /**
   * The actual objects that are the target of the reference (Insurance plans,
   * coverage extensions, pre-authorizations and/or pre-determinations that may be
   * required for delivering the requested service.)
   */
  protected List insuranceTarget;

  /**
   * Additional clinical information about the patient that may influence the
   * request fulfilment. For example, this may include where on the subject's body
   * the device will be used (i.e. the target site).
   */
  @Child(name = "supportingInfo", type = {
      Reference.class }, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Additional clinical information", formalDefinition = "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).")
  protected List supportingInfo;
  /**
   * The actual objects that are the target of the reference (Additional clinical
   * information about the patient that may influence the request fulfilment. For
   * example, this may include where on the subject's body the device will be used
   * (i.e. the target site).)
   */
  protected List supportingInfoTarget;

  /**
   * Details about this request 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.
   */
  @Child(name = "note", type = {
      Annotation.class }, order = 22, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Notes or comments", formalDefinition = "Details about this request 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.")
  protected List note;

  /**
   * Key events in the history of the request.
   */
  @Child(name = "relevantHistory", type = {
      Provenance.class }, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Request provenance", formalDefinition = "Key events in the history of the request.")
  protected List relevantHistory;
  /**
   * The actual objects that are the target of the reference (Key events in the
   * history of the request.)
   */
  protected List relevantHistoryTarget;

  private static final long serialVersionUID = 1484452423L;

  /**
   * Constructor
   */
  public DeviceRequest() {
    super();
  }

  /**
   * Constructor
   */
  public DeviceRequest(Enumeration intent, Type code, Reference subject) {
    super();
    this.intent = intent;
    this.code = code;
    this.subject = subject;
  }

  /**
   * @return {@link #identifier} (Identifiers assigned to this order by the
   *         orderer or by the receiver.)
   */
  public List getIdentifier() {
    if (this.identifier == null)
      this.identifier = new ArrayList();
    return this.identifier;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setIdentifier(List theIdentifier) {
    this.identifier = theIdentifier;
    return this;
  }

  public boolean hasIdentifier() {
    if (this.identifier == null)
      return false;
    for (Identifier item : this.identifier)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Identifier addIdentifier() { // 3
    Identifier t = new Identifier();
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return t;
  }

  public DeviceRequest addIdentifier(Identifier t) { // 3
    if (t == null)
      return this;
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #identifier}, creating
   *         it if it does not already exist
   */
  public Identifier getIdentifierFirstRep() {
    if (getIdentifier().isEmpty()) {
      addIdentifier();
    }
    return getIdentifier().get(0);
  }

  /**
   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
   *         protocol, guideline, orderset or other definition that is adhered to
   *         in whole or in part by this DeviceRequest.)
   */
  public List getInstantiatesCanonical() {
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    return this.instantiatesCanonical;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setInstantiatesCanonical(List theInstantiatesCanonical) {
    this.instantiatesCanonical = theInstantiatesCanonical;
    return this;
  }

  public boolean hasInstantiatesCanonical() {
    if (this.instantiatesCanonical == null)
      return false;
    for (CanonicalType item : this.instantiatesCanonical)
      if (!item.isEmpty())
        return true;
    return false;
  }

  /**
   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
   *         protocol, guideline, orderset or other definition that is adhered to
   *         in whole or in part by this DeviceRequest.)
   */
  public CanonicalType addInstantiatesCanonicalElement() {// 2
    CanonicalType t = new CanonicalType();
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    this.instantiatesCanonical.add(t);
    return t;
  }

  /**
   * @param value {@link #instantiatesCanonical} (The URL pointing to a
   *              FHIR-defined protocol, guideline, orderset or other definition
   *              that is adhered to in whole or in part by this DeviceRequest.)
   */
  public DeviceRequest addInstantiatesCanonical(String value) { // 1
    CanonicalType t = new CanonicalType();
    t.setValue(value);
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    this.instantiatesCanonical.add(t);
    return this;
  }

  /**
   * @param value {@link #instantiatesCanonical} (The URL pointing to a
   *              FHIR-defined protocol, guideline, orderset or other definition
   *              that is adhered to in whole or in part by this DeviceRequest.)
   */
  public boolean hasInstantiatesCanonical(String value) {
    if (this.instantiatesCanonical == null)
      return false;
    for (CanonicalType v : this.instantiatesCanonical)
      if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
        return true;
    return false;
  }

  /**
   * @return {@link #instantiatesUri} (The URL pointing to an externally
   *         maintained protocol, guideline, orderset or other definition that is
   *         adhered to in whole or in part by this DeviceRequest.)
   */
  public List getInstantiatesUri() {
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    return this.instantiatesUri;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setInstantiatesUri(List theInstantiatesUri) {
    this.instantiatesUri = theInstantiatesUri;
    return this;
  }

  public boolean hasInstantiatesUri() {
    if (this.instantiatesUri == null)
      return false;
    for (UriType item : this.instantiatesUri)
      if (!item.isEmpty())
        return true;
    return false;
  }

  /**
   * @return {@link #instantiatesUri} (The URL pointing to an externally
   *         maintained protocol, guideline, orderset or other definition that is
   *         adhered to in whole or in part by this DeviceRequest.)
   */
  public UriType addInstantiatesUriElement() {// 2
    UriType t = new UriType();
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    this.instantiatesUri.add(t);
    return t;
  }

  /**
   * @param value {@link #instantiatesUri} (The URL pointing to an externally
   *              maintained protocol, guideline, orderset or other definition
   *              that is adhered to in whole or in part by this DeviceRequest.)
   */
  public DeviceRequest addInstantiatesUri(String value) { // 1
    UriType t = new UriType();
    t.setValue(value);
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    this.instantiatesUri.add(t);
    return this;
  }

  /**
   * @param value {@link #instantiatesUri} (The URL pointing to an externally
   *              maintained protocol, guideline, orderset or other definition
   *              that is adhered to in whole or in part by this DeviceRequest.)
   */
  public boolean hasInstantiatesUri(String value) {
    if (this.instantiatesUri == null)
      return false;
    for (UriType v : this.instantiatesUri)
      if (v.getValue().equals(value)) // uri
        return true;
    return false;
  }

  /**
   * @return {@link #basedOn} (Plan/proposal/order fulfilled by this request.)
   */
  public List getBasedOn() {
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    return this.basedOn;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setBasedOn(List theBasedOn) {
    this.basedOn = theBasedOn;
    return this;
  }

  public boolean hasBasedOn() {
    if (this.basedOn == null)
      return false;
    for (Reference item : this.basedOn)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addBasedOn() { // 3
    Reference t = new Reference();
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    this.basedOn.add(t);
    return t;
  }

  public DeviceRequest addBasedOn(Reference t) { // 3
    if (t == null)
      return this;
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    this.basedOn.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #basedOn}, creating it
   *         if it does not already exist
   */
  public Reference getBasedOnFirstRep() {
    if (getBasedOn().isEmpty()) {
      addBasedOn();
    }
    return getBasedOn().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getBasedOnTarget() {
    if (this.basedOnTarget == null)
      this.basedOnTarget = new ArrayList();
    return this.basedOnTarget;
  }

  /**
   * @return {@link #priorRequest} (The request takes the place of the referenced
   *         completed or terminated request(s).)
   */
  public List getPriorRequest() {
    if (this.priorRequest == null)
      this.priorRequest = new ArrayList();
    return this.priorRequest;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setPriorRequest(List thePriorRequest) {
    this.priorRequest = thePriorRequest;
    return this;
  }

  public boolean hasPriorRequest() {
    if (this.priorRequest == null)
      return false;
    for (Reference item : this.priorRequest)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addPriorRequest() { // 3
    Reference t = new Reference();
    if (this.priorRequest == null)
      this.priorRequest = new ArrayList();
    this.priorRequest.add(t);
    return t;
  }

  public DeviceRequest addPriorRequest(Reference t) { // 3
    if (t == null)
      return this;
    if (this.priorRequest == null)
      this.priorRequest = new ArrayList();
    this.priorRequest.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #priorRequest},
   *         creating it if it does not already exist
   */
  public Reference getPriorRequestFirstRep() {
    if (getPriorRequest().isEmpty()) {
      addPriorRequest();
    }
    return getPriorRequest().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getPriorRequestTarget() {
    if (this.priorRequestTarget == null)
      this.priorRequestTarget = new ArrayList();
    return this.priorRequestTarget;
  }

  /**
   * @return {@link #groupIdentifier} (Composite request this is part of.)
   */
  public Identifier getGroupIdentifier() {
    if (this.groupIdentifier == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.groupIdentifier");
      else if (Configuration.doAutoCreate())
        this.groupIdentifier = new Identifier(); // cc
    return this.groupIdentifier;
  }

  public boolean hasGroupIdentifier() {
    return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
  }

  /**
   * @param value {@link #groupIdentifier} (Composite request this is part of.)
   */
  public DeviceRequest setGroupIdentifier(Identifier value) {
    this.groupIdentifier = value;
    return this;
  }

  /**
   * @return {@link #status} (The status of the request.). This is the underlying
   *         object with id, value and extensions. The accessor "getStatus" gives
   *         direct access to the value
   */
  public Enumeration getStatusElement() {
    if (this.status == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.status");
      else if (Configuration.doAutoCreate())
        this.status = new Enumeration(new DeviceRequestStatusEnumFactory()); // bb
    return this.status;
  }

  public boolean hasStatusElement() {
    return this.status != null && !this.status.isEmpty();
  }

  public boolean hasStatus() {
    return this.status != null && !this.status.isEmpty();
  }

  /**
   * @param value {@link #status} (The status of the request.). This is the
   *              underlying object with id, value and extensions. The accessor
   *              "getStatus" gives direct access to the value
   */
  public DeviceRequest setStatusElement(Enumeration value) {
    this.status = value;
    return this;
  }

  /**
   * @return The status of the request.
   */
  public DeviceRequestStatus getStatus() {
    return this.status == null ? null : this.status.getValue();
  }

  /**
   * @param value The status of the request.
   */
  public DeviceRequest setStatus(DeviceRequestStatus value) {
    if (value == null)
      this.status = null;
    else {
      if (this.status == null)
        this.status = new Enumeration(new DeviceRequestStatusEnumFactory());
      this.status.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #intent} (Whether the request is a proposal, plan, an original
   *         order or a reflex order.). This is the underlying object with id,
   *         value and extensions. The accessor "getIntent" gives direct access to
   *         the value
   */
  public Enumeration getIntentElement() {
    if (this.intent == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.intent");
      else if (Configuration.doAutoCreate())
        this.intent = new Enumeration(new RequestIntentEnumFactory()); // bb
    return this.intent;
  }

  public boolean hasIntentElement() {
    return this.intent != null && !this.intent.isEmpty();
  }

  public boolean hasIntent() {
    return this.intent != null && !this.intent.isEmpty();
  }

  /**
   * @param value {@link #intent} (Whether the request is a proposal, plan, an
   *              original order or a reflex order.). This is the underlying
   *              object with id, value and extensions. The accessor "getIntent"
   *              gives direct access to the value
   */
  public DeviceRequest setIntentElement(Enumeration value) {
    this.intent = value;
    return this;
  }

  /**
   * @return Whether the request is a proposal, plan, an original order or a
   *         reflex order.
   */
  public RequestIntent getIntent() {
    return this.intent == null ? null : this.intent.getValue();
  }

  /**
   * @param value Whether the request is a proposal, plan, an original order or a
   *              reflex order.
   */
  public DeviceRequest setIntent(RequestIntent value) {
    if (this.intent == null)
      this.intent = new Enumeration(new RequestIntentEnumFactory());
    this.intent.setValue(value);
    return this;
  }

  /**
   * @return {@link #priority} (Indicates how quickly the {{title}} should be
   *         addressed with respect to other requests.). This is the underlying
   *         object with id, value and extensions. The accessor "getPriority"
   *         gives direct access to the value
   */
  public Enumeration getPriorityElement() {
    if (this.priority == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.priority");
      else if (Configuration.doAutoCreate())
        this.priority = new Enumeration(new RequestPriorityEnumFactory()); // bb
    return this.priority;
  }

  public boolean hasPriorityElement() {
    return this.priority != null && !this.priority.isEmpty();
  }

  public boolean hasPriority() {
    return this.priority != null && !this.priority.isEmpty();
  }

  /**
   * @param value {@link #priority} (Indicates how quickly the {{title}} should be
   *              addressed with respect to other requests.). This is the
   *              underlying object with id, value and extensions. The accessor
   *              "getPriority" gives direct access to the value
   */
  public DeviceRequest setPriorityElement(Enumeration value) {
    this.priority = value;
    return this;
  }

  /**
   * @return Indicates how quickly the {{title}} should be addressed with respect
   *         to other requests.
   */
  public RequestPriority getPriority() {
    return this.priority == null ? null : this.priority.getValue();
  }

  /**
   * @param value Indicates how quickly the {{title}} should be addressed with
   *              respect to other requests.
   */
  public DeviceRequest setPriority(RequestPriority value) {
    if (value == null)
      this.priority = null;
    else {
      if (this.priority == null)
        this.priority = new Enumeration(new RequestPriorityEnumFactory());
      this.priority.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #code} (The details of the device to be used.)
   */
  public Type getCode() {
    return this.code;
  }

  /**
   * @return {@link #code} (The details of the device to be used.)
   */
  public Reference getCodeReference() throws FHIRException {
    if (this.code == null)
      this.code = new Reference();
    if (!(this.code instanceof Reference))
      throw new FHIRException(
          "Type mismatch: the type Reference was expected, but " + this.code.getClass().getName() + " was encountered");
    return (Reference) this.code;
  }

  public boolean hasCodeReference() {
    return this != null && this.code instanceof Reference;
  }

  /**
   * @return {@link #code} (The details of the device to be used.)
   */
  public CodeableConcept getCodeCodeableConcept() throws FHIRException {
    if (this.code == null)
      this.code = new CodeableConcept();
    if (!(this.code instanceof CodeableConcept))
      throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
          + this.code.getClass().getName() + " was encountered");
    return (CodeableConcept) this.code;
  }

  public boolean hasCodeCodeableConcept() {
    return this != null && this.code instanceof CodeableConcept;
  }

  public boolean hasCode() {
    return this.code != null && !this.code.isEmpty();
  }

  /**
   * @param value {@link #code} (The details of the device to be used.)
   */
  public DeviceRequest setCode(Type value) {
    if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
      throw new Error("Not the right type for DeviceRequest.code[x]: " + value.fhirType());
    this.code = value;
    return this;
  }

  /**
   * @return {@link #parameter} (Specific parameters for the ordered item. For
   *         example, the prism value for lenses.)
   */
  public List getParameter() {
    if (this.parameter == null)
      this.parameter = new ArrayList();
    return this.parameter;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setParameter(List theParameter) {
    this.parameter = theParameter;
    return this;
  }

  public boolean hasParameter() {
    if (this.parameter == null)
      return false;
    for (DeviceRequestParameterComponent item : this.parameter)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public DeviceRequestParameterComponent addParameter() { // 3
    DeviceRequestParameterComponent t = new DeviceRequestParameterComponent();
    if (this.parameter == null)
      this.parameter = new ArrayList();
    this.parameter.add(t);
    return t;
  }

  public DeviceRequest addParameter(DeviceRequestParameterComponent t) { // 3
    if (t == null)
      return this;
    if (this.parameter == null)
      this.parameter = new ArrayList();
    this.parameter.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #parameter}, creating
   *         it if it does not already exist
   */
  public DeviceRequestParameterComponent getParameterFirstRep() {
    if (getParameter().isEmpty()) {
      addParameter();
    }
    return getParameter().get(0);
  }

  /**
   * @return {@link #subject} (The patient who will use the device.)
   */
  public Reference getSubject() {
    if (this.subject == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.subject");
      else if (Configuration.doAutoCreate())
        this.subject = new Reference(); // cc
    return this.subject;
  }

  public boolean hasSubject() {
    return this.subject != null && !this.subject.isEmpty();
  }

  /**
   * @param value {@link #subject} (The patient who will use the device.)
   */
  public DeviceRequest setSubject(Reference value) {
    this.subject = value;
    return this;
  }

  /**
   * @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 will
   *         use the device.)
   */
  public Resource getSubjectTarget() {
    return this.subjectTarget;
  }

  /**
   * @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
   *              will use the device.)
   */
  public DeviceRequest setSubjectTarget(Resource value) {
    this.subjectTarget = value;
    return this;
  }

  /**
   * @return {@link #encounter} (An encounter that provides additional context in
   *         which this request is made.)
   */
  public Reference getEncounter() {
    if (this.encounter == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.encounter");
      else if (Configuration.doAutoCreate())
        this.encounter = new Reference(); // cc
    return this.encounter;
  }

  public boolean hasEncounter() {
    return this.encounter != null && !this.encounter.isEmpty();
  }

  /**
   * @param value {@link #encounter} (An encounter that provides additional
   *              context in which this request is made.)
   */
  public DeviceRequest setEncounter(Reference value) {
    this.encounter = value;
    return this;
  }

  /**
   * @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. (An encounter that
   *         provides additional context in which this request is made.)
   */
  public Encounter getEncounterTarget() {
    if (this.encounterTarget == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.encounter");
      else if (Configuration.doAutoCreate())
        this.encounterTarget = new Encounter(); // aa
    return this.encounterTarget;
  }

  /**
   * @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. (An encounter
   *              that provides additional context in which this request is made.)
   */
  public DeviceRequest setEncounterTarget(Encounter value) {
    this.encounterTarget = value;
    return this;
  }

  /**
   * @return {@link #occurrence} (The timing schedule for the use of the device.
   *         The Schedule data type allows many different expressions, for
   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
   *         and 1 Nov 2013".)
   */
  public Type getOccurrence() {
    return this.occurrence;
  }

  /**
   * @return {@link #occurrence} (The timing schedule for the use of the device.
   *         The Schedule data type allows many different expressions, for
   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
   *         and 1 Nov 2013".)
   */
  public DateTimeType getOccurrenceDateTimeType() throws FHIRException {
    if (this.occurrence == null)
      this.occurrence = new DateTimeType();
    if (!(this.occurrence instanceof DateTimeType))
      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
          + this.occurrence.getClass().getName() + " was encountered");
    return (DateTimeType) this.occurrence;
  }

  public boolean hasOccurrenceDateTimeType() {
    return this != null && this.occurrence instanceof DateTimeType;
  }

  /**
   * @return {@link #occurrence} (The timing schedule for the use of the device.
   *         The Schedule data type allows many different expressions, for
   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
   *         and 1 Nov 2013".)
   */
  public Period getOccurrencePeriod() throws FHIRException {
    if (this.occurrence == null)
      this.occurrence = new Period();
    if (!(this.occurrence instanceof Period))
      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.occurrence.getClass().getName()
          + " was encountered");
    return (Period) this.occurrence;
  }

  public boolean hasOccurrencePeriod() {
    return this != null && this.occurrence instanceof Period;
  }

  /**
   * @return {@link #occurrence} (The timing schedule for the use of the device.
   *         The Schedule data type allows many different expressions, for
   *         example. "Every 8 hours"; "Three times a day"; "1/2 an hour before
   *         breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013
   *         and 1 Nov 2013".)
   */
  public Timing getOccurrenceTiming() throws FHIRException {
    if (this.occurrence == null)
      this.occurrence = new Timing();
    if (!(this.occurrence instanceof Timing))
      throw new FHIRException("Type mismatch: the type Timing was expected, but " + this.occurrence.getClass().getName()
          + " was encountered");
    return (Timing) this.occurrence;
  }

  public boolean hasOccurrenceTiming() {
    return this != null && this.occurrence instanceof Timing;
  }

  public boolean hasOccurrence() {
    return this.occurrence != null && !this.occurrence.isEmpty();
  }

  /**
   * @param value {@link #occurrence} (The timing schedule for the use of the
   *              device. The Schedule data type allows many different
   *              expressions, for example. "Every 8 hours"; "Three times a day";
   *              "1/2 an hour before breakfast for 10 days from 23-Dec 2011:";
   *              "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".)
   */
  public DeviceRequest setOccurrence(Type value) {
    if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
      throw new Error("Not the right type for DeviceRequest.occurrence[x]: " + value.fhirType());
    this.occurrence = value;
    return this;
  }

  /**
   * @return {@link #authoredOn} (When the request transitioned to being
   *         actionable.). This is the underlying object with id, value and
   *         extensions. The accessor "getAuthoredOn" gives direct access to the
   *         value
   */
  public DateTimeType getAuthoredOnElement() {
    if (this.authoredOn == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.authoredOn");
      else if (Configuration.doAutoCreate())
        this.authoredOn = new DateTimeType(); // bb
    return this.authoredOn;
  }

  public boolean hasAuthoredOnElement() {
    return this.authoredOn != null && !this.authoredOn.isEmpty();
  }

  public boolean hasAuthoredOn() {
    return this.authoredOn != null && !this.authoredOn.isEmpty();
  }

  /**
   * @param value {@link #authoredOn} (When the request transitioned to being
   *              actionable.). This is the underlying object with id, value and
   *              extensions. The accessor "getAuthoredOn" gives direct access to
   *              the value
   */
  public DeviceRequest setAuthoredOnElement(DateTimeType value) {
    this.authoredOn = value;
    return this;
  }

  /**
   * @return When the request transitioned to being actionable.
   */
  public Date getAuthoredOn() {
    return this.authoredOn == null ? null : this.authoredOn.getValue();
  }

  /**
   * @param value When the request transitioned to being actionable.
   */
  public DeviceRequest setAuthoredOn(Date value) {
    if (value == null)
      this.authoredOn = null;
    else {
      if (this.authoredOn == null)
        this.authoredOn = new DateTimeType();
      this.authoredOn.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #requester} (The individual who initiated the request and has
   *         responsibility for its activation.)
   */
  public Reference getRequester() {
    if (this.requester == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.requester");
      else if (Configuration.doAutoCreate())
        this.requester = new Reference(); // cc
    return this.requester;
  }

  public boolean hasRequester() {
    return this.requester != null && !this.requester.isEmpty();
  }

  /**
   * @param value {@link #requester} (The individual who initiated the request and
   *              has responsibility for its activation.)
   */
  public DeviceRequest setRequester(Reference value) {
    this.requester = value;
    return this;
  }

  /**
   * @return {@link #requester} 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 individual who
   *         initiated the request and has responsibility for its activation.)
   */
  public Resource getRequesterTarget() {
    return this.requesterTarget;
  }

  /**
   * @param value {@link #requester} 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 individual
   *              who initiated the request and has responsibility for its
   *              activation.)
   */
  public DeviceRequest setRequesterTarget(Resource value) {
    this.requesterTarget = value;
    return this;
  }

  /**
   * @return {@link #performerType} (Desired type of performer for doing the
   *         diagnostic testing.)
   */
  public CodeableConcept getPerformerType() {
    if (this.performerType == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.performerType");
      else if (Configuration.doAutoCreate())
        this.performerType = new CodeableConcept(); // cc
    return this.performerType;
  }

  public boolean hasPerformerType() {
    return this.performerType != null && !this.performerType.isEmpty();
  }

  /**
   * @param value {@link #performerType} (Desired type of performer for doing the
   *              diagnostic testing.)
   */
  public DeviceRequest setPerformerType(CodeableConcept value) {
    this.performerType = value;
    return this;
  }

  /**
   * @return {@link #performer} (The desired performer for doing the diagnostic
   *         testing.)
   */
  public Reference getPerformer() {
    if (this.performer == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create DeviceRequest.performer");
      else if (Configuration.doAutoCreate())
        this.performer = new Reference(); // cc
    return this.performer;
  }

  public boolean hasPerformer() {
    return this.performer != null && !this.performer.isEmpty();
  }

  /**
   * @param value {@link #performer} (The desired performer for doing the
   *              diagnostic testing.)
   */
  public DeviceRequest setPerformer(Reference value) {
    this.performer = value;
    return this;
  }

  /**
   * @return {@link #performer} 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 desired performer
   *         for doing the diagnostic testing.)
   */
  public Resource getPerformerTarget() {
    return this.performerTarget;
  }

  /**
   * @param value {@link #performer} 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 desired
   *              performer for doing the diagnostic testing.)
   */
  public DeviceRequest setPerformerTarget(Resource value) {
    this.performerTarget = value;
    return this;
  }

  /**
   * @return {@link #reasonCode} (Reason or justification for the use of this
   *         device.)
   */
  public List getReasonCode() {
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    return this.reasonCode;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setReasonCode(List theReasonCode) {
    this.reasonCode = theReasonCode;
    return this;
  }

  public boolean hasReasonCode() {
    if (this.reasonCode == null)
      return false;
    for (CodeableConcept item : this.reasonCode)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public CodeableConcept addReasonCode() { // 3
    CodeableConcept t = new CodeableConcept();
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    this.reasonCode.add(t);
    return t;
  }

  public DeviceRequest addReasonCode(CodeableConcept t) { // 3
    if (t == null)
      return this;
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    this.reasonCode.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #reasonCode}, creating
   *         it if it does not already exist
   */
  public CodeableConcept getReasonCodeFirstRep() {
    if (getReasonCode().isEmpty()) {
      addReasonCode();
    }
    return getReasonCode().get(0);
  }

  /**
   * @return {@link #reasonReference} (Reason or justification for the use of this
   *         device.)
   */
  public List getReasonReference() {
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    return this.reasonReference;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setReasonReference(List theReasonReference) {
    this.reasonReference = theReasonReference;
    return this;
  }

  public boolean hasReasonReference() {
    if (this.reasonReference == null)
      return false;
    for (Reference item : this.reasonReference)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addReasonReference() { // 3
    Reference t = new Reference();
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    this.reasonReference.add(t);
    return t;
  }

  public DeviceRequest addReasonReference(Reference t) { // 3
    if (t == null)
      return this;
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    this.reasonReference.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #reasonReference},
   *         creating it if it does not already exist
   */
  public Reference getReasonReferenceFirstRep() {
    if (getReasonReference().isEmpty()) {
      addReasonReference();
    }
    return getReasonReference().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getReasonReferenceTarget() {
    if (this.reasonReferenceTarget == null)
      this.reasonReferenceTarget = new ArrayList();
    return this.reasonReferenceTarget;
  }

  /**
   * @return {@link #insurance} (Insurance plans, coverage extensions,
   *         pre-authorizations and/or pre-determinations that may be required for
   *         delivering the requested service.)
   */
  public List getInsurance() {
    if (this.insurance == null)
      this.insurance = new ArrayList();
    return this.insurance;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setInsurance(List theInsurance) {
    this.insurance = theInsurance;
    return this;
  }

  public boolean hasInsurance() {
    if (this.insurance == null)
      return false;
    for (Reference item : this.insurance)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addInsurance() { // 3
    Reference t = new Reference();
    if (this.insurance == null)
      this.insurance = new ArrayList();
    this.insurance.add(t);
    return t;
  }

  public DeviceRequest addInsurance(Reference t) { // 3
    if (t == null)
      return this;
    if (this.insurance == null)
      this.insurance = new ArrayList();
    this.insurance.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #insurance}, creating
   *         it if it does not already exist
   */
  public Reference getInsuranceFirstRep() {
    if (getInsurance().isEmpty()) {
      addInsurance();
    }
    return getInsurance().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getInsuranceTarget() {
    if (this.insuranceTarget == null)
      this.insuranceTarget = new ArrayList();
    return this.insuranceTarget;
  }

  /**
   * @return {@link #supportingInfo} (Additional clinical information about the
   *         patient that may influence the request fulfilment. For example, this
   *         may include where on the subject's body the device will be used (i.e.
   *         the target site).)
   */
  public List getSupportingInfo() {
    if (this.supportingInfo == null)
      this.supportingInfo = new ArrayList();
    return this.supportingInfo;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setSupportingInfo(List theSupportingInfo) {
    this.supportingInfo = theSupportingInfo;
    return this;
  }

  public boolean hasSupportingInfo() {
    if (this.supportingInfo == null)
      return false;
    for (Reference item : this.supportingInfo)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addSupportingInfo() { // 3
    Reference t = new Reference();
    if (this.supportingInfo == null)
      this.supportingInfo = new ArrayList();
    this.supportingInfo.add(t);
    return t;
  }

  public DeviceRequest addSupportingInfo(Reference t) { // 3
    if (t == null)
      return this;
    if (this.supportingInfo == null)
      this.supportingInfo = new ArrayList();
    this.supportingInfo.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #supportingInfo},
   *         creating it if it does not already exist
   */
  public Reference getSupportingInfoFirstRep() {
    if (getSupportingInfo().isEmpty()) {
      addSupportingInfo();
    }
    return getSupportingInfo().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getSupportingInfoTarget() {
    if (this.supportingInfoTarget == null)
      this.supportingInfoTarget = new ArrayList();
    return this.supportingInfoTarget;
  }

  /**
   * @return {@link #note} (Details about this request 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.)
   */
  public List getNote() {
    if (this.note == null)
      this.note = new ArrayList();
    return this.note;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setNote(List theNote) {
    this.note = theNote;
    return this;
  }

  public boolean hasNote() {
    if (this.note == null)
      return false;
    for (Annotation item : this.note)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Annotation addNote() { // 3
    Annotation t = new Annotation();
    if (this.note == null)
      this.note = new ArrayList();
    this.note.add(t);
    return t;
  }

  public DeviceRequest addNote(Annotation t) { // 3
    if (t == null)
      return this;
    if (this.note == null)
      this.note = new ArrayList();
    this.note.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #note}, creating it if
   *         it does not already exist
   */
  public Annotation getNoteFirstRep() {
    if (getNote().isEmpty()) {
      addNote();
    }
    return getNote().get(0);
  }

  /**
   * @return {@link #relevantHistory} (Key events in the history of the request.)
   */
  public List getRelevantHistory() {
    if (this.relevantHistory == null)
      this.relevantHistory = new ArrayList();
    return this.relevantHistory;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public DeviceRequest setRelevantHistory(List theRelevantHistory) {
    this.relevantHistory = theRelevantHistory;
    return this;
  }

  public boolean hasRelevantHistory() {
    if (this.relevantHistory == null)
      return false;
    for (Reference item : this.relevantHistory)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addRelevantHistory() { // 3
    Reference t = new Reference();
    if (this.relevantHistory == null)
      this.relevantHistory = new ArrayList();
    this.relevantHistory.add(t);
    return t;
  }

  public DeviceRequest addRelevantHistory(Reference t) { // 3
    if (t == null)
      return this;
    if (this.relevantHistory == null)
      this.relevantHistory = new ArrayList();
    this.relevantHistory.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #relevantHistory},
   *         creating it if it does not already exist
   */
  public Reference getRelevantHistoryFirstRep() {
    if (getRelevantHistory().isEmpty()) {
      addRelevantHistory();
    }
    return getRelevantHistory().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getRelevantHistoryTarget() {
    if (this.relevantHistoryTarget == null)
      this.relevantHistoryTarget = new ArrayList();
    return this.relevantHistoryTarget;
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public Provenance addRelevantHistoryTarget() {
    Provenance r = new Provenance();
    if (this.relevantHistoryTarget == null)
      this.relevantHistoryTarget = new ArrayList();
    this.relevantHistoryTarget.add(r);
    return r;
  }

  protected void listChildren(List children) {
    super.listChildren(children);
    children.add(new Property("identifier", "Identifier",
        "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE,
        identifier));
    children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)",
        "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.",
        0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
    children.add(new Property("instantiatesUri", "uri",
        "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.",
        0, java.lang.Integer.MAX_VALUE, instantiatesUri));
    children.add(new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.", 0,
        java.lang.Integer.MAX_VALUE, basedOn));
    children.add(new Property("priorRequest", "Reference(Any)",
        "The request takes the place of the referenced completed or terminated request(s).", 0,
        java.lang.Integer.MAX_VALUE, priorRequest));
    children.add(
        new Property("groupIdentifier", "Identifier", "Composite request this is part of.", 0, 1, groupIdentifier));
    children.add(new Property("status", "code", "The status of the request.", 0, 1, status));
    children.add(new Property("intent", "code",
        "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent));
    children.add(new Property("priority", "code",
        "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority));
    children.add(new Property("code[x]", "Reference(Device)|CodeableConcept", "The details of the device to be used.",
        0, 1, code));
    children.add(new Property("parameter", "",
        "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0,
        java.lang.Integer.MAX_VALUE, parameter));
    children.add(new Property("subject", "Reference(Patient|Group|Location|Device)",
        "The patient who will use the device.", 0, 1, subject));
    children.add(new Property("encounter", "Reference(Encounter)",
        "An encounter that provides additional context in which this request is made.", 0, 1, encounter));
    children.add(new Property("occurrence[x]", "dateTime|Period|Timing",
        "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
        0, 1, occurrence));
    children.add(
        new Property("authoredOn", "dateTime", "When the request transitioned to being actionable.", 0, 1, authoredOn));
    children.add(new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)",
        "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester));
    children.add(new Property("performerType", "CodeableConcept",
        "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType));
    children.add(new Property("performer",
        "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)",
        "The desired performer for doing the diagnostic testing.", 0, 1, performer));
    children.add(new Property("reasonCode", "CodeableConcept", "Reason or justification for the use of this device.", 0,
        java.lang.Integer.MAX_VALUE, reasonCode));
    children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
        "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
    children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)",
        "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.",
        0, java.lang.Integer.MAX_VALUE, insurance));
    children.add(new Property("supportingInfo", "Reference(Any)",
        "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).",
        0, java.lang.Integer.MAX_VALUE, supportingInfo));
    children.add(new Property("note", "Annotation",
        "Details about this request 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, note));
    children.add(new Property("relevantHistory", "Reference(Provenance)", "Key events in the history of the request.",
        0, java.lang.Integer.MAX_VALUE, relevantHistory));
  }

  @Override
  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
    switch (_hash) {
    case -1618432855:
      /* identifier */ return new Property("identifier", "Identifier",
          "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE,
          identifier);
    case 8911915:
      /* instantiatesCanonical */ return new Property("instantiatesCanonical",
          "canonical(ActivityDefinition|PlanDefinition)",
          "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.",
          0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
    case -1926393373:
      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
          "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this DeviceRequest.",
          0, java.lang.Integer.MAX_VALUE, instantiatesUri);
    case -332612366:
      /* basedOn */ return new Property("basedOn", "Reference(Any)", "Plan/proposal/order fulfilled by this request.",
          0, java.lang.Integer.MAX_VALUE, basedOn);
    case 237568101:
      /* priorRequest */ return new Property("priorRequest", "Reference(Any)",
          "The request takes the place of the referenced completed or terminated request(s).", 0,
          java.lang.Integer.MAX_VALUE, priorRequest);
    case -445338488:
      /* groupIdentifier */ return new Property("groupIdentifier", "Identifier", "Composite request this is part of.",
          0, 1, groupIdentifier);
    case -892481550:
      /* status */ return new Property("status", "code", "The status of the request.", 0, 1, status);
    case -1183762788:
      /* intent */ return new Property("intent", "code",
          "Whether the request is a proposal, plan, an original order or a reflex order.", 0, 1, intent);
    case -1165461084:
      /* priority */ return new Property("priority", "code",
          "Indicates how quickly the {{title}} should be addressed with respect to other requests.", 0, 1, priority);
    case 941839219:
      /* code[x] */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
          "The details of the device to be used.", 0, 1, code);
    case 3059181:
      /* code */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
          "The details of the device to be used.", 0, 1, code);
    case 1565461470:
      /* codeReference */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
          "The details of the device to be used.", 0, 1, code);
    case 4899316:
      /* codeCodeableConcept */ return new Property("code[x]", "Reference(Device)|CodeableConcept",
          "The details of the device to be used.", 0, 1, code);
    case 1954460585:
      /* parameter */ return new Property("parameter", "",
          "Specific parameters for the ordered item.  For example, the prism value for lenses.", 0,
          java.lang.Integer.MAX_VALUE, parameter);
    case -1867885268:
      /* subject */ return new Property("subject", "Reference(Patient|Group|Location|Device)",
          "The patient who will use the device.", 0, 1, subject);
    case 1524132147:
      /* encounter */ return new Property("encounter", "Reference(Encounter)",
          "An encounter that provides additional context in which this request is made.", 0, 1, encounter);
    case -2022646513:
      /* occurrence[x] */ return new Property("occurrence[x]", "dateTime|Period|Timing",
          "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
          0, 1, occurrence);
    case 1687874001:
      /* occurrence */ return new Property("occurrence[x]", "dateTime|Period|Timing",
          "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
          0, 1, occurrence);
    case -298443636:
      /* occurrenceDateTime */ return new Property("occurrence[x]", "dateTime|Period|Timing",
          "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
          0, 1, occurrence);
    case 1397156594:
      /* occurrencePeriod */ return new Property("occurrence[x]", "dateTime|Period|Timing",
          "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
          0, 1, occurrence);
    case 1515218299:
      /* occurrenceTiming */ return new Property("occurrence[x]", "dateTime|Period|Timing",
          "The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. \"Every 8 hours\"; \"Three times a day\"; \"1/2 an hour before breakfast for 10 days from 23-Dec 2011:\"; \"15 Oct 2013, 17 Oct 2013 and 1 Nov 2013\".",
          0, 1, occurrence);
    case -1500852503:
      /* authoredOn */ return new Property("authoredOn", "dateTime",
          "When the request transitioned to being actionable.", 0, 1, authoredOn);
    case 693933948:
      /* requester */ return new Property("requester", "Reference(Device|Practitioner|PractitionerRole|Organization)",
          "The individual who initiated the request and has responsibility for its activation.", 0, 1, requester);
    case -901444568:
      /* performerType */ return new Property("performerType", "CodeableConcept",
          "Desired type of performer for doing the diagnostic testing.", 0, 1, performerType);
    case 481140686:
      /* performer */ return new Property("performer",
          "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)",
          "The desired performer for doing the diagnostic testing.", 0, 1, performer);
    case 722137681:
      /* reasonCode */ return new Property("reasonCode", "CodeableConcept",
          "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
    case -1146218137:
      /* reasonReference */ return new Property("reasonReference",
          "Reference(Condition|Observation|DiagnosticReport|DocumentReference)",
          "Reason or justification for the use of this device.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
    case 73049818:
      /* insurance */ return new Property("insurance", "Reference(Coverage|ClaimResponse)",
          "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.",
          0, java.lang.Integer.MAX_VALUE, insurance);
    case 1922406657:
      /* supportingInfo */ return new Property("supportingInfo", "Reference(Any)",
          "Additional clinical information about the patient that may influence the request fulfilment.  For example, this may include where on the subject's body the device will be used (i.e. the target site).",
          0, java.lang.Integer.MAX_VALUE, supportingInfo);
    case 3387378:
      /* note */ return new Property("note", "Annotation",
          "Details about this request 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, note);
    case 1538891575:
      /* relevantHistory */ return new Property("relevantHistory", "Reference(Provenance)",
          "Key events in the history of the request.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
    default:
      return super.getNamedProperty(_hash, _name, _checkValid);
    }

  }

  @Override
  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return this.identifier == null ? new Base[0]
          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
    case 8911915:
      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
    case -1926393373:
      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
    case -332612366:
      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
    case 237568101:
      /* priorRequest */ return this.priorRequest == null ? new Base[0]
          : this.priorRequest.toArray(new Base[this.priorRequest.size()]); // Reference
    case -445338488:
      /* groupIdentifier */ return this.groupIdentifier == null ? new Base[0] : new Base[] { this.groupIdentifier }; // Identifier
    case -892481550:
      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration
    case -1183762788:
      /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // Enumeration
    case -1165461084:
      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // Enumeration
    case 3059181:
      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // Type
    case 1954460585:
      /* parameter */ return this.parameter == null ? new Base[0]
          : this.parameter.toArray(new Base[this.parameter.size()]); // DeviceRequestParameterComponent
    case -1867885268:
      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
    case 1524132147:
      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
    case 1687874001:
      /* occurrence */ return this.occurrence == null ? new Base[0] : new Base[] { this.occurrence }; // Type
    case -1500852503:
      /* authoredOn */ return this.authoredOn == null ? new Base[0] : new Base[] { this.authoredOn }; // DateTimeType
    case 693933948:
      /* requester */ return this.requester == null ? new Base[0] : new Base[] { this.requester }; // Reference
    case -901444568:
      /* performerType */ return this.performerType == null ? new Base[0] : new Base[] { this.performerType }; // CodeableConcept
    case 481140686:
      /* performer */ return this.performer == null ? new Base[0] : new Base[] { this.performer }; // Reference
    case 722137681:
      /* reasonCode */ return this.reasonCode == null ? new Base[0]
          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
    case -1146218137:
      /* reasonReference */ return this.reasonReference == null ? new Base[0]
          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
    case 73049818:
      /* insurance */ return this.insurance == null ? new Base[0]
          : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
    case 1922406657:
      /* supportingInfo */ return this.supportingInfo == null ? new Base[0]
          : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
    case 3387378:
      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
    case 1538891575:
      /* relevantHistory */ return this.relevantHistory == null ? new Base[0]
          : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
    default:
      return super.getProperty(hash, name, checkValid);
    }

  }

  @Override
  public Base setProperty(int hash, String name, Base value) throws FHIRException {
    switch (hash) {
    case -1618432855: // identifier
      this.getIdentifier().add(castToIdentifier(value)); // Identifier
      return value;
    case 8911915: // instantiatesCanonical
      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
      return value;
    case -1926393373: // instantiatesUri
      this.getInstantiatesUri().add(castToUri(value)); // UriType
      return value;
    case -332612366: // basedOn
      this.getBasedOn().add(castToReference(value)); // Reference
      return value;
    case 237568101: // priorRequest
      this.getPriorRequest().add(castToReference(value)); // Reference
      return value;
    case -445338488: // groupIdentifier
      this.groupIdentifier = castToIdentifier(value); // Identifier
      return value;
    case -892481550: // status
      value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
      return value;
    case -1183762788: // intent
      value = new RequestIntentEnumFactory().fromType(castToCode(value));
      this.intent = (Enumeration) value; // Enumeration
      return value;
    case -1165461084: // priority
      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
      this.priority = (Enumeration) value; // Enumeration
      return value;
    case 3059181: // code
      this.code = castToType(value); // Type
      return value;
    case 1954460585: // parameter
      this.getParameter().add((DeviceRequestParameterComponent) value); // DeviceRequestParameterComponent
      return value;
    case -1867885268: // subject
      this.subject = castToReference(value); // Reference
      return value;
    case 1524132147: // encounter
      this.encounter = castToReference(value); // Reference
      return value;
    case 1687874001: // occurrence
      this.occurrence = castToType(value); // Type
      return value;
    case -1500852503: // authoredOn
      this.authoredOn = castToDateTime(value); // DateTimeType
      return value;
    case 693933948: // requester
      this.requester = castToReference(value); // Reference
      return value;
    case -901444568: // performerType
      this.performerType = castToCodeableConcept(value); // CodeableConcept
      return value;
    case 481140686: // performer
      this.performer = castToReference(value); // Reference
      return value;
    case 722137681: // reasonCode
      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
      return value;
    case -1146218137: // reasonReference
      this.getReasonReference().add(castToReference(value)); // Reference
      return value;
    case 73049818: // insurance
      this.getInsurance().add(castToReference(value)); // Reference
      return value;
    case 1922406657: // supportingInfo
      this.getSupportingInfo().add(castToReference(value)); // Reference
      return value;
    case 3387378: // note
      this.getNote().add(castToAnnotation(value)); // Annotation
      return value;
    case 1538891575: // relevantHistory
      this.getRelevantHistory().add(castToReference(value)); // Reference
      return value;
    default:
      return super.setProperty(hash, name, value);
    }

  }

  @Override
  public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().add(castToIdentifier(value));
    } else if (name.equals("instantiatesCanonical")) {
      this.getInstantiatesCanonical().add(castToCanonical(value));
    } else if (name.equals("instantiatesUri")) {
      this.getInstantiatesUri().add(castToUri(value));
    } else if (name.equals("basedOn")) {
      this.getBasedOn().add(castToReference(value));
    } else if (name.equals("priorRequest")) {
      this.getPriorRequest().add(castToReference(value));
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = castToIdentifier(value); // Identifier
    } else if (name.equals("status")) {
      value = new DeviceRequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
    } else if (name.equals("intent")) {
      value = new RequestIntentEnumFactory().fromType(castToCode(value));
      this.intent = (Enumeration) value; // Enumeration
    } else if (name.equals("priority")) {
      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
      this.priority = (Enumeration) value; // Enumeration
    } else if (name.equals("code[x]")) {
      this.code = castToType(value); // Type
    } else if (name.equals("parameter")) {
      this.getParameter().add((DeviceRequestParameterComponent) value);
    } else if (name.equals("subject")) {
      this.subject = castToReference(value); // Reference
    } else if (name.equals("encounter")) {
      this.encounter = castToReference(value); // Reference
    } else if (name.equals("occurrence[x]")) {
      this.occurrence = castToType(value); // Type
    } else if (name.equals("authoredOn")) {
      this.authoredOn = castToDateTime(value); // DateTimeType
    } else if (name.equals("requester")) {
      this.requester = castToReference(value); // Reference
    } else if (name.equals("performerType")) {
      this.performerType = castToCodeableConcept(value); // CodeableConcept
    } else if (name.equals("performer")) {
      this.performer = castToReference(value); // Reference
    } else if (name.equals("reasonCode")) {
      this.getReasonCode().add(castToCodeableConcept(value));
    } else if (name.equals("reasonReference")) {
      this.getReasonReference().add(castToReference(value));
    } else if (name.equals("insurance")) {
      this.getInsurance().add(castToReference(value));
    } else if (name.equals("supportingInfo")) {
      this.getSupportingInfo().add(castToReference(value));
    } else if (name.equals("note")) {
      this.getNote().add(castToAnnotation(value));
    } else if (name.equals("relevantHistory")) {
      this.getRelevantHistory().add(castToReference(value));
    } else
      return super.setProperty(name, value);
    return value;
  }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().remove(castToIdentifier(value));
    } else if (name.equals("instantiatesCanonical")) {
      this.getInstantiatesCanonical().remove(castToCanonical(value));
    } else if (name.equals("instantiatesUri")) {
      this.getInstantiatesUri().remove(castToUri(value));
    } else if (name.equals("basedOn")) {
      this.getBasedOn().remove(castToReference(value));
    } else if (name.equals("priorRequest")) {
      this.getPriorRequest().remove(castToReference(value));
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = null;
    } else if (name.equals("status")) {
      this.status = null;
    } else if (name.equals("intent")) {
      this.intent = null;
    } else if (name.equals("priority")) {
      this.priority = null;
    } else if (name.equals("code[x]")) {
      this.code = null;
    } else if (name.equals("parameter")) {
      this.getParameter().remove((DeviceRequestParameterComponent) value);
    } else if (name.equals("subject")) {
      this.subject = null;
    } else if (name.equals("encounter")) {
      this.encounter = null;
    } else if (name.equals("occurrence[x]")) {
      this.occurrence = null;
    } else if (name.equals("authoredOn")) {
      this.authoredOn = null;
    } else if (name.equals("requester")) {
      this.requester = null;
    } else if (name.equals("performerType")) {
      this.performerType = null;
    } else if (name.equals("performer")) {
      this.performer = null;
    } else if (name.equals("reasonCode")) {
      this.getReasonCode().remove(castToCodeableConcept(value));
    } else if (name.equals("reasonReference")) {
      this.getReasonReference().remove(castToReference(value));
    } else if (name.equals("insurance")) {
      this.getInsurance().remove(castToReference(value));
    } else if (name.equals("supportingInfo")) {
      this.getSupportingInfo().remove(castToReference(value));
    } else if (name.equals("note")) {
      this.getNote().remove(castToAnnotation(value));
    } else if (name.equals("relevantHistory")) {
      this.getRelevantHistory().remove(castToReference(value));
    } else
      super.removeChild(name, value);
    
  }

  @Override
  public Base makeProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      return addIdentifier();
    case 8911915:
      return addInstantiatesCanonicalElement();
    case -1926393373:
      return addInstantiatesUriElement();
    case -332612366:
      return addBasedOn();
    case 237568101:
      return addPriorRequest();
    case -445338488:
      return getGroupIdentifier();
    case -892481550:
      return getStatusElement();
    case -1183762788:
      return getIntentElement();
    case -1165461084:
      return getPriorityElement();
    case 941839219:
      return getCode();
    case 3059181:
      return getCode();
    case 1954460585:
      return addParameter();
    case -1867885268:
      return getSubject();
    case 1524132147:
      return getEncounter();
    case -2022646513:
      return getOccurrence();
    case 1687874001:
      return getOccurrence();
    case -1500852503:
      return getAuthoredOnElement();
    case 693933948:
      return getRequester();
    case -901444568:
      return getPerformerType();
    case 481140686:
      return getPerformer();
    case 722137681:
      return addReasonCode();
    case -1146218137:
      return addReasonReference();
    case 73049818:
      return addInsurance();
    case 1922406657:
      return addSupportingInfo();
    case 3387378:
      return addNote();
    case 1538891575:
      return addRelevantHistory();
    default:
      return super.makeProperty(hash, name);
    }

  }

  @Override
  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return new String[] { "Identifier" };
    case 8911915:
      /* instantiatesCanonical */ return new String[] { "canonical" };
    case -1926393373:
      /* instantiatesUri */ return new String[] { "uri" };
    case -332612366:
      /* basedOn */ return new String[] { "Reference" };
    case 237568101:
      /* priorRequest */ return new String[] { "Reference" };
    case -445338488:
      /* groupIdentifier */ return new String[] { "Identifier" };
    case -892481550:
      /* status */ return new String[] { "code" };
    case -1183762788:
      /* intent */ return new String[] { "code" };
    case -1165461084:
      /* priority */ return new String[] { "code" };
    case 3059181:
      /* code */ return new String[] { "Reference", "CodeableConcept" };
    case 1954460585:
      /* parameter */ return new String[] {};
    case -1867885268:
      /* subject */ return new String[] { "Reference" };
    case 1524132147:
      /* encounter */ return new String[] { "Reference" };
    case 1687874001:
      /* occurrence */ return new String[] { "dateTime", "Period", "Timing" };
    case -1500852503:
      /* authoredOn */ return new String[] { "dateTime" };
    case 693933948:
      /* requester */ return new String[] { "Reference" };
    case -901444568:
      /* performerType */ return new String[] { "CodeableConcept" };
    case 481140686:
      /* performer */ return new String[] { "Reference" };
    case 722137681:
      /* reasonCode */ return new String[] { "CodeableConcept" };
    case -1146218137:
      /* reasonReference */ return new String[] { "Reference" };
    case 73049818:
      /* insurance */ return new String[] { "Reference" };
    case 1922406657:
      /* supportingInfo */ return new String[] { "Reference" };
    case 3387378:
      /* note */ return new String[] { "Annotation" };
    case 1538891575:
      /* relevantHistory */ return new String[] { "Reference" };
    default:
      return super.getTypesForProperty(hash, name);
    }

  }

  @Override
  public Base addChild(String name) throws FHIRException {
    if (name.equals("identifier")) {
      return addIdentifier();
    } else if (name.equals("instantiatesCanonical")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.instantiatesCanonical");
    } else if (name.equals("instantiatesUri")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.instantiatesUri");
    } else if (name.equals("basedOn")) {
      return addBasedOn();
    } else if (name.equals("priorRequest")) {
      return addPriorRequest();
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = new Identifier();
      return this.groupIdentifier;
    } else if (name.equals("status")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.status");
    } else if (name.equals("intent")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.intent");
    } else if (name.equals("priority")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.priority");
    } else if (name.equals("codeReference")) {
      this.code = new Reference();
      return this.code;
    } else if (name.equals("codeCodeableConcept")) {
      this.code = new CodeableConcept();
      return this.code;
    } else if (name.equals("parameter")) {
      return addParameter();
    } else if (name.equals("subject")) {
      this.subject = new Reference();
      return this.subject;
    } else if (name.equals("encounter")) {
      this.encounter = new Reference();
      return this.encounter;
    } else if (name.equals("occurrenceDateTime")) {
      this.occurrence = new DateTimeType();
      return this.occurrence;
    } else if (name.equals("occurrencePeriod")) {
      this.occurrence = new Period();
      return this.occurrence;
    } else if (name.equals("occurrenceTiming")) {
      this.occurrence = new Timing();
      return this.occurrence;
    } else if (name.equals("authoredOn")) {
      throw new FHIRException("Cannot call addChild on a singleton property DeviceRequest.authoredOn");
    } else if (name.equals("requester")) {
      this.requester = new Reference();
      return this.requester;
    } else if (name.equals("performerType")) {
      this.performerType = new CodeableConcept();
      return this.performerType;
    } else if (name.equals("performer")) {
      this.performer = new Reference();
      return this.performer;
    } else if (name.equals("reasonCode")) {
      return addReasonCode();
    } else if (name.equals("reasonReference")) {
      return addReasonReference();
    } else if (name.equals("insurance")) {
      return addInsurance();
    } else if (name.equals("supportingInfo")) {
      return addSupportingInfo();
    } else if (name.equals("note")) {
      return addNote();
    } else if (name.equals("relevantHistory")) {
      return addRelevantHistory();
    } else
      return super.addChild(name);
  }

  public String fhirType() {
    return "DeviceRequest";

  }

  public DeviceRequest copy() {
    DeviceRequest dst = new DeviceRequest();
    copyValues(dst);
    return dst;
  }

  public void copyValues(DeviceRequest dst) {
    super.copyValues(dst);
    if (identifier != null) {
      dst.identifier = new ArrayList();
      for (Identifier i : identifier)
        dst.identifier.add(i.copy());
    }
    ;
    if (instantiatesCanonical != null) {
      dst.instantiatesCanonical = new ArrayList();
      for (CanonicalType i : instantiatesCanonical)
        dst.instantiatesCanonical.add(i.copy());
    }
    ;
    if (instantiatesUri != null) {
      dst.instantiatesUri = new ArrayList();
      for (UriType i : instantiatesUri)
        dst.instantiatesUri.add(i.copy());
    }
    ;
    if (basedOn != null) {
      dst.basedOn = new ArrayList();
      for (Reference i : basedOn)
        dst.basedOn.add(i.copy());
    }
    ;
    if (priorRequest != null) {
      dst.priorRequest = new ArrayList();
      for (Reference i : priorRequest)
        dst.priorRequest.add(i.copy());
    }
    ;
    dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
    dst.status = status == null ? null : status.copy();
    dst.intent = intent == null ? null : intent.copy();
    dst.priority = priority == null ? null : priority.copy();
    dst.code = code == null ? null : code.copy();
    if (parameter != null) {
      dst.parameter = new ArrayList();
      for (DeviceRequestParameterComponent i : parameter)
        dst.parameter.add(i.copy());
    }
    ;
    dst.subject = subject == null ? null : subject.copy();
    dst.encounter = encounter == null ? null : encounter.copy();
    dst.occurrence = occurrence == null ? null : occurrence.copy();
    dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
    dst.requester = requester == null ? null : requester.copy();
    dst.performerType = performerType == null ? null : performerType.copy();
    dst.performer = performer == null ? null : performer.copy();
    if (reasonCode != null) {
      dst.reasonCode = new ArrayList();
      for (CodeableConcept i : reasonCode)
        dst.reasonCode.add(i.copy());
    }
    ;
    if (reasonReference != null) {
      dst.reasonReference = new ArrayList();
      for (Reference i : reasonReference)
        dst.reasonReference.add(i.copy());
    }
    ;
    if (insurance != null) {
      dst.insurance = new ArrayList();
      for (Reference i : insurance)
        dst.insurance.add(i.copy());
    }
    ;
    if (supportingInfo != null) {
      dst.supportingInfo = new ArrayList();
      for (Reference i : supportingInfo)
        dst.supportingInfo.add(i.copy());
    }
    ;
    if (note != null) {
      dst.note = new ArrayList();
      for (Annotation i : note)
        dst.note.add(i.copy());
    }
    ;
    if (relevantHistory != null) {
      dst.relevantHistory = new ArrayList();
      for (Reference i : relevantHistory)
        dst.relevantHistory.add(i.copy());
    }
    ;
  }

  protected DeviceRequest typedCopy() {
    return copy();
  }

  @Override
  public boolean equalsDeep(Base other_) {
    if (!super.equalsDeep(other_))
      return false;
    if (!(other_ instanceof DeviceRequest))
      return false;
    DeviceRequest o = (DeviceRequest) other_;
    return compareDeep(identifier, o.identifier, true)
        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
        && compareDeep(priorRequest, o.priorRequest, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
        && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true)
        && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
        && compareDeep(parameter, o.parameter, true) && compareDeep(subject, o.subject, true)
        && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true)
        && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true)
        && compareDeep(performerType, o.performerType, true) && compareDeep(performer, o.performer, true)
        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
        && compareDeep(insurance, o.insurance, true) && compareDeep(supportingInfo, o.supportingInfo, true)
        && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true);
  }

  @Override
  public boolean equalsShallow(Base other_) {
    if (!super.equalsShallow(other_))
      return false;
    if (!(other_ instanceof DeviceRequest))
      return false;
    DeviceRequest o = (DeviceRequest) other_;
    return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
        && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
        && compareValues(authoredOn, o.authoredOn, true);
  }

  public boolean isEmpty() {
    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
        basedOn, priorRequest, groupIdentifier, status, intent, priority, code, parameter, subject, encounter,
        occurrence, authoredOn, requester, performerType, performer, reasonCode, reasonReference, insurance,
        supportingInfo, note, relevantHistory);
  }

  @Override
  public ResourceType getResourceType() {
    return ResourceType.DeviceRequest;
  }

  /**
   * Search parameter: requester
   * 

* Description: Who/what is requesting service
* Type: reference
* Path: DeviceRequest.requester
*

*/ @SearchParamDefinition(name = "requester", path = "DeviceRequest.requester", description = "Who/what is requesting service", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class, Organization.class, Practitioner.class, PractitionerRole.class }) public static final String SP_REQUESTER = "requester"; /** * Fluent Client search parameter constant for requester *

* Description: Who/what is requesting service
* Type: reference
* Path: DeviceRequest.requester
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_REQUESTER); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:requester". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include( "DeviceRequest:requester").toLocked(); /** * Search parameter: insurance *

* Description: Associated insurance coverage
* Type: reference
* Path: DeviceRequest.insurance
*

*/ @SearchParamDefinition(name = "insurance", path = "DeviceRequest.insurance", description = "Associated insurance coverage", type = "reference", target = { ClaimResponse.class, Coverage.class }) public static final String SP_INSURANCE = "insurance"; /** * Fluent Client search parameter constant for insurance *

* Description: Associated insurance coverage
* Type: reference
* Path: DeviceRequest.insurance
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_INSURANCE); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:insurance". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURANCE = new ca.uhn.fhir.model.api.Include( "DeviceRequest:insurance").toLocked(); /** * Search parameter: identifier *

* Description: Business identifier for request/order
* Type: token
* Path: DeviceRequest.identifier
*

*/ @SearchParamDefinition(name = "identifier", path = "DeviceRequest.identifier", description = "Business identifier for request/order", type = "token") public static final String SP_IDENTIFIER = "identifier"; /** * Fluent Client search parameter constant for identifier *

* Description: Business identifier for request/order
* Type: token
* Path: DeviceRequest.identifier
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_IDENTIFIER); /** * Search parameter: code *

* Description: Code for what is being requested/ordered
* Type: token
* Path: DeviceRequest.codeCodeableConcept
*

*/ @SearchParamDefinition(name = "code", path = "(DeviceRequest.code as CodeableConcept)", description = "Code for what is being requested/ordered", type = "token") public static final String SP_CODE = "code"; /** * Fluent Client search parameter constant for code *

* Description: Code for what is being requested/ordered
* Type: token
* Path: DeviceRequest.codeCodeableConcept
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_CODE); /** * Search parameter: performer *

* Description: Desired performer for service
* Type: reference
* Path: DeviceRequest.performer
*

*/ @SearchParamDefinition(name = "performer", path = "DeviceRequest.performer", description = "Desired performer for service", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { CareTeam.class, Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class }) public static final String SP_PERFORMER = "performer"; /** * Fluent Client search parameter constant for performer *

* Description: Desired performer for service
* Type: reference
* Path: DeviceRequest.performer
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PERFORMER); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:performer". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include( "DeviceRequest:performer").toLocked(); /** * Search parameter: event-date *

* Description: When service should occur
* Type: date
* Path: DeviceRequest.occurrenceDateTime, * DeviceRequest.occurrencePeriod
*

*/ @SearchParamDefinition(name = "event-date", path = "(DeviceRequest.occurrence as dateTime) | (DeviceRequest.occurrence as Period)", description = "When service should occur", type = "date") public static final String SP_EVENT_DATE = "event-date"; /** * Fluent Client search parameter constant for event-date *

* Description: When service should occur
* Type: date
* Path: DeviceRequest.occurrenceDateTime, * DeviceRequest.occurrencePeriod
*

*/ public static final ca.uhn.fhir.rest.gclient.DateClientParam EVENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam( SP_EVENT_DATE); /** * Search parameter: subject *

* Description: Individual the service is ordered for
* Type: reference
* Path: DeviceRequest.subject
*

*/ @SearchParamDefinition(name = "subject", path = "DeviceRequest.subject", description = "Individual the service is ordered for", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Device.class, Group.class, Location.class, Patient.class }) public static final String SP_SUBJECT = "subject"; /** * Fluent Client search parameter constant for subject *

* Description: Individual the service is ordered for
* Type: reference
* Path: DeviceRequest.subject
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_SUBJECT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:subject". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include( "DeviceRequest:subject").toLocked(); /** * Search parameter: instantiates-canonical *

* Description: Instantiates FHIR protocol or definition
* Type: reference
* Path: DeviceRequest.instantiatesCanonical
*

*/ @SearchParamDefinition(name = "instantiates-canonical", path = "DeviceRequest.instantiatesCanonical", description = "Instantiates FHIR protocol or definition", type = "reference", target = { ActivityDefinition.class, PlanDefinition.class }) public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical"; /** * Fluent Client search parameter constant for * instantiates-canonical *

* Description: Instantiates FHIR protocol or definition
* Type: reference
* Path: DeviceRequest.instantiatesCanonical
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_INSTANTIATES_CANONICAL); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:instantiates-canonical". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include( "DeviceRequest:instantiates-canonical").toLocked(); /** * Search parameter: encounter *

* Description: Encounter during which request was created
* Type: reference
* Path: DeviceRequest.encounter
*

*/ @SearchParamDefinition(name = "encounter", path = "DeviceRequest.encounter", description = "Encounter during which request was created", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class }) public static final String SP_ENCOUNTER = "encounter"; /** * Fluent Client search parameter constant for encounter *

* Description: Encounter during which request was created
* Type: reference
* Path: DeviceRequest.encounter
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_ENCOUNTER); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:encounter". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include( "DeviceRequest:encounter").toLocked(); /** * Search parameter: authored-on *

* Description: When the request transitioned to being actionable
* Type: date
* Path: DeviceRequest.authoredOn
*

*/ @SearchParamDefinition(name = "authored-on", path = "DeviceRequest.authoredOn", description = "When the request transitioned to being actionable", type = "date") public static final String SP_AUTHORED_ON = "authored-on"; /** * Fluent Client search parameter constant for authored-on *

* Description: When the request transitioned to being actionable
* Type: date
* Path: DeviceRequest.authoredOn
*

*/ public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam( SP_AUTHORED_ON); /** * Search parameter: intent *

* Description: proposal | plan | original-order |reflex-order
* Type: token
* Path: DeviceRequest.intent
*

*/ @SearchParamDefinition(name = "intent", path = "DeviceRequest.intent", description = "proposal | plan | original-order |reflex-order", type = "token") public static final String SP_INTENT = "intent"; /** * Fluent Client search parameter constant for intent *

* Description: proposal | plan | original-order |reflex-order
* Type: token
* Path: DeviceRequest.intent
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_INTENT); /** * Search parameter: group-identifier *

* Description: Composite request this is part of
* Type: token
* Path: DeviceRequest.groupIdentifier
*

*/ @SearchParamDefinition(name = "group-identifier", path = "DeviceRequest.groupIdentifier", description = "Composite request this is part of", type = "token") public static final String SP_GROUP_IDENTIFIER = "group-identifier"; /** * Fluent Client search parameter constant for group-identifier *

* Description: Composite request this is part of
* Type: token
* Path: DeviceRequest.groupIdentifier
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_GROUP_IDENTIFIER); /** * Search parameter: based-on *

* Description: Plan/proposal/order fulfilled by this request
* Type: reference
* Path: DeviceRequest.basedOn
*

*/ @SearchParamDefinition(name = "based-on", path = "DeviceRequest.basedOn", description = "Plan/proposal/order fulfilled by this request", type = "reference") public static final String SP_BASED_ON = "based-on"; /** * Fluent Client search parameter constant for based-on *

* Description: Plan/proposal/order fulfilled by this request
* Type: reference
* Path: DeviceRequest.basedOn
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_BASED_ON); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:based-on". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include( "DeviceRequest:based-on").toLocked(); /** * Search parameter: patient *

* Description: Individual the service is ordered for
* Type: reference
* Path: DeviceRequest.subject
*

*/ @SearchParamDefinition(name = "patient", path = "DeviceRequest.subject.where(resolve() is Patient)", description = "Individual the service is ordered for", type = "reference", target = { Patient.class }) public static final String SP_PATIENT = "patient"; /** * Fluent Client search parameter constant for patient *

* Description: Individual the service is ordered for
* Type: reference
* Path: DeviceRequest.subject
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PATIENT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:patient". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include( "DeviceRequest:patient").toLocked(); /** * Search parameter: instantiates-uri *

* Description: Instantiates external protocol or definition
* Type: uri
* Path: DeviceRequest.instantiatesUri
*

*/ @SearchParamDefinition(name = "instantiates-uri", path = "DeviceRequest.instantiatesUri", description = "Instantiates external protocol or definition", type = "uri") public static final String SP_INSTANTIATES_URI = "instantiates-uri"; /** * Fluent Client search parameter constant for instantiates-uri *

* Description: Instantiates external protocol or definition
* Type: uri
* Path: DeviceRequest.instantiatesUri
*

*/ public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam( SP_INSTANTIATES_URI); /** * Search parameter: prior-request *

* Description: Request takes the place of referenced completed or terminated * requests
* Type: reference
* Path: DeviceRequest.priorRequest
*

*/ @SearchParamDefinition(name = "prior-request", path = "DeviceRequest.priorRequest", description = "Request takes the place of referenced completed or terminated requests", type = "reference") public static final String SP_PRIOR_REQUEST = "prior-request"; /** * Fluent Client search parameter constant for prior-request *

* Description: Request takes the place of referenced completed or terminated * requests
* Type: reference
* Path: DeviceRequest.priorRequest
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRIOR_REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PRIOR_REQUEST); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:prior-request". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PRIOR_REQUEST = new ca.uhn.fhir.model.api.Include( "DeviceRequest:prior-request").toLocked(); /** * Search parameter: device *

* Description: Reference to resource that is being requested/ordered
* Type: reference
* Path: DeviceRequest.codeReference
*

*/ @SearchParamDefinition(name = "device", path = "(DeviceRequest.code as Reference)", description = "Reference to resource that is being requested/ordered", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class }) public static final String SP_DEVICE = "device"; /** * Fluent Client search parameter constant for device *

* Description: Reference to resource that is being requested/ordered
* Type: reference
* Path: DeviceRequest.codeReference
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_DEVICE); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "DeviceRequest:device". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include( "DeviceRequest:device").toLocked(); /** * Search parameter: status *

* Description: entered-in-error | draft | active |suspended | * completed
* Type: token
* Path: DeviceRequest.status
*

*/ @SearchParamDefinition(name = "status", path = "DeviceRequest.status", description = "entered-in-error | draft | active |suspended | completed", type = "token") public static final String SP_STATUS = "status"; /** * Fluent Client search parameter constant for status *

* Description: entered-in-error | draft | active |suspended | * completed
* Type: token
* Path: DeviceRequest.status
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_STATUS); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy