visit board
parent
3f1845cc06
commit
15e6f3d834
|
@ -27,7 +27,7 @@
|
||||||
<field name="hd_mode" span="2"/>
|
<field name="hd_mode" span="2"/>
|
||||||
<field name="hd_acc" span="2"/>
|
<field name="hd_acc" span="2"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<field name="wt_start" span="2"/>
|
<field name="wt_start" span="2" attrs='{"required":[["state","=","waiting_treatment"]]}'/>
|
||||||
<field name="wt_stop" span="2"/>
|
<field name="wt_stop" span="2"/>
|
||||||
<field name="hct" span="2" onchange="onchange_hct"/>
|
<field name="hct" span="2" onchange="onchange_hct"/>
|
||||||
<field name="hct_msg" span="4" readonly="1"/>
|
<field name="hct_msg" span="4" readonly="1"/>
|
||||||
|
|
|
@ -6,4 +6,7 @@
|
||||||
</head>
|
</head>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="available" readonly="1"/>
|
<field name="available" readonly="1"/>
|
||||||
|
<related>
|
||||||
|
<field name="hd_cases"/>
|
||||||
|
</related>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
<field name="date_from" span="2"/>
|
<field name="date_from" span="2"/>
|
||||||
<field name="date_to" span="2"/>
|
<field name="date_to" span="2"/>
|
||||||
<field name="patient_id" span="2"/>
|
<field name="patient_id" span="2"/>
|
||||||
<group span="2" columns="1">
|
<group span="1" columns="1">
|
||||||
<button string="Make an appointment" method="make_visit" span="2" icon="calendar" type="success" size="small"/>
|
<button string="New Visit" method="make_visit" span="1" icon="plus" type="success" size="small"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="2" columns="1">
|
<group span="2" columns="1">
|
||||||
<button string="Visit Planning" action="clinic_gen_visit_form" span="2" icon="arrow-right" type="default" size="small"/>
|
<button string="Make An Appointment" action="clinic_gen_visit_form" span="2" icon="calendar" type="default" size="small"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start" onchange="onchange_datefrom"/>
|
<field name="time_start" onchange="onchange_datefrom"/>
|
||||||
<field name="cycle_id" onchange="onchange_cycle" required="1"/>
|
<field name="cycle_id" onchange="onchange_cycle" required="1"/>
|
||||||
<field name="sickbed_id" domain="[['available','=',true]]" attrs='{"required":[["state","=","pending"]]}'/>
|
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
|
|
|
@ -28,7 +28,6 @@ class Visit(Model):
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed"),
|
|
||||||
"time_start": fields.DateTime("Start Time",required=True),
|
"time_start": fields.DateTime("Start Time",required=True),
|
||||||
"time_stop": fields.DateTime("End Time",required=True),
|
"time_stop": fields.DateTime("End Time",required=True),
|
||||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||||
|
@ -160,7 +159,6 @@ class Visit(Model):
|
||||||
'patient_id': obj.patient_id.id,
|
'patient_id': obj.patient_id.id,
|
||||||
'nurse_id': obj.nurse_id.id,
|
'nurse_id': obj.nurse_id.id,
|
||||||
'department_id': obj.department_id.id,
|
'department_id': obj.department_id.id,
|
||||||
'sickbed_id': obj.sickbed_id.id,
|
|
||||||
'time_start': obj.time_start,
|
'time_start': obj.time_start,
|
||||||
'time_stop': obj.time_stop,
|
'time_stop': obj.time_stop,
|
||||||
'cycle_id' : obj.cycle_id.id,
|
'cycle_id' : obj.cycle_id.id,
|
||||||
|
|
|
@ -86,40 +86,64 @@ class VisitBoard(Model):
|
||||||
|
|
||||||
patient_types={t['id']:t['name'] for t in get_model("clinic.patient.type").search_read([[]],['name'])}
|
patient_types={t['id']:t['name'] for t in get_model("clinic.patient.type").search_read([[]],['name'])}
|
||||||
cycle_names={t['id']:t['name'] for t in get_model("clinic.cycle").search_read([[]],['name'])}
|
cycle_names={t['id']:t['name'] for t in get_model("clinic.cycle").search_read([[]],['name'])}
|
||||||
|
total_wait=0
|
||||||
|
total_done=0
|
||||||
|
total_cancel=0
|
||||||
types={}
|
types={}
|
||||||
cycles={}
|
cycles={}
|
||||||
no=1
|
no=1
|
||||||
for visit in get_model("clinic.visit").search_browse(dom):
|
for visit in get_model("clinic.visit").search_browse(dom):
|
||||||
|
if visit.state in ('draft','pending'):
|
||||||
|
total_wait+=1
|
||||||
|
elif visit.state in ('confirmed'):
|
||||||
|
total_done+=1
|
||||||
|
else:
|
||||||
|
total_cancel+=1
|
||||||
|
|
||||||
hd_case_id=None
|
hd_case_id=None
|
||||||
hd_case_number=''
|
hd_case_number=''
|
||||||
hd_case_state=''
|
hd_case_state=''
|
||||||
visit_color=''
|
visit_color=''
|
||||||
|
sickbed_name='N/A'
|
||||||
|
sickbed_id=None
|
||||||
if visit.hd_cases:
|
if visit.hd_cases:
|
||||||
hd_case=visit.hd_cases[0]
|
hd_case=visit.hd_cases[0]
|
||||||
|
sickbed_name=hd_case.sickbed_id.name or "N/A"
|
||||||
|
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='*รอการรรักษา'
|
hd_case_number='*รอการรรักษา'
|
||||||
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':
|
||||||
|
hd_case_number+=' (กำลังรักษา)'
|
||||||
|
|
||||||
number=visit.number
|
number=visit.number
|
||||||
if number=='/':
|
if number=='/':
|
||||||
number='*รอการยืนยัน'
|
number='*รอการยืนยัน'
|
||||||
cycle=visit.cycle_id
|
cycle=visit.cycle_id
|
||||||
patient=visit.patient_id
|
patient=visit.patient_id
|
||||||
hn_name=patient.hn or ''
|
hn_name=patient.hn or '-'
|
||||||
|
|
||||||
visit_date=visit.visit_date
|
visit_date=visit.visit_date
|
||||||
#if visit.state=='confirmed':
|
if visit.state=='cancelled':
|
||||||
#visit_color='#99ff99'
|
visit_color='#dbdbdb',
|
||||||
#elif visit.state=='cancelled':
|
if visit.number=='/':
|
||||||
#visit_color='#D84B4B',
|
number='*(ยกเลิก)'
|
||||||
|
else:
|
||||||
|
number+='(ยกเลิก)'
|
||||||
line={
|
line={
|
||||||
'number': number,
|
'number': number,
|
||||||
'hn_name': hn_name,
|
'hn_name': hn_name,
|
||||||
'visit_id': visit.id,
|
'visit_id': visit.id,
|
||||||
'sickbed_name': visit.sickbed_id.name or "",
|
'sickbed_name': sickbed_name,
|
||||||
|
'sickbed_id': sickbed_id,
|
||||||
'cycle_name': cycle.name,
|
'cycle_name': cycle.name,
|
||||||
'cycle_color': cycle.color,
|
'cycle_color': cycle.color,
|
||||||
'patient_name': patient.name,
|
'patient_name': patient.name,
|
||||||
|
@ -170,13 +194,14 @@ class VisitBoard(Model):
|
||||||
line['cycle_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
|
line['cycle_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
|
||||||
lines.insert(index,line)
|
lines.insert(index,line)
|
||||||
dates.append(date)
|
dates.append(date)
|
||||||
if count==total_qty:
|
if count==total_qty and not obj.patient_id:
|
||||||
index+=1
|
index+=1
|
||||||
# footer
|
# footer
|
||||||
line=empty_line.copy()
|
line=empty_line.copy()
|
||||||
patient_str='[%s]'%', '.join('%s %s'%(patient_types[k],v) for k,v in types[date].items())
|
patient_str='[%s]'%', '.join('%s: %s'%(patient_types[k],v) for k,v in types[date].items())
|
||||||
cycle_str='[%s]'%', '.join('%s: %s'%(cycle_names[k],v) for k,v in cycles[date].items())
|
cycle_str='[%s]'%', '.join('%s: %s'%(cycle_names[k],v) for k,v in cycles[date].items())
|
||||||
line['details']='รวม %s: %s'%(total_qty,', '.join([cycle_str,patient_str]))
|
summary_str='[%s]'%', '.join(['รับไว้: %s'%total_wait,'จำหน่ายแล้ว: %s'%total_done, 'ยกเลิก: %s'%total_cancel])
|
||||||
|
line['details']='ทั้งหมด %s: %s'%(total_qty,', '.join([summary_str,cycle_str,patient_str]))
|
||||||
line['footer']=True
|
line['footer']=True
|
||||||
line['title']=False
|
line['title']=False
|
||||||
lines.insert(index,line)
|
lines.insert(index,line)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{{#each lines }}
|
{{#each lines }}
|
||||||
{{#if footer}}
|
{{#if footer}}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="10" style="text-align:right; background-color:#b9b9b7"><b>{{details}}</b></td>
|
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details}}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{else}}
|
{{else}}
|
||||||
<tr style="background-color:{{visit_color}}">
|
<tr style="background-color:{{visit_color}}">
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<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}}">{{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}}">{{sickbed_name}}</td>
|
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_sickbed&active_id={{sickbed_id}}&mode=form">{{sickbed_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}}"><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>
|
<td style="background-color:{{visit_color}}">{{note}}</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Loading…
Reference in New Issue