package cn.hnthyy.thmz.mapper.his.yf;


import cn.hnthyy.thmz.entity.his.YpMzDivide;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 药品分装组合持久化
 */
public interface YfDivideMapper {

    /**
     * 保存分装记录
     * @param YpMzDivide
     * @return
     */
    @Insert("insert into yp_mz_divide (divide_date, in_seri, charge_code, serial, amount, divider, acct_sign, group_no ) " +
            "values ( CONVERT(varchar(100), GETDATE(), 23) , #{inSeri} , #{chargeCode} , #{serial} , #{amount} , #{divider} , #{acctSign} , #{groupNo} )")
    int insertYpMzDivide(YpMzDivide YpMzDivide);

    /**
     * 获取当日分装最大次数
     *
     * @param groupNo
     * @return
     */
    @Select("select isnull(max ( in_seri ),0) from yp_mz_divide where divide_date =CONVERT(varchar(100), GETDATE(), 23) and group_no =#{groupNo}")
    int selectMaxInSeri(@Param("groupNo") String groupNo);
}
