From c0c976803550bd7d97bb1cb78244ff1f5de30521 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 03 十一月 2026 09:38:02 +0800
Subject: [PATCH] Merge branch 'subtask' of http://116.62.18.175:6699/r/~yxh/smartor-web into subtask
---
src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue | 717 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 618 insertions(+), 99 deletions(-)
diff --git a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
index f0534c0..d8687d5 100644
--- a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
+++ b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
@@ -9,6 +9,19 @@
label-width="100px"
class="query-form"
>
+ <el-form-item label="婊℃剰搴︾被鍨�" prop="satisfactionScope">
+ <el-select
+ v-model="satisfactionScope"
+ placeholder="榛樿鍦ㄩ櫌"
+ clearable
+ style="width: 150px"
+ @change="handleSatisfactionScopeChange"
+ >
+ <el-option label="绂婚櫌婊℃剰搴�" value="leave" />
+ <el-option label="鍦ㄩ櫌婊℃剰搴�" value="hospital" />
+ </el-select>
+ </el-form-item>
+
<el-form-item label="缁熻绫诲瀷" prop="statisticaltype">
<el-select
v-model="queryParams.statisticaltype"
@@ -137,29 +150,67 @@
@selection-change="handleSelectionChange"
:row-key="getRowKey"
>
- <!-- 鐥呭尯鍒� -->
+ <!-- 鐥呭尯缁熻锛氬湪闄㈢梾鍖� + 绂婚櫌鐥呭尯 -->
<el-table-column
v-if="queryParams.statisticaltype == 1"
- label="鍑洪櫌鐥呭尯"
+ label="鍦ㄩ櫌鐥呭尯"
+ align="center"
+ sortable
+ key="hospitaldistrictname"
+ prop="hospitaldistrictname"
+ :show-overflow-tooltip="true"
+ :sort-method="sortHospitalWard"
+ min-width="120"
+ >
+ <template slot-scope="scope">
+ {{ scope.row.hospitaldistrictname || "-" }}
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ v-if="queryParams.statisticaltype == 1"
+ label="绂婚櫌鐥呭尯"
align="center"
sortable
key="leavehospitaldistrictname"
prop="leavehospitaldistrictname"
:show-overflow-tooltip="true"
- :sort-method="sortChineseNumber"
+ :sort-method="sortLeaveWard"
min-width="120"
- />
+ >
+ <template slot-scope="scope">
+ {{ scope.row.leavehospitaldistrictname || "-" }}
+ </template>
+ </el-table-column>
- <!-- 绉戝鍒� -->
+ <!-- 绉戝缁熻锛氬湪闄㈢瀹� + 绂婚櫌绉戝 -->
<el-table-column
v-if="queryParams.statisticaltype == 2"
- label="绉戝"
+ label="鍦ㄩ櫌绉戝"
+ align="center"
+ key="hospitaldeptname"
+ prop="hospitaldeptname"
+ :show-overflow-tooltip="true"
+ min-width="120"
+ >
+ <template slot-scope="scope">
+ {{ scope.row.hospitaldeptname || "-" }}
+ </template>
+ </el-table-column>
+
+ <el-table-column
+ v-if="queryParams.statisticaltype == 2"
+ label="绂婚櫌绉戝"
align="center"
key="deptname"
prop="deptname"
:show-overflow-tooltip="true"
min-width="120"
- />
+ >
+ <template slot-scope="scope">
+ {{ scope.row.deptname || "-" }}
+ </template>
+ </el-table-column>
<el-table-column
label="鍑洪櫌浜烘"
@@ -338,6 +389,7 @@
} from "@/api/system/user";
import ExcelJS from "exceljs";
import { saveAs } from "file-saver";
+import { getTaskservelist } from "@/api/AiCentre/SingleTask";
import SeedetailsDialog from "./components/SeedetailsDialog.vue";
import TopicDialog from "./components/TopicDialog.vue";
@@ -347,14 +399,26 @@
SeedetailsDialog,
TopicDialog,
},
+ props: {
+ // 鏄惁鍦ㄩ《閮ㄧ敓鎴愭偅鑰呰〃鍗� / 闂璇︽儏鍒嗘瀽 tab锛堜粎婊℃剰搴︾粺璁′富椤靛紑鍚級
+ showAnalysisTabs: {
+ type: Boolean,
+ default: false,
+ },
+ },
data() {
return {
+ // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙鎸夊嚭闄㈢梾鍖虹粺璁★級锛宧ospital=鍦ㄩ櫌婊℃剰搴︼紙鎸夊湪闄㈢梾鍖虹粺璁★級
+ // 榛樿绂婚櫌婊℃剰搴�
+ satisfactionScope: "leave",
+
// 鏌ヨ鍙傛暟
queryParams: {
statisticaltype: 1,
leavehospitaldistrictcodes: ["all"],
deptcodes: [],
- serviceType: [2],
+ // 榛樿鏈嶅姟绫诲瀷锛�6=浣忛櫌婊℃剰搴︼紙鍑哄叆闄㈡弧鎰忓害锛�
+ serviceType: [6],
dateRange: [],
pageNum: 1,
pageSize: 20,
@@ -374,23 +438,23 @@
// 鏈嶅姟绫诲瀷閫夐」
options: [
- // {
- // value: 6,
- // label: "浣忛櫌婊℃剰搴�",
- // raw: {
- // cssClass: "",
- // listClass: "",
- // },
- // },
+ {
+ value: 6,
+ label: "鍑哄叆闄㈡弧鎰忓害",
+ raw: {
+ cssClass: "",
+ listClass: "",
+ },
+ },
- // {
- // value: 14,
- // label: "闂ㄨ瘖婊℃剰搴�",
- // raw: {
- // cssClass: "",
- // listClass: "",
- // },
- // },
+ {
+ value: 14,
+ label: "闂ㄨ瘖婊℃剰搴�",
+ raw: {
+ cssClass: "",
+ listClass: "",
+ },
+ },
],
// 琛ㄦ牸鏁版嵁
@@ -402,6 +466,10 @@
// 鍔犺浇鐘舵��
loading: false,
orgname: "",
+ // 宸插畬鎴愭槑缁嗚姹傚簭鍙凤紝閬垮厤蹇�熷垏鎹㈢瓫閫夋椂鏃ц姹傝鐩栨柊缁撴灉
+ completedRequestSeq: 0,
+ // 闂璇︽儏璇锋眰搴忓彿
+ questionRequestSeq: 0,
// 閫変腑鐨勮
ids: [],
@@ -459,10 +527,28 @@
};
},
+ computed: {
+ // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勭粺璁★細鍦ㄩ櫌鐢� hospitaldistrictcodes / hospitaldeptcodes锛�
+ // 绂婚櫌鐢� leavehospitaldistrictcodes / leaveldeptcodes
+ // 榛樿鍦ㄩ櫌锛屾墍浠ユ竻绌轰笅鎷夋椂浠嶆寜鍦ㄩ櫌鍙e緞澶勭悊
+ isInHospitalSatisfaction() {
+ return this.satisfactionScope !== "leave";
+ },
+ // patItem 鎺ュ彛鐨� serviceType 鍙帴鏀跺崟涓�硷紝澶氶�夋椂鍙栫涓�涓�
+ currentServiceType() {
+ const value = this.queryParams.serviceType;
+ const first = Array.isArray(value) ? value[0] : value;
+ return first || 6;
+ },
+ },
+
created() {
this.orgname = localStorage.getItem("orgname");
this.initData();
+ // 椤堕儴鎮h�呰〃鍗� / 闂璇︽儏鍒嗘瀽 tab锛氶粯璁ゆ寜褰撳墠缁熻鍙e緞鍔犺浇涓�娆�
+ this.maybeRefreshCompletedGroups();
+ this.maybeRefreshQuestionDetails();
},
methods: {
@@ -474,8 +560,11 @@
// 鑾峰彇绉戝鏍�
getDeptTree() {
- // 鑾峰彇鏈嶅姟绫诲瀷
- this.options = this.$store.getters.tasktypes || [];
+ // 鑾峰彇鏈嶅姟绫诲瀷锛堝瓧鍏搁噷鐨勩�屼綇闄㈡弧鎰忓害銆嶅湪鏈〉鏄剧ず涓恒�屽嚭鍏ラ櫌婊℃剰搴︺�嶏級
+ const labelFix = { 浣忛櫌婊℃剰搴�: "鍑哄叆闄㈡弧鎰忓害" };
+ this.options = (this.$store.getters.tasktypes || []).map((o) =>
+ labelFix[o.label] ? { ...o, label: labelFix[o.label] } : o
+ );
// 鑾峰彇绉戝鍒楄〃
this.flatArraydept = (this.$store.getters.belongDepts || []).map(
@@ -521,36 +610,56 @@
params.endTime = this.queryParams.dateRange[1];
}
- // 澶勭悊鐥呭尯/绉戝閫夋嫨
+ // 澶勭悊鐥呭尯/绉戝閫夋嫨锛氬彧淇濈暀褰撳墠缁熻绫诲瀷 + 褰撳墠婊℃剰搴︾被鍨嬪搴旂殑瀛楁锛�
+ // 閬垮厤鍦ㄩ櫌/绂婚櫌涓ゅ鏉′欢鍚屾椂鎷艰繘 SQL
if (params.statisticaltype == 1) {
// 鐥呭尯缁熻
- if (params.leavehospitaldistrictcodes.includes("all")) {
- // 濡傛灉閫夋嫨浜�"鍏ㄩ儴"锛屽垯绉婚櫎"all"鍊�
- params.leavehospitaldistrictcodes =
- params.leavehospitaldistrictcodes.filter(
- (item) => item !== "all"
- );
- // 濡傛灉闇�瑕佷紶鎵�鏈夌梾鍖轰唬鐮侊紝鍙互浠巗tore涓幏鍙�
- params.leavehospitaldistrictcodes = (
- this.$store.getters.belongWards || []
- ).map((ward) => ward.districtCode);
+ let wardCodes = params.leavehospitaldistrictcodes || [];
+ if (wardCodes.includes("all")) {
+ // 閫夋嫨"鍏ㄩ儴"鏃朵笉鍔犵梾鍖洪檺鍒讹紝鏌ュ叏閮ㄧ梾鍖�
+ wardCodes = [];
+ }
+ delete params.leavehospitaldistrictcodes;
+ delete params.hospitaldistrictcodes;
+ delete params.deptcodes;
+ delete params.leaveldeptcodes;
+ delete params.hospitaldeptcodes;
+ if (wardCodes.length) {
+ if (this.isInHospitalSatisfaction) {
+ params.hospitaldistrictcodes = wardCodes;
+ } else {
+ params.leavehospitaldistrictcodes = wardCodes;
+ }
}
} else if (params.statisticaltype == 2) {
// 绉戝缁熻
- if (params.deptcodes.includes("all")) {
- // 濡傛灉閫夋嫨浜�"鍏ㄩ儴"锛屽垯绉婚櫎"all"鍊�
- params.deptcodes = params.deptcodes.filter(
- (item) => item !== "all"
- );
- // 濡傛灉闇�瑕佷紶鎵�鏈夌瀹や唬鐮侊紝鍙互浠巗tore涓幏鍙�
- params.deptcodes = (this.$store.getters.belongDepts || []).map(
- (dept) => dept.deptCode
- );
+ let deptCodes = params.deptcodes || [];
+ if (deptCodes.includes("all")) {
+ // 閫夋嫨"鍏ㄩ儴"鏃朵笉鍔犵瀹ら檺鍒讹紝鏌ュ叏閮ㄧ瀹�
+ deptCodes = [];
+ } else {
+ deptCodes = deptCodes.filter((item) => item !== "all");
+ }
+ delete params.deptcodes;
+ delete params.leaveldeptcodes;
+ delete params.hospitaldeptcodes;
+ delete params.leavehospitaldistrictcodes;
+ delete params.hospitaldistrictcodes;
+ if (deptCodes.length) {
+ if (this.isInHospitalSatisfaction) {
+ params.hospitaldeptcodes = deptCodes;
+ } else {
+ params.leaveldeptcodes = deptCodes;
+ }
}
}
const response = await getSfStatisticsJoy(params);
- this.userList = this.customSort(response.data) || [];
+ // 绉戝缁熻鎸夋帴鍙h繑鍥為『搴忥紝鐥呭尯缁熻淇濇寔鍘熸湁鐨勪腑鏂囧簭鍙锋帓搴�
+ this.userList =
+ this.queryParams.statisticaltype == 1
+ ? this.customSort(response.data) || []
+ : response.data || [];
this.total = response.total || 0;
} catch (error) {
console.error("鑾峰彇缁熻鍒楄〃澶辫触:", error);
@@ -560,9 +669,22 @@
}
},
sortChineseNumber(aRow, bRow) {
- const a = aRow.leavehospitaldistrictname;
- const b = bRow.leavehospitaldistrictname;
-
+ return this.compareWardNames(this.getWardName(aRow), this.getWardName(bRow));
+ },
+ sortHospitalWard(aRow, bRow) {
+ return this.compareWardNames(
+ aRow && aRow.hospitaldistrictname,
+ bRow && bRow.hospitaldistrictname
+ );
+ },
+ sortLeaveWard(aRow, bRow) {
+ return this.compareWardNames(
+ aRow && aRow.leavehospitaldistrictname,
+ bRow && bRow.leavehospitaldistrictname
+ );
+ },
+ // 姣旇緝涓や釜鐥呭尯鍚嶇О鐨勪腑鏂囧簭鍙凤紱鏃犲簭鍙锋椂鎸夊瓧绗︿覆姣旇緝
+ compareWardNames(a, b) {
// 涓枃鏁板瓧鍒伴樋鎷変集鏁板瓧鐨勬槧灏勶紙鎵╁睍鍒�45锛�
const chineseNumMap = {
涓�: 1,
@@ -721,14 +843,12 @@
return -1;
};
- const indexA = getIndex(a.leavehospitaldistrictname);
- const indexB = getIndex(b.leavehospitaldistrictname);
+ const indexA = getIndex(this.getWardName(a));
+ const indexB = getIndex(this.getWardName(b));
// 鎺掑簭閫昏緫
if (indexA === -1 && indexB === -1) {
- return (a.leavehospitaldistrictname || "").localeCompare(
- b.leavehospitaldistrictname || ""
- );
+ return this.getWardName(a).localeCompare(this.getWardName(b));
}
if (indexA === -1) return 1;
if (indexB === -1) return -1;
@@ -744,26 +864,388 @@
}
this.queryParams.pageNum = 1;
this.getList();
+ this.maybeRefreshCompletedGroups();
+ this.maybeRefreshQuestionDetails();
},
// 澶勭悊鏌ヨ
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
+ this.maybeRefreshCompletedGroups();
+ this.maybeRefreshQuestionDetails();
},
- // 閲嶇疆鏌ヨ
+ // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+ handleSatisfactionScopeChange() {
+ this.queryParams.pageNum = 1;
+ this.getList();
+ this.maybeRefreshCompletedGroups();
+ this.maybeRefreshQuestionDetails();
+ },
+
+ /**
+ * 椤堕儴銆屽凡瀹屾垚鎮h�呮槑缁嗐�峵ab 鏁版嵁
+ * 缁村害娌跨敤涓嬫柟銆岀粺璁$被鍨嬨�嶏細鐥呭尯缁熻 -> 鎸夌梾鍖哄垎缁勶紱绉戝缁熻 -> 鎸夌瀹ゅ垎缁�
+ * 鏃堕棿娌跨敤涓嬫柟銆岄殢璁挎椂闂淬�嶏紝鐘舵�佸浐瀹氫负宸插畬鎴�
+ */
+ maybeRefreshCompletedGroups() {
+ if (this.showAnalysisTabs) {
+ this.refreshCompletedGroups();
+ }
+ },
+
+ async refreshCompletedGroups() {
+ const seq = ++this.completedRequestSeq;
+ const payload = this.buildCompletedPayload();
+
+ // 娌℃湁绉戝/鐥呭尯鏉冮檺鏃朵笉鍙戣捣璇锋眰锛岄伩鍏嶆妸鍏ㄩ噺鏁版嵁鏌ュ嚭鏉�
+ if (!payload) {
+ this.emitCompletedGroups([], seq);
+ return;
+ }
+
+ this.$emit("completed-rows-change", {
+ ...this.buildCompletedMeta(),
+ loading: true,
+ });
+
+ try {
+ const res = await getTaskservelist(payload);
+ if (seq !== this.completedRequestSeq) return;
+
+ const rows = this.pickCompletedRows(res);
+ this.emitCompletedGroups(rows, seq);
+ } catch (error) {
+ if (seq !== this.completedRequestSeq) return;
+ console.error("鑾峰彇宸插畬鎴愭偅鑰呮槑缁嗗け璐�:", error);
+ this.emitCompletedGroups([], seq);
+ }
+ },
+
+ // 缁勮绗竴寮犮�屾弧鎰忓害鐘舵�佹煡璇€�嶉〉鍚屾鏌ヨ鏉′欢
+ buildCompletedPayload() {
+ const scope = this.buildCompletedScope();
+ if (!scope.all && !scope.depts.length && !scope.wards.length) {
+ return null;
+ }
+
+ const payload = {
+ pageNum: null,
+ pageSize: null,
+ sendstate: null,
+ sendstateView: 2, // 2 = 宸插畬鎴�
+ sort: 2,
+ serviceType: this.currentServiceType,
+ searchscope: scope.searchscope,
+ visitCount: 1,
+ scopetype: [],
+ // 涓庣涓�寮犲浘涓�鑷达細閫変簡鍏蜂綋绉戝/鐥呭尯鏃跺彧浼犲搴旂淮搴︼紱銆屽叏閮ㄣ�嶆椂涓や釜缁村害閮戒紶
+ deptOrDistrict: scope.deptOrDistrict,
+ };
+
+ // 鍦ㄩ櫌婊℃剰搴︾敤 hospital*锛岀闄㈡弧鎰忓害鐢� leave*
+ if (this.satisfactionScope === "hospital") {
+ if (scope.depts.length) {
+ payload.deptcodes = scope.depts;
+ }
+ if (scope.wards.length) {
+ payload.hospitaldistrictcodes = scope.wards;
+ }
+ } else {
+ if (scope.depts.length) {
+ payload.leaveldeptcodes = scope.depts;
+ }
+ if (scope.wards.length) {
+ payload.leavehospitaldistrictcodes = scope.wards;
+ }
+ }
+
+ const range = this.queryParams.dateRange || [];
+ if (range.length === 2 && range[0] && range[1]) {
+ payload.finishtimeStart = range[0];
+ payload.finishtimeEnd = range[1];
+ }
+
+ return payload;
+ },
+
+ // 缁勮鏌ヨ鑼冨洿锛氱粺璁$被鍨嬪喅瀹氭寜鐥呭尯杩樻槸绉戝杩囨护
+ buildCompletedScope() {
+ const allDepts = (this.$store.getters.belongDepts || [])
+ .map((dept) => dept.deptCode)
+ .filter(Boolean);
+ const allWards = (this.$store.getters.belongWards || [])
+ .map((ward) => ward.districtCode)
+ .filter(Boolean);
+
+ // 鐥呭尯缁熻锛堝惈缁熻绫诲瀷涓虹┖鐨勬儏鍐碉級
+ if (this.queryParams.statisticaltype != 2) {
+ const rawSelected = this.queryParams.leavehospitaldistrictcodes || [];
+ const selected = rawSelected.filter(
+ (code) => code && code !== "all"
+ );
+ const useAll = !rawSelected.length || rawSelected.includes("all");
+
+ if (!useAll && selected.length) {
+ return {
+ depts: [],
+ wards: selected,
+ deptOrDistrict: 1,
+ searchscope: 2,
+ };
+ }
+ // 鍏ㄩ儴锛氫笉浼犵梾鍖�/绉戝缂栫爜锛岀敱鍚庣杩斿洖褰撳墠鏈烘瀯鍏ㄩ儴鏁版嵁
+ return {
+ depts: [],
+ wards: [],
+ deptOrDistrict: 2,
+ searchscope: 3,
+ all: true,
+ };
+ }
+
+ // 绉戝缁熻
+ const rawSelected = this.queryParams.deptcodes || [];
+ const selected = rawSelected.filter((code) => code && code !== "all");
+ const useAll = !rawSelected.length || rawSelected.includes("all");
+ if (!useAll && selected.length) {
+ return {
+ depts: selected,
+ wards: [],
+ deptOrDistrict: 1,
+ searchscope: 1,
+ };
+ }
+ return {
+ depts: [],
+ wards: [],
+ deptOrDistrict: 2,
+ searchscope: 3,
+ all: true,
+ };
+ },
+
+ // 闂璇︽儏鍗犳瘮 / 鍥捐〃 / 楗煎浘 鍏辩敤鏁版嵁
+ maybeRefreshQuestionDetails() {
+ if (this.showAnalysisTabs) {
+ this.refreshQuestionDetails();
+ }
+ },
+
+ async refreshQuestionDetails() {
+ const seq = ++this.questionRequestSeq;
+ const payload = this.buildQuestionPayload();
+
+ if (!payload) {
+ this.$emit("question-details-change", { loading: false, list: [] });
+ return;
+ }
+
+ this.$emit("question-details-change", { loading: true });
+
+ try {
+ const res = await getSfStatisticsJoyInfo(payload);
+ if (seq !== this.questionRequestSeq) return;
+
+ this.$emit("question-details-change", {
+ loading: false,
+ list: res.data || [],
+ });
+ } catch (error) {
+ if (seq !== this.questionRequestSeq) return;
+ console.error("鑾峰彇闂璇︽儏鍗犳瘮澶辫触:", error);
+ this.$emit("question-details-change", { loading: false, list: [] });
+ }
+ },
+
+ buildQuestionPayload() {
+ const scope = this.buildCompletedScope();
+ if (!scope.all && !scope.depts.length && !scope.wards.length) {
+ return null;
+ }
+
+ const params = {
+ configKey: "joyCount",
+ statisticaltype: this.queryParams.statisticaltype,
+ serviceType: this.queryParams.serviceType,
+ searchscope: scope.searchscope,
+ pageNum: 1,
+ pageSize: 999,
+ };
+
+ const range = this.queryParams.dateRange || [];
+ if (range.length === 2 && range[0] && range[1]) {
+ params.startTime = range[0];
+ params.endTime = range[1];
+ }
+
+ if (this.queryParams.statisticaltype == 2) {
+ if (scope.depts.length) {
+ if (this.isInHospitalSatisfaction) {
+ params.hospitaldeptcodes = scope.depts;
+ } else {
+ params.leaveldeptcodes = scope.depts;
+ }
+ }
+ } else if (scope.wards.length) {
+ if (this.isInHospitalSatisfaction) {
+ params.hospitaldistrictcodes = scope.wards;
+ } else {
+ params.leavehospitaldistrictcodes = scope.wards;
+ }
+ }
+
+ return params;
+ },
+
+ // 鍏煎鎺ュ彛涓嶅悓鐨勮繑鍥炲眰绾�
+ pickCompletedRows(res) {
+ if (!res) return [];
+ const rowsWrap = res.rows || (res.data && res.data.rows);
+ let list = [];
+
+ if (Array.isArray(rowsWrap) && rowsWrap[0]) {
+ list =
+ rowsWrap[0].serviceSubtaskList ||
+ (rowsWrap[0].sendname ? rowsWrap : []);
+ } else if (res.data && Array.isArray(res.data.serviceSubtaskList)) {
+ list = res.data.serviceSubtaskList;
+ } else if (Array.isArray(res.data)) {
+ list = res.data;
+ }
+
+ return (list || [])
+ .filter(Boolean)
+ .map((row) => this.normalizeCompletedRow(row));
+ },
+
+ normalizeCompletedRow(row) {
+ const item = { ...row };
+ if (item.endtime) {
+ item.endDay = this.daysBetween(item.endtime);
+ }
+ return item;
+ },
+
+ emitCompletedGroups(rows, seq) {
+ if (seq !== this.completedRequestSeq) return;
+ this.$emit("completed-rows-change", {
+ ...this.buildCompletedMeta(),
+ loading: false,
+ total: rows.length,
+ rows,
+ });
+ },
+
+ buildCompletedMeta() {
+ return {
+ dimension:
+ this.queryParams.statisticaltype == 2 ? "dept" : "ward",
+ scope: this.satisfactionScope,
+ dateRange: [...(this.queryParams.dateRange || [])],
+ };
+ },
+
+ // 鎸夊綋鍓嶇粺璁$被鍨嬪垎缁勶細鐥呭尯缁熻 -> 鐥呭尯锛岀瀹ょ粺璁� -> 绉戝
+ groupCompletedRows(rows) {
+ const dimension =
+ this.queryParams.statisticaltype == 2 ? "dept" : "ward";
+ const groupMap = new Map();
+
+ (rows || []).forEach((row) => {
+ const name =
+ dimension === "ward" ? this.wardNameOf(row) : this.deptNameOf(row);
+ const code =
+ dimension === "ward"
+ ? this.wardCodeOf(row)
+ : this.deptCodeOf(row);
+
+ const key = String(code || name || "unknown");
+ if (!groupMap.has(key)) {
+ groupMap.set(key, {
+ key,
+ label:
+ name || (dimension === "ward" ? "鏈垎鐥呭尯" : "鏈垎绉戝"),
+ rows: [],
+ });
+ }
+ groupMap.get(key).rows.push(row);
+ });
+
+ const orderMap = this.buildGroupOrder(dimension);
+ return Array.from(groupMap.values()).sort((a, b) => {
+ const aIndex = orderMap.has(a.key) ? orderMap.get(a.key) : 99999;
+ const bIndex = orderMap.has(b.key) ? orderMap.get(b.key) : 99999;
+ if (aIndex !== bIndex) return aIndex - bIndex;
+ return a.label.localeCompare(b.label, "zh-Hans-CN");
+ });
+ },
+
+ // tab 椤哄簭鎸夐〉闈㈠乏渚х瀹�/鐥呭尯鏉冮檺鍒楄〃鐨勯『搴忥紝淇濊瘉銆屼竴鐥呭尯銆佷簩鐥呭尯鈥︺�嶇殑鑷劧椤哄簭
+ buildGroupOrder(dimension) {
+ const list =
+ dimension === "ward"
+ ? this.$store.getters.belongWards
+ : this.$store.getters.belongDepts;
+ const orderMap = new Map();
+
+ (list || []).forEach((item, index) => {
+ const code =
+ dimension === "ward" ? item.districtCode : item.deptCode;
+ if (code) orderMap.set(String(code), index);
+ });
+
+ return orderMap;
+ },
+
+ wardNameOf(row) {
+ if (!row) return "";
+ const name =
+ this.satisfactionScope === "hospital"
+ ? row.hospitaldistrictname || row.leavehospitaldistrictname
+ : row.leavehospitaldistrictname || row.hospitaldistrictname;
+ return name === "-" ? "" : name;
+ },
+
+ wardCodeOf(row) {
+ if (!row) return "";
+ return this.satisfactionScope === "hospital"
+ ? row.hospitaldistrictcode || row.leavehospitaldistrictcode
+ : row.leavehospitaldistrictcode || row.hospitaldistrictcode;
+ },
+
+ deptNameOf(row) {
+ if (!row) return "";
+ const name =
+ this.satisfactionScope === "hospital"
+ ? row.deptname || row.leaveldeptname
+ : row.leaveldeptname || row.deptname;
+ return name === "-" ? "" : name;
+ },
+
+ deptCodeOf(row) {
+ if (!row) return "";
+ return this.satisfactionScope === "hospital"
+ ? row.hospitaldeptcode || row.deptcode
+ : row.deptcode || row.hospitaldeptcode;
+ },
+
+ // 閲嶇疆鏌ヨ锛堟仮澶嶉粯璁わ細绂婚櫌婊℃剰搴� + 鏈嶅姟绫诲瀷 6锛�
resetQuery() {
+ this.satisfactionScope = "leave";
this.queryParams = {
statisticaltype: 1,
leavehospitaldistrictcodes: [],
deptcodes: [],
- serviceType: [2],
+ serviceType: [6],
dateRange: [],
pageNum: 1,
pageSize: 20,
};
this.getList();
+ this.maybeRefreshCompletedGroups();
+ this.maybeRefreshQuestionDetails();
},
// 澶勭悊鍒嗛〉澶у皬鍙樺寲
@@ -786,11 +1268,19 @@
this.multiple = !selection.length;
},
- // 鑾峰彇琛宬ey
+ // 鑾峰彇琛宬ey锛堟寜褰撳墠缁熻绫诲瀷鍙栧搴旂淮搴︾紪鐮侊級
getRowKey(row) {
- return row.statisticaltype === 1
- ? row.leavehospitaldistrictcode
- : row.deptcode;
+ return this.queryParams.statisticaltype == 1
+ ? row.hospitaldistrictcode || row.leavehospitaldistrictcode
+ : row.hospitaldeptcode || row.deptcode;
+ },
+
+ // 褰撳墠婊℃剰搴︾被鍨嬪搴旂殑鐥呭尯鍚嶇О锛堢敤浜庢帓搴�/瀵煎嚭/璇︽儏鏍囬锛�
+ getWardName(row) {
+ if (!row) return "";
+ return this.isInHospitalSatisfaction
+ ? row.hospitaldistrictname || ""
+ : row.leavehospitaldistrictname || "";
},
// 鏍煎紡鍖栫櫨鍒嗘瘮
@@ -827,12 +1317,33 @@
params.endTime = this.queryParams.dateRange[1];
}
+ // 璇︽儏鍙寜褰撳墠鍒嗙粍缁村害杩囨护锛屾竻鎺夊叾浣欑淮搴︼紝閬垮厤鍦ㄩ櫌/绂婚櫌鏉′欢浜掔浉骞叉壈
+ delete params.deptcodes;
+ delete params.leaveldeptcodes;
+ delete params.hospitaldeptcodes;
+ delete params.leavehospitaldistrictcodes;
+ delete params.hospitaldistrictcodes;
+
if (this.queryParams.statisticaltype == 1) {
- this.topicvalue.name = row.leavehospitaldistrictname;
- params.leavehospitaldistrictcodes = [row.leavehospitaldistrictcode];
+ if (this.isInHospitalSatisfaction) {
+ this.topicvalue.name = row.hospitaldistrictname || "-";
+ params.hospitaldistrictcodes = [row.hospitaldistrictcode].filter(
+ Boolean
+ );
+ } else {
+ this.topicvalue.name = row.leavehospitaldistrictname || "-";
+ params.leavehospitaldistrictcodes = [
+ row.leavehospitaldistrictcode,
+ ].filter(Boolean);
+ }
} else {
- this.topicvalue.name = row.deptname;
- params.deptcodes = [row.deptcode];
+ if (this.isInHospitalSatisfaction) {
+ this.topicvalue.name = row.hospitaldeptname || "-";
+ params.hospitaldeptcodes = [row.hospitaldeptcode].filter(Boolean);
+ } else {
+ this.topicvalue.name = row.deptname || "-";
+ params.leaveldeptcodes = [row.deptcode].filter(Boolean);
+ }
}
const response = await getSfStatisticsJoyInfo(params);
@@ -955,25 +1466,29 @@
},
};
- // 娣诲姞鎬绘爣棰�
- worksheet.mergeCells(1, 1, 1, 10);
- const titleCell = worksheet.getCell(1, 1);
- titleCell.value = `婊℃剰搴﹂殢璁跨粺璁¤〃锛�${sheetNameSuffix}锛塦;
- titleCell.style = titleStyle;
- worksheet.getRow(1).height = 35;
-
- // 娣诲姞琛ㄥご
+ // 琛ㄥご鎸夐〉闈㈠垪鍔ㄦ�佺敓鎴愶細绉戝/鐥呭尯缁熻鍒椾笉鍚岋紝銆屽強鏃剁巼銆嶅彧鏈夋櫙瀹侀櫌鍖洪〉闈㈡墠鏄剧ず
+ const isWardStatistics = this.queryParams.statisticaltype == 1;
+ const showTimelyRate = this.orgname === "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�";
const headers = [
- this.queryParams.statisticaltype == 1 ? "鍑洪櫌鐥呭尯" : "绉戝",
+ isWardStatistics ? "鍦ㄩ櫌鐥呭尯" : "鍦ㄩ櫌绉戝",
+ isWardStatistics ? "绂婚櫌鐥呭尯" : "绂婚櫌绉戝",
"鍑洪櫌浜烘",
"鏃犻渶闅忚浜烘",
"搴旈殢璁夸汉娆�",
"闅忚鐜�",
- "鍙婃椂鐜�",
- "婊℃剰搴﹂鐩�婚噺",
- "婊℃剰搴﹀~鎶ラ噺",
- "瀹屾垚姣旂巼",
];
+ if (showTimelyRate) {
+ headers.push("鍙婃椂鐜�");
+ }
+ headers.push("婊℃剰搴﹂鐩�婚噺", "婊℃剰搴﹀~鎶ラ噺", "瀹屾垚姣旂巼");
+ const colCount = headers.length;
+
+ // 娣诲姞鎬绘爣棰�
+ worksheet.mergeCells(1, 1, 1, colCount);
+ const titleCell = worksheet.getCell(1, 1);
+ titleCell.value = `婊℃剰搴﹂殢璁跨粺璁¤〃锛�${sheetNameSuffix}锛塦;
+ titleCell.style = titleStyle;
+ worksheet.getRow(1).height = 35;
const headerRow = worksheet.addRow(headers);
headerRow.eachCell((cell) => {
@@ -981,21 +1496,33 @@
});
headerRow.height = 25;
- // 娣诲姞鏁版嵁琛�
+ // 娣诲姞鏁版嵁琛岋紙绌哄�肩粺涓�鏄剧ず鈥�-鈥濓紝涓庨〉闈繚鎸佷竴鑷达級
+ const dash = (v, formatter) => {
+ if (v === null || v === undefined || v === "") return "-";
+ return formatter ? formatter(v) : v;
+ };
this.userList.forEach((item) => {
- const dataRow = worksheet.addRow([
- this.queryParams.statisticaltype == 1
- ? item.leavehospitaldistrictname
- : item.deptname,
+ const rowData = [
+ isWardStatistics
+ ? item.hospitaldistrictname || "-"
+ : item.hospitaldeptname || "-",
+ isWardStatistics
+ ? item.leavehospitaldistrictname || "-"
+ : item.deptname || "-",
item.dischargeCount || 0,
item.nonFollowUp || 0,
item.followUpNeeded || 0,
- item.followUpRate || "0%",
- item.rate ? this.formatPercent(item.rate) : "0%",
+ dash(item.followUpRate),
+ ];
+ if (showTimelyRate) {
+ rowData.push(dash(item.rate, (v) => this.formatPercent(v)));
+ }
+ rowData.push(
item.joyAllCount || 0,
item.joyCount || 0,
- item.joyTotal ? this.formatPercent(item.joyTotal) : "0%",
- ]);
+ dash(item.joyTotal, (v) => this.formatPercent(v))
+ );
+ const dataRow = worksheet.addRow(rowData);
dataRow.eachCell((cell) => {
cell.style = cellStyle;
@@ -1003,18 +1530,10 @@
dataRow.height = 22;
});
- // 璁剧疆鍒楀
- worksheet.columns = [
- { width: 20 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 12 },
- { width: 15 },
- { width: 15 },
- { width: 12 },
- ];
+ // 璁剧疆鍒楀锛堣窡鍒楁暟涓�鑷达級
+ worksheet.columns = headers.map((h, i) => ({
+ width: i < 2 ? 20 : h.length > 6 ? 15 : 12,
+ }));
// 鐢熸垚骞朵笅杞芥枃浠�
const buffer = await workbook.xlsx.writeBuffer();
--
Gitblit v1.9.3