import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { IInventoryListByTypesParams, ListNearExpireItemsParams, ListNearExpireItemsReponse, IInventoryItemUpdateManufacturerDealerDictParams } from './types';

export function Add(params: object) {
	return request({
		url: '/inventory/item/detail/info/add',
		method: 'post',
		data: params,
	});
}
export function update(params: object) {
	return request({
		url: '/inventory/item/detail/info/update',
		method: 'post',
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/inventory/item/detail/info/delete',
		method: 'post',
			headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
			},
		data: params,
	});
}
export function list(params: object) {
    return request({
      url: '/inventory/item/detail/info/list',
      method: 'post',
      params
    })
}
export function listKnj(params: string) {
    return request({
      url: '/inventory/item/detail/info/listKnj',
	  headers: {
		'Content-Type': 'application/x-www-form-urlencoded'
		},
      method: 'post',
      data: params,
    })
}
export function listItemWithSum(params: object) {
    return request({
      url: '/inventory/check/listItemWithSum',
      method: 'post',
       data:params
    })
}
export function listNames(params: object) {
	return request({
		url: '/inventory/item/detail/info/listNames',
		method: 'post',
			headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
			},
		params,
	});
}


/**
 * 获取过期检测数据
 * @param params 
 * @returns 
 */
export function listNearExpireItemsApi(params: ListNearExpireItemsParams): AxiosPromise<ListNearExpireItemsReponse> {
	return request({
		url: '/inventory/item/detail/info/listNearExpireItems',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params: params
	})
}

/**
 * 获取库存监测数据
 * @param params 
 * @returns 
 */
export function listInventoryMonitoringApi(params: ListNearExpireItemsParams) {
	return request({
		url: '/inventory/item/detail/info/listNearOutStockItems',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params: params
	})
}


/**
 * 厂商经销商字典手动快速录入
 * @param data 
 * @returns 
 */
export function inventoryItemUpdateManufacturerDealerDictApi(params: IInventoryItemUpdateManufacturerDealerDictParams) {
	return request({
		url: '/inventory/item/detail/info/updateManufacturerDealerDict',
		method: 'post',
		params
	})
}


/**
 * 获取库存字典
 * @param params 
 * @returns 
 */
export function inventoryListByTypesApi(params: IInventoryListByTypesParams) {
	return request({
		url: '/inventory/item/detail/info/listByTypes',
		method: 'post',
		params
	})
}

/**
 * 获自备药字典
 * @param params 
 * @returns 
 */
export function listByItemName(params: object) {
	return request({
		url: '/inventory/item/detail/info/listByItemName',
		method: 'post',
		params
	})
}

/**
 * 获自自备药列表
 * @param params 
 * @returns 
 */
export function listPage(params: object) {
	return request({
		url: '/patient/inventory/item/detail/info/listPage',
		method: 'post',
		params
	})
}
export function patientAdd(params: object) {
	return request({
		url: '/patient/inventory/item/detail/info/add',
		method: 'post',
		data: params,
	});
}
export function patientUpdate(params: object) {
	return request({
		url: '/patient/inventory/item/detail/info/update',
		method: 'post',
		data: params,
	});
}
export function patientDeleteId(params: string) {
	return request({
		url: '/patient/inventory/item/detail/info/delete',
		method: 'post',
			headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
			},
		data: params,
	});
}
export function listUpdateLog(params: object) {
    return request({
		url: '/patient/inventory/item/detail/info/listUpdateLog',
		method: 'post',
		params:params
    })
}

/**
 * 查询药品及收费项目接口
 * @param params 
 * @returns 
 */
export function queryDrugAndFeeTeamsApi(params: { page: number; size: number; clientCode: string; queryCondition?: string }) {
	return request({
		url: '/fee/service/group/info/queryDrugAndFeeTeams',
		method: 'post',
		params,
    })
}