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

import { request } from 'umi';

//获取用户首页数据

export interface UserInfo {
  gender: string;
  title: string;
  departmentId: string;
  doctorLevel: string;
  userCate: string;
  qualificationCertificateNo: string;
  account: string;
  position: string;
  jobTitle: string;
  entryTime: string;
  remark: string;
  name: string;
  id: string;
  departmentName: string;
  practiceStatus: string;
  avatarUrl: string;
  practiceCate: string;
  practiceCertificateNo: string;
  major: string;
  practiceSubject: string;
}

export const getUserIndexData = async () => {
  return request<{
    indexUrl: string | undefined;
    userInfo: UserInfo;
    recentVisit: any;
    fastEntrance: any;
    todoList: any;
    messageRecords: any;
  }>('/centerSys/index/getMyIndex', {
    method: 'GET',
  });
};

//消息处理

export const todoListAct = async (data: number[]) => {
  return request('/centerSys/index/handleMessage', {
    method: 'POST',
    data: data,
  });
};

export const getAllParams = async () => {
  return request('/centerSys/parameter', {
    method: 'GET',
  });
};

//根据系统id和参数code获取参数

export const getSysParamsByCode = async (systemId: string, parameterCode?: string) => {
  return request('/centerSys/parameter/getParameters?pageSize=500&current=1', {
    method: 'GET',
    params: { systemId, parameterCode },
  });
};

//校验是否具有应用使用权限

export const getAppAccess = async (systemId: any) => {
  return request('/centerSys/menu/checkKeygen', {
    method: 'POST',
    params: { systemId },
  });
};

//删除快速入口

export const removeFastEntrance = async (ids: string[]) => {
  return request('/centerSys/index/removeFastEntrance', {
    method: 'POST',
    data: ids,
  });
};
//切换组织
export const switchOrgReq = async (orgId: string, orgName: string) => {
  return request('/centerSys/index/switchOrg', {
    method: 'POST',
    params: { orgId, orgName },
  });
};
