models: improve models to manage validation ac

This commit is contained in:
Jérôme Schneider 2012-10-31 16:40:51 +01:00
parent 93e8b1b8a3
commit 47b11707c0
2 changed files with 16 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class Act(models.Model):
doctors = models.ManyToManyField('personnes.Worker',
limit_choices_to={'type__intervene': True},
verbose_name=u'Thérapeutes')
histories = models.ManyToManyField('HistoryAct')
def is_absent(self):
if self.get_state() in ('ABS_NON_EXC', 'ABS_EXC', 'ANNUL_NOUS',
@ -86,6 +87,19 @@ class Act(models.Model):
ordering = ['-date', 'patient']
class HistoryAct(models.Model):
EVENT_CHOICES = (
('NR', u'Nouveau rendez-vous'),
('AV', u'Acte validé'),
('CF', u'En cours de facturation'),
('AF', u'Acte facturé'),
)
date = models.DateTimeField()
event_type = models.CharField(max_length=2,
choices=EVENT_CHOICES)
description = models.TextField(default='')
class EventActManager(EventManager):
def create_patient_appointment(self, creator, title, patient, participants,

View File

@ -60,6 +60,8 @@ class PatientRecord(ServiceLinkedAbstractModel, People):
editable=False)
contacts = models.ManyToManyField('personnes.People',
related_name='contact_of')
birthdate = models.DateField()
paper_id = models.CharField(max_length=12)
def __init__(self, *args, **kwargs):
super(PatientRecord, self).__init__(*args, **kwargs)