zhaowenxuan
2024-10-12 a7984ee3e52625f8df474fb2f8f5478451ffefa3
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.*;
/**
@@ -119,12 +121,14 @@
            "  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} \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}  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" +
@@ -137,14 +141,18 @@
            "  create_by,\n" +
            "  is_sampling,\n" +
            "  create_id,\n" +
            "  pro_type) \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) FROM tb_transition a LEFT JOIN tj_project b ON a.pro_id=b.pro_id  WHERE a.cus_id=#{cusId} \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) FROM tb_transition a LEFT JOIN tj_project b ON a.parent_pro_id=b.pro_id  WHERE a.cus_id=#{cusId}  GROUP BY a.parent_pro_id")
    boolean saveJSYTjOrderDetailsByCusId(@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) ,#{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);
@@ -158,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" +
@@ -185,4 +193,43 @@
    @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);
}