From 81f615750dec3e3aba4b607033609a1f3c7fc7fd Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 15 三月 2024 16:03:18 +0800
Subject: [PATCH] 业务管理:检验任务(update)

---
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 7948d72..35f6dff 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -40,4 +40,61 @@
         appointed,create_user,update_user,
         create_time,update_time
     </sql>
+    <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
+        SELECT DISTINCT
+            io.entrust_code,
+            io.type,
+            tempA.id,
+            tempA.sample,
+            tempA.sample_code,
+            tempA.send_time,
+            tempA.appointed,
+            tempA.ins_state,
+            tempA.ins_result,
+            tempA.user_id,
+            tempA.ins_order_id,
+            tempA.sample_user_id,
+            ipr.son_laboratory
+        FROM
+            (
+                SELECT
+                    temp.*
+                FROM
+                    (
+                        SELECT
+                            isa.id,
+                            isa.sample,
+                            isa.sample_code,
+                            isa.send_time,
+                            isa.appointed,
+                            isa.ins_state,
+                            isa.ins_result,
+                            isu.user_id,
+                            isa.ins_order_id,
+                            isu.id as sample_user_id
+                        FROM
+                            ins_sample isa
+                                LEFT JOIN ins_sample_user isu ON isa.id = isu.ins_sample_id
+                    ) AS temp
+                WHERE
+                    temp.user_id = #{ew.userId}
+                   OR ( SELECT COUNT(*) FROM ins_sample_user WHERE ins_sample_id = temp.id ) = 0
+            ) AS tempA
+                LEFT JOIN ins_order io ON tempA.ins_order_id = io.id
+                LEFT JOIN ins_product ipr ON tempA.id = ipr.ins_sample_id
+        WHERE
+          io.state = #{ew.state}
+          AND ipr.state = 1
+          AND ipr.son_laboratory = #{ew.childrenLaboratory}
+          <if test="ew.insState!=null and ew.insState!=''">
+              AND tempA.ins_state = #{ew.insState}
+          </if>
+          <if test="ew.sampleName!=null and ew.sampleName!=''">
+              AND tempA.sample like concat('%',#{ew.sampleName},'%')
+          </if>
+          <if test="ew.viewSelf==true">
+              AND tempA.sample_user_id is not null
+          </if>
+          ORDER BY io.type DESC
+    </select>
 </mapper>

--
Gitblit v1.9.3