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

import cn.hnthyy.thmz.entity.his.mz.MzZdSupplyCharge;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MzZdSupplyChargeMapper {
    /**
     * 根据编码查询门诊给药方式附加收费信息
     *
     * @param code
     * @return
     */
    @Select("select rtrim(supply_code) supply_code,rtrim(charge_code) charge_code,amount,freq_num,rtrim(del_flag) del_flag from mz_zd_supply_charge where supply_code = #{code,jdbcType=VARCHAR}")
    List<MzZdSupplyCharge> selectMzZdSupplyChargeByCode(@Param("code") String code);

    /**
     * 根据编码集合查询门诊给药方式附加收费列表
     *
     * @param codes
     * @return
     */
    @Select({"<script>",
            "select rtrim(supply_code) supply_code,rtrim(charge_code) charge_code,amount,freq_num,rtrim(del_flag) del_flag from mz_zd_supply_charge ",
            "<when test='codes!=null'>",
            " where supply_code in",
            "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</when>",
            "</script>"})
    List<MzZdSupplyCharge> selectMzZdSupplyChargeByCodeList(@Param("codes") String codes);
}
