Projet

Général

Profil

0001-dossiers-printing-each-patient-record-tab-with-filte.patch

Serghei Mihai, 31 juillet 2014 18:02

Télécharger (18,5 ko)

Voir les différences:

Subject: [PATCH] dossiers: printing each patient record tab with filtering
 past and future appointments by dates

Closes #3109
 calebasse/dossiers/forms.py                        |  7 +++
 .../dossiers/patientrecord_tab1_general.html       |  9 +++-
 .../dossiers/patientrecord_tab2_fiche_adm.html     |  7 +++
 .../dossiers/patientrecord_tab3_adresses.html      |  7 +++
 .../dossiers/patientrecord_tab4_notifs.html        |  7 +++
 .../dossiers/patientrecord_tab5_actes_passes.html  | 21 +++++++-
 .../dossiers/patientrecord_tab6_next_rdv.html      | 21 +++++++-
 .../dossiers/patientrecord_tab7_socialisation.html |  8 +++
 .../dossiers/patientrecord_tab8_medical.html       |  7 +++
 calebasse/static/css/agenda.css                    |  4 --
 calebasse/static/css/dossiers.css                  | 27 +++++++++-
 calebasse/static/css/print.css                     | 57 +++++++++++++++++++++-
 calebasse/static/css/style.css                     |  7 +++
 calebasse/static/js/calebasse.agenda.js            | 14 ------
 calebasse/static/js/calebasse.dossiers.js          | 40 +++++++++++++++
 calebasse/static/js/common.js                      | 13 +++++
 calebasse/templates/calebasse/base.html            |  1 +
 17 files changed, 234 insertions(+), 23 deletions(-)
 create mode 100644 calebasse/static/js/common.js
calebasse/dossiers/forms.py
398 398
    date_actes_start = forms.DateField(label=u'Date', localize=True)
399 399
    date_actes_end = forms.DateField(label=u'Date', localize=True)
400 400
    without_quotations = forms.BooleanField()
401

  
402
class PatientRecordPrintForm(Form):
403

  
404
    prev_appointment_start_date = forms.DateField(label=u'De', required=False)
405
    prev_appointment_end_date = forms.DateField(label=u'au', required=False)
406
    next_appointment_start_date = forms.DateField(label=u'De', required=False)
407
    next_appointment_end_date = forms.DateField(label=u'au', required=False)
calebasse/dossiers/templates/dossiers/patientrecord_tab1_general.html
1
<button id="patientrecord-print-tab1" class="icon-print right">Imprimer</button>
1 2
<form method="post" action="tab1"  id="general-form" class="patientrecordform">{% csrf_token %}
2 3
<div class="left">
3 4
  <ul>
......
84 85
      {% for state in status %}
85 86
      <button type="button" id="{{ state.0 }}">{{ state.1 }}</button>
86 87
      {% endfor %}
87
      <button type="button" id="patientrecord-history">Historique</button><br/>
88
      <button type="button" id="patientrecord-history">Historique</button>
88 89
      <hr/>
89 90
      <p id="confidential-msg" style="display: none; font-size: 10px;">Confidentialité mise à jour</p>
90 91
      {{ form.confidential.label_tag }} : {{ form.confidential }}
......
114 115
    </form>
115 116
</div>
116 117
<br style="clear:both"/>
118
<script type="text/javascript">
119
    $('#patientrecord-print-tab1').on('click', function(event) {
120
        print_cleanup();
121
        window.print();
122
    });
123
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab2_fiche_adm.html
1 1
{% load dossiers %}
2
<button id="patientrecord-print-tab2" class="icon-print right">Imprimer</button>
2 3
<div id="tabs-2">
3 4
  <form method="post" action="tab2" id="administrative-form" class="patientrecordform">{% csrf_token %}
4 5
    <p><button class="save enable-on-change">Enregistrer</button></p>
......
164 165
    {% endfor %}
165 166
  </div>
166 167
</div>
168
<script type="text/javascript">
169
    $('#patientrecord-print-tab2').on('click', function(event) {
170
        print_cleanup();
171
        window.print();
172
    });
173
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab3_adresses.html
1 1
{% load dossiers %}
2
<button id="patientrecord-print-tab3" class="icon-print right">Imprimer</button>
2 3
<div id="tabs-3">
3 4
  <form method="post" action="tab3" id="policyholder-form" class="patientrecordform">{% csrf_token %}
4 5
    <p>
......
97 98
{% endfor %}
98 99
  </form>
99 100
</div>
101
<script type="text/javascript">
102
    $('#patientrecord-print-tab3').on('click', function(event) {
103
        print_cleanup();
104
        window.print();
105
    });
106
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab4_notifs.html
1
<button id="patientrecord-print-tab4" class="icon-print right">Imprimer</button>
1 2
<div id="tabs-4">
2 3
  {% if object.service.slug == "cmpp" %}
3 4
  <div class="notifs">
......
215 216
    {% endif %}
216 217
    {% endif %}
217 218
  </div>
219
<script type="text/javascript">
220
    $('#patientrecord-print-tab4').on('click', function(event) {
221
        print_cleanup();
222
        window.print();
223
    });
224
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab5_actes_passes.html
1
<div class="print screen-only">
2
  <form class="datepicker filter">
3
    <h5>Filtrer par date</h5>
4
      du <input type="text" name="from" />
5
      au <input type="text" name="to" />
6
  </form>
7
  <button id="patientrecord-print-tab5" class="icon-print">Imprimer</button>
8
</div>
9

  
10
<br class="clear" />
1 11
<div id="tabs-5">
2 12
  {% for state, last_rdvs in history %}
3 13
  <div class="frame">
......
10 20
      <tbody>
11 21
      {% for act, state, missing_workers in last_rdvs %}
12 22
      <tr>
13
        <td>{{ act.date|date:"SHORT_DATE_FORMAT" }} {{ act.time|date:"H:i" }}{% if missing_workers %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
23
        <td><span class="date">{{ act.date|date:"SHORT_DATE_FORMAT" }}</span>
24
          <span class="time">{{ act.time|date:"H:i" }}</span>{% if missing_workers %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
14 25
        <td>{% if state %}{% if act.is_absent %}<strong>{% endif %}{% if state.state_name == 'ACT_DOUBLE' or state.state_name == 'ACT_LOST' %}Présent ({{ state }}){% else %}{{ state }}{% endif %}{% if act.is_absent %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
15 26
        <td>{{ act.act_type }}</td>
16 27
        <td class="width-limited">{% for doctor in act.doctors.all %}
......
27 38
  </div>
28 39
  {% endfor %}
29 40
</div>
41
<script type="text/javascript">
42
    init_datepickers();
43
    $('#patientrecord-print-tab5').on('click', function(event) {
44
        filter_date_bounds('.frame td span.date');
45
        print_cleanup();
46
        window.print();
47
    });
48
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab6_next_rdv.html
1
<div class="print screen-only">
2
  <form class="datepicker filter">
3
    <h5>Filtrer par date</h5>
4
      du <input type="text" name="from" />
5
      au <input type="text" name="to" />
6
  </form>
7
  <button id="patientrecord-print-tab6" class="icon-print">Imprimer</button>
8
</div>
9
<br class="clear" />
10

  
1 11
<div id="tabs-6">
2 12
  <table class="basic">
3 13
    <thead>
......
6 16
    <tbody>
7 17
    {% for event, state, missing_participants, inactive_participants in next_rdvs %}
8 18
    <tr>
9
      <td>{% firstof event.start_datetime|date:"l d/m/y H:i"|title %}{% if missing_participants or inactive_participants %} <span title="Au moins un intervenant est absent ou ne fait plus partie du service" class="icon-warning-sign absent"></span>{% endif %}</td>
19
      <td><span class="date">{{ event.start_datetime|date:"SHORT_DATE_FORMAT" }}</span>
20
          <span class="time">{% firstof event.start_datetime|date:"H:i"|title %}</span>{% if missing_participants or inactive_participants %} <span title="Au moins un intervenant est absent ou ne fait plus partie du service" class="icon-warning-sign absent"></span>{% endif %}</td>
10 21
      <td>{% if state %}{% if state.state_name != 'VALIDE' %}<strong>{% endif %}{{ state }}{% if state.state_name != 'VALIDE' %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
11 22
      <td>{{ event.act_type }}</td>
12 23
      <td class="width-limited">{% for participant in event.participants.all %}
......
32 43
    </tbody>
33 44
  </table>
34 45
</div>
46
<script type="text/javascript">
47
    init_datepickers();
48
    $('#patientrecord-print-tab6').on('click', function(event) {
49
        filter_date_bounds('.basic td span.date');
50
        print_cleanup();
51
        window.print();
52
    });
53
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab7_socialisation.html
1
<button id="patientrecord-print-tab7" class="icon-print right">Imprimer</button>
2
<br class="clear" />
1 3
<div id="tabs-7">
2 4
  <div class="frame">
3 5
    <h3>Périodes de socialisation</h3>
......
68 70
    {% endfor %}
69 71
  </div>
70 72
</div>
73
<script type="text/javascript">
74
    $('#patientrecord-print-tab7').on('click', function(event) {
75
        print_cleanup();
76
        window.print();
77
    });
78
</script>
calebasse/dossiers/templates/dossiers/patientrecord_tab8_medical.html
1
<button id="patientrecord-print-tab8" class="icon-print right">Imprimer</button>
1 2
<div id="tabs-8">
2 3
  <form method="post" action="tab8" id="physiology-form" class="patientrecordform">
3 4
    {% csrf_token %}
......
16 17
    <button class="save enable-on-change">Enregistrer</button>
17 18
  </form>
18 19
</div>
20
<script type="text/javascript">
21
    $('#patientrecord-print-tab8').on('click', function(event) {
22
        print_cleanup();
23
        window.print();
24
    });
25
</script>
calebasse/static/css/agenda.css
1
br.clear {
2
    clear: both;
3
}
4

  
5 1
td#dispos {
6 2
	vertical-align: top;
7 3
}
calebasse/static/css/dossiers.css
126 126

  
127 127
input[type=checkbox] + button {
128 128
    display: none;
129
}
129
}
130

  
131
.patientrecord_print ul {
132
    margin: 0;
133
    padding: 0;
134
}
135

  
136
.patientrecord_print li {
137
    list-style-type: none;
138
    display: inline;
139
}
140

  
141
.patientrecord_print label {
142
    margin: 0 .5em;
143
}
144

  
145
.print {
146
    float: right;
147
}
148
.print h5 {
149
    margin: 0;
150
}
151

  
152
.print form {
153
    display: inline;
154
}
calebasse/static/css/print.css
7 7
  color: black;
8 8
}
9 9

  
10
button {
11
    display: none;
12
}
13

  
10 14
div#header, div#splash, div#footer, div#appbar, div#datesel,
11
div#djDebugToolbarHandle, button#uncheck-all, button#check-all, input.printable  {
15
div#djDebugToolbarHandle, input.printable {
12 16
  display: none;
13 17
}
14 18

  
......
100 104
table.main td, table.main th {
101 105
    border: 1px solid #555;
102 106
    padding: 0 .5em;
107
}
108

  
109

  
110
 /* Patient record printing */
111

  
112
textarea, input[type=text], select {
113
    border: 0;
114
}
115

  
116
textarea[value=''] {
117
    display: none;
118
}
119

  
120
input[value=''] {
121
    display: none;
122
}
123

  
124
#tabs > ul {
125
    display: none;
126
}
127

  
128
.social-security-contact ul {
129
    display: block;
130
}
131

  
132
 /* tabs-7 */
133

  
134
#tabs-7 .subframe {
135
    padding: 0 .5em;
136
}
137

  
138
 /* tabs-8 */
139

  
140
#tabs-8 label {
141
    display: inline;
142
}
143

  
144
.select2-results {
145
    display: none;
146
}
147

  
148
.select2-choices {
149
    list-style-type:none;
150
}
151

  
152
.select2-container + select {
153
    display: none;
154
}
155

  
156
#tabs-8 label:after {
157
    content: ':';
103 158
}
calebasse/static/css/style.css
1407 1407
    display: none;
1408 1408
}
1409 1409

  
1410
.right {
1411
    float: right;
1412
}
1413

  
1414
.clear {
1415
    clear: both;
1416
}
calebasse/static/js/calebasse.agenda.js
4 4
var current_date = path[3];
5 5
COOKIE_PATH = '/' + service + '/agenda';
6 6

  
7
function delete_prompt(text) {
8
  var r = prompt(text + '\n Pour cela veuillez entrer DEL');
9
  if (r.toLowerCase().replace(/^\s+|\s+$/g, '') == 'del') {
10
    return true;
11
  } else {
12
    return false;
13
  }
14
}
15

  
16 7
function get_initial_fields(button, base) {
17 8
    var participants = new Array();
18 9
    var ressource = null;
......
273 264
    return $(ressource_target).find('a.tab');
274 265
}
275 266

  
276
function init_datepickers(dialog) {
277
    $('.datepicker-date', dialog).datepicker({dateFormat: 'd/m/yy', showOn: 'button'});
278
    $('.datepicker input', dialog).datepicker({dateFormat: 'd/m/yy', showOn: 'button'});
279
}
280

  
281 267
function event_dialog(url, title, width, btn_text) {
282 268
    function add_periodic_events(base) {
283 269
      init_datepickers(base);
calebasse/static/js/calebasse.dossiers.js
10 10
  $('input#id_prolongation_date', that).datepicker({dateFormat: 'd/m/yy', showOn: 'button' });
11 11
}
12 12

  
13
function print_cleanup() {
14
    $.each($('textarea'), function() {
15
        if(!$(this).val())
16
            $(this).addClass('screen-only');
17
        else
18
            $(this).removeClass('screen-only');
19
    });
20

  
21
        // $.each($('select'), function() {
22
        //     $(this).addClass('screen-only');
23
        //     var span = $('<span>');
24
        //     span.addClass('print-only');
25
        //     span.html($(this).val());
26
        //     $(this).parent().append(span);
27
        //     console.log($(this).val());
28
        // });
29
}
30

  
31
function filter_date_bounds(selector) {
32
    var from = $('form.filter input[name=from]').datepicker('getDate');
33
    var to = $('form.filter input[name=to]').datepicker('getDate');
34
    if (to) {
35
        to.setHours(23); to.setMinutes(59); to.setSeconds(59);
36
    }
37
    $.each($(selector), function(){
38
        var current = $.datepicker.parseDate('d/m/yy', $(this).text());
39
        if (current < from || (to && current >= to)) {
40
            $(this).parent().parent().addClass('screen-only');
41
        } else {
42
            $(this).parent().parent().removeClass('screen-only');
43
        }
44
    });
45
}
46

  
13 47
function load_add_address_dialog() {
14 48
  var str = $("#contactform").serialize();
15 49
  $.cookie('contactform', str, { path: window.location.pathname });
......
391 425
        });
392 426
    });
393 427

  
428
    $('#patientrecord-print-button').on('click', function(event) {
429
        event.preventDefault();
430
        generic_ajaxform_dialog($(this).attr('href'), 'Impression dossier patient',
431
                                '#ajax-dlg', '450px', 'Imprimer', false, false);
432
    });
433

  
394 434
    $('#new-patientrecord').click(function() {
395 435
        generic_ajaxform_dialog('new', 'Nouveau dossier',
396 436
            '#dossier-dlg', '700px', 'Ajouter', false, function(that) {
calebasse/static/js/common.js
1
function delete_prompt(text) {
2
  var r = prompt(text + '\n Pour cela veuillez entrer DEL');
3
  if (r.toLowerCase().replace(/^\s+|\s+$/g, '') == 'del') {
4
    return true;
5
  } else {
6
    return false;
7
  }
8
}
9

  
10
function init_datepickers(on) {
11
    $('.datepicker-date', on).datepicker({dateFormat: 'd/m/yy', showOn: 'button'});
12
    $('.datepicker input', on).datepicker({dateFormat: 'd/m/yy', showOn: 'button'});
13
}
calebasse/templates/calebasse/base.html
20 20
    <script src="{{ STATIC_URL }}js/jquery.form.js"></script>
21 21
    <script src="{{ STATIC_URL }}js/jquery.sortElements.js"></script>
22 22
    <script src="{{ STATIC_URL }}development-bundle/ui/i18n/jquery.ui.datepicker-fr.js"></script>
23
    <script src="{{ STATIC_URL }}js/common.js"></script>
23 24
    <script src="{{ STATIC_URL }}js/ajax_select.js"></script>
24 25
    <script src="{{ STATIC_URL }}js/jquery.mousewheel.js"></script>
25 26
    <script src="{{ STATIC_URL }}js/calebasse.mousewheel.js"></script>
26
-