|
@ -2,7 +2,12 @@ package com.yihu.jw.care.service.statistics;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
import com.yihu.jw.care.util.ConstantUtil;
|
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
import com.yihu.jw.es.util.ElasticsearchUtil;
|
|
import com.yihu.jw.es.util.ElasticsearchUtil;
|
|
|
|
import com.yihu.jw.es.util.SaveModel;
|
|
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@ -26,14 +31,56 @@ public class StatisticsService {
|
|
private ElasticsearchUtil elasticsearchUtil;
|
|
private ElasticsearchUtil elasticsearchUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
|
@Autowired
|
|
|
|
private DictHospitalDeptDao hospitalDeptDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseOrgDao orgDao;
|
|
|
|
@Autowired
|
|
|
|
private StatisticsUtilService statisticsUtilService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 统计首页头部数据
|
|
|
|
* @param area
|
|
|
|
* @param startDate
|
|
|
|
|
|
* 统计总数
|
|
* @param endDate
|
|
* @param endDate
|
|
|
|
* @param area
|
|
|
|
* @param level 2 市 3区 4医院 5、科室 6医生
|
|
|
|
* @param index
|
|
|
|
* @param type
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
|
|
public JSONObject statisticsTotalAmount( String endDate, String area, int level, String index, String type) throws Exception {
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
String[] indexes = index.split(",");
|
|
|
|
for(String ind:indexes){
|
|
|
|
//总量
|
|
|
|
SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, ind, SaveModel.timeLevel_DDL);
|
|
|
|
res.put("index_"+ind+"_total",saveModel.getResult2().longValue());
|
|
|
|
if(StringUtils.isNotBlank(type)){
|
|
|
|
//周/月 增量
|
|
|
|
String start = statisticsUtilService.calStart(endDate,type);
|
|
|
|
SaveModel saveModelAdd = elasticsearchUtil.findOneDateQuotaLevel0(start, endDate, area, level, ind, SaveModel.timeLevel_ZL);
|
|
|
|
|
|
|
|
res.put("index_"+ind+"_add",saveModelAdd.getResult2().longValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 统计首页头部数据
|
|
|
|
* @param area
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
*/
|
|
public JSONObject indexTopNum(String area,String startDate,String endDate,Integer level){
|
|
public JSONObject indexTopNum(String area,String startDate,String endDate,Integer level){
|
|
JSONObject re = new JSONObject();
|
|
JSONObject re = new JSONObject();
|
|
String signSql = " SELECT COUNT(sr.id) " +
|
|
String signSql = " SELECT COUNT(sr.id) " +
|