<?xml version="1.0" encoding="UTF-8"?>
<!--

Stylesheet for timecritical data templates
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:urn="urn:hl7-org:v3">
	<!--

	Main timecritical data template which includes content rows
	-->
	<xsl:template name="structuredBody.timeCritical" match="urn:structuredBody" mode="timeCritical">
		<!--Patsient-->
		<xsl:if test="../../urn:recordTarget/urn:patientRole/urn:patient">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="../../urn:recordTarget/urn:patientRole/urn:patient" mode="timecritical"/>
				</td>
			</tr>
		</xsl:if>	
		<!--veregrupp-->	
		<xsl:if test="urn:component/urn:section[urn:code/@code='BLRH']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='BLRH']" mode="bloodRh"/>
				</td>
			</tr>
		</xsl:if>
		
		<!--rasedus-->		
		<xsl:if test="urn:component/urn:section[urn:code/@code='PRGN']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='PRGN']" mode="pregnancy"/>
				</td>
			</tr>
		</xsl:if>
		<!--puude ja töövõimetuse andmed-->
	<xsl:if test="urn:component/urn:section[urn:code/@code='DISABL']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='DISABL']" mode="disability"/>
				</td>
			</tr>
		</xsl:if>
		<!--Allergiad-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='ALL']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='ALL']" mode="diagnoses"/>
				</td>
			</tr>
		</xsl:if>
		<!--Immuniseerimine-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='IMM']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='IMM']" mode="immunization">
					<xsl:with-param name="ageGroup" select="'All'"/>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
		<!--Olulised kirurgilised protseduurid-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='STPROC']">		
		<tr>
			<td class="tableBlock">
				<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='STPROC']" mode="statProcedures"/>
			</td>
		</tr>
		</xsl:if>
		<!--kroonilised haigused-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='DGNCHR']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='DGNCHR']" mode="diagnoses"/>
				</td>
			</tr>
		</xsl:if>
		<!--väljastatud ravimid (apteegist aegkriitiliste andmete teatisega)-->	
		<xsl:if test="urn:component/urn:section[urn:code/@code='DRUG']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='DRUG']" mode="drugs"/>
				</td>
			</tr>
		</xsl:if>
	<!--väljastatud ravimid viimase 3 kuu jooksul (Digilugu väljastab)-->	
		<xsl:if test="urn:component/urn:section[urn:code/@code='DRUGLST']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='DRUGLST']" mode="drugs"/>
				</td>
			</tr>
		</xsl:if>
		<!--muu oluline lisainfo-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='TCOTHER']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='TCOTHER']" mode="otherInfo"/>
				</td>
			</tr>
		</xsl:if>	
		<!--kirurgilised protseduurid (operatsioonid) viimase 3 kuu jooksul-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='PROCES']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='PROCES']" mode="statProcedures"/>
				</td>
			</tr>
		</xsl:if>	
		<!--viimane visiit või hospitaliseeriminel-->
		<xsl:if test="urn:component/urn:section[urn:code/@code='CASES']">
			<tr>
				<td class="tableBlock">
					<xsl:apply-templates select="urn:component/urn:section[urn:code/@code='CASES']" mode="lastCases"/>
				</td>
			</tr>
			</xsl:if>	
	</xsl:template>
</xsl:stylesheet>

