<%@ include file="/includes.jsp" %>
<c:if test="${emdt.patient != null }">
	<table  class="patientDemographicsBox">
		<tr><td width="200" align="center"><c:choose>
			<c:when test="${previousPatientId!=null}">
			
				<a href="viewPatient.form?patientId=<c:out value="${previousPatientId}"/>" class="buttonClass" title="Go to previous patient"><img src="../images/backward.png"/>&nbsp;Previous&nbsp;patient&nbsp;&nbsp;</a>
				
			</c:when>
			<c:otherwise>
				<div class="buttonClass" title="At first patient"><img src="../images/disabled_back.png"/>&nbsp;Previous&nbsp;patient&nbsp;&nbsp;</div>

			</c:otherwise>
		</c:choose></td>
		<td>
			<table width="100%">
				<tr>
					<td class="patientDemographicsBoxLabel">Surname</td>
					<td class="patientDemographicsBoxLabel">Forename</td>
					<td class="patientDemographicsBoxLabel">Gender</td>
					<td class="patientDemographicsBoxLabel">Date of Birth</td>
					<td class="patientDemographicsBoxLabel">Age</td>
				<!-- <td class="patientDemographicsBoxLabel">NHS No.:</td>  -->	
					<td class="patientDemographicsBoxLabel">Hospital Number</td>
					<td class="patientDemographicsBoxLabel">Primary Clinician</td>
					<td class="patientDemographicsBoxLabel">Care Spell</td>
					<td class="patientDemographicsBoxLabel">Status</td>
				</tr>
				<tr>
					<td class="patientDemographicsBoxValue"><c:out value="${emdt.patient.surname }"/></td>
					<td class="patientDemographicsBoxValue"><c:out value="${emdt.patient.forename }"/></td>
					<td class="patientDemographicsBoxValue"><webapp:listValue domain="EMDT" listName="SexCode" key="${emdt.patient.sex}" /></td>
					<td class="patientDemographicsBoxValue"><fmt:formatDate value="${emdt.patient.dateOfBirth}" pattern="dd MMM yyyy"/>
					<td class="patientDemographicsBoxValue">
						<c:if test="${emdt.patient.dateOfBirth != null}">
							<c:out value="${emdt.patient.currentAge }"/>
						</c:if>
						<c:if test="${emdt.patient.dateOfDeath != null}">
							<font color="maroon">(deceased)</font>
						</c:if>
					
					</td>
				<!-- <td class="patientDemographicsBoxValue"><c:out value="${emdt.patient.nhsNumber }"/></td>  -->	
					<td class="patientDemographicsBoxValue"><c:out value="${emdt.patient.hospitalNumber }"/></td>
					<td class="patientDemographicsBoxValue">
						<c:if test="${emdt.currentCareSpell != null}">
							<c:out value="${emdt.currentCareSpell.primaryClinician.fullName}"/>	 
						</c:if>
					</td>
					<td class="patientDemographicsBoxValue">
						<c:if test="${emdt.currentCareSpell != null}">
							<webapp:listValue domain="EMDT" listName="Speciality" key="${emdt.currentCareSpell.primarySite}" />														 
						</c:if>
						<c:if test="${emdt.currentCareSpell == null}">
							<a href="editCarespells.form" title="Select or create a care spell">Select...</a>
						</c:if>
					</td>
					<td class="patientDemographicsBoxValue">
						<c:if test="${emdt.currentCareSpell != null}">
							<c:out value="${emdt.currentCareSpell.status}"/>	 
						</c:if>
					</td>
				</tr>
			</table>
		</td>
		<td width="200" align="center"> <c:choose>
			<c:when test="${nextPatientId!=null}">
			
				<a href="viewPatient.form?patientId=<c:out value="${nextPatientId}"/>" class="buttonClass" title="Go to next patient"> Next&nbsp;patient&nbsp;<img src="../images/forward.png"/>&nbsp;&nbsp;&nbsp; </a>
			
			</c:when>
			<c:otherwise>
			
				<div class="buttonClass" title="At last patient"> Next patient <img src="../images/disabled_forward.png"/>&nbsp;&nbsp;&nbsp;</div>
			
			</c:otherwise>
		</c:choose></td></tr>
	</table>
</c:if>
