improve cycle item report
parent
5387c9029e
commit
19139bbcc8
|
@ -1,4 +1,6 @@
|
|||
<form model="clinic.vascular.access">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="description"/>
|
||||
<field name="note"/>
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<list model="clinic.vascular.access">
|
||||
<field name="name"/>
|
||||
<field name="note"/>
|
||||
<field name="code"/>
|
||||
<field name="description"/>
|
||||
</list>
|
||||
|
|
|
@ -82,6 +82,15 @@ class ReportCycleItem(Model):
|
|||
dom.append(['department_id','=',department_id])
|
||||
lines=[]
|
||||
cycles={}
|
||||
vasculars={}
|
||||
for vscl in get_model("clinic.vascular.access").search_read([],['code','description']):
|
||||
vasculars[vscl['code']]={
|
||||
'qty': 0,
|
||||
'description': vscl['description'] or ''
|
||||
}
|
||||
ptypes={}
|
||||
for ptype in get_model("clinic.patient.type").search_read([],['name']):
|
||||
ptypes[ptype['name'] or ""]=0
|
||||
for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"):
|
||||
cycle=citem.cycle_id
|
||||
if cycle.id not in cycles.keys():
|
||||
|
@ -91,9 +100,12 @@ class ReportCycleItem(Model):
|
|||
cycles[cycle.id].append(nurse.name)
|
||||
for hdcase in citem.hd_cases:
|
||||
patient=hdcase.patient_id
|
||||
vascular=patient.vascular_acc
|
||||
vasculars[vascular.code]['qty']+=1
|
||||
ptype=patient.type_id
|
||||
if ptype_id and ptype_id!=ptype.id:
|
||||
continue
|
||||
ptypes[ptype.name or ""]+=1
|
||||
doctor=hdcase.doctor_id
|
||||
cycle=hdcase.cycle_id
|
||||
dpt=hdcase.department_id
|
||||
|
@ -163,14 +175,31 @@ class ReportCycleItem(Model):
|
|||
line['no']=no
|
||||
nlines.append(line)
|
||||
no+=1
|
||||
vscl_lines=[]
|
||||
for k,v in vasculars.items():
|
||||
vscl_lines.append({
|
||||
'description': v['description'],
|
||||
'qty': v['qty'],
|
||||
})
|
||||
ptype_lines=[]
|
||||
total_pt=0
|
||||
for pname,qty in ptypes.items():
|
||||
ptype_lines.append({
|
||||
'name': pname,
|
||||
'qty': qty,
|
||||
})
|
||||
total_pt+=qty
|
||||
data={
|
||||
'company_name': company_name or "",
|
||||
'lines': nlines,
|
||||
'vscl_lines': vscl_lines,
|
||||
'ptype_lines': ptype_lines,
|
||||
'month': month_str,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'total_fee': total_fee,
|
||||
'total_mdc': total_mdc,
|
||||
'total_pt': total_pt,
|
||||
}
|
||||
return data
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ class ReportHDCaseSummary(Model):
|
|||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model("company").browse(company_id)
|
||||
|
||||
date=datetime.now().strftime("%Y-%m-%d")
|
||||
year=int(date[0:4])
|
||||
crr_month=int(date[5:7])
|
||||
|
@ -63,9 +62,9 @@ class ReportHDCaseSummary(Model):
|
|||
date_from=defaults.get('date_from',date)
|
||||
date_to=defaults.get('date_to',date)
|
||||
branch_id=defaults.get("branch_id",None)
|
||||
department_id=defaults.get("department_id",None)
|
||||
if branch_id:
|
||||
branch_id=branch_id[0]
|
||||
department_id=defaults.get("department_id",None)
|
||||
if department_id:
|
||||
department_id=department_id[0]
|
||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||
|
@ -110,10 +109,10 @@ class ReportHDCaseSummary(Model):
|
|||
count=1
|
||||
# number of hd case of this month
|
||||
dom=[]
|
||||
dom.append(["time_start",">=",time_start])
|
||||
dom.append(["time_stop","<=",time_stop])
|
||||
dom.append(["date",">=",date_from])
|
||||
dom.append(["date","<=",date_to])
|
||||
dom.append(["state","in",["completed","waiting_payment","paid"]])
|
||||
dom.append(['patient_id.walkin','=','no'])
|
||||
#dom.append(['patient_id.walkin','=','no'])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -228,8 +227,6 @@ class ReportHDCaseSummary(Model):
|
|||
'unit': 'คน',
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
dom=[]
|
||||
time_start='%s-%s-01'%(year,str(crr_month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
|
@ -237,8 +234,6 @@ class ReportHDCaseSummary(Model):
|
|||
dom.append(['type_id','=',ptype['id']])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',False])
|
||||
#if resign_patients:
|
||||
#dom.append(['id','not in',resign_patients])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -283,7 +278,6 @@ class ReportHDCaseSummary(Model):
|
|||
elif branch_id:
|
||||
branch=get_model("clinic.branch").browse(branch_id)
|
||||
sub_name="(%s)" % branch.name or ""
|
||||
print('>> ', context.get('defaults'))
|
||||
data={
|
||||
'branch_id': branch_id,
|
||||
'department_id': department_id,
|
||||
|
|
|
@ -134,7 +134,7 @@ class ReportLaborCostSummary(Model):
|
|||
staffs[staff.name][dpt.name]['qty']+=qty
|
||||
|
||||
if not citems.get(citem.id):
|
||||
qty=len([hdcase for hdcase in citem.hd_cases])
|
||||
qty=len([hdcase for hdcase in citem.hd_cases if hdcase.state in ('completed', 'waiting_payment', 'paid')])
|
||||
citems[citem.id]=qty
|
||||
lines=[]
|
||||
dom=[]
|
||||
|
|
|
@ -6,7 +6,11 @@ class VascularAccess(Model):
|
|||
|
||||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"code": fields.Char("Code",required=True,search=True),
|
||||
"description": fields.Char("Description",search=True),
|
||||
'note': fields.Text("Note"),
|
||||
}
|
||||
|
||||
_sql_constraints=("clinic_vascular_key_uniq","unique(code)","code should be unique"),
|
||||
|
||||
VascularAccess.register()
|
||||
|
|
Binary file not shown.
|
@ -33,7 +33,7 @@
|
|||
<td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
|
||||
<td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
|
||||
<td style="text-align:right">{{fee}}</td>
|
||||
<td>{{mdc}}</td>
|
||||
<td style="text-align:right">{{mdc}}</td>
|
||||
<td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
|
||||
<td>{{dlz_use}}</td>
|
||||
<td><a href="/ui#name=clinic_cycle_item&active_id={{ctid}}&mode=form">View</a></td>
|
||||
|
@ -49,9 +49,47 @@
|
|||
<th></th>
|
||||
<th></th>
|
||||
<th style="text-align:right">{{currency total_fee zero=""}}</th>
|
||||
<th></th>
|
||||
<th style="text-align:right">{{currency total_mdc}}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tfoot>
|
||||
</table>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<td colspan="5" style="width:50%">
|
||||
<table class="table ">
|
||||
<thead>
|
||||
<th>Vascular Access</th>
|
||||
<th>Qty</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each vscl_lines}}
|
||||
<tr>
|
||||
<td>{{description}}</td><td>{{qty}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="6" style="width:50%">
|
||||
<table class="table ">
|
||||
<thead>
|
||||
<th>Patient Type</th>
|
||||
<th>Qty</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each ptype_lines}}
|
||||
<tr>
|
||||
<td>{{name}}</td><td>{{qty}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th>รวมผู้ป่วยทั้งหมด</th>
|
||||
<th>{{total_pt}}</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<th>Receipt#</th>
|
||||
<th>Invoice#</th>
|
||||
<th>ชื่อยา</th>
|
||||
<th>ค่าฟอก</th>
|
||||
<th>ค่ายา</th>
|
||||
<th>Lab</th>
|
||||
<th>Misc.</th>
|
||||
|
@ -37,7 +36,6 @@
|
|||
{{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
|
||||
</td>
|
||||
<td>{{mdc_name}}</td>
|
||||
<td>{{currency fee zero=""}}</td>
|
||||
<td>{{currency mdc zero=""}}</td>
|
||||
<td>{{currency lab zero=""}}</td>
|
||||
<td>{{currency misc zero=""}}</td>
|
||||
|
|
Loading…
Reference in New Issue