2025-08-12 13:33:25 +03:00

336 lines
22 KiB
HTML

{% extends 'base.html' %}
{% load static %}
{% block title %}Check In Patient{% endblock %}
{% block content %}
<div id="content" class="app-content">
<div class="container">
<div class="row justify-content-center">
<div class="col-xl-10">
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'core:dashboard' %}">Dashboard</a></li>
<li class="breadcrumb-item"><a href="{% url 'appointments:appointment_list' %}">Appointments</a></li>
<li class="breadcrumb-item"><a href="{% url 'appointments:appointment_detail' appointment.id %}">{{ appointment.patient.first_name }} {{ appointment.patient.last_name }}</a></li>
<li class="breadcrumb-item active">Check In</li>
</ul>
<h1 class="page-header">Patient Check-In</h1>
<div class="row">
<div class="col-xl-8">
<!-- Appointment Info -->
<div class="card mb-4">
<div class="card-header">
<h4 class="card-title">Appointment Details</h4>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="row mb-2">
<div class="col-4"><strong>Patient:</strong></div>
<div class="col-8">{{ appointment.patient.first_name }} {{ appointment.patient.last_name }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>Patient ID:</strong></div>
<div class="col-8">{{ appointment.patient.patient_id }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>DOB:</strong></div>
<div class="col-8">{{ appointment.patient.date_of_birth|date:"M d, Y" }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>Phone:</strong></div>
<div class="col-8">{{ appointment.patient.phone_number|default:"Not provided" }}</div>
</div>
</div>
<div class="col-md-6">
<div class="row mb-2">
<div class="col-4"><strong>Date:</strong></div>
<div class="col-8">{{ appointment.appointment_date|date:"M d, Y" }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>Time:</strong></div>
<div class="col-8">{{ appointment.appointment_time|time:"g:i A" }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>Provider:</strong></div>
<div class="col-8">{{ appointment.provider.first_name }} {{ appointment.provider.last_name }}</div>
</div>
<div class="row mb-2">
<div class="col-4"><strong>Department:</strong></div>
<div class="col-8">{{ appointment.department.name }}</div>
</div>
</div>
</div>
</div>
</div>
<!-- Check-in Form -->
<div class="card">
<div class="card-header">
<h4 class="card-title">Check-In Information</h4>
</div>
<div class="card-body">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
{% endif %}
<form method="post" class="form-horizontal">
{% csrf_token %}
<div class="row mb-3">
<label class="col-form-label col-md-3">Check-in Time</label>
<div class="col-md-9">
<input type="datetime-local" name="checkin_time" class="form-control"
value="{{ form.checkin_time.value|default:now|date:'Y-m-d\TH:i' }}" required>
{% if form.checkin_time.errors %}
<div class="text-danger">{{ form.checkin_time.errors.0 }}</div>
{% endif %}
</div>
</div>
<div class="row mb-3">
<label class="col-form-label col-md-3">Checked In By</label>
<div class="col-md-9">
<input type="text" name="checked_in_by" class="form-control"
value="{{ form.checked_in_by.value|default:request.user.get_full_name }}" readonly>
{% if form.checked_in_by.errors %}
<div class="text-danger">{{ form.checked_in_by.errors.0 }}</div>
{% endif %}
</div>
</div>
<div class="row mb-3">
<label class="col-form-label col-md-3">Verification Checklist</label>
<div class="col-md-9">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="id_verified" id="id_verified"
{% if form.id_verified.value %}checked{% endif %}>
<label class="form-check-label" for="id_verified">
Photo ID verified
</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="insurance_verified" id="insurance_verified"
{% if form.insurance_verified.value %}checked{% endif %}>
<label class="form-check-label" for="insurance_verified">
Insurance card verified
</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="forms_completed" id="forms_completed"
{% if form.forms_completed.value %}checked{% endif %}>
<label class="form-check-label" for="forms_completed">
Required forms completed
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="copay_collected" id="copay_collected"
{% if form.copay_collected.value %}checked{% endif %}>
<label class="form-check-label" for="copay_collected">
Co-payment collected (if applicable)
</label>
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-form-label col-md-3">Waiting Area Assignment</label>
<div class="col-md-9">
<select name="waiting_area" class="form-select">
<option value="">Select Waiting Area</option>
<option value="main_lobby" {% if form.waiting_area.value == 'main_lobby' %}selected{% endif %}>Main Lobby</option>
<option value="pediatric_area" {% if form.waiting_area.value == 'pediatric_area' %}selected{% endif %}>Pediatric Area</option>
<option value="specialty_clinic" {% if form.waiting_area.value == 'specialty_clinic' %}selected{% endif %}>Specialty Clinic</option>
<option value="urgent_care" {% if form.waiting_area.value == 'urgent_care' %}selected{% endif %}>Urgent Care</option>
<option value="surgical_waiting" {% if form.waiting_area.value == 'surgical_waiting' %}selected{% endif %}>Surgical Waiting</option>
</select>
{% if form.waiting_area.errors %}
<div class="text-danger">{{ form.waiting_area.errors.0 }}</div>
{% endif %}
</div>
</div>
<div class="row mb-3">
<label class="col-form-label col-md-3">Special Needs</label>
<div class="col-md-9">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="wheelchair_needed" id="wheelchair_needed"
{% if form.wheelchair_needed.value %}checked{% endif %}>
<label class="form-check-label" for="wheelchair_needed">
Wheelchair assistance needed
</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="interpreter_needed" id="interpreter_needed"
{% if form.interpreter_needed.value %}checked{% endif %}>
<label class="form-check-label" for="interpreter_needed">
Interpreter services needed
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="special_assistance" id="special_assistance"
{% if form.special_assistance.value %}checked{% endif %}>
<label class="form-check-label" for="special_assistance">
Other special assistance required
</label>
</div>
</div>
</div>
<div class="row mb-3">
<label class="col-form-label col-md-3">Check-in Notes</label>
<div class="col-md-9">
<textarea name="checkin_notes" class="form-control" rows="3"
placeholder="Any additional notes about the check-in process">{{ form.checkin_notes.value|default:'' }}</textarea>
{% if form.checkin_notes.errors %}
<div class="text-danger">{{ form.checkin_notes.errors.0 }}</div>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-md-9 offset-md-3">
<button type="submit" class="btn btn-success">
<i class="fa fa-check me-2"></i>Complete Check-In
</button>
<a href="{% url 'appointments:appointment_detail' appointment.id %}" class="btn btn-secondary ms-2">
<i class="fa fa-arrow-left me-2"></i>Go Back
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-xl-4">
<!-- Patient Information -->
<div class="card mb-4">
<div class="card-header">
<h4 class="card-title">Patient Information</h4>
</div>
<div class="card-body">
<div class="row mb-2">
<div class="col-5"><strong>Age:</strong></div>
<div class="col-7">{{ appointment.patient.age|default:"N/A" }}</div>
</div>
<div class="row mb-2">
<div class="col-5"><strong>Gender:</strong></div>
<div class="col-7">{{ appointment.patient.gender|default:"N/A" }}</div>
</div>
<div class="row mb-2">
<div class="col-5"><strong>Address:</strong></div>
<div class="col-7">{{ appointment.patient.address|default:"Not provided" }}</div>
</div>
<div class="row mb-2">
<div class="col-5"><strong>Emergency Contact:</strong></div>
<div class="col-7">{{ appointment.patient.emergency_contact|default:"Not provided" }}</div>
</div>
</div>
</div>
<!-- Insurance Information -->
<div class="card mb-4">
<div class="card-header">
<h4 class="card-title">Insurance Information</h4>
</div>
<div class="card-body">
{% if appointment.patient.insurance_provider %}
<div class="row mb-2">
<div class="col-5"><strong>Provider:</strong></div>
<div class="col-7">{{ appointment.patient.insurance_provider }}</div>
</div>
<div class="row mb-2">
<div class="col-5"><strong>Policy #:</strong></div>
<div class="col-7">{{ appointment.patient.insurance_policy_number }}</div>
</div>
<div class="row mb-2">
<div class="col-5"><strong>Group #:</strong></div>
<div class="col-7">{{ appointment.patient.insurance_group_number|default:"N/A" }}</div>
</div>
{% else %}
<p class="text-muted">No insurance information on file</p>
{% endif %}
</div>
</div>
<!-- Alerts -->
<div class="card mb-4">
<div class="card-header">
<h4 class="card-title">Patient Alerts</h4>
</div>
<div class="card-body">
{% if appointment.patient.allergies %}
<div class="alert alert-warning">
<strong>Allergies:</strong> {{ appointment.patient.allergies }}
</div>
{% endif %}
{% if appointment.patient.medical_alerts %}
<div class="alert alert-danger">
<strong>Medical Alerts:</strong> {{ appointment.patient.medical_alerts }}
</div>
{% endif %}
{% if not appointment.patient.allergies and not appointment.patient.medical_alerts %}
<p class="text-muted">No alerts on file</p>
{% endif %}
</div>
</div>
<!-- Quick Actions -->
<div class="card">
<div class="card-header">
<h4 class="card-title">Quick Actions</h4>
</div>
<div class="card-body">
<div class="d-grid gap-2">
<a href="{% url 'patients:patient_detail' appointment.patient.id %}" class="btn btn-outline-primary btn-sm">
<i class="fa fa-user me-2"></i>View Patient Profile
</a>
<a href="{% url 'appointments:appointment_update' appointment.id %}" class="btn btn-outline-warning btn-sm">
<i class="fa fa-edit me-2"></i>Edit Appointment
</a>
<button type="button" class="btn btn-outline-info btn-sm" onclick="printCheckinForm()">
<i class="fa fa-print me-2"></i>Print Check-in Form
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
// Set current time as default check-in time
var now = new Date();
var formattedTime = now.toISOString().slice(0, 16);
if (!$('input[name="checkin_time"]').val()) {
$('input[name="checkin_time"]').val(formattedTime);
}
// Auto-check ID verified if patient has complete information
var hasCompleteInfo = '{{ appointment.patient.date_of_birth }}' && '{{ appointment.patient.address }}';
if (hasCompleteInfo) {
$('#id_verified').prop('checked', true);
}
});
function printCheckinForm() {
window.print();
}
</script>
{% endblock %}