浏览代码

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

huangwenjie 7 年之前
父节点
当前提交
12c0551ce2

+ 23 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -13,6 +13,7 @@ import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.statistics.WlyySignFamilyCodeDao;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -39,6 +40,7 @@ public class TaskService {
    private Logger logger = LoggerFactory.getLogger(TaskService.class);
    private static String URL = "health:blank:url";
    private static String STEP = "health:blank:step";
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
@ -73,6 +75,7 @@ public class TaskService {
        }
    }
    /**
     * 查看活动列表
     *
@ -139,7 +142,7 @@ public class TaskService {
        }
        Patient patient = patientDao.findByCode(patientId);
        String unionId = object.getString("unionId");
        if(patient.getUnionid() != null){
        if(!StringUtils.isNoneBlank(patient.getUnionid())){
            throw new Exception("该居民已报名!");
        }else {
            Patient patient1 = patientDao.findByUnionid(unionId);
@ -149,6 +152,7 @@ public class TaskService {
            patient.setUnionid(unionId);
            patientDao.save(patient);
        }
        object.put("unionId",unionId);
        object.put("patientIdcard",patient.getIdcard());
        object.put("patientOpenid",patient.getOpenid());
@ -236,4 +240,22 @@ public class TaskService {
        return JSONObject.parseObject(response);
    }
    /**
     * 获取步数 50、100、500
     *
     * @return
     */
    public JSONObject getStepNumber(){
        String step = redisTemplate.opsForValue().get(STEP);
        String step1 = systemDictDao.findByDictNameAndCode("HEALTH_STEP","HEALTH_STEP");
        JSONObject jsonObject = JSONObject.parseObject(step1);
        if (step1 != null && step.equalsIgnoreCase(step1)){
            return jsonObject;
        }else {
            redisTemplate.opsForValue().set(STEP,step1);
            return jsonObject;
        }
    }
}

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/AccountController.java

@ -124,4 +124,21 @@ public class AccountController extends BaseController {
            return error(-1,e.getMessage());
        }
    }
    /**
     * 获取缓存步数
     *
     * @return
     */
    @RequestMapping(value = "/getStepNumber",method = RequestMethod.POST)
    @ApiOperation("获取步数")
    public String getStepNumber(){
        try {
            return write(200,"获取成功","data",taskService.getStepNumber());
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
}