Jelajahi Sumber

设备统计列表修改

liuwenbin 7 tahun lalu
induk
melakukan
0d2dec292e

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

@ -5616,6 +5616,8 @@ public class StatisticsESService {
            }
            if (hospitals != null && hospitals.size() > 0) {
                int amount = 0;
                int allNum = 0;
                for (Hospital hos : hospitals) {
                    if (hos.getCode().length() > 10) {
                        continue;
@ -5623,7 +5625,7 @@ public class StatisticsESService {
//                    String sql = " select count(DISTINCT p.doctor,p.device_sn) AS amount,p.doctor as doctorCode,r.name as doctorName from wlyy.wlyy_patient_device p JOIN wlyy.wlyy_doctor r on p.doctor is not null and  p.doctor =r.code  LEFT JOIN device.wlyy_devices d on p.device_sn=d.device_code where p.del=0 and p.doctor is not null and d.grant_org_code ='" + hos.getCode() + "'  group by p.doctor,r.name";
                    String sql = " select count(*) as amount,if(a.doctor is null,'other',a.doctor) as doctorCode,if(a.NAME is null,'其他',a.NAME) as doctorName " +
                            " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                            "where p.del=0 and d.is_binding in (1,2) and d.grant_org_code ='" + hos.getCode() + "') a " +
                            "where p.del=0 and d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "') a " +
                            " GROUP BY a.doctor,a.name";
                    List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                    for (Map<String, Object> one : list) {
@ -5632,9 +5634,23 @@ public class StatisticsESService {
                        obj.put("name", one.get("doctorName"));
                        obj.put("amount", one.get("amount"));
                        obj = deviceRateList(obj,hos);
                        if("other".equals(one.get("doctorCode")+"")){
                            amount += Integer.valueOf(obj.get("amount")+"");
                            allNum += Integer.valueOf(obj.get("allNum")+"");
                            continue;
                        }
                        resultList.add(obj);
                    }
                }
                Map<String, Object> otherObj = new HashMap<>();
                otherObj.put("code", "other");
                otherObj.put("name", "其他");
                otherObj.put("amount", amount);
                otherObj.put("allNum", allNum);
                otherObj.put("bindingNum", amount);
                otherObj.put("rate", getRange(amount, allNum, 2));//续签率是 续签量/去年的签约数
                otherObj.put("rateNum", getRangeNum(amount, allNum, 2));//续签率是 续签量/去年的签约数
                resultList.add(otherObj);
            }
//        }
        return resultList;
@ -5754,7 +5770,7 @@ public class StatisticsESService {
        String temp = "other".equals(reMap.get("code"))? " and p.doctor is null ":" and p.doctor='"+reMap.get("code")+"' ";
        String sql = " select count(1) as amount " +
                " from (select  DISTINCT p.doctor,r.name,p.device_sn FROM wlyy.wlyy_patient_device p left join device.wlyy_devices d on p.device_sn=d.device_code left JOIN wlyy.wlyy_doctor r ON  p.doctor = r. CODE " +
                " where d.is_binding in (1,2) and  d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
                " where d.is_binding in (1,2) and p.category_code in('1','2') and d.grant_org_code ='" + hos.getCode() + "' "+temp+") a " +
                " GROUP BY a.doctor,a.name";
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql);
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
@ -6159,14 +6175,6 @@ public class StatisticsESService {
//    }
    /**
     * 查询签约
     *
     * @param type      0 按周,1 按月
     * @param startDate
     * @param endDate
     * @return
     */
    /*public JSONArray getDeviceLine(String doctor, String type, String startDate, String endDate) throws Exception {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);