import request from '@/utils/request';


// 查询调配管理列表
export function listAllocateCore(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/allocateList',
    method: 'get',
    params: query,
  });
}

// 查询调配师列表
export function listDispatcher(query) {
  return request({
    url: '/yfc-admin/pharmacistOnlineStatus/getOnlineUser',
    method: 'get',
    params: query,
  }).then(res => {
    if ( res && Array.isArray(res.data) ) {
      res.data = res.data.map(item => {
        return {
          id: item.pharmacistUserId,
          name: item.nickName,
          jobNumber: item.jobNumber,
          onlineStatus: item.onlineStatus,
          workStatus: item.workStatus,
        };
      });
    }
    return res;
  });
}

// 置顶调配处方
export function pinOrder(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/updateTop',
    method: 'get',
    params: query,
  });
}

export function assignOrder(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/assignPharmacist',
    method: 'get',
    params: query,
  });
}

export function assignAndPinOrder(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/assignAndTop',
    method: 'get',
    params: query,
  });
}

// 调配统计列表
export function reportStatistics(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/reportStatistics',
    method: 'get',
    params: query,
  });
}

// 调配师明细统计列表
export function selectOralPreList(query) {
  return request({
    url: '/yfc-admin/prescription/prescriptionCore/selectOralPreList',
    method: 'get',
    params: query,
  });
}
