Browse Source

统计修改

lyr 8 years ago
parent
commit
2ebe48d833

+ 21 - 17
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -307,7 +307,7 @@ public class SignPatientLabelInfoService extends BaseService {
        if (!labelType.equals("5")) {
            labelNo.setLabelCode("0");
            labelNo.setLabelName("未分组");
            labelNo.setLabelName(labelType.equals("1") ? "未分组" : "未标注");
            labelNo.setStatus(1);
            labelNo.setIsSystem(1);
            labelNo.setLabelType(labelType);
@ -414,6 +414,10 @@ public class SignPatientLabelInfoService extends BaseService {
                }
                json.put("amount", amount);
                if (label.getLabelCode().equals("0") && labelType.equals("1") && amount < 0) {
                    continue;
                }
                result.put(json);
            }
        }
@ -622,22 +626,22 @@ public class SignPatientLabelInfoService extends BaseService {
        page = page * pagesize;
        Object[] args = null;
        String sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
                                " join " : " left join ") +
                        "    wlyy_sign_patient_label_info t2 " +
                        " ON t1.patient = t2.patient " +
                        " WHERE " +
                        (StringUtils.isNotEmpty(labelCode) ? " t2.label = ? " : "") +
                        (StringUtils.isNotEmpty(labelType) ? " and t2.label_type = ? " : "") +
                        "    AND t2.status = 1 " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.status > 0 " +
                        "    AND (t1.name like ? OR t2.label_name like ?) " +
                        (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")
                        + " limit " + page + "," + pagesize;
                "    t1.* " +
                " FROM " +
                "    wlyy_sign_family t1 " +
                (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
                        " join " : " left join ") +
                "    wlyy_sign_patient_label_info t2 " +
                " ON t1.patient = t2.patient " +
                " WHERE " +
                (StringUtils.isNotEmpty(labelCode) ? " t2.label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " and t2.label_type = ? " : "") +
                "    AND t2.status = 1 " +
                "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                "    AND t1.status > 0 " +
                "    AND (t1.name like ? OR t2.label_name like ?) " +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")
                + " limit " + page + "," + pagesize;
        if (StringUtils.isNotEmpty(labelCode)) {
            args = new Object[]{labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%"};

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

@ -133,7 +133,7 @@ public class StatisticsService extends BaseService {
        }
    }
    public long getWeiJiaoFei(String endDate,String area,int level){
    public long getWeiJiaoFei(String endDate, String area, int level) {
        // 查询语句
        String sql = " select " +
                "     ifnull(result,'0') amount" +
@ -158,9 +158,9 @@ public class StatisticsService extends BaseService {
            sql += " and qkdoctor_code = ?";
        }
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{level, endDate, area});
        if (result != null  && result.size() > 0) {
        if (result != null && result.size() > 0) {
            return (result.get(0).get("amount") != null ? Long.valueOf(result.get(0).get("amount").toString()) : 0);
        } else {
            return 0;
@ -1419,6 +1419,54 @@ public class StatisticsService extends BaseService {
                map6.put("name", "50~65");
                map6.put("amount", Double.valueOf("0.0"));
                resultList.add(map6);
            } else if (index.equals("14")) {
                Map<String, Object> map1 = new HashMap<>();
                map1.put("code", "0");
                map1.put("name", "未缴费人数");
                map1.put("amount", Double.valueOf("0.0"));
                resultList.add(map1);
                Map<String, Object> map2 = new HashMap<>();
                map2.put("code", "1");
                map2.put("name", "已缴费人数");
                map2.put("amount", Double.valueOf("0.0"));
                resultList.add(map2);
                Map<String, Object> map3 = new HashMap<>();
                map2.put("code", "2");
                map2.put("name", "已退费人数");
                map2.put("amount", Double.valueOf("0.0"));
                resultList.add(map3);
            } else if (index.equals("15")) {
                Map<String, Object> map1 = new HashMap<>();
                map1.put("code", "0");
                map1.put("name", "未标注");
                map1.put("amount", Double.valueOf("0.0"));
                resultList.add(map1);
                Map<String, Object> map2 = new HashMap<>();
                map2.put("code", "1");
                map2.put("name", "健康人群");
                map2.put("amount", Double.valueOf("0.0"));
                resultList.add(map2);
                Map<String, Object> map3 = new HashMap<>();
                map3.put("code", "2");
                map3.put("name", "患病人群");
                map3.put("amount", Double.valueOf("0.0"));
                resultList.add(map3);
                Map<String, Object> map4 = new HashMap<>();
                map4.put("code", "3");
                map4.put("name", "高危人群");
                map4.put("amount", Double.valueOf("0.0"));
                resultList.add(map4);
                Map<String, Object> map5 = new HashMap<>();
                map5.put("code", "4");
                map5.put("name", "恢复期人群");
                map5.put("amount", Double.valueOf("0.0"));
                resultList.add(map5);
            }
        }
@ -1458,31 +1506,7 @@ public class StatisticsService extends BaseService {
                    String code = String.valueOf(map.get("code"));
                    double rateG = (total > 0 ? ((long) map.get("amount")) * 1.0000 / total * 100 : 0);
                    map.put("rate", df.format(rateG));
//                    if (index.equals(GROUP)) {
//                        if (code.equals("1") || code.equals("2") || code.equals("3")) {
//                            rateTotal += rateG;
//                        }
//                    } else {
//                        rateTotal += rateG;
//                    }
                }
//                if (1 - rateTotal > 0) {
//                    for (Map<String, Object> map : resultList) {
//                        if (index.equals(GROUP)) {
//                            String code = String.valueOf(map.get("code"));
//                            if ((long) map.get("amount") > 0 && (code.equals("1") || code.equals("2") || code.equals("3"))) {
//                                map.put("rate", df.format(Double.valueOf((String) map.get("rate")) + (1 - rateTotal)));
//                                break;
//                            }
//                        }else{
//                            if ((long) map.get("amount") > 0) {
//                                map.put("rate", df.format(Double.valueOf((String) map.get("rate")) + (1 - rateTotal)));
//                                break;
//                            }
//                        }
//                    }
//                }
            }
            if (index.equals(SEX) && resultList.size() > 0) {
                int i = 0;
@ -1844,19 +1868,19 @@ public class StatisticsService extends BaseService {
            }
        }
        json.put("taskNum",taskNum);
        json.put("taskNum", taskNum);
        if (interval == 1) {
            JSONArray jsonArray = dateTotalStatistics(startDate, endDate, area, level, index);
            json.put("data",jsonArray);
            json.put("data", jsonArray);
            return json;
        } else if (interval == 2) {
            JSONArray jsonArray = weekTotalStatistics(startDate, endDate, area, level, index);
            json.put("data",jsonArray);
            json.put("data", jsonArray);
            return json;
        } else if(interval == 3){
        } else if (interval == 3) {
            JSONArray jsonArray = monthTotalStatistics(startDate, endDate, area, level, index);
            json.put("data",jsonArray);
            json.put("data", jsonArray);
            return json;
        }
@ -1871,7 +1895,7 @@ public class StatisticsService extends BaseService {
     * @param index
     * @return
     */
    public JSONArray dateTotalStatistics(String startDate, String endDate,  String area, int level, String index) {
    public JSONArray dateTotalStatistics(String startDate, String endDate, String area, int level, String index) {
        String areaField = "";
        String sql = "";
@ -2106,9 +2130,9 @@ public class StatisticsService extends BaseService {
                String range = map.get("range").toString();
                JSONObject json = countResult.get(range);
                if(json != null) {
                if (json != null) {
                    long amount = map.get("amount") == null ? 0L : Long.valueOf(map.get("amount").toString());
                    json.put("amount",amount);
                    json.put("amount", amount);
                }
            }
@ -2261,9 +2285,9 @@ public class StatisticsService extends BaseService {
                String range = map.get("range").toString();
                JSONObject json = countResult.get(range);
                if(json != null) {
                if (json != null) {
                    long amount = map.get("amount") == null ? 0L : Long.valueOf(map.get("amount").toString());
                    json.put("amount",amount);
                    json.put("amount", amount);
                }
            }
@ -2289,4 +2313,5 @@ public class StatisticsService extends BaseService {
        }
    }
}