<%@ include file="/includes.jsp" %>
<!DOCTYPE html>  
<html lang="en"> 
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="../css/webapp.css" type="text/css" />
<link rel="stylesheet" href="../meetings/css/summary.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" />
<script src="../js/jquery/jquery-3.7.1.min.js"></script>
<script src="../js/jquery/jquery-ui.js"></script>
<title>Print Meeting</title>


<%-- Styles common to screen and print --%>
<style media="all">

body {
	margin: 10px;
	font-family:	Helvetica;
}

table {
	border: none;
}

td {
	padding: 4px;
}

th {
	padding: 4px;
	background: #eee;
}

hr	{
	color:	#ddd;
	size:	1px;
}

h4	{
	color:	#333;
}
h5	{
	font-size: 10pt;
	color:	#777;
}
.meetingTitle h2	{
	color:	#555;
	font-size:	12pt;
}
.meetingTitle h3	{
	color:	#777;
	font-size:	10pt;
}
.tools, .summaryPageHeader, .summarySectionHeader	{
	display: none;
}

.summaryTileContainer table	{
	width:	100%;
	border:	none;
}
td.summaryFieldTitle	{
	width:	30%;
}
td.summaryFieldValue	{
	width:	70%;
}
span.summaryFormTitle	{
	cursor: default;
}
.summaryFormisEmptyMessage	{
	color:	#888888;
}
pre {
font-family: Arial;  
white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
 width: 99%;   /* remove horizontal scroll-bar when viewing in IE7 */
}
.fixedtable {
	width: 100%;
	table-layout: fixed;
}
.summaryPagesContainer	{
	display:	block;
}
.meetingTitle	{
	font-size: 12pt;
}

.meetingNotesContainer	{
	margin-bottom: 50px;
}
.meetingSummaryContainer	{
	margin-bottom: 50px;
}
.showAllToggler		{
	display:	none;
}
.table tr	{
	border: none;
}
.table	{
	border: none;
}


</style>


<%-- styles we want to be displayed on screen --%>

<style media="screen">
#controls	{
	width:	100%;
	text-align: right;
	margin-bottom: 20px;
}

#closer	{
	display: inline-block;
}
#pdfdiv	{
	display: inline-block;
	margin-right:	20px;
	cursor: pointer;
}
</style>

<%-- styles we want to be visible in the PDF or printed version --%>
<style media="print">
#closer	{
	display: none;
}
.noprint	{
	display: none;
}

</style>

<!-- style changes to hide navigation links we don't want to show  -->
<style>

div.showAllToggler	{
	display:	none;
}
.summaryFormContainer:hover .tools {
    display: none;
}

div.summaryPagesContainer	{
	display:	block;
}
a.formDisplayToggler	{
	display:	none;
}
.summaryRow:hover {
	border-bottom: white solid 1px;
	border-top: white solid 1px;
	background: #ffffff;
}

body	{
	margin:	4px;
}

</style>



<!--  CSS voodoo to make the header and footer appear when printed or as PDF  -->

<style media="screen">
div.header {
	display: none;
}
div.footer {
	display: none;
}
</style>

<style media="print">

body	{
	font-family: sans-serif;
}

@page { 
	-fs-flow-top: "header";
	-fs-flow-bottom: "footer";
	-fs-flow-left: "left";
	-fs-flow-right: "right";
}
@page { 
	@top-center {
		content: element(header) 
	}
}
@page { 
	@bottom-center { 
		content: element(footer) 
	}
}

div.header {
	font-size: 90%; font-style: italic;
	-fs-move-to-flow: "header";
	position: running(header);
}

.footer {
	font-size: 90%; font-style: italic; 
	-fs-move-to-flow: "footer";
	position: running(footer);
}


#pagenumber:before {
	content: counter(page); 
}

#pagecount:before {
	content: counter(pages);  
}
.startPatientDetails	{
	page-break-after:always;
}
div.pageBreak	{
	page-break-after:always;
}
</style>

</head>

<body>
<%-- define print-only content for repeating page footer and header for first page --%>
<div class="footer">Page <span id="pagenumber"></span> of <span id="pagecount"></span><!-- footer --></div>
<div class="header"><!-- blank header on first page --></div>

<div id="controls">
	<div id="pdfdiv" class="noprint">
		<a onclick="window.location.href = '../emdt/convertJspToPdf.form?jspUrl=meetings/printPatientsInCurrentMeeting.jsp&amp;isLandscapePrint=N';"><img src="../emdt/images/16x16/pdf.gif" alt="pdf"/> Download report as PDF </a>
	</div>

	<div id="closer">
		<a href="#" onclick="window.close()"><img src="../images/16x16/exit.png" alt="exit"/> Close window </a>
	</div>
</div>

<h2><c:out value="${emdt.currentMeeting.title}"/></h2>

<hr size="1"/>
<br />

<!-- Meeting overview -->
<table>
	<tr>
		<th align="right">Speciality&nbsp;</th>
		<td><webapp:listValue domain="emdt" listName="PrimarySite" key="${emdt.currentMeeting.tumourGroup }" /></td>
	</tr>

	<tr>
		<th align="right">Date&nbsp;</th>
		<td><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy" /></td>
	</tr>
	<tr>
		<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>
	</tr>
	<tr>
		<th align="right">Location&nbsp;</th>
		<td><c:out value="${emdt.currentMeeting.hospital.hospitalName}"/>&nbsp;&nbsp;<c:out value="${emdt.currentMeeting.location}"/></td>	</tr>
	<tr>
		<th align="right">Notes&nbsp;</th>
		<td><c:out value="${emdt.currentMeeting.notes }"/></td>
	</tr>
</table>

<br />

<h3>List of Patients in Meeting</h3>

<table border="1" cellpadding="4">
	<tr align="left">
		<th>Surname</th>
		<th>Forename</th>
		<th>Age</th>
		<th>NHS Number</th>
		<th>Hospital Number</th>
		<th>Last MDT</th>
		<th>Meeting Type</th>
		<th>Follow Up</th>
		<th>Primary Clinician</th>
	</tr>
	<c:forEach var="item" items="${emdt.currentMeeting.items }" varStatus="s">
		<tr>
			<td><c:out value="${item.patientDiscussed.surname}"/></td>
			<td style=""><c:out value="${item.patientDiscussed.forename}"/>&nbsp;</td>
			<td align="right"><c:out value="${item.patientDiscussed.currentAge}"/>&nbsp;</td>
			<td><c:out value="${item.patientDiscussed.nhsNumber}"/>&nbsp;</td>
			<td><c:out value="${item.patientDiscussed.hospitalNumber}"/>&nbsp;</td>
			<td align="right"><fmt:formatDate value="${item.lastDiscussedDate}" pattern="dd MMMM yyyy" /></td>
			<td><webapp:listValue domain="EMDT" listName="MeetingItemType" key="${item.type}" />&nbsp;</td>
			<td align="right"><fmt:formatDate value="${item.followUpDate}" pattern="dd MMMM yyyy" /></td>
			<td><c:out value="${item.patientDiscussed.primaryClinicianInCSMatchesMeetingTG}"/>&nbsp;</td>
		</tr>
	</c:forEach>
</table>

<h3>Attendees</h3>

<div style="margin-left: 15px; margin-bottom: 50px;">
<table>
	<tr>
		<td><b>Attendee name</b></td><td><b>Attended?</b></td>
	</tr>
	<c:forEach var="att" items="${emdt.currentMeeting.attendees }" varStatus="attendeeIndex">
		<tr>
			<td><c:out value="${att.user.forename}"/> <c:out value="${att.user.surname}"/></td><td align="center"><c:if test="${att.attendedMeeting }">Yes</c:if><c:if test="${!att.attendedMeeting }">No</c:if></td>
		</tr>
	</c:forEach>
</table>

</div>

<br/>

<c:if test="${emdt.currentMeeting.summaryId != null }">
	<c:forEach var="item" items="${emdt.currentMeeting.items }" varStatus="s">
		<c:set var="patient" value="${item.patientDiscussed}"/>
		<div class="pageBreak"><!-- page break after this --></div>
		<div class="header">MDT Meeting <fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy" /> :  Patient '<c:out value="${item.patientDiscussed.fullName}"/>', hospital number <c:out value="${item.patientDiscussed.hospitalNumber}"/>, Date of birth <fmt:formatDate value="${item.patientDiscussed.dateOfBirth}" pattern="dd MMMM yyyy" /></div>
		<h3>&nbsp;Patient Details:</h3>
		<table border="1" width="100%" cellpadding="4">
		<tr align="left">
			<th>Surname</th>
			<th>Forename</th>
			<th>Hospital Number</th>
			<th>Date of Birth</th>
		</tr>
		<tr>
			<td><c:out value="${item.patientDiscussed.surname}"/></td>
			<td><c:out value="${item.patientDiscussed.forename}"/>&nbsp;</td>
			<td><c:out value="${item.patientDiscussed.hospitalNumber}"/>&nbsp;</td>
			<td><fmt:formatDate value="${item.patientDiscussed.dateOfBirth}" pattern="dd MMMM yyyy" />&nbsp;</td>
		</tr>
		</table>
		
		<h3>Attendees</h3>

		<div style="margin-left: 15px; margin-bottom: 50px;">
			<c:forEach var="att" items="${emdt.currentMeeting.attendees }" varStatus="attendeeIndex">
			<c:out value="${att.user.forename}"/> <c:out value="${att.user.surname}"/><c:if test="${!attendeeIndex.last }">, </c:if>
			</c:forEach>
		</div>
		
		
		<div class="header">MDT Meeting <fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy" /> :  Patient '<c:out value="${item.patientDiscussed.fullName}"/>', hospital number <c:out value="${item.patientDiscussed.hospitalNumber}"/>, Date of birth <fmt:formatDate value="${item.patientDiscussed.dateOfBirth}" pattern="dd MMMM yyyy" /></div>
		
		<c:if test="${emdt.currentMeeting.summaryId != null}">

			<%-- Show meeting summaries --%>
			<div class="meetingSummaryContainer">
				<c:if test="${emdt.currentMeeting.summaryId != null }">
					<h3>Meeting Summary</h3>
					<table width="100%">
					<tbody>
						<tr id="summary${item.id }">
							<td>
							<div class="summaryTileContainer">
								<emdt:runSummary summaryId="${emdt.currentMeeting.summaryGuid}" patientId="${item.patientDiscussed.guid}" />
								<tiles:insertTemplate template="/emdt/tiles/patientSummaryTile.jsp?readonly=1" flush="false" />
							</div>
							</td>
						</tr>
					</tbody>
					</table>
				</c:if>
			</div>

		</c:if>
				
		<%-- Virtual Meeting Discussion Blog --%>
		<div class="pageBreak"><!-- start meeting blog on new page --></div>
		<div class="meetingBlogContainer">
			<h3>Virtual Meeting Discussion</h3>
			<c:choose>
				<c:when test="${empty item.blogComments}" >
					(No virtual meeting discussion was found for this patient)
				</c:when>
				<c:otherwise>
				<c:forEach items="${item.blogComments}" var="blog">
					<div class="blogRow">
						<div class="blogUser"><c:out value="${blog.userMakingComment.fullName}"/>
						<br/><div class="blogHospital"><c:out value="${blog.userMakingComment.hospital.hospitalName}"/></div>
						<div class="blogDate"><fmt:formatDate value="${blog.dateOfComment}" pattern="dd MMM yyyy,  HH:mm"/> </div> 
						</div>
						<pre class="blogComment"><c:out value="${blog.comment}"/></pre>
					</div>
				</c:forEach>
				</c:otherwise>
			</c:choose>
		</div>
		
		
		<%-- Show the meeting notes form --%>
		<div class="meetingNotesContainer">
			<c:if test="${emdt.currentMeeting.formPath != null and fn:length(emdt.currentMeeting.formPath)>0 }">
				<h3>Meeting Notes</h3>
				<table width="100%">
					<tr id="note${item.id }">
						<td>
							<emdt:getNote meetingId="${emdt.currentMeeting.guid}" itemId="${item.guid}" />
							<tiles:insertTemplate  template="/meetings/printForm.jsp"/>
						</td>
					</tr>
				</table>
			</c:if>		
		</div>
		<c:if test="${emdt.currentMeeting.hospital.virtualHospital}">
			<div class="meetingSection" style="clear:both;">
			<div style="clear:both;">
				   <div style="clear:both;height:0px;"></div>
			</div>
			<div style="clear:both;">
				 <h2>Actions and Response</h2>
			</div>
			<div style="clear:both;padding:5px;">
				<div style="clear:both;border-bottom: 1px solid #eee;">
					<div style="clear:both;"> <div style="clear:both;height:0px;"></div></div>
					<div style="clear:both;">
						<div style="clear:both;"> <h2>Response</h2></div>
					    <div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Date of Information :</b> &nbsp; &nbsp; ${item.meetingResponse.dateOfInformation}</div>
					    <div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Title : </b>&nbsp; &nbsp; <c:out value="${item.meetingResponse.title}"/> </div>
					    <div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Response to Primary Clinician Submitting patient:</b> &nbsp; &nbsp; <c:out value="${item.meetingResponse.responsetoPrimaryClinician}"/></div>
					     <div style="clear:both;height:0px;"></div>
					</div>
				</div>
				<div style="clear:both;">
					<div style="clear:both;padding:5px;">
						<div style="clear:both;">
							<div style="clear:both;"> <div style="clear:both;height:0;"></div></div>
								<div style="clear:both;">
									<div style="clear:both;"><h2>Actions </h2></div>
								    <div style="clear:both" class="padding5pix">
											<div style="display: inline;">
												<c:choose>
													<c:when test="${item.discussed ne null and item.discussed eq true}">Patient has been discussed in this meeting.</c:when>
													<c:otherwise>Patient has not been discussed in this meeting.</c:otherwise>
												</c:choose>
											</div>
										</div>
					  			    <div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Actions from Meeting:</b> &nbsp; &nbsp;<c:out value="${item.meetingItemAction}"/></div>
								    <div style="clear:both" class="padding5pix">
								      	<c:choose>
											<c:when test="${item.meetingItemActionCompleted ne null and item.meetingItemActionCompleted eq true }">These actions have  been completed.</c:when>
											<c:otherwise>These actions have not been completed.</c:otherwise>
										</c:choose>
								    </div>
									<div style="clear:both;height:0;"></div>
								</div>
							</div>
						</div>
						<div style="clear:both;height:0;"></div>
					</div>
				</div>
			</div>	
		</c:if>
	</c:forEach>
</c:if>
<br/>
<br/>
<emdt:getNote meetingId="${emdt.currentMeeting.guid}" itemId="${emdt.currentMeeting.currentItem.guid}" /> 
</body>
</html>