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




import { getManaIndexGroup } from '@/pages/budgetMana/monthlyDataCheck/service';
import { request } from 'umi';


//获取左侧医疗组
export const getMedicalGroup = () => {
  return request('/performance/unit/getMedicalGroup', {
    method: 'GET',
  });
};

//获取表格数据
export const getEmpTableDataFromMedicalGroup = (params:{medicalGroupCode:string}) => {
    return request('/performance/unit/getMedicalGroupMap', {
      method: 'GET',
      params:{...params}
    });
};


//新增医疗组
export const addMedicalGroup = (data:any) => {
  return request('/performance/unit/addMedicalGroup', {
    method: 'POST',
    data
  });
};


//编辑医疗组
export const editMedicalGroup = (data:any) => {
  return request('/performance/unit/editMedicalGroup', {
    method: 'POST',
    data
  });
};


//删除左侧数据
export const delLeftReportData = (id:number) => {
  return request('/performance/unit/deleteMedicalGroup', {
    method: 'POST',
    params:{id}
  });
};



//添加医疗组人员信息

type AddMedicalGroupEmpDataType = {medicalGroupCode:string,employee:MedicalEmpInfoType[]}
export const addMedicalGroupEmp = (data:AddMedicalGroupEmpDataType) => {
  return request('/performance/unit/addMedicalGroupMap', {
    method: 'POST',
    data
  });
};



//编辑表格数据

export const updateMedicalGroupEmpInfo = (data:any) => {
    return request('/performance/unit/editMedicalGroupMap', {
      method: 'POST',
      data
    });
};




//删除表格操作
export const delTableData = (ids:number[]) => {
    return request('/performance/unit/deleteMedicalGroupMap', {
      method: 'POST',
      data:[...ids]
    });
};


//获取医疗组人员

export type MedicalEmpInfoType = {
  account:string,
  userId:number,
  name:string
}
export const getMedicalAllEmp = (params:{medicalGroupCode:string}) => {
  return request<MedicalEmpInfoType[]>('/performance/unit/getMedicalGroupEmployee', {
    method: 'GET',
    params
  });
};


//获取工作量
export const getWorkData = (params:{computeDate:string,unitCode:string,empNo:string,code:string}) => {
  return request('/performance/secondSetting/getEmpWorkload', {
    method: 'GET',
    params
  });
};



