import request from '/@/utils/request';
import type { AxiosPromise } from 'axios';
import type { ICommonListParams } from '../common.type';
import type { IPatFootBaaeInfo, IPatFootBaaeInfoRespData, IGetLatestDataParams, IGetLatestDataReponse, IGetLatestData  } from './types/patient_foot_base_info.type';

/**
 * 新增患者足部管理基础信息
 * @param data 
 * @returns 
 */
export function patientFootBaseAddApi(data) {
    return request({
        url: '/patient/foot/base/info/add',
        method: 'post',
        data
    })
}


/**
 * 批量添加患者足部管理基础信息
 * @param data 
 * @returns 
 */
export function patientFootBaseAddListApi(data: IPatFootBaaeInfo) {
    return request({
        url: '/patient/foot/base/info/addList',
        method: 'post',
        data
    })
}

/**
 * 删除患者足部管理基础信息
 * @param id 
 * @returns 
 */
export function patientFootBaseDelApi(id: number) {
    return request({
        url: '/patient/foot/base/info/delete',
        method: 'post',
        params: { id }
    })
}


/**
 * 批量删除患者足部管理基础信息
 * @param ids
 * @returns 
 */
export function patientFootBaseBratchDelApi(ids: string) {
    return request({
        url: '/patient/foot/base/info/deleteAll',
        method: 'post',
        params: { ids }
    })
}

/**
 * 根据id获取患者足部管理基础信息
 * @param id
 * @returns 
 */
export function patientFootBaseDetaliByIdApi(id: number) {
    return request({
        url: '/patient/foot/base/info/detail',
        method: 'post',
        params: { id }
    })
}

/**
 * 根据code获取患者足部管理基础信息
 * @param code
 * @returns 
 */
export function patientFootBaseDetaliByCodeApi(code: string) {
    return request({
        url: '/patient/foot/base/info/detail2',
        method: 'post',
        params: { code }
    })
}


/**
 * 获取患者足部管理基础信息列表
 * @param params 
 * @returns 
 */
export function patientFootBaseListApi(params: ICommonListParams) :AxiosPromise<IPatFootBaaeInfoRespData> {
    return request({
        url: '/patient/foot/base/info/list',
        method: 'post',
        params,
    })
}

/**
 * 保存患者足部管理基础信息
 * @param data 
 * @returns 
 */
export function patientFootBaseSaveApi(data: IPatFootBaaeInfo) {
    return request({
        url: '/patient/foot/base/info/save',
        method: 'post',
        data,
    })
}

/**
 * 更新患者足部管理基础信息
 * @param data 
 * @returns 
 */
export function patientFootBaseUpdateApi(data: Partial<IPatFootBaaeInfo>) {
    return request({
        url: '/patient/foot/base/info/update',
        method: 'post',
        data,
    })
}


/**
 * 根据患者编号/开始日期/结束日期获取患者最新一条ABI数据
 * @param params 
 * @returns 
 */
export function getLatestDataApi(params: IGetLatestDataParams) : AxiosPromise<IGetLatestData> {
    return request({
        url: '/patient/result/from/doppler/blood/flow/device/getLatestData',
        method: 'post',
        params
    })
}