Browse Source

feat:[试验管理][试验方法管理]关闭

master
HanLong 1 month ago
parent
commit
461522a53b
9 changed files with 83 additions and 19 deletions
  1. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java
  2. +12
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java
  3. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java
  4. +6
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java
  5. +1
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java
  6. +5
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java
  7. +2
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java
  8. +32
    -18
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java
  9. +8
    -0
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMethodMapper.xml

+ 7
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java View File

@ -72,6 +72,13 @@ public class StudyMethodController extends BaseController {
return AjaxResult.success();
}
@PostMapping("/close")
public AjaxResult close(@RequestBody StudyMethodForm form) {
form.setQmrId(SecurityUtils.getUserId());
studyMethodService.close(form);
return AjaxResult.success();
}
@PostMapping("/read")
@RequiresPermissions("business:studyMethod:read")
public AjaxResult read(@RequestBody @Validated StudyMethodReadForm form) {

+ 12
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyMethod.java View File

@ -36,7 +36,10 @@ public class StudyMethod extends MpBaseEntity
/** 方法归属人名称 */
private String userMc;
/** 状态 */
/** 是否关闭状态 1-已关闭 10-未关闭 */
private Integer status;
/** 状态 */
@TableField(exist = false)
private Integer zt;
@ -113,4 +116,12 @@ public class StudyMethod extends MpBaseEntity
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodForm.java View File

@ -9,6 +9,8 @@ import javax.validation.constraints.NotNull;
*/
public class StudyMethodForm {
private Long id;
/** 所属试验id */
@NotNull(message = "请选择所属试验")
private Long studyId;
@ -99,4 +101,12 @@ public class StudyMethodForm {
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

+ 6
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMethodMapper.java View File

@ -26,4 +26,10 @@ public interface StudyMethodMapper extends BaseMapper
*/
List<StudyMethod> queryList(@Param("ew") Wrapper<StudyMethod> queryWrapper, @Param("qmrId") Long qmrId);
/**
* 获取未读试验方法列表
* @param queryWrapper
* @return
*/
List<StudyMethod> queryUnreadList(@Param("ew") Wrapper<StudyMethod> queryWrapper);
}

+ 1
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodReadService.java View File

@ -21,4 +21,5 @@ public interface IStudyMethodReadService extends IService
* @return 已读列表
*/
List<StudyMethodRead> queryList(Long studyMethodId);
}

+ 5
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java View File

@ -45,4 +45,9 @@ public interface IStudyMethodService extends IService
*/
HashMap<String,Object> checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId);
/**
* 关闭
* @param form
*/
void close(StudyMethodForm form);
}

+ 2
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodReadServiceImpl.java View File

@ -2,7 +2,9 @@ package com.hxhq.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxhq.business.domain.Bacteria;
import com.hxhq.business.domain.StudyMethod;
import com.hxhq.business.domain.StudyMethodRead;
import com.hxhq.business.form.study.StudyMethodForm;

+ 32
- 18
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java View File

@ -7,9 +7,12 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.business.domain.Bacteria;
import com.hxhq.business.domain.Study;
import com.hxhq.business.domain.StudyMethodRead;
import com.hxhq.business.dto.select.DeptUserTreeDto;
import com.hxhq.business.enums.NormalEnum;
import com.hxhq.business.enums.study.StudyMethodStatusEnum;
import com.hxhq.business.enums.study.StudyTypeEnum;
import com.hxhq.business.form.study.StudyMethodForm;
@ -118,6 +121,7 @@ public class StudyMethodServiceImpl extends ServiceImpl
BeanUtils.copyProperties(form, studyMethod);
studyMethod.setUserId(qmr.getUserId());
studyMethod.setUserMc(qmr.getNickName());
studyMethod.setStatus(NormalEnum.yes.getValue());
this.save(studyMethod);
StudyMethodRead studyMethodRead = new StudyMethodRead();
@ -182,34 +186,44 @@ public class StudyMethodServiceImpl extends ServiceImpl
if(depts.stream().map(o->o.getId()).collect(Collectors.toList()).contains(String.valueOf(userId)) && !study.getLeader().equals(userId)){
//排除sd
LambdaQueryWrapper<StudyMethodRead> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StudyMethodRead::getQmrId, userId)
.eq(StudyMethodRead::getStudyId, studyId);
QueryWrapper<StudyMethod> queryWrapper = Wrappers.query();
queryWrapper.eq("del_flag", 0)
.eq("status", NormalEnum.yes.getValue())
.eq("study_id", studyId);
if(studySubjectId != null) {
queryWrapper.eq(StudyMethodRead::getStudySubjectId, studySubjectId);
queryWrapper.eq("study_subject_id", studySubjectId);
queryWrapper.and(p -> p.apply("(id NOT IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_id = {1} AND study_subject_id = {2}))"
, SecurityUtils.getUserId(), studyId, studySubjectId));
} else {
queryWrapper.and(p -> p.apply("(id NOT IN (SELECT study_method_id FROM t_study_method_read WHERE del_flag = 0 AND qmr_id = {0} AND study_id = {1}))"
, SecurityUtils.getUserId(), studyId));
}
long readCount = studyMethodReadService.count(queryWrapper);
LambdaQueryWrapper<StudyMethod> studyMethodLambdaQueryWrapper = new LambdaQueryWrapper<>();
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudyId, studyId);
if(studySubjectId != null) {
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId);
}
List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper);
if(readCount != list.size()) {
List<StudyMethod> list = baseMapper.queryUnreadList(queryWrapper);
if(list.size() > 0) {
// 获取未读方法
StudyMethodSearchForm form = new StudyMethodSearchForm();
form.setStudyId(studyId);
form.setStudySubjectId(studySubjectId);
form.setZt(StudyMethodStatusEnum.wd.getValue());
List<StudyMethod> studyMethodList = queryList(form);
String toUrl=study.getType().equals(StudyTypeEnum.sy.getValue())?("/study/enter/"+study.getId()+"/syff"):study.getType().equals(StudyTypeEnum.fsy.getValue())?("/nonTrial/enter/"+study.getId()+"/syff"):study.getType().equals(StudyTypeEnum.mjy.getValue())?("/drug/enter/"+study.getId()+"/syff"):"";
result.put("toUrl",toUrl);
result.put("ffmc","《" + studyMethodList.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")) + "》方法还未阅读,请先阅读后再进行操作");
result.put("ffmc","《" + list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")) + "》方法还未阅读,请先阅读后再进行操作");
}
}
return result;
}
@Override
public void close(StudyMethodForm form) {
SysUser qmr = sysUserService.selectUserById(form.getQmrId());
sysUserService.checkPassword(qmr, form.getQmrmm(), false);
StudyMethod studyMethod = getById(form.getId());
if(studyMethod == null || !studyMethod.getUserId().equals(form.getQmrId())) {
throw new ServiceException("对象不存在");
}
studyMethod.setStatus(NormalEnum.no.getValue());
updateById(studyMethod);
}
}

+ 8
- 0
hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMethodMapper.xml View File

@ -12,4 +12,12 @@
</where>
</if>
</select>
<select id="queryUnreadList" resultType="com.hxhq.business.domain.StudyMethod">
SELECT * FROM t_study_method
<if test="ew.sqlSegment != '' and ew.sqlSegment != null">
<where>
${ew.sqlSegment}
</where>
</if>
</select>
</mapper>

Loading…
Cancel
Save