From 70dc4dbb6a200fededbaa4d462240baa2cf11869 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Thu, 30 Apr 2015 16:41:34 +0700 Subject: [PATCH] improve visit board (add icon) --- .../actions/clinic_hd_case_staff.xml | 6 ++ .../layouts/clinic_hd_case_staff_form.xml | 6 ++ .../layouts/clinic_hd_case_staff_list.xml | 6 ++ .../models/hd_case_popup_discontinue.py | 2 +- netforce_clinic/models/hd_case_popup_dlz.py | 2 +- netforce_clinic/models/hd_case_staff.py | 12 ++-- netforce_clinic/models/visit_board.py | 19 +++--- netforce_clinic/templates/visit_board.hbs | 61 ++++++++++++------- 8 files changed, 73 insertions(+), 41 deletions(-) create mode 100644 netforce_clinic/actions/clinic_hd_case_staff.xml create mode 100644 netforce_clinic/layouts/clinic_hd_case_staff_form.xml create mode 100644 netforce_clinic/layouts/clinic_hd_case_staff_list.xml diff --git a/netforce_clinic/actions/clinic_hd_case_staff.xml b/netforce_clinic/actions/clinic_hd_case_staff.xml new file mode 100644 index 0000000..391bb30 --- /dev/null +++ b/netforce_clinic/actions/clinic_hd_case_staff.xml @@ -0,0 +1,6 @@ + + HDCase Staff + multi_view + clinic.hd.case.staff + clinic_menu + diff --git a/netforce_clinic/layouts/clinic_hd_case_staff_form.xml b/netforce_clinic/layouts/clinic_hd_case_staff_form.xml new file mode 100644 index 0000000..af9d6b6 --- /dev/null +++ b/netforce_clinic/layouts/clinic_hd_case_staff_form.xml @@ -0,0 +1,6 @@ +
+ + + + + diff --git a/netforce_clinic/layouts/clinic_hd_case_staff_list.xml b/netforce_clinic/layouts/clinic_hd_case_staff_list.xml new file mode 100644 index 0000000..850f54e --- /dev/null +++ b/netforce_clinic/layouts/clinic_hd_case_staff_list.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/netforce_clinic/models/hd_case_popup_discontinue.py b/netforce_clinic/models/hd_case_popup_discontinue.py index e5c901f..c03dad5 100644 --- a/netforce_clinic/models/hd_case_popup_discontinue.py +++ b/netforce_clinic/models/hd_case_popup_discontinue.py @@ -12,7 +12,7 @@ class HDCasePopupDiscontinue(Model): def _get_hd_case_id(self,context={}): hd_case_id=context.get("refer_id") - print("hd case deault") + print("clinic.hd.case.popup.discontinue default") if not hd_case_id: return None return int(hd_case_id) diff --git a/netforce_clinic/models/hd_case_popup_dlz.py b/netforce_clinic/models/hd_case_popup_dlz.py index bb7f825..c4d6a90 100644 --- a/netforce_clinic/models/hd_case_popup_dlz.py +++ b/netforce_clinic/models/hd_case_popup_dlz.py @@ -16,7 +16,7 @@ class HDCasePopupDlz(Model): def _get_hd_case_id(self,context={}): hd_case_id=context.get("refer_id") - print("hd case deault") + print("clinic.hd.case.popup.dlz default") if not hd_case_id: return None return int(hd_case_id) diff --git a/netforce_clinic/models/hd_case_staff.py b/netforce_clinic/models/hd_case_staff.py index 05e3e5f..93f5d3b 100644 --- a/netforce_clinic/models/hd_case_staff.py +++ b/netforce_clinic/models/hd_case_staff.py @@ -1,3 +1,5 @@ +import time + from netforce.model import Model, fields class HDCaseStaff(Model): @@ -14,30 +16,30 @@ class HDCaseStaff(Model): 'patient_id': patient.id, 'patient_type_id': patient.type_id.id, 'cycle_id': hd_case.cycle_id.id, - 'date': hd_case.date, 'department_id': hd_case.department_id.id, 'state': hd_case.state, } return res _fields={ - "hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade"), + "hd_case_id": fields.Many2One("clinic.hd.case","HD Case",required=True,on_delete="cascade",search=True), "staff_id": fields.Many2One("clinic.staff","Doctor",search=True), - "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True), - "priop": fields.Selection([("personal","Personal"),('other','Other')],"Priority"), + "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True,search=True), + "priop": fields.Selection([("personal","Personal"),('other','Other')],"Priority",search=True), 'note': fields.Char("Note"), 'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True), 'patient_id': fields.Many2One("clinic.patient","Patient",domain=[['state','=','admit']], function="_get_all",function_multi=True), 'patient_type_id': fields.Many2One("clinic.patient.type","Patient Type",function="_get_all",function_multi=True), 'cycle_id': fields.Many2One("clinic.cycle","Cycle",function="_get_all",function_multi=True), 'department_id': fields.Many2One("clinic.department","Department",function="_get_all",function_multi=True), - 'date': fields.Date("Date",function="_get_all",function_multi=True), + 'date': fields.Date("Date",search=True), "state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),("completed","Finish Treatment"),('paid','Paid'),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",function="_get_all",function_multi=True), } _defaults={ 'type': 'doctor', 'priop': 'personal', + 'date': lambda *a: time.strftime("%Y-%m-%d"), } HDCaseStaff.register() diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index da48725..a109846 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -160,22 +160,19 @@ class VisitBoard(Model): sickbed_name=hd_case.sickbed_id.name or "N/A" sickbed_id=hd_case.sickbed_id.id hd_case_id=hd_case.id, - if hd_case.number=='/': - hd_case_number='*Waiting' + hd_case_number='Waiting' else: hd_case_number=hd_case.number - hd_case_state=hd_case.state if hd_case_state=='completed': visit_color='#99ff99' - hd_case_number+=" (เสร็จสิ้น)" elif hd_case_state=='in_progress': - hd_case_number+=' (กำลังรักษา)' - + visit_color='#f9e37d' + pass number=visit.number if number=='/': - number='*Waiting' + number='Waiting' cycle=visit.cycle_id patient=visit.patient_id if not patient.active: @@ -192,9 +189,9 @@ class VisitBoard(Model): if visit.state=='cancelled': visit_color='#dbdbdb', if visit.number=='/': - number='*Cancelled' + number='Cancelled' else: - number+='*Cancelled' + number+='Cancelled' line={ 'number': number, 'hn_name': hn_name, @@ -214,6 +211,8 @@ class VisitBoard(Model): 'doctor_name': visit.doctor_id.name, 'doctor_id': visit.doctor_id.id, 'hd_case_number': hd_case_number, + 'hd_case_state': hd_case_state, + 'hd_case_state_txt':HD_STATE.get(hd_case_state,''), 'hd_case_id': hd_case_id, 'visit_color': visit_color, 'date': visit_date, @@ -227,7 +226,6 @@ class VisitBoard(Model): 'details5':'', 'no': no, 'note': visit.note, - 'hd_case_state':HD_STATE.get(hd_case_state,''), } lines.append(line) no+=1 @@ -305,7 +303,6 @@ class VisitBoard(Model): '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"), } - #set_active_user(user_id) return data def onchange_date(self,context={}): diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs index cdb9f6e..c430063 100644 --- a/netforce_clinic/templates/visit_board.hbs +++ b/netforce_clinic/templates/visit_board.hbs @@ -19,28 +19,10 @@ {{#if footer}} สรุป - - - {{details4}} - {{else}} {{#if title}} @@ -49,12 +31,17 @@ {{else}}
{{cycle_name}}
{{no}} - {{number}} + + + {{#ifeq number "Waiting"}} +  {{number}} + {{else}} + {{number}} + {{/ifeq}} + + {{hn_name}} {{patient_name}} - {{patient_type}} {{doctor_name}} {{department_name}} @@ -63,7 +50,35 @@ {{else}} {{sickbed_name}} {{/if}} - {{hd_case_number}} + + + {{#ifeq number "Waiting"}} + + {{else}} + {{#ifeq number "Cancelled"}} + + {{else}} + {{#ifeq hd_case_state "waiting_treatment"}} + + {{else}} + {{#ifeq hd_case_state "in_progress"}} + + {{else}} + {{#ifeq hd_case_state "cancelled"}} + + {{else}} + + {{/ifeq}} + {{/ifeq}} + {{/ifeq}} + {{hd_case_number}} + {{/ifeq}} + {{/ifeq}} + + + {{/if}} {{/if}}