import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { ICommonListParams } from '../common.type';
import type { IDeviceGroupList } from './tyeps/group.type';

export function Add(data:object){
	return request({
		url: '/device/group/info/add',
		method: 'post',
		data
	})
}
export function update(params: string) {
	return request({
		url: '/device/group/info/update',
		method: 'post',
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/device/group/info/delete',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
export function detail2(params: string) {
	return request({
		url: '/device/group/info/detail2',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}

/**
 * 获取设备分组列表
 * @param params 
 * @returns 
 */
export function list(params: ICommonListParams): AxiosPromise<IDeviceGroupList> {
	return request({
		url: '/device/group/info/list',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params,
	});
}
export function listAllDevices(params: string) {
	return request({
		url: '/device/group/info/listAllDevices',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
export function listAllDevices2(params: string) {
	return request({
		url: '/device/group/info/listAllDevices2',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
export function listAllDevices3(params: string) {
	return request({
		url: '/device/group/info/listAllDevices3',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
export function listPatHemoMedCard(params: string) {
	return request({
		url: '/patient/hemo/med/record/listPatHemoMedCard',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
// 读取设置API
export function loadCardSetting(params: string) {
	return request({
		url: '/patient/hemo/med/record/loadCardSetting',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
// 保存设置API
export function saveCardSetting(params: object) {
	return request({
		url: '/patient/hemo/med/record/saveCardSetting',
		method: 'post',
		data: params,
	});
}

/**
 * 获取透析单图片
 * @param data 
 * @returns 
 */
export function apiGetTreatmentSheetImg(data: { clientCode: string; recordCodes: string;}) {
	return request({
		url: "/patient/hemo/med/record/printMedReports",
		method: "post",
		headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: `clientCode=${data.clientCode}&recordCodes=${data.recordCodes}`
	})
}