import fetch from '../fetch'
import { getBaseUrl } from '@/utils/index'

export const uploadExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/v2/role/importRoleFile?projectId=' + projectId),
    method: 'post',
    data: data,
    description: '上传excel文件',
  })
  // })
}
export const uploadOrgExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/new/scope/org/v1/' + projectId + '/import'),
    method: 'put',
    data: data,
    description: '上传excel文件',
  })
  // })
}
export const uploadPersonExcel = (data, projectId) => {
  // return utils.checkAuth(()=>{
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/new/scope/doctor/v1/' + projectId + '/import'),
    method: 'put',
    data: data,
    description: '上传excel文件',
  })
  // })
}
export const uploadShieldExcel = (data, projectId) => {
  return fetch({
    headers: {
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('aggregate/black/setPeopleBlackStatus/batch/' + projectId),
    method: 'post',
    data: data,
    description: '上传excel文件',
  })
}

export const uploadMateExcel = (data) => {
  return fetch({
    headers: {
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/black/transferHospitalInfo'),
    method: 'post',
    data: data,
    description: '转换机构信息上传文件',
  })
}
export const uploadBatchExcel = (data) => {
  return fetch({
    headers: {
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/black/setHospitalBlackStatus/batch'),
    method: 'post',
    data: data,
    description: '屏蔽机构操作上传文件',
  })
}

export const getUploadExcelProgress = (id) => {
  return fetch({
    headers: {
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl(`portal/new/batch/progress/doctor/${id}`),
    method: 'post',
    description: '人员导入核销处理进度，id为批次id',
  })
}

export const uploadPersonExcel2 = (data, projectId) => {
  return fetch({
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      sysCode: 12,
      token: localStorage.getItem('storageToken'),
    },
    url: getBaseUrl('portal/new/scope/doctor/v2/' + projectId + '/import'),
    method: 'put',
    data: data,
    description: '上传excel文件',
  })
}
