esb пре 8 година
родитељ
комит
a6f38e34a8

+ 43 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java

@ -244,6 +244,38 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动判断的任务
     *
     * @return
     */
    @ApiOperation(value = "启动清除缓存的任务")
    @RequestMapping(value = "startCleanCacheJob", method = RequestMethod.GET)
    public String startCleanCacheJob() {
        try {
            jobService.startCleanCacheJob();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止判断的任务
     *
     * @return
     */
    @ApiOperation(value = "停止清除缓存的任务")
    @RequestMapping(value = "stopCleanCacheJob", method = RequestMethod.GET)
    public String stopCleanCacheJob() {
        try {
            jobService.stopCleanCacheJob();
            return success("停止成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动所有任务
     *
@ -260,7 +292,17 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "清除緩存")
    @RequestMapping(value = "cleanCache", method = RequestMethod.GET)
    public String cleanCache() {
        try {
            jobService.cleanCache();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    //@RequestMapping(value = "startaaaa", method = RequestMethod.GET)
    public String startaaaa() {
        try {

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/SignPatientLabelInfoDao.java

@ -63,4 +63,6 @@ public interface SignPatientLabelInfoDao extends
     */
    @Query("update SignPatientLabelInfo a set a.labelName = ?1 where a.label= ?2 and a.labelType = '4' ")
    int updateLabelName(String labelName, String labelCode);
    List<SignPatientLabelInfo> findByLabelTypeAndStatus(String s, int i);
}

+ 23 - 26
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -4,6 +4,7 @@ import com.yihu.wlyy.statistics.dao.DoctorAdminTeamDao;
import com.yihu.wlyy.statistics.dao.HospitalDao;
import com.yihu.wlyy.statistics.dao.SignPatientLabelInfoDao;
import com.yihu.wlyy.statistics.dao.TownDao;
import com.yihu.wlyy.statistics.etl.cache.CachePool;
import com.yihu.wlyy.statistics.etl.model.ETLModel;
import com.yihu.wlyy.statistics.etl.model.FilterModel;
import com.yihu.wlyy.statistics.job.business.Constant;
@ -47,6 +48,8 @@ public class SignDataFilter {
    private DoctorAdminTeamDao doctorAdminTeamDao;
    @Autowired
    private SignPatientLabelInfoDao signPatientLabelInfoDao;
    @Autowired
    private CachePool cachePool;
    private int count=0;
    /**
@ -125,13 +128,8 @@ public class SignDataFilter {
        Long adminCount = new Long(0L);//统计到所有团队的数目
        Long errorCount=new Long(0L);//脏数据
        Boolean isAll=true;//是否统计失败
        int a1=0;
        int a2=0;
        for (int i=0;i<signFamilies.size();i++){
            SignFamily signFamily=signFamilies.get(i);
            if("1".equals(signFamily.getExpensesStatus())){
                a1++;
            }
            String orgCode = signFamily.getHospital();
            if(StringUtils.isEmpty(orgCode)) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据为空");
@ -196,9 +194,6 @@ public class SignDataFilter {
                errorCount++;
                continue;
            }
            if("1".equals(signFamilies.get(i).getExpensesStatus())){
                a2++;
            }
            //设置二级维度的Key
            String returnLevel2Key=getLevel2Key(level2Key,signFamily);
            String returnLevel3Key=getLevel3Key(level3Key,signFamily);
@ -327,9 +322,11 @@ public class SignDataFilter {
    private String getHealth(SignFamily signFamily) {
        String returnLevel2Key="0";//查找每个患者的健康分布标签
        List<SignPatientLabelInfo> signPatientLabelInfoList= signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(signFamily.getPatient(),"2",1);
        if(signPatientLabelInfoList!=null&&signPatientLabelInfoList.size()>0){
            returnLevel2Key=signPatientLabelInfoList.get(0).getLabel();
        try{
            returnLevel2Key=cachePool.getHealthGroup(signFamily.getPatient());
        }catch (Exception e){
            e.printStackTrace();
            return returnLevel2Key;
        }
        return returnLevel2Key;
    }
@ -349,31 +346,31 @@ public class SignDataFilter {
    }
    private String getGroup(SignFamily signFamily) {
        String returnLevel2Key;
        List<SignPatientLabelInfo> signPatientLabelInfoList= signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(signFamily.getPatient(),"1",1);
        StringBuffer returnLevel2KeyBuffer= new StringBuffer("1");
        if(signPatientLabelInfoList!=null&&signPatientLabelInfoList.size()>0){
            returnLevel2KeyBuffer=new StringBuffer(signPatientLabelInfoList.get(0).getLabel());
        String returnLevel2Key="";
        String group=cachePool.getPatientGroup(signFamily.getPatient());
        if(StringUtils.isEmpty(group)){
            group="0";
        }
        StringBuffer returnLevel2KeyBuffer=new StringBuffer(group);
        //如果是慢病组  区分65岁以上还是以下   65岁以上的慢病患者是7  65岁上下是2
        if("2".equals(returnLevel2KeyBuffer.toString())){
             Integer age=IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
            if(age>65){
                returnLevel2KeyBuffer=new StringBuffer("7");
            }
        }
//        if("2".equals(returnLevel2KeyBuffer.toString())){
//             Integer age=IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
//            if(age>65){
//                returnLevel2KeyBuffer=new StringBuffer("7");
//            }
//        }
        if("2".equals(returnLevel2KeyBuffer.toString())||"7".equals(returnLevel2KeyBuffer.toString())){
            String returnLevel2KeyTemp="0";
            boolean hasGXY=false;//有高血压
            boolean hasTNB=false;//糖尿病
            //得到患者的疾病标签
            signPatientLabelInfoList= signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(signFamily.getPatient(),"3",1);
            for (SignPatientLabelInfo signPatientLabelInfo:signPatientLabelInfoList){
                if("1".equals(signPatientLabelInfo.getLabel())){//判斷是否有高血壓
          List<String> diseaseList=  cachePool.getDiseaseGroup(signFamily.getPatient());
            for (String diseaseCode:diseaseList){
                if("1".equals(diseaseCode)){//判斷是否有高血壓
                    returnLevel2KeyTemp="4";
                    hasGXY=true;
                }
                if("2".equals(signPatientLabelInfo.getLabel())){//判斷是否有糖尿病
                if("2".equals(diseaseCode)){//判斷是否有糖尿病
                    returnLevel2KeyTemp="5";
                    hasTNB=true;
                }

+ 2 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignJob.java

@ -165,7 +165,8 @@ public class SignJob implements Job {
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);
            //保存数据 1 表示:从1开始循环 6表示:循环6次 3表示 2级维度是 3
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,7,3,1);
            // dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,7,3,1);
             dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,6,3,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());

+ 23 - 3
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -4,7 +4,9 @@ import com.yihu.wlyy.statistics.dao.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.statistics.dao.QuartzJobConfigDao;
import com.yihu.wlyy.statistics.dao.QuotaDao;
import com.yihu.wlyy.statistics.dao.SignFamilyDao;
import com.yihu.wlyy.statistics.etl.cache.CachePool;
import com.yihu.wlyy.statistics.job.business.QuartzHelper;
import com.yihu.wlyy.statistics.job.cache.CacheCleanJob;
import com.yihu.wlyy.statistics.job.check.CheckSignJob;
import com.yihu.wlyy.statistics.model.doctor.DoctorPatientGroupInfo;
import com.yihu.wlyy.statistics.model.job.QuartzJobConfig;
@ -42,6 +44,8 @@ public class JobService {
    @Autowired
    private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
    @Autowired
    private CachePool cachePool;
    @Transactional
    public void stopById(String id) throws Exception {
@ -153,7 +157,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
                    Thread.sleep(12000L);
                    Thread.sleep(20000L);
                }
            }
        }
@ -195,7 +199,7 @@ public class JobService {
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
                Thread.sleep(12000L);
                Thread.sleep(20000L);
            }
        }
@ -305,7 +309,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
                    Thread.sleep(12000L);
                    Thread.sleep(20000L);
                }
            }
    }
@ -372,4 +376,20 @@ public class JobService {
            productDataByOneDayWithId(getYesterday(i,startDate),id);
        }
    }
    public void startCleanCacheJob() throws  Exception {
        if(!quartzHelper.isExistJob(CacheCleanJob.jobKey)){
            quartzHelper.addJob(CacheCleanJob.class,CacheCleanJob.cron,CacheCleanJob.jobKey,new HashMap<>());
        }
    }
    public void stopCleanCacheJob()throws  Exception  {
        if(quartzHelper.isExistJob(CacheCleanJob.jobKey)){
            quartzHelper.removeJob(CacheCleanJob.jobKey);
        }
    }
    public void cleanCache() {
        CachePool.cleanAllCache();
    }
}