title first_name and last_name for patient & staff
parent
bac6fc081d
commit
0ee5de47de
|
@ -1,7 +1,7 @@
|
||||||
<menu string="Clinic">
|
<menu string="Clinic">
|
||||||
<item string="Dashboard" action="clinic_board"/>
|
<item string="Dashboard" action="clinic_board"/>
|
||||||
<item string="Staffs" perm="clinic_staff">
|
<item string="Staffs" perm="clinic_staff">
|
||||||
<item string="Staffs" action="clinic_staff" action_options="tab_no=2"/>
|
<item string="Staffs" action="clinic_staff" action_options="tab_no=0"/>
|
||||||
<item string="Doctors" action="clinic_staff" action_options="tab_no=3"/>
|
<item string="Doctors" action="clinic_staff" action_options="tab_no=3"/>
|
||||||
<item string="Nurses" action="clinic_staff" action_options="tab_no=4"/>
|
<item string="Nurses" action="clinic_staff" action_options="tab_no=4"/>
|
||||||
<divider/>
|
<divider/>
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
</head>
|
</head>
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="trt_no"/>
|
<field name="trt_no"/>
|
||||||
|
<!--<field name="name"/>-->
|
||||||
|
<field name="title_id" required="1"/>
|
||||||
<field name="type_id"/>
|
<field name="type_id"/>
|
||||||
<field name="name"/>
|
<field name="first_name" required="1"/>
|
||||||
|
<field name="last_name" required="1"/>
|
||||||
<field name="reg_date"/>
|
<field name="reg_date"/>
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="categ_id"/>
|
<field name="categ_id"/>
|
||||||
<field name="branch_id" required="1"/>
|
<field name="branch_id" required="1"/>
|
||||||
<field name="title_id" required="1"/>
|
|
||||||
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
|
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
|
||||||
<field name="first_name" required="1"/>
|
|
||||||
<field name="last_name" required="1"/>
|
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General Information">
|
<tab string="General Information">
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
|
|
|
@ -39,7 +39,32 @@ class Patient(Model):
|
||||||
res[obj.id]=hn
|
res[obj.id]=hn
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_name_check(self,ids,context={}):
|
def _get_name(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
name=''
|
||||||
|
title=obj.title_id
|
||||||
|
if title:
|
||||||
|
title_name=title.name or ""
|
||||||
|
title_name=title_name.replace(" ","")
|
||||||
|
if title_name.lower()!='notitle':
|
||||||
|
name+=obj.title_id.name or ""
|
||||||
|
if obj.first_name:
|
||||||
|
name+=obj.first_name or ""
|
||||||
|
name+=" "
|
||||||
|
if obj.last_name:
|
||||||
|
name+=obj.last_name or ""
|
||||||
|
if not obj.active:
|
||||||
|
name+='not_use'
|
||||||
|
elif context.get('active'):
|
||||||
|
name+='not_use'
|
||||||
|
res[obj.id]={
|
||||||
|
'name': name,
|
||||||
|
'name_check': name.replace(" ",""), # remove all space for make sure
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _get_name_old(self,ids,context={}):
|
||||||
# remove all space for make sure
|
# remove all space for make sure
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
|
@ -48,7 +73,9 @@ class Patient(Model):
|
||||||
name+='not_use'
|
name+='not_use'
|
||||||
elif context.get('active'):
|
elif context.get('active'):
|
||||||
name+='not_use'
|
name+='not_use'
|
||||||
res[obj.id]=name
|
res[obj.id]={
|
||||||
|
'name_check': name,
|
||||||
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
|
@ -59,8 +86,8 @@ class Patient(Model):
|
||||||
'title_id': fields.Many2One("clinic.name.title","Title"),
|
'title_id': fields.Many2One("clinic.name.title","Title"),
|
||||||
"first_name": fields.Char("First Name"),
|
"first_name": fields.Char("First Name"),
|
||||||
"last_name": fields.Char("Last Name"),
|
"last_name": fields.Char("Last Name"),
|
||||||
"name": fields.Char("Name",search=True),
|
"name": fields.Char("Name",function="_get_name",function_multi=True,store=True,search=True),
|
||||||
"name_check": fields.Char("Name",function="_get_name_check",store=True), # prevent duplicate
|
"name_check": fields.Char("Name",function="_get_name",function_multi=True,store=True), # prevent duplicate
|
||||||
'type_id': fields.Many2One("clinic.patient.type","Type",search=True,required=True),
|
'type_id': fields.Many2One("clinic.patient.type","Type",search=True,required=True),
|
||||||
"reg_date": fields.Date("Reg. Date",required=False,search=True),
|
"reg_date": fields.Date("Reg. Date",required=False,search=True),
|
||||||
"birthday": fields.Date("Birthday",required=False,search=True),
|
"birthday": fields.Date("Birthday",required=False,search=True),
|
||||||
|
@ -169,7 +196,7 @@ class Patient(Model):
|
||||||
_order="resign_date desc,number desc"
|
_order="resign_date desc,number desc"
|
||||||
|
|
||||||
def create(self, vals,**kw):
|
def create(self, vals,**kw):
|
||||||
obj_id=super(Patient,self).create(vals,**kw)
|
obj_id=super().create(vals,**kw)
|
||||||
self.function_store([obj_id])
|
self.function_store([obj_id])
|
||||||
obj=self.browse(obj_id)
|
obj=self.browse(obj_id)
|
||||||
partner_id=obj.partner_id
|
partner_id=obj.partner_id
|
||||||
|
@ -211,6 +238,8 @@ class Patient(Model):
|
||||||
address_ids=[addr.id for addr in obj.partner_id.addresses]
|
address_ids=[addr.id for addr in obj.partner_id.addresses]
|
||||||
get_model("partner").delete(partner_ids)
|
get_model("partner").delete(partner_ids)
|
||||||
get_model("address").delete(address_ids)
|
get_model("address").delete(address_ids)
|
||||||
|
vids=get_model("clinic.visit").search([['patient_id','in',ids],['state','in',['draft','pending']]])
|
||||||
|
get_model('clinic.visit').delete(vids)
|
||||||
super().delete(ids)
|
super().delete(ids)
|
||||||
|
|
||||||
def write(self,ids,vals,**kw):
|
def write(self,ids,vals,**kw):
|
||||||
|
@ -244,6 +273,7 @@ class Patient(Model):
|
||||||
'doctor_id': vals['doctor_id'],
|
'doctor_id': vals['doctor_id'],
|
||||||
}
|
}
|
||||||
update_visit_pending(obj,visit_vals)
|
update_visit_pending(obj,visit_vals)
|
||||||
|
# get name
|
||||||
partner_id=obj.partner_id
|
partner_id=obj.partner_id
|
||||||
if not partner_id:
|
if not partner_id:
|
||||||
for partner in get_model("partner").search_browse([['name', '=', obj.name]]):
|
for partner in get_model("partner").search_browse([['name', '=', obj.name]]):
|
||||||
|
@ -280,8 +310,13 @@ class Patient(Model):
|
||||||
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','in',('draft','pending')]])
|
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','in',('draft','pending')]])
|
||||||
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)
|
||||||
self.function_store(ids,context=ctx)
|
|
||||||
super().write(ids,vals,**kw)
|
super().write(ids,vals,**kw)
|
||||||
|
self.function_store(ids,context=ctx)
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
print(obj.name or "")
|
||||||
|
obj.partner_id.write({
|
||||||
|
'last_name': obj.name,
|
||||||
|
})
|
||||||
|
|
||||||
def name_get(self,ids,context={}):
|
def name_get(self,ids,context={}):
|
||||||
vals=[]
|
vals=[]
|
||||||
|
|
|
@ -110,6 +110,132 @@ class ClinicSetting(Model):
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
|
titles=dict([(t.name, t.id) for t in get_model("clinic.name.title").search_browse([])])
|
||||||
|
title_id=None
|
||||||
|
gtile_id=title_id
|
||||||
|
for name, tid in titles.items():
|
||||||
|
if name=='No Title':
|
||||||
|
gtitle_id=tid
|
||||||
|
for model_name in ('clinic.staff', 'clinic.patient'):
|
||||||
|
for st in get_model(model_name).search_browse([]):
|
||||||
|
name=st.name
|
||||||
|
vals={}
|
||||||
|
if 'นายแพทย์' in name:
|
||||||
|
name=name.replace("นายแพทย์","")
|
||||||
|
tname='นายแพทย์'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'male',
|
||||||
|
})
|
||||||
|
elif 'นพ.' in name:
|
||||||
|
name=name.replace("นพ.","")
|
||||||
|
tname='นพ.'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'male',
|
||||||
|
})
|
||||||
|
elif 'นาย' in name:
|
||||||
|
name=name.replace("นาย","")
|
||||||
|
tname='นาย'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'male',
|
||||||
|
})
|
||||||
|
elif 'พันตำรวจเอก' in name:
|
||||||
|
name=name.replace("พันตำรวจเอก","")
|
||||||
|
tname='พันตำรวจเอก'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'male',
|
||||||
|
})
|
||||||
|
elif 'นางสาว' in name:
|
||||||
|
name=name.replace("นางสาว","")
|
||||||
|
tname='นางสาว'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'นาง' in name:
|
||||||
|
name=name.replace("นาง","")
|
||||||
|
tname='นาง'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'น.ส.' in name:
|
||||||
|
name=name.replace("น.ส.","")
|
||||||
|
tname='น.ส.'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'พญ..' in name:
|
||||||
|
name=name.replace("พญ..","")
|
||||||
|
tname='พญ..'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'แพทย์หญิง' in name:
|
||||||
|
name=name.replace("แพทย์หญิง","")
|
||||||
|
tname='แพทย์หญิง'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'ร้อยเอกหญิง' in name:
|
||||||
|
name=name.replace("ร้อยเอกหญิง","")
|
||||||
|
tname='ร้อยเอกหญิง'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'พันตรีหญิง' in name:
|
||||||
|
name=name.replace("พันตรีหญิง","")
|
||||||
|
tname='พันตรีหญิง'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
elif 'พันตำรวจโทหญิง' in name:
|
||||||
|
name=name.replace("พันตำรวจโทหญิง","")
|
||||||
|
tname='พันตำรวจโทหญิง'
|
||||||
|
title_id=titles.get(tname)
|
||||||
|
vals.update({
|
||||||
|
'title_id': title_id,
|
||||||
|
'gender': 'female',
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
vals.update({
|
||||||
|
'first_name': name, #XXX
|
||||||
|
'title_id': gtitle_id,
|
||||||
|
#'gender': 'male',
|
||||||
|
})
|
||||||
|
names=name.split()
|
||||||
|
names=[n for n in names if n] # skip space
|
||||||
|
if len(names)==2:
|
||||||
|
vals.update({
|
||||||
|
'first_name':names[0],
|
||||||
|
'last_name': names[1],
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
print(name)
|
||||||
|
st.write(vals)
|
||||||
|
if not st.gender:
|
||||||
|
st.write({
|
||||||
|
'gender': 'male',
|
||||||
|
})
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def reset_last_import(self,ids,context={}):
|
def reset_last_import(self,ids,context={}):
|
||||||
|
|
|
@ -71,11 +71,29 @@ class Staff(Model):
|
||||||
res[obj.id]=hids
|
res[obj.id]=hids
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_name_check(self,ids,context={}):
|
def _get_name(self,ids,context={}):
|
||||||
# remove all space for make sure
|
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
res[obj.id]=(obj.name or "").replace(" ","")
|
name=''
|
||||||
|
title=obj.title_id
|
||||||
|
if title:
|
||||||
|
title_name=title.name or ""
|
||||||
|
title_name=title_name.replace(" ","")
|
||||||
|
if title_name.lower()!='notitle':
|
||||||
|
name+=obj.title_id.name or ""
|
||||||
|
if obj.first_name:
|
||||||
|
name+=obj.first_name or ""
|
||||||
|
name+=" "
|
||||||
|
if obj.last_name:
|
||||||
|
name+=obj.last_name or ""
|
||||||
|
if not obj.active:
|
||||||
|
name+='not_use'
|
||||||
|
elif context.get('active'):
|
||||||
|
name+='not_use'
|
||||||
|
res[obj.id]={
|
||||||
|
'name': name,
|
||||||
|
'name_check': name.replace(" ",""), # remove all space for make sure
|
||||||
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
|
@ -84,8 +102,8 @@ class Staff(Model):
|
||||||
"title_id": fields.Many2One("clinic.name.title","Title"),
|
"title_id": fields.Many2One("clinic.name.title","Title"),
|
||||||
"first_name": fields.Char("First Name"),
|
"first_name": fields.Char("First Name"),
|
||||||
"last_name": fields.Char("Last Name"),
|
"last_name": fields.Char("Last Name"),
|
||||||
"name": fields.Char("Name",required=True,search=True),
|
"name": fields.Char("Name",function="_get_name",function_multi=True,store=True,required=True,search=True),
|
||||||
"name_check": fields.Char("Name",function="_get_name_check",store=True),
|
"name_check": fields.Char("Name",function="_get_name",function_multi=True,store=True),
|
||||||
"name_eng": fields.Char("Eng Name",search=True),
|
"name_eng": fields.Char("Eng Name",search=True),
|
||||||
"nick_name": fields.Char("Nick Name",search=True),
|
"nick_name": fields.Char("Nick Name",search=True),
|
||||||
"identification" : fields.Char("Identification Card"),
|
"identification" : fields.Char("Identification Card"),
|
||||||
|
@ -133,7 +151,6 @@ class Staff(Model):
|
||||||
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
|
'branch_id': fields.Many2One("clinic.branch","Branch", search=True),
|
||||||
"partner_id": fields.Many2One("partner","Contact"),
|
"partner_id": fields.Many2One("partner","Contact"),
|
||||||
'departments': fields.Many2Many("clinic.department","Departments"),
|
'departments': fields.Many2Many("clinic.department","Departments"),
|
||||||
'test': fields.Boolean("Test",search=True),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
|
@ -256,8 +273,8 @@ class Staff(Model):
|
||||||
address_id=None
|
address_id=None
|
||||||
if not partner_id:
|
if not partner_id:
|
||||||
vals['partner_id'],address_id=self.create_contact(name)
|
vals['partner_id'],address_id=self.create_contact(name)
|
||||||
self.function_store(ids)
|
|
||||||
super().write(ids,vals,**kw)
|
super().write(ids,vals,**kw)
|
||||||
|
self.function_store(ids)
|
||||||
if address_id:
|
if address_id:
|
||||||
addr=get_model('address').browse(address_id)
|
addr=get_model('address').browse(address_id)
|
||||||
addr.write({
|
addr.write({
|
||||||
|
|
|
@ -10,3 +10,34 @@ todo:
|
||||||
matching payment > ok
|
matching payment > ok
|
||||||
create contact from staff -> ok
|
create contact from staff -> ok
|
||||||
script to clear invoice -> ok
|
script to clear invoice -> ok
|
||||||
|
|
||||||
|
requirement:
|
||||||
|
|
||||||
|
1.1 Profile STAFF ยังไม่สามารถ กำหนดให้ 1คน มี profile ได้หลาย Department (ตามเมล์ date: Mon, Feb 23, 2015 at 3:15 PM ที่คุณพอลลี่แจ้งมา อยู่ระหว่างกำลังแก้ไข)
|
||||||
|
|
||||||
|
1.2 HD Cases ยังพบ bug ในส่วน Expense EPO ที่เบิกได้ตามสิทธิ์ของผู้ป่วย เลือก Product แล้วราคาไม่แสดง
|
||||||
|
-> config on product price list and retest it again
|
||||||
|
|
||||||
|
1.3 HD Cases ในส่วน Expense ที่ถูกต้อง เมื่อเลือก Product แล้ว Product นั้นต้องสัมพันธ์กับสถานะ Reimbursable (เช่น Category: EPO Product: [61006-SSO] EPIAO-SSO Reimbursable ต้องเป็น Yes ถ้า EPO ขาย สถานะ Reimbursable เป็น No)
|
||||||
|
->ok
|
||||||
|
|
||||||
|
1.4 RC เป็น PDF + ชื่อพยาบาล วันที่ (ตรงลายเซ็นคุณผดา ต้องการให้สามารถใส่ไฟล์แก้ไขได้เอง)
|
||||||
|
|
||||||
|
1.5 HD Case Summary สร้าง filter กรองตามชั้น
|
||||||
|
-> ok
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2. Accounting issues
|
||||||
|
|
||||||
|
2.1 HD Cases Matching
|
||||||
|
|
||||||
|
2.2 Statement Matching
|
||||||
|
|
||||||
|
2.3 ค่าตอบแทนแพทย์ และพยาบาล (ตามที่ คุณบอย แจ้งเมื่อวันที่ 19 ก.พ. 58)
|
||||||
|
|
||||||
|
2.4 Bank Reconciliation
|
||||||
|
|
||||||
|
2.5 Fixed Asset
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue