zjh
2024-01-24 aa33bb96ba9f14b16c6c7832e21bfbd88983ba6d
ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderDetailMapper.java
@@ -5,9 +5,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ltkj.hosp.domain.TjOrderDetail;
import com.ltkj.hosp.domain.TjProject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.*;
/**
 * 体检项目明细Mapper接口
@@ -73,10 +71,6 @@
            "  SELECT a.pro_id FROM tj_order_detail a WHERE !ISNULL(flowing_water_id) AND order_id=#{orderId})")
    public List<TjProject> selectTjOrderDetailListByFlowingWaterIdIsNotNull(String orderId);
    /**
     * 查询未缴费项目
     */
@@ -108,8 +102,8 @@
    List<TjOrderDetail> getTjOrderDetailList(@Param("startDate") String startDate,@Param("endDate") String endDate);
    @Select("\tINSERT INTO tj_order_detail(\n" +
            "\torder_detail_id,\n" +
    @Insert("\tINSERT INTO tj_order_detail(\n" +
//            "\torder_detail_id,\n" +
            "  order_id,\n" +
            "  pro_id,\n" +
            "  pro_result,\n" +
@@ -120,10 +114,44 @@
            "  create_id,\n" +
            "  pro_type) \n" +
            "  \n" +
            "     SELECT a.id,#{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 b.need_report='Y' \n" +
            "\t\t\n" +
            "\tUNION\n" +
            "  \n" +
            "\tSELECT DISTINCT a.parent_pro_id,#{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}")
    List<TjOrderDetail> 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 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);
    @Insert("INSERT INTO tj_pure_tone_test (\n" +
            "  tj_num,\n" +
            "\tcus_id,\n" +
            "\tcus_name,\n" +
            "\tpro_id,\n" +
            "\tpro_name,\n" +
            "\tcreate_by,\n" +
            "\tcreate_time,\n" +
            "\tcreate_id\n" +
            ")\n" +
            "SELECT #{tjNum},b.cus_id,b.cus_name,'1633660948860522619','纯音听阈'," +
            "#{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);
    @Update("UPDATE tj_order_detail a SET\n" +
            "a.flowing_water_id=#{ls} ,\n" +
            "a.update_time=SYSDATE(),\n" +
            "a.update_by=#{userName},\n" +
            "a.update_id=#{userId}\n" +
            "WHERE a.order_id=#{orderId}")
    boolean updateTjOrderDetailsByOrderId(@Param("orderId")String orderId,@Param("userName")String userName,@Param("userId") String userId,@Param("ls")String ls);
    @Select("SELECT *\n" +
            "FROM `tj_order_detail` \n" +
            "where order_id=#{orderId}\n" +
            "and pro_id IN\n" +
            "(select pro_id from tj_project where pro_parent_id=#{proParentId})")
    public List<TjOrderDetail> getDetailByOrderIdAndParId(@Param("orderId")Long orderId,@Param("proParentId")Long proParentId);
}