<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.280
Name: [4] KMCR VId Karta medycznych czynności ratunkowych
Description: KMCR VId Karta medycznych czynności ratunkowych
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.280-2025-02-26T000000">
   <title>[4] KMCR VId Karta medycznych czynności ratunkowych</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]"
         id="d16e12791-false-d49517e0">
      <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.4.280-2025-02-26T000000.html"
              test="count(hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]) &gt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]) &lt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]"
         id="d16e12818-false-d49534e0">
      <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.4.280-2025-02-26T000000.html"
              test="string(@classCode) = ('ACT')">(plCdaRescueDocumentHandoverEntry): The value for classCode SHALL be 'ACT'. 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.4.280-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRescueDocumentHandoverEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</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.4.280-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']) &gt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280'] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']) &lt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280'] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &gt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &lt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:statusCode[@code = 'completed'] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:statusCode[@code = 'completed'] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:text[not(@nullFlavor)]) &gt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:text[not(@nullFlavor)] 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.4.280-2025-02-26T000000.html"
              test="count(hl7:text[not(@nullFlavor)]) &lt;= 1">(plCdaRescueDocumentHandoverEntry): element hl7:text[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']"
         id="d16e12824-false-d49586e0">
      <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.4.280-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.280')">(plCdaRescueDocumentHandoverEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.280'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:code[(@code = 'KMCR_VId' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]"
         id="d16e12829-false-d49598e0">
      <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.4.280-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KMCR_VId' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.1' and @displayName='Wydanie karty medycznej' and @codeSystemName='WpisDoKMCR_KMLZRM')">(plCdaRescueDocumentHandoverEntry): The element value SHALL be one of 'code 'KMCR_VId' codeSystem '2.16.840.1.113883.3.4424.13.5.30.1' displayName='Wydanie karty medycznej' codeSystemName='WpisDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:statusCode[@code = 'completed']
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:statusCode[@code = 'completed']"
         id="d16e12834-false-d49612e0">
      <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.4.280-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaRescueDocumentHandoverEntry): The element value SHALL be one of 'code 'completed''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.280
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:text[not(@nullFlavor)]
Item: (plCdaRescueDocumentHandoverEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.280']]/hl7:text[not(@nullFlavor)]"
         id="d16e12840-false-d49625e0">
      <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.4.280-2025-02-26T000000.html"
              test="text()='nie wydano - pacjent nie wyraził zgody'">(plCdaRescueDocumentHandoverEntry): the element content of hl7:text[not(@nullFlavor)] SHALL be ''nie wydano - pacjent nie wyraził zgody''. Found: "<value-of select="."/>"</assert>
   </rule>
</pattern>
