import
parent
20f304274d
commit
616e172447
|
@ -0,0 +1,7 @@
|
|||
<action>
|
||||
<field name="string">NHSO</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="tabs">[["All",[]],["Success",[["type","=","success"]]],["Fail",[["type","=","fail"]]]]</field>
|
||||
<field name="model">clinic.data.nhso</field>
|
||||
<field name="menu">account_menu</field>
|
||||
</action>
|
|
@ -0,0 +1,7 @@
|
|||
<action>
|
||||
<field name="string">NHSO</field>
|
||||
<field name="view_cls">multi_view</field>
|
||||
<field name="tabs">[["All",[]],["Success",[["type","=","success"]]],["Fail",[["type","=","fail"]]]]</field>
|
||||
<field name="model">clinic.data.sc</field>
|
||||
<field name="menu">account_menu</field>
|
||||
</action>
|
|
@ -0,0 +1,18 @@
|
|||
<form model="clinic.data.nhso">
|
||||
<field name="name"/>
|
||||
<field name="epostat"/>
|
||||
<field name="hdrate"/>
|
||||
<field name="hdflag"/>
|
||||
<field name="amount"/>
|
||||
<field name="paid"/>
|
||||
<field name="paychk"/>
|
||||
<field name="dttran"/>
|
||||
<field name="hreg"/>
|
||||
<field name="station"/>
|
||||
<field name="hn"/>
|
||||
<field name="invno"/>
|
||||
<field name="rid"/>
|
||||
<field name="cstat"/>
|
||||
<field name="reimbpay"/>
|
||||
<field name="type"/>
|
||||
</form>
|
|
@ -0,0 +1,19 @@
|
|||
<!--<list model="clinic.data.nhso" colors='{"#9f9":[["type","=","success"]],"red":[["type","=","fail"]]}'>-->
|
||||
<list model="clinic.data.nhso">
|
||||
<field name="name"/>
|
||||
<field name="epostat"/>
|
||||
<field name="hdrate"/>
|
||||
<field name="hdflag"/>
|
||||
<field name="amount"/>
|
||||
<field name="paid"/>
|
||||
<field name="paychk"/>
|
||||
<field name="dttran"/>
|
||||
<field name="hreg"/>
|
||||
<field name="station"/>
|
||||
<field name="hn"/>
|
||||
<field name="invno"/>
|
||||
<field name="rid"/>
|
||||
<field name="cstat"/>
|
||||
<field name="reimbpay"/>
|
||||
<field name="type"/>
|
||||
</list>
|
|
@ -0,0 +1,12 @@
|
|||
<form model="clinic.data.sc">
|
||||
<field name="hn"/>
|
||||
<field name="name14"/>
|
||||
<field name="hcode18"/>
|
||||
<field name="amount23"/>
|
||||
<field name="cur"/>
|
||||
<field name="epoadm29"/>
|
||||
<field name="eponame"/>
|
||||
<field name="ln"/>
|
||||
<field name="st"/>
|
||||
<field name="allow37"/>
|
||||
</form>
|
|
@ -0,0 +1,12 @@
|
|||
<list model="clinic.data.sc">
|
||||
<field name="hn"/>
|
||||
<field name="name14"/>
|
||||
<field name="hcode18"/>
|
||||
<field name="amount23"/>
|
||||
<field name="cur"/>
|
||||
<field name="epoadm29"/>
|
||||
<field name="eponame"/>
|
||||
<field name="ln"/>
|
||||
<field name="st"/>
|
||||
<field name="allow37"/>
|
||||
</list>
|
|
@ -1,10 +1,13 @@
|
|||
<form model="clinic.gen.visit">
|
||||
<field name="date_from" onchange="onchange_time" span="6"/>
|
||||
<field name="date_to" onchange="onchange_dateto" span="6"/>
|
||||
<field name="cycle_id" onchange="onchange_time" span="6"/>
|
||||
<field name="doctor_id" span="6"/>
|
||||
<field name="nurse_id" span="6"/>
|
||||
<field name="duration" span="6"/>
|
||||
<group form_layout="stacked">
|
||||
<field name="date_from" onchange="onchange_time" span="6"/>
|
||||
<field name="date_to" onchange="onchange_dateto" span="6"/>
|
||||
<field name="cycle_id" onchange="onchange_time" span="6"/>
|
||||
<field name="duration" span="6"/>
|
||||
<field name="nurse_id" span="6"/>
|
||||
<field name="doctor_id" span="6"/>
|
||||
<field name="department_id" span="6"/>
|
||||
</group>
|
||||
<separator string="Select Days"/>
|
||||
<field name="monday" span="4"/>
|
||||
<field name="tuesday" span="4"/>
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<item string="Settings" position="before">
|
||||
<item string="Ratchawat">
|
||||
<header string="IMPORT PAYMENT"/>
|
||||
<item string="Medical Government" action="import_clinic_mg"/>
|
||||
<!--<item string="Medical Government" action="import_clinic_mg"/>-->
|
||||
<item string="Social Security" action="import_clinic_sc"/>
|
||||
<item string="NHSO 30฿" action="import_clinic_nhso"/>
|
||||
<divider/>
|
||||
<header string="IMPORT DATA"/>
|
||||
<item string="Medical Government" action="clinic_import_payment"/>
|
||||
<item string="Social Security" action="clinic_import_payment"/>
|
||||
<item string="NHSO 30฿" action="clinic_import_payment"/>
|
||||
<!--<item string="Medical Government" action="clinic_import_payment"/>-->
|
||||
<item string="Social Security" action="clinic_data_sc"/>
|
||||
<item string="NHSO 30฿" action="clinic_data_nhso"/>
|
||||
</item>
|
||||
</item>
|
||||
</inherit>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<form title="Import Medical Government">
|
||||
<field name="file"/>
|
||||
<group span="6" columns="1">
|
||||
<field name="file"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<separator string="Result"/>
|
||||
<field name="result" nolabel="1" height="240" width="540"/>
|
||||
</group>
|
||||
<foot replace="1">
|
||||
<button string="Import Data" method="import_mg" type="primary" icon="arrow-right"/>
|
||||
<button string="Import Data" method="import_nhso" type="primary" icon="arrow-right"/>
|
||||
</foot>
|
||||
</form>
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<form title="Import NHSO">
|
||||
<field name="file"/>
|
||||
<field name="date">
|
||||
<template>
|
||||
<a href="ui#name=clinic_hd_case">xx{{context.data}}</a>
|
||||
</template>
|
||||
</field>
|
||||
<group span="6" columns="1">
|
||||
<field name="file"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<separator string="Result"/>
|
||||
<field name="result" nolabel="1" height="240" width="540"/>
|
||||
</group>
|
||||
<foot replace="1">
|
||||
<button string="Import Data" method="import_nhso" type="primary" icon="arrow-right"/>
|
||||
<!--<button string="Post" method="post" type="success"/>-->
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<form title="Import Social Security">
|
||||
<field name="file"/>
|
||||
<group span="6" columns="1">
|
||||
<field name="file"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<separator string="Result"/>
|
||||
<field name="result" nolabel="1" height="240" width="540"/>
|
||||
</group>
|
||||
<foot replace="1">
|
||||
<button string="Import Data" method="import_sc" type="primary" icon="arrow-right"/>
|
||||
</foot>
|
||||
|
|
|
@ -29,6 +29,7 @@ class GenVisit(Model):
|
|||
'friday': fields.Boolean("Fridays"),
|
||||
'doctor_id': fields.Many2One("clinic.doctor","Doctor"),
|
||||
'nurse_id': fields.Many2One("clinic.nurse","Nurse"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
|
||||
}
|
||||
|
||||
|
@ -119,6 +120,7 @@ class GenVisit(Model):
|
|||
'patient_id': line.patient_id.id,
|
||||
'doctor_id': obj.doctor_id.id,
|
||||
'nurse_id': obj.nurse_id.id,
|
||||
'department_id': obj.department_id.id,
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
'time_start': "%s %s" % (tmp.strftime(FMT_DATE),date_from.strftime(FMT_DATETIME)[11:]),
|
||||
'time_stop': "%s %s" % (tmp.strftime(FMT_DATE),date_to.strftime(FMT_DATETIME)[11:]),
|
||||
|
|
|
@ -5,7 +5,7 @@ class ImportDataNHSO(Model):
|
|||
_transient=True
|
||||
_fields={
|
||||
'name': fields.Char("Name"),
|
||||
'type': fields.Selection([['sucess','Succes'],['fail','Fail']],'Type'),
|
||||
'type': fields.Selection([['success','Succes'],['fail','Fail']],'Type'),
|
||||
'epostat': fields.Char("Epostat"),
|
||||
'hdrate': fields.Char("Hdrate"),
|
||||
'hdflag': fields.Char("Hdflag"),
|
||||
|
@ -22,4 +22,5 @@ class ImportDataNHSO(Model):
|
|||
'reimbpay': fields.Char("Reimbpay"),
|
||||
}
|
||||
|
||||
|
||||
ImportDataNHSO.register()
|
||||
|
|
|
@ -4,7 +4,17 @@ class ImportDataSC(Model):
|
|||
_name="clinic.data.sc"
|
||||
_transient=True
|
||||
_fields={
|
||||
'name': fields.Char("Name"),
|
||||
'hn': fields.Char("hn", search=True),
|
||||
'name14': fields.Char("name14", search=True),
|
||||
'hcode18': fields.Char("hcode18", search=True),
|
||||
'amount23': fields.Char("amount23", search=True),
|
||||
"cur": fields.Char("cur"),
|
||||
'epoadm29': fields.Char("epoadm29"),
|
||||
'eponame': fields.Char("eponame"),
|
||||
'ln': fields.Char('ln'),
|
||||
'st': fields.Char('st'),
|
||||
'allow37': fields.Char('allow37'),
|
||||
'type': fields.Selection([['success','Succes'],['fail','Fail']],'Type', search=True),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ class ImportPayment(Model):
|
|||
_fields={
|
||||
'date': fields.DateTime("Date"),
|
||||
'file': fields.File("File"),
|
||||
'result': fields.Text("Success"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
@ -27,12 +28,14 @@ class ImportPayment(Model):
|
|||
if suffix not in ('xls', 'xlsx'):
|
||||
raise Exception("ERROR : please should file xls or xlsx")
|
||||
wb=xlrd.open_workbook(fpath)
|
||||
worksheet=wb.sheet_by_name("Sheet1")
|
||||
num_rows=worksheet.nrows-1
|
||||
curr_row=-1
|
||||
while curr_row < num_rows:
|
||||
curr_row +=1
|
||||
worksheet.cell_value(curr_row,2)
|
||||
sheet=wb.sheet_by_name("Sheet1")
|
||||
# read header values into the list
|
||||
keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)]
|
||||
data=[]
|
||||
for row_index in range(1, sheet.nrows):
|
||||
d = {(keys[col_index] or "").lower(): sheet.cell(row_index, col_index).value
|
||||
for col_index in range(sheet.ncols)}
|
||||
data.append(d)
|
||||
return data
|
||||
|
||||
def read_xml(self,fpath=None,node=""):
|
||||
|
@ -72,8 +75,25 @@ class ImportPayment(Model):
|
|||
lines=self.read_xml(fpath,node='HDBills')
|
||||
if not lines:
|
||||
raise Exception("Wrong file")
|
||||
data_nhso=get_model("clinic.data.nhso")
|
||||
nhso_ids=data_nhso.search([])
|
||||
data_nhso.delete(nhso_ids)
|
||||
result=""
|
||||
result+="Match: %s"%(50)
|
||||
result+="\n"
|
||||
result+="*"*50
|
||||
for line in lines:
|
||||
# TODO need to check match or not
|
||||
data_nhso.create(line)
|
||||
line['type']='success'
|
||||
print(line)
|
||||
result+="\n"
|
||||
result+="Not Match: %s"%(40)
|
||||
result+="\n"
|
||||
result+="*"*50
|
||||
obj.write({
|
||||
'result': result,
|
||||
})
|
||||
|
||||
def import_mg(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
|
@ -85,7 +105,48 @@ class ImportPayment(Model):
|
|||
obj=self.browse(ids)[0]
|
||||
fname=obj.file
|
||||
fpath=get_file_path(fname)
|
||||
print("fpath ", fpath)
|
||||
lines=self.read_excel(fpath)
|
||||
if not lines:
|
||||
raise Exception("Wrong File")
|
||||
data_sc=get_model("clinic.data.sc")
|
||||
sc_ids=data_sc.search([])
|
||||
data_sc.delete(sc_ids)
|
||||
st={}
|
||||
patient=get_model("clinic.patient")
|
||||
old_patient=[x['hn'] for x in patient.search_read([],['hn']) if x['hn']]
|
||||
for line in lines:
|
||||
hn=line.get('hn')
|
||||
if not hn:
|
||||
continue
|
||||
# create patient if not found
|
||||
if not st.get(hn) and (not hn in old_patient):
|
||||
patient.create({
|
||||
'type': 'sc',
|
||||
'hn': hn,
|
||||
'name': line.get('name14'),
|
||||
'reg_date': time.strftime("%Y-%m-%d"),
|
||||
})
|
||||
st.update({hn: line.get('name14')})
|
||||
print("create %s ok"%hn)
|
||||
vals={
|
||||
'hn': hn,
|
||||
'name14': line.get('name14'),
|
||||
'hcode18': line.get('hcode18'),
|
||||
'amount23': line.get('amount23'),
|
||||
"cur": line.get('cur'),
|
||||
'epoadm29': line.get('epoadm29'),
|
||||
'eponame': line.get('eponame'),
|
||||
'ln': line.get('ln'),
|
||||
'st': line.get('st'),
|
||||
'allow37': line.get('allow37'),
|
||||
'type': 'success',
|
||||
}
|
||||
data_sc.create(vals)
|
||||
msg="%s -OK "%("*"*50)
|
||||
obj.write({
|
||||
'result': msg,
|
||||
})
|
||||
print("OK")
|
||||
|
||||
|
||||
ImportPayment.register()
|
||||
|
|
|
@ -190,5 +190,27 @@ class Patient(Model):
|
|||
vals['partner_id']=partner_id
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def name_get(self,ids,context={}):
|
||||
vals=[]
|
||||
for obj in self.browse(ids):
|
||||
name="%s [%s] %s"%(obj.name,obj.number,obj.hn or "")
|
||||
vals.append((obj.id,name))
|
||||
return vals
|
||||
|
||||
def name_search(self,name,domain=None,context={},**kw):
|
||||
dom=[["number","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids1=self.search(dom)
|
||||
dom=[["name","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids2=self.search(dom)
|
||||
dom=[["hn","ilike","%"+name+"%"]]
|
||||
if domain:
|
||||
dom=[dom,domain]
|
||||
ids3=self.search(dom)
|
||||
ids=list(set(ids1+ids2+ids3))
|
||||
return self.name_get(ids,context=context)
|
||||
|
||||
Patient.register()
|
||||
|
|
Loading…
Reference in New Issue