Quellcode durchsuchen

Merge branch 'dev' of wangzhinan/wlyy2.0 into dev

huangwenjie vor 6 Jahren
Ursprung
Commit
558619b8e0

+ 24 - 13
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActiveRecordController.java

@ -1,17 +1,19 @@
package com.yihu.jw.controller;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.health.bank.ActiveRecordDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.ActiveRecordService;
import com.yihu.jw.service.TaskPatientDtailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@ -23,21 +25,30 @@ import org.springframework.web.bind.annotation.RestController;
public class ActiveRecordController extends EnvelopRestController {
    @Autowired
    private ActiveRecordService activeRecordService;
    @Autowired
    private TaskPatientDtailService taskPatientDtailService;
    @PostMapping(value = HealthBankMapping.healthBank.createActiveRecord)
    @ApiOperation(value = "添加健康银行活动活跃记录")
    public Envelop<ActiveRecordDO> addActiveRecord(@ApiParam(name = "saasId",value = "saasId")@RequestParam(value = "saasId",required = false)String saasId,
                                                   @ApiParam(name = "taskId",value = "任务id")@RequestParam(value = "taskId",required = false)String taskId,
                                                   @ApiParam(name = "activityId",value = "活动的id")@RequestParam(value = "activityId",required = false)String activityId,
                                                   @ApiParam(name = "originalStatus",value = "原有状态")@RequestParam(value = "originalStatus",required = true)Integer originalStatus,
                                                   @ApiParam(name = "currentStatus",value = "当前状态")@RequestParam(value = "currentStatus",required = true)Integer currentStatus,
                                                   @ApiParam(name = "patientId",value = "居民code")@RequestParam(value = "patientId",required = true)String patientId){
    public Envelop<ActiveRecordDO> addActiveRecord(@RequestBody JSONObject object){
        try{
            ActiveRecordDO activeRecordDO = activeRecordService.insert(saasId,taskId,activityId,originalStatus,currentStatus,patientId);
            if(activeRecordDO!=null){
                return Envelop.getSuccess("添加成功",activeRecordDO);
            }else{
                return Envelop.getError("添加失败");
            String openId = object.getString("patientOpenid");
            String idCard = object.getString("patientIdcard");
            String unionId = object.getString("unionId");
            String taskCode = object.getString("taskCode");
            Integer originalStatus = object.getInteger("originalStatus");
            Integer currentStatus = object.getInteger("currentStatus");
            String patientId = object.getString("patientId");
            TaskPatientDetailDO taskPatientDetailDO = taskPatientDtailService.selectByPatientId(openId,idCard,unionId,taskCode);
            if (taskPatientDetailDO == null){
                return Envelop.getError("尚未报名!");
            }else {
                ActiveRecordDO activeRecordDO = activeRecordService.insert(taskPatientDetailDO.getSaasId(),taskPatientDetailDO.getTaskId(),taskPatientDetailDO.getActivityId(),originalStatus,currentStatus,patientId);
                if(activeRecordDO!=null){
                    return Envelop.getSuccess("添加成功",activeRecordDO);
                }else{
                    return Envelop.getError("添加失败");
                }
            }
        }catch (Exception e){
            return Envelop.getError("添加失败");

+ 16 - 1
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskPatientDtailService.java

@ -110,5 +110,20 @@ public class TaskPatientDtailService extends BaseJpaService<TaskPatientDetailDO,
        return envelop;
    }
    /**
     * 获取参与活动信息
     *
     * @param openId 微信id
     * @param idCard 身份证号
     * @param unionId
     * @param taskCode 任务标识
     * @return
     */
    public TaskPatientDetailDO selectByPatientId(String openId,String idCard,String unionId,String taskCode){
        String sql ="select * from wlyy_health_bank_task_patient_detail where patient_openid = '"+openId+"'" +
                " AND patient_idcard = '"+idCard+"' AND union_id ='"+unionId+"' AND task_id = " +
                "(select id from wlyy_health_bank_task where task_code = '"+taskCode+"' )";
        List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
        return taskPatientDetailDOS.get(0);
    }
}