<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.324
Name: [4] Obrażenia pacjenta
Description: Obrażenia pacjenta
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.324-2025-02-26T000000">
   <title>[4] Obrażenia pacjenta</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]
Item: (plCdaPatientInjuriesEntry)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]"
         id="d16e14553-false-d55500e0">
      <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.324-2025-02-26T000000.html"
              test="string(@classCode) = ('BATTERY')">(plCdaPatientInjuriesEntry): The value for classCode SHALL be 'BATTERY'. 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.324-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaPatientInjuriesEntry): 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.324-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']) &gt;= 1">(plCdaPatientInjuriesEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324'] 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.324-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']) &lt;= 1">(plCdaPatientInjuriesEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324'] 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.324-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')]) &gt;= 1">(plCdaPatientInjuriesEntry): element hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')] 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.324-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')]) &lt;= 1">(plCdaPatientInjuriesEntry): element hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')] 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.324-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaPatientInjuriesEntry): 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.324-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaPatientInjuriesEntry): 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.324-2025-02-26T000000.html"
              test="count(hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.328']) &lt;= 1">(plCdaPatientInjuriesEntry): element hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.328'] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']
Item: (plCdaPatientInjuriesEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']"
         id="d16e14559-false-d55554e0">
      <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.324-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.324')">(plCdaPatientInjuriesEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.324'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')]
Item: (plCdaPatientInjuriesEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:code[(@code = '417163006' and @codeSystem = '2.16.840.1.113883.6.96')]"
         id="d16e14564-false-d55566e0">
      <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.324-2025-02-26T000000.html"
              test="@nullFlavor or (@code='417163006' and @codeSystem='2.16.840.1.113883.6.96' and @displayName='Traumatic or non-traumatic injury (disorder)' and @codeSystemName='SNOMED-CT')">(plCdaPatientInjuriesEntry): The element value SHALL be one of 'code '417163006' codeSystem '2.16.840.1.113883.6.96' displayName='Traumatic or non-traumatic injury (disorder)' codeSystemName='SNOMED-CT''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:statusCode[@code = 'completed']
Item: (plCdaPatientInjuriesEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:statusCode[@code = 'completed']"
         id="d16e14569-false-d55580e0">
      <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.324-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaPatientInjuriesEntry): 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.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.274']
Item: (plCdaPatientInjuriesEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.274']">
      <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.324-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaPatientInjuriesEntry): The value for typeCode SHALL be 'COMP'. Found: "<value-of select="@typeCode"/>"</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.327']
Item: (plCdaPatientInjuriesEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.327']">
      <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.324-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaPatientInjuriesEntry): The value for typeCode SHALL be 'COMP'. Found: "<value-of select="@typeCode"/>"</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.328']
Item: (plCdaPatientInjuriesEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.328']">
      <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.324-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaPatientInjuriesEntry): The value for typeCode SHALL be 'COMP'. Found: "<value-of select="@typeCode"/>"</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.324
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.329']
Item: (plCdaPatientInjuriesEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.324']]/hl7:component[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.329']">
      <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.324-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaPatientInjuriesEntry): The value for typeCode SHALL be 'COMP'. Found: "<value-of select="@typeCode"/>"</assert>
   </rule>
</pattern>
