From 6e39dbb31c0d5039f5cb76aff4582d78bd73657d Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 26 Nov 2014 14:35:09 +0700 Subject: [PATCH] schedule board --- .../actions/clinic_schedule_board.xml | 8 ++ netforce_clinic/layouts/clinic_menu.xml | 3 + .../layouts/clinic_schedule_board.xml | 4 + .../layouts/clinic_schedule_form.xml | 1 + netforce_clinic/models/__init__.py | 1 + netforce_clinic/models/schedule_board.py | 100 ++++++++++++++++++ netforce_clinic/models/schedule_line.py | 1 + netforce_clinic/models/visit_board.py | 4 + .../{visit_dialy.xlsx => schedule_board.xlsx} | Bin netforce_clinic/reports/visit_board.xlsx | Bin 0 -> 5043 bytes netforce_clinic/templates/schedule_board.hbs | 40 +++++++ netforce_clinic/templates/visit_board.hbs | 8 +- 12 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 netforce_clinic/actions/clinic_schedule_board.xml create mode 100644 netforce_clinic/layouts/clinic_schedule_board.xml create mode 100644 netforce_clinic/models/schedule_board.py rename netforce_clinic/reports/{visit_dialy.xlsx => schedule_board.xlsx} (100%) create mode 100644 netforce_clinic/reports/visit_board.xlsx create mode 100644 netforce_clinic/templates/schedule_board.hbs diff --git a/netforce_clinic/actions/clinic_schedule_board.xml b/netforce_clinic/actions/clinic_schedule_board.xml new file mode 100644 index 0000000..daa06bc --- /dev/null +++ b/netforce_clinic/actions/clinic_schedule_board.xml @@ -0,0 +1,8 @@ + + Schedule Board + report + clinic.schedule.board + schedule_board + schedule_board + clinic_menu + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 8c6cf7f..48af121 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -31,7 +31,10 @@ + + + diff --git a/netforce_clinic/layouts/clinic_schedule_board.xml b/netforce_clinic/layouts/clinic_schedule_board.xml new file mode 100644 index 0000000..31d491b --- /dev/null +++ b/netforce_clinic/layouts/clinic_schedule_board.xml @@ -0,0 +1,4 @@ +
+ + + diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml index 5f1af9b..bc7e2d2 100644 --- a/netforce_clinic/layouts/clinic_schedule_form.xml +++ b/netforce_clinic/layouts/clinic_schedule_form.xml @@ -18,6 +18,7 @@ + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index af4f59a..2788785 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -47,6 +47,7 @@ from . import staff_level from . import staff_rotation from . import staff_cycle from . import schedule +from . import schedule_board from . import schedule_line from . import schedule_copy from . import load_nurse diff --git a/netforce_clinic/models/schedule_board.py b/netforce_clinic/models/schedule_board.py new file mode 100644 index 0000000..a6b8848 --- /dev/null +++ b/netforce_clinic/models/schedule_board.py @@ -0,0 +1,100 @@ +import time + +from datetime import datetime, timedelta +from netforce.model import Model, fields, get_model +from netforce.access import get_active_company + +from . import utils + +DRT=5 + +class ScheduleBoard(Model): + _name="clinic.schedule.board" + _string="Schedule Board" + _transient=True + + _fields={ + "date_from": fields.Date("From", required=True), + "date_to": fields.Date("To", required=True), + } + + _defaults={ + 'date_from': lambda *a: time.strftime("%Y-%m-%d"), + 'date_to': lambda *a: (datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d"), + } + + def get_report_data(self,ids,context={}): + company_id=get_active_company() + company=get_model("company").browse(company_id) + + date_from=datetime.now().strftime("%Y-%m-%d") + date_to=(datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d") + if ids: + obj=self.browse(ids)[0] + date_from=obj.date_from + date_to=obj.date_to + + time_start='%s 00:00:00'%(date_from) + time_stop='%s 23:59:59'%(date_to) + + dom=[] + dom.append(['time_start','>=','%s'%time_start]) + dom.append(['time_stop','<=','%s'%time_stop]) + + lines=[] + empty_line={ + 'no': '', + 'schedule_name': '', + 'cycle_name': '', + 'nurse_id': None, + 'nurse_name': '', + 'level_id': None, + 'level_name': '', + 'note':'', + 'title':True, + 'schedule_id': None, + } + + for schedule in get_model("clinic.schedule").search_browse(dom): + no=1 + line=empty_line.copy() + date=schedule.date + line['schedule_id']=schedule.id + line['schedule_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"), + lines.append(line) + for line in schedule.lines: + nurse=line.nurse_id + level=line.level_id + cycle=line.cycle_id + line={ + 'no': no, + 'cycle_id': cycle.id, + 'cycle_name': cycle.name or '', + 'cycle_color': cycle.color or '', + 'nurse_id': nurse.id, + 'nurse_name': nurse.name or "", + 'level_id': level.id, + 'level_name': level.name or "", + 'title': False, + 'schedule_id': None, + 'schedule_name': '', + 'note': line.note or "", + } + lines.append(line) + no+=1 + has_duration=False + if date_from != date_to: + has_duration=True + data={ + 'lines': lines, + 'date': utils.date2thai(date_from,format='ประจำวัน%(Td)s ที่ %(d)s %(Tm)s %(BY)s'), + 'company_name': company.name, + 'company_parent_name': company.parent_id.name, + 'has_duration': has_duration, + 'date_from': utils.date2thai(date_from,format='%(d)s %(Tm)s %(By)s',lang="th_TH2"), + 'date_to': utils.date2thai(date_to,format='%(d)s %(Tm)s %(By)s',lang="th_TH2"), + } + + return data + +ScheduleBoard.register() diff --git a/netforce_clinic/models/schedule_line.py b/netforce_clinic/models/schedule_line.py index 8c1bb50..b4a4f9c 100644 --- a/netforce_clinic/models/schedule_line.py +++ b/netforce_clinic/models/schedule_line.py @@ -16,6 +16,7 @@ class ScheduleLine(Model): 'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"), "nurse_id": fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]), 'level_id': fields.Many2One("clinic.staff.level","Level",function="_get_level"), + 'note': fields.Text("Note"), } ScheduleLine.register() diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 691cc0c..081c3b4 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -54,9 +54,11 @@ class VisitBoard(Model): 'visit_id': None, 'cycle_name': '', 'cycle_color': '', + 'patient_id': None, 'patient_name': '', 'patient_type': '', 'doctor_name': '', + 'doctor_id': None, 'hd_case_number': '', 'hd_case_id': None, 'success_color': '', @@ -91,8 +93,10 @@ class VisitBoard(Model): 'cycle_name': cycle.name, 'cycle_color': cycle.color, 'patient_name': patient.name, + 'patient_id': patient.id, 'patient_type': utils.PATIENT_TYPE.get(patient.type,''), 'doctor_name': visit.doctor_id.name, + 'doctor_id': visit.doctor_id.id, 'hd_case_number': hd_case_number, 'hd_case_id': hd_case_id, 'visit_color': visit_color, diff --git a/netforce_clinic/reports/visit_dialy.xlsx b/netforce_clinic/reports/schedule_board.xlsx similarity index 100% rename from netforce_clinic/reports/visit_dialy.xlsx rename to netforce_clinic/reports/schedule_board.xlsx diff --git a/netforce_clinic/reports/visit_board.xlsx b/netforce_clinic/reports/visit_board.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..47b0b02c1a7a456edbcc9c91fe2d02d8a457f06e GIT binary patch literal 5043 zcmaJ_2Ut^EvjqVu(n*jGp$Lj}P^w6kPN<>xAT>bfhN5&3=_Me&g8`&VM+wCOf&l~( z5a~qeO)uaJ-gkd_zW+Ms`*Ke5otd4z_MWxZ3|NzZ5P(NQLW1{_$V&z9oL#~_Tf?Dl z-a>+BpVcXEH3&qgqc?-&k`VsQKxK!9&X|$MYQguBZ%%D*W(hO;1|z~r%qmNX6V*d@ zhi)om&(J#V$K~9KQ}w7aaZ6dmJe+{CZ~L zNejIfCRWm)ZAw{Mqa9`(5E1T{)&xHsRu5t-4`!Wa|9WH`eHfAXv=XZt?Z0SsK~-w> zGo&a<;E+#MNUVcK_pP#lQ2~=qyPJ^zH-rue--LPHrx>r?XNC>&$ZlWR)@XRHJl#q} z&8fH4GZNLr(~cDFwbxGLJ)^u%@_1lPViL!yu$E7_Y0F%|!+rlZV3=@k1h@(Pjg7wt z+||y*!&NZA-R*CjlC@oXg~_8fPk^e2ed@&a@sgeK3biLk`2BjHN6Qhkyp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aPg~ogq?51y6 ztFUmp0Pb&1xTZJ204w3PR4T97!e`09F6Vb`haMuzH&X!|e7$|7;j+p33^}j}DqA90 z7-1S*CR^xSFQDCFEaWjQF>+{O4@09O$O@axRBCidk!RMe-SR;RR0nH;b^fjdhu)LP4A007i!jBk$U^G^}$1!f@RK#VL@ z+MB|h`6Ux6wIDg!q zDYakLP4b`r@sDo%-T6F?o+*M~mPYpX@c+>Vzq_6%nlqmLWr4Uzzq9V|-sh9)jEsI+ r3gtQPf2iqq_wzgBEaQIJ7aRuvCI7&hL>JFqBE? +

ตารางเวร

+

+ {{parent_company_name}} {{company_name}}
+

+

+ {{#if has_duration}} + ระหว่างวันที่ {{date_from}} ถึง {{date_to}} + {{else}} + {{date}} + {{/if}} +

+ + + + + + + + + + + {{#each lines}} + + {{#if title}} + + + {{else}} + + + + + + {{/if}} + + {{/each}} + + + +
รอบ#ชื่อตำแหน่งหมายเหตุ
{{schedule_name}}{{cycle_name}}{{no}}{{nurse_name}}{{level_name}}{{note}}
diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs index ed58c1e..b9940c2 100644 --- a/netforce_clinic/templates/visit_board.hbs +++ b/netforce_clinic/templates/visit_board.hbs @@ -26,15 +26,15 @@ {{#each lines }} {{#if title}} - {{cycle_name}} - {{details}} + {{cycle_name}} + {{details}} {{else}} {{cycle_name}} {{no}} {{number}} - {{patient_name}} + {{patient_name}} {{patient_type}} - {{doctor_name}} + {{doctor_name}} {{hd_case_number}} {{note}} {{/if}}