improve visit board (add icon)

conv_bal
watcha.h@almacom.co.th 2015-04-30 16:41:34 +07:00
parent 4cda6b2cac
commit 70dc4dbb6a
8 changed files with 73 additions and 41 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">HDCase Staff</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case.staff</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -0,0 +1,6 @@
<form model="clinic.hd.case.staff">
<field name="hd_case_id"/>
<field name="type"/>
<field name="staff_id"/>
<field name="priop"/>
</form>

View File

@ -0,0 +1,6 @@
<list model="clinic.hd.case.staff">
<field name="hd_case_id"/>
<field name="type"/>
<field name="staff_id"/>
<field name="priop"/>
</list>

View File

@ -12,7 +12,7 @@ class HDCasePopupDiscontinue(Model):
def _get_hd_case_id(self,context={}): def _get_hd_case_id(self,context={}):
hd_case_id=context.get("refer_id") hd_case_id=context.get("refer_id")
print("hd case deault") print("clinic.hd.case.popup.discontinue default")
if not hd_case_id: if not hd_case_id:
return None return None
return int(hd_case_id) return int(hd_case_id)

View File

@ -16,7 +16,7 @@ class HDCasePopupDlz(Model):
def _get_hd_case_id(self,context={}): def _get_hd_case_id(self,context={}):
hd_case_id=context.get("refer_id") hd_case_id=context.get("refer_id")
print("hd case deault") print("clinic.hd.case.popup.dlz default")
if not hd_case_id: if not hd_case_id:
return None return None
return int(hd_case_id) return int(hd_case_id)

View File

@ -1,3 +1,5 @@
import time
from netforce.model import Model, fields from netforce.model import Model, fields
class HDCaseStaff(Model): class HDCaseStaff(Model):
@ -14,30 +16,30 @@ class HDCaseStaff(Model):
'patient_id': patient.id, 'patient_id': patient.id,
'patient_type_id': patient.type_id.id, 'patient_type_id': patient.type_id.id,
'cycle_id': hd_case.cycle_id.id, 'cycle_id': hd_case.cycle_id.id,
'date': hd_case.date,
'department_id': hd_case.department_id.id, 'department_id': hd_case.department_id.id,
'state': hd_case.state, 'state': hd_case.state,
} }
return res return res
_fields={ _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), "staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True), "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True,search=True),
"priop": fields.Selection([("personal","Personal"),('other','Other')],"Priority"), "priop": fields.Selection([("personal","Personal"),('other','Other')],"Priority",search=True),
'note': fields.Char("Note"), 'note': fields.Char("Note"),
'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed",function="_get_all",function_multi=True), '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_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), '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), '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), '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), "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={ _defaults={
'type': 'doctor', 'type': 'doctor',
'priop': 'personal', 'priop': 'personal',
'date': lambda *a: time.strftime("%Y-%m-%d"),
} }
HDCaseStaff.register() HDCaseStaff.register()

View File

@ -160,22 +160,19 @@ class VisitBoard(Model):
sickbed_name=hd_case.sickbed_id.name or "N/A" sickbed_name=hd_case.sickbed_id.name or "N/A"
sickbed_id=hd_case.sickbed_id.id sickbed_id=hd_case.sickbed_id.id
hd_case_id=hd_case.id, hd_case_id=hd_case.id,
if hd_case.number=='/': if hd_case.number=='/':
hd_case_number='*Waiting' hd_case_number='Waiting'
else: else:
hd_case_number=hd_case.number hd_case_number=hd_case.number
hd_case_state=hd_case.state hd_case_state=hd_case.state
if hd_case_state=='completed': if hd_case_state=='completed':
visit_color='#99ff99' visit_color='#99ff99'
hd_case_number+=" (เสร็จสิ้น)"
elif hd_case_state=='in_progress': elif hd_case_state=='in_progress':
hd_case_number+=' (กำลังรักษา)' visit_color='#f9e37d'
pass
number=visit.number number=visit.number
if number=='/': if number=='/':
number='*Waiting' number='Waiting'
cycle=visit.cycle_id cycle=visit.cycle_id
patient=visit.patient_id patient=visit.patient_id
if not patient.active: if not patient.active:
@ -192,9 +189,9 @@ class VisitBoard(Model):
if visit.state=='cancelled': if visit.state=='cancelled':
visit_color='#dbdbdb', visit_color='#dbdbdb',
if visit.number=='/': if visit.number=='/':
number='*Cancelled' number='Cancelled'
else: else:
number+='*Cancelled' number+='Cancelled'
line={ line={
'number': number, 'number': number,
'hn_name': hn_name, 'hn_name': hn_name,
@ -214,6 +211,8 @@ class VisitBoard(Model):
'doctor_name': visit.doctor_id.name, 'doctor_name': visit.doctor_id.name,
'doctor_id': visit.doctor_id.id, 'doctor_id': visit.doctor_id.id,
'hd_case_number': hd_case_number, '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, 'hd_case_id': hd_case_id,
'visit_color': visit_color, 'visit_color': visit_color,
'date': visit_date, 'date': visit_date,
@ -227,7 +226,6 @@ class VisitBoard(Model):
'details5':'', 'details5':'',
'no': no, 'no': no,
'note': visit.note, 'note': visit.note,
'hd_case_state':HD_STATE.get(hd_case_state,''),
} }
lines.append(line) lines.append(line)
no+=1 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_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"), 'date_to': utils.date2thai(date_to,format='%(d)s %(Tm)s %(By)s',lang="th_TH2"),
} }
#set_active_user(user_id)
return data return data
def onchange_date(self,context={}): def onchange_date(self,context={}):

View File

@ -19,28 +19,10 @@
{{#if footer}} {{#if footer}}
<tr> <tr>
<td rowspan="3" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>สรุป</b></span></td> <td rowspan="3" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>สรุป</b></span></td>
<!--
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details1}}</b></td>
-->
</tr> </tr>
<!--
<tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details2}}</b></td>
</tr>
-->
<!--
<tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details3}}</b></td>
</tr>
-->
<tr> <tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details4}}</b></td> <td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details4}}</b></td>
</tr> </tr>
<!--
<tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details5}}</b></td>
</tr>
-->
{{else}} {{else}}
<tr style="background-color:{{visit_color}}"> <tr style="background-color:{{visit_color}}">
{{#if title}} {{#if title}}
@ -49,12 +31,17 @@
{{else}} {{else}}
<td style="background-color:{{cycle_color}};color:white;width:6%"><center>{{cycle_name}}</center></td> <td style="background-color:{{cycle_color}};color:white;width:6%"><center>{{cycle_name}}</center></td>
<td style="background-color:{{visit_color}}">{{no}}</td> <td style="background-color:{{visit_color}}">{{no}}</td>
<td style="background-color:{{visit_color}};width:8%"><a href="/ui#name=clinic_visit&active_id={{visit_id}}&mode=form">{{number}}</a></td> <td style="background-color:{{visit_color}};width:8%">
<a href="/ui#name=clinic_visit&active_id={{visit_id}}&mode=form">
{{#ifeq number "Waiting"}}
<span class="glyphicon glyphicon-arrow-right">&nbsp;{{number}}</span>
{{else}}
{{number}}
{{/ifeq}}
</a>
</td>
<td style="background-color:{{visit_color}}">{{hn_name}}</td> <td style="background-color:{{visit_color}}">{{hn_name}}</td>
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td> <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
<!--
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_branch&active_id={{branch_id}}&mode=form">{{branch_name}}</a></td>
-->
<td style="background-color:{{visit_color}}">{{patient_type}}</td> <td style="background-color:{{visit_color}}">{{patient_type}}</td>
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td> <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_department&active_id={{department_id}}&mode=form">{{department_name}}</a></td> <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_department&active_id={{department_id}}&mode=form">{{department_name}}</a></td>
@ -63,7 +50,35 @@
{{else}} {{else}}
<td style="background-color:{{visit_color}}">{{sickbed_name}}</td> <td style="background-color:{{visit_color}}">{{sickbed_name}}</td>
{{/if}} {{/if}}
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">{{hd_case_number}}</a></td> <td style="background-color:{{visit_color}}">
<a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">
{{#ifeq number "Waiting"}}
{{else}}
{{#ifeq number "Cancelled"}}
<!--
<span class="glyphicon glyphicon-thumbs-down">
-->
{{else}}
{{#ifeq hd_case_state "waiting_treatment"}}
<span class="glyphicon glyphicon-arrow-right">
{{else}}
{{#ifeq hd_case_state "in_progress"}}
<span class="glyphicon glyphicon-refresh">
{{else}}
{{#ifeq hd_case_state "cancelled"}}
<span class="glyphicon glyphicon-ban-cycle">
{{else}}
<span class="glyphicon glyphicon-ok">
{{/ifeq}}
{{/ifeq}}
{{/ifeq}}
{{hd_case_number}}
{{/ifeq}}
{{/ifeq}}
</span>
</a>
</td>
{{/if}} {{/if}}
</tr> </tr>
{{/if}} {{/if}}