Merge branch 'master' of dev.netforce.com:netforce-customized/clinic

conv_bal
watcha.h 2014-10-01 14:47:54 +07:00
commit c2f8465529
8 changed files with 221 additions and 104 deletions

View File

@ -43,16 +43,24 @@
<field name="total"/> <field name="total"/>
</list> </list>
</field> </field>
<field name="fee" span="2" offset="7" attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/> <group attrs='{"readonly":[["state","in",["canceled","approved","validate"]]]}'/>
<field name="total" span="2" offset="8"/> <field name="fee" span="2" offset="7"/>
<field name="amount" span="2" offset="8"/> </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"/>
<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="Canceled" type="danger" method="canceled" confirm="You are sure to canceled hd case"/>
</foot> </foot>
<related> <related>
<field name="comments"/> <field name="invoices" click_action="view_invoice"/>
<field name="payments" click_action="view_payment"/>
<field name="pickings" click_action="view_picking"/>
<field name="comments"/>
</related> </related>
</form> </form>

View File

@ -1,15 +1,11 @@
<menu string="Clinic"> <menu string="Clinic">
<item string="Dashboard" action="clinic_board"/> <item string="Dashboard" action="clinic_board"/>
<item string="Genaral Data"> <item string="Doctor" action="clinic_doctor"/>
<item string="Patient" action="clinic_patient"/> <item string="Nurse" action="clinic_nurse"/>
<item string="Doctor" action="clinic_doctor"/> <item string="Patient" action="clinic_patient"/>
<item string="Nurse" action="clinic_nurse"/> <item string="Visit" action="clinic_visit"/>
</item> <item string="HD Case Treatment" action="clinic_hd_case"/>
<item string="Clinic"> <item string="Dialyzer" action="clinic_dialyzer"/>
<item string="Visit" action="clinic_visit"/>
<item string="HD case treatment" action="clinic_hd_case"/>
<item string="Dialyzer" action="clinic_dialyzer"/>
</item>
<item string="Settings"> <item string="Settings">
<item string="Clinic Setting" action="clinic_setting"/> <item string="Clinic Setting" action="clinic_setting"/>
</item> </item>

View File

@ -6,59 +6,111 @@
</button> </button>
</head> </head>
<tabs> <tabs>
<tab string="Patient"> <tab string="Patient's Data">
<separator string="Patient Info"/> <group span="12" colunm="1">
<field name="number"/> <field name="type"/>
<field name="type"/> </group>
<field name="name"/> <group span="12" colunm="1">
<field name="date"/> <field name="number"/>
<field name="birthday"/> <field name="date"/>
<field name="telephone"/> </group>
<field name="mobile"/> <group span="12" colunm="2">
<field name="job"/> <field name="first_name"/>
<field name="age"/> <field name="last_name"/>
<field name="weight"/> </group>
<field name="height"/> <group span="12" colunm="2">
<field name="card_type"/> <field name="birthday"/>
<field name="exp_id"/> <field name="age"/>
<field name="gender"/> </group>
<field name="marital_status"/> <group span="12" colunm="2">
<field name="nationality"/> <field name="card_type"/>
<field name="race"/> </group>
<separator string="Decare"/> <group span="12" colunm="2">
<field name="smoke"/> <field name="iden_id"/>
<field name="first_hemodialysis"/> <field name="exp_id"/>
<field name="hemodialysis"/> </group>
<field name="clinic_after"/> <field name="telephone"/>
<field name="clinic_after_name"/> <field name="mobile"/>
<field name="first_permanent_vascular_access"/> <field name="gender" span="12"/>
<field name="first_tenckhoff_catheters"/> <field name="marital_status" span="12"/>
<field name="start_date_clinic"/> <group span="12" colunm="2">
<field name="waiting_transplantation"/> <field name="nationality"/>
<field name="who_transplantation"/> <field name="race"/>
<field name="reason_of_chronic_renal_failure"/> </group>
<field name="ac_mi"/> <field name="graduation" span="12"/>
<field name="co_an"/> <field name="job" span="12"/>
<field name="ce_ac"/> <field name="weight" span="12"/>
<field name="hypertnsion"/> <field name="height" span="12"/>
<field name="dia"/> </tab>
<field name="copd"/> <tab string="Patient's Data +">
<field name="asthma"/> <field name="smoke" span="12"/>
<field name="pul_tub"/> <field name="salary" span="12"/>
<field name="cancer"/> <field name="withdrawal" span="12"/>
<field name="cirrhosis"/> <group span="12" colunm="2">
<field name="dyslip"/> <field name="first_hemodialysis"/>
<field name="prca"/> <field name="hemodialysis"/>
<field name="hyperucemia"/> </group>
<field name="cga"/> <field name="first_treatment" span="12"/>
<field name="parathy"/> <group span="12" colunm="2">
<field name="comarbid"/> <field name="clinic_after"/>
<field name="comarbid2"/> <field name="clinic_after_name"/>
</tab> </group>
<tab string="Doctor"> <field name="first_permanent_vascular_access" span="12"/>
<field name="doctorsss"/> <field name="first_tenckhoff_catheters" span="12"/>
<field name="nurses"/> <field name="start_date_clinic" span="12"/>
</tab> <field name="waiting_transplantation" span="12"/>
<field name="who_transplantation"/>
<field name="reason_of_chronic_renal_failure"/>
<separator string="Cause of chronic renal failure"/>
<group span="12" colunm="3">
<field name="ac_mi"/>
<field name="co_an"/>
<field name="ce_ac"/>
<field name="hypertnsion"/>
<field name="dia"/>
<field name="copd"/>
<field name="asthma"/>
<field name="pul_tub"/>
<field name="cancer"/>
<field name="cirrhosis"/>
<field name="dyslip"/>
<field name="prca"/>
<field name="hyperucemia"/>
<field name="cga"/>
<field name="parathy"/>
</group>
</tab>
<tab string="Co-marbid">
<separator string="Co-morbidity, before RRT"/>
<field name="check1" span="12"/>
<field name="check2" span="12"/>
<field name="check3" span="12"/>
<field name="check4" span="12"/>
<field name="check5" span="12"/>
<field name="check6" span="12"/>
<field name="check7" span="12"/>
<field name="check8" span="12"/>
<field name="check9" span="12"/>
<field name="check10" span="12"/>
<field name="check11" span="12"/>
<field name="check12" span="12"/>
<field name="check13" span="12"/>
<field name="check14" span="12"/>
<field name="check15" span="12"/>
<field name="check16" span="12"/>
<field name="check17" span="12"/>
</tab>
<tab string="Morbidity">
<separator string="Morbidity, After RRT"/>
<field name="check18" span="12"/>
<field name="check19" span="12"/>
<field name="check20" span="12"/>
<field name="comarbid2"/>
</tab>
<tab string="Healthcare">
<field name="doctorsss"/>
<field name="nurses"/>
</tab>
</tabs> </tabs>
<related> <related>
<field name="addresses"/> <field name="addresses"/>

View File

@ -1,6 +1,7 @@
<list model="clinic.patient"> <list model="clinic.patient">
<field name="number"/> <field name="number"/>
<field name="name"/> <field name="first_name"/>
<field name="last_name"/>
<field name="date"/> <field name="date"/>
<field name="state"/> <field name="state"/>
</list> </list>

View File

@ -12,7 +12,7 @@ class Doctor(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),
"name": fields.Char("Name Surname",required=True,search=True), "name": fields.Char("Name",required=True,search=True),
"date": fields.Date("Create Date",required=True,search=True), "date": fields.Date("Create Date",required=True,search=True),
"birthday": fields.Date("BirthDay",required=True,search=True), "birthday": fields.Date("BirthDay",required=True,search=True),
"telephone": fields.Char("Telephone",required=True,search=True), "telephone": fields.Char("Telephone",required=True,search=True),

View File

@ -4,7 +4,7 @@ import time
from netforce.access import get_active_user,set_active_user from netforce.access import get_active_user,set_active_user
from netforce.access import get_active_company from netforce.access import get_active_company
class Hdcase(Model): class HDcase(Model):
_name="clinic.hd.case" _name="clinic.hd.case"
_string="HD Case Treatment" _string="HD Case Treatment"
_audit_log=True _audit_log=True
@ -34,6 +34,9 @@ class Hdcase(Model):
"amount": fields.Float("Amount",function="get_total",readonly=True,function_multi=True), "amount": fields.Float("Amount",function="get_total",readonly=True,function_multi=True),
"total": fields.Float("Total",function="get_total",readonly=True,function_multi=True), "total": fields.Float("Total",function="get_total",readonly=True,function_multi=True),
"reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True), "reconcile_id": fields.Many2One("account.reconcile","Reconcile Id",readonly=True),
"invoices": fields.One2Many("account.invoice","related_id","Invoices"),
"pickings": fields.One2Many("stock.picking","related_id","Pickings"),
"payments": fields.One2Many("account.payment","related_id","Payments"),
} }
def _get_number(self,context={}): def _get_number(self,context={}):
@ -80,7 +83,6 @@ class Hdcase(Model):
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
obj.write({"state":"canceled"}) obj.write({"state":"canceled"})
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"})
@ -203,4 +205,4 @@ class Hdcase(Model):
} }
return vals return vals
Hdcase.register() HDcase.register()

View File

@ -12,7 +12,7 @@ class Nurse(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),
"name": fields.Char("Name Surname",required=True,search=True), "name": fields.Char("Name",required=True,search=True),
"date": fields.Date("Create Date",required=True,search=True), "date": fields.Date("Create Date",required=True,search=True),
"birthday": fields.Date("BirthDay",required=True,search=True), "birthday": fields.Date("BirthDay",required=True,search=True),
"telephone": fields.Char("Telephone",required=True,search=True), "telephone": fields.Char("Telephone",required=True,search=True),

View File

@ -10,38 +10,56 @@ class Patient(Model):
_audit_log=True _audit_log=True
_name_field="name" _name_field="name"
_multi_company=True _multi_company=True
def _get_age(self,ids,context):
res={}
year_now=int(time.strftime("%Y"))
for obj in self.browse(ids):
age=0
if obj.birthday:
year_bd=int(obj.birthday[0:4])
age=year_now-year_bd
res[obj.id]=age
return res # -> {1: 30, 2: 45,.....}
_fields={ _fields={
"number": fields.Char("Number",required=True,search=True), #Patient's Data
"name": fields.Char("Name Surname",required=True,search=True), "number": fields.Char("Patient ID",required=True,search=True),
"date": fields.Date("Create Date",required=True,search=True), "first_name": fields.Char("First Name",required=True,search=True),
"birthday": fields.Date("BirthDay",required=True,search=True), "last_name": fields.Char("Last Name",required=False,search=True),
"telephone": fields.Char("Telephone",required=True,search=True), "date": fields.Date("Create Date",required=False,search=True),
"mobile": fields.Char("Mobile",required=True,search=True), "birthday": fields.Date("BirthDay",required=False,search=True),
"telephone": fields.Char("Telephone",required=False,search=True),
"mobile": fields.Char("Mobile",required=False,search=True),
"job": fields.Char("Job"), "job": fields.Char("Job"),
"age": fields.Integer("Age"), "graduation": fields.Selection([("junior_high_school", "Junior High School"),("senior_hish_school","Senior High School"),("vocational_certificate", "Vocational Certificate"),("High_vocational_certificate", "High Vocational Certificate"),("ba", "B.A.(Bachelor of Arts)"),("ma","M.A.(Master of Arts)"),("phd","Ph.D.(Doctor of Philosophy)")],"Graduation"),
"age": fields.Integer("Age", function="_get_age"),
"weight": fields.Integer("Weight (cm)"), "weight": fields.Integer("Weight (cm)"),
"height": fields.Integer("Height (Kg)"), "height": fields.Integer("Height (Kg)"),
"type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Type",required=True), "type": fields.Selection([("mg","Medical Govement"),("sc","Social Security"),("nhso","NHSO (30฿)"),("personal","Personal"),("other","Other")],"Type of treatment",required=False),
"card_type": fields.Selection([("iden_id","Identity Card"),("passport","Passport")],"ID From",required=True), "card_type": fields.Selection([("iden_id","Identity Card"),("passport","Passport")],"Card Type",required=True),
'iden_id' : fields.Char("Identity ID"), 'iden_id' : fields.Char("Card No."),
"app_no": fields.Char("Application No."), "app_no": fields.Char("Application No."),
"salary": fields.Float("Salary"), "salary": fields.Selection([("20000","5,001-20,000"),("50000","20,001-50,000"),("100000","50,001-100,000"),("100001","100,000+")], "Salary"),
'exp_id' : fields.Date("Expiry Date"), 'exp_id' : fields.Date("Expiry Date"),
"state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status",required=True), "state": fields.Selection([("draft","Draft"),("active","Active"),("deactive","Deactive")],"Status",required=False),
"addresses": fields.One2Many("address","related_id","Addresses"), "addresses": fields.One2Many("address","related_id","Addresses"),
"gender": fields.Selection([("male","Male"),("female","Female")],"Gendel",required=True), "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=True), "marital_status": fields.Selection([("single","Single"),("marry","Marry"),("divorce","Divorce"),("separated","Saparated"),("widowed","Widowed")],"Marital Status",required=False),
"nationality": fields.Char("Nationality",search=True), "nationality": fields.Char("Nationality",search=True),
"race": fields.Char("Race",search=True), "race": fields.Char("Race",search=True),
"smoke": fields.Boolean("Smoke ?"), #Patient's +
"first_hemodialysis": fields.Date("First time Hemodialysis",required=True), "smoke": fields.Selection([("never","Never"),("stopped","Stopped"),("smoked","Smoked")],"Smoking"),
"hemodialysis": fields.Char("First Hemodialysis",required=True), "withdrawal" : fields.Selection([("social_security","Social Security"),("health_insurance","Health Insurance"),("etc","ETC.")],"Right of withdrawal"),
"clinic_after": fields.Selection([("small","Small"),("medium","Medium"),("large","Large")],"Clinic Lastime",required=True), "first_treatment" : fields.Selection([("hd","HD"),("test","Test")], "First treatment"),
"clinic_after_name": fields.Char("Clinic after name",required=True), "first_hemodialysis": fields.Date("First time Hemodialysis",required=False),
"first_permanent_vascular_access": fields.Date("First time Permanent Vascular",required=True), "hemodialysis": fields.Char("First Hemodialysis",required=False),
"first_tenckhoff_catheters": fields.Date("First time Tenckhoff Catheters",required=True), "clinic_after": fields.Selection([("small","Small"),("medium","Medium"),("large","Large")],"Clinic Lastime",required=False),
"start_date_clinic": fields.Date("Start Date Clinic",required=True), "clinic_after_name": fields.Char("Clinic after name",required=False),
"waiting_transplantation": fields.Boolean("Kidney Transplantation Waiting ?"), "first_permanent_vascular_access": fields.Date("First time Permanent Vascular",required=False),
"first_tenckhoff_catheters": fields.Date("First time Tenckhoff Catheters",required=False),
"start_date_clinic": fields.Date("Start Date Clinic",required=False),
"waiting_transplantation": fields.Selection([("yes","Yes"),("no","No")],"Kidney Transplantation Waiting ?"),
"who_transplantation": fields.Char("Who is Transplantation?"), "who_transplantation": fields.Char("Who is Transplantation?"),
"reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"), "reason_of_chronic_renal_failure": fields.Char("Reason chronic renal failure ?"),
"ac_mi": fields.Boolean("Acute MI"), "ac_mi": fields.Boolean("Acute MI"),
@ -61,8 +79,31 @@ class Patient(Model):
"hyperucemia": fields.Boolean("Hyperurinencemia"), "hyperucemia": fields.Boolean("Hyperurinencemia"),
"cga": fields.Boolean("Chronic gouty arthitis"), "cga": fields.Boolean("Chronic gouty arthitis"),
"parathy": fields.Boolean("Parathyroidectomy"), "parathy": fields.Boolean("Parathyroidectomy"),
"comarbid": fields.Char("Co-morbid 1"), #Co-marbid
"comarbid2": fields.Char("Co-morbid 2"), "check1" : fields.Boolean("The patient had been diagnosed, Acute MI or Unstable angina"),
"check2" : fields.Boolean("The patient had been diagnosed, Coronary angioplasty or CABG"),
"check3" : fields.Boolean("The patient had been diagnosed, Cerebrovascular accident"),
"check4" : fields.Boolean("The patient had been diagnosed, PVD or Amputation"),
"check5" : fields.Boolean("The patient had been diagnosed, Congestive heart failure"),
"check6" : fields.Boolean("The patient had been diagnosed, Hypertension"),
"check7" : fields.Boolean("The patient had been diagnosed, Diabetes"),
"check8" : fields.Boolean("The patient had been diagnosed, COPD"),
"check9" : fields.Boolean("The patient had been diagnosed, Asthma"),
"check10" : fields.Boolean("The patient had been diagnosed, Pulmonary tuberculosis"),
"check11" : fields.Boolean("The patient had been diagnosed, of cancer"),
"check12" : fields.Boolean("The patient had been diagnosed, Cirrhosis"),
"check13" : fields.Boolean("The patient had been diagnosed, Dyslipidemia"),
"check14" : fields.Boolean("The patient had been diagnosed, PRCA"),
"check15" : fields.Boolean("The patient had been diagnosed, Hyperurinecemia"),
"check16" : fields.Boolean("The patient had been diagnosed, Chronic gouty arthitis"),
"check17" : fields.Boolean("The patient had been diagnosed, Parathyroidectomy"),
#"comarbid" : fields.char("Co-morbid Other"),
#Morbidity
"check18" : fields.Boolean("Ischemic Heart Disease"),
"check19" : fields.Boolean("Of cancer"),
"check20" : fields.Boolean("Cerebrovascular accident"),
"comarbid2": fields.Char("Co-morbid Other"),
#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"), "doctorsss": fields.Many2Many("clinic.doctor","Doctors"),
@ -72,6 +113,19 @@ class Patient(Model):
} }
def _get_number(self,context={}): def _get_number(self,context={}):
seq_name="clinic_patient"
seq_id=get_model("sequence").find_sequence(name=seq_name)
if not seq_id:
raise Exception("Sequence not found: '%s'"%seq_name)
while 1:
num=get_model("sequence").get_next_number(seq_id)
if not num:
return None
get_model("sequence").increment_number(seq_id)
return num
return
#XXXX
while 1: while 1:
num=get_model("sequence").get_number("clinic_patient") num=get_model("sequence").get_number("clinic_patient")
if not num: if not num:
@ -90,11 +144,15 @@ 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"})
Patient.register() Patient.register()