Link Report to Data
parent
20f304274d
commit
3215e9b638
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
#from netforce.access import get_active_company
|
||||
|
||||
|
||||
class ReportHDDetail(Model):
|
||||
_name="clinic.report.hd.detail"
|
||||
|
@ -15,6 +15,8 @@ class ReportHDDetail(Model):
|
|||
"date_from": fields.Date("From"),
|
||||
"date_to": fields.Date("To"),
|
||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||
"type": fields.Selection([("mg","Medical Goverment"),("sc","Social Security"),("nhso","NHSO (30B)"),("personal","Personal"),("other","Other")],"Type"),
|
||||
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
@ -38,20 +40,14 @@ class ReportHDDetail(Model):
|
|||
|
||||
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",
|
||||
|
@ -84,6 +80,10 @@ class ReportHDDetail(Model):
|
|||
dom.append([
|
||||
'doctor_id','=',obj.doctor_id.id,
|
||||
])
|
||||
if obj.type_id:
|
||||
dom.append([
|
||||
'type','=',obj.type_id.id,
|
||||
])
|
||||
|
||||
dom.append(['time_start', ">=", date_from+" 00:00:00"])
|
||||
dom.append(['time_stop',"<=", date_to+" 23:59:59"])
|
||||
|
@ -92,10 +92,17 @@ class ReportHDDetail(Model):
|
|||
index=0
|
||||
no_patient=0
|
||||
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
||||
#print('='*50)
|
||||
#for line in hd_case.line:
|
||||
# dialyzer_id=line.dialyzer_id
|
||||
# if dialyzer_id:
|
||||
# dialyzer_number=line.number or ""
|
||||
# print(dialyzer_number)
|
||||
|
||||
#print('='*50)
|
||||
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)
|
||||
#dialyzer=get_model("clinic.dialyzer").search_browse([])
|
||||
cycle_name=hd_case.cycle_id.name or ""
|
||||
show_cycle=False
|
||||
if not cycle_name in cycles:
|
||||
|
@ -122,14 +129,18 @@ class ReportHDDetail(Model):
|
|||
vals={
|
||||
'show_cycle': show_cycle,
|
||||
'cycle' : cycle_name,
|
||||
'patient': hd_case.patient_id.name,
|
||||
'patient_id': hd_case.patient_id.id,
|
||||
'patient_name': hd_case.patient_id.name,
|
||||
'patient_type' : patient_type,
|
||||
'no_patient': 0,
|
||||
'doctor' : hd_case.doctor_id.name,
|
||||
'doctor_id': hd_case.doctor_id.id,
|
||||
'doctor_name' : hd_case.doctor_id.name,
|
||||
'total' : hd_case.total,
|
||||
'hd_case_id' : hd_case.id,
|
||||
'rc_no' : hd_case.number,
|
||||
'dialyzer_name' : 'DZ-xxx',
|
||||
'nurse' : hd_case.nurse_id.name,
|
||||
'dialyzer_number' : 'DZ-XXXX',
|
||||
'nurse_id': hd_case.nurse_id.id,
|
||||
'nurse_name' : hd_case.nurse_id.name,
|
||||
}
|
||||
lines.append(vals)
|
||||
|
||||
|
|
|
@ -51,17 +51,25 @@ class ReportHDMadical(Model):
|
|||
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)
|
||||
|
||||
for product in get_model("clinic.hd.case.gm.line").search_browse([]):
|
||||
product_id=product.product_id
|
||||
print(product_id)
|
||||
if product_id:
|
||||
product_name=product.description or ""
|
||||
product_id=product.product_id or ""
|
||||
|
||||
lines=[
|
||||
{
|
||||
'madical' : 'H4',
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : product_name,
|
||||
'sc': '437',
|
||||
'uc': '',
|
||||
'buy' : '4',
|
||||
'total' : '441',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'H2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -69,6 +77,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epr4',
|
||||
'sc': '216',
|
||||
'uc': '',
|
||||
|
@ -76,6 +85,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '216',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epr2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -83,6 +93,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epk4',
|
||||
'sc': '70',
|
||||
'uc': '',
|
||||
|
@ -90,6 +101,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '70',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epk2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -97,6 +109,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epg4',
|
||||
'sc': '98',
|
||||
'uc': '',
|
||||
|
@ -104,6 +117,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '98',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epg2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -111,6 +125,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Rng4',
|
||||
'sc': '34',
|
||||
'uc': '',
|
||||
|
@ -118,6 +133,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '43',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Rng2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -125,6 +141,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epi4',
|
||||
'sc': '264',
|
||||
'uc': '',
|
||||
|
@ -132,6 +149,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '43',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Epi2',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
@ -139,6 +157,7 @@ class ReportHDMadical(Model):
|
|||
'total' : '',
|
||||
},
|
||||
{
|
||||
'product_id' : 'MD-XXXX',
|
||||
'madical' : 'Vnf',
|
||||
'sc': '',
|
||||
'uc': '',
|
||||
|
|
|
@ -55,7 +55,6 @@ class ReportHDSummary(Model):
|
|||
dom.append(['time_start','>=',time_start])
|
||||
dom.append(['time_stop','<=',time_stop])
|
||||
|
||||
|
||||
dom=[]
|
||||
dom.append(['type','=','mg'])
|
||||
patients_mg=len(get_model("clinic.patient").search(dom))
|
||||
|
|
Loading…
Reference in New Issue