package com.fs.his.service.impl;

import java.util.List;

import com.fs.common.core.domain.R;
import com.fs.his.param.FsUserDoctorListUParam;
import com.fs.his.vo.FsUserDoctorListUVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.his.mapper.FsUserDoctorMapper;
import com.fs.his.domain.FsUserDoctor;
import com.fs.his.service.IFsUserDoctorService;

/**
 * 会员医生Service业务层处理
 *
 * @author fs
 * @date 2023-07-03
 */
@Service
public class FsUserDoctorServiceImpl implements IFsUserDoctorService
{
    @Autowired
    private FsUserDoctorMapper fsUserDoctorMapper;

    /**
     * 查询会员医生
     *
     * @param id 会员医生主键
     * @return 会员医生
     */
    @Override
    public FsUserDoctor selectFsUserDoctorById(Long id)
    {
        return fsUserDoctorMapper.selectFsUserDoctorById(id);
    }

    /**
     * 查询会员医生列表
     *
     * @param fsUserDoctor 会员医生
     * @return 会员医生
     */
    @Override
    public List<FsUserDoctor> selectFsUserDoctorList(FsUserDoctor fsUserDoctor)
    {
        return fsUserDoctorMapper.selectFsUserDoctorList(fsUserDoctor);
    }

    /**
     * 新增会员医生
     *
     * @param fsUserDoctor 会员医生
     * @return 结果
     */
    @Override
    public int insertFsUserDoctor(FsUserDoctor fsUserDoctor)
    {
        return fsUserDoctorMapper.insertFsUserDoctor(fsUserDoctor);
    }

    /**
     * 修改会员医生
     *
     * @param fsUserDoctor 会员医生
     * @return 结果
     */
    @Override
    public int updateFsUserDoctor(FsUserDoctor fsUserDoctor)
    {
        return fsUserDoctorMapper.updateFsUserDoctor(fsUserDoctor);
    }

    /**
     * 批量删除会员医生
     *
     * @param ids 需要删除的会员医生主键
     * @return 结果
     */
    @Override
    public int deleteFsUserDoctorByIds(Long[] ids)
    {
        return fsUserDoctorMapper.deleteFsUserDoctorByIds(ids);
    }

    /**
     * 删除会员医生信息
     *
     * @param id 会员医生主键
     * @return 结果
     */
    @Override
    public int deleteFsUserDoctorById(Long id)
    {
        return fsUserDoctorMapper.deleteFsUserDoctorById(id);
    }

    @Override
    public List<FsUserDoctorListUVO> getMyDoctorList(FsUserDoctorListUParam param) {
        return fsUserDoctorMapper.getMyDoctorList(param);
    }

    @Override
    public R checkFollow(Long doctorId, long userId) {
        return fsUserDoctorMapper.checkFollow(doctorId,userId)>0?R.ok().put("isFollow",1):R.error().put("isFollow",0);
    }

    @Override
    public int deleteFollow(Long doctorId, long userId) {
        return fsUserDoctorMapper.deleteFollow(doctorId,userId);
    }
}
