conv_bal
watcha.h 2014-10-02 07:34:58 +07:00
parent dacaa8c4b6
commit c9c7944981
14 changed files with 158 additions and 107 deletions

View File

@ -1,6 +1,6 @@
<action>
<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_xml">clinic_board</field>
<field name="menu">clinic_menu</field>

View File

@ -1,8 +1,8 @@
<action>
<field name="string">HD Case</field>
<field name="string">HD Cases</field>
<field name="view_cls">multi_view</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="menu">clinic_menu</field>
</action>

View File

@ -2,6 +2,6 @@
<field name="string">Patients</field>
<field name="view_cls">multi_view</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>
</action>

View File

@ -1,8 +1,8 @@
<action>
<field name="string">Visit</field>
<field name="string">Visits</field>
<field name="view_cls">multi_view</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="menu">clinic_menu</field>
</action>

View File

@ -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>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="Journal Report" method="journal_report"/>
</button>
</head>
<separator string="HD Case Info"/>
<field name="number" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="patient_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="date_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="date_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="wh_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="wh_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="bp_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="per_bp_start" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="bp_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="per_bp_stop" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="hct" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="doctor_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="nurse_id" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="department" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="lines" nolabel="0" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
<group span="6" columns="1">
<field name="number"/>
<field name="date_start"/>
<field name="date_stop"/>
</group>
<group span="6" columns="1">
<field name="patient_id" onchange="onchange_patient"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
<field name="department_id"/>
</group>
<tabs>
<tab string="Treatment Information">
<field name="wh_start"/>
<field name="wh_stop"/>
<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>
<field name="dialzer_id" onchange="onchange_dialyzer"/>
<field name="detail"/>
@ -33,29 +40,25 @@
<field name="state"/>
</list>
</field>
<field name="lines_detail" nolabel="0" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
<list>
<field name="product_id" onchange="onchange_product"/>
<field name="detail"/>
<field name="qty"/>
<field name="uom_id"/>
<field name="price"/>
<field name="total"/>
</list>
<field name="lines_detail" nolabel="1">
<list>
<field name="product_id" onchange="onchange_product"/>
<field name="detail"/>
<field name="qty"/>
<field name="uom_id"/>
<field name="price"/>
<field name="total"/>
</list>
</field>
<group attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'>
<field name="fee" span="2" offset="7"/>
</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="fee" span="3" offset="9"/>
<field name="total" span="3" offset="9"/>
<field name="amount" span="2" offset="9"/>
<foot>
<button string="Confirm" type="success" method="confirmed" states="draft" />
<button string="Approved" type="success" method="approved" states="confirmed"/>
<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>
<related>
<field name="invoices" click_action="view_invoice"/>

View File

@ -3,7 +3,6 @@
<field name="date_start"/>
<field name="date_stop"/>
<field name="patient_id"/>
<field name="hct"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
<field name="state"/>

View File

@ -1,14 +1,20 @@
<menu string="Clinic">
<item string="Dashboard" action="clinic_board"/>
<item string="Visit" action="clinic_visit"/>
<item string="HD Case Treatment" action="clinic_hd_case"/>
<item string="Dialyzer" action="clinic_dialyzer"/>
<item string="Visits" action="clinic_visit"/>
<item string="Treatments" action="clinic_hd_case"/>
<item string="Personal">
<item string="Doctors" action="clinic_doctor"/>
<item string="Nurses" action="clinic_nurse"/>
<item string="Patients" action="clinic_patient"/>
</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="Dialyzer" action="clinic_dialyzer"/>
<item string="Departments" action="clinic_department"/>
<item string="Graduations" action="clinic_grade"/>
<item string="Nationalities" action="clinic_nation"/>

View File

@ -20,9 +20,9 @@
<field name="age"/>
<field name="card_type"/>
<field name="card_no"/>
<field name="exp_date"/>
<field name="card_exp"/>
<field name="picture"/>
<field name="phone"/>
<field name="mobile"/>
<field name="email"/>
</group>
<group span="6" columns="1">
@ -31,7 +31,7 @@
<field name="grad_id"/>
<field name="weight"/>
<field name="height"/>
<field name="mobile"/>
<field name="phone"/>
</group>
<separator string="Address Information"/>
<field name="addresses" view="form_list"/>

View File

@ -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="cycle"/>
<field name="number"/>

View File

@ -1,27 +1,27 @@
<form model="clinic.visit">
<head>
<field name="state"/>
<button string="Print" icon="print" action="print_visit"/>
<button string="Options" dropdown="1">
<item string="Send Confirm visit"/>
<item string="Send Confirm visit"/>
</button>
</head>
<tabs>
<tab string="Visit">
<separator string="Visit Info"/>
<field name="number"/>
<field name="department"/>
<field name="visit_date"/>
<field name="cycle"/>
<field name="patient_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
</tab>
<tab string="Visit">
<field name="number"/>
<field name="department_id"/>
<field name="visit_date"/>
<field name="cycle"/>
<field name="patient_id" onchange="onchange_patient"/>
<field name="doctor_id"/>
<field name="nurse_id"/>
</tab>
</tabs>
<foot>
<button string="Confirm" type="success" method="confirmed" states="pending" />
<button string="Canceled" type="danger" method="canceled" confirm="You are sure to canceled hd case"/>
<button string="Confirm" type="success" method="confirm" states="pending" />
<button string="Cancel" type="danger" method="cancel" confirm="Are you sure to cancel HD case?"/>
</foot>
<related>
<field name="comments"/>
<field name="comments"/>
</related>
</form>

View File

@ -12,20 +12,20 @@ class HDcase(Model):
_multi_company=True
_fields={
"number": fields.Char("Number",required=True,search=True),
"patient_id": fields.Many2One("clinic.patient","Patients",required=True,search=True),
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=True,search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
"date_start": fields.DateTime("Date start",required=True,search=True),
"date_stop": fields.DateTime("Date stop",required=True,search=True),
"department": fields.Char("Department",required=False,search=True),
"wh_start": fields.Float("Wt.Kg start",required=True,search=True),
"wh_stop": fields.Float("Wt.Kg stop",required=True,search=True),
"bp_start": fields.Integer("BP mmHG start",required=True,search=True),
"per_bp_start": fields.Integer("/Per start",required=True,search=True),
"bp_stop": fields.Integer("BP mmHG stop",required=True,search=True),
"per_bp_stop": fields.Integer("/Per stop",required=True,search=True),
"hct": fields.Integer("HCT %",required=True,search=True),
"state": fields.Selection([("draft","Draft"),("approved","Approved"),("confirmed","Confirmed"),("validate","Validate"),("canceled","Canceled"),("payment","Payment")],"Status",required=True),
"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"),
"hct": fields.Integer("HCT %"),
"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_detail": fields.One2Many("clinic.hd.case.line.detail","hd_case_id","Detail"),
"comments": fields.One2Many("message","related_id","Comments"),
@ -49,6 +49,25 @@ class HDcase(Model):
return num
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={}):
data=context["data"]
path=context["path"]
@ -67,29 +86,31 @@ class HDcase(Model):
line["state"]=dialyzer.state
return data
_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"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
"fee": 1500,
}
_order="date_start desc,number desc"
def onchange_patient(self,context={}):
data=context['data']
patient_id=data['patient_id']
hd_cases=self.search_browse([['patient_id','=',patient_id]])
if hd_cases:
hd_case=hd_cases[-1]
data['doctor_id']=hd_case.doctor_id.id
data['department_id']=hd_case.department_id.id
else:
data['doctor_id']=None
data['department_id']=None
return data
def canceled(self,ids,context={}):
def cancelled(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({"state":"canceled"})
obj.write({"state":"cancelled"})
def confirmed(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({"state":"confirmed"})
def payment(self,ids,context={}):
def paid(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({"state":"payment"})
obj.write({"state":"paid"})
def approved(self,ids,context={}):
for obj in self.browse(ids):

View File

@ -21,7 +21,7 @@ class Patient(Model):
return res # -> {1: 30, 2: 45,.....}
_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),
"name": fields.Char("Name",required=True,search=True),
"reg_date": fields.Date("Register Date",required=False,search=True),
@ -36,9 +36,9 @@ class Patient(Model):
"height": fields.Float("Height (Kg)"),
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type",required=True),
'card_no' : fields.Char("Card No."),
'card_exp' : fields.Date("Card Expire"),
"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"),
'exp_date' : fields.Date("Expiry Date"),
"addresses": fields.One2Many("address","related_id","Addresses"),
"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),
@ -67,8 +67,6 @@ class Patient(Model):
#Healthcare
"comments": fields.One2Many("message","related_id","Comments"),
"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"),
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
}
@ -105,13 +103,6 @@ class Patient(Model):
}
_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={}):
obj=self.browse(ids)[0]
obj.write({"state":"voided"})

View File

@ -1,5 +1,7 @@
import time
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):
_name="clinic.visit"
@ -13,9 +15,9 @@ class Visit(Model):
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse",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),
"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"),
"company_id": fields.Many2One("company","Company"),
}
@ -30,22 +32,44 @@ class Visit(Model):
return num
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": "pending",
"cycle": "1",
'visit_date': time.strftime("%Y-%m-%d"),
"number": _get_number,
"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.write({"state":"confirmed"})
def canceled(self,ids,context={}):
def cancel(self,ids,context={}):
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()

View File

@ -0,0 +1,7 @@
sequence (support multi company)
- visit
- hd case
- doctor
- nurse
- patient