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.HealthPersonMedicalReportProjectMapper;
import com.bonus.canteen.core.health.domain.HealthPersonMedicalReportProject;
import com.bonus.canteen.core.health.service.IHealthPersonMedicalReportProjectService;

/**
 * 人员体检报告项目Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class HealthPersonMedicalReportProjectServiceImpl implements IHealthPersonMedicalReportProjectService {
    @Autowired
    private HealthPersonMedicalReportProjectMapper healthPersonMedicalReportProjectMapper;

    /**
     * 查询人员体检报告项目
     * 
     * @param id 人员体检报告项目主键
     * @return 人员体检报告项目
     */
    @Override
    public HealthPersonMedicalReportProject selectHealthPersonMedicalReportProjectById(Long id) {
        return healthPersonMedicalReportProjectMapper.selectHealthPersonMedicalReportProjectById(id);
    }

    /**
     * 查询人员体检报告项目列表
     * 
     * @param healthPersonMedicalReportProject 人员体检报告项目
     * @return 人员体检报告项目
     */
    @Override
    public List<HealthPersonMedicalReportProject> selectHealthPersonMedicalReportProjectList(HealthPersonMedicalReportProject healthPersonMedicalReportProject) {
        return healthPersonMedicalReportProjectMapper.selectHealthPersonMedicalReportProjectList(healthPersonMedicalReportProject);
    }

    /**
     * 新增人员体检报告项目
     * 
     * @param healthPersonMedicalReportProject 人员体检报告项目
     * @return 结果
     */
    @Override
    public int insertHealthPersonMedicalReportProject(HealthPersonMedicalReportProject healthPersonMedicalReportProject) {
        healthPersonMedicalReportProject.setCreateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportProjectMapper.insertHealthPersonMedicalReportProject(healthPersonMedicalReportProject);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改人员体检报告项目
     * 
     * @param healthPersonMedicalReportProject 人员体检报告项目
     * @return 结果
     */
    @Override
    public int updateHealthPersonMedicalReportProject(HealthPersonMedicalReportProject healthPersonMedicalReportProject) {
        healthPersonMedicalReportProject.setUpdateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportProjectMapper.updateHealthPersonMedicalReportProject(healthPersonMedicalReportProject);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

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

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