conv_bal
watcha.h 2014-10-29 16:10:19 +07:00
parent 8ddb2e5533
commit 156310367f
13 changed files with 166 additions and 16 deletions

View File

@ -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","=","others"]]],["Archived",[["active","=","False"]]]]</field> <field name="tabs">[["All",[]],["Archived",[["active","=","False"]]],["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>

View File

@ -0,0 +1,8 @@
<action>
<field name="string">Personals</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.personal</field>
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Doctor",[["type","=","doctor"]]],["Nurse",[["type","=","nurse"]]]]</field>
<field name="modes">list,page,form</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -11,14 +11,12 @@
<field name="time_start"/> <field name="time_start"/>
<field name="cycle_id" required="1"/> <field name="cycle_id" required="1"/>
<field name="department_id"/> <field name="department_id"/>
<field name="visit_id" readonly="1"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<field name="patient_id" onchange="onchange_patient"/> <field name="patient_id" onchange="onchange_patient"/>
<field name="time_stop"/> <field name="time_stop"/>
<field name="duration"/> <field name="duration"/>
<field name="doctor_id"/> <field name="visit_id" readonly="1"/>
<field name="nurse_id"/>
</group> </group>
<tabs> <tabs>
<tab string="General"> <tab string="General">
@ -84,14 +82,16 @@
<field name="amount"/> <field name="amount"/>
</group> </group>
</tab> </tab>
<tab string="Personals">
<field name="doctor_id"/>
<field name="nurse_id"/>
</tab>
<tab string="Other Info"> <tab string="Other Info">
<group span="6" columns="1"> <group span="6" columns="1">
<separator string="Fees"/>
<field name="fee_partner_id" domain="[['type','=','org']]"/> <field name="fee_partner_id" domain="[['type','=','org']]"/>
</group> </group>
<group span="6" columns="1"> <group span="6" columns="1">
<separator string="Note"/> <field name="note"/>
<field name="note" nolabel="1"/>
</group> </group>
</tab> </tab>
</tabs> </tabs>

View File

@ -1,8 +1,9 @@
<menu string="Clinic"> <menu string="Clinic">
<item string="Dashboard" action="clinic_board"/> <item string="Dashboard" action="clinic_board"/>
<item string="Personals"> <item string="Personals">
<item string="Doctors" action="clinic_doctor"/> <item string="Personals" action="clinic_personal"/>
<item string="Nurses" action="clinic_nurse"/> <item string="Doctors" action="clinic_personal" action_options="tab_no=2"/>
<item string="Nurses" action="clinic_personal" action_options="tab_no=3"/>
<divider/> <divider/>
<header string="CATEGORIES"/> <header string="CATEGORIES"/>
<item string="Personal Categories" action="clinic_personal_categ"/> <item string="Personal Categories" action="clinic_personal_categ"/>
@ -11,13 +12,13 @@
<item string="Patients" action="clinic_patient"/> <item string="Patients" action="clinic_patient"/>
<item string="Dialyzers" action="clinic_dialyzer"/> <item string="Dialyzers" action="clinic_dialyzer"/>
<divider/> <divider/>
<header string="OTHERS"/> <header string="PATIENT SETTINGS"/>
<item string="Races" action="clinic_race"/>
<item string="Nationalities" action="clinic_nation"/>
<item string="Graduations" action="clinic_grade"/>
<item string="Cause Chronics" action="clinic_cause_chronic"/> <item string="Cause Chronics" action="clinic_cause_chronic"/>
<item string="Comorbidities" action="clinic_comorbidity"/> <item string="Comorbidities" action="clinic_comorbidity"/>
<item string="Graduations" action="clinic_grade"/>
<item string="Races" action="clinic_race"/>
<item string="Morbidities" action="clinic_morbidity"/> <item string="Morbidities" action="clinic_morbidity"/>
<item string="Nationalities" action="clinic_nation"/>
</item> </item>
<item string="Schedules" action="clinic_schedule"/> <item string="Schedules" action="clinic_schedule"/>
<item string="Cycles"> <item string="Cycles">

View File

@ -85,6 +85,9 @@
</list> </list>
</field> </field>
</tab> </tab>
<tab string="Note">
<field name="note" nolabel="1"/>
</tab>
</tabs> </tabs>
<related> <related>
<field name="visits"/> <field name="visits"/>

View File

@ -0,0 +1,46 @@
<form model="clinic.personal">
<head>
<field name="state"/>
<button string="Options" dropdown="1">
<item string="Copy"/>
</button>
</head>
<tabs>
<tab string="General">
<group span="6" columns="1">
<field name="type" required="1"/>
<field name="number"/>
<field name="name"/>
<field name="identification"/>
<field name="expiry_card"/>
<field name="birthday"/>
<field name="department_id"/>
<field name="categ_id"/>
<field name="state"/>
</group>
<group span="6" columns="1">
<field name="picture"/>
<field name="user_id"/>
<field name="email"/>
<field name="mobile"/>
<field name="phone"/>
<field name="active"/>
</group>
<separator string="Address Information"/>
<field name="addresses" view="form_list"/>
</tab>
<tab string="Professional Information">
<field name="prof_license"/>
<field name="prof_license_date"/>
</tab>
<tab string="Note">
<field name="note" nolabel="1"/>
</tab>
</tabs>
<related>
<field name="visits"/>
<field name="hd_cases"/>
<field name="patients"/>
<field name="comments"/>
</related>
</form>

View File

@ -0,0 +1,6 @@
<list model="clinic.personal">
<field name="number"/>
<field name="name"/>
<field name="type"/>
<field name="state"/>
</list>

View File

@ -13,6 +13,7 @@ class Migration(migration.Migration):
seq_names=[ seq_names=[
('HDC-','Clinic HD Case'), ('HDC-','Clinic HD Case'),
('VS-', 'Clinic Visit'), ('VS-', 'Clinic Visit'),
('PS-', 'Clinic Personal'),
('PT-', 'Clinic Patient'), ('PT-', 'Clinic Patient'),
('DT-', 'Clinic Doctor'), ('DT-', 'Clinic Doctor'),
('NS-', 'Clinic Nurse'), ('NS-', 'Clinic Nurse'),
@ -26,6 +27,7 @@ class Migration(migration.Migration):
'type': 'other', 'type': 'other',
}) })
print("create seq %s successfully " % seq_name) print("create seq %s successfully " % seq_name)
# insert into clinic_personal(number,name,type, state,picture, active) select number, name,'doctor','temporary', picture, true from clinic_doctor;
return return
Migration.register() Migration.register()

View File

@ -44,4 +44,5 @@ from . import payment
from . import account_payment from . import account_payment
from . import account_invoice from . import account_invoice
from . import personal_categ from . import personal_categ
from . import personal
from . import schedule from . import schedule

View File

@ -77,6 +77,7 @@ class Patient(Model):
"partner_id": fields.Many2One("partner","Contact"), "partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
"active":fields.Boolean("Active"), "active":fields.Boolean("Active"),
'note': fields.Text("Note"),
} }

View File

@ -0,0 +1,80 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company, get_active_user, set_active_user
class Personal(Model):
_name="clinic.personal"
_string="Personal"
_audit_log=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
_fields={
"number": fields.Char("Ref.",required=True,search=True),
"name": fields.Char("Name",required=True,search=True),
"identification" : fields.Char("Identification"),
"expiry_card" : fields.Date("Card Expiry"),
"birthday": fields.Date("Birthday",search=True),
"age": fields.Integer("Age", function="_get_age"),
"state": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"Status"),
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["other","Other"]],"Type"),
"mobile": fields.Char("Mobile",required=False,search=True),
"phone": fields.Char("Phone",search=True),
'email': fields.Char("Email"),
"prof_license" : fields.Char("License."),
"prof_license_date" : fields.Date("License Date"),
"birthday": fields.Date("BirthDay",search=True),
"department_id": fields.Many2One("clinic.department", "Department",search=True),
"patients": fields.Many2Many("clinic.patient","Patients"),
"addresses": fields.One2Many("address","related_id","Addresses"),
"comments": fields.One2Many("message","related_id","Comments"),
"visits": fields.One2Many("clinic.visit","nurse_id","Visits"),
"hd_cases": fields.One2Many("clinic.hd.case","nurse_id","HD Cases"),
"company_id": fields.Many2One("company","Company"),
"user_id": fields.Many2One("base.user","User"),
'picture': fields.File("Picture"),
'note': fields.Text("Note"),
'categ_id': fields.Many2One("clinic.personal.categ", "Category"),
'active': fields.Boolean("Active"),
'date': fields.Date("Register Date"),
}
def _get_number(self,context={}):
while 1:
seq_id=get_model("sequence").find_sequence(name="Clinic Personal")
if not seq_id:
return "/"
num=get_model("sequence").get_next_number(seq_id,context=context)
if not num:
return None
user_id=get_active_user()
set_active_user(1)
res=self.search([["number","=",num]])
set_active_user(user_id)
if not res:
return num
get_model("sequence").increment_number(seq_id,context=context)
_defaults={
'active': True,
"state": "temporary",
'type': 'nurse',
"personal_type": "temporary",
"date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
}
_order="date desc,number desc"
Personal.register()

View File

@ -1,7 +1,7 @@
from netforce.model import Model, fields from netforce.model import Model, fields
from netforce.access import get_active_company from netforce.access import get_active_company
class NurseCateg(Model): class PersonalCateg(Model):
_name="clinic.personal.categ" _name="clinic.personal.categ"
_string="Personal Category" _string="Personal Category"
@ -41,4 +41,4 @@ class NurseCateg(Model):
ids=list(set(ids1+ids2)) ids=list(set(ids1+ids2))
return self.name_get(ids,context=context) return self.name_get(ids,context=context)
NurseCateg.register() PersonalCateg.register()

View File

@ -1,5 +1,6 @@
from netforce.model import Model from netforce.model import Model
from netforce.database import get_connection from netforce.database import get_connection
from netforce.access import get_active_company
class Report(Model): class Report(Model):
_name="clinic.report" _name="clinic.report"
@ -7,7 +8,8 @@ class Report(Model):
def cycle_recent_widget(self,context={}): def cycle_recent_widget(self,context={}):
db=get_connection() db=get_connection()
res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id group by c.name;") company_id=get_active_company()
res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id where hd.company_id=%s group by c.name",company_id)
data=[] data=[]
for r in res: for r in res:
data.append((r.name,r.count)) data.append((r.name,r.count))