xxxx
parent
616e172447
commit
639522b85d
|
@ -1,5 +1,5 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="string">NHSO</field>
|
<field name="string">Social Security</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="tabs">[["All",[]],["Success",[["type","=","success"]]],["Fail",[["type","=","fail"]]]]</field>
|
<field name="tabs">[["All",[]],["Success",[["type","=","success"]]],["Fail",[["type","=","fail"]]]]</field>
|
||||||
<field name="model">clinic.data.sc</field>
|
<field name="model">clinic.data.sc</field>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<field name="hn"/>
|
<field name="hn"/>
|
||||||
<field name="name14"/>
|
<field name="name14"/>
|
||||||
<field name="hcode18"/>
|
<field name="hcode18"/>
|
||||||
|
<field name="dttran"/>
|
||||||
<field name="amount23"/>
|
<field name="amount23"/>
|
||||||
<field name="cur"/>
|
<field name="cur"/>
|
||||||
<field name="epoadm29"/>
|
<field name="epoadm29"/>
|
||||||
|
@ -9,4 +10,5 @@
|
||||||
<field name="ln"/>
|
<field name="ln"/>
|
||||||
<field name="st"/>
|
<field name="st"/>
|
||||||
<field name="allow37"/>
|
<field name="allow37"/>
|
||||||
|
<field name="type"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<list model="clinic.data.sc">
|
<list model="clinic.data.sc" colors='{"red":[["type","=","fail"]]}'>
|
||||||
<field name="hn"/>
|
<field name="hn"/>
|
||||||
<field name="name14"/>
|
<field name="name14"/>
|
||||||
<field name="hcode18"/>
|
<field name="hcode18"/>
|
||||||
|
<field name="dttran"/>
|
||||||
<field name="amount23"/>
|
<field name="amount23"/>
|
||||||
<field name="cur"/>
|
<field name="cur"/>
|
||||||
<field name="epoadm29"/>
|
<field name="epoadm29"/>
|
||||||
|
@ -9,4 +10,5 @@
|
||||||
<field name="ln"/>
|
<field name="ln"/>
|
||||||
<field name="st"/>
|
<field name="st"/>
|
||||||
<field name="allow37"/>
|
<field name="allow37"/>
|
||||||
|
<field name="type"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<field name="file"/>
|
<field name="file"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<separator string="Result"/>
|
<!--<separator string="Result"/>-->
|
||||||
<field name="result" nolabel="1" height="240" width="540"/>
|
<!--<field name="result" nolabel="1" height="240" width="540"/>-->
|
||||||
</group>
|
</group>
|
||||||
<foot replace="1">
|
<foot replace="1">
|
||||||
<button string="Import Data" method="import_nhso" type="primary" icon="arrow-right"/>
|
<button string="Import Data" method="import_nhso" type="primary" icon="arrow-right"/>
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<separator string="Result"/>
|
<separator string="Result"/>
|
||||||
|
<template>
|
||||||
|
<a href="ui#name=clinic_data_sc" target="_blank"><span class="glyphicon glyphicon-arrow-right"></span> Review Data</a>
|
||||||
|
</template>
|
||||||
<field name="result" nolabel="1" height="240" width="540"/>
|
<field name="result" nolabel="1" height="240" width="540"/>
|
||||||
</group>
|
</group>
|
||||||
<foot replace="1">
|
<foot replace="1">
|
||||||
|
|
|
@ -14,6 +14,7 @@ class ImportDataSC(Model):
|
||||||
'ln': fields.Char('ln'),
|
'ln': fields.Char('ln'),
|
||||||
'st': fields.Char('st'),
|
'st': fields.Char('st'),
|
||||||
'allow37': fields.Char('allow37'),
|
'allow37': fields.Char('allow37'),
|
||||||
|
'dttran': fields.Date("dttran"),
|
||||||
'type': fields.Selection([['success','Succes'],['fail','Fail']],'Type', search=True),
|
'type': fields.Selection([['success','Succes'],['fail','Fail']],'Type', search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
import xlrd
|
import xlrd
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
|
@ -33,8 +34,18 @@ class ImportPayment(Model):
|
||||||
keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)]
|
keys = [sheet.cell(0, col_index).value for col_index in range(sheet.ncols)]
|
||||||
data=[]
|
data=[]
|
||||||
for row_index in range(1, sheet.nrows):
|
for row_index in range(1, sheet.nrows):
|
||||||
d = {(keys[col_index] or "").lower(): sheet.cell(row_index, col_index).value
|
#d = {(keys[col_index] or "").lower(): sheet.cell(row_index, col_index).value for col_index in range(sheet.ncols)}
|
||||||
for col_index in range(sheet.ncols)}
|
d={}
|
||||||
|
for col_index in range(sheet.ncols):
|
||||||
|
ctype=sheet.cell(row_index,col_index).ctype
|
||||||
|
if ctype==3:
|
||||||
|
value=sheet.cell(row_index, col_index).value
|
||||||
|
year, month, day, hour, minute, second = xlrd.xldate_as_tuple(value,wb.datemode)
|
||||||
|
value=datetime.datetime(year, month, day, hour, minute,second)
|
||||||
|
value=value.strftime("%Y-%m-%d")
|
||||||
|
else:
|
||||||
|
value=sheet.cell(row_index, col_index).value
|
||||||
|
d.update({(keys[col_index] or "").lower():value})
|
||||||
data.append(d)
|
data.append(d)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -95,12 +106,6 @@ class ImportPayment(Model):
|
||||||
'result': result,
|
'result': result,
|
||||||
})
|
})
|
||||||
|
|
||||||
def import_mg(self,ids,context={}):
|
|
||||||
obj=self.browse(ids)[0]
|
|
||||||
fname=obj.file
|
|
||||||
fpath=get_file_path(fname)
|
|
||||||
print("fpath ", fpath)
|
|
||||||
|
|
||||||
def import_sc(self,ids,context={}):
|
def import_sc(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
fname=obj.file
|
fname=obj.file
|
||||||
|
@ -114,6 +119,8 @@ class ImportPayment(Model):
|
||||||
st={}
|
st={}
|
||||||
patient=get_model("clinic.patient")
|
patient=get_model("clinic.patient")
|
||||||
old_patient=[x['hn'] for x in patient.search_read([],['hn']) if x['hn']]
|
old_patient=[x['hn'] for x in patient.search_read([],['hn']) if x['hn']]
|
||||||
|
fail_qty=0
|
||||||
|
success_qty=0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
hn=line.get('hn')
|
hn=line.get('hn')
|
||||||
if not hn:
|
if not hn:
|
||||||
|
@ -128,10 +135,16 @@ class ImportPayment(Model):
|
||||||
})
|
})
|
||||||
st.update({hn: line.get('name14')})
|
st.update({hn: line.get('name14')})
|
||||||
print("create %s ok"%hn)
|
print("create %s ok"%hn)
|
||||||
|
hcode=int((line.get('hcode18') or "0")) # XXX
|
||||||
|
type=hcode==23869 and 'success' or 'fail'
|
||||||
|
if type=='success':
|
||||||
|
success_qty+=1
|
||||||
|
else:
|
||||||
|
fail_qty+=1
|
||||||
vals={
|
vals={
|
||||||
'hn': hn,
|
'hn': hn,
|
||||||
'name14': line.get('name14'),
|
'name14': line.get('name14'),
|
||||||
'hcode18': line.get('hcode18'),
|
'hcode18': hcode,
|
||||||
'amount23': line.get('amount23'),
|
'amount23': line.get('amount23'),
|
||||||
"cur": line.get('cur'),
|
"cur": line.get('cur'),
|
||||||
'epoadm29': line.get('epoadm29'),
|
'epoadm29': line.get('epoadm29'),
|
||||||
|
@ -139,14 +152,26 @@ class ImportPayment(Model):
|
||||||
'ln': line.get('ln'),
|
'ln': line.get('ln'),
|
||||||
'st': line.get('st'),
|
'st': line.get('st'),
|
||||||
'allow37': line.get('allow37'),
|
'allow37': line.get('allow37'),
|
||||||
'type': 'success',
|
'dttran': line.get("dttran"),
|
||||||
|
'type': type,
|
||||||
}
|
}
|
||||||
data_sc.create(vals)
|
data_sc.create(vals)
|
||||||
msg="%s -OK "%("*"*50)
|
msg=''
|
||||||
|
msg+="%s\n"%("*"*50)
|
||||||
|
msg+='success: %s\n'%success_qty
|
||||||
|
msg+='fail: %s\n'%fail_qty
|
||||||
|
msg+="%s\n"%("*"*50)
|
||||||
|
|
||||||
obj.write({
|
obj.write({
|
||||||
'result': msg,
|
'result': msg,
|
||||||
})
|
})
|
||||||
print("OK")
|
|
||||||
|
def import_mg(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
fname=obj.file
|
||||||
|
fpath=get_file_path(fname)
|
||||||
|
print("fpath ", fpath)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImportPayment.register()
|
ImportPayment.register()
|
||||||
|
|
Loading…
Reference in New Issue