import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { IPathologyDiagnoseListParams, IPathologyDiagnose, IPathologyDiagnoseAny } from './types/index.type';


/**
 * 添加患者病理诊断
 * @param data 
 * @returns 
 */
export function pathologyDiagnoseAddApi(data: IPathologyDiagnoseAny) {
    return request({
        url: '/patient/pathology/diagnose/add',
        method: 'post',
        data
    })
}


/**
 * 批量添加患者病理诊断
 * @param data 
 * @returns 
 */
export function pathologyDiagnoseAddListApi(data: IPathologyDiagnoseAny[]) {
    return request({
        url: '/patient/pathology/diagnose/addList',
        method: 'post',
        data
    })
}

/**
 * 删除患者病理诊断
 * @param id 
 * @returns 
 */
export function pathologyDiagnoseDelApi(id: number) {
    return request({
        url: '/patient/pathology/diagnose/delete',
        method: 'post',
        params: {
            id
        }
    })
}


/**
 * 批量删除患者病理诊断
 * @param ids 
 * @returns 
 */
export function pathologyDiagnoseDelAllApi(ids: string) {
    return request({
        url: '/patient/pathology/diagnose/deleteAll',
        method: 'post',
        data: {
            ids
        }
    })
}

/**
 * 根据id获取患者病理诊断详情
 * @param id 
 * @returns 
 */
export function pathologyDiagnoseDetailByIdApi(id: number): AxiosPromise<IPathologyDiagnose> {
    return request({
        url: '/patient/pathology/diagnose/detail',
        method: 'post',
        params: {
            id
        }
    })
}

/**
 * 根据code获取患者病理诊断详情
 * @param id 
 * @returns 
 */
export function pathologyDiagnoseDetailByCodeApi(code: number): AxiosPromise<IPathologyDiagnose>  {
    return request({
        url: '/patient/pathology/diagnose/detail',
        method: 'post',
        params: {
            code
        }
    })
}


/**
 * 获取患者病理诊断列表
 * @param params 
 * @returns 
 */
export function pathologyDiagnoseListApi(params: IPathologyDiagnoseListParams): AxiosPromise<{ list: IPathologyDiagnose[]; total: number; [key: string]: any; }>  {
    return request({
        url: '/patient/pathology/diagnose/list',
        method: 'post',
        params
    })
}


/**
 * 保存患者病理诊断
 * @param data 
 * @returns 
 */
export function pathologyDiagnoseSaveApi(data: IPathologyDiagnoseAny) : AxiosPromise<IPathologyDiagnose> {
    return request({
        url: '/patient/pathology/diagnose/save',
        method: 'post',
        data
    })
}


/**
 * 更新患者病理诊断
 * @param data 
 * @returns 
 */
export function pathologyDiagnoseUpdateApi(data: IPathologyDiagnoseAny) {
    return request({
        url: '/patient/pathology/diagnose/update',
        method: 'post',
        data
    })
}