<%@ include file="/includes.jsp"%>

<html>
<head>

<title>UHCW Meeting Summary</title>
<link rel="stylesheet" href="../webapp.css" type="text/css" />
<link rel="icon" href="../images/emdt.ico" type="image/x-icon" />
<link rel="shortcut icon" href="../images/emdt.ico" type="image/x-icon" />
<style>
body {
	margin: 10 10 10 10;
}

table {
	border: 1px solid #ccc;
}

td {
	padding: 4 4 4 4;
	vertical-align: top;
}

th {
	padding: 4 4 4 4;
	background: #eee;
	vertical-align: top;
}

.dialogBox {
	background: white;
	border:	0px;
}

.dialogTitle {
	background: white;
}

.dialogContent {
	background: white;
	border:	0px;
}

.dialogFooter {
	background: white;
}

.summaryFormContainer {
	background: white;
}
pre	{
	font-family:	Arial,Verdana,Helvetica;
	font-size:	10pt;
}
hr	{
	color:	#ddd;
	size:	1px;
}
</style>
</head>

<body>

<table border="1">
	<tr>
		<th align="right">Meeting:&nbsp;</th>
		<td><c:out value="${emdt.currentMeeting.title}"/></td>
		<th align="right">Speciality:&nbsp;</th>
		<td><webapp:listValue domain="emdt" listName="PrimarySite" key="${emdt.currentMeeting.tumourGroup}" /></td>
		<th align="right">Date:&nbsp;</th>
		<td><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy" /></td>
		<th align="right">Time:&nbsp;</th>
		<td><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="HH:mm" /> - <fmt:formatDate value="${emdt.currentMeeting.endDate}" pattern="HH:mm" /></td>
		<th align="right">Location:&nbsp;</th>
		<td><webapp:listValue domain="webapp" listName="location" key="${emdt.currentMeeting.location }" /></td>
	</tr>
</table>

<br/>

<table border="1">
	<tr align="left">
		<th>Consultant</th>
		<th>Name/PID</th>
		<th>Referral Details</th>
		<th>Site</th>
		<th>Investigation<br/>Histology / Imaging</th>
		<th>Treatment Plan / Notes</th>
	</tr>
	<c:forEach var="item" items="${emdt.currentMeeting.items }" varStatus="s">
	
		<hibernate:executeQuery hql="select distinct cn from ConsultationNote cn, CareSpell cs, Patient p join cn.values as fv join fv.values as v where cn.careSpellId = cs.id and p = cs.patient and cn.formName = '/EMDT/Coventry/REFERRALDETAILS' and cn.deleted=false and p.gid= <c:out value="${item.patientDiscussed.guid}"/>" var="results" varError="hqlError" />
		<tr>
			<td><c:out value="${item.patientDiscussed.primaryClinicianInCSMatchesMeetingTG}"/>&nbsp;</td>
			<td>Name:<br/><c:out value="${item.patientDiscussed.forename }"/>&nbsp;<b><c:out value="${item.patientDiscussed.surname }"/></b> <br/><br/>
				Hosp num:&nbsp;<c:out value="${item.patientDiscussed.hospitalNumber }"/><br/><br/>
				Age:&nbsp;<c:out value="${item.patientDiscussed.currentAge }"/></td>
			<td><c:out value="${results[0].values['Referralreceived'].value}"/><br/><br/>
				<c:out value="${results[0].values['REFERRINGCONSULTANTCLINICIAN'].value}"/></td>
			<td><webapp:listValue listName="PHAnatomicalPath" key="${results[0].values['AnatomicalPath'].value}" domain="EMDT" cacheable="true"/></td>
			<td align="right">
				<c:if test="${results[0].values['US'].value == 'yes'}">
					US:&nbsp;<c:out value="${results[0].values['USDATE'].value}"/> <br/>
				</c:if>
				<c:if test="${results[0].values['EUS'].value == 'yes'}">
					EUS:&nbsp;<c:out value="${results[0].values['EUSDATE'].value}"/> <br/>
				</c:if>
				<c:if test="${results[0].values['CT'].value == 'yes'}">
					CT:&nbsp;<c:out value="${results[0].values['CTDATE'].value}"/> <br/>
				</c:if>
				<c:if test="${results[0].values['PET'].value == 'yes'}">
					PET:&nbsp;<c:out value="${results[0].values['PETDATE'].value}"/> <br/>
				</c:if>
				<c:if test="${results[0].values['MRI'].value == 'yes'}">
					MRI:&nbsp;<c:out value="${results[0].values['MRIDATE'].value}"/> <br/>
				</c:if>

			</td>
			<td><pre><c:out value="${results[0].values['PRESENTINGHISTORY'].value}"/></pre></td>
		</tr>
	</c:forEach>
</table>

<br>

</body>
</html>