From 1fd9e721593f0d22d16cdbac6b341553b1168cf7 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期三, 02 四月 2025 20:49:44 +0800
Subject: [PATCH] bug修改

---
 medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java                     |   72 +++++++++++++++++++++++++-----------
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwMicroEquipmentRecordServiceImpl.java |   24 ++++++++---
 medicalWaste-system/src/main/resources/mapper/system/MwCheckoutRecordMapper.xml                         |    4 +-
 3 files changed, 69 insertions(+), 31 deletions(-)

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 8050b30..6970076 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
@@ -216,7 +216,7 @@
      * @return
      */
     public void hospitalReportExport(HospitalReportQuery query) throws IOException {
-        List<List<String>> head = hospitalReportHead();
+        List<List<String>> head = hospitalReportHead(query.getDepartmentId());
         System.out.println(JSONObject.toJSONString(head));
         // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
         response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@@ -262,16 +262,25 @@
      *
      * @return
      */
-    private List<List<String>> hospitalReportHead() {
+    private List<List<String>> hospitalReportHead(Long departmentId) {
+        SysDepartment department = sysDepartmentService.getById(departmentId);
         List<SysDictDataVO> wasteTypeList = sysDictDataService.medicalWasteTypeList();
         List<List<String>> headTitles = Lists.newArrayList();
-        headTitles.add(Lists.newArrayList("日期", "日期"));
+        String title = "";
+        if (Objects.nonNull(department)) {
+            title = department.getDepartmentName() + "医废报表";
+        } else {
+            title = "医废报表";
+        }
+        headTitles.add(Lists.newArrayList(title, "日期", "日期"));
+        String finalTitle = title;
         wasteTypeList.forEach(item -> {
-            headTitles.add(Lists.newArrayList(item.getDictLabel(), "数量"));
-            headTitles.add(Lists.newArrayList(item.getDictLabel(), "重量(KG)"));
+            headTitles.add(Lists.newArrayList(finalTitle, item.getDictLabel(), "数量"));
+            headTitles.add(Lists.newArrayList(finalTitle, item.getDictLabel(), "重量(KG)"));
         });
-        headTitles.add(Lists.newArrayList("小计", "数量"));
-        headTitles.add(Lists.newArrayList("小计", "重量(KG)"));
+        headTitles.add(Lists.newArrayList(title, "小计", "数量"));
+        headTitles.add(Lists.newArrayList(title, "小计", "重量(KG)"));
+        headTitles.add(Lists.newArrayList(title, "是否超时", "是否超时"));
         return headTitles;
     }
 
@@ -554,7 +563,7 @@
      * @throws IOException
      */
     public void disposalReportExport(DisposalReportQuery query) throws IOException {
-        List<List<String>> head = disposalReportHead(query.getWasteTypeCodeList());
+        List<List<String>> head = disposalReportHead(query);
         System.out.println(JSONObject.toJSONString(head));
         // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
         response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@@ -596,19 +605,28 @@
     /**
      * 处置报表表头
      *
-     * @param wasteTypeCodeList
+     * @param query
      * @return
      */
-    private List<List<String>> disposalReportHead(List<Long> wasteTypeCodeList) {
+    private List<List<String>> disposalReportHead(DisposalReportQuery query) {
         //查询医废类型
-        List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeListByDictCode(wasteTypeCodeList);
+        List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeListByDictCode(query.getWasteTypeCodeList());
+        SysDepartment department = sysDepartmentService.getById(query.getDepartmentId());
+        String title = "";
+        if (Objects.nonNull(department)) {
+            title = department.getDepartmentName() + "处置报表";
+        } else {
+            title = "处置报表";
+        }
         List<List<String>> headTitles = Lists.newArrayList();
-        headTitles.add(Lists.newArrayList("日期"));
+        headTitles.add(Lists.newArrayList(title, "日期", "日期"));
+        String finalTitle = title;
         sysDictDataVOS.forEach(item -> {
-            headTitles.add(Lists.newArrayList("医疗废物接收量(kg)", item.getDictLabel()));
+            headTitles.add(Lists.newArrayList(finalTitle, "医疗废物接收量(kg)", item.getDictLabel()));
         });
+        String finalTitle1 = title;
         sysDictDataVOS.forEach(item -> {
-            headTitles.add(Lists.newArrayList("医疗废物处置量(kg)", item.getDictLabel()));
+            headTitles.add(Lists.newArrayList(finalTitle1, "医疗废物处置量(kg)", item.getDictLabel()));
         });
         return headTitles;
     }
@@ -738,7 +756,7 @@
     }
 
     public void regulationReportExport(DisposalReportQuery query) throws IOException {
-        List<List<String>> head = regulationReportHead(query.getWasteTypeCodeList());
+        List<List<String>> head = regulationReportHead(query);
         System.out.println(JSONObject.toJSONString(head));
         // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
         response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@@ -780,22 +798,32 @@
     /**
      * 监管报表表头
      *
-     * @param wasteTypeCodeList
+     * @param query
      * @return
      */
-    private List<List<String>> regulationReportHead(List<Long> wasteTypeCodeList) {
+    private List<List<String>> regulationReportHead(DisposalReportQuery query) {
         //查询医废类型
-        List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeListByDictCode(wasteTypeCodeList);
+        List<SysDictDataVO> sysDictDataVOS = sysDictDataService.medicalWasteTypeListByDictCode(query.getWasteTypeCodeList());
+        SysDepartment department = sysDepartmentService.getById(query.getDepartmentId());
+        String title = "";
+        if (Objects.nonNull(department)) {
+            title = department.getDepartmentName() + "监管报表";
+        } else {
+            title = "监管报表";
+        }
         List<List<String>> headTitles = Lists.newArrayList();
-        headTitles.add(Lists.newArrayList("日期"));
+        headTitles.add(Lists.newArrayList(title, "日期", "日期"));
+        String finalTitle = title;
         sysDictDataVOS.forEach(item -> {
-            headTitles.add(Lists.newArrayList("医疗废物产生量(kg)", item.getDictLabel()));
+            headTitles.add(Lists.newArrayList(finalTitle, "医疗废物产生量(kg)", item.getDictLabel()));
         });
+        String finalTitle1 = title;
         sysDictDataVOS.forEach(item -> {
-            headTitles.add(Lists.newArrayList("医疗废物转移量(kg)", item.getDictLabel()));
+            headTitles.add(Lists.newArrayList(finalTitle1, "医疗废物转移量(kg)", item.getDictLabel()));
         });
+        String finalTitle2 = title;
         sysDictDataVOS.forEach(item -> {
-            headTitles.add(Lists.newArrayList("医疗废物处置量(kg)", item.getDictLabel()));
+            headTitles.add(Lists.newArrayList(finalTitle2, "医疗废物处置量(kg)", item.getDictLabel()));
         });
         return headTitles;
     }
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 735cdf0..2b6976d 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
@@ -312,7 +312,7 @@
     @Override
     public void staticsExport(MwMicroEquipmentStaticsQuery query, HttpServletResponse response) throws IOException {
 
-        List<List<String>> head = head();
+        List<List<String>> head = head(query);
         System.out.println(JSONObject.toJSONString(head));
         // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
         response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
@@ -355,16 +355,26 @@
      *
      * @return
      */
-    private List<List<String>> head() {
+    private List<List<String>> head(MwMicroEquipmentStaticsQuery query) {
         List<SysDictData> medicalWasteTypeList = sysDictDataService.lambdaQuery().eq(SysDictData::getDictType, "medical_waste_type").list();
         List<List<String>> headTitles = Lists.newArrayList();
-        headTitles.add(Lists.newArrayList("日期"));
+        SysDepartment department = sysDepartmentService.getById(query.getDepartmentId());
+        MwMicroEquipment microEquipment = mwMicroEquipmentService.getById(query.getEquipmentId());
+        //修改代码判断department不为空才拼接
+        String title = "";
+        if (Objects.nonNull(department) && Objects.nonNull(microEquipment)) {
+            title = department.getDepartmentName() + microEquipment.getEquipmentName() + "处置报表";
+        } else {
+            title = "处置报表";
+        }
+        headTitles.add(Lists.newArrayList(title, "日期", "日期"));
+        String finalTitle = title;
         medicalWasteTypeList.forEach(item -> {
-            headTitles.add(Lists.newArrayList(item.getDictLabel(), "总重量(KG)"));
-            headTitles.add(Lists.newArrayList(item.getDictLabel(), "总数量"));
+            headTitles.add(Lists.newArrayList(finalTitle, item.getDictLabel(), "总重量(KG)"));
+            headTitles.add(Lists.newArrayList(finalTitle, item.getDictLabel(), "总数量"));
         });
-        headTitles.add(Lists.newArrayList("小计", "总重量(KG)"));
-        headTitles.add(Lists.newArrayList("小计", "总数量"));
+        headTitles.add(Lists.newArrayList(title, "小计", "总重量(KG)"));
+        headTitles.add(Lists.newArrayList(title, "小计", "总数量"));
         return headTitles;
     }
 
diff --git a/medicalWaste-system/src/main/resources/mapper/system/MwCheckoutRecordMapper.xml b/medicalWaste-system/src/main/resources/mapper/system/MwCheckoutRecordMapper.xml
index d607856..bc8e7d5 100644
--- a/medicalWaste-system/src/main/resources/mapper/system/MwCheckoutRecordMapper.xml
+++ b/medicalWaste-system/src/main/resources/mapper/system/MwCheckoutRecordMapper.xml
@@ -156,10 +156,10 @@
             <if test="query.licensePlateNumber != null">
                 AND MTC.LICENSE_PLATE_NUMBER LIKE CONCAT('%',#{query.licensePlateNumber},'%')
             </if>
-            <if test="query.status != null and (query.status == 3 or query.status == 4)">
+            <if test="query.status != null and query.status == 3">
                 AND MCR.STATUS IN (3,4)
             </if>
-            <if test="query.status != null">
+            <if test="query.status != null and query.status == 2">
                 AND MCR.STATUS =#{query.status}
             </if>
             <if test="query.startTimeStart != null and query.startTimeEnd != null">

--
Gitblit v1.7.1