clean
parent
dacaa8c4b6
commit
c9c7944981
|
@ -1,6 +1,6 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="name">clinic_board</field>
|
<field name="name">clinic_board</field>
|
||||||
<field name="string">clinic board</field>
|
<field name="string">Clinic Board</field>
|
||||||
<field name="view_cls">board</field>
|
<field name="view_cls">board</field>
|
||||||
<field name="view_xml">clinic_board</field>
|
<field name="view_xml">clinic_board</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="string">HD Case</field>
|
<field name="string">HD Cases</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.hd.case</field>
|
<field name="model">clinic.hd.case</field>
|
||||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirm",[["state","=","corfirmed"]]],["Approved",[["state","=","approved"]]],["Validate",[["state","=","validate"]]],["Payment",[["state","=","payment"]]]]</field>
|
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirm",[["state","=","corfirmed"]]],["Approved",[["state","=","approved"]]],["Validated",[["state","=","validated"]]],["Paid",[["state","=","paid"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
||||||
<field name="modes">list,form</field>
|
<field name="modes">list,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<field name="string">Patients</field>
|
<field name="string">Patients</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.patient</field>
|
<field name="model">clinic.patient</field>
|
||||||
<field name="tabs">[["All",[]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","other"]]]]</field>
|
<field name="tabs">[["All",[]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","others"]]]]</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="string">Visit</field>
|
<field name="string">Visits</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.visit</field>
|
<field name="model">clinic.visit</field>
|
||||||
<field name="tabs">[["All",[]],["Pending",[["state","=","pending"]]],["Confirm",[["state","=","corfirmed"]]],["Canceled",[["state","=","canceled"]]]]</field>
|
<field name="tabs">[["All",[]],["Pending",[["state","=","pending"]]],["Confirmed",[["state","=","confirmed"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
||||||
<field name="modes">list,calendar,form</field>
|
<field name="modes">list,calendar,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -1,26 +1,33 @@
|
||||||
<form model="clinic.hd.case">
|
<form model="clinic.hd.case" attrs='{"readonly":[["state","in",["cancelled","approved","validated"]]]}' show_company="1">
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Journal Report" method="journal_report"/>
|
<item string="Journal Report" method="journal_report"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<separator string="HD Case Info"/>
|
<group span="6" columns="1">
|
||||||
<field name="number" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="number"/>
|
||||||
<field name="patient_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="date_start"/>
|
||||||
<field name="date_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="date_stop"/>
|
||||||
<field name="date_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
</group>
|
||||||
<field name="wh_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<group span="6" columns="1">
|
||||||
<field name="wh_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="patient_id" onchange="onchange_patient"/>
|
||||||
<field name="bp_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="doctor_id"/>
|
||||||
<field name="per_bp_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="nurse_id"/>
|
||||||
<field name="bp_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="department_id"/>
|
||||||
<field name="per_bp_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
</group>
|
||||||
<field name="hct" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<tabs>
|
||||||
<field name="doctor_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<tab string="Treatment Information">
|
||||||
<field name="nurse_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="wh_start"/>
|
||||||
<field name="department" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
|
<field name="wh_stop"/>
|
||||||
<field name="lines" nolabel="0" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
|
<field name="bp_start"/>
|
||||||
|
<field name="per_bp_start"/>
|
||||||
|
<field name="bp_stop"/>
|
||||||
|
<field name="per_bp_stop"/>
|
||||||
|
<field name="hct"/>
|
||||||
|
</tab>
|
||||||
|
</tabs>
|
||||||
|
<field name="lines" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="dialzer_id" onchange="onchange_dialyzer"/>
|
<field name="dialzer_id" onchange="onchange_dialyzer"/>
|
||||||
<field name="detail"/>
|
<field name="detail"/>
|
||||||
|
@ -33,29 +40,25 @@
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
<field name="lines_detail" nolabel="0" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
|
<field name="lines_detail" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="product_id" onchange="onchange_product"/>
|
<field name="product_id" onchange="onchange_product"/>
|
||||||
<field name="detail"/>
|
<field name="detail"/>
|
||||||
<field name="qty"/>
|
<field name="qty"/>
|
||||||
<field name="uom_id"/>
|
<field name="uom_id"/>
|
||||||
<field name="price"/>
|
<field name="price"/>
|
||||||
<field name="total"/>
|
<field name="total"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
<group attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
|
<field name="fee" span="3" offset="9"/>
|
||||||
<field name="fee" span="2" offset="7"/>
|
<field name="total" span="3" offset="9"/>
|
||||||
</group>
|
|
||||||
<group attrs='{"readonly":[["state","not in",["canceled","approved","validate"]]]}'>
|
|
||||||
<field name="fee" span="2" offset="9"/>
|
|
||||||
</group>
|
|
||||||
<field name="total" span="2" offset="9"/>
|
|
||||||
<field name="amount" span="2" offset="9"/>
|
<field name="amount" span="2" offset="9"/>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" method="confirmed" states="draft" />
|
<button string="Confirm" type="success" method="confirmed" states="draft" />
|
||||||
<button string="Approved" type="success" method="approved" states="confirmed"/>
|
<button string="Approved" type="success" method="approved" states="confirmed"/>
|
||||||
<button string="Validate" type="success" method="validate" states="approved" />
|
<button string="Validate" type="success" method="validate" states="approved" />
|
||||||
<button string="Canceled" type="danger" method="canceled" confirm="You are sure to canceled hd case"/>
|
<button string="Paid" type="success" method="paid" states="validated" />
|
||||||
|
<button string="Canceled" type="danger" method="cancelled" confirm="Are you sure to cancel this HD case?"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
<field name="invoices" click_action="view_invoice"/>
|
<field name="invoices" click_action="view_invoice"/>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
<field name="date_start"/>
|
<field name="date_start"/>
|
||||||
<field name="date_stop"/>
|
<field name="date_stop"/>
|
||||||
<field name="patient_id"/>
|
<field name="patient_id"/>
|
||||||
<field name="hct"/>
|
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="nurse_id"/>
|
<field name="nurse_id"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
<menu string="Clinic">
|
<menu string="Clinic">
|
||||||
<item string="Dashboard" action="clinic_board"/>
|
<item string="Dashboard" action="clinic_board"/>
|
||||||
<item string="Visit" action="clinic_visit"/>
|
<item string="Visits" action="clinic_visit"/>
|
||||||
<item string="HD Case Treatment" action="clinic_hd_case"/>
|
<item string="Treatments" action="clinic_hd_case"/>
|
||||||
<item string="Dialyzer" action="clinic_dialyzer"/>
|
|
||||||
<item string="Personal">
|
<item string="Personal">
|
||||||
<item string="Doctors" action="clinic_doctor"/>
|
<item string="Doctors" action="clinic_doctor"/>
|
||||||
<item string="Nurses" action="clinic_nurse"/>
|
<item string="Nurses" action="clinic_nurse"/>
|
||||||
<item string="Patients" action="clinic_patient"/>
|
<item string="Patients" action="clinic_patient"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item string="Reports">
|
||||||
|
<item string="Report1" action="report1"/>
|
||||||
|
</item>
|
||||||
|
<item string="Import Data">
|
||||||
|
<item string="Report1" action="report1"/>
|
||||||
|
</item>
|
||||||
<item string="Settings">
|
<item string="Settings">
|
||||||
|
<item string="Dialyzer" action="clinic_dialyzer"/>
|
||||||
<item string="Departments" action="clinic_department"/>
|
<item string="Departments" action="clinic_department"/>
|
||||||
<item string="Graduations" action="clinic_grade"/>
|
<item string="Graduations" action="clinic_grade"/>
|
||||||
<item string="Nationalities" action="clinic_nation"/>
|
<item string="Nationalities" action="clinic_nation"/>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
<field name="age"/>
|
<field name="age"/>
|
||||||
<field name="card_type"/>
|
<field name="card_type"/>
|
||||||
<field name="card_no"/>
|
<field name="card_no"/>
|
||||||
<field name="exp_date"/>
|
<field name="card_exp"/>
|
||||||
<field name="picture"/>
|
<field name="picture"/>
|
||||||
<field name="phone"/>
|
<field name="mobile"/>
|
||||||
<field name="email"/>
|
<field name="email"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<field name="grad_id"/>
|
<field name="grad_id"/>
|
||||||
<field name="weight"/>
|
<field name="weight"/>
|
||||||
<field name="height"/>
|
<field name="height"/>
|
||||||
<field name="mobile"/>
|
<field name="phone"/>
|
||||||
</group>
|
</group>
|
||||||
<separator string="Address Information"/>
|
<separator string="Address Information"/>
|
||||||
<field name="addresses" view="form_list"/>
|
<field name="addresses" view="form_list"/>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<calendar model="clinic.visit" states='pending' date_field="date" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"#ebff00":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
<calendar model="clinic.visit" states='pending' date_field="visit_date" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"#ebff00":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
||||||
<field name="patient_id"/>
|
<field name="patient_id"/>
|
||||||
<field name="cycle"/>
|
<field name="cycle"/>
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
<form model="clinic.visit">
|
<form model="clinic.visit">
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
<button string="Print" icon="print" action="print_visit"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Send Confirm visit"/>
|
<item string="Send Confirm visit"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="Visit">
|
<tab string="Visit">
|
||||||
<separator string="Visit Info"/>
|
<field name="number"/>
|
||||||
<field name="number"/>
|
<field name="department_id"/>
|
||||||
<field name="department"/>
|
<field name="visit_date"/>
|
||||||
<field name="visit_date"/>
|
<field name="cycle"/>
|
||||||
<field name="cycle"/>
|
<field name="patient_id" onchange="onchange_patient"/>
|
||||||
<field name="patient_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="doctor_id"/>
|
<field name="nurse_id"/>
|
||||||
<field name="nurse_id"/>
|
</tab>
|
||||||
</tab>
|
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" method="confirmed" states="pending" />
|
<button string="Confirm" type="success" method="confirm" states="pending" />
|
||||||
<button string="Canceled" type="danger" method="canceled" confirm="You are sure to canceled hd case"/>
|
<button string="Cancel" type="danger" method="cancel" confirm="Are you sure to cancel HD case?"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
<field name="comments"/>
|
<field name="comments"/>
|
||||||
</related>
|
</related>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -12,20 +12,20 @@ class HDcase(Model):
|
||||||
_multi_company=True
|
_multi_company=True
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
"patient_id": fields.Many2One("clinic.patient","Patients",required=True,search=True),
|
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||||
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=True,search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
|
||||||
"date_start": fields.DateTime("Date start",required=True,search=True),
|
"date_start": fields.DateTime("Date start",required=True,search=True),
|
||||||
"date_stop": fields.DateTime("Date stop",required=True,search=True),
|
"date_stop": fields.DateTime("Date stop",required=True,search=True),
|
||||||
"department": fields.Char("Department",required=False,search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
"wh_start": fields.Float("Wt.Kg start",required=True,search=True),
|
"wh_start": fields.Float("Wt.Kg start"),
|
||||||
"wh_stop": fields.Float("Wt.Kg stop",required=True,search=True),
|
"wh_stop": fields.Float("Wt.Kg stop"),
|
||||||
"bp_start": fields.Integer("BP mmHG start",required=True,search=True),
|
"bp_start": fields.Integer("BP mmHG start"),
|
||||||
"per_bp_start": fields.Integer("/Per start",required=True,search=True),
|
"per_bp_start": fields.Integer("/Per start"),
|
||||||
"bp_stop": fields.Integer("BP mmHG stop",required=True,search=True),
|
"bp_stop": fields.Integer("BP mmHG stop"),
|
||||||
"per_bp_stop": fields.Integer("/Per stop",required=True,search=True),
|
"per_bp_stop": fields.Integer("/Per stop"),
|
||||||
"hct": fields.Integer("HCT %",required=True,search=True),
|
"hct": fields.Integer("HCT %"),
|
||||||
"state": fields.Selection([("draft","Draft"),("approved","Approved"),("confirmed","Confirmed"),("validate","Validate"),("canceled","Canceled"),("payment","Payment")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("approved","Approved"),("confirmed","Confirmed"),("validated","Validated"),("cancelled","Cancelled"),("paid","Paid")],"Status",required=True),
|
||||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Details"),
|
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Details"),
|
||||||
"lines_detail": fields.One2Many("clinic.hd.case.line.detail","hd_case_id","Detail"),
|
"lines_detail": fields.One2Many("clinic.hd.case.line.detail","hd_case_id","Detail"),
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
|
@ -49,6 +49,25 @@ class HDcase(Model):
|
||||||
return num
|
return num
|
||||||
get_model("sequence").increment("sale_order")
|
get_model("sequence").increment("sale_order")
|
||||||
|
|
||||||
|
def _get_nurse(self,context={}):
|
||||||
|
user_id=get_active_user()
|
||||||
|
print("user_id ",user_id)
|
||||||
|
nurse_ids=get_model("clinic.nurse").search([['user_id','=',user_id]])
|
||||||
|
if nurse_ids:
|
||||||
|
return nurse_ids[0]
|
||||||
|
return None
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
"state": "draft",
|
||||||
|
"date_start": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
"date_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
'nurse_id': _get_nurse,
|
||||||
|
"number": _get_number,
|
||||||
|
"company_id": lambda *a: get_active_company(),
|
||||||
|
"fee": 1500,
|
||||||
|
}
|
||||||
|
_order="date_start desc,number desc"
|
||||||
|
|
||||||
def onchange_dialyzer(self,context={}):
|
def onchange_dialyzer(self,context={}):
|
||||||
data=context["data"]
|
data=context["data"]
|
||||||
path=context["path"]
|
path=context["path"]
|
||||||
|
@ -67,29 +86,31 @@ class HDcase(Model):
|
||||||
line["state"]=dialyzer.state
|
line["state"]=dialyzer.state
|
||||||
return data
|
return data
|
||||||
|
|
||||||
_defaults={
|
def onchange_patient(self,context={}):
|
||||||
"state": "draft",
|
data=context['data']
|
||||||
"date_start": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
patient_id=data['patient_id']
|
||||||
"date_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
hd_cases=self.search_browse([['patient_id','=',patient_id]])
|
||||||
"number": _get_number,
|
if hd_cases:
|
||||||
"company_id": lambda *a: get_active_company(),
|
hd_case=hd_cases[-1]
|
||||||
"fee": 1500,
|
data['doctor_id']=hd_case.doctor_id.id
|
||||||
}
|
data['department_id']=hd_case.department_id.id
|
||||||
_order="date_start desc,number desc"
|
else:
|
||||||
|
data['doctor_id']=None
|
||||||
|
data['department_id']=None
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def cancelled(self,ids,context={}):
|
||||||
def canceled(self,ids,context={}):
|
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"canceled"})
|
obj.write({"state":"cancelled"})
|
||||||
|
|
||||||
def confirmed(self,ids,context={}):
|
def confirmed(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"confirmed"})
|
obj.write({"state":"confirmed"})
|
||||||
|
|
||||||
def payment(self,ids,context={}):
|
def paid(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"payment"})
|
obj.write({"state":"paid"})
|
||||||
|
|
||||||
def approved(self,ids,context={}):
|
def approved(self,ids,context={}):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Patient(Model):
|
||||||
return res # -> {1: 30, 2: 45,.....}
|
return res # -> {1: 30, 2: 45,.....}
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Patient Type",required=False),
|
"type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("others","Others")],"Patient Type",required=False),
|
||||||
"number": fields.Char("Patient No.",required=True,search=True),
|
"number": fields.Char("Patient No.",required=True,search=True),
|
||||||
"name": fields.Char("Name",required=True,search=True),
|
"name": fields.Char("Name",required=True,search=True),
|
||||||
"reg_date": fields.Date("Register Date",required=False,search=True),
|
"reg_date": fields.Date("Register Date",required=False,search=True),
|
||||||
|
@ -36,9 +36,9 @@ class Patient(Model):
|
||||||
"height": fields.Float("Height (Kg)"),
|
"height": fields.Float("Height (Kg)"),
|
||||||
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True),
|
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True),
|
||||||
'card_no' : fields.Char("Card No."),
|
'card_no' : fields.Char("Card No."),
|
||||||
|
'card_exp' : fields.Date("Card Expire"),
|
||||||
"app_no": fields.Char("Application No."),
|
"app_no": fields.Char("Application No."),
|
||||||
"salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"),
|
"salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"),
|
||||||
'exp_date' : fields.Date("Expiry Date"),
|
|
||||||
"addresses": fields.One2Many("address","related_id","Addresses"),
|
"addresses": fields.One2Many("address","related_id","Addresses"),
|
||||||
"gender": fields.Selection([("male","Male"),("female","Female")],"Gender",required=False),
|
"gender": fields.Selection([("male","Male"),("female","Female")],"Gender",required=False),
|
||||||
"marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=False),
|
"marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=False),
|
||||||
|
@ -67,8 +67,6 @@ class Patient(Model):
|
||||||
#Healthcare
|
#Healthcare
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
"company_id": fields.Many2One("company","Company"),
|
"company_id": fields.Many2One("company","Company"),
|
||||||
"doctorsss": fields.Many2Many("clinic.doctor","Doctors"),
|
|
||||||
"nurses": fields.Many2Many("clinic.nurse","Nurses"),
|
|
||||||
"visits": fields.One2Many("clinic.visit","patient_id","Visits"),
|
"visits": fields.One2Many("clinic.visit","patient_id","Visits"),
|
||||||
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
|
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
|
||||||
}
|
}
|
||||||
|
@ -105,13 +103,6 @@ class Patient(Model):
|
||||||
}
|
}
|
||||||
_order="date desc,number desc"
|
_order="date desc,number desc"
|
||||||
|
|
||||||
def name_get(self,ids,context={}):
|
|
||||||
vals=[]
|
|
||||||
for obj in self.browse(ids):
|
|
||||||
name='%s %s'%(obj.first_name or "", obj.last_name or "")
|
|
||||||
vals.append((obj.id,name))
|
|
||||||
return vals
|
|
||||||
|
|
||||||
def void(self,ids,context={}):
|
def void(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"voided"})
|
obj.write({"state":"voided"})
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
import time
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.access import get_active_company
|
from netforce.access import get_active_company, get_active_user
|
||||||
|
|
||||||
class Visit(Model):
|
class Visit(Model):
|
||||||
_name="clinic.visit"
|
_name="clinic.visit"
|
||||||
|
@ -13,9 +15,9 @@ class Visit(Model):
|
||||||
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
||||||
"visit_date": fields.Date("Visit Date",required=True,search=True),
|
"visit_date": fields.Date("Visit Date",required=True,search=True),
|
||||||
"department": fields.Char("Department",required=False,search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
"cycle": fields.Selection([("1","One"),("2","Two"),("3","Tree"),("4","Four")],"Cycle",required=True),
|
"cycle": fields.Selection([("1","One"),("2","Two"),("3","Tree"),("4","Four")],"Cycle",required=True),
|
||||||
"state": fields.Selection([("pending","Pending"),("confirmed","Confirmed"),("canceled","Canceled")],"Status",required=True),
|
"state": fields.Selection([("pending","Pending"),("confirmed","Confirmed"),("cancelled","Cancelled")],"Status",required=True),
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
"company_id": fields.Many2One("company","Company"),
|
"company_id": fields.Many2One("company","Company"),
|
||||||
}
|
}
|
||||||
|
@ -30,22 +32,44 @@ class Visit(Model):
|
||||||
return num
|
return num
|
||||||
get_model("sequence").increment("sale_order")
|
get_model("sequence").increment("sale_order")
|
||||||
|
|
||||||
|
def _get_nurse(self,context={}):
|
||||||
|
user_id=get_active_user()
|
||||||
|
print("user_id ",user_id)
|
||||||
|
nurse_ids=get_model("clinic.nurse").search([['user_id','=',user_id]])
|
||||||
|
if nurse_ids:
|
||||||
|
return nurse_ids[0]
|
||||||
|
return None
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
"state": "pending",
|
"state": "pending",
|
||||||
|
"cycle": "1",
|
||||||
|
'visit_date': time.strftime("%Y-%m-%d"),
|
||||||
"number": _get_number,
|
"number": _get_number,
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
|
'nurse_id': _get_nurse,
|
||||||
}
|
}
|
||||||
_order="date asc,cycle asc"
|
_order="date,cycle"
|
||||||
|
|
||||||
|
|
||||||
def confirmed(self,ids,context={}):
|
def confirm(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"confirmed"})
|
obj.write({"state":"confirmed"})
|
||||||
|
|
||||||
def canceled(self,ids,context={}):
|
def cancel(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
obj.write({"state":"canceled"})
|
obj.write({"state":"cancelled"})
|
||||||
|
|
||||||
|
def onchange_patient(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
patient_id=data['patient_id']
|
||||||
|
visits=self.search_browse([['patient_id','=',patient_id]])
|
||||||
|
if visits:
|
||||||
|
visit=visits[-1]
|
||||||
|
data['doctor_id']=visit.doctor_id.id
|
||||||
|
data['department_id']=visit.department_id.id
|
||||||
|
else:
|
||||||
|
data['patient_id']=None
|
||||||
|
data['department_id']=None
|
||||||
|
return data
|
||||||
|
|
||||||
Visit.register()
|
Visit.register()
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
sequence (support multi company)
|
||||||
|
- visit
|
||||||
|
- hd case
|
||||||
|
- doctor
|
||||||
|
- nurse
|
||||||
|
- patient
|
||||||
|
|
Loading…
Reference in New Issue