|
@@ -0,0 +1,164 @@
|
|
|
+<template>
|
|
|
+
|
|
|
+ <div class="layout_container">
|
|
|
+ <header>
|
|
|
+ <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期" :shortcuts="shortcuts"> </el-date-picker>
|
|
|
+ <el-autocomplete v-model="dept" value-key="name" :fetch-suggestions="querySearchDept"
|
|
|
+ clearable class="inline-input w-50 m-2" style="width: 240px"
|
|
|
+ @select="handleSelect" placeholder="请输入关键字">
|
|
|
+ <template #prepend>科室</template>
|
|
|
+ </el-autocomplete>
|
|
|
+ <el-button type="primary" icon="Search" @click="query" style="margin-left: 5px">查询</el-button>
|
|
|
+ <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
|
|
|
+ </header>
|
|
|
+ <div class="layout_main layout_el-table">
|
|
|
+ <el-table :data="returnData" border highlight-current-row row-key="childKey" show-summary :summary-method="getSummaries" stripe>
|
|
|
+ <el-table-column type="index" label="序号" align="center" header-align="center" fixed></el-table-column>
|
|
|
+ <template v-for="col in headData">
|
|
|
+ <el-table-column v-if="col.name === 'doctorName' " :prop="col.name" :label="col.display"
|
|
|
+ :width="col.width" :align="col.align" fixed>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column v-else :prop="col.name" :label="col.display" :width="col.width" :align="col.align">
|
|
|
+ </el-table-column>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+</template>
|
|
|
+<script setup name="WorkFeeStatistics" >
|
|
|
+import { ref } from 'vue'
|
|
|
+import { shortcuts } from '@/data/shortcuts'
|
|
|
+import { formatDate, getDateRangeFormatDate } from '@/utils/date'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import {exportWorkFeeStatisticsInfo, selectWorkFeeStatistics} from '@/api/reports/work-fee-statistics'
|
|
|
+import {selectSmallDept} from "@/api/medical-insurance/si-yb-util"
|
|
|
+
|
|
|
+let nowDay = new Date()
|
|
|
+nowDay.setTime(nowDay.getTime() - 24 * 60 * 60 * 1000)
|
|
|
+let yf, inday
|
|
|
+if (nowDay.getMonth() < 9) {
|
|
|
+ yf = '0' + (nowDay.getMonth() + 1)
|
|
|
+} else {
|
|
|
+ yf = nowDay.getMonth() + 1
|
|
|
+}
|
|
|
+if (nowDay.getDate() < 10) {
|
|
|
+ inday = '0' + nowDay.getDate()
|
|
|
+} else {
|
|
|
+ inday = nowDay.getDate()
|
|
|
+}
|
|
|
+let s1 = nowDay.getFullYear() + "-" + yf + "-" + inday
|
|
|
+const start = formatDate(s1);
|
|
|
+const end = formatDate(s1);
|
|
|
+const dateRange = ref([]);
|
|
|
+const dept = ref('');
|
|
|
+
|
|
|
+const queryTerm = ref({
|
|
|
+ startTime: "",
|
|
|
+ endTime: "",
|
|
|
+ reportId: "",
|
|
|
+ menuId: "",
|
|
|
+ type: "",
|
|
|
+ dept: "",
|
|
|
+ exportName: "",
|
|
|
+ total: {}
|
|
|
+});
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ queryTerm.value.reportId = 'zy_feeStatic'
|
|
|
+ queryTerm.value.type = '1'
|
|
|
+ queryTerm.value.startTime = start + '00:00:00'
|
|
|
+ queryTerm.value.endTime = end + " 23:59:59"
|
|
|
+ dateRange.value = [start, end]
|
|
|
+ query()
|
|
|
+});
|
|
|
+
|
|
|
+const querySearchDept = async (str, cb) => {
|
|
|
+ let results = await selectSmallDept({ str })
|
|
|
+ if (results) {
|
|
|
+ // 调用 callback 返回建议列表的数据
|
|
|
+ cb(results)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleSelect = (item) => {
|
|
|
+ queryTerm.value.dept = item.code
|
|
|
+}
|
|
|
+
|
|
|
+const returnData = ref([])
|
|
|
+const headData = ref([])
|
|
|
+
|
|
|
+const query = async () => {
|
|
|
+ if (dateRange.value) {
|
|
|
+ let dateS = getDateRangeFormatDate(dateRange.value);
|
|
|
+ queryTerm.value.startTime = dateS.startTime;
|
|
|
+ queryTerm.value.endTime = dateS.endTime;
|
|
|
+ } else {
|
|
|
+ queryTerm.value.startTime = start;
|
|
|
+ queryTerm.value.endTime = end;
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "默认查询本月的数据",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ await selectWorkFeeStatistics(queryTerm.value)
|
|
|
+ .then((res) => {
|
|
|
+ returnData.value = res.resultList
|
|
|
+ headData.value = res.headList
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+let hj = {}
|
|
|
+const getSummaries = (param) => {
|
|
|
+ let columns = param.columns
|
|
|
+ let data = param.data
|
|
|
+ let sums = []
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = h('div', { style: { textDecoration: 'underline' } }, [
|
|
|
+ '',
|
|
|
+ ])
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const values = data.map((item) => Number(item[column.property]))
|
|
|
+ if (!values.every((value) => Number.isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr)
|
|
|
+ if (!Number.isNaN(value)) {
|
|
|
+ return prev + curr
|
|
|
+ } else {
|
|
|
+ return prev
|
|
|
+ }
|
|
|
+ }, 0)
|
|
|
+ if (column.property === 'inDays') {
|
|
|
+ sums[index] = sums[index].toFixed(0)
|
|
|
+ } else {
|
|
|
+ sums[index] = sums[index].toFixed(2)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sums[index] = '合计'
|
|
|
+ }
|
|
|
+ hj[column.property] = sums[index]
|
|
|
+ })
|
|
|
+
|
|
|
+ return sums
|
|
|
+}
|
|
|
+
|
|
|
+const exportData = () => {
|
|
|
+ if (returnData.value.length <= 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '没有可以导出的数据!',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ queryTerm.value.total = hj
|
|
|
+ queryTerm.value.exportName = '住院工作量统计'
|
|
|
+ exportWorkFeeStatisticsInfo(queryTerm.value)
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|