From 4f45f29e6b53f4c01b414409c5000ff4e212b3d9 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 05 六月 2026 13:36:54 +0800
Subject: [PATCH] 增加eip

---
 report-server/src/main/resources/mapper/SampleProgressMapper.xml |   98 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 insertions(+), 0 deletions(-)

diff --git a/report-server/src/main/resources/mapper/SampleProgressMapper.xml b/report-server/src/main/resources/mapper/SampleProgressMapper.xml
new file mode 100644
index 0000000..ac9dfd1
--- /dev/null
+++ b/report-server/src/main/resources/mapper/SampleProgressMapper.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.report.mapper.SampleProgressMapper">
+
+    <!-- 鍒嗛〉鏌ヨ鏍峰搧杩涘害 -->
+    <select id="pageSampleProgress" resultType="com.ruoyi.report.vo.SampleProgressVo">
+        SELECT
+            s.id AS sampleId,
+            o.entrust_code AS entrustCode,
+            s.sample_code AS sampleCode,
+            s.sample AS sampleName,
+            r.code AS reportCode,
+            o.ins_state AS insState,
+            COUNT(p.id) AS totalItems,
+            SUM(CASE WHEN p.ins_result IS NOT NULL THEN 1 ELSE 0 END) AS finishedItems,
+            o.appointed AS planFinishTime,
+            o.ins_time AS actualFinishTime,
+            u.name AS chargeUser,
+            o.custom AS custom,
+            s.create_time AS createTime
+        FROM ins_sample s
+        LEFT JOIN ins_order o ON s.ins_order_id = o.id
+        LEFT JOIN ins_product p ON s.id = p.ins_sample_id
+        LEFT JOIN ins_report r ON o.id = r.ins_order_id
+        LEFT JOIN user u ON o.prepare_user_id = u.id
+        WHERE 1=1
+        <if test="dto.entrustCode != null and dto.entrustCode != ''">
+            AND o.entrust_code LIKE CONCAT('%', #{dto.entrustCode}, '%')
+        </if>
+        <if test="dto.sampleCode != null and dto.sampleCode != ''">
+            AND s.sample_code LIKE CONCAT('%', #{dto.sampleCode}, '%')
+        </if>
+        <if test="dto.sampleName != null and dto.sampleName != ''">
+            AND s.sample LIKE CONCAT('%', #{dto.sampleName}, '%')
+        </if>
+        <if test="dto.reportCode != null and dto.reportCode != ''">
+            AND r.code LIKE CONCAT('%', #{dto.reportCode}, '%')
+        </if>
+        <if test="dto.insState != null">
+            AND o.ins_state = #{dto.insState}
+        </if>
+        <if test="dto.custom != null and dto.custom != ''">
+            AND o.custom LIKE CONCAT('%', #{dto.custom}, '%')
+        </if>
+        <if test="dto.startTime != null and dto.startTime != ''">
+            AND s.create_time >= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null and dto.endTime != ''">
+            AND s.create_time &lt;= #{dto.endTime}
+        </if>
+        GROUP BY s.id
+        ORDER BY s.create_time DESC
+    </select>
+
+    <!-- 鑾峰彇缁熻鏁版嵁 -->
+    <select id="getStatistics" resultType="java.util.Map">
+        SELECT
+            SUM(CASE WHEN o.ins_state = 0 THEN 1 ELSE 0 END) AS waitInspection,
+            SUM(CASE WHEN o.ins_state = 1 THEN 1 ELSE 0 END) AS inspecting,
+            SUM(CASE WHEN o.ins_state = 3 THEN 1 ELSE 0 END) AS waitAudit,
+            SUM(CASE WHEN o.ins_state = 5 THEN 1 ELSE 0 END) AS finished
+        FROM ins_sample s
+        LEFT JOIN ins_order o ON s.ins_order_id = o.id
+        WHERE 1=1
+        <if test="dto.custom != null and dto.custom != ''">
+            AND o.custom LIKE CONCAT('%', #{dto.custom}, '%')
+        </if>
+        <if test="dto.startTime != null and dto.startTime != ''">
+            AND s.create_time >= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null and dto.endTime != ''">
+            AND s.create_time &lt;= #{dto.endTime}
+        </if>
+    </select>
+
+    <!-- 鑾峰彇鍥捐〃鏁版嵁 -->
+    <select id="getChartData" resultType="java.util.Map">
+        SELECT
+            DATE_FORMAT(s.create_time, '%Y-%m-%d') AS date,
+            COUNT(*) AS totalCount,
+            SUM(CASE WHEN o.ins_state = 5 THEN 1 ELSE 0 END) AS finishedCount
+        FROM ins_sample s
+        LEFT JOIN ins_order o ON s.ins_order_id = o.id
+        WHERE 1=1
+        <if test="dto.custom != null and dto.custom != ''">
+            AND o.custom LIKE CONCAT('%', #{dto.custom}, '%')
+        </if>
+        <if test="dto.startTime != null and dto.startTime != ''">
+            AND s.create_time >= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null and dto.endTime != ''">
+            AND s.create_time &lt;= #{dto.endTime}
+        </if>
+        GROUP BY DATE_FORMAT(s.create_time, '%Y-%m-%d')
+        ORDER BY date ASC
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3