Project

General

Profile

« Previous | Next » 

Revision 9a64c930

Added by Mikaël Ates about 13 years ago

facturation : take in account one or two treatment hc per patient.

View differences:

calebasse/facturation/list_acts.py
len_acts_cared_diag = len(hcd.act_set.all())
except:
pass
hct = None
'''
We take in account the two last treatment healthcare
'''
hcts = None
len_acts_cared_trait = 0
try:
hct = CmppHealthCareTreatment.objects.\
filter(patient=patient).latest('start_date')
hcts = CmppHealthCareTreatment.objects.\
filter(patient=patient).order_by('-start_date')
len_acts_cared_trait = len(hct.act_set.all())
except:
pass
# acts are all billable and chronologically ordered
count_hcd = 0
count_hct = 0
count_hct_1 = 0
count_hct_2 = 0
for act in acts:
cared = False
if hcd and hcd.start_date <= act.date:
......
acts_diagnostic[act.patient] = [(act, hcd)]
count_hcd = count_hcd + 1
cared = True
if not cared and hct and hct.start_date <= act.date and hct.end_date >= act.date:
# The one before the last may be not full.
if not cared and len(hcts) >1 and hcts[1] and hcts[1].start_date <= act.date and hcts[1].end_date >= act.date:
# Ce qui seraient prise en charge
nb_acts_cared = len_acts_cared_trait + count_hct
# Ne doit pas dépasser la limite de prise en charge du hc
if nb_acts_cared < hct.get_act_number() :
if nb_acts_cared < hct.get_act_number():
if act.patient in acts_treatment:
acts_treatment[act.patient]. \
append((act, hct))
else:
acts_treatment[act.patient] = [(act, hct)]
count_hct = count_hct + 1
cared = True
# ne doit pas dépasser la limite de prise en charge du hc
if count_hct_1 < hcts[1].get_act_number() - hcts[1].get_nb_acts_cared():
if act.patient in acts_treatment:
acts_treatment[act.patient]. \
append((act, hcts[1]))
else:
acts_treatment[act.patient] = [(act, hcts[1])]
count_hct_1 = count_hct_1 + 1
cared = True
if not cared and hcts[0] and hcts[0].start_date <= act.date and hcts[0].end_date >= act.date:
if count_hct_2 < hcts[0].get_act_number() - hcts[0].get_nb_acts_cared():
if act.patient in acts_treatment:
acts_treatment[act.patient]. \
append((act, hcts[0]))
else:
acts_treatment[act.patient] = [(act, hcts[0])]
count_hct_2 = count_hct_2 + 1
cared = True
if not cared:
if act.patient in acts_losts:
acts_losts[act.patient]. \

Also available in: Unified diff