/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-03-24 12:22:03
 * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */



import { request } from 'umi';

//获取table列表数据

export type DepartmentDataType = {
    id:number;
    hospId:string;
    code:string;
    name:string;
    type:string;
    remark:string;
    hospName:string;
    typeName:string;
}


export const getDepartmentData = (params?:any) => {
  return request<{
       current:number;
       list:DepartmentDataType[];
       pageSize:number;
       totalCount:number;
       totalPage:number;
  }>('/centerSys/sysdepartment/getList', {
    method: 'GET',
    params:{...params}
  });
};


//新增表格数据
export type AddTableDataType = {
  hospId:number;
  dictName:string;
  dictType:string;
  remark:string
}
export const addData = (data:AddTableDataType) => {
  return request('/centerSys/sysdepartment/add', {
    method: 'POST',
    data
  });
};



//编辑表格数据
export type EditTableDataType = {
  dictId:number;
  hospId:number;
  dictName:string;
  dictType:string;
  remark:string
}

export const editData = (data:EditTableDataType) => {
  return request('/centerSys/sysdepartment/edit', {
    method: 'POST',
    data
  });
};

//删除表格操作
export const delData = (id:string) => {
  return request('/centerSys/sysdepartment/delete', {
    method: 'POST',
    params:{id}
  });
};



//获取科室类型

export type GetDepartmentType = {
    code:string;
    value:string;
    name:string;
}

export const getDepartmentType = (params?:any) => {
    return request<GetDepartmentType[]>('/centerSys/sysdepartment/getDepartType', {
      method: 'GET',
    });
};


//科室数据导入

export const importDepartmentData = (data:any) => {
    return request('/centerSys/sysdepartment/importData', {
      method: 'POST',
      data
    });
};



//获取互通院区列表

export const getRelaHosp = () => {
    return request('/centerSys/hospital/currentAndShareHosp', {
      method: 'GET',
    });
};






