Browse Source

feat: [试验管理] 试验列表根据沟通的进下修改

master
memorylkf 5 days ago
parent
commit
c3578ee71d
5 changed files with 108 additions and 86 deletions
  1. +1
    -24
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java
  2. +2
    -25
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java
  3. +2
    -26
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java
  4. +23
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java
  5. +80
    -11
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java

+ 1
- 24
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java View File

@ -52,34 +52,11 @@ public class StudyController extends BaseController
startPage();
List<StudyListDto> list = studyService.queryList(form);
TableDataInfo table = getDataTable(list);
table.setRows(initFormCount((List<StudyListDto>)table.getRows()));
table.setRows(studyService.initFormCount((List<StudyListDto>)table.getRows()));
return table;
}
/**
* 设置表单数
* @param list
* @return
*/
private List<StudyListDto> initFormCount(List<StudyListDto> list){
if(list.size()>0){
List<StudyListDto> countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList()));
for(StudyListDto l : list){
List<StudyListDto> matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList());
if(matchList.size()>0){
l.setFormCount(matchList.get(0).getFormCount());
l.setFormFinishCount(matchList.get(0).getFormFinishCount());
}else{
l.setFormCount(0);
l.setFormFinishCount(0);
}
}
}
return list;
}
/**
* 获取试验详细信息
*/
@RequiresPermissions({"business:study:add", "business:study:edit", "business:study:detail"})

+ 2
- 25
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java View File

@ -49,36 +49,13 @@ public class StudyDrugController extends BaseController
{
form.setType(StudyTypeEnum.mjy.getValue());
startPage();
List<StudyListDto> list = studyService.queryList(form);
List<StudyListDto> list = studyService.queryDrugList(form);
TableDataInfo table = getDataTable(list);
table.setRows(initFormCount((List<StudyListDto>)table.getRows()));
table.setRows(studyService.initFormCount((List<StudyListDto>)table.getRows()));
return table;
}
/**
* 设置表单数
* @param list
* @return
*/
private List<StudyListDto> initFormCount(List<StudyListDto> list){
if(list.size()>0){
List<StudyListDto> countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList()));
for(StudyListDto l : list){
List<StudyListDto> matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList());
if(matchList.size()>0){
l.setFormCount(matchList.get(0).getFormCount());
l.setFormFinishCount(matchList.get(0).getFormFinishCount());
}else{
l.setFormCount(0);
l.setFormFinishCount(0);
}
}
}
return list;
}
/**
* 获取试验详细信息
*/
@RequiresPermissions({"business:form:drug:add", "business:form:drug:edit", "business:form:drug:detail"})

+ 2
- 26
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java View File

@ -48,37 +48,13 @@ public class StudyNonTrialController extends BaseController
public TableDataInfo list(StudySearchForm form)
{
form.setType(StudyTypeEnum.fsy.getValue());
startPage();
List<StudyListDto> list = studyService.queryList(form);
List<StudyListDto> list = studyService.queryNonList(form);
TableDataInfo table = getDataTable(list);
table.setRows(initFormCount((List<StudyListDto>)table.getRows()));
table.setRows(studyService.initFormCount((List<StudyListDto>)table.getRows()));
return table;
}
/**
* 设置表单数
* @param list
* @return
*/
private List<StudyListDto> initFormCount(List<StudyListDto> list){
if(list.size()>0){
List<StudyListDto> countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList()));
for(StudyListDto l : list){
List<StudyListDto> matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList());
if(matchList.size()>0){
l.setFormCount(matchList.get(0).getFormCount());
l.setFormFinishCount(matchList.get(0).getFormFinishCount());
}else{
l.setFormCount(0);
l.setFormFinishCount(0);
}
}
}
return list;
}
/**
* 获取试验详细信息
*/
@RequiresPermissions({"business:form:nonTrial:add", "business:form:nonTrial:edit", "business:form:nonTrial:detail"})

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

@ -25,6 +25,29 @@ public interface IStudyService extends IService
public List<StudyListDto> queryList(StudySearchForm form);
/**
* 查询非试验列表
*
* @param form 试验
* @return 试验集合
*/
public List<StudyListDto> queryNonList(StudySearchForm form);
/**
* 查询麻精药列表
*
* @param form 试验
* @return 试验集合
*/
public List<StudyListDto> queryDrugList(StudySearchForm form);
/**
* 赋值表单数量
* @param list
* @return
*/
List<StudyListDto> initFormCount(List<StudyListDto> list);
/**
* 获取表单数量
* @param idList
* @return

+ 80
- 11
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -12,6 +13,7 @@ import com.hxhq.business.domain.StudyJcgj;
import com.hxhq.business.dto.study.StudyListDto;
import com.hxhq.business.enums.study.StudyBorrowStatusEnum;
import com.hxhq.business.enums.study.StudyStatusEnum;
import com.hxhq.business.enums.study.StudyTypeEnum;
import com.hxhq.business.enums.zykgl.JcgjlxEnum;
import com.hxhq.business.enums.zykgl.JcmcysEnum;
import com.hxhq.business.form.common.SignForm;
@ -22,6 +24,7 @@ import com.hxhq.business.utils.JctUtil;
import com.hxhq.business.utils.ObjectCompareUtil;
import com.hxhq.common.core.exception.ServiceException;
import com.hxhq.common.core.utils.DateUtils;
import com.hxhq.common.core.utils.PageUtils;
import com.hxhq.common.core.utils.StringUtils;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.security.auth.AuthUtil;
@ -48,16 +51,9 @@ public class StudyServiceImpl extends ServiceImpl implements
private IStudyJcgjService studyJcgjService;
@Autowired
private ISysUserService sysUserService;
/**
* 查询试验列表
*
* @param form 试验
* @return 试验
*/
@Override
public List<StudyListDto> queryList(StudySearchForm form)
{
QueryWrapper<StudyListDto> queryWrapper = Wrappers.query();
private QueryWrapper<StudyListDto> getListBaseQuery(StudySearchForm form){
QueryWrapper<StudyListDto> queryWrapper = new QueryWrapper();
queryWrapper.eq("s.del_flag","0");
if(form.getType()!=null && form.getType().intValue()>0){
queryWrapper.eq("s.type",form.getType());
@ -80,6 +76,20 @@ public class StudyServiceImpl extends ServiceImpl implements
if(form.getStatus()!=null && form.getStatus().intValue()>0){
queryWrapper.eq("s.status",form.getStatus());
}
return queryWrapper;
}
/**
* 查询试验列表
*
* @param form 试验
* @return 试验
*/
@Override
public List<StudyListDto> queryList(StudySearchForm form)
{
QueryWrapper<StudyListDto> queryWrapper = getListBaseQuery(form);
//试验管理
//TFM看所有试验其他只能看自己进入的试验
String tmfRole = "TFM";
if (!AuthUtil.hasRole(tmfRole))
@ -92,9 +102,49 @@ public class StudyServiceImpl extends ServiceImpl implements
"s.id IN (\n" +
"SELECT study_id FROM `t_study_subject_user` WHERE del_flag='0' AND user_id={0}\n" +
")\n" +
"OR create_by={0}\n" +
"OR s.leader={0}\n" +
")",SecurityUtils.getUserId());
}
queryWrapper.orderByDesc("s.id");
return baseMapper.queryList(queryWrapper);
}
@Override
public List<StudyListDto> queryNonList(StudySearchForm form) {
QueryWrapper<StudyListDto> queryWrapper = getListBaseQuery(form);
// 非试验管理
// 特殊部门QA可以看所有列表+审核表单
// 特殊角色可以看部门级下级部门的所有非试验操作非试验锁定解锁...可以审核表单
// 其他只能看所在部门级下级部门的所有非试验
// 总结有这个菜单特殊部QA可以看所有+审核表单其他只能看部门级下级部门的列表部长可以操作+审核表单
Long deptId = sysUserService.selectUserById(SecurityUtils.getLoginUser().getUserid()).getDeptId();
if (!deptId.equals(216L))
{
queryWrapper.apply("(\n" +
"s.dept_id IN(\n" +
"SELECT dept_id FROM sys_dept WHERE del_flag = '0' AND FIND_IN_SET({0}, ancestors) \n" +
")\n" +
"OR s.dept_id={0}\n" +
")",deptId);
}
queryWrapper.orderByDesc("s.id");
PageUtils.startPage();
return baseMapper.queryList(queryWrapper);
}
@Override
public List<StudyListDto> queryDrugList(StudySearchForm form) {
QueryWrapper<StudyListDto> queryWrapper = getListBaseQuery(form);
// 麻精药管理
// 特殊部门QA可以看所有列表+审核表单
// 特殊角色麻精药,角色下所有人都能看所有麻精药表单列表
// 是部长角色的话能看所有麻精药列表+操作+可以审核表单
// 总结只要有这个菜单就能看所有列表特殊部门QA可以审核表单部长角色的话能操作+可以审核表单
queryWrapper.orderByDesc("s.id");
return baseMapper.queryList(queryWrapper);
}
@ -108,6 +158,25 @@ public class StudyServiceImpl extends ServiceImpl implements
}
@Override
public List<StudyListDto> initFormCount(List<StudyListDto> list) {
if(list.size()>0){
List<StudyListDto> countList = queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList()));
for(StudyListDto l : list){
List<StudyListDto> matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList());
if(matchList.size()>0){
l.setFormCount(matchList.get(0).getFormCount());
l.setFormFinishCount(matchList.get(0).getFormFinishCount());
}else{
l.setFormCount(0);
l.setFormFinishCount(0);
}
}
}
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveInfo(StudySaveForm form) {
Study study = form.getStudy();

Loading…
Cancel
Save