Procházet zdrojové kódy

add:添加术前问卷接口

zhouzeyu před 6 měsíci
rodič
revize
5fa1dcc556

+ 2 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/mapper/BizQuestionMapper.java

@@ -2,6 +2,7 @@ package cn.tr.module.smart.common.mapper;
 
 import cn.tr.module.smart.common.po.BizQuestionPO;
 import cn.tr.module.smart.common.dto.BizQuestionDTO;
+import cn.tr.module.smart.wx.controller.vo.BizWxDeptQuestionVO;
 import org.mapstruct.Mapper;
 import org.mapstruct.factory.Mappers;
 
@@ -25,4 +26,5 @@ public interface BizQuestionMapper {
 
     List<BizQuestionPO> convertPOList(List<BizQuestionDTO> source);
 
+    List<BizWxDeptQuestionVO> convertWxDeptQuestionVOList(List<BizQuestionPO> list);
 }

+ 1 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/IBizClinicService.java

@@ -69,5 +69,5 @@ public interface IBizClinicService{
 
     BizWxAppletClinicVO stdSelectWxAppletById(String id);
 
-    BizWxDeptQuestionVO selectPreSurgeryQuestionnaire(String clinicId);
+    List<BizWxDeptQuestionVO> selectPreSurgeryQuestionnaire(String clinicId);
 }

+ 4 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/IBizQuestionService.java

@@ -2,6 +2,8 @@ package cn.tr.module.smart.common.service;
 
 import cn.tr.module.smart.common.dto.BizQuestionDTO;
 import cn.tr.module.smart.common.dto.BizQuestionQueryDTO;
+import cn.tr.module.smart.wx.controller.vo.BizWxDeptQuestionVO;
+
 import java.util.*;
 
 /**
@@ -51,4 +53,6 @@ public interface IBizQuestionService{
      * @date    2025/05/23 17:03
      */
     int removeBizQuestionByIds(Collection<String> ids);
+
+    List<BizWxDeptQuestionVO> selectBizQuestionByGroupId(String groupId);
 }

+ 18 - 7
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/BizClinicServiceImpl.java

@@ -4,7 +4,11 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.tr.core.exception.TRExcCode;
 import cn.tr.core.strategy.LoginUserStrategy;
+import cn.tr.module.smart.common.dto.BizDeptDTO;
 import cn.tr.module.smart.common.po.BizDeptPO;
+import cn.tr.module.smart.common.repository.BizDeptRepository;
+import cn.tr.module.smart.common.service.IBizDeptService;
+import cn.tr.module.smart.common.service.IBizQuestionService;
 import cn.tr.module.smart.wx.controller.vo.BizWxDeptQuestionVO;
 import cn.tr.module.smart.wx.dto.BizClinicAddOrEditDTO;
 import cn.tr.module.smart.wx.dto.BizWxAppletClinicQueryDTO;
@@ -39,6 +43,11 @@ import org.springframework.util.StringUtils;
 public class BizClinicServiceImpl extends ServiceImpl<BizClinicRepository,BizClinicPO> implements IBizClinicService {
 
 
+    @Autowired
+    private IBizDeptService bizDeptService;
+
+    @Autowired
+    private IBizQuestionService bizQuestionService;
 
 
     /**
@@ -182,8 +191,7 @@ public class BizClinicServiceImpl extends ServiceImpl<BizClinicRepository,BizCli
     }
 
     @Override
-    public BizWxDeptQuestionVO selectPreSurgeryQuestionnaire(String clinicId) {
-
+    public List<BizWxDeptQuestionVO> selectPreSurgeryQuestionnaire(String clinicId) {
         //判断临床id是否为空
         if(StrUtil.isBlank(clinicId)){
             throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"患者信息不存在");
@@ -191,10 +199,13 @@ public class BizClinicServiceImpl extends ServiceImpl<BizClinicRepository,BizCli
         BizClinicPO clinic = baseMapper.selectById(clinicId);
         String deptId = clinic.getDeptId();
         //判断科室id是否为空
-        //如果科室id不为空获取到问题组id
-        //判断问题组id是否为空不为空
-        //通过问题组id去查询出来biz_question表中的所有问题并传给前端
-
-        return null;
+        if(StrUtil.isBlank(deptId)){
+            throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"科室信息不存在");
+        }
+        BizDeptDTO bizDeptDTO = bizDeptService.selectBizDeptById(deptId);
+        String groupId = bizDeptDTO.getGroupId();
+        //通过获取到的groupId查询问卷调查问题表
+        List<BizWxDeptQuestionVO> result = bizQuestionService.selectBizQuestionByGroupId(groupId);
+        return result;
     }
 }

+ 12 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/BizQuestionServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.tr.module.smart.common.service.impl;
 
 import cn.tr.core.exception.TRExcCode;
+import cn.tr.module.smart.wx.controller.vo.BizWxDeptQuestionVO;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -103,4 +104,15 @@ public class BizQuestionServiceImpl implements IBizQuestionService {
         }
 
     }
+
+
+    @Override
+    public List<BizWxDeptQuestionVO> selectBizQuestionByGroupId(String groupId) {
+        //根据groupId查询
+        List<BizQuestionPO> list = baseRepository.selectList(new LambdaQueryWrapper<BizQuestionPO>()
+                .eq(BizQuestionPO::getGroupId, groupId)
+                .orderByAsc(BizQuestionPO::getSort));
+
+        return BizQuestionMapper.INSTANCE.convertWxDeptQuestionVOList(list);
+    }
 }

+ 1 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/wx/controller/BizWxAppletClinicController.java

@@ -89,7 +89,7 @@ public class BizWxAppletClinicController extends BaseController{
 
     @PostMapping("/preSurgeryQuestionnaire/{clinicId}")
     @ApiOperation(value = "术前问卷",position = 8)
-    public CommonResult<BizWxDeptQuestionVO> preSurgeryQuestionnaire(@PathVariable("clinicId") String clinicId){
+    public CommonResult<List<BizWxDeptQuestionVO>> preSurgeryQuestionnaire(@PathVariable("clinicId") String clinicId){
         return CommonResult.success(clinicService.selectPreSurgeryQuestionnaire(clinicId));
     }
 }

+ 0 - 8
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/wx/controller/vo/BizWxDeptQuestionVO.java

@@ -21,14 +21,6 @@ import java.util.List;
 @ToString
 public class BizWxDeptQuestionVO {
 
-    /** 临床id */
-    @TableId
-    @ApiModelProperty(value = "临床id", position = 1)
-    private String clinicId;
-
-    /** 科室 */
-    @ApiModelProperty(value = "科室", position = 2)
-    private String deptId;
 
     /** 问题组id */
     @ApiModelProperty(value = "问题组id", position = 3)