reports
parent
27bf15311f
commit
0be9ca722c
|
@ -23,6 +23,9 @@ class ReportDiscontinuePatient(Model):
|
|||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
defaults=context.get('defaults')
|
||||
if defaults:
|
||||
year,month,day=defaults['date'].split("-")
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
year,month,day=obj.date.split("-")
|
||||
|
|
|
@ -69,7 +69,7 @@ class ReportHDCaseSummary(Model):
|
|||
'month': month_str,
|
||||
'qty': crr_total or 0,
|
||||
'action': 'clinic_hd_case',
|
||||
'action_options': 'mode=list&search_domain=%s'%replace_quote('%s'%dom),
|
||||
'action_options': 'mode=list&search_domain=%s&tab_no=4'%replace_quote('%s'%dom),
|
||||
}
|
||||
|
||||
# number of patient from previous
|
||||
|
@ -192,35 +192,28 @@ class ReportHDCaseSummary(Model):
|
|||
lines.append(line)
|
||||
index+=1
|
||||
|
||||
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
|
||||
context['defaults']={'date': date}
|
||||
|
||||
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
|
||||
titles={
|
||||
'prod_name': 'ชื่อยา',
|
||||
'sc': utils.PATIENT_TYPE['sc'],
|
||||
'nhso': utils.PATIENT_TYPE['nhso'],
|
||||
'personal': utils.PATIENT_TYPE['personal'],
|
||||
}
|
||||
medicals=get_model("clinic.report.medical.summary").get_report_data(ids=[],context=context)['lines']
|
||||
|
||||
data={
|
||||
'date': date,
|
||||
'month': month_str,
|
||||
'year': year,
|
||||
'lines': lines,
|
||||
#'new_patient_lines': new_patient_lines,
|
||||
#'resign_patient_lines': resign_patient_lines,
|
||||
'new_patients': get_model("clinic.report.new.patient").get_report_data(ids=[],context=context)['lines'],
|
||||
'resign_patients': get_model("clinic.report.discontinue.patient").get_report_data(ids=[],context=context)['lines'],
|
||||
'medicals': medicals,
|
||||
'company_name': company.name or "",
|
||||
'parent_company_name': company.parent_id.name or "",
|
||||
}
|
||||
data.update(titles)
|
||||
return data
|
||||
|
||||
ReportHDCaseSummary.register()
|
||||
|
|
|
@ -40,6 +40,7 @@ class ReportMedicalSummary(Model):
|
|||
'qty': 0,
|
||||
'name': prod.name,
|
||||
'code': prod.code,
|
||||
'prod_id': prod.id,
|
||||
}
|
||||
|
||||
for hd_case in get_model('clinic.hd.case').search_browse(dom):
|
||||
|
@ -55,6 +56,7 @@ class ReportMedicalSummary(Model):
|
|||
for prod, records in products.items():
|
||||
line={
|
||||
'prod_name': records['sc']['name'], # XXX
|
||||
'prod_id': records[patient_type]['prod_id'],
|
||||
}
|
||||
for patient_type in ('sc','nhso','personal'):
|
||||
line.update({
|
||||
|
|
|
@ -23,6 +23,10 @@ class ReportNewPatient(Model):
|
|||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
|
||||
defaults=context.get('defaults')
|
||||
if defaults:
|
||||
year,month,day=defaults['date'].split("-")
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
year,month,day=obj.date.split("-")
|
||||
|
|
|
@ -37,3 +37,119 @@
|
|||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>
|
||||
<center>
|
||||
<a href="/ui#name=clinic_report_new_patient&defaults.date={{date}}">
|
||||
รายชื่อผู้ป่วยรับใหม่
|
||||
</a>
|
||||
</center>
|
||||
</th>
|
||||
<th>
|
||||
<center>
|
||||
<a href="/ui#name=clinic_report_discontinue_patient&defaults.date={{date}}">
|
||||
รายชื่อผู้ป่วยจำหน่าย
|
||||
</a>
|
||||
</center>
|
||||
</th>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>ชื่อ</th>
|
||||
<th>หมายเหตุ</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#if resign_patients}}
|
||||
{{#each resign_patients}}
|
||||
<tr>
|
||||
<td>{{no}}</td>
|
||||
<td>
|
||||
{{view "link" string=name action="clinic_patient" action_options="mode=form" active_id=pid}}
|
||||
</td>
|
||||
<td>{{note}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
No items to display.
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:50%">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>ชื่อ</th>
|
||||
<th>หมายเหตุ</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#if new_patients}}
|
||||
{{#each new_patients}}
|
||||
<tr>
|
||||
<td>{{no}}</td>
|
||||
<td>
|
||||
{{view "link" string=name action="clinic_patient" action_options="mode=form" active_id=pid}}
|
||||
</td>
|
||||
<td>{{note}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
No items to display.
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<span>
|
||||
<center>
|
||||
<b>
|
||||
<a href="/ui#name=clinic_report_medical_summary&defaults.date={{date}}">รวมจำนวนยาที่ใช้ประจำเดือน</a>
|
||||
</b>
|
||||
</center>
|
||||
</span>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>{{prod_name}}</th>
|
||||
<th>{{sc}}</th>
|
||||
<th>{{nhso}}</th>
|
||||
<th>{{personal}}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each medicals}}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||
</td>
|
||||
<td>{{sc}}</td>
|
||||
<td>{{nhso}}</td>
|
||||
<td>{{personal}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
<tbody>
|
||||
{{#each lines}}
|
||||
<tr>
|
||||
<td>{{prod_name}}</td>
|
||||
<td>
|
||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||
</td>
|
||||
<td>{{sc}}</td>
|
||||
<td>{{nhso}}</td>
|
||||
<td>{{personal}}</td>
|
||||
|
|
Loading…
Reference in New Issue