diff --git a/netforce_clinic/layouts/clinic_board.xml b/netforce_clinic/layouts/clinic_board.xml
index e46937e..48b30f0 100644
--- a/netforce_clinic/layouts/clinic_board.xml
+++ b/netforce_clinic/layouts/clinic_board.xml
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index 919c1de..bf00136 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -36,7 +36,7 @@
-
-
+
-
diff --git a/netforce_clinic/layouts/clinic_visit_board.xml b/netforce_clinic/layouts/clinic_visit_board.xml
index 466c99e..41c21d7 100644
--- a/netforce_clinic/layouts/clinic_visit_board.xml
+++ b/netforce_clinic/layouts/clinic_visit_board.xml
@@ -3,4 +3,10 @@
+
+
+
+
+
+
diff --git a/netforce_clinic/layouts/clinic_visit_form.xml b/netforce_clinic/layouts/clinic_visit_form.xml
index bc1d363..aaa842c 100644
--- a/netforce_clinic/layouts/clinic_visit_form.xml
+++ b/netforce_clinic/layouts/clinic_visit_form.xml
@@ -13,8 +13,9 @@
-
+
+
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index c5196a2..908e602 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -28,6 +28,7 @@ class Visit(Model):
_fields={
"number": fields.Char("Number",required=True,search=True),
+ 'sickbed_id': fields.Many2One("clinic.sickbed","Sickbed"),
"time_start": fields.DateTime("Start Time",required=True),
"time_stop": fields.DateTime("End Time",required=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,
'nurse_id': obj.nurse_id.id,
'department_id': obj.department_id.id,
+ 'sickbed_id': obj.sickbed_id.id,
'time_start': obj.time_start,
'time_stop': obj.time_stop,
'cycle_id' : obj.cycle_id.id,
diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py
index 6bf83e7..03df669 100644
--- a/netforce_clinic/models/visit_board.py
+++ b/netforce_clinic/models/visit_board.py
@@ -8,7 +8,17 @@ from netforce.access import get_active_company
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):
_name="clinic.visit.board"
@@ -60,6 +70,7 @@ class VisitBoard(Model):
'patient_id': None,
'patient_name': '',
'patient_type': '',
+ 'patient_type_id': None,
'doctor_name': '',
'doctor_id': None,
'hd_case_number': '',
@@ -67,7 +78,9 @@ class VisitBoard(Model):
'success_color': '',
'date':'',
'title': True,
+ 'footer': False,
'details':'',
+ 'hd_case_state': '',
}
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):
hd_case_id=None
hd_case_number=''
+ hd_case_state=''
+ visit_color=''
if visit.hd_cases:
hd_case=visit.hd_cases[0]
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
if number=='/':
- number='รอการรรักษา'
+ number='*รอการยืนยัน'
cycle=visit.cycle_id
patient=visit.patient_id
visit_date=visit.visit_date
- visit_color=''
- if visit.state=='confirmed':
- visit_color='#99ff99'
- elif visit.state=='cancelled':
- visit_color='#D84B4B',
+ #if visit.state=='confirmed':
+ #visit_color='#99ff99'
+ #elif visit.state=='cancelled':
+ #visit_color='#D84B4B',
line={
'number': number,
'visit_id': visit.id,
+ 'sickbed_name': visit.sickbed_id.name or "",
'cycle_name': cycle.name,
'cycle_color': cycle.color,
'patient_name': patient.name,
'patient_id': patient.id,
'patient_type': patient.type_id.name or "",
+ 'patient_type_id': patient.type_id.id or None,
'doctor_name': visit.doctor_id.name,
'doctor_id': visit.doctor_id.id,
'hd_case_number': hd_case_number,
@@ -106,8 +128,11 @@ class VisitBoard(Model):
'visit_color': visit_color,
'date': visit_date,
'title': False,
+ 'footer': False,
'details':'',
'no': no,
+ 'note': visit.note,
+ 'hd_case_state':HD_STATE.get(hd_case_state,''),
}
lines.append(line)
no+=1
@@ -119,17 +144,30 @@ class VisitBoard(Model):
dates=[]
index=0
+ total_qty=0
+ count=0
for line in lines:
date=line['date']
+ if not date:
+ continue
if date not in dates:
- line=empty_line.copy()
+ count=0
total_qty=0
+ line=empty_line.copy()
for qty in types[date].values():
total_qty+=qty
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)
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
has_duration=False
@@ -155,5 +193,13 @@ class VisitBoard(Model):
data['date_from']="%s-%s-01"%(year,month)
data['date_to']="%s-%s-%s"%(year,month,total_day)
return data
+
+ def make_visit(self,ids,context={}):
+ return {
+ 'next': {
+ 'name': 'clinic_visit',
+ 'mode': 'form',
+ }
+ }
VisitBoard.register()
diff --git a/netforce_clinic/templates/schedule_board.hbs b/netforce_clinic/templates/schedule_board.hbs
index ed77bae..10702d9 100644
--- a/netforce_clinic/templates/schedule_board.hbs
+++ b/netforce_clinic/templates/schedule_board.hbs
@@ -1,4 +1,5 @@
+
diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs
index b9940c2..0f65036 100644
--- a/netforce_clinic/templates/visit_board.hbs
+++ b/netforce_clinic/templates/visit_board.hbs
@@ -1,4 +1,5 @@
+