فهرست منبع

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

liuwenbin 7 سال پیش
والد
کامیت
d8b029ede1

+ 15 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/CreditLogService.java

@ -19,6 +19,7 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -43,6 +44,7 @@ public class CreditLogService {
    private Logger logger = LoggerFactory.getLogger(CreditLogService.class);
    private static String URL = "health:blank:url";
    private static String STEP = "health:blank:step";
    //    private String baseUrl = "http://192.168.131.24:8088/svr-iot/";
    @Autowired
@ -715,10 +717,14 @@ public class CreditLogService {
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
        String imptimeBegin = sdf.format(cal.getTime());
        List<String> timeList = new ArrayList<>();
        timeList.add(imptimeBegin);
        if (sdf.format(cal.getTime()).compareTo(sdf.format(sdf.parse("2018-08-01")))>=0){
            timeList.add(imptimeBegin);
        }
        for (int i =0;i<6;i++){
            cal.add(Calendar.DATE,1);
            timeList.add(sdf.format(cal.getTime()));
            if(sdf.format(cal.getTime()).compareTo(sdf.format(sdf.parse("2018-08-01")))>=0){
                timeList.add(sdf.format(cal.getTime()));
            }
        }
        logger.info("一周的日期:"+timeList.toString());
        StringBuffer buffer = new StringBuffer();
@ -729,8 +735,14 @@ public class CreditLogService {
        buffer.deleteCharAt(buffer.length()-1);
        buffer.append(")");
        logger.info("组装的sql"+buffer);
        String step = redisTemplate.opsForValue().get(STEP);
        if (StringUtils.isEmpty(step)){
            throw new Exception("获取步数失败!");
        }
        JSONObject object1 = JSONObject.parseObject(step);
        int step1 = object1.getInteger("step1");
        String sql = "select count(1) as total from (select * FROM wlyy_patient_aim_sports where DATE_FORMAT(create_time,'%Y-%m-%d') IN "+buffer +" and patientcode = '"+patientId+"'"+
                ") pas where pas.daily_step_count > 600";
                ") pas where pas.daily_step_count > "+step1;
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){