package com.xinelu.manage.service.patientpropaganda.impl;

import com.xinelu.manage.domain.patientpropaganda.PatientPropaganda;
import com.xinelu.manage.mapper.patientpropaganda.PatientPropagandaMapper;
import com.xinelu.manage.service.patientpropaganda.IPatientPropagandaService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 患者宣教信息Service业务层处理
 *
 * @author haown
 * @date 2024-02-27
 */
@Service
public class PatientPropagandaServiceImpl implements IPatientPropagandaService {
    @Resource
    private PatientPropagandaMapper patientPropagandaMapper;

    /**
     * 查询患者宣教信息
     *
     * @param id 患者宣教信息主键
     * @return 患者宣教信息
     */
    @Override
    public PatientPropaganda selectPatientPropagandaById(Long id) {
        return patientPropagandaMapper.selectPatientPropagandaById(id);
    }

    /**
     * 查询患者宣教信息列表
     *
     * @param patientPropaganda 患者宣教信息
     * @return 患者宣教信息
     */
    @Override
    public List<PatientPropaganda> selectPatientPropagandaList(PatientPropaganda patientPropaganda) {
        return patientPropagandaMapper.selectPatientPropagandaList(patientPropaganda);
    }

    /**
     * 新增患者宣教信息
     *
     * @param patientPropaganda 患者宣教信息
     * @return 结果
     */
    @Override
    public int insertPatientPropaganda(PatientPropaganda patientPropaganda) {
        patientPropaganda.setCreateTime(LocalDateTime.now());
        return patientPropagandaMapper.insertPatientPropaganda(patientPropaganda);
    }

    /**
     * 修改患者宣教信息
     *
     * @param patientPropaganda 患者宣教信息
     * @return 结果
     */
    @Override
    public int updatePatientPropaganda(PatientPropaganda patientPropaganda) {
        patientPropaganda.setUpdateTime(LocalDateTime.now());
        return patientPropagandaMapper.updatePatientPropaganda(patientPropaganda);
    }

    /**
     * 批量删除患者宣教信息
     *
     * @param ids 需要删除的患者宣教信息主键
     * @return 结果
     */
    @Override
    public int deletePatientPropagandaByIds(Long[] ids) {
        return patientPropagandaMapper.deletePatientPropagandaByIds(ids);
    }

    /**
     * 删除患者宣教信息信息
     *
     * @param id 患者宣教信息主键
     * @return 结果
     */
    @Override
    public int deletePatientPropagandaById(Long id) {
        return patientPropagandaMapper.deletePatientPropagandaById(id);
    }
}
