Archive [Patients]
parent
12ff2c49fb
commit
df33030c56
|
@ -10,13 +10,15 @@ class GenVisit(Model):
|
||||||
_name="clinic.gen.visit"
|
_name="clinic.gen.visit"
|
||||||
_transient=True
|
_transient=True
|
||||||
|
|
||||||
|
|
||||||
def _get_duration(self,ids,context={}):
|
def _get_duration(self,ids,context={}):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
|
duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||||
res[obj.id]=duration.days
|
res[obj.id]=duration.days
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
'date_from': fields.DateTime("From", required=True),
|
'date_from': fields.DateTime("From", required=True),
|
||||||
'date_to': fields.DateTime("To", required=True),
|
'date_to': fields.DateTime("To", required=True),
|
||||||
|
@ -33,6 +35,7 @@ class GenVisit(Model):
|
||||||
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
|
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _get_lines(self,context={}):
|
def _get_lines(self,context={}):
|
||||||
ids=context.get("ids")
|
ids=context.get("ids")
|
||||||
if not ids:
|
if not ids:
|
||||||
|
|
|
@ -76,6 +76,7 @@ class Patient(Model):
|
||||||
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
|
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
|
||||||
"partner_id": fields.Many2One("partner","Contact"),
|
"partner_id": fields.Many2One("partner","Contact"),
|
||||||
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
|
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
|
||||||
|
"active":fields.Boolean("Active"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
|
@ -96,12 +97,15 @@ class Patient(Model):
|
||||||
cause_ids=get_model("clinic.cause.chronic").search([])
|
cause_ids=get_model("clinic.cause.chronic").search([])
|
||||||
return cause_ids
|
return cause_ids
|
||||||
|
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
"type": "mg",
|
"type": "mg",
|
||||||
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
|
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
"number": _get_number,
|
"number": _get_number,
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
#'cause_lines': _get_cause_line,
|
#'cause_lines': _get_cause_line,
|
||||||
|
"active" : True,
|
||||||
|
|
||||||
}
|
}
|
||||||
_order="date desc,number desc"
|
_order="date desc,number desc"
|
||||||
|
|
||||||
|
|
|
@ -28,19 +28,11 @@ class ReportHDDetail(Model):
|
||||||
|
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
|
||||||
# company_id=get_active_company
|
|
||||||
# comp=get_model("company").browse(company_id)
|
|
||||||
# context=> dict
|
|
||||||
# inside context => keys => defaults => type => dict
|
|
||||||
# dict => key: value => '', 1, [], {}
|
|
||||||
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
|
|
||||||
for item in get_model("company").search_browse([]):
|
for item in get_model("company").search_browse([]):
|
||||||
company_name=item.name
|
company_name=item.name
|
||||||
|
|
||||||
date_from=time.strftime("%Y-%m-%d")
|
date_from=time.strftime("%Y-%m-%d")
|
||||||
date_to=time.strftime("%Y-%m-%d")
|
date_to=time.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
defaults=context.get("defaults")
|
defaults=context.get("defaults")
|
||||||
if defaults:
|
if defaults:
|
||||||
if defaults.get("date_from"):
|
if defaults.get("date_from"):
|
||||||
|
@ -80,10 +72,10 @@ class ReportHDDetail(Model):
|
||||||
dom.append([
|
dom.append([
|
||||||
'doctor_id','=',obj.doctor_id.id,
|
'doctor_id','=',obj.doctor_id.id,
|
||||||
])
|
])
|
||||||
if obj.type_id:
|
"""if obj.patient_id:
|
||||||
dom.append([
|
dom.append([
|
||||||
'type','=',obj.type_id.name,
|
'type','=',obj.patient_id.type,
|
||||||
])
|
])"""
|
||||||
|
|
||||||
dom.append(['time_start', ">=", date_from+" 00:00:00"])
|
dom.append(['time_start', ">=", date_from+" 00:00:00"])
|
||||||
dom.append(['time_stop',"<=", date_to+" 23:59:59"])
|
dom.append(['time_stop',"<=", date_to+" 23:59:59"])
|
||||||
|
|
|
@ -56,9 +56,7 @@ class ReportHDMedical(Model):
|
||||||
vals={
|
vals={
|
||||||
'product_code' : product_code,
|
'product_code' : product_code,
|
||||||
'medical' : product_name,
|
'medical' : product_name,
|
||||||
'mg' : '-',
|
|
||||||
'uc' : '-',
|
'uc' : '-',
|
||||||
'sc' : '-',
|
|
||||||
'buy' : '-',
|
'buy' : '-',
|
||||||
'amount' : product_amount,
|
'amount' : product_amount,
|
||||||
'product_id': product_id,
|
'product_id': product_id,
|
||||||
|
|
|
@ -48,6 +48,8 @@ class ReportHDSummary(Model):
|
||||||
time_start='2014-%s-01'%(month) # 2014-10-20
|
time_start='2014-%s-01'%(month) # 2014-10-20
|
||||||
time_stop='2014-%s-%s'%(month,total_day)
|
time_stop='2014-%s-%s'%(month,total_day)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['type','=','mg'])
|
dom.append(['type','=','mg'])
|
||||||
patients_mg=len(get_model("clinic.patient").search(dom))
|
patients_mg=len(get_model("clinic.patient").search(dom))
|
||||||
|
@ -61,14 +63,14 @@ class ReportHDSummary(Model):
|
||||||
patients_pn=len(get_model("clinic.patient").search(dom))
|
patients_pn=len(get_model("clinic.patient").search(dom))
|
||||||
#New Patients
|
#New Patients
|
||||||
#dom.append(['type','=','All'])
|
#dom.append(['type','=','All'])
|
||||||
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
|
#patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
|
||||||
|
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['state','=','completed'])
|
dom.append(['state','=','completed'])
|
||||||
dom.append(['time_start','>=',time_start])
|
dom.append(['time_start','>=',time_start])
|
||||||
dom.append(['time_stop','<=',time_stop])
|
dom.append(['time_stop','<=',time_stop])
|
||||||
|
|
||||||
cur_total_case=len(get_model("clinic.hd.case").search(dom))
|
cur_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||||
|
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
|
||||||
|
|
||||||
weekday, prev_total_day=monthrange(year, previous_month)
|
weekday, prev_total_day=monthrange(year, previous_month)
|
||||||
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
||||||
|
@ -157,7 +159,6 @@ class ReportHDSummary(Model):
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
'company_name': company_name,
|
'company_name': company_name,
|
||||||
}
|
}
|
||||||
print("data", data)
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue