Explorar el Código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	common/common-entity/sql记录
yeshijie hace 3 años
padre
commit
414932c015

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

@ -376,22 +376,54 @@ public class StatisticsService {
        Integer childTotal = 0;
        Integer helperTotal = 0;
        Integer teacherTotal = 0;
        Integer olderOff = 0;
        Integer childOff = 0;
        Integer helperOff = 0;
        Integer teacherOff = 0;
        Integer helperOn = 0;
        Integer teacherOn = 0;
        Integer childOn = 0;
        Integer olderOn = 0;
        Integer olderWxOn = 0;
        Integer olderPadOn = 0;
        //老人 儿童注册人数
        String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type from base_patient WHERE archive_type is  not null and del='1' GROUP BY archive_type";
        String pateintFilter = "";
        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(",","','");
            pateintFilter = " and id not in ('"+orgCodes+"')";
        }
        String sql1 = "SELECT COUNT(*) c,archive_type*1 as archive_type,IFNULL(on_line,0) online from base_patient WHERE archive_type is  not null" +
                " and del='1' "+pateintFilter+" GROUP BY archive_type";
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        for(Map<String,Object> map:list1){
            String archive_type = map.get("archive_type").toString();
            Integer num = Integer.valueOf(map.get("c").toString());
            Integer online = Integer.valueOf(map.get("online").toString());
            if("1".equals(archive_type)){
                olderTotal = num;
                if(online == 1){
                    olderOn = num;
                }else{
                    olderOff = num;
                }
                continue;
            }
            if("2".equals(archive_type)){
                childTotal = num;
                if(online == 1){
                    childOn = num;
                }else{
                    childOff = num;
                }
            }
        }
        olderTotal = olderOff+olderOn;
        childTotal = childOff+childOn;
        //助老员和教师注册人数
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
        String sql2 = "SELECT COUNT(a.id) c,a.doctor_level,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
                "and a.doctor_level is not null and h.org_code not in ( " +
                "SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  " +
                ") GROUP BY a.doctor_level";
@ -399,50 +431,32 @@ public class StatisticsService {
        for(Map<String,Object> map:list2){
            String archive_type = map.get("doctor_level").toString();
            Integer num = Integer.valueOf(map.get("c").toString());
            Integer online = Integer.valueOf(map.get("online").toString());
            if("2".equals(archive_type)){
                helperTotal = num;
                if(online == 1){
                    helperOn = num;
                }else{
                    helperOff = num;
                }
                continue;
            }
            if("3".equals(archive_type)){
                teacherTotal = num;
                if(online == 1){
                    teacherOn = num;
                }else{
                    teacherOff = num;
                }
            }
        }
        helperTotal = helperOff+helperOn;
        teacherTotal = teacherOff+teacherOn;
        //helper 助老员,teacher 教师,child 幼儿,olderWx 老人公众号,olderPad 老人平板
        String onlineCount = imUtil.getOnlineCountByType("");
        JSONObject jsonObject = JSON.parseObject(onlineCount).getJSONObject("data");
        //olderPad":0,"olderWx":0,"child":0,"teacher":0,"helper":0
        Integer helperOn = jsonObject.getInteger("helper");
        Integer teacherOn = jsonObject.getInteger("teacher");
        Integer childOn = jsonObject.getInteger("child");
        Integer olderWxOn = jsonObject.getInteger("olderWx");
        Integer olderPadOn = jsonObject.getInteger("olderPad");
        int repeatNum = 0;
        if(olderWxOn>0&&olderPadOn>0){
            //2个都大于0 要计算重复的人数
            String onlineOlderWx = imUtil.getOnlineListByType("olderWx");
            JSONObject olderWx = JSON.parseObject(onlineOlderWx);
            List<String> list = new ArrayList(olderWx.size());
            olderWx.entrySet().stream().forEach(one->{
                list.add(one.getKey());
            });
            String onlineOlderPad = imUtil.getOnlineListByType("olderPad");
            JSONObject olderPad = JSON.parseObject(onlineOlderPad);
            for (Map.Entry<String,Object> s:olderPad.entrySet()){
                if(list.contains(s.getKey())){
                    repeatNum++;
                }
            }
        }
        Integer olderOff = olderTotal - olderWxOn - olderPadOn + repeatNum;
        olderOff = olderOff>0?olderOff:0;
        Integer childOff = childTotal - childOn;
        Integer helperOff = helperTotal - helperOn;
        Integer teacherOff = teacherTotal - teacherOn;
        olderWxOn = jsonObject.getInteger("olderWx");
        olderPadOn = jsonObject.getInteger("olderPad");
        result.put("olderTotal",olderTotal);
        result.put("childTotal",childTotal);