From 5eb498766eb0d0fcfa6935afb0fd47032435c98c Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Thu, 9 Nov 2023 08:48:30 +0800 Subject: [PATCH] =?UTF-8?q?update=3D=3D=3D>:=E4=BF=AE=E6=94=B9=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2=E7=AD=9B=E6=9F=A5=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=97=B6=EF=BC=8C=E6=9F=A5=E8=AF=A2=E7=AD=9B=E6=9F=A5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppletScreeningProjectController.java | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java index 93cd3ea..09840b6 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningproject/AppletScreeningProjectController.java @@ -3,11 +3,17 @@ package com.xinelu.applet.controller.appletscreeningproject; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.R; import com.xinelu.manage.domain.screeningproject.ScreeningProject; -import com.xinelu.manage.service.screeningproject.IScreeningProjectService; +import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO; +import com.xinelu.manage.service.screeningrecord.IScreeningRecordService; +import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.Resource; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,12 +28,29 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "项目控制器-小程序") public class AppletScreeningProjectController extends BaseController { @Resource - private IScreeningProjectService projectService; + private IScreeningRecordService screeningRecordService; @ApiOperation("筛查项目列表") @GetMapping("list") - public R> list(ScreeningProject project) { - List list = projectService.findList(project); - return R.ok(list); + public R> list(ScreeningRecordDTO query) { + // 查询居民预约过的项目 + List projectList = new ArrayList<>(); + + query.setScreeningType("1"); + List recordList = screeningRecordService.list(query); + if (CollectionUtils.isNotEmpty(recordList)) { + // 按照项目进行分组 + Map> groupByProject = recordList.stream() + .collect(Collectors.groupingBy(ScreeningRecordVo::getProjectId)); + for (String projectId : groupByProject.keySet()) { + ScreeningProject project = new ScreeningProject(); + project.setProjectId(projectId); + project.setProjectName(groupByProject.get(projectId).get(0).getProjectName()); + project.setHospitalId(groupByProject.get(projectId).get(0).getHospitalId()); + project.setHospitalName(groupByProject.get(projectId).get(0).getHospitalName()); + projectList.add(project); + } + } + return R.ok(projectList); } }