diff --git a/netforce_clinic/actions/clinic_hd_case.xml b/netforce_clinic/actions/clinic_hd_case.xml
index d0caf61..3ac12b7 100644
--- a/netforce_clinic/actions/clinic_hd_case.xml
+++ b/netforce_clinic/actions/clinic_hd_case.xml
@@ -2,7 +2,7 @@
HD Cases
multi_view
clinic.hd.case
- [["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Completed",[["state","=","completed"]]],["In Completed",[["state","=","in_completed"]]]]
+ [["All",[]],["Draft",[["state","=","draft"]]],["Waiting Treatment",[["state","=","waiting_treatment"]]],["In Progress",[["state","=","in_progress"]]],["Waiting Payment",[["state","=","waiting_payment"]]],["Waiting Approval",[["state","=","waiting_approval"]]],["Completed",[["state","=","completed"]]],["Cancelled",[["state","=","cancelled"]]]]
list,form
clinic_menu
diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 1e6f27f..8733157 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -2,49 +2,49 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -86,7 +86,7 @@
-
+
@@ -103,13 +103,8 @@
-
-
-
-
-
-
-
+
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_list.xml b/netforce_clinic/layouts/clinic_hd_case_list.xml
index 5c887a3..5e65f04 100644
--- a/netforce_clinic/layouts/clinic_hd_case_list.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_list.xml
@@ -1,5 +1,6 @@
+
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index c88433f..049b162 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -13,8 +13,6 @@
-
-
-
diff --git a/netforce_clinic/layouts/clinic_visit_form.xml b/netforce_clinic/layouts/clinic_visit_form.xml
index 2f5eb79..033066d 100644
--- a/netforce_clinic/layouts/clinic_visit_form.xml
+++ b/netforce_clinic/layouts/clinic_visit_form.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/netforce_clinic/models/address.py b/netforce_clinic/models/address.py
index c430cb2..7ba6a76 100644
--- a/netforce_clinic/models/address.py
+++ b/netforce_clinic/models/address.py
@@ -1,4 +1,5 @@
from netforce.model import Model, fields
+from pprint import pprint
class Address(Model):
_inherit="address"
@@ -7,5 +8,9 @@ class Address(Model):
"patient_id": fields.Many2One("clinic.patient","Patient"),
"staff_id": fields.Many2One("clinic.staff","Staff"),
}
+
+ def write(self,ids,vals,**kw):
+ pprint(vals)
+ super().write(ids,vals,**kw)
Address.register()
diff --git a/netforce_clinic/models/department.py b/netforce_clinic/models/department.py
index 54475f8..0101262 100644
--- a/netforce_clinic/models/department.py
+++ b/netforce_clinic/models/department.py
@@ -4,6 +4,7 @@ from netforce.access import get_active_company
class Department(Model):
_name="clinic.department"
_string="Department"
+ _key=['code']
_fields={
"name": fields.Char("Name",required=True,search=True),
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index b5b6194..5a89b5e 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -65,27 +65,32 @@ class HDCase(Model):
}
return vals
+ def _get_patient_type(self,ids,context={}):
+ res={}
+ for obj in self.browse(ids):
+ patient=obj.patient_id
+ res[obj.id]=patient.type
+ return res
+
_fields={
"number": fields.Char("Number",required=True,search=True),
- "time_start": fields.DateTime("Time Start",required=True,search=True),
- "time_stop": fields.DateTime("Time Stop",required=True,search=True),
+ "ref": fields.Char("Ref",search=True),
+ "time_start": fields.DateTime("Start Time",required=True,search=True),
+ "time_stop": fields.DateTime("Finish Time",required=True,search=True),
"date": fields.Date("Date",required=True,search=True),
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
+ "patient_type": fields.Selection([("sc","Social Security"),("uc","UC"),("others","Others")],"Service Type",function="_get_patient_type"),
+ "vascular_acc": fields.Selection([("shunt","Shunt"),("graft","Graft"),("pem_cath","Pem Cath"),('temp_cash','Temp Cath')],"Vascular Ac."),
"nurse_id": fields.Many2One("clinic.staff","Approve By", domain=[['type','=','nurse']]),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
- "wh_start": fields.Float("Wt.Kg start"),
- "wh_stop": fields.Float("Wt.Kg stop"),
- "bp_start": fields.Integer("BP mmHG start"),
- "per_bp_start": fields.Integer("/Per start"),
- "bp_stop": fields.Integer("BP mmHG stop"),
- "per_bp_stop": fields.Integer("/Per stop"),
- "epo_tn" : fields.Char("EpoTn (Drug name)"),
- "epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
- "hct": fields.Integer("HCT % (<40)"),
- "hct_msg" : fields.Char("HCT message"),
+ "wt_kg": fields.Float("Wt.kg."),
+ "bp": fields.Integer("BP"),
+ "mm_hg": fields.Integer("mmHG"),
+ "hct": fields.Integer("Hct%(<40)"),
+ "hct_msg" : fields.Char(""),
"check_goverment_pay" : fields.Boolean("The Government Pay"),
"check_personal_pay" : fields.Boolean("Pay yourself"),
- "state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
+ "state": fields.Selection([("draft","Draft"),('waiting_treatment','Waiting Treatment'),("in_progress","In Progress"),('waiting_approval','Waiting Approval'),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("cancelled","Cancelled")],"Status",required=True),
"dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
"staffs": fields.One2Many("clinic.hd.case.staff","hd_case_id","Staffs"),
@@ -96,7 +101,7 @@ class HDCase(Model):
"payments": fields.One2Many("account.payment","related_id","Payments"),
"payment_lines": fields.One2Many("clinic.payment","hd_case_id","Payment Lines"),
'visit_id': fields.Many2One("clinic.visit", "Visit"),
- 'duration': fields.Integer("Duration (hrs)",function="get_hrs"),
+ 'duration': fields.Integer("Duration(Hours)",function="get_hrs"),
"total": fields.Float("Total",function="_get_total",readonly=True,function_multi=True),
"fee_amount": fields.Float("Fee",function="_get_total",readonly=True,function_multi=True),
"mdc_amount": fields.Float("Medicine",function="_get_total",readonly=True,function_multi=True),
@@ -140,6 +145,9 @@ class HDCase(Model):
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
+ 'wt_kg': 0.0,
+ 'bp': 0,
+ 'mm_hg': 0,
'hct': 0,
'hct_msg': "สามารถเบิกค่ายาสูงสุดไม่เกิน 1,125บาท ต่อ สัปดาห์",
'fee_paid': False,
@@ -501,7 +509,7 @@ class HDCase(Model):
def discontinue(self,ids,context={}):
obj=self.browse(ids)[0]
# TODO pop to note
- obj.write({"state":"in_completed"})
+ obj.write({"state":"cancelled"})
def update_usetime(self,ids,context={}):
for obj in self.browse(ids):
diff --git a/netforce_clinic/models/hd_case_discont.py b/netforce_clinic/models/hd_case_discont.py
index 6758d34..d953e13 100644
--- a/netforce_clinic/models/hd_case_discont.py
+++ b/netforce_clinic/models/hd_case_discont.py
@@ -25,7 +25,7 @@ class HDCaseDiscont(Model):
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
hd_case.write({
'note': obj.note,
- 'state': 'in_completed',
+ 'state': 'cancelled',
})
return {
'next': {
diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py
index 55fe65b..04987dd 100644
--- a/netforce_clinic/models/patient.py
+++ b/netforce_clinic/models/patient.py
@@ -132,6 +132,7 @@ class Patient(Model):
address_id=get_model('address').create({
'type': 'shipping',
'partner_id': partner_id,
+ 'patient_id': obj.id, #XXX
'address': 'your address',
'address2': 'your address2',
'city': 'your city',
@@ -181,6 +182,7 @@ class Patient(Model):
addr=obj.addresses[0]
get_model("address").browse(addr.id).write({
'partner_id': partner_id,
+ 'patient_id': obj.id,
})
else:
if vals.get("addresses"):
@@ -192,14 +194,13 @@ class Patient(Model):
})
del vals['addresses']
print("create address for %s"%obj.name, ' ', addr_vals)
-
if obj.rm_remain_visit:
visit_ids=get_model('clinic.visit').search([['patient_id','=',obj.id],['state','=','draft']])
get_model('clinic.visit').delete(visit_ids)
print('remove visit auto %s'%visit_ids)
super().write(ids,vals,**kw)
- def name_get(self,ids,context={}):
+ def _name_get(self,ids,context={}):
vals=[]
for obj in self.browse(ids):
name="%s %s %s"%(obj.number,obj.name, obj.hn)
diff --git a/netforce_clinic/models/visit.py b/netforce_clinic/models/visit.py
index 3d3732d..3f4d63f 100644
--- a/netforce_clinic/models/visit.py
+++ b/netforce_clinic/models/visit.py
@@ -28,8 +28,8 @@ class Visit(Model):
_fields={
"number": fields.Char("Number",required=True,search=True),
- "time_start": fields.DateTime("Time Start",required=True),
- "time_stop": fields.DateTime("Time Stop",required=True),
+ "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),
"doctor_id": fields.Many2One("clinic.staff","Doctor", domain=[['type','=','doctor']],search=True),
"nurse_id": fields.Many2One("clinic.staff","Confirm By", domain=[['type','=','nurse']],search=True),
@@ -97,7 +97,7 @@ class Visit(Model):
_order="sequence"
def confirm(self,ids,context={}):
- obj=self.browse(ids[0])
+ obj=self.browse(ids)[0]
number=obj.number
if number=="/" or not number:
number=self._get_number(context)
@@ -105,9 +105,12 @@ class Visit(Model):
'number': number,
'state': 'confirmed',
}
+ user_id=get_active_user()
+ staff=get_model("clinic.staff").search_browse([['user_id','=',user_id]])
+ if staff:
+ vals['nurse_id']=staff[0].id
obj.write(vals)
hd_case_obj=get_model("clinic.hd.case")
- obj=self.browse(ids)[0]
vals={
'patient_id': obj.patient_id.id,
'nurse_id': obj.nurse_id.id,
@@ -119,7 +122,7 @@ class Visit(Model):
'lines':[],
'dialyzers': [],
'staffs': [],
- 'state': 'draft',
+ 'state': 'waiting_treatment',
}
# use exist hd_case (in case set to draft)
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index e730caa..0c460a0 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,5 +1,10 @@
=====
import payment from government
+ - read file
+ xml
+ - uc
+ excel
+ - social security
======
bug: