Archive [Patients]

conv_bal
chayut.s 2014-10-29 11:40:35 +07:00
parent 12ff2c49fb
commit df33030c56
5 changed files with 15 additions and 17 deletions

View File

@ -10,6 +10,7 @@ class GenVisit(Model):
_name="clinic.gen.visit"
_transient=True
def _get_duration(self,ids,context={}):
res={}
for obj in self.browse(ids):
@ -17,6 +18,7 @@ class GenVisit(Model):
res[obj.id]=duration.days
return res
_fields={
'date_from': fields.DateTime("From", required=True),
'date_to': fields.DateTime("To", required=True),
@ -33,6 +35,7 @@ class GenVisit(Model):
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
}
def _get_lines(self,context={}):
ids=context.get("ids")
if not ids:

View File

@ -76,6 +76,7 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
"active":fields.Boolean("Active"),
}
def _get_number(self,context={}):
@ -96,12 +97,15 @@ class Patient(Model):
cause_ids=get_model("clinic.cause.chronic").search([])
return cause_ids
_defaults={
"type": "mg",
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
#'cause_lines': _get_cause_line,
"active" : True,
}
_order="date desc,number desc"

View File

@ -28,19 +28,11 @@ class ReportHDDetail(Model):
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([]):
company_name=item.name
date_from=time.strftime("%Y-%m-%d")
date_to=time.strftime("%Y-%m-%d")
defaults=context.get("defaults")
if defaults:
if defaults.get("date_from"):
@ -80,10 +72,10 @@ class ReportHDDetail(Model):
dom.append([
'doctor_id','=',obj.doctor_id.id,
])
if obj.type_id:
"""if obj.patient_id:
dom.append([
'type','=',obj.type_id.name,
])
'type','=',obj.patient_id.type,
])"""
dom.append(['time_start', ">=", date_from+" 00:00:00"])
dom.append(['time_stop',"<=", date_to+" 23:59:59"])

View File

@ -56,9 +56,7 @@ class ReportHDMedical(Model):
vals={
'product_code' : product_code,
'medical' : product_name,
'mg' : '-',
'uc' : '-',
'sc' : '-',
'buy' : '-',
'amount' : product_amount,
'product_id': product_id,

View File

@ -48,6 +48,8 @@ class ReportHDSummary(Model):
time_start='2014-%s-01'%(month) # 2014-10-20
time_stop='2014-%s-%s'%(month,total_day)
dom=[]
dom.append(['type','=','mg'])
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))
#New Patients
#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.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))
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
weekday, prev_total_day=monthrange(year, previous_month)
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
@ -157,7 +159,6 @@ class ReportHDSummary(Model):
'lines': lines,
'company_name': company_name,
}
print("data", data)
return data