From 92e9322af285048b2d3e859ba14d256d4cedb017 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Fri, 19 Apr 2024 10:40:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=9A=8F=E8=AE=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homepage/HomePageController.java | 4 ++-- .../service/homepage/HomePageService.java | 4 ++-- .../homepage/Impl/HomePageServiceImpl.java | 19 +++++++++++++++---- .../mapper/homepage/HomePageMapper.xml | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) 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 ec8d8b66..26fcfe2d 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,6 +1,6 @@ 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 org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -22,7 +22,7 @@ public class HomePageController { private HomePageService homePageService; @GetMapping("/myFollowUp") - public AjaxResult myFollowUp(Long residentId) { + public TableDataInfo myFollowUp(Long residentId) { return homePageService.myFollowUp(residentId); } } 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 6e1de6ac..b849ecb4 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,8 @@ package com.xinelu.mobile.service.homepage; -import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; public interface HomePageService { - AjaxResult myFollowUp(Long residentId); + TableDataInfo myFollowUp(Long residentId); } \ 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 1dc33fed..0a00fb65 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,14 +1,18 @@ 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.mobile.mapper.homepage.HomePageMapper; import com.xinelu.mobile.service.homepage.HomePageService; import com.xinelu.mobile.vo.myfollowup.MyFollowUpVO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -18,16 +22,23 @@ public class HomePageServiceImpl implements HomePageService { @Resource private HomePageMapper homePageMapper; + @Resource + private PageServiceUtil pageServiceUtil; @Override - public AjaxResult myFollowUp(Long residentId) { + public TableDataInfo myFollowUp(Long residentId) { + pageServiceUtil.startPage(); List myFollowUpList = homePageMapper.selectManageRouteNode(residentId, RouteNodeNameEnum.AFTER_ADMISSION.getInfo()); + if (CollectionUtils.isEmpty(myFollowUpList)) { + return pageServiceUtil.getDataTable(new ArrayList<>()); + } for (MyFollowUpVO myFollowUpVO : myFollowUpList) { if (Objects.nonNull(myFollowUpVO) && Objects.nonNull(myFollowUpVO.getDischargeTime())) { myFollowUpVO.setFollowDate(myFollowUpVO.getDischargeTime().plusDays(myFollowUpVO.getRouteNodeDay())); } - myFollowUpVO.setRouteNodeName((myFollowUpVO.getRouteNodeName() == null ? "出院后" : myFollowUpVO.getRouteNodeName()) + myFollowUpVO.getRouteNodeDay()); + myFollowUpVO.setRouteNodeName("出院后第" + myFollowUpVO.getRouteNodeDay() + "天"); } - return AjaxResult.success(myFollowUpList); + myFollowUpList.sort(Comparator.comparing(MyFollowUpVO::getFollowDate).reversed()); + return pageServiceUtil.getDataTable(myFollowUpList); } } \ 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 706c3f82..9d597dc7 100644 --- a/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml +++ b/postdischarge-mobile/src/main/resources/mapper/homepage/HomePageMapper.xml @@ -9,7 +9,7 @@ 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 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