report detail
parent
80520d8f71
commit
33ce56fdd9
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Report Medical Detail</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.report.medical.detail</field>
|
||||||
|
<field name="report_template">report_medical_detail</field>
|
||||||
|
<field name="report_template_xls">report_medical_detail</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -9,9 +9,9 @@
|
||||||
<header string="REPORTS"/>
|
<header string="REPORTS"/>
|
||||||
<item string="Report Claim Expense" action="clinic_report_account_hd_case_summary"/>
|
<item string="Report Claim Expense" action="clinic_report_account_hd_case_summary"/>
|
||||||
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
||||||
<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>
|
<!--<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>-->
|
||||||
<item string="Labor Cost Sub Detail" action="clinic_report_labor_cost_sub_detail"/>
|
<!--<item string="Labor Cost Sub Detail" action="clinic_report_labor_cost_sub_detail"/>-->
|
||||||
<item string="Labor Cost Daily" action="clinic_report_labor_cost_daily"/>
|
<!--<item string="Labor Cost Daily" action="clinic_report_labor_cost_daily"/>-->
|
||||||
<item string="Labor Cost Overtime" action="clinic_report_labor_cost_overtime"/>
|
<item string="Labor Cost Overtime" action="clinic_report_labor_cost_overtime"/>
|
||||||
<divider/>
|
<divider/>
|
||||||
<header string="OTHERS"/>
|
<header string="OTHERS"/>
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
<item string="Graduations" action="clinic_grade"/>
|
<item string="Graduations" action="clinic_grade"/>
|
||||||
<item string="Morbidities" action="clinic_morbidity"/>
|
<item string="Morbidities" action="clinic_morbidity"/>
|
||||||
<item string="Patient Cycles" action="clinic_patient_cycle"/>
|
<item string="Patient Cycles" action="clinic_patient_cycle"/>
|
||||||
<!--<item string="Patient Categories" action="clinic_patient_categ"/>-->
|
|
||||||
<item string="Patient Types" action="clinic_patient_type"/>
|
<item string="Patient Types" action="clinic_patient_type"/>
|
||||||
<item string="Races" action="clinic_race"/>
|
<item string="Races" action="clinic_race"/>
|
||||||
<item string="Valcular Access" action="clinic_vascular_access"/>
|
<item string="Valcular Access" action="clinic_vascular_access"/>
|
||||||
|
@ -49,6 +48,7 @@
|
||||||
<item string="Report Claim Expense" action="clinic_report_claim"/>
|
<item string="Report Claim Expense" action="clinic_report_claim"/>
|
||||||
<item string="Cycle Item Summary" action="clinic_report_cycle_item"/>
|
<item string="Cycle Item Summary" action="clinic_report_cycle_item"/>
|
||||||
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
||||||
|
<!--<item string="Medical Detail" action="clinic_report_medical_detail"/>-->
|
||||||
<!--<item string="HD Case Summary(PDF)" action="clinic_hd_case_print"/>-->
|
<!--<item string="HD Case Summary(PDF)" action="clinic_hd_case_print"/>-->
|
||||||
<!--<item string="Medical Summary" action="clinic_report_medical_summary"/>-->
|
<!--<item string="Medical Summary" action="clinic_report_medical_summary"/>-->
|
||||||
<!--<item string="Recent Patient" action="clinic_report_recent_patient"/>-->
|
<!--<item string="Recent Patient" action="clinic_report_recent_patient"/>-->
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<form model="clinic.report.medical.detail">
|
||||||
|
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||||
|
<field name="date_from" span="2"/>
|
||||||
|
<field name="date_to" span="2"/>
|
||||||
|
<field name="prod_categ_id" span="2"/>
|
||||||
|
<field name="product_id" domain='[["categ_id","=",prod_categ_id]]' span="2"/>
|
||||||
|
<field name="branch_id" span="2"/>
|
||||||
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||||
|
<field name="types" span="4">
|
||||||
|
<list>
|
||||||
|
<field name="name"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
</form>
|
|
@ -70,6 +70,7 @@ from . import report_hd_case_summary
|
||||||
from . import report_account_hd_case_summary
|
from . import report_account_hd_case_summary
|
||||||
from . import report_hd_case_detail
|
from . import report_hd_case_detail
|
||||||
from . import report_medical_summary
|
from . import report_medical_summary
|
||||||
|
from . import report_medical_detail
|
||||||
from . import report_recent_patient
|
from . import report_recent_patient
|
||||||
from . import report_discontinue_patient
|
from . import report_discontinue_patient
|
||||||
from . import report_staff
|
from . import report_staff
|
||||||
|
|
|
@ -0,0 +1,162 @@
|
||||||
|
import time
|
||||||
|
from calendar import monthrange
|
||||||
|
|
||||||
|
from netforce.model import Model,fields,get_model
|
||||||
|
from netforce.access import get_active_company
|
||||||
|
|
||||||
|
class ReportMedicalDetail(Model):
|
||||||
|
_name="clinic.report.medical.detail"
|
||||||
|
_string="Report Medical Detail"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Month", required=True),
|
||||||
|
"date_from": fields.Date("From", required=True),
|
||||||
|
"date_to": fields.Date("To", required=True),
|
||||||
|
"prod_categ_id": fields.Many2One("product.categ","Category",required=True),
|
||||||
|
"product_id": fields.Many2One("product","Product"),
|
||||||
|
'types': fields.Many2Many("clinic.patient.type","Types"),
|
||||||
|
"branch_id": fields.Many2One("clinic.branch","Branch"),
|
||||||
|
"department_id": fields.Many2One("clinic.department","Department"),
|
||||||
|
}
|
||||||
|
|
||||||
|
# in case link from another report
|
||||||
|
def default_get(self,field_names=None,context={},**kw):
|
||||||
|
defaults=context.get("defaults",{})
|
||||||
|
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
||||||
|
year,month=time.strftime("%Y-%m").split("-")
|
||||||
|
weekday, total_day=monthrange(int(year), int(month))
|
||||||
|
date_from=defaults.get('date_from','%s-%s-01'%(year,month))
|
||||||
|
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
||||||
|
categ_id=defaults.get('categ_id',None)
|
||||||
|
if not categ_id:
|
||||||
|
categ_ids=get_model("product.categ").search([['code','=','EPO']])
|
||||||
|
if categ_ids:
|
||||||
|
categ_id=categ_ids[0]
|
||||||
|
branch_id=defaults.get('branch_id',None)
|
||||||
|
select_dpt=get_model('select.company').get_select()
|
||||||
|
if not branch_id:
|
||||||
|
if select_dpt:
|
||||||
|
branch_id=select_dpt['branch_id']
|
||||||
|
else:
|
||||||
|
branch_id=int(branch_id or "0")
|
||||||
|
department_id=defaults.get('department_id',None)
|
||||||
|
if not department_id:
|
||||||
|
if select_dpt.get('department_ids'):
|
||||||
|
department_id=select_dpt['department_ids'][0]
|
||||||
|
else:
|
||||||
|
department_id=select_dpt['department_id']
|
||||||
|
else:
|
||||||
|
department_id=int(department_id or "0")
|
||||||
|
types=defaults.get('types',[])
|
||||||
|
if types:
|
||||||
|
types=[int(t) for t in types.split(",") if t]
|
||||||
|
product_id=defaults.get("product_id",None)
|
||||||
|
if product_id:
|
||||||
|
product_id=int(product_id)
|
||||||
|
print('xx ',product_id)
|
||||||
|
res={
|
||||||
|
'date': date,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
|
'prod_categ_id': categ_id,
|
||||||
|
'branch_id': branch_id,
|
||||||
|
'department_id': department_id,
|
||||||
|
'types': types,
|
||||||
|
'product_id': product_id,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
year, month=time.strftime("%Y-%m").split("-")
|
||||||
|
weekday, total_day=monthrange(int(year), int(month))
|
||||||
|
defaults=self.default_get(context=context)
|
||||||
|
time_start=defaults.get("date_from")
|
||||||
|
time_stop=defaults.get("date_to")
|
||||||
|
prod_categ_id=defaults.get("prod_categ_id")
|
||||||
|
branch_id=defaults.get("branch_id")
|
||||||
|
department_id=defaults.get("department_id")
|
||||||
|
product_id=defaults.get('product_id')
|
||||||
|
types=defaults.get('types')
|
||||||
|
if ids:
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
prod_categ_id=obj.prod_categ_id.id
|
||||||
|
product_id=obj.product_id.id
|
||||||
|
types=obj.types
|
||||||
|
branch_id=obj.branch_id.id
|
||||||
|
department_id=obj.department_id.id
|
||||||
|
month=obj.date_from.split("-")[1]
|
||||||
|
time_start=obj.date_from
|
||||||
|
time_stop=obj.date_to
|
||||||
|
dom=[
|
||||||
|
['hd_case_id.date','>=',time_start],
|
||||||
|
['hd_case_id.date','<=',time_stop],
|
||||||
|
]
|
||||||
|
if branch_id:
|
||||||
|
dom.append(['hd_case_id.branch_id','=',branch_id])
|
||||||
|
if department_id:
|
||||||
|
dom.append(['hd_case_id.department_id','=',department_id])
|
||||||
|
if prod_categ_id:
|
||||||
|
dom.append(['product_categ_id','=',prod_categ_id])
|
||||||
|
if product_id:
|
||||||
|
dom.append(['product_id','=',product_id])
|
||||||
|
if types and ids:
|
||||||
|
dom.append(['hd_case_id.patient_type_id','in',[t.id for t in types]])
|
||||||
|
elif types:
|
||||||
|
dom.append(['hd_case_id.patient_type_id','in',[t_id for t_id in types]])
|
||||||
|
lines=[]
|
||||||
|
total_qty=0
|
||||||
|
for line in get_model('clinic.hd.case.line').search_browse(dom):
|
||||||
|
hdcase=line.hd_case_id
|
||||||
|
patient=hdcase.patient_id
|
||||||
|
cycle=hdcase.cycle_id
|
||||||
|
department=hdcase.department_id
|
||||||
|
qty=line.qty or 0
|
||||||
|
lines.append({
|
||||||
|
'date': hdcase.date or '',
|
||||||
|
'tname': hdcase.patient_type_id.name or '',
|
||||||
|
'pname': patient.name or '',
|
||||||
|
'qty': qty,
|
||||||
|
'cname': cycle.name,
|
||||||
|
'cseq': cycle.sequence,
|
||||||
|
'dpt_name': department.name,
|
||||||
|
'hid': hdcase.id,
|
||||||
|
'hname': hdcase.number,
|
||||||
|
})
|
||||||
|
total_qty+=qty
|
||||||
|
sub_name=''
|
||||||
|
if department_id:
|
||||||
|
dpt=get_model("clinic.department").browse(department_id)
|
||||||
|
sub_name="(%s)" % dpt.name or ""
|
||||||
|
elif branch_id:
|
||||||
|
branch=get_model("clinic.branch").browse(branch_id)
|
||||||
|
sub_name="(%s)" % branch.name or ""
|
||||||
|
company_id=get_active_company()
|
||||||
|
company=get_model("company").browse(company_id)
|
||||||
|
no=1
|
||||||
|
for line in sorted(lines,key=lambda x: (x['date'],x['cseq'])):
|
||||||
|
line['no']=no
|
||||||
|
no+=1
|
||||||
|
data={
|
||||||
|
'company_name': '%s %s' % (company.name or "", sub_name),
|
||||||
|
'lines': lines,
|
||||||
|
'year': year,
|
||||||
|
'total_qty': total_qty,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
def onchange_date(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
date=data['date']
|
||||||
|
year,month,day=date.split("-")
|
||||||
|
weekday, total_day=monthrange(int(year), int(month))
|
||||||
|
data['date_from']="%s-%s-01"%(year,month)
|
||||||
|
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||||
|
return data
|
||||||
|
|
||||||
|
def onchange_branch(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
data['department_id']=None
|
||||||
|
return data
|
||||||
|
|
||||||
|
ReportMedicalDetail.register()
|
|
@ -2,7 +2,7 @@ import time
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
|
|
||||||
from netforce.model import Model,fields,get_model
|
from netforce.model import Model,fields,get_model
|
||||||
from netforce.access import get_active_company, get_active_user
|
from netforce.access import get_active_company
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
class ReportMedicalSummary(Model):
|
class ReportMedicalSummary(Model):
|
||||||
|
@ -129,24 +129,43 @@ class ReportMedicalSummary(Model):
|
||||||
count=1
|
count=1
|
||||||
total=0.0
|
total=0.0
|
||||||
sub_lines=[]
|
sub_lines=[]
|
||||||
|
all_ptypes=""
|
||||||
|
prod_id=None
|
||||||
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
|
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
|
||||||
|
all_ptypes+="%s,"%patient_type_id
|
||||||
qty=records[patient_type_id]['qty'] or 0
|
qty=records[patient_type_id]['qty'] or 0
|
||||||
|
prod_id=records[patient_type_id]['prod_id']
|
||||||
line={
|
line={
|
||||||
'prod_name': prod_name,
|
'prod_name': prod_name,
|
||||||
'prod_name_org': prod_name_org,
|
'prod_name_org': prod_name_org,
|
||||||
'prod_id': records[patient_type_id]['prod_id'],
|
'prod_id': prod_id,
|
||||||
'total': 0,
|
'total': 0,
|
||||||
}
|
}
|
||||||
sub_lines.append({
|
sub_lines.append({
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
|
'types': "%s"%patient_type_id,
|
||||||
|
'time_start': time_start,
|
||||||
|
'time_stop': time_stop,
|
||||||
|
'product_id': prod_id,
|
||||||
|
'product_categ_id': prod_categ_id,
|
||||||
})
|
})
|
||||||
total+=qty
|
total+=qty
|
||||||
count+=1
|
count+=1
|
||||||
sub_lines.append({
|
sub_lines.append({
|
||||||
'qty': total,
|
'qty': total,
|
||||||
|
'types': all_ptypes,
|
||||||
|
'time_start': time_start,
|
||||||
|
'time_stop': time_stop,
|
||||||
|
'product_id': prod_id,
|
||||||
|
'product_categ_id': prod_categ_id,
|
||||||
})
|
})
|
||||||
line['sub_lines']=sub_lines
|
line['sub_lines']=sub_lines
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
for line in lines:
|
||||||
|
st=""
|
||||||
|
for x in line['sub_lines']:
|
||||||
|
st+='%s'%(x['types'])
|
||||||
|
|
||||||
titles.append({'name':'รวม'})
|
titles.append({'name':'รวม'})
|
||||||
|
|
||||||
company_id=get_active_company()
|
company_id=get_active_company()
|
||||||
|
|
Binary file not shown.
|
@ -139,7 +139,9 @@
|
||||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||||
</td>
|
</td>
|
||||||
{{#each sub_lines}}
|
{{#each sub_lines}}
|
||||||
<td>{{qty}}</td>
|
<td style="text-align:center">
|
||||||
|
<a href="/ui#name=clinic_report_medical_detail&defaults.date_from={{time_start}}&defaults.date_to={{time_stop}}&defaults.types={{types}}&defaults.product_id={{product_id}}&defaults.product_categ_id={{product_categ_id}}">{{qty}} </a>
|
||||||
|
</td>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<center>
|
||||||
|
<h3>
|
||||||
|
{{company_name}}
|
||||||
|
</h3>
|
||||||
|
</center>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>HDCase#</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Patient</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Cycle</th>
|
||||||
|
<th>Department</th>
|
||||||
|
<th>Qty</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines}}
|
||||||
|
<tr>
|
||||||
|
<td>{{no}}</td>
|
||||||
|
<td>
|
||||||
|
{{view "link" string=hname action="clinic_hd_case" action_options="mode=form" active_id=hid}}
|
||||||
|
</td>
|
||||||
|
<td>{{date}}</td>
|
||||||
|
<td>{{pname}}</td>
|
||||||
|
<td>{{tname}}</td>
|
||||||
|
<td>{{cname}}</td>
|
||||||
|
<td>{{dpt_name}}</td>
|
||||||
|
<td>{{qty}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th>{{total_qty}}</th>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
|
@ -20,7 +20,9 @@
|
||||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||||
</td>
|
</td>
|
||||||
{{#each sub_lines}}
|
{{#each sub_lines}}
|
||||||
<td style="text-align:center">{{qty}}</td>
|
<td style="text-align:center">
|
||||||
|
<a href="/ui#name=clinic_report_medical_detail&defaults.date_from={{time_start}}&defaults.date_to={{time_stop}}&defaults.types={{types}}&defaults.product_id={{product_id}}&defaults.product_categ_id={{product_categ_id}}">{{qty}} </a>
|
||||||
|
</td>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
report cycle item
|
report cycle item
|
||||||
- remove minus from fee amount
|
- remove minus from fee amount -> ok
|
||||||
- summary amount
|
- summary amount -> ok
|
||||||
report medical
|
report medical
|
||||||
- see detail of amount (department, patient, cycle, hdcase#)
|
- see detail of amount (department, patient, cycle, hdcase#)
|
||||||
|
|
||||||
report claim expense:
|
report claim expense:
|
||||||
- add good issue columns
|
- add good issue columns -> ok
|
||||||
|
|
Loading…
Reference in New Issue