hospital-management/templates/radiology/imaging_order_list.html
2025-08-12 13:33:25 +03:00

244 lines
13 KiB
HTML

{% extends 'base.html' %}
{% load static %}
{% block title %}Imaging Orders{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">Imaging Orders</h1>
<a href="{% url 'radiology:imaging_order_create' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> New Order
</a>
</div>
</div>
</div>
<!-- Search and Filter Form -->
<div class="row mb-4">
<div class="col-12">
<div class="card">
<div class="card-body">
<form method="get" class="row">
<div class="col-md-3">
<input type="text" name="search" class="form-control"
placeholder="Search orders..." value="{{ request.GET.search }}">
</div>
<div class="col-md-2">
<select name="status" class="form-control">
<option value="">All Statuses</option>
{% for value, label in statuses %}
<option value="{{ value }}" {% if request.GET.status == value %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="modality" class="form-control">
<option value="">All Modalities</option>
{% for value, label in modalities %}
<option value="{{ value }}" {% if request.GET.modality == value %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="priority" class="form-control">
<option value="">All Priorities</option>
{% for value, label in priorities %}
<option value="{{ value }}" {% if request.GET.priority == value %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-outline-primary">
<i class="fas fa-search"></i> Search
</button>
<a href="{% url 'radiology:imaging_order_list' %}" class="btn btn-outline-secondary">
<i class="fas fa-times"></i> Clear
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Orders Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
{% if imaging_orders %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Patient</th>
<th>Study</th>
<th>Modality</th>
<th>Priority</th>
<th>Status</th>
<th>Ordered</th>
<th>Provider</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for order in imaging_orders %}
<tr>
<td>
<a href="{% url 'radiology:imaging_order_detail' order.pk %}">
<strong>{{ order.patient.first_name }} {{ order.patient.last_name }}</strong>
</a>
<br><small class="text-muted">MRN: {{ order.patient.mrn }}</small>
</td>
<td>
{{ order.study_description }}
{% if order.body_part %}
<br><small class="text-muted">{{ order.body_part }}</small>
{% endif %}
</td>
<td>
<span class="badge badge-info">{{ order.modality }}</span>
</td>
<td>
<span class="badge badge-{% if order.priority == 'URGENT' %}danger{% elif order.priority == 'HIGH' %}warning{% else %}secondary{% endif %}">
{{ order.get_priority_display }}
</span>
</td>
<td>
<span class="badge badge-{% if order.status == 'PENDING' %}warning{% elif order.status == 'SCHEDULED' %}info{% elif order.status == 'IN_PROGRESS' %}primary{% elif order.status == 'COMPLETED' %}success{% else %}secondary{% endif %}">
{{ order.get_status_display }}
</span>
</td>
<td>{{ order.order_datetime|date:"M d, Y H:i" }}</td>
<td>
{% if order.ordering_provider %}
{{ order.ordering_provider.first_name }} {{ order.ordering_provider.last_name }}
{% else %}
<span class="text-muted">N/A</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'radiology:imaging_order_detail' order.pk %}"
class="btn btn-outline-info" title="View Details">
<i class="fas fa-eye"></i>
</a>
{% if order.status == 'PENDING' %}
<a href="{% url 'radiology:imaging_order_update' order.pk %}"
class="btn btn-outline-primary" title="Update">
<i class="fas fa-edit"></i>
</a>
<button type="button" class="btn btn-outline-success"
title="Schedule Study" data-toggle="modal"
data-target="#scheduleModal{{ order.pk }}">
<i class="fas fa-calendar"></i>
</button>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if is_paginated %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1{% for key, value in request.GET.items %}{% if key != 'page' %}&{{ key }}={{ value }}{% endif %}{% endfor %}">First</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% for key, value in request.GET.items %}{% if key != 'page' %}&{{ key }}={{ value }}{% endif %}{% endfor %}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% for key, value in request.GET.items %}{% if key != 'page' %}&{{ key }}={{ value }}{% endif %}{% endfor %}">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% for key, value in request.GET.items %}{% if key != 'page' %}&{{ key }}={{ value }}{% endif %}{% endfor %}">Last</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-4">
<i class="fas fa-x-ray fa-3x text-muted mb-3"></i>
<h5 class="text-muted">No imaging orders found</h5>
<p class="text-muted">Start by creating your first imaging order.</p>
<a href="{% url 'radiology:imaging_order_create' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> Create First Order
</a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!-- Schedule Study Modals -->
{% for order in imaging_orders %}
{% if order.status == 'PENDING' %}
<div class="modal fade" id="scheduleModal{{ order.pk }}" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Schedule Study</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<form method="post" action="{% url 'radiology:schedule_study' order.pk %}">
{% csrf_token %}
<div class="modal-body">
<div class="form-group">
<label>Patient:</label>
<p><strong>{{ order.patient.first_name }} {{ order.patient.last_name }}</strong></p>
</div>
<div class="form-group">
<label>Study:</label>
<p>{{ order.study_description }} ({{ order.modality }})</p>
</div>
<div class="form-group">
<label for="scheduled_datetime">Scheduled Date & Time:</label>
<input type="datetime-local" name="scheduled_datetime" class="form-control" required>
</div>
<div class="form-group">
<label for="room_location">Room Location:</label>
<input type="text" name="room_location" class="form-control" placeholder="e.g., CT Room 1">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success">Schedule Study</button>
</div>
</form>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% endblock %}