Revision 584b363f
Added by Mikaël Ates almost 11 years ago
calebasse/dossiers/templates/dossiers/patientrecord_tab1.html | ||
---|---|---|
67 | 67 |
</li> |
68 | 68 |
</ul> |
69 | 69 |
<div class="etat"> |
70 |
{% if future_state %} |
|
71 |
<h4>État à venir du dossier : {{ current_state.status.name.lower }}</h4> |
|
72 |
<p>à partir du : {{ current_state.date_selected|date:"d/m/Y" }}</p> |
|
73 |
{% else %} |
|
70 | 74 |
<h4>État courant du dossier : {{ current_state.status.name.lower }}</h4> |
71 | 75 |
<p>depuis le : {{ current_state.date_selected|date:"d/m/Y" }}</p> |
76 |
{% endif %} |
|
72 | 77 |
{% if current_state.comment %}<p><label>Commentaire :</label> {{ current_state.comment }}</p>{% endif %} |
73 | 78 |
{% for state in status %} |
74 | 79 |
<button type="button" id="{{ state.0 }}">{{ state.1 }}</button> |
calebasse/dossiers/views.py | ||
---|---|---|
272 | 272 |
ctx['object'].automated_switch_state(self.request.user) |
273 | 273 |
ctx['initial_state'] = ctx['object'].get_initial_state() |
274 | 274 |
current_state = ctx['object'].get_current_state() |
275 |
if not current_state: |
|
276 |
current_state = ctx['object'].get_state() |
|
277 |
ctx['future_state'] = True |
|
275 | 278 |
if STATES_MAPPING.has_key(current_state.status.type): |
276 | 279 |
state = STATES_MAPPING[current_state.status.type] |
277 | 280 |
else: |
... | ... | |
881 | 884 |
def _get_search_result(self, paginate_patient_records): |
882 | 885 |
patient_records = [] |
883 | 886 |
for patient_record in paginate_patient_records: |
884 |
current_state = patient_record.get_current_state() |
|
887 |
current_state = patient_record.get_current_state() or patient_record.get_state()
|
|
885 | 888 |
state = current_state.status.name |
886 | 889 |
state_class = current_state.status.type.lower() |
887 | 890 |
patient_records.append( |
calebasse/statistics/statistics.py | ||
---|---|---|
1221 | 1221 |
data.append(["Etat du dossier à ce jour (%s)" % formats.date_format(datetime.today(), "SHORT_DATE_FORMAT"), 'Nombre de patients']) |
1222 | 1222 |
states = dict() |
1223 | 1223 |
for patient in patients: |
1224 |
states.setdefault(patient.get_current_state().status, []).append(patient) |
|
1224 |
current_state = patient.get_current_state() |
|
1225 |
state = "Indéfini" |
|
1226 |
if current_state: |
|
1227 |
state = current_state.status.name |
|
1228 |
states.setdefault(state, []).append(patient) |
|
1225 | 1229 |
values = [] |
1226 | 1230 |
for state, ps in states.iteritems(): |
1227 |
values.append((state.name, len(ps)))
|
|
1231 |
values.append((state, len(ps))) |
|
1228 | 1232 |
data.append(values) |
1229 | 1233 |
data_tables.append(data) |
1230 | 1234 |
|
Also available in: Unified diff
There may be no current state, we have to handle it (fixes #4532).