<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%@ page import="java.util.Date,java.text.SimpleDateFormat"%>

<!DOCTYPE HTML>

<html>
<head>
<title>Notification Summary Report</title>
<link rel="icon" href="../images/emdt.ico" type="image/x-icon">
<link rel="shortcut icon" href="../images/emdt.ico"
	type="image/x-icon">
<link rel="stylesheet" href="../referrals/css/reports.css"
	type="text/css" media="screen, print">

<style media="print" type="text/css">
.noPrint {
	visibility: hidden;
	display: none;
}
</style>
</head>

<body>

<smvc:form name="notificationReport" modelAttribute="notificationReportDTO"
	method="post" action="../emdt/notificationReport.form">
	<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
	<%
		String str1 = (String) request.getParameter("module");
	%>
	<c:set var="str" value="<%=str1%>" />
	<!-- 
	<c:choose>
		<c:when test="${str eq 'referral'}">
			<div align="right" class="noPrint">&nbsp;&nbsp;<a
				href="../referrals/referralsReportMenu.jsp" class="noPrint"><img
				src="../images/16x16/action_back.png" border="0" alt="back" />&nbsp;Return
			to previous screen</a></div>
		</c:when>
		<c:otherwise>
			<div align="right" class="noPrint">&nbsp;&nbsp;<a
				href="../emdt/patientSearch.jsp" class="noPrint"><img
				src="../images/16x16/action_back.png" border="0" alt="back" />&nbsp;Return
			to previous screen</a></div>
		</c:otherwise>
	</c:choose>
	 -->
	
	<div style="width: 350px;">
	<h2>Notification Summary Report</h2>
	</div>
	<div align="right">
	<%
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm, dd MMM yyyy");
	%> Date of report: <%=sdf.format(new java.util.Date())%></div>
	<c:choose>
		<c:when
			test="${model.ackReport ne null and fn:length(model.ackReport) ne 0}">
			<table border="1" class="report">
				<tr>
					<th class="reportTableHeading" colspan="12" align="left">&nbsp;Actions
					Outstanding</th>
				</tr>
				<tr align="center">
					<th>Date Referral Received</th>
					<th>Days Elapsed</th>
					<th>Patient Name</th>
					<th>DOB</th>
					<th>Age</th>
					<th>NHS Number</th>
					<th>Referred To</th>
					<th>Referred by Consultant/Specialist</th>
					<th>Referral Submitted by</th>
					<th>Referring Hospital</th>
					<th>Response Sent</th>
					<th>Acknowledgment Received</th>
				</tr>
				<c:forEach var="report" items="${model.ackReport}" varStatus="line">
					<tr>
						<td align="center">&nbsp;<c:out value="${report.refDate}"/></td>
						<td align="right">&nbsp;<c:out value="${report.daysOld}"/></td>
						<td>&nbsp;<c:out value="${report.patientName}"/></td>
						<td align="center">&nbsp;<c:out value="${report.dateOfBirth}"/></td>
						<td align="right">&nbsp;<c:out value="${report.age}"/></td>
						<td>&nbsp;<c:out value="${report.NHSNumber}"/></td>
						<td>&nbsp;<c:out value="${report.referredTo}"/></td>
						<td>&nbsp;<c:out value="${report.referredByConsultant}"/></td>
						<td>&nbsp;<c:out value="${report.refSubmittedBy}"/></td>
						<td>&nbsp;<c:out value="${report.referringHospital}"/></td>
						<td>&nbsp;<c:out value="${report.responseSent}"/></td>
						<td align="center">&nbsp;<c:out value="${report.acknowledgementReceived}"/></td>
					</tr>
				</c:forEach>
			</table>
		</c:when>
		<c:otherwise>
			<table>
				<tr>
					<td>You have no actions outstanding at the moment.</td>
				</tr>
			</table>
		</c:otherwise>
	</c:choose>

	<br />
	<br />

	<c:choose>
		<c:when
			test="${model.referralReport ne null and fn:length(model.referralReport) ne 0}">
			<table border="1" class="report">
				<tr>
					<th class="reportTableHeading" colspan="14" align="left">&nbsp;Referrals
					Activity for Previous 2 Weeks</th>
				</tr>
				<tr align="center">
					<th>Date Referral Received</th>
					<th>Days Elapsed</th>
					<th>Patient Name</th>
					<th>DOB</th>
					<th>Age</th>
					<th>NHS Number</th>
					<th>Referred To</th>
					<th>Referred by Consultant/Specialist</th>
					<th>Referral Submitted by</th>
					<th>Referring Hospital</th>
					<th>Images Arrived</th>
					<th>Response Sent</th>
					<th>Acknowledgment Received</th>
				</tr>
				<c:forEach var="report" items="${model.referralReport}"
					varStatus="line">
					<tr>
						<td align="center"><c:out value="${report.referralDate}"/></td>
						<td align="right">&nbsp;<c:out value="${report.daysOld}"/></td>
						<td>&nbsp;<c:out value="${report.patientName}"/></td>
						<td align="right"><c:out value="${report.dateOfBirth}"/></td>
						<td>&nbsp;<c:out value="${report.age}"/></td>
						<td>&nbsp;<c:out value="${report.NHSNumber}"/></td>
						<td>&nbsp;<c:out value="${report.referredTo}"/></td>
						<td>&nbsp;<c:out value="${report.referredByConsultant}"/></td>
						<td>&nbsp;<c:out value="${report.refSubmittedBy}"/></td>
						<td>&nbsp;<c:out value="${report.referringHospital}"/></td>
						<td align="center">&nbsp;<c:out value="${report.imagesArrived}"/></td>
						<td align="center">&nbsp;<c:out value="${report.responseSent}"/></td>
						<td align="center">&nbsp;<c:out value="${report.acknowledgementReceived}"/></td>
					</tr>
				</c:forEach>
			</table>
		</c:when>
		<c:otherwise>
			<table>
				<tr>
					<td>There is no Referrals Report data available for last 2
					weeks.</td>
				</tr>
			</table>
		</c:otherwise>
	</c:choose>

	<br />
	<br />
	<br />
	<c:choose>
		<c:when
			test="${model.referralReport ne null and fn:length(model.referralReport) ne 0}">
			<table border="1" class="report">
				<tr>
					<th class="reportTableHeading" colspan="13" align="left">&nbsp;Image
					Transfer Details</th>
				</tr>
				<tr align="center">
					<th>Patient Name</th>
					<th>Hospital Number</th>
					<th>Referring Hospital Name</th>
					<th>Date Requested</th>
					<th>Accession Number</th>
					<th>Image Transfer Method</th>
					<th>Description</th>
				</tr>
				<c:forEach var="imgReport" items="${model.imageTransfer}"
					varStatus="line">
					<tr>
						<td align="left">&nbsp;<c:out value="${imgReport.patientName}"/></td>
						<td align="left">&nbsp;<c:out value="${imgReport.hospitalNumber}"/></td>
						<td>&nbsp;<c:out value="${imgReport.refHospName}"/></td>
						<td align="right"><fmt:formatDate pattern="dd/MM/yyyy HH:mm"
							value="${imgReport.dateRequested}" /></td>
						<td align="left">&nbsp;<c:out value="${imgReport.accessionNumber}"/></td>
						<td>&nbsp;<c:out value="${imgReport.imgTransMethod}"/></td>
						<td>&nbsp;<c:out value="${imgReport.probDescription}"/></td>
					</tr>

				</c:forEach>
			</table>
		</c:when>
		<c:otherwise>
			<table>
				<tr>
					<td>There is no Image Report data available.</td>
				</tr>
			</table>
		</c:otherwise>
	</c:choose>
	<br />
	
	<br />

<div id="navigation"  class="navButtonBar noPrint">
	
		<c:choose>
		<c:when test="${str eq 'referral'}">
			<img src="../images/16x16/arrow_undo.png" />&nbsp;Back to: <a href="../referrals/referralsReportMenu.jsp">Reports main menu</a> &nbsp;</a>
		</c:when>
		<c:otherwise>
			<a href="../emdt/reportMenu.jsp" class="noPrint"><img src="../images/16x16/arrow_undo.png" />&nbsp;&nbsp;Return to previous screen</a>
		</c:otherwise>
	</c:choose>

	&nbsp; &nbsp; &nbsp;
	
	<a href="javascript:print();"><img border="0" alt="Printer icon" src="../images/16x16/printer.png"> Print</a>

	&nbsp; &nbsp; &nbsp;
	
</div>
	

</smvc:form>
</body>
</html>