From bb0a72311792bb57e1e90668c00f1c077d9f1761 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期四, 02 四月 2026 15:20:13 +0800
Subject: [PATCH] 测试完成
---
src/views/patient/patient/hospital.vue | 311 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 307 insertions(+), 4 deletions(-)
diff --git a/src/views/patient/patient/hospital.vue b/src/views/patient/patient/hospital.vue
index 6961289..fed951f 100644
--- a/src/views/patient/patient/hospital.vue
+++ b/src/views/patient/patient/hospital.vue
@@ -121,6 +121,18 @@
</el-col> -->
<el-col :span="1.5">
<el-button
+ type="warning"
+ plain
+ icon="el-icon-plus"
+ size="medium"
+ :disabled="multiple"
+ @click="handleBatchAddTask"
+ >
+ 娣诲姞寤剁画鎶ょ悊浠诲姟
+ </el-button>
+ </el-col>
+ <el-col :span="1.5">
+ <el-button
type="danger"
plain
icon="el-icon-delete"
@@ -323,7 +335,114 @@
/>
</el-col>
</el-row>
+ <!-- 鎵归噺娣诲姞浠诲姟寮圭獥 -->
+ <el-dialog
+ title="鎵归噺娣诲姞寤剁画鎶ょ悊"
+ :visible.sync="batchTaskVisible"
+ width="90%"
+ append-to-body
+ >
+ <el-row :gutter="20">
+ <!-- 宸︿晶锛氶�変腑鎮h�呭垪琛� -->
+ <el-col :span="12">
+ <div class="batch-patient-section">
+ <h4>閫変腑鎮h�咃紙{{ selectedPatients.length }}浜猴級</h4>
+ <el-table
+ :data="selectedPatients"
+ border
+ style="width: 100%"
+ size="small"
+ >
+ <el-table-column prop="patname" label="濮撳悕" width="100" />
+ <el-table-column prop="sex" label="鎬у埆" width="80">
+ <template slot-scope="scope">
+ {{ scope.row.sex === 1 ? "鐢�" : "濂�" }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鍑洪櫌鏃堕棿"
+ align="center"
+ key="endtime"
+ prop="endtime"
+ >
+ <template slot-scope="scope">
+ <span>{{ formatTime(scope.row.endtime) }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="inhospno" label="浣忛櫌鍙�" />
+ <el-table-column prop="deptname" label="绉戝" />
+ </el-table>
+ </div>
+ </el-col>
+ <!-- 鍙充晶锛氫换鍔″垪琛� -->
+ <el-col :span="12">
+ <div class="batch-task-section">
+ <h4>浠诲姟鍒楄〃锛堣閫夋嫨1涓换鍔★級</h4>
+ <el-table
+ :data="taskList"
+ border
+ style="width: 100%"
+ size="small"
+ @current-change="handleTaskSelectionChange"
+ highlight-current-row
+ >
+ <el-table-column
+ label="浠诲姟鍚嶇О"
+ fixed
+ align="center"
+ key="taskName"
+ prop="taskName"
+ :show-overflow-tooltip="true"
+ />
+
+ <el-table-column
+ label="鏈嶅姟椤圭洰"
+ align="center"
+ key="templatename"
+ prop="templatename"
+ :show-overflow-tooltip="true"
+ />
+
+ <el-table-column
+ label="鍒涘缓浜�"
+ align="center"
+ key="createBy"
+ prop="createBy"
+ :show-overflow-tooltip="true"
+ />
+ <el-table-column
+ label="鍒涘缓鏃堕棿"
+ sortable
+ align="center"
+ prop="createTime"
+ >
+ <template slot-scope="scope">
+ <span>{{ formatTime(scope.row.createTime) }}</span>
+ </template>
+ </el-table-column>
+ <template #empty>
+ <div class="empty-message">
+ <i class="el-icon-warning"></i>
+ <span>鎮h�呯瀹ゆ棤鍖归厤鏈嶅姟</span>
+ </div>
+ </template>
+ </el-table>
+ </div>
+ </el-col>
+ </el-row>
+
+ <!-- 搴曢儴鎸夐挳 -->
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="batchTaskVisible = false">鍙� 娑�</el-button>
+ <el-button
+ type="primary"
+ :loading="batchLoading"
+ @click="submitBatchTask"
+ >鍒涘缓浠诲姟</el-button
+ >
+ </div>
+ </el-dialog>
<!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
<el-dialog
:title="upload.title"
@@ -435,7 +554,7 @@
import Treeselect from "@riophae/vue-treeselect";
import { listDept } from "@/api/system/dept";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { query360PatInfo } from "@/api/AiCentre/index";
+import { query360PatInfo, getTasklist, addSubtask } from "@/api/AiCentre/index";
import store from "@/store";
@@ -470,6 +589,12 @@
// 榛樿瀵嗙爜
initPassword: undefined,
amendtag: false, //鏄惁淇敼
+ // 鎵归噺浠诲姟鐩稿叧鏁版嵁
+ batchTaskVisible: false, // 寮圭獥鍙鎬�
+ selectedPatients: [], // 閫変腑鐨勬偅鑰呭垪琛�
+ taskList: [], // 浠诲姟鍒楄〃
+ selectedTask: null, // 閫変腑鐨勪换鍔�
+ batchLoading: false, // 鎵归噺鎻愪氦鍔犺浇鐘舵��
// 鏃ユ湡鑼冨洿
dateRange: [],
source: [
@@ -630,6 +755,9 @@
this.queryParams.leaveldeptcodes = store.getters.belongDepts.map(
(obj) => obj.deptCode
);
+ this.queryParams.leavehospitaldistrictcodes = store.getters.belongWards.map(
+ (obj) => obj.districtCode
+ );
this.getList();
// this.listDept();
this.gettabList();
@@ -665,6 +793,144 @@
this.$modal.msgWarning("360鏌ヨ鏃犵粨鏋�");
}
});
+ },
+ /** 鎵归噺娣诲姞浠诲姟鎸夐挳鐐瑰嚮 */
+ handleBatchAddTask() {
+ // 鏍¢獙鏄惁閫変腑鎮h��
+ if (this.ids.length === 0) {
+ this.$modal.msgWarning("璇疯嚦灏戦�変腑1鍚嶆偅鑰�");
+ return;
+ }
+
+ // 鑾峰彇閫変腑鎮h�呯殑绉戝淇℃伅
+ const patientDepts = new Set();
+ let deptcode = "";
+ this.ids.forEach((patId) => {
+ const patient = this.userList.find((item) => item.patid === patId);
+ if (patient) {
+ patientDepts.add(patient.deptname);
+ deptcode = patient.deptcode;
+ }
+ });
+
+ // 鑾峰彇閫変腑鎮h�呭垪琛�
+ this.selectedPatients = this.userList.filter((item) =>
+ this.ids.includes(item.patid)
+ );
+
+ // 鏄剧ず寮圭獥
+ this.batchTaskVisible = true;
+
+ // 鑾峰彇浠诲姟鍒楄〃
+ this.loadTaskList(deptcode);
+ },
+
+ /** 鍔犺浇浠诲姟鍒楄〃 */
+ loadTaskList(deptcode) {
+ this.batchLoading = true;
+ let topqueryParams = {
+ pageNum: 1,
+ pageSize: 100, // 璁剧疆杈冨ぇ鐨勫垎椤佃幏鍙栨洿澶氫换鍔�
+ type: 2, // 鏍规嵁瀹為檯鎯呭喌璋冩暣
+ };
+
+ getTasklist(topqueryParams)
+ .then((response) => {
+ this.taskList = response.rows;
+ this.batchLoading = false;
+
+ if (this.taskList.length === 0) {
+ this.$modal.msgWarning("褰撳墠绉戝鏃犲彲鐢ㄤ换鍔�");
+ }
+ })
+ .catch((error) => {
+ this.$modal.msgError("鑾峰彇浠诲姟鍒楄〃澶辫触锛�" + error.message);
+ this.batchLoading = false;
+ });
+ },
+
+ /** 澶勭悊浠诲姟閫夋嫨鍙樺寲 */
+ handleTaskSelectionChange(currentRow) {
+ this.selectedTask = currentRow;
+ },
+
+ /** 鎵归噺鎻愪氦浠诲姟 */
+ async submitBatchTask() {
+ // 鏍¢獙鏄惁閫変腑浠诲姟
+ if (!this.selectedTask) {
+ this.$modal.msgWarning("璇烽�夋嫨1涓换鍔�");
+ return;
+ }
+
+ this.batchLoading = true;
+ const successPatients = [];
+ const failedPatients = [];
+ const errorMessages = [];
+
+ try {
+ // 閬嶅巻閫変腑鐨勬偅鑰咃紝閫愪釜璋冪敤鎺ュ彛
+ for (const patient of this.selectedPatients) {
+ const params = {
+ taskid: this.selectedTask.taskid,
+ type: this.selectedTask.type,
+ taskName: this.selectedTask.taskName,
+ serviceType: this.selectedTask.serviceType,
+ preachform: this.selectedTask.preachform,
+ templateid: this.selectedTask.templateid,
+ libtemplateid: this.selectedTask.libtemplateid,
+ sendstate: 2,
+ ...patient,
+ sendname: patient.patname,
+ endtime: patient.endtime ? patient.endtime + " 00:00:00" : "",
+ leavediagname: patient.leavediagname || patient.diagname || "",
+ age: patient.age || "",
+ };
+
+ try {
+ const response = await addSubtask(params);
+ if (response.code === 200) {
+ successPatients.push(patient.patname);
+ } else {
+ failedPatients.push(patient.patname);
+ errorMessages.push(
+ `${patient.patname}: ${response.msg || "娣诲姞澶辫触"}`
+ );
+ }
+ } catch (error) {
+ failedPatients.push(patient.patname);
+ errorMessages.push(
+ `${patient.patname}: ${error.message || "缃戠粶閿欒"}`
+ );
+ }
+ }
+
+ // 鏄剧ず澶勭悊缁撴灉
+ if (failedPatients.length === 0) {
+ this.$modal.msgSuccess(
+ `鎴愬姛涓� ${successPatients.length} 鍚嶆偅鑰呮坊鍔犱换鍔
+ );
+ } else {
+ this.$modal.msgWarning(
+ `鎴愬姛娣诲姞 ${successPatients.length} 浜猴紝澶辫触 ${failedPatients.length} 浜恒�俙 +
+ (errorMessages.length > 0
+ ? `澶辫触鍘熷洜锛�${errorMessages.join("; ")}`
+ : "")
+ );
+ }
+
+ this.batchTaskVisible = false;
+ this.getList(); // 鍒锋柊鎮h�呭垪琛�
+ } catch (error) {
+ this.$modal.msgError("鎵归噺娣诲姞浠诲姟杩囩▼涓嚭閿欙細" + error.message);
+ } finally {
+ this.batchLoading = false;
+ }
+ },
+
+ /** 鏍煎紡鍖栨椂闂� */
+ formatTime(time) {
+ if (!time) return "";
+ return time;
},
/** 鏌ヨ鏍囩鍒楄〃 */
gettabList() {
@@ -774,8 +1040,8 @@
leavehospitaldistrictcodes: [],
};
this.queryParams.leaveldeptcodes = store.getters.belongDepts.map(
- (obj) => obj.deptCode
- );
+ (obj) => obj.deptCode
+ );
this.handleQuery();
},
// 澶氶�夋閫変腑鏁版嵁
@@ -946,6 +1212,43 @@
}
}
.button-textsc {
- color: #3664D9;
+ color: #3664d9;
+}
+// 鎵归噺浠诲姟寮圭獥鏍峰紡
+.batch-patient-section,
+.batch-task-section {
+ h4 {
+ margin: 0 0 10px 0;
+ color: #606266;
+ font-size: 16px;
+ }
+}
+
+.empty-message {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px;
+ color: #909399;
+
+ i {
+ font-size: 24px;
+ margin-bottom: 8px;
+ }
+}
+
+.dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ padding-top: 20px;
+ border-top: 1px solid #ebeef5;
+}
+
+// 鍝嶅簲寮忚皟鏁�
+@media screen and (max-width: 1200px) {
+ .batch-patient-section,
+ .batch-task-section {
+ margin-bottom: 20px;
+ }
}
</style>
--
Gitblit v1.9.3