conv_bal
watcha.h 2014-11-03 08:21:34 +07:00
parent 24d1bf3338
commit add077636e
13 changed files with 8 additions and 302 deletions

View File

@ -1,45 +0,0 @@
<form model="clinic.doctor">
<head>
<field name="type"/>
<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"/>
</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="Others">
<field name="note"/>
</tab>
</tabs>
<related>
<field name="visits"/>
<field name="hd_cases"/>
<field name="patients"/>
<field name="comments"/>
</related>
</form>

View File

@ -1,5 +0,0 @@
<list model="clinic.doctor">
<field name="number"/>
<field name="name"/>
<field name="type"/>
</list>

View File

@ -5,5 +5,6 @@
<field name="cycle_id"/> <field name="cycle_id"/>
<field name="patient_id"/> <field name="patient_id"/>
<field name="department_id"/> <field name="department_id"/>
<field name="nurse_id"/>
<field name="state"/> <field name="state"/>
</list> </list>

View File

@ -1,45 +0,0 @@
<form model="clinic.nurse">
<head>
<field name="type"/>
<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"/>
</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="Others">
<field name="note"/>
</tab>
</tabs>
<related>
<field name="visits"/>
<field name="hd_cases"/>
<field name="patients"/>
<field name="comments"/>
</related>
</form>

View File

@ -1,5 +0,0 @@
<list model="clinic.nurse">
<field name="number"/>
<field name="name"/>
<field name="type"/>
</list>

View File

@ -1,12 +1,11 @@
from . import setting
from . import cause_chronic from . import cause_chronic
from . import comorbidity from . import comorbidity
from . import department from . import department
from . import doctor
from . import education from . import education
from . import graduation from . import graduation
from . import morbidity from . import morbidity
from . import nation from . import nation
from . import nurse
from . import address from . import address
from . import patient from . import patient
from . import patient_categ from . import patient_categ
@ -14,10 +13,7 @@ from . import patient_cause_line
from . import patient_comorbidity_line from . import patient_comorbidity_line
from . import patient_morbidity_line from . import patient_morbidity_line
from . import race from . import race
from . import setting
from . import visit from . import visit
from . import visit_line
from . import visit_plan
from . import hd_case from . import hd_case
from . import hd_case_line from . import hd_case_line
from . import hd_case_personal from . import hd_case_personal

View File

@ -1,80 +0,0 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company, get_active_user, set_active_user
class Doctor(Model):
_name="clinic.doctor"
_string="Doctor"
_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("Doctor No.",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"),
"type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"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", "Doctor Category", domain=[['type','=','doctor']]),
'active': fields.Boolean("Active"),
}
def _get_number(self,context={}):
while 1:
seq_id=get_model("sequence").find_sequence(name="Clinic Doctor")
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={
"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"
def void(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({"state":"voided"})
Doctor.register()

View File

@ -1,74 +0,0 @@
import time
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company, get_active_user, set_active_user
class Nurse(Model):
_name="clinic.nurse"
_string="Nurse"
_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("Nurse No.",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"),
"type": fields.Selection([["temporary","Temporary"],["permanent","Permanent"]],"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", "Nurse Category", domain=[['type','=','nurse']]),
'active': fields.Boolean("Active"),
}
def _get_number(self,context={}):
while 1:
seq_id=get_model("sequence").find_sequence(name="Clinic Nurse")
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={
"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"
Nurse.register()

View File

@ -10,8 +10,8 @@ class ReportHDDetail(Model):
_fields={ _fields={
"patient_id" : fields.Many2One("clinic.patient","Patient"), "patient_id" : fields.Many2One("clinic.patient","Patient"),
"doctor_id" : fields.Many2One("clinic.doctor","Doctor"), "doctor_id" : fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']]),
"nurse_id" : fields.Many2One("clinic.nurse","Nurse"), "nurse_id" : fields.Many2One("clinic.personal","Nurse",domain=[['type','=','nurse']]),
"date_from": fields.Date("From"), "date_from": fields.Date("From"),
"date_to": fields.Date("To"), "date_to": fields.Date("To"),
"cycle_id": fields.Many2One("clinic.cycle","Cycle"), "cycle_id": fields.Many2One("clinic.cycle","Cycle"),

View File

@ -10,8 +10,8 @@ class ReportHDPayment(Model):
_fields={ _fields={
"patient_id" : fields.Many2One("clinic.patient","Patient"), "patient_id" : fields.Many2One("clinic.patient","Patient"),
"doctor_id" : fields.Many2One("clinic.doctor","Doctor"), "doctor_id" : fields.Many2One("clinic.personal","Doctor",domain=[['type','=','doctor']]),
"nurse_id" : fields.Many2One("clinic.nurse","Nurse"), "nurse_id" : fields.Many2One("clinic.personal","Nurse",domain=[['type','=','nurse']]),
"date_from": fields.Date("From"), "date_from": fields.Date("From"),
"date_to": fields.Date("To"), "date_to": fields.Date("To"),
"cycle_id": fields.Many2One("clinic.cycle","Cycle"), "cycle_id": fields.Many2One("clinic.cycle","Cycle"),

View File

@ -98,8 +98,8 @@ class ClinicSetting(Model):
print("="*50) print("="*50)
patients=get_model("clinic.patient").search_read([],['name','hn']) patients=get_model("clinic.patient").search_read([],['name','hn'])
visits=get_model("clinic.visit").search_read([],['number','time_start','cycle_id','state']) visits=get_model("clinic.visit").search_read([],['number','time_start','cycle_id','state'])
doctor_ids=[dt['id'] for dt in get_model("clinic.doctor").search_read([],['name'])] doctor_ids=[dt['id'] for dt in get_model("clinic.personal").search_read([['type','=','doctor']],['name'])]
nurse_ids=[ns['id'] for ns in get_model("clinic.nurse").search_read([],['name'])] nurse_ids=[ns['id'] for ns in get_model("clinic.personal").search_read([['type','=','nurse']],['name'])]
cycle_ids=[cc['id'] for cc in get_model("clinic.cycle").search_read([],['name'])] cycle_ids=[cc['id'] for cc in get_model("clinic.cycle").search_read([],['name'])]
department_ids=[dp['id'] for dp in get_model("clinic.department").search_read([],['name'])] department_ids=[dp['id'] for dp in get_model("clinic.department").search_read([],['name'])]
#db=get_connection() #db=get_connection()

View File

@ -1,15 +0,0 @@
from netforce.model import Model, fields, get_model
class VisitLine(Model):
_name="clinic.visit.line"
_string="Visit Line"
_fields={
'visit_id': fields.Many2One("clinic.visit","Visit"),
'cycle_id': fields.Many2One("clinic.cycle","Cycle"),
'time_start': fields.DateTime("Time Start"),
'time_stop': fields.DateTime("Time Stop"),
"state": fields.Selection([("pending","Pending"),("completed","Completed")],"Status"),
}
VisitLine.register()

View File

@ -1,22 +0,0 @@
from netforce.model import Model, fields
class VisitPlane(Model):
_name="clinic.visit.plane"
_string="Visit Plan"
_fieldname="visit_id"
_fields={
'visit_id': fields.Many2One("clinic.visit","Visit"),
'hd_case_id': fields.Many2One("clinic.hd.case","HD Case"),
"date": fields.Date("Date"),
"time_start": fields.DateTime("Time Start"),
"time_stop": fields.DateTime("Time Stop"),
"state": fields.Selection([("open","Open"),("close","Close")],"Status"),
'active': fields.Boolean("Active"), # to hide
}
_defaults={
'state': 'open',
'active': True,
}
VisitPlane.register()