189 lines
9.0 KiB
HTML
189 lines
9.0 KiB
HTML
{% load static %}
|
|
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Complete Patient Transfer</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="completeTransferForm" method="post" action="{% url 'inpatients:complete_transfer' transfer_id=transfer.id %}">
|
|
{% csrf_token %}
|
|
|
|
<div class="transfer-info mb-3">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p><strong>Patient:</strong> {{ transfer.admission.patient.get_full_name }}</p>
|
|
<p><strong>MRN:</strong> {{ transfer.admission.patient.mrn }}</p>
|
|
<p><strong>Transfer Type:</strong> {{ transfer.get_transfer_type_display }}</p>
|
|
<p><strong>Status:</strong>
|
|
<span class="badge bg-{{ transfer.status|lower }}">
|
|
{{ transfer.get_status_display }}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p><strong>From:</strong> {{ transfer.source_ward.name }}, Room {{ transfer.source_bed.room_number }}, Bed {{ transfer.source_bed.bed_number }}</p>
|
|
<p><strong>To:</strong> {{ transfer.target_ward.name }}, Room {{ transfer.target_bed.room_number }}, Bed {{ transfer.target_bed.bed_number }}</p>
|
|
<p><strong>Approved By:</strong> {{ transfer.approved_by.get_full_name }}</p>
|
|
<p><strong>Scheduled Time:</strong> {{ transfer.scheduled_datetime|date:"M d, Y H:i" }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="alert alert-info mt-2">
|
|
<p><strong>Reason:</strong> {{ transfer.get_transfer_reason_display }}</p>
|
|
{% if transfer.notes %}
|
|
<p><strong>Notes:</strong> {{ transfer.notes }}</p>
|
|
{% endif %}
|
|
{% if transfer.approval_notes %}
|
|
<p><strong>Approval Notes:</strong> {{ transfer.approval_notes }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="actual_datetime" class="form-label">Actual Transfer Time <span class="text-danger">*</span></label>
|
|
<input type="datetime-local" class="form-control" id="actual_datetime" name="actual_datetime" required>
|
|
<div class="form-text">When did the transfer actually occur?</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="completed_by_role" class="form-label">Your Role <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="completed_by_role" name="completed_by_role" required>
|
|
<option value="">Select your role</option>
|
|
<option value="NURSE">Nurse</option>
|
|
<option value="PHYSICIAN">Physician</option>
|
|
<option value="TRANSPORT">Transport Staff</option>
|
|
<option value="ADMIN">Administrative Staff</option>
|
|
<option value="OTHER">Other (specify in notes)</option>
|
|
</select>
|
|
<div class="form-text">Select your role in completing this transfer.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="handoff_to" class="form-label">Handoff To <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="handoff_to" name="handoff_to" required placeholder="Name of staff receiving the patient">
|
|
<div class="form-text">Who received the patient at the destination?</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="handoff_to_role" class="form-label">Handoff To Role <span class="text-danger">*</span></label>
|
|
<select class="form-select" id="handoff_to_role" name="handoff_to_role" required>
|
|
<option value="">Select role</option>
|
|
<option value="NURSE">Nurse</option>
|
|
<option value="PHYSICIAN">Physician</option>
|
|
<option value="ADMIN">Administrative Staff</option>
|
|
<option value="OTHER">Other (specify in notes)</option>
|
|
</select>
|
|
<div class="form-text">Role of the person who received the patient.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="completion_notes" class="form-label">Completion Notes</label>
|
|
<textarea class="form-control" id="completion_notes" name="completion_notes" rows="3" placeholder="Enter any additional information about this transfer"></textarea>
|
|
<div class="form-text">Please provide any additional details about the transfer completion.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="handoff_completed" name="handoff_completed" required>
|
|
<label class="form-check-label" for="handoff_completed">
|
|
I confirm that proper handoff was completed, including patient information and care requirements
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="belongings_transferred" name="belongings_transferred" required>
|
|
<label class="form-check-label" for="belongings_transferred">
|
|
I confirm that all patient belongings were transferred with the patient
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="notify_completion" name="notify_completion" checked>
|
|
<label class="form-check-label" for="notify_completion">
|
|
Notify care teams about transfer completion
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="submit" form="completeTransferForm" class="btn btn-success">
|
|
<i class="fa fa-check-circle"></i> Complete Transfer
|
|
</button>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Set default actual datetime to current time
|
|
var now = new Date();
|
|
var defaultDateTime = now.toISOString().slice(0, 16);
|
|
$('#actual_datetime').val(defaultDateTime);
|
|
|
|
// Form validation
|
|
$('#completeTransferForm').submit(function(e) {
|
|
var isValid = true;
|
|
|
|
// Required fields
|
|
var requiredFields = ['#actual_datetime', '#completed_by_role', '#handoff_to', '#handoff_to_role'];
|
|
|
|
$.each(requiredFields, function(index, field) {
|
|
if ($(field).val() === '' || $(field).val() === null) {
|
|
$(field).addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$(field).removeClass('is-invalid');
|
|
}
|
|
});
|
|
|
|
// Check if actual time is in the future
|
|
var actualTime = new Date($('#actual_datetime').val());
|
|
var now = new Date();
|
|
|
|
if (actualTime > now) {
|
|
$('#actual_datetime').addClass('is-invalid');
|
|
$('#actual_datetime').closest('.mb-3').find('.form-text').html('<span class="text-danger">Actual time cannot be in the future.</span>');
|
|
isValid = false;
|
|
} else {
|
|
$('#actual_datetime').removeClass('is-invalid');
|
|
$('#actual_datetime').closest('.mb-3').find('.form-text').html('When did the transfer actually occur?');
|
|
}
|
|
|
|
// Check required checkboxes
|
|
if (!$('#handoff_completed').is(':checked')) {
|
|
$('#handoff_completed').addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$('#handoff_completed').removeClass('is-invalid');
|
|
}
|
|
|
|
if (!$('#belongings_transferred').is(':checked')) {
|
|
$('#belongings_transferred').addClass('is-invalid');
|
|
isValid = false;
|
|
} else {
|
|
$('#belongings_transferred').removeClass('is-invalid');
|
|
}
|
|
|
|
// Check if "Other" role is selected but no notes provided
|
|
if (($('#completed_by_role').val() === 'OTHER' || $('#handoff_to_role').val() === 'OTHER') &&
|
|
$('#completion_notes').val().trim() === '') {
|
|
$('#completion_notes').addClass('is-invalid');
|
|
$('#completion_notes').closest('.mb-3').find('.form-text').html('<span class="text-danger">Please provide details for "Other" role.</span>');
|
|
isValid = false;
|
|
}
|
|
|
|
if (!isValid) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
});
|
|
</script>
|
|
|