fix
parent
c48ad556bc
commit
fd33b9b1d0
|
@ -3,8 +3,6 @@
|
|||
<field name="type_id"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<!--<item string="Generate Visit" action="clinic_gen_visit"/>-->
|
||||
<!--<item string="New Dialyzer" method="new_dialyzer"/>-->
|
||||
<item string="New Address" method="simple_address" perm="clinic_simple_address"/>
|
||||
</button>
|
||||
</head>
|
||||
<field name="number"/>
|
||||
|
|
|
@ -4,6 +4,8 @@ class Address(Model):
|
|||
_inherit="address"
|
||||
_fields={
|
||||
'fax': fields.Char("Fax"),
|
||||
'patient_id': fields.Many2One("clinic.patient", "Patient"),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
||||
}
|
||||
|
||||
Address.register()
|
||||
|
|
|
@ -142,12 +142,12 @@ class Patient(Model):
|
|||
"partner_id": fields.Many2One("partner","Contact"),
|
||||
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
|
||||
"active":fields.Boolean("Active"),
|
||||
"dispose":fields.Boolean("Dispose"),
|
||||
"dispose":fields.Boolean("Dispose",search=True),
|
||||
'note': fields.Text("Note"),
|
||||
'categ_id': fields.Many2One("clinic.patient.categ","Category"),
|
||||
'doctor_id': fields.Many2One("clinic.staff","Doctor",domain=[['type','=','doctor']]),
|
||||
"documents": fields.One2Many("document","related_id","Documents"),
|
||||
'resign_date': fields.Date("Dispose Date"),
|
||||
'resign_date': fields.Date("Dispose Date", search=True),
|
||||
'rm_remain_visit': fields.Boolean("Auto Remove Remaining Visit"),
|
||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||
'cycle_id': fields.Many2One("clinic.cycle","Last Cycle",function="_get_last_cycle"),
|
||||
|
@ -223,7 +223,7 @@ class Patient(Model):
|
|||
if res.get("department_ids"):
|
||||
dpt_ids=res['department_ids']
|
||||
else:
|
||||
dpt_ids=res['department_id']
|
||||
dpt_ids=[res['department_id']]
|
||||
dpts=get_model("clinic.department").browse(dpt_ids)
|
||||
code=','.join([dpt.code for dpt in dpts])
|
||||
return code
|
||||
|
@ -249,6 +249,7 @@ class Patient(Model):
|
|||
'departments': _get_departments,
|
||||
'location': _get_default_location,
|
||||
'nation_id': _get_nation,
|
||||
'dispose': False,
|
||||
}
|
||||
|
||||
_sql_constraints=("clinic_patient_key_uniq","unique(name_check,branch_id)","name should be unique"),
|
||||
|
|
|
@ -99,6 +99,8 @@ class ReportHDCaseSummary(Model):
|
|||
return dom
|
||||
|
||||
def replace_quote(dom=""):
|
||||
dom=dom.replace("False","false") #XXX
|
||||
dom=dom.replace("True","true") #XXX
|
||||
return dom.replace("'","\"")
|
||||
|
||||
count=1
|
||||
|
@ -127,6 +129,8 @@ class ReportHDCaseSummary(Model):
|
|||
weekday, prev_total_day=monthrange(prev_year, prev_month)
|
||||
time_stop='%s-%s-%s'%(prev_year,str(prev_month).zfill(2),prev_total_day)
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',False])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -148,6 +152,8 @@ class ReportHDCaseSummary(Model):
|
|||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['reg_date','>=',time_start])
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',False])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -168,6 +174,8 @@ class ReportHDCaseSummary(Model):
|
|||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['resign_date','>=',time_start])
|
||||
dom.append(['resign_date','<=',time_stop])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',True])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -177,14 +185,12 @@ class ReportHDCaseSummary(Model):
|
|||
for pt in get_model('clinic.patient').search_browse(dom):
|
||||
resign_patients_qty+=1
|
||||
resign_patients.append(pt.name)
|
||||
|
||||
del dom[-1]
|
||||
dom=replace_quote('%s'%dom)
|
||||
items['topic%s'%count]={
|
||||
'month': month_str,
|
||||
'qty': resign_patients_qty,
|
||||
'action': 'clinic_patient',
|
||||
'action_options': 'mode=list&search_domain=%s&tab_no=2'%dom,
|
||||
'action_options': 'mode=list&search_domain=%s&tab_no=3'%dom,
|
||||
}
|
||||
count+=1
|
||||
# all patient who are in hospital on select month
|
||||
|
@ -196,6 +202,8 @@ class ReportHDCaseSummary(Model):
|
|||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',False])
|
||||
total_patient=get_model('clinic.patient').search_browse(dom)
|
||||
dom=replace_quote('%s'%dom)
|
||||
total_patient_qty=len(total_patient) or 0
|
||||
|
@ -223,16 +231,22 @@ class ReportHDCaseSummary(Model):
|
|||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
dom.append(['type_id','=',ptype['id']])
|
||||
dom.append(['name','not in', resign_patients])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['dispose','=',False])
|
||||
npatients_qty=0
|
||||
for pt in get_model("clinic.patient").search(dom):
|
||||
npatients_qty+=1
|
||||
dom=replace_quote('%s'%dom)
|
||||
print(">>> <<< ", dom)
|
||||
items[tkey]={
|
||||
'month': '',
|
||||
'qty': npatients_qty,
|
||||
'action': 'clinic_patient',
|
||||
'action_options': 'mode=list&search_domain=%s'%dom,
|
||||
'action_options': 'mode=list&tab_no=0&search_domain=%s'%dom,
|
||||
}
|
||||
count+=1
|
||||
|
||||
|
@ -306,5 +320,4 @@ class ReportHDCaseSummary(Model):
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
ReportHDCaseSummary.register()
|
||||
|
|
|
@ -206,7 +206,7 @@ class Staff(Model):
|
|||
if res.get("department_ids"):
|
||||
dpt_ids=res['department_ids']
|
||||
else:
|
||||
dpt_ids=res['department_id']
|
||||
dpt_ids=[res['department_id']]
|
||||
dpts=get_model("clinic.department").browse(dpt_ids)
|
||||
code=','.join([dpt.code for dpt in dpts])
|
||||
return code
|
||||
|
|
Loading…
Reference in New Issue