{% set absUrl = app.request.getSchemeAndHttpHost() ~ app.request.baseUrl|replace({'/app_dev.php': ''}) %}
{% set userData = app.session.get('userData') %}
<!DOCTYPE html>
<html class="no-js" lang="en" dir="ltr">
<head>
	<meta charset="utf-8">
	<meta http-equiv="x-ua-compatible" content="ie=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Somnus Letter</title>
</head>
<body style="font-family:'Arial'; font-size:18px;">
{% if patientLetter.patientReferringProvider %}
	{% set rp = patientLetter.patientReferringProvider.referringProvider %}
	{% set patient = patientLetter.patient %}
	{% set receiverFullName = patientLetter.patientReferringProvider.referringProvider.honorific ~ ' ' ~ patientLetter.patientReferringProvider.referringProvider.fullName|title %}
	{% if patientLetter.patientReferringProvider.referringProvider.phoneNo is null or patientLetter.patientReferringProvider.referringProvider.phoneNo == '' %}
		{% set receiverPhone = '' %}
		{% for prhf in patient.patientReferringHealthFacilities %}
			{% for rhfp in rp.referringHealthFacilityProviders %}
				{% if prhf.referringHealthFacility.id == rhfp.referringHealthFacility.id %}
					{% set receiverPhone = prhf.referringHealthFacility.phoneNo %}
				{% endif %}
			{% endfor %}
		{% endfor %}
	{% else %}
		{% set receiverPhone = patientLetter.patientReferringProvider.referringProvider.phoneNo %}
	{% endif %}
	{% if patientLetter.patientReferringProvider.referringProvider.faxNo is null or patientLetter.patientReferringProvider.referringProvider.faxNo == '' %}
		{% set receiverFax = '' %}
		{% for prhf in patient.patientReferringHealthFacilities %}
			{% for rhfp in rp.referringHealthFacilityProviders %}
				{% if prhf.referringHealthFacility.id == rhfp.referringHealthFacility.id %}
					{% set receiverFax = prhf.referringHealthFacility.faxNo %}
				{% endif %}
			{% endfor %}
		{% endfor %}
	{% else %}
		{% set receiverFax = patientLetter.patientReferringProvider.referringProvider.faxNo %}
	{% endif %}
{% endif %}
{% if patientLetter.patientReferringHealthFacility %}
	{% set receiverFullName = patientLetter.patientReferringHealthFacility.referringHealthFacility.description %}
	{% set receiverPhone = patientLetter.patientReferringHealthFacility.referringHealthFacility.phoneNo is null ? patientLetter.patientReferringHealthFacility.referringHealthFacility.phoneNoTwo : patientLetter.patientReferringHealthFacility.referringHealthFacility.phoneNo %}
	{% set receiverFax = patientLetter.patientReferringHealthFacility.referringHealthFacility.faxNo is null ? patientLetter.patientReferringHealthFacility.referringHealthFacility.faxNoTwo : patientLetter.patientReferringHealthFacility.referringHealthFacility.faxNo %}
{% endif %}
{% if patientLetter.patientInsurance %}
	{% set receiverFullName = patientLetter.patientInsurance.insurance.description %}
	{% set receiverPhone = patientLetter.patientInsurance.insurance.phoneNo is null ? patientLetter.patientInsurance.insurance.phoneNoTwo : patientLetter.patientInsurance.insurance.phoneNo %}
	{% set receiverFax = patientLetter.patientInsurance.insurance.faxNo is null ? patientLetter.patientInsurance.insurance.faxNoTwo : patientLetter.patientInsurance.insurance.faxNo %}
{% endif %}
{% set patientFullName = patientLetter.patient.fullName %}
{% set patientFirstName = patientLetter.patient.firstName %}
{% set patientLastName = patientLetter.patient.lastName %}
{% set patient = patientLetter.patient %}
{% set dateOfBirth = patientLetter.patient.birthDate|date('F j, Y') %}

{% set customBody = patientLetter.customBody|replace({
	'{{RECEVIER-FULLNAME}}' :  receiverFullName,
	'{{PATIENT-FULLNAME}}' : patientFullName,
	'{{PATIENT-FIRSTNAME}}' :  patientLetter.patient.firstName,
	'{{PATIENT-LASTNAME}}' :  patientLetter.patient.lastName,
	'{{USERDATA-FULLNAME}}' : userData.fullName,
	'{{DATE-TODAY}}' : 'now'|date('m/d/Y'),
	'{{DATE-CREATED}}' : patientLetter.createdAt|date('m/d/Y'),
	'{{PATIENT-PHN}}' : patientLetter.patient.personalHealthNo|default(''),
	'{{PATIENT-DOB}}' : patientLetter.patient.birthDate|date('m/d/Y'),
	'{{PATIENT-GENDER}}' : patientLetter.patient.gender == 'Male' ? 'he' : 'she',
	'{{PATIENT-GENDER2}}' : patientLetter.patient.gender == 'Male' ? 'him' : 'her',
	'{{PATIENT-GENDER3}}' : patientLetter.patient.gender == 'Male' ? 'his' : 'her',
	'{{PATIENT-GENDER4}}' : patientLetter.patient.gender == 'Male' ? 'He' : 'She'
})
%}


<!------ 1ST PAGE ------>
{% include '@RxConnexion/Patient/FaxTemplate/SomnusTemplate/fax_cover.wkpdf.twig' with {patientLetter: patientLetter} %}
<div style="page-break-before: always"></div>
<div style="width:768px; position: relative; padding:0px; margin: 0 auto; box-shadow:3px 1px 10px 1px;">
	<div style="border: none;">
		<div style="color: #ED226D; font-size: 22px;"><strong>COVID SCREENING</strong></div>
		<div style="margin-top: 10%;">
			<div>Patient Name: {{ patientFullName }}</div>
			<div>Screened By: {{ covidScreening.screenedBy|default('') }}</div>
			<div>Date Completed: {{ covidScreening.completedDate|default('')|date('F j, Y') }}</div>
		</div>
		<div style="margin-top: 10%; float: left">
			<div style="display: inline-block; font-size: 16px;">
				<strong>Are you experiencing cold, flu or COVID-19-like symptoms, even mild ones?</strong>
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.isExperiencingCovid == 1 ? 'checked' : '' }}> Yes
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.isExperiencingCovid != 1 ? 'checked' : '' }}> No
			</div>
		</div>
		<div style="width: 100%; margin-top: 2%; float: left">
			<div style="float: left; width: 50%;">
				<ul>
					<li>Fever</li>
					<li>Chills</li>
					<li>Cough or worsening of chronic cough</li>
					<li>Shortness of breath, sore throat</li>
					<li>Runny nose</li>
					<li>Loss of sense of smell and taste</li>
					<li>Headache</li>
					<li>Fatigue</li>
					<li>Diarrhea</li>
				</ul>
			</div>
			<div style="float: right; width: 50%;">
				<ul>
					<li>Loss of appetite</li>
					<li>Nausea and vomiting</li>
					<li>Muscle aches</li>
					<li>Stuffy nose</li>
					<li>Conjunctivitis (Pink Eye)</li>
					<li>Dizziness</li>
					<li>Confusion</li>
					<li>Abdominal Pain</li>
					<li>Skin rashes or discoloration of fingers or toes</li>
				</ul>
			</div>
		</div>
		<div style="margin-top: 5%; float: left">
			<div style="display: inline-block; font-size: 16px;">
				<strong>Have you travelled to any countries outside Canada (including the United States) within the last 14 days?</strong>
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.hasTravelled|default('') == 1 ? 'checked' : '' }}> Yes
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.hasTravelled|default('') != 1 ? 'checked' : '' }}> No
			</div>
		</div>
		<div style="margin-top: 5%; float: left">
			<div style="display: inline-block; font-size: 16px;">
				<strong>Do you provide care or have close contact with a person with confirmed COVID-19?</strong>
				<div>Note: This means you would have been contacted by your health authority's public health team.</div>
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.isCloseContactPerson|default('') == 1 ? 'checked' : '' }}> Yes
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.isCloseContactPerson|default('') != 1 ? 'checked' : '' }}> No
			</div>
		</div>
		<div style="margin-top: 5%; float: left">
			<div style="display: inline-block; font-size: 16px;">
				<strong>Do you have a scheduled appointment for a COVID-19 swab test?</strong>
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.hasScheduledAppointment|default('') == 1 ? 'checked' : '' }}> Yes
				<input type="checkbox" style="margin-right: 10px;" {{ covidScreening.hasScheduledAppointment|default('') != 1 ? 'checked' : '' }}> No
			</div>
		</div>
	</div>
	<div style="width: 100%; margin-top: 10%; text-align: center; float: left;">
		<strong>If the patient says yes to any of the above the patient appt should be cancelled and rebooked for 15 days later</strong>
	</div>
</div>
</body>
</html>