import request from '/@/utils/request';
import type { IPatientDialysisFrequencyCountRes, IPatientDialysisFrequencyCountParams, ItKtvAndUrrListByCondition, IGetKtvAndUrrListByCondition, IWypertensionStatistics, IWypertensionStatisticsParams, IQualityControlReportParams, IQualityControlReportReponse, WeightControlRateDetail, WeightControlRateByYearParams, WeightControlRateByYear, WeightControlRateDetailstParams } from './types'
import { AxiosPromise } from 'axios';


export function listWorkStats(params: object) {
	return request({
		url: '/patient/hemo/med/record/listWorkStats',
		method: 'post',
		data: params,
	});
}
export function listRecordsWorkStats(params: object) {
	return request({
		url: '/patient/hemo/med/record/listRecordsWorkStats',
		method: 'post',
		data: params,
	});
}

export function listHemoNurseWorkStats(params: object) {
	return request({
		url: '/patient/hemo/med/record/listHemoNurseWorkStats',
		method: 'post',
		data: params,
	});
}
export function listRecordsByToolUsage(params: object) {
	return request({
		url: '/patient/hemo/med/record/listRecordsByToolUsage',
		method: 'post',
		data: params,
	});
}
export function listRecordsByMedicineUsage(params: object) {
	return request({
		url: '/patient/hemo/med/record/listRecordsByMedicineUsage',
		method: 'post',
		data: params,
	});
}

export function listDetailsOfMedicineUsage(params: object) {
	return request({
		url: '/patient/hemo/med/record/listDetailsOfMedicineUsage',
		method: 'post',
		data: params,
	});
}
export function doStatByResult(params: object) {
	return request({
		url: '/lis/stat/doStatByResult',
		method: 'post',
		data: params,
	});
}
export function doStatCountByResult(params: object) {
	return request({
		url: '/lis/stat/doStatCountByResult',
		method: 'post',
		data: params,
	});
}
export function doClientStat4(params: object) {
	return request({
		url: '/lis/stat/doClientStat4',
		method: 'post',
		data: params,
	});
}
export function doListResultsGroupByMonth(params: object) {
	return request({
		url: '/lis/stat/doListResultsGroupByMonth',
		method: 'post',
		data: params,
	});
}
export function doListTestItems() {
	return request({
		url: '/lis/stat/doListTestItems',
		method: 'post',
	});
}
export function doTestItemPassedCount(params: object) {
	return request({
		url: '/lis/stat/doTestItemPassedCount',
		method: 'post',
		data: params,
	});
}
export function listGroups() {
	return request({
		url: '/client/group/info/listGroups',
		method: 'post',
	});
}
export function listDetailsEachOne(params) {
	return request({
		url: '/client/group/info/listDetailsEachOne',
		method: 'post',
		// headers: {
        //     'Content-Type': 'application/x-www-form-urlencoded'
        // },
		params,
	});
}


/**
 * 重新计算KTV与URR
 * @param params 
 * @returns 
 */
export function doCalcKtvOrUrrApi(params) {
	return request({
		url: '/lis/stat/doCalcKtvOrUrr',
		method: 'post',
		params
	})
}

/**
 * 统计体重增长控制率
 * @param params 
 * @returns 
 */
export function weightControlRateByYearApi(params: WeightControlRateByYearParams): AxiosPromise<WeightControlRateByYear> {
	return request({
		url: '/patient/stat/weight/increase/range/weightControlRateByYear',
		method: 'post',
		params
	})
}

/** 统计体重增长控制率详情 */
export function weightControlRateDetailsApi(data: WeightControlRateDetailstParams): AxiosPromise<{ list: WeightControlRateDetail[]; total: number }> {
	return request({
		url: '/patient/stat/weight/increase/range/weightControlRateDetails',
		method: 'post',
		data
	})
}

/**
 * 查询KTV Or URR接口
 * @param data 
 * @returns 
 */
// export function getKtvAndUrrListByConditionsApi(data: IGetKtvAndUrrListByCondition) :AxiosPromise<{ list: ItKtvAndUrrListByCondition[]; total: number; }> {
// 	return request({
// 		url: '/patient/ktv/listByConditions',
// 		method: 'post',
// 		data
// 	})
// }

/**
 * 查询KTV Or URR接口
 * @param data 
 * @returns 
 */
export function getKtvAndUrrListByConditionsApi(data: IGetKtvAndUrrListByCondition) :AxiosPromise<{ list: ItKtvAndUrrListByCondition[]; total: number; }> {
	return request({
		url: '/patient/ktv/listByConditions',
		method: 'post',
		data
	})
}

/**
 * 药物用量统计页面
 */

export function listGroupByDrug(param) {
	return request({
		url: '/patient/drug/order/vs/patient/listGroupByDrug',
		method: 'post',
		params:param
	})
}
/**
 * 药物用量统计页面明细
 */

export function listDetailByDrug(param) {
	return request({
		url: '/patient/drug/order/vs/patient/listDetailByDrug',
		method: 'post',
		params:param
	})
}
/**
 * 药物用量统计临时医嘱
 */

export function listTempDrugGroupByDrug(param) {
	return request({
		url: '/patient/drug/order/vs/patient/listTempDrugGroupByDrug',
		method: 'post',
		params:param
	})
}

/**
 * 药物用量统计临时医嘱明细
 */

export function listTempDrugDetailByDrug(param) {
	return request({
		url: '/patient/drug/order/vs/patient/listTempDrugDetailByDrug',
		method: 'post',
		params:param
	})
}

/**
 * 获取高血压控制率
 * @param params 
 * @returns 
 */
export function hypertensionStatisticsApi(params: IWypertensionStatisticsParams) :AxiosPromise<IWypertensionStatistics> {
	return request({
		url: '/patient/hemo/med/body/state/pre/hypertensionStatistics',
		method: 'post',
		params
	})
}

/**
 * 获取质控报表
 * @param params 
 * @returns 
 */
export function qualityControlReportApi(params: IQualityControlReportParams): AxiosPromise<IQualityControlReportReponse> {
	return request({
		url: '/patient/info/qualityControlReport',
		method: 'post',
		params
	})
}



/**
 * 月度患者透析次数统计接口
 * @param data 
 * @returns 
 */
export function patientDialysisFrequencyCountApi(data: IPatientDialysisFrequencyCountParams) :AxiosPromise<IPatientDialysisFrequencyCountRes> {
	return request({
		url: '/patient/hemo/med/record/patientDialysisFrequencyCount',
		method: 'post',
		data
	})
}