schedule board
parent
e642ed021a
commit
6e39dbb31c
|
@ -0,0 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Schedule Board</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.schedule.board</field>
|
||||
<field name="report_template">schedule_board</field>
|
||||
<field name="report_template_xls">schedule_board</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -31,7 +31,10 @@
|
|||
<item string="Cycle Items" action="clinic_cycle_item"/>
|
||||
<item string="Cycle Dialy" action="clinic_cycle_dialy"/>
|
||||
</item>
|
||||
<item string="Schedules" action="clinic_schedule">
|
||||
<item string="Schedules" action="clinic_schedule"/>
|
||||
<item string="Schedules Board" action="clinic_schedule_board"/>
|
||||
</item>
|
||||
<item string="Visits">
|
||||
<item string="Visits" action="clinic_visit"/>
|
||||
<item string="Visit Board" action="clinic_visit_board"/>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<form model="clinic.schedule.board">
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
</form>
|
|
@ -18,6 +18,7 @@
|
|||
<field name="cycle_id"/>
|
||||
<field name="nurse_id" onchange="onchange_nurse"/>
|
||||
<field name="level_id"/>
|
||||
<field name="note"/>
|
||||
<field name="cycle_item_id" readonly="1"/>
|
||||
</list>
|
||||
</field>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
|
@ -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()
|
||||
|
|
|
@ -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,
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,40 @@
|
|||
<center>
|
||||
<h2>ตารางเวร</h2>
|
||||
<h3>
|
||||
{{parent_company_name}} {{company_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{#if has_duration}}
|
||||
ระหว่างวันที่ {{date_from}} ถึง {{date_to}}
|
||||
{{else}}
|
||||
{{date}}
|
||||
{{/if}}
|
||||
</h4>
|
||||
</center>
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th>รอบ</th>
|
||||
<th>#</th>
|
||||
<th>ชื่อ</th>
|
||||
<th>ตำแหน่ง</th>
|
||||
<th>หมายเหตุ</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines}}
|
||||
<tr>
|
||||
{{#if title}}
|
||||
<td style="background-color:#ddddff"><a href="/ui#name=clinic_schedule&active_id={{schedule_id}}&mode=form">{{schedule_name}}</a></td>
|
||||
<td style="background-color:#ddddff" colspan="5"></td>
|
||||
{{else}}
|
||||
<td style="background-color:{{cycle_color}}">{{cycle_name}}</td>
|
||||
<td>{{no}}</td>
|
||||
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{nurse_id}}&mode=form">{{nurse_name}}</a></td>
|
||||
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff_level&active_id={{level_id}}&mode=form">{{level_name}}</a></td>
|
||||
<td>{{note}}</td>
|
||||
{{/if}}
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
|
@ -26,15 +26,15 @@
|
|||
{{#each lines }}
|
||||
<tr style="background-color:{{visit_color}}">
|
||||
{{#if title}}
|
||||
<td style="background-color:{{cycle_color}}"><b>{{cycle_name}}</b></td>
|
||||
<td colspan="7" style="text-align:right;"><b>{{details}}</b></td>
|
||||
<td style="background-color:#ddddff"><b>{{cycle_name}}</b></td>
|
||||
<td colspan="8" style="text-align:right; background-color:#ddddff"><b>{{details}}</b></td>
|
||||
{{else}}
|
||||
<td style="background-color:{{cycle_color}}">{{cycle_name}}</td>
|
||||
<td style="background-color:{{visit_color}}">{{no}}</td>
|
||||
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_visit&active_id={{visit_id}}&mode=form">{{number}}</a></td>
|
||||
<td style="background-color:{{visit_color}}">{{patient_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}}">{{patient_type}}</td>
|
||||
<td style="background-color:{{visit_color}}">{{doctor_name}}</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_hd_case&active_id={{hd_case_id}}&mode=form">{{hd_case_number}}</a></td>
|
||||
<td style="background-color:{{visit_color}}">{{note}}</td>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue