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>
|
|
@ -3,6 +3,6 @@
|
|||
<field name="view_cls">multi_view</field>
|
||||
<field name="model">clinic.visit</field>
|
||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Waiting Treatment",[["state","=","waiting_treatment"]]],["Treatment",[["state","=","treatment"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
||||
<field name="modes">list,calendar,form</field>
|
||||
<field name="modes">list,calendar,form</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<action>
|
||||
<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="template">visit</field>
|
||||
<field name="template">round</field>
|
||||
</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>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<!--<item string="New Visit" method="new_visit"/>-->
|
||||
<item string="TODO" method="todo"/>
|
||||
</button>
|
||||
</head>
|
||||
<group span="6" columns="1">
|
||||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="nurse_id"/>
|
||||
<field name="visit_id"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="patient_id" onchange="onchange_patient"/>
|
||||
<field name="time_stop"/>
|
||||
<field name="duration"/>
|
||||
<field name="department_id"/>
|
||||
<field name="visit_id"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
</group>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
|
@ -74,7 +74,6 @@
|
|||
</field>
|
||||
<group span="8" 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]]}'/>
|
||||
</group>
|
||||
<group span="2" columns="1">
|
||||
|
@ -92,7 +91,6 @@
|
|||
<foot>
|
||||
<button string="Confirm" type="success" method="confirm" states="draft"/>
|
||||
<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"/>
|
||||
</foot>
|
||||
<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="Treatments" action="clinic_hd_case"/>
|
||||
<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 string="Imports">
|
||||
<item string="Import Payments" action="clinic_import_payment"/>
|
||||
</item>
|
||||
<item string="Settings">
|
||||
<!-- <item string="Cycle" action="clinic_cycle"/>-->
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
<item string="Cycle" action="clinic_cycle"/>
|
||||
<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' 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="cycle"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="number"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<form model="clinic.visit" attrs='{"readonly":[["state","in",["treatment"]]]}' show_company="1">
|
||||
<head>
|
||||
<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">
|
||||
<item string="Copy" method="copy"/>
|
||||
<item string="Create Dialyzer" method="create_dialyzer"/>
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="time_stop"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -7,8 +7,25 @@ class Migration(migration.Migration):
|
|||
|
||||
def migrate(self):
|
||||
res=get_model("clinic.setting").search([])
|
||||
if res:
|
||||
return
|
||||
get_model("clinic.setting").create({})
|
||||
if not res:
|
||||
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()
|
||||
|
|
|
@ -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 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_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 race
|
||||
from . import report_hd
|
||||
from . import report_dialyzer_drop
|
||||
from . import schedule
|
||||
from . import setting
|
||||
from . import visit
|
||||
from . import visit_line
|
||||
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
|
||||
|
||||
FMT_DATE="%Y-%m-%d %H:%M:%S"
|
||||
|
||||
class Cycle(Model):
|
||||
_name="clinic.cycle"
|
||||
_string="Cycle"
|
||||
|
||||
_fields={
|
||||
"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)"),
|
||||
}
|
||||
|
||||
def _get_time_stop(self,context):
|
||||
time_stop=datetime.now()+timedelta(seconds=3600)
|
||||
return time_stop.strftime(FMT_DATE)
|
||||
|
||||
_defaults={
|
||||
#'time_start': lambda *a: datetime.now().strftime(FMT_DATE),
|
||||
#'time_stop': _get_time_stop,
|
||||
'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()
|
||||
|
|
|
@ -32,7 +32,10 @@ class Dialyzer(Model):
|
|||
|
||||
def _get_number(self,context={}):
|
||||
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)
|
||||
if not num:
|
||||
return None
|
||||
|
@ -61,7 +64,8 @@ class Dialyzer(Model):
|
|||
_defaults={
|
||||
"state": "new",
|
||||
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||
"number": _get_number,
|
||||
#"number": _get_number,
|
||||
'number': '/',
|
||||
"max_use_time": 10,
|
||||
"use_time": 0,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
|
@ -105,7 +109,7 @@ class Dialyzer(Model):
|
|||
cust_loc_id=res[0]
|
||||
|
||||
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:
|
||||
res=get_model("stock.location").search([["type","=","internal"]])
|
||||
if not res:
|
||||
|
@ -127,7 +131,13 @@ class Dialyzer(Model):
|
|||
pick_id=picking_obj.create(pick_vals,context={"pick_type": "out"})
|
||||
pick=picking_obj.browse(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 {
|
||||
'next':{
|
||||
'name': 'clinic_dialyzer',
|
||||
|
|
|
@ -31,12 +31,19 @@ class HDcase(Model):
|
|||
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True),
|
||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,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_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"),
|
||||
"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 %"),
|
||||
"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"),
|
||||
|
@ -91,7 +98,6 @@ class HDcase(Model):
|
|||
"number": _get_number,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
"fee": 1500,
|
||||
'cycle': '1',
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
|
||||
|
@ -158,6 +164,18 @@ class HDcase(Model):
|
|||
data['total']=total
|
||||
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={}):
|
||||
data=context['data']
|
||||
path=context["path"]
|
||||
|
@ -413,7 +431,7 @@ class HDcase(Model):
|
|||
'mode': 'form',
|
||||
'form_view_xml': 'clinic_hd_case_form',
|
||||
'active_id': ids[0],
|
||||
}
|
||||
}
|
||||
|
||||
def delete(self,ids,context={}):
|
||||
for obj in self.browse(ids):
|
||||
|
@ -430,106 +448,4 @@ class HDcase(Model):
|
|||
data['fee']=0.0
|
||||
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()
|
||||
|
|
|
@ -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,25 +26,27 @@ class Visit(Model):
|
|||
|
||||
_fields={
|
||||
"number": fields.Char("Number",required=True,search=True),
|
||||
"date": fields.Date("Date Visit"),
|
||||
"time_start": fields.DateTime("Time Start"),
|
||||
"time_stop": fields.DateTime("Time Stop"),
|
||||
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
|
||||
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse",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"),
|
||||
'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),
|
||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
||||
"comments": fields.One2Many("message","related_id","Comments"),
|
||||
}
|
||||
|
||||
def _get_number(self,context={}):
|
||||
def _get_number( self,context={}):
|
||||
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)
|
||||
if not num:
|
||||
return None
|
||||
|
@ -77,14 +79,11 @@ class Visit(Model):
|
|||
|
||||
_defaults={
|
||||
"state": "draft",
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'time_start': _get_time_start,
|
||||
'time_stop': _get_time_stop,
|
||||
"number": "/",
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'nurse_id': _get_nurse,
|
||||
'cycle': '1',
|
||||
'time_use': 1,
|
||||
}
|
||||
_order="id desc"
|
||||
|
||||
|
@ -120,6 +119,7 @@ class Visit(Model):
|
|||
'department_id': obj.department_id.id,
|
||||
'time_start': obj.time_start,
|
||||
'time_stop': obj.time_stop,
|
||||
'cycle_id' : obj.cycle_id.id,
|
||||
'visit_id': obj.id,
|
||||
'cycle_id': obj.cycle_id.id,
|
||||
#'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_ids=get_model("partner.categ").search([['name','=',categ_name]])
|
||||
if not categ_ids:
|
||||
raise Exception("Category: %s not found"%categ_name)
|
||||
raise Exception("Partner Category: %s not found"%categ_name)
|
||||
partner_id=None
|
||||
if obj.patient_id.type in ("mg","sc","nhso"):
|
||||
partner_obj=get_model("partner")
|
||||
|
@ -164,9 +164,9 @@ class Visit(Model):
|
|||
obj=self.browse(ids)[0]
|
||||
obj.write({"state":"cancelled"})
|
||||
|
||||
def reopen(self,ids,context={}):
|
||||
def reopen(self,ids,context={ }):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({"state":"draft"})
|
||||
obj.write({"state":"draf t"})
|
||||
|
||||
def onchange_patient(self,context={}):
|
||||
data=context['data']
|
||||
|
@ -179,9 +179,10 @@ class Visit(Model):
|
|||
else:
|
||||
data['doctor_id']=None
|
||||
data['department_id']=None
|
||||
|
||||
return data
|
||||
|
||||
def copy(self,ids,context={}):
|
||||
def copy(self,ids,context={}) :
|
||||
obj=self.browse(ids[0])
|
||||
vals={
|
||||
'patient_id': obj.patient_id.id,
|
||||
|
@ -198,6 +199,7 @@ class Visit(Model):
|
|||
'mode': 'form',
|
||||
'active_id': new_id,
|
||||
},
|
||||
|
||||
'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 "",
|
||||
'nurse_name': obj.nurse_id.name or "",
|
||||
'print_date': time.strftime("%d/%m/%Y"),
|
||||
'cycle_name': obj.cycle_id.name or "",
|
||||
}
|
||||
return data
|
||||
|
||||
|
@ -237,14 +240,4 @@ class Visit(Model):
|
|||
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
||||
return data
|
||||
|
||||
|
||||
def create_dialyzer(self,ids,context={}):
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_dialyzer',
|
||||
'mode': 'form',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
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