From bbbc478129f72b26e2ec4a2e981ed8698a96880c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 22 十月 2026 00:28:18 +0800
Subject: [PATCH] 当service_type=6时,需要根据传入的入院还是离院病区(病区)去后端查询
---
src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue | 186 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 148 insertions(+), 38 deletions(-)
diff --git a/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue b/src/views/Satisfaction/sfstatistics/components/FollowupStatistics.vue
index 1b59b49..e5eb304 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,10 +150,10 @@
@selection-change="handleSelectionChange"
:row-key="getRowKey"
>
- <!-- 鐥呭尯鍒� -->
+ <!-- 鐥呭尯鍒楋細浣忛櫌婊℃剰搴︾粺璁″湪闄㈢梾鍖猴紝鍏朵綑缁熻鍑洪櫌鐥呭尯 -->
<el-table-column
v-if="queryParams.statisticaltype == 1"
- label="鍑洪櫌鐥呭尯"
+ :label="wardColumnLabel"
align="center"
sortable
key="leavehospitaldistrictname"
@@ -148,7 +161,11 @@
:show-overflow-tooltip="true"
:sort-method="sortChineseNumber"
min-width="120"
- />
+ >
+ <template slot-scope="scope">
+ {{ getWardName(scope.row) || "-" }}
+ </template>
+ </el-table-column>
<!-- 绉戝鍒� -->
<el-table-column
@@ -199,13 +216,14 @@
scope.row.followUpRate !== undefined
"
>
- {{ formatPercent(scope.row.followUpRate) }}
+ {{ scope.row.followUpRate }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
+ v-if="orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
label="鍙婃椂鐜�"
align="center"
key="rate"
@@ -322,6 +340,7 @@
:row-data="currentRow"
:topicList="topiclist"
:query-params="queryParams"
+ :topType="2"
@close="topicVisible = false"
/>
</el-dialog>
@@ -347,6 +366,9 @@
},
data() {
return {
+ // 婊℃剰搴︾被鍨嬶細leave=绂婚櫌婊℃剰搴︼紙鎸夊嚭闄㈢梾鍖虹粺璁★級锛宧ospital=鍦ㄩ櫌婊℃剰搴︼紙鎸夊湪闄㈢梾鍖虹粺璁★級
+ satisfactionScope: "leave",
+
// 鏌ヨ鍙傛暟
queryParams: {
statisticaltype: 1,
@@ -371,7 +393,25 @@
flatArraydept: [],
// 鏈嶅姟绫诲瀷閫夐」
- options: [],
+ options: [
+ {
+ value: 6,
+ label: "浣忛櫌婊℃剰搴�",
+ raw: {
+ cssClass: "",
+ listClass: "",
+ },
+ },
+
+ {
+ value: 14,
+ label: "闂ㄨ瘖婊℃剰搴�",
+ raw: {
+ cssClass: "",
+ listClass: "",
+ },
+ },
+ ],
// 琛ㄦ牸鏁版嵁
userList: [],
@@ -381,6 +421,7 @@
// 鍔犺浇鐘舵��
loading: false,
+ orgname: "",
// 閫変腑鐨勮
ids: [],
@@ -438,7 +479,22 @@
};
},
+ computed: {
+ // 鏄惁鎸夈�屽湪闄㈡弧鎰忓害銆嶅彛寰勭粺璁★細鍦ㄩ櫌鎮h�呮寜鍦ㄩ櫌鐥呭尯(hospitaldistrictcodes)缁熻锛�
+ // 绂婚櫌婊℃剰搴︿粛鎸夊嚭闄㈢梾鍖�(leavehospitaldistrictcodes)缁熻
+ isInHospitalSatisfaction() {
+ return this.satisfactionScope === "hospital";
+ },
+
+ // 鐥呭尯鍒楁爣棰�
+ wardColumnLabel() {
+ return this.isInHospitalSatisfaction ? "鍦ㄩ櫌鐥呭尯" : "鍑洪櫌鐥呭尯";
+ },
+ },
+
created() {
+ this.orgname = localStorage.getItem("orgname");
+
this.initData();
},
@@ -446,7 +502,7 @@
// 鍒濆鍖栨暟鎹�
async initData() {
await this.getDeptTree();
- await this.getList();
+ // await this.getList();
},
// 鑾峰彇绉戝鏍�
@@ -501,16 +557,20 @@
// 澶勭悊鐥呭尯/绉戝閫夋嫨
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 = (this.$store.getters.belongWards || []).map(
+ (ward) => ward.districtCode
+ );
+ }
+ // 浣忛櫌婊℃剰搴﹂拡瀵瑰湪闄㈡偅鑰咃紝鎸夊湪闄㈢梾鍖�(hospitaldistrictcodes)缁熻锛�
+ // 鍑洪櫌闅忚绛夊叾浠栨湇鍔$被鍨嬩粛鎸夊嚭闄㈢梾鍖�(leavehospitaldistrictcodes)缁熻
+ delete params.leavehospitaldistrictcodes;
+ if (this.isInHospitalSatisfaction) {
+ params.hospitaldistrictcodes = wardCodes;
+ } else {
+ params.leavehospitaldistrictcodes = wardCodes;
}
} else if (params.statisticaltype == 2) {
// 绉戝缁熻
@@ -537,8 +597,8 @@
}
},
sortChineseNumber(aRow, bRow) {
- const a = aRow.leavehospitaldistrictname;
- const b = bRow.leavehospitaldistrictname;
+ const a = this.getWardName(aRow);
+ const b = this.getWardName(bRow);
// 涓枃鏁板瓧鍒伴樋鎷変集鏁板瓧鐨勬槧灏勶紙鎵╁睍鍒�45锛�
const chineseNumMap = {
@@ -698,14 +758,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;
@@ -725,6 +783,12 @@
// 澶勭悊鏌ヨ
handleQuery() {
+ this.queryParams.pageNum = 1;
+ this.getList();
+ },
+
+ // 鍒囨崲婊℃剰搴︾被鍨嬶紙绂婚櫌/鍦ㄩ櫌锛夊悗閲嶆柊鏌ヨ
+ handleSatisfactionScopeChange() {
this.queryParams.pageNum = 1;
this.getList();
},
@@ -766,8 +830,14 @@
// 鑾峰彇琛宬ey
getRowKey(row) {
return row.statisticaltype === 1
- ? row.leavehospitaldistrictcode
+ ? row.hospitaldistrictcode || row.leavehospitaldistrictcode
: row.deptcode;
+ },
+
+ // 鐥呭尯鍚嶇О锛氫綇闄㈡弧鎰忓害鎺ュ彛杩斿洖鍦ㄩ櫌鐥呭尯瀛楁锛屽叾浣欒繑鍥炲嚭闄㈢梾鍖哄瓧娈�
+ getWardName(row) {
+ if (!row) return "";
+ return row.hospitaldistrictname || row.leavehospitaldistrictname || "";
},
// 鏍煎紡鍖栫櫨鍒嗘瘮
@@ -805,8 +875,18 @@
}
if (this.queryParams.statisticaltype == 1) {
- this.topicvalue.name = row.leavehospitaldistrictname;
- params.leavehospitaldistrictcodes = [row.leavehospitaldistrictcode];
+ this.topicvalue.name = this.getWardName(row);
+ // 浣忛櫌婊℃剰搴︽寜鍦ㄩ櫌鐥呭尯缁熻锛屽叾浣欐寜鍑洪櫌鐥呭尯缁熻
+ if (this.isInHospitalSatisfaction) {
+ delete params.leavehospitaldistrictcodes;
+ params.hospitaldistrictcodes = [
+ row.hospitaldistrictcode || row.leavehospitaldistrictcode,
+ ];
+ } else {
+ params.leavehospitaldistrictcodes = [
+ row.leavehospitaldistrictcode,
+ ];
+ }
} else {
this.topicvalue.name = row.deptname;
params.deptcodes = [row.deptcode];
@@ -814,8 +894,7 @@
const response = await getSfStatisticsJoyInfo(params);
this.topiclist = response.data || [];
- this.topicVisible = true;
-
+ this.topicVisible = true;
} catch (error) {
console.error("鑾峰彇婊℃剰搴﹁鎯呭け璐�:", error);
this.$message.error("鑾峰彇璇︽儏澶辫触");
@@ -835,23 +914,54 @@
// 鏋勫缓鏃ユ湡鑼冨洿瀛楃涓�
let dateRangeString = "";
let sheetNameSuffix = "";
+ const isLishuiHospital = this.orgname == "涓芥按甯備腑鍖婚櫌";
if (
this.queryParams.dateRange &&
this.queryParams.dateRange.length === 2
) {
- const startDateFormatted = this.queryParams.dateRange[0];
- const endDateFormatted = this.queryParams.dateRange[1];
- dateRangeString = `${startDateFormatted}鑷�${endDateFormatted}`;
- sheetNameSuffix = `${startDateFormatted}鑷�${endDateFormatted}`;
+ const startDateStr = this.queryParams.dateRange[0];
+ const endDateStr = this.queryParams.dateRange[1];
+
+ if (isLishuiHospital) {
+ // 涓芥按甯備腑鍖婚櫌锛氬彧鏄剧ず骞存湀
+ const formatMonthOnly = (dateTimeStr) => {
+ const date = new Date(dateTimeStr);
+ const year = date.getFullYear();
+ const month = date.getMonth() + 1;
+ return `${year}骞�${month}鏈坄;
+ };
+ const startDateFormatted = formatMonthOnly(startDateStr);
+ const endDateFormatted = formatMonthOnly(endDateStr);
+ dateRangeString = `${startDateFormatted}鑷�${endDateFormatted}`;
+ sheetNameSuffix = `${startDateFormatted}鑷�${endDateFormatted}`;
+ } else {
+ // 鍏朵粬鍖婚櫌锛氭樉绀哄勾鏈堟棩
+ const formatDateForDisplay = (dateTimeStr) => {
+ return dateTimeStr.split(" ")[0];
+ };
+ const startDateFormatted = formatDateForDisplay(startDateStr);
+ const endDateFormatted = formatDateForDisplay(endDateStr);
+ dateRangeString = `${startDateFormatted}鑷�${endDateFormatted}`;
+ sheetNameSuffix = `${startDateFormatted}鑷�${endDateFormatted}`;
+ }
} else {
const now = new Date();
const currentMonth = now.getMonth() + 1;
- dateRangeString = `${currentMonth}鏈坄;
- sheetNameSuffix = `${currentMonth}鏈坄;
+ const currentYear = now.getFullYear();
+
+ if (isLishuiHospital) {
+ // 涓芥按甯備腑鍖婚櫌锛氭樉绀哄勾鏈�
+ dateRangeString = `${currentYear}骞�${currentMonth}鏈坄;
+ sheetNameSuffix = `${currentYear}骞�${currentMonth}鏈坄;
+ } else {
+ // 鍏朵粬鍖婚櫌锛氭樉绀烘湀浠�
+ dateRangeString = `${currentMonth}鏈坄;
+ sheetNameSuffix = `${currentMonth}鏈坄;
+ }
}
- const excelName = `闅忚缁熻琛╛${dateRangeString}.xlsx`;
+ const excelName = `婊℃剰搴﹂殢璁跨粺璁¤〃_${dateRangeString}.xlsx`;
const worksheetName = `闅忚缁熻_${sheetNameSuffix}`;
// 鍒涘缓Excel宸ヤ綔绨�
@@ -905,13 +1015,13 @@
// 娣诲姞鎬绘爣棰�
worksheet.mergeCells(1, 1, 1, 10);
const titleCell = worksheet.getCell(1, 1);
- titleCell.value = `闅忚缁熻琛紙${sheetNameSuffix}锛塦;
+ titleCell.value = `婊℃剰搴﹂殢璁跨粺璁¤〃锛�${sheetNameSuffix}锛塦;
titleCell.style = titleStyle;
worksheet.getRow(1).height = 35;
// 娣诲姞琛ㄥご
const headers = [
- this.queryParams.statisticaltype == 1 ? "鍑洪櫌鐥呭尯" : "绉戝",
+ this.queryParams.statisticaltype == 1 ? this.wardColumnLabel : "绉戝",
"鍑洪櫌浜烘",
"鏃犻渶闅忚浜烘",
"搴旈殢璁夸汉娆�",
@@ -932,7 +1042,7 @@
this.userList.forEach((item) => {
const dataRow = worksheet.addRow([
this.queryParams.statisticaltype == 1
- ? item.leavehospitaldistrictname
+ ? this.getWardName(item)
: item.deptname,
item.dischargeCount || 0,
item.nonFollowUp || 0,
--
Gitblit v1.9.3