瀏覽代碼

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

chenweida 8 年之前
父節點
當前提交
92a6dd57d1

+ 21 - 21
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/RenewSignDataFilter.java

@ -162,46 +162,46 @@ public class RenewSignDataFilter {
            //判断社区有没有值
            Hospital hospital = hospitalsMap.get(orgCodeTemp);
            if (hospital == null) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_hospital_noExist));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_hospital_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
            String town = hospital.getTown();
            if (StringUtils.isEmpty(town)) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_town_null));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_town_null));
                isAll = false;
                errorCount++;
                continue;
            }
            Town townObj = townsMap.get(town);
            if (townObj == null) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_town_noExist));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_town_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
            Long adminId = signFamily.getAdminTeamId();
            if (adminId == null || adminId <= 0) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_adminTeam_null));
                isAll = false;
                errorCount++;
                continue;
            }
            AdminTeam adminTeam = adminTeamMap.get(adminId + "");
            if (adminTeam == null) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
            String idCard = signFamily.getIdcard();
            if (idCard == null || ((idCard.length() != 18 && idCard.length() != 15))) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_idcard_error));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_adminTeam_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
//            String idCard = signFamily.getIdcard();
//            if (idCard == null || ((idCard.length() != 18 && idCard.length() != 15))) {
//                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_idcard_error));
//                isAll = false;
//                errorCount++;
//                continue;
//            }
            //设置二级维度的Key
            String returnLevel2Key = getLevel2Key(level2Key, signFamily);
            String returnLevel3Key = getLevel3Key(level3Key, signFamily);
@ -348,13 +348,13 @@ public class RenewSignDataFilter {
            SignFamilyRenew signFamily = signFamilies.get(i);
            String orgCode = signFamily.getHospital();
            if (StringUtils.isEmpty(orgCode)) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_hospital_null));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_hospital_null));
                isAll = false;
                errorCount++;
                continue;
            }
            if (orgCode.length() != 10) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_hospital_isTest));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_hospital_isTest));
                isAll = false;
                errorCount++;
                continue;
@ -370,28 +370,28 @@ public class RenewSignDataFilter {
            //判断社区有没有值
            Hospital hospital = hospitalsMap.get(orgCodeTemp);
            if (hospital == null) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_hospital_noExist));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_hospital_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
            String town = hospital.getTown();
            if (StringUtils.isEmpty(town)) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_town_null));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_town_null));
                isAll = false;
                errorCount++;
                continue;
            }
            Town townObj = townsMap.get(town);
            if (townObj == null) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_town_noExist));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_town_noExist));
                isAll = false;
                errorCount++;
                continue;
            }
            String idCard = signFamily.getIdcard();
            if (idCard == null || ((idCard.length() != 18 && idCard.length() != 15))) {
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_idcard_error));
                errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_idcard_error));
                isAll = false;
                errorCount++;
                continue;
@ -406,7 +406,7 @@ public class RenewSignDataFilter {
                    String sqlD = "select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='" + signFamily.getDoctor() + "'";
                    adminTeamList = jdbcTemplate.queryForList(sqlD, Long.class);
                    if (adminTeamList == null && adminTeamList.size() == 0) {
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_adminTeam_null));
                        isAll = false;
                        errorCount++;
                        continue;
@ -416,13 +416,13 @@ public class RenewSignDataFilter {
                    String sqlD = "select DISTINCT team_id from wlyy_admin_team_member w where w.doctor_code='" + signFamily.getDoctorHealth() + "'  ";
                    adminTeamList = jdbcTemplate.queryForList(sqlD, Long.class);
                    if (adminTeamList == null && adminTeamList.size() == 0) {
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                        errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_adminTeam_null));
                        isAll = false;
                        errorCount++;
                        continue;
                    }
                } else {
                    errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_adminTeam_null));
                    errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.renew_adminTeam_null));
                    isAll = false;
                    errorCount++;
                    continue;

+ 12 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/model/ErrorModel.java

@ -43,6 +43,18 @@ public class ErrorModel {
    public static String sign_idcard_error_age="签约表中(wlyy_sign_family)中的身份证解析年龄失败";
    public static String sign_idcard_error_sex="签约表中(wlyy_sign_family)中的身份证解析性别失败";
    public static String renew_hospital_null="续签表中(wlyy_sign_family_renew)中的hospital数据为空";
    public static String renew_hospital_noExist="续签表中(wlyy_sign_family_renew)中的hospital数据不存在";
    public static String renew_hospital_isTest="续签表中(wlyy_sign_family_renew)中的hospital数据是测试数据";
    public static String renew_adminTeam_null="续签表中(wlyy_sign_family_renew)中的团队数据为空";
    public static String renew_adminTeam_noExist="续签表中(wlyy_sign_family_renew)中的团队数据不存在";
    public static String renew_town_null="机构表的中的town为空";
    public static String renew_town_noExist="机构表的中的town不存在";
    public static String renew_idcard_error="续签表中(wlyy_sign_family_renew)中的身份证错误";
    public static String renew_idcard_error_age="续签表中(wlyy_sign_family_renew)中的身份证解析年龄失败";
    public static String renew_idcard_error_sex="续签表中(wlyy_sign_family_renew)中的身份证解析性别失败";
    public static String consult_adminTeam_null="咨询的团队(wlyy_consult_team)中的admin_team_code数据为空";
    public static String consult_adminTeam_noExist="咨询的团队(wlyy_consult_team)中的admin_team_code数据不存在";
    public static String consult_hospital_null="咨询的团队(wlyy_consult_team)中的admin_team_code在团队表中的orgCode为空";

+ 21 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -184,6 +184,7 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_34(); //续签签入
        computequota_35(); //统计续签签出
        computequota_36(sql, signFamilies, null); //签约服务类型
        computequota_37(); //统计转签
        quartzJobLog.setJobContent(allContent.toString());
@ -207,6 +208,26 @@ public class CurrentDayAllQuotaJob implements Job {
        redisTemplate.opsForValue().set("quota:timeKey", RedisStorage.timeKey);
    }
    private void computequota_37() {
        String quotaId = "37";
        try {
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where fr.`status`>0  and fr.old_admin_team_id!=fr.admin_team_id and fr.apply_date<'"+tomorrow+"'";
            //抽取數據
            List<SignFamily> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamily.class, sql);
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(SignDataFilter.class).filter(signFamilies, sql, "now");
            //统计数据
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel1(returnDatas, null, quotaId);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
            allContent.append("统计失败:" + e.getMessage());
        }
        allContent.append("-----------37----------");
    }
    private void computequota_36(String sql, List<SignFamily> signFamilies, Object o) {
        String quotaId = "36";
        //找出今天的签约信息

+ 105 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SwitchSignJob.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.statistics.job.business;
import com.yihu.wlyy.statistics.dao.QuartzJobLogDao;
import com.yihu.wlyy.statistics.etl.dataFilter.RenewSignDataFilter;
import com.yihu.wlyy.statistics.etl.extract.DBExtract;
import com.yihu.wlyy.statistics.etl.model.ETLModel;
import com.yihu.wlyy.statistics.etl.model.FilterModel;
import com.yihu.wlyy.statistics.etl.role.Level1Role;
import com.yihu.wlyy.statistics.etl.storage.DBStorage;
import com.yihu.wlyy.statistics.model.job.QuartzJobLog;
import com.yihu.wlyy.statistics.model.signfamily.SignFamilyRenew;
import com.yihu.wlyy.statistics.util.JsonUtil;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 转签的指标执行类
 */
@Component
@Scope("prototype")
@DisallowConcurrentExecution//防止到了执行时间点前一任务还在执行中,但是这时有空闲的线程,那么马上又会执行,这样一来就会存在同一job被并行执行
public class SwitchSignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;//执行日志Dao
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private Level1Role levelRole;
    @Autowired
    private DBStorage dbStorage;
    @Autowired
    private DBExtract dbExtract;
    @Autowired
    private RenewSignDataFilter signDataFilter;
    String yesterday;
    String daybefore;
    @Override
    public void execute(JobExecutionContext context)
            throws JobExecutionException {
        try{
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            //初始化参数
            JobDataMap map = context.getJobDetail().getJobDataMap();
            wlyyQuota = (WlyyQuotaVO) map.get("quota");
            wlyyJobConfig = (WlyyJobConfigVO) map.get("jobConfig");
            daybefore= StringUtils.isEmpty(map.get("daybefore"))?SignJob.getDayString(-2):map.get("daybefore").toString();
            yesterday= StringUtils.isEmpty(map.get("yesterday"))?SignJob.getDayString(-1):map.get("yesterday").toString();
            //计算指标
            computequota();
        }catch (Exception e){
            //如果出錯立即重新執行
            JobExecutionException e2 =new JobExecutionException(e);
            e2.setRefireImmediately(true);
        }
    }
    /**
     * 计算指标
     */
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+37+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
            quartzJobLog.setJobStartTime(new Date());
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where fr.`status`>0  and fr.old_admin_team_id!=fr.admin_team_id and fr.apply_date<'"+yesterday+Constant.quota_date_last+"'";
            //抽取數據
            List<SignFamilyRenew> signFamilies= dbExtract.extract(SignFamilyRenew.class,sql);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(signFamilies,null,null,sql,yesterday);
            //统计数据
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //保存数据
            dbStorage.saveByLevel1(returnDatas,yesterday,wlyyQuota);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));
            quartzJobLog.setJobType(etlModels.getError()?"1":"0");
            quartzJobLogDao.save(quartzJobLog);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 106 - 106
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -27,112 +27,112 @@ public class DoctorInterceptor extends BaseInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
        try {
            request.setCharacterEncoding("UTF-8");
            request.setAttribute("log-start", new Date().getTime());
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            if (json == null) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
                    return true;
                }
            }
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
            String observer = json.has("observer") ? json.getString("observer") : "";
            //如果是观察者直接返回true
            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {
                Class cls = ((HandlerMethod) handler).getBeanType();
                RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
                Method method = ((HandlerMethod) handler).getMethod();
                RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
                String url = "";
                String urlCls = "";
                String urlMth = "";
                if (clsRm.value() != null && clsRm.value().length > 0) {
                    urlCls = clsRm.value()[0];
                }
                if (mthRm.value() != null && mthRm.value().length > 0) {
                    urlMth = mthRm.value()[0];
                }
                if (StringUtils.isNotEmpty(urlCls)) {
                    url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
                }
                if (StringUtils.isNotEmpty(urlMth)) {
                    url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
                }
                url = url.replace("\\", "/").replace("//", "/");
                CudUrl cudUrl = cudUrlDao.findByUrl(url);
                if (url.equals("/doctor/consult/readed")) {
                    response.getOutputStream().write(write(200, "操作成功").getBytes());
                    return false;
                }
                if (cudUrl != null) {
                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {
                        return true;
                    } else {
                        response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
                        return false;
                    }
                }
                return true;
            }
            if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            Token token = SystemData.doctorTokens.get(uid);
            if (token == null) {
                token = tokenDao.findByPatient(uid, 2);
                if (token != null) {
                    // 加入缓存
                    SystemData.doctorTokens.put(uid, token);
                }
            }
            if (token == null || token.getPlatform() != 2) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                flag = false;
            } else {
                if (token.getTimeout().getTime() < new Date().getTime()) {
                    // 登录超时
                    response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
                    flag = false;
                } else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
                    // 别处登录
                    response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
                    flag = false;
                } else {
                    // 一天只更新一次
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        // 更新内存
                        SystemData.doctorTokens.put(uid, token);
                        // 更新数据库
                        tokenDao.save(token);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
//        try {
//            request.setCharacterEncoding("UTF-8");
//            request.setAttribute("log-start", new Date().getTime());
//            response.setCharacterEncoding("UTF-8");
//            JSONObject json = getAgent(request);
//
//            if (json == null) {
//                // 未登录
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                return false;
//            }
//
//            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
//                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
//                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
//                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
//                    return true;
//                }
//            }
//
//            String tokenStr = json.has("token") ? json.getString("token") : "";
//            String uid = json.has("uid") ? json.getString("uid") : "";
//            String imei = json.has("imei") ? json.getString("imei") : "";
//            String observer = json.has("observer") ? json.getString("observer") : "";
//            //如果是观察者直接返回true
//            if (!org.springframework.util.StringUtils.isEmpty(observer) && observer.equals("1")) {
//                Class cls = ((HandlerMethod) handler).getBeanType();
//                RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
//                Method method = ((HandlerMethod) handler).getMethod();
//                RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
//                String url = "";
//                String urlCls = "";
//                String urlMth = "";
//                if (clsRm.value() != null && clsRm.value().length > 0) {
//                    urlCls = clsRm.value()[0];
//                }
//                if (mthRm.value() != null && mthRm.value().length > 0) {
//                    urlMth = mthRm.value()[0];
//                }
//                if (StringUtils.isNotEmpty(urlCls)) {
//                    url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
//                }
//                if (StringUtils.isNotEmpty(urlMth)) {
//                    url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
//                }
//                url = url.replace("\\", "/").replace("//", "/");
//                CudUrl cudUrl = cudUrlDao.findByUrl(url);
//
//                if (url.equals("/doctor/consult/readed")) {
//                    response.getOutputStream().write(write(200, "操作成功").getBytes());
//                    return false;
//                }
//
//                if (cudUrl != null) {
//                    if (StringUtils.isNotEmpty(cudUrl.getMethod()) &&
//                            request.getMethod().toUpperCase().compareTo(cudUrl.getMethod()) != 0) {
//                        return true;
//                    } else {
//                        response.getOutputStream().write(error(403, "该操作没有权限").getBytes());
//                        return false;
//                    }
//                }
//
//                return true;
//            }
//            if (StringUtils.isEmpty(tokenStr) || StringUtils.isEmpty(imei) || StringUtils.isEmpty(uid)) {
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                return false;
//            }
//
//            Token token = SystemData.doctorTokens.get(uid);
//            if (token == null) {
//                token = tokenDao.findByPatient(uid, 2);
//                if (token != null) {
//                    // 加入缓存
//                    SystemData.doctorTokens.put(uid, token);
//                }
//            }
//            if (token == null || token.getPlatform() != 2) {
//                // 未登录
//                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//                flag = false;
//            } else {
//                if (token.getTimeout().getTime() < new Date().getTime()) {
//                    // 登录超时
//                    response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
//                    flag = false;
//                } else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
//                    // 别处登录
//                    response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
//                    flag = false;
//                } else {
//                    // 一天只更新一次
//                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
//                        // 今天未更新,则更新缓存
//                        token.setCzrq(new Date());
//                        // 更新内存
//                        SystemData.doctorTokens.put(uid, token);
//                        // 更新数据库
//                        tokenDao.save(token);
//                    }
//                }
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        return flag;
    }

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

@ -3552,8 +3552,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.czrq <= '"+startDate+"' " +
                    " AND w.czrq >= '"+endDate+"' " +
                    " GROUP BY dateNo";
        }else{
            //按月统计
@ -3589,8 +3589,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.czrq <= '"+startDate+"' " +
                    " AND w.czrq >= '"+endDate+"' " +
                    " GROUP BY dateNo";
        }else{
            //按月统计
@ -3732,7 +3732,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " +teamCode+
                " AND w.doctor ='"+doctor+"'" +
                " AND w.czrq <= '"+endDate+"' ";
                " AND w.czrq >= '"+endDate+"'";
        String addSQL ="SELECT " +
                " COUNT(1) AS addCount " +
@ -3741,8 +3741,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.czrq <= '"+startDate+"' " +
                " AND w.czrq >= '"+endDate+"'";
        JSONObject rs = new JSONObject();
        Long guidanceCount =0L;
        Long addCount = 0L;

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

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.statistic;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.util.ValueComparator;
@ -10,7 +11,6 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -49,14 +49,14 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标按间隔统计
     * 指标按间隔统计  增量
     *
     * @param startDate 起始日期
     * @param endDate   结束时间
     * @param interval  时间间隔
     * @param area      区域或机构
     * @param level     级别
     * @param index     指标
     * @param index     指标 3 4 5 27
     * @return
     */
    @RequestMapping(value = "/interval")
@ -86,7 +86,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标期间增长量
     * 指标期间 增长量
     *
     * @param startDate
     * @param endDate
@ -118,16 +118,16 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标截止日期累积量
     * 指标截止日期累积量  增量的累加接口
     *
     * @param endDate     结束时间
     * @param area        父code
     * @param level       等级  1 团队,2 机构,3 区,4 市
     * @param index       指标代码
     * @param index       指标代码 3 4 5 27
     * @param level2_type 指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @return
     */
        @RequestMapping("/total")
    @RequestMapping("/total")
    @ResponseBody
    public String getIndexTotal(@RequestParam(required = true) String endDate,
                                @RequestParam(required = true) String area,
@ -149,7 +149,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标期间增长量
     * 指标期间增长量    此接口前端没用
     *
     * @param startDate
     * @param endDate
@ -160,6 +160,7 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/lowlevel_increment")
    @ResponseBody
    @Deprecated
    public String getIndexLowLevelIncrement(@RequestParam(required = true) String startDate,
                                            @RequestParam(required = true) String endDate,
                                            @RequestParam(required = true) String area,
@ -183,8 +184,9 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标截止日期增量
     * 指标截止日期      增量
     * (如:待预约量)
     *
     * @param endDate     结束时间
     * @param area        父code
     * @param level       等级  1 团队,2 机构,3 区,4 市
@ -202,13 +204,14 @@ public class StatisticsController extends BaseController {
                                        @RequestParam(required = true) String index,
                                        @RequestParam(required = true) int sort,
                                        @RequestParam(required = false) String lowLevel,
                                        @RequestParam(required = false) String level2_type) {
                                        @RequestParam(required = false) String level2_type,
                                        @RequestParam(required = false) String year) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type));
                result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type, year));
            }
            return write(200, "查询成功", "data", result);
@ -218,13 +221,13 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标截止日期累积量
     * 指标截止日期累积量  增量
     * 根据2个ID合并指标
     *
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @param index   3,22
     * @return
     */
    @RequestMapping("/lowlevel_total_mesh")
@ -234,14 +237,15 @@ public class StatisticsController extends BaseController {
                                            @RequestParam(required = true) int level,//等级
                                            @RequestParam(required = true) String index,//指标code
                                            @RequestParam(required = true) int sort,//1是倒叙 0是正序
                                            @RequestParam(required = false) String lowLevel) {
                                            @RequestParam(required = false) String lowLevel,
                                            @RequestParam(required = false) String year) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            JSONArray returnJa = new JSONArray();
            List<JSONArray> jsonArrays = new ArrayList<>();
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null);
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
            jsonArrays.add(jsonArray1);
            JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
@ -259,22 +263,22 @@ public class StatisticsController extends BaseController {
                }
            } else {
                //如果是2个指标的时候,分别放入map中,以减少查询次数
                Map<String,JSONObject> in =new TreeMap<>();
                Map<String, JSONObject> in = new TreeMap<>();
                ValueComparator vc = new ValueComparator(in);
                Map<String,JSONObject> index2=new TreeMap<>();
                Map<String, JSONObject> index2 = new TreeMap<>();
                for (int i = 0; i < jsonArrays.get(0).length(); i++) {
                    JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
                    in.put(map1.get("code").toString(),map1);
                    in.put(map1.get("code").toString(), map1);
                }
                Map<String,JSONObject> index1 =new TreeMap<>(vc);
                Map<String, JSONObject> index1 = new TreeMap<>(vc);
                index1.putAll(in);
                for (int i = 0; i < jsonArrays.get(1).length(); i++) {
                    JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
                    index2.put(map1.get("code").toString(),map1);
                    index2.put(map1.get("code").toString(), map1);
                }
                for(Map.Entry<String , JSONObject> one:index1.entrySet()){
                for (Map.Entry<String, JSONObject> one : index1.entrySet()) {
                    JSONObject map1 = one.getValue();
                    JSONObject map2 = index2.get(one.getKey());
                    String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
@ -283,7 +287,7 @@ public class StatisticsController extends BaseController {
                }
            }
            if(level==2){
            if (level == 2) {
                statisticsAllService.translateTeamLeaderNameByCode(returnJa);
            }
            result.put("index_" + indexes[0], returnJa);
@ -300,7 +304,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标期间增长量
     * 指标期间      增长量
     *
     * @param startDate
     * @param endDate
@ -345,7 +349,9 @@ public class StatisticsController extends BaseController {
    public String getAreaSignInfo(@RequestParam(required = true) String endDate,
                                  @RequestParam(required = true) String area,
                                  @RequestParam(required = true) int level,
                                  @RequestParam(required = false) String lowCode) {
                                  @RequestParam(required = false) String lowCode,
                                  @RequestParam(required = false) String year
    ) {
        try {
            JSONObject result = new JSONObject();
@ -370,7 +376,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 获取三级指标增量
     * 获取三级指标增量  到达量
     *
     * @param startDate
     * @param endDate
@ -382,7 +388,8 @@ public class StatisticsController extends BaseController {
    @ResponseBody
    public String getSixFiveStatistics(@RequestParam(required = false) String startDate,
                                       @RequestParam(required = true) String endDate,
                                       @RequestParam(required = true) String area, int level) {
                                       @RequestParam(required = true) String area,
                                       int level) {
        try {
            JSONArray result = statisticsAllService.getSixFiveStatistics(endDate, area, level);
@ -394,14 +401,16 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标按间隔统计
     * 指标按间隔统计  到达量
     *
     * @param startDate 起始日期
     * @param endDate   结束时间
     * @param interval  时间间隔
     * @param area      区域或机构
     * @param level     级别
     * @param index     指标
     * @param index     指标 除了增量的指标都会调用
     * @param lowCode   子维度
     * @param year      查询年份
     * @return
     */
    @RequestMapping(value = "/interval_total")
@ -412,17 +421,35 @@ public class StatisticsController extends BaseController {
                                     @RequestParam(required = true) String area,
                                     @RequestParam(required = true) int level,
                                     @RequestParam(required = true) String index,
                                     @RequestParam(required = false) String lowCode) {
                                     @RequestParam(required = false) String lowCode,
                                     @RequestParam(required = false) String year) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            if (index != null) {
                for (String idx : indexes) {
                    result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode));
                    JSONObject json = statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode);
                    //如果year不为空  那么因为是到达量 所以要扣除上一年的数据
                    if (!org.springframework.util.StringUtils.isEmpty(year) && !"2016".equals(year)) {
                        //得到上一个年份的的最后一天的统计数据
                        String date = year + "-06-30";//固定是 6月三十号 为一个年份的最后一天,如果是2017年份 那么就是2017-7-1 到 2018-6-30
                        WlyyQuotaResult wlyyQuotaResult = statisticsService.findOneQuotaResult(date, level, idx, area);
                        if (wlyyQuotaResult != null) {
                            JSONArray ja = json.getJSONArray("data");
                            for (int i = 0; i < ja.length(); i++) {
                                Integer value = Integer.valueOf(ja.getJSONObject(i).getString("amount"));
                                super.infoMessage("原来的总数:" + value);
                                ja.getJSONObject(i).put("amount", value - Integer.valueOf(wlyyQuotaResult.getResult()));
                                super.infoMessage("需要扣除的总数:" + wlyyQuotaResult.getResult());
                            }
                        }
                    }
                    result.put("index_" + idx, json);
                }
            }
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            return error(-1, "查询失败!");
@ -430,13 +457,14 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标截止日期累积量
     * 指标截止日期累积量 到达量
     *
     * @param date
     * @param area
     * @param level level1_type等级 1:团队 2社区机构 3区级 4市级
     * @param index quotoCode 18/19两率
     * @param sort  1降序排列-1升序排列
     * @param level   level1_type等级 1:团队 2社区机构 3区级 4市级
     * @param index   quotoCode 18/19两率  28  13 17
     * @param sort    0:升序 1:降序
     * @param lowCode
     * @return
     */
    @RequestMapping("/lowlevel_all")
@ -447,20 +475,18 @@ public class StatisticsController extends BaseController {
                                            @RequestParam(required = true) String index,
                                            @RequestParam(required = true) int sort,
                                            @RequestParam(required = false) String lowLevel,
                                            @RequestParam(required = false) String lowCode,
                                            @RequestParam(required = false) String startDate) {
                                            @RequestParam(required = false) String lowCode) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            if (StringUtils.isNotEmpty(lowCode)) {
//                指定level下特定查询级别
                if(index.equals("17")){
                if (index.equals("17")) {
                    result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotalTeamLeader(date, area, level, index, sort, lowLevel, lowCode));
                }else{
                } else {
                    result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode));
                }
            } else {
//                未指定level下特定查询级别
                for (String idx : indexes) {
@ -468,11 +494,11 @@ public class StatisticsController extends BaseController {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
                    } else if (idx.equals("1") || index.equals("21")) {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
                    } else if (idx.equals("28")){
                        result.put("index_" + idx, statisticsService.getAvgAllInfo(level,area,lowLevel));
                    } else if(idx.equals("13")){
                    } else if (idx.equals("28")) {
                        result.put("index_" + idx, statisticsService.getAvgAllInfo(level, area, lowLevel));
                    } else if (idx.equals("13")) {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotalTeamLeader(date, area, level, idx, sort, lowLevel));
                    }else{
                    } else {
                        result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
                    }
                }
@ -514,7 +540,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 二级指标到达量
     * 二级指标 到达量  废弃接口 前端没有调用
     *
     * @param date
     * @param area
@ -524,6 +550,7 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping(value = "/leveltwo_all")
    @ResponseBody
    @Deprecated
    public String getIndexLevelTwoTotal(@RequestParam(required = true) String date,
                                        @RequestParam(required = true) String area,
                                        @RequestParam(required = true) int level,
@ -544,7 +571,7 @@ public class StatisticsController extends BaseController {
    }
    /**
     * 指标截止日期到达量
     * 指标截止日期  到达量
     *
     * @param endDate
     * @param area
@ -557,13 +584,26 @@ public class StatisticsController extends BaseController {
    public String getIndexAll(@RequestParam(required = true) String endDate,
                              @RequestParam(required = true) String area,
                              @RequestParam(required = true) int level,
                              @RequestParam(required = true) String index) {
                              @RequestParam(required = true) String index,
                              @RequestParam(required = false) String year) {
        try {
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsAllService.getIndexTotal(endDate, area, level, idx));
                Long total = statisticsAllService.getIndexTotal(endDate, area, level, idx);
                super.infoMessage("原来的总数:" + total);
                //如果year不为空  那么因为是到达量 所以要扣除上一年的数据
                if (!org.springframework.util.StringUtils.isEmpty(year) && !"2016".equals(year)) {
                    //得到上一个年份的的最后一天的统计数据
                    String date = year + "-06-30";//固定是 6月三十号 为一个年份的最后一天,如果是2017年份 那么就是2017-7-1 到 2018-6-30
                    WlyyQuotaResult wlyyQuotaResult = statisticsService.findOneQuotaResult(date, level, idx, area);
                    if (wlyyQuotaResult != null) {
                        super.infoMessage("需要扣除的数目:" + wlyyQuotaResult.getResult());
                        total = total - Long.valueOf(wlyyQuotaResult.getResult());
                    }
                }
                result.put("index_" + idx, total);
            }
            return write(200, "查询成功", "data", result);
@ -683,6 +723,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取得分平均数
     *
     * @param level
     * @param area
     * @return
@ -691,7 +732,7 @@ public class StatisticsController extends BaseController {
    @ResponseBody
    public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
        try {
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level,area));
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level, area));
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
@ -700,16 +741,17 @@ public class StatisticsController extends BaseController {
    /**
     * 获取得分平均数按月份
     *
     * @return
     */
    @RequestMapping("/getAVGSocreByMonth")
    @ResponseBody
    public String getAVGSocreByMonth(@RequestParam(required = true)String level ,
                                     @RequestParam(required = true)String area,
                                     @RequestParam(required = true)String statDate,
                                     @RequestParam(required = true)String endDate){
    public String getAVGSocreByMonth(@RequestParam(required = true) String level,
                                     @RequestParam(required = true) String area,
                                     @RequestParam(required = true) String statDate,
                                     @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level,area,statDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level, area, statDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -718,15 +760,16 @@ public class StatisticsController extends BaseController {
    /**
     * 统计当前团队,签约人数,服务次数,平均满意度
     *
     * @return
     */
    @RequestMapping("/getStatTitleInfo")
    @ResponseBody
    public String getStatTitleInfo(@RequestParam(required = true)String startDate,
                                   @RequestParam(required = true)String endDate){
    public String getStatTitleInfo(@RequestParam(required = true) String startDate,
                                   @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(),startDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
        } catch (Exception e) {
@ -737,25 +780,26 @@ public class StatisticsController extends BaseController {
    /**
     * 获取签约折线图
     *
     * @param startDate
     * @param endDate
     * @param signType 0 签约,1 续签
     * @param type 0 按周,1 按月
     * @param signType  0 签约,1 续签
     * @param type      0 按周,1 按月
     * @return
     */
    @RequestMapping("/getSignCountLineByType")
    @ResponseBody
    public String getSignCountLineByType(@RequestParam(required = true)String startDate,
                                         @RequestParam(required = true)String endDate,
                                         @RequestParam(required = true)String signType,
                                         @RequestParam(required = true)String type){
    public String getSignCountLineByType(@RequestParam(required = true) String startDate,
                                         @RequestParam(required = true) String endDate,
                                         @RequestParam(required = true) String signType,
                                         @RequestParam(required = true) String type) {
        try {
            //判断是签约还是续签
            if("0".equals(signType)){
                return write(200, "查询成功", "data", statisticsService.getSignCountLineByType(getUID(),type,startDate,endDate));
            if ("0".equals(signType)) {
                return write(200, "查询成功", "data", statisticsService.getSignCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
            }else{
                return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType(getUID(),type,startDate,endDate));
            } else {
                return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
            }
        } catch (Exception e) {
@ -766,18 +810,19 @@ public class StatisticsController extends BaseController {
    /**
     * 获取咨询数和未回复数
     *
     * @param startDate
     * @param endDate
     * @param isNow 1 为当前;2为非当前
     * @param isNow     1 为当前;2为非当前
     * @return
     */
    @RequestMapping("/getReyStatbyTeam")
    @ResponseBody
    public String  getReyStatbyTeam(@RequestParam(required = true)String startDate,
                                    @RequestParam(required = true)String endDate,
                                    @RequestParam(required = true)String isNow){
    public String getReyStatbyTeam(@RequestParam(required = true) String startDate,
                                   @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(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeam("xh1D201703150222",startDate,endDate,isNow));
        } catch (Exception e) {
            error(e);
@ -787,16 +832,17 @@ public class StatisticsController extends BaseController {
    /**
     * 获取机构内服务排行
     *
     * @param startDate
     * @param endDate
     * @return
     */
    @RequestMapping("/getServiceRankingList")
    @ResponseBody
    public String getServiceRankingList(@RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate){
    public String getServiceRankingList(@RequestParam(required = true) String startDate,
                                        @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getServiceRankingList(getUID(),startDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getServiceRankingList(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getServiceRankingList("xh1D201703150222",startDate,endDate));
        } catch (Exception e) {
            error(e);
@ -805,20 +851,21 @@ public class StatisticsController extends BaseController {
    }
    /**
     *  获取平均值统计折线图
     * 获取平均值统计折线图
     *
     * @param startDate
     * @param endDate
     * @param type 0周,1月
     * @param type      0周,1月
     * @return
     */
    @RequestMapping("/getAvgLine")
    @ResponseBody
    public String getAvgLine(@RequestParam(required = true)String startDate,
                             @RequestParam(required = true)String endDate,
                             @RequestParam(required = true)String type){
    public String getAvgLine(@RequestParam(required = true) String startDate,
                             @RequestParam(required = true) String endDate,
                             @RequestParam(required = true) String type) {
        try {
            return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(),startDate,endDate,type));
           // return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
            return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
            // return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -827,11 +874,12 @@ public class StatisticsController extends BaseController {
    /**
     * 判断团队是否是团队长
     *
     * @return
     */
    @RequestMapping("/checkDoctorIsTeamLeder")
    @ResponseBody
    public String checkDoctorIsTeamLeder(){
    public String checkDoctorIsTeamLeder() {
        try {
            return write(200, "查询成功", "data", statisticsService.checkDoctorIsTeamleader(getUID()));
        } catch (Exception e) {
@ -842,20 +890,21 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队月或周咨询未回复和总数折线图
     * @param teamCode 团队id
     *
     * @param teamCode  团队id
     * @param startDate
     * @param endDate
     * @param type 0周,1月
     * @param type      0周,1月
     * @return
     */
    @RequestMapping("/getTeamConsultCount")
    @ResponseBody
    public String getTeamConsultCount(@RequestParam(required = true)String teamCode,
                                      @RequestParam(required = true)String startDate,
                                      @RequestParam(required = true)String endDate,
                                      @RequestParam(required = true)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));
            return write(200, "查询成功", "data", statisticsService.getTeamConsultCount(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -863,23 +912,24 @@ public class StatisticsController extends BaseController {
    }
    /**
     *  计算团队医生月或周咨询未回复和总数折线图
     * 计算团队医生月或周咨询未回复和总数折线图
     *
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type 0周,1月
     * @param type      0周,1月
     * @param doctor
     * @return
     */
    @RequestMapping("/getTeamDoctorConsultCount")
    @ResponseBody
    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){
    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.getTeamDoctorConsultCount(teamCode,startDate,endDate,type,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorConsultCount(teamCode, startDate, endDate, type, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -888,21 +938,22 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队内这成员,未回复数,总数,结束咨询数
     *
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param sort 0降序,1升序
     * @param sort      0降序,1升序
     * @return
     */
    @RequestMapping("/getMemberConsultList")
    @ResponseBody
    public String getMemberConsultList(@RequestParam(required = true)String teamCode,
                                       @RequestParam(required = true)String startDate,
                                       @RequestParam(required = true)String endDate,
                                       @RequestParam(required = true)String sort,
                                       @RequestParam(required = true)String sortType){
    public String getMemberConsultList(@RequestParam(required = true) String teamCode,
                                       @RequestParam(required = true) String startDate,
                                       @RequestParam(required = true) String endDate,
                                       @RequestParam(required = true) String sort,
                                       @RequestParam(required = true) String sortType) {
        try {
            return write(200, "查询成功", "data", statisticsService.getMemberConsultList(teamCode,startDate,endDate,sort,sortType));
            return write(200, "查询成功", "data", statisticsService.getMemberConsultList(teamCode, startDate, endDate, sort, sortType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -911,6 +962,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取Doctor咨询结果
     *
     * @param doctor
     * @param teamCode
     * @param startDate
@ -919,12 +971,12 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getDoctorConsultTitle")
    @ResponseBody
    public String getDoctorConsultTitle(@RequestParam(required = true)String doctor,
                                        @RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)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));
            return write(200, "查询成功", "data", statisticsService.getDoctorConsultTitle(doctor, teamCode, startDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -933,6 +985,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队随访量折线统计图
     *
     * @param type
     * @param teamCode
     * @param startDate
@ -941,12 +994,12 @@ public class StatisticsController extends BaseController {
     */
    @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){
    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));
            return write(200, "查询成功", "data", statisticsService.getTeamFollowupLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -955,13 +1008,13 @@ public class StatisticsController extends BaseController {
    @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){
    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));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorFollowupLine(teamCode, startDate, endDate, type, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -970,22 +1023,23 @@ public class StatisticsController extends BaseController {
    /**
     * 根据团队获取团队底下用户列表
     * @param sort 0为降序,1为升序
     *
     * @param sort      0为降序,1为升序
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param sortType 0为总数排序,1为增量排序,2为计划中排序
     * @param sortType  0为总数排序,1为增量排序,2为计划中排序
     * @return
     */
    @RequestMapping("/getDoctorTeamFolList")
    @ResponseBody
    public String getDoctorTeamFolList(@RequestParam(required = true)String sort,
                                       @RequestParam(required = true)String teamCode,
                                       @RequestParam(required = true)String startDate,
                                       @RequestParam(required = true)String endDate,
                                       @RequestParam(required = true)String sortType){
    public String getDoctorTeamFolList(@RequestParam(required = true) String sort,
                                       @RequestParam(required = true) String teamCode,
                                       @RequestParam(required = true) String startDate,
                                       @RequestParam(required = true) String endDate,
                                       @RequestParam(required = true) String sortType) {
        try {
            return write(200, "查询成功", "data", statisticsService.getDoctorTeamFolList(startDate,endDate,teamCode,sort,sortType));
            return write(200, "查询成功", "data", statisticsService.getDoctorTeamFolList(startDate, endDate, teamCode, sort, sortType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -994,6 +1048,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取医生随访头信息
     *
     * @param teamCode
     * @param doctor
     * @param startDate
@ -1002,12 +1057,12 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorFolTitle")
    @ResponseBody
    public String getTeamDoctorFolTitle(@RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String doctor,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate){
    public String getTeamDoctorFolTitle(@RequestParam(required = true) String teamCode,
                                        @RequestParam(required = true) String doctor,
                                        @RequestParam(required = true) String startDate,
                                        @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorFolTitle(teamCode,doctor,startDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorFolTitle(teamCode, doctor, startDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1016,6 +1071,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取待预约量团队统计则线图
     *
     * @param teamCode
     * @param type
     * @param startDate
@ -1024,12 +1080,12 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamResLine")
    @ResponseBody
    public String getTeamResLine(@RequestParam(required = true)String teamCode,
                                 @RequestParam(required = true)String type,
                                 @RequestParam(required = true)String startDate,
                                 @RequestParam(required = true)String endDate){
    public String getTeamResLine(@RequestParam(required = true) String teamCode,
                                 @RequestParam(required = true) String type,
                                 @RequestParam(required = true) String startDate,
                                 @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamResLine(teamCode,startDate,endDate,type));
            return write(200, "查询成功", "data", statisticsService.getTeamResLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1038,6 +1094,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队医生预约量团队统计则线图
     *
     * @param teamCode
     * @param type
     * @param startDate
@ -1047,13 +1104,13 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorResLine")
    @ResponseBody
    public String getTeamDoctorResLine(@RequestParam(required = true)String teamCode,
                                       @RequestParam(required = true)String type,
                                       @RequestParam(required = true)String startDate,
                                       @RequestParam(required = true)String endDate,
                                       @RequestParam(required = true)String doctor){
    public String getTeamDoctorResLine(@RequestParam(required = true) String teamCode,
                                       @RequestParam(required = true) String type,
                                       @RequestParam(required = true) String startDate,
                                       @RequestParam(required = true) String endDate,
                                       @RequestParam(required = true) String doctor) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResLine(teamCode,startDate,endDate,type,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResLine(teamCode, startDate, endDate, type, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1062,22 +1119,23 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队待预约量医生列表信息
     *
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param sort 0为降序,1为升序
     * @param sortType 0为按总数,1为按增数
     * @param sort      0为降序,1为升序
     * @param sortType  0为按总数,1为按增数
     * @return
     */
    @RequestMapping("/getTeamDoctorResList")
    @ResponseBody
    public String getTeamDoctorResList(@RequestParam(required = true)String teamCode,
                                       @RequestParam(required = true)String startDate,
                                       @RequestParam(required = true)String endDate,
                                       @RequestParam(required = true)String sort,
                                       @RequestParam(required = true)String sortType){
    public String getTeamDoctorResList(@RequestParam(required = true) String teamCode,
                                       @RequestParam(required = true) String startDate,
                                       @RequestParam(required = true) String endDate,
                                       @RequestParam(required = true) String sort,
                                       @RequestParam(required = true) String sortType) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResList(teamCode,startDate,endDate,sort,sortType));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResList(teamCode, startDate, endDate, sort, sortType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1086,6 +1144,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队医生待预信息
     *
     * @param teamCode
     * @param doctor
     * @param startDate
@ -1094,12 +1153,12 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorResTitle")
    @ResponseBody
    public String getTeamDoctorResTitle(@RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String doctor,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate){
    public String getTeamDoctorResTitle(@RequestParam(required = true) String teamCode,
                                        @RequestParam(required = true) String doctor,
                                        @RequestParam(required = true) String startDate,
                                        @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResTitle(teamCode,doctor,startDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorResTitle(teamCode, doctor, startDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1108,20 +1167,21 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队健康指导折线图
     *
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type 0周,1月
     * @param type      0周,1月
     * @return
     */
    @RequestMapping("/getTeamGuidLine")
    @ResponseBody
    public String getTeamGuidLine(@RequestParam(required = true)String teamCode,
                                  @RequestParam(required = true)String startDate,
                                  @RequestParam(required = true)String endDate,
                                  @RequestParam(required = true)String type){
    public String getTeamGuidLine(@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.getTeamGuidLine(teamCode,startDate,endDate,type));
            return write(200, "查询成功", "data", statisticsService.getTeamGuidLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1129,7 +1189,8 @@ public class StatisticsController extends BaseController {
    }
    /**
     *  获取团队医生则线图
     * 获取团队医生则线图
     *
     * @param teamCode
     * @param startDate
     * @param endDate
@ -1139,13 +1200,13 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorGuidLine")
    @ResponseBody
    public String getTeamDoctorGuidLine(@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){
    public String getTeamDoctorGuidLine(@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.getTeamDoctorGuidLine(teamCode,startDate,endDate,type,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorGuidLine(teamCode, startDate, endDate, type, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1154,6 +1215,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队指导总数List
     *
     * @param teamCode
     * @param startDate
     * @param endDate
@ -1163,13 +1225,13 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamGuidList")
    @ResponseBody
    public String getTeamGuidList(@RequestParam(required = true)String teamCode,
                                  @RequestParam(required = true)String startDate,
                                  @RequestParam(required = true)String endDate,
                                  @RequestParam(required = true)String sort,
                                  @RequestParam(required = true)String sortType){
    public String getTeamGuidList(@RequestParam(required = true) String teamCode,
                                  @RequestParam(required = true) String startDate,
                                  @RequestParam(required = true) String endDate,
                                  @RequestParam(required = true) String sort,
                                  @RequestParam(required = true) String sortType) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamGuidList(teamCode,startDate,endDate,sort,sortType));
            return write(200, "查询成功", "data", statisticsService.getTeamGuidList(teamCode, startDate, endDate, sort, sortType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1178,6 +1240,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取医生健康指导头部信息
     *
     * @param teamCode
     * @param doctor
     * @param startDate
@ -1186,12 +1249,12 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorGuiTitle")
    @ResponseBody
    public String getTeamDoctorGuiTitle(@RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String doctor,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate){
    public String getTeamDoctorGuiTitle(@RequestParam(required = true) String teamCode,
                                        @RequestParam(required = true) String doctor,
                                        @RequestParam(required = true) String startDate,
                                        @RequestParam(required = true) String endDate) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorGuiTitle(teamCode,doctor,startDate,endDate));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorGuiTitle(teamCode, doctor, startDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1200,20 +1263,21 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队健康教育折线统计
     *
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type 0按周 1按月
     * @param type      0按周 1按月
     * @return
     */
    @RequestMapping("/getTeamEduLine")
    @ResponseBody
    public String getTeamEduLine(@RequestParam(required = true)String teamCode,
                                 @RequestParam(required = true)String startDate,
                                 @RequestParam(required = true)String endDate,
                                 @RequestParam(required = true)String type){
    public String getTeamEduLine(@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.getTeamEduLine(teamCode,startDate,endDate,type));
            return write(200, "查询成功", "data", statisticsService.getTeamEduLine(teamCode, startDate, endDate, type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1222,6 +1286,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队健康
     *
     * @param teamCode
     * @param startDate
     * @param endDate
@ -1230,13 +1295,13 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamDoctorEduLine")
    @ResponseBody
    public String getTeamDoctorEduLine(@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){
    public String getTeamDoctorEduLine(@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.getTeamDoctorEduLine(teamCode,startDate,endDate,type,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduLine(teamCode, startDate, endDate, type, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1245,6 +1310,7 @@ public class StatisticsController extends BaseController {
    /**
     * 获取团队成员健康教育列表
     *
     * @param teamCode
     * @param startDate
     * @param endDate
@ -1254,13 +1320,13 @@ public class StatisticsController extends BaseController {
     */
    @RequestMapping("/getTeamEduList")
    @ResponseBody
    public String getTeamEduList(@RequestParam(required = true)String teamCode,
                                 @RequestParam(required = true)String startDate,
                                 @RequestParam(required = true)String endDate,
                                 @RequestParam(required = true)String sort,
                                 @RequestParam(required = true)String sortType){
    public String getTeamEduList(@RequestParam(required = true) String teamCode,
                                 @RequestParam(required = true) String startDate,
                                 @RequestParam(required = true) String endDate,
                                 @RequestParam(required = true) String sort,
                                 @RequestParam(required = true) String sortType) {
        try {
            return write(200, "查询成功", "data", statisticsService.getTeamEduList(teamCode,startDate,endDate,sort,sortType));
            return write(200, "查询成功", "data", statisticsService.getTeamEduList(teamCode, startDate, endDate, sort, sortType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1269,12 +1335,12 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/getTeamDoctorEduTitle")
    @ResponseBody
    public String getTeamDoctorEduTitle(@RequestParam(required = true)String teamCode,
                                        @RequestParam(required = true)String startDate,
                                        @RequestParam(required = true)String endDate,
                                        @RequestParam(required = true)String doctor){
    public String getTeamDoctorEduTitle(@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.getTeamDoctorEduTitle(teamCode,startDate,endDate,doctor));
            return write(200, "查询成功", "data", statisticsService.getTeamDoctorEduTitle(teamCode, startDate, endDate, doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1283,7 +1349,7 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/getDotorInfo")
    @ResponseBody
    public String getDotorInfo(String code){
    public String getDotorInfo(String code) {
        try {
            return write(200, "查询成功", "data", statisticsService.getDoctorInfo(code));
        } catch (Exception e) {
@ -1291,4 +1357,49 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取转签率和续签率
     * 前端:续签进展页面中用到
     * @param level 等级  4 市  3区  2社区 1团队
     * @param code  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code
     * @param year 年份 非比传
     * @return
     */
    @RequestMapping(value = "/getRenewPercentAndChangePercent", method = RequestMethod.GET)
    @ResponseBody
    public String getRenewPercentAndChangePercent(
            @RequestParam(required = true) String level,
            @RequestParam(required = true) String code,
            @RequestParam(required = false) String year) {
        try {
            return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(level, code,year));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取转签人数,转签原因分析,转签分布
     * 前端:签约数据分析
     * @param level 等级  4 市  3区  2社区 1团队
     * @param code  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code
     * @param year 年份 非比传
     * @return
     */
    @RequestMapping(value = "/getRenewAnalysis", method = RequestMethod.GET)
    @ResponseBody
    public String getRenewAnalysis(
            @RequestParam(required = true) String level,
            @RequestParam(required = true) String code,
            @RequestParam(required = false) String year) {
        try {
            return write(200, "查询成功", "data", statisticsService.getRenewAnalysis(level, code,year));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}