hn & hct
parent
da14324956
commit
4c783eccd8
|
@ -19,6 +19,7 @@
|
|||
<field name="req_fee" span="2" invisible="1"/>
|
||||
<!-- enable show_company=1 -->
|
||||
<field name="company_id" span="2" invisible="1"/>
|
||||
<field name="hct_include" span="2" invisible="1"/>
|
||||
</group>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
|
@ -32,8 +33,8 @@
|
|||
<newline/>
|
||||
<field name="wt_start" span="2" attrs='{"required":[["state","=","waiting_treatment"]]}'/>
|
||||
<field name="wt_stop" span="2"/>
|
||||
<field name="hct" span="2" onchange="onchange_hct"/>
|
||||
<field name="hct_msg" span="4" readonly="1"/>
|
||||
<field name="hct" span="2" onchange="onchange_hct" attrs='{"invisible":[["hct_include","=",false]]}'/>
|
||||
<field name="hct_msg" span="4" readonly="1" attrs='{"invisible":[["hct_include","=",false]]}'/>
|
||||
<newline/>
|
||||
<field name="bp_start" span="2"/>
|
||||
<field name="bp_stop" span="2"/>
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
<button string="Options" dropdown="1">
|
||||
<item string="Generate Visit" action="clinic_gen_visit"/>
|
||||
<item string="New Dialyzer" method="new_dialyzer"/>
|
||||
<item string="Simple Address" method="simple_address"/>
|
||||
<!--<item string="Simple Address" method="simple_address"/>-->
|
||||
</button>
|
||||
</head>
|
||||
<field name="number"/>
|
||||
<field name="trt_no"/>
|
||||
<field name="type_id"/>
|
||||
<field name="name"/>
|
||||
<field name="hn"/>
|
||||
<!--<field name="hn"/>-->
|
||||
<field name="reg_date"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="categ_id"/>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</head>
|
||||
<field name="reg_date"/>
|
||||
<field name="number"/>
|
||||
<field name="hn_no"/>
|
||||
<!--<field name="hn_no"/>-->
|
||||
<field name="trt_no"/>
|
||||
<field name="name"/>
|
||||
<field name="department_id"/>
|
||||
|
|
|
@ -4,9 +4,16 @@
|
|||
<item string="New Contact" method="new_contact"/>
|
||||
</button>
|
||||
</head>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="contact_id"/>
|
||||
<field name="default"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
</tab>
|
||||
<tab string="Other">
|
||||
<field name="hct_include"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
</form>
|
||||
|
|
|
@ -58,6 +58,15 @@ class HDCase(Model):
|
|||
res[obj.id]=patient.type_id.id
|
||||
return res
|
||||
|
||||
def _get_hct_include(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
include=False
|
||||
if obj.patient_id.type_id.hct_include:
|
||||
include=True
|
||||
res[obj.id]=include
|
||||
return res
|
||||
|
||||
_fields={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
|
||||
|
@ -81,6 +90,7 @@ class HDCase(Model):
|
|||
"ultrafittration": fields.Float("Ultrafittration (kg.)"),
|
||||
"hct": fields.Integer("Hct",required=True),
|
||||
"hct_msg" : fields.Char(""),
|
||||
'hct_include': fields.Boolean("HCT Include", function="_get_hct_include",store=True),
|
||||
"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),
|
||||
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
|
||||
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
|
||||
|
@ -977,6 +987,7 @@ class HDCase(Model):
|
|||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
vals['branch_id']=patient.branch_id.id
|
||||
new_id=super().create(vals,**kw)
|
||||
self.function_store([new_id])
|
||||
return new_id
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
|
@ -1045,6 +1056,7 @@ class HDCase(Model):
|
|||
sb.write({
|
||||
'state': 'not_available',
|
||||
})
|
||||
self.function_store(ids)
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def approve(self,ids,context={}):
|
||||
|
|
|
@ -3,13 +3,15 @@ import time
|
|||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company, get_active_user, set_active_user
|
||||
|
||||
from . import utils
|
||||
|
||||
|
||||
class Patient(Model):
|
||||
_name="clinic.patient"
|
||||
_string="Patient"
|
||||
_audit_log=True
|
||||
_multi_company=True
|
||||
_key=['name']
|
||||
_key=['number']
|
||||
|
||||
def _get_age(self,ids,context):
|
||||
res={}
|
||||
|
@ -35,15 +37,15 @@ class Patient(Model):
|
|||
def _get_hn_no(self,ids,context={}):
|
||||
res={}
|
||||
for obj in self.browse(ids):
|
||||
hn=''.join(x for x in (obj.hn or "") if x.isdigit())
|
||||
hn=''.join(x for x in (obj.number or "") if x.isdigit())
|
||||
res[obj.id]=hn
|
||||
return res
|
||||
|
||||
_fields={
|
||||
'type_id': fields.Many2One("clinic.patient.type","Type",search=True,required=True),
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"number": fields.Char("HN",required=True,search=True),
|
||||
"trt_no": fields.Char("TRT. No",search=True),
|
||||
"hn_no": fields.Char("HN",function="_get_hn_no"),
|
||||
"hn_no": fields.Char("HN Number",function="_get_hn_no"),
|
||||
"hn": fields.Char("REF/HN",search=True),
|
||||
"name": fields.Char("Name",required=True,search=True),
|
||||
"reg_date": fields.Date("Register Date",required=False,search=True),
|
||||
|
@ -109,6 +111,11 @@ class Patient(Model):
|
|||
return None
|
||||
user_id=get_active_user()
|
||||
set_active_user(1)
|
||||
# reformat number: month-running num-year thai(2 digit)
|
||||
monthnow=int(time.strftime("%m"))
|
||||
yearnow=utils.date2thai(time.strftime("%Y-%m-%d"),"%(By)s")
|
||||
num="%s-%s-%s"%(monthnow,num,yearnow)
|
||||
|
||||
res=self.search([["number","=",num]])
|
||||
set_active_user(user_id)
|
||||
if not res:
|
||||
|
@ -226,7 +233,6 @@ class Patient(Model):
|
|||
def name_get(self,ids,context={}):
|
||||
vals=[]
|
||||
for obj in self.browse(ids):
|
||||
#name="%s [%s]"%(obj.name, obj.hn_no)
|
||||
name=obj.name or ''
|
||||
if obj.hn_no:
|
||||
name+=" (HN: %s)"%obj.hn_no
|
||||
|
@ -238,7 +244,7 @@ class Patient(Model):
|
|||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids1=self.search(dom)
|
||||
dom=[["hn","ilike","%"+name+"%"]]
|
||||
dom=[["number","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids2=self.search(dom)
|
||||
|
|
|
@ -11,6 +11,7 @@ class PatientType(Model):
|
|||
"code": fields.Char("Code",required=True,search=True),
|
||||
'contact_id': fields.Many2One("partner","Contact",domain=[['type','=','org']],search=True),
|
||||
'default': fields.Boolean("Default"),
|
||||
'hct_include': fields.Boolean("HCT Include"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue