/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-05-08 14:47:53
 * @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 NonAssessProjectTableItemDataType = {
  id: number,
  hospId: number,
  code: string,
  name: string,
  distributionType: number,
  distributionTypeName: string,
  distributionTarget: number,
  distributionTargetName: string,
  isCeiling: number,
  ceiling: number,
  secondItem: any[]
}


export const getNonCheckProjectTableData = (params?: any) => {
  return request<{
    current: number;
    list: NonAssessProjectTableItemDataType[];
    pageSize: number;
    totalCount: number;
    totalPage: number;
  }>('/performance/item/getNonAssessment', {
    method: 'GET',
    params: { ...params }
  });
};

export const gainData = (params?: any) => {
  return request('/performance/item/auto', {
    method: 'GET',
    params: { ...params }
  });
};




//新增表格数据
export type AddTableDataType = {
  "name": string, //名称
  "distributionType": number, //分配方式 1占比 2绝对数 3自动计算
  "distributionTarget": number, //分配目标 1医师 2核算单元 3医疗组
  "isCeiling": number, //是否有上限 1有 0无
  "ceiling": number //上限值
}
export const addData = (data: AddTableDataType) => {
  return request('/performance/item/addNonAssessment', {
    method: 'POST',
    data
  });
};



//编辑表格数据

export const editData = (data: AddTableDataType & { id: number }) => {
  return request('/performance/item/editNonAssessment', {
    method: 'POST',
    data
  });
};

//保存评分项
export const saveScoreData = (data:{nonAssessmentCode:string,secondItem:any[]}) => {
  return request('/performance/item/addNonAssessmentSecondItemMap', {
    method: 'POST',
    data
  });
};


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










