import request from '@/utils/request'
import requestDownload from '@/utils/request-download'
export function addBaseLineLesion(param) {
  return request({
    url: '/report/addBaseLineLesion',
    method: 'post',
    data: param
  })
}

export function getBLLineLesion(trialCode, subjectCode, tpCode) {
  return request({
    url: `/report/getBLLineLesion/${trialCode}/${subjectCode}/${tpCode}`,
    method: 'get'
  })
}

export function getVisitLineLesion(trialCode, subjectCode, visitNum, tpCode) {
  return request({
    url: `/report/getVisitLineLesion/${trialCode}/${subjectCode}/${visitNum}/${tpCode}`,
    method: 'get'
  })
}

export function saveVisitReport(param) {
  return request({
    url: '/report/saveVisitReport',
    method: 'post',
    data: param
  })
}

export function submiteReport(tpId) {
  return request({
    url: `/report/submiteReport/${tpId}`,
    method: 'post'
  })
}

export function saveImageLabelList(param) {
  return request({
    url: '/study/saveImageLabelList',
    method: 'post',
    data: param
  })
}

export function getStudyInfo(studyId, params) {
  return request({
    url: `/Study/item/${studyId}`,
    method: 'get',
    params
  })
}
export function getSeriesList(url) {
  return request({
    url: url,
    method: 'get'
  })
}
export function getInstanceList(seriesId) {
  return request({
    url: `/instance/list/id/${seriesId}`,
    method: 'get'
  })
}
export function getImageLabelList(tpCode) {
  return request({
    url: `/study/getImageLabelList/${tpCode}`,
    method: 'get'
  })
}
export function getRelationVisitList(visitNum, tpCode) {
  return request({
    url: `/study/getRelationVisitList/${visitNum}/${tpCode}`,
    method: 'get'
  })
}
export function getAllRelationStudyList(studyId, params) {
  return request({
    url: `/study/getAllRelationStudyList/${studyId}`,
    method: 'get',
    params
  })
}
export function getTrialListByReviewer(param) {
  return request({
    url: `/trial/getTrialListByReviewer`,
    method: 'post',
    data: param
  })
}

export function updateEnrollStatus(trialId, status) {
  return request({
    url: `/trial/updateEnrollStatus/${trialId}/${status}`,
    method: 'post'
  })
}

export function getHistoryVisitRsList(trialId, subjectId, visitNum, globalId, globalCode) {
  return request({
    url: `/globalReport/getHistoryVisitRsList/${trialId}/${subjectId}/${visitNum}/${globalId}/${globalCode}`,
    method: 'get'
  })
}

export function getHistoryGlobalRsList(trialId, subjectCode, visitNum, globalId) {
  return request({
    url: `/globalReport/getHistoryGlobalRsList/${trialId}/${subjectCode}/${visitNum}/${globalId}`,
    method: 'get'
  })
}

export function AddGlobalReport(param) {
  return request({
    url: `/globalReport/AddGlobalReport`,
    method: 'post',
    data: param
  })
}

export function GetAdReport(adId) {
  return request({
    url: `/globalReport/getAdReport/${adId}`,
    method: 'get'
  })
}

export function AddAdjudicationReport(param) {
  return request({
    url: `/globalReport/AddAdjudicationReport`,
    method: 'post',
    data: param
  })
}

export function getVisitStudyList(trialId, subjectVisitId, isReading, visitTaskId) {
  let url = `/SubjectVisit/getVisitStudyList/${trialId}/${subjectVisitId}/${isReading}`
  url = visitTaskId ? `${url}?visitTaskId=${visitTaskId}` : url
  return request({
    url: url,
    method: 'get'
  })
}

export function uploadPrintscreen(param, subjectId) {
  return request({
    url: `/Printscreen/UploadPrintscreen/${subjectId}`,
    method: 'post',
    data: param
  })
}

export function submitCustomTag(param) {
  return request({
    url: `/ReadingImageTask/submitCustomTag`,
    method: 'post',
    data: param
  })
}

export function deleteCustomTag(param) {
  return request({
    url: `/ReadingImageTask/deleteCustomTag/{id}`,
    method: 'post',
    data: param
  })
}

export function getCustomTag(param) {
  return request({
    url: `/ReadingImageTask/getCustomTag`,
    method: 'post',
    data: param
  })
}

export function clearSkipReadingCache(param) {
  return request({
    url: `/ReadingImageTask/clearSkipReadingCache`,
    method: 'post',
    data: param
  })
}

export function setSkipReadingCache(param) {
  return request({
    url: `/ReadingImageTask/setSkipReadingCache`,
    method: 'post',
    data: param
  })
}
export function resetReadingTask(param) {
  return request({
    url: `/ReadingImageTask/resetReadingTask`,
    method: 'post',
    data: param
  })
}
export function getTaskUploadedDicomStudyList(param) {
  return request({
    url: `/DownloadAndUpload/getTaskUploadedDicomStudyList`,
    method: 'post',
    data: param
  })
}
export function getIVUSTemplate(param) {
  return requestDownload({
    url: '/IVUSCalculate/getIVUSTemplate',
    method: 'post',
    responseType: 'blob',
    data: param
  })
}
export function uploadIVUSTemplate(param) {
  return request({
    url: `/IVUSCalculate/uploadIVUSTemplate`,
    method: 'post',
    data: param
  })
}

export function getOCTFCTTemplate(param) {
  return requestDownload({
    url: '/OCTCalculate/getOCTFCTTemplate',
    method: 'post',
    responseType: 'blob',
    data: param
  })
}

export function uploadOCTFCTTemplate(param) {
  return request({
    url: `/OCTCalculate/uploadOCTFCTTemplate`,
    method: 'post',
    data: param
  })
}

export function getOCTLipidAngleTemplate(param) {
  return requestDownload({
    url: '/OCTCalculate/getOCTLipidAngleTemplate',
    method: 'post',
    responseType: 'blob',
    data: param
  })
}
export function uploadOCTLipidAngleTemplate(param) {
  return request({
    url: `/OCTCalculate/uploadOCTLipidAngleTemplate`,
    method: 'post',
    data: param
  })
}

export function saveTableQuestionMark(param, type) {
  return request({
    url: `/saveTableQuestionMark/${type}`,
    method: 'post',
    data: param
  })
}

export function deleteTableQuestionMark(param, type) {
  return request({
    url: `/deleteTableQuestionMark/${type}`,
    method: 'post',
    data: param
  })
}

export function submitTaskRowInfo(param, type) {
  return request({
    url: `/SubmitTaskRowInfo/${type}`,
    method: 'post',
    data: param
  })
}

export function deleteSingleTableQuestionMark(param, type) {
  return request({
    url: `/DeleteSingleTableQuestionMark/${type}`,
    method: 'post',
    data: param
  })
}

// 阅片导入
export function readingImport(param) {
  return request({
    url: `/ReadingCalculate/readingImport`,
    method: 'post',
    data: param
  })
}
