From ccd758bcd9b357b365c28f62efde203faa83fb93 Mon Sep 17 00:00:00 2001
From: luoyisheng <yangdongji@argo-ai.cn>
Date: 星期一, 24 二月 2025 14:45:10 +0800
Subject: [PATCH] bug

---
 medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppDepartmentController.java |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 57 insertions(+), 10 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 d87f1e5..8d37177 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
@@ -6,6 +6,7 @@
 import com.sinata.system.domain.*;
 import com.sinata.system.domain.dto.CheckOutDto;
 import com.sinata.system.domain.dto.CollectTotalUpDto;
+import com.sinata.system.domain.dto.CountTwoDto;
 import com.sinata.system.domain.dto.SysDepartmentDTO;
 import com.sinata.system.domain.vo.SysDepartmentVO;
 import com.sinata.system.mapper.SysDepartmentMapper;
@@ -16,6 +17,7 @@
 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.*;
 
@@ -54,8 +56,28 @@
     @PostMapping("/regionTree")
     @ApiImplicitParam(name = "keyword", value = "关键字", required = false)
     public R<List<SysDepartmentVO>> getRegionTree(@RequestParam(required = false) String keyword) {
-        return R.ok(sysDepartmentService.getRegionTree(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) {
+        List<SysDepartmentVO> regionTree1 = sysDepartmentService.getRegionTree2(keyword);
+        return R.ok(regionTree1);
+    }
+
+
+
+
+    @ApiOperation("获取单位详情")
+    @PostMapping("/detail")
+    public R<SysDepartment> getRegionTree(@RequestParam(required = true) Long id) {
+        return R.ok(sysDepartmentService.getById(id));
+
+    }
+
 
     /**
      * 获取区域树
@@ -65,18 +87,18 @@
     @ApiOperation(value = "获取全部/区域/医疗机构/处置单位/监管单位树-搜索框用", notes = "0:全部 1:区域 2:医疗机构 3:处置单位 4:监管单位")
     @PostMapping("/departmentSearchTree")
     @ApiImplicitParam(name = "type", value = "查询类型", required = true)
-    public R<List<SysDepartmentVO>> getDepartmentSearchTree(@RequestParam(value = "type", required = true) @NotNull(message = "类型不能为空") Integer type) {
-        return R.ok(sysDepartmentService.listByType(type));
+    public R<List<SysDepartmentVO>> getDepartmentSearchTree() {
+        return R.ok(sysDepartmentService.getRegionTree2(null));
     }
 
     @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) {
+        List<SysDepartment> list = sysDepartmentService.lambdaQuery().eq(areaId!=null,SysDepartment::getParentId,areaId).like(name!=null,SysDepartment::getDepartmentName,name).eq(SysDepartment::getOrgType, 2).list();
         for (SysDepartment sysDepartment : list) {
             //获取医院暂存间信息
             MwStagingRoom one = roomService.lambdaQuery().eq(MwStagingRoom::getDepartmentId, sysDepartment.getId()).one();
-            if (one != null) {
+            if (one == null) {
                 continue;
             }
             //获取存了多少数量
@@ -101,11 +123,11 @@
         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();
+            Long count1 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count();
             //获取接收数量
-            Long count2 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveTime,now).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).eq(MwCollectRecord::getStatus, 3).groupBy(MwCollectRecord::getBoxNumber).count();
+            Long count2 = collectRecordService.lambdaQuery().isNotNull(MwCollectRecord::getReceiveTime).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count();
             //获取处置数量
-            Long count3 = collectRecordService.lambdaQuery().eq(MwCollectRecord::getReceiveTime,now).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).eq(MwCollectRecord::getStatus, 4).groupBy(MwCollectRecord::getBoxNumber).count();
+            Long count3 = collectRecordService.lambdaQuery().isNotNull(MwCollectRecord::getDisposalTime).eq(MwCollectRecord::getReceiveDepartmentId, sysDepartment.getId()).count();
             sysDepartment.setCont1(count1);
             sysDepartment.setCont2(count2);
             sysDepartment.setCont3(count3);
@@ -121,9 +143,21 @@
         return R.ok(collectRecordService.collectTotal3(departmentId));
     }
 
+
+    @ApiOperation("医院暂存间情况上")
+    @PostMapping("/up/room")
+    public R<MwStagingRoom> collecttotal2(@ApiParam("医院id")@RequestParam Long departmentId) {
+        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();
+        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) {
+    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();
@@ -144,6 +178,19 @@
         return R.ok(backList);
     }
 
+    @ApiOperation(value = "处置详情上")
+    @PostMapping("/end/total/up")
+    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();
+        countTwoDto.setCount(count);
+        countTwoDto.setCount1(count1);
+        return R.ok(countTwoDto);
+    }
+
+
     @ApiOperation(value = "处置详情")
     @PostMapping("/end/total")
     public R<List<CollectTotalUpDto>> outtotal1(@ApiParam("处置机构id")@RequestParam Long departmentId) {

--
Gitblit v1.7.1