|
@ -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("添加失败");
|