trick9191 8 éve
szülő
commit
5a5dcedb4e

+ 86 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1894,7 +1894,82 @@ public class StatisticsService extends BaseService {
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
    }
    public JSONObject getReyStatbyTeamNow(String doctor, String startDate, String endDate, String isNow){
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
        if (admin == null) {
            throw new RuntimeException("未找到团队信息");
        }
        String imDataBaseName = SystemConf.getInstance().getImDataBaseName();
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        Long id = admin.getId();
        String totalSql = "SELECT " +
                " count(1) AS total " +
                "FROM " +
                " wlyy_consult_team a " +
                "WHERE " +
                " a.czrq <= '"+endDate+"' " +
                " AND a.czrq >= '"+startDate+"' " +
                " AND a.admin_team_code= " +id+
                " AND a.consult IN ( " +
                " SELECT DISTINCT " +
                "  t.id consultId " +
                " FROM " +
                "  "+imDataBaseName+".topics t, " +
                "  "+imDataBaseName+".participants p, " +
                "  "+imDataBaseName+".doctors d, " +
                "  "+imDataBaseName+".sessions s " +
                " WHERE " +
                "  p.participant_id = d.id " +
                " AND t.session_id = p.session_id " +
                " AND t.session_id = s.id " +
                " AND s.type = 1 " +
                " AND t.create_time <= '"+endDate+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                ")";
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSql);
        Long totalCount = 0L;
        if(totalList!=null&&totalList.size()>0){
            Map<String,Object> total = totalList.get(0);
            totalCount = (Long)total.get("total");
        }
        String noReySql = "SELECT " +
                " count(1) AS noRey " +
                "FROM " +
                " wlyy_consult_team a " +
                "WHERE " +
                " a.czrq <= '"+endDate+"' " +
                "AND a.czrq >= '"+startDate+"' " +
                "AND a.admin_team_code= " +id+
                " AND a.consult IN ( " +
                " SELECT DISTINCT " +
                "  t.id consultId " +
                " FROM " +
                "  "+imDataBaseName+".topics t, " +
                "  "+imDataBaseName+".participants p, " +
                "  "+imDataBaseName+".doctors d, " +
                "  "+imDataBaseName+".sessions s " +
                " WHERE " +
                "  p.participant_id = d.id " +
                " AND t.session_id = p.session_id " +
                " AND t.session_id = s.id " +
                " AND s.type = 1 " +
                " AND t. STATUS <> 10  " +
                " AND t.`reply` = 0  " +
                " AND t.create_time <= '"+endDate+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                ")";
        List<Map<String,Object>> noReyList = jdbcTemplate.queryForList(noReySql);
        Long noReyCount = 0L;
        if(noReyList!=null&&noReyList.size()>0){
            Map<String,Object> noRey = noReyList.get(0);
            noReyCount = (Long)noRey.get("noRey");
        }
        JSONObject rs = new JSONObject();
        rs.put("onReyCount", noReyCount);
        rs.put("totalCount",totalCount);
        return rs;
    }
    public JSONObject getReyStatbyTeam(String doctor, String startDate, String endDate, String isNow) {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
@ -2127,8 +2202,8 @@ public class StatisticsService extends BaseService {
     */
    public Map<String, Object> getConsultByteam(Long id, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //咨询量
        String consult_sql = "SELECT COUNT(1) AS consultCount FROM wlyy_consult_team t WHERE t.admin_team_code = " + id + " AND t.czrq <='" + endDate + "' AND t.czrq >='" + startDate + "'";
        //获取咨詢數
@ -2140,8 +2215,8 @@ public class StatisticsService extends BaseService {
    }
    public Map<String, Object> getReservationByteam(Long id, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //获取待预约
        String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation  w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'";
        //获取待预约
@ -2153,8 +2228,8 @@ public class StatisticsService extends BaseService {
    }
    public Map<String, Object> getEduArticleByTeam(Long id, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //获取健康教育
        String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient w WHERE  w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'";
        //获取健康教育
@ -2166,8 +2241,8 @@ public class StatisticsService extends BaseService {
    }
    public Map<String, Object> getGuidanceByTeam(Long id, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //获取健康指导
        String guidance_sql = "SELECT COUNT(1) AS guidanceCount  FROM wlyy_patient_health_guidance w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'";
        //获取健康指导
@ -2179,8 +2254,8 @@ public class StatisticsService extends BaseService {
    }
    public Map<String, Object> getArticleByTeam(Long id, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
//        startDate = startDate + " 00:00:00";
//        endDate = endDate + " 23:59:59";
        //随访数目
        String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' AND w.followup_class IS NOT NULL ";
        //随访数目

+ 4 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -811,8 +811,8 @@ public class StatisticsController extends BaseController {
                                   @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("zbqD201703150228",startDate,endDate));
        } catch (Exception e) {
            error(e);
@ -864,8 +864,8 @@ public class StatisticsController extends BaseController {
                                   @RequestParam(required = true) String endDate,
                                   @RequestParam(required = true) String isNow) {
        try {
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam("xh1D201703150222",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam(getUID(), startDate, endDate, isNow));
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("zbqD201703150228",startDate,endDate,isNow));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");