<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://fhir.catsalut.cat/r4/mConnectaHES/StructureDefinition/HESConnecta_ServiceRequest" />
  <name value="HESConnecta_ServiceRequest" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="ServiceRequest" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/ServiceRequest" />
  <derivation value="constraint" />
  <differential>
    <element id="ServiceRequest.identifier">
      <path value="ServiceRequest.identifier" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.identifier.value">
      <path value="ServiceRequest.identifier.value" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.status">
      <path value="ServiceRequest.status" />
      <short value="active | revoked | completed | entered-in-error" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.intent">
      <path value="ServiceRequest.intent" />
      <short value="order" />
      <fixedCode value="order" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.code">
      <path value="ServiceRequest.code" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.catsalut.cat/r4/mConnectaHES/ValueSet/Verticals-mConnecta" />
      </binding>
    </element>
    <element id="ServiceRequest.subject">
      <path value="ServiceRequest.subject" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.subject.identifier">
      <path value="ServiceRequest.subject.identifier" />
      <min value="1" />
      <mustSupport value="false" />
    </element>
    <element id="ServiceRequest.subject.identifier.type.coding.code">
      <path value="ServiceRequest.subject.identifier.type.coding.code" />
      <fixedCode value="CIP-CatSalut" />
    </element>
    <element id="ServiceRequest.subject.identifier.type.coding.display">
      <path value="ServiceRequest.subject.identifier.type.coding.display" />
      <fixedString value="Codi d'identificació personal únic del Servei Català de la Salut (CIP-CatSalut)" />
    </element>
    <element id="ServiceRequest.subject.identifier.system">
      <path value="ServiceRequest.subject.identifier.system" />
      <fixedUri value="urn:oid:2.16.724.4.9.10.1" />
    </element>
    <element id="ServiceRequest.encounter">
      <path value="ServiceRequest.encounter" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.occurrence[x]">
      <path value="ServiceRequest.occurrence[x]" />
      <min value="1" />
      <type>
        <code value="Period" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.occurrence[x].start">
      <path value="ServiceRequest.occurrence[x].start" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.requester">
      <path value="ServiceRequest.requester" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.requester.identifier">
      <path value="ServiceRequest.requester.identifier" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.locationCode">
      <path value="ServiceRequest.locationCode" />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.catsalut.cat/r4/mConnectaHES/ValueSet/Entorns" />
      </binding>
    </element>
    <element id="ServiceRequest.locationCode.coding">
      <path value="ServiceRequest.locationCode.coding" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.reasonCode">
      <path value="ServiceRequest.reasonCode" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.reasonCode.coding">
      <path value="ServiceRequest.reasonCode.coding" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.reasonReference">
      <path value="ServiceRequest.reasonReference" />
      <max value="0" />
    </element>
    <element id="ServiceRequest.insurance">
      <path value="ServiceRequest.insurance" />
      <max value="0" />
    </element>
    <element id="ServiceRequest.supportingInfo">
      <path value="ServiceRequest.supportingInfo" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.catsalut.cat/r4/mConnectaHES/StructureDefinition/HESConnecta_Device" />
      </type>
    </element>
    <element id="ServiceRequest.supportingInfo.reference">
      <path value="ServiceRequest.supportingInfo.reference" />
      <min value="1" />
    </element>
    <element id="ServiceRequest.specimen">
      <path value="ServiceRequest.specimen" />
      <max value="0" />
    </element>
    <element id="ServiceRequest.bodySite">
      <path value="ServiceRequest.bodySite" />
      <max value="0" />
    </element>
    <element id="ServiceRequest.note">
      <path value="ServiceRequest.note" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="ServiceRequest.patientInstruction">
      <path value="ServiceRequest.patientInstruction" />
      <max value="0" />
    </element>
    <element id="ServiceRequest.relevantHistory">
      <path value="ServiceRequest.relevantHistory" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>