JDBC连接数据库的部分已经完成了,代码如下Statementstmt=conn.createStatement();ResultSetrs=stmt.executeQuery("SELECTdiagnostic_name_outpatients,Count(*)FROMwestmedicalrecor...
JDBC连接数据库的部分已经完成了,代码如下
Statement stmt=conn.createStatement();
ResultSet rs= stmt.executeQuery("SELECT diagnostic_name_outpatients,Count(*) FROM westmedicalrecord w GROUP BY w.diagnostic_name_outpatients ORDER BY COUNT(*) DESC LIMIT 20" );
while (rs.next()){
System.out.println(rs.getString("diagnostic_name_outpatients")+","+rs.getInt("COUNT(*)"));
//这里暂时是输出,应该存成两个数组
}
}
}
结果截图是这样
要传到的jsp页面代码
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: '地区整体发病情况'
},
tooltip: {},
legend: {
data:['发病人数']
},
xAxis: {
data: ["肺部感染","慢性胃炎","支气管肺炎","腹痛","急性支气管炎","肺炎","胆囊结石伴急性胆囊炎","支气管肺炎","腰椎间盘突出","颅内损伤"]
},
yAxis: {},
series: [{
name: '发病人数',
type: 'bar',
data: [2126, 1585, 1554, 1514, 1412, 1044,964,881,750,728]
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
要传入的位置
展开