浏览代码

统计修改

lyr 8 年之前
父节点
当前提交
e26b826e2f

+ 15 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/ExpensesRemindService.java

@ -103,7 +103,7 @@ public class ExpensesRemindService extends BaseService {
                    Patient p = patientDao.findByCode(String.valueOf(map.get("patient")));
                    Patient p = patientDao.findByCode(String.valueOf(map.get("patient")));
                    if (p != null) {
                    if (p != null) {
                        remindPatientExpenses(p, doc, hos);
                        remindPatientExpenses(p, doc, hos, true);
                    }
                    }
                }
                }
            }
            }
@ -137,7 +137,7 @@ public class ExpensesRemindService extends BaseService {
                throw new Exception("patient info can not find");
                throw new Exception("patient info can not find");
            }
            }
            return remindPatientExpenses(p, doc, hos);
            return remindPatientExpenses(p, doc, hos, false);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return 0;
            return 0;
@ -152,7 +152,7 @@ public class ExpensesRemindService extends BaseService {
     * @param hos 医院
     * @param hos 医院
     * @return
     * @return
     */
     */
    public int remindPatientExpenses(Patient p, Doctor doc, Hospital hos) throws Exception {
    public int remindPatientExpenses(Patient p, Doctor doc, Hospital hos,boolean ignore) throws Exception {
        try {
        try {
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            boolean mFlag = false;
            boolean mFlag = false;
@ -185,9 +185,16 @@ public class ExpensesRemindService extends BaseService {
                wFlag = true;
                wFlag = true;
            }
            }
            if (wFlag || mFlag) {
            if(ignore) {
                redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
                redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
                redisTemplate.expire("expenses:remind:" + p.getCode(),1, TimeUnit.DAYS);
                redisTemplate.expire("expenses:remind:" + p.getCode(), 1, TimeUnit.DAYS);
            }
            if (wFlag || mFlag) {
                if(!ignore) {
                    redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
                    redisTemplate.expire("expenses:remind:" + p.getCode(), 1, TimeUnit.DAYS);
                }
                if (!isMobileExist) {
                if (!isMobileExist) {
                    return 2;
                    return 2;
                }
                }
@ -199,6 +206,9 @@ public class ExpensesRemindService extends BaseService {
                if (!isMobileExist && !isOpenIdExist) {
                if (!isMobileExist && !isOpenIdExist) {
                    return -1;
                    return -1;
                }
                }
                if(isMobileExist){
                    return  -2;
                }
                return 0;
                return 0;
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {

+ 357 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java

@ -241,6 +241,218 @@ public class StatisticsAllService extends BaseService {
    }
    }
    /**
     * 获取签约分组信息
     *
     * @param endDate
     * @param lowCode
     * @param area
     * @param level
     * @return
     */
    public JSONObject getGroupInfo(String endDate, String lowCode, String area, int level) {
        JSONObject json = new JSONObject();
        long total = 0;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        boolean preFlag = false;
        String preDate = endDate;
        if (endDate.compareTo(dateFormat.format(new Date())) >= 0) {
            String val = redisTemplate.opsForValue().get("quota:7:" + level + ":" + area + ":" + lowCode + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(val)) {
                JSONObject valJson = new JSONObject(val);
                if (valJson.has("num")) {
                    total = valJson.getInt("num");
                }
            } else {
                preFlag = true;
                Calendar today = Calendar.getInstance();
                today.add(Calendar.DATE, -1);
                preDate = dateFormat.format(today.getTime());
            }
        } else {
            preFlag = true;
        }
        if (preFlag) {
            // 查询语句
            String sql = " select " +
                    "     ifnull(result,'0') amount" +
                    " from  " +
                    "     wlyy_quota_result " +
                    " where " +
                    "     quato_code = '7' " +
                    "   and level1_type = ? and del = '1'" +
                    "   and quota_date = ? " +
                    "   and level2_type = ? ";
            if (level == 4) {
                // 市级别
                sql += " and city = ? ";
            } else if (level == 3) {
                // 区、城镇级别
                sql += " and town = ? ";
            } else if (level == 2) {
                // 机构级别
                sql += " and org_code = ? ";
            } else if (level == 1) {
                sql += " and qkdoctor_code = ? ";
            }
            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{level, preDate, lowCode, area});
            if (result != null && result.size() > 0) {
                total = (result.get(0).get("amount") != null ? Long.valueOf(result.get(0).get("amount").toString()) : 0L);
            }
        }
        int num = 0;
        int taskNum = 0;
        String redisNum = redisTemplate.opsForValue().get("people:num:" + area);
        if (StringUtils.isEmpty(redisNum)) {
            PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
            if (peopleNum != null) {
                if (lowCode.equals("3")) {
                    num = peopleNum.getSixFiveNum();
                    taskNum = peopleNum.getSixFiveTaskNum();
                } else if (lowCode.equals("4")) {
                    num = peopleNum.getGxyNum();
                    taskNum = peopleNum.getGxyTaskNum();
                } else if (lowCode.equals("5")) {
                    num = peopleNum.getTnbNum();
                    taskNum = peopleNum.getTnbTaskNum();
                }
            }
        } else {
            JSONObject peopleNum = new JSONObject(redisNum);
            if (peopleNum != null) {
                if (lowCode.equals("3")) {
                    num = peopleNum.getInt("sixFiveNum");
                    taskNum = peopleNum.getInt("sixFiveTaskNum");
                } else if (lowCode.equals("4")) {
                    num = peopleNum.getInt("gxyNum");
                    taskNum = peopleNum.getInt("gxyTaskNum");
                } else if (lowCode.equals("5")) {
                    num = peopleNum.getInt("gxyNum");
                    taskNum = peopleNum.getInt("gxyTaskNum");
                }
            }
        }
        DecimalFormat df = new DecimalFormat("0.0000");
        json.put("sign", total);
        json.put("signRate", df.format((total * 1.0000) / num));
        json.put("signTaskRate", df.format((total * 1.0000) / taskNum));
        return json;
    }
    /**
     * 查询某个级别的某个指标到达量
     *
     * @param date
     * @param area
     * @param level
     * @param index
     * @param sort
     * @param lowLevel
     * @return
     * @throws Exception
     */
    public JSONArray getLevelTwoLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel, String lowCode) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (date.compareTo(dateFormat.format(new Date())) >= 0) {
            resultList = getLevelTwoTodayLowLevelTotal(area, level, index, sort, lowLevel, lowCode);
        } else {
            resultList = getLevelTwoTodayBeforeLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode);
        }
        // 结果为空时,自建结果集
        if (resultList == null || resultList.size() < 1) {
            resultList = getLowLevelMapKey(level, low_level, area);
        }
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
                if (!low_level.equals("1")) {
                    String redisNum = redisTemplate.opsForValue().get("people:num:" + map.get("code").toString());
                    if (StringUtils.isEmpty(redisNum)) {
                        PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(map.get("code").toString(), Calendar.getInstance().get(Calendar.YEAR));
                        if (peopleNum != null) {
                            int num = 0;
                            int taskNum = 0;
                            if (lowCode.equals("3")) {
                                num = peopleNum.getSixFiveNum();
                                taskNum = peopleNum.getSixFiveTaskNum();
                            } else if (lowCode.equals("4")) {
                                num = peopleNum.getGxyNum();
                                taskNum = peopleNum.getGxyTaskNum();
                            } else if (lowCode.equals("5")) {
                                num = peopleNum.getTnbNum();
                                taskNum = peopleNum.getTnbTaskNum();
                            }
                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100));
                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100));
                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100));
                            map.put("num", num);
                            map.put("task", taskNum);
                        }
                    } else {
                        JSONObject peopleNum = new JSONObject(redisNum);
                        if (peopleNum != null) {
                            int num = 0;
                            int taskNum = 0;
                            if (lowCode.equals("3")) {
                                num = peopleNum.getInt("sixFiveNum");
                                taskNum = peopleNum.getInt("sixFiveTaskNum");
                            } else if (lowCode.equals("4")) {
                                num = peopleNum.getInt("gxyNum");
                                taskNum = peopleNum.getInt("gxyTaskNum");
                            } else if (lowCode.equals("5")) {
                                num = peopleNum.getInt("gxyNum");
                                taskNum = peopleNum.getInt("gxyTaskNum");
                            }
                            map.put("rate", df.format(((long) map.get("amount") * 1.0000) / num * 100));
                            map.put("taskRate", df.format(((long) map.get("amount") * 1.0000) / taskNum * 100));
                            map.put("targetRate", df.format(taskNum * 1.0000 / num * 100));
                            map.put("num", num);
                            map.put("task", taskNum);
                        }
                    }
                }
            }
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    long map1value = (long) o1.get("amount");
                    long map2value = (long) o2.get("amount");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
                    } else if (map1value - map2value < 0) {
                        return sort == 1 ? 1 : -1;
                    } else {
                        return 0;
                    }
                }
            });
            return new JSONArray(resultList);
        } else {
            return new JSONArray();
        }
    }
    /**
    /**
     * 查询某个级别的某个指标到达量
     * 查询某个级别的某个指标到达量
     *
     *
@ -320,6 +532,74 @@ public class StatisticsAllService extends BaseService {
        }
        }
    }
    }
    /**
     * 获取过去某个日期某个区域一级指标的下级统计
     *
     * @param date
     * @param area
     * @param level
     * @param index
     * @param lowLevel
     * @return
     */
    public List<Map<String, Object>> getLevelTwoTodayBeforeLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel, String lowCode) throws Exception {
        List<Map<String, Object>> resultList = new ArrayList<>();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String areaField = "";
        String lowLevelField = "";
        String lowLevelName = "";
        if (level == 4) {
            // 市级别
            areaField = "city";
        } else if (level == 3) {
            // 区、城镇级别
            areaField = "town";
        } else if (level == 2) {
            // 机构级别
            areaField = "org_code";
        } else if (level == 1) {
            throw new Exception("param level error");
        }
        if (low_level.equals("3")) {
            lowLevelField = "town";
            lowLevelName = "town_name";
        } else if (low_level.equals("2")) {
            lowLevelField = "org_code";
            lowLevelName = "org_name";
        } else if (low_level.equals("1")) {
            lowLevelField = "qkdoctor_code";
            lowLevelName = "qkdoctor_name";
        } else {
            throw new Exception("param lowLevel error");
        }
        // 查询语句
        String sql = " select " +
                "     ifnull(" + lowLevelField + ",'') code " +
                "     ,ifnull(" + lowLevelName + ",'') 'name' " +
                "     ,ifnull(result,'0') amount" +
                " from  " +
                "     wlyy_quota_result " +
                " where " +
                "     quato_code = '" + index + "' " +
                "   and level1_type = ? and del = '1'" +
                "   and quota_date = ? " +
                "   and " + areaField + " = ? " +
                "   and level2_type = ? ";
        if (sort == 1) {
            sql += " order by amount desc ";
        } else {
            sql += " order by amount asc ";
        }
        resultList = jdbcTemplate.queryForList(sql, new Object[]{low_level, date, area, lowCode});
        return resultList;
    }
    /**
    /**
     * 获取过去某个日期某个区域一级指标的下级统计
     * 获取过去某个日期某个区域一级指标的下级统计
     *
     *
@ -388,6 +668,32 @@ public class StatisticsAllService extends BaseService {
    }
    }
    /**
     * 获取今天某个区域一级指标的下级统计
     *
     * @param area
     * @param level
     * @param index
     * @param lowLevel
     * @return
     */
    public List<Map<String, Object>> getLevelTwoTodayLowLevelTotal(String area, int level, String index, int sort, String lowLevel, String lowCode) throws Exception {
        List<Map<String, Object>> resultList = new ArrayList<>();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        resultList = getLowLevelMapKey(level, low_level, area);
        for (Map<String, Object> map : resultList) {
            String redisData = redisTemplate.opsForValue().get("quota:" + index + ":" + low_level + ":" + String.valueOf(map.get("code")) + ":" + lowCode + ":" + getQuotaTimeStamp());
            if (!StringUtils.isEmpty(redisData)) {
                JSONObject json = new JSONObject(redisData);
                map.put("amount", Long.valueOf(String.valueOf(json.get("num"))));
            }
        }
        return resultList;
    }
    /**
    /**
     * 获取今天某个区域一级指标的下级统计
     * 获取今天某个区域一级指标的下级统计
     *
     *
@ -429,6 +735,7 @@ public class StatisticsAllService extends BaseService {
        return resultList;
        return resultList;
    }
    }
    /**
    /**
     * 获取下级统计key
     * 获取下级统计key
     *
     *
@ -1058,11 +1365,11 @@ public class StatisticsAllService extends BaseService {
     * @param index
     * @param index
     * @return
     * @return
     */
     */
    public JSONObject getDateTotal(String startDate, String endDate, int interval, String area, int level, String index) throws Exception {
    public JSONObject getDateTotal(String startDate, String endDate, int interval, String area, int level, String index, String lowCode) throws Exception {
        int taskNum = 0;
        int taskNum = 0;
        JSONObject json = new JSONObject();
        JSONObject json = new JSONObject();
        if (level > 1) {
        if (level > 1 && StringUtils.isEmpty(lowCode)) {
            String redisNum = redisTemplate.opsForValue().get("people:num:" + area);
            String redisNum = redisTemplate.opsForValue().get("people:num:" + area);
            if (StringUtils.isEmpty(redisNum)) {
            if (StringUtils.isEmpty(redisNum)) {
@ -1077,19 +1384,46 @@ public class StatisticsAllService extends BaseService {
                }
                }
            }
            }
        }
        }
        if (!StringUtils.isEmpty(lowCode)) {
            String redisNum = redisTemplate.opsForValue().get("people:num:" + area);
            if (StringUtils.isEmpty(redisNum)) {
                PopulationBase peopleNum = peopleNumDao.findByCodeAndYear(area, Calendar.getInstance().get(Calendar.YEAR));
                if (peopleNum != null) {
                    if (lowCode.equals("3")) {
                        taskNum = peopleNum.getSixFiveTaskNum();
                    } else if (lowCode.equals("4")) {
                        taskNum = peopleNum.getGxyTaskNum();
                    } else if (lowCode.equals("5")) {
                        taskNum = peopleNum.getTnbTaskNum();
                    }
                }
            } else {
                JSONObject peopleNum = new JSONObject(redisNum);
                if (peopleNum != null) {
                    if (lowCode.equals("3")) {
                        taskNum = peopleNum.getInt("sixFiveTaskNum");
                    } else if (lowCode.equals("4")) {
                        taskNum = peopleNum.getInt("gxyTaskNum");
                    } else if (lowCode.equals("5")) {
                        taskNum = peopleNum.getInt("gxyTaskNum");
                    }
                }
            }
        }
        json.put("taskNum", taskNum);
        json.put("taskNum", taskNum);
        if (interval == 1) {
        if (interval == 1) {
            JSONArray jsonArray = dateTotalStatistics(startDate, endDate, area, level, index);
            JSONArray jsonArray = dateTotalStatistics(startDate, endDate, area, level, index, lowCode);
            json.put("data", jsonArray);
            json.put("data", jsonArray);
            return json;
            return json;
        } else if (interval == 2) {
        } else if (interval == 2) {
            JSONArray jsonArray = weekTotalStatistics(startDate, endDate, area, level, index);
            JSONArray jsonArray = weekTotalStatistics(startDate, endDate, area, level, index, lowCode);
            json.put("data", jsonArray);
            json.put("data", jsonArray);
            return json;
            return json;
        } else if (interval == 3) {
        } else if (interval == 3) {
            JSONArray jsonArray = monthTotalStatistics(startDate, endDate, area, level, index);
            JSONArray jsonArray = monthTotalStatistics(startDate, endDate, area, level, index, lowCode);
            json.put("data", jsonArray);
            json.put("data", jsonArray);
            return json;
            return json;
        }
        }
@ -1105,7 +1439,7 @@ public class StatisticsAllService extends BaseService {
     * @param index
     * @param index
     * @return
     * @return
     */
     */
    public JSONArray dateTotalStatistics(String startDate, String endDate, String area, int level, String index) throws ParseException {
    public JSONArray dateTotalStatistics(String startDate, String endDate, String area, int level, String index, String lowCode) throws ParseException {
        String areaField = "";
        String areaField = "";
        String sql = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@ -1170,7 +1504,7 @@ public class StatisticsAllService extends BaseService {
            // 当前范围包含当天,则需添加当天的统计数据
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(df.format(new Date())) == 0) {
            if (startStr.compareTo(df.format(new Date())) == 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + (!StringUtils.isEmpty(lowCode) ? (lowCode + ":") : "") + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                    if (valJson.has("num")) {
@ -1205,6 +1539,10 @@ public class StatisticsAllService extends BaseService {
                "   and quota_date <= '" + dateCon + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
                "   and " + areaField + " = '" + area + "' ";
        if (!StringUtils.isEmpty(lowCode)) {
            sql += "  and level2_type = '" + lowCode + "' ";
        }
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
        if (resultList != null) {
@ -1248,7 +1586,7 @@ public class StatisticsAllService extends BaseService {
     * @param index
     * @param index
     * @return
     * @return
     */
     */
    private JSONArray weekTotalStatistics(String startDate, String endDate, String area, int level, String index) throws Exception {
    private JSONArray weekTotalStatistics(String startDate, String endDate, String area, int level, String index, String lowCode) throws Exception {
        String areaField = "";
        String areaField = "";
        String sql = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@ -1347,7 +1685,7 @@ public class StatisticsAllService extends BaseService {
            // 当前范围包含当天,则需添加当天的统计数据
            // 当前范围包含当天,则需添加当天的统计数据
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + (!StringUtils.isEmpty(lowCode) ? (lowCode + ":") : "") + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                    if (valJson.has("num")) {
@ -1385,6 +1723,10 @@ public class StatisticsAllService extends BaseService {
                "   and quota_date <= '" + dateCon + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
                "   and " + areaField + " = '" + area + "' ";
        if (!StringUtils.isEmpty(lowCode)) {
            sql += "  and level2_type = '" + lowCode + "' ";
        }
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
        if (resultList != null) {
@ -1432,7 +1774,7 @@ public class StatisticsAllService extends BaseService {
     * @return
     * @return
     * @throws Exception
     * @throws Exception
     */
     */
    private JSONArray monthTotalStatistics(String startDate, String endDate, String area, int level, String index) throws Exception {
    private JSONArray monthTotalStatistics(String startDate, String endDate, String area, int level, String index, String lowCode) throws Exception {
        String areaField = "";
        String areaField = "";
        String sql = "";
        String sql = "";
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@ -1521,7 +1863,7 @@ public class StatisticsAllService extends BaseService {
            // 当天数据计算
            // 当天数据计算
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
            if (startStr.compareTo(df.format(new Date())) <= 0 && endStr.compareTo(df.format(new Date())) >= 0) {
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + getQuotaTimeStamp());
                String val = redisTemplate.opsForValue().get("quota:" + index + ":" + level + ":" + area + ":" + (!StringUtils.isEmpty(lowCode) ? (lowCode + ":") : "") + getQuotaTimeStamp());
                if (!StringUtils.isEmpty(val)) {
                if (!StringUtils.isEmpty(val)) {
                    JSONObject valJson = new JSONObject(val);
                    JSONObject valJson = new JSONObject(val);
                    if (valJson.has("num")) {
                    if (valJson.has("num")) {
@ -1559,6 +1901,10 @@ public class StatisticsAllService extends BaseService {
                "   and quota_date <= '" + dateCon + "' " +
                "   and quota_date <= '" + dateCon + "' " +
                "   and " + areaField + " = '" + area + "' ";
                "   and " + areaField + " = '" + area + "' ";
        if (!StringUtils.isEmpty(lowCode)) {
            sql += "  and level2_type = '" + lowCode + "' ";
        }
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        if (resultList != null) {
        if (resultList != null) {

+ 3 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -883,7 +883,9 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    return error(200, "居民未绑定微信,无法微信提醒,已发送短信提醒");
                    return error(200, "居民未绑定微信,无法微信提醒,已发送短信提醒");
                } if (result == -1) {
                } if (result == -1) {
                    return error(-1, "居民未绑定手机号和微信,无法提醒");
                    return error(-1, "居民未绑定手机号和微信,无法提醒");
                } else {
                } if (result == -2) {
                    return error(-1, "短信发送失败");
                }  else {
                    return error(-1, "提醒失败");
                    return error(-1, "提醒失败");
                }
                }
            } else if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
            } else if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {

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

@ -5,6 +5,7 @@ import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,8 +14,11 @@ import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Set;
/**
/**
 * Created by lyr on 2016/08/16.
 * Created by lyr on 2016/08/16.
 */
 */
@ -225,19 +229,23 @@ public class StatisticsController extends BaseController {
     */
     */
    @RequestMapping(value = "/sign_info")
    @RequestMapping(value = "/sign_info")
    @ResponseBody
    @ResponseBody
    public String getAreaSignInfo(String endDate, String area, int level) {
    public String getAreaSignInfo(String endDate, String area, int level, @RequestParam(required = false) String lowCode) {
        try {
        try {
            JSONObject result = new JSONObject();
            JSONObject result = new JSONObject();
            long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
            long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
            JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level);
            JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
            result.put("sign", sign);
            result.put("expenses", weiJf);
            result.put("signRate", signRate);
            result.put("signTaskRate", signTaskRate);
            if (StringUtils.isEmpty(lowCode)) {
                long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
                long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
                JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level);
                JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
                result.put("sign", sign);
                result.put("expenses", weiJf);
                result.put("signRate", signRate);
                result.put("signTaskRate", signTaskRate);
            } else {
                result = statisticsAllService.getGroupInfo(endDate, lowCode, area, level);
            }
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
@ -281,14 +289,14 @@ public class StatisticsController extends BaseController {
     */
     */
    @RequestMapping(value = "/interval_total")
    @RequestMapping(value = "/interval_total")
    @ResponseBody
    @ResponseBody
    public String indexIntervalTotal(String startDate, String endDate, int interval, String area, int level, String index) {
    public String indexIntervalTotal(String startDate, String endDate, int interval, String area, int level, String index, @RequestParam(required = false) String lowCode) {
        try {
        try {
            String[] indexes = index.split(",");
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            JSONObject result = new JSONObject();
            if (index != null) {
            if (index != null) {
                for (String idx : indexes) {
                for (String idx : indexes) {
                    result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx));
                    result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode));
                }
                }
            }
            }
@ -310,13 +318,18 @@ public class StatisticsController extends BaseController {
     */
     */
    @RequestMapping("/lowlevel_all")
    @RequestMapping("/lowlevel_all")
    @ResponseBody
    @ResponseBody
    public String getIndexLowLevelTotalSign(String date, String area, int level, String index, int sort, String lowLevel) {
    public String getIndexLowLevelTotalSign(String date, String area, int level, String index,
                                            int sort, String lowLevel, @RequestParam(required = false) String lowCode) {
        try {
        try {
            String[] indexes = index.split(",");
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
            if (StringUtils.isNotEmpty(lowCode)) {
                result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode));
            } else {
                for (String idx : indexes) {
                    result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
                }
            }
            }
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
@ -379,4 +392,5 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
}
}