From dedacd79c93f8ef95e0cb986f5e7fbd27ddbd907 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期四, 03 七月 2025 09:12:49 +0800
Subject: [PATCH] 2025-07-03

---
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSamplingMapper.java |   72 ++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSamplingMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSamplingMapper.java
index 9630fbf..245a1bd 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSamplingMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjSamplingMapper.java
@@ -128,4 +128,76 @@
 //            "</foreach>",
 //            "</script>"})
     boolean updateHeBingXms(@Param("ids") List<String> ids);
+
+    @Delete("DELETE FROM tj_sampling WHERE tj_num = #{tjNum} AND cus_id = #{userId}")
+    int deleteByTjNumAndCusId(@Param("tjNum") String tjNum,@Param("userId") Long userId);
+
+    @Delete({
+            "<script>",
+            "DELETE FROM tj_sampling WHERE tj_num = #{tjNum} AND cus_id = #{userId} and jxbz in ",
+            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
+            "#{id}",
+            "</foreach>",
+            "</script>"
+    })
+    int deleteByTjNumAndCusIdAndJxbz(@Param("tjNum") String tjNum,@Param("userId") Long userId,@Param("ids")List<String> ids);
+
+
+    @Delete("DELETE FROM tj_sampling WHERE tj_num = #{tjNum} AND cus_id = #{userId} and jxbz = #{jxbz} ")
+    int deleteByTjNumAndCusIdAndJxbzo(@Param("tjNum") String tjNum,@Param("userId") Long userId,@Param("jxbz")String jxbz);
+
+
+    @Select({"<script>","SELECT\n" +
+            "  IFNULL(GROUP_CONCAT( aa.pro_name SEPARATOR ' ; ' ),NULL)\n" +
+            "FROM\n" +
+            "  (\n" +
+            "  SELECT\n" +
+            "    a.jyxmdm,\n" +
+            "    a.pro_name,\n" +
+            "    b.jyxmmc,\n" +
+            "    b.jybbdm,\n" +
+            "    b.jyfldm \n" +
+            "  FROM\n" +
+            "    `tj_sampling` a\n" +
+            "    LEFT JOIN ltkj_jyxmzd b ON a.jyxmdm = b.jyxmdm   WHERE a.id " +
+            "IN ","<foreach collection='ids' item='id' open='(' separator=',' close=')'>",
+            "#{id}",
+            "</foreach>"
+            +") aa " + "WHERE\n" + "  aa.jyfldm NOT IN ( SELECT c.flbm FROM lis_jyflhb c);",
+            "</script>"})
+    String getBuKeHebingProName(@Param("ids")List<String> ids);
+
+    @Select("SELECT COUNT( 1 ) FROM(\n" +
+            "\tSELECT\n" +
+            "\t\ta.jyxmdm,\n" +
+            "\t\tb.jyfldm \n" +
+            "\tFROM\n" +
+            "\t\t`tj_sampling` a\n" +
+            "\t\tLEFT JOIN ltkj_jyxmzd b ON a.jyxmdm = b.jyxmdm \n" +
+            "\tWHERE\n" +
+            "\t\ta.id = #{id} \n" +
+            "\t) aa WHERE aa.jyfldm NOT IN ( SELECT c.flbm FROM lis_jyflhb c )")
+    int isMergeItem(@Param("id") String id);
+
+
+    @Update("UPDATE tj_sampling a SET\n" +
+            "a.update_time=SYSDATE(),\n" +
+            "a.update_by= #{userName},\n" +
+            "a.update_id= #{userId},\n" +
+            "a.create_id = #{userId}\n"+
+            "WHERE a.tj_num=#{tjNum}")
+    boolean updateUserIdByTjNum(@Param("tjNum")String tjNum,@Param("userName")String userName,@Param("userId") String userId);
+
+    @Update("UPDATE tj_sampling a SET\n" +
+            "a.update_time=SYSDATE(),\n" +
+            "a.update_by= #{userName},\n" +
+            "a.update_id= #{userId},\n" +
+            "a.create_id = #{userId}\n"+
+            "WHERE a.tj_num=#{tjNum} AND a.jxbz = #{jxbz}")
+    boolean updateUserIdByTjNumAndJxbz(@Param("tjNum")String tjNum,@Param("userName")String userName,@Param("userId") String userId,@Param("jxbz") String jxbz);
+
+
+
+    @Select("SELECT COUNT(*) FROM tj_sampling a WHERE a.deleted=0 AND a.tj_num=#{tjh} AND  LOCATE(#{proId},a.pro_id)")
+    int isExistProId(@Param("tjh") String tjh,@Param("proId") String proId);
 }

--
Gitblit v1.8.0