<?xml version="1.0" encoding="UTF-8"?>
<!-- 
  Copyright (c) 2011-2013, 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, Sep 30, 2014 18:08+1000 for FHIR v0.0.82 
-->
<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="0.0.82">
  <xs:include schemaLocation="fhir-base.xsd"/>
  <xs:element name="OrderResponse" type="OrderResponse">
    <xs:annotation>
      <xs:documentation>A response to an order.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="OrderResponse">
    <xs:annotation>
      <xs:documentation>A response to an order.</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Resource">
        <xs:sequence>
          <xs:element name="identifier" minOccurs="0" maxOccurs="unbounded" type="Identifier">
            <xs:annotation>
              <xs:documentation>Identifiers assigned to this order. The identifiers are usually assigned by the system responding to the order, but they may be provided or added to by other systems.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="request" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>A reference to the order that this is in response to.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="date" minOccurs="0" maxOccurs="1" type="dateTime">
            <xs:annotation>
              <xs:documentation>The date and time at which this order response was made (created/posted).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="who" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The person, organization, or device credited with making the response.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:choice minOccurs="0" maxOccurs="1" >
            <xs:annotation>
              <xs:documentation>A reference to an authority policy that is the reason for the response. Usually this is used when the order is rejected, to provide a reason for rejection.</xs:documentation>
            </xs:annotation>
            <xs:element name="authorityCodeableConcept" type="CodeableConcept"/>
            <xs:element name="authorityResource" type="ResourceReference"/>
          </xs:choice>
          <xs:element name="code" minOccurs="1" maxOccurs="1" type="OrderOutcomeStatus">
            <xs:annotation>
              <xs:documentation>What this response says about the status of the original order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="description" minOccurs="0" maxOccurs="1" type="string">
            <xs:annotation>
              <xs:documentation>Additional description about the response - e.g. a text description provided by a human user when making decisions about the order.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="fulfillment" minOccurs="0" maxOccurs="unbounded" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Links to resources that provide details of the outcome of performing the order. E.g. Diagnostic Reports in a response that is made to an order that referenced a diagnostic order.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="OrderOutcomeStatus-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="pending">
        <xs:annotation>
          <xs:documentation>The order is known, but no processing has occurred at this time.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="review">
        <xs:annotation>
          <xs:documentation>The order is undergoing initial processing to determine whether it will be accepted (usually this involves human review).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="rejected">
        <xs:annotation>
          <xs:documentation>The order was rejected because of a workflow/business logic reason.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="error">
        <xs:annotation>
          <xs:documentation>The order was unable to be processed because of a technical error (i.e. unexpected error).</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="accepted">
        <xs:annotation>
          <xs:documentation>The order has been accepted, and work is in progress.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>Processing the order was halted at the initiators request.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="replaced">
        <xs:annotation>
          <xs:documentation>The order has been cancelled and replaced by another.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="aborted">
        <xs:annotation>
          <xs:documentation>Processing the order was stopped because of some workflow/business logic reason.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="complete">
        <xs:annotation>
          <xs:documentation>The order has been completed.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="OrderOutcomeStatus">
    <xs:annotation>
      <xs:documentation>The status of the response to an order</xs:documentation>
      <xs:documentation>If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="Element">
        <xs:attribute name="value" type="OrderOutcomeStatus-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
