<!-- 
  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 Wed, Apr 19, 2017 07:44+1000 for FHIR v3.0.1 

  Note: the schemas &amp; schematrons do not contain all of the rules about what makes resources
  valid. Implementers will still need to be familiar with the content of the specification and with
  any profiles that apply to the resources in order to make a conformant implementation.

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://hl7.org/fhir" xmlns:xhtml="http://www.w3.org/1999/xhtml" targetNamespace="http://hl7.org/fhir" elementFormDefault="qualified" version="1.0">
  <xs:include schemaLocation="fhir-base.xsd" />
  <xs:element name="ReferralRequest" type="ReferralRequest">
    <xs:annotation>
      <xs:documentation xml:lang="en">Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="ReferralRequest">
    <xs:annotation>
      <xs:documentation xml:lang="en">Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.</xs:documentation>
      <xs:documentation xml:lang="en">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="DomainResource">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">Business identifier that uniquely identifies the referral/care transfer request instance.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="definition" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">A protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="basedOn" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates any plans, proposals or orders that this request is intended to satisfy - in whole or in part.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="replaces" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Completed or terminated request(s) whose function is taken by this new request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="groupIdentifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation xml:lang="en">The business identifier of the logical "grouping" request/order that this referral is a part of.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="RequestStatus">
            <xs:annotation>
              <xs:documentation xml:lang="en">The status of the authorization/intention reflected by the referral request record.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="intent" minOccurs="1" maxOccurs="1" type="RequestIntent">
            <xs:annotation>
              <xs:documentation xml:lang="en">Distinguishes the "level" of authorization/demand implicit in this request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">An indication of the type of referral (or where applicable the type of transfer of care) request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="priority" minOccurs="0" maxOccurs="1" type="RequestPriority">
            <xs:annotation>
              <xs:documentation xml:lang="en">An indication of the urgency of referral (or where applicable the type of transfer of care) request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="serviceRequested" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">The service(s) that is/are requested to be provided to the patient.  For example: cardiac pacemaker insertion.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="1" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The patient who is the subject of a referral or transfer of care request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="context" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The encounter at which the request for referral or transfer of care is initiated.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">The period of time within which the services identified in the referral/transfer of care is specified or required to occur.</xs:documentation>
            </xs:annotation>
            <xs:element name="occurrenceDateTime" type="dateTime" />
            <xs:element name="occurrencePeriod" type="Period" />
          </xs:choice>
          <xs:element name="authoredOn" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation xml:lang="en">Date/DateTime of creation for draft requests and date of activation for active requests.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="requester" type="ReferralRequest.Requester" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation xml:lang="en">The individual who initiated the request and has responsibility for its activation.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="specialty" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indication of the clinical domain or discipline to which the referral or transfer of care request is sent.  For example: Cardiology Gastroenterology Diabetology.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="recipient" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The healthcare provider(s) or provider organization(s) who/which is to receive the referral/transfer of care request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="reasonCode" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation xml:lang="en">Description of clinical condition indicating why referral/transfer of care is requested.  For example:  Pathological Anomalies, Disabled (physical or mental),  Behavioral Management.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="reasonReference" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Indicates another resource whose existence justifies this request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation xml:lang="en">The reason element gives a short description of why the referral is being made, the description expands on this to support a more complete clinical summary.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="supportingInfo" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Any additional (administrative, financial or clinical) information required to support request for referral or transfer of care.  For example: Presenting problems/chief complaints Medical History Family History Alerts Allergy/Intolerance and Adverse Reactions Medications Observations/Assessments (may include cognitive and fundtional assessments) Diagnostic Reports Care Plan.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="note" minOccurs="0" maxOccurs="unbounded" type="Annotation">
            <xs:annotation>
              <xs:documentation xml:lang="en">Comments made about the referral request by any of the participants.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="relevantHistory" minOccurs="0" maxOccurs="unbounded" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="ReferralRequest.Requester">
    <xs:annotation>
      <xs:documentation xml:lang="en">Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="agent" minOccurs="1" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The device, practitioner, etc. who initiated the request.</xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="onBehalfOf" minOccurs="0" maxOccurs="1" type="Reference">
            <xs:annotation>
              <xs:documentation xml:lang="en">The organization the device or practitioner was acting on behalf of.</xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>