From bb9499352faae20bb2c898f3f6078f7a4e9ceef2 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期五, 19 四月 2024 10:17:19 +0800
Subject: [PATCH] 检验项目数据导入;检验模板调整

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

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index b5effec..f5822aa 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -29,7 +29,7 @@
     <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
         select * from(
         SELECT
-        *
+        a.*,ios.ins_state,ios.verify_tell
         FROM
         (
         SELECT
@@ -41,7 +41,6 @@
         io.sample_type,
         isu.user_id,
         ip.son_laboratory,
-        io.ins_state,
         io.ins_result
         FROM
         ins_order io
@@ -52,11 +51,12 @@
         io.state = 1
         AND io.ins_state != 5
         and send_time is not null
+        and (isu.user_id = #{userId} OR isu.user_id is NULL)
         GROUP BY
         ip.son_laboratory,
         io.id
         ) a
-        where a.user_id = #{userId} OR a.user_id is NULL
+        LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
         ORDER BY
         a.user_id DESC,
         a.type DESC,
@@ -101,11 +101,60 @@
                ip.update_user ip_update_user,
                ip.create_time ip_create_time,
                ip.update_time ip_update_time,
-               template_id
+               template_id,
+               ipr.ins_value,
+               ipr.com_value,
+               ipr.equip_value
         from ins_sample isa
         left join ins_product ip on isa.id = ip.ins_sample_id
+        left join ins_product_result ipr on ip.id = ipr.ins_product_id
         where ins_order_id = #{id}
         and state = 1
+    </select>
+    <select id="getInsOrderAndSample" resultMap="sampleDto">
+        select isa.*,
+               ip.id ip_id,
+               inspection_item,
+               inspection_item_classify,
+               inspection_item_subclass,
+               ip.factory ip_factory,
+               ip.laboratory ip_laboratory,
+               ip.sample_type ip_sample_type,
+               ip.sample ip_sample,
+               ip.model ip_model,
+               son_laboratory,
+               ip.unit ip_unit,
+               price,
+               man_hour,
+               man_hour_group,
+               inspection_item_type,
+               inspection_value_type,
+               device_group,
+               checkout_number,
+               section,
+               value_type,
+               method,
+               man_day,
+               bsm,
+               ask,
+               `last_value`,
+               ip.ins_result ip_ins_result,
+               state,
+               ins_sample_id,
+               ip.create_user ip_create_user,
+               ip.update_user ip_update_user,
+               ip.create_time ip_create_time,
+               ip.update_time ip_update_time,
+               template_id,
+               ipr.ins_value,
+               ipr.com_value,
+               ipr.equip_value
+        from ins_sample isa
+        left join ins_product ip on isa.id = ip.ins_sample_id
+        left join ins_product_result ipr on ip.id = ipr.ins_product_id
+        where ins_order_id = #{id}
+        and state = 1
+        and ip.son_laboratory = #{laboratory}
     </select>
 
     <resultMap id="sampleDto" type="com.yuanchu.mom.dto.SampleProductDto">
@@ -167,5 +216,12 @@
         <result property="createTime" column="ip_create_time" jdbcType="TIMESTAMP"/>
         <result property="updateTime" column="ip_update_time" jdbcType="TIMESTAMP"/>
         <result property="templateId" column="template_id" jdbcType="INTEGER"/>
+        <collection property="insProductResult" resultMap="insProductResult"/>
+    </resultMap>
+
+    <resultMap id="insProductResult" type="com.yuanchu.mom.pojo.InsProductResult">
+        <result property="insValue" column="ins_value" jdbcType="VARCHAR"/>
+        <result property="comValue" column="com_value" jdbcType="VARCHAR"/>
+        <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
     </resultMap>
 </mapper>

--
Gitblit v1.9.3