From c3578ee71dd69cdae9b1755d23913f1697effa7d Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Thu, 8 Jan 2026 12:09:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20=E8=AF=95=E9=AA=8C=E5=88=97=E8=A1=A8=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=B2=9F=E9=80=9A=E7=9A=84=E8=BF=9B=E4=B8=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/StudyController.java | 25 +----- .../business/controller/StudyDrugController.java | 27 +------ .../controller/StudyNonTrialController.java | 28 +------ .../com/hxhq/business/service/IStudyService.java | 23 ++++++ .../business/service/impl/StudyServiceImpl.java | 91 +++++++++++++++++++--- 5 files changed, 108 insertions(+), 86 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java index 82aa7f6..f7aaef7 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -52,34 +52,11 @@ public class StudyController extends BaseController startPage(); List list = studyService.queryList(form); TableDataInfo table = getDataTable(list); - table.setRows(initFormCount((List)table.getRows())); + table.setRows(studyService.initFormCount((List)table.getRows())); return table; } /** - * 设置表单数 - * @param list - * @return - */ - private List initFormCount(List list){ - if(list.size()>0){ - List countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); - for(StudyListDto l : list){ - List 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"}) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java index 3fa7938..620596e 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyDrugController.java @@ -49,36 +49,13 @@ public class StudyDrugController extends BaseController { form.setType(StudyTypeEnum.mjy.getValue()); startPage(); - List list = studyService.queryList(form); + List list = studyService.queryDrugList(form); TableDataInfo table = getDataTable(list); - table.setRows(initFormCount((List)table.getRows())); + table.setRows(studyService.initFormCount((List)table.getRows())); return table; } /** - * 设置表单数 - * @param list - * @return - */ - private List initFormCount(List list){ - if(list.size()>0){ - List countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); - for(StudyListDto l : list){ - List 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"}) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java index d4ea949..cdf1a0a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyNonTrialController.java @@ -48,37 +48,13 @@ public class StudyNonTrialController extends BaseController public TableDataInfo list(StudySearchForm form) { form.setType(StudyTypeEnum.fsy.getValue()); - startPage(); - List list = studyService.queryList(form); + List list = studyService.queryNonList(form); TableDataInfo table = getDataTable(list); - table.setRows(initFormCount((List)table.getRows())); + table.setRows(studyService.initFormCount((List)table.getRows())); return table; } /** - * 设置表单数 - * @param list - * @return - */ - private List initFormCount(List list){ - if(list.size()>0){ - List countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); - for(StudyListDto l : list){ - List 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"}) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java index 08bcc9e..0bec73c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -25,6 +25,29 @@ public interface IStudyService extends IService public List queryList(StudySearchForm form); /** + * 查询非试验列表 + * + * @param form 试验 + * @return 试验集合 + */ + public List queryNonList(StudySearchForm form); + + /** + * 查询麻精药列表 + * + * @param form 试验 + * @return 试验集合 + */ + public List queryDrugList(StudySearchForm form); + + /** + * 赋值表单数量 + * @param list + * @return + */ + List initFormCount(List list); + + /** * 获取表单数量 * @param idList * @return diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 5476d2a..8121209 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -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 queryList(StudySearchForm form) - { - QueryWrapper queryWrapper = Wrappers.query(); + + private QueryWrapper getListBaseQuery(StudySearchForm form){ + QueryWrapper 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 queryList(StudySearchForm form) + { + QueryWrapper 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 queryNonList(StudySearchForm form) { + QueryWrapper 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 queryDrugList(StudySearchForm form) { + QueryWrapper 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 initFormCount(List list) { + if(list.size()>0){ + List countList = queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); + for(StudyListDto l : list){ + List 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();