report hd
parent
bdcddcf5c2
commit
6f437ceba7
|
@ -19,21 +19,43 @@ class HDReport(Model):
|
|||
_order="cycle_id desc"
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
lines=[]
|
||||
hd_case_ids=get_model("clinic.dialyzer").search([["state","=","completed"]])
|
||||
hd_cases=get_model("clinic.hd.case").search_browse([])
|
||||
for hd_case_ids in hd_cases:
|
||||
PATIENT_TYPE={
|
||||
"mg":"Medical Government",
|
||||
"sc":"Social Security",
|
||||
"nhso":"NHSO (30฿)",
|
||||
"personal": "Personal",
|
||||
"others": "Others",
|
||||
}
|
||||
dom=[]
|
||||
dom.append([
|
||||
'state','=','completed',
|
||||
])
|
||||
if obj.cycle_id:
|
||||
dom.append([
|
||||
'cycle_id','=',obj.cycle_id.id,
|
||||
])
|
||||
|
||||
if obj.date:
|
||||
dom.append(['time_start', ">=", obj.date+" 00:00:00"])
|
||||
dom.append(['time_stop', "<=", obj.date+" 23:59:59"])
|
||||
|
||||
print("dom ", dom)
|
||||
for hd_case in get_model("clinic.hd.case").search_browse(dom):
|
||||
patient_type=hd_case.patient_id.type
|
||||
patient_type=PATIENT_TYPE.get(patient_type)
|
||||
lines.append({
|
||||
'cycle' : hd_case_ids.cycle_id.name,
|
||||
'patient': hd_case_ids.patient_id.name,
|
||||
'doctor' : hd_case_ids.doctor_id.name,
|
||||
'total' : hd_case_ids.fee,
|
||||
'rc_no' : hd_case_ids.number,
|
||||
'nurse' : hd_case_ids.nurse_id.name,
|
||||
'cycle' : hd_case.cycle_id.name,
|
||||
'patient': hd_case.patient_id.name,
|
||||
'patient_type' : patient_type,
|
||||
'doctor' : hd_case.doctor_id.name,
|
||||
'total' : hd_case.fee,
|
||||
'rc_no' : hd_case.number,
|
||||
'nurse' : hd_case.nurse_id.name,
|
||||
})
|
||||
|
||||
data={
|
||||
'cycle_id': hd_case_ids.cycle or "Empty Cyle",
|
||||
'lines': lines,
|
||||
}
|
||||
return data
|
||||
|
|
Loading…
Reference in New Issue