Browse Source

修改基卫查询状态接口和修改统计

zd_123 7 years ago
parent
commit
84e6d44ed5

+ 3 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -55,6 +55,9 @@ public class PrescriptionLog extends IdEntity {
    //状态枚举
    public enum PrescriptionLogStatus {
        pay_cancle("线下取消",-5),
        pay_refund("线下退费",-4),
        //续方取消
        pay_outtime("支付超时", -3),

+ 15 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -468,7 +468,7 @@ public class PrescriptionInfoService extends BaseService {
        return r;
    }
    public com.alibaba.fastjson.JSONObject getPrescriptionProcess(String code) {
    public com.alibaba.fastjson.JSONObject getPrescriptionProcess(String code) throws Exception{
        Prescription prescription = prescriptionDao.findByCode(code);
        List<PrescriptionInfo> prescriptionInfos = prescriptionInfoDao.findByPrescriptionCode(code);
        PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
@ -512,6 +512,20 @@ public class PrescriptionInfoService extends BaseService {
        } else {
            //rs.put("time","");
        }
        if(prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()){
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            object = prescriptionService.checkRecipeNoPay(2,code);
            String status = object.getString("status");
            if("200".equals(status)){
                //-1操作失败 0新开 1待执行 5已执行 9作废 404没有找到对应的数据
                rs.put("zyStatus",object.getString("code"));
            }else{
                rs.put("zyStatus",status);
            }
            rs.put("zyMsg",object.getString("message"));
        }
        if (prescriptionAdjusts != null && prescriptionAdjusts.size() > 0) {
            rs.put("isAdjust", true);
        } else {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -429,7 +429,7 @@ public class PrescriptionService extends BaseService {
                    if("9".equals(code)){
                        prescriptionDao.updateStatus(prescriptionCode,-5);
                        statusObj.put("status",200);
                        statusObj.put("code",200);
                        statusObj.put("code",9);
                        statusObj.put("message","基卫处方为作废,已修改本地数据库该处方为线下取消");
                    }else{
                        statusObj.put("status",200);
@ -441,7 +441,7 @@ public class PrescriptionService extends BaseService {
                statusObj.put("status",404);
                statusObj.put("message","没有找到相应的结果");
            }else{
                statusObj.put("status",0);
                statusObj.put("status",-1);
                statusObj.put("message","操作失败!");
            }
        }

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

@ -2918,7 +2918,6 @@ public class StatisticsAllService extends BaseService {
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            //查询去年的签约转map

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

@ -2197,8 +2197,123 @@ public class StatisticsESService {
            String preDate = new SimpleDateFormat("yyyy-MM-dd").format(today.getTime());
//            data = getTodayBeforeLowLevelTotalSingle(preDate, area, level, index);
        }
        return data;
    }
    /**
     * 去年的签约量,续签量和续签率 列表
     * @param area
     * @param level 等级 1(5):团队 2(4)社区机构 3()3区级 4(2)市级
     * @param index
     * @param sort
     * @param lowLevel
     * @param year
     * @param lowCode
     * @return
     * @throws Exception
     */
    public JSONArray getLevelTwoLowLevelTotalSignAndRenew(String area, int level, String index, int sort, String lowLevel, String year, String lowCode) throws Exception {
        String lastDate = year + "-06-30";
        //String timeKey = elasticsearchUtil.getQuotaTime();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();//续签量
        Map<String, Integer> renewMap = new HashMap<>(); //续签的的列表转map
        List<SaveModel> renewSaveModels = new ArrayList<SaveModel>();
        List<SaveModel> signSaveModels = new ArrayList<SaveModel>();
        if (StringUtils.isEmpty(lowCode)) {
            //续签量
            renewSaveModels = elasticsearchUtil.findListDateQuotaLevel0(lastDate, area, level, index, "2", lowLevel);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findListDateQuotaLevel1(lastDate, area, level, index, "2", lowLevel, lowCode);
            if (renewSaveModels != null && renewSaveModels.size() > 0) {
                for (SaveModel saveModel : renewSaveModels) {
                    if ("3".equals(low_level)) {
                        renewMap.put(saveModel.getTown(), saveModel.getResult2());
                    } else if ("4".equals(low_level)) {
                        renewMap.put(saveModel.getHospital(), saveModel.getResult2());
                    } else if ("5".equals(low_level)) {
                        renewMap.put(saveModel.getTeam(), saveModel.getResult2());
                    } else {
                        continue;
                    }
                }
            }
        }
        return data;
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
//        if (resultList != null) {
//            DecimalFormat df = new DecimalFormat("0.0000");
//            //查询去年的签约转map
//            if (StringUtils.isBlank(lowCode)) {
//                yearsYear = findQuotaResultList(lastDate, Integer.valueOf(low_level), "1");
//            } else {
//                if ("3".equals(lowCode)) {
//                    //老年人
//                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "3");
//                } else if ("4".equals(lowCode)) {
//                    //高血压
//                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "1");
//                } else if ("5".equals(lowCode)) {
//                    //糖尿病
//                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate, Integer.valueOf(low_level), "17", "2");
//                } else {
//                }
//            }
//
//            Map<String, WlyyQuotaResult> resultMap = new HashMap<>();
//            yearsYear.stream().forEach(one -> {
//                if ("1".equals(low_level)) {
//                    resultMap.put(one.getQkdoctorCode(), one);
//                } else if ("2".equals(low_level)) {
//                    resultMap.put(one.getOrgCode(), one);
//                } else if ("3".equals(low_level)) {
//                    resultMap.put(one.getTown(), one);
//                }
//            });
//
//            for (Map<String, Object> map : resultList) {
//                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
//                //获取去年签约的人数 默认是上个年度的最后一天
//                WlyyQuotaResult one = resultMap.get(map.get("code").toString());
//                int signNum = 0;
//                int renewNum = renewMap.get(map.get("code").toString());
//                if (one != null) {
//                    signNum = Integer.valueOf(one.getResult());
//                }
//                map.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
//                map.put("signNum", signNum);
//                map.put("renewNum", renewNum);
//
//            }
//
//            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
//                translateTeamLeaderName(resultList);
//            }
//            //对结果进行排序
//            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
//                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
//                    int map1value = (int) o1.get("renewNum");
//                    int map2value = (int) o2.get("renewNum");
//
//                    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();
//        }
        return null;
    }
}

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

@ -416,7 +416,7 @@ public class EsStatisticsController extends BaseController {
                                       @RequestParam(required = false) String year) {
        try {
            level=changeLevel(level);
            level=elasticsearchUtil.changeLevel(level);
            JSONArray result = statisticsESService.getSixFiveStatistics(endDate, area, level);
            return write(200, "查询成功", "data", result);
@ -496,7 +496,7 @@ public class EsStatisticsController extends BaseController {
        try {
            String[] indexes = index.split(",");
            level=elasticsearchUtil.changeLevel(level);
            lowLevel=changeLevel(Integer.valueOf(lowLevel))+"";
            lowLevel=elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))+"";
            JSONObject result = new JSONObject();
            String year = Constant.getNowYearByDate(date);
            if (StringUtils.isNotEmpty(lowCode)) {
@ -1513,16 +1513,16 @@ public class EsStatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            //如果年度是空,按当前时间计算是年度是属于那个年度
            if (org.springframework.util.StringUtils.isEmpty(year)) {
            if (StringUtils.isEmpty(year)) {
                year = Constant.getNowYear();
            }
            //lowLevel不传默认是 level-1
            if (org.springframework.util.StringUtils.isEmpty(lowLevel)) {
            if (StringUtils.isEmpty(lowLevel)) {
                lowLevel = level - 1 + "";
            }
            result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, changeLevel(level), index, sort, String.valueOf(changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
            result.put("index_" + index, statisticsESService.getLevelTwoLowLevelTotalSignAndRenew(area, elasticsearchUtil.changeLevel(level), index, sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
            //result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, elasticsearchUtil.changeLevel(level), index, sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year, lowCode));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {