Project

General

Profile

« Previous | Next » 

Revision e24683bd

Added by Jérôme Schneider about 13 years ago

dossiers: add last and next rdv

View differences:

calebasse/dossiers/templates/dossiers/patientrecord_update.html
</div>
<div class="right">
<ul>
<li><label>Dernier acte :</label> 28/06/2012 - T - absence excusée</li>
<li><label>Prochain rendez-vous :</label> 18/08/2012 - Roudon - mini synthèse.</li>
<li><label>Dernier acte :</label>
{% if last_rdv %}
{{ last_rdv.start_datetime|date:"d/m/Y" }} -
{% for participant in last_rdv.participants %}
{{ participant.last_name }} -
{% endfor %}
{{ last_rdv.act_type }}
{% endif %}
</li>
<li><label>Prochain rendez-vous :</label>
{% if next_rdv %}
{{ next_rdv.start_datetime|date:"d/m/Y" }} -
{% for participant in next_rdv.participants %}
{{ participant.next_name }} -
{% endfor %}
{{ next_rdv.act_type }}
{% endif %}
</li>
</ul>
<div class="etat">
<h4>État du dossier : {{ object.last_state.status.name.lower }}</h4>
calebasse/dossiers/views.py
from calebasse.dossiers.states import STATES_MAPPING, STATE_CHOICES_TYPE
def get_next_rdv(patient_record):
next_rdv = {}
occurrence = Occurrence.objects.next_appoinment(patient_record)
if occurrence:
next_rdv['start_datetime'] = occurrence.start_time
next_rdv['participants'] = occurrence.event.participants.all()
next_rdv['act_type'] = occurrence.event.eventact.act_type
return next_rdv
def get_last_rdv(patient_record):
last_rdv = {}
occurrence = Occurrence.objects.last_appoinment(patient_record)
if occurrence:
last_rdv['start_datetime'] = occurrence.start_time
last_rdv['participants'] = occurrence.event.participants.all()
last_rdv['act_type'] = occurrence.event.eventact.act_type
return last_rdv
class PatientRecordView(MultiUpdateView):
"""
"""
......
def get_context_data(self, **kwargs):
ctx = super(PatientRecordView, self).get_context_data(**kwargs)
ctx['next_rdv'] = get_next_rdv(ctx['object'])
ctx['last_rdv'] = get_last_rdv(ctx['object'])
return ctx
patient_record = PatientRecordView.as_view()
......
if self.request.GET:
for patient_record in ctx['object_list'].filter():
ctx['stats']['dossiers'] += 1
next_rdv = {}
occurrence = Occurrence.objects.next_appoinment(patient_record)
if occurrence:
next_rdv['start_datetime'] = occurrence.start_time
next_rdv['participants'] = occurrence.event.participants.all()
next_rdv['act_type'] = occurrence.event.eventact.act_type
occurrence = Occurrence.objects.last_appoinment(patient_record)
last_rdv = {}
if occurrence:
last_rdv['start_datetime'] = occurrence.start_time
last_rdv['participants'] = occurrence.event.participants.all()
last_rdv['act_type'] = occurrence.event.eventact.act_type
occurrence = Occurrence.objects.next_appoinment(patient_record)
next_rdv = get_next_rdv(patient_record)
last_rdv = get_last_rdv(patient_record)
if STATES_MAPPING.has_key(patient_record.last_state.status.type):
state = STATES_MAPPING[patient_record.last_state.status.type]
else:

Also available in: Unified diff