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.HealthPersonMedicalReportDetailMapper;
import com.bonus.canteen.core.health.domain.HealthPersonMedicalReportDetail;
import com.bonus.canteen.core.health.service.IHealthPersonMedicalReportDetailService;

/**
 * 人员体检报告项目明细Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class HealthPersonMedicalReportDetailServiceImpl implements IHealthPersonMedicalReportDetailService {
    @Autowired
    private HealthPersonMedicalReportDetailMapper healthPersonMedicalReportDetailMapper;

    /**
     * 查询人员体检报告项目明细
     * 
     * @param id 人员体检报告项目明细主键
     * @return 人员体检报告项目明细
     */
    @Override
    public HealthPersonMedicalReportDetail selectHealthPersonMedicalReportDetailById(Long id) {
        return healthPersonMedicalReportDetailMapper.selectHealthPersonMedicalReportDetailById(id);
    }

    /**
     * 查询人员体检报告项目明细列表
     * 
     * @param healthPersonMedicalReportDetail 人员体检报告项目明细
     * @return 人员体检报告项目明细
     */
    @Override
    public List<HealthPersonMedicalReportDetail> selectHealthPersonMedicalReportDetailList(HealthPersonMedicalReportDetail healthPersonMedicalReportDetail) {
        return healthPersonMedicalReportDetailMapper.selectHealthPersonMedicalReportDetailList(healthPersonMedicalReportDetail);
    }

    /**
     * 新增人员体检报告项目明细
     * 
     * @param healthPersonMedicalReportDetail 人员体检报告项目明细
     * @return 结果
     */
    @Override
    public int insertHealthPersonMedicalReportDetail(HealthPersonMedicalReportDetail healthPersonMedicalReportDetail) {
        healthPersonMedicalReportDetail.setCreateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportDetailMapper.insertHealthPersonMedicalReportDetail(healthPersonMedicalReportDetail);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改人员体检报告项目明细
     * 
     * @param healthPersonMedicalReportDetail 人员体检报告项目明细
     * @return 结果
     */
    @Override
    public int updateHealthPersonMedicalReportDetail(HealthPersonMedicalReportDetail healthPersonMedicalReportDetail) {
        healthPersonMedicalReportDetail.setUpdateTime(DateUtils.getNowDate());
        try {
            return healthPersonMedicalReportDetailMapper.updateHealthPersonMedicalReportDetail(healthPersonMedicalReportDetail);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

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

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