<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.2.17
Name: [2] Jednostka podmiotu wykonującego działalność leczniczą (bazowy)
Description: Szablon struktury CDA dla jednostki organizacyjnej podmiotu wykonującego działalność leczniczą
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000">
   <title>[2] Jednostka podmiotu wykonującego działalność leczniczą (bazowy)</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]"
         id="d16e4432-false-d20986e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2']) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2']) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:name) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:name is required [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:name) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:name appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:telecom) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:telecom is required [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:telecom) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:telecom appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']"
         id="d16e4506-false-d21048e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.2.17')">(plCdaBaseOrganizationalUnit): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.2.17'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2']
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2']"
         id="d16e4511-false-d21060e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.3.2')">(plCdaBaseOrganizationalUnit): The value for root SHALL be '2.16.840.1.113883.3.4424.2.3.2'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalUnit): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalUnit): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:name
Item: (plCdaBaseOrganizationalUnit)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:telecom"
         id="d16e4521-false-d21085e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="string-length(@value)&gt;0">(plCdaBaseOrganizationalUnit): Wartość dla telefonu, adresu email lub lokalizacji zasobu nie może by pusta.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']"
         id="d16e4529-false-d21094e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="@nullFlavor or (@codeSystem='2.16.840.1.113883.3.4424.11.2.4')">(plCdaBaseOrganizationalUnit): The element value SHALL be one of 'codeSystem '2.16.840.1.113883.3.4424.11.2.4''.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="@code">(plCdaBaseOrganizationalUnit): attribute @code SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="not(@code) or (string-length(@code) &gt; 0 and not(matches(@code,'\s')))">(plCdaBaseOrganizationalUnit): Attribute @code SHALL be of data type 'cs'  - '<value-of select="@code"/>'</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="@displayName">(plCdaBaseOrganizationalUnit): attribute @displayName SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="not(@displayName) or string-length(@displayName)&gt;0">(plCdaBaseOrganizationalUnit): Attribute @displayName SHALL be of data type 'st'  - '<value-of select="@displayName"/>'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]"
         id="d16e4538-false-d21117e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="string(@classCode) = ('PART') or not(@classCode)">(plCdaBaseOrganizationalUnit): The value for classCode SHALL be 'PART'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:id) = 0">(plCdaBaseOrganizationalUnit): element hl7:id MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:code) = 0">(plCdaBaseOrganizationalUnit): element hl7:code MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:statusCode) = 0">(plCdaBaseOrganizationalUnit): element hl7:statusCode MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:effectiveTime) = 0">(plCdaBaseOrganizationalUnit): element hl7:effectiveTime MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:id
Item: (plCdaBaseOrganizationalUnit)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:code
Item: (plCdaBaseOrganizationalUnit)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:statusCode
Item: (plCdaBaseOrganizationalUnit)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:effectiveTime
Item: (plCdaBaseOrganizationalUnit)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]"
         id="d16e4551-false-d21195e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']) &gt;= 1">(plCdaBaseOrganizationalUnit): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']) &lt;= 1">(plCdaBaseOrganizationalUnit): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2'] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.17
Context: *[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]/hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']
Item: (plCdaBaseOrganizationalUnit)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.17']]/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]/hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']"
         id="d16e4553-false-d21213e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.2.2')">(plCdaBaseOrganizationalUnit): The value for root SHALL be '2.16.840.1.113883.3.4424.2.2.2'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalUnit): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.17-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalUnit): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
   </rule>
</pattern>
