package com.ruoyi.web.work.service.impl;

import java.util.List;

import com.ruoyi.web.work.domain.Request;
import com.ruoyi.web.work.domain.dto.ReportDto;
import com.ruoyi.web.work.mapper.RequestMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.work.mapper.ReportMapper;
import com.ruoyi.web.work.domain.Report;
import com.ruoyi.web.work.service.IReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @author lsw
 * @date 2024-07-24
 */
@Service
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements IReportService {
    @Autowired
    private ReportMapper reportMapper;

    @Autowired
    private RequestMapper requestMapper;

    @Override
    public List<Report> selectList(Report report) {
        return reportMapper.selectList(report);
    }

    @Override
    public List<Request> getAllReportByPatId(Long patId) {
        return reportMapper.getAllReportByPatId(patId);
    }

    @Override
    public ReportDto getOrcReportByObcId(String orcId) {
        ReportDto dto = new ReportDto();
        //根据orcId查得到检查项目名称
        Request request = requestMapper.selectOrcReportByOrcId(orcId);
        String medTechProName = request.getMedTechProName();
        Report report = reportMapper.selectOrcReportByObcId(orcId);
        BeanUtils.copyProperties(report,dto);
        dto.setMedTechProName(medTechProName);
        return dto;
    }


}
