我是JasperReports的新手,我正在尝试使用iReports 5.1.0生成饼图。
我计算了应该计算 3 个切片的百分比的天数,但是我应该在 Key Expression 和 Label Expression 中给出什么?尝试将 3 个切片标签自定义为 5 天内、5 天以上和已测试但未提及。
我通过这段代码得到计数
SELECT SUM(subSet.days_taken <= 5) AS within_5_days,
SUM(subSet.days_taken > 5) AS more_than_5,
SUM(subSet.date_referred IS NULL) as not_yet_referred
FROM (select p.patient_id,
(CASE
WHEN st.smear_result <> 'NEGATIVE' OR st.gxp_result = 'MTB+' THEN (DATEDIFF(r.date_referred, MIN(st.date_smear_tested)))
ELSE
(CASE
WHEN st.smear_result = 'NEGATIVE' OR st.gxp_result = 'MTB-' THEN (DATEDIFF(r.date_referred, MAX(st.date_smear_tested)))
END) END) as days_taken,
r.date_referred as date_referred
from patient as p
left outer join sputum_test as st on p.patient_id = st.patient_id
left outer join referral as r on r.patient_id = st.patient_id
where p.suspected_by is not null
and (p.patient_status = 'SUSPECT' or
p.patient_status = 'CONFIRMED')
group by p.patient_id)
as subSet
这也是我正在使用的 DataSet 运行。
您的帮助将不胜感激。