Browse Source

Merge branch 'dev' of trick9191/patient-co-management into dev

trick9191 7 years ago
parent
commit
e21cd2639f

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

@ -2358,7 +2358,7 @@ public class StatisticsService extends BaseService {
     * @param doctor 医生code
     * @return
     */
    public JSONObject getTeamDocotorConsultCount(String teamCode,String startDate,String endDate,String type,String doctor){
    public JSONObject getTeamDoctorConsultCount(String teamCode,String startDate,String endDate,String type,String doctor){
        String imDataBaseName = SystemConf.getInstance().getImDataBaseName();
        String sql ;
        String totalSql ;
@ -2568,7 +2568,7 @@ public class StatisticsService extends BaseService {
                " c.doctorCode, " +
                " count(1) AS total " +
                " FROM " +
                " wlyy__team a, " +
                " wlyy_consult_team a, " +
                " ( " +
                " SELECT DISTINCT " +
                " t.id consultId, " +
@ -2579,7 +2579,7 @@ public class StatisticsService extends BaseService {
                " "+imDataBaseName+".doctors d, " +
                " "+imDataBaseName+".sessions s " +
                " WHERE " +
                " tp.participant_id = d.id " +
                " p.participant_id = d.id " +
                " AND t.session_id = p.session_id " +
                " AND t.session_id = s.id " +
                " AND s.type = 1 " +
@ -2848,4 +2848,179 @@ public class StatisticsService extends BaseService {
        rs.put("noRelyNumber",noRelyNumber);
        return rs;
    }
    public JSONObject getTeamDoctorFollowupLine(String teamCode,String startDate,String endDate,String type,String doctor){
        startDate = startDate+" 00:00:00";
        endDate = endDate+" 23:59:59";
        String totalSQL ;
        String planSQL ;
        if("0".equals(type)){
            //按周
            totalSQL ="SELECT " +
                    " left(w.create_time,10) AS dateNo,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.doctor_code ='"+doctor+"'"+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
            planSQL ="SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS planCount " +
                    "FROM " +
                    " wlyy_followup w " +
                    "WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.doctor_code ='"+doctor+"'"+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }else{
            //按月
            totalSQL ="SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.doctor_code ='"+doctor+"'"+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
            planSQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.doctor_code ='"+doctor+"'"+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
        List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSQL);
        JSONObject rs = new JSONObject();
        rs.put("totalLine",totalList);
        rs.put("planLine",planList);
        return rs;
    }
    public JSONObject getTeamFollowupLine(String teamCode,String startDate,String endDate,String type){
        startDate = startDate+" 00:00:00";
        endDate = endDate+" 23:59:59";
        String totalSQL ;
        String planSQL ;
        if("0".equals(type)){
            //按周
            totalSQL ="SELECT " +
                    " left(w.create_time,10) AS dateNo,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY dateNo";
            planSQL ="SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS planCount " +
                    "FROM " +
                    " wlyy_followup w " +
                    "WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }else{
            //按月
            totalSQL ="SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
            planSQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('2017-06-01', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" +teamCode+
                    " AND w.create_time >= '"+startDate+"' " +
                    " AND w.create_time <= '"+endDate+"' " +
                    " AND w.status ='2'"+
                    " AND w.followup_class IS NOT NULL " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String,Object>> totalList = jdbcTemplate.queryForList(totalSQL);
        List<Map<String,Object>> planList = jdbcTemplate.queryForList(planSQL);
        JSONObject rs = new JSONObject();
        rs.put("totalLine",totalList);
        rs.put("planLine",planList);
        return rs;
    }
    public JSONArray getDoctorTeamFolList(String startDate,String endDate,String teamCode,String sort,String sortType){
        startDate = startDate+" 00:00:00";
        endDate = endDate+" 23:59:59";
        String totalSQL = "SELECT " +
                " IFNULL(c.followupCount,0) AS followupCount, " +
                " d.`code` AS doctorCode, " +
                " d.`name` AS name " +
                " FROM " +
                " wlyy_admin_team_member m " +
                " LEFT JOIN ( " +
                " SELECT " +
                "  w.doctor_code, " +
                "  w.doctor_name, " +
                "  COUNT(1) AS followupCount " +
                " FROM " +
                "  wlyy_followup w " +
                " WHERE " +
                " w.admin_team_code =" +teamCode+
                " AND w.create_time >= '"+startDate+"' " +
                " AND w.create_time <= '"+endDate+"' " +
                " AND w.followup_class IS NOT NULL " +
                " GROUP BY " +
                "  w.doctor_code " +
                " ) c ON c.doctor_code =m.doctor_code, " +
                " wlyy_doctor d " +
                " WHERE  " +
                "  d.`code` = m.doctor_code " +
                " AND m.available = 1 " +
                " AND m.team_id =" +teamCode ;
        if("0".equals(sort)){
            totalSQL =totalSQL+" ORDER BY followupCount DESC";
        }else{
            totalSQL =totalSQL+" ORDER BY followupCount ASC";
        }
        return null;
    }
}

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

@ -850,7 +850,10 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamConsultCount")
    @ResponseBody
    public String getTeamConsultCount(String teamCode,String startDate,String endDate,String type){
    public String getTeamConsultCount(@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.getTeamConsultCount(teamCode,startDate,endDate,type));
        } catch (Exception e) {
@ -868,11 +871,15 @@ public class StatisticsController extends BaseController {
     * @param doctor
     * @return
     */
    @RequestMapping("/getTeamDocotorConsultCount")
    @RequestMapping("/getTeamDoctorConsultCount")
    @ResponseBody
    public String getTeamDocotorConsultCount(String teamCode,String startDate,String endDate,String type,String doctor){
    public String getTeamDoctorConsultCount(@RequestParam(required = true)String teamCode,
                                             @RequestParam(required = true)String startDate,
                                             @RequestParam(required = true)String endDate,
                                             @RequestParam(required = true)String type,
                                             @RequestParam(required = true)String doctor){
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDocotorConsultCount(teamCode,startDate,endDate,type,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorConsultCount(teamCode,startDate,endDate,type,doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -889,7 +896,10 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getMemberConsultList")
    @ResponseBody
    public String getMemberConsultList(String teamCode,String startDate,String endDate,String sort){
    public String getMemberConsultList(@RequestParam(required = true)String teamCode,
                                       @RequestParam(required = true)String startDate,
                                       @RequestParam(required = true)String endDate,
                                       @RequestParam(required = true)String sort){
        try {
            return write(200, "查询成功", "data", statisticsService.getMemberConsultList(teamCode,startDate,endDate,sort));
        } catch (Exception e) {
@ -908,7 +918,10 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getDoctorConsultTitle")
    @ResponseBody
    public String getDoctorConsultTitle(String doctor,String teamCode,String startDate,String endDate){
    public String getDoctorConsultTitle(@RequestParam(required = true)String doctor,
                                        @RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate){
        try {
            return write(200, "查询成功", "data", statisticsService.getDoctorConsultTitle(doctor,teamCode,startDate,endDate));
        } catch (Exception e) {
@ -917,4 +930,41 @@ public class StatisticsController extends BaseController {
        }
    }
    /**
     * 获取团队随访量折线统计图
     * @param type
     * @param teamCode
     * @param startDate
     * @param endDate
     * @return
     */
    @RequestMapping("/getTeamFollowupLine")
    @ResponseBody
    public String getTeamFollowupLine(@RequestParam(required = true)String type,
                                      @RequestParam(required = true)String teamCode,
                                      @RequestParam(required = true)String startDate,
                                      @RequestParam(required = true)String endDate){
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamFollowupLine(teamCode,startDate,endDate,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getTeamDoctorFollowupLine")
    @ResponseBody
    public String getTeamDoctorFollowupLine(@RequestParam(required = true)String type,
                                            @RequestParam(required = true)String teamCode,
                                            @RequestParam(required = true)String startDate,
                                            @RequestParam(required = true)String endDate,
                                            @RequestParam(required = true)String doctor){
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorFollowupLine(teamCode,startDate,endDate,type,doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}