import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { ICustomDict, IDict } from './types/index.type';


export function listDictType() {
	return request({
		url: '/dict/base/info/listDictTypes',
		method: 'post',
	});
}
export function saveDictTypes(params:object) {
	return request({
		url: '/dict/base/info/saveDictTypes',
		method: 'post',
        data: params,
	});
}
export function saveCustDictTypes(params:object) {
	return request({
		url: '/dict/custom/info/saveDictTypes',
		method: 'post',
        data: params,
	});
}
export function listDictValuesByType(params: string): AxiosPromise<IDict[]> {
    return request({
      url: 'dict/base/info/listDictValuesByType',
      method: 'post',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
        },
      data: params,
    })
}

export function getDictType(params: Object) {
  return request({
      url: '/dict/base/info/listDictValuesByType',
      method: 'post',
      headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
      },
      params,
  })
}
export function listDictValuesByType2(params: string): AxiosPromise<IDict[]> {
  return request({
    url: 'dict/base/info/listDictValuesByType2',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
      },
    data: params,
  })
}

/** 获取自定义字典 */
export function listCustomDictValuesByType(params: string): AxiosPromise<ICustomDict[]> {
  return request({
    url: '/dict/custom/info/listCustomDictValuesByType',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
      },
    data: params,
  })
}
// 根据字典类型取得所有字典项
export function getListByTypeList(dictType: string) {
  return request({
    url: '/dict/base/info/listDictValuesByType',
    method: 'post',
    params: {
      dictType: dictType
    }
  })
}

export function listCustomDictTypes() {
  return request({
    url: 'dict/custom/info/listCustomDictTypes',
    method: 'post',
  })
}
// 药物字典查询
export function getDrupDicList(params:object) {
  return request({
    url: '/drug/info/list',
    method: 'post',
    params
  })
}
// 新增药物字典
export function addDrugDict(data:object) {
  return request({
    url: '/drug/info/add',
    method: 'post',
    data
  })
}
// 修改药物字典
export function updateDrugDict(data:object) {
  return request({
    url: '/drug/info/update',
    method: 'post',
    data
  })
}
// 删除药品字典
export function deleteDrugDict(id:number) {
  return request({
    url: '/drug/info/delete',
    method: 'post',
    params: {
      id
    }
  })
}
// 根据客户列出药物字典
export function getDrugDictOfClient (clientCode: string,drugName:string) {
  return request({
    url: '/drug/info/listDrugsByClient',
    method: 'post',
    params: {
      clientCode,
      drugName
    }
  })
}
export function getsuntopItemList (params) {
  return request({
    url: '/data/global/item/info/list',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    params
  })
}
export function getCleanList(params: Object) {
  return request({
      url: '/device/clean/type/list',
      method: 'post',
      headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
      },
      params,
  })
}
// 删除药品字典
export function deleteCleanDict(id:number) {
  return request({
    url: '/device/clean/type/delete',
    method: 'post',
    params: {
      id
    }
  })
}
export function addCleanDict(data:object){
	return request({
		url: '/device/clean/type/add',
		method: 'post',
		data
	})
}
export function updateCleanDict(data: object) {
	return request({
		url: '/device/clean/type/update',
		method: 'post',
		data,
	});
}