Revision f3407c83
Added by Jérôme Schneider over 12 years ago
calebasse/dossiers/forms.py | ||
---|---|---|
6 | 6 |
from models import PatientRecord |
7 | 7 |
from states import STATE_CHOICES |
8 | 8 |
|
9 |
class CreatePatientRecordForm(ModelForm): |
|
10 |
class Meta: |
|
11 |
model = PatientRecord |
|
12 |
|
|
13 |
|
|
14 | 9 |
class EditPatientRecordForm(ModelForm): |
15 | 10 |
class Meta: |
16 | 11 |
model = PatientRecord |
... | ... | |
25 | 20 |
label=u"test", |
26 | 21 |
choices=STATE_CHOICES, initial=(0,1,2,3,4)) |
27 | 22 |
|
23 |
class CivilStatusForm(ModelForm): |
|
24 |
class Meta: |
|
25 |
model = PatientRecord |
|
26 |
fields = ('first_name', 'last_name', 'birthdate', 'gender', 'nationality') |
calebasse/dossiers/models.py | ||
---|---|---|
149 | 149 |
return None |
150 | 150 |
|
151 | 151 |
def save(self, **kwargs): |
152 |
# self.date_selected = \
|
|
153 |
# datetime(self.date_selected.year,
|
|
154 |
# self.date_selected.month, self.date_selected.day)
|
|
152 |
self.date_selected = \ |
|
153 |
datetime(self.date_selected.year,
|
|
154 |
self.date_selected.month, self.date_selected.day)
|
|
155 | 155 |
super(FileState, self).save(**kwargs) |
156 | 156 |
|
157 | 157 |
def __unicode__(self): |
... | ... | |
171 | 171 |
contacts = models.ManyToManyField('personnes.People', |
172 | 172 |
related_name='contact_of') |
173 | 173 |
birthdate = models.DateField(null=True, blank=True) |
174 |
nationality = models.CharField(max_length=70, null=True, blank=True) |
|
174 | 175 |
paper_id = models.CharField(max_length=12, |
175 | 176 |
null=True, blank=True) |
176 | 177 |
social_security_id = models.CharField(max_length=13) |
calebasse/dossiers/templates/dossiers/index.html | ||
---|---|---|
5 | 5 |
<h2>Dossiers</h2> |
6 | 6 |
<a href="../..">Retourner à l'accueil</a> |
7 | 7 |
<button id="new-dossier">Nouveau dossier</button> |
8 |
<span>Dossiers: <span class="num">{{ stats.dossiers }}</span> - |
|
9 |
En contact: <span class="num">{{ stats.En_contact }}</span> - |
|
10 |
Fin d'accueil: <span class="num">{{ stats.Fin_daccueil }}</span> - |
|
11 |
<span>En diagnostic: <span class="num">{{ stats.Diagnostic }}</span> - |
|
12 |
En traitement: <span class="num">{{ stats.Traitement }}</span> - |
|
13 |
Clos: <span class="num">{{ stats.Clos }}</span></span> |
|
8 |
<span> |
|
9 |
Dossiers: <span class="num">{{ stats.dossiers }}</span> - |
|
10 |
En contact: <span class="num">{{ stats.En_contact }}</span> - |
|
11 |
Fin d'accueil: <span class="num">{{ stats.Fin_daccueil }}</span> - |
|
12 |
En diagnostic: <span class="num">{{ stats.Diagnostic }}</span> - |
|
13 |
En traitement: <span class="num">{{ stats.Traitement }}</span> - |
|
14 |
Clos: <span class="num">{{ stats.Clos }}</span> |
|
15 |
</span> |
|
14 | 16 |
<br> |
15 | 17 |
<br> |
16 | 18 |
</span> |
... | ... | |
33 | 35 |
{{ search_form.states }} |
34 | 36 |
<button id="btn_all_state" type="button">Tous</button> |
35 | 37 |
<button id="btn_none_state" type="button">Aucun</button> |
36 |
<!-- <ul id="state_filters"> |
|
37 |
<li><label for="id_states_0"><input checked="checked" type="checkbox" name="states" value="0" id="id_states_0" class="checkbox_state"> En contact</label></li> |
|
38 |
<li><label for="id_states_1"><input checked="checked" type="checkbox" name="states" value="1" id="id_states_1" class="checkbox_state"> Fin d'accueil</label></li> |
|
39 |
<li><label for="id_states_2"><input checked="checked" type="checkbox" name="states" value="2" id="id_states_2" class="checkbox_state"> En diagnostic</label></li> |
|
40 |
<li><label for="id_states_3"><input checked="checked" type="checkbox" name="states" value="3" id="id_states_3" class="checkbox_state"> En traitement</label></li> |
|
41 |
<li><label for="id_states_4"><input checked="checked" type="checkbox" name="states" value="4" id="id_states_4" class="checkbox_state"> Clos</label></li> |
|
42 |
</ul> --> |
|
43 | 38 |
<h3>Afficher les dossiers</h3> |
44 | 39 |
<ul> |
45 | 40 |
<li><button>En pause facturation</button></li> |
calebasse/dossiers/urls.py | ||
---|---|---|
3 | 3 |
from calebasse.cbv import ListView, CreateView, DeleteView, UpdateView |
4 | 4 |
|
5 | 5 |
from models import PatientRecord |
6 |
from views import DossiersHomepageView |
|
7 |
from forms import CreatePatientRecordForm, EditPatientRecordForm |
|
6 |
from views import (PatientRecordsHomepageView, PatientRecordView, |
|
7 |
patient_record) |
|
8 |
from forms import EditPatientRecordForm |
|
8 | 9 |
|
9 | 10 |
urlpatterns = patterns('', |
10 |
url(r'^$', DossiersHomepageView.as_view()), |
|
11 |
#url(r'^$', ListView.as_view(model=PatientRecord)), |
|
12 |
url(r'^new/$', CreateView.as_view(model=PatientRecord, |
|
13 |
form_class=CreatePatientRecordForm, |
|
14 |
template_name_suffix='_new')), |
|
15 |
url(r'^(?P<pk>\d+)/$', UpdateView.as_view(model=PatientRecord, |
|
16 |
form_class=EditPatientRecordForm, |
|
17 |
template_name_suffix='_edit')), |
|
18 |
url(r'^(?P<pk>\d+)/delete/$', DeleteView.as_view(model=PatientRecord)), |
|
11 |
url(r'^$', PatientRecordsHomepageView.as_view()), |
|
12 |
url(r'^view/(?P<pk>\d+)/$', patient_record), |
|
19 | 13 |
) |
14 |
|
|
15 |
# url(r'^new/$', CreateView.as_view(model=PatientRecord, |
|
16 |
# form_class=CreatePatientRecordForm, |
|
17 |
# template_name_suffix='_new')), |
|
18 |
# url(r'^(?P<pk>\d+)/delete/$', DeleteView.as_view(model=PatientRecord)), |
|
19 |
#) |
calebasse/dossiers/views.py | ||
---|---|---|
1 | 1 |
|
2 |
from calebasse.cbv import ListView |
|
2 |
from calebasse.cbv import ListView, MultiUpdateView
|
|
3 | 3 |
from calebasse.agenda.models import Occurrence |
4 | 4 |
from calebasse.dossiers.models import PatientRecord |
5 |
from calebasse.dossiers.forms import SearchForm |
|
5 |
from calebasse.dossiers.forms import SearchForm, CivilStatusForm
|
|
6 | 6 |
from calebasse.dossiers.states import STATES_MAPPING, STATE_CHOICES_TYPE |
7 | 7 |
|
8 |
class DossiersHomepageView(ListView): |
|
8 |
|
|
9 |
class PatientRecordView(MultiUpdateView): |
|
10 |
""" |
|
11 |
""" |
|
12 |
model = PatientRecord |
|
13 |
forms_classes = {'civil_status': CivilStatusForm} |
|
14 |
template_name = 'dossiers/patientrecord_update.html' |
|
15 |
success_url = './' |
|
16 |
|
|
17 |
def get_context_data(self, **kwargs): |
|
18 |
ctx = super(PatientRecordView, self).get_context_data(**kwargs) |
|
19 |
return ctx |
|
20 |
|
|
21 |
patient_record = PatientRecordView.as_view() |
|
22 |
|
|
23 |
class PatientRecordsHomepageView(ListView): |
|
9 | 24 |
model = PatientRecord |
10 | 25 |
template_name = 'dossiers/index.html' |
11 | 26 |
|
12 | 27 |
def get_queryset(self): |
13 |
qs = super(DossiersHomepageView, self).get_queryset()
|
|
28 |
qs = super(PatientRecordsHomepageView, self).get_queryset()
|
|
14 | 29 |
first_name = self.request.GET.get('first_name') |
15 | 30 |
last_name = self.request.GET.get('last_name') |
16 | 31 |
paper_id = self.request.GET.get('paper_id') |
... | ... | |
32 | 47 |
return qs |
33 | 48 |
|
34 | 49 |
def get_context_data(self, **kwargs): |
35 |
ctx = super(DossiersHomepageView, self).get_context_data(**kwargs)
|
|
50 |
ctx = super(PatientRecordsHomepageView, self).get_context_data(**kwargs)
|
|
36 | 51 |
ctx['search_form'] = SearchForm(data=self.request.GET or None) |
37 | 52 |
ctx['patient_records'] = [] |
38 | 53 |
ctx['stats'] = {"dossiers": 0, |
calebasse/static/js/calebasse.dossiers.js | ||
---|---|---|
1 |
|
|
2 | 1 |
(function($) { |
3 |
$(function() { |
|
4 |
$('#btn_all_state').click(function() { |
|
5 |
$('.checkbox_state').attr('checked', true); |
|
6 |
}); |
|
7 |
$('#btn_none_state').click(function() { |
|
8 |
$('.checkbox_state').attr('checked', false); |
|
9 |
}); |
|
2 |
$(function() { |
|
3 |
$('#btn_all_state').click(function() { |
|
4 |
$('.checkbox_state').attr('checked', true); |
|
5 |
}); |
|
6 |
$('#btn_none_state').click(function() { |
|
7 |
$('.checkbox_state').attr('checked', false); |
|
8 |
}); |
|
9 |
$('#tabs').tabs(); |
|
10 |
$('#clore-dossier').click(function() { |
|
11 |
$('#dossier-change').dialog({title: 'Changement - Clôture', |
|
12 |
width: '500px', |
|
13 |
buttons: [ { text: "Annuler", |
|
14 |
click: function() { $(this).dialog("close"); } }, |
|
15 |
{ text: "Valider", |
|
16 |
click: function() { $(this).dialog("close"); } }]} |
|
17 |
); |
|
18 |
}); |
|
19 |
$('#reaccueillir-dossier').click(function() { |
|
20 |
$('#dossier-change').dialog({title: 'Changement - Réaccueil', |
|
21 |
width: '500px', |
|
22 |
buttons: [ { text: "Annuler", |
|
23 |
click: function() { $(this).dialog("close"); } }, |
|
24 |
{ text: "Valider", |
|
25 |
click: function() { $(this).dialog("close"); } }]} |
|
26 |
); |
|
27 |
}); |
|
28 |
$('#historique-dossier').click(function() { |
|
29 |
$('#dossier-histo-dlg').dialog({title: 'Historique dossier', |
|
30 |
width: '500px', |
|
31 |
buttons: [ { text: "Fermer", |
|
32 |
click: function() { $(this).dialog("close"); } }]} |
|
33 |
); |
|
34 |
}); |
|
35 |
$('#new-address-btn').click(function() { |
|
36 |
$('#new-address-dlg').dialog({title: 'Nouvelle adresse', |
|
37 |
width: '500px', |
|
38 |
buttons: [ { text: "Annuler", |
|
39 |
click: function() { $(this).dialog("close"); } }, |
|
40 |
{ text: "Valider", |
|
41 |
click: function() { $(this).dialog("close"); } }]} |
|
42 |
); |
|
43 |
}); |
|
44 |
|
|
45 |
$('#add-prise-en-charge-btn').click(function() { |
|
46 |
$('#add-prise-en-charge-dlg').dialog({title: 'Prise en charge', |
|
47 |
width: '300px', |
|
48 |
buttons: [ { text: "Annuler", |
|
49 |
click: function() { $(this).dialog("close"); } }, |
|
50 |
{ text: "Valider", |
|
51 |
click: function() { $(this).dialog("close"); } }]} |
|
52 |
); |
|
53 |
}); |
|
54 |
|
|
55 |
$('#add-prolongation-btn').click(function() { |
|
56 |
$('#add-prolongation-dlg').dialog({title: 'Prolongation', |
|
57 |
width: '300px', |
|
58 |
buttons: [ { text: "Annuler", |
|
59 |
click: function() { $(this).dialog("close"); } }, |
|
60 |
{ text: "Valider", |
|
61 |
click: function() { $(this).dialog("close"); } }]} |
|
62 |
); |
|
63 |
}); |
|
64 |
|
|
65 |
$('button.blind').next().hide(); |
|
66 |
$('button.blind').click(function() { |
|
67 |
$(this).next().toggle('blind'); |
|
10 | 68 |
}); |
69 |
}); |
|
11 | 70 |
})(window.jQuery) |
12 | 71 |
|
Also available in: Unified diff
dossiers: begin patient record edition