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

<!DOCTYPE html>

<html>
<head>
<title>Patient Meeting Report</title>
<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>

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

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

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:	#555;
	font-size:	10pt;
	margin-left:	20px;
}
.tools, .summaryPageHeader, .summarySectionHeader	{
	display: none;
}

.summaryTileContainer table	{
	width:	100%;
	border:	none;
}
.summaryFormisEmptyMessage	{
	color:	#888888;
}
pre {
font-family: Arial, sans-serif;
white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 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;
}
table.meetingHeader th	{
	text-align: right;
	padding: 10px;
	background-color: white;
}
table.meetingHeader td	{
	text-align: left;
	padding: 10px;
}
table.meetingHeader	{
	border:	1px solid lightgrey;
}
</style>

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

<style media="screen">
.meetingBodyContainer	{
	display: block;
}
.meetingToggler	{
	width:	100%;
	text-align: right;
	cursor:		pointer;
}
.meetingTitleTable	{
	width:	100%;
	border:	none;
}
#controls	{
	width:	100%;
	text-align: right;
	margin-bottom: 20px;
}

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

<%-- styles we want to be visible in the PDF or printed version --%>
<style media="print">
.showAllToggler	{
	display: none;
}
.meetingBodyContainer	{
	display: block;
}
.meetingToggler	{
	width:	100%;
	text-align: right;
	display: none;
}
.meetingTitleTable	{
	width:	100%;
	border:	none;
}
#closer	{
	display: none;
}
.noprint	{
	display: none;
}
div.pageBreak	{
	page-break-after:always;
}
</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, last-except) }}
@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);  
}
</style>

<script>

$(document).ready(function(){
	
  $(".meetingToggler").click(function(){
    $(this).parent().parent().parent().parent().parent().parent().children(".meetingBodyContainer").slideToggle(400);
  });
  
});
</script>

</head>
<body>
	<c:set var="patient" value="${emdt.currentMeeting.currentItem.patientDiscussed}"></c:set>

	<div class="header">MDT Meeting  <fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy" /> :  Patient '<c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.fullName}"/>', hospital number <c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.hospitalNumber}"/>, Date of birth <fmt:formatDate value="${patient.dateOfBirth}" pattern="dd MMM yyyy" /></div>
	<div class="footer">Page <span id="pagenumber" ></span> of <span id="pagecount"></span></div>
	
	
	<div id="controls">
		<div id="pdfdiv" class="noprint">
			<a href="#"  onclick="window.location.href = '../emdt/convertJspToPdf.form?jspUrl=meetings/printPatientMeetingReport.jsp&amp;isLandscapePrint=N';"><img src="../emdt/images/16x16/pdf.gif" alt="pdf"/> Download report as PDF </a>
			<%--
			this report uses CSS-generated headers and footers, but can add them via java too like this:
			<c:set var="headerString" value="Patient Name : ${emdt.currentMeeting.currentItem.patientDiscussed.fullName}, Hospital Number :  ${emdt.currentMeeting.currentItem.patientDiscussed.hospitalNumber } "></c:set>
			<a href="#"  onclick="window.location.href = '../emdt/convertJspToPdf.form?jspUrl=meetings/patientMeetingHistoryReport.form&amp;isLandscapePrint=N&amp;headerString=${headerString}&amp;addPageNumbers=true';"><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>Meeting Report for Patient '<c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.fullName}"/>' </h2>
	<table class="meetingHeader">
		<tr>
			<th>Hospital Number</th>
			<td><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.hospitalNumber}"/></td>
			<td style="width: 40px;"></td>
			<th>Meeting Title</th>
			<td><c:out value="${emdt.currentMeeting.title}"/></td>
		</tr>
		<tr>
			<th>Date of Birth</th>
			<td><fmt:formatDate value="${patient.dateOfBirth}" pattern="dd MMM yyyy" /></td>
			<td style="width: 40px;"></td>
			<th>Meeting Speciality</th>
			<td><webapp:listValue domain="EMDT" listName="tumourGroup" key="${emdt.currentMeeting.tumourGroup}"/></td>
		</tr>
		<tr>
			<th>Age</th>
			<td><c:out value="${emdt.currentMeeting.currentItem.patientDiscussed.currentAge}"/></td>
			<td style="width: 40px;"></td>
			<th>Meeting Date</th>
			<td><fmt:formatDate value="${emdt.currentMeeting.date}" pattern="dd MMMM yyyy, HH:mm" /> to <fmt:formatDate value="${emdt.currentMeeting.endDate}" pattern="HH:mm" /></td>
		</tr>
		<tr>
			<th>Location</th>
			<td colspan="4"><c:out value="${emdt.currentMeeting.hospital.hospitalName }"/>&nbsp;&nbsp;<c:out value="${emdt.currentMeeting.location }"/></td>
		</tr>
	</table>

<%--
	<bean:define id="item" value="<c:out value="${emdt.currentMeeting.currentItem}"/>" />
 --%>

	<h3>Attendees</h3>
				
	<div class="meetingBodyContainer">
		<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>
					
	<hr size="1"/>
	
	<div class="meetingSummaryContainer">
		<c:if test="${emdt.currentMeeting.summaryId != null }">
			<h3>Meeting Summary</h3>
			<table width="100%" summary="">
				<tr>
					<td colspan="3">
					<div class="summaryTileContainer">
						<emdt:runSummary summaryId="${emdt.currentMeeting.summaryGuid}" patientId="${emdt.currentMeeting.currentItem.patientDiscussed.guid}" /> 
						<tiles:insertTemplate template="/emdt/tiles/patientSummaryTile.jsp?readonly=1" flush="false" />
					</div>
					</td>
				</tr>
			</table>
		</c:if>
	</div>
			
		<%-- 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 emdt.currentMeeting.currentItem.blogComments}" >
					(No virtual meeting discussion was found for this patient)
				</c:when>
				<c:otherwise>
				<c:forEach items="${emdt.currentMeeting.currentItem.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>
		
		
	<div class="meetingNotesContainer">
		<c:if test="${emdt.currentMeeting.formPath != null and fn:length(emdt.currentMeeting.formPath)>0 }">
			<h3>Meeting Notes</h3>
			<table width="100%" summary="">
				<tr>
					<td colspan="3">
						<emdt:getNote meetingId="${emdt.currentMeeting.guid}" itemId="${emdt.currentMeeting.currentItem.guid}" /> 
						<tiles:insertTemplate  template="/meetings/printForm.jsp"/>
					</td>
				</tr>
			</table>
		</c:if>
	</div>
</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; <c:out value="${emdt.currentMeeting.currentItem.meetingResponse.dateOfInformation}"/></div>
				<div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Title : </b>&nbsp; &nbsp; <c:out value="${emdt.currentMeeting.currentItem.meetingResponse.title}"/> </div>
				<div style="clear:both"  class="meetingActionAndReponseLabel padding5pix"><b>Response to Primary Clinician Submitting patient:</b> &nbsp; &nbsp; <c:out value="${emdt.currentMeeting.currentItem.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:0px;"></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="${emdt.currentMeeting.currentItem.discussed ne null and emdt.currentMeeting.currentItem.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="${emdt.currentMeeting.currentItem.meetingItemAction}"/></div>
							<div style="clear:both" class="padding5pix">
								<c:choose>
									<c:when test="${emdt.currentMeeting.currentItem.meetingItemActionCompleted ne null and emdt.currentMeeting.currentItem.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:0px;"></div>
						</div>
					</div>
				</div>
				<div style="clear:both; height:0px;"></div>
			</div>
		</div>
	</div>
</c:if>
<hr size="1"/>
		
</body></html>
