Quellcode durchsuchen

长沙市医保决算数据导入以及统计

hsh vor 3 Jahren
Ursprung
Commit
475bb17933

+ 28 - 0
src/api/ybkf/yb-cssybtj.js

@@ -0,0 +1,28 @@
+import request from '../../utils/request'
+
+// 查询长沙市医保结算信息-科室
+export function selectCssYbJsTj(data) {
+    return request({
+        url: '/cssYbTj/selectCssYbJsTj',
+        method: 'post',
+        data,
+    })
+}
+
+// 查询长沙市医保结算信息-医生
+export function selectYsJsTj(data) {
+    return request({
+        url: '/cssYbTj/selectYsJsTj',
+        method: 'post',
+        data,
+    })
+}
+
+// 查询长沙市医保结算信息-病人
+export function selectBrJsTj(data) {
+    return request({
+        url: '/cssYbTj/selectBrJsTj',
+        method: 'post',
+        data,
+    })
+}

+ 10 - 0
src/api/ybkf/yb-import.js

@@ -0,0 +1,10 @@
+import request from '../../utils/request'
+
+// 长沙市医保数据导入
+export function ybCssImp(data) {
+    return request({
+        url: '/cssYbTj/ybCssImp',
+        method: 'post',
+        data,
+    })
+}

+ 106 - 0
src/components/medical-insurance/ybkf/YbImport.vue

@@ -0,0 +1,106 @@
+<template>
+  <div style="margin-top: 10px; height: 400px">
+    <el-date-picker v-model="nf" type="year" placeholder="请选择年份" />
+    <el-select v-model="insurId" style="width: 200px; padding-left: 5px">
+      <el-option label="长沙市城职普通住院" value="1"></el-option>
+      <el-option label="长沙市城居普通住院" value="2"></el-option>
+    </el-select>
+    <div style="margin-top: 10px">
+      <el-upload
+        class="upload-demo"
+        ref="upload"
+        accept=".xlsx,.xls"
+        :action="apiUrl + '/cssYbTj/ybCssImp'"
+        :headers="header"
+        :file-list="fileList"
+        :limit="1"
+        :data="queryData"
+        :on-exceed="fileSizeOutLimit"
+        :on-success="uploadSuccess"
+        :on-error="uploadError"
+        :auto-upload="false"
+      >
+        <template #trigger>
+          <el-button type="primary" icon="Picture">选取文件</el-button>
+        </template>
+        <el-button style="margin-left: 10px" type="success" icon="Upload" @click="submitUpload">上传</el-button>
+        <template #tip>
+          <div class="el-upload__tip">只能上传 xls/xlsx 文件,建议上传一个月数据</div>
+        </template>
+      </el-upload>
+    </div>
+  </div>
+</template>
+
+<script>
+import { reactive, ref } from '@vue/reactivity'
+import { onMounted } from 'vue'
+import store from '@/store'
+import { ElMessage } from 'element-plus'
+import { formatYear } from '@/utils/date'
+
+export default {
+  setup() {
+    const nf = ref(null)
+    const insurId = ref('1')
+
+    const queryData = reactive({
+      nf: '',
+      insurName: '',
+    })
+
+    // 初始化数据
+    onMounted(() => {
+      nf.value = new Date()
+      queryData.nf = formatYear(nf.value)
+      queryData.insurName = insurId.value === '1' ? '长沙市城职普通住院' : '长沙市城居普通住院'
+    })
+
+    // ------------------ 上传 ---------------------
+    const fileList = ref([])
+    const apiUrl = import.meta.env.VITE_BASE_URL
+
+    const upload = ref(null)
+    const header = {
+      token: store.state.user.token,
+    }
+    const submitUpload = () => {
+      queryData.insurName = insurId.value === '1' ? '长沙市城职普通住院' : '长沙市城居普通住院'
+      queryData.nf = formatYear(nf.value)
+      nextTick(() => {
+        upload.value.submit()
+      })
+    }
+    const fileSizeOutLimit = () => {
+      ElMessage.error('已经选取excel,如须更换请先移除已选取的excel!')
+    }
+    const uploadSuccess = () => {
+      ElMessage.success('上传成功!')
+    }
+    const uploadError = () => {
+      ElMessage.error('上传失败!')
+    }
+
+    return {
+      queryData,
+      nf,
+      insurId,
+      header,
+      fileList,
+      apiUrl,
+      submitUpload,
+      fileSizeOutLimit,
+      uploadSuccess,
+      uploadError,
+      upload,
+    }
+  },
+}
+</script>
+
+<style scoped>
+.inline {
+  display: inline-block;
+  vertical-align: top;
+}
+</style>

+ 22 - 1
src/data/shortcuts.js

@@ -1,5 +1,5 @@
 import moment from 'moment'
-import {getFormatDatetime} from "@/utils/date";
+import { getFormatDatetime } from "@/utils/date";
 
 export const shortcuts = [
     {
@@ -146,3 +146,24 @@ export const setlShtcuts = [
         })(),
     },
 ]
+
+
+export const seltYearAndNowLast = [
+    {
+        text: '第一个月',
+        value: (() => {
+            const now = new Date()
+            const start = now.getFullYear() + "-01-01";
+            const end = now.getFullYear() + "-01-31";
+            return [start, end]
+        })(),
+    },
+    {
+        text: '上一个月',
+        value: (() => {
+            const start = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD');
+            const end = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY-MM-DD');
+            return [start, end]
+        })(),
+    },
+]

+ 10 - 0
src/router/modules/dashboard.js

@@ -130,6 +130,16 @@ const route = [
                 component: createNameComponent(() => import('@/views/medical-insurance/allpatient/InsurIncomeAnalysis.vue')),
                 meta: {title: '全院医保收入分析', icon: 'iconfont icon-zhuyuanqingdan'},
             },
+            {
+                path: 'statistical/cssybJsTj',
+                component: createNameComponent(() => import('@/views/medical-insurance/statistical/CssybJsTj.vue')),
+                meta: {title: '市医保决算统计', icon: 'iconfont icon-zhuyuanqingdan' },
+            },
+            {
+                path: 'statistical/cssybCsTj',
+                component: createNameComponent(() => import('@/views/medical-insurance/statistical/CssybCsTj.vue')),
+                meta: {title: '市医保测算统计', icon: 'iconfont icon-zhuyuanqingdan' },
+            },
         ],
     },
     {

+ 18 - 16
src/views/examination/TjReportInfo.vue

@@ -33,10 +33,10 @@
                 </el-row>
                 <el-row :gutter="6" style="margin-bottom: 8px">
                   <el-col :span="6"></el-col>
-                  <el-col :span="4">姓&emsp;&emsp;名:{{ tjReportDetail.reportHeader.姓名 }}</el-col>
-                  <el-col :span="4">性&emsp;&emsp;别:{{ filterSex(tjReportDetail.reportHeader.性别) }}</el-col>
-                  <el-col :span="4">年&emsp;&emsp;龄:{{ tjReportDetail.reportHeader.年龄 }}</el-col>
-                  <el-col :span="6"></el-col>
+                  <el-col :span="6">姓&emsp;&emsp;名:{{ tjReportDetail.reportHeader.姓名 }}</el-col>
+                  <el-col :span="6">性&emsp;&emsp;别:{{ filterSex(tjReportDetail.reportHeader.性别) }}</el-col>
+                  <el-col :span="6">年&emsp;&emsp;龄:{{ tjReportDetail.reportHeader.年龄 }}</el-col>
+                  <!-- <el-col :span="6"></el-col> -->
                 </el-row>
                 <el-row :gutter="6" style="margin-bottom: 8px">
                   <el-col :span="6"></el-col>
@@ -76,26 +76,23 @@
                   您的健康,我们真诚的建议您定期进行健康体检。
                 </span>
               </el-row>
-              <el-row :gutter="6" style="padding-bottom: 22px; margin: 0 20px 0 20px">
+              <el-row :gutter="6" style="padding-bottom: 6px; margin: 0 20px 0 20px">
                 <span style="font-weight: bold"> 祝您身体健康,工作顺利! </span>
               </el-row>
               <div style="margin: 5px 0; border-top: 1px solid gray"></div>
-              <el-row :gutter="6" style="padding-bottom: 22px; margin: 0 20px 0 20px">
+              <el-row :gutter="6" style="padding-bottom: 12px; margin: 0 20px 0 20px">
                 <div>
-                  <span style="font-size: 18px"><b>一丶体检结论及健康建议</b></span>
+                  <span style="font-size: 16px"><b>一丶体检结论及健康建议</b></span>
                 </div>
               </el-row>
-              <el-row :gutter="6" style="padding-bottom: 240px; margin: 0 20px 0 40px">
+              <el-row :gutter="6" style="padding-bottom: 2px; margin: 0 20px 0 40px">
                 <el-col :span="24">
-                  <span style="font-size: 16px">
-                    <b>
-                      <p v-html="tjReportDetail.reportSummary.汇总建议"></p>
-                    </b>
+                  <span style="font-size: 12px; font-weight: bold">
+                    <p v-html="tjReportDetail.reportSummary.汇总建议"></p>
                   </span>
                 </el-col>
               </el-row>
-              <el-row :gutter="6" style="padding-bottom: 8px; margin: 0 20px 0 20px">
-                <el-col :span="6"></el-col>
+              <el-row :gutter="6" style="margin: 0 20px 0 20px">
                 <el-col :span="6"></el-col>
                 <el-col :span="6"></el-col>
                 <el-col :span="6"
@@ -103,8 +100,13 @@
                     ><b>汇总:{{ tjReportDetail.reportSummary.汇总医生 }}</b></span
                   ></el-col
                 >
+                <el-col :span="6"
+                  ><span style="font-size: 18px"
+                    ><b>主检:{{ tjReportDetail.reportSummary.审核医生 }}</b></span
+                  ></el-col
+                >
               </el-row>
-              <el-row :gutter="6" style="padding-bottom: 8px; margin: 0 20px 0 20px">
+              <!-- <el-row :gutter="6" style="padding-bottom: 8px; margin: 0 20px 0 20px">
                 <el-col :span="6"></el-col>
                 <el-col :span="6"></el-col>
                 <el-col :span="6"></el-col>
@@ -113,7 +115,7 @@
                     ><b>主检:{{ tjReportDetail.reportSummary.审核医生 }}</b></span
                   ></el-col
                 >
-              </el-row>
+              </el-row> -->
             </div>
             <div v-else>
               <el-row :gutter="6" style="text-align: center; padding-top: 10px">

+ 2 - 0
src/views/medical-insurance/allpatient/InsurIncomeAnalysis.vue

@@ -64,6 +64,7 @@
               <el-table-column fixed label="姓名" prop="psnName" width="60"></el-table-column>
               <el-table-column fixed label="住院号" prop="patNo" width="70"></el-table-column>
               <el-table-column label="次数" prop="times" width="40"></el-table-column>
+              <el-table-column label="科室" prop="psnCertType" width="100"></el-table-column>
               <el-table-column label="性别" prop="gendName" width="50"></el-table-column>
               <el-table-column label="出生日期" prop="brdy"></el-table-column>
               <el-table-column label="身份证" prop="certno"></el-table-column>
@@ -499,6 +500,7 @@ export default {
         const title = {
           patNo: '住院号',
           times: '住院次数',
+          psnCertType: '科室',
           psnName: '姓名',
           gendName: '性别',
           brdy: '出生日期',

+ 207 - 0
src/views/medical-insurance/statistical/CssybCsTj.vue

@@ -0,0 +1,207 @@
+<template>
+  <el-container>
+    <el-header height="35px" style="margin-top: 10px">
+      <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :shortcuts="shortcuts"> </el-date-picker>
+      <el-select v-model="insurId" style="width: 200px" clearable>
+        <el-option label="长沙市城职普通住院" value="1"></el-option>
+        <el-option label="长沙市城居普通住院" value="2"></el-option>
+      </el-select>
+      <el-button type="primary" icon="Search" @click="query" style="margin-left: 5px">查询</el-button>
+      <!-- <el-button type="primary" v-if="returnData.length > 0" icon="Download" @click="exportExcel">导出excel </el-button> -->
+    </el-header>
+    <el-main>
+      <el-table
+        :data="returnData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
+        :height="tableHeight"
+        stripe
+        highlight-current-row
+        show-summary
+        :summary-method="getSummaries"
+      >
+        <el-table-column fixed prop="deptName" label="科室" width="100"></el-table-column>
+        <el-table-column fixed prop="doctor" label="医生" width="80" align="center"></el-table-column>
+        <el-table-column prop="zyh" label="住院号" width="80" align="center"></el-table-column>
+        <el-table-column prop="xm" label="姓名" width="80" align="center"></el-table-column>
+        <el-table-column prop="yblx" label="险种" width="100" align="center"></el-table-column>
+        <el-table-column prop="zfy" label="总费用" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="yjzf" label="预计支付" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="tczf" label="统筹支付" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="bal" label="盈亏额" width="100" align="right" sortable>
+          <template #default="scope">
+            <span v-if="scope.row.bal < 0" style="color: red">{{ scope.row.bal }}</span>
+            <span v-else>{{ scope.row.bal }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="bxbl" label="报销比例(%)" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="zfz" label="总分值" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="zlfs" label="治疗方式" width="100" align="left"></el-table-column>
+        <el-table-column prop="sblx" label="申报类型" width="100" align="left"></el-table-column>
+        <el-table-column prop="zdmc" label="主要诊断" width="200" align="left" show-overflow-tooltip>
+          <template #default="scope"> {{ scope.row.zdmc }}<span>(</span>{{ scope.row.zdbm }}<span>)</span> </template>
+        </el-table-column>
+        <el-table-column prop="ssmc" label="主要手术" width="200" align="left" show-overflow-tooltip>
+          <template #default="scope">
+            <span v-if="scope.row.ssmc">{{ scope.row.ssmc }}<span>(</span>{{ scope.row.ssbm }}<span>)</span></span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="jssj" label="结算时间" width="140" align="center"></el-table-column>
+      </el-table>
+    </el-main>
+    <el-footer style="height: 40px">
+      <el-pagination
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :current-page="currentPage"
+        :page-sizes="[20, 30, 40, 50, 100]"
+        :page-size="pageSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="returnData.length"
+        style="margin-top: 5px"
+      ></el-pagination>
+    </el-footer>
+  </el-container>
+</template>
+<script>
+import { reactive, ref } from '@vue/reactivity'
+import { shortcuts, seltYearAndNowLast } from '@/data/shortcuts'
+import { onMounted } from 'vue'
+import { formatDate, getDateRangeFormatDate } from '@/utils/date'
+import { ElMessage } from 'element-plus'
+import store from '@/store'
+
+export default {
+  setup() {
+    const windowSize = store.state.app.windowSize
+    const tableHeight = windowSize.h / 1.2
+
+    const start = formatDate(seltYearAndNowLast[1].value[0])
+    const end = formatDate(seltYearAndNowLast[1].value[1])
+
+    const insurId = ref('')
+
+    const queryTerm = reactive({
+      startTime: '',
+      endTime: '',
+      insurName: '',
+      deptId: '',
+      doctorId: '',
+    })
+    onMounted(() => {
+      queryTerm.startTime = start
+      queryTerm.endTime = end + ' 23:59:59'
+      dateRange.value = [start, end]
+    })
+
+    const dateRange = ref([])
+    const returnData = ref([])
+
+    const pageSize = ref(30)
+    const currentPage = ref(1)
+
+    const handleSizeChange = (val) => {
+      pageSize.value = val
+    }
+    const handleCurrentChange = (val) => {
+      currentPage.value = val
+    }
+
+    const query = () => {
+      if (dateRange.value) {
+        let dateS = getDateRangeFormatDate(dateRange.value)
+        queryTerm.startTime = dateS.startTime
+        queryTerm.endTime = dateS.endTime
+      } else {
+        queryTerm.startTime = start
+        queryTerm.endTime = end
+        ElMessage({
+          type: 'info',
+          message: '默认查询上个月的数据',
+          duration: 2500,
+          showClose: true,
+        })
+      }
+      // selectCssYbCsTj(queryTerm)
+      //   .then((res) => {
+      //     returnData.value = res
+      //   })
+      //   .catch(() => {
+      //     returnData.value = []
+      //   })
+    }
+
+    let sum = {}
+
+    const getSummaries = (param) => {
+      const { columns, data } = param
+      const sums = []
+      let bxblIndex, zfyIndex, tczfIndex
+
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+          return
+        }
+
+        if (column.property === 'doctor' || column.property === 'zyh' || column.property === 'zlfs' || column.property === 'ssmc') {
+          sums[index] = ''
+          return
+        }
+
+        if (column.property === 'bxbl') {
+          bxblIndex = index
+        }
+        if (column.property === 'zfy') {
+          zfyIndex = index
+        }
+        if (column.property === 'tczf') {
+          tczfIndex = index
+        }
+
+        const values = data.map((item) => Number(item[column.property]))
+        if (!values.every((value) => isNaN(value))) {
+          let hj = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+
+          let reg = /rs$/
+          if (!reg.test(column.property)) {
+            sums[index] = hj.toFixed(2)
+          } else {
+            sums[index] = hj
+          }
+        } else {
+          sums[index] = ''
+        }
+      })
+      sums[bxblIndex] = ((sums[tczfIndex] / sums[zfyIndex]) * 100).toFixed(2)
+      sum = sums
+      return sums
+    }
+
+    return {
+      dateRange,
+      shortcuts,
+      insurId,
+      tableHeight,
+      queryTerm,
+      returnData,
+      pageSize,
+      currentPage,
+      getSummaries,
+      query,
+      handleSizeChange,
+      handleCurrentChange,
+    }
+  },
+}
+</script>
+<style scoped>
+:deep(.el-dialog__header) {
+  margin-right: 2px;
+}
+</style>

+ 502 - 0
src/views/medical-insurance/statistical/CssybJsTj.vue

@@ -0,0 +1,502 @@
+<template>
+  <el-container>
+    <el-header height="30px" style="margin-top: 10px">
+      <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :shortcuts="shortcuts"> </el-date-picker>
+      <el-select v-model="insurId" style="width: 200px" clearable>
+        <el-option label="长沙市城职普通住院" value="1"></el-option>
+        <el-option label="长沙市城居普通住院" value="2"></el-option>
+      </el-select>
+      <el-button type="primary" icon="Search" @click="query" style="margin-left: 5px">查询</el-button>
+      <el-button type="primary" icon="Download" @click="exportKsDetailExcel" style="margin-left: 5px">导出Excel</el-button>
+      <el-button type="primary" icon="Upload" @click="cssybImort" style="margin-left: 5px">决算数据导入</el-button>
+    </el-header>
+    <el-main>
+      <el-table :data="returnData" :height="tableHeight" stripe highlight-current-row show-summary :summary-method="getSummaries" @row-dblclick="ysJsdetails">
+        <el-table-column fixed prop="deptName" label="科室" width="120"></el-table-column>
+        <el-table-column prop="zfy" label="总费用" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="yjzf" label="预计支付" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="tczf" label="统筹支付" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="bal" label="盈亏额" width="100" align="right" sortable>
+          <template #default="scope">
+            <span v-if="scope.row.bal < 0" style="color: red">{{ scope.row.bal }}</span>
+            <span v-else>{{ scope.row.bal }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="bxbl" label="报销比例(%)" width="100" align="right" sortable></el-table-column>
+        <el-table-column prop="zrs" label="总人数" width="80" align="right" sortable></el-table-column>
+        <el-table-column prop="zfz" label="总分值" width="100" align="right" sortable></el-table-column>
+        <el-table-column label="有对照" header-align="center">
+          <el-table-column prop="ydzrs" label="人数" width="80" align="right" sortable />
+          <el-table-column prop="ydzbal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.ydzbal < 0" style="color: red">{{ scope.row.ydzbal }}</span>
+              <span v-else>{{ scope.row.ydzbal }}</span>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column label="无对照" header-align="center">
+          <el-table-column prop="wdzrs" label="人数" width="80" align="right" sortable />
+          <el-table-column prop="wdzbal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.wdzbal < 0" style="color: red">{{ scope.row.wdzbal }}</span>
+              <span v-else>{{ scope.row.wdzbal }}</span>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column label="难度系数" header-align="center">
+          <el-table-column prop="ndxsrs" label="人数" width="80" align="right" sortable />
+          <el-table-column prop="ndxsbal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.ndxsbal < 0" style="color: red">{{ scope.row.ndxsbal }}</span>
+              <span v-else>{{ scope.row.ndxsbal }}</span>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column label="治疗未完成" header-align="center">
+          <el-table-column prop="wwcrs" label="人数" width="80" align="right" sortable />
+          <el-table-column prop="wwcbal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.wwcbal < 0" style="color: red">{{ scope.row.wwcbal }}</span>
+              <span v-else>{{ scope.row.wwcbal }}</span>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column label="转科" header-align="center">
+          <el-table-column prop="zkrs" label="人数" width="80" align="right" sortable />
+          <el-table-column prop="zkbal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.zkbal < 0" style="color: red">{{ scope.row.zkbal }}</span>
+              <span v-else>{{ scope.row.zkbal }}</span>
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column prop="dlrs" label="单列" width="80" align="right" sortable></el-table-column>
+      </el-table>
+      <el-dialog v-model="showYsSetldetails" :close-on-click-modal="false" :close-on-press-escape="false" :title="filterYsDialogTitle" width="90%">
+        <div style="width: 130px; height: 36px; position: absolute; top: 16px; right: 60px">
+          <el-button icon="Download" type="primary" @click="exportYsDetailExcel">导出Excel</el-button>
+        </div>
+        <el-table :data="setlYsdetails" :height="tableHeight - 160" show-summary :summary-method="getSummaries" highlight-current-row stripe @row-dblclick="brJsdetails">
+          <el-table-column fixed prop="deptName" label="科室" width="120"></el-table-column>
+          <el-table-column fixed prop="doctor" label="医生" width="80" align="center"></el-table-column>
+          <el-table-column prop="zfy" label="总费用" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="yjzf" label="预计支付" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="tczf" label="统筹支付" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="bal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.bal < 0" style="color: red">{{ scope.row.bal }}</span>
+              <span v-else>{{ scope.row.bal }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="bxbl" label="报销比例(%)" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="zrs" label="总人数" width="80" align="right" sortable></el-table-column>
+          <el-table-column prop="zfz" label="总分值" width="100" align="right" sortable></el-table-column>
+          <el-table-column label="有对照" header-align="center">
+            <el-table-column prop="ydzrs" label="人数" width="80" align="right" sortable />
+            <el-table-column prop="ydzbal" label="盈亏额" width="100" align="right" sortable>
+              <template #default="scope">
+                <span v-if="scope.row.ydzbal < 0" style="color: red">{{ scope.row.ydzbal }}</span>
+                <span v-else>{{ scope.row.ydzbal }}</span>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column label="无对照" header-align="center">
+            <el-table-column prop="wdzrs" label="人数" width="80" align="right" sortable />
+            <el-table-column prop="wdzbal" label="盈亏额" width="100" align="right" sortable>
+              <template #default="scope">
+                <span v-if="scope.row.wdzbal < 0" style="color: red">{{ scope.row.wdzbal }}</span>
+                <span v-else>{{ scope.row.wdzbal }}</span>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column label="难度系数" header-align="center">
+            <el-table-column prop="ndxsrs" label="人数" width="80" align="right" sortable />
+            <el-table-column prop="ndxsbal" label="盈亏额" width="100" align="right" sortable>
+              <template #default="scope">
+                <span v-if="scope.row.ndxsbal < 0" style="color: red">{{ scope.row.ndxsbal }}</span>
+                <span v-else>{{ scope.row.ndxsbal }}</span>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column label="治疗未完成" header-align="center">
+            <el-table-column prop="wwcrs" label="人数" width="80" align="right" sortable />
+            <el-table-column prop="wwcbal" label="盈亏额" width="100" align="right" sortable>
+              <template #default="scope">
+                <span v-if="scope.row.wwcbal < 0" style="color: red">{{ scope.row.wwcbal }}</span>
+                <span v-else>{{ scope.row.wwcbal }}</span>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column label="转科" header-align="center">
+            <el-table-column prop="zkrs" label="人数" width="80" align="right" sortable />
+            <el-table-column prop="zkbal" label="盈亏额" width="100" align="right" sortable>
+              <template #default="scope">
+                <span v-if="scope.row.zkbal < 0" style="color: red">{{ scope.row.zkbal }}</span>
+                <span v-else>{{ scope.row.zkbal }}</span>
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <el-table-column prop="dlrs" label="单列" width="100" align="right" sortable></el-table-column>
+        </el-table>
+      </el-dialog>
+      <el-dialog v-model="showBrSetldetails" :close-on-click-modal="false" :close-on-press-escape="false" :title="filterBrDialogTitle" width="90%">
+        <div style="width: 130px; height: 36px; position: absolute; top: 16px; right: 60px">
+          <el-button icon="Download" type="primary" @click="exportBrDetailExcel">导出Excel</el-button>
+        </div>
+        <el-table
+          :data="setlBrdetails.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
+          :height="tableHeight - 160"
+          show-summary
+          :summary-method="getSummaries"
+          highlight-current-row
+          stripe
+        >
+          <el-table-column fixed prop="deptName" label="科室" width="100"></el-table-column>
+          <el-table-column fixed prop="doctor" label="医生" width="80" align="center"></el-table-column>
+          <el-table-column prop="zyh" label="住院号" width="80" align="center"></el-table-column>
+          <el-table-column prop="xm" label="姓名" width="80" align="center"></el-table-column>
+          <el-table-column prop="yblx" label="险种" width="100" align="center"></el-table-column>
+          <el-table-column prop="zfy" label="总费用" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="yjzf" label="预计支付" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="tczf" label="统筹支付" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="bal" label="盈亏额" width="100" align="right" sortable>
+            <template #default="scope">
+              <span v-if="scope.row.bal < 0" style="color: red">{{ scope.row.bal }}</span>
+              <span v-else>{{ scope.row.bal }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="bxbl" label="报销比例(%)" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="zfz" label="总分值" width="100" align="right" sortable></el-table-column>
+          <el-table-column prop="zlfs" label="治疗方式" width="100" align="left"></el-table-column>
+          <el-table-column prop="sblx" label="申报类型" width="100" align="left"></el-table-column>
+          <el-table-column prop="zdmc" label="主要诊断" width="200" align="left" show-overflow-tooltip>
+            <template #default="scope"> {{ scope.row.zdmc }}<span>(</span>{{ scope.row.zdbm }}<span>)</span> </template>
+          </el-table-column>
+          <el-table-column prop="ssmc" label="主要手术" width="200" align="left" show-overflow-tooltip>
+            <template #default="scope">
+              <span v-if="scope.row.ssmc">{{ scope.row.ssmc }}<span>(</span>{{ scope.row.ssbm }}<span>)</span></span>
+            </template>
+          </el-table-column>
+          <el-table-column prop="jssj" label="结算时间" width="140" align="center"></el-table-column>
+        </el-table>
+        <el-footer style="height: 40px">
+          <el-pagination
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-sizes="[15, 30, 50, 100]"
+            :page-size="pageSize"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="setlBrdetails.length"
+            style="margin-top: 5px"
+          ></el-pagination>
+        </el-footer>
+      </el-dialog>
+    </el-main>
+    <el-dialog v-model="showImportYb" :close-on-click-modal="false" title="市医保数据导入" width="50%" top="20px">
+      <YbImport :ybkf="ybImportData" />
+    </el-dialog>
+  </el-container>
+</template>
+<script>
+import { reactive, ref } from '@vue/reactivity'
+import { shortcuts, seltYearAndNowLast } from '@/data/shortcuts'
+import { onMounted } from 'vue'
+import { clone } from '@/utils/clone'
+import { formatDate, getDateRangeFormatDate } from '@/utils/date'
+import YbImport from '../../../components/medical-insurance/ybkf/YbImport.vue'
+import { selectCssYbJsTj, selectYsJsTj, selectBrJsTj } from '@/api/ybkf/yb-cssybtj'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { downloadExcel } from '@/utils/excel'
+import store from '@/store'
+
+export default {
+  components: {
+    YbImport,
+  },
+  setup() {
+    const windowSize = store.state.app.windowSize
+    const tableHeight = windowSize.h / 1.13
+
+    const start = formatDate(seltYearAndNowLast[0].value[0])
+    const end = formatDate(seltYearAndNowLast[1].value[1])
+
+    const insurId = ref('')
+
+    const queryTerm = reactive({
+      startTime: '',
+      endTime: '',
+      insurName: '',
+      deptId: '',
+      doctorId: '',
+    })
+    onMounted(() => {
+      queryTerm.startTime = start
+      queryTerm.endTime = end + ' 23:59:59'
+      dateRange.value = [start, end]
+    })
+
+    const handleSizeChange = (val) => {
+      pageSize.value = val
+    }
+
+    const handleCurrentChange = (val) => {
+      currentPage.value = val
+    }
+
+    const currentPage = ref(1)
+    const pageSize = ref(30)
+
+    const dateRange = ref([])
+    const returnData = ref([])
+
+    const query = () => {
+      if (dateRange.value) {
+        let dateS = getDateRangeFormatDate(dateRange.value)
+        queryTerm.startTime = dateS.startTime
+        queryTerm.endTime = dateS.endTime
+      } else {
+        queryTerm.startTime = start
+        queryTerm.endTime = end
+        ElMessage({
+          type: 'info',
+          message: '默认查询本月的数据',
+          duration: 2500,
+          showClose: true,
+        })
+      }
+
+      queryTerm.insurName = filterInsurName()
+
+      selectCssYbJsTj(queryTerm)
+        .then((res) => {
+          returnData.value = res
+        })
+        .catch(() => {
+          returnData.value = []
+        })
+      returnData.value = []
+    }
+
+    const exportKsDetailExcel = () => {
+      if (returnData.value.length === 0) {
+        ElMessage({
+          message: '没有可以导出的数据!',
+          type: 'warning',
+          duration: 2500,
+          showClose: true,
+        })
+      } else {
+        // 导出实现
+        let selectData = clone(queryTerm)
+        let url = '/cssYbTj/exportKsYbSetlExcel'
+        exportExcelData(selectData, url)
+      }
+    }
+
+    // -------------- 医生详情统计 -----------------
+    const setlYsdetails = ref([])
+    const showYsSetldetails = ref(false)
+    // 科室钻取到医生查询
+    const ysJsdetails = (row) => {
+      queryTerm.deptId = row.deptId
+      let selectInfo = clone(queryTerm)
+      selectYsJsTj(selectInfo)
+        .then((res) => {
+          showYsSetldetails.value = true
+          setlYsdetails.value = res
+        })
+        .catch(() => {
+          setlYsdetails.value = []
+        })
+    }
+
+    const filterYsDialogTitle = computed(() => {
+      return '市医保结算统计(医生)'
+    })
+
+    const exportYsDetailExcel = () => {
+      if (setlYsdetails.value.length === 0) {
+        ElMessage({
+          message: '没有可以导出的数据!',
+          type: 'warning',
+          duration: 2500,
+          showClose: true,
+        })
+      } else {
+        // 导出实现
+        let selectData = clone(queryTerm)
+        let url = '/cssYbTj/exportYsYbSetlExcel'
+        exportExcelData(selectData, url)
+      }
+    }
+
+    // -------------- 病人详情统计 -----------------
+    const setlBrdetails = ref([])
+    const showBrSetldetails = ref(false)
+    // 科室钻取到医生查询
+    const brJsdetails = (row) => {
+      queryTerm.deptId = row.deptId
+      queryTerm.doctorId = row.doctorId == null ? '' : row.doctorId
+      let selectInfo = clone(queryTerm)
+      selectBrJsTj(selectInfo)
+        .then((res) => {
+          showBrSetldetails.value = true
+          setlBrdetails.value = res
+        })
+        .catch(() => {
+          setlBrdetails.value = []
+        })
+    }
+
+    const filterBrDialogTitle = computed(() => {
+      return '市医保结算统计(病人)'
+    })
+
+    const exportBrDetailExcel = () => {
+      if (setlBrdetails.value.length === 0) {
+        ElMessage({
+          message: '没有可以导出的数据!',
+          type: 'warning',
+          duration: 2500,
+          showClose: true,
+        })
+      } else {
+        // 导出实现
+        let selectData = clone(queryTerm)
+        let url = '/cssYbTj/exportBrYbSetlExcel'
+        exportExcelData(selectData, url)
+      }
+    }
+
+    // -------------- 合计 -----------------
+
+    let sum = {}
+
+    const getSummaries = (param) => {
+      const { columns, data } = param
+      const sums = []
+      let bxblIndex, zfyIndex, tczfIndex
+
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+          return
+        }
+
+        if (column.property === 'doctor' || column.property === 'zyh' || column.property === 'zlfs' || column.property === 'ssmc') {
+          sums[index] = ''
+          return
+        }
+
+        if (column.property === 'bxbl') {
+          bxblIndex = index
+        }
+        if (column.property === 'zfy') {
+          zfyIndex = index
+        }
+        if (column.property === 'tczf') {
+          tczfIndex = index
+        }
+
+        const values = data.map((item) => Number(item[column.property]))
+        if (!values.every((value) => isNaN(value))) {
+          let hj = values.reduce((prev, curr) => {
+            const value = Number(curr)
+            if (!isNaN(value)) {
+              return prev + curr
+            } else {
+              return prev
+            }
+          }, 0)
+
+          let reg = /rs$/
+          if (!reg.test(column.property)) {
+            sums[index] = hj.toFixed(2)
+          } else {
+            sums[index] = hj
+          }
+        } else {
+          sums[index] = ''
+        }
+      })
+      sums[bxblIndex] = ((sums[tczfIndex] / sums[zfyIndex]) * 100).toFixed(2)
+      sum = sums
+      return sums
+    }
+
+    const filterInsurName = () => {
+      if (insurId.value == '1') {
+        return '长沙市城职普通住院'
+      } else if (insurId.value == '2') {
+        return '长沙市城居普通住院'
+      } else {
+        return ''
+      }
+    }
+
+    // ------------------ 页面医保数据导出 ------------------
+    const exportExcelData = (selectData, t_url) => {
+      ElMessageBox.prompt('导出文件名字', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        inputPattern: /\S/,
+        inputErrorMessage: '文件名不能为空 (∩•̀ω•́)⊃-*⋆',
+      })
+        .then(({ value }) => {
+          const data = {
+            param: selectData,
+            url: t_url,
+            fileName: value + '.xlsx',
+          }
+          setTimeout(() => {
+            downloadExcel(data)
+          }, 500)
+        })
+        .catch(() => {})
+    }
+
+    // ------------------ 医保数据导入 ------------------
+    const showImportYb = ref(false)
+    const ybImportData = ref({})
+    const cssybImort = () => {
+      showImportYb.value = true
+      ybImportData.value = { type: '1' }
+    }
+
+    return {
+      dateRange,
+      shortcuts,
+      tableHeight,
+      queryTerm,
+      insurId,
+      returnData,
+      pageSize,
+      currentPage,
+      setlYsdetails,
+      showYsSetldetails,
+      filterYsDialogTitle,
+      setlBrdetails,
+      showBrSetldetails,
+      filterBrDialogTitle,
+      showImportYb,
+      ybImportData,
+      query,
+      cssybImort,
+      ysJsdetails,
+      brJsdetails,
+      exportKsDetailExcel,
+      exportYsDetailExcel,
+      exportBrDetailExcel,
+      getSummaries,
+      handleSizeChange,
+      handleCurrentChange,
+    }
+  },
+}
+</script>
+<style scoped>
+:deep(.el-dialog__header) {
+  margin-right: 2px;
+}
+</style>