import request from "@/utils/request";

const BASE_URL = "/internal/medicalLabel";

// 疾病管理-分页列表
export function diseasePageList(query) {
  return request({
    url: `${BASE_URL}/list`,
    method: "get",
    params: query,
  });
}

// 疾病管理-新增疾病
export function addDisease(data) {
  return request({
    url: `${BASE_URL}/save`,
    method: "post",
    data,
  });
}

// 疾病管理-更新疾病
export function updateDisease(data) {
  return request({
    url: `${BASE_URL}/save`,
    method: "patch",
    data,
  });
}

// 疾病管理- 删除疾病
export function deleteDisease(id) {
  return request({
    url: `${BASE_URL}/del/${id}`,
    method: "post",
  });
}

// 疾病管理-批量导入
export function batchImportDisease(file) {
  const formData = new FormData();
  formData.append("file", file);
  return request({
    url: `${BASE_URL}/import`,
    timeout: 60 * 1000 * 10, // 10分钟
    method: "post",
    data: formData,
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
}
