Merge remote-tracking branch 'origin/0418_小程序开发' into dev

This commit is contained in:
纪寒 2024-04-22 09:56:28 +08:00
commit b3e543fe5d
6 changed files with 201 additions and 11 deletions

View File

@ -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);
}
}

View File

@ -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<MyFollowUpVO> selectManageRouteNode(@Param("residentId") Long residentId, @Param("routeNodeName") String routeNodeName);
/**
* 我的随访列表
*
* @param myFollowUp 用户信息
* @return TableDataInfo
*/
List<MyFollowUpVO> selectManageRouteNode(MyFollowUpVO myFollowUp);
}

View File

@ -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);
}

View File

@ -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<MyFollowUpVO> myFollowUpList = homePageMapper.selectManageRouteNode(residentId, RouteNodeNameEnum.AFTER_ADMISSION.getInfo());
public TableDataInfo myFollowUp(MyFollowUpVO myFollowUp) {
myFollowUp.setRouteNodeName(RouteNodeNameEnum.AFTER_DISCHARGE.getInfo());
List<MyFollowUpVO> 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<QuestionSubjectVO> questionSubjects = questionSubjectMapper.selectQuestionSubjectBy(templateId);
List<Long> 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<QuestionSubjectOptionVO> questionSubjectOptions = questionSubjectOptionMapper.selectQuestionSubjectOptions(questionSubjectIds);
for (QuestionSubjectVO questionSubject : questionSubjects) {
List<QuestionSubjectOptionVO> 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));
}
}

View File

@ -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;
}

View File

@ -5,11 +5,19 @@
<mapper namespace="com.xinelu.mobile.mapper.homepage.HomePageMapper">
<select id="selectManageRouteNode" resultType="com.xinelu.mobile.vo.myfollowup.MyFollowUpVO">
select spmrn.task_type,
select
spmrn.id manageRouteNodeId,
spmrn.task_type,
spmrn.route_node_name,
IFNULL( spmrn.route_node_day,0) routeNodeDay,
pi.discharge_time,
IF(pter.id=NULL,0,1) sign
IF(pter.id=NULL,0,1) sign,
pter.id patientTaskExecuteRecordId,
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_id
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.question_info_id
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_id
END AS templateId
FROM patient_info pi
LEFT JOIN sign_patient_manage_route spmr ON spmr.patient_id = pi.id
LEFT JOIN sign_patient_manage_route_node spmrn ON spmrn.manage_route_id = spmr.id