瀏覽代碼

Merge branch '2.0' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into 2.0

LAPTOP-KB9HII50\70708 1 年之前
父節點
當前提交
56e201f4cd

+ 322 - 14
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -46,7 +46,9 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.util.*;
import java.util.stream.Collectors;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
 * Created by wangzhinan on 2019/12/3.
@ -6172,9 +6174,9 @@ public class StatisticsEsService {
        //开方 【处方量】
        int kf_total = countListTotal(cf_model01);
        int kf_period = countListTotal(cf_model02);
        ;//上个周期
        //上个周期
        int kf_periodYear = countListTotal(cf_model03);
        ;//去年同周期
        //去年同周期
        result.put("kf_total", kf_total);//开方量
        result.put("kf_kfl", getRange(kf_total, patientVolume, 0));//【处方率】= 处方量 ÷ 接诊量 ×100%
        result.put("kf_hb", getRange((kf_total - kf_period), kf_period, 0));//环比
@ -6980,10 +6982,10 @@ public class StatisticsEsService {
        JSONObject result = new JSONObject();
        String sql = " SELECT dict_code \"functionCode\",dict_value \"functionName\",img_url \"img\" FROM wlyy_hospital_sys_dict WHERE dict_name='FUNCTION_SETTING' ORDER BY sort  ";
        List<Map<String, Object>> functionList = jdbcTemplate.queryForList(sql);
         List<String[]> list = new ArrayList<>();
        List<String[]> list = new ArrayList<>();
        for (Map<String, Object> map : functionList) {
              String[] strings = {String.valueOf(map.get("functionCode")), String.valueOf(map.get("functionName")), String.valueOf(map.get("img"))};
              list.add(strings);
            String[] strings = {String.valueOf(map.get("functionCode")), String.valueOf(map.get("functionName")), String.valueOf(map.get("img"))};
            list.add(strings);
        }
        result.put("list", list);
        return result;
@ -6994,12 +6996,12 @@ public class StatisticsEsService {
        String functionSql = " SELECT dict_code \"functionCode\",dict_value \"functionName\",py_code \"img\" FROM wlyy_hospital_sys_dict WHERE dict_name='FUNCTION_SETTING' ORDER BY sort  ";
        List<Map<String, Object>> functionList = jdbcTemplate.queryForList(functionSql);
        //医生信息
        String sql = " SELECT function_setting \"functionCode\" FROM base.base_doctor WHERE id='"+doctorCode+"'";
        String sql = " SELECT function_setting \"functionCode\" FROM base.base_doctor WHERE id='" + doctorCode + "'";
        List<Map<String, Object>> doctorList = jdbcTemplate.queryForList(sql);
        if (doctorList.isEmpty()){
        if (doctorList.isEmpty()) {
            return null;
        }else {
            String functionCodeList =(String) doctorList.get(0).get("functionCode");
        } else {
            String functionCodeList = (String) doctorList.get(0).get("functionCode");
//            List<String> list = Arrays.asList(functionCodeList.split(","));
//            List<Map<String, Object>> collect = functionList.stream()
//                    .filter(map -> map.keySet().containsAll(list))
@ -7007,21 +7009,21 @@ public class StatisticsEsService {
            List<String[]> list = new ArrayList<>();
            for (String code : functionCodeList.split(",")) {
                for (Map<String, Object> map : functionList) {
                    if (code.equals(map.get("functionCode"))){
                    if (code.equals(map.get("functionCode"))) {
                        String[] strings = {String.valueOf(map.get("functionCode")), String.valueOf(map.get("functionName")), String.valueOf(map.get("img"))};
                        list.add(strings);
                    }
                }
            }
            JSONObject result = new JSONObject();
            result.put("list",list);
            result.put("list", list);
            return result;
        }
    }
    public int updateDoctorSetting(String doctorCode,String functionCodeList) {
        String sql=" UPDATE base.base_doctor SET function_setting='"+functionCodeList+"'  WHERE id='"+doctorCode+"'" ;
    public int updateDoctorSetting(String doctorCode, String functionCodeList) {
        String sql = " UPDATE base.base_doctor SET function_setting='" + functionCodeList + "'  WHERE id='" + doctorCode + "'";
        int update = jdbcTemplate.update(sql);
        return update;
@ -7043,4 +7045,310 @@ public class StatisticsEsService {
    }
    public static ExecutorService execute = Executors.newFixedThreadPool(20);
    /**
     * 总人数:200人
     * <p>
     * 总次数:500次
     * 今日新增 +10
     * 本月新增 +10
     */
    public HashMap<String, Object> getConsultationCount(ScreenQvo qvo) throws Exception {
        HashMap<String, Object> map = new HashMap<>();
        //获取第一天、最后一天
        String[] dateList = getFirstAndEndDay(qvo.getEndDate());
        //今日新增量
        String todaySql = "SELECT count(*) as count from wlyy_consult_outpatient_info o where 1=1 AND o.create_time >='" + qvo.getEndDate() + "' and o.create_time <='" + qvo.getEndDate() + " 23:59:59' ";
        //查询本月量
        String monthSql = "SELECT count(*) as count from wlyy_consult_outpatient_info o where 1=1 AND o.create_time >='" + dateList[0] + "' and o.create_time <='" + dateList[1] + " 23:59:59' ";
        //查询人数
        String patientCountSql = "SELECT count(DISTINCT p.patient) 'count' FROM  wlyy_outpatient p  WHERE `p`.`pay_status` in (1,2) AND p.`create_time`>='" + qvo.getStartDate() + "' AND p.`create_time`<='" + qvo.getEndDate() + " 23:59:59' ";
        CompletableFuture<Void> future01 = CompletableFuture.runAsync(() -> {
            try {
                //全部问诊量
                SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), qvo.getIndex(), SaveModel.timeLevel_DDL);
                if (saveModel != null) {
                    map.put("allConsultCount", saveModel.getResult2().longValue());
                } else {
                    map.put("allConsultCount", 0);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, execute);
        CompletableFuture<Void> future02 = CompletableFuture.runAsync(() -> {
            //今日问诊量
            Integer count = jdbcTemplate.queryForObject(todaySql, Integer.class);
            map.put("todayConsultCount", count);
        }, execute);
        CompletableFuture<Void> future03 = CompletableFuture.runAsync(() -> {
            //本月
            Integer count = jdbcTemplate.queryForObject(monthSql, Integer.class);
            map.put("monthConsultCount", count);
        }, execute);
        CompletableFuture<Void> future04 = CompletableFuture.runAsync(() -> {
            //问诊人数
            Integer count = jdbcTemplate.queryForObject(patientCountSql, Integer.class);
            map.put("consultPaitentCount", count);
        }, execute);
        System.out.println("111");
        CompletableFuture<Void> allOf = CompletableFuture.allOf(future01, future02, future03, future04);
        allOf.get();
        System.out.println("222");
        return map;
    }
    /**
     * 获取男女就诊次数
     * 1男2女3其他
     */
    public HashMap<String, Object> getConsultGroupBySex(ScreenQvo qvo) {
        HashMap<String, Object> resultMap = new HashMap<>();
        String sql = "SELECT b.sex,count(a.id) 'count' \n" +
                " FROM  wlyy_outpatient a INNER JOIN base_patient b ON a.patient=b.id \n" +
                " WHERE 1=1 " +
                "  AND a.`pay_status` in (1,2) " +
                "  AND a.`create_time`>='" + qvo.getStartDate() + "' AND a.`create_time`<='" + qvo.getEndDate() + "' \n" +
                " GROUP BY b.sex";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        int otherCount = 0;
        for (Map<String, Object> map : list) {
            if (!Objects.isNull(map.get("sex")) && "1".equals(map.get("sex").toString())) {
                resultMap.put("1", map.get("count"));
            } else if (!Objects.isNull(map.get("sex")) && "2".equals(map.get("sex").toString())) {
                resultMap.put("2", map.get("count"));
            } else {
                otherCount += Integer.parseInt(map.get("count").toString());
            }
        }
        resultMap.put("3", otherCount);
        return resultMap;
    }
    /**
     * 获取第一天和最后一天
     */
    public String[] getFirstAndEndDay(String dateStr) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = sdf.parse(dateStr);
        // 获取 Calendar 实例并设置到指定的 Date
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        // 设置 Calendar 到月初
        cal.set(Calendar.DAY_OF_MONTH, 1);
        String startOfMonth = sdf.format(cal.getTime());
        System.out.println("本月第一天: " + startOfMonth);
        // 获取本月最大天数并设置到 Calendar
        int maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        cal.set(Calendar.DAY_OF_MONTH, maxDay);
        String endOfMonth = sdf.format(cal.getTime());
        System.out.println("本月最后一天: " + endOfMonth);
        // 返回包含本月第一天和最后一天的字符串数组
        String[] dates = {startOfMonth, endOfMonth};
        return dates;
    }
    public HashMap<String, Object> getConsultGroupByAge(ScreenQvo qvo) {
        String sql = "SELECT\n" +
                "	q.*,\n" +
                "	(\n" +
                "	SELECT\n" +
                "		count(1)\n" +
                "	FROM\n" +
                "		base_patient a\n" +
                "		INNER JOIN wlyy_outpatient b ON a.id = b.patient\n" +
                "		WHERE 1=1 AND a.birthday IS NOT NULL\n" +
                "		AND TIMESTAMPDIFF(YEAR, a.birthday, b.create_time) >=q.start_age\n" +
                "		AND TIMESTAMPDIFF(YEAR, a.birthday, b.create_time) <=q.end_age\n" +
                "		AND b.`pay_status` in (1,2)\n" +
                "		AND b.`create_time`>='" + qvo.getStartDate() + "' AND b.create_time<='" + qvo.getEndDate() + " 23:59:59'\n" +
                "	)'count'\n" +
                "FROM\n" +
                "	age_table q ORDER BY q.sort ";
        HashMap<String, Object> resultMap = new HashMap<>();
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        int allCount = 0;
        for (Map<String, Object> map : list) {
            allCount += Integer.parseInt(map.get("count").toString());
        }
        resultMap.put("ageList", list);
        resultMap.put("allCount", allCount);
        return resultMap;
    }
    /**
     * 接诊量 job=12,14,16
     * 处方量 job=2
     * 【接诊率】= 接诊量 ÷ 问诊量 ×100%
     * 服务评价
     */
    public HashMap<String, Object> getConsultDetailCount(ScreenQvo qvo) throws Exception {
        HashMap<String, Object> resultMap = new HashMap<>();
        // 服务评分
        String scoreSql = "SELECT ROUND(AVG(score),2) 'score' FROM base_evaluate_score ";
        CompletableFuture<Void> future01 = CompletableFuture.runAsync(() -> {
            //开方量
            try {
                SaveModel model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "2", SaveModel.timeLevel_DDL);
                if (model != null) {
                    resultMap.put("kfl", model.getResult2().longValue());//赋值开发量
                } else {
                    resultMap.put("kfl", 0);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, execute);
        CompletableFuture<List<SaveModel>> future02 = CompletableFuture.supplyAsync(() -> {
            //接诊量
            List<SaveModel> model = null;
            try {
                model = elasticsearchUtil.findListDateQuotaLevel2(qvo.getStartDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "12,14,16", SaveModel.timeLevel_ZL, null, "9,16,12,1,17", "1");
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future03 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //接诊量
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "5", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<Void> future04 = CompletableFuture.runAsync(() -> {
            String score = jdbcTemplate.queryForObject(scoreSql, String.class);
            resultMap.put("score", score);//赋值评分
        }, execute);
        CompletableFuture.allOf(future01, future02, future03, future04).get();
        List<SaveModel> jzModelList = future02.get();
        SaveModel model = future03.get();
        int patientVolume = countListTotal(jzModelList);
        int allConsultCount = 0;
        if (model != null) {
            allConsultCount = model.getResult2().intValue();
        }
        resultMap.put("jzCount", patientVolume);//赋值接诊量
        resultMap.put("wzAllCount", allConsultCount);//赋值问诊量
        //接诊率= 接诊量 ÷ 问诊量 ×100%
        resultMap.put("jzl", getRange(patientVolume, allConsultCount, 0));//赋值接诊率
        return resultMap;
    }
    /**
     * 【总收入】= 诊查费(21) + 处方费(3)
     * 查询诊查费、药品费、平均门诊费用 、总收入
     * 今日新增、本月新增
     */
    public HashMap<String, Object> getFreeDetailCount(ScreenQvo qvo) throws Exception {
        HashMap<String, Object> resultMap = new HashMap<>();
        String[] dateList = getFirstAndEndDay(qvo.getEndDate());
        //今天的
        String sql = "SELECT SUM(q.total)'todayFree' FROM(\n" +
                "	SELECT\n" +
                "	 IF(SUM(p.drug_fee) IS NULL,0,SUM(p.drug_fee))	 AS total \n" +
                "	FROM\n" +
                "		wlyy_prescription p\n" +
                "		INNER JOIN wlyy_outpatient o ON p.outpatient_id = o.id \n" +
                "	WHERE\n" +
                "		1 = 1 \n" +
                "		AND p.STATUS >= 30\n" +
                "		AND p.create_time  >='" + qvo.getEndDate() + "'  AND p.create_time <='" + qvo.getEndDate() + " 23:59:59' \n" +
                "	UNION ALL\n" +
                "	SELECT\n" +
                "		COALESCE(ROUND(SUM(bop.pay_price),2), 0) AS total\n" +
                "	FROM\n" +
                "		wlyy_outpatient o\n" +
                "		LEFT JOIN base_business_order_pay bop ON o.id = bop.relation_code \n" +
                "	WHERE\n" +
                "		o.pay_status = 1 \n" +
                "		AND o.`status` IN ( 1, 2, 3 )\n" +
                "		AND bop.pay_price IS NOT NULL AND bop.pay_price>0\n" +
                "		AND o.create_time  >='" + qvo.getEndDate() + "'  AND o.create_time <='" + qvo.getEndDate() + " 23:59:59' \n" +
                ") q ";
        CompletableFuture<SaveModel> future01 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //处方费
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "3", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future02 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //检查费
                model = elasticsearchUtil.findOneDateQuotaLevel0(qvo.getEndDate(), qvo.getEndDate(), qvo.getArea(), qvo.getLevel(), "21", SaveModel.timeLevel_DDL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<SaveModel> future03 = CompletableFuture.supplyAsync(() -> {
            SaveModel model = null;
            try {
                //本月新增[处方费+检查费]
                model = elasticsearchUtil.findOneDateQuotaLevel0(dateList[0], dateList[1], qvo.getArea(), qvo.getLevel(), "3,21", SaveModel.timeLevel_ZL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return model;
        }, execute);
        CompletableFuture<String> future04 = CompletableFuture.supplyAsync(() -> {
            String todayFree = jdbcTemplate.queryForObject(sql, String.class);
            return todayFree;
        }, execute);
        CompletableFuture.allOf(future01, future02, future03, future04).get();
        SaveModel model01 = future01.get();
        SaveModel model02 = future02.get();
        SaveModel monthModel = future03.get();
        String todayFree = future04.get();
        long checkFree = 0;
        long prescriptionFee = 0;
        long allCount;
        if (model01 != null) {
            prescriptionFee = model01.getResult2().longValue();
        }
        if (model02 != null) {
            checkFree = model02.getResult2().longValue();
        }
        allCount = prescriptionFee + checkFree;
        resultMap.put("checkFree", checkFree);//处方费
        resultMap.put("prescriptionFee", prescriptionFee);//检查费
        resultMap.put("allCount", allCount);//总费用
        if (allCount == 0) {
            resultMap.put("avgFree", 0);
        } else {
            resultMap.put("avgFree", allCount / 2.0);//平均费用
        }
        if (monthModel != null) {
            resultMap.put("monthFree", monthModel.getResult2().longValue());//本月新增
        } else {
            resultMap.put("monthFree", 0);
        }
        resultMap.put("todayFree", todayFree);//今日新增
        return resultMap;
    }
}

+ 1 - 1
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -848,7 +848,7 @@ public class ElasticsearchUtil {
            }
        }
        sql.append(groupBy);
        //logger.info("sql:"+sql);
        logger.info("sql:"+sql);
        return excuteEs7(sql.toString(), SaveModel.class, "", "");
    }

+ 2 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/statistics/ScreenQvo.java

@ -11,6 +11,8 @@ public class ScreenQvo {
//   interval  1日 2周 3月
//   lowLevel  下一级区域等级
   private String startDate;//开始时间
   private String endDate;//结束时间

+ 123 - 11
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -1191,7 +1192,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getTotal3Data(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getTotal3Data):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getTotal3Data]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1209,7 +1210,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getKindsConsultCount(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getKindsConsultCount):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getKindsConsultCount]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1231,7 +1232,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getConsultAndPrescriptionList(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getConsultAndPrescriptionList):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getConsultAndPrescriptionList]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1254,7 +1255,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getDrugAndExaminationFeeList(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getDrugAndExaminationFeeList):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getDrugAndExaminationFeeList]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1274,7 +1275,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getDeptOrDoctorVolumeList(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getDeptOrDoctorVolumeList):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getDeptOrDoctorVolumeList]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1296,7 +1297,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getAllHospitalDetails(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getAllHospitalDetails):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getAllHospitalDetails]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1316,7 +1317,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            statisticsEsService.getAllDeptAndDoctorDetails(qvo, os); //导出
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(exportHospitalDetails):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[exportHospitalDetails]:报错==>入参:" + JSON.toJSONString(qvo));
        }
    }
@ -1333,7 +1334,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getDeptScheduling(qvo);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getDeptScheduling):报错==>入参:" + JSON.toJSONString(qvo));
            System.out.println("接口[getDeptScheduling]:报错==>入参:" + JSON.toJSONString(qvo));
        }
        return success(result);
    }
@ -1349,7 +1350,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getAllFunctionSetting();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getAllFunctionSetting):报错");
            System.out.println("接口[getAllFunctionSetting]:报错");
        }
        return success(result);
    }
@ -1367,7 +1368,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            result = statisticsEsService.getDoctorSetting(doctorCode);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(getDoctorSetting):报错==>入参:" + JSON.toJSONString(doctorCode));
            System.out.println("接口[getDoctorSetting]:报错==>入参:" + JSON.toJSONString(doctorCode));
        }
        return success(result);
    }
@ -1390,7 +1391,7 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口(updateDoctorSetting):报错==>入参:" + doctorCode + "----" + functionCodeList);
            System.out.println("接口[updateDoctorSetting]:报错==>入参:" + doctorCode + "----" + functionCodeList);
        }
        return null;
    }
@ -1414,4 +1415,115 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            return error(-1, e.getMessage());
        }
    }
    // ==========================================
    /**
     *  timeLevel;// 1 日 2 周 3 月 4 年  1增量 2到达量
     *  areaLevel;// 1 省 2 市 3 区县 4 机构 5团队 6医生
     */
    // ==========================================
    //------------------------------大屏接口-----------------------------------------
    /**
     * 查询网络门诊概况
     * 总人数:200人
     * 总次数:500次
     * 今日新增 +10
     * 本月新增 +10
     * - strJson={"startDate":"2020-07-18","endDate":"2023-11-29","area":"350200","level":2,"index":5}
     */
    @GetMapping(value = "/getConsultationCount")
    @ApiOperation(value = "查询网络门诊概况")
    public Envelop getConsultationCount(@RequestParam(required = true) String strJson) {
        ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
        try {
            HashMap<String, Object> result = statisticsEsService.getConsultationCount(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口[getConsultationCount]:报错==>入参:" + JSON.toJSONString(qvo));
            return failed("系统繁忙");
        }
    }
    /**
     * 获取男女就诊次数
     * strJson={"startDate":"2020-07-18","endDate":"2023-11-29"}
     */
    @GetMapping(value = "/getConsultGroupBySex")
    @ApiOperation(value = " 获取男女就诊次数")
    public Envelop getConsultGroupBySex(@RequestParam(required = true) String strJson) {
        ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
        try {
            HashMap<String, Object> result = statisticsEsService.getConsultGroupBySex(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口[getConsultGroupBySex]:报错==>入参:" + JSON.toJSONString(qvo));
            return failed("系统繁忙");
        }
    }
    /**
     * 患者年龄分布
     * strJson={"startDate":"2020-07-18","endDate":"2023-11-29"}
     */
    @GetMapping(value = "/getConsultGroupByAge")
    @ApiOperation(value = " 患者年龄分布")
    public Envelop getConsultGroupByAge(@RequestParam(required = true) String strJson) {
        ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
        try {
            HashMap<String, Object> result = statisticsEsService.getConsultGroupByAge(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口[getConsultGroupByAge]:报错==>入参:" + JSON.toJSONString(qvo));
            return failed("系统繁忙");
        }
    }
    /**
     * 查询接诊量、处方量、接诊率、服务评价
     * strJson={"startDate":"2020-07-18","endDate":"2023-11-29","area":"350200","level":2}
     */
    @GetMapping(value = "/getConsultDetailCount")
    @ApiOperation(value = "查询接诊量、处方量、接诊率、服务评价")
    public Envelop getConsultDetailCount(@RequestParam(required = true) String strJson) {
        ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
        try {
            HashMap<String, Object> result = statisticsEsService.getConsultDetailCount(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口[getConsultDetailCount]:报错==>入参:" + JSON.toJSONString(qvo));
            return failed("系统繁忙");
        }
    }
    /**
     * 查询诊查费、药品费、平均门诊费用 、【总收入= 诊查费 + 处方费】
     * 今日新增、本月新增
     * strJson={"startDate":"2020-07-18","endDate":"2023-11-29","area":"350200","level":2}
     */
    @GetMapping(value = "/getFreeDetailCount")
    @ApiOperation(value = "查询接诊量、处方量、接诊率、服务评价")
    public Envelop getFreeDetailCount(@RequestParam(required = true) String strJson) {
        ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
        try {
            HashMap<String, Object> result = statisticsEsService.getFreeDetailCount(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("接口[getFreeDetailCount]:报错==>入参:" + JSON.toJSONString(qvo));
            return failed("系统繁忙");
        }
    }
}