hd case summary
parent
6bca8eb033
commit
f9cd6d404c
|
@ -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
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ class ReportDiscontinuePatient(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def default_get(self,field_names=None,context={},**kw):
|
def default_get(self,field_names=None,context={},**kw):
|
||||||
user_id=get_active_user()
|
|
||||||
defaults=context.get("defaults",{})
|
defaults=context.get("defaults",{})
|
||||||
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
||||||
year,month=time.strftime("%Y-%m").split("-")
|
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_from=defaults.get('date_from','%s-%s-01'%(year,month))
|
||||||
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
||||||
branch_id=defaults.get('branch_id',None)
|
branch_id=defaults.get('branch_id',None)
|
||||||
if not branch_id:
|
print('defaults ', defaults)
|
||||||
staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
if branch_id:
|
||||||
if staff:
|
branch_id=int(branch_id)
|
||||||
branch_id=staff[0].branch_id.id
|
|
||||||
else:
|
|
||||||
branch_id=int(branch_id or "0")
|
|
||||||
department_id=defaults.get('department_id',None)
|
department_id=defaults.get('department_id',None)
|
||||||
if not department_id:
|
if department_id:
|
||||||
dom=[]
|
department_id=int(department_id)
|
||||||
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")
|
|
||||||
res={
|
res={
|
||||||
'date': date,
|
'date': date,
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
|
@ -75,7 +63,6 @@ class ReportDiscontinuePatient(Model):
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['resign_date','>=',time_start])
|
dom.append(['resign_date','>=',time_start])
|
||||||
dom.append(['resign_date','<=',time_stop])
|
dom.append(['resign_date','<=',time_stop])
|
||||||
dom.append(['active','=',False])
|
|
||||||
if branch_id:
|
if branch_id:
|
||||||
dom.append(['branch_id','=',branch_id])
|
dom.append(['branch_id','=',branch_id])
|
||||||
if department_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)
|
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_start])
|
||||||
dom.append(['resign_date','<=',time_stop])
|
dom.append(['resign_date','<=',time_stop])
|
||||||
dom.append(['active','=',False]) #XXX
|
|
||||||
print("1. >>> ", dom)
|
|
||||||
if branch_id:
|
if branch_id:
|
||||||
dom.append(['branch_id','=',branch_id])
|
dom.append(['branch_id','=',branch_id])
|
||||||
if department_id:
|
if department_id:
|
||||||
|
@ -164,7 +162,7 @@ class ReportHDCaseSummary(Model):
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'qty': resign_patients_qty,
|
'qty': resign_patients_qty,
|
||||||
'action': 'clinic_patient',
|
'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
|
count+=1
|
||||||
# all patient who are in hospital on select month
|
# all patient who are in hospital on select month
|
||||||
|
@ -199,18 +197,11 @@ class ReportHDCaseSummary(Model):
|
||||||
|
|
||||||
|
|
||||||
dom=[]
|
dom=[]
|
||||||
## should be that month or from begin ?
|
|
||||||
time_start='%s-%s-01'%(year,str(crr_month).zfill(2))
|
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)
|
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(['reg_date','<=',time_stop])
|
||||||
dom.append(['type_id','=',ptype['id']])
|
dom.append(['type_id','=',ptype['id']])
|
||||||
print("2. >>> ", dom)
|
dom.append(['name','not in', resign_patients])
|
||||||
###FIXME remove
|
|
||||||
#dom.append(['resign_date','>=',time_start])
|
|
||||||
#dom.append(['resign_date','<=',time_stop])
|
|
||||||
#dom.append(['active','=',False]) #XXX
|
|
||||||
|
|
||||||
npatients_qty=0
|
npatients_qty=0
|
||||||
for pt in get_model("clinic.patient").search(dom):
|
for pt in get_model("clinic.patient").search(dom):
|
||||||
npatients_qty+=1
|
npatients_qty+=1
|
||||||
|
@ -235,7 +226,11 @@ class ReportHDCaseSummary(Model):
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
index+=1
|
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)
|
medicals=get_model("clinic.report.medical.summary").get_report_data(ids=[],context=context)
|
||||||
year=year+543
|
year=year+543
|
||||||
|
@ -271,4 +266,9 @@ class ReportHDCaseSummary(Model):
|
||||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def onchange_branch(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
data['department_id']=None
|
||||||
|
return data
|
||||||
|
|
||||||
ReportHDCaseSummary.register()
|
ReportHDCaseSummary.register()
|
||||||
|
|
|
@ -20,7 +20,6 @@ class ReportRecentPatient(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def default_get(self,field_names=None,context={},**kw):
|
def default_get(self,field_names=None,context={},**kw):
|
||||||
user_id=get_active_user()
|
|
||||||
defaults=context.get("defaults",{})
|
defaults=context.get("defaults",{})
|
||||||
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
date=defaults.get('date',time.strftime("%Y-%m-%d"))
|
||||||
year,month=time.strftime("%Y-%m").split("-")
|
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_from=defaults.get('date_from','%s-%s-01'%(year,month))
|
||||||
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
|
||||||
branch_id=defaults.get('branch_id',None)
|
branch_id=defaults.get('branch_id',None)
|
||||||
if not branch_id:
|
if branch_id:
|
||||||
staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
branch_id=int(branch_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)
|
department_id=defaults.get('department_id',None)
|
||||||
if not department_id:
|
if department_id:
|
||||||
dom=[]
|
department_id=int(department_id)
|
||||||
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")
|
|
||||||
res={
|
res={
|
||||||
'date': date,
|
'date': date,
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
|
@ -79,6 +66,7 @@ class ReportRecentPatient(Model):
|
||||||
dom.append(['branch_id','=',branch_id])
|
dom.append(['branch_id','=',branch_id])
|
||||||
if department_id:
|
if department_id:
|
||||||
dom.append(['department_id','=',department_id])
|
dom.append(['department_id','=',department_id])
|
||||||
|
print("recent ", dom)
|
||||||
records=get_model('clinic.patient').search_browse(dom)
|
records=get_model('clinic.patient').search_browse(dom)
|
||||||
lines=[]
|
lines=[]
|
||||||
no=1
|
no=1
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
<thead>
|
<thead>
|
||||||
<th>
|
<th>
|
||||||
<center>
|
<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>
|
</a>
|
||||||
</center>
|
</center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<center>
|
<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>
|
</a>
|
||||||
</center>
|
</center>
|
||||||
|
@ -122,9 +122,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td colspan="2">
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span>
|
<span>
|
||||||
<center>
|
<center>
|
||||||
<b>
|
<b>
|
||||||
|
|
Loading…
Reference in New Issue