dossiers: add new feature waiting queue (fixes #3111).
This commit is contained in:
parent
8c58c98a91
commit
c5f8a9198c
|
@ -51,7 +51,8 @@
|
|||
</div>
|
||||
<br>
|
||||
<div>
|
||||
<a href="quotations">Page des quotations</a>
|
||||
<a href="quotations">Page des quotations</a><br/>
|
||||
<a href="waiting-queue">Liste d'attente</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
{% extends "dossiers/base.html" %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>Dossiers sur liste d'attente{% if len_patient_records %} : {{ len_patient_records }}{% endif %}</h2>
|
||||
<a href=".">Retourner aux dossiers</a>
|
||||
<button id='print-button'>Imprimer</button>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="sidebar">
|
||||
<div>
|
||||
<form>
|
||||
<h3>Rechercher dans les dossiers</h3>
|
||||
<label>Nom <input name="last_name" type="text" value="{{ request.GET.last_name }}" class="focus"></label>
|
||||
<label>Prénom <input name="first_name" type="text" value="{{ request.GET.first_name }}"></label>
|
||||
<label>Numéro de dossier papier <input name="paper_id" type="text" value="{{ request.GET.paper_id }}"></label>
|
||||
<label>Numéro de dossier inform. <input name="id" type="text" value="{{ request.GET.id }}"></label>
|
||||
<label>Numéro d'assuré social <input name="social_security_id" value="{{ request.GET.social_security_id }}" type="text"></label>
|
||||
{% if request.GET %}
|
||||
<div class="search-reset">
|
||||
<button id="search">Rechercher</button>
|
||||
<button id="reset" class="icon-remove-sign" title="Réinitialiser"></button>
|
||||
</div>
|
||||
{% else %}
|
||||
<button id="search">Rechercher</button>
|
||||
{% endif %}
|
||||
<p id="search-results" style="display: none; "></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<table id="dossiers" class="main">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">N° dossier
|
||||
</th><th rowspan="2">Nom</th>
|
||||
<th rowspan="2">Prénom</th>
|
||||
<th rowspan="2">Position</th>
|
||||
<th rowspan="2">Date d'accueil</th>
|
||||
<th rowspan="2">Commentaire</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>papier</th>
|
||||
<th>inform.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% for patient_record in patient_records %}
|
||||
<tr style="display: table-row;" class="pr-line {{ patient_record.state_class }}" data-link="{{ patient_record.object.id }}/view">
|
||||
<td>{{ patient_record.object.paper_id|default_if_none:"" }}</td>
|
||||
<td>{{ patient_record.object.id }}</td>
|
||||
<td><span class="lastname">{{ patient_record.object.last_name }}</span></td>
|
||||
<td>{{ patient_record.object.first_name }}</td>
|
||||
<td>{{ patient_record.position }}</td>
|
||||
<td>{{ patient_record.object.last_state.date_selected|date:"SHORT_DATE_FORMAT" }}</td>
|
||||
<td>{{ patient_record.object.last_state.comment|default_if_none:"" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="pagination">
|
||||
<span class="step-links">
|
||||
{% if paginate_patient_records.has_previous %}
|
||||
<a href="?{{ query }}&page={{ paginate_patient_records.previous_page_number }}">««</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current">
|
||||
page {{ paginate_patient_records.number }} de {{ paginate_patient_records.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if paginate_patient_records.has_next %}
|
||||
<a href="?{{ query }}&page={{ paginate_patient_records.next_page_number }}">»»</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% if request.GET and not patient_records %}
|
||||
<div>Pas de résultat pour votre recherche</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -29,6 +29,7 @@ from views import (patientrecord_home, patient_record, state_form,
|
|||
delete_mdph_response,
|
||||
generate_rtf_form,
|
||||
patientrecord_quotations,
|
||||
patientrecord_waiting_queue,
|
||||
create_directory,
|
||||
prescription_transport)
|
||||
from forms import EditPatientRecordForm
|
||||
|
@ -36,6 +37,7 @@ from forms import EditPatientRecordForm
|
|||
urlpatterns = patterns('',
|
||||
url(r'^$', patientrecord_home),
|
||||
url(r'^quotations$', patientrecord_quotations),
|
||||
url(r'^waiting-queue$', patientrecord_waiting_queue),
|
||||
url(r'^new$', new_patient_record),
|
||||
url(r'^(?P<pk>\d+)/view$', patient_record),
|
||||
url(r'^(?P<pk>\d+)/delete$', patientrecord_delete),
|
||||
|
|
|
@ -932,6 +932,86 @@ class PatientRecordsQuotationsView(cbv.ListView):
|
|||
|
||||
patientrecord_quotations = PatientRecordsQuotationsView.as_view()
|
||||
|
||||
class PatientRecordsWaitingQueueView(cbv.ListView):
|
||||
model = PatientRecord
|
||||
template_name = 'dossiers/waiting_queue.html'
|
||||
|
||||
def _get_search_result(self, paginate_patient_records,
|
||||
all_patient_records):
|
||||
patient_records = []
|
||||
if paginate_patient_records:
|
||||
first = paginate_patient_records[0]
|
||||
position = 1
|
||||
while first.id != all_patient_records[position - 1].id:
|
||||
position += 1
|
||||
for patient_record in paginate_patient_records:
|
||||
while patient_record.id != all_patient_records[position - 1].id:
|
||||
position += 1
|
||||
patient_records.append(
|
||||
{
|
||||
'object': patient_record,
|
||||
'position': position,
|
||||
}
|
||||
)
|
||||
return patient_records
|
||||
|
||||
def get_queryset(self):
|
||||
form = forms.QuotationsForm(data=self.request.GET or None)
|
||||
qs = super(PatientRecordsWaitingQueueView, self).get_queryset()
|
||||
first_name = self.request.GET.get('first_name')
|
||||
last_name = self.request.GET.get('last_name')
|
||||
paper_id = self.request.GET.get('paper_id')
|
||||
id = self.request.GET.get('id')
|
||||
social_security_id = self.request.GET.get('social_security_id')
|
||||
qs = qs.filter(service=self.service,
|
||||
last_state__status__type='ACCUEIL')
|
||||
if last_name:
|
||||
qs = qs.filter(last_name__istartswith=last_name)
|
||||
if first_name:
|
||||
qs = qs.filter(first_name__istartswith=first_name)
|
||||
if paper_id:
|
||||
qs = qs.filter(paper_id__startswith=paper_id)
|
||||
if id:
|
||||
qs = qs.filter(id__startswith=id)
|
||||
if social_security_id:
|
||||
qs = qs.filter(models.Q(
|
||||
social_security_id__startswith=social_security_id)
|
||||
| models.Q(
|
||||
contacts__social_security_id__startswith=social_security_id))
|
||||
qs = qs.order_by('last_state__date_selected', 'created')
|
||||
return qs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super(PatientRecordsWaitingQueueView, self).get_context_data(**kwargs)
|
||||
ctx['search_form'] = forms.QuotationsForm(data=self.request.GET or None,
|
||||
service=self.service)
|
||||
patient_records = []
|
||||
page = self.request.GET.get('page')
|
||||
paginator = Paginator(ctx['object_list'].filter(), 50)
|
||||
try:
|
||||
paginate_patient_records = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
paginate_patient_records = paginator.page(1)
|
||||
except EmptyPage:
|
||||
paginate_patient_records = paginator.page(paginator.num_pages)
|
||||
|
||||
all_patient_records = PatientRecord.objects.filter(
|
||||
service=self.service,
|
||||
last_state__status__type='ACCUEIL').order_by(
|
||||
'last_state__date_selected', 'created')
|
||||
ctx['patient_records'] = self._get_search_result(
|
||||
paginate_patient_records, all_patient_records)
|
||||
ctx['paginate_patient_records'] = paginate_patient_records
|
||||
ctx['len_patient_records'] = all_patient_records.count()
|
||||
|
||||
query = self.request.GET.copy()
|
||||
if 'page' in query:
|
||||
del query['page']
|
||||
ctx['query'] = query.urlencode()
|
||||
|
||||
return ctx
|
||||
|
||||
patientrecord_waiting_queue = PatientRecordsWaitingQueueView.as_view()
|
||||
|
||||
class CreateDirectoryView(View, cbv.ServiceViewMixin):
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
|
Reference in New Issue