Project

General

Profile

« Previous | Next » 

Revision 0bb70851

Added by Mikaël Ates almost 12 years ago

dossiers: warn user when closing a patient record with future appointments.

View differences:

calebasse/dossiers/states.py
37 37
        'DIAGNOSTIC': ('diagnostic-patientrecord', 'En diagnostic'),
38 38
        'TRAITEMENT': ('traitement-patientrecord', 'En traitement'),
39 39
        'CLOS': ('close-patientrecord', 'Clore'),
40
        'CLOS_RDV': ('close-rdv-patientrecord', 'Clore'),
40 41
        'BILAN': ('bilan-patientrecord', 'En bilan'),
41 42
        'SURVEILLANCE': ('surveillance-patientrecord', 'En surveillance'),
42 43
        'SUIVI': ('suivi-patientrecord', 'En suivi'),
......
91 92

  
92 93
#STATES_MAPPING = dict(CMPP_STATES, **CAMSP_STATES)
93 94
#STATES_MAPPING = dict(STATES_MAPPING, **SESSAD_STATES)
94

  
calebasse/dossiers/templates/dossiers/state.html
2 2

  
3 3
<form action="{{ request.get_full_path }}" method="post">
4 4
  {% csrf_token %}
5
   <p class="message"/>
5 6
   <p>
6 7
   <label for="id_date">Date :</label>
7 8
   {{ form.date.errors }}
calebasse/dossiers/views.py
328 328
            ctx['missing_birthdate'] = True
329 329

  
330 330
        ctx['status'] = []
331
        close_btn = STATES_BTN_MAPPER['CLOS']
332
        if 'next_rdv' in ctx:
333
            close_btn = STATES_BTN_MAPPER['CLOS_RDV']
331 334
        if ctx['object'].service.name == "CMPP":
332 335
            ctx['can_rediag'] = self.object.create_diag_healthcare(self.request.user)
333 336
            status = self.object.get_healthcare_status()
......
374 377
            elif ctx['object'].last_state.status.type == "DIAGNOSTIC":
375 378
                # Passage automatique en traitement
376 379
                ctx['status'] = [STATES_BTN_MAPPER['TRAITEMENT'],
377
                        STATES_BTN_MAPPER['CLOS'],
380
                        close_btn,
378 381
                        STATES_BTN_MAPPER['ACCUEIL']]
379 382
            elif ctx['object'].last_state.status.type == "TRAITEMENT":
380 383
                # Passage automatique en diagnostic si on ajoute une prise en charge diagnostic,
381 384
                # ce qui est faisable dans l'onglet prise en charge par un bouton visible sous conditions
382 385
                ctx['status'] = [STATES_BTN_MAPPER['DIAGNOSTIC'],
383
                        STATES_BTN_MAPPER['CLOS'],
386
                        close_btn,
384 387
                        STATES_BTN_MAPPER['ACCUEIL']]
385 388
            elif ctx['object'].last_state.status.type == "CLOS":
386 389
                # Passage automatique en diagnostic ou traitement
......
414 417
                        STATES_BTN_MAPPER['BILAN'],
415 418
                        STATES_BTN_MAPPER['SURVEILLANCE'],
416 419
                        STATES_BTN_MAPPER['SUIVI'],
417
                        STATES_BTN_MAPPER['CLOS']]
420
                        close_btn]
418 421
            elif ctx['object'].last_state.status.type == "BILAN":
419 422
                ctx['status'] = [STATES_BTN_MAPPER['SURVEILLANCE'],
420 423
                        STATES_BTN_MAPPER['SUIVI'],
421
                        STATES_BTN_MAPPER['CLOS'],
424
                        close_btn,
422 425
                        STATES_BTN_MAPPER['ACCUEIL']]
423 426
            elif ctx['object'].last_state.status.type == "SURVEILLANCE":
424 427
                ctx['status'] = [STATES_BTN_MAPPER['SUIVI'],
425
                        STATES_BTN_MAPPER['CLOS'],
428
                        close_btn,
426 429
                        STATES_BTN_MAPPER['ACCUEIL'],
427 430
                        STATES_BTN_MAPPER['BILAN']]
428 431
            elif ctx['object'].last_state.status.type == "SUIVI":
429
                ctx['status'] = [STATES_BTN_MAPPER['CLOS'],
432
                ctx['status'] = [close_btn,
430 433
                        STATES_BTN_MAPPER['ACCUEIL'],
431 434
                        STATES_BTN_MAPPER['BILAN'],
432 435
                        STATES_BTN_MAPPER['SURVEILLANCE']]
......
442 445
            elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
443 446
                ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
444 447
                        STATES_BTN_MAPPER['TRAITEMENT'],
445
                        STATES_BTN_MAPPER['CLOS']]
448
                        close_btn]
446 449
            elif ctx['object'].last_state.status.type == "TRAITEMENT":
447
                ctx['status'] = [STATES_BTN_MAPPER['CLOS'],
450
                ctx['status'] = [close_btn,
448 451
                        STATES_BTN_MAPPER['ACCUEIL']]
449 452
            elif ctx['object'].last_state.status.type == "CLOS":
450 453
                ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
calebasse/static/js/calebasse.dossiers.js
26 26
                        window.location.reload(true);
27 27
                    }
28 28
                }
29
                if (state_type == 'CLOS_RDV') {
30
                  var message = $('p.message')
31
                  message.append($('<span id="highlight">Attention ce patient a encore des rendez-vous de planifiés !</span>'));
32
                  state_type = 'CLOS';
33
                }
29 34
                $('input.date', this).datepicker({dateFormat: 'd/m/yy', showOn: 'button' });
30 35
                $('form', this).ajaxForm({
31 36
                    success: onsuccess,
......
78 83
    $('#close-patientrecord').click(function() {
79 84
        state_dialog('update-state', 'Clore', 'CLOS');
80 85
    });
86
    $('#close-rdv-patientrecord').click(function() {
87
        state_dialog('update-state', 'Clore', 'CLOS_RDV');
88
    });
81 89
    $('#reopen-patientrecord').click(function() {
82 90
        state_dialog('update-state', 'Réaccueil', 'ACCUEIL');
83 91
    });

Also available in: Unified diff