Parcourir la source

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

trick9191 il y a 7 ans
Parent
commit
a192f05f2c

+ 159 - 4
common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java

@ -14,7 +14,7 @@ import org.hibernate.annotations.GenericGenerator;
@Table(name = "wlyy_job_config")
public class QuartzJobConfig implements java.io.Serializable {
    private String id;
    /*private String id;
    private String quotaId;//指标id
    private String jobName;//任务名称
    private String jobInfo;//任务描述
@ -24,12 +24,12 @@ public class QuartzJobConfig implements java.io.Serializable {
    private String status;//1 启动 0停止
    private String del;//是否删除 1正常 0删除
    /** minimal constructor */
    *//** minimal constructor *//*
    public QuartzJobConfig() {
    }
    /** full constructor */
    *//** full constructor *//*
    public QuartzJobConfig(String jobName, String jobInfo, String jobType,
                           String jobClass, String quartzCron, String status) {
        this.jobName = jobName;
@ -123,5 +123,160 @@ public class QuartzJobConfig implements java.io.Serializable {
    public void setDel(String del) {
        this.del = del;
    }
    }*/
    private String id;
	private String quotaId;//指标id
	private String jobName;//任务名称
	private String jobInfo;//任务描述
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String jobClass;//任务执行的class
	private String quartzCron;//quartz表达式
	private String status;//1 启动 0停止
	private String del;//是否删除 1正常 0删除
	private String sql;
	private String sqlCount;
	private String sqlDay;
	private String sqlYear;
	private String cacheKey;//缓存的key
	/** minimal constructor */
	public QuartzJobConfig() {
	}
	/** full constructor */
	public QuartzJobConfig(String jobName, String jobInfo, String jobType,
                           String jobClass, String quartzCron, String status) {
		this.jobName = jobName;
		this.jobInfo = jobInfo;
		this.jobType = jobType;
		this.jobClass = jobClass;
		this.quartzCron = quartzCron;
		this.status = status;
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Column(name = "job_name", length = 50)
	public String getJobName() {
		return this.jobName;
	}
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}
	@Column(name = "job_info", length = 200)
	public String getJobInfo() {
		return this.jobInfo;
	}
	public void setJobInfo(String jobInfo) {
		this.jobInfo = jobInfo;
	}
	@Column(name = "job_type", length = 10)
	public String getJobType() {
		return this.jobType;
	}
	public void setJobType(String jobType) {
		this.jobType = jobType;
	}
	@Column(name = "job_class", length = 200)
	public String getJobClass() {
		return jobClass;
	}
	public void setJobClass(String jobClass) {
		this.jobClass = jobClass;
	}
	@Column(name = "quartz_cron", length = 200)
	public String getQuartzCron() {
		return this.quartzCron;
	}
	public void setQuartzCron(String quartzCron) {
		this.quartzCron = quartzCron;
	}
	@Column(name = "status", length = 1)
	public String getStatus() {
		return this.status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@Column(name = "quota_id", length = 50)
	public String getQuotaId() {
		return quotaId;
	}
	public void setQuotaId(String quotaId) {
		this.quotaId = quotaId;
	}
	@Column(name = "del", length = 1)
	public String getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
	public String getSql() {
		return sql;
	}
	public void setSql(String sql) {
		this.sql = sql;
	}
	public String getSqlCount() {
		return sqlCount;
	}
	public void setSqlCount(String sqlCount) {
		this.sqlCount = sqlCount;
	}
	public String getSqlDay() {
		return sqlDay;
	}
	public void setSqlDay(String sqlDay) {
		this.sqlDay = sqlDay;
	}
	public String getSqlYear() {
		return sqlYear;
	}
	public void setSqlYear(String sqlYear) {
		this.sqlYear = sqlYear;
	}
	public String getCacheKey() {
		return cacheKey;
	}
	public void setCacheKey(String cacheKey) {
		this.cacheKey = cacheKey;
	}
}

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

@ -1924,9 +1924,94 @@ public class StatisticsESService {
        }
        return resultMaps;
    }
    public JSONObject getRenewPercentAndChangePercent(String renewIndex, String level, String code, String year, String lowCode) {
        return null;
    public JSONObject getRenewPercentAndChangePercent(Integer level, String area, String year, String lowCode) {
        JSONObject jo = new JSONObject();
        String switchIndex = "";//转签index
        String signIndex ="1";//签约index
        String renewIndex ="";//续签index
        String date = year + "-06-30";
        try{
            if (level == 5) {
                //团队的转签
                if(StringUtils.isNoneBlank(lowCode)){
                    //服务类型维度
                    switchIndex = "55";
                    renewIndex = "52";
                }else{
                    switchIndex = "35";
                    renewIndex = "42";
                }
            } else if (level == 4) {
                //社区的转签
                if(StringUtils.isNoneBlank(lowCode)){
                    //服务类型维度
                    switchIndex = "56";
                    renewIndex = "53";
                }else{
                    switchIndex = "35";
                    renewIndex = "43";
                }
            } else {
                //区和市的转签
                if(StringUtils.isNoneBlank(lowCode)){
                    //服务类型维度
                    switchIndex = "57";
                    renewIndex = "54";
                }else{
                    switchIndex = "35";
                    renewIndex = "44";
                }
            }
            String timeKey = elasticsearchUtil.getQuotaTime();
            SaveModel renewSaveModel = new SaveModel();
            SaveModel switchSaveModel = new SaveModel();
            SaveModel signSaveModel = new SaveModel();
            if (StringUtils.isNotBlank(lowCode)){
                //续签量
                renewSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level,renewIndex,"2",lowCode);
                //转签量
                switchSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey,area,level,switchIndex,"2",lowCode);
            }else{
                //续签量
                renewSaveModel=elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level,renewIndex,"2");
                //转签量
                switchSaveModel=elasticsearchUtil.findOneDateQuotaLevel0(timeKey,area,level,renewIndex,"2");
            }
            int renewNum = renewSaveModel.getResult2();
            int switchNum = switchSaveModel.getResult2();
            //根据年度获取去年的签约数 签约指标是1
            if(StringUtils.isNoneBlank(lowCode)){
                if("3".equals(lowCode)){
                    //老年人
                    lowCode = "3";
                }else if("4".equals(lowCode)){
                    //高血压
                    lowCode = "1";
                }else if("5".equals(lowCode)){
                    //糖尿病
                    lowCode = "2";
                }
                signIndex = "17";
                signSaveModel=elasticsearchUtil.findOneDateQuotaLevel1(date,area,level,signIndex,"2",lowCode);
            }else{
                signSaveModel=elasticsearchUtil.findOneDateQuotaLevel0(date,area,level,signIndex,"2");
            }
            //签约量
            int signNum = signSaveModel.getResult2();
            jo.put("yesterYearSign", signNum);//去年的签约量
            jo.put("thisYearRenew", renewNum);//今年的续签量
            jo.put("thisYearSwithch", switchNum);//今年的转签量
            jo.put("renewRange", getRange(renewNum, signNum, 2));//续签率  50.00%
            jo.put("switchRange", getRange(switchNum, renewNum, 2));//转签率
        }catch (Exception e){
            e.getMessage();
            jo.put("status","0");
            jo.put("error","查询失败"+e.getMessage());
            return jo;
        }
        return jo;
    }
    public JSONObject getRenewAnalysis(String switchIndex, String switchIndexReson, String signIn, String signOut, String level, String code) throws Exception{

+ 35 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -7,7 +7,6 @@ import com.yihu.wlyy.util.Constant;
import com.yihu.wlyy.util.ValueComparator;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -1370,9 +1369,9 @@ public class EsStatisticsController extends BaseController {
     * 获取转签率和续签率
     * 前端:续签进展
     *
     * @param index 42,43,44 (52,53,54 服务类型维度)
     * //@param index 42,43,44 (52,53,54 服务类型维度)
     * @param level 等级  4 市  3区  2社区 1团队
     * @param code  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code
     * @param area  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code
     * @param year  年份 非比传
     * @param lowCode 服务类型维度code(老年人3,高血压4,糖尿病5)
     * @return
@ -1380,14 +1379,15 @@ public class EsStatisticsController extends BaseController {
    @RequestMapping(value = "/getRenewPercentAndChangePercent", method = RequestMethod.GET)
    @ResponseBody
    public String getRenewPercentAndChangePercent(
            @RequestParam(required = true) String index,//续签index
            @RequestParam(required = true) String level,
            @RequestParam(required = true) String code,
            //@RequestParam(required = true) String index,//续签index
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String area,
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String lowCode) {
        try {
            return write(200, "查询成功", "data", statisticsESService.getRenewPercentAndChangePercent(index,level, code, year,lowCode));
            //return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(index,level, code, year,lowCode));
            return write(200,"查询成功!","data",statisticsESService.getRenewPercentAndChangePercent(changeLevel(level),area,year,lowCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1502,4 +1502,32 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 将参数转换成需要的SaveModel里的标识
     * @param level 等级  4 市  3区  2社区 1团队
     * @return
     * @author zhangdan
     * @time 2017-10-18
     */
    public int changeLevel(int level){
        int resultLevel =0;
        if (level==1){
            //团队转成SaveModel里的标识
            resultLevel = Integer.valueOf(SaveModel.teamLevel);
        }else if(level==2){
            //社区转成SaveModel里的标识
            resultLevel = Integer.valueOf(SaveModel.OrgLevel);
        }else if (level ==3){
            //区转成SaveModel里的标识
            resultLevel = Integer.valueOf(SaveModel.townLevel);
        }else if (level==4){
            //市转成SaveModel里的标识
            resultLevel = Integer.valueOf(SaveModel.cityLevel);
        }
        if(resultLevel==0){
            resultLevel = level;
        }
        return  resultLevel;
    }
}