import request from '/@/utils/request';
import type { AxiosPromise } from 'axios';
import type { IDrugOrderOperationRecord, IDrugOrderOperationRecordList, IDrugOrderOperationRecordParams } from './types/index.type';

/**
 * 新增长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordAddApi(data: Partial<IDrugOrderOperationRecord>) {
    return request({
        url: '/drug/order/operation/record/add',
        method: 'post',
        data
    })
}

/**
 * 批量新增长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordAddListApi(data: Partial<IDrugOrderOperationRecord>[]) {
    return request({
        url: '/drug/order/operation/record/addList',
        method: 'post',
        data
    })
}

/**
 * 删除长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordDelApi(id: number) {
    return request({
        url: '/drug/order/operation/record/delete',
        method: 'post',
        data: { id }
    })
}

/**
 * 批量删除长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordDelAllApi(ids: string) {
    return request({
        url: '/drug/order/operation/record/deleteAll',
        method: 'post',
        data: { ids }
    })
}

/**
 * 根据id获取长期医嘱修改记录详情
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordDetailByIdApi(id: number) :AxiosPromise<IDrugOrderOperationRecord> {
    return request({
        url: '/drug/order/operation/record/dateil',
        method: 'post',
        params: { id }
    })
}

/**
 * 根据code获取长期医嘱修改记录详情
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordDetailByCodeApi(code: string) :AxiosPromise<IDrugOrderOperationRecord> {
    return request({
        url: '/drug/order/operation/record/dateil2',
        method: 'post',
        params: { code }
    })
}

/**
 * 获取长期医嘱修改记录列表
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordListApi(params: IDrugOrderOperationRecordParams): AxiosPromise<IDrugOrderOperationRecordList> {
    return request({
        url: '/drug/order/operation/record/list',
        method: 'post',
        params,
    })
}


/**
 * 保存长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordSaveApi(data: Partial<IDrugOrderOperationRecord>) {
    return request({
        url: '/drug/order/operation/record/save',
        method: 'post',
        data,
    })
}

/**
 * 更新长期医嘱修改记录
 * @param data 
 * @returns 
 */
export function drugOrderOperationRecordUpdateApi(data: Partial<IDrugOrderOperationRecord>) {
    return request({
        url: '/drug/order/operation/record/update',
        method: 'post',
        data,
    })
}