Browse Source

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

liuwenbin 7 năm trước cách đây
mục cha
commit
2e2dee8a9b

+ 45 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -823,4 +823,49 @@ public class DataHandingService {
        sqlStr = sqlList.toArray(sqlStr);
        jdbcTemplate.batchUpdate(sqlStr);
    }
    /**
     * 24H干预指导率数据清洗
     */
    @Transactional(rollbackFor = Exception.class)
    public void abnormalSignRinse() throws Exception{
        int index =0;
        int a =0;
        while (true){
            a = index*1000;
            String sql = "select i.czrq,i.id,i.user as patient,m.receiver as doctor from wlyy.wlyy_message m " +
                    " LEFT JOIN device.wlyy_patient_health_index i on m.tz_code=i.id " +
                    " where m.type =2 and m.tz_type in ('1','2') and m.create_time>='2018-07-01 00:00:00' and m.create_time<='2018-09-26 16:00:00'  " +
                    " and i.manage_result=2 limit "+a+",1000";
            List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql);
            Date tzCzrq = null;
            Date guidanceCzrq =null;
            String guidanceSql = "";
            String patient ="";
            String doctor ="";
            long h24 = 1000*60*60*24+10;
            String tzCzrqStr ="";
            String guidanceCzrqStr ="";
            String tempSql = "";
            for(Map<String,Object> one: resultList){
                tzCzrq = (Date)one.get("czrq");
                guidanceCzrq = new Date(tzCzrq.getTime()+h24);
                tzCzrqStr = DateUtil.dateToStrLong(tzCzrq);
                guidanceCzrqStr = DateUtil.dateToStrLong(guidanceCzrq);
                patient = one.get("patient")+"";
                doctor = one.get("doctor")+"";
                guidanceSql = " select * from wlyy.wlyy_patient_health_guidance where patient='"+patient+"' and doctor='"+doctor+"' and czrq>='"+tzCzrqStr+"' and czrq<='"+guidanceCzrqStr+"'";
                List<Map<String,Object>> resultList2 = jdbcTemplate.queryForList(guidanceSql);
                if(resultList2!=null&&resultList2.size()>0){//有效干预
                    tempSql = "update device.wlyy_patient_health_index set manage_result=1 where id="+one.get("id");
                    jdbcTemplate.execute(tempSql);
                }
            }
            if(resultList.size()<1000){
                return;
            }
            index++;
        }
    }
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -403,4 +403,18 @@ public class DataHandlingController extends BaseController {
            return write(-1,"清洗数据失败!");
        }
    }
    @RequestMapping(value = "/abnormalSignRinse",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("24H干预指导率数据清洗")
    public String abnormalSignRinse(){
        try{
            dataHandingService.abnormalSignRinse();
            return write(200,"清洗数据成功");
        }catch (Exception e){
            System.out.println(e.getMessage());
            e.printStackTrace();
            return write(-1,"清洗数据失败!");
        }
    }
}