import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ScreeningVO, ScreeningForm, ScreeningQuery } from '@/api/system/screening/types';

/**
 * 查询营养筛查列表
 * @param query
 * @returns {*}
 */

export const listScreening = (query?: ScreeningQuery): AxiosPromise<ScreeningVO[]> => {
  return request({
    url: '/system/screening/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询营养筛查详细
 * @param id
 */
export const getScreening = (id: string | number): AxiosPromise<ScreeningVO> => {
  return request({
    url: '/system/screening/' + id,
    method: 'get'
  });
};

/**
 * 新增营养筛查
 * @param data
 */
export const addScreening = (data: ScreeningForm) => {
  return request({
    url: '/system/screening',
    method: 'post',
    data: data
  });
};

/**
 * 修改营养筛查
 * @param data
 */
export const updateScreening = (data: ScreeningForm) => {
  return request({
    url: '/system/screening',
    method: 'put',
    data: data
  });
};

/**
 * 删除营养筛查
 * @param id
 */
export const delScreening = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/screening/' + id,
    method: 'delete'
  });
};
