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.HealthMedicalReportProjectMapper;
import com.bonus.canteen.core.health.domain.HealthMedicalReportProject;
import com.bonus.canteen.core.health.service.IHealthMedicalReportProjectService;

/**
 * 体检报告项目Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class HealthMedicalReportProjectServiceImpl implements IHealthMedicalReportProjectService {
    @Autowired
    private HealthMedicalReportProjectMapper healthMedicalReportProjectMapper;

    /**
     * 查询体检报告项目
     * 
     * @param id 体检报告项目主键
     * @return 体检报告项目
     */
    @Override
    public HealthMedicalReportProject selectHealthMedicalReportProjectById(Long id) {
        return healthMedicalReportProjectMapper.selectHealthMedicalReportProjectById(id);
    }

    /**
     * 查询体检报告项目列表
     * 
     * @param healthMedicalReportProject 体检报告项目
     * @return 体检报告项目
     */
    @Override
    public List<HealthMedicalReportProject> selectHealthMedicalReportProjectList(HealthMedicalReportProject healthMedicalReportProject) {
        return healthMedicalReportProjectMapper.selectHealthMedicalReportProjectList(healthMedicalReportProject);
    }

    /**
     * 新增体检报告项目
     * 
     * @param healthMedicalReportProject 体检报告项目
     * @return 结果
     */
    @Override
    public int insertHealthMedicalReportProject(HealthMedicalReportProject healthMedicalReportProject) {
        healthMedicalReportProject.setCreateTime(DateUtils.getNowDate());
        try {
            return healthMedicalReportProjectMapper.insertHealthMedicalReportProject(healthMedicalReportProject);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改体检报告项目
     * 
     * @param healthMedicalReportProject 体检报告项目
     * @return 结果
     */
    @Override
    public int updateHealthMedicalReportProject(HealthMedicalReportProject healthMedicalReportProject) {
        healthMedicalReportProject.setUpdateTime(DateUtils.getNowDate());
        try {
            return healthMedicalReportProjectMapper.updateHealthMedicalReportProject(healthMedicalReportProject);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

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

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