package com.bonus.canteen.core.health.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.health.mapper.HealthPersonMedicalReportMapper;
import com.bonus.canteen.core.health.domain.HealthPersonMedicalReport;
import com.bonus.canteen.core.health.service.IHealthPersonMedicalReportService;

/**
 * 人员体检报告Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class HealthPersonMedicalReportServiceImpl implements IHealthPersonMedicalReportService {
    @Autowired
    private HealthPersonMedicalReportMapper healthPersonMedicalReportMapper;

    /**
     * 查询人员体检报告
     * 
     * @param id 人员体检报告主键
     * @return 人员体检报告
     */
    @Override
    public HealthPersonMedicalReport selectHealthPersonMedicalReportById(Long id) {
        return healthPersonMedicalReportMapper.selectHealthPersonMedicalReportById(id);
    }

    /**
     * 查询人员体检报告列表
     * 
     * @param healthPersonMedicalReport 人员体检报告
     * @return 人员体检报告
     */
    @Override
    public List<HealthPersonMedicalReport> selectHealthPersonMedicalReportList(HealthPersonMedicalReport healthPersonMedicalReport) {
        return healthPersonMedicalReportMapper.selectHealthPersonMedicalReportList(healthPersonMedicalReport);
    }

    /**
     * 新增人员体检报告
     * 
     * @param healthPersonMedicalReport 人员体检报告
     * @return 结果
     */
    @Override
    public int insertHealthPersonMedicalReport(HealthPersonMedicalReport healthPersonMedicalReport) {
        healthPersonMedicalReport.setCreateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportMapper.insertHealthPersonMedicalReport(healthPersonMedicalReport);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改人员体检报告
     * 
     * @param healthPersonMedicalReport 人员体检报告
     * @return 结果
     */
    @Override
    public int updateHealthPersonMedicalReport(HealthPersonMedicalReport healthPersonMedicalReport) {
        healthPersonMedicalReport.setUpdateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportMapper.updateHealthPersonMedicalReport(healthPersonMedicalReport);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除人员体检报告
     * 
     * @param ids 需要删除的人员体检报告主键
     * @return 结果
     */
    @Override
    public int deleteHealthPersonMedicalReportByIds(Long[] ids) {
        return healthPersonMedicalReportMapper.deleteHealthPersonMedicalReportByIds(ids);
    }

    /**
     * 删除人员体检报告信息
     * 
     * @param id 人员体检报告主键
     * @return 结果
     */
    @Override
    public int deleteHealthPersonMedicalReportById(Long id) {
        return healthPersonMedicalReportMapper.deleteHealthPersonMedicalReportById(id);
    }
}
