Revision 82feb7c2
Added by Mikaël Ates over 12 years ago
calebasse/facturation/list_acts.py | ||
---|---|---|
141 | 141 |
return (acts_not_locked, days_not_locked, acts_not_valide, |
142 | 142 |
acts_not_billable, acts_bad_state, |
143 | 143 |
acts_accepted) |
144 |
|
|
145 |
|
|
146 |
def list_acts_for_billing_SESSAD(start_day, end_day, service): |
|
147 |
"""Used to sort acts billable by specific service requirements. |
|
148 |
|
|
149 |
For the SESSAD, acts are billable if the state of the patient record at |
|
150 |
the date of the act is 'SESSAD_STATE_TRAITEMENT' and there was also a |
|
151 |
valid notification at that date. |
|
152 |
|
|
153 |
acts = acts_not_locked + \ |
|
154 |
acts_not_valide + \ |
|
155 |
acts_not_billable + \ |
|
156 |
acts_bad_state + \ |
|
157 |
acts_missing_valid_notification + \ |
|
158 |
acts_accepted |
|
159 |
|
|
160 |
:param end_day: formatted date that gives the last day when acts are taken |
|
161 |
in account. |
|
162 |
:type end_day: datetime |
|
163 |
:param service: service in which acts are dealt with. |
|
164 |
:type service: calebasse.ressources.Service |
|
165 |
|
|
166 |
:returns: a list of dictionnaries where patients are the keys and values |
|
167 |
are lists of acts. The second element of this list in not a dict but |
|
168 |
a list of the days where are all days are not locked. |
|
169 |
:rtype: list |
|
170 |
""" |
|
171 |
|
|
172 |
acts_not_locked, days_not_locked, acts_not_valide, \ |
|
173 |
acts_not_billable, acts_billable = \ |
|
174 |
list_acts_for_billing_first_round(end_day, service, |
|
175 |
start_day=start_day) |
|
176 |
acts_bad_state = {} |
|
177 |
acts_missing_valid_notification = {} |
|
178 |
acts_accepted = {} |
|
179 |
for patient, acts in acts_billable.items(): |
|
180 |
for act in acts: |
|
181 |
if patient.was_in_state_at_day(act.date, |
|
182 |
'SESSAD_STATE_TRAITEMENT'): |
|
183 |
if not act.was_covered_by_notification(): |
|
184 |
if act.patient in acts_missing_valid_notification: |
|
185 |
acts_missing_valid_notification[act.patient]. \ |
|
186 |
append(act) |
|
187 |
else: |
|
188 |
acts_missing_valid_notification[act.patient] = [act] |
|
189 |
else: |
|
190 |
if act.patient in acts_accepted: |
|
191 |
acts_accepted[act.patient].append(act) |
|
192 |
else: |
|
193 |
acts_accepted[act.patient] = [act] |
|
194 |
else: |
|
195 |
if act.patient in acts_bad_state: |
|
196 |
acts_bad_state[act.patient]. \ |
|
197 |
append((act, 'NOT_ACCOUNTABLE_STATE')) |
|
198 |
else: |
|
199 |
acts_bad_state[act.patient] = \ |
|
200 |
[(act, 'NOT_ACCOUNTABLE_STATE')] |
|
201 |
return (acts_not_locked, days_not_locked, acts_not_valide, |
|
202 |
acts_not_billable, acts_bad_state, acts_missing_valid_notification, |
|
203 |
acts_accepted) |
Also available in: Unified diff
facturation: List acts billable for billing at the SESSAD.
The elegibility for billing is based on the validation of the acts, on the
state of the patient record and on the date coverage by an notification
healthcare.