feat: implement new pathology report search functionality with dedicated view and form.

This commit is contained in:
Furen Xiao 2026-02-25 21:51:15 +08:00
parent 38f54f252f
commit 6f052be127
15 changed files with 445 additions and 17 deletions

View file

@ -105,7 +105,7 @@ def ScanOPSchedule(year=False, month=False):
# if starts.month != ends.month: # if starts.month != ends.month:
# SaveOP(vs, end, end) # SaveOP(vs, end, end)
# print vs, start, end # print vs, start, end
OPSchedule.objects.filter(Complete__in=['NO', 'OO']).update(Complete="完成") OPSchedule.objects.filter(Complete__in=['NO', 'OO', 'OO,OS,OE']).update(Complete="完成")

View file

@ -42,9 +42,11 @@ def SavePathology(ChartNo, SESSION = None):
p.PersonID = r['PersonID'] p.PersonID = r['PersonID']
# p.PathCode = r['PathCode'] # p.PathCode = r['PathCode']
p.SpecimenGetDate = r['SpecimenGetDate'].replace('/', '-').split(' ')[0] p.SpecimenGetDate = r['SpecimenGetDate'].replace('/', '-').split(' ')[0]
p.ReportDate = r['ReportDate'].replace('/', '-').split(' ')[0] # p.ReportDate = r['ReportDate'].replace('/', '-').split(' ')[0]
p.ReportDate = datetime.strptime(r['ReportDate'], "%Y/%m/%d %H:%M")
p.url = r['url'] p.url = r['url']
p.html = r['html'] p.html = r['html']
# print(r['ReportDate'], p.ReportDate)
p.save() p.save()
def ScanPathology(days = False): def ScanPathology(days = False):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View file

@ -402,6 +402,8 @@ ALLOWED_HOSTS = [
'192.168.26.10', '192.168.26.10',
] ]
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
########## HAYSTACK ########## HAYSTACK
# HAYSTACK_CONNECTIONS = { # HAYSTACK_CONNECTIONS = {
# 'default': { # 'default': {

View file

@ -7,17 +7,16 @@ from django.views.generic import TemplateView
import fileupload.views import fileupload.views
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from django.contrib import admin
admin.autodiscover()
#from fileupload.views import PictureCreateView, PictureDeleteView, multiple_uploader #from fileupload.views import PictureCreateView, PictureDeleteView, multiple_uploader
#from registry.views import PictureCreateView, PictureDeleteView, multiple_uploader #from registry.views import PictureCreateView, PictureDeleteView, multiple_uploader
from registry import views as registry_views from registry import views as registry_views
from registry.views import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = [ urlpatterns = [
# Examples: # Examples:
@ -45,7 +44,8 @@ urlpatterns = [
re_path(r'^registry/op_note/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.op_note), re_path(r'^registry/op_note/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.op_note),
re_path(r'^registry/patho_report/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.patho_report), # re_path(r'^registry/patho_report/(?P<PatChartNo>\d+)/(?P<date>\d{4}-\d\d-\d\d)/', registry_views.patho_report),
re_path(r'^registry/patho_report/(?P<PathCode>.+)/', registry_views.patho_report),
re_path(r'^registry/op_prepare/', registry_views.op_prepare), re_path(r'^registry/op_prepare/', registry_views.op_prepare),
@ -53,7 +53,10 @@ urlpatterns = [
re_path(r'^registry/op_edit/', registry_views.op_edit), re_path(r'^registry/op_edit/', registry_views.op_edit),
re_path(r'^registry/op_search/', registry_views.op_search), re_path(r'^registry/op_search/', registry_views.op_search),
re_path(r'^registry/patho_search/', registry_views.patho_search), re_path(r'^registry/patho_search/', registry_views.patho_search),
path('pathology/search/', PathologyReportSearchView.as_view(), name='pathology_search'),
re_path(r'^registry/op_uncategorized/', registry_views.op_uncategorized), re_path(r'^registry/op_uncategorized/', registry_views.op_uncategorized),
re_path(r'^registry/op_month/', registry_views.op_month), re_path(r'^registry/op_month/', registry_views.op_month),
re_path(r'^registry/op_year/', registry_views.op_year), re_path(r'^registry/op_year/', registry_views.op_year),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -0,0 +1,107 @@
<table id="rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay" class="standard" cellspacing="1" width="100%" cellpadding="1" border="1">
<tbody><tr>
<th width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitlePathCode">病理號</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblPathCode">S0219316</span>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblFrozenFlag"></span>
</td>
<th width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleSpecimenGetdate">收件日</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblSpecimenGetDate">2002/08/12</span>
</td>
<th width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleReportDate">報告日</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblReportDate">2002/08/13 00:00</span>
</td>
</tr>
<tr>
<th width="5%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleSpecimenCode">檢體</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblSpecimenCode">b</span>
</td>
<th>科別
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblDepCode">SURG</span>
</td>
<th>病床
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblWardNoRoomCoBedNo">04B10801</span>
</td>
</tr>
<tr>
<th width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleTissue">組織由來</span>
</th>
<td colspan="5">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTissue"></span>
</td>
</tr>
<tr>
<th width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleBedDiagnosis">臨床診斷</span>
</th>
<td colspan="5">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblBedDiagnosis">Neurotic tumor</span>
</td>
</tr>
<tr>
<td colspan="6" style="font-size: medium">
<table border="1" width="100%"><tbody><tr><th colspan="2">01</th></tr><tr><th width="15%">器官與術式</th><td>Lung,left,apex,excision</td></tr><tr><th width="15%">組織學診斷1</th><td>schwannoma</td></tr><tr><th width="15%">診斷描述1</th><td></td></tr></tbody></table>
</td>
</tr>
<tr>
<th colspan="6" width="10%">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleresult">檢查報告</span>
</th>
</tr>
<tr>
<td colspan="6">
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblAlertMessage"></span>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblResult">The specimen submitted consists of 3 tissue fragments measuring up to<br> 3.5 x 3.0 x 2.5 cm. in size fixed in formalin.<br> <br> Grossly, they are yellowish white and elastic. <br> <br> <br> <br> All for section. Jar 0 <br> <br> <br> <br> Microscopically, it shows schwannoma. Prominent Antoni A and Antoni B areas are<br>seen. Same areas of hyalinization and hemorrhage are also noted.<br><br><br><br>Ref.S02-19242</span>
</td>
</tr>
<tr>
<th colspan="1" width="10%">
</th>
<td colspan="5">
</td>
</tr>
<tr id="rReportTab_lsvReportBody_ctrl0_ctl00_rowReportHide">
<th>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleExamDoctorName">執行醫師</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblExamDoctorName">林中梧(病解專醫字第0279號)</span>
</td>
<th>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleInChargeDoctorName">負責醫師</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblInChargeDoctorName">王逸平</span>
</td>
<th>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblTitleReCheckDoctorName">覆閱醫師</span>
</th>
<td>
<span id="rReportTab_lsvReportBody_ctrl0_ctl00_lblReCheckDoctorName"></span>
</td>
</tr>
<tr align="right">
<td colspan="6">
</td>
</tr>
</tbody></table>

24
ntuh/registry/forms.py Normal file
View file

@ -0,0 +1,24 @@
from django import forms
from haystack.forms import SearchForm, ModelSearchForm
class PathologyReportForm(SearchForm):
# class PathologyReportForm(ModelSearchForm):
q = forms.CharField(
required=False,
# label=_("Search"),
widget=forms.TextInput(attrs={"type": "search"}),
)
# def __init__(self, *args, **kwargs):
# super().__init__(*args, **kwargs)
# self.fields["models"] = forms.MultipleChoiceField(
# choices=[
# # ('registry.opnote', 'Op notes'),
# ('registry.pathologyreport', 'Pathology reports')
# ],
# required=False,
# # label=_("Search In"),
# widget=forms.CheckboxSelectMultiple,
# )

View file

View file

@ -0,0 +1,29 @@
from django import template
from pyquery import PyQuery
register = template.Library()
@register.filter
def patho_short(html):
doc = PyQuery(html)
report_text = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_TextBox2').text().strip()
if not report_text:
# report_text = doc('#ContentContainer').text().strip()
# report_text = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay').text().strip()
# report_text = doc(
# '#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(1) > table:nth-child(1)'
# ).text().strip()
report_text = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_lblResult').text().strip()
return report_text
@register.filter
def patho_long(html):
doc = PyQuery(html)
report_text = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay').text().strip()
return report_text
@register.filter
def DOB(html):
doc = PyQuery(html)
report_text = doc('.patientInfo > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(6)').text().strip()
return report_text

View file

@ -8,6 +8,7 @@ import re
from django.contrib.auth import * from django.contrib.auth import *
from django.contrib.auth.decorators import * from django.contrib.auth.decorators import *
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core import serializers from django.core import serializers
from django.http import * from django.http import *
@ -22,6 +23,7 @@ from categories.models import *
from dateutil.relativedelta import * from dateutil.relativedelta import *
from excel_response import ExcelResponse from excel_response import ExcelResponse
from haystack.generic_views import SearchView
from haystack.inputs import AutoQuery, Raw from haystack.inputs import AutoQuery, Raw
from haystack.query import SearchQuerySet, SQ from haystack.query import SearchQuerySet, SQ
@ -30,6 +32,8 @@ from pyquery import PyQuery
from ntuh import settings from ntuh import settings
from registry.models import * from registry.models import *
from .forms import *
from .utils import RenewSchedule from .utils import RenewSchedule
#from multiuploader.models import * #from multiuploader.models import *
@ -171,13 +175,29 @@ def op_note(request, PatChartNo, date):
return HttpResponse() return HttpResponse()
@login_required @login_required
def patho_report(request, PatChartNo, date): def patho_report2(request, PatChartNo, date):
for patho in PathologyReport.objects.filter(ChartNo = PatChartNo).order_by('-SpecimenGetDate'): for patho in PathologyReport.objects.filter(ChartNo = PatChartNo).order_by('-ReportDate'):
print(patho.ReportDate, date)
if patho.ReportDate.strftime("%Y-%m-%d") == date:
matches = re.findall('(<table id="rReportTab.*?</table>)', patho.html, re.DOTALL) matches = re.findall('(<table id="rReportTab.*?</table>)', patho.html, re.DOTALL)
return HttpResponse(matches[0]) return HttpResponse(matches[0])
return HttpResponse() return HttpResponse()
@login_required
def patho_report(request, PathCode):
for patho in PathologyReport.objects.filter(PathCode = PathCode).order_by('-ReportDate'):
# matches = re.findall('(<table id="rReportTab.*?</table>)', patho.html, re.DOTALL)
# matches = re.findall('(<table id="rReportTab.*?</table>)', patho.html, re.DOTALL)
# return HttpResponse(matches[0])
doc = PyQuery(patho.html)
html = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay').outerHtml().strip()
# with open('rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay.txt', 'w') as f:
# f.write(html)
return HttpResponse(html)
return HttpResponse()
#@login_required #@login_required
#def op_images(request, PatChartNo, date): #def op_images(request, PatChartNo, date):
@ -934,6 +954,19 @@ def patho_html2text(html):
report_text = doc('#ContentContainer').text().strip() report_text = doc('#ContentContainer').text().strip()
return report_text return report_text
def patho_long(html):
doc = PyQuery(html)
report_text = doc('#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay').text().strip()
return report_text
def patho_info(html):
doc = PyQuery(html)
return {
'long': doc('#rReportTab_lsvReportBody_ctrl0_ctl00_tblDisplay').text().strip(),
'DOB': doc('.patientInfo > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(6)').text().strip(),
}
# using haystack # using haystack
@login_required @login_required
def patho_search(request): def patho_search(request):
@ -1502,3 +1535,47 @@ def Default_Dr(request, ChartNo):
return HttpResponse(data) return HttpResponse(data)
return HttpResponse('Only POST accepted') return HttpResponse('Only POST accepted')
class PathologyReportSearchView(LoginRequiredMixin, SearchView):
template_name = 'registry/pathology_search.html'
# queryset = SearchQuerySet().filter(author='john')
# form_class = PathologyReportForm
results_per_page = 25
def get_queryset(self):
form = PathologyReportForm(self.request.GET or None) # Use GET for filter forms
sqs = SearchQuerySet().models(PathologyReport)
queryset = None
if form.is_valid():
filter_value = form.cleaned_data.get('q')
if filter_value:
queryset = sqs.filter(text=Raw(filter_value)).order_by('-ReportDate')
return queryset
def render_to_response(self, context, **response_kwargs):
if self.request.GET.get('search_xls', None):
obj2 = context['page_obj'].paginator.object_list
data = [['ChartNo', 'ReportKey', 'ReportCode',
# 'PersonID',
'DOB', 'PathCode', 'SpecimenGetDate', 'ReportDate', 'url', 'Report']]
for r1 in obj2:
r = r1.object
p1 = patho_info(r.html)
r2 = [r.ChartNo, r.ReportKey, r.ReportCode,
# r.PersonID,
p1['DOB'], r.PathCode, r.SpecimenGetDate, r.ReportDate, r.url, p1['long']]
data.append(r2)
return ExcelResponse(data,
# auto_adjust_width=False
)
return super().render_to_response(context, **response_kwargs)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 126 KiB

View file

@ -113,7 +113,8 @@
<li role="presentation"><a href="/registry/op_month/">月報</a></li> <li role="presentation"><a href="/registry/op_month/">月報</a></li>
<li role="presentation"><a href="/registry/op_year">年報</a></li> <li role="presentation"><a href="/registry/op_year">年報</a></li>
<li role="presentation"><a href="/registry/op_search">手術搜尋</a></li> <li role="presentation"><a href="/registry/op_search">手術搜尋</a></li>
<li role="presentation"><a href="/registry/patho_search">病理搜尋</a></li> <!-- <li role="presentation"><a href="/registry/patho_search">病理搜尋</a></li> -->
<li role="presentation"><a href="{% url 'pathology_search' %}">病理搜尋</a></li>
<li role="presentation"><a href="/registry/op_charge">緊急到院處理費</a></li> <li role="presentation"><a href="/registry/op_charge">緊急到院處理費</a></li>
<li role="presentation"><a href="/changelog">更新日誌</a></li> <li role="presentation"><a href="/changelog">更新日誌</a></li>
<li role="presentation"><a href="/accounts/logout/?next=/">Logout</a></li> <li role="presentation"><a href="/accounts/logout/?next=/">Logout</a></li>

View file

@ -143,7 +143,7 @@
<tr style="background-color:#C0C0FF;"> <tr style="background-color:#C0C0FF;">
<th>counter</th> <th>counter</th>
<th>病歷號</th> <th>病歷號</th>
<th>ReportKey</th> <!-- <th>ReportKey</th> -->
<!-- <th>ReportCode</td> --> <!-- <th>ReportCode</td> -->
<th>PersonID</th> <th>PersonID</th>
<th>病理號</th> <th>病理號</th>
@ -158,9 +158,9 @@
<tr> <tr>
<td>{{forloop.counter}}</td> <td>{{forloop.counter}}</td>
<td>{{report.ChartNo}}</td> <td>{{report.ChartNo}}</td>
<td>{{report.ReportKey|slice:"-8:"}}</td> <!-- <td>{{report.ReportKey|slice:"-8:"}}</td> -->
<!-- <td>{{report.ReportCode}}</td> --> <!-- <td>{{report.ReportCode}}</td> -->
<td>{{report.PersonID}}</td> <td>{{report.PersonID}} {{report.html|DOB}}</td>
<td>{{report.PathCode}}</td> <td>{{report.PathCode}}</td>
<td>{{report.SpecimenGetDate|date:"Y-m-d"}}</td> <td>{{report.SpecimenGetDate|date:"Y-m-d"}}</td>
<td>{{report.ReportDate|date:"Y-m-d"}}</td> <td>{{report.ReportDate|date:"Y-m-d"}}</td>

View file

@ -0,0 +1,183 @@
{% extends 'base.html' %}
{% load pathology %}
{% block head %}
<script type="text/javascript">
function showUrlInDialogx(url, options){
options = options || {};
var tag = $("<div></div>"); //This tag will the hold the dialog content.
$.ajax({
url: url,
type: (options.type || 'GET'),
beforeSend: options.beforeSend,
error: options.error,
complete: options.complete,
success: function(data, textStatus, jqXHR) {
if(typeof data == "object" && data.html) { //response is assumed to be JSON
tag.html(data.html).dialog({modal: options.modal, title: data.title}).dialog('open');
} else { //response is assumed to be HTML
tag.html(data).dialog({modal: options.modal, title: options.title}).dialog('open');
}
$.isFunction(options.success) && (options.success)(data, textStatus, jqXHR);
}
});
}
function showUrlInDialog(url){
var tag = $("<div></div>");
$.ajax({
url: url,
success: function(data) {
tag.html(data).dialog({
dialogClass: "alert",
modal: true,
show: "slide",
width: 640,
open: function(){
$("body").css("overflow", "hidden");
},
close: function(){
$("body").css("overflow", "auto");
},
}).dialog('open');
}
});
}
document.addEventListener('DOMContentLoaded', function() {
// Your code here will execute once the DOM is ready
// document.getElementById('id_models').style.display = 'none';
document.getElementById("id_models").innerHTML = "<label>Pathology reports</label>";
});
</script>
{% endblock %}
{% block logo %}
<h1><a href="#">{{specialty}} 病理報告搜尋</a></h1>
{% endblock %}
{% block content %}
<h2>Search</h2>
<div id="accordion">
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-primary" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Query tips!
</button>
<a href="https://whoosh.readthedocs.io/en/latest/querylang.html" target="_blank">query language</a>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<table class="table table-sm">
<tr><td>單一關鍵字(非100%精確)</td><td>e.g. meningioma, metastatic, schwannoma</td><td>"malignant meningioma"</td></tr>
<tr><td>含任一關鍵字</td><td>metastases OR metastasis OR metastatic</td><td>SSTR2a OR EMA</td></tr>
<tr><td>含所有關鍵字</td><td>meningioma malignancy</td><td>meningioma AND malignancy</td></tr>
<tr><td>排除關鍵字(慎用)</td><td>meningioma NOT atypical NOT malignancy</td><td>meningioma NOT (atypical OR malignancy)</td></tr>
<tr><td>萬用字元(慢)</td><td>metasta*</td><td>metastas?s</td></tr>
</table>
</div>
</div>
</div>
</div>
<form method="get" action=".">
<table>
{{ form.as_table }}
<tr>
<td>&nbsp;</td>
<td>
<!-- <input type="submit" value="Search"> -->
<input class="btn btn-primary" type="submit" id="search_submit" name="search_submit" value="Search" />
<input class="btn btn-success" type="submit" id="search_xls" name="search_xls" value="匯出 Excel 2007-2013 XML 工作簿" />
</td>
</tr>
</table>
{% if query %}
<h3>Results - {{page_obj.paginator.count}} Page: {{page_obj.number}}/{{page_obj.paginator.num_pages}}</h3>
{% with page=page_obj %}
{% if page.has_previous or page.has_next %}
<nav aria-label="Page navigation example">
<ul class="pagination">
{% if page.has_previous %}
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page=1">First</a></li>
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page.previous_page_number }}">Previous</a></li>
{% endif %}
<li class="page-item"><a class="page-link">{{page_obj.number}}</a></li>
{% if page.has_next %}
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Next</a></li>
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page_obj.paginator.num_pages }}">Last({{ page_obj.paginator.num_pages }})</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
<table class="table">
<thead>
<tr>
<th>病歷號</th>
<!-- <th>ReportKey</th> -->
<!-- <th>ReportCode</th> -->
<!-- <th>PersonID</th> -->
<th>生日</th>
<th>病理號</th>
<th>收件日</th>
<th>報告日</th>
<th>html</th>
</tr>
</thead>
<tbody>
{% for result in page.object_list %}
<tr>
<td>{{ result.object.ChartNo }}</td>
<!-- <td>{{ result.object.ReportKey }}</td> -->
<!-- <td>{{ result.object.ReportCode }}</td> -->
<!-- <td>{{ r.object.PersonID }}</td> -->
<td>{{ result.object.html|DOB }}</td>
<td>{{ result.object.PathCode }}</td>
<td>{{ result.object.SpecimenGetDate|date:"Y-m-d" }}</td>
<td>{{ result.object.ReportDate|date:"Y-m-d" }}</td>
<!-- <td>{{ result.object.url }}</td> -->
<td>
<a href="#" title='{{result.object.html|patho_long}}' onclick="showUrlInDialog('/registry/patho_report/{{result.object.PathCode}}/'); return false;">{{result.object.html|patho_short|truncatewords:20}}</a>
</td>
</tr>
{% empty %}
<p>No results found.</p>
{% endfor %}
</tbody>
</table>
{% if page.has_previous or page.has_next %}
<nav aria-label="Page navigation example">
<ul class="pagination">
{% if page.has_previous %}
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page=1">First</a></li>
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page.previous_page_number }}">Previous</a></li>
{% endif %}
<li class="page-item"><a class="page-link">{{page_obj.number}}</a></li>
{% if page.has_next %}
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page.next_page_number }}">Next</a></li>
<li class="page-item"><a class="page-link" href="?q={{ query }}&amp;page={{ page_obj.paginator.num_pages }}">Last({{ page_obj.paginator.num_pages }})</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endwith %}
{% else %}
{# Show some example queries to run, maybe query syntax, something else? #}
{% endif %}
</form>
{% endblock %}