Selaa lähdekoodia

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

humingfen 7 vuotta sitten
vanhempi
commit
d51618fac4

+ 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;
        }
    }
}

+ 7 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -19,6 +19,7 @@ import com.yihu.wlyy.service.app.device.PatientDeviceLogService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.service.app.health.bank.TaskService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
@ -86,6 +87,8 @@ public class PatientDeviceController extends BaseController {
    private SystemDictDao systemDictDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private TaskService taskService;
    @Value("${yihu.yihu_OpenPlatform_url}")
    private String url;
@ -246,8 +249,8 @@ public class PatientDeviceController extends BaseController {
            //修改设备表中{"1":"0", "2":"0"}的绑定次数 和其他绑定信息
            deviceDetailService.updateAfterBinding(device,new Date(),flag);
            SignFamily signFamily = signFamilyDao.findSignByPatient(patient.getCode());
            String flagStr ="";
            if (flag && "350205".equals(signFamily.getHospital().substring(0,6))){
                String flagStr ="";
                if ("1".equals(device.getCategoryCode())){
                    flagStr="GLU_BIND";
                }else if ("2".equals(device.getCategoryCode())){
@ -273,19 +276,9 @@ public class PatientDeviceController extends BaseController {
            }
            //活动的活跃度
            if (flag){
                String url1 = systemDictDao.findByDictNameAndCode("HEALTH_BANK_URL","HEALTH_BANK_URL");
                String url = url1 + "/createActiveRecord";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("originalStatus", "0"));
                params.add(new BasicNameValuePair("currentStatus","1"));
                params.add(new BasicNameValuePair("patientId",patient.getCode()));
                String response = httpClientUtil.post(url,params,"UTF-8");
                if (StringUtils.isNotEmpty(response)){
                    com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(response);
                    if (!"200".equals(jsonObject.getString("status"))){
                        logger.info("添加活跃度失败!");
                    }
                }
                com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
                jsonObject.put("patientId",patient.getCode());
                jsonObject.put("taskCode",flagStr);
            }
            try {
                String openId = patient.getOpenid();

+ 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());
        }
    }
}