/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2025-02-19 10:02:52
 * @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 const getTableList = (params?: any) => {
  return request('/centerSys/datafill/getPageItemList', {
    method: 'GET',
    params: { ...params },
  });
};

//获取当前院区所有科室
export const getCurrentHospAlldeps = () => {
  return request('/centerSys/sysdepartment/getHospDepartment', {
    method: 'GET',
  });
};

//获取动态表格数据
export const generateTableDataReq = (params: { fillItemCode: string; dataYear: number; name?: string }) => {
  return request('/centerSys/datafill/getItemDetail', {
    method: 'GET',
    params: { ...params },
  });
};

//新增
export type AddTableDataType = {};

export const addData = (data: AddTableDataType) => {
  return request('/centerSys/datafill/addItem', {
    method: 'POST',
    data,
  });
};

//编辑表格数据

export type TableRowEditType = {
  id: number;
} & AddTableDataType;

export const editData = (data: any) => {
  return request(`/centerSys/datafill/updateItem`, {
    method: 'POST',
    data,
  });
};

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

//批量保存填报详情
export const applyBatchItemValueReq = (data: any) => {
  return request(`/centerSys/datafill/applyBatchItemValue`, {
    method: 'POST',
    data,
  });
};
