/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-07-15 10:13:10
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2025-04-25 10:07:12
 * @FilePath: /KC-MiddlePlatform/src/service/indicator.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { request } from 'umi';

//获取指标列表

export type IndicatorManaItemType = {
  [x: string]: any;
  current: number;
  pageSize: number;
  totalCount: number;
  totalPage: number;
  list?: any[];
};
export const getIndicatorManaList = async (params: { current?: number; pageSize?: number; menuCode: string; menuType: string; [key: string]: any }) => {
  return request<IndicatorManaItemType>('/centerSys/indicator/getIndicatorDetail', {
    method: 'GET',
    params: { ...params, pageSize: 100 },
  });
};

//添加指标信息
export const addIndicatorManaList = async (data: any) => {
  return request('/centerSys/indicator/addIndicator', {
    method: 'POST',
    data: data,
  });
};

//编辑指标信息
export const editIndicatorManaList = async (data: any) => {
  return request('/centerSys/indicator/editIndicator', {
    method: 'POST',
    data: data,
  });
};

//保存指标与数据项目的绑定
export const saveIndicatorBindItems = async (data: any) => {
  return request('/centerSys/indicator/applyIndicatorDataMap', {
    method: 'POST',
    data: data,
  });
};

//删除指标
export const delIndicatorManaList = async (params: { id: number }) => {
  return request('/centerSys/indicator/deleteIndicator', {
    method: 'POST',
    params: params,
  });
};

//获取指标目录

export const getIndicatorCateList = async (params?: { menuType: string }) => {
  return request<any[]>('/centerSys/indicator/getHospIndicatorMenu', {
    method: 'GET',
    params: params,
  });
};

//获取指标穿梭框数据
export const getTransferDataReq = async (indicatorCode: string) => {
  return request('/centerSys/indicator/getIndicatorDataMap', {
    method: 'GET',
    params: { indicatorCode },
  });
};

//获取指标详情
export const getIndicatorDetailReq = async (params: { indicatorCode: string; dataYear: string; periodType: string; fillItemName?: string }) => {
  return request('/centerSys/indicator/getIndicatorFillData', {
    method: 'GET',
    params: params,
  });
};

//老版本
export const getIndicatorManaList_old = async (params: { current: number; pageSize: number; menuCode: string; [key: string]: any }) => {
  return request<IndicatorManaItemType>('/centerSys/indicator/getIndicatorList', {
    method: 'GET',
    params: { ...params, pageSize: 100 },
  });
};

//获取指标目录 老版本

export const getIndicatorCateList_old = async (params?: { menuCode: string }) => {
  return request<any[]>('/centerSys/indicator/getIndicatorMenu', {
    method: 'GET',
    params: params,
  });
};


//编辑指标绑定的报告

export const applyOnlineReportMap = async (params?: { code: string,onlineReportCode:string,onlineRemark:string }) => {
  return request<any[]>('/centerSys/indicator/applyOnlineReportMap', {
    method: 'POST',
    data: params,
  });
};