import request from '@/utils/request';

// 查询器材目录列表
export function getDeviceList (query) {
  return request ({
    url: '/data-dictionary/device/information-page',
    method: 'get',
    params: query,
  });
}

// 查询器材目录详细
export function getDeviceOne (id) {
  return request ({
    url: '/data-dictionary/device/information-one',
    method: 'get',
    params: {id}, // 确保参数正确传递
  });
}
// 校验器材是否可以编辑
export function validateEditDevice (deviceId) {
  return request ({
    url: '/data-dictionary/device/validate-edit',
    method: 'get',
    params: {deviceId}, // 确保参数正确传递
  });
}

// 新增器材目录
export function addDevice (data) {
  return request ({
    url: '/data-dictionary/device/information',
    method: 'post',
    data: data,
  });
}

// 修改器材目录
export function editDevice (data) {
  return request ({
    url: '/data-dictionary/device/information',
    method: 'put',
    data: data,
  });
}

// // 删除器材目录
// export function delUser(userId) {
//   return request({
//     url: '/system/user/' + userId,
//     method: 'delete'
//   })
// }

// 器材目录分类查询
export function getDiseaseTreatmentInit () {
  return request ({
    url: '/data-dictionary/device/init',
    method: 'get',
  });
}

// 停用病种目录
export function stopDevice (ids) {
  console.log (ids);
  return request ({
    url: '/data-dictionary/device/information-stop',
    method: 'put',
    data: ids,
  });
}

// 启用病种目录
export function startDevice (ids) {
  console.log (ids);
  return request ({
    url: '/data-dictionary/device/information-start',
    method: 'put',
    data: ids,
  });
}

// 查询部门树形数据
export function deptTreeSelect (queryParams) {
  return request ({
    url: '/base-data-manage/organization/organization',
    method: 'get',
    params: queryParams,
  });
}

// 查询地点树形数据
export function locationTreeSelect (queryParams) {
  return request ({
    url: '/base-data-manage/location/location-page-tree',
    method: 'get',
    params: queryParams,
  });
}

// 获取医疗服务项目目录
export function getYbDeviceList (queryParams) {
  return request ({
    url: '/catalog/page',
    method: 'get',
    params: queryParams,
  });
}
