Przeglądaj źródła

Web端问卷查询实现

wangzl 5 miesięcy temu
rodzic
commit
ae9278faf9

+ 3 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/po/BizQuestionAnswerPO.java

@@ -57,4 +57,7 @@ public class BizQuestionAnswerPO extends TenantPO {
     @ApiModelProperty(value = "问卷回答时间", position = 7)
     private Date answerTime;
 
+    @ApiModelProperty(value = "问卷类型", position = 8)
+    private String questionType;
+
 }

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

@@ -25,4 +25,6 @@ public interface IBizQuestionAnswerService{
     List<BizWxDeptQuestionVO> stdSelectWxAppletPreSurgeryQuestionnaire(String clinicId);
 
     List<BizWebQuestionAnswerVO> selectWebQuestionAnswerList(BizWebQuestionAnswerQueryDTO query);
+
+    List<BizWxDeptQuestionVO> selectDetailByAnswerId(String answerId);
 }

+ 22 - 6
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/BizQuestionAnswerServiceImpl.java

@@ -83,9 +83,30 @@ public class BizQuestionAnswerServiceImpl implements IBizQuestionAnswerService {
         if (ObjectUtil.isNull(questionAnswer)) {
             return null;
         }
+        return getQuestionAnswerList(questionAnswer);
+    }
 
-        List<BizWxDeptQuestionVO> questionAnswerList = BizQuestionAnswerMapper.INSTANCE.convertWxAppletVOList(questionAnswer.getQuestion());
+    @Override
+    public List<BizWebQuestionAnswerVO> selectWebQuestionAnswerList(BizWebQuestionAnswerQueryDTO query) {
+        return baseRepository.selectWebQuestionAnswerList(query);
+    }
+
+    @Override
+    public List<BizWxDeptQuestionVO> selectDetailByAnswerId(String answerId) {
+        BizQuestionAnswerPO bizQuestionAnswerPO = baseRepository.selectById(answerId);
+        if (ObjectUtil.isNull(bizQuestionAnswerPO)) {
+           throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"未查询到问卷信息");
+        }
+        return getQuestionAnswerList(bizQuestionAnswerPO);
+    }
 
+    /**
+     * @description: 根据问题填充答案
+     * @author wangzl
+     * @date 2025/7/21
+     */
+    public List<BizWxDeptQuestionVO> getQuestionAnswerList(BizQuestionAnswerPO questionAnswer){
+        List<BizWxDeptQuestionVO> questionAnswerList = BizQuestionAnswerMapper.INSTANCE.convertWxAppletVOList(questionAnswer.getQuestion());
         //填充回答
         List<BizWxAppletQuestionAnswerEntity> answerContent = questionAnswer.getContent();
         if(CollectionUtil.isNotEmpty(answerContent)&&CollectionUtil.isNotEmpty(questionAnswerList)){
@@ -103,9 +124,4 @@ public class BizQuestionAnswerServiceImpl implements IBizQuestionAnswerService {
         }
         return questionAnswerList;
     }
-
-    @Override
-    public List<BizWebQuestionAnswerVO> selectWebQuestionAnswerList(BizWebQuestionAnswerQueryDTO query) {
-        return baseRepository.selectWebQuestionAnswerList(query);
-    }
 }

+ 16 - 7
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/controller/BizWebQuestionAnswerController.java

@@ -1,12 +1,14 @@
 package cn.tr.module.smart.web.controller;
 
 import cn.dev33.satoken.annotation.SaCheckLogin;
+import cn.tr.core.pojo.CommonResult;
 import cn.tr.core.pojo.TableDataInfo;
 import cn.tr.module.smart.common.service.IBizQuestionAnswerService;
 import cn.tr.module.smart.web.dto.BizWebPainAssessmentQueryDTO;
 import cn.tr.module.smart.web.dto.BizWebQuestionAnswerQueryDTO;
 import cn.tr.module.smart.web.vo.BizWebPainAssessmentVO;
 import cn.tr.module.smart.web.vo.BizWebQuestionAnswerVO;
+import cn.tr.module.smart.wx.controller.vo.BizWxDeptQuestionVO;
 import cn.tr.module.sys.oauth2.LoginTypeConstant;
 import cn.tr.plugin.mybatis.base.BaseController;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -14,17 +16,16 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * @author wangzl
  * @description: TODO
  * @date 2025/7/1 11:27
  */
-@Api(tags = "web端术后问卷")
+@Api(tags = "web端问卷")
 @RestController
 @RequestMapping("/web/answer")
 @AllArgsConstructor
@@ -33,11 +34,19 @@ public class BizWebQuestionAnswerController extends BaseController {
 
     @Autowired
     private IBizQuestionAnswerService bizQuestionAnswerService;
-    @ApiOperationSupport(author = "wangzl",order = 1)
-    @ApiOperation(value="根据条件查询患者问卷列表",notes = "权限: 无")
+
+    @ApiOperationSupport(author = "wangzl", order = 1)
+    @ApiOperation(value = "根据条件查询患者问卷列表", notes = "权限: 无")
     @PostMapping("/query/page")
     public TableDataInfo<BizWebQuestionAnswerVO> selectList(@RequestBody BizWebQuestionAnswerQueryDTO query) {
         startPage();
         return getDataTable(bizQuestionAnswerService.selectWebQuestionAnswerList(query));
     }
+
+    @ApiOperationSupport(author = "wangzl", order = 2)
+    @ApiOperation(value = "查看问卷详情", notes = "权限: 无")
+    @GetMapping("/detail/{answerId}")
+    public CommonResult<List<BizWxDeptQuestionVO>> selectDetailByAnswerId(@PathVariable String answerId) {
+        return CommonResult.success(bizQuestionAnswerService.selectDetailByAnswerId(answerId));
+    }
 }

+ 9 - 6
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/dto/BizWebQuestionAnswerQueryDTO.java

@@ -20,20 +20,23 @@ import java.util.List;
 @ApiModel("Web端术后问卷查询请求对象")
 @Data
 @ToString
-public class BizWebQuestionAnswerQueryDTO  implements Serializable {
+public class BizWebQuestionAnswerQueryDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty("查询条件")
+    @ApiModelProperty(value = "查询条件", position = 1)
     private String condition;
 
-    @ApiModelProperty("检索时间")
+    @ApiModelProperty(value = "检索时间", position = 2)
     private List<Date> clinicTime;
 
+    @ApiModelProperty(value = "问卷类型 不区分 不传,术前:BEFORE 术后AFTER", position = 3)
+    private String questionType;
+
     public void setClinicTime(List<Date> clinicTime) {
-        this.clinicTime=new ArrayList<>();
-        if(CollectionUtil.isNotEmpty(clinicTime)){
+        this.clinicTime = new ArrayList<>();
+        if (CollectionUtil.isNotEmpty(clinicTime)) {
             this.clinicTime.add(DateUtil.beginOfDay(CollectionUtil.getFirst(clinicTime)));
-            if(CollectionUtil.size(clinicTime)>1){
+            if (CollectionUtil.size(clinicTime) > 1) {
                 this.clinicTime.add(DateUtil.endOfDay(CollectionUtil.getLast(clinicTime)));
             }
 

+ 6 - 0
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/web/vo/BizWebQuestionAnswerVO.java

@@ -37,4 +37,10 @@ public class BizWebQuestionAnswerVO  extends BaseDTO {
 
     @ApiModelProperty(value = "手术开始时间", position = 6)
     private String clinicStartTime;
+
+    @ApiModelProperty(value = "问卷类型", position = 7)
+    private String questionType;
+
+    @ApiModelProperty(value = "问卷ID", position = 8)
+    private String answerId;
 }

+ 6 - 1
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizQuestionAnswerMapper.xml

@@ -7,12 +7,14 @@
 
     <select id="selectWebQuestionAnswerList" resultType="cn.tr.module.smart.web.vo.BizWebQuestionAnswerVO">
         SELECT
-        bcr.ID as id,
+        bcr.id as id,
         bcr.patient_name as patientName,
         bcr.clinic_name as clinicName,
         bcr.dept_id as deptId,
         bcr.dept_name as deptName,
         bcr.clinic_start_time as clinicStartTime,
+        bqa.id as answerId,
+        bqa.question_type as questionType
         bcr.create_time as create_time,
         bcr.create_by as create_by,
         bcr.update_time as update_time,
@@ -31,6 +33,9 @@
             <if test="query.clinicTime != null and query.clinicTime.size() > 1">
                 AND bcr.clinic_start_time &lt;= #{query.clinicTime[1]}
             </if>
+            <if test="query.questionType != null">
+                AND bqa.question_type = #{query.questionType}
+            </if>
         </where>
     </select>
 </mapper>