Browse Source

代码修改

LAPTOP-KB9HII50\70708 10 tháng trước cách đây
mục cha
commit
af027e01ef

+ 60 - 54
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -7852,6 +7852,16 @@ public class StatisticsEsService {
     * 本月新增 +10
     */
    public HashMap<String, Object> getConsultationCount(ScreenQvo qvo) throws Exception {
        if(StringUtils.isBlank(qvo.getEndDate())){
            qvo.setEndDate(DateUtil.getStringDateShort());
        }
        String filter = "";
        if(StringUtils.isNotBlank(qvo.getStartDate())){
            filter += " AND i.`create_time`>='" + qvo.getStartDate() + "' ";
        }
        if(StringUtils.isNotBlank(qvo.getEndDate())){
            filter += " AND i.`create_time`<='" + qvo.getEndDate() + " 23:59:59' ";
        }
        HashMap<String, Object> map = new HashMap<>();
        //获取第一天、最后一天
        String[] dateList = getFirstAndEndDay(qvo.getEndDate());
@ -7860,39 +7870,26 @@ public class StatisticsEsService {
        //查询本月量
        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' ";
        String patientCountSql = "SELECT count(DISTINCT i.patient) 'count' FROM  wlyy_outpatient i  WHERE i.`pay_status` in (1,2) " +filter;
        //全部问诊量
        String indexSql = "SELECT count(ct.id) FROM wlyy_consult_outpatient_info ct WHERE " +
                " ct.type IN (1, 9, 12, 15, 16,17) AND ct.create_time <'"+qvo.getEndDate()+" 23:59:59' AND ct.create_time >='"+qvo.getStartDate()+"' ";
        CompletableFuture<Void> future01 = CompletableFuture.runAsync(() -> {
            try {
                //全部问诊量
                Integer allConsultCount = jdbcTemplate.queryForObject(indexSql, Integer.class);
                map.put("allConsultCount", allConsultCount);
            } 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");
        String indexSql = "SELECT count(i.id) FROM wlyy_consult_outpatient_info i WHERE " +
                " i.type IN (1, 9, 12, 15, 16,17) "+filter;
        //全部问诊量
        Integer allConsultCount = jdbcTemplate.queryForObject(indexSql, Integer.class);
        map.put("allConsultCount", allConsultCount);
        //今日问诊量
        Integer todayConsultCount = jdbcTemplate.queryForObject(todaySql, Integer.class);
        map.put("todayConsultCount", todayConsultCount);
        //本月
        Integer monthConsultCount = jdbcTemplate.queryForObject(monthSql, Integer.class);
        map.put("monthConsultCount", monthConsultCount);
        //问诊人数
        Integer consultPaitentCount = jdbcTemplate.queryForObject(patientCountSql, Integer.class);
        map.put("consultPaitentCount", consultPaitentCount);
        return map;
    }
@ -7902,12 +7899,18 @@ public class StatisticsEsService {
     * 1男2女3其他
     */
    public HashMap<String, Object> getConsultGroupBySex(ScreenQvo qvo) {
        String filter = "";
        if(StringUtils.isNotBlank(qvo.getStartDate())){
            filter += " AND i.`create_time`>='" + qvo.getStartDate() + "' ";
        }
        if(StringUtils.isNotBlank(qvo.getEndDate())){
            filter += " AND i.`create_time`<='" + qvo.getEndDate() + " 23:59:59' ";
        }
        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" +
        String sql = "SELECT b.sex,count(i.id) 'count' " +
                "   FROM  wlyy_consult_outpatient_info i,wlyy_outpatient a,base_patient b " +
                "   WHERE i.id=a.id and a.patient=b.id " +
                "    AND i.type in (1, 9, 12, 15, 16,17) " + filter +
                " GROUP BY b.sex";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        int otherCount = 0;
@ -7950,22 +7953,26 @@ public class StatisticsEsService {
    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 ";
        String filter = "";
        if(StringUtils.isNotBlank(qvo.getStartDate())){
            filter += " AND i.`create_time`>='" + qvo.getStartDate() + "' ";
        }
        if(StringUtils.isNotBlank(qvo.getEndDate())){
            filter += " AND i.`create_time`<='" + qvo.getEndDate() + " 23:59:59' ";
        }
        String sql = "SELECT " +
                " q.*, " +
                " ( " +
                " SELECT " +
                "  count(1) " +
                " FROM " +
                "  base_patient a,wlyy_outpatient b,wlyy_consult_outpatient_info i " +
                "  WHERE a.id = b.patient and i.id=b.id  AND i.type in (1, 9, 12, 15, 16,17) AND ( (a.birthday IS NULL and q.start_age is null) " +
                "  or (a.birthday IS NOT NULL and TIMESTAMPDIFF(YEAR, a.birthday, b.create_time) >=q.start_age " +
                "  AND TIMESTAMPDIFF(YEAR, a.birthday, b.create_time) <=q.end_age)) " + filter +
                " )'count' " +
                "FROM " +
                " age_table q ORDER BY q.sort ";
        System.out.println("患者年龄分布=>"+sql);
        HashMap<String, Object> resultMap = new HashMap<>();
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
@ -8311,8 +8318,7 @@ public class StatisticsEsService {
                "GROUP BY\n" +
                "	icd10,icd10_name \n" +
                "ORDER BY\n" +
                "	count(1) DESC\n" +
                "LIMIT 5";
                "	count(1) DESC ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }

+ 1 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4301,7 +4301,7 @@ public class ImService {
                }
            } else {
                sql += " and op.create_time <= '" + end_time + "'";
                sql += " and op.create_time <= '" + end_time + " 23:59:59'";
            }
        }