Revision 748e8d64
Added by Serghei Mihai over 9 years ago
calebasse/dossiers/templates/dossiers/quotations.html | ||
---|---|---|
52 | 52 |
<th colspan="2">N° dossier |
53 | 53 |
</th><th rowspan="2">Nom</th> |
54 | 54 |
<th rowspan="2">Prénom</th> |
55 |
<th rowspan="2">Date de naissance</th> |
|
55 | 56 |
<th rowspan="2">État du dossier</th> |
56 |
<th rowspan="2">Mises 1</th>
|
|
57 |
<th rowspan="2">Mises 2</th>
|
|
58 |
<th rowspan="2">Mises 3</th>
|
|
57 |
<th rowspan="2">Date du prochain rendez-vou</th>
|
|
58 |
<th rowspan="2">Date du dernier rendez-vous</th>
|
|
59 |
<th rowspan="2">Mises</th> |
|
59 | 60 |
<th rowspan="2">ANAP</th> |
60 | 61 |
</tr> |
61 | 62 |
<tr> |
... | ... | |
71 | 72 |
<td>{{ patient_record.object.id }}</td> |
72 | 73 |
<td><span class="lastname">{{ patient_record.object.last_name }}</span></td> |
73 | 74 |
<td>{{ patient_record.object.first_name }}</td> |
75 |
<td>{{ patient_record.object.birthdate|date:"SHORT_DATE_FORMAT" }}</td> |
|
74 | 76 |
<td class="{{ patient_record.state_class }}">{{ patient_record.state }}</td> |
75 |
<td>{% for mise in patient_record.object.mises_1.all %}{{ mise }}<br/>{% endfor %}</td> |
|
76 |
<td>{% for mise in patient_record.object.mises_2.all %}{{ mise }}<br/>{% endfor %}</td> |
|
77 |
<td>{% for mise in patient_record.object.mises_3.all %}{{ mise }}<br/>{% endfor %}</td> |
|
77 |
<td>{% if patient_record.next_rdv_date %} |
|
78 |
{{ patient_record.next_rdv_date|date:"DATETIME_FORMAT" }} |
|
79 |
{% endif %} |
|
80 |
</td> |
|
81 |
<td>{% if patient_record.last_rdv_date %} |
|
82 |
{{ patient_record.last_rdv_date|date:"DATETIME_FORMAT" }} |
|
83 |
{% endif %}</td> |
|
84 |
<td>{% if patient_record.mises %}<span class="icon-ok"></span>{% endif %}</td> |
|
78 | 85 |
<td>{% if patient_record.anap %}<span class="icon-ok"></span>{% endif %}</td> |
79 | 86 |
</tr> |
80 | 87 |
{% endfor %} |
calebasse/dossiers/views.py | ||
---|---|---|
843 | 843 |
deficiencies = [getattr(patient_record, field) \ |
844 | 844 |
for field in self.deficience_fields] |
845 | 845 |
anap = reduce(lambda f1, f2: f1 or f2, deficiencies) |
846 |
mises = reduce(lambda m1, m2: m1+m2, [list(getattr(patient_record, field).all()) for field in self.mises_fields]) |
|
847 |
next_rdv = get_next_rdv(patient_record) |
|
848 |
last_rdv = get_last_rdv(patient_record) |
|
849 |
|
|
850 |
if next_rdv: |
|
851 |
next_rdv_datetime = next_rdv.start_datetime |
|
852 |
else: |
|
853 |
next_rdv_datetime = None |
|
854 |
if last_rdv: |
|
855 |
last_rdv_datetime = last_rdv['start_datetime'] |
|
856 |
else: |
|
857 |
last_rdv_datetime = None |
|
846 | 858 |
patient_records.append( |
847 | 859 |
{ |
848 | 860 |
'object': patient_record, |
849 | 861 |
'state': state, |
850 | 862 |
'state_class': state_class, |
851 |
'anap': anap |
|
863 |
'anap': anap, |
|
864 |
'mises': mises, |
|
865 |
'next_rdv_date': next_rdv_datetime, |
|
866 |
'last_rdv_date': last_rdv_datetime |
|
852 | 867 |
} |
853 | 868 |
) |
854 | 869 |
return patient_records |
... | ... | |
856 | 871 |
def get_queryset(self): |
857 | 872 |
form = forms.QuotationsForm(data=self.request.GET or None) |
858 | 873 |
qs = super(PatientRecordsQuotationsView, self).get_queryset() |
859 |
self.deficience_fields = [field for field in self.model._meta.get_all_field_names() if field.startswith('deficiency_')] |
|
874 |
all_field_names = self.model._meta.get_all_field_names() |
|
875 |
self.deficience_fields = [field for field in all_field_names if field.startswith('deficiency_')] |
|
876 |
self.mises_fields = [field for field in all_field_names if field.startswith('mises_')] |
|
860 | 877 |
|
861 | 878 |
without_quotations = self.request.GET.get('without_quotations') |
862 | 879 |
without_anap_quotations = self.request.GET.get('without_anap_quotations') |
863 | 880 |
if without_quotations: |
864 |
qs = qs.filter(mises_1__isnull=True).filter(mises_2__isnull=True).filter(mises_3__isnull=True) |
|
881 |
for field in self.mises_fields: |
|
882 |
mise_field = {'%s__isnull' % field: True} |
|
883 |
qs = qs.filter(**mise_field) |
|
865 | 884 |
|
866 | 885 |
if without_anap_quotations: |
867 | 886 |
for field in self.deficience_fields: |
Also available in: Unified diff
dossiers: quotations table refactored
Closes #5013