import request from '/@/utils/request';

import type { AxiosPromise } from 'axios';
import type { IPatientFailEvaluate, IPatientFailEvaluateReponse } from './types/index.type';
import type { ICommonListParams } from '../common.type';


/**
 * 新增跌倒评估险api
 * @param data 
 * @returns 
 */
export function addPatientFallEvaluateApi(data: IPatientFailEvaluate) {
    return request({
        url: '/patient/fall/evaluate/add',
        method: 'post',
        data
    })
}


/**
 * 修改跌倒评估险api
 * @param data 
 * @returns 
 */
export function updatePatientFallEvaluateApi(data: IPatientFailEvaluate) {
    return request({
        url: '/patient/fall/evaluate/update',
        method: 'post',
        data
    })
}

/**
 * 删除跌倒评估险api
 * @param id 
 * @returns 
 */
export function delPatientFallEvaluateApi(id: number) {
    return request({
        url: '/patient/fall/evaluate/delete',
        method: 'post',
        params: { id }
    })
}


/**
 * 根据code查询跌倒评估险api
 * @param code 
 * @returns 
 */
export function getPatientFallEvaluateDetailByCodeApi(code: string): AxiosPromise<IPatientFailEvaluate> {
    return request({
        url: '/patient/fall/evaluate/detail2',
        method: 'post',
        params: { code }
    })
}

/**
 * 查询跌倒评估险列表api
 * @param params 
 * @returns 
 */
export function getPatientFallEvaluateListApi(params: ICommonListParams): AxiosPromise<IPatientFailEvaluateReponse> {
    return request({
        url: '/patient/fall/evaluate/list',
        method: 'post',
        params,
    })
}

//滑脱风险评估
/**
 * 新增滑脱评估险api
 * @param data 
 * @returns 
 */
export function addPatientSlippageApi(data) {
  return request({
    url: '/patient/assessment/of/catheter/dislocation/add',
    method: 'post',
    data
  })
}

/**
 * 修改滑脱评估险api
 * @param data 
 * @returns 
 */
export function editPatientSlippageApi(data) {
  return request({
    url: '/patient/assessment/of/catheter/dislocation/update',
    method: 'post',
    data
  })
}

/**
 * 删除跌倒评估险api
 * @param id 
 * @returns 
 */
export function delPatientSlippageApi(id: number) {
    return request({
        url: '/patient/assessment/of/catheter/dislocation/delete',
        method: 'post',
        params: { id }
    })
}

/**
 * 查询滑脱评估险列表api
 * @param params 
 * @returns 
 */
export function getPatientSlippageListApi(params: ICommonListParams): AxiosPromise<IPatientFailEvaluateReponse> {
    return request({
        url: '/patient/assessment/of/catheter/dislocation/list',
        method: 'post',
        params,
    })
}

/**
 * 根据code查询滑脱评估险api
 * @param code 
 * @returns 
 */
export function getPatientSlippageDetailByCodeApi(id,code): AxiosPromise<IPatientFailEvaluate> {
    return request({
        url: `/patient/assessment/of/catheter/dislocation/detail2?id=${id}`,
        method: 'post',
        params: { code }
    })
}