package com.fs.hospital.mapper;

import java.util.List;
import com.fs.hospital.domain.HospitalInspectItem;
import com.fs.hospital.param.HospitalOrderItemParam;
import com.fs.hospital.vo.HospitalOrderItemListHVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * 检查Mapper接口
 *
 * @author fs
 * @date 2024-03-26
 */
public interface HospitalInspectItemMapper
{
    /**
     * 查询检查
     *
     * @param inspectId 检查主键
     * @return 检查
     */
    public HospitalInspectItem selectHospitalInspectItemByInspectId(Long inspectId);

    /**
     * 查询检查列表
     *
     * @param hospitalInspectItem 检查
     * @return 检查集合
     */
    public List<HospitalInspectItem> selectHospitalInspectItemList(HospitalInspectItem hospitalInspectItem);

    /**
     * 新增检查
     *
     * @param hospitalInspectItem 检查
     * @return 结果
     */
    public int insertHospitalInspectItem(HospitalInspectItem hospitalInspectItem);

    /**
     * 修改检查
     *
     * @param hospitalInspectItem 检查
     * @return 结果
     */
    public int updateHospitalInspectItem(HospitalInspectItem hospitalInspectItem);

    /**
     * 删除检查
     *
     * @param inspectId 检查主键
     * @return 结果
     */
    public int deleteHospitalInspectItemByInspectId(Long inspectId);

    /**
     * 批量删除检查
     *
     * @param inspectIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteHospitalInspectItemByInspectIds(Long[] inspectIds);
    @Select("select * from hospital_inspect_item where inspect_code=#{inspectCode}")
    HospitalInspectItem selectHospitalInspectItemByCode(String inspectCode);

    @Select({"<script> " +
            "select h.inspect_id as id,h.inspect_name as name,h.unit,h.sell_price as price,2 as type  from hospital_inspect_item h    " +
            "where 1=1 and is_del = 0 " +
            "<if test = ' maps.hospitalId!=null  '> " +
            "and h.hospital_id = #{maps.hospitalId} " +
            "</if>" +
            "<if test = ' maps.cate!=null  '> " +
            "and h.inspect_cate = #{maps.cate} " +
            "</if>" +
            "<if test = ' maps.keyword!=null and maps.keyword != \"\"  '> " +
            "and h.inspect_name like concat('%', #{maps.keyword}, '%') " +
            "</if>" +
            "</script>"})
    List<HospitalOrderItemListHVO> selectHospitalOrderItemListHVOList(@Param("maps") HospitalOrderItemParam param);
}
