report hd case

conv_bal
watcha.h 2014-11-22 00:31:10 +07:00
parent d870a49af0
commit 514198043d
12 changed files with 149 additions and 30 deletions

View File

@ -0,0 +1,8 @@
<action>
<field name="string">HD Case Dialy</field>
<field name="view_cls">report</field>
<field name="model">clinic.hd.case.dialy</field>
<field name="report_template">hd_case_dialy</field>
<field name="report_template_xls">hd_case_dialy</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -0,0 +1,3 @@
<form model="clinic.hd.case.dialy">
<field name="date" span="2"/>
</form>

View File

@ -36,8 +36,10 @@
<item string="Visit Dialy" action="clinic_visit_dialy"/> <item string="Visit Dialy" action="clinic_visit_dialy"/>
<item string="Generate Visit" action="clinic_gen_visit_form"/> <item string="Generate Visit" action="clinic_gen_visit_form"/>
</item> </item>
<item string="HD Cases" action="clinic_hd_case"/> <item string="HD Cases">
<!--<item string="POS" icon="arrow-right" url="/static/pos/index.html"/>--> <item string="HD Cases" action="clinic_hd_case"/>
<item string="HD Case Dialy" action="clinic_hd_case_dialy"/>
</item>
<item string="Reports"> <item string="Reports">
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/> <item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
<item string="Medical Summary" action="clinic_report_medical_summary"/> <item string="Medical Summary" action="clinic_report_medical_summary"/>

View File

@ -23,8 +23,9 @@ from . import hd_case_personal
from . import hd_case_gmline from . import hd_case_gmline
from . import hd_case_discont from . import hd_case_discont
from . import hd_case_payment from . import hd_case_payment
from . import hd_case_dialy
from . import hd_case_dialyzer
from . import dialyzer from . import dialyzer
from . import dialyzer_line
from . import import_payment from . import import_payment
from . import cycle from . import cycle
from . import cycle_item from . import cycle_item

View File

@ -1,20 +0,0 @@
from netforce.model import Model, fields
class DialyzerLine(Model):
_name="clinic.dialyzer.line"
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
"visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"),
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True),
"description": fields.Char("Description",search=True),
"use_time":fields.Integer("Use time"),
"max_use_time":fields.Integer("Max use time"),
"member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"),
"dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Member Type"),
"bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"),
"ultrafittration": fields.Float("Ultrafittration Kg."),
"state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"),
}
DialyzerLine.register()

View File

@ -49,7 +49,7 @@ class HDCase(Model):
"check_goverment_pay" : fields.Boolean("The Government Pay"), "check_goverment_pay" : fields.Boolean("The Government Pay"),
"check_personal_pay" : fields.Boolean("Pay yourself"), "check_personal_pay" : fields.Boolean("Pay yourself"),
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True), "state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"), "dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"), "lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
"personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"), "personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
@ -694,7 +694,6 @@ class HDCase(Model):
doctor+= 1 doctor+= 1
else: else:
nurse+=1 nurse+=1
print('doctor ', doctor_id)
res[obj.id]={ res[obj.id]={
'total_doctor': doctor, 'total_doctor': doctor,
'total_nurse': nurse, 'total_nurse': nurse,

View File

@ -0,0 +1,77 @@
import time
import urllib.parse as urllib
from datetime import datetime
from calendar import monthrange
from netforce.model import Model, fields, get_model
from netforce.access import get_active_company
from . import utils
class HDCaseDialy(Model):
_name="clinic.hd.case.dialy"
_string="HD Case Dialy"
_transient=True
_fields={
"date": fields.Date("Date", required=True),
}
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"),
}
def get_report_data(self,ids,context={}):
company_id=get_active_company()
company=get_model("company").browse(company_id)
date=datetime.now().strftime("%Y-%m-%d")
if ids:
obj=self.browse(ids)[0]
date=obj.date
month=int(date[5:7])
day=date[8:10]
year=date[0:4]
month_str=utils.MONTHS['th_TH'][month]
dom=[]
dom.append(['time_start','>=','%s 00:00:00'%date])
dom.append(['time_stop','<=','%s 23:59:59'%date])
lines=[]
no=1
for obj in get_model("clinic.hd.case").search_browse(dom):
patient_type=utils.PATIENT_TYPE[obj.patient_id.type]
dlz_number=""
dlz_id=None
for line in obj.dialyzers:
dlz=line.dialyzer_id
dlz_id=dlz.id
dlz_number=dlz.number
line={
'cycle_name': obj.cycle_id.name,
'no': no,
'hd_case_number': obj.number,
'patient_name': obj.patient_id.name,
'patient_type': patient_type,
'doctor_name': obj.doctor_id.name,
'doctor_id': obj.doctor_id.id,
'fee_amount': obj.fee_amount,
'hd_case_id': obj.id,
'dlz_number': dlz_number,
'dlz_id': dlz_id,
'success_color': obj.state=='completed' and '#99ff99' or '',
'note': obj.note or "",
}
lines.append(line)
no+=1
# XXX
year=int(year)+543
date_str='%s %s %s'%(day,month_str,year)
data={
'lines': lines,
'date': date_str,
'company_name': company.name,
'company_parent_name': company.parent_id.name,
}
return data
HDCaseDialy.register()

View File

@ -1,9 +1,10 @@
from netforce.model import Model, fields from netforce.model import Model, fields
class HdcaseDialyzer(Model): class HDCaseDialyzerLine(Model):
_name="clinic.hd.case.dialyzer" _name="clinic.hd.case.dialyzer"
_fields={ _fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
"visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"),
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True), "dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True),
"description": fields.Char("Description",search=True), "description": fields.Char("Description",search=True),
"use_time":fields.Integer("Use time"), "use_time":fields.Integer("Use time"),
@ -15,5 +16,5 @@ class HdcaseDialyzer(Model):
"state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"), "state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"),
} }
HdcaseDialyzer.register() HDCaseDialyzerLine.register()

Binary file not shown.

View File

@ -0,0 +1,45 @@
<center>
<h2>ตารางการรักษาผู้ป่วย</h2>
<h3>
{{parent_company_name}}&nbsp;{{company_name}}<br/>
</h3>
<h4>
ประจำวันที่ {{date}}
</h4>
</center>
<table class="table table-hover">
<thead>
<th>รอบ</th>
<th>No</th>
<th>ชื่อ-นามสกุล</th>
<th>แพทย์</th>
<th>สิทธิ์</th>
<th>จำนวนเงิน</th>
<th>RC.No</th>
<th>H</th>
<th>DZ</th>
<th>N/U</th>
<th>พยาบาล</th>
<th>หมายเหตุ</th>
</thead>
<tbody>
{{#each lines }}
<tr style="background-color: {{success_color}}">
<td style="background-color: {{cycle_color}}">{{cycle_name}}</td>
<td>{{no}}</td>
<td><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
<td><a href="/ui#name=clinic_personal&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
<td>{{patient_type}}</td>
<td>{{fee_amount}}</td>
<td>-</td>
<td><a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">{{hd_case_number}}</a></td>
<td><a href="/ui#name=clinic_hd_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_number}}</a></td>
<td>-</td>
<td>-</td>
<td>{{note}}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
</tfoot>
</table>

View File

@ -1,5 +1,5 @@
<center> <center>
<h2>ตารางการรักษาผู้ป่วย</h2> <h2>ตารางการนัดผู้ป่วย</h2>
<h3> <h3>
{{parent_company_name}}&nbsp;{{company_name}}<br/> {{parent_company_name}}&nbsp;{{company_name}}<br/>
</h3> </h3>
@ -12,7 +12,7 @@
<th>รอบ</th> <th>รอบ</th>
<th>Ref.</th> <th>Ref.</th>
<th>ผู้ป่วย</th> <th>ผู้ป่วย</th>
<th>นพ.</th> <th>แพทย์</th>
<th>HD Case</th> <th>HD Case</th>
<th>หมายเหตุ</th> <th>หมายเหตุ</th>
</thead> </thead>

View File

@ -1,4 +1,7 @@
======= =======
- report salary
-
========
customize ui customize ui
calendar - calendar -
- show search - show search