<?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="Encounter" type="Encounter">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
  </xs:element>
  <xs:complexType name="Encounter">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</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>Identifier(s) by which this encounter is known.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="status" minOccurs="1" maxOccurs="1" type="EncounterState">
            <xs:annotation>
              <xs:documentation>planned | in progress | onleave | finished | cancelled.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="class" minOccurs="1" maxOccurs="1" type="EncounterClass">
            <xs:annotation>
              <xs:documentation>inpatient | outpatient | ambulatory | emergency +.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="type" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="subject" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The patient present at the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="participant" type="Encounter.Participant" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>The main practitioner responsible for providing the service.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>The start and end time of the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="length" minOccurs="0" maxOccurs="1" type="Duration">
            <xs:annotation>
              <xs:documentation>Quantity of time the encounter lasted. This excludes the time during leaves of absence.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reason" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="indication" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="priority" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Indicates the urgency of the encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="hospitalization" type="Encounter.Hospitalization" minOccurs="0" maxOccurs="1">
            <xs:annotation>
              <xs:documentation>Details about an admission to a clinic.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="location" type="Encounter.Location" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>List of locations at which the patient has been.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="serviceProvider" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Department or team providing care.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="partOf" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Another Encounter of which this encounter is a part of (administratively or in time).</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Participant">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="type" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Role of participant in encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="individual" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Persons involved in the encounter other than the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Hospitalization">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="preAdmissionIdentifier" minOccurs="0" maxOccurs="1" type="Identifier">
            <xs:annotation>
              <xs:documentation>Pre-admission identifier.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="origin" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The location from which the patient came before admission.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="admitSource" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>From where patient was admitted (physician referral, transfer).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Period during which the patient was admitted.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="accomodation" type="Encounter.Accomodation" minOccurs="0" maxOccurs="unbounded">
            <xs:annotation>
              <xs:documentation>Where the patient stays during this encounter.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="diet" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Dietary restrictions for the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specialCourtesy" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Special courtesies (VIP, board member).</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="specialArrangement" minOccurs="0" maxOccurs="unbounded" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Wheelchair, translator, stretcher, etc.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="destination" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>Location to which the patient is discharged.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dischargeDisposition" minOccurs="0" maxOccurs="1" type="CodeableConcept">
            <xs:annotation>
              <xs:documentation>Category or kind of location after discharge.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="dischargeDiagnosis" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The final diagnosis given a patient before release from the hospital after all testing, surgery, and workup are complete.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="reAdmission" minOccurs="0" maxOccurs="1" type="boolean">
            <xs:annotation>
              <xs:documentation>Whether this hospitalization is a readmission.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Accomodation">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="bed" minOccurs="0" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The bed that is assigned to the patient.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="0" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Period during which the patient was assigned the bed.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Encounter.Location">
    <xs:annotation>
      <xs:documentation>An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="BackboneElement">
        <xs:sequence>
          <xs:element name="location" minOccurs="1" maxOccurs="1" type="ResourceReference">
            <xs:annotation>
              <xs:documentation>The location where the encounter takes place.</xs:documentation>
           </xs:annotation>
          </xs:element>
          <xs:element name="period" minOccurs="1" maxOccurs="1" type="Period">
            <xs:annotation>
              <xs:documentation>Time period during which the patient was present at the location.</xs:documentation>
           </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="EncounterClass-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="inpatient">
        <xs:annotation>
          <xs:documentation>An encounter during which the patient is hospitalized and stays overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="outpatient">
        <xs:annotation>
          <xs:documentation>An encounter during which the patient is not hospitalized overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="ambulatory">
        <xs:annotation>
          <xs:documentation>An encounter where the patient visits the practitioner in his/her office, e.g. a G.P. visit.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="emergency">
        <xs:annotation>
          <xs:documentation>An encounter where the patient needs urgent care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="home">
        <xs:annotation>
          <xs:documentation>An encounter where the practitioner visits the patient at his/her home.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="field">
        <xs:annotation>
          <xs:documentation>An encounter taking place outside the regular environment for giving care.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="daytime">
        <xs:annotation>
          <xs:documentation>An encounter where the patient needs more prolonged treatment or investigations than outpatients, but who do not need to stay in the hospital overnight.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="virtual">
        <xs:annotation>
          <xs:documentation>An encounter that takes place where the patient and practitioner do not physically meet but use electronic means for contact.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EncounterClass">
    <xs:annotation>
      <xs:documentation>Classification of the encounter</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="EncounterClass-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:simpleType name="EncounterState-list">
    <xs:restriction base="xs:string">
      <xs:enumeration value="planned">
        <xs:annotation>
          <xs:documentation>The Encounter has not yet started.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="in progress">
        <xs:annotation>
          <xs:documentation>The Encounter has begun and the patient is present / the practitioner and the patient are meeting.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="onleave">
        <xs:annotation>
          <xs:documentation>The Encounter has begun, but the patient is temporarily on leave.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="finished">
        <xs:annotation>
          <xs:documentation>The Encounter has ended.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="cancelled">
        <xs:annotation>
          <xs:documentation>The Encounter has ended before it has begun.</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="EncounterState">
    <xs:annotation>
      <xs:documentation>Current state of the encounter</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="EncounterState-list" use="optional"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>
