From 1ee80f051aa7932d6c690b288718cbaf7f3ad31b Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 1 Oct 2014 23:14:52 +0700 Subject: [PATCH] clean --- netforce_clinic/actions/clinic_grade.xml | 6 + netforce_clinic/actions/clinic_nation.xml | 6 + netforce_clinic/actions/clinic_patient.xml | 2 +- netforce_clinic/actions/clinic_race.xml | 6 + .../layouts/clinic_doctor_form.xml | 40 ++++-- .../layouts/clinic_education_form.xml | 3 + .../layouts/clinic_education_list.xml | 3 + netforce_clinic/layouts/clinic_grade_form.xml | 3 + netforce_clinic/layouts/clinic_grade_list.xml | 3 + netforce_clinic/layouts/clinic_menu.xml | 3 + .../layouts/clinic_nation_form.xml | 3 + .../layouts/clinic_nation_list.xml | 3 + netforce_clinic/layouts/clinic_nurse_form.xml | 40 ++++-- .../layouts/clinic_patient_form.xml | 120 +++++++++--------- netforce_clinic/layouts/clinic_race_form.xml | 3 + netforce_clinic/layouts/clinic_race_list.xml | 3 + netforce_clinic/models/__init__.py | 4 + netforce_clinic/models/clinic_doctor.py | 37 ++++-- netforce_clinic/models/clinic_education.py | 11 ++ netforce_clinic/models/clinic_graduation.py | 11 ++ netforce_clinic/models/clinic_nation.py | 11 ++ netforce_clinic/models/clinic_nurse.py | 46 ++++--- netforce_clinic/models/clinic_patient.py | 16 ++- netforce_clinic/models/clinic_race.py | 11 ++ 24 files changed, 269 insertions(+), 125 deletions(-) create mode 100644 netforce_clinic/actions/clinic_grade.xml create mode 100644 netforce_clinic/actions/clinic_nation.xml create mode 100644 netforce_clinic/actions/clinic_race.xml create mode 100644 netforce_clinic/layouts/clinic_education_form.xml create mode 100644 netforce_clinic/layouts/clinic_education_list.xml create mode 100644 netforce_clinic/layouts/clinic_grade_form.xml create mode 100644 netforce_clinic/layouts/clinic_grade_list.xml create mode 100644 netforce_clinic/layouts/clinic_nation_form.xml create mode 100644 netforce_clinic/layouts/clinic_nation_list.xml create mode 100644 netforce_clinic/layouts/clinic_race_form.xml create mode 100644 netforce_clinic/layouts/clinic_race_list.xml create mode 100644 netforce_clinic/models/clinic_education.py create mode 100644 netforce_clinic/models/clinic_graduation.py create mode 100644 netforce_clinic/models/clinic_nation.py create mode 100644 netforce_clinic/models/clinic_race.py diff --git a/netforce_clinic/actions/clinic_grade.xml b/netforce_clinic/actions/clinic_grade.xml new file mode 100644 index 0000000..7502df8 --- /dev/null +++ b/netforce_clinic/actions/clinic_grade.xml @@ -0,0 +1,6 @@ + + Graduations + multi_view + clinic.graduation + clinic_menu + diff --git a/netforce_clinic/actions/clinic_nation.xml b/netforce_clinic/actions/clinic_nation.xml new file mode 100644 index 0000000..3ff6182 --- /dev/null +++ b/netforce_clinic/actions/clinic_nation.xml @@ -0,0 +1,6 @@ + + Nationalities + multi_view + clinic.nation + clinic_menu + diff --git a/netforce_clinic/actions/clinic_patient.xml b/netforce_clinic/actions/clinic_patient.xml index b4b9a0d..6b0d86b 100644 --- a/netforce_clinic/actions/clinic_patient.xml +++ b/netforce_clinic/actions/clinic_patient.xml @@ -2,6 +2,6 @@ Patients multi_view clinic.patient - [["All",[]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30$)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Other",[["type","=","other"]]]] + [["All",[]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","other"]]]] clinic_menu diff --git a/netforce_clinic/actions/clinic_race.xml b/netforce_clinic/actions/clinic_race.xml new file mode 100644 index 0000000..776b65c --- /dev/null +++ b/netforce_clinic/actions/clinic_race.xml @@ -0,0 +1,6 @@ + + Races + multi_view + clinic.race + clinic_menu + diff --git a/netforce_clinic/layouts/clinic_doctor_form.xml b/netforce_clinic/layouts/clinic_doctor_form.xml index 69407c1..ee1cd38 100644 --- a/netforce_clinic/layouts/clinic_doctor_form.xml +++ b/netforce_clinic/layouts/clinic_doctor_form.xml @@ -2,22 +2,36 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/netforce_clinic/layouts/clinic_education_form.xml b/netforce_clinic/layouts/clinic_education_form.xml new file mode 100644 index 0000000..41ba900 --- /dev/null +++ b/netforce_clinic/layouts/clinic_education_form.xml @@ -0,0 +1,3 @@ +
+ + diff --git a/netforce_clinic/layouts/clinic_education_list.xml b/netforce_clinic/layouts/clinic_education_list.xml new file mode 100644 index 0000000..0280036 --- /dev/null +++ b/netforce_clinic/layouts/clinic_education_list.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/layouts/clinic_grade_form.xml b/netforce_clinic/layouts/clinic_grade_form.xml new file mode 100644 index 0000000..945552b --- /dev/null +++ b/netforce_clinic/layouts/clinic_grade_form.xml @@ -0,0 +1,3 @@ +
+ + diff --git a/netforce_clinic/layouts/clinic_grade_list.xml b/netforce_clinic/layouts/clinic_grade_list.xml new file mode 100644 index 0000000..c094b9c --- /dev/null +++ b/netforce_clinic/layouts/clinic_grade_list.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index e5bf288..9f3d64b 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -10,6 +10,9 @@ + + + diff --git a/netforce_clinic/layouts/clinic_nation_form.xml b/netforce_clinic/layouts/clinic_nation_form.xml new file mode 100644 index 0000000..46f3549 --- /dev/null +++ b/netforce_clinic/layouts/clinic_nation_form.xml @@ -0,0 +1,3 @@ +
+ + diff --git a/netforce_clinic/layouts/clinic_nation_list.xml b/netforce_clinic/layouts/clinic_nation_list.xml new file mode 100644 index 0000000..f82fd67 --- /dev/null +++ b/netforce_clinic/layouts/clinic_nation_list.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/layouts/clinic_nurse_form.xml b/netforce_clinic/layouts/clinic_nurse_form.xml index 6bb155d..a10c014 100644 --- a/netforce_clinic/layouts/clinic_nurse_form.xml +++ b/netforce_clinic/layouts/clinic_nurse_form.xml @@ -2,22 +2,36 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index 5b49c06..22c1431 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -1,69 +1,72 @@
- + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,7 +97,6 @@ - diff --git a/netforce_clinic/layouts/clinic_race_form.xml b/netforce_clinic/layouts/clinic_race_form.xml new file mode 100644 index 0000000..928d67c --- /dev/null +++ b/netforce_clinic/layouts/clinic_race_form.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/layouts/clinic_race_list.xml b/netforce_clinic/layouts/clinic_race_list.xml new file mode 100644 index 0000000..1a8bab6 --- /dev/null +++ b/netforce_clinic/layouts/clinic_race_list.xml @@ -0,0 +1,3 @@ + + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 67d599b..0eb736e 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -7,4 +7,8 @@ from . import clinic_hd_case_line from . import clinic_hd_case_line_detail from . import clinic_dialyzer from . import clinic_department +from . import clinic_education from . import clinic_setting +from . import clinic_graduation +from . import clinic_nation +from . import clinic_race diff --git a/netforce_clinic/models/clinic_doctor.py b/netforce_clinic/models/clinic_doctor.py index abdca17..fe54cb3 100644 --- a/netforce_clinic/models/clinic_doctor.py +++ b/netforce_clinic/models/clinic_doctor.py @@ -8,28 +8,41 @@ class Doctor(Model): _string="Doctor" _audit_log=True _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 + _fields={ "number": fields.Char("Doctor No.",required=True,search=True), "name": fields.Char("Name",required=True,search=True), - "card_id" : fields.Char("Identity ID"), - "card_expire" : fields.Date("Expire Date"), - "birthday": fields.Date("Date of Birth",search=True), - "telephone": fields.Char("Telephone",search=True), - "type": fields.Selection([("temporary","Temporary"),("permanent","Permanent")],"Type"), + "identification" : fields.Char("Identification"), + "expiry_card" : fields.Date("Expiry Card"), + "birthday": fields.Date("Birthday",search=True), + "age": fields.Integer("Age", function="_get_age"), + "type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Type"), "mobile": fields.Char("Mobile",required=False,search=True), - "cert_no" : fields.Char("Certificate No."), - "cert_date" : fields.Date("Certificate Date"), + "phone": fields.Char("Phone",search=True), + 'email': fields.Char("Email"), + "prof_license" : fields.Char("Professional License."), + "prof_license_date" : fields.Date("Professional License Date"), "birthday": fields.Date("BirthDay",search=True), - "telephone": fields.Char("Telephone",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True), - "mobile": fields.Char("Mobile",search=True), - "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status"), + "patients": fields.Many2Many("clinic.patient","Patients"), "addresses": fields.One2Many("address","related_id","Addresses"), "comments": fields.One2Many("message","related_id","Comments"), - "patients": fields.Many2Many("clinic.patient","Patients"), "visits": fields.One2Many("clinic.visit","nurse_id","Visits"), - "hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD cases"), + "hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD Cases"), "company_id": fields.Many2One("company","Company"), + "user_id": fields.Many2One("base.user","User"), + 'picture': fields.File("Picture"), } def _get_number(self,context={}): diff --git a/netforce_clinic/models/clinic_education.py b/netforce_clinic/models/clinic_education.py new file mode 100644 index 0000000..ab924b1 --- /dev/null +++ b/netforce_clinic/models/clinic_education.py @@ -0,0 +1,11 @@ +from netforce.model import Model, fields + +class Education(Model): + _name="clinic.education" + _string="Education" + + _fields={ + "name": fields.Char("Name",required=True,search=True), + } + +Education.register() diff --git a/netforce_clinic/models/clinic_graduation.py b/netforce_clinic/models/clinic_graduation.py new file mode 100644 index 0000000..a4d83d3 --- /dev/null +++ b/netforce_clinic/models/clinic_graduation.py @@ -0,0 +1,11 @@ +from netforce.model import Model, fields + +class Graduation(Model): + _name="clinic.graduation" + _string="Graduation" + + _fields={ + "name": fields.Char("Name",required=True,search=True), + } + +Graduation.register() diff --git a/netforce_clinic/models/clinic_nation.py b/netforce_clinic/models/clinic_nation.py new file mode 100644 index 0000000..33bc4ad --- /dev/null +++ b/netforce_clinic/models/clinic_nation.py @@ -0,0 +1,11 @@ +from netforce.model import Model, fields + +class Nation(Model): + _name="clinic.nation" + _string="Nationality" + + _fields={ + "name": fields.Char("Name",required=True,search=True), + } + +Nation.register() diff --git a/netforce_clinic/models/clinic_nurse.py b/netforce_clinic/models/clinic_nurse.py index 1d37e46..5d02500 100644 --- a/netforce_clinic/models/clinic_nurse.py +++ b/netforce_clinic/models/clinic_nurse.py @@ -7,30 +7,42 @@ class Nurse(Model): _name="clinic.nurse" _string="Nurse" _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 + _fields={ - "number": fields.Char("Nurse No.",required=True,search=True), + "number": fields.Char("Doctor No.",required=True,search=True), "name": fields.Char("Name",required=True,search=True), - "card_id" : fields.Char("Identity ID"), - "card_expire" : fields.Date("Expire Date"), - "birthday": fields.Date("Date of Birth",search=True), - "telephone": fields.Char("Telephone",search=True), - "type": fields.Selection([("temporary","Temporary"),("permanent","Permanent")],"Type"), + "identification" : fields.Char("Identification"), + "expiry_card" : fields.Date("Expiry Card"), + "birthday": fields.Date("Birthday",search=True), + "age": fields.Integer("Age", function="_get_age"), + "type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Type"), "mobile": fields.Char("Mobile",required=False,search=True), - "cert_no" : fields.Char("Certificate No."), - "cert_date" : fields.Date("Certificate Date"), + "phone": fields.Char("Phone",search=True), + 'email': fields.Char("Email"), + "prof_license" : fields.Char("Professional License."), + "prof_license_date" : fields.Date("Professional License Date"), "birthday": fields.Date("BirthDay",search=True), - "telephone": fields.Char("Telephone",search=True), "department_id": fields.Many2One("clinic.department", "Department",search=True), - "mobile": fields.Char("Mobile",search=True), - "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status"), + "patients": fields.Many2Many("clinic.patient","Patients"), "addresses": fields.One2Many("address","related_id","Addresses"), "comments": fields.One2Many("message","related_id","Comments"), - "patients": fields.Many2Many("clinic.patient","Patients"), "visits": fields.One2Many("clinic.visit","nurse_id","Visits"), - "hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD cases"), + "hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD Cases"), "company_id": fields.Many2One("company","Company"), + "user_id": fields.Many2One("base.user","User"), + 'picture': fields.File("Picture"), } def _get_number(self,context={}): @@ -53,10 +65,4 @@ class Nurse(Model): _order="date desc,number desc" - - def void(self,ids,context={}): - obj=self.browse(ids)[0] - obj.write({"state":"voided"}) - - Nurse.register() diff --git a/netforce_clinic/models/clinic_patient.py b/netforce_clinic/models/clinic_patient.py index 5f02d03..4c23256 100644 --- a/netforce_clinic/models/clinic_patient.py +++ b/netforce_clinic/models/clinic_patient.py @@ -21,19 +21,20 @@ class Patient(Model): return res # -> {1: 30, 2: 45,.....} _fields={ + "type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Patient Type",required=False), "number": fields.Char("Patient No.",required=True,search=True), "name": fields.Char("Name",required=True,search=True), "reg_date": fields.Date("Register Date",required=False,search=True), - "birthday": fields.Date("Date of Birth",required=False,search=True), - "tel": fields.Char("Tel.",required=False,search=True), + "birthday": fields.Date("Birthday",required=False,search=True), + "phone": fields.Char("Phone",required=False,search=True), "mobile": fields.Char("Mobile",required=False,search=True), "job": fields.Char("Job/Position"), - "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"), + 'picture': fields.File("Picture"), + 'email': fields.Char("Email"), "weight": fields.Float("Weight (cm)"), "height": fields.Float("Height (Kg)"), - "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), + "card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True), 'card_no' : fields.Char("Card No."), "app_no": fields.Char("Application No."), "salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"), @@ -41,8 +42,9 @@ class Patient(Model): "addresses": fields.One2Many("address","related_id","Addresses"), "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), + "nation_id": fields.Many2One("clinic.nation","Nationality"), + "race_id": fields.Many2One("clinic.race","Race"), + "grad_id": fields.Many2One("clinic.graduation","Graduation"), #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"), diff --git a/netforce_clinic/models/clinic_race.py b/netforce_clinic/models/clinic_race.py new file mode 100644 index 0000000..f3d1819 --- /dev/null +++ b/netforce_clinic/models/clinic_race.py @@ -0,0 +1,11 @@ +from netforce.model import Model, fields + +class Race(Model): + _name="clinic.race" + _string="Race" + + _fields={ + "name": fields.Char("Name",required=True,search=True), + } + +Race.register()