import { StatsAnalysis, Common } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 统计分析
 */

// 腧穴名列表
export const getPointList = () => {
  return http.get<Common.ResOptions[]>(PORT1 + `/statistics/pointList`, { loading: false });
};
// 病症名列表
export const geSymptomList = () => {
  return http.get<Common.ResOptions[]>(PORT1 + `/statistics/symptomList`, { loading: false });
};

// 各腧穴治疗的所有病证统计
export const getPointSymptomData = (params: { pointId?: number }) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/pointSymptom`, params);
};

// 各种病证所用的所有腧穴统计
export const getDiseasePointData = (params: { diseaseId?: number }) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/diseasePoint`, params);
};

// 各个病证中出现的病因病机统计
export const getDiseaseEtiologyData = (params: { diseaseId?: number }) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/diseaseEtiology`, params);
};

// 疾病与治疗方法柱状图
export const getDiseaseTreatmentData = (params: { diseaseId?: number }) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/diseaseTreatment`, params);
};

// 各个病证中穴位组成统计
export const getDiseasePointCountData = (params: { diseaseId?: number }) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/diseasePointCount`, params);
};

// 书名、疾病与腧穴名柱状图
export const getBookDiseasePointData = (params: StatsAnalysis.ReqSearchParam) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/bookDiseasePoint`, params);
};

// 书名、疾病与治疗方法柱状图
export const getBookDiseaseTreatmentData = (params: StatsAnalysis.ReqSearchParam) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/bookDiseaseTreatment`, params);
};

// 书名、疾病与病因病机柱状图
export const getBookDiseaseEapData = (params: StatsAnalysis.ReqSearchParam) => {
  return http.get<StatsAnalysis.ResChartData[]>(PORT1 + `/statistics/bookDiseaseEap`, params);
};

// 导出
export const exportStatistics = (params: StatsAnalysis.ReqExportParams) => {
  return http.download(PORT1 + `/statistics/export`, params);
};
