reformat hd case
parent
69746f378a
commit
9f0c65072b
|
@ -2,7 +2,7 @@
|
|||
<field name="string">HD Cases</field>
|
||||
<field name="view_cls">multi_view</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="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -2,49 +2,49 @@
|
|||
<head>
|
||||
<field name="state"/>
|
||||
<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"/>
|
||||
</button>
|
||||
</head>
|
||||
<group span="6" columns="1">
|
||||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="cycle_id" required="1"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="patient_id" onchange="onchange_patient"/>
|
||||
<field name="time_stop"/>
|
||||
<field name="duration"/>
|
||||
<field name="visit_id" readonly="1"/>
|
||||
<group form_layout="stacked">
|
||||
<field name="number" span="2"/>
|
||||
<field name="ref" span="2"/>
|
||||
<field name="patient_id" span="2" onchange="onchange_patient"/>
|
||||
<field name="cycle_id" span="2" required="1"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="visit_id" span="2"/>
|
||||
<field name="fee_partner_id" span="2" domain="[['type','=','org']]"/>
|
||||
<field name="patient_type" span="2"/>
|
||||
</group>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<field name="wh_start"/>
|
||||
<field name="wh_stop"/>
|
||||
<field name="bp_start"/>
|
||||
<field name="per_bp_start"/>
|
||||
<field name="bp_stop"/>
|
||||
<field name="per_bp_stop"/>
|
||||
<field name="hct" onchange="onchange_hct"/>
|
||||
<field name="nu"/>
|
||||
<newline/>
|
||||
<field offset="2" name="hct_msg" nolabel="1" readonly="1"/>
|
||||
<field name="dialyzers" nolabel="1">
|
||||
<list>
|
||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||
<field name="description"/>
|
||||
<field name="use_time"/>
|
||||
<field name="max_use_time"/>
|
||||
<field name="member_type"/>
|
||||
<field name="dialyzer_type"/>
|
||||
<field name="bid_flow_rate"/>
|
||||
<field name="ultrafittration"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
<group form_layout="form">
|
||||
<field name="time_start" span="2"/>
|
||||
<field name="time_stop" span="2"/>
|
||||
<field name="duration" span="2"/>
|
||||
<field name="vascular_acc" span="2"/>
|
||||
<field name="wt_kg" span="1"/>
|
||||
<field name="bp" span="1"/>
|
||||
<field name="mm_hg" span="1"/>
|
||||
<field name="nu" span="2"/>
|
||||
<field name="hct" span="2" onchange="onchange_hct"/>
|
||||
<field name="hct_msg" span="4" readonly="1"/>
|
||||
<field name="dialyzers" nolabel="1">
|
||||
<list>
|
||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||
<field name="description"/>
|
||||
<field name="use_time"/>
|
||||
<field name="max_use_time"/>
|
||||
<field name="member_type"/>
|
||||
<field name="dialyzer_type"/>
|
||||
<field name="bid_flow_rate"/>
|
||||
<field name="ultrafittration"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Expenses">
|
||||
<tab string="Expense">
|
||||
<group span="12" form_layout="stacked">
|
||||
<field name="lines" count="3" nolabel="1">
|
||||
<list>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<field name="amount"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Staffs">
|
||||
<tab string="Staff">
|
||||
<field name="staffs" nolabel="1">
|
||||
<list>
|
||||
<field name="type"/>
|
||||
|
@ -103,13 +103,8 @@
|
|||
<tab string="Approval">
|
||||
<field name="nurse_id"/>
|
||||
</tab>
|
||||
<tab string="Others">
|
||||
<group span="6" columns="1">
|
||||
<field name="fee_partner_id" domain="[['type','=','org']]"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="note"/>
|
||||
</group>
|
||||
<tab string="Note">
|
||||
<field name="note" nolabel="1"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]]}'>
|
||||
<field name="number"/>
|
||||
<field name="ref"/>
|
||||
<field name="date"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="patient_id"/>
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
<item string="Categories" action="clinic_staff_categ"/>
|
||||
</item>
|
||||
<item string="Patients">
|
||||
<item string="New Patient" action="clinic_patient" action_options="mode=form"/>
|
||||
<divider/>
|
||||
<item string="Patients" action="clinic_patient"/>
|
||||
<item string="Dialyzers" action="clinic_dialyzer"/>
|
||||
<divider/>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<field name="visit_date"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Validation">
|
||||
<tab string="Confirmation">
|
||||
<field name="nurse_id"/>
|
||||
</tab>
|
||||
<tab string="Note">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from netforce.model import Model, fields
|
||||
from pprint import pprint
|
||||
|
||||
class Address(Model):
|
||||
_inherit="address"
|
||||
|
@ -7,5 +8,9 @@ class Address(Model):
|
|||
"patient_id": fields.Many2One("clinic.patient","Patient"),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
||||
}
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
pprint(vals)
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
Address.register()
|
||||
|
|
|
@ -4,6 +4,7 @@ from netforce.access import get_active_company
|
|||
class Department(Model):
|
||||
_name="clinic.department"
|
||||
_string="Department"
|
||||
_key=['code']
|
||||
|
||||
_fields={
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
|
|
|
@ -65,27 +65,32 @@ class HDCase(Model):
|
|||
}
|
||||
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={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"time_start": fields.DateTime("Time Start",required=True,search=True),
|
||||
"time_stop": fields.DateTime("Time Stop",required=True,search=True),
|
||||
"ref": fields.Char("Ref",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),
|
||||
"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']]),
|
||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||
"wh_start": fields.Float("Wt.Kg start"),
|
||||
"wh_stop": fields.Float("Wt.Kg stop"),
|
||||
"bp_start": fields.Integer("BP mmHG start"),
|
||||
"per_bp_start": fields.Integer("/Per start"),
|
||||
"bp_stop": fields.Integer("BP mmHG stop"),
|
||||
"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"),
|
||||
"wt_kg": fields.Float("Wt.kg."),
|
||||
"bp": fields.Integer("BP"),
|
||||
"mm_hg": fields.Integer("mmHG"),
|
||||
"hct": fields.Integer("Hct%(<40)"),
|
||||
"hct_msg" : fields.Char(""),
|
||||
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
||||
"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"),
|
||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
||||
"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"),
|
||||
"payment_lines": fields.One2Many("clinic.payment","hd_case_id","Payment Lines"),
|
||||
'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),
|
||||
"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),
|
||||
|
@ -140,6 +145,9 @@ class HDCase(Model):
|
|||
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"number": _get_number,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'wt_kg': 0.0,
|
||||
'bp': 0,
|
||||
'mm_hg': 0,
|
||||
'hct': 0,
|
||||
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
|
||||
'fee_paid': False,
|
||||
|
@ -501,7 +509,7 @@ class HDCase(Model):
|
|||
def discontinue(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
# TODO pop to note
|
||||
obj.write({"state":"in_completed"})
|
||||
obj.write({"state":"cancelled"})
|
||||
|
||||
def update_usetime(self,ids,context={}):
|
||||
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.write({
|
||||
'note': obj.note,
|
||||
'state': 'in_completed',
|
||||
'state': 'cancelled',
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
|
|
|
@ -132,6 +132,7 @@ class Patient(Model):
|
|||
address_id=get_model('address').create({
|
||||
'type': 'shipping',
|
||||
'partner_id': partner_id,
|
||||
'patient_id': obj.id, #XXX
|
||||
'address': 'your address',
|
||||
'address2': 'your address2',
|
||||
'city': 'your city',
|
||||
|
@ -181,6 +182,7 @@ class Patient(Model):
|
|||
addr=obj.addresses[0]
|
||||
get_model("address").browse(addr.id).write({
|
||||
'partner_id': partner_id,
|
||||
'patient_id': obj.id,
|
||||
})
|
||||
else:
|
||||
if vals.get("addresses"):
|
||||
|
@ -192,14 +194,13 @@ class Patient(Model):
|
|||
})
|
||||
del vals['addresses']
|
||||
print("create address for %s"%obj.name, ' ', addr_vals)
|
||||
|
||||
if obj.rm_remain_visit:
|
||||
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])
|
||||
get_model('clinic.visit').delete(visit_ids)
|
||||
print('remove visit auto %s'%visit_ids)
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def name_get(self,ids,context={}):
|
||||
def _name_get(self,ids,context={}):
|
||||
vals=[]
|
||||
for obj in self.browse(ids):
|
||||
name="%s %s %s"%(obj.number,obj.name, obj.hn)
|
||||
|
|
|
@ -28,8 +28,8 @@ class Visit(Model):
|
|||
|
||||
_fields={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"time_start": fields.DateTime("Time Start",required=True),
|
||||
"time_stop": fields.DateTime("Time Stop",required=True),
|
||||
"time_start": fields.DateTime("Start Time",required=True),
|
||||
"time_stop": fields.DateTime("End Time",required=True),
|
||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,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),
|
||||
|
@ -97,7 +97,7 @@ class Visit(Model):
|
|||
_order="sequence"
|
||||
|
||||
def confirm(self,ids,context={}):
|
||||
obj=self.browse(ids[0])
|
||||
obj=self.browse(ids)[0]
|
||||
number=obj.number
|
||||
if number=="/" or not number:
|
||||
number=self._get_number(context)
|
||||
|
@ -105,9 +105,12 @@ class Visit(Model):
|
|||
'number': number,
|
||||
'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)
|
||||
hd_case_obj=get_model("clinic.hd.case")
|
||||
obj=self.browse(ids)[0]
|
||||
vals={
|
||||
'patient_id': obj.patient_id.id,
|
||||
'nurse_id': obj.nurse_id.id,
|
||||
|
@ -119,7 +122,7 @@ class Visit(Model):
|
|||
'lines':[],
|
||||
'dialyzers': [],
|
||||
'staffs': [],
|
||||
'state': 'draft',
|
||||
'state': 'waiting_treatment',
|
||||
}
|
||||
|
||||
# use exist hd_case (in case set to draft)
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
=====
|
||||
import payment from government
|
||||
- read file
|
||||
xml
|
||||
- uc
|
||||
excel
|
||||
- social security
|
||||
|
||||
======
|
||||
bug:
|
||||
|
|
Loading…
Reference in New Issue