xxx
commit
1286e1641d
|
@ -0,0 +1,8 @@
|
||||||
|
<action> -->
|
||||||
|
<field name="string">HD Report Detail</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.report.hd.detail</field>
|
||||||
|
<field name="report_template">report_hd_detail</field>
|
||||||
|
<field name="report_template_xls">report_hd_detail</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Medical Report Summary</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.report.hd.madical</field>
|
||||||
|
<field name="report_template">report_hd_madical</field>
|
||||||
|
<field name="report_template_xls">report_hd_madical</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">HD Report Summary</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.report.hd.summary</field>
|
||||||
|
<field name="report_template">report_hd_summary</field>
|
||||||
|
<field name="report_template_xls">report_hd_summary</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Translation</field>
|
||||||
|
<field name="view_cls">multi_view</field>
|
||||||
|
<field name="model">clinic.translate</field>
|
||||||
|
<field name="modes">list,form</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -26,8 +26,10 @@
|
||||||
<field name="bp_start"/>
|
<field name="bp_start"/>
|
||||||
<field name="per_bp_start"/>
|
<field name="per_bp_start"/>
|
||||||
<field name="bp_stop"/>
|
<field name="bp_stop"/>
|
||||||
<field name="per_bp_stop"/>
|
<field name="per_bp_stop"/>
|
||||||
<field name="hct" onchange="onchange_hct"/>
|
<field name="hct" onchange="onchange_hct"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="hct_alert"/>
|
||||||
<field name="dialyzers" nolabel="1">
|
<field name="dialyzers" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||||
|
|
|
@ -20,12 +20,15 @@
|
||||||
<item string="Treatments" action="clinic_hd_case"/>
|
<item string="Treatments" action="clinic_hd_case"/>
|
||||||
<item string="Reports">
|
<item string="Reports">
|
||||||
<header string="HD CASE"/>
|
<header string="HD CASE"/>
|
||||||
<item string="Daily" action="clinic_report_hd_dialy"/>
|
<item string="HD Detail" action="clinic_report_hd_detail"/>
|
||||||
<item string="Monthly" action="clinic_report_hd_monthly"/>
|
<item string="HD Summary" action="clinic_report_hd_summary"/>
|
||||||
|
<header string="HD Madical"/>
|
||||||
|
<item string="Madical Summary" action="clinic_report_hd_madical"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="Settings">
|
<item string="Settings">
|
||||||
<item string="Cycles" action="clinic_cycle"/>
|
<item string="Cycles" action="clinic_cycle"/>
|
||||||
<item string="Departments" action="clinic_department"/>
|
<item string="Departments" action="clinic_department"/>
|
||||||
|
<item string="Translate" action="clinic_translate"/>
|
||||||
<item string="Clinic Settings" action="clinic_setting"/>
|
<item string="Clinic Settings" action="clinic_setting"/>
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<form model="clinic.report.hd.detail">
|
||||||
|
<group>
|
||||||
|
<field name="date_from" span="2"/>
|
||||||
|
<field name="date_to" span="2"/>
|
||||||
|
<field name="cycle_id" span="2"/>
|
||||||
|
<field name="patient_id" span="2"/>
|
||||||
|
<field name="nurse_id" span="2"/>
|
||||||
|
<field name="doctor_id" span="2"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<form model="clinic.report.hd.madical">
|
||||||
|
<field name="date" mode="month" span="2"/>
|
||||||
|
</form>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<form model="clinic.report.hd.summary">
|
||||||
|
<field name="date" mode="month" span="2"/>
|
||||||
|
</form>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<form model="clinic.translate">
|
||||||
|
<field name="original_string"/>
|
||||||
|
<field name="translate"/>
|
||||||
|
</form>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<list model="clinic.translate">
|
||||||
|
<field name="original_string"/>
|
||||||
|
<field name="translate"/>
|
||||||
|
</list>
|
|
@ -29,7 +29,9 @@ from . import file_sheet
|
||||||
from . import cycle
|
from . import cycle
|
||||||
from . import gen_visit
|
from . import gen_visit
|
||||||
from . import gen_visit_line
|
from . import gen_visit_line
|
||||||
from . import report_hd_dialy
|
from . import report_hd_detail
|
||||||
from . import report_hd_monthly
|
from . import report_hd_summary
|
||||||
from . import payment
|
from . import payment
|
||||||
from . import input_data
|
from . import input_data
|
||||||
|
from . import report_hd_madical
|
||||||
|
from . import translate
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.utils import get_data_path
|
from netforce.utils import get_data_path
|
||||||
from netforce.access import get_active_user,set_active_user
|
from netforce.access import get_active_user,set_active_user
|
||||||
|
@ -22,6 +22,7 @@ class HDcase(Model):
|
||||||
res[obj.id]=total_time
|
res[obj.id]=total_time
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
"time_start": fields.DateTime("Time start",required=True,search=True),
|
"time_start": fields.DateTime("Time start",required=True,search=True),
|
||||||
|
@ -41,9 +42,9 @@ class HDcase(Model):
|
||||||
"epo_tn" : fields.Char("EpoTn (Drug name)"),
|
"epo_tn" : fields.Char("EpoTn (Drug name)"),
|
||||||
"epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
|
"epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
|
||||||
"hct": fields.Integer("HCT %", required=True),
|
"hct": fields.Integer("HCT %", required=True),
|
||||||
|
"hct_alert" : fields.Char("",readonly=True,function_multi=True),
|
||||||
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
||||||
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
||||||
"hct": fields.Integer("HCT %(>39)"),
|
|
||||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||||
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
|
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
|
||||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
||||||
|
@ -534,6 +535,21 @@ class HDcase(Model):
|
||||||
else:
|
else:
|
||||||
data['fee']=0.0
|
data['fee']=0.0
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def onchange_hct(self,context={}):
|
||||||
|
print(">"*50)
|
||||||
|
data=context['data']
|
||||||
|
hct_alert=data.get("hct","")
|
||||||
|
if(hct_alert<=36):
|
||||||
|
data['hct_alert']="Reimbursement of medicines : 1,125/Week"
|
||||||
|
elif(36<=hct_alert<=39):
|
||||||
|
data['hct_alert']="Reimbursement of medicines : 750/Week"
|
||||||
|
elif(hct_alert>39):
|
||||||
|
data['hct_alert']="Can not be drawn"
|
||||||
|
else:
|
||||||
|
data['hct_alert']=""
|
||||||
|
return data
|
||||||
|
|
||||||
def undo(self,ids,context={}):
|
def undo(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
@ -559,6 +575,5 @@ class HDcase(Model):
|
||||||
},
|
},
|
||||||
'flash': '%s has been undo'%obj.number,
|
'flash': '%s has been undo'%obj.number,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HDcase.register()
|
HDcase.register()
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
import time
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class ReportHDDetail(Model):
|
||||||
|
_name="clinic.report.hd.detail"
|
||||||
|
_string="Hemodialysis Report Detail"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"patient_id" : fields.Many2One("clinic.patient","Patient"),
|
||||||
|
"doctor_id" : fields.Many2One("clinic.doctor","Doctor"),
|
||||||
|
"nurse_id" : fields.Many2One("clinic.nurse","Nurse"),
|
||||||
|
"date_from": fields.Date("From"),
|
||||||
|
"date_to": fields.Date("To"),
|
||||||
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date_from': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
'date_to': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_order="cycle_id desc"
|
||||||
|
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
# context=> dict
|
||||||
|
# inside context => keys => defaults => type => dict
|
||||||
|
# dict => key: value => '', 1, [], {}
|
||||||
|
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
|
||||||
|
date_from=time.strftime("%Y-%m-%d")
|
||||||
|
date_to=time.strftime("%Y-%m-%d")
|
||||||
|
# print('date_from ',date_from)
|
||||||
|
defaults=context.get("defaults")
|
||||||
|
if defaults:
|
||||||
|
if defaults.get("date_from"):
|
||||||
|
date_from=defaults['date_from']
|
||||||
|
if defaults.get("date_to"):
|
||||||
|
date_to=defaults['date_to']
|
||||||
|
# date_to=context['date_to']
|
||||||
|
# default => key => dataults
|
||||||
|
# date_from=context['date_from']
|
||||||
|
# print(context['date_from'])
|
||||||
|
#'2014-10-13'
|
||||||
|
# print('date_from ',date_from)
|
||||||
|
# print('date_to ',date_to)
|
||||||
|
PATIENT_TYPE={
|
||||||
|
"mg":"Medical Government",
|
||||||
|
"sc":"Social Security",
|
||||||
|
"nhso":"NHSO (30฿)",
|
||||||
|
"personal": "Personal",
|
||||||
|
"others": "Others",
|
||||||
|
}
|
||||||
|
|
||||||
|
dom=[]
|
||||||
|
dom.append(['state','=','completed'])
|
||||||
|
if ids:
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
if obj.date_from:
|
||||||
|
date_from=obj.date_from
|
||||||
|
if obj.date_to:
|
||||||
|
date_to=obj.date_to
|
||||||
|
if obj.cycle_id:
|
||||||
|
dom.append([
|
||||||
|
'cycle_id','=',obj.cycle_id.id,
|
||||||
|
])
|
||||||
|
if obj.patient_id:
|
||||||
|
dom.append([
|
||||||
|
'patient_id','=',obj.patient_id.id,
|
||||||
|
])
|
||||||
|
if obj.nurse_id:
|
||||||
|
dom.append([
|
||||||
|
'nurse_id','=',obj.nurse_id.id,
|
||||||
|
])
|
||||||
|
if obj.doctor_id:
|
||||||
|
dom.append([
|
||||||
|
'doctor_id','=',obj.doctor_id.id,
|
||||||
|
])
|
||||||
|
|
||||||
|
dom.append(['time_start', ">=", date_from+" 00:00:00"])
|
||||||
|
dom.append(['time_stop',"<=", date_to+" 23:59:59"])
|
||||||
|
lines=[]
|
||||||
|
cycles=[]
|
||||||
|
index=0
|
||||||
|
no_patient=0
|
||||||
|
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
||||||
|
patient_type=hd_case.patient_id.type
|
||||||
|
patient_type=PATIENT_TYPE.get(patient_type)
|
||||||
|
#dialyzer_name=hd_case.dialyzers.id
|
||||||
|
#dialyzer_name=DIALYZER_NAME.get(dialyzer_name)
|
||||||
|
cycle_name=hd_case.cycle_id.name or ""
|
||||||
|
show_cycle=False
|
||||||
|
if not cycle_name in cycles:
|
||||||
|
cycles.append(cycle_name)
|
||||||
|
show_cycle=True
|
||||||
|
vals={
|
||||||
|
'color': 'success',
|
||||||
|
'show_cycle': False,
|
||||||
|
'cycle' : "",
|
||||||
|
'patient': "",
|
||||||
|
'no_patient': no_patient,
|
||||||
|
'patient_type' : "",
|
||||||
|
'doctor' : "",
|
||||||
|
'total' : "",
|
||||||
|
'rc_no' : "",
|
||||||
|
'dialyzer_name' : "",
|
||||||
|
'nurse' : "",
|
||||||
|
}
|
||||||
|
lines.append(vals)
|
||||||
|
no_patient=1
|
||||||
|
else:
|
||||||
|
no_patient+=1
|
||||||
|
index+=1
|
||||||
|
vals={
|
||||||
|
'show_cycle': show_cycle,
|
||||||
|
'cycle' : cycle_name,
|
||||||
|
'patient': hd_case.patient_id.name,
|
||||||
|
'patient_type' : patient_type,
|
||||||
|
'no_patient': 0,
|
||||||
|
'doctor' : hd_case.doctor_id.name,
|
||||||
|
'total' : hd_case.total,
|
||||||
|
'rc_no' : hd_case.number,
|
||||||
|
'dialyzer_name' : 'DZ-xxx',
|
||||||
|
'nurse' : hd_case.nurse_id.name,
|
||||||
|
}
|
||||||
|
lines.append(vals)
|
||||||
|
|
||||||
|
# XXX
|
||||||
|
if lines:
|
||||||
|
vals={
|
||||||
|
'color': 'success',
|
||||||
|
'show_cycle': False,
|
||||||
|
'cycle' : "",
|
||||||
|
'patient': "",
|
||||||
|
'no_patient': no_patient,
|
||||||
|
'patient_type' : "",
|
||||||
|
'doctor' : "",
|
||||||
|
'total' : "",
|
||||||
|
'rc_no' : "",
|
||||||
|
'dialyzer_name' : "",
|
||||||
|
'nurse' : "",
|
||||||
|
}
|
||||||
|
lines.append(vals)
|
||||||
|
#XXX
|
||||||
|
del lines[0]
|
||||||
|
data={
|
||||||
|
'lines': lines,
|
||||||
|
'same_date': date_from==date_to,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
ReportHDDetail.register()
|
|
@ -0,0 +1,153 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
from calendar import monthrange
|
||||||
|
from netforce.model import Model,fields
|
||||||
|
|
||||||
|
class ReportHDMadical(Model):
|
||||||
|
_name="clinic.report.hd.madical"
|
||||||
|
_string="Hemodialysis Report Madical Summary"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Month", required=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
date=datetime.now().strftime("%Y-%m-%d")
|
||||||
|
#datemonth=datetime.now().strftime("%m")
|
||||||
|
if ids:
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
date=obj.date
|
||||||
|
year=int(date[0:4])
|
||||||
|
month=int(date[5:7])
|
||||||
|
month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
|
||||||
|
|
||||||
|
next_month = str(month + 1)
|
||||||
|
if next_month == 13:
|
||||||
|
next_month = 12
|
||||||
|
#next_month_str=datetime.strptime(next_month,'%m').strftime("%B")
|
||||||
|
previous_month = str(month - 1)
|
||||||
|
if previous_month == 0:
|
||||||
|
previous_month = 12
|
||||||
|
#previous_month_str=datetime.strptime(previous_month,'%m').strftime("%B")
|
||||||
|
|
||||||
|
#madical=get_model("clinic.hd.case.gm.line").search_browse()
|
||||||
|
#patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
|
||||||
|
|
||||||
|
weekday, total_day=monthrange(year, month)
|
||||||
|
time_start='2014-%s-01 00:00:00'%(month)
|
||||||
|
time_stop='2014-%s-%s 23:59:59'%(month,total_day)
|
||||||
|
|
||||||
|
dom=[]
|
||||||
|
dom.append(['state','=','completed'])
|
||||||
|
dom.append(['time_start','>=',time_start])
|
||||||
|
dom.append(['time_stop','<=',time_stop])
|
||||||
|
#hd_cases=get_model("clinic.hd.case.gm.line").search_browse(dom)
|
||||||
|
|
||||||
|
lines=[
|
||||||
|
{
|
||||||
|
'madical' : 'H4',
|
||||||
|
'sc': '437',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '4',
|
||||||
|
'total' : '441',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'H2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epr4',
|
||||||
|
'sc': '216',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '216',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epr2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epk4',
|
||||||
|
'sc': '70',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '70',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epk2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epg4',
|
||||||
|
'sc': '98',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '98',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epg2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Rng4',
|
||||||
|
'sc': '34',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '9',
|
||||||
|
'total' : '43',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Rng2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epi4',
|
||||||
|
'sc': '264',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '9',
|
||||||
|
'total' : '43',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Epi2',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'madical' : 'Vnf',
|
||||||
|
'sc': '',
|
||||||
|
'uc': '',
|
||||||
|
'buy' : '',
|
||||||
|
'total' : '',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
data={
|
||||||
|
'month': month_str,
|
||||||
|
'year': year,
|
||||||
|
'lines': lines,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
ReportHDMadical.register()
|
|
@ -0,0 +1,149 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
from calendar import monthrange
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class ReportHDSummary(Model):
|
||||||
|
_name="clinic.report.hd.summary"
|
||||||
|
_string="Hemodialysis Report Summary"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Month", required=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
date=datetime.now().strftime("%Y-%m-%d")
|
||||||
|
dom=[]
|
||||||
|
if ids:
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
date=obj.date
|
||||||
|
|
||||||
|
month=int(date[5:7])
|
||||||
|
year=int(date[0:4])
|
||||||
|
weekday, total_day=monthrange(year, month)
|
||||||
|
#date_from="%s-%s-01"%(year,month)
|
||||||
|
#date_to="%s-%s-%s"%(year,month,total_day)
|
||||||
|
month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
|
||||||
|
next_month = str(month + 1)
|
||||||
|
if next_month == 13:
|
||||||
|
next_month = 12
|
||||||
|
next_month_str=datetime.strptime(next_month,'%m').strftime("%B")
|
||||||
|
|
||||||
|
previous_month = month-1
|
||||||
|
if previous_month == 0:
|
||||||
|
previous_month = 12
|
||||||
|
#tip previous_month=str(month-1 == 0 and 12 or month)
|
||||||
|
previous_month_str=datetime.strptime('%s'%previous_month,'%m').strftime("%B")
|
||||||
|
|
||||||
|
|
||||||
|
time_start='2014-%s-01'%(month) # 2014-10-20
|
||||||
|
time_stop='2014-%s-%s'%(month,total_day)
|
||||||
|
|
||||||
|
dom=[]
|
||||||
|
dom.append(['time_start','>=',time_start])
|
||||||
|
dom.append(['time_stop','<=',time_stop])
|
||||||
|
|
||||||
|
patients=get_model("clinic.patient").search_browse(['type','=','All'])
|
||||||
|
new_patients=len(patients)
|
||||||
|
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
|
||||||
|
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
|
||||||
|
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
|
||||||
|
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
|
||||||
|
|
||||||
|
dom=[]
|
||||||
|
dom.append(['state','=','completed'])
|
||||||
|
dom.append(['time_start','>=',time_start])
|
||||||
|
dom.append(['time_stop','<=',time_stop])
|
||||||
|
cur_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||||
|
|
||||||
|
weekday, prev_total_day=monthrange(year, previous_month)
|
||||||
|
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
||||||
|
time_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
|
||||||
|
|
||||||
|
dom=[]
|
||||||
|
dom.append(['state','=','completed'])
|
||||||
|
dom.append(['time_start','>=',time_start_pre])
|
||||||
|
dom.append(['time_stop','<=',time_stop_pre])
|
||||||
|
prev_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||||
|
|
||||||
|
lines=[
|
||||||
|
{
|
||||||
|
'topic': 'The number of times the Hemodialysis',
|
||||||
|
'month': month_str,
|
||||||
|
'amount': cur_total_case,
|
||||||
|
'date_from': time_start,
|
||||||
|
'date_to': time_stop,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'The number of cases brought',
|
||||||
|
'month': previous_month_str,
|
||||||
|
'amount': prev_total_case,
|
||||||
|
'date_from': time_start_pre,
|
||||||
|
'date_to': time_stop_pre,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Number of new patients',
|
||||||
|
'month': month_str,
|
||||||
|
'amount': new_patients,
|
||||||
|
'date_from': time_start,
|
||||||
|
'date_to': time_stop,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Number of patients discharged',
|
||||||
|
'month': month_str,
|
||||||
|
'amount': 'N/A',
|
||||||
|
'date_from': time_start,
|
||||||
|
'date_to': time_stop,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'The number of cases brought',
|
||||||
|
'month': next_month_str,
|
||||||
|
'amount': 'N/A',
|
||||||
|
'date_from': time_start,
|
||||||
|
'date_to': time_stop,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Number of patients withdrawn Social Security',
|
||||||
|
'month': '',
|
||||||
|
'amount': len(patients_sc),
|
||||||
|
'date_from': "",
|
||||||
|
'date_to': "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Number of patients withdrawn Medical Government',
|
||||||
|
'month':'',
|
||||||
|
'amount': len(patients_mg),
|
||||||
|
'date_from': "",
|
||||||
|
'date_to': "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Number of patients withdrawn NHSO(30B)',
|
||||||
|
'month':'',
|
||||||
|
'amount': len(patients_nhso),
|
||||||
|
'date_from': "",
|
||||||
|
'date_to': "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'topic':'Many patients pay themselves',
|
||||||
|
'month': '',
|
||||||
|
'amount': len(patients_pn),
|
||||||
|
'date_from': "",
|
||||||
|
'date_to': "",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
data={
|
||||||
|
'month': month_str,
|
||||||
|
'year': year,
|
||||||
|
'lines': lines,
|
||||||
|
}
|
||||||
|
#print("data", data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
ReportHDSummary.register()
|
|
@ -17,6 +17,9 @@ class ClinicSetting(Model):
|
||||||
"sc_partner_id": fields.Many2One("partner","Partner Social Security"),
|
"sc_partner_id": fields.Many2One("partner","Partner Social Security"),
|
||||||
"ar_sc_id": fields.Many2One("account.account","Account Receiveble Social Security"),
|
"ar_sc_id": fields.Many2One("account.account","Account Receiveble Social Security"),
|
||||||
"ap_sc_id": fields.Many2One("account.account","Account Payment Social Security"),
|
"ap_sc_id": fields.Many2One("account.account","Account Payment Social Security"),
|
||||||
|
#"ori_str": fields.Char("ori_str","Original String"),
|
||||||
|
#"translate": fields.Char("translate","Translation"),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClinicSetting.register()
|
ClinicSetting.register()
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
from netforce.model import Model, fields
|
||||||
|
|
||||||
|
class Translate(Model):
|
||||||
|
_name="clinic.translate"
|
||||||
|
_string="Translate"
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"original_string": fields.Char("original_string","Original String",required=True,search=True),
|
||||||
|
"translate": fields.Char("translate","Translate"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Translate.register()
|
|
@ -13,7 +13,7 @@ class Visit(Model):
|
||||||
_name_field="number"
|
_name_field="number"
|
||||||
_multi_company=True
|
_multi_company=True
|
||||||
|
|
||||||
def _get_visit_date(self,ids,context):
|
def _get_visit_date(self,ids,context={}):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
res[obj.id]=obj.time_start[0:10]
|
res[obj.id]=obj.time_start[0:10]
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,84 @@
|
||||||
|
<center>
|
||||||
|
<h2>Detail of the Hemodialysis</h2>
|
||||||
|
<h3>Clinic [Ratchawat]</h3>
|
||||||
|
<h4>
|
||||||
|
{{#if same_date}}
|
||||||
|
As at {{fmt_date date_from}}
|
||||||
|
{{else}}
|
||||||
|
From {{fmt_date date_from}} to {{fmt_date date_to}}
|
||||||
|
{{/if}}
|
||||||
|
</h4>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Cycle
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Patient
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Doctor
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Patient Type
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
HD Fee
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
RC.No
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Dialyzer
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Nurse
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines context=context}}
|
||||||
|
{{#if show_cycle}}
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" style="font-weight:bold">
|
||||||
|
{{cycle}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
<tr class="{{color}}">
|
||||||
|
{{#if no_patient}}
|
||||||
|
<td><b>TOTAL</b></td>
|
||||||
|
<td>{{no_patient}}</td>
|
||||||
|
{{else}}
|
||||||
|
<td></td>
|
||||||
|
<td>{{patient}}</td>
|
||||||
|
{{/if}}
|
||||||
|
<td>
|
||||||
|
{{doctor}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{patient_type}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{total}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{rc_no}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{dialyzer_name}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{nurse}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr style="font-weight:bold">
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<center>
|
||||||
|
<h2>
|
||||||
|
Summary of the Madical
|
||||||
|
</h2>
|
||||||
|
<h3>
|
||||||
|
[Ratchawat : Saamsan4]<br/>
|
||||||
|
As at {{month}} {{year}}
|
||||||
|
</h3>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<th>Madical</th>
|
||||||
|
<th>Social Security</th>
|
||||||
|
<th>uc</th>
|
||||||
|
<th>Buy</th>
|
||||||
|
<th>Total</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines}}
|
||||||
|
<tr>
|
||||||
|
<td>{{madical}}</td>
|
||||||
|
<td>{{sc}}</td>
|
||||||
|
<td>{{uc}}</td>
|
||||||
|
<td style color="red"></style>{{buy}}</td>
|
||||||
|
<td style color="blue"></style>{{total}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<center>
|
||||||
|
<h2>
|
||||||
|
Summary of the Hemodialysis
|
||||||
|
</h2>
|
||||||
|
<h3>
|
||||||
|
[Ratchawat : Saamsan4]<br/>
|
||||||
|
As at {{month}} {{year}}
|
||||||
|
</h3>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<th>Topic</th>
|
||||||
|
<th>Month</th>
|
||||||
|
<th>Amount</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines}}
|
||||||
|
<tr>
|
||||||
|
<td>{{topic}}</td>
|
||||||
|
<td>{{month}}</td>
|
||||||
|
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
Loading…
Reference in New Issue