package digital.laboratory.platform.inspection.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
import digital.laboratory.platform.inspection.dto.DeleteTestAtlasDTO;
import digital.laboratory.platform.inspection.dto.TestRecordDto;
import digital.laboratory.platform.inspetion.api.entity.EntrustInfo;
import digital.laboratory.platform.inspetion.api.entity.TestRecord;
import digital.laboratory.platform.inspection.vo.ProcedureVo;
import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface TestRecordService extends IService<TestRecord> {
    @Transactional
    TestRecord createTestInstance(TestRecordDto testRecord, DLPUser dlpUser) throws Exception;

    TestRecord updateTestInstance(TestRecord testRecord);

    TestRecordVo getTestRecord(String id, DLPUser dlpUser);

    IPage<TestRecordVo> getTestRecordPageList(Page page, DLPUser dlpUser, LocalDateTime startTime, LocalDateTime endTime, String businessType);

    List<TestRecordVo>getTestRecordList(DLPUser dlpUser);

    boolean updateTestRecordArgument(String testId, String testRecordArgumentId, String argument,Integer opCode);

    TestRecord useTemplate(String testId, String templateId) throws Exception;

    ProcedureVo getProcedure(String testId);

    Map getPrintData(String businessId) throws Exception;

    boolean createInspectionRecordByBiological(String businessId) throws Exception;

    boolean createInspectionRecord(String businessId) throws Exception;

    @Transactional(rollbackFor = Exception.class)
    boolean delTestRecord(String testId);

    Page<String> getResultSolutionPage(Page page, String testId);


    /**
     * 根据业务id获取实验信息
     * @param businessIds
     * @return
     */
    R<Map<String, TestRecordVo>> queryTestRecordInfoByBusinessId(List<String> businessIds);

    /**
     * 根据业务id获取实验检验记录
     * @param businessId
     * @return
     */
    TestRecord getTestRecordByBusinessId(String businessId);
}
