From c42f62b32bac302a7ac9fcde7489f7c5fc6e11aa Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期五, 06 十二月 2024 15:35:17 +0800
Subject: [PATCH] zjh20241205-3

---
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java |  110 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 99 insertions(+), 11 deletions(-)

diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java
index 0e11dc0..b4b4ef4 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java
@@ -1,10 +1,12 @@
 package com.ltkj.hosp.mapper;
 
 import java.util.List;
+import java.util.Map;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ltkj.hosp.domain.TjOrderDetail;
 import com.ltkj.hosp.domain.TjProject;
+import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo;
 import org.apache.ibatis.annotations.*;
 
 /**
@@ -55,6 +57,11 @@
      */
     public int deleteTjOrderDetailByOrderDetailId(String orderDetailId);
 
+    @Delete("    delete\n" +
+            "        from tj_order_detail\n" +
+            "        where order_id = #{orderId}")
+    int deleteTjOrderDetailByOrderId(String orderId);
+
     /**
      * 鎵归噺鍒犻櫎浣撴椤圭洰鏄庣粏
      *
@@ -68,14 +75,14 @@
      * 鏌ヨ宸茬即璐归」鐩�
      */
     @Select("SELECT * FROM tj_project p WHERE p.pro_parent_id =0 AND p.pro_id IN (\n" +
-            "  SELECT a.pro_id FROM tj_order_detail a WHERE !ISNULL(flowing_water_id) AND order_id=#{orderId})")
+            "  SELECT a.pro_id FROM tj_order_detail a WHERE !ISNULL(flowing_water_id) AND order_id=#{orderId} and a.deleted=0 )")
     public List<TjProject> selectTjOrderDetailListByFlowingWaterIdIsNotNull(String orderId);
 
     /**
      * 鏌ヨ鏈即璐归」鐩�
      */
     @Select("SELECT * FROM tj_project p WHERE p.pro_parent_id =0 AND p.pro_id IN (\n" +
-            "  SELECT a.pro_id FROM tj_order_detail a WHERE ISNULL(flowing_water_id) AND order_id=#{orderId})")
+            "  SELECT a.pro_id FROM tj_order_detail a WHERE ISNULL(flowing_water_id) AND order_id=#{orderId} and a.deleted=0 )")
     public List<TjProject> selectTjOrderDetailListByFlowingWaterIdIsNull(String orderId);
 
 
@@ -114,12 +121,39 @@
             "  create_id,\n" +
             "  pro_type) \n" +
             "  \n" +
-            "  SELECT #{orderId},a.pro_id,IFNULL(b.pro_default,''),'0',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0) FROM tb_transition a LEFT JOIN tj_project b ON a.pro_id=b.pro_id  WHERE a.cus_id=#{cusId} and b.need_report='Y' \n" +
+            "  SELECT #{orderId},a.pro_id,IFNULL(b.pro_default,''),'0',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0)" +
+            " FROM tb_transition a LEFT JOIN tj_project b ON a.pro_id=b.pro_id  WHERE a.cus_id=#{cusId} AND a.card_id=#{cardId} \n" +
             "\t\t\n" +
             "\tUNION\n" +
             "  \n" +
-            "\tSELECT #{orderId},a.parent_pro_id,IFNULL(b.pro_default,''),'0',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0) FROM tb_transition a LEFT JOIN tj_project b ON a.parent_pro_id=b.pro_id  WHERE a.cus_id=#{cusId} and b.need_report='Y' GROUP BY a.parent_pro_id")
-     boolean saveTjOrderDetailsByCusId(@Param("cusId")String cusId,@Param("orderId")String orderId,@Param("userName")String userName,@Param("userId") String userId);
+            "\tSELECT #{orderId},a.parent_pro_id,IFNULL(b.pro_default,''),'0',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0) " +
+            "FROM tb_transition a LEFT JOIN tj_project b ON a.parent_pro_id=b.pro_id  WHERE a.cus_id=#{cusId} AND a.card_id=#{cardId} GROUP BY a.parent_pro_id")
+     boolean saveTjOrderDetailsByCusId(@Param("cusId")String cusId,@Param("orderId")String orderId,@Param("userName")String userName,@Param("userId") String userId,@Param("cardId") String cardId);
+
+
+    @Insert("\tINSERT INTO tj_order_detail(\n" +
+//            "\torder_detail_id,\n" +
+            "  order_id,\n" +
+            "  pro_id,\n" +
+            "  pro_result,\n" +
+            "  tj_status,\n" +
+            "  create_time,\n" +
+            "  create_by,\n" +
+            "  is_sampling,\n" +
+            "  create_id,\n" +
+            "  pro_type," +
+            "flowing_water_id) \n" +
+            "  \n" +
+            "  SELECT #{orderId},a.pro_id,IFNULL(b.pro_default,''),'1',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0) ,#{sl}" +
+            "FROM tb_transition a LEFT JOIN tj_project b ON a.pro_id=b.pro_id  WHERE a.cus_id=#{cusId} AND a.card_id=#{cardId} \n" +
+            "\t\t\n" +
+            "\tUNION\n" +
+            "  \n" +
+            "\tSELECT #{orderId},a.parent_pro_id,IFNULL(b.pro_default,''),'0',SYSDATE(),#{userName},b.is_sampling,#{userId},IFNULL(a.pac_id,0) ,#{sl}" +
+            " FROM tb_transition a LEFT JOIN tj_project b ON a.parent_pro_id=b.pro_id  WHERE a.cus_id=#{cusId} AND a.card_id=#{cardId} GROUP BY a.parent_pro_id")
+    boolean saveJSYTjOrderDetailsByCusId(@Param("cusId")String cusId,@Param("orderId")String orderId,@Param("userName")String userName,@Param("userId") String userId,
+                                         @Param("cardId") String cardId,@Param("sl") String sl);
+
 
 
     @Insert("INSERT INTO tj_pure_tone_test (\n" +
@@ -132,10 +166,10 @@
             "\tcreate_time,\n" +
             "\tcreate_id\n" +
             ")\n" +
-            "SELECT #{tjNum},b.cus_id,b.cus_name,'1633660948860522619','绾煶鍚槇'," +
+            "SELECT #{tjNum},b.cus_id,b.cus_name,'1740177341251154247','绾煶鍚槇'," +
             "#{userName},SYSDATE(),#{userId} FROM tb_transition a LEFT JOIN tj_customer b " +
-            "ON a.cus_id=b.cus_idcard WHERE a.cus_id=#{cusId} AND a.parent_pro_id IN('1633660948860522619') GROUP BY a.cus_id")
-    boolean saveTjPureToneTesByCusId(@Param("cusId")String cusId,@Param("tjNum")String tjNum,@Param("userName")String userName,@Param("userId") String userId);
+            "ON a.cus_id=b.cus_idcard WHERE a.cus_id=#{cusId} AND a.card_id=#{cardId}  AND a.parent_pro_id IN('1740177341251154247') GROUP BY a.cus_id")
+    boolean saveTjPureToneTesByCusId(@Param("cusId")String cusId,@Param("tjNum")String tjNum,@Param("userName")String userName,@Param("userId") String userId,@Param("cardId") String cardId);
 
 
     @Update("UPDATE tj_order_detail a SET\n" +
@@ -154,9 +188,63 @@
             "(select pro_id from tj_project where pro_parent_id=#{proParentId})")
     public List<TjOrderDetail> getDetailByOrderIdAndParId(@Param("orderId")Long orderId,@Param("proParentId")Long proParentId);
 
+    public List<TjOrderDetail> getDetailByOrderIdAndParIds(@Param("orderId")Long orderId,@Param("proParentIds")List<Long> proParentIds);
 
-
-//    @Select("call pro_lis_sqdbgd(1,#{tjnumber,mode=IN})")
-    @Select("select * from test_detail")
+    @Select("call pro_lis_sqdbgd(1,#{tjnumber,mode=IN})")
+//    @Select("select * from test_detail")
     List<TjOrderDetail> addHuaYanTable(@Param("tjnumber") String tjnumber);
+
+    @Select("call pro_checkhyAndcg(1,#{tjnumber,mode=IN})")
+    List<TjOrderDetail> addHuaYanAndCgTable(String tjnumber);
+
+
+    @Delete("delete\n" +
+            " from tj_order_detail\n" +
+            " where jxbz = #{jxbz}")
+    void deleteTjOrderDetailByjxbz(String jxbz);
+
+
+
+
+    @Select("SELECT\n" +
+            "\tIFNULL(SUM(CASE WHEN aa.mc LIKE '%韬珮%' THEN aa.jg END),'鏃�') shenggao,\n" +
+            "\tIFNULL(SUM(CASE WHEN aa.mc LIKE '%浣撻噸%' THEN aa.jg END),'鏃�') tizhong,\n" +
+            "\tIFNULL(SUM(CASE WHEN aa.mc LIKE '%鎸囨暟%' THEN aa.jg END),'鏃�') tizhongzhishu,\n" +
+            "\tIFNULL(SUM(CASE WHEN aa.mc LIKE '%鏀剁缉鍘�%' THEN aa.jg END),'鏃�') shousuoya,\n" +
+            "\tIFNULL(SUM(CASE WHEN aa.mc LIKE '%鑸掑紶鍘�%' THEN aa.jg END),'鏃�') shuzhangya\n" +
+            "FROM\n" +
+            "\t(\n" +
+            "\tSELECT\n" +
+            "\t\tc.pro_name mc,\n" +
+            "\t\tb.pro_result jg \n" +
+            "\tFROM\n" +
+            "\t\ttj_order a\n" +
+            "\t\tJOIN tj_order_detail b ON a.order_id = b.order_id\n" +
+            "\t\tJOIN tj_project c ON c.pro_id = b.pro_id \n" +
+            "\tWHERE\n" +
+            "\t\ta.tj_number =#{tjNum} \n" +
+            "\t\tAND c.pro_parent_id != 0 \n" +
+            "\t\tAND (\n" +
+            "\t\t\tc.pro_name LIKE '%韬珮%' \n" +
+            "\t\t\tOR c.pro_name LIKE '%浣撻噸%' \n" +
+            "\t\t\tOR c.pro_name LIKE '%鎸囨暟%' \n" +
+            "\t\t\tOR c.pro_name LIKE '%鏀剁缉鍘�%' \n" +
+            "\t\tOR c.pro_name LIKE '%鑸掑紶鍘�%' \n" +
+            "\t)) aa ")
+    List<ShenGaoTiZhongVo> getShenGaoTiZhongList(String tjNum);
+
+
+
+//    @Select("SELECT a.* FROM tj_order_detail a LEFT JOIN tj_project b ON a.pro_id=b.pro_id \n" +
+//            "LEFT JOIN sys_dept c ON c.dept_id=b.dept_id \n" +
+//            " WHERE a.deleted=0 AND !ISNULL(a.flowing_water_id) AND a.order_id=#{orderId} and b.pro_parent_id = 0 AND c.org_type=1")
+    @Select("SELECT a.* FROM tj_order_detail a LEFT JOIN tj_project b ON a.pro_id=b.pro_id \n" +
+            "LEFT JOIN sys_dept c ON c.dept_id=b.dept_id \n" +
+            " WHERE a.deleted=0 AND a.order_id=#{orderId} and b.pro_parent_id = 0 AND c.org_type=1")
+    List<TjOrderDetail> getCaiYangDengJi(Long orderId);
+
+    @Select("SELECT a.* FROM tj_order_detail a LEFT JOIN tj_project b ON a.pro_id=b.pro_id \n" +
+            "LEFT JOIN sys_dept c ON c.dept_id=b.dept_id \n" +
+            " WHERE a.deleted=0 AND a.order_id=#{orderId} and b.pro_parent_id = 0 AND c.org_type=1 AND a.jxbz = #{jxbz}")
+    List<TjOrderDetail> getCaiYangDengJiJxbz(@Param("orderId") Long orderId,@Param("jxbz") String jxbz);
 }

--
Gitblit v1.8.0