conv_bal
watcha.h 2015-02-20 08:52:14 +07:00
parent 82aa96abb9
commit d8c8c27fd2
10 changed files with 112 additions and 48 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Titles</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.name.title</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -14,7 +14,7 @@
</item>
<item string="Patients" perm="clinic_patient">
<item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/>
<item string="Dialyzers" action="clinic_dialyzer" perm="clinic_dialyzer"/>
<divider/>
<header string="SETTINGS"/>
<item string="Cause Chronics" action="clinic_cause_chronic"/>
@ -55,6 +55,7 @@
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
</item>
<item string="Settings" perm="clinic_settings">
<item string="Titles" action="clinic_name_title" perm="clinic_name_title"/>
<item string="Branches" action="clinic_branch" perm="clinic_branch"/>
<item string="Departments" action="clinic_department"/>
<item string="Hospitals" action="clinic_hospital"/>

View File

@ -0,0 +1,3 @@
<form model="clinic.name.title">
<field name="name"/>
</form>

View File

@ -0,0 +1,3 @@
<list model="clinic.name.title">
<field name="name"/>
</list>

View File

@ -2,7 +2,7 @@
<head>
<field name="type_id"/>
<button string="Options" dropdown="1">
<item string="Generate Visit" action="clinic_gen_visit"/>
<!--<item string="Generate Visit" action="clinic_gen_visit"/>-->
<!--<item string="New Dialyzer" method="new_dialyzer"/>-->
<item string="New Address" method="simple_address" perm="clinic_simple_address"/>
</button>
@ -12,7 +12,6 @@
<field name="type_id"/>
<field name="name"/>
<field name="reg_date"/>
<field name="partner_id" domain='[["is_patient","=","true"]]'/>
<field name="categ_id"/>
<field name="doctor_id"/>
<field name="department_id"/>
@ -72,33 +71,8 @@
<field name="cycle_id"/>
</group>
</tab>
<tab string="Cause Of Chronic Renal Failure">
<field name="causes" nolabel="1">
<list>
<field name="cause_id"/>
<field name="date_cause"/>
</list>
</field>
</tab>
<tab string="Co-marbid">
<separator string="Co-morbidity, before RRT"/>
<field name="comorbilities" nolabel="1">
<list>
<field name="comorbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</list>
</field>
</tab>
<tab string="Morbidity">
<separator string="Morbidity, After RRT"/>
<field name="morbilities" nolabel="1">
<list>
<field name="morbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</list>
</field>
<tab string="Accounting">
<field name="partner_id" domain='[["is_patient","=","true"]]'/>
</tab>
<tab string="Other">
<group form_layout="stacked">
@ -116,6 +90,40 @@
<field name="visits" readonly="1"/>
<field name="hd_cases" readonly="1"/>
<field name="dialyzers" readonly="1"/>
<field name="causes" nolabel="1">
<list>
<field name="cause_id"/>
<field name="date_cause"/>
</list>
<form>
<field name="cause_id"/>
<field name="date_cause"/>
</form>
</field>
<field name="comorbilities" nolabel="1">
<list>
<field name="comorbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</list>
<form>
<field name="comorbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</form>
</field>
<field name="morbilities" nolabel="1">
<list>
<field name="morbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</list>
<form>
<field name="morbility_id"/>
<field name="ans"/>
<field name="analysis_date" mode="year"/>
</form>
</field>
<field name="documents"/>
<field name="comments"/>
</related>

View File

@ -110,3 +110,4 @@ from . import shop_line
from . import product
from . import base_user
from . import select_company
from . import name_title

View File

@ -106,6 +106,11 @@ class MatchingPayment(Model):
for inv in get_model('account.invoice').search_browse(dom):
pname=inv.ref or ''
pname=pname.replace(" ","")
##XXX ธงชัย วิศาลโภคะ (1045-12-1-53)
#pname_alpha=''.join([pn for pn in pname if pn.isalpha()])
#hn=''.join([str(pn) for pn in pname if pn.isdigit()])
#print(hn, pname_alpha)
hn=""
vals={
'invoice_id': inv.id,
}
@ -117,7 +122,7 @@ class MatchingPayment(Model):
if not matches1.get(key1):
matches1[key1]=vals
for pt in get_model("clinic.patient").search_browse([['name_check','=',pname]]):
hn=pt.hn_no or ''
hn=pt.hn_no or hn or ''
key2='%s:%s'%(
hn,
date,
@ -161,7 +166,6 @@ class MatchingPayment(Model):
continue
hn=line.get('hn')
hn=''.join([x for x in hn if x.isdigit()])
#if hn=='10288153':
#import pdb; pdb.set_trace()
#1. name, 2. hn, 3. id_card
@ -193,6 +197,7 @@ class MatchingPayment(Model):
if not matches2.get(key2):
if not matches3.get(key3):
print("not found")
pass
else:
print("found 3.")
# found 3.
@ -242,31 +247,49 @@ class MatchingPayment(Model):
hn=line['hn']
hn=hn.replace(" ", "")
if date and time:
key2='%s:%s:%s'%(
key2='%s:%s'%(
line['hn'],
date,
#amt,
)
name=''
pid=''
key1=''
key3=''
for pt in get_model("clinic.patient").search_browse([['hn_no','=',hn]]):
name=pt.name
name=pt.name_check or ""
key1='%s:%s'%(name,date)
pid=pt.card_no or ''
key3='%s:%s'%(pid,date)
name1=pt.name or ""
record={
'date':date,
'patient_name': name2,
'name': name1,
'pid': pid,
'hn': hn,
'fee_amt': lfee_amt,
'srv_amt': lsrv_amt,
'mdc_amt': lmdc_amt,
'fee_amt': amt,
'srv_amt': 0,
'mdc_amt': 0,
'invoice_id': None,
}
if matches2.get(key2):
if matches1.get(key1):
vals=matches1[key1]
record.update({
'invoice_id':vals['invoice_id'],
})
elif matches2.get(key2):
vals=matches2[key2]
record.update({
'invoice_id':vals['invoice_id'],
})
elif matches3.get(key3):
vals=matches3[key3]
record.update({
'invoice_id':vals['invoice_id'],
})
else:
pass
#print("not found")
records.append(record)
return records

View File

@ -0,0 +1,13 @@
from netforce.model import Model, fields
class NameTitle(Model):
_name="clinic.name.title"
_string="Title"
_fields={
"name": fields.Char("Name",required=True,search=True),
}
_order="name"
NameTitle.register()

View File

@ -88,9 +88,9 @@ class Patient(Model):
"waiting_transplantation": fields.Selection([("yes","Yes"),("no","No")],"Kidney Transplantation Waiting ?"),
"who_transplantation": fields.Char("Who is Transplantation?"),
"reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"),
'causes': fields.One2Many("clinic.patient.cause","patient_id","Cause Line"),
'comorbilities': fields.One2Many("clinic.patient.comorbidity","patient_id","Comorbility"),
'morbilities': fields.One2Many("clinic.patient.morbidity","patient_id","Morbility"),
'causes': fields.One2Many("clinic.patient.cause","patient_id","Cause Of Chronic Renal Failure"),
'comorbilities': fields.One2Many("clinic.patient.comorbidity","patient_id","Comorbilities"),
'morbilities': fields.One2Many("clinic.patient.morbidity","patient_id","Morbilities"),
"comments": fields.One2Many("message","related_id","Comments"),
"company_id": fields.Many2One("company","Company",search=True),
"visits": fields.One2Many("clinic.visit","patient_id","Visits"),
@ -206,6 +206,7 @@ class Patient(Model):
super().delete(ids)
def write(self,ids,vals,**kw):
#TODO change department of patient after change department
if 'active' in vals.keys():
if not vals['active']:
vals['resign_date']=time.strftime("%Y-%m-%d")

View File

@ -111,15 +111,20 @@ class ClinicSetting(Model):
print("Only admin!!")
return
for exp in get_model('clinic.hd.case.expense').search_browse([]):
exp.write({
'note': ' ',
})
#for exp in get_model('clinic.hd.case.expense').search_browse([]):
#exp.write({
#'note': ' ',
#})
# try to create contact
for staff in get_model("clinic.staff").search_browse([]):
staff.write({
for pt in get_model("clinic.patient").search_browse([]):
pt.write({
'note': ' ',
})
#for staff in get_model("clinic.staff").search_browse([]):
#staff.write({
#'note': ' ',
#})
print("Done!")
def reset_last_import(self,ids,context={}):