From fb34ba28cb908bd328cf6690ab0b19a56428f4e2 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 13 十一月 2026 10:56:55 +0800
Subject: [PATCH] 测试完成
---
src/views/sfstatistics/percentage/components/FirstFollowUp.vue | 1519 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 1,063 insertions(+), 456 deletions(-)
diff --git a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
index 89b4de0..1e2b17e 100644
--- a/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
+++ b/src/views/sfstatistics/percentage/components/FirstFollowUp.vue
@@ -156,6 +156,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="!isTargetHospital"
label="寰呴殢璁�"
align="center"
key="pendingFollowUp"
@@ -179,6 +180,62 @@
}}</span>
</el-button>
</template>
+ </el-table-column>
+ <el-table-column
+ v-if="isTargetHospital"
+ label="寰呴殢璁�"
+ align="center"
+ >
+ <el-table-column
+ label="寰呭彂閫�"
+ align="center"
+ key="pendingFollowUpWaitSend"
+ prop="pendingFollowUpWaitSend"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'pendingFollowUpWaitSendInfo',
+ '寰呭彂閫佸垪琛�',
+ '1'
+ )
+ "
+ >
+ <span class="button-zx">{{
+ scope.row.pendingFollowUpWaitSend
+ }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="宸插彂閫�"
+ align="center"
+ key="pendingFollowUpSent"
+ prop="pendingFollowUpSent"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'pendingFollowUpSentInfo',
+ '宸插彂閫佸垪琛�',
+ '1'
+ )
+ "
+ >
+ <span class="button-zx">{{
+ scope.row.pendingFollowUpSent
+ }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
</el-table-column>
<el-table-column
label="闅忚鎴愬姛"
@@ -206,6 +263,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="!isTargetHospital"
label="闅忚澶辫触"
align="center"
key="followUpFail"
@@ -231,6 +289,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="orgname != '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
label="鎴愬姛鐜�"
align="center"
width="120"
@@ -271,9 +330,9 @@
type="text"
@click="handleSeeDetails(scope.row)"
>
- <span class="button-zx"
- >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span
- >
+ <span class="button-zx">{{
+ getTimelyRateText(scope.row)
+ }}</span>
</el-button>
</template>
</el-table-column>
@@ -475,6 +534,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="!isTargetHospital"
label="寰呴殢璁�"
align="center"
key="pendingFollowUp"
@@ -495,6 +555,60 @@
<span class="button-zx">{{ scope.row.pendingFollowUp }}</span>
</el-button>
</template>
+ </el-table-column>
+ <el-table-column
+ v-if="isTargetHospital"
+ label="寰呴殢璁�"
+ align="center"
+ >
+ <el-table-column
+ label="寰呭彂閫�"
+ align="center"
+ key="pendingFollowUpWaitSend"
+ prop="pendingFollowUpWaitSend"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'pendingFollowUpWaitSendInfo',
+ '寰呭彂閫佸垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{
+ scope.row.pendingFollowUpWaitSend
+ }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="宸插彂閫�"
+ align="center"
+ key="pendingFollowUpSent"
+ prop="pendingFollowUpSent"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'pendingFollowUpSentInfo',
+ '宸插彂閫佸垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{
+ scope.row.pendingFollowUpSent
+ }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
</el-table-column>
<el-table-column
label="闅忚鎴愬姛"
@@ -519,6 +633,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="!isTargetHospital"
label="闅忚澶辫触"
align="center"
key="followUpFail"
@@ -541,6 +656,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="orgname != '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
label="鎴愬姛鐜�"
align="center"
width="120"
@@ -581,13 +697,231 @@
type="text"
@click="handleSeeDetails(scope.row)"
>
- <span class="button-zx"
- >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span
- >
+ <span class="button-zx">{{
+ getTimelyRateText(scope.row)
+ }}</span>
</el-button>
</template>
</el-table-column>
<el-table-column
+ v-if="orgname == '缂欎簯鍘夸汉姘戝尰闄�'"
+ label="鍙婃椂闅忚浜烘"
+ align="center"
+ key="timelyFollowUp"
+ prop="timelyFollowUp"
+ width="138"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'timelyFollowUpInfo',
+ '鍙婃椂闅忚鍒楄〃'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.timelyFollowUp }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column v-if="isTargetHospital" label="璇煶" align="center">
+ <el-table-column
+ label="鍙戦�佹暟"
+ align="center"
+ key="voice"
+ prop="voice"
+ :render-header="Tooltipfswc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'voiceInfo',
+ '鍙戦�佸畬鎴愯闊抽殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.voice }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎴愬姛鏁�"
+ align="center"
+ key="voiceSuccess"
+ prop="voiceSuccess"
+ :render-header="Tooltipzzwc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'voiceSuccessInfo',
+ '鏈�缁堝畬鎴愯闊抽殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.voiceSuccess }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table-column>
+ <el-table-column v-if="isTargetHospital" label="寰俊" align="center">
+ <el-table-column
+ label="鍙戦�佹暟"
+ align="center"
+ key="weChat"
+ prop="weChat"
+ :render-header="Tooltipfswc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'weChatInfo',
+ '鍙戦�佸畬鎴愬井淇¢殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.weChat }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎴愬姛鏁�"
+ align="center"
+ key="weChatSuccess"
+ prop="weChatSuccess"
+ :render-header="Tooltipzzwc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'weChatSuccessInfo',
+ '鏈�缁堝畬鎴愬井淇¢殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.weChatSuccess }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table-column>
+ <el-table-column v-if="isTargetHospital" label="鐭俊" align="center">
+ <el-table-column
+ label="鍙戦�佹暟"
+ align="center"
+ key="sms"
+ prop="sms"
+ :render-header="Tooltipfswc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'smsInfo',
+ '鍙戦�佸畬鎴愮煭淇¢殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.sms }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎴愬姛鏁�"
+ align="center"
+ key="smsSuccess"
+ prop="smsSuccess"
+ :render-header="Tooltipzzwc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'smsSuccessInfo',
+ '鏈�缁堝畬鎴愮煭淇¢殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.smsSuccess }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table-column>
+ <el-table-column v-if="isTargetHospital" label="浜哄伐" align="center">
+ <el-table-column
+ label="鍙戦�佹暟"
+ align="center"
+ key="manual"
+ prop="manual"
+ :render-header="Tooltipfswc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'manualInfo',
+ '鍙戦�佸畬鎴愪汉宸ラ殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.manual }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎴愬姛鏁�"
+ align="center"
+ key="manualSuccess"
+ prop="manualSuccess"
+ :render-header="Tooltipzzwc"
+ >
+ <template slot-scope="scope">
+ <el-button
+ size="medium"
+ type="text"
+ @click="
+ handleViewDetails(
+ scope.row,
+ 'manualSuccessInfo',
+ '鏈�缁堝畬鎴愪汉宸ラ殢璁垮垪琛�'
+ )
+ "
+ >
+ <span class="button-zx">{{ scope.row.manualSuccess }}</span>
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table-column>
+
+ <el-table-column
+ v-if="!isTargetHospital"
label="浜哄伐"
align="center"
key="manual"
@@ -605,7 +939,13 @@
</el-button>
</template>
</el-table-column>
- <el-table-column label="璇煶" align="center" key="voice" prop="voice">
+ <el-table-column
+ v-if="!isTargetHospital"
+ label="璇煶"
+ align="center"
+ key="voice"
+ prop="voice"
+ >
<template slot-scope="scope">
<el-button
size="medium"
@@ -618,7 +958,13 @@
</el-button>
</template>
</el-table-column>
- <el-table-column label="鐭俊" align="center" key="sms" prop="sms">
+ <el-table-column
+ v-if="!isTargetHospital"
+ label="鐭俊"
+ align="center"
+ key="sms"
+ prop="sms"
+ >
<template slot-scope="scope">
<el-button
size="medium"
@@ -630,6 +976,7 @@
</template>
</el-table-column>
<el-table-column
+ v-if="!isTargetHospital"
label="寰俊"
align="center"
key="weChat"
@@ -649,11 +996,9 @@
</el-table-column>
</el-table-column>
- <!-- 闅忚鎯呭喌鍒楋紙浠呬附姘村競涓尰闄㈡樉绀猴級 -->
+ <!-- 闅忚鎯呭喌鍒楋紙涓芥按甯備腑鍖婚櫌宸茬Щ鍒扮患鍚堢粺璁★紝姝ゅ浠呮櫙瀹佺暡鏃忚嚜娌诲幙浜烘皯鍖婚櫌鏄剧ず锛� -->
<el-table-column
- v-if="
- orgname == '涓芥按甯備腑鍖婚櫌' || orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'
- "
+ v-if="orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
align="center"
label="闅忚鎯呭喌"
>
@@ -747,6 +1092,14 @@
tasktypes: store.getters.tasktypes,
};
},
+ computed: {
+ isTargetHospital() {
+ return (
+ this.orgname == "绗竴浜烘皯鍖婚櫌婀栨花闄㈠尯" ||
+ this.orgname == "绗竴浜烘皯鍖婚櫌鍚村北闄㈠尯"
+ );
+ },
+ },
methods: {
loadData() {
this.loading = true;
@@ -764,8 +1117,8 @@
delete params.leavehospitaldistrictcodes.all;
delete params.deptcodes.all;
- params.rateDay = 7;
- getSfStatistics(params)
+ params.rateDay = this.orgname == "榫欐硥甯備汉姘戝尰闄�" ? 21 : 7;
+ return getSfStatistics(params)
.then((response) => {
this.tableData = this.customSort(response.data);
})
@@ -791,205 +1144,23 @@
},
customSort(data) {
- const order = [
- "涓�",
- "浜�",
- "涓�",
- "鍥�",
- "浜�",
- "鍏�",
- "涓�",
- "鍏�",
- "涔�",
- "鍗�",
- "鍗佷竴",
- "鍗佷簩",
- "鍗佷笁",
- "鍗佸洓",
- "鍗佷簲",
- "鍗佸叚",
- "鍗佷竷",
- "鍗佸叓",
- "鍗佷節",
- "浜屽崄",
- "浜屽崄涓�",
- "浜屽崄浜�",
- "浜屽崄涓�",
- "浜屽崄鍥�",
- "浜屽崄浜�",
- "浜屽崄鍏�",
- "浜屽崄涓�",
- "浜屽崄鍏�",
- "浜屽崄涔�",
- "涓夊崄",
- "涓夊崄涓�",
- "涓夊崄浜�",
- "涓夊崄涓�",
- "涓夊崄鍥�",
- "涓夊崄浜�",
- "涓夊崄鍏�",
- "涓夊崄涓�",
- "涓夊崄鍏�",
- "涓夊崄涔�",
- "鍥涘崄",
- "鍥涘崄涓�",
- "鍥涘崄浜�",
- "鍥涘崄涓�",
- "鍥涘崄鍥�",
- "鍥涘崄浜�",
- ];
-
- return data.sort((a, b) => {
- const getIndex = (name) => {
- if (!name || typeof name !== "string") return -1;
- const chineseMatch = name.match(/^([涓�浜屼笁鍥涗簲鍏竷鍏節鍗乚+)/);
- if (chineseMatch && chineseMatch[1]) {
- return order.indexOf(chineseMatch[1]);
- }
- const arabicMatch = name.match(/^(\d+)/);
- if (arabicMatch && arabicMatch[1]) {
- const num = parseInt(arabicMatch[1], 10);
- if (num >= 1 && num <= 45) {
- return num - 1;
- }
- }
- return -1;
- };
-
- const indexA = getIndex(a.leavehospitaldistrictname);
- const indexB = getIndex(b.leavehospitaldistrictname);
-
- if (indexA === -1 && indexB === -1) {
- return (a.leavehospitaldistrictname || "").localeCompare(
- b.leavehospitaldistrictname || ""
- );
- }
- if (indexA === -1) return 1;
- if (indexB === -1) return -1;
- return indexA - indexB;
- });
- },
- Tooltipcgl(h, { column }) {
- return h(
- "el-tooltip",
- {
- props: {
- content: "闅忚鎴愬姛/(闇�闅忚-寰呴殢璁�)",
- placement: "top",
- effect: "dark",
- },
- },
- [h("span", column.label)]
+ return data.sort((a, b) =>
+ this.compareWardName(
+ a.leavehospitaldistrictname,
+ b.leavehospitaldistrictname
+ )
);
},
- Tooltipjsl(h, { column }) {
- return h(
- "el-tooltip",
- {
- props: {
- content: "(搴旈殢璁挎椂闂�+浠诲姟鍛ㄦ湡)灏忎簬瀹屾垚鏃堕棿鍗充负瓒呮椂;(闇�闅忚-瓒呮椂)/闇�闅忚",
- placement: "top",
- effect: "dark",
- },
- },
- [h("span", column.label)]
- );
- },
- Tooltipsfl(h, { column }) {
- return h(
- "el-tooltip",
- {
- props: {
- content: "(闅忚鎴愬姛+棣栨闅忚澶辫触)/棣栨搴旈殢璁�",
- placement: "top",
- effect: "dark",
- },
- },
- [h("span", column.label)]
- );
- },
+
sortChineseNumber(aRow, bRow) {
- const a = aRow.leavehospitaldistrictname;
- const b = bRow.leavehospitaldistrictname;
-
- const chineseNumMap = {
- 涓�: 1,
- 浜�: 2,
- 涓�: 3,
- 鍥�: 4,
- 浜�: 5,
- 鍏�: 6,
- 涓�: 7,
- 鍏�: 8,
- 涔�: 9,
- 鍗�: 10,
- 鍗佷竴: 11,
- 鍗佷簩: 12,
- 鍗佷笁: 13,
- 鍗佸洓: 14,
- 鍗佷簲: 15,
- 鍗佸叚: 16,
- 鍗佷竷: 17,
- 鍗佸叓: 18,
- 鍗佷節: 19,
- 浜屽崄: 20,
- 浜屽崄涓�: 21,
- 浜屽崄浜�: 22,
- 浜屽崄涓�: 23,
- 浜屽崄鍥�: 24,
- 浜屽崄浜�: 25,
- 浜屽崄鍏�: 26,
- 浜屽崄涓�: 27,
- 浜屽崄鍏�: 28,
- 浜屽崄涔�: 29,
- 涓夊崄: 30,
- 涓夊崄涓�: 31,
- 涓夊崄浜�: 32,
- 涓夊崄涓�: 33,
- 涓夊崄鍥�: 34,
- 涓夊崄浜�: 35,
- 涓夊崄鍏�: 36,
- 涓夊崄涓�: 37,
- 涓夊崄鍏�: 38,
- 涓夊崄涔�: 39,
- 鍥涘崄: 40,
- 鍥涘崄涓�: 41,
- 鍥涘崄浜�: 42,
- 鍥涘崄涓�: 43,
- 鍥涘崄鍥�: 44,
- 鍥涘崄浜�: 45,
- };
-
- const getNumberFromText = (text) => {
- if (!text || typeof text !== "string") return -1;
- const match = text.match(/^([涓�浜屼笁鍥涗簲鍏竷鍏節鍗乚+)/);
- if (match && match[1]) {
- const chineseNum = match[1];
- return chineseNumMap[chineseNum] !== undefined
- ? chineseNumMap[chineseNum]
- : -1;
- }
- const arabicMatch = text.match(/^(\d+)/);
- if (arabicMatch && arabicMatch[1]) {
- const num = parseInt(arabicMatch[1], 10);
- return num >= 1 && num <= 45 ? num : -1;
- }
- return -1;
- };
-
- const numA = getNumberFromText(a);
- const numB = getNumberFromText(b);
-
- if (numA === -1 && numB === -1) {
- return (a || "").localeCompare(b || "");
- }
- if (numA === -1) return 1;
- if (numB === -1) return -1;
- return numA - numB;
+ return this.compareWardName(
+ aRow.leavehospitaldistrictname,
+ bRow.leavehospitaldistrictname
+ );
},
getRowKey(row) {
- return row.statisticaltype === 1
+ return this.queryParams.statisticaltype === 1
? row.leavehospitaldistrictcode
: row.deptcode;
},
@@ -1015,7 +1186,7 @@
if (!row.doctorStats) {
this.loading = true;
- params.rateDay = 7;
+ params.rateDay = this.orgname == "榫欐硥甯備汉姘戝尰闄�" ? 21 : 7;
getSfStatistics(params).then((res) => {
this.$set(row, "doctorStats", res.data);
@@ -1032,8 +1203,8 @@
const need = Number(needFollowUp) || 0;
const pending = Number(pendingFollowUp) || 0;
- // 鍒嗘瘝 = 闇�闅忚 - 寰呴殢璁�
- const denominator = need - pending;
+ // 鐩爣鍖婚櫌锛氭垚鍔熺巼 = 闅忚鎴愬姛 / 闇�闅忚锛涘叾浠栵細闅忚鎴愬姛 / (闇�闅忚 - 寰呴殢璁�)
+ const denominator = this.isTargetHospital ? need : need - pending;
if (denominator <= 0) {
return "0.00%";
@@ -1041,6 +1212,26 @@
const rate = (success / denominator) * 100;
return rate.toFixed(2) + "%";
+ },
+ // 璁$畻鍙婃椂鐜囷紙鐩爣鍖婚櫌锛夛細(闇�闅忚 - 浜哄伐瑙勫畾鏃堕棿鍐呮病鎵撹繃鐢佃瘽) / 闇�闅忚
+ calculateTimelyRate(needFollowUp, manualCallTimeout) {
+ const need = Number(needFollowUp) || 0;
+ const timeout = Number(manualCallTimeout) || 0;
+ if (need <= 0) {
+ return "0.00%";
+ }
+ const rate = ((need - timeout) / need) * 100;
+ return (rate < 0 ? 0 : rate).toFixed(2) + "%";
+ },
+ // 鍙婃椂鐜囧睍绀烘枃妗堬細鐩爣鍖婚櫌鍓嶇璁$畻锛屽叾浠栫敤鍚庣 rate 瀛楁
+ getTimelyRateText(row) {
+ if (this.isTargetHospital) {
+ return this.calculateTimelyRate(
+ row.needFollowUp,
+ row.manualCallTimeout
+ );
+ }
+ return (Number(row.rate) * 100).toFixed(2) + "%";
},
// 鍦ㄧ粺璁℃眹鎬绘柟娉曚腑澶勭悊鎴愬姛鐜�
getSummaries(param) {
@@ -1071,17 +1262,51 @@
return sum + (Number(item.pendingFollowUp) || 0);
}, 0);
- const denominator = totalNeed - totalPending;
+ const denominator = this.isTargetHospital
+ ? totalNeed
+ : totalNeed - totalPending;
if (denominator > 0) {
sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
} else {
sums[index] = "0.00%";
}
- } else if (
- column.property === "followUpRate" ||
- column.property === "rate"
- ) {
+ } else if (column.property === "rate") {
+ if (this.isTargetHospital) {
+ const totalNeed = data.reduce(
+ (sum, item) => sum + (Number(item.needFollowUp) || 0),
+ 0
+ );
+ const totalTimeout = data.reduce(
+ (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+ 0
+ );
+ sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout);
+ } else {
+ const percentageValues = data
+ .map((item) => {
+ const value = item[column.property];
+ if (!value || value === "-" || value === "0%") return null;
+ if (typeof value === "string" && value.includes("%")) {
+ const numValue = parseFloat(value.replace("%", "")) / 100;
+ return isNaN(numValue) ? null : numValue;
+ } else {
+ const numValue = parseFloat(value);
+ return isNaN(numValue) ? null : numValue;
+ }
+ })
+ .filter((value) => value !== null && value !== 0);
+
+ if (percentageValues.length > 0) {
+ const average =
+ percentageValues.reduce((sum, value) => sum + value, 0) /
+ percentageValues.length;
+ sums[index] = (average * 100).toFixed(2) + "%";
+ } else {
+ sums[index] = "0.00%";
+ }
+ }
+ } else if (column.property === "followUpRate") {
const percentageValues = data
.map((item) => {
const value = item[column.property];
@@ -1122,7 +1347,75 @@
return sums;
},
-
+ Tooltipcgl(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: this.isTargetHospital
+ ? "闅忚鎴愬姛/闇�闅忚"
+ : "闅忚鎴愬姛/(闇�闅忚-寰呴殢璁�)",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
+ Tooltipjsl(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: this.isTargetHospital
+ ? "鍙婃椂鐜�=(闇�闅忚-浜哄伐瑙勫畾鏃堕棿鍐呮病鎵撹繃鐢佃瘽)/闇�闅忚"
+ : "(鍑洪櫌鏃堕棿+浠诲姟鍛ㄦ湡)灏忎簬瀹屾垚鏃堕棿鍗充负瓒呮椂;(闇�闅忚-瓒呮椂)/闇�闅忚",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
+ Tooltipsfl(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: "(闅忚鎴愬姛+棣栨闅忚澶辫触)/棣栨搴旈殢璁�",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
+ Tooltipfswc(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: "棣栨鍙戦�佹偅鑰呭嵆濉姤鎴愬姛鐨勬暟閲�",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
+ Tooltipzzwc(h, { column }) {
+ return h(
+ "el-tooltip",
+ {
+ props: {
+ content: "棣栨鏈畬鎴愪簩娆℃垨涓夋琛ュ伩鎺ㄩ�佹湰鏂瑰紡鐨勫畬鎴愭鏁�",
+ placement: "top",
+ effect: "dark",
+ },
+ },
+ [h("span", column.label)]
+ );
+ },
getInnerSummaries(param) {
const { columns, data } = param;
const sums = [];
@@ -1152,17 +1445,51 @@
return sum + (Number(item.pendingFollowUp) || 0);
}, 0);
- const denominator = totalNeed - totalPending;
+ const denominator = this.isTargetHospital
+ ? totalNeed
+ : totalNeed - totalPending;
if (denominator > 0) {
sums[index] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
} else {
sums[index] = "0.00%";
}
- } else if (
- column.property === "followUpRate" ||
- column.property === "rate"
- ) {
+ } else if (column.property === "rate") {
+ if (this.isTargetHospital) {
+ const totalNeed = data.reduce(
+ (sum, item) => sum + (Number(item.needFollowUp) || 0),
+ 0
+ );
+ const totalTimeout = data.reduce(
+ (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+ 0
+ );
+ sums[index] = this.calculateTimelyRate(totalNeed, totalTimeout);
+ } else {
+ const percentageValues = data
+ .map((item) => {
+ const value = item[column.property];
+ if (!value || value === "-" || value === "0%") return null;
+ if (typeof value === "string" && value.includes("%")) {
+ const numValue = parseFloat(value.replace("%", "")) / 100;
+ return isNaN(numValue) ? null : numValue;
+ } else {
+ const numValue = parseFloat(value);
+ return isNaN(numValue) ? null : numValue;
+ }
+ })
+ .filter((value) => value !== null && value !== 0);
+
+ if (percentageValues.length > 0) {
+ const average =
+ percentageValues.reduce((sum, value) => sum + value, 0) /
+ percentageValues.length;
+ sums[index] = (average * 100).toFixed(2) + "%";
+ } else {
+ sums[index] = "0.00%";
+ }
+ }
+ } else if (column.property === "followUpRate") {
const percentageValues = data
.map((item) => {
const value = item[column.property];
@@ -1207,6 +1534,77 @@
formatNumber(num) {
if (isNaN(num)) return "-";
return Number.isInteger(num) ? num.toString() : num.toFixed(0);
+ },
+
+ // ===== 鐥呭尯鍚嶆帓搴忥紙鏀寔 1-B10 / 2-A2 绛� 鏁板瓧-瀛楁瘝鏁板瓧 鏍煎紡锛� =====
+ // 瑙f瀽鐥呭尯鍚嶏紝杩斿洖鎺掑簭閿� { group, letter, number }
+ parseWardKey(name) {
+ if (!name || typeof name !== "string") return null;
+ const trimmed = name.trim();
+
+ // 鏍煎紡1锛氭暟瀛�-瀛楁瘝鏁板瓧锛屽 1-B10銆�2-A2銆�1-A11
+ const dashMatch = trimmed.match(/^(\d+)-([A-Za-z]+)(\d+)/);
+ if (dashMatch) {
+ return {
+ group: parseInt(dashMatch[1], 10),
+ letter: dashMatch[2].toUpperCase(),
+ number: parseInt(dashMatch[3], 10),
+ };
+ }
+
+ // 鏍煎紡2锛氫腑鏂囨暟瀛楀紑澶达紝濡� 涓�鐥呭尯銆佸崄涓�鐥呭尯銆佷簩鍗佷竴鐥呭尯
+ const cnMatch = trimmed.match(/^([涓�浜屼笁鍥涗簲鍏竷鍏節鍗乚+)/);
+ if (cnMatch && cnMatch[1]) {
+ const num = this.chineseToNumber(cnMatch[1]);
+ if (num > 0) return { group: num, letter: "", number: 0 };
+ }
+
+ // 鏍煎紡3锛氶樋鎷変集鏁板瓧寮�澶达紝濡� 1鐥呭尯銆�12鐥呭尯
+ const numMatch = trimmed.match(/^(\d+)/);
+ if (numMatch && numMatch[1]) {
+ return { group: parseInt(numMatch[1], 10), letter: "", number: 0 };
+ }
+
+ return null;
+ },
+
+ // 涓枃鏁板瓧杞樋鎷変集鏁板瓧锛堟敮鎸� 涓� ~ 涔濆崄涔濓級
+ chineseToNumber(str) {
+ const digits = {
+ 涓�: 1,
+ 浜�: 2,
+ 涓�: 3,
+ 鍥�: 4,
+ 浜�: 5,
+ 鍏�: 6,
+ 涓�: 7,
+ 鍏�: 8,
+ 涔�: 9,
+ };
+ if (!str) return -1;
+ if (str === "鍗�") return 10;
+ if (str.startsWith("鍗�")) return 10 + (digits[str[1]] || 0);
+ if (str.includes("鍗�")) {
+ const parts = str.split("鍗�");
+ const tens = digits[parts[0]] || 0;
+ const ones = digits[parts[1]] || 0;
+ return tens * 10 + ones;
+ }
+ return digits[str] !== undefined ? digits[str] : -1;
+ },
+
+ // 鐥呭尯鍚嶆瘮杈冨櫒锛氭暟瀛楁 鈫� 瀛楁瘝娈� 鈫� 鏁板瓧娈�
+ compareWardName(nameA, nameB) {
+ const ka = this.parseWardKey(nameA);
+ const kb = this.parseWardKey(nameB);
+
+ if (!ka && !kb) return (nameA || "").localeCompare(nameB || "", "zh-CN");
+ if (!ka) return 1;
+ if (!kb) return -1;
+
+ if (ka.group !== kb.group) return ka.group - kb.group;
+ if (ka.letter !== kb.letter) return ka.letter.localeCompare(kb.letter);
+ return ka.number - kb.number;
},
handleSelectionChange(selection) {
@@ -1262,65 +1660,46 @@
sheetNameSuffix = `${startDateFormatted}鑷�${endDateFormatted}`;
}
} else {
- const now = new Date();
- const currentMonth = now.getMonth() + 1;
- const currentYear = now.getFullYear();
-
- if (isLishuiHospital) {
- // 涓芥按甯備腑鍖婚櫌锛氭樉绀哄勾鏈�
- dateRangeString = `${currentYear}骞�${currentMonth}鏈坄;
- sheetNameSuffix = `${currentYear}骞�${currentMonth}鏈坄;
- } else {
- // 鍏朵粬鍖婚櫌锛氭樉绀烘湀浠�
- dateRangeString = `${currentMonth}鏈坄;
- sheetNameSuffix = `${currentMonth}鏈坄;
- }
+ // 鏈�夋嫨鏃堕棿锛氭暟鎹湭鍋氭椂闂寸瓫閫夛紝涓哄叏閮ㄦ暟鎹紝鏂囦欢鍚嶆爣娉ㄢ�滃叏閮ㄢ��
+ dateRangeString = "鍏ㄩ儴";
+ sheetNameSuffix = "鍏ㄩ儴";
}
- // 鏍规嵁 serviceType 鐢熸垚闅忚绫诲瀷鍚嶇О
+ // 鏍规嵁 serviceType 鐢熸垚闅忚绫诲瀷鍚嶇О锛堝吋瀹瑰崟閫�/澶氶�夛級
+ const serviceTypes = Array.isArray(this.queryParams.serviceType)
+ ? this.queryParams.serviceType
+ : this.queryParams.serviceType
+ ? [this.queryParams.serviceType]
+ : [];
+
let serviceTypeName = "棣栨鍑洪櫌闅忚"; // 鏂囦欢鍚嶄娇鐢ㄧ殑鍚嶇О
let sheetTypeName = "棣栨闅忚"; // 宸ヤ綔琛ㄤ娇鐢ㄧ殑鍚嶇О锛堢畝鍖栫増锛�
- if (
- this.queryParams.serviceType &&
- Array.isArray(this.queryParams.serviceType) &&
- this.queryParams.serviceType.length > 0
- ) {
- if (this.tasktypes && Array.isArray(this.tasktypes)) {
- // 杩囨护鍑哄尮閰嶇殑闅忚绫诲瀷
- const matchedTypes = this.tasktypes.filter((task) =>
- this.queryParams.serviceType.includes(task.value)
+ if (serviceTypes.length > 0) {
+ // 浣跨敤 props 涓殑 options锛堝嵆 tasktypes锛�
+ if (this.options && Array.isArray(this.options)) {
+ const matchedTypes = this.options.filter((task) =>
+ serviceTypes.includes(task.value)
);
+ console.log(matchedTypes, "matchedTypes");
if (matchedTypes.length === 1) {
- // 鍗曚釜绫诲瀷
const label = matchedTypes[0].label;
serviceTypeName = `棣栨${label}`;
sheetTypeName = `棣栨${label}`;
} else if (matchedTypes.length > 1) {
- // 澶氫釜绫诲瀷
const typeNames = matchedTypes.map((task) => task.label);
-
- // 鏂囦欢鍚嶏細鐢ㄦ枩鏉犲垎闅�
serviceTypeName = `棣栨${typeNames.join("/")}`;
-
- // 宸ヤ綔琛ㄥ悕锛氫娇鐢ㄧ涓�涓被鍨嬫垨绠�鍖栧悕绉�
- if (matchedTypes.length <= 2) {
- // 濡傛灉鍙湁2涓被鍨嬶紝閮芥樉绀�
- sheetTypeName = `棣栨${typeNames[0]}绛塦;
- } else {
- // 濡傛灉瓒呰繃2涓被鍨嬶紝鍙樉绀虹涓�涓�
- sheetTypeName = `棣栨${typeNames[0]}绛塦;
- }
- } else if (this.queryParams.serviceType.length > 0) {
- // 濡傛灉娌℃湁鍖归厤鐨勶紝浣跨敤鍘熷鍊�
- const typeStr = this.queryParams.serviceType.join("/");
+ // 宸ヤ綔琛ㄥ悕绠�鍖栵紙鍙栫涓�涓�+鈥滅瓑鈥濓級
+ sheetTypeName = `棣栨${typeNames[0]}绛塦;
+ } else {
+ // 鏃犲尮閰嶆椂浣跨敤鍘熷鍊�
+ const typeStr = serviceTypes.join("/");
serviceTypeName = `棣栨${typeStr}`;
sheetTypeName = "棣栨闅忚";
}
- } else if (this.queryParams.serviceType.length > 0) {
- // 濡傛灉娌℃湁 tasktypes锛屼娇鐢ㄥ師濮嬪��
- const typeStr = this.queryParams.serviceType.join("/");
+ } else {
+ const typeStr = serviceTypes.join("/");
serviceTypeName = `棣栨${typeStr}`;
sheetTypeName = "棣栨闅忚";
}
@@ -1347,7 +1726,7 @@
const worksheet = workbook.addWorksheet(worksheetName);
// 鏋勫缓琛ㄦ牸
- this.buildExportSheet(worksheet, sheetNameSuffix);
+ this.buildExportSheet(worksheet, sheetNameSuffix, serviceTypeName);
const buffer = await workbook.xlsx.writeBuffer();
const blob = new Blob([buffer], {
@@ -1379,7 +1758,8 @@
const end = this.queryParams.dateRange[1].split(" ")[0];
dateRangeString = `${start}鑷�${end}`;
} else {
- dateRangeString = `${new Date().getMonth() + 1}鏈坄;
+ // 鏈�夋嫨鏃堕棿锛氭暟鎹负鍏ㄩ儴
+ dateRangeString = "鍏ㄩ儴";
}
const fileName = `${areaName}鍖荤敓闅忚鍒楄〃_${dateRangeString}.xlsx`;
@@ -1444,13 +1824,12 @@
},
};
- // 鏍囬
- worksheet.mergeCells(1, 1, 1, 10);
- worksheet.getCell(1, 1).value = `${areaName}鍖荤敓闅忚鍒楄〃`;
- worksheet.getCell(1, 1).style = titleStyle;
- worksheet.getRow(1).height = 30;
+ const graded = this.isTargetHospital;
+ // 鎴愬姛鐜囷細鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄笉灞曠ず锛涘強鏃剁巼锛氫附姘村競涓尰闄笉灞曠ず
+ const showSuccessRate = this.orgname != "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�";
+ const showTimelyRate = this.orgname != "涓芥按甯備腑鍖婚櫌";
- // 琛ㄥご
+ // 鍒楀畾涔夛紙涓庡睍寮�鐨勫尰鐢熷瓙琛ㄤ繚鎸佷竴鑷达級
const headers = [
"鍖荤敓濮撳悕",
"绉戝",
@@ -1458,13 +1837,26 @@
"鏃犻渶闅忚",
"搴旈殢璁�",
"闇�闅忚",
- "寰呴殢璁�",
+ ...(graded ? ["寰呭彂閫�", "宸插彂閫�"] : ["寰呴殢璁�"]),
"闅忚鎴愬姛",
- "闅忚澶辫触",
- "鎴愬姛鐜�", // 鏂板
- "闅忚鐜�", // 鍘熸潵鍦ㄦ垚鍔熺巼浣嶇疆
+ ...(graded ? [] : ["闅忚澶辫触"]),
+ ...(showSuccessRate ? ["鎴愬姛鐜�"] : []),
+ "闅忚鐜�",
+ ...(showTimelyRate ? ["鍙婃椂鐜�"] : []),
+ "浜哄伐",
+ "璇煶",
+ "鐭俊",
+ "寰俊",
];
+ const totalCols = headers.length;
+ // 鏍囬
+ worksheet.mergeCells(1, 1, 1, totalCols);
+ worksheet.getCell(1, 1).value = `${areaName}鍖荤敓闅忚鍒楄〃`;
+ worksheet.getCell(1, 1).style = titleStyle;
+ worksheet.getRow(1).height = 30;
+
+ // 琛ㄥご
const headerRow = worksheet.addRow(headers);
headerRow.eachCell((cell) => {
cell.style = headerStyle;
@@ -1480,15 +1872,26 @@
item.nonFollowUp,
item.followUpNeeded,
item.needFollowUp,
- item.pendingFollowUp,
+ ...(graded
+ ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0]
+ : [item.pendingFollowUp || 0]),
item.followUpSuccess,
- item.followUpFail,
- this.calculateSuccessRate(
- item.followUpSuccess,
- item.needFollowUp,
- item.pendingFollowUp
- ),
+ ...(graded ? [] : [item.followUpFail || 0]),
+ ...(showSuccessRate
+ ? [
+ this.calculateSuccessRate(
+ item.followUpSuccess,
+ item.needFollowUp,
+ item.pendingFollowUp
+ ),
+ ]
+ : []),
item.followUpRate,
+ ...(showTimelyRate ? [this.getTimelyRateText(item)] : []),
+ item.manual || 0,
+ item.voice || 0,
+ item.sms || 0,
+ item.weChat || 0,
]);
row.eachCell((cell) => {
cell.style = cellStyle;
@@ -1506,58 +1909,66 @@
};
});
- // 鍒楀
- worksheet.columns = [
- { width: 15 },
- { width: 15 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 }, // 鎴愬姛鐜�
- { width: 12 }, // 闅忚鐜�
- ];
+ // 鍒楀锛堝墠涓ゅ垪濮撳悕/绉戝杈冨锛屽叾浣欑粺涓�锛�
+ const widths = [15, 15];
+ headers.slice(2).forEach(() => widths.push(12));
+ worksheet.columns = widths.map((width) => ({ width }));
},
getDoctorExportSummary(data) {
- const sums = ["灏忚"];
+ const graded = this.isTargetHospital;
+ const showSuccessRate = this.orgname != "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�";
+ const showTimelyRate = this.orgname != "涓芥按甯備腑鍖婚櫌";
- const keys = [
- "dischargeCount",
- "nonFollowUp",
- "followUpNeeded",
- "needFollowUp",
- "pendingFollowUp",
- "followUpSuccess",
- "followUpFail",
- ];
+ const sums = ["灏忚", "-"];
+
+ // 鏁板�煎垪姹傚拰
+ const keys = graded
+ ? [
+ "dischargeCount",
+ "nonFollowUp",
+ "followUpNeeded",
+ "needFollowUp",
+ "pendingFollowUpWaitSend",
+ "pendingFollowUpSent",
+ "followUpSuccess",
+ ]
+ : [
+ "dischargeCount",
+ "nonFollowUp",
+ "followUpNeeded",
+ "needFollowUp",
+ "pendingFollowUp",
+ "followUpSuccess",
+ "followUpFail",
+ ];
keys.forEach((key) => {
sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0));
});
// 鎴愬姛鐜囷紙骞冲潎鍊硷級
- const successRates = data
- .map((item) => {
- const success = Number(item.followUpSuccess) || 0;
- const need = Number(item.needFollowUp) || 0;
- const pending = Number(item.pendingFollowUp) || 0;
- const denominator = need - pending;
- if (denominator <= 0) return 0;
- return success / denominator;
- })
- .filter((rate) => !isNaN(rate));
+ if (showSuccessRate) {
+ const successRates = data
+ .map((item) => {
+ const success = Number(item.followUpSuccess) || 0;
+ const need = Number(item.needFollowUp) || 0;
+ const pending = Number(item.pendingFollowUp) || 0;
+ const denominator = graded ? need : need - pending;
+ if (denominator <= 0) return 0;
+ return success / denominator;
+ })
+ .filter((rate) => !isNaN(rate));
- sums.push(
- successRates.length
- ? (
- (successRates.reduce((a, b) => a + b, 0) / successRates.length) *
- 100
- ).toFixed(2) + "%"
- : "0.00%"
- );
+ sums.push(
+ successRates.length
+ ? (
+ (successRates.reduce((a, b) => a + b, 0) /
+ successRates.length) *
+ 100
+ ).toFixed(2) + "%"
+ : "0.00%"
+ );
+ }
// 闅忚鐜囷紙骞冲潎鍊硷級
const followUpRates = data
@@ -1574,9 +1985,41 @@
: "0.00%"
);
+ // 鍙婃椂鐜囷紙鐩爣鍖婚櫌璁$畻锛屽叾浠栧彇 rate 骞冲潎锛�
+ if (showTimelyRate) {
+ if (graded) {
+ const totalNeed = data.reduce(
+ (s, r) => s + (Number(r.needFollowUp) || 0),
+ 0
+ );
+ const totalTimeout = data.reduce(
+ (s, r) => s + (Number(r.manualCallTimeout) || 0),
+ 0
+ );
+ sums.push(this.calculateTimelyRate(totalNeed, totalTimeout));
+ } else {
+ const rateValues = data
+ .map((i) => this.extractPercentageValue(i.rate))
+ .filter(Boolean);
+ sums.push(
+ rateValues.length
+ ? (
+ (rateValues.reduce((a, b) => a + b, 0) / rateValues.length) *
+ 100
+ ).toFixed(2) + "%"
+ : "0.00%"
+ );
+ }
+ }
+
+ // 浜哄伐/璇煶/鐭俊/寰俊
+ ["manual", "voice", "sms", "weChat"].forEach((key) => {
+ sums.push(data.reduce((t, r) => t + (Number(r[key]) || 0), 0));
+ });
+
return sums;
},
- buildExportSheet(worksheet, sheetNameSuffix) {
+ buildExportSheet(worksheet, sheetNameSuffix, serviceTypeName) {
const titleStyle = {
font: {
name: "寰蒋闆呴粦",
@@ -1650,91 +2093,193 @@
right: { style: "thin", color: { argb: "FFD0D0D0" } },
},
};
+ // 鏄惁涓虹洰鏍囧尰闄紙浜哄伐/璇煶/鐭俊/寰俊 鎸� 鍙戦�佹暟/鎴愬姛鏁� 鍒嗙骇灞曠ず锛�
+ const graded = this.isTargetHospital;
- // 娣诲姞鏍囬琛�
- worksheet.mergeCells(1, 1, 1, 16);
- const titleCell = worksheet.getCell(1, 1);
- titleCell.value = `棣栨鍑洪櫌闅忚缁熻琛╛${sheetNameSuffix}`;
- titleCell.style = titleStyle;
- worksheet.getRow(1).height = 35;
-
- // 琛ㄥご
- const secondRowHeaders = [
+ const baseHeaders = [
"",
"鍑洪櫌鐥呭尯",
"绉戝",
"鍑洪櫌浜烘",
"鏃犻渶闅忚浜烘",
"搴旈殢璁夸汉娆�",
- "闇�闅忚",
- "寰呴殢璁�",
- "闅忚鎴愬姛",
- "闅忚澶辫触",
- "鎴愬姛鐜�", // 鏂板
- "闅忚鐜�", // 鍘熶綅缃悗绉�
- "鍙婃椂鐜�", // 鍙婃椂鐜囧悗绉�
- "浜哄伐",
- "璇煶", // 淇锛氬簲璇ユ槸璇煶
- "鐭俊", // 鐭俊
- "寰俊", // 寰俊
];
+ const coreHeaders = this.isTargetHospital
+ ? [
+ "闇�闅忚",
+ "寰呭彂閫�",
+ "宸插彂閫�",
+ "闅忚鎴愬姛",
+ "鎴愬姛鐜�",
+ "闅忚鐜�",
+ "鍙婃椂鐜�",
+ ]
+ : [
+ "闇�闅忚",
+ "寰呴殢璁�",
+ "闅忚鎴愬姛",
+ "闅忚澶辫触",
+ "鎴愬姛鐜�",
+ "闅忚鐜�",
+ "鍙婃椂鐜�",
+ ];
+ const methodGroups = this.getMethodColumns();
- secondRowHeaders.forEach((header, index) => {
- const cell = worksheet.getCell(3, index + 1);
- cell.value = header;
- cell.style = headerStyle;
- });
+ const baseCount = baseHeaders.length; // 6
+ const coreCount = coreHeaders.length; // 7
+ const methodLeafCount = methodGroups.reduce(
+ (sum, g) => sum + g.fields.length,
+ 0
+ ); // 8 鎴� 4
+ const totalCols = baseCount + coreCount + methodLeafCount; // 21 鎴� 17
+ const coreStartCol = baseCount + 1; // 7
+ const methodStartCol = baseCount + coreCount + 1; // 14
- // 鍚堝苟鍗曞厓鏍�
- for (let i = 1; i <= 6; i++) {
- worksheet.mergeCells(2, i, 3, i);
- const cell = worksheet.getCell(2, i);
- cell.style = headerStyle;
+ const titleText = `${serviceTypeName}缁熻琛╛${sheetNameSuffix}`;
+ // 娣诲姞鏍囬琛�
+ worksheet.mergeCells(1, 1, 1, totalCols);
+ const titleCell = worksheet.getCell(1, 1);
+ titleCell.value = titleText;
+ titleCell.style = titleStyle;
+ worksheet.getRow(1).height = 35;
+
+ if (graded) {
+ // 琛ㄥご鍗� 3 琛岋紙绗�2/3/4琛岋級锛屾暟鎹粠绗�5琛屽紑濮�
+ const headerEndRow = 4;
+
+ // 绗�2琛岋細鍩虹鍒楃旱鍚戝悎骞� + 闅忚鍒嗙粍妯悜鍚堝苟
+ for (let i = 1; i <= baseCount; i++) {
+ worksheet.mergeCells(2, i, headerEndRow, i);
+ const cell = worksheet.getCell(2, i);
+ cell.value = baseHeaders[i - 1];
+ cell.style = headerStyle;
+ }
+ worksheet.mergeCells(2, coreStartCol, 2, totalCols);
+ worksheet.getCell(2, coreStartCol).value = serviceTypeName;
+ worksheet.getCell(2, coreStartCol).style = headerStyle;
+
+ // 绗�3琛岋細闅忚鏍稿績鍒楋紙鐩爣鍖婚櫌鈥滃緟闅忚鈥濅笅宓屽鈥滃緟鍙戦��/宸插彂閫佲�濓級
+ worksheet.mergeCells(3, coreStartCol, headerEndRow, coreStartCol);
+ worksheet.getCell(3, coreStartCol).value = "闇�闅忚";
+ worksheet.getCell(3, coreStartCol).style = headerStyle;
+
+ worksheet.mergeCells(3, coreStartCol + 1, 3, coreStartCol + 2);
+ worksheet.getCell(3, coreStartCol + 1).value = "寰呴殢璁�";
+ worksheet.getCell(3, coreStartCol + 1).style = headerStyle;
+
+ worksheet.mergeCells(
+ 3,
+ coreStartCol + 3,
+ headerEndRow,
+ coreStartCol + 3
+ );
+ worksheet.getCell(3, coreStartCol + 3).value = "闅忚鎴愬姛";
+ worksheet.getCell(3, coreStartCol + 3).style = headerStyle;
+
+ ["鎴愬姛鐜�", "闅忚鐜�", "鍙婃椂鐜�"].forEach((label, i) => {
+ const col = coreStartCol + 4 + i;
+ worksheet.mergeCells(3, col, headerEndRow, col);
+ worksheet.getCell(3, col).value = label;
+ worksheet.getCell(3, col).style = headerStyle;
+ });
+
+ // 绗�4琛岋細寰呭彂閫�/宸插彂閫� 瀛愬垪
+ worksheet.getCell(4, coreStartCol + 1).value = "寰呭彂閫�";
+ worksheet.getCell(4, coreStartCol + 1).style = headerStyle;
+ worksheet.getCell(4, coreStartCol + 2).value = "宸插彂閫�";
+ worksheet.getCell(4, coreStartCol + 2).style = headerStyle;
+
+ let mc = methodStartCol;
+ methodGroups.forEach((g) => {
+ if (g.fields.length > 1) {
+ worksheet.mergeCells(3, mc, 3, mc + g.fields.length - 1);
+ }
+ const cell = worksheet.getCell(3, mc);
+ cell.value = g.label;
+ cell.style = headerStyle;
+ mc += g.fields.length;
+ });
+
+ // 绗�4琛岋細闅忚鏂瑰紡瀛愬垪锛堝彂閫佹暟/鎴愬姛鏁帮級
+ mc = methodStartCol;
+ methodGroups.forEach((g) => {
+ g.fields.forEach((field, idx) => {
+ const cell = worksheet.getCell(4, mc + idx);
+ cell.value = g.sub[idx];
+ cell.style = headerStyle;
+ });
+ mc += g.fields.length;
+ });
+
+ worksheet.getRow(2).height = 28;
+ worksheet.getRow(3).height = 24;
+ worksheet.getRow(4).height = 24;
+ } else {
+ // 琛ㄥご鍗� 2 琛岋紙绗�2/3琛岋級锛屾暟鎹粠绗�4琛屽紑濮�
+ const headerEndRow = 3;
+
+ for (let i = 1; i <= baseCount; i++) {
+ worksheet.mergeCells(2, i, headerEndRow, i);
+ const cell = worksheet.getCell(2, i);
+ cell.value = baseHeaders[i - 1];
+ cell.style = headerStyle;
+ }
+ worksheet.mergeCells(2, coreStartCol, 2, totalCols);
+ worksheet.getCell(2, coreStartCol).value = serviceTypeName;
+ worksheet.getCell(2, coreStartCol).style = headerStyle;
+
+ // 绗�3琛岋細闅忚鏍稿績鍒� + 闅忚鏂瑰紡鍒�
+ for (let k = 0; k < coreCount; k++) {
+ const cell = worksheet.getCell(3, coreStartCol + k);
+ cell.value = coreHeaders[k];
+ cell.style = headerStyle;
+ }
+ let mc = methodStartCol;
+ methodGroups.forEach((g) => {
+ const cell = worksheet.getCell(3, mc);
+ cell.value = g.label;
+ cell.style = headerStyle;
+ mc += 1;
+ });
+
+ worksheet.getRow(2).height = 28;
+ worksheet.getRow(3).height = 25;
}
- worksheet.getCell(2, 1).value = "";
- worksheet.getCell(2, 2).value = "鍑洪櫌鐥呭尯";
- worksheet.getCell(2, 3).value = "绉戝";
- worksheet.getCell(2, 4).value = "鍑洪櫌浜烘";
- worksheet.getCell(2, 5).value = "鏃犻渶闅忚浜烘";
- worksheet.getCell(2, 6).value = "搴旈殢璁夸汉娆�";
-
- worksheet.mergeCells(2, 7, 2, 16); // 浠�7鍚堝苟鍒�16锛堝師鏉ユ槸7-15锛�
- worksheet.getCell(2, 7).value = "棣栨鍑洪櫌闅忚";
- worksheet.getCell(2, 7).style = headerStyle;
-
- worksheet.getRow(2).height = 28;
- worksheet.getRow(3).height = 25;
-
// 鏁版嵁琛�
+ const dataStartRow = graded ? 5 : 4;
this.tableData.forEach((item, rowIndex) => {
- const dataRow = worksheet.addRow(
- [
- "",
- item.leavehospitaldistrictname || "",
- item.deptname || "",
- item.dischargeCount || 0,
- item.nonFollowUp || 0,
- item.followUpNeeded || 0,
- item.needFollowUp || 0,
- item.pendingFollowUp || 0,
- item.followUpSuccess || 0,
- item.followUpFail || 0,
- // 鎴愬姛鐜� - 闇�瑕佸姩鎬佽绠�
- this.calculateSuccessRate(
- item.followUpSuccess,
- item.needFollowUp,
- item.pendingFollowUp
- ),
- item.followUpRate || "0%", // 闅忚鐜�
- item.rate ? (Number(item.rate) * 100).toFixed(2) + "%" : "0%", // 鍙婃椂鐜�
- item.manual || 0,
- item.voice || 0, // 璇煶
- item.sms || 0, // 鐭俊
- item.weChat || 0, // 寰俊
- ],
- rowIndex + 4
- );
+ const rowValues = [
+ "",
+ item.leavehospitaldistrictname || "",
+ item.deptname || "",
+ item.dischargeCount || 0,
+ item.nonFollowUp || 0,
+ item.followUpNeeded || 0,
+ item.needFollowUp || 0,
+ // 寰呴殢璁匡細鐩爣鍖婚櫌鎷嗕负寰呭彂閫�/宸插彂閫侊紝鍏朵粬鐢ㄥ緟闅忚
+ ...(this.isTargetHospital
+ ? [item.pendingFollowUpWaitSend || 0, item.pendingFollowUpSent || 0]
+ : [item.pendingFollowUp || 0]),
+ item.followUpSuccess || 0,
+ // 闅忚澶辫触锛氱洰鏍囧尰闄笉鏄剧ず
+ ...(this.isTargetHospital ? [] : [item.followUpFail || 0]),
+ // 鎴愬姛鐜� - 闇�瑕佸姩鎬佽绠�
+ this.calculateSuccessRate(
+ item.followUpSuccess,
+ item.needFollowUp,
+ item.pendingFollowUp
+ ),
+ item.followUpRate || "0%", // 闅忚鐜�
+ this.getTimelyRateText(item), // 鍙婃椂鐜�
+ ];
+ methodGroups.forEach((g) => {
+ g.fields.forEach((field) => {
+ rowValues.push(item[field] || 0);
+ });
+ });
+
+ const dataRow = worksheet.addRow(rowValues, rowIndex + dataStartRow);
dataRow.eachCell((cell) => {
cell.style = cellStyle;
});
@@ -1753,24 +2298,43 @@
summaryRow.height = 28;
// 鍒楀
- worksheet.columns = [
- { width: 8 },
- { width: 20 },
- { width: 15 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 10 },
- { width: 10 },
- { width: 10 },
- { width: 10 },
- { width: 12 }, // 鎴愬姛鐜�
- { width: 12 }, // 闅忚鐜�
- { width: 12 }, // 鍙婃椂鐜�
- { width: 8 }, // 浜哄伐
- { width: 8 }, // 璇煶
- { width: 8 }, // 鐭俊
- { width: 8 }, // 寰俊
+ const widths = [8, 20, 15, 12, 12, 12, 10, 10, 10, 10, 12, 12, 12];
+ methodGroups.forEach((g) => {
+ g.fields.forEach(() => widths.push(8));
+ });
+ worksheet.columns = widths.map((width) => ({ width }));
+ },
+ getMethodColumns() {
+ // 闅忚鏂瑰紡鍒楅厤缃細鐩爣鍖婚櫌鎸夆�滃彂閫佹暟/鎴愬姛鏁扳�濆垎绾у睍绀�
+ if (this.isTargetHospital) {
+ return [
+ {
+ label: "浜哄伐",
+ fields: ["manual", "manualSuccess"],
+ sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+ },
+ {
+ label: "璇煶",
+ fields: ["voice", "voiceSuccess"],
+ sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+ },
+ {
+ label: "鐭俊",
+ fields: ["sms", "smsSuccess"],
+ sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+ },
+ {
+ label: "寰俊",
+ fields: ["weChat", "weChatSuccess"],
+ sub: ["鍙戦�佹暟", "鎴愬姛鏁�"],
+ },
+ ];
+ }
+ return [
+ { label: "浜哄伐", fields: ["manual"], sub: ["浜哄伐"] },
+ { label: "璇煶", fields: ["voice"], sub: ["璇煶"] },
+ { label: "鐭俊", fields: ["sms"], sub: ["鐭俊"] },
+ { label: "寰俊", fields: ["weChat"], sub: ["寰俊"] },
];
},
@@ -1783,37 +2347,47 @@
0, // 4: nonFollowUp
0, // 5: followUpNeeded
0, // 6: needFollowUp
- 0, // 7: pendingFollowUp
- 0, // 8: followUpSuccess
- 0, // 9: followUpFail
+ 0, // 7: 寰呭彂閫�/寰呴殢璁�
+ 0, // 8: 宸插彂閫�/闅忚鎴愬姛
+ 0, // 9: 闅忚鎴愬姛/闅忚澶辫触
"0%", // 10: 鎴愬姛鐜�
"0%", // 11: 闅忚鐜�
"0%", // 12: 鍙婃椂鐜�
- 0, // 13: manual
- 0, // 14: voice
- 0, // 15: sms
- 0, // 16: weChat
];
+
+ const methodFields = this.getMethodColumns().reduce(
+ (arr, g) => arr.concat(g.fields),
+ []
+ );
+ const methodStartIndex = 13;
+ methodFields.forEach(() => summaries.push(0));
this.tableData.forEach((item) => {
summaries[3] += Number(item.dischargeCount) || 0;
summaries[4] += Number(item.nonFollowUp) || 0;
summaries[5] += Number(item.followUpNeeded) || 0;
summaries[6] += Number(item.needFollowUp) || 0;
- summaries[7] += Number(item.pendingFollowUp) || 0;
- summaries[8] += Number(item.followUpSuccess) || 0;
- summaries[9] += Number(item.followUpFail) || 0;
- summaries[13] += Number(item.manual) || 0;
- summaries[14] += Number(item.voice) || 0;
- summaries[15] += Number(item.sms) || 0;
- summaries[16] += Number(item.weChat) || 0;
+ if (this.isTargetHospital) {
+ summaries[7] += Number(item.pendingFollowUpWaitSend) || 0;
+ summaries[8] += Number(item.pendingFollowUpSent) || 0;
+ summaries[9] += Number(item.followUpSuccess) || 0;
+ } else {
+ summaries[7] += Number(item.pendingFollowUp) || 0;
+ summaries[8] += Number(item.followUpSuccess) || 0;
+ summaries[9] += Number(item.followUpFail) || 0;
+ }
+ methodFields.forEach((field, i) => {
+ summaries[methodStartIndex + i] += Number(item[field]) || 0;
+ });
});
- // 鎴愬姛鐜囪绠�
- const totalSuccess = summaries[8]; // followUpSuccess鐨勬�诲拰
+ // 鎴愬姛鐜囪绠楋細闅忚鎴愬姛 / 闇�闅忚锛堢洰鏍囧尰闄級锛屽惁鍒� 闅忚鎴愬姛 / (闇�闅忚-寰呴殢璁�)
+ const totalSuccess = this.isTargetHospital ? summaries[9] : summaries[8];
const totalNeed = summaries[6]; // needFollowUp鐨勬�诲拰
- const totalPending = summaries[7]; // pendingFollowUp鐨勬�诲拰
- const denominator = totalNeed - totalPending;
+ const totalPending = summaries[7]; // 寰呭彂閫�/寰呴殢璁跨殑鎬诲拰
+ const denominator = this.isTargetHospital
+ ? totalNeed
+ : totalNeed - totalPending;
if (denominator > 0) {
summaries[10] = ((totalSuccess / denominator) * 100).toFixed(2) + "%";
@@ -1833,19 +2407,30 @@
summaries[11] = (avgFollowUpRate * 100).toFixed(2) + "%";
}
- // 鍙婃椂鐜囪绠�
- const rateValues = this.tableData
- .map((item) => this.extractPercentageValue(item.rate))
- .filter((value) => value !== null);
+ // 鍙婃椂鐜囪绠楋細鐩爣鍖婚櫌 (闇�闅忚-浜哄伐瓒呮椂)/闇�闅忚锛屽叾浠栧彇鍚庣 rate 骞冲潎
+ if (this.isTargetHospital) {
+ const totalTimeout = this.tableData.reduce(
+ (sum, item) => sum + (Number(item.manualCallTimeout) || 0),
+ 0
+ );
+ summaries[12] = this.calculateTimelyRate(totalNeed, totalTimeout);
+ } else {
+ const rateValues = this.tableData
+ .map((item) => this.extractPercentageValue(item.rate))
+ .filter((value) => value !== null);
- if (rateValues.length > 0) {
- const avgRate =
- rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length;
- summaries[12] = (avgRate * 100).toFixed(2) + "%";
+ if (rateValues.length > 0) {
+ const avgRate =
+ rateValues.reduce((sum, val) => sum + val, 0) / rateValues.length;
+ summaries[12] = (avgRate * 100).toFixed(2) + "%";
+ }
}
// 鏍煎紡鍖栨暟瀛�
- [3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16].forEach((index) => {
+ const numericIndices = [3, 4, 5, 6, 7, 8, 9].concat(
+ methodFields.map((_, i) => methodStartIndex + i)
+ );
+ numericIndices.forEach((index) => {
summaries[index] = this.formatNumber(summaries[index]);
});
@@ -1865,23 +2450,45 @@
selectTimelyRate(row, queryParams) {
console.log(row, queryParams, 88);
- // const params = {
- // ...this.patientqueryParams,
- // starttime: this.parseTime(dateRange[0]),
- // endtime: this.parseTime(dateRange[1]),
- // deptcode: row.deptcode,
- // };
- this.patientqueryParams.starttime = this.parseTime(
- queryParams.dateRange[0]
- );
- this.patientqueryParams.endtime = this.parseTime(
- queryParams.dateRange[1]
- );
- this.patientqueryParams.deptcode = row.deptcode;
- console.log(1);
+ // 搴旈殢璁挎椂闂磋寖鍥�
+ if (queryParams.endTime) {
+ this.patientqueryParams.starttime = queryParams.startTime;
+ this.patientqueryParams.endtime = queryParams.endTime;
+ } else {
+ this.patientqueryParams.starttime = this.parseTime(
+ queryParams.dateRange[0]
+ );
+ this.patientqueryParams.endtime = this.parseTime(
+ queryParams.dateRange[1]
+ );
+ }
+ // 鍑洪櫌鏃堕棿鑼冨洿
+ if (queryParams.hospitalEndTime) {
+ this.patientqueryParams.startOutHospTime =
+ queryParams.hospitalStartTime;
+ this.patientqueryParams.endOutHospTime = queryParams.hospitalEndTime;
+ } else {
+ this.patientqueryParams.startOutHospTime = this.parseTime(
+ queryParams.dateRangecy[0]
+ );
+ this.patientqueryParams.endOutHospTime = this.parseTime(
+ queryParams.dateRangecy[1]
+ );
+ }
+ // 缁熻绫诲瀷锛氱梾鍖虹粺璁�(1)浼犵梾鍖篶ode锛岀瀹ょ粺璁�(2)浼犵瀹ode
+ if (queryParams.statisticaltype == 1) {
+ this.patientqueryParams.leavehospitaldistrictcode =
+ row.leavehospitaldistrictcode;
+ this.patientqueryParams.deptcode = null;
+ } else {
+ this.patientqueryParams.deptcode = row.deptcode;
+ this.patientqueryParams.leavehospitaldistrictcode = null;
+ }
this.patientqueryParams.serviceTypes = queryParams.serviceType
- ? queryParams.serviceType.join(",")
+ ? Array.isArray(queryParams.serviceType)
+ ? queryParams.serviceType.join(",")
+ : String(queryParams.serviceType)
: null;
return selectTimelyRate(this.patientqueryParams);
--
Gitblit v1.9.3