package com.fs.his.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.his.domain.FsHealthPulse;
import com.fs.his.param.FsHealthPulseListUParam;
import com.fs.his.vo.FsHealthPulseListVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 脉诊Mapper接口
 *
 * @author fs
 * @date 2025-10-11
 */
public interface FsHealthPulseMapper extends BaseMapper<FsHealthPulse>{
    /**
     * 查询脉诊
     *
     * @param id 脉诊主键
     * @return 脉诊
     */
    FsHealthPulse selectFsHealthPulseById(Long id);

    /**
     * 查询脉诊列表
     *
     * @param fsHealthPulse 脉诊
     * @return 脉诊集合
     */
    List<FsHealthPulse> selectFsHealthPulseList(FsHealthPulse fsHealthPulse);

    /**
     * 新增脉诊
     *
     * @param fsHealthPulse 脉诊
     * @return 结果
     */
    int insertFsHealthPulse(FsHealthPulse fsHealthPulse);

    /**
     * 修改脉诊
     *
     * @param fsHealthPulse 脉诊
     * @return 结果
     */
    int updateFsHealthPulse(FsHealthPulse fsHealthPulse);

    /**
     * 删除脉诊
     *
     * @param id 脉诊主键
     * @return 结果
     */
    int deleteFsHealthPulseById(Long id);

    /**
     * 批量删除脉诊
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteFsHealthPulseByIds(Long[] ids);

    @Select("SELECT * from fs_health_pulse where user_id=#{userId} and status=0 order by create_time desc limit 1")
    FsHealthPulse queryUserLatestHealthPulse(@Param("userId") Long userId);

    List<FsHealthPulseListVO> selectFsHealthPulseListVO(FsHealthPulseListUParam param);

    List<String> selectListByDateAndUserId(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("userId") Long userId);

}
