Explorar o código

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

yeshijie %!s(int64=7) %!d(string=hai) anos
pai
achega
ce74b0bf1d

+ 31 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DispensaryTypeConvert.java

@ -0,0 +1,31 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.List;
/**
 * 长处方疾病
 * Created by zhangdan on 2017/10/26.
 */
public class DispensaryTypeConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                //获取到prescriptionCode,求长处方配送方式
                String sql ="SELECT dispensary_type FROM wlyy_prescription WHERE code=?";
                Object[] args = {value};
                String type=jdbcTemplate.queryForObject(sql,args,String.class);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, type);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        return oneList;
    }
}

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

@ -30,6 +30,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -2651,18 +2652,48 @@ public class StatisticsESService {
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
        String index ="58";
        Map<String,Object> rs = new HashedMap();
        List<SaveModel> totalList = null;
        List<SaveModel> processingList = null;
        List<SaveModel> finishedList = null;
        List<SaveModel> canceledList = null;
        List<SaveModel> unPassList = null;
        List<SaveModel> otherList = null;
        //总数
        List<SaveModel> totalList =  elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        if(StringUtils.isNotBlank(disease)){
            totalList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }else{
            totalList = elasticsearchUtil.findListDateQuotaLevel0(null,area,level,index,"2",null);
        }
        //进行中
        List<SaveModel> processingList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
        if(StringUtils.isNotBlank(disease)){
            processingList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
        }else{
            processingList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }
        //已完成
        List<SaveModel> finishedList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
        if(StringUtils.isNotBlank(disease)){
            finishedList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
        }else{
            finishedList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }
        //已经取消
        List<SaveModel> canceledList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
        if(StringUtils.isNotBlank(disease)){
            canceledList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
        }else{
            canceledList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }
        //审核不通过
        List<SaveModel> unPassList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
        if(StringUtils.isNotBlank(disease)){
            unPassList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
        }else{
            unPassList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }
        //其他原因取消
        List<SaveModel> otherList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
        if(StringUtils.isNotBlank(disease)){
            otherList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
        }else{
            otherList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        }
        //总数
        if(totalList!=null && totalList.size()>0){
@ -2946,29 +2977,89 @@ public class StatisticsESService {
     * @param type 0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
     * @return
     */
    public List<SaveModel> getPrescriptionTotalLowLevel(int level,String lowlevel,String area,String disease,String type)throws Exception{
    public List<Map<String,Object>> getPrescriptionTotalLowLevel(int level,String lowlevel,String area,String disease,String type)throws Exception{
        String quotaDate = elasticsearchUtil.getQuotaTime();
        String index = "58";
        List<SaveModel> saveModels = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        //一级维度
        if (StringUtils.isNotBlank(disease)){
            //类型 0.总量,1.已完成,2.居民取消,3.审核不通过,4.进行中,5.其他原因取消
            if("1".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel0("",area,level,index,"2",lowlevel);
                saveModels = elasticsearchUtil.findListDateQuotaLevel0(quotaDate,area,level,index,"2",lowlevel);
            }else {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1("",area,level,index,"2",lowlevel,type);
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,type);
            }
        }else{
            //类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
            if("1".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel1("",area,level,index,"2",lowlevel,disease);
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,disease);
            }else {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2("",area,level,index,"2",lowlevel,disease,type);
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate,area,level,index,"2",lowlevel,disease,type);
            }
        }
        if ("5".equals(lowlevel)){
            translateTeamLeaderName2(saveModels);
        }
        return saveModels;
        Map<String, Object> map = null;
        if(saveModels.size()>0){
            for(SaveModel one:saveModels){
                map = new HashMap<>();
                if(Integer.parseInt(lowlevel)>=level){
                    lowlevel = String.valueOf(level+1);
                }
                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",one.getResult2().longValue());
            }
        }else{
            //统计数据为空时,自建结果集
//            List<Map<String, Object>> resultList = new ArrayList<>();
//            resultList = getLowLevelMapKey(level, lowlevel, area);
            List<Town> townList = null;
            List<Hospital> hospitalList = null;
            List<AdminTeam> adminTeams = null;
            if(SaveModel.cityLevel.equals(level)){
                townList = townDao.findByCityCode(area);
                hospitalList = hospitalDao.findByCity(area);
                adminTeams = findAllTeam();
            }else if(SaveModel.townLevel.equals(level)){
                hospitalList = hospitalDao.findByTownCode(area);
                adminTeams = adminTeamDao.findByTownCode(area);
            }else if(SaveModel.OrgLevel.equals(level)){
                adminTeams = adminTeamDao.findByOrgCode(area);
            }
            if(SaveModel.townLevel.equals(lowlevel)){
                for(Town one : townList){
                    map.put("code",one.getCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }else if(SaveModel.OrgLevel.equals(lowlevel)){
                for(Hospital one : hospitalList){
                    map.put("code",one.getCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }else if(SaveModel.teamLevel.equals(lowlevel)){
                for(AdminTeam one : adminTeams){
                    map.put("code",one.getLeaderCode());
                    map.put("name",one.getName());
                    map.put("val",0);
                }
            }
        }
        rs.add(map);
        return rs;
    }
    public List<SaveModel> translateTeamLeaderName2(List<SaveModel> rs) {
@ -3027,4 +3118,49 @@ public class StatisticsESService {
        return map;
    }
    public Map<String,Object> getPrescriptionDispatchingTotal(int level,String area,String disease)throws Exception{
        List<SaveModel> seltList = null;//自取集合
        List<SaveModel> deliveryList = null;//物流配送集合
        List<SaveModel> healthDoctorList = null;//健管师配送集合
        if(StringUtils.isNotBlank(disease)){
            //自取
            seltList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","1",disease);
            //物流配送
            deliveryList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","2",disease);
            //健管师配送
            healthDoctorList = elasticsearchUtil.findListDateQuotaLevel2("",area,level,"62","2","","2",disease);
        }else{
            //自取
            seltList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","1");
            //物流配送
            deliveryList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","2");
            //健管师配送
            healthDoctorList = elasticsearchUtil.findListDateQuotaLevel1("",area,level,"62","2","","2");
        }
        Map<String,Object> rs = new HashedMap();
        //自取数目
        if(seltList!=null && seltList.size()>0){
            rs.put("seltTotal",seltList.get(0).getResult2());
        }else{
            rs.put("seltTotal",0);
        }
        //快递配送
        if(deliveryList!=null && deliveryList.size()>0){
            rs.put("deliveryTotal",deliveryList.get(0).getResult2());
        }else{
            rs.put("deliveryTotal",0);
        }
        //健管师配送
        if(healthDoctorList!=null && healthDoctorList.size()>0){
            rs.put("doctorTotal",healthDoctorList.get(0).getResult2());
        }else{
            rs.put("doctorTotal",0);
        }
        return rs;
    }
}

+ 28 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -1601,19 +1601,6 @@ 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, "查询失败");
        }
    }
    /**
     *年龄统计-下部列表(疾病维度)
@ -1677,6 +1664,20 @@ 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, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionTotalHistogram")
    @ResponseBody
    @ApiOperation("订单统计-中部树状图获取")
@ -1708,6 +1709,20 @@ public class EsStatisticsController extends BaseController {
        }
    }
    @RequestMapping("/getPrescriptionDispatchingTotal")
    @ResponseBody
    @ApiOperation("配送统计-头部总数接口")
    public String getPrescriptionDispatchingTotal(@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.getPrescriptionDispatchingTotal(elasticsearchUtil.changeLevel(Integer.valueOf(level)),area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionDispatchingLowLevel")
    @ResponseBody
    @ApiOperation("配送统计-下部条形图")