瀏覽代碼

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

chenweida 7 年之前
父節點
當前提交
d12af4927b

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

@ -2483,7 +2483,7 @@ public class StatisticsService extends BaseService {
        String sql;
        String totalSql;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            sql = "SELECT " +
@ -2591,8 +2591,8 @@ public class StatisticsService extends BaseService {
        String imDataBaseName = im_dataBase_name;
        String sql;
        String totalSql;
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            sql = "SELECT " +
@ -2701,8 +2701,8 @@ public class StatisticsService extends BaseService {
     */
    public JSONArray getMemberConsultList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        String imDataBaseName = im_dataBase_name;
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        // 未回复咨询总量
        String onReySQL = "SELECT " +
                " IFNULL(c.total,0) AS noRely, " +
@ -2915,8 +2915,8 @@ public class StatisticsService extends BaseService {
    public JSONObject getDoctorConsultTitle(String doctor, String teamCode, String startDate, String endDate) {
        String imDataBaseName = im_dataBase_name;
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        //获取咨询总数
        String couTotalSQL = "SELECT " +
                "  COUNT(1) total " +
@ -3045,7 +3045,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorFollowupLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL;
        String planSQL;
        if ("0".equals(type)) {
@ -3110,7 +3110,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL;
        String planSQL;
        if ("0".equals(type)) {
@ -3170,8 +3170,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getDoctorTeamFolList(String startDate, String endDate, String teamCode, String sort, String sortType) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " IFNULL(c.followupCount,0) AS followupCount, " +
                " d.`code` AS doctorCode, " +
@ -3378,7 +3378,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorFolTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " COUNT(1) AS followupCount " +
                " FROM " +
@ -3431,7 +3431,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamResLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql;
        if ("0".equals(type)) {
            //查周
@ -3464,8 +3464,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamDoctorResLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql;
        if ("0".equals(type)) {
            //查周
@ -3500,8 +3500,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamDoctorResList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.reservationCount,0) AS reservationCount, " +
                " d.`code` AS doctorCode, " +
@ -3610,8 +3610,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONObject getTeamDoctorResTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " COUNT(1) AS reservationCount " +
                " FROM " +
@ -3652,8 +3652,8 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamGuidLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String SQL;
        if ("0".equals(type)) {
            //按周统计
@ -3664,22 +3664,22 @@ public class StatisticsService extends BaseService {
                    " wlyy_patient_health_guidance w " +
                    " WHERE " +
                    " w.admin_team_code = " + teamCode +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
            SQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    " ) AS weekOfMonth, " +
                    " COUNT(1) AS guidanceCount " +
                    " FROM " +
                    " wlyy_patient_health_guidance w " +
                    " WHERE " +
                    " w.admin_team_code =" + teamCode +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(SQL);
@ -3688,8 +3688,8 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamDoctorGuidLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String SQL;
        if ("0".equals(type)) {
            //按周统计
@ -3701,14 +3701,14 @@ public class StatisticsService extends BaseService {
                    " WHERE " +
                    " w.admin_team_code = " + teamCode +
                    " AND w.doctor ='" + doctor + "'" +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
            SQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    " ) AS weekOfMonth, " +
                    " COUNT(1) AS guidanceCount " +
                    " FROM " +
@ -3716,8 +3716,8 @@ public class StatisticsService extends BaseService {
                    " WHERE " +
                    " w.admin_team_code =" + teamCode +
                    " AND w.doctor ='" + doctor + "'" +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(SQL);
@ -3725,8 +3725,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamGuidList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.guidanceCount,0) AS guidanceCount, " +
                " d.`code` AS doctorCode, " +
@ -3770,8 +3770,8 @@ public class StatisticsService extends BaseService {
                " wlyy_patient_health_guidance w " +
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.create_time >= '" + startDate + "' " +
                " GROUP BY w.doctor " +
                " ) c ON c.doctor = m.doctor_code, " +
                " wlyy_doctor d " +
@ -3835,8 +3835,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONObject getTeamDoctorGuiTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " COUNT(1) AS guidanceCount " +
                " FROM " +
@ -3844,7 +3844,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "'";
                " AND w.create_time <= '" + endDate + "'";
        String addSQL = "SELECT " +
                " COUNT(1) AS addCount " +
@ -3853,8 +3853,8 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "'";
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.create_time >= '" + startDate + "'";
        JSONObject rs = new JSONObject();
        Long guidanceCount = 0L;
        Long addCount = 0L;
@ -3877,7 +3877,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String sql;
        if ("0".equals(type)) {
@ -3909,8 +3909,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamDoctorEduLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String sql;
        if ("0".equals(type)) {
@ -3944,8 +3944,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamEduList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.articleCount,0) AS articleCount, " +
                " IFNULL(c.batchno,0) AS batchno, " +
@ -4081,8 +4081,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONObject getTeamDoctorEduTitle(String teamCode, String startDate, String endDate, String doctor) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " COUNT(1) AS articleCount, " +
                " COUNT(DISTINCT w.batch_no) batchno " +
@ -6722,8 +6722,8 @@ public class StatisticsService extends BaseService {
    public List<Map<String, Object>> getCousultTotalForEsGetTeamConsultCount(String teamCode, String startDate, String endDate, String type) {
        String imDataBaseName = im_dataBase_name;
        String totalSql;
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            totalSql = "SELECT " +

+ 20 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2303,8 +2303,8 @@ public class StatisticsESService {
     * @return
     */
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type)throws Exception {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        List<Map<String,Object>> dateList = DateUtil.findDates(dateFormat.parse(startDate),dateFormat.parse(endDate));
        Integer interval = Integer.parseInt(type) + 1;
@ -3055,41 +3055,44 @@ public class StatisticsESService {
     * @return
     */
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        //startDate = elasticsearchUtil.changeTime(startDate+" 17:00:00");
        //endDate = elasticsearchUtil.changeTime(endDate+" 17:00:00");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list1 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "69", SaveModel.timeLevel_ZL, interval + "");
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "70", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list1) {
            if(one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("planCount", one.getResult2().longValue());
                planList.add(map);
                map.put("followupCount", one.getResult2().intValue());
                totalList.add(map);
            }
        }
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list1) {
            if(one.getResult2().intValue()!=0){
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("followupCount", one.getResult2().longValue());
                totalList.add(map);
                map.put("planCount", one.getResult2().intValue());
                planList.add(map);
            }
        }
        JSONObject result = new JSONObject();
        result.put("planList", planList);
        result.put("totalList", totalList);
        result.put("totalLine", totalList);
        result.put("planLine", planList);
        return result;
    }
@ -3104,8 +3107,8 @@ public class StatisticsESService {
     */
    public JSONArray getTeamResLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        startDate = elasticsearchUtil.changeTime(startDate + " 17:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 17:00:00");
//        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
//        endDate = elasticsearchUtil.changeTime(endDate + " 17:00:00");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
@ -3284,8 +3287,6 @@ public class StatisticsESService {
    public JSONArray getTeamGuidLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        startDate = elasticsearchUtil.changeTime(startDate + " 17:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 17:00:00");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;

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

@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
 * Created by lyr on 2016/08/16
 * Created by lyr on 2016/08/16.
 */
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})