import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HospitalVO, HospitalForm, HospitalQuery } from '@/api/system/hospital/types';

/**
 * 查询医院管理列表
 * @param query
 * @returns {*}
 */

export const listHospital = (query?: HospitalQuery): AxiosPromise<HospitalVO[]> => {
  return request({
    url: '/system/hospital/list',
    method: 'get',
    params: query
  });
};


export const getHospitalData = (): AxiosPromise<HospitalVO> => {
  return request({
    url: '/system/hospital/getHospitalData',
    method: 'get',
  });
};

/**
 * 查询医院管理详细
 * @param hospitalId
 */
export const getHospital = (hospitalId: string | number): AxiosPromise<HospitalVO> => {
  return request({
    url: '/system/hospital/' + hospitalId,
    method: 'get'
  });
};

/**
 * 新增医院管理
 * @param data
 */
export const addHospital = (data: HospitalForm) => {
  return request({
    url: '/system/hospital',
    method: 'post',
    data: data
  });
};

/**
 * 修改医院管理
 * @param data
 */
export const updateHospital = (data: HospitalForm) => {
  return request({
    url: '/system/hospital',
    method: 'put',
    data: data
  });
};

/**
 * 删除医院管理
 * @param hospitalId
 */
export const delHospital = (hospitalId: string | number | Array<string | number>) => {
  return request({
    url: '/system/hospital/' + hospitalId,
    method: 'delete'
  });
};
