<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="au-healthcareservice" />
  <url value="http://hl7.org.au/fhir/StructureDefinition/au-healthcareservice" />
  <version value="1.1.0" />
  <name value="AUBaseHealthcareService" />
  <title value="AU Base Healthcare Service" />
  <status value="active" />
  <date value="2018-08-03" />
  <publisher value="Health Level Seven Australia (Patient Administration WG)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org.au/fhir" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="This profile defines a healthcare service administration details structure that includes core localisation concepts for use in an Australian context." />
  <fhirVersion value="3.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="HealthcareService" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/HealthcareService" />
  <derivation value="constraint" />
  <differential>
    <element id="HealthcareService">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="trial-use" />
      </extension>
      <path value="HealthcareService" />
      <short value="A healthcare service in an Australian healthcare context" />
      <definition value="The details of a healthcare service." />
    </element>
    <element id="HealthcareService.extension">
      <path value="HealthcareService.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="HealthcareService.extension:eligibilityDetails">
      <path value="HealthcareService.extension" />
      <sliceName value="eligibilityDetails" />
      <short value="Healthcare Service Eligibility Detail" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org.au/fhir/StructureDefinition/healthcareservice-eligibility-detail" />
      </type>
    </element>
    <element id="HealthcareService.extension:communication">
      <path value="HealthcareService.extension" />
      <sliceName value="communication" />
      <short value="Healthcare Service Communication Languages" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org.au/fhir/StructureDefinition/healthcareservice-communication" />
      </type>
    </element>
    <element id="HealthcareService.identifier">
      <path value="HealthcareService.identifier" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="type" />
        </discriminator>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <short value="Healthcare service identifiers" />
    </element>
    <element id="HealthcareService.identifier:hpio">
      <path value="HealthcareService.identifier" />
      <sliceName value="hpio" />
      <short value="Healthcare Provider Identifier – Organisation (HPI-O)" />
      <definition value="National identifier Health Provider Identifier for Organisations (HPI-O)." />
      <constraint>
        <key value="inv-hpio-0" />
        <severity value="error" />
        <human value="HPI-O shall be an exactly 16 digit number" />
        <expression value="value.matches('^([0-9]{16})$')" />
      </constraint>
      <constraint>
        <key value="inv-hpio-1" />
        <severity value="error" />
        <human value="HPI-O prefix is 800362" />
        <expression value="value.startsWith('800362')" />
      </constraint>
      <constraint>
        <key value="inv-hpio-2" />
        <severity value="error" />
        <human value="HPI-O shall pass the Luhn algorithm check" />
        <expression value="(((select(value.substring(0,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(1,1).toInteger())+(select(value.substring(2,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(3,1).toInteger())+(select(value.substring(4,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(5,1).toInteger())+(select(value.substring(6,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(7,1).toInteger())+(select(value.substring(8,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(9,1).toInteger())+(select(value.substring(10,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(11,1).toInteger())+(select(value.substring(12,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(13,1).toInteger())+(select(value.substring(14,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(15,1).toInteger()))mod 10=0)" />
      </constraint>
    </element>
    <element id="HealthcareService.identifier:hpio.type">
      <path value="HealthcareService.identifier.type" />
      <short value="Identifier type for HPI-O" />
      <definition value="Healthcare Provider Identifier – Organisation (HPI-O) identifier type." />
      <patternCodeableConcept>
        <coding>
          <system value="http://hl7.org.au/fhir/v2/0203" />
          <code value="NOI" />
        </coding>
      </patternCodeableConcept>
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="IdentifierType" />
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding">
          <valueBoolean value="true" />
        </extension>
        <strength value="required" />
        <description value="Local identifier type" />
        <valueSetReference>
          <reference value="http://hl7.org.au/fhir/ValueSet/au-hl7v2-0203" />
        </valueSetReference>
      </binding>
    </element>
    <element id="HealthcareService.identifier:hpio.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="HealthcareService.identifier.type.text" />
      <definition value="hpi-o" />
      <fixedString value="HPI-O" />
    </element>
    <element id="HealthcareService.identifier:hpio.system">
      <path value="HealthcareService.identifier.system" />
      <short value="Namespace for HPI-O" />
      <definition value="This namespace is used for qualified identifiers to represent Healthcare Provider Identifier for Organisations (HPI-O) numbers. An example of the syntax of a HPI-O represented as a qualified identifer using this namespace is: http://ns.electronichealth.net.au/id/hi/hpio/1.0/8003620000000000" />
      <min value="1" />
      <fixedUri value="http://ns.electronichealth.net.au/id/hi/hpio/1.0" />
    </element>
    <element id="HealthcareService.identifier:hpio.value">
      <path value="HealthcareService.identifier.value" />
      <short value="HPI-O number" />
      <definition value="Identifier for the organization that is used to identify the organization across multiple disparate systems." />
      <min value="1" />
      <example>
        <label value="HPI-O number" />
        <valueString value="8003621566684455" />
      </example>
      <maxLength value="16" />
    </element>
    <element id="HealthcareService.type">
      <path value="HealthcareService.type" />
      <short value="Healthcare service types" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="service-type" />
        </extension>
        <strength value="preferred" />
        <description value="A type of service that a healthcare service may provide." />
        <valueSetReference>
          <reference value="http://hl7.org.au/fhir/ValueSet/snomed-healthcareservice-services" />
        </valueSetReference>
      </binding>
    </element>
    <element id="HealthcareService.specialty">
      <path value="HealthcareService.specialty" />
      <short value="Healthcare service provided specialties" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="service-specialty" />
        </extension>
        <strength value="preferred" />
        <description value="A specialty role that a healthcare service may provide." />
        <valueSetReference>
          <reference value="http://hl7.org.au/fhir/ValueSet/snomed-healthcareservice-roles" />
        </valueSetReference>
      </binding>
    </element>
    <element id="HealthcareService.serviceProvisionCode">
      <path value="HealthcareService.serviceProvisionCode" />
      <short value="Healthcare service provision conditions" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="ServiceProvisionConditions" />
        </extension>
        <strength value="preferred" />
        <valueSetReference>
          <reference value="http://hl7.org.au/fhir/ValueSet/service-provision-conditions" />
        </valueSetReference>
      </binding>
    </element>
    <element id="HealthcareService.eligibility">
      <path value="HealthcareService.eligibility" />
      <short value="Primary eligibility criteria for service" />
      <definition value="Primary eligibility criterial for service." />
      <comment value="The extension Healthcare Service; eligibilityDetails allows for specific desciption of multiple criteria." />
    </element>
  </differential>
</StructureDefinition>