|
|
@@ -2,6 +2,8 @@ package com.nb.app.assistant.controller;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.druid.sql.visitor.functions.Bin;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.nb.app.assistant.api.enums.ApplyEnum;
|
|
|
import com.nb.app.assistant.controller.vo.InviteCodePatientVo;
|
|
|
@@ -12,6 +14,8 @@ import com.nb.app.assistant.service.LocalAssistantUserBindService;
|
|
|
import com.nb.app.assistant.service.dto.AssistPatientResult;
|
|
|
import com.nb.app.assistant.service.dto.EditAssistBindDto;
|
|
|
import com.nb.auth.utils.SecurityUtil;
|
|
|
+import com.nb.core.annotation.Log;
|
|
|
+import com.nb.core.enums.UserPlatformEnum;
|
|
|
import com.nb.core.exception.CustomException;
|
|
|
import com.nb.core.result.R;
|
|
|
import com.nb.web.api.feign.IPatientClient;
|
|
|
@@ -113,8 +117,10 @@ public class PatientOperationController {
|
|
|
* @return R
|
|
|
*/
|
|
|
@PostMapping("/save")
|
|
|
+ @Log(title = "发起看护人申请",userPlatform = UserPlatformEnum.APP_ASSIST)
|
|
|
@ApiOperation(value = "发起添加看护人申请")
|
|
|
public R<Boolean> saveMonitor(@RequestBody MonitorAddVo vo){
|
|
|
+ log.info("发起看护申请{}", JSONUtil.toJsonStr(vo));
|
|
|
if(ApplyEnum.INVITE_CODE.equals(vo.getApplyType())&& StrUtil.isEmpty(vo.getInviteCode())){
|
|
|
throw new CustomException("邀请码不能为空");
|
|
|
}
|
|
|
@@ -127,7 +133,7 @@ public class PatientOperationController {
|
|
|
if(vo.getManageType()==null){
|
|
|
vo.setManageType(patientClient.getManageType(vo.getPatientId()));
|
|
|
}
|
|
|
- judgePatient(vo.getPatientId());
|
|
|
+ judgePatient(vo.getPatientId(),String.valueOf(SecurityUtil.getId()));
|
|
|
judgeUser();
|
|
|
AssistantUserBindEntity resource = BeanUtil.copyProperties(vo, AssistantUserBindEntity.class);
|
|
|
return R.success(userBindService.save(resource));
|
|
|
@@ -140,7 +146,7 @@ public class PatientOperationController {
|
|
|
if(inviteCodeResult.getResult()==null){
|
|
|
throw new CustomException("系统繁忙,请稍后重试");
|
|
|
}
|
|
|
- judgePatient(inviteCodeResult.getResult().getPatientId());
|
|
|
+// judgePatient(inviteCodeResult.getResult().getPatientId());
|
|
|
judgeUser();
|
|
|
InviteCodePatientVo result = BeanUtil.copyProperties(inviteCodeResult.getResult(), InviteCodePatientVo.class);
|
|
|
result.setTenantId(inviteCodeResult.getTenantId());
|
|
|
@@ -197,17 +203,19 @@ public class PatientOperationController {
|
|
|
* @author lifang
|
|
|
* @date 2022/8/12 14:45
|
|
|
* @param patientId
|
|
|
+ * @param
|
|
|
* @return void
|
|
|
*/
|
|
|
- private void judgePatient(String patientId){
|
|
|
+ private void judgePatient(String patientId, String assistId){
|
|
|
AssistantUserBindEntity userBind = userBindService.getOne(new QueryWrapper<AssistantUserBindEntity>()
|
|
|
.lambda()
|
|
|
- .eq(AssistantUserBindEntity::getStatus, BindEnum.SUCCESS)
|
|
|
+ .eq(AssistantUserBindEntity::getAssistId,assistId)
|
|
|
+ .in(AssistantUserBindEntity::getStatus, BindEnum.WAITING, BindEnum.SUCCESS)
|
|
|
.eq(AssistantUserBindEntity::getPatientId, patientId)
|
|
|
);
|
|
|
|
|
|
if(userBind!=null){
|
|
|
- throw new CustomException("该病号已被他人监护");
|
|
|
+ throw new CustomException("您已对该病号发起看护请求,请勿重复操作");
|
|
|
}
|
|
|
}
|
|
|
|