From 806faec9cd6da7422a92b8b7c4b565b993dd3328 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Tue, 28 Oct 2014 22:16:16 +0700 Subject: [PATCH] widget --- netforce_clinic/actions/clinic_board.xml | 2 +- .../actions/clinic_cycle_widget.xml | 6 ++++ netforce_clinic/actions/clinic_patient.xml | 2 +- .../actions/clinic_recent_patient_widget.xml | 7 +++++ netforce_clinic/actions/clinic_schedule.xml | 7 +++++ netforce_clinic/actions/clinic_visit.xml | 2 +- netforce_clinic/layouts/clinic_board.xml | 12 ++++++-- netforce_clinic/layouts/clinic_menu.xml | 3 +- .../layouts/clinic_patient_form.xml | 1 + .../layouts/clinic_recent_patient_widget.xml | 8 +++++ .../layouts/clinic_schedule_calendar.xml | 4 +++ .../layouts/clinic_schedule_form.xml | 11 +++++++ .../layouts/clinic_schedule_list.xml | 5 ++++ netforce_clinic/models/__init__.py | 2 ++ netforce_clinic/models/patient.py | 6 +--- netforce_clinic/models/report_clinic.py | 16 ++++++++++ netforce_clinic/models/schedule.py | 29 +++++++++++++++++++ 17 files changed, 111 insertions(+), 12 deletions(-) create mode 100644 netforce_clinic/actions/clinic_cycle_widget.xml create mode 100644 netforce_clinic/actions/clinic_recent_patient_widget.xml create mode 100644 netforce_clinic/actions/clinic_schedule.xml create mode 100644 netforce_clinic/layouts/clinic_recent_patient_widget.xml create mode 100644 netforce_clinic/layouts/clinic_schedule_calendar.xml create mode 100644 netforce_clinic/layouts/clinic_schedule_form.xml create mode 100644 netforce_clinic/layouts/clinic_schedule_list.xml create mode 100644 netforce_clinic/models/report_clinic.py create mode 100644 netforce_clinic/models/schedule.py diff --git a/netforce_clinic/actions/clinic_board.xml b/netforce_clinic/actions/clinic_board.xml index 4584279..cecee1f 100644 --- a/netforce_clinic/actions/clinic_board.xml +++ b/netforce_clinic/actions/clinic_board.xml @@ -1,6 +1,6 @@ clinic_board - Visit Board + Clinic Board board clinic_board clinic_menu diff --git a/netforce_clinic/actions/clinic_cycle_widget.xml b/netforce_clinic/actions/clinic_cycle_widget.xml new file mode 100644 index 0000000..e677127 --- /dev/null +++ b/netforce_clinic/actions/clinic_cycle_widget.xml @@ -0,0 +1,6 @@ + + chart_view + clinic.report + cycle_recent_widget + pie + diff --git a/netforce_clinic/actions/clinic_patient.xml b/netforce_clinic/actions/clinic_patient.xml index edb3dfb..333e7af 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"]]],["Others",[["type","=","others"]]]] + [["All",[]],["Archived",[["active","=",false]]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","others"]]]] clinic_menu diff --git a/netforce_clinic/actions/clinic_recent_patient_widget.xml b/netforce_clinic/actions/clinic_recent_patient_widget.xml new file mode 100644 index 0000000..f24049b --- /dev/null +++ b/netforce_clinic/actions/clinic_recent_patient_widget.xml @@ -0,0 +1,7 @@ + + list_view + clinic.patient + write_time desc + 5 + clinic_recent_patient_widget + diff --git a/netforce_clinic/actions/clinic_schedule.xml b/netforce_clinic/actions/clinic_schedule.xml new file mode 100644 index 0000000..a61472b --- /dev/null +++ b/netforce_clinic/actions/clinic_schedule.xml @@ -0,0 +1,7 @@ + + Schedules + multi_view + clinic.schedule + calendar,list,page,form + clinic_menu + diff --git a/netforce_clinic/actions/clinic_visit.xml b/netforce_clinic/actions/clinic_visit.xml index 9481abc..42c5502 100644 --- a/netforce_clinic/actions/clinic_visit.xml +++ b/netforce_clinic/actions/clinic_visit.xml @@ -3,6 +3,6 @@ multi_view clinic.visit [["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]],["Cancelled",[["state","=","cancelled"]]]] - list,calendar,form + calendar,list,form clinic_menu diff --git a/netforce_clinic/layouts/clinic_board.xml b/netforce_clinic/layouts/clinic_board.xml index c7e1151..6e71737 100644 --- a/netforce_clinic/layouts/clinic_board.xml +++ b/netforce_clinic/layouts/clinic_board.xml @@ -1,5 +1,11 @@ - - - + + + + + + + + + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 70a49bd..87e2acf 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -19,11 +19,12 @@ + + -
diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index dbc144c..5faa609 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -14,6 +14,7 @@ + diff --git a/netforce_clinic/layouts/clinic_recent_patient_widget.xml b/netforce_clinic/layouts/clinic_recent_patient_widget.xml new file mode 100644 index 0000000..cecada5 --- /dev/null +++ b/netforce_clinic/layouts/clinic_recent_patient_widget.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/netforce_clinic/layouts/clinic_schedule_calendar.xml b/netforce_clinic/layouts/clinic_schedule_calendar.xml new file mode 100644 index 0000000..04b312d --- /dev/null +++ b/netforce_clinic/layouts/clinic_schedule_calendar.xml @@ -0,0 +1,4 @@ + + + + diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml new file mode 100644 index 0000000..618d668 --- /dev/null +++ b/netforce_clinic/layouts/clinic_schedule_form.xml @@ -0,0 +1,11 @@ +
+ + + + + + + + diff --git a/netforce_clinic/layouts/clinic_schedule_list.xml b/netforce_clinic/layouts/clinic_schedule_list.xml new file mode 100644 index 0000000..4ac4079 --- /dev/null +++ b/netforce_clinic/layouts/clinic_schedule_list.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index ab59ba4..b7d838e 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -34,6 +34,7 @@ from . import report_hd_detail from . import report_hd_summary from . import report_hd_medical from . import report_hd_payment +from . import report_clinic from . import fin_setting from . import import_data_mg from . import import_data_nhso @@ -43,3 +44,4 @@ from . import payment from . import account_payment from . import account_invoice from . import personal_categ +from . import schedule diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index d70727f..d27a668 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -76,6 +76,7 @@ class Patient(Model): "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "partner_id": fields.Many2One("partner","Contact"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), + 'active': fields.Boolean("Active"), } def _get_number(self,context={}): @@ -92,16 +93,11 @@ class Patient(Model): return num get_model("sequence").increment_number(seq_id,context=context) - def _get_cause_line(self,context={}): - cause_ids=get_model("clinic.cause.chronic").search([]) - return cause_ids - _defaults={ "type": "mg", "reg_date": lambda *a: time.strftime("%Y-%m-%d"), "number": _get_number, "company_id": lambda *a: get_active_company(), - #'cause_lines': _get_cause_line, } _order="date desc,number desc" diff --git a/netforce_clinic/models/report_clinic.py b/netforce_clinic/models/report_clinic.py new file mode 100644 index 0000000..79e1a78 --- /dev/null +++ b/netforce_clinic/models/report_clinic.py @@ -0,0 +1,16 @@ +from netforce.model import Model +from netforce.database import get_connection + +class Report(Model): + _name="clinic.report" + _store=False + + def cycle_recent_widget(self,context={}): + db=get_connection() + res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id group by c.name;") + data=[] + for r in res: + data.append((r.name,r.count)) + return {"value":data} + +Report.register() diff --git a/netforce_clinic/models/schedule.py b/netforce_clinic/models/schedule.py new file mode 100644 index 0000000..ead691b --- /dev/null +++ b/netforce_clinic/models/schedule.py @@ -0,0 +1,29 @@ +from netforce.model import Model, fields +from netforce.access import get_active_company + +class Schedule(Model): + _name="clinic.schedule" + _string="Schedule" + #_field_name="cycle_id" + + def _get_name(self,ids,context={}): + res={} + for obj in self.browse(ids): + total_nurse=len(obj.nurses) + res[obj.id]='Cycle: %s, Nurse: %s'%(obj.cycle_id.name or "", total_nurse) + return res + + _fields={ + "name": fields.Char("Name",function="_get_name"), + 'cycle_id': fields.Many2One("clinic.cycle","Cycle",required=True), + "time_start": fields.DateTime("Time Start",required=True), + "time_stop": fields.DateTime("Time Stop",required=True), + 'company_id': fields.Many2One("company","Company"), + 'nurses': fields.Many2Many('clinic.nurse','Nurses'), + } + + _defaults={ + "company_id": lambda *a: get_active_company(), + } + +Schedule.register()