report summary
parent
c196d8878e
commit
b892f55408
|
@ -39,12 +39,9 @@
|
|||
<header string="REPORTS"/>
|
||||
<item string="HD Summary" action="clinic_report_hd_case_summary"/>
|
||||
<item string="HD Detail" action="clinic_report_hd_case_detail"/>
|
||||
<header string="REPORT SETTINGS"/>
|
||||
<item string="Topics" action="clinic_translate"/>
|
||||
</item>
|
||||
<item string="Reports">
|
||||
<item string="Medical Summary" action="clinic_report_hd_case_medical"/>
|
||||
<item string="Payment Summary" action="clinic_report_hd_case_payment"/>"
|
||||
</item>
|
||||
<item string="Settings">
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
|
|
|
@ -34,8 +34,6 @@ from . import gen_visit_line
|
|||
from . import report_clinic
|
||||
from . import report_hd_case_detail
|
||||
from . import report_hd_case_summary
|
||||
from . import report_hd_case_medical
|
||||
from . import report_hd_case_payment
|
||||
from . import fin_setting
|
||||
from . import import_data_mg
|
||||
from . import import_data_nhso
|
||||
|
|
|
@ -3,6 +3,7 @@ import time
|
|||
from datetime import datetime
|
||||
from calendar import monthrange
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.database import get_connection
|
||||
|
||||
from . import utils
|
||||
|
||||
|
@ -20,6 +21,7 @@ class ReportHDCaseSummary(Model):
|
|||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
db=get_connection()
|
||||
for item in get_model("company").search_browse([]):
|
||||
company_name=item.name
|
||||
|
||||
|
@ -27,99 +29,118 @@ class ReportHDCaseSummary(Model):
|
|||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
date=obj.date
|
||||
year=int(date[0:4])
|
||||
prev_year=year
|
||||
next_year=year
|
||||
crr_month=int(date[5:7])
|
||||
prev_month=crr_month-1
|
||||
next_month=crr_month+1
|
||||
if crr_month==1:
|
||||
prev_month=12
|
||||
prev_year-=1
|
||||
if crr_month==12:
|
||||
next_month=1
|
||||
next_year+=1
|
||||
|
||||
year=int(date[0:4])
|
||||
month_str=utils.MONTHS['th_TH'][crr_month]
|
||||
next_month_str=utils.MONTHS['th_TH'][next_month]
|
||||
prev_month_str=utils.MONTHS['th_TH'][prev_month]
|
||||
|
||||
dom=[]
|
||||
weekday, prev_total_day=monthrange(year, prev_month)
|
||||
prev_time_start='2014-%s-01 00:00:00'%(str(prev_month).zfill(2))
|
||||
prev_time_stop='2014-%s-%s 23:59:59'%(str(prev_month).zfill(2),prev_total_day)
|
||||
dom.append(['time_start','>=', prev_time_start])
|
||||
dom.append(['time_stop','<=',prev_time_stop])
|
||||
prev_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
# number of hd case of this month
|
||||
dom=[]
|
||||
weekday, crr_total_day=monthrange(year, crr_month)
|
||||
crr_time_start='2014-%s-01 00:00:00'%(str(crr_month).zfill(2))
|
||||
crr_time_stop='2014-%s-%s 23:59:59'%(str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['time_start','>=', crr_time_start])
|
||||
dom.append(['time_stop','<=',crr_time_stop])
|
||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['time_start','>=', time_start])
|
||||
dom.append(['time_stop','<=',time_stop])
|
||||
dom.append(['state','=','completed'])
|
||||
crr_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
dom=[]
|
||||
weekday, next_total_day=monthrange(year, next_month)
|
||||
next_time_start='2014-%s-01 00:00:00'%(str(next_month).zfill(2))
|
||||
next_time_stop='2014-%s-%s 23:59:59'%(str(next_month).zfill(2),next_total_day)
|
||||
dom.append(['time_start','>=', next_time_start])
|
||||
dom.append(['time_stop','<=',next_time_stop])
|
||||
next_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
items={
|
||||
'topic1': {
|
||||
items={}
|
||||
items['topic1']={
|
||||
'month': month_str,
|
||||
'amount': crr_total,
|
||||
'date_from': crr_time_start[0:10],
|
||||
'date_to': crr_time_stop[0:10],
|
||||
},
|
||||
'topic2':
|
||||
{
|
||||
'date_from': time_start[0:10],
|
||||
'date_to': time_stop[0:10],
|
||||
'link': True,
|
||||
}
|
||||
|
||||
# number patient from previous month
|
||||
dom=[]
|
||||
weekday, prev_total_day=monthrange(prev_year, prev_month)
|
||||
#time_start='%s-%s-01'%(prev_year,str(prev_month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(prev_year,str(prev_month).zfill(2),prev_total_day)
|
||||
#dom.append(['reg_date','>=', time_start])
|
||||
dom.append(['reg_date','<=',time_stop])
|
||||
npatient=len(get_model("clinic.patient").search(dom))
|
||||
items['topic2']={
|
||||
'month': prev_month_str,
|
||||
'amount': prev_total,
|
||||
'date_from': prev_time_start[0:10],
|
||||
'date_to': prev_time_stop[0:10],
|
||||
},
|
||||
'topic3':
|
||||
{
|
||||
'month': month_str,
|
||||
'amount': next_total,
|
||||
'date_from': next_time_start[0:10],
|
||||
'date_to': next_time_stop[0:10],
|
||||
},
|
||||
'topic4':
|
||||
{
|
||||
'month': month_str,
|
||||
'amount': 'N/A',
|
||||
'amount': npatient or 0.0,
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic5':
|
||||
{
|
||||
'link': False,
|
||||
}
|
||||
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
weekday, crr_total_day=monthrange(prev_year, crr_month)
|
||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
new_patients=db.query("select id, name, note from clinic_patient where active=true and create_time >=%s and create_time <=%s",time_start,time_stop)
|
||||
items['topic3']={
|
||||
'month': month_str,
|
||||
'amount': len(new_patients) or 0.0,
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
'link': False,
|
||||
}
|
||||
|
||||
# number for patient who resign for this month
|
||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
resign_patients=db.query("select id, name, note from clinic_patient where active=false and write_time >=%s and write_time <=%s",time_start,time_stop)
|
||||
items['topic4']={
|
||||
'month': month_str,
|
||||
'amount': len(resign_patients) or 0.0,
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
'link': False,
|
||||
}
|
||||
# all patient who are in hospital now
|
||||
dom=[]
|
||||
weekday, crr_total_day=monthrange(year, crr_month)
|
||||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||
npatients=db.query("select id, name, note from clinic_patient where active=true and reg_date <=%s",time_stop)
|
||||
items['topic5']={
|
||||
'month': next_month_str,
|
||||
'amount': 'N/A',
|
||||
'amount': len(npatients),
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic6':
|
||||
{
|
||||
'link': False,
|
||||
}
|
||||
|
||||
npatients=get_model("clinic.patient").search([['type','=','sc']])
|
||||
items['topic6']={
|
||||
'month': '',
|
||||
'amount': '',
|
||||
'amount': len(npatients),
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic7':
|
||||
{
|
||||
'link': False,
|
||||
}
|
||||
npatients=get_model("clinic.patient").search([['type','=','nhso']])
|
||||
items['topic7']={
|
||||
'month':'',
|
||||
'amount': '',
|
||||
'amount': len(npatients),
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic8':
|
||||
{
|
||||
'link': False,
|
||||
}
|
||||
npatients=get_model("clinic.patient").search([['type','in',['personal','others']]])
|
||||
items['topic8']={
|
||||
'month': '',
|
||||
'amount': '',
|
||||
'amount': len(npatients),
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'link': False,
|
||||
}
|
||||
|
||||
lines=[]
|
||||
|
@ -134,28 +155,32 @@ class ReportHDCaseSummary(Model):
|
|||
lines.append(line)
|
||||
index+=1
|
||||
|
||||
new_pt_lines=[]
|
||||
for i in range(3):
|
||||
new_pt_lines.append({
|
||||
'no': i+1,
|
||||
'name': 'xxxxx',
|
||||
'note': '',
|
||||
new_patient_lines=[]
|
||||
index=1
|
||||
for new_patient in new_patients:
|
||||
new_patient_lines.append({
|
||||
'no': index,
|
||||
'name': new_patient['name'] or "",
|
||||
'note': new_patient['note'] or "",
|
||||
})
|
||||
index+=1
|
||||
|
||||
resign_pt_lines=[]
|
||||
for i in range(5):
|
||||
resign_pt_lines.append({
|
||||
'no': i+1,
|
||||
'name': 'xxxxx',
|
||||
'note': '',
|
||||
resign_patient_lines=[]
|
||||
index=1
|
||||
for resign_patient in resign_patients:
|
||||
resign_patient_lines.append({
|
||||
'no': index,
|
||||
'name': resign_patient['name'],
|
||||
'note': resign_patient['note'],
|
||||
})
|
||||
index+=1
|
||||
|
||||
data={
|
||||
'month': month_str,
|
||||
'year': year,
|
||||
'lines': lines,
|
||||
'new_pt_lines': new_pt_lines,
|
||||
'resign_pt_lines': resign_pt_lines,
|
||||
'new_patient_lines': new_patient_lines,
|
||||
'resign_patient_lines': resign_patient_lines,
|
||||
'company_name': company_name,
|
||||
}
|
||||
return data
|
||||
|
|
|
@ -5,6 +5,15 @@ DAYS={ 'th_TH': ['จันทร์', 'อังคาร', 'พุธ', 'พ
|
|||
MONTHS={ 'th_TH': [None, 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม']
|
||||
, 'en_US': [None, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
|
||||
}
|
||||
|
||||
PATIENT_TYPE={
|
||||
"mg":"Medical Government",
|
||||
"sc":"ปกส.",
|
||||
"nhso":"สปกส.",
|
||||
"personal": "จ่ายเอง",
|
||||
"others": "อื่นๆ",
|
||||
}
|
||||
|
||||
TOPICS={
|
||||
'topic1': {'name': 'จำนวนครั้งการทำ Hemodialysis', 'unit': 'ครั้ง'},
|
||||
'topic2': {'name': 'จำนวนผู้ป่วยยกมาจากเดือน', 'unit': 'คน'},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<center>
|
||||
<h2>Detail of the Hemodialysis</h2>
|
||||
<h3>[{{company_name}}]</h3>
|
||||
<h2>รายละเอียดการทำ Hemodialysis</h2>
|
||||
<h3>ศูนย์ไตเทียมราชวัตร {{company_name}}</h3>
|
||||
<h4>
|
||||
{{#if same_date}}
|
||||
As at {{fmt_date date_from}}
|
||||
ณ วันที่ {{fmt_date date_from}}
|
||||
{{else}}
|
||||
From {{fmt_date date_from}} to {{fmt_date date_to}}
|
||||
ตั้งแต่ {{fmt_date date_from}} ถึง {{fmt_date date_to}}
|
||||
{{/if}}
|
||||
</h4>
|
||||
</center>
|
||||
|
@ -13,28 +13,25 @@
|
|||
<thead class="scroll-header">
|
||||
<tr>
|
||||
<th>
|
||||
Cycle
|
||||
รอบ
|
||||
</th>
|
||||
<th>
|
||||
Patient
|
||||
ผู้ป่วย
|
||||
</th>
|
||||
<th>
|
||||
Patient Type
|
||||
ประเภท
|
||||
</th>
|
||||
<th>
|
||||
HD Fee
|
||||
ค่าธรรมเนียม
|
||||
</th>
|
||||
<th>
|
||||
RC.No
|
||||
HD.No
|
||||
</th>
|
||||
<th>
|
||||
Dialyzer
|
||||
</th>
|
||||
<th>
|
||||
Doctor
|
||||
</th>
|
||||
<th>
|
||||
Nurse
|
||||
หมอ
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -49,7 +46,7 @@
|
|||
{{/if}}
|
||||
<tr class="{{color}}">
|
||||
{{#if no_patient}}
|
||||
<td><b>TOTAL</b></td>
|
||||
<td><b>ทั้งหมด</b></td>
|
||||
<td>{{no_patient}}</td>
|
||||
{{else}}
|
||||
<td></td>
|
||||
|
@ -64,13 +61,11 @@
|
|||
<td><a style="text-decoration: underline" href="ui#name=clinic_hd_case&mode=page&active_id={{hd_case_id}}">{{rc_no}}</a></td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_dialyzer&mode=page&active_id={{dialyzer_number}}">{{dialyzer_number}}</a></td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_doctor&mode=page&active_id={{doctor_id}}">{{doctor_name}}</a></td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_nurse&mode=page&active_id={{nurse_id}}">{{nurse_name}}</a></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style="font-weight:bold">
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
@ -23,7 +23,11 @@
|
|||
<td>{{topic}}</td>
|
||||
<td>{{month}}</td>
|
||||
<td>เท่ากับ</td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_case_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
|
||||
{{#if link}}
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_case_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
|
||||
{{else}}
|
||||
<td>{{amount}}</td>
|
||||
{{/if}}
|
||||
<td>{{unit}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
@ -35,15 +39,11 @@
|
|||
<table class="table">
|
||||
<thead>
|
||||
<th><h4>รายชื่อผู้ป่วยรับใหม่</h4></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each new_pt_lines}}
|
||||
{{#each new_patient_lines}}
|
||||
<tr>
|
||||
<td>{{no}}</td>
|
||||
<td>{{name}}</td>
|
||||
<td>{{note}}</td>
|
||||
<td>{{no}}. {{name}} {{note}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
@ -77,15 +77,11 @@
|
|||
<table class="table">
|
||||
<thead>
|
||||
<th><h4>รายชื่อผู้ป่วยจำหน่าย<h4></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each resign_pt_lines}}
|
||||
{{#each resign_patient_lines}}
|
||||
<tr>
|
||||
<td>{{no}}</td>
|
||||
<td>{{name}}</td>
|
||||
<td>{{note}}</td>
|
||||
<td>{{no}}. {{name}} {{note}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue