import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { ListHistoryApiParams, BillInfoListReceipts1Params, BillInfoListReceipts23Params,  IGetConsumeInfoParams, IGetConsumeInfo, IPatientSelfInspectionParams } from './types';

export function Add(params: object) {
	return request({
		url: '/fee/service/info/add',
		method: 'post',
		data: params,
	});
}
export function update(params: object) {
	return request({
		url: '/fee/service/info/update',
		method: 'post',
		data: params,
	});
}
export function getOutputInfoList(params: object) {
	return request({
		url: '/patient/bill/info/getOutputInfoList',
		method: 'post',
		responseType: "blob",
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/fee/service/info/delete',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		data: params,
	});
}
export function list(params: object) {
	return request({
		url: '/fee/service/info/list',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}
export function listDrugs2(params: string) {
	return request({
		url: '/inventory/item/detail/info/listDrugs2',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		data: params,
	});
}
export function listStuffs(params: string) {
	return request({
		url: '/inventory/item/detail/info/listStuffs',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		data: params,
	});
}
export function reBuildPatientBill(params: object) {
	return request({
		url: '/patient/bill/info/reBuildPatientBill',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params,
	});
}
export function listItems(params: object) {
	return request({
		url: '/fee/service/group/detail/info/listItems',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params,
	});
}


/**
 * 获取门诊记录数据
 * @param params 
 * @returns 
 */
export function listHistoryApi(params: ListHistoryApiParams) {
	return request({
		url: '/patient/bill/set/info/listHistory',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}
/**
 * 获取处方详情
 * @param params 
 * @returns 
 */
export function PrescriptionDetailsApi(params: object) {
	return request({
		url: '/patient/bill/set/info/listHistoryDetails',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}


/**
 * 查询药与注射液的处方明细(收费清单打印用的)
 * @param params 
 * @returns 
 */
export function billInfoListReceipts1Api(params: BillInfoListReceipts1Params) {
	return request({
		url: '/patient/bill/info/listReceipts1',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}

/**
 * 根据处方编号,查询治疗项目(收费清单打印用的)
 * @param patientCode 
 * @returns 
 */
export function billInfoListReceipts2Api(params: BillInfoListReceipts23Params) {
	return request({
		url: '/patient/bill/info/listReceipts2',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}


/**
 * 根据处方编号,查询检验项目(收费清单打印用的)
 * @param patientCode 
 * @returns 
 */
export function billInfoListReceipts3Api(params: BillInfoListReceipts23Params) {
	return request({
		url: '/patient/bill/info/listReceipts3',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}

/**
 * 剩余库存低于库存预警值
 * @param clientCode 
 * @returns 
 */
export function listHisKcjcApi(clientCode: string) {
	return request({
		url: '/inventory/item/detail/info/listHisKcjc',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params: { clientCode }
	})
}

/**
 * 有效期低于预警天数
 * @param clientCode 
 * @returns 
 */
export function listHisyxqjcApi(clientCode: string) {
	return request({
		url: '/inventory/item/detail/info/listHisyxqjc',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params: { clientCode }
	})
}

/**
 * 患者复诊记录自查api
 * @param params 
 * @returns 
 */
export function patientSelfInspectionApi(params: IPatientSelfInspectionParams) {
	return request({
		url: '/revisit/record/patientSelfInspection',
		method: 'post',
		headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params
	})
}


/**
 * 取消处方同步
 * @param id 
 * @returns 
 */
export function cancelSyncFeeApi(id: number) {
	return request({
		url: '/patient/bill/set/info/cancelSync',
		method: 'post',
		headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params: { id }
	})
}

/**
 * 获取患者当月费用情况
 * @param params 
 * @returns 
 */
export function getConsumeInfoApi(params: IGetConsumeInfoParams): AxiosPromise<IGetConsumeInfo> {
	return request({
		url: '/patient/bill/set/info/getConsumeInfo',
		method: 'post',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		},
		params
	})
}

/**
 * 患者复诊记录自查api
 * @param params 
 * @returns 
 */
// export function patientSelfInspectionApi(params: IPatientSelfInspectionParams) {
// 	return request({
// 		url: '/revisit/record/patientSelfInspection',
// 		method: 'post',
// 		headers: {
//             'Content-Type': 'application/x-www-form-urlencoded'
//         },
// 		params
// 	})
// }