Przeglądaj źródła

Merge branch 'dev' of chinawu123/wlyy2.0 into dev

liubing 3 lat temu
rodzic
commit
c2efa2c2e3

+ 4 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -84,7 +84,8 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "patientAnalysis")
    @ApiOperation(value = "居民分析")
    public ObjEnvelop patientAnalysis(@RequestParam(required = true) String endDate,
    public ObjEnvelop patientAnalysis(
                                      @RequestParam(required = true) String endDate,
                                      @RequestParam(required = true) String area,
                                      @RequestParam(required = true) int level,
                                      @ApiParam(name = "index", value = "42幼儿,37老人", defaultValue = "") @RequestParam(required = true) String index) {
@ -100,11 +101,10 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "patientTypeTotalAnalysis")
    @ApiOperation(value = "老人幼儿类型统计分析")
    public ObjEnvelop patientTypeTotalAnalysis(
            @RequestParam(required = true) String startDate,
            @RequestParam(required = true) String endDate,
            @RequestParam(required = false) String endDate,
            @ApiParam(name = "index", value = "42幼儿,37老人", defaultValue = "") @RequestParam(required = true) String index) {
        try {
            JSONObject result = statisticsService.combinedTotal(index,startDate,endDate);
            JSONObject result = statisticsService.combinedTotal(index,endDate);
            return success(result);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);

+ 19 - 9
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -178,7 +178,9 @@ public class StatisticsService {
        JSONObject res = new JSONObject();
        StringBuffer sqlbuff = new StringBuffer();
        List<Map<String,Object>> listMaps = null;
        if ("".equals(day)){
            day = "30";
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.DATE, -Integer.parseInt(day));
@ -227,6 +229,13 @@ public class StatisticsService {
        // 28 新生儿-在线咨询总数
        // 32 新生儿-在线咨询总数
        // 35 新生儿-上门辅导-服务工单数
        // 54 新生儿-上门辅导-工单数发起数
        if ("".equals(interval)){
            interval ="1";
        }
        if ("".equals(timeLevel)){
            timeLevel ="1";
        }
        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);
@ -237,7 +246,7 @@ public class StatisticsService {
    }
    /*综合总数*/
    public JSONObject combinedTotal(String type,String startDate,String endDate) throws Exception {
    public JSONObject combinedTotal(String type,String endDate) throws Exception {
        JSONObject res = new JSONObject();
        String index = "";
        //es
@ -245,7 +254,8 @@ public class StatisticsService {
        // 44 老人-生活照料-代预约
        // 28 新生儿-在线咨询总数
        // 35 新生儿-上门辅导-服务工单数
        // 29 新生儿-在线咨询未回复数
        // 54 新生儿-上门辅导-工单数发起数
        //sql
        // activity-3 幼儿活动
        // activity-1   活动浏览次数
@ -253,13 +263,13 @@ public class StatisticsService {
        //41 老人-紧急呼叫
        //43 老人 安放监护
        //type 42 老人 37 幼儿
        if ("42".equals(type)){
             index = "39,44";
        //type   幼儿42    37老人
        if ("37".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);
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, 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 ";
@ -269,11 +279,11 @@ public class StatisticsService {
            res.put("index_41",emergencyCallNum);
            res.put("index_43",securityMonitoringNum);
        }else {
            index = "28,35";
            index = "28,35,54,29";
            String[] indexes = index.split(",");
            for(String ind:indexes){
                //总量
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL);
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, defalutArea, defalutLevel, ind, SaveModel.timeLevel_DDL);
                res.put("index_"+ind,saveModel.getResult2().longValue());
            }