package com.fs.hospital.mapper;

import java.util.List;

import com.fs.hospital.domain.HospitalInspectItem;
import com.fs.hospital.domain.HospitalTreatItem;
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 HospitalTreatItemMapper
{
    /**
     * 查询治疗
     *
     * @param treatId 治疗主键
     * @return 治疗
     */
    public HospitalTreatItem selectHospitalTreatItemByTreatId(Long treatId);

    /**
     * 查询治疗列表
     *
     * @param hospitalTreatItem 治疗
     * @return 治疗集合
     */
    public List<HospitalTreatItem> selectHospitalTreatItemList(HospitalTreatItem hospitalTreatItem);

    /**
     * 新增治疗
     *
     * @param hospitalTreatItem 治疗
     * @return 结果
     */
    public int insertHospitalTreatItem(HospitalTreatItem hospitalTreatItem);

    /**
     * 修改治疗
     *
     * @param hospitalTreatItem 治疗
     * @return 结果
     */
    public int updateHospitalTreatItem(HospitalTreatItem hospitalTreatItem);

    /**
     * 删除治疗
     *
     * @param treatId 治疗主键
     * @return 结果
     */
    public int deleteHospitalTreatItemByTreatId(Long treatId);

    /**
     * 批量删除治疗
     *
     * @param treatIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteHospitalTreatItemByTreatIds(Long[] treatIds);
    @Select("select * from hospital_treat_item where treat_code=#{code}")
    HospitalTreatItem selectHospitalTreatItemBycode(String code);

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