package com.fs.hospital.mapper;

import java.util.List;
import com.fs.hospital.domain.HospitalExamItem;
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;

/**
 * 检验项目Mapper接口
 *
 * @author fs
 * @date 2024-03-26
 */
public interface HospitalExamItemMapper
{
    /**
     * 查询检验项目
     *
     * @param examId 检验项目主键
     * @return 检验项目
     */
    public HospitalExamItem selectHospitalExamItemByExamId(Long examId);

    /**
     * 查询检验项目列表
     *
     * @param hospitalExamItem 检验项目
     * @return 检验项目集合
     */
    public List<HospitalExamItem> selectHospitalExamItemList(HospitalExamItem hospitalExamItem);

    /**
     * 新增检验项目
     *
     * @param hospitalExamItem 检验项目
     * @return 结果
     */
    public int insertHospitalExamItem(HospitalExamItem hospitalExamItem);

    /**
     * 修改检验项目
     *
     * @param hospitalExamItem 检验项目
     * @return 结果
     */
    public int updateHospitalExamItem(HospitalExamItem hospitalExamItem);

    /**
     * 删除检验项目
     *
     * @param examId 检验项目主键
     * @return 结果
     */
    public int deleteHospitalExamItemByExamId(Long examId);

    /**
     * 批量删除检验项目
     *
     * @param examIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteHospitalExamItemByExamIds(Long[] examIds);
    @Select("select * from hospital_exam_item where exam_code=#{examCode}")
    HospitalExamItem selectHospitalExamItemByCode(String examCode);

    @Select({"<script> " +
            "select h.exam_id as id,h.exam_name as name,h.unit,h.sell_price as price,1 as type  from hospital_exam_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.exam_cate = #{maps.cate} " +
            "</if>" +
            "<if test = ' maps.keyword!=null and maps.keyword != \"\"  '> " +
            "and h.exam_name like concat('%', #{maps.keyword}, '%') " +
            "</if>" +
            "</script>"})
    List<HospitalOrderItemListHVO> selectHospitalOrderItemListHVOList(@Param("maps") HospitalOrderItemParam param);
}
