report hd case summary (revise) 2
parent
59b0427b6a
commit
392e04f932
|
@ -1,6 +1,7 @@
|
|||
<form model="clinic.patient.move">
|
||||
<field name="date"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="type_id"/>
|
||||
<field name="type"/>
|
||||
<field name="patient_name"/>
|
||||
<field name="patient_type"/>
|
||||
|
|
|
@ -16,3 +16,4 @@ from . import clinic_setting
|
|||
#from . import add_missing_dlz # pending
|
||||
#from . import validate_cycle_item
|
||||
from . import update_line_amount
|
||||
from . import add_patient_moves
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
import time
|
||||
|
||||
from netforce.model import get_model
|
||||
from netforce import migration
|
||||
from netforce.access import set_active_user, get_active_user, set_active_company, get_active_company
|
||||
from netforce.database import get_connection
|
||||
|
||||
class Migration(migration.Migration):
|
||||
_name="clinic.patient.move"
|
||||
_version="2.12.7"
|
||||
|
||||
def migrate(self):
|
||||
set_active_company(1)
|
||||
set_active_user(1)
|
||||
user_id=get_active_user()
|
||||
company_id=get_active_company()
|
||||
count_out=0
|
||||
count_in=0
|
||||
db=get_connection()
|
||||
vals=[]
|
||||
for patient in get_model("clinic.patient").search_browse([]):
|
||||
count_out=0
|
||||
count_in=0
|
||||
date_str=""
|
||||
time_tuple=""
|
||||
if patient.dispose==True:
|
||||
if not patient.resign_date:
|
||||
#time_tuple=lambda *a: time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
time_tuple = lambda *a: time.strftime("%Y-%m-%d")
|
||||
else:
|
||||
date_str = patient.resign_date
|
||||
time_tuple = lambda *a: time.strptime(date_str, "%Y-%m-%d")
|
||||
line_vals={
|
||||
"patient_id": patient.id,
|
||||
"patient_name": "%s %s"% (patient.first_name or "",patient.last_name or ""),
|
||||
"patient_type": patient.type_id.name,
|
||||
"type": "out",
|
||||
"type_id": patient.type_id.id,
|
||||
"date": date_str,
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
db.execute("""
|
||||
insert INTO clinic_patient_move (patient_id,patient_name,patient_type,type_id,type,date,create_time,create_uid) VALUES (%d,'%s','%s',%d,'%s','%s',CURRENT_DATE,%d);
|
||||
"""%(line_vals.get('patient_id'),line_vals.get('patient_name'),line_vals.get('patient_type'),line_vals.get('type_id'),line_vals.get('type'),line_vals.get('date'),user_id))
|
||||
print("insert INTO clinic.patient.move ('OUT'): %s , %s , %s"%(line_vals.get('patient_name'),line_vals.get('type'),line_vals.get('date')))
|
||||
date_str = patient.reg_date
|
||||
time_tuple = lambda *a: time.strptime(date_str, "%Y-%m-%d")
|
||||
line_vals={
|
||||
"patient_id": patient.id,
|
||||
"patient_name": "%s %s"% (patient.first_name or "",patient.last_name or ""),
|
||||
"patient_type": patient.type_id.name,
|
||||
"type": "in",
|
||||
"type_id": patient.type_id.id,
|
||||
"date": date_str,
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
db.execute("""
|
||||
insert INTO clinic_patient_move (patient_id,patient_name,patient_type,type_id,type,date,create_time,create_uid) VALUES (%d,'%s','%s',%d,'%s','%s',CURRENT_DATE,%d);
|
||||
"""%(line_vals.get('patient_id'),line_vals.get('patient_name'),line_vals.get('patient_type'),line_vals.get('type_id'),line_vals.get('type'),line_vals.get('date'),user_id))
|
||||
print("insert INTO clinic.patient.move ('IN'): %s , %s , %s"%(line_vals.get('patient_name'),line_vals.get('type'),line_vals.get('date')))
|
||||
#set_active_user(user_id)
|
||||
return True
|
||||
|
||||
Migration.register()
|
|
@ -330,15 +330,17 @@ class Patient(Model):
|
|||
})
|
||||
|
||||
#TODO create patient.move
|
||||
patient_move={
|
||||
"patient_id": obj.id,
|
||||
"patient_name": "%s %s"% (obj.first_name or "",obj.last_name or ""),
|
||||
"patient_type": obj.type_id.name,
|
||||
"type": "in",
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
get_model("clinic.patient.move").create(patient_move)
|
||||
if obj.walkin=="no":
|
||||
patient_move={
|
||||
"patient_id": obj.id,
|
||||
"patient_name": "%s %s"% (obj.first_name or "",obj.last_name or ""),
|
||||
"patient_type": obj.type_id.name,
|
||||
"type": "in",
|
||||
"type_id": obj.type_id.id,
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
get_model("clinic.patient.move").create(patient_move)
|
||||
return obj_id
|
||||
|
||||
def delete(self,ids,context={}):
|
||||
|
@ -385,19 +387,33 @@ class Patient(Model):
|
|||
vals['resign_date']=time.strftime("%Y-%m-%d")
|
||||
vals['rm_remain_visit']=True
|
||||
obj=self.browse(ids)[0]
|
||||
patient_move={
|
||||
"patient_id": obj.id,
|
||||
"patient_name": "%s %s"% (obj.first_name or "",obj.last_name or ""),
|
||||
"patient_type": obj.type_id.name,
|
||||
"type": "out",
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
get_model("clinic.patient.move").create(patient_move)
|
||||
if obj.walkin=='no':
|
||||
patient_move={
|
||||
"patient_id": obj.id,
|
||||
"patient_name": "%s %s"% (obj.first_name or "",obj.last_name or ""),
|
||||
"patient_type": obj.type_id.name,
|
||||
"type": "out",
|
||||
"type_id": obj.type_id.id,
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
get_model("clinic.patient.move").create(patient_move)
|
||||
else:
|
||||
vals['state']='admit'
|
||||
vals['rm_remain_visit']=False
|
||||
vals['resign_date']=None
|
||||
obj=self.browse(ids)[0]
|
||||
if obj.walkin=='no':
|
||||
patient_move={
|
||||
"patient_id": obj.id,
|
||||
"patient_name": "%s %s"% (obj.first_name or "",obj.last_name or ""),
|
||||
"patient_type": obj.type_id.name,
|
||||
"type": "in",
|
||||
"type_id": obj.type_id.id,
|
||||
#"location_from_id": obj.location,
|
||||
#"location_to_id": obj.location,
|
||||
}
|
||||
get_model("clinic.patient.move").create(patient_move)
|
||||
ctx={}
|
||||
if 'active' in vals.keys():
|
||||
if not vals['active']:
|
||||
|
|
|
@ -6,7 +6,8 @@ class PatientMove(Model):
|
|||
_name='clinic.patient.move'
|
||||
|
||||
_fields={
|
||||
'patient_id': fields.Many2One("clinic.patient", "Patient", required=True, on_delete="cascade"),
|
||||
"patient_id": fields.Many2One("clinic.patient", "Patient", required=True, on_delete="cascade"),
|
||||
"type_id": fields.Many2One("clinic.patient.type","Type",search=True,required=True),
|
||||
"date": fields.DateTime("Date"),
|
||||
"patient_name": fields.Char("Patient Name"),
|
||||
"patient_type": fields.Char("Patient Type"), #ปกส. ....
|
||||
|
|
|
@ -51,7 +51,7 @@ class ReportDiscontinuePatient(Model):
|
|||
}
|
||||
return res
|
||||
|
||||
def get_report_data_revise(self,ids,context={}):
|
||||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
|
@ -90,6 +90,8 @@ class ReportDiscontinuePatient(Model):
|
|||
continue
|
||||
if record.patient_id.department_id.id!=department_id:
|
||||
continue
|
||||
if record.patient_id.walkin!='no':
|
||||
continue
|
||||
lines.append({
|
||||
'no': no,
|
||||
'name': record.patient_name or '',
|
||||
|
@ -121,7 +123,7 @@ class ReportDiscontinuePatient(Model):
|
|||
}
|
||||
return data
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
def get_report_data_bak(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
|
|
|
@ -77,7 +77,7 @@ class ReportHDCaseDetail(Model):
|
|||
#print('report.hd.case.detail.defaults ', res)
|
||||
return res
|
||||
|
||||
def get_report_data_revise(self,ids,context={}):
|
||||
def get_report_data(self,ids,context={}):
|
||||
user_id=get_active_user()
|
||||
set_active_user(1)
|
||||
|
||||
|
@ -166,34 +166,37 @@ class ReportHDCaseDetail(Model):
|
|||
reg_date='%s-%s-%s'%(prev_year,str(prev_month).zfill(2),str(prev_total_day).zfill(2))
|
||||
print('topic2 ', reg_date)
|
||||
dom=[]
|
||||
dom.append(['reg_date','<=',reg_date])
|
||||
dom.append(['walkin','=',"no"])
|
||||
#dom.append(['dispose','=',False])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
total=0
|
||||
for patient in get_model("clinic.patient").search_browse(dom):
|
||||
if patient.dispose and patient.resign_date:
|
||||
if patient.resign_date < date_from:
|
||||
print('continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',reg_date]],order="date desc"))==0:
|
||||
continue
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',reg_date]],order="date desc"))==0:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',reg_date]],order="date desc")[0]
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'note': moves_in.patient_id.note,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
else:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',reg_date]],order="date desc")[0]
|
||||
moves_out=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',reg_date]],order="date desc")[0]
|
||||
if moves_out.date > moves_in.date:
|
||||
continue
|
||||
elif patient.resign_date > date_to:
|
||||
pass
|
||||
elif not patient.resign_date > date_to:
|
||||
print('pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
elif not (patient.resign_date>=date_from and patient.resign_date<=date_to):
|
||||
print('continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
continue
|
||||
print('pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
lines.append({
|
||||
'number': patient.hn_no,
|
||||
'pid': patient.id,
|
||||
'name': patient.name,
|
||||
'note': patient.note,
|
||||
'date': patient.reg_date,
|
||||
})
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'note': moves_in.patient_id.note,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
lines.append(data)
|
||||
total+=1
|
||||
# new patient of this month
|
||||
#TODO should include move_history
|
||||
|
@ -204,29 +207,18 @@ class ReportHDCaseDetail(Model):
|
|||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
dom.append(['type','=',"in"])
|
||||
#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:
|
||||
#dom.append(['department_id','=',department_id])
|
||||
total=0
|
||||
for moves in get_model('clinic.patient.move').search_browse(dom):
|
||||
if moves.patient_id.branch_id.id!=branch_id:
|
||||
continue
|
||||
if moves.patient_id.department_id.id!=department_id:
|
||||
continue
|
||||
if moves.patient_id.walkin!='no':
|
||||
continue
|
||||
lines.append({
|
||||
#'number': patient.hn_no,
|
||||
#'pid': patient.id,
|
||||
#'name': patient.name,
|
||||
#'note': patient.note,
|
||||
#'date': patient.reg_date,
|
||||
'number': moves.patient_id.hn_no,
|
||||
'pid': moves.patient_id.id,
|
||||
'name': moves.patient_id.name,
|
||||
'name': moves.patient_name,
|
||||
'note': moves.patient_id.note,
|
||||
'date': moves.date[:10],
|
||||
})
|
||||
|
@ -237,27 +229,21 @@ class ReportHDCaseDetail(Model):
|
|||
title=titles.get(report_type,'no title')
|
||||
title+=' '+month_str
|
||||
dom=[]
|
||||
#dom.append(['resign_date','>=',time_start])
|
||||
#dom.append(['resign_date','<=',time_stop])
|
||||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
dom.append(['type','=',"out"])
|
||||
#dom.append(['walkin','=',"no"])
|
||||
#dom.append(['dispose','=',True])
|
||||
#if branch_id:
|
||||
#dom.append(['branch_id','=',branch_id])
|
||||
#if department_id:
|
||||
#dom.append(['department_id','=',department_id])
|
||||
total=0
|
||||
for moves in get_model('clinic.patient.move').search_browse(dom):
|
||||
if moves.patient_id.branch_id.id!=branch_id:
|
||||
continue
|
||||
if moves.patient_id.department_id.id!=department_id:
|
||||
continue
|
||||
if moves.patient_id.walkin!='no':
|
||||
continue
|
||||
lines.append({
|
||||
'number': moves.patient_id.hn_no,
|
||||
'pid': moves.patient_id.id,
|
||||
'name': moves.patient_id.name,
|
||||
'pid': moves.id,
|
||||
'name': moves.patient_name,
|
||||
'note': moves.patient_id.note,
|
||||
'date': moves.date[:10],
|
||||
})
|
||||
|
@ -268,34 +254,39 @@ class ReportHDCaseDetail(Model):
|
|||
title=titles.get(report_type,'no title')
|
||||
title+=' '+next_month_str
|
||||
dom=[]
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
dom.append(['walkin','=',"no"])
|
||||
total=0
|
||||
for patient in get_model('clinic.patient').search_browse(dom,order="reg_date"):
|
||||
if patient.dispose and patient.resign_date:
|
||||
if patient.resign_date < date_from:
|
||||
print('1. continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
count=0
|
||||
data_check={}
|
||||
for patient in get_model('clinic.patient').search_browse(dom):
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc"))==0:
|
||||
continue
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',time_stop]],order="date desc"))==0:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc")[0]
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'note': moves_in.patient_id.note,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
else:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc")[0]
|
||||
moves_out=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',time_stop]],order="date desc")[0]
|
||||
if moves_out.date > moves_in.date:
|
||||
continue
|
||||
elif patient.resign_date > date_to:
|
||||
pass
|
||||
elif patient.resign_date > date_to:
|
||||
print('2. pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
elif (patient.resign_date>=date_from and patient.resign_date<=date_to):
|
||||
print('3. continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
continue
|
||||
print('4. pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
lines.append({
|
||||
'number': patient.hn_no,
|
||||
'pid': patient.id,
|
||||
'name': patient.name,
|
||||
'note': patient.note,
|
||||
'date': patient.reg_date,
|
||||
'dispose': patient.dispose and 'yes' or 'no',
|
||||
})
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'note': moves_in.patient_id.note,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
lines.append(data)
|
||||
total+=1
|
||||
# find patient movement
|
||||
elif report_type=='topic6':
|
||||
|
@ -307,7 +298,6 @@ class ReportHDCaseDetail(Model):
|
|||
return {'total': 0}
|
||||
title=ptype.name or ''
|
||||
dom=[]
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
dom.append(['type_id','=',ptype['id']])
|
||||
dom.append(['walkin','=',"no"])
|
||||
dom.append(['type_id','=',ptype.id])
|
||||
|
@ -316,25 +306,29 @@ class ReportHDCaseDetail(Model):
|
|||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
total=0
|
||||
for patient in get_model("clinic.patient").search_browse(dom):
|
||||
if patient.resign_date:
|
||||
if patient.dispose and patient.resign_date < date_from:
|
||||
print('1. continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
for patient in get_model('clinic.patient').search_browse(dom):
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc"))==0:
|
||||
continue
|
||||
if len(get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',time_stop]],order="date desc"))==0:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc")[0]
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
else:
|
||||
moves_in=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','in'],['date','<=',time_stop]],order="date desc")[0]
|
||||
moves_out=get_model('clinic.patient.move').search_browse([['patient_id','=',patient.id],['type','=','out'],['date','<=',time_stop]],order="date desc")[0]
|
||||
if moves_out.date > moves_in.date:
|
||||
continue
|
||||
elif patient.resign_date > date_to:
|
||||
pass
|
||||
elif patient.resign_date > date_to:
|
||||
print('2. pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
elif (patient.resign_date>=date_from and patient.resign_date<=date_to):
|
||||
print('3. continue >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
continue
|
||||
print('4. pass >>> ', patient.name, patient.resign_date, date_from, date_to)
|
||||
lines.append({
|
||||
'pid': patient.id,
|
||||
'number': patient.hn_no,
|
||||
'name': patient.name or '',
|
||||
'date': patient.reg_date,
|
||||
})
|
||||
data={
|
||||
'number': moves_in.patient_id.hn_no,
|
||||
'pid': moves_in.patient_id.id,
|
||||
'name': moves_in.patient_name,
|
||||
'date': moves_in.patient_id.reg_date,
|
||||
}
|
||||
lines.append(data)
|
||||
total+=1
|
||||
sub_name=''
|
||||
if department_id:
|
||||
|
@ -366,7 +360,7 @@ class ReportHDCaseDetail(Model):
|
|||
set_active_user(user_id)
|
||||
return data
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
def get_report_data_bak(self,ids,context={}):
|
||||
user_id=get_active_user()
|
||||
set_active_user(1)
|
||||
|
||||
|
@ -482,6 +476,7 @@ class ReportHDCaseDetail(Model):
|
|||
'name': patient.name,
|
||||
'note': patient.note,
|
||||
'date': patient.reg_date,
|
||||
'dispose': patient.dispose and 'yes' or 'no',
|
||||
})
|
||||
total+=1
|
||||
# new patient of this month
|
||||
|
@ -604,6 +599,7 @@ class ReportHDCaseDetail(Model):
|
|||
'number': patient.hn_no,
|
||||
'name': patient.name or '',
|
||||
'date': patient.reg_date,
|
||||
'dispose': patient.dispose and 'yes' or 'no',
|
||||
})
|
||||
total+=1
|
||||
sub_name=''
|
||||
|
|
|
@ -176,11 +176,11 @@ class ReportHDCaseSummary(Model):
|
|||
dom2=dom+[['patient_type_id','=',topics[topic]['ptype_id']]]
|
||||
dom_txt=set_default(dom2,topic)
|
||||
ctx=set_ctx(dom2,topic)
|
||||
qty=get_model("clinic.report.hd.case.detail").get_report_data_revise(ids=[],context=ctx)['total']
|
||||
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||
else:
|
||||
dom_txt=set_default(dom,topic)
|
||||
ctx=set_ctx(dom,topic)
|
||||
qty=get_model("clinic.report.hd.case.detail").get_report_data_revise(ids=[],context=ctx)['total']
|
||||
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||
item_vals={
|
||||
"topic": topics[topic]['name'],
|
||||
"unit": topics[topic]['unit'],
|
||||
|
@ -233,8 +233,8 @@ class ReportHDCaseSummary(Model):
|
|||
'month': month_str,
|
||||
'year': year,
|
||||
'lines': lines,
|
||||
'recent_patients': get_model("clinic.report.recent.patient").get_report_data_revise(ids=[],context=context)['lines'],
|
||||
'resign_patients': get_model("clinic.report.discontinue.patient").get_report_data_revise(ids=[],context=context)['lines'],
|
||||
'recent_patients': get_model("clinic.report.recent.patient").get_report_data(ids=[],context=context)['lines'],
|
||||
'resign_patients': get_model("clinic.report.discontinue.patient").get_report_data(ids=[],context=context)['lines'],
|
||||
'medicals': medical_lines,
|
||||
'titles': medical_titles,
|
||||
'plines': plines,
|
||||
|
|
|
@ -50,7 +50,7 @@ class ReportRecentPatient(Model):
|
|||
}
|
||||
return res
|
||||
|
||||
def get_report_data_revise(self,ids,context={}):
|
||||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
|
@ -72,14 +72,6 @@ class ReportRecentPatient(Model):
|
|||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
dom.append(['type','=',"in"])
|
||||
#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:
|
||||
#dom.append(['department_id','=',department_id])
|
||||
records=get_model('clinic.patient.move').search_browse(dom)
|
||||
lines=[]
|
||||
no=1
|
||||
|
@ -88,6 +80,8 @@ class ReportRecentPatient(Model):
|
|||
continue
|
||||
if record.patient_id.department_id.id!=department_id:
|
||||
continue
|
||||
if record.patient_id.walkin!='no':
|
||||
continue
|
||||
lines.append({
|
||||
'no': no,
|
||||
'name': record.patient_name or '',
|
||||
|
@ -120,7 +114,7 @@ class ReportRecentPatient(Model):
|
|||
}
|
||||
return data
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
def get_report_data_bak(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
|
|
|
@ -70,8 +70,11 @@
|
|||
<td>
|
||||
{{view "link" string=name action="clinic_patient_move" action_options="mode=form" active_id=pid}}
|
||||
</td>
|
||||
<!--button delete ##TODO-->
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger btn-xs">Del</button>
|
||||
<button type="button" class="btn btn-danger btn-xs">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
@ -103,8 +106,11 @@
|
|||
<td>
|
||||
{{view "link" string=name action="clinic_patient_move" action_options="mode=form" active_id=pid}}
|
||||
</td>
|
||||
<!--button delete ##TODO-->
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger btn-xs">Del</button>
|
||||
<button type="button" class="btn btn-danger btn-xs">
|
||||
<span class="glyphicon glyphicon-remove"></span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
Loading…
Reference in New Issue