Treatment_Summary & Dialyzer_Drop [Report]

conv_bal
chayut.s 2014-10-13 15:10:20 +07:00
parent 5aee7a60b5
commit a307836918
28 changed files with 469 additions and 100 deletions

View File

@ -0,0 +1,6 @@
<action>
<field name="string">Cycle</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.cycle</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -0,0 +1,3 @@
<form model="clinic.cycle">
<field name="name"/>
</form>

View File

@ -0,0 +1,3 @@
<list model="clinic.cycle">
<field name="name"/>
</list>

View File

@ -0,0 +1,5 @@
<form model="report.dialyzer.drop">
<group form_layout="stacked">
<field name="date" span="4"/>
</group>
</form>

View File

@ -8,16 +8,17 @@
<group span="6" columns="1">
<field name="number"/>
<field name="date"/>
<field name="nurse_id"/>
<field name="time_start"/>
<field name="total_time"/>
<field name="visit_id"/>
<field name="cycle_id"/>
<field name="department_id"/>
</group>
<group span="6" columns="1">
<field name="visit_id"/>
<field name="patient_id" onchange="onchange_patient"/>
<field name="doctor_id"/>
<field name="time_stop"/>
<field name="nurse_id"/>
<field name="department_id"/>
<field name="total_time"/>
</group>
<tabs>
<tab string="Dialyzer">
@ -44,7 +45,7 @@
<field name="per_bp_stop"/>
<field name="epo_tn"/>
<field name="epo_unit"/>
<field name="hct" onchange="onchange_htc"/>
<field name="hct" onchange="onchange_hct"/>
</tab>
<tab string="Next Visit">
<separator string="Click Options-> New Visit"/>
@ -64,7 +65,6 @@
</tabs>
<separator string="Other Expenses"/>
<field name="lines" count="3" nolabel="1">
>>>>>>> e1240368c0b451851115891dd7ace7423682a225
<list>
<field name="product_id" onchange="onchange_product"/>
<field name="description"/>
@ -85,8 +85,6 @@
<field name="amount"/>
</list>
</field>
<field name="fee" offset="7"/>
<field name="fee_partner_id" domain="[['type','=','org']]" attrs='{"required":[["fee","!=",0]]}' offset="7"/>
<group span="4" columns="1">
</group>
<separator string="HD Case Treatment Summary"/>

View File

@ -1,9 +1,8 @@
<list model="clinic.hd.case">
<field name="number"/>
<field name="time_start"/>
<field name="time_stop"/>
<field name="patient_id"/>
<field name="doctor_id"/>
<field name="fee"/>
<field name="nurse_id"/>
<field name="state"/>
</list>

View File

@ -1,4 +1,6 @@
<form model="clinic.hd.report">
<field name="cycle"/>
<field name="date"/>
<group form_layout="stacked">
<field name="date" span="2"/>
<field name="cycle_id" span="2"/>
</group>
</form>

View File

@ -23,15 +23,18 @@
<!--<item string="Visit" action="clinic_visit"/>-->
<!--</item>-->
<item string="Reports">
<item string="Treatment Report" action="clinic_hd_report"/>
<item string="Clinic Round(Testing)" action="clinic_round_report"/>
<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="Round" action="clinic_round"/>
<!-- <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"/>
</item>
</menu>

View File

@ -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" 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"/>

View File

@ -12,7 +12,7 @@
<group span="6" columns="1">
<field name="number"/>
<field name="date_visit" onchange="onchange_date_visit"/>
<field name="cycle"/>
<field name="cycle_id" onchange="onchange_cycle"/>
</group>
<group span="6" columns="1">
<field name="patient_id" onchange="onchange_patient"/>

View File

@ -2,7 +2,7 @@
<field name="late_visit" invisible="1"/>
<field name="number"/>
<field name="date_visit"/>
<field name="cycle"/>
<field name="cycle_id"/>
<field name="patient_id"/>
<field name="doctor_id"/>
<field name="nurse_id"/>

View File

@ -1,36 +1,37 @@
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 cycle
from . import department
from . import dialyzer
from . import dialyzer_line
from . import doctor
from . import education
from . import file_sheet
from . import graduation
from . import hd_case
from . import hd_case_line
from . import hd_case_discont
from . import import_payment
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_plan
from . import clinic_round
from . import clinic_round_report
from . import report_hd
from . import hd_case
from . import hd_case_line
from . import hd_case_discont
from . import dialyzer
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

View File

@ -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

View File

@ -0,0 +1,11 @@
from netforce.model import Model, fields
class Cycle(Model):
_name="clinic.cycle"
_string="Cycle"
_fields={
"name": fields.Char("Name",required=True,search=True),
}
Cycle.register()

View File

@ -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',

View File

@ -27,9 +27,8 @@ class HDcase(Model):
"patient_id": fields.Many2One("clinic.patient","Patient",required=True,search=True),
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=True,search=True),
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
"date_start": fields.DateTime("Time start",required=True,search=True),
"date_stop": fields.DateTime("Time stop",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"),
@ -81,6 +80,7 @@ class HDcase(Model):
return num
get_model("sequence").increment_number(seq_id,context=context)
def _get_nurse(self,context={}):
user_id=get_active_user()
print("user_id ",user_id)
@ -89,6 +89,9 @@ class HDcase(Model):
return nurse_ids[0]
return None
_defaults={
"state": "draft",
"date": lambda *a: time.strftime("%Y-%m-%d"),
@ -97,7 +100,6 @@ class HDcase(Model):
'nurse_id': _get_nurse,
"number": _get_number,
"company_id": lambda *a: get_active_company(),
"fee": 1500,
}
_order="date desc,number desc"
@ -164,16 +166,18 @@ class HDcase(Model):
data['total']=total
return data
def onchange_htc(self,context={}):
data=context['htc']
total=0.0
if (htc > 39):
data['htc']=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"})
obj.write({" state":"cancelled"})
def make_invoices(self,ids,context={}):
setting=get_model("settings").browse(1)
@ -382,7 +386,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):
@ -475,7 +479,7 @@ class HDcase(Model):
'active_id': visit_id,
},
'flash': "New visit is created",
}
}
def onchange_dateplane(self,context={}):
data=context["data"]

View File

@ -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()

View File

@ -1,6 +1,6 @@
import time
from netforce.model import Model, fields
from netforce.model import Model, fields, get_model
class HDReport(Model):
_name="clinic.hd.report"
@ -9,21 +9,39 @@ class HDReport(Model):
_fields={
"date": fields.Date("Date"),
"cycle": fields.Selection([("1","One"),("2","Two"),("3","Three"),("4","Four")],"Cycle"),
"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={}):
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>.")
if not ids:
return {}
obj=self.browse(ids)[0]
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,
#'Patient_Type' : patient.type,
'total' : hd_case_ids.fee,
'rc_no' : hd_case_ids.number,
#'dz' : hd_case.dialyzers,
'nurse' : hd_case_ids.nurse_id.name,
})
#get_model('clinic.patient').search
#[{'name': 1}, {'name': 2}]
data={
'cycle': obj.cycle or "Empty Cyle"
'cycle_id': hd_case_ids.cycle or "Empty Cyle",
#'patient_id' : obj.patient or "",
#'doctor_id' : obj.doctor or "",
'lines': lines,
}
return data

View File

@ -31,7 +31,7 @@ class Visit(Model):
"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),
"cycle": fields.Selection([("1","One"),("2","Two"),("3","Tree"),("4","Four")],"Cycle",required=True),
"cycle_id" : fields.Many2One("clinic.cycle","Cycle",required=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"),
@ -45,9 +45,12 @@ class Visit(Model):
'hd_cases': fields.One2Many('clinic.hd.case','visit_id',"HD Cases",readonly=True),
}
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
@ -67,6 +70,23 @@ class Visit(Model):
return nurse_ids[0]
return None
def _get_doctor(self,context={}):
user_id=get_active_user()
print("user_id",user_id)
doctor_ids=get_model("clinic.doctor").search([['user_id','=',user_id]])
if doctor_ids:
return doctor_ids[0]
return None
def _get_cycle(self,context={}):
user_id=get_active_user()
print("user_id",user_id)
cycle_ids=get_model("clinic.cycle").search([['user_id','=',user_id]])
if cycle_ids:
return cycle_ids[0]
return None
def _get_time_start(self,context={}):
now=datetime.datetime.now()
starttime=now.strftime("%Y-%m-%d %H:%M:%S")
@ -80,13 +100,15 @@ class Visit(Model):
_defaults={
"state": "draft",
"cycle": "1",
#"cycle": "One",
'date_visit': 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,
'doctor_id' : _get_doctor,
'cycle_id' : _get_cycle ,
'time_use': 1,
}
_order="id desc"
@ -127,6 +149,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,
'fee': include_fee and 1500.00 or 0.0,
'fee_type': obj.patient_id.type,
@ -145,7 +168,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")
@ -184,9 +207,10 @@ 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']
@ -204,9 +228,29 @@ class Visit(Model):
else:
data['doctor_id']=None
data['department_id']=None
return data
def copy(self,ids,context={}):
def onchange_cycle(self,context={}):
data=context['data']
cycle_id=data['cycle_id']
visits=self.search_browse([['cycle_id','=',cycle_id]],order="number desc")
if visits:
visit=visits[0]
data['doctor_id']=visit.doctor_id.id
data['patient']=visit.patient_id.id
cycle=int(visit.cycle)+1
data['cycle']=str(cycle)
if cycle>4:
data['cycle']='1'
else:
data['doctor_id']=None
data['patient_id']=None
data['department_id']=None
return data
def copy(self,ids,context={}) :
obj=self.browse(ids[0])
vals={
'patient_id': obj.patient_id.id,
@ -230,21 +274,11 @@ class Visit(Model):
'mode': 'form',
'active_id': new_id,
},
'flash': 'Visit %s is copy to %s'%(obj.number,new_obj.number),
}
def get_visit_demo(self,context={}):
if not context.get('number'):
return {}
visit_id=int(context['number'])
visit=self.browse(visit_id)
data={
'number' : visit.number
}
return data
def delete(self,ids,context={}):
for obj in self.browse(ids):
if obj.state!='draft':
@ -257,7 +291,7 @@ class Visit(Model):
return {}
ref_id=int(ref_id)
obj=self.browse(ref_id)
cycle_list={'1': 'One','2': 'Two','3': 'Tree','4': 'Four'}
#cycle_list={'1': 'One','2': 'Two','3': 'Tree','4': 'Four'}
data={
'number': obj.number,
'date_visit': obj.date_visit,
@ -265,7 +299,7 @@ class Visit(Model):
'patient_name': obj.patient_id.name or "",
'doctor_name': obj.doctor_id.name or "",
'nurse_name': obj.nurse_id.name or "",
'cycle': cycle_list.get(obj.cycle,""),
'cycle_name': obj.cycle_id.name or "",
'print_date': time.strftime("%d/%m/%Y"),
}
return data
@ -288,7 +322,7 @@ class Visit(Model):
line["bid_flow_rate"]=dialyzer.bid_flow_rate
line["ultrafittration"]=dialyzer.ultrafittration
line["state"]=dialyzer.state
return data
return data
def onchange_timeuse(self,context={}):
data=context["data"]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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>

View File

@ -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>

View File

@ -1 +1,63 @@
<h1 style="color: red">Cycle {{cycle}}</h1>
<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>