Selaa lähdekoodia

Merge branch 'dev' of zd_123/patient-co-management into dev

trick9191 7 vuotta sitten
vanhempi
commit
346e9fb06e

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

@ -2609,6 +2609,7 @@ public class StatisticsService extends BaseService {
                    " AND c.patient = s.id " +
                    " AND t. STATUS <> 10 " +
                    " AND t.`reply` = 0 " +
                    " AND c.type = 2 "+
                    " AND p.session_id = t.session_id " +
                    " AND d.id ='" + doctor + "'" +
                    " AND c.admin_team_code = " + teamCode +
@ -2631,6 +2632,7 @@ public class StatisticsService extends BaseService {
                    " AND p.session_id = t.session_id " +
                    " AND d.id ='" + doctor + "'" +
                    " AND c.admin_team_code = " + teamCode +
                    " AND c.type = 2 "+
                    " AND t.create_time >= '" + startDate + "' " +
                    " AND t.create_time <= '" + endDate + "' " +
                    " GROUP BY dateNo";
@ -2654,6 +2656,7 @@ public class StatisticsService extends BaseService {
                    "  AND d.id ='" + doctor + "'" +
                    "  AND t. STATUS <> 10  " +
                    "  AND t.`reply` = 0  " +
                    "  AND c.type = 2 "+
                    "  AND t.create_time >= '" + startDate + "' " +
                    "  AND t.create_time <= '" + endDate + "' " +
                    "  GROUP BY weekOfMonth";
@ -2673,6 +2676,7 @@ public class StatisticsService extends BaseService {
                    "  AND p.session_id = t.session_id " +
                    "  AND d.id ='" + doctor + "'" +
                    "  AND c.admin_team_code = " + teamCode +
                    "  AND c.type = 2 "+
                    "  AND t.create_time >= '" + startDate + "' " +
                    "  AND t.create_time <= '" + endDate + "' " +
                    "  GROUP BY weekOfMonth";
@ -2928,6 +2932,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
                " AND t.create_time <= '" + endDate + "'";
@ -2946,6 +2951,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND t.`reply`=1 " +
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
@ -2966,6 +2972,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND c.admin_team_code =" + teamCode +
                " AND d.id='" + doctor + "'" +
                " AND t.create_time >= '" + startDate + "' " +
@ -2985,6 +2992,7 @@ public class StatisticsService extends BaseService {
                " AND c.patient = s.id " +
                " AND p.session_id = t.session_id " +
                " AND c.type <> 8"+
                " AND c.type = 2"+
                " AND t. STATUS <> 10  " +
                " AND t.`reply` = 0  " +
                " AND c.admin_team_code =" + teamCode +
@ -4093,7 +4101,8 @@ public class StatisticsService extends BaseService {
                " w.admin_team_code =" + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "'";
                " AND w.czrq >= '" + startDate + "'"+
                " GROUP BY w.batch_no";
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> addList = jdbcTemplate.queryForList(addSql);
        JSONObject rs = new JSONObject();

+ 103 - 25
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2281,6 +2281,66 @@ public class StatisticsESService {
        return resultMaps;
    }
    /**
     * 团队报告团队详情中健康教育折线图
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type
     * @return
     */
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type)throws Exception {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        List<Map<String,Object>> dateList = DateUtil.findDates(dateFormat.parse(startDate),dateFormat.parse(endDate));
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> articleCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"59",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<SaveModel> batchNoCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"71",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<Map<String, Object>> list = new ArrayList<>();
        if(articleCountList!=null){
            //循环人数集合
            for (SaveModel one1:articleCountList){
                String date = "";
                if(one1.getQuotaDate()!=null){
                    date=dateFormat.format(one1.getQuotaDate());
                }
                if (one1.getResult2().intValue()!=0){
                    Map<String,Object> map = new HashedMap();
                    map.put("articleCount",one1.getResult2().intValue());
                    //查看批次集合里是否有同时间的数据
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            map.put("batchCount",one2.getResult2().intValue());
                        }
                    }
                    if ("0".equals(type)) {
                        map.put("dateNo",date);
                    } else {
                        map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
                    }
                    list.add(map);
                }else{
                    //循环批次
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getResult2().intValue()!=0 && one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            Map<String,Object> map = new HashedMap();
                            map.put("articleCount",0);
                            map.put("batchCount",one2.getResult2().intValue());
                            if ("0".equals(type)) {
                                map.put("dateNo",dateFormat.format(date));
                            } else {
                                map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
                            }
                            list.add(map);
                        }
                    }
                }
            }
        }
        return new JSONArray(list);
    }
    public JSONObject getRenewPercentAndChangePercent(String index, Integer level, String area, String year, String lowCode) {
        JSONObject jo = new JSONObject();
        String switchIndex = "";//转签index
@ -2950,7 +3010,7 @@ public class StatisticsESService {
                if ("0".equals(type)) {
                    map.put("dateNo",dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("noRely", one.getResult2().longValue());
                noReyList.add(map);
@ -2977,7 +3037,7 @@ public class StatisticsESService {
    }
    /**
     * 获取团队随访量折线统计图(弃用)
     * 获取团队随访量折线统计图
     *
     * @param type
     * @param teamCode
@ -2987,11 +3047,12 @@ public class StatisticsESService {
     */
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "4", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list1 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "69", SaveModel.timeLevel_ZL, interval + "");
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "70", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
        for (SaveModel one : list1) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
@ -3001,8 +3062,21 @@ public class StatisticsESService {
            map.put("followupCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return null;
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            }
            map.put("planCount", one.getResult2().longValue());
            planList.add(map);
        }
        JSONObject result = new JSONObject();
        result.put("planList", planList);
        result.put("totalList", totalList);
        return result;
    }
    /**
@ -3018,19 +3092,21 @@ public class StatisticsESService {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("reservationCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("reservationCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }
@ -3196,19 +3272,21 @@ public class StatisticsESService {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("guidanceCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("guidanceCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }

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

@ -29,10 +29,10 @@ import java.util.Map;
import java.util.TreeMap;
/**
 * Created by chenweida on 2017/10/13.
 * Created by chenweida on 2017/10/13
 */
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "ES统计查询")
public class EsStatisticsController extends BaseController {
@ -1050,7 +1050,7 @@ public class EsStatisticsController extends BaseController {
    }
    /**
     * 获取团队随访量折线统计图(弃用)
     * 获取团队随访量折线统计图
     *
     * @param type
     * @param teamCode
@ -1065,7 +1065,7 @@ public class EsStatisticsController extends BaseController {
                                      @RequestParam(required = true) String startDate,
                                      @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamFollowupLine(teamCode, startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getTeamFollowupLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1343,7 +1343,7 @@ public class EsStatisticsController extends BaseController {
                                 @RequestParam(required = true) String endDate,
                                 @RequestParam(required = true) String type) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamEduLine(teamCode, startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getTeamEduLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");

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

@ -29,7 +29,7 @@ import java.util.*;
 * Created by lyr on 2016/08/16.
 */
@Controller
@RequestMapping(value = "/oldstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "统计")
public class StatisticsController extends BaseController {