|
@ -43,8 +43,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import javax.persistence.Transient;
|
|
import javax.persistence.Transient;
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
import java.awt.print.Pageable;
|
|
import java.awt.print.Pageable;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@ -136,19 +140,19 @@ public class StatisticsService {
|
|
String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
|
|
String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
|
|
Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
|
|
Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
|
|
|
|
|
|
//男 女 性别总数
|
|
|
|
|
|
/*//男 女 性别总数
|
|
String sexCountSql = "SELECT COUNT(*) ss, CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END AS sex " +
|
|
String sexCountSql = "SELECT COUNT(*) ss, CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END AS sex " +
|
|
"FROM wlyy_patient_label lab " +
|
|
"FROM wlyy_patient_label lab " +
|
|
"INNER JOIN base_patient p ON p.id = lab.patient AND lab.label_type = '3' AND lab.patient NOT IN ('null') GROUP BY p.sex";
|
|
"INNER JOIN base_patient p ON p.id = lab.patient AND lab.label_type = '3' AND lab.patient NOT IN ('null') GROUP BY p.sex";
|
|
List<Map<String, Object>> sexCountMap = jdbcTemplate.queryForList(sexCountSql);
|
|
List<Map<String, Object>> sexCountMap = jdbcTemplate.queryForList(sexCountSql);
|
|
res.put("sexCount",sexCountMap);
|
|
|
|
|
|
res.put("sexCount",sexCountMap);*/
|
|
|
|
|
|
//老人-紧急预警
|
|
//老人-紧急预警
|
|
res.put("index_"+41,emergencyCallNum);
|
|
res.put("index_"+41,emergencyCallNum);
|
|
//老人 安放监护
|
|
//老人 安放监护
|
|
res.put("index_"+43,securityMonitoringNum);
|
|
res.put("index_"+43,securityMonitoringNum);
|
|
//评估类型
|
|
//评估类型
|
|
res.put("capacityAssessment",capacityAssessment(endDate,defalutArea,defalutLevel));
|
|
|
|
|
|
res.put("capacityAssessment",cloudCareForTheElderly(endDate,defalutArea,defalutLevel));
|
|
//居民健康标签纬度
|
|
//居民健康标签纬度
|
|
res.put("patientLabelStatistic",statisticsOrderServer("47",endDate,2,"2"));
|
|
res.put("patientLabelStatistic",statisticsOrderServer("47",endDate,2,"2"));
|
|
|
|
|
|
@ -161,20 +165,135 @@ public class StatisticsService {
|
|
res.put("activity_"+tmp.get("type").toString(),num);
|
|
res.put("activity_"+tmp.get("type").toString(),num);
|
|
}
|
|
}
|
|
|
|
|
|
//返回活动曲线图
|
|
|
|
sql = "select count(id),DATE_FORMAT(create_time,'%Y-%m-%d') as total from base_child_activity_registration " +
|
|
|
|
"GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') " +
|
|
|
|
"ORDER BY create_time";
|
|
|
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
|
res.put("quxiantu_3",maps);
|
|
|
|
|
|
|
|
//幼儿活动报名总数
|
|
|
|
|
|
//activity-3 幼儿活动报名-总数
|
|
sql = " select count(id) as total from base_child_activity_registration ";
|
|
sql = " select count(id) as total from base_child_activity_registration ";
|
|
Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
res.put("activity_3",count);
|
|
res.put("activity_3",count);
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*曲线*/
|
|
|
|
public JSONObject curveTotal(String day,String type,String area,int level,String timeLevel,String interval,String lowLevel) throws Exception {
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
StringBuffer sqlbuff = new StringBuffer();
|
|
|
|
List<Map<String,Object>> listMaps = null;
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
cal.setTime(new Date());
|
|
|
|
cal.add(Calendar.DATE, -Integer.parseInt(day));
|
|
|
|
java.sql.Date date = new java.sql.Date(cal.getTime().getTime());
|
|
|
|
|
|
|
|
/*---------sql----------*/
|
|
|
|
// 3 幼儿活动
|
|
|
|
if("3".equals(type)){
|
|
|
|
sqlbuff.append("SELECT count(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') as `range` FROM base_child_activity_registration WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= date(create_time) GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time");
|
|
|
|
listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff));
|
|
|
|
res.put("count",listMaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
//41 老人-紧急呼叫
|
|
|
|
if("41".equals(type)){
|
|
|
|
sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_emergency_assistance_order WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time");
|
|
|
|
listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff));
|
|
|
|
res.put("count",listMaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
//43 老人 安放监护
|
|
|
|
if ("43".equals(type)){
|
|
|
|
sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_security_monitoring_order WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND status >= 0 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time");
|
|
|
|
listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff));
|
|
|
|
res.put("count",listMaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 1 活动浏览次数
|
|
|
|
if ("1".equals(type)){
|
|
|
|
sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND activity_type = 1 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time");
|
|
|
|
listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff));
|
|
|
|
res.put("count",listMaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 2 公艺课程播放
|
|
|
|
if ("2".equals(type)){
|
|
|
|
sqlbuff.append("SELECT COUNT(id) amount,DATE_FORMAT(create_time,'%Y-%m-%d') AS `range` FROM base_activity_click WHERE DATE_SUB(CURDATE(), INTERVAL "+day+" DAY) <= DATE(create_time) AND activity_type = 2 GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d') ORDER BY create_time");
|
|
|
|
listMaps = jdbcTemplate.queryForList(String.valueOf(sqlbuff));
|
|
|
|
res.put("count",listMaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*----------es-----------*/
|
|
|
|
// 39 老人-生活照料-服务工单数
|
|
|
|
// 44 老人-生活照料-代预约
|
|
|
|
// 28 新生儿-在线咨询总数
|
|
|
|
// 32 新生儿-在线咨询总数
|
|
|
|
// 35 新生儿-上门辅导-服务工单数
|
|
|
|
if (!"3".equals(type)&&!"41".equals(type)&&!"43".equals(type)&&!"1".equals(type)&&!"2".equals(type)){
|
|
|
|
JSONArray esResoult = addLine(String.valueOf(date),LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), area, level, type, timeLevel, interval, lowLevel);
|
|
|
|
List<Map> maps = JSONObject.parseArray(esResoult.toJSONString(), Map.class);
|
|
|
|
res.put("count",maps);
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*综合总数*/
|
|
|
|
public JSONObject combinedTotal(String type,String startDate,String endDate) throws Exception {
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
String index = "";
|
|
|
|
//es
|
|
|
|
// 39 老人-生活照料-服务工单数
|
|
|
|
// 44 老人-生活照料-代预约
|
|
|
|
// 28 新生儿-在线咨询总数
|
|
|
|
// 35 新生儿-上门辅导-服务工单数
|
|
|
|
|
|
|
|
//sql
|
|
|
|
// activity-3 幼儿活动
|
|
|
|
// activity-1 活动浏览次数
|
|
|
|
// activity-2 公艺课程播放
|
|
|
|
//41 老人-紧急呼叫
|
|
|
|
//43 老人 安放监护
|
|
|
|
|
|
|
|
//type 42 老人 37 幼儿
|
|
|
|
if ("42".equals(type)){
|
|
|
|
index = "39,44";
|
|
|
|
String[] indexes = index.split(",");
|
|
|
|
for(String ind:indexes){
|
|
|
|
//总量
|
|
|
|
SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL);
|
|
|
|
res.put("index_"+ind,saveModel.getResult2().longValue());
|
|
|
|
}
|
|
|
|
String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 ";
|
|
|
|
Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql,Integer.class);
|
|
|
|
String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 ";
|
|
|
|
Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql,Integer.class);
|
|
|
|
res.put("index_41",emergencyCallNum);
|
|
|
|
res.put("index_43",securityMonitoringNum);
|
|
|
|
}else {
|
|
|
|
index = "28,35";
|
|
|
|
String[] indexes = index.split(",");
|
|
|
|
for(String ind:indexes){
|
|
|
|
//总量
|
|
|
|
SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL);
|
|
|
|
res.put("index_"+ind,saveModel.getResult2().longValue());
|
|
|
|
}
|
|
|
|
|
|
|
|
// activity-1 活动浏览次数
|
|
|
|
// activity-2 公艺课程播放
|
|
|
|
String sql = " select type,num from base_child_activity_click where type in(1,2)";
|
|
|
|
List<Map<String,Object>> lists = jdbcTemplate.queryForList(sql);
|
|
|
|
for (Map<String,Object> tmp:lists){
|
|
|
|
Integer num = Integer.parseInt(tmp.get("num").toString());
|
|
|
|
res.put("activity_"+tmp.get("type").toString(),num);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*幼儿活动报名 总数*/
|
|
|
|
String sqlActivity = " select count(id) as total from base_child_activity_registration ";
|
|
|
|
Integer count = jdbcTemplate.queryForObject(sqlActivity,Integer.class);
|
|
|
|
res.put("activity_3",count);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
public JSONObject serviceResources(){
|
|
public JSONObject serviceResources(){
|
|
String orgFilter = "";
|
|
String orgFilter = "";
|
|
String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
|
|
String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
|
|
@ -723,7 +842,6 @@ public class StatisticsService {
|
|
range.put("amount", saveModel.getResult2());
|
|
range.put("amount", saveModel.getResult2());
|
|
result.add(range);
|
|
result.add(range);
|
|
}
|
|
}
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@ -911,10 +1029,10 @@ public class StatisticsService {
|
|
}
|
|
}
|
|
JSONArray jsonArray = new JSONArray();
|
|
JSONArray jsonArray = new JSONArray();
|
|
String sql = " select dict.dict_code,dict_value,count(DISTINCT A.patient) total from wlyy_hospital_sys_dict dict \n" +
|
|
String sql = " select dict.dict_code,dict_value,count(DISTINCT A.patient) total from wlyy_hospital_sys_dict dict \n" +
|
|
" LEFT JOIN (select distinct lab.patient,lab.label_code from wlyy_patient_label lab INNER JOIN base_patient p on p.id = lab.patient AND lab.label_type='3' " +
|
|
|
|
|
|
" LEFT JOIN (select distinct lab.patient,lab.label_code from wlyy_patient_label lab INNER JOIN base_patient p on p.id = lab.patient AND lab.label_type='1' " +
|
|
filter+" \n" +
|
|
filter+" \n" +
|
|
")A on dict.dict_code = A.label_code " +
|
|
")A on dict.dict_code = A.label_code " +
|
|
"where dict.dict_name='older_label' and dict.dict_code is not null and dict_code <= 7 \n" +
|
|
|
|
|
|
"where dict.dict_name='service_type' and dict.dict_code is not null and dict_code <> 5 \n" +
|
|
" GROUP BY dict.dict_code; ";
|
|
" GROUP BY dict.dict_code; ";
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
@ -1510,4 +1628,153 @@ public class StatisticsService {
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*大屏 老人云照护 病人分析 */
|
|
|
|
public JSONObject patientAnalysisDP(String endDate, String area, int level,String index) throws Exception{
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
String areaLevel = "6";
|
|
|
|
if("42".equals(index)){
|
|
|
|
areaLevel = "4";
|
|
|
|
//新生儿
|
|
|
|
//是否入学
|
|
|
|
List<SaveModel> statusList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL,null,null,areaLevel);
|
|
|
|
JSONArray statusArray = new JSONArray();
|
|
|
|
for(int i=0;i<statusList.size();i++){
|
|
|
|
SaveModel saveModel = statusList.get(i);
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("num",saveModel.getResult2().longValue());
|
|
|
|
json.put("code",saveModel.getSlaveKey1());
|
|
|
|
json.put("name",saveModel.getSlaveKey1Name());
|
|
|
|
statusArray.add(json);
|
|
|
|
}
|
|
|
|
res.put("statusList",statusArray);
|
|
|
|
}else{
|
|
|
|
//老人
|
|
|
|
//能力评估 从签约时服务标签取
|
|
|
|
res.put("levelList",cloudCareForTheElderly(null,null,null));
|
|
|
|
|
|
|
|
//居民健康标签
|
|
|
|
List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"47",SaveModel.timeLevel_DDL,null,null,"2");
|
|
|
|
JSONArray labelArr = new JSONArray();
|
|
|
|
Long total = 0l;
|
|
|
|
for(int i=0;i<list.size();i++){
|
|
|
|
SaveModel saveModel = list.get(i);
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
json.put("num",saveModel.getResult2().longValue());
|
|
|
|
json.put("code",saveModel.getSlaveKey1());
|
|
|
|
json.put("name",saveModel.getSlaveKey1Name());
|
|
|
|
total+=saveModel.getResult2().longValue();
|
|
|
|
labelArr.add(json);
|
|
|
|
}
|
|
|
|
JSONObject arrTmp = new JSONObject();
|
|
|
|
arrTmp.put("patientLabelTotal",total);
|
|
|
|
arrTmp.put("patientLabelList",labelArr);
|
|
|
|
res.put("patientLabelStatistic",arrTmp);
|
|
|
|
|
|
|
|
//年龄分布 50
|
|
|
|
// ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate, endDate, area, level, "50", SaveModel.timeLevel_DDL,null,null,"2");
|
|
|
|
List<SaveModel> ageList = elasticsearchUtil.findDateAllQuotaLevel1(endDate,endDate,area,level,"50",SaveModel.timeLevel_DDL,null,null,"2");
|
|
|
|
JSONArray ageArray = new JSONArray();
|
|
|
|
for(int i=0;i<ageList.size();i++){
|
|
|
|
SaveModel saveModel = ageList.get(i);
|
|
|
|
if ("0".equals(saveModel.getSlaveKey1())){//去除60岁以下老人
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("num",saveModel.getResult2().longValue());
|
|
|
|
json.put("code",saveModel.getSlaveKey1());
|
|
|
|
json.put("name",saveModel.getSlaveKey1Name());
|
|
|
|
ageArray.add(json);
|
|
|
|
}
|
|
|
|
res.put("ageList",ageArray);
|
|
|
|
|
|
|
|
//居住小区分布
|
|
|
|
String filter = "";
|
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
|
|
|
|
List<Map<String,Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
|
if(listtmp.size()>0){
|
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
|
filter = " not in ('"+orgCodes+"')";
|
|
|
|
}
|
|
|
|
String sql = "select count(id) total,residential_area residentialArea from base_patient where del=1 and id "+filter+" and archive_type=1 " +
|
|
|
|
"GROUP BY residential_area ORDER BY total desc";
|
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
|
Iterator<Map<String, Object>> iterator = result.iterator();
|
|
|
|
Map<String, Object> tmp = new HashMap<>();
|
|
|
|
while (iterator.hasNext()){
|
|
|
|
tmp = iterator.next();
|
|
|
|
if (null==tmp.get("residentialArea")){
|
|
|
|
iterator.remove();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
result.add(tmp);
|
|
|
|
res.put("residentialArea",result);
|
|
|
|
}
|
|
|
|
//性别分析
|
|
|
|
String archiType="";
|
|
|
|
if("42".equals(index)){
|
|
|
|
archiType="2";
|
|
|
|
}
|
|
|
|
if("37".equals(index)){
|
|
|
|
archiType="1";
|
|
|
|
}
|
|
|
|
List<SaveModel> sexList = elasticsearchUtil.findDateQuotaLevel2ByKeyGroup(endDate, endDate,defalutArea, level, "51",SaveModel.timeLevel_DDL,null,archiType,null,null,"2","1");
|
|
|
|
JSONArray sexArray = new JSONArray();
|
|
|
|
for(int i=0;i<sexList.size();i++){
|
|
|
|
SaveModel saveModel = sexList.get(i);
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
json.put("num",saveModel.getResult2().longValue());
|
|
|
|
json.put("code",saveModel.getSlaveKey1());
|
|
|
|
json.put("name",saveModel.getSlaveKey1Name());
|
|
|
|
sexArray.add(json);
|
|
|
|
}
|
|
|
|
res.put("sexList",sexArray);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*大屏 老人云照护 评估*/
|
|
|
|
public JSONArray cloudCareForTheElderly(String endDate, String area, Integer level) throws Exception{
|
|
|
|
//评估类型
|
|
|
|
String filter = "";
|
|
|
|
String sqltmp = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_child' or dict_name = 'jkzl_older' ";
|
|
|
|
List<Map<String,Object>> listtmp = jdbcTemplate.queryForList(sqltmp);
|
|
|
|
if(listtmp.size()>0){
|
|
|
|
String orgCodes = String.valueOf(listtmp.get(0).get("orgCodes"));
|
|
|
|
if (StringUtils.isNotBlank(orgCodes)){
|
|
|
|
orgCodes = orgCodes.replaceAll(",","','");
|
|
|
|
filter = " and lab.patient not in ('"+orgCodes+"')";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
|
String sql = " select dict.dict_code,dict_value,count(DISTINCT A.patient) total from wlyy_hospital_sys_dict dict \n" +
|
|
|
|
" LEFT JOIN (select distinct lab.patient,lab.label_code from wlyy_patient_label lab INNER JOIN base_patient p on p.id = lab.patient AND lab.label_type='3' " +
|
|
|
|
filter+" \n" +
|
|
|
|
")A on dict.dict_code = A.label_code " +
|
|
|
|
"where dict.dict_name='older_label' and dict.dict_code is not null and dict_code <= 7 \n" +
|
|
|
|
" GROUP BY dict.dict_code; ";
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
String older = " select count(distinct lab.patient) from wlyy_patient_label lab INNER JOIN base_patient p on p.id = lab.patient AND lab.label_type='1' "+filter;
|
|
|
|
Integer count = jdbcTemplate.queryForObject(older,Integer.class);
|
|
|
|
|
|
|
|
for(Map<String,Object> map:list){
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
json.put("rate", df.format((Integer.parseInt(map.get("total").toString())*1.00) / count * 100));
|
|
|
|
json.put("num", map.get("total"));
|
|
|
|
json.put("code",map.get("dict_code").toString());
|
|
|
|
json.put("name",map.get("dict_value").toString());
|
|
|
|
jsonArray.add(json);
|
|
|
|
}
|
|
|
|
return jsonArray;
|
|
|
|
}
|
|
}
|
|
}
|