From b44b174f656aac1fe03e7f96851e564c3982f67d Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 28 三月 2025 16:52:25 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/boymi/YiFeiNN --- medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java | 57 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 38 insertions(+), 19 deletions(-) diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java index 08831a5..7c320c9 100644 --- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java +++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java @@ -3,6 +3,7 @@ import com.sinata.common.core.domain.R; import com.sinata.common.core.domain.entity.SysUser; import com.sinata.common.utils.SecurityUtils; +import com.sinata.common.utils.StringUtils; import com.sinata.system.domain.*; import com.sinata.system.domain.dto.CheckOutDto; import com.sinata.system.domain.dto.CollectTotalUpDto; @@ -17,11 +18,13 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import javax.validation.constraints.NotNull; +import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @@ -55,14 +58,16 @@ @PostMapping("/regionTree") @ApiImplicitParam(name = "keyword", value = "关键字", required = false) public R<List<SysDepartmentVO>> getRegionTree(@RequestParam(required = false) String keyword) { - return R.ok(sysDepartmentService.getRegionTree1(keyword)); + List<SysDepartmentVO> regionTree1 = sysDepartmentService.getRegionTree2(keyword); + return R.ok(regionTree1); } @ApiOperation("获取区域树") @PostMapping("/pub/regionTree") @ApiImplicitParam(name = "keyword", value = "关键字", required = false) public R<List<SysDepartmentVO>> getRegionTree1(@RequestParam(required = false) String keyword) { - return R.ok(sysDepartmentService.getRegionTree1(keyword)); + List<SysDepartmentVO> regionTree1 = sysDepartmentService.getRegionTree2(keyword); + return R.ok(regionTree1); } @@ -90,8 +95,10 @@ @ApiOperation("获取医院监管列表") @PostMapping("/hospita/list") - public R<List<SysDepartment>> list(String name) { - List<SysDepartment> list = sysDepartmentService.lambdaQuery().like(name!=null,SysDepartment::getDepartmentName,name).eq(SysDepartment::getOrgType, 2).list(); + public R<List<SysDepartment>> list(String name, Long areaId) { +// SysDepartment byId = sysDepartmentService.getMyDepartment(); + SysDepartment byId = sysDepartmentService.getById(areaId); + List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, byId.getTreeCode()).like(StringUtils.isNotEmpty(name), SysDepartment::getDepartmentName, name).eq(SysDepartment::getOrgType, 2).list(); for (SysDepartment sysDepartment : list) { //获取医院暂存间信息 MwStagingRoom one = roomService.lambdaQuery().eq(MwStagingRoom::getDepartmentId, sysDepartment.getId()).one(); @@ -106,7 +113,6 @@ sysDepartment.setMaxCapacity(one.getMaxCapacity()); sysDepartment.setNowCapacity(count.intValue()); sysDepartment.setPercentage(percentage); - } return R.ok(list); } @@ -115,16 +121,23 @@ @ApiOperation("获取处置监管列表") @PostMapping("/end/list") - public R<List<SysDepartment>> list2(String name) { - List<SysDepartment> list = sysDepartmentService.lambdaQuery().like(name!=null,SysDepartment::getDepartmentName,name).eq(SysDepartment::getOrgType, 3).list(); + public R<List<SysDepartment>> list2(String name,Long areaId) { + SysDepartment byId = sysDepartmentService.getById(areaId); + List<SysDepartment> list = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, byId.getTreeCode()).like(name!=null,SysDepartment::getDepartmentName,name).eq(SysDepartment::getOrgType, 3).list(); LocalDate now = LocalDate.now(); for (SysDepartment sysDepartment : list) { //获取库存总量 - Long count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).eq(MwCollectRecord::getStatus, 3).groupBy(MwCollectRecord::getBoxNumber).count(); + BigDecimal count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() + .map(MwCollectRecord::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add); //获取接收数量 - Long count2 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveTime,now).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).eq(MwCollectRecord::getStatus, 3).groupBy(MwCollectRecord::getBoxNumber).count(); + BigDecimal count2 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getReceiveTime,now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() + .map(MwCollectRecord::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add); //获取处置数量 - Long count3 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveTime,now).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).eq(MwCollectRecord::getStatus, 4).groupBy(MwCollectRecord::getBoxNumber).count(); + BigDecimal count3 = collectRecordService.lambdaQuery().ge(MwCollectRecord::getDisposalTime,now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).list().stream() + .map(MwCollectRecord::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add); sysDepartment.setCont1(count1); sysDepartment.setCont2(count2); sysDepartment.setCont3(count3); @@ -147,19 +160,21 @@ MwStagingRoom one = roomService.lambdaQuery().eq(MwStagingRoom::getDepartmentId, departmentId).one(); Long count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStagingRoomId, one.getId()).eq(MwCollectRecord::getStatus, 1).count(); MwCollectRecord one1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getStagingRoomId, one.getId()).eq(MwCollectRecord::getStatus, 1).orderByDesc(MwCollectRecord::getBoxTime).last("limit 1").one(); + if (one1!=null){ + one.setBoxTime(one1.getBoxTime()); + } one.setCount(count); - one.setBoxTime(one1.getBoxTime()); return R.ok(one); } @ApiOperation(value = "医院转运记录") @PostMapping("/trans") - public R<List<CheckOutDto>> trans(LocalDate date,@ApiParam("医院id")@RequestParam Long departmentId) { - LocalDate now = LocalDate.now().minusDays(7); - if (date!=null){ - now = LocalDate.now(); - } - List<MwCheckoutRecord> list = mwCheckoutRecordService.lambdaQuery().ge(date ==null,MwCheckoutRecord::getCheckoutTime, now).eq(MwCheckoutRecord::getDepartmentId, departmentId).orderByDesc(MwCheckoutRecord::getCheckoutTime).list(); + public R<List<CheckOutDto>> trans(@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)LocalDate date, @ApiParam("医院id")@RequestParam Long departmentId) { +// LocalDate now = LocalDate.now().minusDays(7); +// if (date!=null){ +// now = LocalDate.now(); +// } + List<MwCheckoutRecord> list = mwCheckoutRecordService.lambdaQuery().ge(MwCheckoutRecord::getCheckoutTime, date.atStartOfDay()).le(MwCheckoutRecord::getCheckoutTime , date.atTime(23,59,59)).eq(MwCheckoutRecord::getDepartmentId, departmentId).orderByDesc(MwCheckoutRecord::getCheckoutTime).list(); List<CheckOutDto> backList = new ArrayList<>(); for (MwCheckoutRecord mwCheckoutRecord : list) { CheckOutDto checkOutDto = new CheckOutDto(); @@ -180,8 +195,12 @@ public R<CountTwoDto> outtotal2(@ApiParam("处置机构id")@RequestParam Long departmentId) { CountTwoDto countTwoDto = new CountTwoDto(); LocalDate now = LocalDate.now(); - Long count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).eq(MwCollectRecord::getReceiveTime, now).count(); - Long count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).eq(MwCollectRecord::getDisposalTime, now).count(); + BigDecimal count = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getReceiveTime, now.atStartOfDay()).le(MwCollectRecord::getReceiveTime,now.atTime(23,59,59)).list().stream() + .map(MwCollectRecord::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, departmentId).ge(MwCollectRecord::getDisposalTime, now.atStartOfDay()).le(MwCollectRecord::getDisposalTime,now.atTime(23,59,59)).list().stream() + .map(MwCollectRecord::getWeight) + .reduce(BigDecimal.ZERO, BigDecimal::add); countTwoDto.setCount(count); countTwoDto.setCount1(count1); return R.ok(countTwoDto); -- Gitblit v1.7.1