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

/**
 * 新增患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestAddApi(data: IPatientGwsbAssistTestSave) {
	return request({
		url: '/patient/gwsb/assist/test/add',
		method: 'post',
		data,
	});
}

/**
 * 批量新增患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestBatchAddApi(data: IPatientGwsbAssistTestSave[]) {
	return request({
		url: '/patient/gwsb/assist/test/addList',
		method: 'post',
		data,
	});
}

/**
 * 删除患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestDelApi(id: number) {
	return request({
		url: '/patient/gwsb/assist/test/delete',
		method: 'post',
		params: { id },
	});
}

/**
 * 批量删除患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestBatchDelApi(ids: string) {
	return request({
		url: '/patient/gwsb/assist/test/deleteAll',
		method: 'post',
		params: { ids },
	});
}

/**
 * 根据id获取患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestDetailByIdApi(id: number): AxiosPromise<IPatientGwsbAssistTest> {
	return request({
		url: '/patient/gwsb/assist/test/detail',
		method: 'post',
		params: { id },
	});
}

/**
 * 根据code获取患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestDetailByCodeApi(code: string): AxiosPromise<IPatientGwsbAssistTest> {
	return request({
		url: '/patient/gwsb/assist/test/detail2',
		method: 'post',
		params: { code },
	});
}

/**
 * 获取患者辅助检查数据列表
 * @param params
 * @returns
 */
export function patientGwsbAssistTestListeApi(params): AxiosPromise<{ list: IPatientGwsbAssistTest[]; total: number; [key: string]: any }> {
	return request({
		url: '/patient/gwsb/assist/test/list',
		method: 'post',
		params,
	});
}

/**
 * 保存患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestSaveApi(data: IPatientGwsbAssistTestSave) {
	return request({
		url: '/patient/gwsb/assist/test/save',
		method: 'post',
		data,
	});
}

/**
 * 保存患者辅助检查数据
 * @param data
 * @returns
 */
export function patientGwsbAssistTestUpdateApi(data: IPatientGwsbAssistTestSave) {
	return request({
		url: '/patient/gwsb/assist/test/update',
		method: 'post',
		data,
	});
}
