From e8d0a2f9375da4d04da4a06a0f9fa8ef448512c4 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 19 十一月 2024 15:58:49 +0800
Subject: [PATCH] 检验下单审核进行企业微信推送

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

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index b03de3c..046862e 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -25,10 +25,21 @@
     </resultMap>
 
     <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
-        select * from(select * from(
+        select * from(
+        select * from(
         SELECT
-        a.*,ios.ins_state,ios.verify_tell,verify_user,ios.id
-        orderStateId,ios.create_time,ios.sort,sort_time,version,ios.num-1 num1
+        a.*,
+        ios.ins_state,
+        ios.verify_tell,
+        verify_user,
+        ios.id orderStateId,
+        ios.create_time,
+        (SELECT ins_time FROM ins_order_state WHERE ins_order_id = a.id AND laboratory = a.son_laboratory ORDER BY ins_time DESC LIMIT 1) AS ins_time ,
+        iou.submit_time ,
+        ios.sort,
+        sort_time,
+        version,
+        ios.num-1 num1
         FROM
         (
         SELECT
@@ -38,10 +49,10 @@
         io.appointed,
         io.send_time,
         group_concat(distinct isa.sample,' ') sample,
+        group_concat(distinct isa.sample_code,' ') sampleCode,
         userName,
         checkName,
         ip.son_laboratory,
-        io.ins_time,
         io.laboratory
         FROM
         ins_order io
@@ -74,6 +85,7 @@
         io.id
         ) a
         LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
+        LEFT JOIN ins_order_user iou ON ios.id = iou.ins_order_state_id and ios.num=iou.num
         ORDER BY
         ios.sort,
         sort_time desc,
@@ -104,6 +116,7 @@
         io.appointed,
         io.send_time,
         group_concat(distinct isa.sample,' ') sampleType,
+        group_concat(distinct isa.sample_code,' ') sampleCode,
         isu.user_id,
         user.name userName,
         ip.son_laboratory,
@@ -263,6 +276,8 @@
                ipr.com_value,
                ipr.equip_value,
                ipr.equip_name,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -331,6 +346,8 @@
                ipr.com_value,
                ipr.equip_value,
                ipr.equip_name,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -353,6 +370,7 @@
           and state = 1
           and ip.son_laboratory = #{laboratory}
           and ios.laboratory = #{laboratory}
+          and (ipr2.num is null or ipr.num is null)
     </select>
     <select id="getSampleEn" resultType="java.lang.String">
         select name_en
@@ -403,6 +421,8 @@
                ipr.ins_value,
                ipr.com_value,
                ipr.equip_value,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -475,6 +495,8 @@
                ipr.ins_value,
                ipr.com_value,
                ipr.equip_value,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -518,10 +540,13 @@
         ip.sample ip_sample,
         ip.model ip_model,
         ip.state,
+        io.issue_time,
+        u.name issueName,
         ins_sample_id
         from ins_sample isa
         left join ins_product ip on isa.id = ip.ins_sample_id
         left join ins_order io on io.id = ins_order_id
+        left join user u on io.issue_user = u.id
         where ip.state = 1
         and ins_order_id in
         <foreach collection="ids" open="(" close=")" item="id" separator=",">
@@ -576,6 +601,8 @@
                ipr.com_value,
                ipr.equip_value,
                ipr.equip_name,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -599,7 +626,7 @@
           and ios.laboratory = #{laboratory}
           and (ipr2.num = ios.num or ipr2.num is null)
           and (ipr.num = ios.num or ipr.num is null)
-        order by ipr.id, ipr2.id
+        order by ip.id, ipr.id, ipr2.id
     </select>
     <select id="getIns2Product1" resultMap="product">
         select ip.id            ip_id,
@@ -642,6 +669,8 @@
                ipr.com_value,
                ipr.equip_value,
                ipr.equip_name,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -663,7 +692,7 @@
           and ip.son_laboratory = #{laboratory}
           and ip.standard_method_list_id is not null
           and ios.laboratory = #{laboratory}
-        order by ipr.id, ipr2.id
+        order by ip.id, ipr.id, ipr2.id
     </select>
     <select id="get2InsProduct1" resultMap="product">
         select ip.id            ip_id,
@@ -706,6 +735,8 @@
                ipr.com_value,
                ipr.equip_value,
                ipr.equip_name,
+               ipr.before_check,
+               ipr.after_check,
                ipr2.frequency,
                ipr2.often,
                ipr2.port,
@@ -728,7 +759,7 @@
           and ip.standard_method_list_id is not null
           and ios.laboratory = #{laboratory}
           and (ipr2.num = #{num} or ipr.num = #{num})
-        order by ipr.id, ipr2.id
+        order by ip.id, ipr.id, ipr2.id
     </select>
 
     <select id="getReportModel" resultType="java.util.Map">
@@ -827,6 +858,8 @@
         <result property="insState" column="ins_state" jdbcType="INTEGER"/>
         <result property="joinNum" column="join_num" jdbcType="INTEGER"/>
         <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="issueTime" column="issue_time" />
+        <result property="issueName" column="issueName" />
         <result property="createUser" column="create_user" jdbcType="INTEGER"/>
         <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@@ -840,6 +873,8 @@
         <result property="insValue" column="ins_value" jdbcType="VARCHAR"/>
         <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
         <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
+        <result property="beforeCheck" column="before_check" jdbcType="VARCHAR"/>
+        <result property="afterCheck" column="after_check" jdbcType="VARCHAR"/>
         <result property="equipName" column="equip_name" jdbcType="VARBINARY"/>
     </resultMap>
     <resultMap id="insProductResult2" type="com.yuanchu.mom.pojo.InsProductResult2">
@@ -905,7 +940,8 @@
           and ip.id is not null
     </select>
     <select id="selectInsSample" resultType="com.yuanchu.mom.pojo.InsSample">
-        select isa.*,entrust_code
+        select isa.*,
+        case when entrust_code is null then out_entrust_code else entrust_code end as  entrust_code
         from ins_sample isa
         left join ins_order io on isa.ins_order_id = io.id
         where ins_order_id in
@@ -913,4 +949,16 @@
             #{id}
         </foreach>
     </select>
+    <select id="selectSample" resultType="com.yuanchu.mom.pojo.InsSample">
+        select distinct isa.*
+        from ins_sample isa
+                 left join ins_product ip on isa.id = ip.ins_sample_id
+        where son_laboratory = '鐢佃矾璇曢獙'
+          and state = 1
+          and ins_order_id = #{insOrderId}
+    </select>
+    <select id="selectList1" resultType="com.yuanchu.mom.dto.SampleProductDto">
+        select * from ins_sample where ins_order_id=#{id
+}
+    </select>
 </mapper>

--
Gitblit v1.9.3