From 4922e5fb02c3a095791a6f6e65c70883054fa3d9 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期五, 28 三月 2025 16:45:22 +0800
Subject: [PATCH] bug修改

---
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordItemServiceImpl.java |   16 ++
 medicalWaste-system/src/main/resources/mapper/system/MwDisposalRecordMapper.xml                             |    5 
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java              |    6 +
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDictDataServiceImpl.java                |    1 
 medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysDepartmentController.java      |    2 
 medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMicroEquipmentRecordItemMapper.java            |   14 ++
 medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java                         |  229 +++++++++++++++++++++++++++++++++++++-
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java     |   51 ++++++++
 medicalWaste-system/src/main/java/com/sinata/system/service/MwMicroEquipmentRecordItemService.java          |   12 +
 medicalWaste-system/src/main/resources/mapper/system/MwMicroEquipmentRecordItemMapper.xml                   |   23 +++
 10 files changed, 347 insertions(+), 12 deletions(-)

diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysDepartmentController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysDepartmentController.java
index 1ceb52a..2491ad0 100644
--- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysDepartmentController.java
+++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/backend/system/SysDepartmentController.java
@@ -55,7 +55,7 @@
      *
      * @return
      */
-    @ApiOperation(value = "获取全部/区域/医疗机构/处置单位/监管单位树-搜索框用", notes = "0:全部 1:区域 2:医疗机构 3:处置单位 4:监管单位 5:医疗机构、监管单位")
+    @ApiOperation(value = "获取全部/区域/医疗机构/处置单位/监管单位树-搜索框用", notes = "0:全部 1:区域 2:医疗机构 3:处置单位 4:监管单位 5:医疗机构、处置单位 6:医疗机构、监管单位 7:处置单位、监管单位")
     @GetMapping("/departmentSearchTree")
     @ApiImplicitParam(name = "type", value = "查询类型", required = true)
     public R<List<SysDepartmentVO>> getDepartmentSearchTree(@RequestParam(value = "type", required = true) @NotNull(message = "类型不能为空") Integer type) {
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMicroEquipmentRecordItemMapper.java b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMicroEquipmentRecordItemMapper.java
index 1c490d0..7112192 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMicroEquipmentRecordItemMapper.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/mapper/MwMicroEquipmentRecordItemMapper.java
@@ -2,7 +2,12 @@
 
 import com.sinata.system.domain.MwMicroEquipmentRecordItem;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sinata.system.domain.query.DisposalReportQuery;
+import com.sinata.system.domain.vo.MwCollectRecordVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -14,5 +19,12 @@
  */
 @Mapper
 public interface MwMicroEquipmentRecordItemMapper extends BaseMapper<MwMicroEquipmentRecordItem> {
-
+    /**
+     * 获取小型微波设备使用记录列表
+     *
+     * @param query
+     * @param treeCode
+     * @return
+     */
+    List<MwCollectRecordVO> getRegulationReportList(@Param("query") DisposalReportQuery query, @Param("treeCode") String treeCode);
 }
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/MwMicroEquipmentRecordItemService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/MwMicroEquipmentRecordItemService.java
index 91626ae..c881fc1 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/MwMicroEquipmentRecordItemService.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/MwMicroEquipmentRecordItemService.java
@@ -2,6 +2,10 @@
 
 import com.sinata.system.domain.MwMicroEquipmentRecordItem;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.sinata.system.domain.query.DisposalReportQuery;
+import com.sinata.system.domain.vo.MwCollectRecordVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +16,11 @@
  * @since 2024-12-02
  */
 public interface MwMicroEquipmentRecordItemService extends IService<MwMicroEquipmentRecordItem> {
-
+    /**
+     * 获取微波设备使用记录列表
+     *
+     * @param query
+     * @return
+     */
+    List<MwCollectRecordVO> getRegulationReportList(DisposalReportQuery query);
 }
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java
index 9b75a92..99967a7 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java
@@ -25,6 +25,7 @@
 import com.sinata.system.service.MwCollectRecordService;
 import com.sinata.system.service.MwDisposalHandleRecordService;
 import com.sinata.system.service.MwDisposalRecordService;
+import com.sinata.system.service.MwMicroEquipmentRecordItemService;
 import com.sinata.system.service.MwWarningRecordService;
 import com.sinata.system.service.SysDepartmentService;
 import com.sinata.system.utils.ImageToBase64;
@@ -59,6 +60,7 @@
     private final HttpServletResponse response;
     private final MwDisposalRecordService mwDisposalRecordService;
     private final MwDisposalHandleRecordService mwDisposalHandleRecordService;
+    private final MwMicroEquipmentRecordItemService mwMicroEquipmentRecordItemService;
 
 
 
@@ -141,6 +143,60 @@
                 }
             }
             list.add(itemVO);
+        }
+        // 添加合计行
+        if (!list.isEmpty()) {
+            DepartmentReportItemVO totalRow = new DepartmentReportItemVO();
+            totalRow.setName("合计");
+            totalRow.setData(new ArrayList<>());
+
+            // 计算各类型废物的数量和重量总计
+            for (SysDictDataVO sysDictDataVO : wasteTypeList) {
+                BigDecimal totalTypeCount = BigDecimal.ZERO;
+                BigDecimal totalTypeWeight = BigDecimal.ZERO;
+
+                for (DepartmentReportItemVO item : list) {
+                    // 每种废物类型占用两列(数量和重量)
+                    int index = wasteTypeList.indexOf(sysDictDataVO);
+                    int countIndex = index * 2;
+                    int weightIndex = countIndex + 1;
+
+                    if (countIndex < item.getData().size()) {
+                        totalTypeCount = totalTypeCount.add(item.getData().get(countIndex));
+                    }
+                    if (weightIndex < item.getData().size()) {
+                        totalTypeWeight = totalTypeWeight.add(item.getData().get(weightIndex));
+                    }
+                }
+
+                totalRow.getData().add(totalTypeCount);
+                totalRow.getData().add(totalTypeWeight);
+            }
+
+            // 计算总的数量和重量
+            BigDecimal finalTotalCount = BigDecimal.ZERO;
+            BigDecimal finalTotalWeight = BigDecimal.ZERO;
+
+            for (DepartmentReportItemVO item : list) {
+                int totalCountIndex = item.getData().size() - 2;
+                int totalWeightIndex = item.getData().size() - 1;
+
+                if (totalCountIndex >= 0 && totalWeightIndex >= 0) {
+                    finalTotalCount = finalTotalCount.add(item.getData().get(totalCountIndex));
+                    finalTotalWeight = finalTotalWeight.add(item.getData().get(totalWeightIndex));
+                }
+            }
+
+            totalRow.getData().add(finalTotalCount);
+            totalRow.getData().add(finalTotalWeight);
+
+            // 超时标记处理(如果有)
+            if (query.getDateType().equals(1)) {
+                totalRow.setOverTimeFlag("—"); // 合计行不显示超时标记
+            }
+
+            // 将合计行添加到列表开头
+            list.add(0, totalRow);
         }
         vo.setList(list);
         return vo;
@@ -228,11 +284,15 @@
         //List<SysDepartment> hospitalList = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, region.getTreeCode()).eq(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode()).list();
         List<TransformVO> checkoutRecordVOList = mwCheckoutRecordService.getCheckoutRecordList(query, region.getTreeCode());
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList()).orderByDesc(SysDictData::getDictCode).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList())
+                .orderByDesc(SysDictData::getDictCode).list();
         if (CollUtils.isNotEmpty(wasteTypeList)) {
             vo.setLegend(wasteTypeList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()));
             vo.getLegend().add("小计");
+
             List<DepartmentReportItemVO> list = new ArrayList<>();
+
+            // 处理各医院数据
             for (TransformVO transformVO : checkoutRecordVOList) {
                 BigDecimal totalCount = BigDecimal.ZERO;
                 BigDecimal totalWeight = BigDecimal.ZERO;
@@ -254,6 +314,58 @@
                 departmentReportItemVO.getData().add(totalWeight);
                 list.add(departmentReportItemVO);
             }
+
+            // 添加合计行
+            if (!list.isEmpty()) {
+                DepartmentReportItemVO totalRow = new DepartmentReportItemVO();
+                totalRow.setName("合计");
+                totalRow.setData(new ArrayList<>());
+
+                // 计算各类型废物的总数量和总重量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalTypeCount = BigDecimal.ZERO;
+                    BigDecimal totalTypeWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        // 获取当前废物类型在数据列表中的索引位置
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        // 每个废物类型占两列(数量和重量)
+                        int countIndex = index * 2;
+                        int weightIndex = countIndex + 1;
+
+                        if (countIndex < item.getData().size()) {
+                            totalTypeCount = totalTypeCount.add(item.getData().get(countIndex));
+                        }
+                        if (weightIndex < item.getData().size()) {
+                            totalTypeWeight = totalTypeWeight.add(item.getData().get(weightIndex));
+                        }
+                    }
+
+                    totalRow.getData().add(totalTypeCount);
+                    totalRow.getData().add(totalTypeWeight);
+                }
+
+                // 计算总的数量和重量
+                BigDecimal finalTotalCount = BigDecimal.ZERO;
+                BigDecimal finalTotalWeight = BigDecimal.ZERO;
+
+                for (DepartmentReportItemVO item : list) {
+                    int totalCountIndex = item.getData().size() - 2;
+                    int totalWeightIndex = item.getData().size() - 1;
+
+                    if (totalCountIndex >= 0 && totalWeightIndex >= 0) {
+                        finalTotalCount = finalTotalCount.add(item.getData().get(totalCountIndex));
+                        finalTotalWeight = finalTotalWeight.add(item.getData().get(totalWeightIndex));
+                    }
+                }
+
+                totalRow.getData().add(finalTotalCount);
+                totalRow.getData().add(finalTotalWeight);
+
+                // 将合计行添加到列表开头
+                list.add(0, totalRow);
+            }
+
             vo.setList(list);
         }
         return vo;
@@ -311,7 +423,8 @@
      */
     private List<List<String>> transformReportHead(List<Long> wasteTypeCodeList) {
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList)
+                .orderByDesc(SysDictData::getDictCode).list();
         List<List<String>> headTitles = Lists.newArrayList();
         headTitles.add(Lists.newArrayList("医院名称", "医院名称"));
         wasteTypeList.forEach(item -> {
@@ -356,7 +469,8 @@
         }
         List<String> dateList = DateUtils.getDayBetween(query.getStartTime(), query.getEndTime(), query.getDateType());
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList()).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList())
+                .orderByDesc(SysDictData::getDictCode).list();
         if (CollUtils.isNotEmpty(wasteTypeList)) {
             List<String> legend = wasteTypeList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
             vo.setLegend(legend);
@@ -382,6 +496,47 @@
                 }
                 list.add(departmentReportItemVO);
             }
+
+            // 添加合计行
+            if (!list.isEmpty()) {
+                DepartmentReportItemVO totalRow = new DepartmentReportItemVO();
+                totalRow.setName("合计");
+                totalRow.setData(new ArrayList<>());
+
+                // 计算各类型废物的接收总量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalReceiveWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        if (index < item.getData().size()) {
+                            totalReceiveWeight = totalReceiveWeight.add(item.getData().get(index));
+                        }
+                    }
+
+                    totalRow.getData().add(totalReceiveWeight);
+                }
+
+                // 计算各类型废物的处置总量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalDisposalWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        // 处置量数据在接收量数据之后,所以索引需要加上wasteTypeList的大小
+                        int disposalIndex = wasteTypeList.size() + index;
+                        if (disposalIndex < item.getData().size()) {
+                            totalDisposalWeight = totalDisposalWeight.add(item.getData().get(disposalIndex));
+                        }
+                    }
+
+                    totalRow.getData().add(totalDisposalWeight);
+                }
+
+                // 将合计行添加到列表开头
+                list.add(0, totalRow);
+            }
+
             vo.setList(list);
         }
         return vo;
@@ -441,7 +596,8 @@
      */
     private List<List<String>> disposalReportHead(List<Long> wasteTypeCodeList) {
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList)
+                .orderByDesc(SysDictData::getDictCode).list();
         List<List<String>> headTitles = Lists.newArrayList();
         headTitles.add(Lists.newArrayList("日期"));
         wasteTypeList.forEach(item -> {
@@ -471,6 +627,8 @@
         List<MwCollectRecordVO> checkoutRecordList = mwCheckoutRecordService.getRegulationReportList(query);
         //医废处置量
         List<MwCollectRecordVO> disposalRecordList = mwDisposalRecordService.getRegulationReportList(query);
+        List<MwCollectRecordVO> microEquipmentRecordList = mwMicroEquipmentRecordItemService.getRegulationReportList(query);
+        disposalRecordList.addAll(microEquipmentRecordList);
         SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.YYYY_MM_DD_HH_MM_SS);
         switch (query.getDateType()) {
             case 1:
@@ -485,7 +643,8 @@
         }
         List<String> dateList = DateUtils.getDayBetween(query.getStartTime(), query.getEndTime(), query.getDateType());
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList()).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList())
+                .orderByDesc(SysDictData::getDictCode).list();
         if (CollUtils.isNotEmpty(wasteTypeList)) {
             vo.setLegend(wasteTypeList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()));
             vo.setList(new ArrayList<>());
@@ -513,6 +672,63 @@
                 }
                 list.add(departmentReportItemVO);
             }
+
+            // 添加合计行
+            if (!list.isEmpty()) {
+                DepartmentReportItemVO totalRow = new DepartmentReportItemVO();
+                totalRow.setName("合计");
+                totalRow.setData(new ArrayList<>());
+
+                // 计算各类型废物的产生总量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalGeneratedWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        if (index < item.getData().size()) {
+                            totalGeneratedWeight = totalGeneratedWeight.add(item.getData().get(index));
+                        }
+                    }
+
+                    totalRow.getData().add(totalGeneratedWeight);
+                }
+
+                // 计算各类型废物的转移总量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalTransferWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        // 转移量数据在产生量数据之后,所以索引需要加上wasteTypeList的大小
+                        int transferIndex = wasteTypeList.size() + index;
+                        if (transferIndex < item.getData().size()) {
+                            totalTransferWeight = totalTransferWeight.add(item.getData().get(transferIndex));
+                        }
+                    }
+
+                    totalRow.getData().add(totalTransferWeight);
+                }
+
+                // 计算各类型废物的处置总量
+                for (SysDictData sysDictData : wasteTypeList) {
+                    BigDecimal totalDisposalWeight = BigDecimal.ZERO;
+
+                    for (DepartmentReportItemVO item : list) {
+                        int index = wasteTypeList.indexOf(sysDictData);
+                        // 处置量数据在产生量和转移量数据之后,所以索引需要加上wasteTypeList的大小的2倍
+                        int disposalIndex = wasteTypeList.size() * 2 + index;
+                        if (disposalIndex < item.getData().size()) {
+                            totalDisposalWeight = totalDisposalWeight.add(item.getData().get(disposalIndex));
+                        }
+                    }
+
+                    totalRow.getData().add(totalDisposalWeight);
+                }
+
+                // 将合计行添加到列表开头
+                list.add(0, totalRow);
+            }
+
             vo.setList(list);
         }
         return vo;
@@ -566,7 +782,8 @@
      */
     private List<List<String>> regulationReportHead(List<Long> wasteTypeCodeList) {
         //查询医废类型
-        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList).list();
+        List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, wasteTypeCodeList)
+                .orderByDesc(SysDictData::getDictCode).list();
         List<List<String>> headTitles = Lists.newArrayList();
         headTitles.add(Lists.newArrayList("日期"));
         wasteTypeList.forEach(item -> {
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordItemServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordItemServiceImpl.java
index 181abae..1b7b28a 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordItemServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordItemServiceImpl.java
@@ -1,10 +1,17 @@
 package com.sinata.system.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sinata.system.domain.MwMicroEquipmentRecordItem;
+import com.sinata.system.domain.query.DisposalReportQuery;
+import com.sinata.system.domain.vo.MwCollectRecordVO;
 import com.sinata.system.mapper.MwMicroEquipmentRecordItemMapper;
 import com.sinata.system.service.MwMicroEquipmentRecordItemService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sinata.system.service.SysDepartmentService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * <p>
@@ -15,6 +22,13 @@
  * @since 2024-12-02
  */
 @Service
+@RequiredArgsConstructor(onConstructor_ = @Lazy)
 public class MwMicroEquipmentRecordItemServiceImpl extends ServiceImpl<MwMicroEquipmentRecordItemMapper, MwMicroEquipmentRecordItem> implements MwMicroEquipmentRecordItemService {
+    private final SysDepartmentService sysDepartmentService;
 
+    @Override
+    public List<MwCollectRecordVO> getRegulationReportList(DisposalReportQuery query) {
+        String treeCode = sysDepartmentService.getTreeCodeByDepartmentId(query.getDepartmentId());
+        return baseMapper.getRegulationReportList(query, treeCode);
+    }
 }
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java
index ec4b822..dd2aca7 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java
@@ -256,6 +256,57 @@
             departmentReportItemVO.getData().add(totalCount);
             result.add(departmentReportItemVO);
         }
+
+        // 添加合计行
+        if (!result.isEmpty()) {
+            DepartmentReportItemVO totalRow = new DepartmentReportItemVO();
+            totalRow.setName("合计");
+            totalRow.setData(new ArrayList<>());
+
+            // 计算各类型废物的重量和数量总计
+            for (SysDictData sysDictData : medicalWasteTypeList) {
+                BigDecimal totalTypeWeight = BigDecimal.ZERO;
+                BigDecimal totalTypeCount = BigDecimal.ZERO;
+
+                for (DepartmentReportItemVO item : result) {
+                    // 每种废物类型占用两列(重量和数量)
+                    int index = medicalWasteTypeList.indexOf(sysDictData);
+                    int weightIndex = index * 2;
+                    int countIndex = weightIndex + 1;
+
+                    if (weightIndex < item.getData().size()) {
+                        totalTypeWeight = totalTypeWeight.add(item.getData().get(weightIndex));
+                    }
+                    if (countIndex < item.getData().size()) {
+                        totalTypeCount = totalTypeCount.add(item.getData().get(countIndex));
+                    }
+                }
+
+                totalRow.getData().add(totalTypeWeight);
+                totalRow.getData().add(totalTypeCount);
+            }
+
+            // 计算总的重量和数量
+            BigDecimal finalTotalWeight = BigDecimal.ZERO;
+            BigDecimal finalTotalCount = BigDecimal.ZERO;
+
+            for (DepartmentReportItemVO item : result) {
+                int totalWeightIndex = item.getData().size() - 2;
+                int totalCountIndex = item.getData().size() - 1;
+
+                if (totalWeightIndex >= 0 && totalCountIndex >= 0) {
+                    finalTotalWeight = finalTotalWeight.add(item.getData().get(totalWeightIndex));
+                    finalTotalCount = finalTotalCount.add(item.getData().get(totalCountIndex));
+                }
+            }
+
+            totalRow.getData().add(finalTotalWeight);
+            totalRow.getData().add(finalTotalCount);
+
+            // 将合计行添加到列表开头
+            result.add(0, totalRow);
+        }
+
         vo.setList(result);
         return vo;
     }
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
index b3596f0..c2c1014 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
@@ -92,6 +92,12 @@
             case 5:
                 childrenMap = getChildrenDepartmentByOrgType(myDepartment, Arrays.asList(DepartmentEnum.REGION.getCode(), DepartmentEnum.MEDICAL_INSTITUTION.getCode(), DepartmentEnum.DISPOSAL_UNIT.getCode()));
                 break;
+            case 6:
+                childrenMap = getChildrenDepartmentByOrgType(myDepartment, Arrays.asList(DepartmentEnum.REGION.getCode(), DepartmentEnum.MEDICAL_INSTITUTION.getCode(), DepartmentEnum.REGULATORY_UNIT.getCode()));
+                break;
+            case 7:
+                childrenMap = getChildrenDepartmentByOrgType(myDepartment, Arrays.asList(DepartmentEnum.REGION.getCode(), DepartmentEnum.DISPOSAL_UNIT.getCode(), DepartmentEnum.REGULATORY_UNIT.getCode()));
+                break;
             default:
                 childrenMap = getChildrenDepartmentByOrgType(myDepartment, null);
         }
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDictDataServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDictDataServiceImpl.java
index 79e5d86..17058ea 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDictDataServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDictDataServiceImpl.java
@@ -133,6 +133,7 @@
         Page<SysDictData> result = this.lambdaQuery()
                 .like(StringUtils.isNotBlank(query.getKeyword()), SysDictData::getDictLabel, query.getKeyword())
                 .eq(StringUtils.isNotBlank(query.getDictType()), SysDictData::getDictType, query.getDictType())
+                .orderByDesc(SysDictData::getDictCode)
                 .page(new Page<>(query.getPageCurr(), query.getPageSize()));
         List<String> dictTypeList = result.getRecords().stream().map(SysDictData::getDictType).distinct().collect(Collectors.toList());
         if (CollUtils.isNotEmpty(dictTypeList)) {
diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwDisposalRecordMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwDisposalRecordMapper.xml
index 86c6bc5..d29252b 100644
--- a/medicalWaste-system/src/main/resources/mapper/system/MwDisposalRecordMapper.xml
+++ b/medicalWaste-system/src/main/resources/mapper/system/MwDisposalRecordMapper.xml
@@ -130,8 +130,9 @@
         MCR.WEIGHT,
         MDHR.DISPOSAL_TIME AS collectTime
         FROM MW_DISPOSAL_HANDLE_RECORD MDHR
-        LEFT JOIN MW_COLLECT_RECORD MCR ON MCR.DISPOSAL_HANDLE_RECORD_ID = MDHR.ID
-        LEFT JOIN SYS_DEPARTMENT SD ON SD.ID = MDHR.DEPARTMENT_ID
+        INNER JOIN MW_DISPOSAL_HANDLE_RECORD_ITEM MDHRI ON MDHRI.DISPOSAL_HANDLE_RECORD_ID = MDHR.ID
+        INNER JOIN MW_COLLECT_RECORD MCR ON MDHRI.COLLECT_RECORD_ID = MCR.ID
+        INNER JOIN SYS_DEPARTMENT SD ON SD.ID = MDHR.DEPARTMENT_ID
         <where>
             MDHR.DEL_FLAG = 0
             <if test="treeCode != null and treeCode != ''">
diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwMicroEquipmentRecordItemMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwMicroEquipmentRecordItemMapper.xml
index 8d38e8c..b0bb5d8 100644
--- a/medicalWaste-system/src/main/resources/mapper/system/MwMicroEquipmentRecordItemMapper.xml
+++ b/medicalWaste-system/src/main/resources/mapper/system/MwMicroEquipmentRecordItemMapper.xml
@@ -13,5 +13,28 @@
     <sql id="Base_Column_List">
         ID, EQUIPMENT_RECORD_ID, COLLECT_RECORD_ID
     </sql>
+    <select id="getRegulationReportList" resultType="com.sinata.system.domain.vo.MwCollectRecordVO"
+            parameterType="com.sinata.system.domain.query.DisposalReportQuery">
+        SELECT MCR.ID, MCR.WASTE_TYPE, MCR.WEIGHT, MMER.USE_TIME AS collectTime
+        FROM MW_MICRO_EQUIPMENT_RECORD MMER INNER JOIN MW_MICRO_EQUIPMENT_RECORD_ITEM MMERI on MMER.ID =
+        MMERI.EQUIPMENT_RECORD_ID
+        INNER JOIN MW_COLLECT_RECORD MCR ON MCR.ID = MMERI.COLLECT_RECORD_ID
+        INNER JOIN SYS_DEPARTMENT SD ON SD.ID = MCR.DEPARTMENT_ID
+        <where>
+            MMER.DEL_FLAG = 0
+            <if test="treeCode != null and treeCode != ''">
+                AND SD.TREE_CODE LIKE CONCAT(#{treeCode}, '%')
+            </if>
+            <if test="query.startTime != null and query.endTime != null">
+                AND MMER.USE_TIME BETWEEN #{query.startTime} AND #{query.endTime}
+            </if>
+            <if test="query.wasteTypeCodeList != null and query.wasteTypeCodeList.size()>0">
+                AND MCR.WASTE_TYPE IN
+                <foreach collection="query.wasteTypeCodeList" item="wasteType" separator="," open="(" close=")">
+                    #{wasteType}
+                </foreach>
+            </if>
+        </where>
+    </select>
 
 </mapper>

--
Gitblit v1.7.1