package com.phm.manage.service.impl;

import com.phm.common.utils.DateUtils;
import com.phm.manage.domain.DiagnoseResult;
import com.phm.manage.mapper.DiagnoseResultMapper;
import com.phm.manage.service.IDiagnoseResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 诊断结果Service业务层处理
 *
 * @author phm
 * @date 2023-08-31
 */
@Service
public class DiagnoseResultServiceImpl implements IDiagnoseResultService {
    @Autowired
    private DiagnoseResultMapper diagnoseResultMapper;

    /**
     * 查询诊断结果
     *
     * @param id 诊断结果主键
     * @return 诊断结果
     */
    @Override
    public DiagnoseResult selectDiagnoseResultById(Long id) {
        return diagnoseResultMapper.selectDiagnoseResultById(id);
    }

    /**
     * 查询诊断结果列表
     *
     * @param diagnoseResult 诊断结果
     * @return 诊断结果
     */
    @Override
    public List<DiagnoseResult> selectDiagnoseResultList(DiagnoseResult diagnoseResult) {
        return diagnoseResultMapper.selectDiagnoseResultList(diagnoseResult);
    }

    /**
     * 新增诊断结果
     *
     * @param diagnoseResult 诊断结果
     * @return 结果
     */
    @Override
    public int insertDiagnoseResult(DiagnoseResult diagnoseResult) {
        diagnoseResult.setCreateTime(DateUtils.getNowDate());
        return diagnoseResultMapper.insertDiagnoseResult(diagnoseResult);
    }

    /**
     * 修改诊断结果
     *
     * @param diagnoseResult 诊断结果
     * @return 结果
     */
    @Override
    public int updateDiagnoseResult(DiagnoseResult diagnoseResult) {
        diagnoseResult.setUpdateTime(DateUtils.getNowDate());
        return diagnoseResultMapper.updateDiagnoseResult(diagnoseResult);
    }

    /**
     * 批量删除诊断结果
     *
     * @param ids 需要删除的诊断结果主键
     * @return 结果
     */
    @Override
    public int deleteDiagnoseResultByIds(Long[] ids) {
        return diagnoseResultMapper.deleteDiagnoseResultByIds(ids);
    }

    /**
     * 删除诊断结果信息
     *
     * @param id 诊断结果主键
     * @return 结果
     */
    @Override
    public int deleteDiagnoseResultById(Long id) {
        return diagnoseResultMapper.deleteDiagnoseResultById(id);
    }
}
