diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java index 26fcfe2d..4fef9817 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/homepage/HomePageController.java @@ -1,7 +1,9 @@ package com.xinelu.mobile.controller.homepage; +import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.mobile.service.homepage.HomePageService; +import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -21,8 +23,36 @@ public class HomePageController { @Resource private HomePageService homePageService; + /** + * 我的随访列表 + */ @GetMapping("/myFollowUp") - public TableDataInfo myFollowUp(Long residentId) { - return homePageService.myFollowUp(residentId); + public TableDataInfo myFollowUp(MyFollowUpVO myFollowUp) { + return homePageService.myFollowUp(myFollowUp); } + + /** + * 获取话术信息详细信息 + */ + @GetMapping("/selectScriptInfo") + public AjaxResult selectScriptInfo(Long templateId) { + return AjaxResult.success(homePageService.selectScriptInfo(templateId)); + } + + /** + * 问卷信息 + */ + @GetMapping("/selectQuestion") + public AjaxResult selectQuestion(Long templateId) { + return homePageService.selectQuestion(templateId); + } + + /** + * 问卷记录信息 + */ + @GetMapping("/selectQuestionSubmit") + public AjaxResult selectQuestionSubmit(Long patientTaskExecuteRecordId) { + return homePageService.selectQuestionSubmit(patientTaskExecuteRecordId); + } + } diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java index 5b44fb86..e19f7642 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/mapper/homepage/HomePageMapper.java @@ -1,7 +1,6 @@ package com.xinelu.mobile.mapper.homepage; import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -13,5 +12,11 @@ import java.util.List; */ public interface HomePageMapper { - List selectManageRouteNode(@Param("residentId") Long residentId, @Param("routeNodeName") String routeNodeName); + /** + * 我的随访列表 + * + * @param myFollowUp 用户信息 + * @return TableDataInfo + */ + List selectManageRouteNode(MyFollowUpVO myFollowUp); } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java index b849ecb4..8b527c78 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/HomePageService.java @@ -1,8 +1,41 @@ package com.xinelu.mobile.service.homepage; +import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.manage.domain.scriptInfo.ScriptInfo; +import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; public interface HomePageService { - TableDataInfo myFollowUp(Long residentId); + /** + * 我的随访列表 + * + * @param myFollowUp 用户信息 + * @return TableDataInfo + */ + TableDataInfo myFollowUp(MyFollowUpVO myFollowUp); + + /** + * 查询话术信息 + * + * @param templateId 话术信息主键 + * @return 话术信息 + */ + ScriptInfo selectScriptInfo(Long templateId); + + /** + * 问卷信息 + * + * @param templateId 问卷表id + * @return AjaxResult + */ + AjaxResult selectQuestion(Long templateId); + + /** + * 问卷记录信息 + * + * @param patientTaskExecuteRecordId 记录表id + * @return AjaxResult + */ + AjaxResult selectQuestionSubmit(Long patientTaskExecuteRecordId); } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java index 0a00fb65..9fe3277d 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/service/homepage/Impl/HomePageServiceImpl.java @@ -1,8 +1,21 @@ package com.xinelu.mobile.service.homepage.Impl; +import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.enums.RouteNodeNameEnum; import com.xinelu.common.utils.PageServiceUtil; +import com.xinelu.common.utils.bean.BeanUtils; +import com.xinelu.manage.domain.questioninfo.QuestionInfo; +import com.xinelu.manage.domain.questionsubject.QuestionSubject; +import com.xinelu.manage.domain.scriptInfo.ScriptInfo; +import com.xinelu.manage.mapper.patientquestionsubmitresult.PatientQuestionSubmitResultMapper; +import com.xinelu.manage.mapper.questioninfo.QuestionInfoMapper; +import com.xinelu.manage.mapper.questionsubject.QuestionSubjectMapper; +import com.xinelu.manage.mapper.questionsubjectoption.QuestionSubjectOptionMapper; +import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper; +import com.xinelu.manage.vo.questionInfo.QuestionVO; +import com.xinelu.manage.vo.questionsubject.QuestionSubjectVO; +import com.xinelu.manage.vo.questionsubjectoption.QuestionSubjectOptionVO; import com.xinelu.mobile.mapper.homepage.HomePageMapper; import com.xinelu.mobile.service.homepage.HomePageService; import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; @@ -15,6 +28,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Service @Slf4j @@ -24,11 +38,27 @@ public class HomePageServiceImpl implements HomePageService { private HomePageMapper homePageMapper; @Resource private PageServiceUtil pageServiceUtil; + @Resource + private ScriptInfoMapper scriptInfoMapper; + @Resource + private QuestionInfoMapper questionInfoMapper; + @Resource + private QuestionSubjectMapper questionSubjectMapper; + @Resource + private QuestionSubjectOptionMapper questionSubjectOptionMapper; + @Resource + private PatientQuestionSubmitResultMapper submitResultMapper; + /** + * 我的随访列表 + * + * @param myFollowUp 用户信息 + * @return TableDataInfo + */ @Override - public TableDataInfo myFollowUp(Long residentId) { - pageServiceUtil.startPage(); - List myFollowUpList = homePageMapper.selectManageRouteNode(residentId, RouteNodeNameEnum.AFTER_ADMISSION.getInfo()); + public TableDataInfo myFollowUp(MyFollowUpVO myFollowUp) { + myFollowUp.setRouteNodeName(RouteNodeNameEnum.AFTER_DISCHARGE.getInfo()); + List myFollowUpList = homePageMapper.selectManageRouteNode(myFollowUp); if (CollectionUtils.isEmpty(myFollowUpList)) { return pageServiceUtil.getDataTable(new ArrayList<>()); } @@ -36,9 +66,66 @@ public class HomePageServiceImpl implements HomePageService { if (Objects.nonNull(myFollowUpVO) && Objects.nonNull(myFollowUpVO.getDischargeTime())) { myFollowUpVO.setFollowDate(myFollowUpVO.getDischargeTime().plusDays(myFollowUpVO.getRouteNodeDay())); } - myFollowUpVO.setRouteNodeName("出院后第" + myFollowUpVO.getRouteNodeDay() + "天"); + myFollowUpVO.setFollowName("出院后第" + myFollowUpVO.getRouteNodeDay() + "天"); } myFollowUpList.sort(Comparator.comparing(MyFollowUpVO::getFollowDate).reversed()); + //处理上面查询的list集合 + Integer pageNum = myFollowUp.getPageNum(); + Integer pageSize = myFollowUp.getPageSize(); + myFollowUpList = myFollowUpList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); return pageServiceUtil.getDataTable(myFollowUpList); } + + /** + * 查询话术信息 + * + * @param templateId 话术信息主键 + * @return 话术信息 + */ + @Override + public ScriptInfo selectScriptInfo(Long templateId) { + return scriptInfoMapper.selectScriptInfoById(templateId); + } + + /** + * 问卷信息 + * + * @param templateId 问卷表id + * @return AjaxResult + */ + @Override + public AjaxResult selectQuestion(Long templateId) { + //查询问卷表 + QuestionInfo questionInfo = questionInfoMapper.selectQuestionInfoById(templateId); + QuestionVO questionVO = new QuestionVO(); + // 查询题目表 + if (Objects.nonNull(questionInfo)) { + BeanUtils.copyBeanProp(questionVO, questionInfo); + List questionSubjects = questionSubjectMapper.selectQuestionSubjectBy(templateId); + List questionSubjectIds = questionSubjects.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getId())).map(QuestionSubject::getId).collect(Collectors.toList()); + if (questionSubjectIds.size() == 0) { + questionVO.setQuestionSubjectList(questionSubjects); + return AjaxResult.success(questionVO); + } + // 查询选项表 + List questionSubjectOptions = questionSubjectOptionMapper.selectQuestionSubjectOptions(questionSubjectIds); + for (QuestionSubjectVO questionSubject : questionSubjects) { + List collect = questionSubjectOptions.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getQuestionnaireSubjectId()) && questionSubject.getId().equals(item.getQuestionnaireSubjectId())).collect(Collectors.toList()); + questionSubject.setQuestionSubjectOptionList(collect); + } + questionVO.setQuestionSubjectList(questionSubjects); + } + return AjaxResult.success(questionVO); + } + + /** + * 问卷记录信息 + * + * @param patientTaskExecuteRecordId 记录表id + * @return AjaxResult + */ + @Override + public AjaxResult selectQuestionSubmit(Long patientTaskExecuteRecordId) { + return AjaxResult.success(submitResultMapper.selectResultByTaskExecuteRecordId(patientTaskExecuteRecordId, null)); + } } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/myfollowup/MyFollowUpVO.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/myfollowup/MyFollowUpVO.java index 2bb39a4d..3d47003c 100644 --- a/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/myfollowup/MyFollowUpVO.java +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/vo/myfollowup/MyFollowUpVO.java @@ -14,6 +14,25 @@ import java.time.LocalDate; @Data public class MyFollowUpVO { + /** + * 用户id + */ + private Long residentId; + + /** + * 执行记录表id + */ + private Long patientTaskExecuteRecordId; + + /** + * 节点id + */ + private Long manageRouteNodeId; + + /** + * 模版id + */ + private Long templateId; /** * 随访时间 */ @@ -24,6 +43,11 @@ public class MyFollowUpVO { */ private String routeNodeName; + /** + * 随访名称 + */ + private String followName; + /** * 随访方式 */ @@ -44,4 +68,7 @@ public class MyFollowUpVO { * 是否随访标记 0:否 1:是 */ private Integer sign; + + private Integer pageNum; + private Integer pageSize; } \ No newline at end of file diff --git a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml index 9d597dc7..4742dc7a 100644 --- a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml +++ b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml @@ -5,11 +5,19 @@