浏览代码

数据清洗

zd_123 7 年之前
父节点
当前提交
b6dfe30687

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -4210,6 +4210,50 @@ public class StatisticsService extends BaseService {
        return  new JSONArray(doctorList);
    }
    public JSONObject getTeamDoctorEduTitleFromEs(String teamCode, String startDate, String endDate, String doctor) {
        startDate = changeDate(DateUtil.getNextDay(startDate,-1));
        endDate = changeDate(endDate);
        String totalSql = "select count(*) AS articleCount,count(DISTINCT batchNo) AS batchCount " +
                " from " +esType+
                " where adminTeamCode="+teamCode+" and doctorCode='"+doctor+"' and createTime <='"+endDate+"'";
        String addSql = "SELECT " +
                " COUNT(*) AS addCount, " +
                " COUNT(DISTINCT batchNo) addBatchno " +
                " FROM " + esType +
                " WHERE " +
                " adminTeamCode =" + teamCode +
                " AND doctorCode ='" + doctor + "'" +
                " AND createTime <= '" + endDate + "' " +
                " AND createTime >= '" + startDate + "'";
        List<HealthEduArticleESResult> totalList = elasticsearchUtil.excute(totalSql,HealthEduArticleESResult.class,esType,esIndex);
        List<HealthEduArticleESResult> addList = elasticsearchUtil.excute(addSql,HealthEduArticleESResult.class,esType,esIndex);
        JSONObject rs = new JSONObject();
        //转换到map
        List<Map<String,Object>> totalMapList = new ArrayList<>();
        Map<String,Object> totalMap = new HashedMap();
        totalMap.put("batchno","0");
        totalMap.put("articleCount","0");
        if (totalList!=null && totalList.size()>0){
            totalMap.put("batchno",totalList.get(0).getBatchCount());
            totalMap.put("articleCount",totalList.get(0).getArticleCount());
        }
        totalMapList.add(totalMap);
        //转换到map
        List<Map<String,Object>> addMapList = new ArrayList<>();
        Map<String,Object> addMap = new HashedMap();
        addMap.put("addCount","0");
        addMap.put("addBatchno","0");
        if (addList!=null && addList.size()>0){
            totalMap.put("addCount",addList.get(0).getAddCount());
            totalMap.put("addBatchno",addList.get(0).getAddBatchno());
        }
        addMapList.add(addMap);
        rs.put("totalList", totalMapList);
        rs.put("addList", addMapList);
        return rs;
    }
    public JSONObject getTeamDoctorEduTitle(String teamCode, String startDate, String endDate, String doctor) {
        startDate = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
        endDate = endDate + " 17:00:00";

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -1430,7 +1430,7 @@ public class EsStatisticsController extends BaseController {
                                        @RequestParam(required = true) String endDate,
                                        @RequestParam(required = true) String doctor) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduTitle(teamCode, startDate, endDate, doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduTitleFromEs(teamCode, startDate, endDate, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");