浏览代码

Merge branch 'dev' of liuwenbin/patient-co-management into dev

yeshijie 7 年之前
父节点
当前提交
fbf6e3eefd

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

@ -3034,7 +3034,7 @@ public class StatisticsESService {
                adminTeams = findAllTeam();
            }else if(SaveModel.townLevel.equals(level)){
                hospitalList = hospitalDao.findByTownCode(area);
                adminTeams = adminTeamDao.findByTownCode(area);
                adminTeams = findAllTeam();
            }else if(SaveModel.OrgLevel.equals(level)){
                adminTeams = adminTeamDao.findByOrgCode(area);
            }
@ -3163,4 +3163,79 @@ public class StatisticsESService {
        }
        return rs;
    }
    /**
     * 获取下部部费用平均值或总数
     * @param level
     * @param lowlevel
     * @param area
     * @param disease
     * @param type 1.总量,2.平均值
     * @return
     */
    public List<Map<String,Object>> getPrescriptionCostLowLevel(String level,String lowlevel,String area,String disease,String type) throws Exception{
        DecimalFormat decimalFormat=new DecimalFormat("0.00");
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //1.总量
        List<SaveModel> list = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,Integer.parseInt(level),"61","2",lowlevel,disease);
        Map<String,Object> map = null;
        List<Map<String,Object>> countList = new ArrayList<>();
        if("1".equals(type)){
            for(SaveModel one:list){
                map = new HashMap<>();
                if(SaveModel.townLevel.equals(lowlevel)){
                    map.put("code",one.getTown());
                    map.put("name",one.getTownName());
                }else if(SaveModel.OrgLevel.equals(lowlevel)){
                    map.put("code",one.getHospital());
                    map.put("name",one.getHospitalName());
                }else if(SaveModel.teamLevel.equals(lowlevel)){
                    map.put("code",one.getTeam());
                    map.put("name",one.getTeamName());
                }
                map.put("val",decimalFormat.format(one.getResult1()/100));
                countList.add(map);
            }
        }else{
            //2.平均值
            //去重获取总人数,计算人均费用
            String sql = "  select count(DISTINCT(s.patient)) as num from wlyy_prescription_pay p left join wlyy_prescription s on p.prescription_code = s. CODE  ";
            for(SaveModel one:list){
                sql +=" and  p.trace_time <= "+one.getQuotaDate();
                Map<String, Object> count = jdbcTemplate.queryForMap(sql);
                map = new HashMap<>();
                if(SaveModel.townLevel.equals(lowlevel)){
                    map.put("code",one.getTown());
                    map.put("name",one.getTownName());
                }else if(SaveModel.OrgLevel.equals(lowlevel)){
                    map.put("code",one.getHospital());
                    map.put("name",one.getHospitalName());
                }else if(SaveModel.teamLevel.equals(lowlevel)){
                    map.put("code",one.getTeam());
                    map.put("name",one.getTeamName());
                }
                Long num = (Long)count.get("num");
                String avg = decimalFormat.format(one.getResult1()/num);
                map.put("val",avg);
                countList.add(map);
            }
        }
        return countList;
    }
    /**
     * 获取中部费用平均值
     * @param level
     * @param area
     * @param disease
     * @param startDate
     * @param endDate
     * @param type 1.按日,2.按周,3.按月
     */
    public List<Map<String,Object>> getPrescriptionCostAvgLine(String level,String area,String disease,String startDate,String endDate,String type){
        return null;
    }
}

+ 50 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -1601,6 +1601,19 @@ public class EsStatisticsController extends BaseController {
    //=================================长处方分析===============================================
    @RequestMapping("/getPrescriptionCount")
    @ResponseBody
    @ApiOperation("订单统计-顶部总数获取")
    public String getPrescriptionCount(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                       @ApiParam(name="area", value="级别对应编码") @RequestParam(required = true)String area,
                                       @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease){
        try{
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionCount(elasticsearchUtil.changeLevel(Integer.valueOf(level)),area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     *年龄统计-下部列表(疾病维度)
@ -1657,6 +1670,7 @@ public class EsStatisticsController extends BaseController {
                                           @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                           @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionAgeTotal(level,area,disease));
        } catch (Exception e) {
            error(e);
@ -1709,6 +1723,42 @@ public class EsStatisticsController extends BaseController {
        }
    }
    @RequestMapping("/getPrescriptionCostLowLevel")
    @ResponseBody
    @ApiOperation("费用统计-下部列表接口")
    public String getPrescriptionCostLowLevel(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                              @ApiParam(name="lowlevel", value="第二级别") @RequestParam(required = true)String lowlevel,
                                              @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                              @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease,
                                              @ApiParam(name="type", value="1.总量,2.平均值")@RequestParam(required =true)String type){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            lowlevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowlevel))+"";
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionCostLowLevel(level,lowlevel,area,disease,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionCostAvgLine")
    @ResponseBody
    @ApiOperation("费用统计-中部折线图接口")
    public String getPrescriptionCostAvgLine(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                             @ApiParam(name="area", value="级别编码") @RequestParam(required = true)String area,
                                             @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease,
                                             @ApiParam(name="startDate", value="开始时间") @RequestParam(required = false)String startDate,
                                             @ApiParam(name="endDate", value="结束时间") @RequestParam(required = false)String endDate,
                                             @ApiParam(name="type", value="1.按日,2.按周,3.按月") @RequestParam(required = false)String type){
        try{
            return write(200, "查询成功", "data", statisticsService.getPrescriptionCostAvgLine(level,area,disease,startDate,endDate,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionDispatchingTotal")
    @ResponseBody
    @ApiOperation("配送统计-头部总数接口")