<!-- nationalMDT/tiles/patientSearchResultsBox.jsp -->
<%@ include file="/includes.jsp"%>
<jsp:useBean id="patientSearchPD" class="com.ardeo.util.PaginationData" scope="session"/>

<table width="100%" cellspacing="0" class="table" id="searchTableId" >
	<thead>
	<tr class="tableHeader">
		<th class="tableColHeader" width="40px"></th>
		<th class="tableColHeader">Patient<br/>Surname</th>
		<th class="tableColHeader" >Patient<br/>Forename</th>
		<th class="tableColHeader" >Hospital<br/>Number</th>
		<th class="tableColHeader" >Date&nbsp;of&nbsp;Birth</th>
		<th class="tableColHeader">Primary<br/>Clinician</th>
		<th class="tableColHeader" >Submission<br/>Date</th>
		<th class="tableColHeader" >Submitting Clinician</th>
		<th class="tableColHeader">Submitting Hospital</th>
		<th class="tableColHeader">Reason</th>
		<th class="tableColHeader">Tracking</th>
		<th class="tableColHeader">National Meeting Date</th>
		<%-- Not required for Spire NMDM
		<th class="tableColHeader">Image Availability</th>
		 --%>
	</tr>
	</thead>
<c:choose>
<c:when test="${(patientSearchDto.referralsPatient ne null) and (fn:length(patientSearchDto.referralsPatient) gt 0)}">
	<c:forEach var="patient" items="${patientSearchDto.referralsPatient}" varStatus="s1" begin="${patientSearchPD.startOfPageIndex}" end="${patientSearchPD.endOfPageIndex}">

		<c:set var="rowClass" value="${s1.count % 2 == 0 ? 'evenRow' : 'oddRow'}" />
			<c:forEach var="cs" items="${patient.careSpellsResultsDtoList}" varStatus="cs1">

				<tr class="<c:out value="${rowClass}"/>" id="rowId<c:out value="${s1.count}"/>.<c:out value="${cs1.count}"/>" onmouseover="this.style.cursor = cursorPointer;">
					<td onclick="return false;">
						<input type="image" src="../images/add.png" title="more details" value="Add" onclick="showPatientDtlsInSrchRecord('<c:out value="${patient.patient_guid}"/>','rowId<c:out value="${s1.count}"/>.<c:out value="${cs1.count}"/>','<c:out value="${parentScreen}"/>',0,'<c:out value="${cs.patient_careSpell_id}"/>');return false;" />
					</td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${patient.patient_surname}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${patient.patient_forename}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${patient.patient_hospitalNumber}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><fmt:formatDate value="${patient.patient_dateOfBirth}" pattern="dd MMM yyyy" /></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${webapp.userNameNameMap[cs.patient_careSpell_primaryClinician_username]}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><fmt:formatDate value="${cs.patient_careSpell_referralDetails_referralDate}" pattern="dd MMM yyyy" />&nbsp;</td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${webapp.userNameNameMap[cs.patient_careSpell_referralDetails_referringSpecialistUser_username]}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${webapp.hospMap[cs.patient_careSpell_referralDetails_referringFromHospitalId]}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${cs.patient_careSpell_referralDetails_referralsDefinition.title}"/>&nbsp;</td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><c:out value="${cs.tracking}"/></td>
					<td class="tableCell" onclick="document.location.href='viewPatient.form?patientId=<c:out value="${patient.patient_guid}"/>&csId=<c:out value="${cs.patient_careSpell_id}"/>'"><fmt:formatDate	value="${patient.meetingDate}" pattern="dd MMM yyyy" />&nbsp;</td>

				</tr>
			</c:forEach>
	</c:forEach>
</c:when>
<c:otherwise>
	<tr>
		<td align="center" class="message" colspan="12">No Patients	Found</td>
	</tr>
</c:otherwise>
</c:choose>

<tfoot>
	<tr class="tableFooter">
		<td colspan="12">&nbsp;</td>
	</tr>
</tfoot>

</table>