From e5f2c3751a84cff45923a3d9c99de12305d1c3c3 Mon Sep 17 00:00:00 2001 From: "chayut.s" Date: Tue, 30 Sep 2014 18:17:46 +0700 Subject: [PATCH 1/4] Customize fields --- .../layouts/clinic_doctor_form.xml | 1 + netforce_clinic/layouts/clinic_menu.xml | 16 +- .../layouts/clinic_patient_form.xml | 137 +++++++++++------- .../layouts/clinic_patient_list.xml | 3 +- netforce_clinic/models/clinic_doctor.py | 2 +- netforce_clinic/models/clinic_nurse.py | 2 +- netforce_clinic/models/clinic_patient.py | 76 +++++++--- 7 files changed, 147 insertions(+), 90 deletions(-) diff --git a/netforce_clinic/layouts/clinic_doctor_form.xml b/netforce_clinic/layouts/clinic_doctor_form.xml index fedde8b..3a026ba 100644 --- a/netforce_clinic/layouts/clinic_doctor_form.xml +++ b/netforce_clinic/layouts/clinic_doctor_form.xml @@ -14,6 +14,7 @@ + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index d8ecdf4..37b1db3 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -1,15 +1,11 @@ - - - - - - - - - - + + + + + + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index b4468be..54a0a2e 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -6,59 +6,90 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/netforce_clinic/layouts/clinic_patient_list.xml b/netforce_clinic/layouts/clinic_patient_list.xml index 0683595..42dd284 100644 --- a/netforce_clinic/layouts/clinic_patient_list.xml +++ b/netforce_clinic/layouts/clinic_patient_list.xml @@ -1,6 +1,7 @@ - + + diff --git a/netforce_clinic/models/clinic_doctor.py b/netforce_clinic/models/clinic_doctor.py index fbd46f7..8206cc1 100644 --- a/netforce_clinic/models/clinic_doctor.py +++ b/netforce_clinic/models/clinic_doctor.py @@ -12,7 +12,7 @@ class Doctor(Model): _multi_company=True _fields={ "number": fields.Char("Number",required=True,search=True), - "name": fields.Char("Name Surname",required=True,search=True), + "name": fields.Char("Name",required=True,search=True), "date": fields.Date("Create Date",required=True,search=True), "birthday": fields.Date("BirthDay",required=True,search=True), "telephone": fields.Char("Telephone",required=True,search=True), diff --git a/netforce_clinic/models/clinic_nurse.py b/netforce_clinic/models/clinic_nurse.py index 4270fc2..40950b7 100644 --- a/netforce_clinic/models/clinic_nurse.py +++ b/netforce_clinic/models/clinic_nurse.py @@ -12,7 +12,7 @@ class Nurse(Model): _multi_company=True _fields={ "number": fields.Char("Number",required=True,search=True), - "name": fields.Char("Name Surname",required=True,search=True), + "name": fields.Char("Name",required=True,search=True), "date": fields.Date("Create Date",required=True,search=True), "birthday": fields.Date("BirthDay",required=True,search=True), "telephone": fields.Char("Telephone",required=True,search=True), diff --git a/netforce_clinic/models/clinic_patient.py b/netforce_clinic/models/clinic_patient.py index aac1d22..1e9b703 100644 --- a/netforce_clinic/models/clinic_patient.py +++ b/netforce_clinic/models/clinic_patient.py @@ -10,38 +10,54 @@ class Patient(Model): _audit_log=True _name_field="name" _multi_company=True + + def _get_age(self,ids,context): + res={} + year_now=int(time.strftime("%Y")) + for obj in self.browse(ids): + age=0 + if obj.birthday: + year_bd=int(obj.birthday[0:4]) + age=year_now-year_bd + res[obj.id]=age + return res # -> {1: 30, 2: 45,.....} + _fields={ - "number": fields.Char("Number",required=True,search=True), - "name": fields.Char("Name Surname",required=True,search=True), - "date": fields.Date("Create Date",required=True,search=True), - "birthday": fields.Date("BirthDay",required=True,search=True), - "telephone": fields.Char("Telephone",required=True,search=True), - "mobile": fields.Char("Mobile",required=True,search=True), + "number": fields.Char("Patient ID",required=True,search=True), + "first_name": fields.Char("First Name",required=True,search=True), + "last_name": fields.Char("Last Name",required=False,search=True), + "date": fields.Date("Create Date",required=False,search=True), + "birthday": fields.Date("BirthDay",required=False,search=True), + "telephone": fields.Char("Telephone",required=False,search=True), + "mobile": fields.Char("Mobile",required=False,search=True), "job": fields.Char("Job"), - "age": fields.Integer("Age"), + "graduation": fields.Selection([("junior_high_school", "Junior High School"),("senior_hish_school","Senior High School"),("vocational_certificate", "Vocational Certificate"),("High_vocational_certificate", "High Vocational Certificate"),("ba", "B.A.(Bachelor of Arts)"),("ma","M.A.(Master of Arts)"),("phd","Ph.D.(Doctor of Philosophy)")],"Graduation"), + "age": fields.Integer("Age", function="_get_age"), "weight": fields.Integer("Weight (cm)"), "height": fields.Integer("Height (Kg)"), - "type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Type",required=True), - "card_type": fields.Selection([("iden_id","Identity Card"),("passport","Passport")],"ID From",required=True), - 'iden_id' : fields.Char("Identity ID"), + "type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Type of treatment",required=False), + "card_type": fields.Selection([("iden_id","Identity Card"),("passport","Passport")],"Card Type",required=True), + 'iden_id' : fields.Char("Card No."), "app_no": fields.Char("Application No."), - "salary": fields.Float("Salary"), + "salary": fields.Selection([("20000","5,001-20,000"),("50000","20,001-50,000"),("100000","50,001-100,000"),("100001","100,000+")], "Salary"), 'exp_id' : fields.Date("Expiry Date"), - "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status",required=True), + "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status",required=False), "addresses": fields.One2Many("address","related_id","Addresses"), - "gender": fields.Selection([("male","Male"),("female","Female")],"Gendel",required=True), - "marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=True), + "gender": fields.Selection([("male","Male"),("female","Female")],"Gender",required=False), + "marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=False), "nationality": fields.Char("Nationality",search=True), "race": fields.Char("Race",search=True), - "smoke": fields.Boolean("Smoke ?"), - "first_hemodialysis": fields.Date("First time Hemodialysis",required=True), - "hemodialysis": fields.Char("First Hemodialysis",required=True), - "clinic_after": fields.Selection([("small","Small"),("medium","Medium"),("large","Large")],"Clinic Lastime",required=True), - "clinic_after_name": fields.Char("Clinic after name",required=True), - "first_permanent_vascular_access": fields.Date("First time Permanent Vascular",required=True), - "first_tenckhoff_catheters": fields.Date("First time Tenckhoff Catheters",required=True), - "start_date_clinic": fields.Date("Start Date Clinic",required=True), - "waiting_transplantation": fields.Boolean("Kidney Transplantation Waiting ?"), + "smoke": fields.Selection([("never","Never"),("stopped","Stopped"),("smoked","Smoked")],"Smoking"), + "withdrawal" : fields.Selection([("social_security","Social Security"),("health_insurance","Health Insurance"),("etc","ETC.")],"Right of withdrawal"), + "first_treatment" : fields.Selection([("hd","HD"),("test","Test")], "First treatment"), + "first_hemodialysis": fields.Date("First time Hemodialysis",required=False), + "hemodialysis": fields.Char("First Hemodialysis",required=False), + "clinic_after": fields.Selection([("small","Small"),("medium","Medium"),("large","Large")],"Clinic Lastime",required=False), + "clinic_after_name": fields.Char("Clinic after name",required=False), + "first_permanent_vascular_access": fields.Date("First time Permanent Vascular",required=False), + "first_tenckhoff_catheters": fields.Date("First time Tenckhoff Catheters",required=False), + "start_date_clinic": fields.Date("Start Date Clinic",required=False), + "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 ?"), "ac_mi": fields.Boolean("Acute MI"), @@ -72,6 +88,19 @@ class Patient(Model): } def _get_number(self,context={}): + seq_name="clinic_patient" + seq_id=get_model("sequence").find_sequence(name=seq_name) + if not seq_id: + raise Exception("Sequence not found: '%s'"%seq_name) + while 1: + num=get_model("sequence").get_next_number(seq_id) + if not num: + return None + get_model("sequence").increment_number(seq_id) + return num + + return + #XXXX while 1: num=get_model("sequence").get_number("clinic_patient") if not num: @@ -91,7 +120,6 @@ class Patient(Model): _order="date desc,number desc" - def void(self,ids,context={}): obj=self.browse(ids)[0] obj.write({"state":"voided"}) From 65739b0a3ded317b7d52ab0403562f2f2bc7477d Mon Sep 17 00:00:00 2001 From: "chayut.s" Date: Wed, 1 Oct 2014 11:05:52 +0700 Subject: [PATCH 2/4] Complete fields Patient --- .../layouts/clinic_patient_form.xml | 25 ++++++++++++++-- netforce_clinic/models/clinic_patient.py | 29 +++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 54a0a2e..e3beb2f 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -80,10 +80,31 @@ - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/netforce_clinic/models/clinic_patient.py b/netforce_clinic/models/clinic_patient.py index 1e9b703..cff713e 100644 --- a/netforce_clinic/models/clinic_patient.py +++ b/netforce_clinic/models/clinic_patient.py @@ -23,6 +23,7 @@ class Patient(Model): return res # -> {1: 30, 2: 45,.....} _fields={ + #Patient's Data "number": fields.Char("Patient ID",required=True,search=True), "first_name": fields.Char("First Name",required=True,search=True), "last_name": fields.Char("Last Name",required=False,search=True), @@ -47,6 +48,7 @@ class Patient(Model): "marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=False), "nationality": fields.Char("Nationality",search=True), "race": fields.Char("Race",search=True), + #Patient's + "smoke": fields.Selection([("never","Never"),("stopped","Stopped"),("smoked","Smoked")],"Smoking"), "withdrawal" : fields.Selection([("social_security","Social Security"),("health_insurance","Health Insurance"),("etc","ETC.")],"Right of withdrawal"), "first_treatment" : fields.Selection([("hd","HD"),("test","Test")], "First treatment"), @@ -77,8 +79,31 @@ class Patient(Model): "hyperucemia": fields.Boolean("Hyperurinencemia"), "cga": fields.Boolean("Chronic gouty arthitis"), "parathy": fields.Boolean("Parathyroidectomy"), - "comarbid": fields.Char("Co-morbid 1"), - "comarbid2": fields.Char("Co-morbid 2"), + #Co-marbid + "check1" : fields.Boolean("The patient had been diagnosed, Acute MI or Unstable angina"), + "check2" : fields.Boolean("The patient had been diagnosed, Coronary angioplasty or CABG"), + "check3" : fields.Boolean("The patient had been diagnosed, Cerebrovascular accident"), + "check4" : fields.Boolean("The patient had been diagnosed, PVD or Amputation"), + "check5" : fields.Boolean("The patient had been diagnosed, Congestive heart failure"), + "check6" : fields.Boolean("The patient had been diagnosed, Hypertension"), + "check7" : fields.Boolean("The patient had been diagnosed, Diabetes"), + "check8" : fields.Boolean("The patient had been diagnosed, COPD"), + "check9" : fields.Boolean("The patient had been diagnosed, Asthma"), + "check10" : fields.Boolean("The patient had been diagnosed, Pulmonary tuberculosis"), + "check11" : fields.Boolean("The patient had been diagnosed, of cancer"), + "check12" : fields.Boolean("The patient had been diagnosed, Cirrhosis"), + "check13" : fields.Boolean("The patient had been diagnosed, Dyslipidemia"), + "check14" : fields.Boolean("The patient had been diagnosed, PRCA"), + "check15" : fields.Boolean("The patient had been diagnosed, Hyperurinecemia"), + "check16" : fields.Boolean("The patient had been diagnosed, Chronic gouty arthitis"), + "check17" : fields.Boolean("The patient had been diagnosed, Parathyroidectomy"), + #"comarbid" : fields.char("Co-morbid Other"), + #Morbidity + "check18" : fields.Boolean("Ischemic Heart Disease"), + "check19" : fields.Boolean("Of cancer"), + "check20" : fields.Boolean("Cerebrovascular accident"), + "comarbid2": fields.Char("Co-morbid Other"), + #Healthcare "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), "doctorsss": fields.Many2Many("clinic.doctor","Doctors"), From 0c897d79b836f25de5b264d4be3afa923ffc18b6 Mon Sep 17 00:00:00 2001 From: Test server Date: Wed, 1 Oct 2014 13:51:36 +0700 Subject: [PATCH 3/4] get patient name --- .../__pycache__/__init__.cpython-32.pyc | Bin 159 -> 0 bytes netforce_clinic/layouts/clinic_menu.xml | 2 +- netforce_clinic/models/clinic_hd_case.py | 5 ++--- netforce_clinic/models/clinic_patient.py | 6 ++++++ 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 netforce_clinic/controllers/__pycache__/__init__.cpython-32.pyc diff --git a/netforce_clinic/controllers/__pycache__/__init__.cpython-32.pyc b/netforce_clinic/controllers/__pycache__/__init__.cpython-32.pyc deleted file mode 100644 index ccf8cbcf10a19f73d287992ec65370d6032e3232..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmd1d;pJlgCm)i`fCLzUYzH7NW&si@3=F{(c_l^pIXS6C#rpB_KqV#d@p=W7r5r$mY;yBcN^?@} KK-LulF#`bk<|H@( diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 37b1db3..41377c6 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -1,8 +1,8 @@ - + diff --git a/netforce_clinic/models/clinic_hd_case.py b/netforce_clinic/models/clinic_hd_case.py index 86b2821..fedbe5b 100644 --- a/netforce_clinic/models/clinic_hd_case.py +++ b/netforce_clinic/models/clinic_hd_case.py @@ -4,7 +4,7 @@ import time from netforce.access import get_active_user,set_active_user from netforce.access import get_active_company -class Hdcase(Model): +class HDcase(Model): _name="clinic.hd.case" _string="HD Case Treatment" _audit_log=True @@ -80,7 +80,6 @@ class Hdcase(Model): obj=self.browse(ids)[0] obj.write({"state":"canceled"}) - def confirmed(self,ids,context={}): obj=self.browse(ids)[0] obj.write({"state":"confirmed"}) @@ -203,4 +202,4 @@ class Hdcase(Model): } return vals -Hdcase.register() +HDcase.register() diff --git a/netforce_clinic/models/clinic_patient.py b/netforce_clinic/models/clinic_patient.py index cff713e..8170226 100644 --- a/netforce_clinic/models/clinic_patient.py +++ b/netforce_clinic/models/clinic_patient.py @@ -144,6 +144,12 @@ class Patient(Model): } _order="date desc,number desc" + def name_get(self,ids,context={}): + vals=[] + for obj in self.browse(ids): + name='%s %s'%(obj.first_name or "", obj.last_name or "") + vals.append((obj.id,name)) + return vals def void(self,ids,context={}): obj=self.browse(ids)[0] From 56140b40482e19fc8169e7ba4aa60760445a77eb Mon Sep 17 00:00:00 2001 From: Test server Date: Wed, 1 Oct 2014 14:40:18 +0700 Subject: [PATCH 4/4] clean --- .../layouts/clinic_hd_case_form.xml | 24 ++++++++++++------- netforce_clinic/models/clinic_hd_case.py | 3 +++ netforce_clinic/models/clinic_patient.py | 1 - 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml index 80be1ac..7be8c49 100644 --- a/netforce_clinic/layouts/clinic_hd_case_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_form.xml @@ -43,16 +43,24 @@ - - - + + + + + + + + -