/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-11-01 11:13:38
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2024-06-28 14:29:20
 * @FilePath: /CostAccountingSys/src/pages/costAccounting/calcPageTemplate/config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { KcimCenterSysId } from '@/constant';
import { getAccountingSubjectList } from '@/pages/baseSetting/accountingAccountSet/accountingSubMana/service';
import { getResponsibilityCenterList } from '@/pages/baseSetting/responsibilityCenterSet/responsibilityCenter/service';
import { getTargetDic } from '@/services/auth';
import { getDicDataBySysId } from '@/services/getDic';
import { getCostProjecttList } from './service';

export const unitPersonnelCostCalcFilterConf = [
  {
    type: 'input',
    label: '检索：',
    placeholder: '人事分类',
    key: 'filter',
  },
];

// 医院科室直接成本表（医疗成本）- 筛选配置
export const deptDirectMedicalCostFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
];

// 医院科室直接成本表（全成本）- 筛选配置（前端检索）
export const deptFullDirectCostFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
];

// 临床服务类科室全成本（医疗成本）- 筛选（前端检索）
export const clinicalDeptMedicalCostFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
];

// 临床服务类科室全成本（全成本）- 筛选（前端检索）
export const clinicalDeptFullCostFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
];

export const patientCostCalcFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
  {
    type: 'input',
    label: '患者姓名：',
    placeholder: '请输入',
    key: 'patientName',
  },
];

export const chargeItemCostCalcFilterConf = [
  {
    type: 'select',
    label: '项目类别：',
    placeholder: '请输入',
    key: 'itemType',
    request: async () => {
      const resp = await getTargetDic('CHARGE_ITEM_TYPE');
      if (resp) {
        const { dataVoList } = resp;
        return dataVoList.map((a: any) => ({ label: a.name, value: a.code }));
      }
    },
  },
  {
    type: 'input',
    label: '检索：',
    placeholder: '请输入收费项目名称',
    key: 'itemName',
  },
];

export const diseaseCostCalculationFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
  {
    type: 'input',
    label: '病种名称：',
    placeholder: '请输入',
    key: 'diseaseName',
  },
];

export const DRG_DIPCostCalcFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentName',
  },
  {
    type: 'input',
    label: '分组名称：',
    placeholder: '请输入',
    key: 'groupName',
  },
];

export const clinicalPathwayFilterConf = [
  {
    type: 'input',
    label: '路径名称：',
    placeholder: '请输入',
    key: 'clinicalName',
  },
];

export const medicalOrderItemFilterConf = [
  {
    type: 'input',
    label: '医嘱项目名称：',
    placeholder: '请输入',
    key: 'orderName',
  },
];

export const beforeCollectionSearchFilterConf = [
  {
    type: 'cascader',
    label: '执行责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'select',
    label: '成本项目：',
    placeholder: '请选择',
    key: 'productCode',
    request: async () => {
      const resp = await getCostProjecttList({ pageSize: 500 });
      if (resp) {
        return resp.list.map((a: any) => ({
          label: a.productName,
          value: a.productCode,
        }));
      }
    },
  },
];

export const afterCollectionSearchFilterConf = [
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'select',
    label: '成本项目：',
    placeholder: '请选择',
    key: 'productCode',
    request: async () => {
      const resp = await getCostProjecttList({ pageSize: 500 });
      if (resp) {
        return resp.list.map((a: any) => ({
          label: a.productName,
          value: a.productCode,
        }));
      }
    },
  },
];

export const beforeCostShareSearchFilterConf = [
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'select',
    label: '会计科目(支出)：',
    placeholder: '请选择',
    key: 'accountCode',
    request: async () => {
      const resp = await getAccountingSubjectList({
        pageSize: 500,
        current: 1,
        accountType: 2,
      });
      if (resp) {
        return resp.list.map((a: any) => ({
          label: a.accountingName,
          value: a.accountingCode,
        }));
      }
    },
  },
];

export const afterCostShareSearchFilterConf = [
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
];

export const departmentCostCalculateFilterConf = [
  {
    type: 'cascader',
    label: '执行责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
];

export const medicalMaterialCostCalcFilterConf = [
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibilityCode',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'input',
    label: '检索：',
    placeholder: '项目代码/名称',
    key: 'filter',
  },
];

export const projectShareParamsCalcFilterConf = [
  {
    type: 'select',
    label: '项目分类：',
    placeholder: '请选择',
    key: 'itemType',
    request: async () => {
      const resp = await getDicDataBySysId(
        KcimCenterSysId,
        'MED_SERVICE_ITEM_TYPE',
      );
      if (resp) {
        return resp.dataVoList.map((a: any) => ({
          label: a.name,
          value: a.code,
        }));
      }
    },
  },
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibility',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'input',
    label: '检索：',
    placeholder: '项目代码/名称',
    key: 'itemFilter',
  },
];
export const projectCostCalcFilterConf = [
  {
    type: 'select',
    label: '项目分类：',
    placeholder: '请选择',
    key: 'itemType',
    request: async () => {
      const resp = await getDicDataBySysId(
        KcimCenterSysId,
        'MED_SERVICE_ITEM_TYPE',
      );
      if (resp) {
        return resp.dataVoList.map((a: any) => ({
          label: a.name,
          value: a.code,
        }));
      }
    },
  },
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibility',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'input',
    label: '检索：',
    placeholder: '项目代码/名称',
    key: 'itemFilter',
  },
];
// 医院医疗服务项目成本明细表 - 项目编码/名称检索
export const medicalServiceCostDetailFilterConf = [
  {
    type: 'input',
    label: '检索：',
    placeholder: '项目代码/名称',
    key: 'itemFilter',
  },
];

export const PatientItemCalcFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentFilter',
  },
  {
    type: 'input',
    label: '患者名称：',
    placeholder: '请输入',
    key: 'patientFilter',
  },
];

export const standardItemCostCalcFilterConf = [
  {
    type: 'select',
    label: '项目分类：',
    placeholder: '请选择',
    key: 'itemType',
    request: async () => {
      const resp = await getDicDataBySysId(
        KcimCenterSysId,
        'MED_SERVICE_ITEM_TYPE',
      );
      if (resp) {
        return resp.dataVoList.map((a: any) => ({
          label: a.name,
          value: a.code,
        }));
      }
    },
  },
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibility',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'input',
    label: '收费项目：',
    placeholder: '收费项目代码/名称',
    key: 'itemFilter',
  },
];

export const patientStandItemCostCalcFilterConf = [
  {
    type: 'input',
    label: '科室名称：',
    placeholder: '请输入',
    key: 'departmentFilter',
  },
  {
    type: 'input',
    label: '患者名称：',
    placeholder: '请输入',
    key: 'patientFilter',
  },
];

export const standItemShareCostCalcFilterConf = [
  {
    type: 'select',
    label: '项目分类：',
    placeholder: '请选择',
    key: 'itemType',
    request: async () => {
      const resp = await getDicDataBySysId(
        KcimCenterSysId,
        'MED_SERVICE_ITEM_TYPE',
      );
      if (resp) {
        return resp.dataVoList.map((a: any) => ({
          label: a.name,
          value: a.code,
        }));
      }
    },
  },
  {
    type: 'cascader',
    label: '责任中心：',
    placeholder: '请选择',
    key: 'responsibility',
    request: async () => {
      const resp = await await getResponsibilityCenterList({ pageSize: 500 });
      if (resp) {
        return resp.list;
      }
    },
  },
  {
    type: 'input',
    label: '收费项目：',
    placeholder: '收费项目代码/名称',
    key: 'itemFilter',
  },
];

// 医院医疗服务项目成本汇总表 - 项目名称检索（本地检索）
export const hospitalServiceProjectCostFilterConf = [
  {
    type: 'input',
    label: '项目名称：',
    placeholder: '请输入',
    key: 'itemName',
  },
];
