202 lines
12 KiB
HTML
202 lines
12 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Lab Orders - {{ block.super }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title mb-0">
|
|
<i class="fas fa-vial me-2"></i>Laboratory Orders
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<!-- Filters -->
|
|
<form method="get" class="mb-3">
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<select name="status" class="form-select">
|
|
<option value="">All Status</option>
|
|
<option value="PENDING" {% if status == 'PENDING' %}selected{% endif %}>Pending</option>
|
|
<option value="SCHEDULED" {% if status == 'SCHEDULED' %}selected{% endif %}>Scheduled</option>
|
|
<option value="COLLECTED" {% if status == 'COLLECTED' %}selected{% endif %}>Collected</option>
|
|
<option value="IN_PROGRESS" {% if status == 'IN_PROGRESS' %}selected{% endif %}>In Progress</option>
|
|
<option value="COMPLETED" {% if status == 'COMPLETED' %}selected{% endif %}>Completed</option>
|
|
<option value="CANCELLED" {% if status == 'CANCELLED' %}selected{% endif %}>Cancelled</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<select name="priority" class="form-select">
|
|
<option value="">All Priorities</option>
|
|
<option value="STAT" {% if priority == 'STAT' %}selected{% endif %}>STAT</option>
|
|
<option value="URGENT" {% if priority == 'URGENT' %}selected{% endif %}>Urgent</option>
|
|
<option value="ROUTINE" {% if priority == 'ROUTINE' %}selected{% endif %}>Routine</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<input type="date" name="date_from" class="form-control"
|
|
value="{{ date_from }}" placeholder="From Date">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<input type="date" name="date_to" class="form-control"
|
|
value="{{ date_to }}" placeholder="To Date">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<input type="text" name="search" class="form-control"
|
|
value="{{ search }}" placeholder="Search orders, patients, MRN...">
|
|
</div>
|
|
<div class="col-md-1">
|
|
<button type="submit" class="btn btn-primary w-100">
|
|
<i class="fas fa-search"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Orders Table -->
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Order #</th>
|
|
<th>Patient</th>
|
|
<th>Tests</th>
|
|
<th>Provider</th>
|
|
<th>Ordered</th>
|
|
<th>Priority</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for order in page_obj %}
|
|
<tr {% if order.priority == 'STAT' %}class="table-danger"{% elif order.priority == 'URGENT' %}class="table-warning"{% endif %}>
|
|
<td>
|
|
<strong>{{ order.order_number }}</strong>
|
|
{% if order.encounter %}
|
|
<br><small class="text-muted">Encounter: {{ order.encounter.id }}</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<strong>{{ order.patient.get_full_name }}</strong><br>
|
|
<small class="text-muted">
|
|
MRN: {{ order.patient.mrn }} •
|
|
{{ order.patient.age }}y {{ order.patient.get_gender_display }}
|
|
</small>
|
|
</td>
|
|
<td>
|
|
{% for test in order.tests.all %}
|
|
<span class="badge bg-info me-1">{{ test.test_name }}</span>
|
|
{% if not forloop.last %}<br>{% endif %}
|
|
{% endfor %}
|
|
</td>
|
|
<td>{{ order.ordering_provider.get_full_name }}</td>
|
|
<td>{{ order.order_datetime|date:"M d, Y H:i" }}</td>
|
|
<td>
|
|
{% if order.priority == 'STAT' %}
|
|
<span class="badge bg-danger">STAT</span>
|
|
{% elif order.priority == 'URGENT' %}
|
|
<span class="badge bg-warning">Urgent</span>
|
|
{% elif order.priority == 'ROUTINE' %}
|
|
<span class="badge bg-info">Routine</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if order.status == 'PENDING' %}
|
|
<span class="badge bg-warning">Pending</span>
|
|
{% elif order.status == 'SCHEDULED' %}
|
|
<span class="badge bg-info">Scheduled</span>
|
|
{% elif order.status == 'COLLECTED' %}
|
|
<span class="badge bg-primary">Collected</span>
|
|
{% elif order.status == 'IN_PROGRESS' %}
|
|
<span class="badge bg-success">In Progress</span>
|
|
{% elif order.status == 'COMPLETED' %}
|
|
<span class="badge bg-success">Completed</span>
|
|
{% elif order.status == 'CANCELLED' %}
|
|
<span class="badge bg-danger">Cancelled</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm">
|
|
<a href="{% url 'laboratory:order_detail' order.order_id %}"
|
|
class="btn btn-outline-primary" title="View Details">
|
|
<i class="fas fa-eye"></i>
|
|
</a>
|
|
{% if order.status == 'PENDING' %}
|
|
<button class="btn btn-outline-success"
|
|
title="Schedule Collection"
|
|
hx-post="{% url 'laboratory:schedule_collection' order.order_id %}"
|
|
hx-confirm="Schedule specimen collection?"
|
|
hx-swap="none">
|
|
<i class="fas fa-calendar"></i>
|
|
</button>
|
|
{% elif order.status == 'SCHEDULED' %}
|
|
<button class="btn btn-outline-info"
|
|
title="Mark Collected"
|
|
hx-post="{% url 'laboratory:mark_collected' order.order_id %}"
|
|
hx-confirm="Mark specimens as collected?"
|
|
hx-swap="none">
|
|
<i class="fas fa-check"></i>
|
|
</button>
|
|
{% endif %}
|
|
<button class="btn btn-outline-secondary" title="Print Labels">
|
|
<i class="fas fa-print"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="8" class="text-center py-4">
|
|
<i class="fas fa-vial fa-3x text-muted mb-3"></i>
|
|
<h5 class="text-muted">No lab orders found</h5>
|
|
<p class="text-muted">No lab orders match your current filters.</p>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if page_obj.has_other_pages %}
|
|
<nav aria-label="Lab orders pagination">
|
|
<ul class="pagination justify-content-center">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page=1{% if search %}&search={{ search }}{% endif %}{% if status %}&status={{ status }}{% endif %}">First</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if search %}&search={{ search }}{% endif %}{% if status %}&status={{ status }}{% endif %}">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 }}{% if search %}&search={{ search }}{% endif %}{% if status %}&status={{ status }}{% endif %}">Next</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if search %}&search={{ search }}{% endif %}{% if status %}&status={{ status }}{% endif %}">Last</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|