if nurse more that number of cycle item should show name of nurse
parent
5c9591f187
commit
ccb1b45903
|
@ -98,17 +98,20 @@ class ReportCycleItem(Model):
|
||||||
ptypes={}
|
ptypes={}
|
||||||
for ptype in get_model("clinic.patient.type").search_read([],['name']):
|
for ptype in get_model("clinic.patient.type").search_read([],['name']):
|
||||||
ptypes[ptype['name'] or ""]=0
|
ptypes[ptype['name'] or ""]=0
|
||||||
|
cycle_check={}
|
||||||
for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"):
|
for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"):
|
||||||
cycle=citem.cycle_id
|
cycle=citem.cycle_id
|
||||||
date=citem.date
|
date=citem.date
|
||||||
key='%s-%s'%(date,cycle.id)
|
key='%s-%s'%(date,cycle.id)
|
||||||
if key not in cycles.keys():
|
if key not in cycles.keys():
|
||||||
cycles[key]=[]
|
cycles[key]=[]
|
||||||
|
cycle_check[key]=0
|
||||||
for line in citem.lines:
|
for line in citem.lines:
|
||||||
nurse=line.nurse_id
|
nurse=line.nurse_id
|
||||||
cycles[key].append({
|
cycles[key].append({
|
||||||
'name': nurse.name,
|
'name': nurse.name,
|
||||||
'first_name': nurse.first_name or "",
|
'first_name': nurse.first_name or "",
|
||||||
|
'cycle_item_id': citem.id,
|
||||||
})
|
})
|
||||||
for hdcase in citem.hd_cases:
|
for hdcase in citem.hd_cases:
|
||||||
if hdcase.state not in ('paid', 'waiting_payment'):
|
if hdcase.state not in ('paid', 'waiting_payment'):
|
||||||
|
@ -120,6 +123,8 @@ class ReportCycleItem(Model):
|
||||||
ptype=patient.type_id
|
ptype=patient.type_id
|
||||||
if ptype_id and ptype_id!=ptype.id:
|
if ptype_id and ptype_id!=ptype.id:
|
||||||
continue
|
continue
|
||||||
|
key='%s-%s'%(hdcase.date,hdcase.cycle_id.id)
|
||||||
|
cycle_check[key]+=1
|
||||||
ptypes[ptype.name or ""]+=1
|
ptypes[ptype.name or ""]+=1
|
||||||
doctor=hdcase.doctor_id
|
doctor=hdcase.doctor_id
|
||||||
cycle=hdcase.cycle_id
|
cycle=hdcase.cycle_id
|
||||||
|
@ -221,7 +226,6 @@ class ReportCycleItem(Model):
|
||||||
sub_mdc+=x['mdc'] or 0
|
sub_mdc+=x['mdc'] or 0
|
||||||
if not epos.get(x['mdc_name']):
|
if not epos.get(x['mdc_name']):
|
||||||
epos[x['mdc_name']]=0
|
epos[x['mdc_name']]=0
|
||||||
#XXX
|
|
||||||
if not epos.get(x['iron_name']):
|
if not epos.get(x['iron_name']):
|
||||||
epos[x['iron_name']]=0
|
epos[x['iron_name']]=0
|
||||||
epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX
|
epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX
|
||||||
|
@ -245,10 +249,20 @@ class ReportCycleItem(Model):
|
||||||
key='%s-%s'%(date,cid)
|
key='%s-%s'%(date,cid)
|
||||||
cres=cycles[key]
|
cres=cycles[key]
|
||||||
line['nurse']=''
|
line['nurse']=''
|
||||||
|
more_lines=[]
|
||||||
if index < len(cres):
|
if index < len(cres):
|
||||||
line['nurse']=cres[index]['name']
|
line['nurse']=cres[index]['name']
|
||||||
line['nfirst_name']=cres[index]['first_name']
|
line['nfirst_name']=cres[index]['first_name']
|
||||||
|
if index+1==cycle_check[key]:
|
||||||
|
for i in range(index+1,len(cres)):
|
||||||
|
more_lines.append({
|
||||||
|
'nurse': cres[i]['name'],
|
||||||
|
'nfirst_name': cres[i]['first_name'],
|
||||||
|
'ctid': cres[i]['cycle_item_id'],
|
||||||
|
})
|
||||||
nlines.append(line)
|
nlines.append(line)
|
||||||
|
# if nurse more that cres, should show name of nurses
|
||||||
|
nlines+=more_lines
|
||||||
if no==count:
|
if no==count:
|
||||||
epo_items=[{'name': k, 'qty': v} for k,v in epos.items() if k ]
|
epo_items=[{'name': k, 'qty': v} for k,v in epos.items() if k ]
|
||||||
nlines.append({
|
nlines.append({
|
||||||
|
|
Loading…
Reference in New Issue