package com.fs.watch.service.impl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.fs.common.utils.DateUtils;
import com.fs.watch.domain.vo.WatchUserAndMedicationVo;
import com.fs.watch.service.WatchMedicationTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.watch.mapper.WatchMedicationTaskMapper;
import com.fs.watch.domain.WatchMedicationTask;

/**
 * 腕用药提醒Service业务层处理
 *
 * @author fs
 * @date 2024-12-10
 */
@Service
public class WatchMedicationTaskServiceImpl implements WatchMedicationTaskService
{
    @Autowired
    private WatchMedicationTaskMapper watchMedicationTaskMapper;

    /**
     * 查询腕用药提醒
     *
     * @param id 腕用药提醒主键
     * @return 腕用药提醒
     */
    @Override
    public WatchMedicationTask selectWatchMedicationTaskById(Long id)
    {
        return watchMedicationTaskMapper.selectWatchMedicationTaskById(id);
    }

    /**
     * 查询腕用药提醒列表
     *
     * @param watchMedicationTask 腕用药提醒
     * @return 腕用药提醒
     */
    @Override
    public List<WatchMedicationTask> selectWatchMedicationTaskList(WatchMedicationTask watchMedicationTask)
    {
        return watchMedicationTaskMapper.selectWatchMedicationTaskList(watchMedicationTask);
    }

    /**
     * 新增腕用药提醒
     *
     * @param watchMedicationTask 腕用药提醒
     * @return 结果
     */
    @Override
    public int insertWatchMedicationTask(WatchMedicationTask watchMedicationTask)
    {
        watchMedicationTask.setCreateTime(DateUtils.getNowDate());
        return watchMedicationTaskMapper.insertWatchMedicationTask(watchMedicationTask);
    }

    /**
     * 修改腕用药提醒
     *
     * @param watchMedicationTask 腕用药提醒
     * @return 结果
     */
    @Override
    public int updateWatchMedicationTask(WatchMedicationTask watchMedicationTask)
    {
        watchMedicationTask.setUpdateTime(DateUtils.getNowDate());
        return watchMedicationTaskMapper.updateWatchMedicationTask(watchMedicationTask);
    }

    /**
     * 批量删除腕用药提醒
     *
     * @param ids 需要删除的腕用药提醒主键
     * @return 结果
     */
    @Override
    public int deleteWatchMedicationTaskByIds(Long[] ids)
    {
        return watchMedicationTaskMapper.deleteWatchMedicationTaskByIds(ids);
    }

    /**
     * 删除腕用药提醒信息
     *
     * @param id 腕用药提醒主键
     * @return 结果
     */
    @Override
    public int deleteWatchMedicationTaskById(Long id)
    {
        return watchMedicationTaskMapper.deleteWatchMedicationTaskById(id);
    }

    /**
     * 批量添加
     * @param tasks
     * @return
     */
    @Override
    public int insertList(ArrayList<WatchMedicationTask> tasks) {
        return watchMedicationTaskMapper.insertList(tasks);
    }

    @Override
    public List<WatchUserAndMedicationVo> medicationTaskList(Integer medicationTime) {
        return watchMedicationTaskMapper.medicationTaskList(medicationTime);
    }
}
