merge
commit
bdcddcf5c2
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Dialyzer</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">report.dialyzer.drop</field>
|
||||||
|
<field name="report_template">report_dialyzer_drop</field>
|
||||||
|
<field name="report_template_xls">dialyzer_drop</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Report HD Case</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.hd.report</field>
|
||||||
|
<field name="report_template">report_hd_report</field>
|
||||||
|
<field name="report_template_xls">hd_report</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Nationalities</field>
|
||||||
|
<field name="view_cls">multi_view</field>
|
||||||
|
<field name="model">clinic.round</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<action>
|
||||||
|
<field name="type">report_odt</field>
|
||||||
|
<field name="model">clinic.round.report</field>
|
||||||
|
<field name="method">get_data</field>
|
||||||
|
<field name="template">round</field>
|
||||||
|
</action>
|
|
@ -1,6 +1,6 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="type">report_odt</field>
|
<field name="type">report_odt</field>
|
||||||
<field name="model">clinic.visit</field>
|
<field name="model">clinic.round</field>
|
||||||
<field name="method">get_data</field>
|
<field name="method">get_data</field>
|
||||||
<field name="template">visit</field>
|
<field name="template">round</field>
|
||||||
</action>
|
</action>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<action>
|
||||||
|
<field name="type">report_odt2</field>
|
||||||
|
<field name="model">clinic.visit</field>
|
||||||
|
<field name="template">visit_form</field>
|
||||||
|
</action>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<form model="report.dialyzer.drop">
|
||||||
|
<group form_layout="stacked">
|
||||||
|
<field name="date" span="4"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
|
@ -2,23 +2,23 @@
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<!--<item string="New Visit" method="new_visit"/>-->
|
|
||||||
<item string="TODO" method="todo"/>
|
<item string="TODO" method="todo"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start"/>
|
<field name="time_start"/>
|
||||||
<field name="doctor_id"/>
|
|
||||||
<field name="nurse_id"/>
|
|
||||||
<field name="cycle_id"/>
|
<field name="cycle_id"/>
|
||||||
|
<field name="nurse_id"/>
|
||||||
|
<field name="visit_id"/>
|
||||||
|
<field name="department_id"/>
|
||||||
</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="department_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="visit_id"/>
|
<field name="nurse_id"/>
|
||||||
</group>
|
</group>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General">
|
<tab string="General">
|
||||||
|
@ -74,7 +74,6 @@
|
||||||
</field>
|
</field>
|
||||||
<group span="8" columns="1">
|
<group span="8" columns="1">
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<!--<field name="fee_partner_id"/>-->
|
|
||||||
<field name="fee_partner_id" domain="[['type','=','org']]" attrs='{"required":[["fee_amount","!=",0]]}'/>
|
<field name="fee_partner_id" domain="[['type','=','org']]" attrs='{"required":[["fee_amount","!=",0]]}'/>
|
||||||
</group>
|
</group>
|
||||||
<group span="2" columns="1">
|
<group span="2" columns="1">
|
||||||
|
@ -92,7 +91,6 @@
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" method="confirm" states="draft"/>
|
<button string="Confirm" type="success" method="confirm" states="draft"/>
|
||||||
<button string="Complete" type="success" method="complete" states="in_progress"/>
|
<button string="Complete" type="success" method="complete" states="in_progress"/>
|
||||||
<!--<button string="Discontinue" type="danger" method="discontinue" states="in_progress"/>-->
|
|
||||||
<button string="Discontinue" type="danger" action="clinic_hd_case_distcont" states="in_progress"/>
|
<button string="Discontinue" type="danger" action="clinic_hd_case_distcont" states="in_progress"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<form model="clinic.hd.report">
|
||||||
|
<group form_layout="stacked">
|
||||||
|
<field name="date" span="2"/>
|
||||||
|
<field name="cycle_id" span="2"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
|
@ -20,12 +20,16 @@
|
||||||
<item string="Visits" action="clinic_visit"/>
|
<item string="Visits" action="clinic_visit"/>
|
||||||
<item string="Treatments" action="clinic_hd_case"/>
|
<item string="Treatments" action="clinic_hd_case"/>
|
||||||
<item string="Reports">
|
<item string="Reports">
|
||||||
<item string="TODO" action="todo"/>
|
<header string="Dialyzers"/>
|
||||||
|
<item string="Dialyzers Drop" action="clinic_dialyzer_report"/>
|
||||||
|
<header string="HD Case"/>
|
||||||
|
<item string="Treatment Summary" action="clinic_hd_report"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="Imports">
|
<item string="Imports">
|
||||||
<item string="Import Payments" action="clinic_import_payment"/>
|
<item string="Import Payments" action="clinic_import_payment"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="Settings">
|
<item string="Settings">
|
||||||
|
<!-- <item string="Cycle" action="clinic_cycle"/>-->
|
||||||
<item string="Departments" action="clinic_department"/>
|
<item string="Departments" action="clinic_department"/>
|
||||||
<item string="Cycle" action="clinic_cycle"/>
|
<item string="Cycle" action="clinic_cycle"/>
|
||||||
<item string="Clinic Settings" action="clinic_setting"/>
|
<item string="Clinic Settings" action="clinic_setting"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!--<calendar model="clinic.visit" states='waiting_treatment' date_field="date_visit" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"#ebff00":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>-->
|
<!--<calendar model="clinic.visit" states='waiting_treatment' date_field="date_visit" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"#ebff00":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>-->
|
||||||
<calendar model="clinic.visit" states='waiting_treatment' start_field="time_start" end_field="time_stop" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"orange":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
<calendar model="clinic.visit" states='waiting_treatment' start_field="time_start" end_field="time_stop" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"orange":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
||||||
<field name="patient_id"/>
|
<field name="patient_id"/>
|
||||||
<field name="cycle"/>
|
<field name="cycle_id"/>
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="nurse_id"/>
|
<field name="nurse_id"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<form model="clinic.visit" attrs='{"readonly":[["state","in",["treatment"]]]}' show_company="1">
|
<form model="clinic.visit" attrs='{"readonly":[["state","in",["treatment"]]]}' show_company="1">
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Print" icon="print" action="print_visit"/>
|
<button string="Print" icon="print" action="report_visit_form"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Copy" method="copy"/>
|
<item string="Copy" method="copy"/>
|
||||||
<item string="Create Dialyzer" method="create_dialyzer"/>
|
<item string="Create Dialyzer" method="create_dialyzer"/>
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start"/>
|
<field name="time_start"/>
|
||||||
<field name="time_stop"/>
|
<field name="time_stop"/>
|
||||||
|
<field name="cycle_id"/>
|
||||||
<field name="patient_id"/>
|
<field name="patient_id"/>
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="nurse_id"/>
|
<field name="nurse_id"/>
|
||||||
<field name="cycle_id"/>
|
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -7,8 +7,25 @@ class Migration(migration.Migration):
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
res=get_model("clinic.setting").search([])
|
res=get_model("clinic.setting").search([])
|
||||||
if res:
|
if not res:
|
||||||
return
|
|
||||||
get_model("clinic.setting").create({})
|
get_model("clinic.setting").create({})
|
||||||
|
|
||||||
|
seq_names=[
|
||||||
|
('HDC-','Clinic HD Case'),
|
||||||
|
('VS-', 'Clinic Visit'),
|
||||||
|
('PT-', 'Clinic Patient'),
|
||||||
|
('DT-', 'Clinic Doctor'),
|
||||||
|
('NS-', 'Clinic Nurse'),
|
||||||
|
]
|
||||||
|
for prefix, seq_name in seq_names:
|
||||||
|
seq_ids=get_model('sequence').search([['name','=',seq_name]])
|
||||||
|
if not seq_ids:
|
||||||
|
get_model("sequence").create({
|
||||||
|
'prefix': prefix,
|
||||||
|
'name': seq_name,
|
||||||
|
'type': 'other',
|
||||||
|
})
|
||||||
|
print("create seq %s successfully " % seq_name)
|
||||||
|
return
|
||||||
|
|
||||||
Migration.register()
|
Migration.register()
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
from . import comorbidity
|
|
||||||
from . import morbidity
|
|
||||||
from . import education
|
|
||||||
from . import setting
|
|
||||||
from . import graduation
|
|
||||||
from . import nation
|
|
||||||
from . import race
|
|
||||||
from . import cause_chronic
|
from . import cause_chronic
|
||||||
from . import schedule
|
from . import comorbidity
|
||||||
|
from . import department
|
||||||
|
from . import doctor
|
||||||
|
from . import education
|
||||||
|
from . import graduation
|
||||||
|
from . import morbidity
|
||||||
|
from . import nation
|
||||||
|
from . import nurse
|
||||||
from . import patient
|
from . import patient
|
||||||
from . import patient_schedule
|
from . import patient_schedule
|
||||||
from . import patient_cause_line
|
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 department
|
from . import race
|
||||||
from . import doctor
|
from . import report_hd
|
||||||
from . import nurse
|
from . import report_dialyzer_drop
|
||||||
|
from . import schedule
|
||||||
|
from . import setting
|
||||||
from . import visit
|
from . import visit
|
||||||
from . import visit_line
|
from . import visit_line
|
||||||
from . import visit_plan
|
from . import visit_plan
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
from . import comorbidity
|
||||||
|
from . import morbidity
|
||||||
|
from . import education
|
||||||
|
from . import setting
|
||||||
|
from . import graduation
|
||||||
|
from . import nation
|
||||||
|
from . import race
|
||||||
|
from . import cycle
|
||||||
|
from . import cause_chronic
|
||||||
|
from . import schedule
|
||||||
|
from . import patient
|
||||||
|
from . import patient_schedule
|
||||||
|
from . import patient_cause_line
|
||||||
|
from . import patient_comorbidity_line
|
||||||
|
from . import patient_morbidity_line
|
||||||
|
from . import department
|
||||||
|
from . import doctor
|
||||||
|
from . import nurse
|
||||||
|
from . import visit
|
||||||
|
from . import visit_plan
|
||||||
|
from . import report_hd
|
||||||
|
from . import hd_case
|
||||||
|
from . import hd_case_line
|
||||||
|
from . import hd_case_discont
|
||||||
|
from . import dialyzer
|
||||||
|
from . import report_dialyzer_drop
|
||||||
|
from . import department
|
||||||
|
from . import education
|
||||||
|
from . import setting
|
||||||
|
from . import graduation
|
||||||
|
from . import nation
|
||||||
|
from . import race
|
||||||
|
from . import cause_chronic
|
||||||
|
from . import dialyzer_line
|
||||||
|
from . import import_payment
|
||||||
|
from . import file_sheet
|
|
@ -0,0 +1,27 @@
|
||||||
|
from netforce.model import Model, fields
|
||||||
|
|
||||||
|
class ClinicRound(Model):
|
||||||
|
_name="clinic.round"
|
||||||
|
_string="Round"
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"name": fields.Char("Name",required=True,search=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_data(self,context={}):
|
||||||
|
lines=[]
|
||||||
|
for i in range(10):
|
||||||
|
line={
|
||||||
|
'no': i,
|
||||||
|
'doctor': 'Doctor %s'%i,
|
||||||
|
#......
|
||||||
|
}
|
||||||
|
lines.append(line)
|
||||||
|
|
||||||
|
data={
|
||||||
|
'lines': lines,
|
||||||
|
}
|
||||||
|
print('data ', data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
ClinicRound.register()
|
|
@ -1,37 +1,17 @@
|
||||||
from datetime import datetime, timedelta
|
|
||||||
|
|
||||||
from netforce.model import Model, fields
|
from netforce.model import Model, fields
|
||||||
|
|
||||||
FMT_DATE="%Y-%m-%d %H:%M:%S"
|
|
||||||
|
|
||||||
class Cycle(Model):
|
class Cycle(Model):
|
||||||
_name="clinic.cycle"
|
_name="clinic.cycle"
|
||||||
_string="Cycle"
|
_string="Cycle"
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"name": fields.Char("Name",required=True,search=True),
|
"name": fields.Char("Name",required=True,search=True),
|
||||||
#"time_start": fields.DateTime("Time Start"),
|
|
||||||
#"time_stop": fields.DateTime("Time Stop"),
|
|
||||||
'duration': fields.Integer("Duration (hrs)"),
|
'duration': fields.Integer("Duration (hrs)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_time_stop(self,context):
|
|
||||||
time_stop=datetime.now()+timedelta(seconds=3600)
|
|
||||||
return time_stop.strftime(FMT_DATE)
|
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
#'time_start': lambda *a: datetime.now().strftime(FMT_DATE),
|
|
||||||
#'time_stop': _get_time_stop,
|
|
||||||
'duration': 1,
|
'duration': 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
def onchange_duration(self,context={}):
|
|
||||||
data=context['data']
|
|
||||||
duration=data['duration']
|
|
||||||
seconds=duration*3600
|
|
||||||
time_start=data['time_start']
|
|
||||||
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
Cycle.register()
|
Cycle.register()
|
||||||
|
|
|
@ -32,7 +32,10 @@ class Dialyzer(Model):
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
while 1:
|
while 1:
|
||||||
seq_id=get_model("sequence").find_sequence(name="Clinic Dializer")
|
seq_name='Clinic Dialyzer'
|
||||||
|
seq_id=get_model("sequence").find_sequence(name=seq_name)
|
||||||
|
if not seq_id:
|
||||||
|
raise Exception("Can not found sequence %s"%seq_name)
|
||||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||||
if not num:
|
if not num:
|
||||||
return None
|
return None
|
||||||
|
@ -61,7 +64,8 @@ class Dialyzer(Model):
|
||||||
_defaults={
|
_defaults={
|
||||||
"state": "new",
|
"state": "new",
|
||||||
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
"number": _get_number,
|
#"number": _get_number,
|
||||||
|
'number': '/',
|
||||||
"max_use_time": 10,
|
"max_use_time": 10,
|
||||||
"use_time": 0,
|
"use_time": 0,
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
|
@ -105,7 +109,7 @@ class Dialyzer(Model):
|
||||||
cust_loc_id=res[0]
|
cust_loc_id=res[0]
|
||||||
|
|
||||||
prod=obj.product_id
|
prod=obj.product_id
|
||||||
wh_loc_id=prod.location_id.id
|
wh_loc_id=prod.location_id.id # product -> tab inventory -> warehouse filed
|
||||||
if not wh_loc_id:
|
if not wh_loc_id:
|
||||||
res=get_model("stock.location").search([["type","=","internal"]])
|
res=get_model("stock.location").search([["type","=","internal"]])
|
||||||
if not res:
|
if not res:
|
||||||
|
@ -127,7 +131,13 @@ class Dialyzer(Model):
|
||||||
pick_id=picking_obj.create(pick_vals,context={"pick_type": "out"})
|
pick_id=picking_obj.create(pick_vals,context={"pick_type": "out"})
|
||||||
pick=picking_obj.browse(pick_id)
|
pick=picking_obj.browse(pick_id)
|
||||||
pick.set_done([pick_id])
|
pick.set_done([pick_id])
|
||||||
obj.write({"state": "active"})
|
number=obj.number.replace("/","")
|
||||||
|
if not number:
|
||||||
|
number=self._get_number(context)
|
||||||
|
obj.write({
|
||||||
|
"number": number,
|
||||||
|
"state": "active",
|
||||||
|
})
|
||||||
return {
|
return {
|
||||||
'next':{
|
'next':{
|
||||||
'name': 'clinic_dialyzer',
|
'name': 'clinic_dialyzer',
|
||||||
|
|
|
@ -31,12 +31,19 @@ class HDcase(Model):
|
||||||
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True),
|
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
|
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
|
||||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
|
"cycle_id" : fields.Many2One("clinic.cycle","Cycle", required=True),
|
||||||
"wh_start": fields.Float("Wt.Kg start"),
|
"wh_start": fields.Float("Wt.Kg start"),
|
||||||
"wh_stop": fields.Float("Wt.Kg stop"),
|
"wh_stop": fields.Float("Wt.Kg stop"),
|
||||||
"bp_start": fields.Integer("BP mmHG start"),
|
"bp_start": fields.Integer("BP mmHG start"),
|
||||||
"per_bp_start": fields.Integer("/Per start"),
|
"per_bp_start": fields.Integer("/Per start"),
|
||||||
"bp_stop": fields.Integer("BP mmHG stop"),
|
"bp_stop": fields.Integer("BP mmHG stop"),
|
||||||
"per_bp_stop": fields.Integer("/Per stop"),
|
"per_bp_stop": fields.Integer("/Per stop"),
|
||||||
|
"epo_tn" : fields.Char("EpoTn (Drug name)"),
|
||||||
|
"epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
|
||||||
|
"hct": fields.Integer("HCT %", required=True),
|
||||||
|
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
||||||
|
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
||||||
|
"state": fields.Selection([("draft","Draft"),("confirmed","Confirmed"),("approved","Approved"),("cancelled","Cancelled"),("paid","Paid")],"Status",required=True),
|
||||||
"hct": fields.Integer("HCT %"),
|
"hct": fields.Integer("HCT %"),
|
||||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("uncompleted","Uncompleted")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("uncompleted","Uncompleted")],"Status",required=True),
|
||||||
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dializers"),
|
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dializers"),
|
||||||
|
@ -91,7 +98,6 @@ class HDcase(Model):
|
||||||
"number": _get_number,
|
"number": _get_number,
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
"fee": 1500,
|
"fee": 1500,
|
||||||
'cycle': '1',
|
|
||||||
}
|
}
|
||||||
_order="date desc,number desc"
|
_order="date desc,number desc"
|
||||||
|
|
||||||
|
@ -158,6 +164,18 @@ class HDcase(Model):
|
||||||
data['total']=total
|
data['total']=total
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def onchange_hct(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
hct=data['hct']
|
||||||
|
if (hct>39):
|
||||||
|
print ("Test1")
|
||||||
|
else:
|
||||||
|
print ("Test3")
|
||||||
|
|
||||||
|
def cancelled(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
obj.write({" state":"cancelled"})
|
||||||
|
|
||||||
def onchange_gmproduct(self,context={}):
|
def onchange_gmproduct(self,context={}):
|
||||||
data=context['data']
|
data=context['data']
|
||||||
path=context["path"]
|
path=context["path"]
|
||||||
|
@ -430,106 +448,4 @@ class HDcase(Model):
|
||||||
data['fee']=0.0
|
data['fee']=0.0
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def new_visit(self,ids,context={}):
|
|
||||||
obj=self.browse(ids[0])
|
|
||||||
skip_plan_id=0
|
|
||||||
plane=None
|
|
||||||
for plane in obj.planes:
|
|
||||||
if plane.state=='close':
|
|
||||||
continue
|
|
||||||
break
|
|
||||||
# XXX
|
|
||||||
if not plane or plane.state=='close':
|
|
||||||
raise Exception("No Planing")
|
|
||||||
print("found plane ",plane)
|
|
||||||
vals={
|
|
||||||
'date_visit': plane.date,
|
|
||||||
'time_start': plane.time_start,
|
|
||||||
'time_stop': plane.time_stop,
|
|
||||||
'patient_id': obj.patient_id.id,
|
|
||||||
'doctor_id': obj.doctor_id.id,
|
|
||||||
'nurse_id': obj.nurse_id.id,
|
|
||||||
'department_id': obj.department_id.id,
|
|
||||||
'planes': [],
|
|
||||||
'dialyzers': [],
|
|
||||||
#'state': 'waiting_treatment',
|
|
||||||
'state': 'draft', # XXX need to gen new doc
|
|
||||||
}
|
|
||||||
plane.write({
|
|
||||||
'state': 'close',
|
|
||||||
})
|
|
||||||
visit_id=get_model("clinic.visit").create(vals)
|
|
||||||
visit=get_model('clinic.visit').browse(visit_id)
|
|
||||||
skip_plan_id=plane.id
|
|
||||||
# copy remaining plane to new visit
|
|
||||||
new_planes=[]
|
|
||||||
for pl in obj.planes:
|
|
||||||
# XXX
|
|
||||||
if skip_plan_id==pl.id:
|
|
||||||
continue
|
|
||||||
if pl.state=='close':
|
|
||||||
continue
|
|
||||||
print("pl state ", pl.state)
|
|
||||||
line={
|
|
||||||
'date': pl.date,
|
|
||||||
'time_start': pl.time_start,
|
|
||||||
'time_stop': pl.time_stop,
|
|
||||||
'visit_id': visit_id,
|
|
||||||
}
|
|
||||||
new_planes.append(('create',line))
|
|
||||||
new_dialyzers=[]
|
|
||||||
for dlz in obj.dialyzers:
|
|
||||||
if dlz.use_time > dlz.dialyzer_id.max_use_time:
|
|
||||||
continue
|
|
||||||
use_time=(dlz.use_time or 0)+1
|
|
||||||
line={
|
|
||||||
"visit_id": visit_id,
|
|
||||||
"dialyzer_id": dlz.dialyzer_id.id,
|
|
||||||
"description": dlz.description,
|
|
||||||
"use_time": use_time,
|
|
||||||
"max_use_time": dlz.max_use_time,
|
|
||||||
"member_type": dlz.member_type,
|
|
||||||
"dialyzer_type": dlz.dialyzer_type,
|
|
||||||
"bid_flow_rate": dlz.bid_flow_rate,
|
|
||||||
"ultrafittration": dlz.ultrafittration,
|
|
||||||
}
|
|
||||||
new_dialyzers.append(('create',line))
|
|
||||||
vals={
|
|
||||||
'planes': new_planes,
|
|
||||||
'dialyzers': new_dialyzers,
|
|
||||||
}
|
|
||||||
visit.write(vals)
|
|
||||||
return {
|
|
||||||
'next': {
|
|
||||||
'name': "clinic_visit",
|
|
||||||
'mode': 'form',
|
|
||||||
'active_id': visit_id,
|
|
||||||
},
|
|
||||||
'flash': "New visit is created",
|
|
||||||
}
|
|
||||||
|
|
||||||
def onchange_dateplane(self,context={}):
|
|
||||||
data=context["data"]
|
|
||||||
path=context["path"]
|
|
||||||
line=get_data_path(data,path,parent=True)
|
|
||||||
start_date=line.get("date")
|
|
||||||
if not start_date:
|
|
||||||
return {}
|
|
||||||
timenow=time.strftime("%H:%M:%S")
|
|
||||||
timevisit=timenow
|
|
||||||
# XXX
|
|
||||||
timevisit=data['time_start'][11:20]
|
|
||||||
fmt_date="%Y-%m-%d %H:%M:%S"
|
|
||||||
fix_hrs=data['total_time'] or 0 # XXX
|
|
||||||
time_start=datetime.strptime("%s %s"%(start_date,timevisit),fmt_date)
|
|
||||||
seconds=fix_hrs*3600
|
|
||||||
time_stop=time_start+timedelta(seconds=seconds)
|
|
||||||
line['time_start']=time_start.strftime(fmt_date)
|
|
||||||
line['time_stop']=time_stop.strftime(fmt_date)
|
|
||||||
if not line.get('state'):
|
|
||||||
line['state']='open'
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
HDcase.register()
|
HDcase.register()
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class DialyzerDrop(Model):
|
||||||
|
_name="report.dialyzer.drop"
|
||||||
|
_string="Dialyzer [Drop]"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Date"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
"state" : "drop",
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
lines=[]
|
||||||
|
|
||||||
|
dialyzer_ids=get_model("clinic.dialyzer").search([["state","=","drop"]])
|
||||||
|
hd_cases=get_model("clinic.dialyzer").search_browse([])
|
||||||
|
for dialyzer_ids in hd_cases:
|
||||||
|
lines.append({
|
||||||
|
'number' : dialyzer_ids.number,
|
||||||
|
'usetime': dialyzer_ids.use_time,
|
||||||
|
'maxuse' : dialyzer_ids.max_use_time,
|
||||||
|
'createdate' : dialyzer_ids.date,
|
||||||
|
'expdate' : dialyzer_ids.exp_date,
|
||||||
|
'patient' : dialyzer_ids.patient_id.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
data={
|
||||||
|
'lines': lines or "Dialyzer Drop [Empty]",
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
DialyzerDrop.register()
|
|
@ -0,0 +1,41 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class HDReport(Model):
|
||||||
|
_name="clinic.hd.report"
|
||||||
|
_string="HD Report"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
"date": fields.Date("Date"),
|
||||||
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_order="cycle_id desc"
|
||||||
|
|
||||||
|
def get_report_data(self,ids,context={}):
|
||||||
|
lines=[]
|
||||||
|
hd_case_ids=get_model("clinic.dialyzer").search([["state","=","completed"]])
|
||||||
|
hd_cases=get_model("clinic.hd.case").search_browse([])
|
||||||
|
for hd_case_ids in hd_cases:
|
||||||
|
lines.append({
|
||||||
|
'cycle' : hd_case_ids.cycle_id.name,
|
||||||
|
'patient': hd_case_ids.patient_id.name,
|
||||||
|
'doctor' : hd_case_ids.doctor_id.name,
|
||||||
|
'total' : hd_case_ids.fee,
|
||||||
|
'rc_no' : hd_case_ids.number,
|
||||||
|
'nurse' : hd_case_ids.nurse_id.name,
|
||||||
|
})
|
||||||
|
|
||||||
|
data={
|
||||||
|
'cycle_id': hd_case_ids.cycle or "Empty Cyle",
|
||||||
|
'lines': lines,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
HDReport.register()
|
|
@ -26,16 +26,15 @@ class Visit(Model):
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
"date": fields.Date("Date Visit"),
|
|
||||||
"time_start": fields.DateTime("Time Start"),
|
"time_start": fields.DateTime("Time Start"),
|
||||||
"time_stop": fields.DateTime("Time Stop"),
|
"time_stop": fields.DateTime("Time Stop"),
|
||||||
"patient_id": fields.Many2One("clinic.patient","Patient",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",search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
||||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
|
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
||||||
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
"company_id": fields.Many2One("company","Company"),
|
"company_id": fields.Many2One("company","Company"),
|
||||||
'time_use': fields.Integer("Fix Hour"),
|
|
||||||
'late_visit': fields.Integer("Late Vist",function="_get_visit_late", store=True),
|
|
||||||
'hd_cases': fields.One2Many('clinic.hd.case','visit_id',"HD Cases",readonly=True),
|
'hd_cases': fields.One2Many('clinic.hd.case','visit_id',"HD Cases",readonly=True),
|
||||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
||||||
|
@ -44,7 +43,10 @@ class Visit(Model):
|
||||||
|
|
||||||
def _get_number( self,context={}):
|
def _get_number( self,context={}):
|
||||||
while 1:
|
while 1:
|
||||||
seq_id=get_model("sequence").find_sequence(name="Clinic Visit")
|
seq_name='Clinic Visit'
|
||||||
|
seq_id=get_model("sequence").find_sequence(name=seq_name)
|
||||||
|
if not seq_id:
|
||||||
|
raise Exception("Can not found sequence %s"%seq_name)
|
||||||
num=get_model("sequence").get_next_number(seq_id,context=context)
|
num=get_model("sequence").get_next_number(seq_id,context=context)
|
||||||
if not num:
|
if not num:
|
||||||
return None
|
return None
|
||||||
|
@ -77,14 +79,11 @@ class Visit(Model):
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
"state": "draft",
|
"state": "draft",
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
|
||||||
'time_start': _get_time_start,
|
'time_start': _get_time_start,
|
||||||
'time_stop': _get_time_stop,
|
'time_stop': _get_time_stop,
|
||||||
"number": "/",
|
"number": "/",
|
||||||
"company_id": lambda *a: get_active_company(),
|
"company_id": lambda *a: get_active_company(),
|
||||||
'nurse_id': _get_nurse,
|
'nurse_id': _get_nurse,
|
||||||
'cycle': '1',
|
|
||||||
'time_use': 1,
|
|
||||||
}
|
}
|
||||||
_order="id desc"
|
_order="id desc"
|
||||||
|
|
||||||
|
@ -120,6 +119,7 @@ class Visit(Model):
|
||||||
'department_id': obj.department_id.id,
|
'department_id': obj.department_id.id,
|
||||||
'time_start': obj.time_start,
|
'time_start': obj.time_start,
|
||||||
'time_stop': obj.time_stop,
|
'time_stop': obj.time_stop,
|
||||||
|
'cycle_id' : obj.cycle_id.id,
|
||||||
'visit_id': obj.id,
|
'visit_id': obj.id,
|
||||||
'cycle_id': obj.cycle_id.id,
|
'cycle_id': obj.cycle_id.id,
|
||||||
#'fee': include_fee and 1500.00 or 0.0,
|
#'fee': include_fee and 1500.00 or 0.0,
|
||||||
|
@ -139,7 +139,7 @@ class Visit(Model):
|
||||||
categ_name=patient_type.get(obj.patient_id.type)
|
categ_name=patient_type.get(obj.patient_id.type)
|
||||||
categ_ids=get_model("partner.categ").search([['name','=',categ_name]])
|
categ_ids=get_model("partner.categ").search([['name','=',categ_name]])
|
||||||
if not categ_ids:
|
if not categ_ids:
|
||||||
raise Exception("Category: %s not found"%categ_name)
|
raise Exception("Partner Category: %s not found"%categ_name)
|
||||||
partner_id=None
|
partner_id=None
|
||||||
if obj.patient_id.type in ("mg","sc","nhso"):
|
if obj.patient_id.type in ("mg","sc","nhso"):
|
||||||
partner_obj=get_model("partner")
|
partner_obj=get_model("partner")
|
||||||
|
@ -179,6 +179,7 @@ class Visit(Model):
|
||||||
else:
|
else:
|
||||||
data['doctor_id']=None
|
data['doctor_id']=None
|
||||||
data['department_id']=None
|
data['department_id']=None
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def copy(self,ids,context={}) :
|
def copy(self,ids,context={}) :
|
||||||
|
@ -198,6 +199,7 @@ class Visit(Model):
|
||||||
'mode': 'form',
|
'mode': 'form',
|
||||||
'active_id': new_id,
|
'active_id': new_id,
|
||||||
},
|
},
|
||||||
|
|
||||||
'flash': 'Visit %s is copy to %s'%(obj.number,new_obj.number),
|
'flash': 'Visit %s is copy to %s'%(obj.number,new_obj.number),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,6 +224,7 @@ class Visit(Model):
|
||||||
'doctor_name': obj.doctor_id.name or "",
|
'doctor_name': obj.doctor_id.name or "",
|
||||||
'nurse_name': obj.nurse_id.name or "",
|
'nurse_name': obj.nurse_id.name or "",
|
||||||
'print_date': time.strftime("%d/%m/%Y"),
|
'print_date': time.strftime("%d/%m/%Y"),
|
||||||
|
'cycle_name': obj.cycle_id.name or "",
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -237,14 +240,4 @@ class Visit(Model):
|
||||||
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def create_dialyzer(self,ids,context={}):
|
|
||||||
return {
|
|
||||||
'next': {
|
|
||||||
'name': 'clinic_dialyzer',
|
|
||||||
'mode': 'form',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Visit.register()
|
Visit.register()
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,58 @@
|
||||||
|
<center>
|
||||||
|
<h2>
|
||||||
|
Dialyzers [Drop]
|
||||||
|
</h2>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Number
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Use (Time)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Max Use (Time)
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Create Date
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Expire Date
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Patient
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines context=context}}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{number}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{usetime}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{maxuse}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{createdate}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{expdate}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{patient}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr style="font-weight:bold">
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<center>
|
||||||
|
<h2>
|
||||||
|
HD Case Report
|
||||||
|
</h2>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Cycle
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Patient
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Doctor
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
HD Fee
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
RC.No
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Nurse
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines context=context}}
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" style="font-weight:bold">
|
||||||
|
{{cycle}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{patient}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{doctor}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{total}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{rc_no}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{nurse}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr style="font-weight:bold">
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<center>
|
||||||
|
<h2>
|
||||||
|
HD Case Report
|
||||||
|
</h2>
|
||||||
|
</center>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead class="scroll-header">
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Cycle
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Patient
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Doctor
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
HD Fee
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
RC.No
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Nurse
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each lines context=context}}
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" style="font-weight:bold">
|
||||||
|
{{cycle}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{patient}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{doctor}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{total}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{rc_no}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{nurse}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr style="font-weight:bold">
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
|
@ -0,0 +1 @@
|
||||||
|
<h1>Hello HBS</h1>
|
Loading…
Reference in New Issue