diff --git a/netforce_clinic/actions/clinic_name_title.xml b/netforce_clinic/actions/clinic_name_title.xml new file mode 100644 index 0000000..148b5be --- /dev/null +++ b/netforce_clinic/actions/clinic_name_title.xml @@ -0,0 +1,6 @@ + + Titles + multi_view + clinic.name.title + clinic_menu + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 65f59eb..5e5c04f 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -14,7 +14,7 @@ - +
@@ -55,6 +55,7 @@ + diff --git a/netforce_clinic/layouts/clinic_name_title_form.xml b/netforce_clinic/layouts/clinic_name_title_form.xml new file mode 100644 index 0000000..a8ee766 --- /dev/null +++ b/netforce_clinic/layouts/clinic_name_title_form.xml @@ -0,0 +1,3 @@ +
+ + diff --git a/netforce_clinic/layouts/clinic_name_title_list.xml b/netforce_clinic/layouts/clinic_name_title_list.xml new file mode 100644 index 0000000..73080ad --- /dev/null +++ b/netforce_clinic/layouts/clinic_name_title_list.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index cb1df83..d0f91ab 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -2,7 +2,7 @@ @@ -12,7 +12,6 @@ - @@ -72,33 +71,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -116,6 +90,40 @@ + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 9bfa733..e551bf5 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -110,3 +110,4 @@ from . import shop_line from . import product from . import base_user from . import select_company +from . import name_title diff --git a/netforce_clinic/models/matching_payment.py b/netforce_clinic/models/matching_payment.py index 9f81cff..024df9d 100644 --- a/netforce_clinic/models/matching_payment.py +++ b/netforce_clinic/models/matching_payment.py @@ -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 diff --git a/netforce_clinic/models/name_title.py b/netforce_clinic/models/name_title.py new file mode 100644 index 0000000..fe3874d --- /dev/null +++ b/netforce_clinic/models/name_title.py @@ -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() diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index 695d28a..23ed9da 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -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") diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index c6e9cf8..d2d884f 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -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={}):