Merge branch 'master' of dev.netforce.com:netforce-customized/clinic
commit
2f663da539
|
@ -46,7 +46,7 @@ class HDcase(Model):
|
||||||
"state": fields.Selection([("draft","Draft"),("confirmed","Confirmed"),("approved","Approved"),("cancelled","Cancelled"),("paid","Paid")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("confirmed","Confirmed"),("approved","Approved"),("cancelled","Cancelled"),("paid","Paid")],"Status",required=True),
|
||||||
"hct": fields.Integer("HCT %"),
|
"hct": fields.Integer("HCT %"),
|
||||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("uncompleted","Uncompleted")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("uncompleted","Uncompleted")],"Status",required=True),
|
||||||
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dializers"),
|
"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"),
|
||||||
"gm_lines": fields.One2Many("clinic.hd.case.gm.line","hd_case_id","GM Lines"),
|
"gm_lines": fields.One2Many("clinic.hd.case.gm.line","hd_case_id","GM Lines"),
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
|
@ -165,12 +165,11 @@ class HDcase(Model):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def onchange_hct(self,context={}):
|
def onchange_hct(self,context={}):
|
||||||
data=context['data']
|
data=context['hct']
|
||||||
hct=data['hct']
|
hct=data['hct']
|
||||||
if (hct>39):
|
if(hct<=39):
|
||||||
print ("Test1")
|
raise Exception("Unit not found in uom")
|
||||||
else:
|
|
||||||
print ("Test3")
|
|
||||||
|
|
||||||
def cancelled(self,ids,context={}):
|
def cancelled(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
|
|
@ -13,14 +13,12 @@ class DialyzerDrop(Model):
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
"state" : "drop",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
lines=[]
|
lines=[]
|
||||||
|
|
||||||
dialyzer_ids=get_model("clinic.dialyzer").search([["state","=","drop"]])
|
hd_cases=get_model("clinic.dialyzer").search_browse(['state','=','drop'])
|
||||||
hd_cases=get_model("clinic.dialyzer").search_browse([])
|
|
||||||
for dialyzer_ids in hd_cases:
|
for dialyzer_ids in hd_cases:
|
||||||
lines.append({
|
lines.append({
|
||||||
'number' : dialyzer_ids.number,
|
'number' : dialyzer_ids.number,
|
||||||
|
|
|
@ -8,16 +8,21 @@ class HDReport(Model):
|
||||||
_transient=True
|
_transient=True
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"date": fields.Date("Date"),
|
"date": fields.Date("Start-Date"),
|
||||||
|
#"time_start": fields.DateTime("Time start",required=False,search=True),
|
||||||
|
#"time_stop": fields.DateTime("Time stop",required=False,search=True),
|
||||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
#'time_start': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
#'time_stop': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order="cycle_id desc"
|
_order="cycle_id desc"
|
||||||
|
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
PATIENT_TYPE={
|
PATIENT_TYPE={
|
||||||
"mg":"Medical Government",
|
"mg":"Medical Government",
|
||||||
|
@ -26,6 +31,8 @@ class HDReport(Model):
|
||||||
"personal": "Personal",
|
"personal": "Personal",
|
||||||
"others": "Others",
|
"others": "Others",
|
||||||
}
|
}
|
||||||
|
#time_start=time.strftime("%Y-%m-%d")
|
||||||
|
#time_stop=time.strftime("%Y-%m-%d")
|
||||||
date=time.strftime("%Y-%m-%d")
|
date=time.strftime("%Y-%m-%d")
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['state','=','completed'])
|
dom.append(['state','=','completed'])
|
||||||
|
@ -47,25 +54,28 @@ class HDReport(Model):
|
||||||
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
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=hd_case.patient_id.type
|
||||||
patient_type=PATIENT_TYPE.get(patient_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 ""
|
cycle_name=hd_case.cycle_id.name or ""
|
||||||
show_cycle=False
|
show_cycle=False
|
||||||
if not cycle_name in cycles:
|
if not cycle_name in cycles:
|
||||||
cycles.append(cycle_name)
|
cycles.append(cycle_name)
|
||||||
show_cycle=True
|
show_cycle=True
|
||||||
if index > 1:
|
print("OK")
|
||||||
vals={
|
vals={
|
||||||
'color': 'success',
|
'color': 'success',
|
||||||
'show_cycle': False,
|
'show_cycle': False,
|
||||||
'cycle' : "",
|
'cycle' : "",
|
||||||
'patient': "",
|
'patient': "",
|
||||||
'no_patient': no_patient,
|
'no_patient': no_patient,
|
||||||
'patient_type' : "",
|
'patient_type' : "",
|
||||||
'doctor' : "",
|
'doctor' : "",
|
||||||
'total' : "",
|
'total' : "",
|
||||||
'rc_no' : "",
|
'rc_no' : "",
|
||||||
'nurse' : "",
|
'dialyzer_name' : "",
|
||||||
}
|
'nurse' : "",
|
||||||
lines.append(vals)
|
}
|
||||||
|
lines.append(vals)
|
||||||
no_patient=1
|
no_patient=1
|
||||||
else:
|
else:
|
||||||
no_patient+=1
|
no_patient+=1
|
||||||
|
@ -79,6 +89,7 @@ class HDReport(Model):
|
||||||
'doctor' : hd_case.doctor_id.name,
|
'doctor' : hd_case.doctor_id.name,
|
||||||
'total' : hd_case.fee,
|
'total' : hd_case.fee,
|
||||||
'rc_no' : hd_case.number,
|
'rc_no' : hd_case.number,
|
||||||
|
'dialyzer_name' : 'DZ-xxx',
|
||||||
'nurse' : hd_case.nurse_id.name,
|
'nurse' : hd_case.nurse_id.name,
|
||||||
}
|
}
|
||||||
lines.append(vals)
|
lines.append(vals)
|
||||||
|
@ -95,10 +106,12 @@ class HDReport(Model):
|
||||||
'doctor' : "",
|
'doctor' : "",
|
||||||
'total' : "",
|
'total' : "",
|
||||||
'rc_no' : "",
|
'rc_no' : "",
|
||||||
|
'dialyzer_name' : "",
|
||||||
'nurse' : "",
|
'nurse' : "",
|
||||||
}
|
}
|
||||||
lines.append(vals)
|
lines.append(vals)
|
||||||
|
#XXX
|
||||||
|
del lines[0]
|
||||||
data={
|
data={
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class HDReport(Model):
|
||||||
|
_name="clinic.hd.report"
|
||||||
|
_string="HD Report"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Start-Date"),
|
||||||
|
#"time_start": fields.DateTime("Time start",required=False,search=True),
|
||||||
|
#"time_stop": fields.DateTime("Time stop",required=False,search=True),
|
||||||
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
#'time_start': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
#'time_stop': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_order="cycle_id desc"
|
||||||
|
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
PATIENT_TYPE={
|
||||||
|
"mg":"Medical Government",
|
||||||
|
"sc":"Social Security",
|
||||||
|
"nhso":"NHSO (30฿)",
|
||||||
|
"personal": "Personal",
|
||||||
|
"others": "Others",
|
||||||
|
}
|
||||||
|
#time_start=time.strftime("%Y-%m-%d")
|
||||||
|
#time_stop=time.strftime("%Y-%m-%d")
|
||||||
|
date=time.strftime("%Y-%m-%d")
|
||||||
|
dom=[]
|
||||||
|
dom.append(['state','=','completed'])
|
||||||
|
if ids:
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
if obj.date:
|
||||||
|
date=obj.date
|
||||||
|
if obj.cycle_id:
|
||||||
|
dom.append([
|
||||||
|
'cycle_id','=',obj.cycle_id.id,
|
||||||
|
])
|
||||||
|
dom.append(['time_start', ">=", obj.date+"00:00:00"])
|
||||||
|
dom.append(['time_stop', "<=", obj.date+"23:59:59"])
|
||||||
|
print("dom ", dom)
|
||||||
|
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
|
||||||
|
if index > 1:
|
||||||
|
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.fee,
|
||||||
|
'rc_no' : hd_case.number,
|
||||||
|
'dialyzer' : dialyzer_name,
|
||||||
|
'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)
|
||||||
|
|
||||||
|
data={
|
||||||
|
'lines': lines,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
HDReport.register()
|
Binary file not shown.
|
@ -1,7 +1,9 @@
|
||||||
<center>
|
<center>
|
||||||
<h2>
|
<h2>HD Case Report </h2>
|
||||||
HD Case Report
|
<h3>
|
||||||
</h2>
|
Clinic [Ratchawat]<br/>
|
||||||
|
As at {{fmt_date date}}
|
||||||
|
</h3>
|
||||||
</center>
|
</center>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead class="scroll-header">
|
<thead class="scroll-header">
|
||||||
|
@ -24,6 +26,9 @@
|
||||||
<th>
|
<th>
|
||||||
RC.No
|
RC.No
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
Dialyzer
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Nurse
|
Nurse
|
||||||
</th>
|
</th>
|
||||||
|
@ -58,6 +63,9 @@
|
||||||
<td>
|
<td>
|
||||||
{{rc_no}}
|
{{rc_no}}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{dialyzer_name}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{nurse}}
|
{{nurse}}
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue