diff --git a/netforce_clinic/models/report_discontinue_patient.py b/netforce_clinic/models/report_discontinue_patient.py
index 6e5c749..5f521c7 100644
--- a/netforce_clinic/models/report_discontinue_patient.py
+++ b/netforce_clinic/models/report_discontinue_patient.py
@@ -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("-")
diff --git a/netforce_clinic/models/report_hd_case_summary.py b/netforce_clinic/models/report_hd_case_summary.py
index 5ca7906..21012ad 100644
--- a/netforce_clinic/models/report_hd_case_summary.py
+++ b/netforce_clinic/models/report_hd_case_summary.py
@@ -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()
diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py
index c7156e5..2c5ba99 100644
--- a/netforce_clinic/models/report_medical_summary.py
+++ b/netforce_clinic/models/report_medical_summary.py
@@ -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({
diff --git a/netforce_clinic/models/report_new_patient.py b/netforce_clinic/models/report_new_patient.py
index 763eec4..3f4bd34 100644
--- a/netforce_clinic/models/report_new_patient.py
+++ b/netforce_clinic/models/report_new_patient.py
@@ -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("-")
diff --git a/netforce_clinic/templates/report_hd_case_summary.hbs b/netforce_clinic/templates/report_hd_case_summary.hbs
index 7c9d5c9..333bd14 100644
--- a/netforce_clinic/templates/report_hd_case_summary.hbs
+++ b/netforce_clinic/templates/report_hd_case_summary.hbs
@@ -37,3 +37,119 @@
{{/each}}
+
+
+
+
+
+
+ รายชื่อผู้ป่วยรับใหม่
+
+
+ |
+
+
+
+ รายชื่อผู้ป่วยจำหน่าย
+
+
+ |
+
+
+
+
+
+ # |
+ ชื่อ |
+ หมายเหตุ |
+
+
+ {{#if resign_patients}}
+ {{#each resign_patients}}
+
+ {{no}} |
+
+ {{view "link" string=name action="clinic_patient" action_options="mode=form" active_id=pid}}
+ |
+ {{note}} |
+
+ {{/each}}
+ {{else}}
+
+
+ No items to display.
+ |
+
+ {{/if}}
+
+
+
+
+ |
+
+
+
+ # |
+ ชื่อ |
+ หมายเหตุ |
+
+
+ {{#if new_patients}}
+ {{#each new_patients}}
+
+ {{no}} |
+
+ {{view "link" string=name action="clinic_patient" action_options="mode=form" active_id=pid}}
+ |
+ {{note}} |
+
+ {{/each}}
+ {{else}}
+
+
+ No items to display.
+ |
+
+ {{/if}}
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ รวมจำนวนยาที่ใช้ประจำเดือน
+
+
+
+
+
+ {{prod_name}} |
+ {{sc}} |
+ {{nhso}} |
+ {{personal}} |
+
+
+ {{#each medicals}}
+
+
+ {{prod_name}}
+ |
+ {{sc}} |
+ {{nhso}} |
+ {{personal}} |
+
+ {{/each}}
+
+
+
+
+ |
+
+
diff --git a/netforce_clinic/templates/report_medical_summary.hbs b/netforce_clinic/templates/report_medical_summary.hbs
index 0386d71..50c4584 100644
--- a/netforce_clinic/templates/report_medical_summary.hbs
+++ b/netforce_clinic/templates/report_medical_summary.hbs
@@ -17,7 +17,9 @@
{{#each lines}}
- {{prod_name}} |
+
+ {{prod_name}}
+ |
{{sc}} |
{{nhso}} |
{{personal}} |