// 生成随机数据函数
export const randomNumber = (min: number, max: number) => {
  return Math.floor(Math.random() * (max - min + 1) + min);
};

// 模拟每日就诊人数数据
export const getMockDailyPatientData = () => {
  const days = ['05/20', '05/21', '05/22', '05/23', '05/24', '05/25', '05/26'];
  return {
    days,
    registered: days.map(() => randomNumber(3000, 20000)),
    actual: days.map(() => randomNumber(2000, 21000)),
  };
};

// 模拟出诊医生数据
export const getMockDoctorData = () => {
  const days = ['05/20', '05/21', '05/22', '05/23', '05/24', '05/25', '05/26'];
  return {
    days,
    planned: days.map(() => randomNumber(5000, 22000)),
    actual: days.map(() => randomNumber(4000, 23000)),
  };
};

// 模拟各科室数据
export const getMockDepartmentData = () => {
  return [
    { name: '消化内科', value: 200 },
    { name: '心内科', value: 183 },
    { name: '骨科', value: 172 },
    { name: '生殖医学中心', value: 165 },
    { name: '皮肤科', value: 132 }
  ];
};

// 模拟窗口数据
export const getMockWindowData = () => {
  return [
    { name: '窗口1', value: 50 },
    { name: '窗口2', value: 230 },
    { name: '窗口3', value: 20 },
    { name: '窗口4', value: 50 },
    { name: '窗口5', value: 140 },
    { name: '窗口6', value: 25 },
    { name: '窗口7', value: 120 },
    { name: '窗口8', value: 160 }
  ];
};

// 模拟分时就诊数据
export const getMockHourlyPatientData = () => {
  const hours = ['08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', 
                '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00'];
  
  return {
    hours,
    morningPatients: hours.map(() => randomNumber(100, 900)),
    afternoonPatients: hours.map(() => randomNumber(100, 900)),
    morningTrend: hours.map(() => randomNumber(300, 800)),
    afternoonTrend: hours.map(() => randomNumber(300, 800)),
  };
};

// 模拟等待时间数据
export const getMockWaitTimeData = () => {
  const hours = ['08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00'];
  
  return {
    hours,
    under5min: hours.map(() => randomNumber(90, 100)),
    under10min: hours.map(() => randomNumber(90, 100)),
    under15min: hours.map(() => randomNumber(90, 100)),
    over15min: hours.map(() => randomNumber(90, 100)),
  };
};

// 获取核心指标数据
export const getCoreMetrics = () => {
  return {
    todayPatients: 4500,
    patientRatio: 59,
    patientChange: 12,
    
    prescriptions: 4500,
    prescriptionRatio: 59,
    prescriptionChange: 12,
    
    medicines: 4500,
    medicineRatio: 59,
    medicineChange: 12,
    
    waitTime15MinRate: 50,
    waitTimeChange: 1.2,
    
    onDutyDoctors: 10,
    openWindows: 10
  };
};

// 发药状态一览mock数据，结构与接口一致
export function getMockDispensingData() {
  return {
    code: 200,
    msg: 'success',
    data: {
      pendingTaskCount: 11,
      topDepartments: [
        { department: '儿科', prescriptionCount: 2 },
        { department: '全科医学科', prescriptionCount: 1 },
        { department: '普外科', prescriptionCount: 1 },
        { department: '精神卫生科', prescriptionCount: 1 },
        { department: '内分泌科', prescriptionCount: 1 }
      ],
      taskStatistics: {
        totalDispensedTasks: 1524,
        directDispensedTasks: 1391,
        currentDirectRate: 0.9127,
        lastMonthDirectRate: 0.9106,
        growthRate: 0.0023
      },
      prescriptionStatistics: {
        totalPrescriptions: 1524,
        machinePrescriptions: 1968,
        machinePrescriptionRate: 1.2913,
        lastMonthMachineRate: 0.9263,
        growthRate: 0.394
      },
      drugDispensingStatistics: {
        totalBoxes: 9835,
        machineBoxes: 9835,
        machineBoxRate: 1.0,
        lastMonthMachineRate: 0.9098,
        growthRate: 0.0991
      }
    }
  };
} 