瀏覽代碼

团队周报统计

trick9191 8 年之前
父節點
當前提交
baf887873b

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -3513,7 +3513,7 @@ public class FamilyContractService extends BaseService {
                " wlyy_sign_family s " +
                " WHERE " +
                " s.`status` >= 0 " +
                " AND s.server_type IS NOT NULL "+
                " AND s.server_type IS NOT NULL AMD s.server_type <>'3' "+
                " AND s.admin_team_code =" +teamCode+
                " AND s.doctor_health IS NULL";
        List<Map<String,Object>> patientList = jdbcTemplate.queryForList(patientSql);

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

@ -2106,8 +2106,6 @@ 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";
        //咨询量
        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+"'";
        //获取咨詢數
@ -2119,8 +2117,6 @@ 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";
        //获取待预约
        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+"'";
        //获取待预约
@ -2132,8 +2128,6 @@ 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";
        //获取健康教育
        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+"'";
        //获取健康教育
@ -2145,8 +2139,6 @@ 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";
        //获取健康指导
        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+"'";
        //获取健康指导
@ -2158,10 +2150,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";
        //随访数目
        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 ";
        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+"' ";
        //随访数目
        Map<String,Object> followupCout= jdbcTemplate.queryForMap(followup_sql);
        if(followupCout.get("followupCount")==null){
@ -2997,8 +2987,8 @@ public class StatisticsService extends BaseService {
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
            " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
                    " AND w.create_time <= '"+endDate+"' " +
//                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
            planSQL ="SELECT " +
@ -3012,7 +3002,7 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
//                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }else{
            //按月
@ -3026,7 +3016,7 @@ public class StatisticsService extends BaseService {
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
//                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
            planSQL = "SELECT " +
                    " ( " +
@ -3039,7 +3029,7 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
//                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
@ -3069,7 +3059,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =" +teamCode+
                " AND w.create_time <= '"+endDate+"' " +
                " AND w.followup_class IS NOT NULL " +
//                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -3101,7 +3091,7 @@ public class StatisticsService extends BaseService {
                " w.admin_team_code =" +teamCode+
                " AND w.create_time >= '"+startDate+"' " +
                " AND w.create_time <= '"+endDate+"' " +
                " AND w.followup_class IS NOT NULL " +
//                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -3134,7 +3124,7 @@ public class StatisticsService extends BaseService {
                " AND w.create_time >= '"+startDate+"' " +
                " AND w.create_time <= '"+endDate+"' " +
                " AND w.status ='2'"+
                " AND w.followup_class IS NOT NULL " +
//                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
@ -4007,4 +3997,50 @@ public class StatisticsService extends BaseService {
        rs.put("photo",doctor.getPhoto());
        return rs;
    }
    public JSONObject getTeamRenewChangeLine(String teamCode,String startDate,String endDate,String type){
        startDate = startDate+" 00:00:00";
        endDate = endDate+" 23:59:59";
        String inSql ;
        String outSql;
        if("0".equals(type)){
            inSql ="SELECT left(r.apply_date,10) AS dateNo,COUNT(1) AS inCount FROM wlyy_sign_family_renew_log r  " +
                    " WHERE r.admin_team_id ='"+teamCode+"' " +
                    " AND r.apply_date >= '"+startDate+"' " +
                    " AND r.apply_date <='"+endDate+"' " +
                    " AND r.old_admin_team_id <> r.admin_team_id " +
                    " GROUP BY dateNo ";
            outSql ="SELECT left(r.apply_date,10) AS dateNo,COUNT(1) AS inCount FROM wlyy_sign_family_renew_log r  " +
                    " WHERE r.old_admin_team_id ='"+teamCode+"' " +
                    " AND r.apply_date >= '"+startDate+"' " +
                    " AND r.apply_date <='"+endDate+"' " +
                    " AND r.old_admin_team_id <> r.admin_team_id " +
                    " GROUP BY dateNo ";
        }else{
            inSql ="SELECT ( " +
                    "  DATE_FORMAT(r.apply_date, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS outCount FROM wlyy_sign_family_renew_log r  " +
                    " WHERE r.admin_team_id ='"+teamCode+"'  " +
                    " AND r.apply_date >= '"+startDate+"'  " +
                    " AND r.apply_date <='"+endDate+"'  " +
                    " AND r.old_admin_team_id <> r.admin_team_id " +
                    " GROUP BY weekOfMonth ";
            outSql ="SELECT ( " +
                    "  DATE_FORMAT(r.apply_date, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS outCount FROM wlyy_sign_family_renew_log r  " +
                    " WHERE r.old_admin_team_id ='"+teamCode+"'  " +
                    " AND r.apply_date >= '"+startDate+"'  " +
                    " AND r.apply_date <='"+endDate+"'  " +
                    " AND r.old_admin_team_id <> r.admin_team_id " +
                    " GROUP BY weekOfMonth ";
        }
        JSONObject rs = new JSONObject();
        List<Map<String,Object>> inList = jdbcTemplate.queryForList(inSql);
        rs.put("inLine",inList);
        List<Map<String,Object>> outList =jdbcTemplate.queryForList(outSql);
        rs.put("outLine",outList);
        return rs ;
    }
}

+ 33 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -595,7 +595,12 @@ public class PatientService extends TokenService {
    public JSONArray getSignByTeamCodeGpbyServer(Long teamCode){
        // 获取总分组数量
        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.server_type IS NOT NULL GROUP BY f.server_type ORDER BY f.server_type ASC";
        String totalGSql ="SELECT d.`code` AS serverType,d.`name` AS serverTypeName,ifNULL(c.Amount,0) AS Amount FROM " +
                " wlyy_sign_dict d LEFT JOIN" +
                " ("+
                "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0 AND f.server_type IS NOT NULL GROUP BY f.server_type ORDER BY f.server_type ASC"+
                " ) c ON d.code = c.serverType " +
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ORDER BY d.sort ASC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
        //获取关注量分组数量
@ -603,7 +608,31 @@ public class PatientService extends TokenService {
        List<Map<String,Object>> fousG = jdbcTemplate.queryForList(fousGSql);
        //获取二级节点分组总数
        String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC ";
        String sesTotalSql ="SELECT " +
                " LEFT ( " +
                "  d.`code`, " +
                "  INSTR(d.`code`, '-') - 1 " +
                " ) AS serverType, " +
                " substring( " +
                "  d.`code`, " +
                "  INSTR(d.`code`, '-') + 1 " +
                " ) AS specialPopulation, " +
                " d.`name` AS specialPopulationName, " +
                " ifnull(c.Amount, 0) AS Amount " +
                " FROM " +
                " wlyy_sign_dict d " +
                " LEFT JOIN ( "+
                " SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName ," +
                " CONCAT(" +
                " f.server_type," +
                " '-'," +
                " f.special_population" +
                " ) AS dcode "+
                " FROM wlyy_sign_family f WHERE f.admin_team_code ="+teamCode+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC "+
                " ) c ON c.dcode = d.code " +
                " WHERE " +
                " d.`year` = '"+DateUtil.getSignYear()+"'" +
                " AND d.`code` LIKE '%-%' ORDER BY d.sort ASC";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);
        //获取二级节点分组数量
@ -703,7 +732,7 @@ public class PatientService extends TokenService {
                " ("+
                " SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.`status`>0 AND f.server_type IS NOT NULL "+teamCodeSql+" GROUP BY f.server_type ORDER BY f.server_type ASC"+
                " ) c ON d.code = c.serverType " +
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ";
                " WHERE d.`year`='"+DateUtil.getSignYear()+"' AND d.`code` NOT LIKE '%-%' ORDER BY d.sort ASC";
//        String totalGSql = "SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name AS serverTypeName FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.`status`>0 AND f.server_type IS NOT NULL "+teamCodeSql+" GROUP BY f.server_type ORDER BY f.server_type ASC";
        List<Map<String,Object>> totalG = jdbcTemplate.queryForList(totalGSql);
@ -736,7 +765,7 @@ public class PatientService extends TokenService {
                " c ON c.dcode = d.code " +
                " WHERE\n" +
                " d.`year` = '"+DateUtil.getSignYear()+"'" +
                " AND d.`code` LIKE '%-%'";
                " AND d.`code` LIKE '%-%' ORDER BY d.sort ASC";
        //String sesTotalSql ="SELECT count(1) AS Amount,f.server_type AS serverType,f.server_type_name As serverTypeName ,f.special_population AS specialPopulation,f.special_population_name AS specialPopulationName  FROM wlyy_sign_family f WHERE (f.doctor ='"+doctor+"' OR f.doctor_health ='"+doctor+"')  "+teamCodeSql+" AND f.`status`>0  AND f.special_population Is NOT NULL AND f.server_type IS NOT NULL GROUP BY f.special_population ORDER BY f.special_population ASC ";
        List<Map<String,Object>> sesTotal = jdbcTemplate.queryForList(sesTotalSql);

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

@ -1283,7 +1283,7 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/getDotorInfo")
    @ResponseBody
    public String getDotorInfo(String code){
    public String getDotorInfo(@RequestParam(required = true)String code){
        try {
            return write(200, "查询成功", "data", statisticsService.getDoctorInfo(code));
        } catch (Exception e) {
@ -1291,4 +1291,19 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getTeamRenewChangeLine")
    @ResponseBody
    public String getTeamRenewChangeLine(@RequestParam(required = true)String teamCode,
                                         @RequestParam(required = true)String startDate,
                                         @RequestParam(required = true)String endDate,
                                         @RequestParam(required = true)String type){
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamRenewChangeLine(teamCode,startDate,endDate,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}