<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.2.90
Name: [2] Dane asystenta medycznego
Description: Bazowy szablon struktury CDA dla danych asystenta medycznego
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000">
   <title>[2] Dane asystenta medycznego</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90'])&gt;=1 ">(plCdaAssistantDataEnterer): element hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90'] jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90'])&lt;=1">(plCdaAssistantDataEnterer): element hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="string(@typeCode)='ENT' or not(@typeCode)">(plCdaAssistantDataEnterer): Wartość dla @typeCode MUSI wynosić 'ENT'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="not(./*[not(self::hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90'] | self::hl7:time | self::hl7:assignedEntity)])">(plCdaAssistantDataEnterer): We fragmencie dokumentu zgodnym z szablonem "[2] Dane asystenta medycznego" występują niedozwolone elementy.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90']/@nullFlavor)">(plCdaAssistantDataEnterer): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90'])&lt;=1">(plCdaAssistantDataEnterer): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:time)&lt;=1">(plCdaAssistantDataEnterer): element hl7:time występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:assignedEntity)&gt;=1 and not(hl7:assignedEntity/@nullFlavor)">(plCdaAssistantDataEnterer): element hl7:assignedEntity jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:assignedEntity)&lt;=1">(plCdaAssistantDataEnterer): element hl7:assignedEntity występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90']
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.90']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaAssistantDataEnterer): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="II"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.13.10.2.90'">(plCdaAssistantDataEnterer): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.13.10.2.90'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaAssistantDataEnterer): Atrybut @root MUSI być typu 'oid'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:time
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:time"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaAssistantDataEnterer): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:TS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="TS"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="string(@classCode)='ASSIGNED' or not(@classCode)">(plCdaAssistantDataEnterer): Wartość dla @classCode MUSI wynosić 'ASSIGNED'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="not(./*[not(self::hl7:id | self::hl7:addr | self::hl7:telecom | self::hl7:assignedPerson)])">(plCdaAssistantDataEnterer): We fragmencie dokumentu zgodnym z szablonem "[2] Dane asystenta medycznego" występują niedozwolone elementy.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:id)&gt;=1 ">(plCdaAssistantDataEnterer): element hl7:id jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:id)&lt;=1">(plCdaAssistantDataEnterer): element hl7:id występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:addr)&lt;=1">(plCdaAssistantDataEnterer): element hl7:addr występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:telecom)&lt;=1">(plCdaAssistantDataEnterer): element hl7:telecom występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1'])&gt;=1 and not(hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1']/@nullFlavor)">(plCdaAssistantDataEnterer): element hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="count(hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1'])&lt;=1">(plCdaAssistantDataEnterer): element hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity/hl7:id
Item: (plCdaAssistantDataEnterer)
-->

   <rule context="*[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity/hl7:id"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.90-2019-09-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaAssistantDataEnterer): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="II"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity/hl7:addr
Item: (plCdaAssistantDataEnterer)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity/hl7:telecom
Item: (plCdaAssistantDataEnterer)
-->


   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.90
Context: *[hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']]/hl7:dataEnterer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.90']/hl7:assignedEntity/hl7:assignedPerson[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.1']
Item: (plCdaAssistantDataEnterer)
--></pattern>
