<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<style>
	<%@ include file="styles.css"%>
</style>

<tiles:importAttribute />
<c:set var="readOnly" value="false"/>
<c:if test="${consultationNoteForm.view.note.locked eq true}">
	<c:set var="readOnly" value="true"/>
</c:if>
<webapp:namedListByFormDefinition formDefinition="${consultationNoteForm.view.form}" id="namedListMap" filterName="${requestScope.ATT_FilterdCode}" filterHospCode="${emdt.currentUser.hospital.hospitalCode}"/>
<c:set var="namedListMap" value="${namedListMap}" scope="request"/>

<input type="hidden" value="false" id="unsaveButtonId">

<div class="container">
	<div class="sectionSubPageTop">
		<h2>Assessment Milestones</h2>
		<div class="fieldSet2Column" style="text-align: left;">
			<span class="inputLabel">Patient's baseline toxicity and performance status are recorded accurately.<br/>
			The patient toxicity assessment needs to be completed prior to each chemotherapy cycle.</span>
		</div>
		<div class="fieldSet2Column" style="text-align: left;">
			<p>This toxicity assessment form incorporates World Health Organisation Toxicity Assessment Criteria and the National Cancer Institute Common Terminology Criteria for Adverse Events Version 4.0 Published: May 28, 2009 (v4.03: June 14, 2010).</p>
			<p>For further details of the grading system please refer to the guidance notes through
				following the link below.</p>
		</div>
		<div class="fieldSet2Column">
			<span class="inputLabel"><a href="../emdt/tiles/forms/ChemoG1/ChemoF4/Guidance%20notes%20for%20patient%20toxicity%20assessment.pdf" target="_blank">Instructions for Toxicity Assessment
					<img src="../emdt/images/16x16/pdf.gif" title="Click to open instructions" alt="PDF" />
			</a></span>
		</div>
		<div class="fieldSet2Column">
			<hr />
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Patient Treatment Stage:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl">
				<c:set var="tempOptionsMapDomain" value="EMDT"/>
				<c:set var="tempOptionsMapName" value="Chemo_Patient_Treatment_Stage"/>
				<webapp:namedList id="nl" domain="${tempOptionsMapDomain }" name="${tempOptionsMapName}" nlFromFormDefinition="${namedListMap[tempOptionsMapDomain][tempOptionsMapName]}"/>
				<c:forEach var="pair" items="${nl.pairIterator}" varStatus="radioCount">
					<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1PatStage]" value="${pair.first}" id="CF4P1PatStage${radioCount.count}"/> <c:out value="${pair.second}"/>&nbsp;
				</c:forEach>
			</span>
		</div>

		<div class="fieldSet2Column"></div>

		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Cycle nbr:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> 
				<webapp:namedListSpring path='value[CF4P1PatCycle]'  id="CF4P1PatCycle" disabled="${readOnly}" domain="EMDT" name="Chemo_Cycle_Nbr"
					currentValue="${consultationNoteForm.value['CF4P1PatCycle']}" nlFromFormDefinition="${namedListMap['EMDT']['Chemo_Cycle_Nbr']}"/>
			</span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Day nbr:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> 
				<webapp:namedListSpring path='value[CF4P1PatDay]'  id="CF4P1PatDay" disabled="${readOnly}" domain="EMDT" name="Chemo_Day_Nbr"
					currentValue="${consultationNoteForm.value['CF4P1PatDay']}" nlFromFormDefinition="${namedListMap['EMDT']['Chemo_Day_Nbr']}"/>

			</span>
		</div>
	</div>



	<div class="sectionSubPageTop">
		<h2>Toxicity Assessment</h2>
		<c:set var="tempOptionsMapDomain" value="EMDT"/>
		<c:set var="tempOptionsMapName" value="Chemo_ECOG_Status"/>
		<webapp:namedList id="nl_Chemo_ECOG_Status" domain="${tempOptionsMapDomain }" name="${tempOptionsMapName}" nlFromFormDefinition="${namedListMap[tempOptionsMapDomain][tempOptionsMapName]}"/>
		<c:set var="tempOptionsMapName" value="YesNo"/>
		<webapp:namedList id="nl_YesNo"  domain="${tempOptionsMapDomain }" name="${tempOptionsMapName}" nlFromFormDefinition="${namedListMap[tempOptionsMapDomain][tempOptionsMapName]}"/>
		<table id="toxicity_table">
			<tr>
				<th>Toxicity</th>
				<th>Grade</th>
				<th>Comment</th>
			</tr>
		</table>

		<div class="tox_left_col">
			
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<div class="gh">0</div><div class="gh">1</div><div class="gh">2</div><div class="gh">3</div><div class="gh">4</div>
			</div>
		</div>
		<div class="tox_right_col">
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Performance status:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1PerfStat]" value="${pair.first}" id="CF4P1PerfStat${radioCount.count}" title="Grade ${pair.second} " /> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtPerf]" size="75" id="CF4P1CmtPerf" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Nausea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Nausea]" value="${pair.first}" id="CF4P1Nausea${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtNaus]" size="75" id="CF4P1CmtNaus" readonly="${readOnly}" />
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Vomiting:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Vomit]" value="${pair.first}" id="CF4P1Vomit${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtVom]" size="75" id="CF4P1CmtVom" readonly="${readOnly}" />
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Mucositis / stomatitis:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Muco]" value="${pair.first}" id="CF4P1Muco${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtMuco]" size="75" id="CF4P1CmtMuco" readonly="${readOnly}" />
		</div>

		<div class="tox_left_col">
			<span class="tox_label">Diarrhoea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Diar]" value="${pair.first}" id="CF4P1Diar${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtDiar]" size="75" id="CF4P1CmtDiar" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Constipation:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Const]" value="${pair.first}" id="CF4P1Const${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtCons]" size="75" id="CF4P1CmtCons" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Fever/Pyrexia/Infection:</span>
		</div>
		<div class="tox_mid_col">
			<div class="grrrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Fever]" value="${pair.first}" id="CF4P1Fever${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtFever]" size="75" id="CF4P1CmtFever" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">PPE:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1PPE]" value="${pair.first}" id="CF4P1PPE${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtPPE]" size="75" id="CF4P1CmtPPE" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Fatigue:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Fatig]" value="${pair.first}" id="CF4P1Fatig${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtFatig]" size="75" id="CF4P1CmtFatig" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Pain:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Pain]" value="${pair.first}" id="CF4P1Pain${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtPain]" size="75" id="CF4P1CmtPain" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Anorexia:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Anor]" value="${pair.first}" id="CF4P1Anor${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtAnor]" size="75" id="CF4P1CmtAnor" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Dyspnoea:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Dyps]" value="${pair.first}" id="CF4P1Dyps${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtDysp]" size="75" id="CF4P1CmtDysp" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Alopecia:</span>
		</div>
		<div class="tox_mid_col">
			<div class="ggyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Alop]" value="${pair.first}" id="CF4P1Alop${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtAlop]" size="75" id="CF4P1CmtAlop" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Rash:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyyrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Rash]" value="${pair.first}" id="CF4P1Rash${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtRash]" size="75" id="CF4P1CmtRash" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Chest pain:</span>
		</div>
		<div class="tox_mid_col">
			<div class="grrrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Chest]" value="${pair.first}" id="CF4P1Chest${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtChest]" size="75" id="CF4P1CmtChest" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Neuropathy:</span>
		</div>
		<div class="tox_mid_col">
			<div class="gyrrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Neuro]" value="${pair.first}" id="CF4P1Neuro${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtNeur]" size="75" id="CF4P1CmtNeur" readonly="${readOnly}" />
		</div>



		<div class="tox_left_col">
			<span class="tox_label">Bleeding or bruising:</span>
		</div>
		<div class="tox_mid_col">
			<div class="grrrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1Bleed]" value="${pair.first}" id="CF4P1Bleed${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtBleed]" size="75" id="CF4P1CmtBleed" readonly="${readOnly}" />
		</div>


		<div class="tox_left_col">
			<span class="tox_label">Other:</span>
		</div>
		<div class="tox_mid_col">
			<div class="grrrr">
				<c:forEach var="pair" items="${nl_Chemo_ECOG_Status.pairIterator}" varStatus="radioCount">
					<div class="grade g<c:out value="${pair.second}"/>" title="Grade ${pair.second} ">
						<smvc:radiobutton disabled="${readOnly}" path="multiValue[CFP1Other]" value="${pair.first}" id="CFP1Other${radioCount.count}" title="Grade ${pair.second} "/> <c:out value="${pair.second}"/>
					</div>
				</c:forEach>
			</div>
		</div>
		<div class="tox_right_col">
			<smvc:input disabled="false" path="value[CF4P1CmtOther]" size="75" id="CF4P1CmtOther" readonly="${readOnly}" />
		</div>

	<div class="fieldSet2Column">
		Assessment Grading: <div id="assessmentGrading"></div>	<smvc:hidden disabled="false" path="value[CF4P1AssessmentGrading]" id="CF4P1AssessmentGrading" />
	</div>

	</div>



	<div class="sectionSubPageTop">
		<h2>Other Information</h2>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Temparature (deg. C):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Temp]" size="0" id="CF4P1Temp" readonly="${readOnly}" /><smvc:hidden disabled="false" path="value[CF4P1TempWarning]" id="CF4P1TempWarning" /></span><div id="tempWarning"></div>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Pulse (bpm):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Pulse]" size="0" id="CF4P1Pulse" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Blood Pressure (mmHg):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1BP]" size="7" id="CF4P1BP" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Oxygen Saturation (%):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1SPO2]" size="0" id="CF4P1SPO2" readonly="${readOnly}" /></span><smvc:hidden disabled="false" path="value[CF4P1SPO2Warning]" id="CF4P1SPO2Warning" /><div id="spo2Warning"></div>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Respirations (per min):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1RR]" size="0" id="CF4P1RR" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Weight (Kg):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Weight]" size="0" id="CF4P1Weight" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Other investigations:</span>
			</div>
			<div class="fieldSetRightColumn">
				<span class="inputControl"> <smvc:textarea path="value[CF4P1OtherInv]" cols="50" rows="" id="CF4P1OtherInv" readonly="${readOnly}" /></span>
			</div>
		</div>

		<div class="fieldSet2Column">
			<hr />
		</div>


		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Has the patient been admitted to hospital or been seen by a GP since treatment was prescribed?</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <webapp:namedList id="nl_YesNo" domain="EMDT" name="YesNo" /> 
				<c:forEach var="pair" items="${nl_YesNo.pairIterator}" varStatus="radioCount">
					<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1PatAdm]" value="${pair.first}" id="CF4P1PatAdm${radioCount.count}"/> <c:out value="${pair.second}"/>&nbsp;
				</c:forEach></span>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Reason:</span>
			</div>
			<div class="fieldSetRightColumn">
				<span class="inputControl"> <smvc:textarea path="value[CF4P1PatAdmReas]" cols="50" rows="" id="CF4P1PatAdmReas" readonly="${readOnly}" /></span>
			</div>
		</div>
		<div class="fieldSet2Column">
		</div>

		<div class="fieldSet2Column">
			<hr />
		</div>

		<div class="fieldSet2Column">
			<span class="inputLabel"><u>Blood Count Results</u></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Date blood taken:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl">
			<spring:bind path='value[CF4P1BldDt]'>
				<c:choose>
					<c:when test="${disabled or readOnly}">
						<input type="text" name="value[CF4P1BldDt]" size="0" id="CF4P1BldDt" class="form-control" readonly="readonly" value="<c:out value="${consultationNoteForm.view.note.getValue('CF4P1BldDt').code}"/>" disabled="disabled" placeholder="dd/mm/yyyy"/>
					</c:when>
					<c:otherwise>
						<input type="text" name="value[CF4P1BldDt]" size="0" id="CF4P1BldDt" class="form-control" value="<c:out value="${consultationNoteForm.view.note.getValue('CF4P1BldDt').code}"/>" placeholder="dd/mm/yyyy"/>
					</c:otherwise>
				</c:choose>
			</spring:bind>
			&nbsp; <img title="Click to choose date" style="cursor: pointer;" src="../images/16x16/date.png" id="CF4P1BldDt_DateTrigger" />
			</span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Haemoglobin (gm/dL):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Hb]" size="0" id="CF4P1Hb" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">White Blood Cell count (per mcL):</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1WBC]" size="0" id="CF4P1WBC" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Neutrophil count:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Neut]" size="0" id="CF4P1Neut" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Platelet count:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1Plat]" size="0" id="CF4P1Plat" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Abnormal biochemistry:</span>
			</div>
			<div class="fieldSetRightColumn">
				<span class="inputControl"> <smvc:textarea path="value[CF4P1AbChem]" cols="50" rows="" id="CF4P1AbChem" readonly="${readOnly}" /></span>
			</div>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabel">Estimated Glomerular Filtration Rate:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <smvc:input disabled="false" path="value[CF4P1GFR]" size="0" id="CF4P1GFR" readonly="${readOnly}" /></span>
		</div>
		<div class="fieldSetLeftColumn">
			<span class="inputLabelAbove">Relevant tumour marker taken:</span>
		</div>
		<div class="fieldSetRightColumn">
			<span class="inputControl"> <c:forEach var="pair" items="${nl_YesNo.pairIterator}" varStatus="radioCount">
					<smvc:radiobutton disabled="${readOnly}" path="multiValue[CF4P1RelTumMk]" value="${pair.first}" id="CF4P1RelTumMk${radioCount.count}"/> <c:out value="${pair.second}"/>&nbsp;	
				</c:forEach></span>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Detail:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"> <smvc:textarea path="value[CF4P1RelTumDtl]" cols="50" rows="" id="CF4P1RelTumDtl" readonly="${readOnly}" /></span>
			</div>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Allergies:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"> <smvc:textarea path="value[CF4P1Allergy]" cols="50" rows="" id="CF4P1Allergy" readonly="${readOnly}" /></span>
			</div>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Last updated by:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"><c:out value="${consultationNoteForm.view.note.modifiedByUser.name}"/></span>
			</div>
		</div>
		<div class="fieldSet2Column">
			<div class="fieldSetLeftColumn">
				<span class="inputLabel">Last updated:</span>
			</div>
			<div class="fieldSetLeftColumn">
				<span class="inputControl"> <fmt:formatDate value="${consultationNoteForm.view.note.modifiedDate}" pattern="dd MMM yyyy HH:mm" /></span>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
//  	CF4P1AssessmentGrading
//		CF4P1TempWarning
//		CF4P1SPO2Warning

/*
Assessment Grading: Calculated as follows
Red [Must be seen and reviewed by senior medical staff prior to treatment] = Patients flagging up 2x Ambers (or more) equates to a RED. As does any red outcome.
Amber [Review by senior nurse / medical staff]= 1x Amber AND / OR Patient has been seen by GP / admitted to hospital (Yes)
Green [Proceed with treatment] = All green AND No to Patient has been seen by GP

Custom Warning Messages: 
Temp: IF >= 37.7 THEN Warning = "Patient is pyrexial and at risk with possible infection. Discuss with senior nurse or medical staff."
SPO2: IF =< 90 THEN Warning = "Possible hypoxia. Discuss with senior nurse or medical staff.

 */

 function checkAndSetTempWarning ()	{
	 var tempstr = $('#CF4P1Temp').val();
	 var temp = 0.0;
	 var warningTemp = 37.7;
	 var warningMessage = "Patient is pyrexial and at risk with possible infection. Discuss with senior nurse or medical staff.";
	 if (tempstr != '' &&  ( ! isNaN(tempstr)) )	{
		 temp = tempstr;
	 }
	 if (temp >= warningTemp)	{
		 $('#tempWarning').text(warningMessage);
	 }
	 else	{
		 $('#tempWarning').text('');
	 }
 }
 
 $('#CF4P1Temp').change (function ()	{
	 checkAndSetTempWarning();
 });

 function checkAndSetOxygenWarning ()	{
	 var oxystr = $('#CF4P1SPO2').val();
	 var oxy = 999; // sentinel value
	 var warningOxy = 90;
	 var warningMessage = "Possible hypoxia. Discuss with senior nurse or medical staff.";
	 if (oxystr != '' &&  ( ! isNaN(oxystr)) )	{
		 oxy = oxystr;
	 }
	 if (oxy <= warningOxy)	{
		 $('#spo2Warning').text(warningMessage);
	 }
	 else	{
		 $('#spo2Warning').text('');
	 }
 }
 
 $('#CF4P1SPO2').change (function ()	{
	 checkAndSetOxygenWarning();
 });
 

 // Names of radio buttons which are coloured in sequence 0=green, 1=green, 2=yellow, 3=red, 4=red etc
var ggyrr_field_names = ["CF4P1PerfStat", "CF4P1Nausea", "CF4P1Vomit", "CF4P1Const", "CF4P1Fatig", "CF4P1Pain", "CF4P1Anor", "CF4P1Dyps", "CF4P1Alop"];
var gyyrr_field_names = ["CF4P1Muco", "CF4P1Diar", "CF4P1PPE", "CF4P1Rash"];
var grrrr_field_names = ["CF4P1Fever", "CF4P1Chest", "CF4P1Bleed", "CFP1Other"];
var gyrrr_field_names = ["CF4P1Neuro"];

// Determine colour of a radio button from its name and numeric value
//   returns: colour name as string, e.g. 'red', 'green', 'amber', or 'unknown' as an error case.
//
function get_colour (name, value)	{
	
	// do the easy short cuts first, since all 0 is green and all 3 or 4 is red
	if (value == 0)
		return 'green';
	
	if (value == 3 || value == 4)
		return 'red';

	// all radios in this sequence are red apart from value 0
	for (i = 0; i < grrrr_field_names.length; i++)	{
		if (name.indexOf(grrrr_field_names[i]) != -1)	{
			return 'red';
		}
	}

	// we just have values 1 and 2 to distinguish now
	if (name.indexOf('CF4P1Neuro') != -1)	{
		if (value == 2)		{
			return 'red';
		}
		return 'amber';
	}
		
	if (value == 2)		{
		return 'amber';
	}
	
	// only 1 to distinguish now

	for (i = 0; i < ggyrr_field_names.length; i++)	{
		if (name.indexOf(ggyrr_field_names[i]) != -1)	
			return 'green';
	}
	for (i = 0; i < gyyrr_field_names.length; i++)	{
		if (name.indexOf(gyyrr_field_names[i]) != -1)	
		return 'amber';
	}
	
	return 'unknown';
}

var numred = '';
var numamber = '';
var numgreen = '';

// calculate assessment grading when any of the toxicity radios are clicked
$('.grade > input:radio').click( function() {
	setAssessmentGrading();
});
// calculate assessment grading when the 'patient admitted to hospital or seen gp' radio is clicked
$('#CF4P1PatAdm0').click( function()	{
	setAssessmentGrading();
});
$('#CF4P1PatAdm1').click( function()	{
	setAssessmentGrading();
});

// calculate assessment grading when page initially loads
$( document ).ready(function() {
	setAssessmentGrading();
	 checkAndSetTempWarning();
	 checkAndSetOxygenWarning ();
});
//
// Calculate and dislay the assessment grading.
// Based on number of colours selected and state of 'patient admitted to hospital' radio button, determine appropriate warning message and display it in a DIV and a hidden field.
//
function setAssessmentGrading ()	{	
	var colour = '';
	numred = 0;
	numgreen = 0;
	numamber = 0;
	
	$('.grade > input[type=radio]:checked').each(function ()	{
			colour = get_colour(this.name, this.value);
			if (colour == 'red')
				numred++;
			if (colour == 'green')
				numgreen++;
			if (colour == 'amber')
				numamber++;
	});

	if (numred > 0 || numamber >= 2)	{
		// red alert
		$('#CF4P1AssessmentGrading').val('Red: Must be seen and reviewed by senior medical staff prior to treatment');
		$('#assessmentGrading').text('Red: Must be seen and reviewed by senior medical staff prior to treatment');
		$('#assessmentGrading').css('color', 'red');
	}
	else if (numamber == 1 || $('#CF4P1PatAdm0').prop("checked") == true) 	{
		$('#CF4P1AssessmentGrading').val( 'Amber: Review by senior nurse / medical staff');
		$('#assessmentGrading').text( 'Amber: Review by senior nurse / medical staff');
		$('#assessmentGrading').css('color', 'orange');
	}
	else if (numamber == 0 && numred == 0 && $('#CF4P1PatAdm0').prop("checked") != true && numgreen > 0)	{
		$('#CF4P1AssessmentGrading').val ( 'Green: Proceed with treatment' );
		$('#assessmentGrading').text ( 'Green: Proceed with treatment' );
		$('#assessmentGrading').css('color', 'green');
	}
}
 
</script>