visit board
parent
97cea74246
commit
fd6fe56294
|
@ -1,7 +1,7 @@
|
||||||
<board>
|
<board>
|
||||||
<hpanel>
|
<hpanel>
|
||||||
<widget action="clinic_visit_widget" string="Current Visit" span="12"/>
|
<widget action="clinic_visit_widget" string="Current Visit" span="12"/>
|
||||||
<widget action="clinic_recent_patient_widget" string="Recent Patient"/>
|
<!--<widget action="clinic_recent_patient_widget" string="Recent Patient"/>-->
|
||||||
<widget action="clinic_cycle_widget" string="Average Cycle"/>
|
<!--<widget action="clinic_cycle_widget" string="Average Cycle"/>-->
|
||||||
</hpanel>
|
</hpanel>
|
||||||
</board>
|
</board>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<item string="Visits">
|
<item string="Visits">
|
||||||
<item string="Visits" action="clinic_visit"/>
|
<item string="Visits" action="clinic_visit"/>
|
||||||
<item string="Visit Board" action="clinic_visit_board"/>
|
<item string="Visit Board" action="clinic_visit_board"/>
|
||||||
<item string="Generate Visit" action="clinic_gen_visit_form"/>
|
<!--<item string="Generate Visit" action="clinic_gen_visit_form"/>-->
|
||||||
</item>
|
</item>
|
||||||
<item string="HD Cases">
|
<item string="HD Cases">
|
||||||
<item string="HD Cases" action="clinic_hd_case"/>
|
<item string="HD Cases" action="clinic_hd_case"/>
|
||||||
|
|
|
@ -3,4 +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">
|
||||||
|
<button string="Make an appointment" method="make_visit" span="2" icon="calendar" type="success" size="small"/>
|
||||||
|
</group>
|
||||||
|
<group span="2" columns="1">
|
||||||
|
<button string="Visit Planning" action="clinic_gen_visit_form" span="2" icon="arrow-right" type="default" size="small"/>
|
||||||
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start" onchange="onchange_datefrom"/>
|
<field name="time_start" onchange="onchange_datefrom"/>
|
||||||
<field name="department_id"/>
|
|
||||||
<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"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="patient_id" onchange="onchange_patient"/>
|
<field name="patient_id" onchange="onchange_patient"/>
|
||||||
|
|
|
@ -28,6 +28,7 @@ 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),
|
||||||
|
@ -159,6 +160,7 @@ 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,
|
||||||
|
|
|
@ -8,7 +8,17 @@ from netforce.access import get_active_company
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
DRT=5
|
DRT=0
|
||||||
|
HD_STATE={
|
||||||
|
"draft":"Draft",
|
||||||
|
'waiting_treatment':'Waiting Treatment',
|
||||||
|
"in_progress":"In Progress",
|
||||||
|
"completed":"Finish Treatment",
|
||||||
|
'paid':'Paid',
|
||||||
|
"waiting_payment":"Waiting Payment",
|
||||||
|
"discountinued":"Discountinued",
|
||||||
|
"cancelled":"Cancelled"
|
||||||
|
}
|
||||||
|
|
||||||
class VisitBoard(Model):
|
class VisitBoard(Model):
|
||||||
_name="clinic.visit.board"
|
_name="clinic.visit.board"
|
||||||
|
@ -60,6 +70,7 @@ class VisitBoard(Model):
|
||||||
'patient_id': None,
|
'patient_id': None,
|
||||||
'patient_name': '',
|
'patient_name': '',
|
||||||
'patient_type': '',
|
'patient_type': '',
|
||||||
|
'patient_type_id': None,
|
||||||
'doctor_name': '',
|
'doctor_name': '',
|
||||||
'doctor_id': None,
|
'doctor_id': None,
|
||||||
'hd_case_number': '',
|
'hd_case_number': '',
|
||||||
|
@ -67,7 +78,9 @@ class VisitBoard(Model):
|
||||||
'success_color': '',
|
'success_color': '',
|
||||||
'date':'',
|
'date':'',
|
||||||
'title': True,
|
'title': True,
|
||||||
|
'footer': False,
|
||||||
'details':'',
|
'details':'',
|
||||||
|
'hd_case_state': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
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'])}
|
||||||
|
@ -76,29 +89,38 @@ class VisitBoard(Model):
|
||||||
for visit in get_model("clinic.visit").search_browse(dom):
|
for visit in get_model("clinic.visit").search_browse(dom):
|
||||||
hd_case_id=None
|
hd_case_id=None
|
||||||
hd_case_number=''
|
hd_case_number=''
|
||||||
|
hd_case_state=''
|
||||||
|
visit_color=''
|
||||||
if visit.hd_cases:
|
if visit.hd_cases:
|
||||||
hd_case=visit.hd_cases[0]
|
hd_case=visit.hd_cases[0]
|
||||||
hd_case_id=hd_case.id,
|
hd_case_id=hd_case.id,
|
||||||
hd_case_number=hd_case.number,
|
if hd_case.number=='/':
|
||||||
|
hd_case_number='*รอการรรักษา'
|
||||||
|
else:
|
||||||
|
hd_case_number=hd_case.number
|
||||||
|
hd_case_state=hd_case.state
|
||||||
|
if hd_case_state=='completed':
|
||||||
|
visit_color='#99ff99'
|
||||||
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
|
||||||
visit_date=visit.visit_date
|
visit_date=visit.visit_date
|
||||||
visit_color=''
|
#if visit.state=='confirmed':
|
||||||
if visit.state=='confirmed':
|
#visit_color='#99ff99'
|
||||||
visit_color='#99ff99'
|
#elif visit.state=='cancelled':
|
||||||
elif visit.state=='cancelled':
|
#visit_color='#D84B4B',
|
||||||
visit_color='#D84B4B',
|
|
||||||
line={
|
line={
|
||||||
'number': number,
|
'number': number,
|
||||||
'visit_id': visit.id,
|
'visit_id': visit.id,
|
||||||
|
'sickbed_name': visit.sickbed_id.name or "",
|
||||||
'cycle_name': cycle.name,
|
'cycle_name': cycle.name,
|
||||||
'cycle_color': cycle.color,
|
'cycle_color': cycle.color,
|
||||||
'patient_name': patient.name,
|
'patient_name': patient.name,
|
||||||
'patient_id': patient.id,
|
'patient_id': patient.id,
|
||||||
'patient_type': patient.type_id.name or "",
|
'patient_type': patient.type_id.name or "",
|
||||||
|
'patient_type_id': patient.type_id.id or None,
|
||||||
'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,
|
||||||
|
@ -106,8 +128,11 @@ class VisitBoard(Model):
|
||||||
'visit_color': visit_color,
|
'visit_color': visit_color,
|
||||||
'date': visit_date,
|
'date': visit_date,
|
||||||
'title': False,
|
'title': False,
|
||||||
|
'footer': False,
|
||||||
'details':'',
|
'details':'',
|
||||||
'no': no,
|
'no': no,
|
||||||
|
'note': visit.note,
|
||||||
|
'hd_case_state':HD_STATE.get(hd_case_state,''),
|
||||||
}
|
}
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
no+=1
|
no+=1
|
||||||
|
@ -119,17 +144,30 @@ class VisitBoard(Model):
|
||||||
|
|
||||||
dates=[]
|
dates=[]
|
||||||
index=0
|
index=0
|
||||||
|
total_qty=0
|
||||||
|
count=0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
date=line['date']
|
date=line['date']
|
||||||
|
if not date:
|
||||||
|
continue
|
||||||
if date not in dates:
|
if date not in dates:
|
||||||
line=empty_line.copy()
|
count=0
|
||||||
total_qty=0
|
total_qty=0
|
||||||
|
line=empty_line.copy()
|
||||||
for qty in types[date].values():
|
for qty in types[date].values():
|
||||||
total_qty+=qty
|
total_qty+=qty
|
||||||
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"),
|
||||||
line['details']='รวม %s: %s'%(total_qty,', '.join('%s %s'%(patient_types[k],v) for k,v in types[date].items()))
|
|
||||||
lines.insert(index,line)
|
lines.insert(index,line)
|
||||||
dates.append(date)
|
dates.append(date)
|
||||||
|
if count==total_qty:
|
||||||
|
index+=1
|
||||||
|
# footer
|
||||||
|
line=empty_line.copy()
|
||||||
|
line['details']='รวม %s: %s'%(total_qty,', '.join('%s %s'%(patient_types[k],v) for k,v in types[date].items()))
|
||||||
|
line['footer']=True
|
||||||
|
line['title']=False
|
||||||
|
lines.insert(index,line)
|
||||||
|
count+=1
|
||||||
index+=1
|
index+=1
|
||||||
|
|
||||||
has_duration=False
|
has_duration=False
|
||||||
|
@ -155,5 +193,13 @@ class VisitBoard(Model):
|
||||||
data['date_from']="%s-%s-01"%(year,month)
|
data['date_from']="%s-%s-01"%(year,month)
|
||||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def make_visit(self,ids,context={}):
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'clinic_visit',
|
||||||
|
'mode': 'form',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VisitBoard.register()
|
VisitBoard.register()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<center>
|
<center>
|
||||||
|
<!--
|
||||||
<h2>ตารางเวร</h2>
|
<h2>ตารางเวร</h2>
|
||||||
<h3>
|
<h3>
|
||||||
{{parent_company_name}} {{company_name}}<br/>
|
{{parent_company_name}} {{company_name}}<br/>
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
{{date}}
|
{{date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h4>
|
</h4>
|
||||||
|
-->
|
||||||
</center>
|
</center>
|
||||||
<table class="table table-condensed table-striped">
|
<table class="table table-condensed table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<center>
|
<center>
|
||||||
|
<!--
|
||||||
<h2>ตารางนัดผู้ป่วย</h2>
|
<h2>ตารางนัดผู้ป่วย</h2>
|
||||||
<h3>
|
<h3>
|
||||||
{{parent_company_name}} {{company_name}}<br/>
|
{{parent_company_name}} {{company_name}}<br/>
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
{{date}}
|
{{date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h4>
|
</h4>
|
||||||
|
-->
|
||||||
</center>
|
</center>
|
||||||
<table class="table table-condensed table-striped">
|
<table class="table table-condensed table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -19,26 +21,34 @@
|
||||||
<th>ผู้ป่วย</th>
|
<th>ผู้ป่วย</th>
|
||||||
<th>สิทธ์</th>
|
<th>สิทธ์</th>
|
||||||
<th>แพทย์</th>
|
<th>แพทย์</th>
|
||||||
<th>HD Case</th>
|
<th>เตียง</th>
|
||||||
|
<th>บันทึกการรักษา</th>
|
||||||
<th>หมายเหตุ</th>
|
<th>หมายเหตุ</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each lines }}
|
{{#each lines }}
|
||||||
<tr style="background-color:{{visit_color}}">
|
{{#if footer}}
|
||||||
{{#if title}}
|
<tr>
|
||||||
<td style="background-color:#ddddff"><b>{{cycle_name}}</b></td>
|
<td colspan="9" style="text-align:right; background-color:#b9b9b7"><b>{{details}}</b></td>
|
||||||
<td colspan="8" style="text-align:right; background-color:#ddddff"><b>{{details}}</b></td>
|
</tr>
|
||||||
{{else}}
|
{{else}}
|
||||||
<td style="background-color:{{cycle_color}}">{{cycle_name}}</td>
|
<tr style="background-color:{{visit_color}}">
|
||||||
<td style="background-color:{{visit_color}}">{{no}}</td>
|
{{#if title}}
|
||||||
<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:#ddddff"><b>{{cycle_name}}</b></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:#ddddff" colspan="9"></td>
|
||||||
<td style="background-color:{{visit_color}}">{{patient_type}}</td>
|
{{else}}
|
||||||
<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:{{cycle_color}}">{{cycle_name}}</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}}">{{no}}</td>
|
||||||
<td style="background-color:{{visit_color}}">{{note}}</td>
|
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_visit&active_id={{visit_id}}&mode=form">{{number}}</a></td>
|
||||||
{{/if}}
|
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
|
||||||
</tr>
|
<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}}">{{sickbed_name}}</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}}
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
|
|
Loading…
Reference in New Issue