reformat hd case
parent
69746f378a
commit
9f0c65072b
|
@ -2,7 +2,7 @@
|
||||||
<field name="string">HD Cases</field>
|
<field name="string">HD Cases</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.hd.case</field>
|
<field name="model">clinic.hd.case</field>
|
||||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Completed",[["state","=","completed"]]],["In Completed",[["state","=","in_completed"]]]]</field>
|
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Waiting Treatment",[["state","=","waiting_treatment"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Waiting Approval",[["state","=","waiting_approval"]]],["Completed",[["state","=","completed"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
||||||
<field name="modes">list,form</field>
|
<field name="modes">list,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -2,34 +2,33 @@
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="New Dialyzer" method="new_dialyzer" states="draft"/>
|
<item string="New Dialyzer" method="new_dialyzer" states="draft,waiting_treatment"/>
|
||||||
<item string="To Draft" method="to_draft" states="in_progress,completed"/>
|
<item string="To Draft" method="to_draft" states="in_progress,completed"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<group span="6" columns="1">
|
<group form_layout="stacked">
|
||||||
<field name="number"/>
|
<field name="number" span="2"/>
|
||||||
<field name="time_start"/>
|
<field name="ref" span="2"/>
|
||||||
<field name="cycle_id" required="1"/>
|
<field name="patient_id" span="2" onchange="onchange_patient"/>
|
||||||
<field name="department_id"/>
|
<field name="cycle_id" span="2" required="1"/>
|
||||||
</group>
|
<field name="department_id" span="2"/>
|
||||||
<group span="6" columns="1">
|
<field name="visit_id" span="2"/>
|
||||||
<field name="patient_id" onchange="onchange_patient"/>
|
<field name="fee_partner_id" span="2" domain="[['type','=','org']]"/>
|
||||||
<field name="time_stop"/>
|
<field name="patient_type" span="2"/>
|
||||||
<field name="duration"/>
|
|
||||||
<field name="visit_id" readonly="1"/>
|
|
||||||
</group>
|
</group>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General">
|
<tab string="General">
|
||||||
<field name="wh_start"/>
|
<group form_layout="form">
|
||||||
<field name="wh_stop"/>
|
<field name="time_start" span="2"/>
|
||||||
<field name="bp_start"/>
|
<field name="time_stop" span="2"/>
|
||||||
<field name="per_bp_start"/>
|
<field name="duration" span="2"/>
|
||||||
<field name="bp_stop"/>
|
<field name="vascular_acc" span="2"/>
|
||||||
<field name="per_bp_stop"/>
|
<field name="wt_kg" span="1"/>
|
||||||
<field name="hct" onchange="onchange_hct"/>
|
<field name="bp" span="1"/>
|
||||||
<field name="nu"/>
|
<field name="mm_hg" span="1"/>
|
||||||
<newline/>
|
<field name="nu" span="2"/>
|
||||||
<field offset="2" name="hct_msg" nolabel="1" readonly="1"/>
|
<field name="hct" span="2" onchange="onchange_hct"/>
|
||||||
|
<field name="hct_msg" span="4" readonly="1"/>
|
||||||
<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"/>
|
||||||
|
@ -43,8 +42,9 @@
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Expenses">
|
<tab string="Expense">
|
||||||
<group span="12" form_layout="stacked">
|
<group span="12" form_layout="stacked">
|
||||||
<field name="lines" count="3" nolabel="1">
|
<field name="lines" count="3" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Staffs">
|
<tab string="Staff">
|
||||||
<field name="staffs" nolabel="1">
|
<field name="staffs" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
|
@ -103,13 +103,8 @@
|
||||||
<tab string="Approval">
|
<tab string="Approval">
|
||||||
<field name="nurse_id"/>
|
<field name="nurse_id"/>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Others">
|
<tab string="Note">
|
||||||
<group span="6" columns="1">
|
<field name="note" nolabel="1"/>
|
||||||
<field name="fee_partner_id" domain="[['type','=','org']]"/>
|
|
||||||
</group>
|
|
||||||
<group span="6" columns="1">
|
|
||||||
<field name="note"/>
|
|
||||||
</group>
|
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]]}'>
|
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]]}'>
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
|
<field name="ref"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="cycle_id"/>
|
<field name="cycle_id"/>
|
||||||
<field name="patient_id"/>
|
<field name="patient_id"/>
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
<item string="Categories" action="clinic_staff_categ"/>
|
<item string="Categories" action="clinic_staff_categ"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="Patients">
|
<item string="Patients">
|
||||||
<item string="New Patient" action="clinic_patient" action_options="mode=form"/>
|
|
||||||
<divider/>
|
|
||||||
<item string="Patients" action="clinic_patient"/>
|
<item string="Patients" action="clinic_patient"/>
|
||||||
<item string="Dialyzers" action="clinic_dialyzer"/>
|
<item string="Dialyzers" action="clinic_dialyzer"/>
|
||||||
<divider/>
|
<divider/>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<field name="visit_date"/>
|
<field name="visit_date"/>
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Validation">
|
<tab string="Confirmation">
|
||||||
<field name="nurse_id"/>
|
<field name="nurse_id"/>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Note">
|
<tab string="Note">
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from netforce.model import Model, fields
|
from netforce.model import Model, fields
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
class Address(Model):
|
class Address(Model):
|
||||||
_inherit="address"
|
_inherit="address"
|
||||||
|
@ -8,4 +9,8 @@ class Address(Model):
|
||||||
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def write(self,ids,vals,**kw):
|
||||||
|
pprint(vals)
|
||||||
|
super().write(ids,vals,**kw)
|
||||||
|
|
||||||
Address.register()
|
Address.register()
|
||||||
|
|
|
@ -4,6 +4,7 @@ from netforce.access import get_active_company
|
||||||
class Department(Model):
|
class Department(Model):
|
||||||
_name="clinic.department"
|
_name="clinic.department"
|
||||||
_string="Department"
|
_string="Department"
|
||||||
|
_key=['code']
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"name": fields.Char("Name",required=True,search=True),
|
"name": fields.Char("Name",required=True,search=True),
|
||||||
|
|
|
@ -65,27 +65,32 @@ class HDCase(Model):
|
||||||
}
|
}
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
|
def _get_patient_type(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
patient=obj.patient_id
|
||||||
|
res[obj.id]=patient.type
|
||||||
|
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),
|
"ref": fields.Char("Ref",search=True),
|
||||||
"time_stop": fields.DateTime("Time Stop",required=True,search=True),
|
"time_start": fields.DateTime("Start Time",required=True,search=True),
|
||||||
|
"time_stop": fields.DateTime("Finish Time",required=True,search=True),
|
||||||
"date": fields.Date("Date",required=True,search=True),
|
"date": fields.Date("Date",required=True,search=True),
|
||||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||||
|
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Service Type",function="_get_patient_type"),
|
||||||
|
"vascular_acc": fields.Selection([("shunt","Shunt"),("graft","Graft"),("pem_cath","Pem Cath"),('temp_cash','Temp Cath')],"Vascular Ac."),
|
||||||
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
|
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
|
||||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
"wh_start": fields.Float("Wt.Kg start"),
|
"wt_kg": fields.Float("Wt.kg."),
|
||||||
"wh_stop": fields.Float("Wt.Kg stop"),
|
"bp": fields.Integer("BP"),
|
||||||
"bp_start": fields.Integer("BP mmHG start"),
|
"mm_hg": fields.Integer("mmHG"),
|
||||||
"per_bp_start": fields.Integer("/Per start"),
|
"hct": fields.Integer("Hct%(<40)"),
|
||||||
"bp_stop": fields.Integer("BP mmHG stop"),
|
"hct_msg" : fields.Char(""),
|
||||||
"per_bp_stop": fields.Integer("/Per stop"),
|
|
||||||
"epo_tn" : fields.Char("EpoTn (Drug name)"),
|
|
||||||
"epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
|
|
||||||
"hct": fields.Integer("HCT % (<40)"),
|
|
||||||
"hct_msg" : fields.Char("HCT message"),
|
|
||||||
"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"),
|
||||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),('waiting_approval','Waiting Approval'),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True),
|
||||||
"dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
|
"dialyzers": fields.One2Many("clinic.hd.case.dialyzer","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"),
|
||||||
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
|
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
|
||||||
|
@ -96,7 +101,7 @@ class HDCase(Model):
|
||||||
"payments": fields.One2Many("account.payment","related_id","Payments"),
|
"payments": fields.One2Many("account.payment","related_id","Payments"),
|
||||||
"payment_lines": fields.One2Many("clinic.payment","hd_case_id","Payment Lines"),
|
"payment_lines": fields.One2Many("clinic.payment","hd_case_id","Payment Lines"),
|
||||||
'visit_id': fields.Many2One("clinic.visit", "Visit"),
|
'visit_id': fields.Many2One("clinic.visit", "Visit"),
|
||||||
'duration': fields.Integer("Duration (hrs)",function="get_hrs"),
|
'duration': fields.Integer("Duration(Hours)",function="get_hrs"),
|
||||||
"total": fields.Float("Total",function="_get_total",readonly=True,function_multi=True),
|
"total": fields.Float("Total",function="_get_total",readonly=True,function_multi=True),
|
||||||
"fee_amount": fields.Float("Fee",function="_get_total",readonly=True,function_multi=True),
|
"fee_amount": fields.Float("Fee",function="_get_total",readonly=True,function_multi=True),
|
||||||
"mdc_amount": fields.Float("Medicine",function="_get_total",readonly=True,function_multi=True),
|
"mdc_amount": fields.Float("Medicine",function="_get_total",readonly=True,function_multi=True),
|
||||||
|
@ -140,6 +145,9 @@ class HDCase(Model):
|
||||||
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
"number": _get_number,
|
"number": _get_number,
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
|
'wt_kg': 0.0,
|
||||||
|
'bp': 0,
|
||||||
|
'mm_hg': 0,
|
||||||
'hct': 0,
|
'hct': 0,
|
||||||
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
|
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
|
||||||
'fee_paid': False,
|
'fee_paid': False,
|
||||||
|
@ -501,7 +509,7 @@ class HDCase(Model):
|
||||||
def discontinue(self,ids,context={}):
|
def discontinue(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
# TODO pop to note
|
# TODO pop to note
|
||||||
obj.write({"state":"in_completed"})
|
obj.write({"state":"cancelled"})
|
||||||
|
|
||||||
def update_usetime(self,ids,context={}):
|
def update_usetime(self,ids,context={}):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
|
|
|
@ -25,7 +25,7 @@ class HDCaseDiscont(Model):
|
||||||
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
|
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
|
||||||
hd_case.write({
|
hd_case.write({
|
||||||
'note': obj.note,
|
'note': obj.note,
|
||||||
'state': 'in_completed',
|
'state': 'cancelled',
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
'next': {
|
'next': {
|
||||||
|
|
|
@ -132,6 +132,7 @@ class Patient(Model):
|
||||||
address_id=get_model('address').create({
|
address_id=get_model('address').create({
|
||||||
'type': 'shipping',
|
'type': 'shipping',
|
||||||
'partner_id': partner_id,
|
'partner_id': partner_id,
|
||||||
|
'patient_id': obj.id, #XXX
|
||||||
'address': 'your address',
|
'address': 'your address',
|
||||||
'address2': 'your address2',
|
'address2': 'your address2',
|
||||||
'city': 'your city',
|
'city': 'your city',
|
||||||
|
@ -181,6 +182,7 @@ class Patient(Model):
|
||||||
addr=obj.addresses[0]
|
addr=obj.addresses[0]
|
||||||
get_model("address").browse(addr.id).write({
|
get_model("address").browse(addr.id).write({
|
||||||
'partner_id': partner_id,
|
'partner_id': partner_id,
|
||||||
|
'patient_id': obj.id,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
if vals.get("addresses"):
|
if vals.get("addresses"):
|
||||||
|
@ -192,14 +194,13 @@ class Patient(Model):
|
||||||
})
|
})
|
||||||
del vals['addresses']
|
del vals['addresses']
|
||||||
print("create address for %s"%obj.name, ' ', addr_vals)
|
print("create address for %s"%obj.name, ' ', addr_vals)
|
||||||
|
|
||||||
if obj.rm_remain_visit:
|
if obj.rm_remain_visit:
|
||||||
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])
|
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])
|
||||||
get_model('clinic.visit').delete(visit_ids)
|
get_model('clinic.visit').delete(visit_ids)
|
||||||
print('remove visit auto %s'%visit_ids)
|
print('remove visit auto %s'%visit_ids)
|
||||||
super().write(ids,vals,**kw)
|
super().write(ids,vals,**kw)
|
||||||
|
|
||||||
def name_get(self,ids,context={}):
|
def _name_get(self,ids,context={}):
|
||||||
vals=[]
|
vals=[]
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
name="%s %s %s"%(obj.number,obj.name, obj.hn)
|
name="%s %s %s"%(obj.number,obj.name, obj.hn)
|
||||||
|
|
|
@ -28,8 +28,8 @@ class Visit(Model):
|
||||||
|
|
||||||
_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),
|
"time_start": fields.DateTime("Start Time",required=True),
|
||||||
"time_stop": fields.DateTime("Time Stop",required=True),
|
"time_stop": fields.DateTime("End Time",required=True),
|
||||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||||
"doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],search=True),
|
"doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True),
|
"nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True),
|
||||||
|
@ -97,7 +97,7 @@ class Visit(Model):
|
||||||
_order="sequence"
|
_order="sequence"
|
||||||
|
|
||||||
def confirm(self,ids,context={}):
|
def confirm(self,ids,context={}):
|
||||||
obj=self.browse(ids[0])
|
obj=self.browse(ids)[0]
|
||||||
number=obj.number
|
number=obj.number
|
||||||
if number=="/" or not number:
|
if number=="/" or not number:
|
||||||
number=self._get_number(context)
|
number=self._get_number(context)
|
||||||
|
@ -105,9 +105,12 @@ class Visit(Model):
|
||||||
'number': number,
|
'number': number,
|
||||||
'state': 'confirmed',
|
'state': 'confirmed',
|
||||||
}
|
}
|
||||||
|
user_id=get_active_user()
|
||||||
|
staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
|
||||||
|
if staff:
|
||||||
|
vals['nurse_id']=staff[0].id
|
||||||
obj.write(vals)
|
obj.write(vals)
|
||||||
hd_case_obj=get_model("clinic.hd.case")
|
hd_case_obj=get_model("clinic.hd.case")
|
||||||
obj=self.browse(ids)[0]
|
|
||||||
vals={
|
vals={
|
||||||
'patient_id': obj.patient_id.id,
|
'patient_id': obj.patient_id.id,
|
||||||
'nurse_id': obj.nurse_id.id,
|
'nurse_id': obj.nurse_id.id,
|
||||||
|
@ -119,7 +122,7 @@ class Visit(Model):
|
||||||
'lines':[],
|
'lines':[],
|
||||||
'dialyzers': [],
|
'dialyzers': [],
|
||||||
'staffs': [],
|
'staffs': [],
|
||||||
'state': 'draft',
|
'state': 'waiting_treatment',
|
||||||
}
|
}
|
||||||
|
|
||||||
# use exist hd_case (in case set to draft)
|
# use exist hd_case (in case set to draft)
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
=====
|
=====
|
||||||
import payment from government
|
import payment from government
|
||||||
|
- read file
|
||||||
|
xml
|
||||||
|
- uc
|
||||||
|
excel
|
||||||
|
- social security
|
||||||
|
|
||||||
======
|
======
|
||||||
bug:
|
bug:
|
||||||
|
|
Loading…
Reference in New Issue