<template>
  <el-container>
    <div class="overlay" v-show="menuVisible" @click="menuVisible = false">
      <div id="menu" class="menu-box">
        <div class="menu-title">{{ rightClickData.label }}</div>
        <div class="menu-item" @click="editTemplateRule">
          <i class="el-icon-edit"></i>
          编辑模板规则
        </div>
        <div class="menu-item" @click="addTemplate(0)">
          <i class="el-icon-folder"></i>
          添加模板目录
        </div>
        <div class="menu-item" @click="addTemplate(1)">
          <i class="el-icon-plus"></i>
          添加模板文件
        </div>
        <div class="menu-item" @click="deleteTemplate">
          <i class="el-icon-delete"></i>
          删除此项目
        </div>
      </div>
    </div>
    <el-header height="36px" style="margin-top: 8px">
      <el-date-picker
          v-model="dateRange"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :shortcuts="shortcuts"
          style="width: 220px"
      ></el-date-picker>
      <el-select v-model="selectedMedtypes" style="width: 150px" multiple clearable collapse-tags
                 placeholder="不选则为全部类别">
        <el-option v-for="item in medtypes" :key="item.code" :label="item.name" :value="item.code"></el-option>
      </el-select>
      <el-divider direction="vertical"></el-divider>
      <el-button type="primary" icon="el-icon-search" @click="fetchTargetData">检索</el-button>
      <el-button type="primary" icon="el-icon-upload" @click="exportExcel">导出Excel</el-button>
      <el-button type="success" icon="el-icon-search" @click="queryHuanZheRuYuanJianGe">患者入院间隔</el-button>
      <huan-zhe-zhu-yuan-tian-shu :date-range="dateRange"></huan-zhe-zhu-yuan-tian-shu>
    </el-header>
    <el-container>
      <el-aside>
        <el-input v-model="templateSearch" placeholder="输入模板名称检索" clearable>
          <template #prepend>模板检索</template>
        </el-input>
        <div style="height: 4px"></div>
        <el-tree
            ref="tree"
            :data="templates"
            :props="defaultProps"
            @node-click="handleNodeClick"
            @node-contextmenu="handleNodeRightClick"
            :style="{ height: treeHeight + 'px', overflowY: 'scroll' }"
            :filter-node-method="filterNode"
            highlight-current
        >
          <template #default="{ node }">
            <span class="custom-tree-node">{{ node.label }}</span>
          </template>
        </el-tree>
      </el-aside>
      <el-main>
        <el-table :data="targetData.slice((currentPage - 1) * pageSize, currentPage * pageSize)" stripe
                  :height="treeHeight">
          <el-table-column prop="name" label="姓名" width="50"></el-table-column>
          <el-table-column prop="inpatientNo" label="住院号"></el-table-column>
          <el-table-column prop="admissTimes" label="次数" width="50"></el-table-column>
          <el-table-column prop="responceTypeName" label="医保身份" width="60"></el-table-column>
          <el-table-column prop="deptName" label="入院科室" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="wardName" label="入院病房"></el-table-column>
          <el-table-column prop="diag" label="出院诊断"></el-table-column>
          <el-table-column prop="detailSn" label="流水号" width="50" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column label="医嘱号" v-if="nowAttribute === 1">
            <template #default="scope">
              <el-link type="primary" href="#" @click="fetchOrder(scope.row)">{{ scope.row.orderNo }}</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="chargeCode" label="收费编码"></el-table-column>
          <el-table-column prop="chargeName" label="收费名称"></el-table-column>
          <el-table-column prop="chargeDate" label="收费时间" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="chargeDay" label="收费日期" v-if="nowAttribute === 2"></el-table-column>
          <el-table-column prop="chargeFee" label="金额" width="50"></el-table-column>
          <el-table-column prop="chargeAmount" label="数量" width="50"></el-table-column>
          <el-table-column prop="conflictDetailSn" label="冲突流水号" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column label="冲突医嘱号" v-if="nowAttribute === 1">
            <template #default="scope">
              <el-link type="danger" href="#" @click="fetchOrder(scope.row)">{{ scope.row.conflictOrderNo }}</el-link>
            </template>
          </el-table-column>
          <el-table-column prop="conflictChargeCode" label="冲突收费编码" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="conflictChargeName" label="冲突收费名称" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="conflictChargeDate" label="冲突收费日期" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="conflictChargeFee" label="冲突收费金额" v-if="nowAttribute === 1"></el-table-column>
          <el-table-column prop="conflictChargeAmount" label="冲突收费数量" v-if="nowAttribute === 1"></el-table-column>
        </el-table>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[15, 30, 45, 70, 100]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="targetData.length"
            style="margin-top: 5px"
        ></el-pagination>
      </el-main>
    </el-container>
    <el-dialog v-model="showEditRule" title="模板编辑" width="700px">
      <div>
        <el-divider></el-divider>
        <div class="edit-line-title">基本信息：</div>
        <el-input v-model="currentTemplate.id" disabled style="width: 560px; margin-bottom: 8px">
          <template #prepend>模板编码</template>
        </el-input>
        <el-input v-model="currentTemplate.label" style="width: 560px">
          <template #prepend>模板名称</template>
        </el-input>
        <div v-show="currentTemplate.type === 1">
          <div class="edit-line-title">规则属性：</div>
          <div>
            <el-radio v-model="currentTemplate.attribute" :label="1">同时收费</el-radio>
            <el-radio v-model="currentTemplate.attribute" :label="2">超量收费</el-radio>
          </div>
          <div class="edit-line-title">
            规则数据：（&nbsp;<span style="font-weight: 500">检索方式：</span>
            <el-radio v-model="searchMethod" label="alpha">首拼</el-radio>
            <el-radio v-model="searchMethod" label="code">编码</el-radio>
            <el-radio v-model="searchMethod" label="name">名称</el-radio>
            <el-divider direction="vertical"></el-divider>
            <el-checkbox v-model="includeDeactivate" style="margin-left: 16px">包含停用内容</el-checkbox>
            &nbsp;）
          </div>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-autocomplete v-model="mainCharge" :fetch-suggestions="fetchChargeItem" placeholder="请输入内容" clearable
                               @select="handleSelectMainCharge">
                <template #prepend>收费主体</template>
                <template #default="{ item }">
                  <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
                  <el-divider direction="vertical"></el-divider>
                  <span>{{ item.name }}</span>
                </template>
              </el-autocomplete>
              <el-table :data="currentTemplate.mainCharges" height="120">
                <el-table-column prop="code" label="收费编码"></el-table-column>
                <el-table-column prop="name" label="收费名称"></el-table-column>
                <el-table-column label="操作">
                  <template #default="scope">
                    <el-button type="text" icon="el-icon-delete" @click="removeMainCharge(scope.$index)">删除</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span="12" v-show="currentTemplate.attribute === 1">
              <el-autocomplete v-model="conflictCharge" :fetch-suggestions="fetchChargeItem" placeholder="请输入内容"
                               clearable @select="handleSelectConflictCharge">
                <template #prepend>冲突收费</template>
                <template #default="{ item }">
                  <span style="color: #8492a6; font-size: 12px">{{ item.code }}</span>
                  <el-divider direction="vertical"></el-divider>
                  <span>{{ item.name }}</span>
                </template>
              </el-autocomplete>
              <el-table :data="currentTemplate.conflictCharges" height="120">
                <el-table-column prop="code" label="收费编码"></el-table-column>
                <el-table-column prop="name" label="收费名称"></el-table-column>
                <el-table-column label="操作">
                  <template #default="scope">
                    <el-button type="text" icon="el-icon-delete" @click="removeConflictCharge(scope.$index)">删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
            <el-col :span="12" v-show="currentTemplate.attribute === 2">
              <el-input type="number" v-model="currentTemplate.maxChargeNum" style="width: 230px" clearable>
                <template #prepend>数量上限（每天）</template>
              </el-input>
              <!-- <el-select v-model="currentTemplate.maxChargeUnit" style="width: 60px">
                <el-option label="天" value="day"></el-option>
                <el-option label="周" value="week"></el-option>
                <el-option label="月" value="month"></el-option>
              </el-select> -->
            </el-col>
          </el-row>
        </div>
      </div>
      <div style="width: 100%; text-align: right; margin: 16px 0 8px 0">
        <el-button type="success" icon="el-icon-upload" @click="saveTemplate">保存模板</el-button>
      </div>
    </el-dialog>
    <el-dialog v-model="ruYuanJianGeDialog" title="查询入院间隔" width="1200px">
      <el-button type="primary" icon="el-icon-upload" @click="exportExcelHuanZhe">导出Excel</el-button>
      <el-table
          :data="huoQuHuanZheShuJu.slice((queryHuanZhe.currentPage - 1) * queryHuanZhe.pageSize, queryHuanZhe.currentPage * queryHuanZhe.pageSize)"
          stripe
          :height="treeHeight - 200"
      >
        <el-table-column label="姓名" prop="name"></el-table-column>
        <el-table-column label="住院号" prop="inpatientNo"></el-table-column>
        <el-table-column label="住院次数" prop="admissTimes"></el-table-column>
        <el-table-column label="住院科室" prop="deptName"></el-table-column>
        <el-table-column label="入院日期" width="80" prop="admissDate"></el-table-column>
        <el-table-column label="出院日期" width="80" prop="disDate"></el-table-column>
        <el-table-column label="相差天数" prop="differDate"></el-table-column>
        <el-table-column label="诊断编码" prop="disDiag"></el-table-column>
        <el-table-column label="主要诊断" prop="disDiagComment"></el-table-column>
        <el-table-column label="医保类型" prop="responceTypeName"></el-table-column>
      </el-table>
      <el-pagination
          @size-change="handleSizeChangeHuanZhe"
          @current-change="handleCurrentChangeHuanZhe"
          :current-page="queryHuanZhe.currentPage"
          :page-sizes="[20, 30, 40, 50, 100]"
          :page-size="queryHuanZhe.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="huoQuHuanZheShuJu.length"
          style="margin-top: 5px"
      ></el-pagination>
    </el-dialog>
    <el-dialog v-model="showOrders" title="医嘱详情" width="60%">
      <el-table :data="orders" stripe>
        <el-table-column prop="actOrderNo" label="医嘱号" width="70"></el-table-column>
        <el-table-column prop="inpatientNo" label="住院号" width="70"></el-table-column>
        <el-table-column prop="admissTimes" label="住院次数" width="70"></el-table-column>
        <el-table-column prop="physicianName" label="医生" width="70"></el-table-column>
        <el-table-column prop="frequCode" label="频率" width="60"></el-table-column>
        <el-table-column prop="orderCode" label="医嘱码" width="70"></el-table-column>
        <el-table-column prop="orderName" label="医嘱名称"></el-table-column>
        <el-table-column prop="startTime" label="开始时间"></el-table-column>
        <el-table-column prop="endTime" label="结束时间"></el-table-column>
      </el-table>
    </el-dialog>
  </el-container>
</template>

<script>
import {ref} from 'vue'
import store from '@/store'
import {onMounted, watchEffect} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {
  analyzeTargetData,
  deleteChosenTemplate,
  fetchMyTemplates,
  insertNewTemplate,
  queryHuanZheLiangCiRuYuanRiQi,
  saveTemplateChanges,
  searchChargeItem,
  selectOrderPair,
} from '@/api/reports/illegal-charges-analysis'
import {shortcuts} from '@/data/shortcuts'
import {getGreatestRole} from '@/utils/permission'
import {formatDate, getDateRangeFormatDate} from '@/utils/date'
import {createWorkSheet, writeExcelFile} from '@/utils/excel'
import HuanZheZhuYuanTianShu from '../../components/reports/huanZheZhuYuanTianShu.vue'

export default {
  components: {HuanZheZhuYuanTianShu},
  setup() {
    const medtypes = initMedtypes()
    const selectedMedtypes = ref([])
    const isAdmin = getGreatestRole() === 1
    const windowSize = store.state.app.windowSize
    const treeHeight = windowSize.h - 80
    const tree = ref(null)
    const templateSearch = ref('')
    const showOrders = ref(false)
    const orders = ref([])
    const includeDeactivate = ref(false)
    watchEffect(() => {
      if (templateSearch.value !== null) {
        if (tree.value) {
          tree.value.filter(templateSearch.value)
        }
      }
    })
    const templates = ref([])
    const defaultProps = {
      children: 'children',
      label: 'label',
    }
    const filterNode = (value, data) => {
      if (!value) {
        return true
      }
      return data.label.indexOf(value) !== -1
    }
    const menuVisible = ref(false)
    const selectedTemplate = ref({})
    const handleNodeClick = (data) => {
      selectedTemplate.value = data
    }
    const rightClickData = ref({})
    const rightClickNode = ref(null)
    const handleNodeRightClick = (event, data, node) => {
      if (data.personal === 1 || isAdmin) {
        rightClickData.value = data
        rightClickNode.value = node
        menuVisible.value = true
        const menu = document.getElementById('menu')
        menu.style.left = event.clientX + 20 + 'px'
        menu.style.top = event.clientY + 10 + 'px'
      }
    }
    const addTemplate = (type) => {
      if (rightClickData.value.type === 1) {
        ElMessage({
          message: '无法在模板文件下进行创建操作！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      const message = type === 0 ? '请输入目录名称' : '请输入模板名称'
      const title = type === 0 ? '添加模板目录' : '添加模板文件'
      ElMessageBox.prompt(message, title, {
        confirmButtonText: '添加',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(({value}) => {
        const parentId = rightClickData.value.id
        const childrenLength = rightClickData.value.children.length
        const template = {
          id: parentId + '-' + (childrenLength + 1),
          parent: parentId,
          label: value,
          personal: rightClickData.value.personal,
          type: type,
          children: [],
          mainCharges: [],
          conflictCharges: [],
        }
        insertNewTemplate(template).then((res) => {
          ElMessage({
            message: res,
            type: 'success',
            duration: 2000,
            showClose: true,
          })
          rightClickData.value.children.push(template)
        })
      })
    }
    const deleteTemplate = () => {
      if (!isAdmin && rightClickData.value.personal === 0) {
        ElMessage({
          message: '公共节点无法删除！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      if (rightClickData.value.id === 'admin_2') {
        ElMessage({
          message: '主节点无法删除！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      deleteChosenTemplate(rightClickData.value).then((res) => {
        ElMessage({
          message: res,
          type: 'success',
          duration: 2000,
          showClose: true,
        })
        const parent = rightClickNode.value.parent
        const children = parent.data.children || parent.data
        const index = children.findIndex((d) => d.id === rightClickData.value.id)
        children.splice(index, 1)
      })
    }

    const showEditRule = ref(false)
    const currentTemplate = ref({
      children: [],
      mainCharges: [],
      conflictCharges: [],
      maxChargeNum: null,
      maxChargeUnit: 'day',
    })
    const editTemplateRule = () => {
      if (!rightClickData.value.parent) {
        ElMessage({
          message: '主节点无法编辑！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      currentTemplate.value = {...rightClickData.value}
      showEditRule.value = true
    }

    const dateRange = ref(null)

    const mainCharge = ref(null)
    const conflictCharge = ref(null)

    const searchMethod = ref('alpha')
    const fetchChargeItem = (queryString, cb) => {
      if (queryString && queryString.length > 1) {
        const param = {
          method: searchMethod.value,
          content: queryString,
          includeDeactivate: includeDeactivate.value,
        }
        searchChargeItem(param).then((res) => {
          cb(res)
        })
      }
    }
    const handleSelectMainCharge = (item) => {
      currentTemplate.value.mainCharges.push(item)
    }
    const handleSelectConflictCharge = (item) => {
      currentTemplate.value.conflictCharges.push(item)
    }
    const removeMainCharge = (index) => {
      currentTemplate.value.mainCharges.splice(index, 1)
    }
    const removeConflictCharge = (index) => {
      currentTemplate.value.conflictCharges.splice(index, 1)
    }
    const saveTemplate = () => {
      if (currentTemplate.value.type === 1 && !currentTemplate.value.attribute) {
        ElMessage({
          message: '请选择规则属性！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }

      if (currentTemplate.value.attribute === 2 && !currentTemplate.value.maxChargeNum) {
        ElMessage({
          message: '请输入超量收费的可收费数量上限！',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }

      saveTemplateChanges(currentTemplate.value).then(() => {
        rightClickNode.value.data = {...currentTemplate.value}
        ElMessage({
          message: '保存成功。',
          type: 'success',
          duration: 2000,
          showClose: true,
        })
        showEditRule.value = false
      })
    }
    const targetData = ref([])
    const nowAttribute = ref(1)
    const fetchTargetData = () => {
      if (!dateRange.value) {
        ElMessage({
          message: '请选择日期范围',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      if (selectedTemplate.value.type !== 1) {
        ElMessage({
          message: '请选择模板',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
      } else {
        selectedTemplate.value.start = formatDate(dateRange.value[0])
        selectedTemplate.value.end = formatDate(dateRange.value[1])
        selectedTemplate.value.medtypes = selectedMedtypes.value
        analyzeTargetData(selectedTemplate.value).then((res) => {
          targetData.value = res
          nowAttribute.value = selectedTemplate.value.attribute
        })
      }
    }

    const fetchOrder = (row) => {
      selectOrderPair(row.orderNo, row.conflictOrderNo).then((res) => {
        orders.value = res
        showOrders.value = true
      })
    }

    const pageSize = ref(30)
    const currentPage = ref(1)
    const handleSizeChange = (val) => {
      pageSize.value = val
    }
    const handleCurrentChange = (val) => {
      currentPage.value = val
    }

    const exportExcel = () => {
      if (!targetData.value || targetData.value.length === 0) {
        ElMessage({
          message: '没有可以导出的数据',
          type: 'warning',
          duration: 2000,
          showClose: true,
        })
        return
      }
      store.commit('app/setLoading', true)
      setTimeout(() => {
        const title = {
          name: '姓名',
          inpatientNo: '住院号',
          admissTimes: '住院次数',
          responceTypeName: '医保身份',
          deptName: '入院科室',
          wardName: '入院病房',
          diag: '出院诊断',
          detailSn: '收费流水号',
          chargeCode: '收费编码',
          chargeName: '收费名称',
          chargeDate: '收费日期',
          chargeFee: '收费金额',
          chargeAmount: '收费数量',
          conflictDetailSn: '冲突收费流水号',
          conflictChargeCode: '冲突收费编码',
          conflictChargeName: '冲突收费名称',
          conflictChargeDate: '冲突收费日期',
          conflictChargeFee: '冲突收费金额',
          conflictChargeAmount: '冲突收费数量',
        }
        const fields = [
          'name',
          'inpatientNo',
          'admissTimes',
          'responceTypeName',
          'deptName',
          'wardName',
          'diag',
          'detailSn',
          'chargeCode',
          'chargeName',
          'chargeDate',
          'chargeFee',
          'chargeAmount',
          'conflictDetailSn',
          'conflictChargeCode',
          'conflictChargeName',
          'conflictChargeDate',
          'conflictChargeFee',
          'conflictChargeAmount',
        ]
        const workSheet = createWorkSheet(targetData.value, fields, title)
        const fileName = '违规收费分析.xlsx'
        writeExcelFile(workSheet, fileName)
      }, 50)
    }
    onMounted(() => {
      fetchMyTemplates().then((res) => {
        templates.value = res
      })
    })

    /**
     * 查询患者入院间隔
     */
    const ruYuanJianGeDialog = ref(false)

    const queryHuanZhe = ref({
      start: '',
      end: '',
      total: 0,
      currentPage: 1,
      pageSize: 50,
    })

    const huoQuHuanZheShuJu = ref([])

    const queryHuanZheRuYuanJianGe = () => {
      let date = getDateRangeFormatDate(dateRange.value)
      queryHuanZhe.value.start = date.startTime
      queryHuanZhe.value.end = date.endTime
      queryHuanZhe.value.medtypes = selectedMedtypes.value
      queryHuanZheLiangCiRuYuanRiQi(queryHuanZhe.value).then((res) => {
        huoQuHuanZheShuJu.value = res
        ruYuanJianGeDialog.value = true
      })
    }

    const handleSizeChangeHuanZhe = (val) => {
      queryHuanZhe.value.pageSize = val
    }

    const handleCurrentChangeHuanZhe = (val) => {
      queryHuanZhe.value.currentPage = val
    }

    const exportExcelHuanZhe = () => {
      if (huoQuHuanZheShuJu.value.length === 0) {
        return ElMessage.error({
          message: '没有可以导出的数据',
          showClose: true,
        })
      }
      store.commit('app/setLoading', true)
      setTimeout(() => {
        const fields = ['name', 'inpatientNo', 'admissTimes', 'deptName', 'admissDate', 'disDate', 'differDate', 'disDiag', 'disDiagComment', 'responceType', 'responceTypeName']
        const title = {
          name: '姓名',
          inpatientNo: '住院号',
          admissTimes: '住院次数',
          deptName: '住院科室',
          admissDate: '住院日期',
          disDate: '出院日期',
          differDate: '相差天数',
          disDiag: '诊断编码',
          disDiagComment: '主要诊断',
          responceType: '医保编码',
          responceTypeName: '医保名称',
        }
        const workSheet = createWorkSheet(huoQuHuanZheShuJu.value, fields, title)
        const fileName = '患者入院间隔.xlsx'
        writeExcelFile(workSheet, fileName)
      }, 50)
    }

    return {
      medtypes,
      selectedMedtypes,
      includeDeactivate,
      treeHeight,
      tree,
      templateSearch,
      templates,
      defaultProps,
      handleNodeClick,
      filterNode,
      rightClickData,
      handleNodeRightClick,
      menuVisible,
      addTemplate,
      deleteTemplate,
      editTemplateRule,
      dateRange,
      shortcuts,
      currentTemplate,
      showEditRule,
      mainCharge,
      conflictCharge,
      fetchChargeItem,
      searchMethod,
      showOrders,
      orders,
      fetchOrder,
      handleSelectMainCharge,
      handleSelectConflictCharge,
      saveTemplate,
      removeMainCharge,
      removeConflictCharge,
      selectedTemplate,
      nowAttribute,
      fetchTargetData,
      targetData,
      pageSize,
      currentPage,
      handleSizeChange,
      handleCurrentChange,
      exportExcel,
      queryHuanZheRuYuanJianGe,
      ruYuanJianGeDialog,
      queryHuanZhe,
      huoQuHuanZheShuJu,
      handleSizeChangeHuanZhe,
      handleCurrentChangeHuanZhe,
      exportExcelHuanZhe,
    }
  },
}

function initMedtypes() {
  return [
    // { code: '02', name: '省医保' },
    // { code: '03', name: '市城居医保' },
    // { code: '04', name: '新农合' },
    // { code: '09', name: '市城职医保' },
    // { code: '10', name: '省医保-异地' },
    {code: '2101', name: '普通住院'},
    {code: '2102', name: '单病种住院'},
    {code: '2106', name: '生育平产(居民)'},
    {code: '2107', name: '生育剖宫产(居民)'},
    {code: '22', name: '外伤住院'},
    {code: '52', name: '生育住院(职工)'},
    {code: '42', name: '工伤住院'},
  ]
}
</script>

<style scoped>
:deep(.el-tree-node) {
  white-space: normal;
}

:deep(.el-tree-node__content) {
  padding: 8px 4px 0 0;
  height: 100%;
  align-items: start;
}

.node-label {
  margin: 5px 0;
  width: 220px;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  background-color: transparent;
}

.menu-box {
  position: fixed;
  border: 1px solid #409eff;
  border-radius: 8px;
  background-color: white;
  width: 120px;
}

.menu-item {
  padding: 8px;
  cursor: pointer;
}

.menu-item:hover {
  color: #409eff;
}

.menu-title {
  padding: 4px;
  background-color: #409eff;
  color: white;
  text-align: center;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.edit-line-title {
  font-size: 14px;
  font-weight: bold;
  padding: 8px 0;
}

:deep(.edit-line-title .el-radio__label) {
  padding-left: 6px;
}

:deep(.edit-line-title .el-radio) {
  margin-right: 16px;
}
</style>
