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

import cn.hnthyy.thmz.entity.his.zy.ZyConfig;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

public interface ZyConfigMapper {

    /**
     * 加锁
     * @param updateTime
     * @return
     */
    @Update("update zy_config set update_time=#{updateTime,jdbcType=TIMESTAMP} where item_no = 1")
    int updateForBlock(@Param("updateTime") Date updateTime);

    /**
     * 查询住院配置表信息
     * @return
     */
    @Select(" select * from zy_config where item_no = 1")
    ZyConfig selectZyConfig();


    /**
     * 更新序列号
     * @param zyConfig
     * @return
     */
    @Update({"<script>",
            "update zy_config ",
            "<trim prefix='set' prefixOverrides=',' suffix=' where item_no =1 ' >",
            "<when test='inpatientNo!=null'>",
            "inpatient_no =#{inpatientNo,jdbcType=INTEGER}",
            "</when>",
            "<when test='zySerialNo!=null'>",
            ",zy_serial_no =#{zySerialNo,jdbcType=INTEGER}",
            "</when>",
            "<when test='delNo!=null'>",
            ",del_no =#{delNo,jdbcType=INTEGER}",
            "</when>",
            "<when test='jcNo!=null'>",
            ",jc_no =#{jcNo,jdbcType=INTEGER}",
            "</when>",
            "<when test='chargeCode!=null'>",
            ",charge_code =#{chargeCode,jdbcType=INTEGER}",
            "</when>",
            "</trim>"
            ,"</script>"})
    int updateZyConfig(ZyConfig zyConfig);



}
