improve
parent
43494a02f1
commit
b573442a1e
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="view_cls">form_view</field>
|
||||
<field name="model">clinic.import.product</field>
|
||||
<field name="view_xml">import_clinic_product</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -10,7 +10,7 @@
|
|||
<field name="number" span="2"/>
|
||||
<field name="ref" span="2"/>
|
||||
<field name="patient_id" span="2" onchange="onchange_patient"/>
|
||||
<field name="cycle_id" span="2" required="1"/>
|
||||
<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']]"/>
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<item string="Clinic Settings" action="clinic_setting"/>
|
||||
<divider/>
|
||||
<header string="IMPORT"/>
|
||||
<item string="Import Product" action="import_clinic_product"/>
|
||||
<item string="Import Patient" action="import_clinic_patient"/>
|
||||
<item string="Import Visit" action="import_clinic_visit"/>
|
||||
<item string="Import HD Case" action="import_clinic_hd_case"/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<form model="clinic.patient">
|
||||
<head>
|
||||
<field name="type"/>
|
||||
<field name="type_id"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Generate Visit" action="clinic_gen_visit"/>
|
||||
<item string="New Dialyzer" method="new_dialyzer"/>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<separator string="Expenes"/>
|
||||
<field name="products" nolabel="1">
|
||||
<list>
|
||||
<field name="patient_type"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="type"/>
|
||||
<field name="product_id" onchange="onchange_product"/>
|
||||
<field name="description"/>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<field name="amount"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="patient_type"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="type"/>
|
||||
<field name="product_id"/>
|
||||
<field name="description"/>
|
||||
|
@ -29,12 +29,12 @@
|
|||
<separator string="Invoice Policy"/>
|
||||
<field name="invoice_policies" nolabel="1">
|
||||
<list>
|
||||
<field name="patient_type"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="invoice_policy"/>
|
||||
<field name="invoice_option"/>
|
||||
</list>
|
||||
<form>
|
||||
<field name="patient_type"/>
|
||||
<field name="patient_type_id"/>
|
||||
<field name="invoice_policy"/>
|
||||
<field name="invoice_option"/>
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<form model="clinic.visit.board">
|
||||
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
<field name="patient_id" span="2"/>
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<field name="date" span="3" mode="month"/>
|
||||
<field name="hcode" span="3"/>
|
||||
<field name="max_row" span="3"/>
|
||||
<separator string="Summary"/>
|
||||
<field name="total_row" span="4" readonly="1"/>
|
||||
<field name="remain_row" span="4" readonly="1"/>
|
||||
<foot replace="1">
|
||||
<button string="Import" method="import_hd_case" type="primary" icon="arrow-right"/>
|
||||
</foot>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<form title="Import Product">
|
||||
<group form_layout="stacked">
|
||||
<field name="file" span="3"/>
|
||||
<field name="hcode" span="3"/>
|
||||
</group>
|
||||
<foot replace="1">
|
||||
<button string="Import" method="import_product" type="primary" icon="arrow-right"/>
|
||||
</foot>
|
||||
</form>
|
|
@ -65,6 +65,7 @@ from . import branch
|
|||
from . import period
|
||||
from . import period_line
|
||||
from . import import_payment
|
||||
from . import import_product
|
||||
from . import import_patient
|
||||
from . import import_visit
|
||||
from . import import_hd_case
|
||||
|
|
|
@ -183,6 +183,15 @@ class HDCase(Model):
|
|||
line["state"]=dialyzer.state
|
||||
data['dlz_id']=dialyzer.id
|
||||
return data
|
||||
|
||||
def onchange_cycle(self,context={}):
|
||||
data=context['data']
|
||||
cycle_id=data['cycle_id']
|
||||
cycle=get_model("clinic.cycle").browse(cycle_id)
|
||||
date=data['time_start'][0:10]
|
||||
data['time_start']='%s %s'%(date, cycle.time_start)
|
||||
data['time_stop']='%s %s'%(date, cycle.time_stop)
|
||||
return data
|
||||
|
||||
def onchange_patient(self,context={}):
|
||||
data=context['data']
|
||||
|
@ -776,7 +785,7 @@ class HDCase(Model):
|
|||
if not vals.get('lines'):
|
||||
vals['lines']=[]
|
||||
for st_prod in st.products:
|
||||
if patient.type==st_prod.patient_type:
|
||||
if patient.type_id.id==st_prod.patient_type_id.id:
|
||||
prod=st_prod.product_id
|
||||
price=st_prod.price
|
||||
qty=st_prod.qty
|
||||
|
@ -828,11 +837,6 @@ class HDCase(Model):
|
|||
if st.type=='doctor':
|
||||
doctor=st.staff_id
|
||||
vals['staff_id']=doctor.id
|
||||
#item=obj.cycle_item_id
|
||||
#for nurse in item.nurses:
|
||||
#nurse.write(('create',{
|
||||
#'hd_cases': '',
|
||||
#}))
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def onchange_type(self,context={}):
|
||||
|
|
|
@ -15,6 +15,8 @@ class ImportHDCase(Model):
|
|||
'file': fields.File("File"),
|
||||
'hcode': fields.Char("Hospital Code"),
|
||||
'max_row': fields.Integer("Max Row"),
|
||||
'remain_row': fields.Integer("Remain Row"),
|
||||
'total_row': fields.Integer("Totol Row"),
|
||||
}
|
||||
|
||||
def get_hcode(self,context={}):
|
||||
|
@ -25,6 +27,7 @@ class ImportHDCase(Model):
|
|||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'hcode': get_hcode,
|
||||
'max_row': 50,
|
||||
}
|
||||
|
||||
def import_hd_case(self,ids,context={}):
|
||||
|
@ -140,4 +143,10 @@ class ImportHDCase(Model):
|
|||
pass
|
||||
#print("XXXX ", name)
|
||||
|
||||
obj.write({
|
||||
'total_row': len(lines),
|
||||
'remain_row': len(lines)-count,
|
||||
})
|
||||
print("Done!")
|
||||
|
||||
ImportHDCase.register()
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.utils import get_file_path
|
||||
from . import utils
|
||||
|
||||
class ImportProduct(Model):
|
||||
_name="clinic.import.product"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
'date': fields.DateTime("Date"),
|
||||
'file': fields.File("File"),
|
||||
'result': fields.Text("Success"),
|
||||
'hcode': fields.Char("Hospital Code"),
|
||||
}
|
||||
|
||||
def get_hcode(self,context={}):
|
||||
settings=get_model("settings").browse(1)
|
||||
hcode=settings.hospital_code or ""
|
||||
return hcode
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'hcode': get_hcode,
|
||||
}
|
||||
|
||||
def import_product(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
fname=obj.file
|
||||
fpath=get_file_path(fname)
|
||||
lines=utils.read_excel(fpath,show_datetime=True)
|
||||
if not lines:
|
||||
raise Exception("Wrong File")
|
||||
for line in lines:
|
||||
hcode=line.get('hcode18','0')
|
||||
if not hcode:
|
||||
hcode='0'
|
||||
hcode=int(hcode)
|
||||
hcode=str(hcode)
|
||||
if obj.hcode==hcode:
|
||||
prod_code=line.get("code31")
|
||||
prod_name=line.get("eponame")
|
||||
prod_ids=get_model("clinic.product").search([['code','=',prod_code]])
|
||||
if not prod_ids:
|
||||
vals={
|
||||
'code': prod_code,
|
||||
'name': prod_name,
|
||||
'uom_id': 2, #XXX Unit
|
||||
'type': 'stock',
|
||||
}
|
||||
prod_id=get_model('product').create(vals)
|
||||
print("create product ", prod_id)
|
||||
|
||||
ImportProduct.register()
|
|
@ -31,9 +31,8 @@ class Patient(Model):
|
|||
cycle_id=cycle.id
|
||||
res[obj.id]=cycle_id
|
||||
return res
|
||||
|
||||
|
||||
_fields={
|
||||
"type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Type",required=True),
|
||||
'type_id': fields.Many2One("clinic.patient.type","Type",search=True,required=True),
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"hn": fields.Char("REF/HN",search=True),
|
||||
|
@ -113,7 +112,6 @@ class Patient(Model):
|
|||
|
||||
_defaults={
|
||||
"number": _get_number,
|
||||
"type": "sc",
|
||||
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'card_type': 'identification',
|
||||
|
|
|
@ -6,7 +6,7 @@ class SettingPolicy(Model):
|
|||
|
||||
_fields={
|
||||
"setting_id": fields.Many2One("clinic.setting","Setting"),
|
||||
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Type",required=True),
|
||||
"patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"),
|
||||
"invoice_policy": fields.Selection([("fee","Only fee"),("fee_mdc","Fee & Medicine")],"Policy"),
|
||||
"invoice_option": fields.Selection([("fee_mdc_plus","Combine Fee & Medicine"),("fee_mdc_split","Split Fee & Medicine")],"Option"),
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class SettingProduct(Model):
|
|||
_fields={
|
||||
"setting_id": fields.Many2One("clinic.setting","Setting"),
|
||||
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),("others","Others")],"Type",required=True),
|
||||
"patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Patient Type",required=True),
|
||||
"patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"),
|
||||
'uom_id': fields.Many2One("uom","UOM", required=True),
|
||||
"product_id": fields.Many2One("product","Product"),
|
||||
'description': fields.Char("Description"),
|
||||
|
|
|
@ -55,7 +55,7 @@ def read_excel(fpath=None,show_datetime=False):
|
|||
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=datetime(year, month, day, hour, minute,second)
|
||||
if show_datetime:
|
||||
value=value.strftime("%Y-%m-%d %H:%M:%S")
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
from calendar import monthrange
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
#from calendar import monthrange
|
||||
|
@ -15,12 +16,14 @@ class VisitBoard(Model):
|
|||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month", required=True),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
'patient_id': fields.Many2One("clinic.patient","Patient"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_from': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_to': lambda *a: (datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
@ -144,4 +147,13 @@ class VisitBoard(Model):
|
|||
|
||||
return data
|
||||
|
||||
def onchange_date(self,context={}):
|
||||
data=context['data']
|
||||
date=data['date']
|
||||
year,month,day=date.split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
data['date_from']="%s-%s-01"%(year,month)
|
||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||
return data
|
||||
|
||||
VisitBoard.register()
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
- missing
|
||||
- import schedule -> wait K. Ekk
|
||||
|
||||
hd case
|
||||
start / stop -> option udpate time
|
||||
======
|
||||
|
@ -22,6 +25,7 @@ improval
|
|||
bug:
|
||||
- มีปัญหาการสร้าง address ของ contact จากผู้ป่วยโดยอัตโนมัติ เพราะมันไม่ได้ถูกเก็บไว้ที่ form
|
||||
- export excel in matrix mode
|
||||
-
|
||||
=====
|
||||
first:
|
||||
match payment
|
||||
|
|
Loading…
Reference in New Issue