conv_bal
watcha.h@almacom.co.th 2014-12-19 23:57:34 +07:00
parent 7377983758
commit f1b8d5f435
13 changed files with 166 additions and 72 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Sickbed</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.sickbed</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -11,6 +11,25 @@
<field name="cycle_id" required="1"/>
<field name="date"/>
<tabs>
<tab string="HDCase">
<field name="hd_cases" nolabel="1">
<list>
<field name="sickbed_id" span="2"/>
<field name="patient_id" span="2"/>
<field name="time_start" span="2"/>
<field name="wt_start" span="2"/>
<field name="bp_start" span="2"/>
<field name="membrane_type" span="2"/>
<field name="vascular_acc" span="2"/>
<field name="bid_flow_rate" span="2"/>
<field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/>
<field name="time_stop" span="2"/>
<field name="wt_stop" span="2"/>
<field name="bp_stop" span="2"/>
</list>
</field>
</tab>
<tab string="Nurses">
<field name="nurses" nolabel="1">
<list>
@ -22,15 +41,14 @@
<tab string="Others">
</tab>
<tab string="Validation">
<field name="user_id"/>
<field name="cycle_daily_id" domain="[['date','=',date]]"/>
<field name="user_id" span="3"/>
<button string="Validate" type="success" method="validate" icon="ok" size="small" states="draft" />
</tab>
</tabs>
<foot>
<button string="Validate" type="success" method="validate" icon="ok" states="draft" />
<!--<button string="Validate" type="success" method="validate" icon="ok" states="draft" />-->
</foot>
<related>
<field name="hd_cases"/>
<field name="visits"/>
</related>
</form>

View File

@ -8,14 +8,13 @@
</head>
<group form_layout="stacked">
<field name="number" span="2"/>
<field name="ref" span="2"/>
<field name="sickbed_id" span="2" required="1"/>
<field name="patient_id" span="2" onchange="onchange_patient"/>
<field name="patient_type_id" span="2"/>
<field name="cycle_id" span="2" required="1" onchange="onchange_cycle"/>
<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"/>
<field name="cycle_item_id" span="2"/>
<field name="cycle_item_id" span="2" domain="[['cycle_id','=',cycle_id]]"/>
<field name="req_fee" span="2" readonly="1" invisible="1"/>
</group>
<tabs>
@ -25,22 +24,26 @@
<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="hd_mode" span="2"/>
<field name="hd_acc" span="2"/>
<newline/>
<field name="wt_start" span="2"/>
<field name="wt_stop" span="2"/>
<field name="hct" span="2" onchange="onchange_hct"/>
<field name="hct_msg" span="4" readonly="1"/>
<newline/>
<field name="bp_start" span="2"/>
<field name="bp_stop" span="2"/>
<field name="membrane_type" span="2" />
<field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/>
<field name="dialyzers" nolabel="1">
<list>
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
<field name="description" readonly="1"/>
<field name="dialyzer_type" span="2"/>
<field name="use_time" readonly="1"/>
<field name="max_use_time" readonly="1"/>
<field name="member_type" readonly="1"/>
<field name="dialyzer_type" readonly="1"/>
<field name="bid_flow_rate" readonly="1"/>
<field name="ultrafittration" readonly="1"/>
<field name="description"/>
</list>
</field>
</group>
@ -88,7 +91,7 @@
<field name="amount"/>
</group>
</tab>
<tab string="Staff">
<tab string="Doctors">
<field name="staffs" nolabel="1">
<list>
<field name="type"/>
@ -98,20 +101,20 @@
</list>
</field>
<group span="9" form_layout="stacked">
<field name="cycle_item_id"/>
</group>
<group span="3" columns="1">
</group>
</tab>
<tab string="Approval">
<field name="nurse_id"/>
</tab>
<tab string="Note">
<field name="note" nolabel="1"/>
</tab>
<tab string="Other">
<field name="nurse_id" span="3"/>
<field name="fee_partner_id" span="3" domain="[['type','=','org']]"/>
</tab>
</tabs>
<foot>
<button string="Do Treatment" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/>
<button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/>
<button string="Done" type="success" icon="ok" method="done" states="in_progress"/>
<button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Request Fee" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",0]]}'/>

View File

@ -1,12 +1,22 @@
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'>
<field name="number"/>
<!--<field name="ref"/>-->
<field name="date"/>
<field name="cycle_id"/>
<field name="patient_id"/>
<field name="hct"/>
<field name="doctor_id"/>
<field name="cycle_id"/>
<field name="department_id"/>
<field name="nurse_id"/>
<field name="doctor_id"/>
<field name="sickbed_id" span="2"/>
<field name="patient_id" span="2"/>
<field name="time_start" span="2"/>
<field name="wt_start" span="2"/>
<field name="bp_start" span="2"/>
<field name="membrane_type" span="2"/>
<field name="vascular_acc" span="2"/>
<field name="bid_flow_rate" span="2"/>
<field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/>
<field name="time_stop" span="2"/>
<field name="wt_stop" span="2"/>
<field name="bp_stop" span="2"/>
<field name="state"/>
</list>

View File

@ -58,6 +58,7 @@
<item string="Branch" action="clinic_branch"/>
<item string="Departments" action="clinic_department"/>
<item string="Hospital" action="clinic_hospital"/>
<item string="Sickbed" action="clinic_sickbed"/>
<item string="Nationalities" action="clinic_nation"/>
<item string="Valcular Access" action="clinic_vascular_access"/>
<item string="Clinic Settings" action="clinic_setting"/>

View File

@ -0,0 +1,9 @@
<form model="clinic.sickbed">
<head>
<button string="Options" dropdown="1">
<item string="Copy" method="copy"/>
</button>
</head>
<field name="name"/>
<field name="available"/>
</form>

View File

@ -0,0 +1,4 @@
<list model="clinic.sickbed">
<field name="name"/>
<field name="available"/>
</list>

View File

@ -80,3 +80,4 @@ from . import labor_cost_line
from . import labor_cost_staff
from . import labor_cost_entry
from . import labor_cost_entry_line
from . import sickbed

View File

@ -19,20 +19,20 @@ class CycleItem(Model):
name="%s-%s"%(cycle_name,obj.date)
res[obj.id]={
'name': name,
'sequence':'%s-%s'%(obj.date,cycle.sequence),
}
return res
_fields={
'name': fields.Char("Name", function="_get_all",function_multi=True),
'name': fields.Char("Name",function="_get_all",function_multi=True,store=True),
'date': fields.Date("Date",search=True),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),
'cycle_daily_id': fields.Many2One("clinic.cycle.daily", "Cycle Daily",search=True),
'lines': fields.One2Many("clinic.cycle.item.line","item_id", "Lines"),
'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"),
'hd_cases': fields.One2Many("clinic.hd.case","cycle_item_id", "HD Cases"),
'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'),
'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]), #XXX
'sequence': fields.Char("Sequence"), # for sort item
'nurse_id': fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
'sequence': fields.Char("Sequence",function="_get_all",function_multi=True,store=True),
'company_id': fields.Many2One("company", "Company"),
"state": fields.Selection([("draft","Draft"),("validated","Validated")],"Status",required=True),
'user_id': fields.Many2One("base.user","Validator"),
@ -72,18 +72,13 @@ class CycleItem(Model):
def create(self, vals,**kw):
date=vals['date']
cycle_id=vals['cycle_id']
cycle=get_model("clinic.cycle").browse(cycle_id)
vals['sequence']='%s-%s'%(date,cycle.sequence) #date-sequence
obj_id=super().create(vals,**kw)
return obj_id
new_id=super().create(vals,**kw)
self.function_store([new_id])
return new_id
def write(self,ids,vals,**kw):
obj=self.browse(ids)[0]
cycle=obj.cycle_id
vals['sequence']='%s-%s'%(obj.date,cycle.sequence) #date-sequence
super().write(ids,vals,**kw)
self.function_store(ids)
def validate(self,ids,context={}):
obj=self.browse(ids)[0]

View File

@ -66,23 +66,30 @@ class HDCase(Model):
res={}
for obj in self.browse(ids):
patient=obj.patient_id
res[obj.id]=patient.type_id.name
res[obj.id]=patient.type_id.id
return res
_fields={
"number": fields.Char("Number",required=True,search=True),
'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
"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.Char("Service Type",function="_get_patient_type"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
"patient_type_id": fields.Many2One("clinic.patient.type", "Type",function="_get_patient_type"),
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
"wt_kg": fields.Float("Wt.kg."),
"bp": fields.Integer("BP"),
"mm_hg": fields.Integer("mmHG"),
"wt_start": fields.Float("Wt Start(kg)"),
"wt_stop": fields.Float("Wt Stop(kg)"),
"bp_start": fields.Char("BP Start"),
"bp_stop": fields.Char("BP Stop"),
"membrane_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"),
"hd_acc": fields.Selection([("o","O"),("i","I")],"HD Acc"),
"hd_mode": fields.Selection([("chronic","Chronic"),("acute","Acute")],"HD Moode"),
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"),
"ultrafittration": fields.Float("Ultrafittration Kg."),
"hct": fields.Integer("Hct",required=True),
"hct_msg" : fields.Char(""),
"state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True),
@ -96,7 +103,7 @@ class HDCase(Model):
"payment_lines": fields.One2Many("clinic.payment","hd_case_id","Payment Lines"),
"expenes": fields.One2Many("clinic.hd.case.expense","hd_case_id","Expenses"),
'visit_id': fields.Many2One("clinic.visit", "Visit"),
'duration': fields.Integer("Duration(Hours)",function="_get_duration"),
'duration': fields.Integer("Duration (Hours)",function="_get_duration"),
"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),
@ -107,7 +114,7 @@ class HDCase(Model):
'note': fields.Text("Note"),
'complication': fields.Text("Complication"),
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"), # on_delete="cascade" -> will rm visit from cycle item
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item (Team)"), # on_delete="cascade" -> will rm visit from cycle item
'pay_amount': fields.Float("Amount",function="_get_pay_amount"),
'pay_date': fields.Date("Pay Date"),
'pay_account_id': fields.Many2One("account.account","Account"),
@ -143,9 +150,14 @@ 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,
'wt_start': 0.0,
'wt_stop': 0.0,
'bp_start': '0/0',
'bp_stop': '0/0',
"bid_flow_rate": 0.0,
"ultrafittration": 0.0,
'hd_acc': 'o',
'hd_mode': 'chronic',
'hct': 0,
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
'fee_paid': False,
@ -174,11 +186,7 @@ class HDCase(Model):
line["description"]=dialyzer.description or dialyzer.product_id.name or ""
line["use_time"]=use_time
line["max_use_time"]=dialyzer.max_use_time
line["member_type"]=dialyzer.member_type
line["dialyzer_type"]=dialyzer.dialyzer_type
line["bid_flow_rate"]=dialyzer.bid_flow_rate
line["ultrafittration"]=dialyzer.ultrafittration
line["state"]=dialyzer.state
data['dlz_id']=dialyzer.id
return data
@ -206,11 +214,11 @@ class HDCase(Model):
partner=patient.type_id.contact_id
data['department_id']=department.id
data['cycle_id']=cycle.id
data['patient_type_id']=patient.type_id.id
if partner:
data['fee_partner_id']=partner.id
else:
data['fee_partner_id']=None
data['patient_type']=patient.type_id.name or ""
data['dialyzers']=[]
doctor=patient.doctor_id
data['staffs']=[] # XXX
@ -827,11 +835,7 @@ class HDCase(Model):
'description': dialyzer.description or product_name,
'use_time': 1,
'max_use_time': dialyzer.max_use_time,
'member_type': dialyzer.member_type,
'dialyzer_type': dialyzer.dialyzer_type,
'bid_flow_rate': dialyzer.bid_flow_rate,
'ultrafittration': dialyzer.ultrafittration,
'state': dialyzer.state,
}))
obj.write(vals)
if context.get('called'):
@ -887,7 +891,7 @@ class HDCase(Model):
}))
# fee
st=get_model("clinic.setting").browse(1)
if not st.auto_gen:
if st.auto_gen:
return
if not vals.get('lines'):
@ -917,15 +921,16 @@ class HDCase(Model):
raise Exception("Not found contact %s at menu: Patiens -> Type"%patient.type_id.name)
return vals
def get_invoice_policy(self,vals,patient_id=None):
def get_invoice_policy(self,vals={},patient_id=None):
print('vals ', vals)
if patient_id:
patient=get_model("clinic.patient").browse(patient_id)
st=get_model("clinic.setting").browse(1)
for pl in st.invoice_policies:
policy=pl.invoice_policy
patient_type_id=pl.patient_type_id.id
patient_type=pl.patient_type_id
opt=pl.invoice_option
if patient.type_id.id==patient_type_id:
if patient.type_id.id==patient_type.id:
vals['invoice_policy']=policy
vals['invoice_option']=opt
break

View File

@ -4,16 +4,11 @@ class HDCaseDialyzerLine(Model):
_name="clinic.hd.case.dialyzer"
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
"visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Dialyzer Type"),
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True),
"description": fields.Char("Description",search=True),
"use_time":fields.Integer("Use time"),
"max_use_time":fields.Integer("Max use time"),
"member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Member Type"),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"),
"ultrafittration": fields.Float("Ultrafittration Kg."),
"state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"),
}
HDCaseDialyzerLine.register()

View File

@ -0,0 +1,31 @@
from netforce.model import Model, fields, get_model
class SickBed(Model):
_name="clinic.sickbed"
_string="Sickbed"
_fields={
"name": fields.Char("Name",required=True,search=True),
"available": fields.Boolean("Available"),
'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'),
}
_defaults={
'available': True,
}
def copy(self,ids,context={}):
obj=self.browse(ids)[0]
new_id=get_model("clinic.sickbed").create({
'name': '%s(copy)' % obj.name,
})
return {
'next': {
'name': 'clinic_sickbed',
'mode': 'form',
'active_id': new_id,
},
'flash': 'Copy succesfully',
}
SickBed.register()

View File

@ -1,4 +1,20 @@
==
=====
cycle item
- list's nurse
- list hd case + U
=====
- design
1. create cycle item
=====
==== after midnight, create payment
====
if patient not do visit before treatment , how to do?
==
import payment