zjh
4 天以前 cc25bc0eec2d50da39d62f9896ed4d5e66805366
ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TbTransitionMapper.java
@@ -8,6 +8,7 @@
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 过渡Mapper接口
@@ -106,7 +107,7 @@
    @Select("SELECT DISTINCT pac_id FROM tb_transition WHERE cus_id=#{cusId} AND !ISNULL(pac_id) AND ISNULL(tj_num)")
    String getTbTransitionPacIdByCusIdAndPac(String cusId);
    @Select("SELECT SUM(a.now_price) now_price FROM tb_transition a WHERE cus_id=#{cusId}")
    @Select("SELECT ifnull(SUM(a.now_price),0) now_price FROM tb_transition a WHERE cus_id=#{cusId} and ISNULL(tj_num)")
    BigDecimal sumNowPrice(String cusId);
    @Select("SELECT MAX(a.create_time) FROM tb_transition a WHERE a.cus_id=#{cusId} ")
@@ -332,6 +333,18 @@
    })
    BigDecimal getLisPriceByTjNumAndInParentProId(@Param("tjNum") String tjNum, @Param("parentProId") List<String> parentProId);
    @Select({
            "<script>",
            "SELECT SUM(now_price) FROM `tb_transition`",
            "WHERE `tj_num` = #{tjNum}",
            "AND `pro_id` IN",
            "<foreach item='item' index='index' collection='proId' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"
    })
    BigDecimal getLisPriceByTjNumAndInProId(@Param("tjNum") String tjNum, @Param("proId") List<Long> parentProId);
    @Select("SELECT GROUP_CONCAT(c.pro_name SEPARATOR ' ; ' ) FROM tj_package_project b JOIN tj_project c ON c.pro_id=b.pro_id\n" +
@@ -389,4 +402,18 @@
    @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE  a.cus_id=#{tjNum} and  isnull(a.tj_num)")
    BigDecimal sumTbTransitionNowPriceByTjNumIsNull(@Param("tjNum")String tjNum);
    @Select("SELECT aa.parent_pro_id xmid,(g.price_now-aa.ys)cj FROM tj_package_project g JOIN (\n" +
            " SELECT a.parent_pro_id,SUM(a.now_price)ys  FROM tb_transition a WHERE a.cus_id=#{cusIdCard} " +
            " AND pac_id=#{pacId} AND ISNULL(a.tj_num) GROUP BY a.parent_pro_id)aa\n" +
            "ON\n" +
            "trim(g.pro_id)=trim(aa.parent_pro_id ) where g.pac_id=#{pacId} AND (g.price_now-aa.ys)>0;")
    List<Map<String,Object>> addTbhuoquxiangmuchajia(@Param("pacId") String pacId, @Param("cusIdCard") String cusIdCard);
    @Select("SELECT DISTINCT b.tj_category FROM tb_transition a JOIN tj_package b ON b.pac_id=a.pac_id " +
            "WHERE a.cus_id=#{cusIdCard} AND ISNULL(a.tj_num)")
    String getTjCategoryByTbTransition(String cusIdCard);
}