import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { IlistTemplateSchemesByPatient, ISaveTemplatesByPatParams, ICheckUpdateTemplatesParams, ICheckUpdateTemplates } from './types/HemoMedScheduleTem.type';


export function save(params: string) {
	return request({
		url: '/hemo/med/schedule/template/save',
		method: 'post',
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/hemo/med/schedule/template/delete',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
export function listTemplateByPatient (params: string) {
	return request({
		url: '/hemo/med/schedule/template/listTemplateByPatient ',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}
//导出模板至某周
export  function output(params:string){
	return request({
		url:"/hemo/med/schedule/template/output",
		method:'post',
		headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params,
	})
}
//导出模板至某周
export  function input(params:string){
	return request({
		url:"/hemo/med/schedule/template/input",
		method:'post',
		headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params,
	})
}
/**
 * 列出今天所在周数的透析排班计划
 * @param params 客户编号
 * @returns 
 */
export function getTemplate(params: string) {
    return request({
		url: '/hemo/med/schedule/template/getTemplate',
		method: 'post',
		headers: {
		'Content-Type': 'application/x-www-form-urlencoded'
		},
		data:params
    })
}
export function exportToExcel(params: string) {
	return request({
		url: '/hemo/med/schedule/template/exportToExcel',
		method: 'post',
		responseType: 'blob',
		params,
	});
}
export function templateTransfer(params: object) {
	return request({
		url: '/hemo/med/schedule/template/transfer',
		method: 'post',
		data: params,
	});
}
export function getCurrentScheduleNo (params: string) {
	return request({
		url: '/hemo/med/schedule/apply/getCurrentScheduleNo',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}

/**
 * 获取患者透析频率和排班模板
 * @param params 
 * @returns 
 */
export function listTemplateSchemesByPatient (params:{ patientCode: string }) :AxiosPromise<IlistTemplateSchemesByPatient> {
	return request({
		url: '/hemo/med/schedule/template/listTemplateSchemesByPatient',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		params,
	});
}

/**
 * 保存患者排班
 * @param params 
 * @returns 
 */
export function saveTemplatesByPat (params: ISaveTemplatesByPatParams) :AxiosPromise<null> {
	return request({
		url: '/hemo/med/schedule/template/saveTemplatesByPat',
		method: 'post',
		data:params,
	});
}


/**
 * 获取未排班的设备
 * @param data 
 * @returns 
 */
export function checkUpdateTemplatesApi(data: ICheckUpdateTemplatesParams) :AxiosPromise<ICheckUpdateTemplates[]>{
	return request({
		url: '/hemo/med/schedule/template/checkUpdateTemplates',
		method: 'post',
		data
	})
}