hd case summary
parent
6bca8eb033
commit
f9cd6d404c
|
@ -2,7 +2,7 @@ import time
|
|||
from calendar import monthrange
|
||||
|
||||
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
|
||||
|
||||
|
@ -20,7 +20,6 @@ class ReportDiscontinuePatient(Model):
|
|||
}
|
||||
|
||||
def default_get(self,field_names=None,context={},**kw):
|
||||
user_id=get_active_user()
|
||||
defaults=context.get("defaults",{})
|
||||
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
||||
year,month=time.strftime("%Y-%m").split("-")
|
||||
|
@ -28,23 +27,12 @@ class ReportDiscontinuePatient(Model):
|
|||
date_from=defaults.get('date_from','%s-%s-01'%(year,month))
|
||||
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
||||
branch_id=defaults.get('branch_id',None)
|
||||
if not branch_id:
|
||||
staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||
if staff:
|
||||
branch_id=staff[0].branch_id.id
|
||||
else:
|
||||
branch_id=int(branch_id or "0")
|
||||
department_id=defaults.get('department_id',None)
|
||||
if not department_id:
|
||||
dom=[]
|
||||
dom.append(['user_id','=',user_id])
|
||||
print('defaults ', defaults)
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
staff=get_model("clinic.staff").search_browse(dom)
|
||||
if staff:
|
||||
department_id=staff[0].department_id.id
|
||||
else:
|
||||
department_id=int(department_id or "0")
|
||||
branch_id=int(branch_id)
|
||||
department_id=defaults.get('department_id',None)
|
||||
if department_id:
|
||||
department_id=int(department_id)
|
||||
res={
|
||||
'date': date,
|
||||
'date_from': date_from,
|
||||
|
@ -75,7 +63,6 @@ class ReportDiscontinuePatient(Model):
|
|||
dom=[]
|
||||
dom.append(['resign_date','>=',time_start])
|
||||
dom.append(['resign_date','<=',time_stop])
|
||||
dom.append(['active','=',False])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
|
|
@ -146,8 +146,6 @@ 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(['active','=',False]) #XXX
|
||||
print("1. >>> ", dom)
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
|
@ -164,7 +162,7 @@ class ReportHDCaseSummary(Model):
|
|||
'month': month_str,
|
||||
'qty': resign_patients_qty,
|
||||
'action': 'clinic_patient',
|
||||
'action_options': 'mode=list&search_domain=%s&tab_no=1'%dom,
|
||||
'action_options': 'mode=list&search_domain=%s&tab_no=2'%dom,
|
||||
}
|
||||
count+=1
|
||||
# all patient who are in hospital on select month
|
||||
|
@ -199,18 +197,11 @@ class ReportHDCaseSummary(Model):
|
|||
|
||||
|
||||
dom=[]
|
||||
## should be that month or from begin ?
|
||||
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)
|
||||
#dom.append(['reg_date','>=',time_start])
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
dom.append(['type_id','=',ptype['id']])
|
||||
print("2. >>> ", dom)
|
||||
###FIXME remove
|
||||
#dom.append(['resign_date','>=',time_start])
|
||||
#dom.append(['resign_date','<=',time_stop])
|
||||
#dom.append(['active','=',False]) #XXX
|
||||
|
||||
dom.append(['name','not in', resign_patients])
|
||||
npatients_qty=0
|
||||
for pt in get_model("clinic.patient").search(dom):
|
||||
npatients_qty+=1
|
||||
|
@ -235,7 +226,11 @@ class ReportHDCaseSummary(Model):
|
|||
lines.append(line)
|
||||
index+=1
|
||||
|
||||
context['defaults']={'date': date}
|
||||
context['defaults']={
|
||||
'date': date,
|
||||
'branch_id': branch_id,
|
||||
'department_id': department_id,
|
||||
}
|
||||
|
||||
medicals=get_model("clinic.report.medical.summary").get_report_data(ids=[],context=context)
|
||||
year=year+543
|
||||
|
@ -271,4 +266,9 @@ class ReportHDCaseSummary(Model):
|
|||
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
|
||||
|
||||
ReportHDCaseSummary.register()
|
||||
|
|
|
@ -20,7 +20,6 @@ class ReportRecentPatient(Model):
|
|||
}
|
||||
|
||||
def default_get(self,field_names=None,context={},**kw):
|
||||
user_id=get_active_user()
|
||||
defaults=context.get("defaults",{})
|
||||
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
||||
year,month=time.strftime("%Y-%m").split("-")
|
||||
|
@ -28,23 +27,11 @@ class ReportRecentPatient(Model):
|
|||
date_from=defaults.get('date_from','%s-%s-01'%(year,month))
|
||||
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
||||
branch_id=defaults.get('branch_id',None)
|
||||
if not branch_id:
|
||||
staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||
if staff:
|
||||
branch_id=staff[0].branch_id.id
|
||||
else:
|
||||
branch_id=int(branch_id or "0")
|
||||
department_id=defaults.get('department_id',None)
|
||||
if not department_id:
|
||||
dom=[]
|
||||
dom.append(['user_id','=',user_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
staff=get_model("clinic.staff").search_browse(dom)
|
||||
if staff:
|
||||
department_id=staff[0].department_id.id
|
||||
else:
|
||||
department_id=int(department_id or "0")
|
||||
branch_id=int(branch_id)
|
||||
department_id=defaults.get('department_id',None)
|
||||
if department_id:
|
||||
department_id=int(department_id)
|
||||
res={
|
||||
'date': date,
|
||||
'date_from': date_from,
|
||||
|
@ -79,6 +66,7 @@ class ReportRecentPatient(Model):
|
|||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
print("recent ", dom)
|
||||
records=get_model('clinic.patient').search_browse(dom)
|
||||
lines=[]
|
||||
no=1
|
||||
|
|
|
@ -42,14 +42,14 @@
|
|||
<thead>
|
||||
<th>
|
||||
<center>
|
||||
<a href="/ui#name=clinic_report_recent_patient&defaults.date={{date}}">
|
||||
<a href="/ui#name=clinic_report_recent_patient&defaults.date={{date}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">
|
||||
รายชื่อผู้ป่วยรับใหม่
|
||||
</a>
|
||||
</center>
|
||||
</th>
|
||||
<th>
|
||||
<center>
|
||||
<a href="/ui#name=clinic_report_discontinue_patient&defaults.date={{date}}">
|
||||
<a href="/ui#name=clinic_report_discontinue_patient&defaults.date={{date}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">
|
||||
รายชื่อผู้ป่วยจำหน่าย
|
||||
</a>
|
||||
</center>
|
||||
|
@ -122,9 +122,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<td colspan="2">
|
||||
<span>
|
||||
<center>
|
||||
<b>
|
||||
|
|
Loading…
Reference in New Issue