From c899dff1fce7f8054008cd9887a9729cdffd88cb Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期四, 19 十一月 2026 11:34:32 +0800
Subject: [PATCH] 测试完成

---
 src/views/patient/patient/hospital.vue |  212 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 191 insertions(+), 21 deletions(-)

diff --git a/src/views/patient/patient/hospital.vue b/src/views/patient/patient/hospital.vue
index 69db263..fbe5da3 100644
--- a/src/views/patient/patient/hospital.vue
+++ b/src/views/patient/patient/hospital.vue
@@ -60,6 +60,8 @@
               v-model="queryParams.scopetype"
               placeholder="榛樿鍏ㄩ儴绉戝"
               :options="sourcetype"
+              filterable
+              clearable
               :props="{ expandTrigger: 'hover' }"
               @change="handleChange"
             ></el-cascader>
@@ -74,6 +76,17 @@
               start-placeholder="寮�濮嬫棩鏈�"
               end-placeholder="缁撴潫鏃ユ湡"
             ></el-date-picker>
+          </el-form-item>
+          <el-form-item label="搴婂彿鎺掑簭" prop="bedSort">
+            <el-select
+              v-model="queryParams.bedSort"
+              placeholder="涓嶆寜搴婂彿鎺掑簭"
+              style="width: 160px"
+            >
+              <el-option label="涓嶆寜搴婂彿鎺掑簭" :value="null"></el-option>
+              <el-option label="鎸夊簥鍙锋搴�" :value="1"></el-option>
+              <el-option label="鎸夊簥鍙峰�掑簭" :value="2"></el-option>
+            </el-select>
           </el-form-item>
 
           <el-row>
@@ -115,7 +128,7 @@
               size="medium"
               :disabled="single"
               @click="handleUpdate"
-              v-hasPermi="['system:user:edit']"
+
               >淇敼</el-button
             >
           </el-col> -->
@@ -129,6 +142,20 @@
               @click="handleBatchAddTask"
             >
               娣诲姞寤剁画鎶ょ悊浠诲姟
+            </el-button>
+          </el-col>
+          <!-- 璇煶鏈嶅姟杞汉宸ユ寜閽� -->
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              plain
+              icon="el-icon-refresh-right"
+              size="medium"
+              :disabled="multiple"
+              v-if="orgname === '绗竴浜烘皯鍖婚櫌婀栨花闄㈠尯'||orgname === '绗竴浜烘皯鍖婚櫌鍚村北闄㈠尯'||orgname === '绗竴浜烘皯鍖婚櫌鍩庝笢闄㈠尯'"
+              @click="handleManualVisit"
+            >
+              璇煶鏈嶅姟杞汉宸�
             </el-button>
           </el-col>
           <el-col :span="1.5">
@@ -203,7 +230,7 @@
                     scope.row.idcardno,
                     scope.row.drcode,
                     scope.row.drname,
-                    scope.row.patid,
+                    scope.row.patid
                   )
                 "
                 ><span class="button-textsc">{{
@@ -339,7 +366,7 @@
     <!-- 鎵归噺娣诲姞浠诲姟寮圭獥 -->
     <!-- 鎵归噺娣诲姞寤剁画鎶ょ悊浠诲姟寮圭獥 -->
     <el-dialog
-      title="鎵归噺娣诲姞寤剁画鎶ょ悊"
+      :title="batchMode === 'manual' ? '璇煶鏈嶅姟杞汉宸�' : '鎵归噺娣诲姞寤剁画鎶ょ悊'"
       :visible.sync="batchTaskVisible"
       width="90%"
       append-to-body
@@ -402,7 +429,11 @@
                 width="120"
                 align="center"
               />
-              <el-table-column prop="leaveldeptname" label="绉戝" align="center" />
+              <el-table-column
+                prop="leaveldeptname"
+                label="绉戝"
+                align="center"
+              />
               <el-table-column
                 prop="leavehospitaldistrictname"
                 label="鐥呭尯"
@@ -416,7 +447,9 @@
         <el-col :span="12">
           <div class="batch-task-section">
             <div class="section-header">
-              <h4>寤剁画鎶ょ悊浠诲姟</h4>
+              <h4>
+                {{ batchMode === "manual" ? "浜哄伐闅忚浠诲姟" : "寤剁画鎶ょ悊浠诲姟" }}
+              </h4>
               <div v-if="selectedTask" class="task-selected-hint selected">
                 <i class="el-icon-success"></i>
                 <span>宸查�夋嫨锛歿{ selectedTask.taskName }}</span>
@@ -429,7 +462,7 @@
             <el-table
               :data="taskList"
               border
-               height="680"
+              height="680"
               style="width: 100%"
               size="small"
               @current-change="handleTaskSelectionChange"
@@ -478,11 +511,22 @@
               <template #empty>
                 <div class="empty-message">
                   <i class="el-icon-document"></i>
-                  <span>鏆傛棤鍙敤寤剁画鎶ょ悊浠诲姟</span>
+                  <span>{{
+                    batchMode === "manual"
+                      ? "鏆傛棤鍙敤浜哄伐闅忚浠诲姟"
+                      : "鏆傛棤鍙敤寤剁画鎶ょ悊浠诲姟"
+                  }}</span>
                   <span class="empty-tips">璇疯仈绯荤鐞嗗憳鍒涘缓浠诲姟</span>
                 </div>
               </template>
             </el-table>
+            <pagination
+              v-show="taskTotal > 0"
+              :total="taskTotal"
+              :page.sync="taskQueryParams.pageNum"
+              :limit.sync="taskQueryParams.pageSize"
+              @pagination="loadTaskList"
+            />
           </div>
         </el-col>
       </el-row>
@@ -498,7 +542,15 @@
           @click="submitBatchTask"
           :disabled="!selectedTask || batchLoading"
         >
-          {{ batchLoading ? "鍒涘缓涓�..." : "鍒涘缓寤剁画鎶ょ悊浠诲姟" }}
+          {{
+            batchLoading
+              ? batchMode === "manual"
+                ? "杞崲涓�..."
+                : "鍒涘缓涓�..."
+              : batchMode === "manual"
+              ? "纭杞汉宸�"
+              : "鍒涘缓寤剁画鎶ょ悊浠诲姟"
+          }}
         </el-button>
       </div>
     </el-dialog>
@@ -598,7 +650,7 @@
 <script>
 import { delUser } from "@/api/system/user";
 
-import { listpatient } from "@/api/patient/record";
+import { listpatient, addManualVisit } from "@/api/patient/record";
 import {
   messagelistpatient,
   alterpatient,
@@ -613,7 +665,12 @@
 import Treeselect from "@riophae/vue-treeselect";
 import { listDept } from "@/api/system/dept";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { query360PatInfo,query360PatInfonh, getTasklist, addSubtask } from "@/api/AiCentre/index";
+import {
+  query360PatInfo,
+  query360PatInfonh,
+  getTasklist,
+  addSubtask,
+} from "@/api/AiCentre/index";
 
 import store from "@/store";
 
@@ -648,12 +705,19 @@
       // 榛樿瀵嗙爜
       initPassword: undefined,
       amendtag: false, //鏄惁淇敼
+      orgname: localStorage.getItem("orgname"),
       // 鎵归噺浠诲姟鐩稿叧鏁版嵁
+      batchMode: "continue", // 寮圭獥妯″紡锛歝ontinue 寤剁画鎶ょ悊 / manual 璇煶鏈嶅姟杞汉宸�
       batchTaskVisible: false, // 寮圭獥鍙鎬�
       selectedPatients: [], // 閫変腑鐨勬偅鑰呭垪琛�
       taskList: [], // 浠诲姟鍒楄〃
       selectedTask: null, // 閫変腑鐨勪换鍔�
       batchLoading: false, // 鎵归噺鎻愪氦鍔犺浇鐘舵��
+      taskQueryParams: {
+        pageNum: 1,
+        pageSize: 20,
+      },
+      taskTotal: 0,
       // 鏃ユ湡鑼冨洿
       dateRange: [],
       source: [
@@ -783,6 +847,7 @@
         pageNum: 1,
         pageSize: 10,
         cry: 1,
+        bedSort: null,
         searchscope: 3,
         scopetype: [],
         leaveldeptcodes: [],
@@ -843,8 +908,8 @@
       const orgname = localStorage.getItem("orgname");
       if (orgname == "鍗楀崕澶у闄勫睘绗竴鍖婚櫌") {
         query360PatInfonh(id).then((res) => {
-          if (res.url) {
-            window.open(res.url, "_blank");
+          if (res.data) {
+            window.open(res.data, "_blank");
           } else {
             this.$modal.msgWarning("360鏌ヨ鏃犵粨鏋�");
           }
@@ -878,6 +943,9 @@
         return;
       }
 
+      this.batchMode = "continue";
+      this.selectedTask = null;
+
       // 鑾峰彇閫変腑鎮h�呯殑绉戝淇℃伅
       const patientDepts = new Set();
       let deptcode = "";
@@ -897,8 +965,31 @@
       // 鏄剧ず寮圭獥
       this.batchTaskVisible = true;
 
-      // 鑾峰彇浠诲姟鍒楄〃
-      this.loadTaskList(deptcode);
+      // 閲嶇疆浠诲姟鍒嗛〉骞惰幏鍙栦换鍔″垪琛�
+      this.taskQueryParams.pageNum = 1;
+      this.loadTaskList();
+    },
+    /** 璇煶鏈嶅姟杞汉宸ユ寜閽偣鍑� */
+    handleManualVisit() {
+      // 鏍¢獙鏄惁閫変腑鎮h��
+      if (this.ids.length === 0) {
+        this.$modal.msgWarning("璇疯嚦灏戦�変腑1鍚嶆偅鑰�");
+        return;
+      }
+
+      this.batchMode = "manual";
+      this.selectedTask = null;
+      // 鑾峰彇閫変腑鎮h�呭垪琛�
+      this.selectedPatients = this.userList.filter((item) =>
+        this.ids.includes(item.patid)
+      );
+
+      // 鏄剧ず寮圭獥
+      this.batchTaskVisible = true;
+
+      // 閲嶇疆浠诲姟鍒嗛〉骞惰幏鍙栦换鍔″垪琛�
+      this.taskQueryParams.pageNum = 1;
+      this.loadTaskList();
     },
     /** 琛ㄦ牸琛屾牱寮� */
     tableRowClassName({ row, rowIndex }) {
@@ -918,27 +1009,61 @@
       }
     },
     /** 鍔犺浇浠诲姟鍒楄〃 */
-    loadTaskList(deptcode) {
+    loadTaskList() {
       this.batchLoading = true;
       let topqueryParams = {
-        pageNum: 1,
-        pageSize: 100, // 璁剧疆杈冨ぇ鐨勫垎椤佃幏鍙栨洿澶氫换鍔�
-        type: 2, // 鏍规嵁瀹為檯鎯呭喌璋冩暣
+        pageNum: this.taskQueryParams.pageNum,
+        pageSize: this.taskQueryParams.pageSize,
       };
-
+      if (this.batchMode !== "manual") {
+        topqueryParams.type = 2; // 寤剁画鎶ょ悊浠诲姟绫诲瀷
+      }
+      topqueryParams.deptcodes = store.getters.belongDepts.map(
+        (obj) => obj.deptCode
+      );
+      topqueryParams.hospitaldistrictcodes = store.getters.belongWards.map(
+        (obj) => obj.districtCode
+      );
       getTasklist(topqueryParams)
         .then((response) => {
-          this.taskList = response.rows;
+          this.taskList = response.rows || [];
+          if (this.batchMode === "manual") {
+            // 鍙繚鐣欍�屼汉宸ャ�嶄换鍔″舰寮忥紙preachform 鍚� 1锛�
+            this.taskList = this.taskList.filter((task) =>
+              this.isManualTask(task)
+            );
+          }
+          this.taskTotal = response.total;
           this.batchLoading = false;
 
           if (this.taskList.length === 0) {
-            this.$modal.msgWarning("褰撳墠绉戝鏃犲彲鐢ㄤ换鍔�");
+            this.$modal.msgWarning(
+              this.batchMode === "manual"
+                ? "褰撳墠绉戝鏃犲彲鐢ㄤ汉宸ラ殢璁夸换鍔�"
+                : "褰撳墠绉戝鏃犲彲鐢ㄥ欢缁姢鐞嗕换鍔�"
+            );
           }
         })
         .catch((error) => {
           this.$modal.msgError("鑾峰彇浠诲姟鍒楄〃澶辫触锛�" + error.message);
           this.batchLoading = false;
         });
+    },
+
+    /** 鍒ゆ柇鏄惁涓恒�屼汉宸ャ�嶄换鍔″舰寮忥紙preachform 鍚� 1锛� */
+    isManualTask(task) {
+      if (task.preachform != null && task.preachform !== "") {
+        const forms = String(task.preachform)
+          .split(",")
+          .map((s) => s.trim());
+        if (forms.includes("1")) return true;
+      }
+      if (Array.isArray(task.preachformList)) {
+        return task.preachformList.some(
+          (item) => String(item.preachform) === "1"
+        );
+      }
+      return false;
     },
 
     /** 澶勭悊浠诲姟閫夋嫨鍙樺寲 */
@@ -951,6 +1076,12 @@
       // 鏍¢獙鏄惁閫変腑浠诲姟
       if (!this.selectedTask) {
         this.$modal.msgWarning("璇烽�夋嫨1涓换鍔�");
+        return;
+      }
+
+      // 璇煶鏈嶅姟杞汉宸ワ細璧版柊鎺ュ彛
+      if (this.batchMode === "manual") {
+        this.submitManualVisit();
         return;
       }
 
@@ -972,6 +1103,7 @@
             libtemplateid: this.selectedTask.libtemplateid,
             sendstate: 2,
             continueFlag: 2,
+            hospType: 2, // 鎮h�呯被鍨嬶細2=鍑洪櫌
             ...patient,
             sendname: patient.patname,
             starttime: patient.starttime ? patient.starttime + " 00:00:00" : "",
@@ -1013,9 +1145,46 @@
         }
 
         this.batchTaskVisible = false;
+        this.$router.push({
+          path: "/followvisit/Continue",
+        });
         this.getList(); // 鍒锋柊鎮h�呭垪琛�
       } catch (error) {
         this.$modal.msgError("鎵归噺娣诲姞浠诲姟杩囩▼涓嚭閿欙細" + error.message);
+      } finally {
+        this.batchLoading = false;
+      }
+    },
+
+    /** 璇煶鏈嶅姟杞汉宸ワ細鍒犻櫎鏈畬鎴愰殢璁夸换鍔″苟閲嶆柊鐢熸垚浜哄伐闅忚浠诲姟 */
+    async submitManualVisit() {
+      this.batchLoading = true;
+      try {
+        const params = {
+          patids: this.selectedPatients.map((item) => item.patid),
+          taskid: this.selectedTask.taskid,
+        };
+        const response = await addManualVisit(params);
+        if (response.code === 200) {
+          const data = response.data || {};
+          const generated = data.generatedCount || 0;
+          const noDischarge = (data.noDischargeRecordPatids || []).length;
+          const noArchive = (data.noArchivePatids || []).length;
+          const failed = (data.generateFailedPatids || []).length;
+          let msg = `鎴愬姛鐢熸垚 ${generated} 涓汉宸ラ殢璁夸换鍔;
+          if (noDischarge) msg += `锛�${noDischarge} 浜烘棤鍑洪櫌璁板綍`;
+          if (noArchive) msg += `锛�${noArchive} 浜烘棤鎮h�呮。妗坄;
+          if (failed) msg += `锛�${failed} 浜虹敓鎴愬け璐;
+          this.$modal.msgSuccess(msg);
+          this.batchTaskVisible = false;
+          this.getList(); // 鍒锋柊鎮h�呭垪琛�
+        } else {
+          this.$modal.msgError(response.msg || "璇煶鏈嶅姟杞汉宸ュけ璐�");
+        }
+      } catch (error) {
+        this.$modal.msgError(
+          "璇煶鏈嶅姟杞汉宸ュけ璐ワ細" + (error.message || "缃戠粶閿欒")
+        );
       } finally {
         this.batchLoading = false;
       }
@@ -1128,6 +1297,7 @@
         pageNum: 1,
         pageSize: 10,
         cry: 1,
+        bedSort: null,
         searchscope: 3,
         scopetype: [],
         leaveldeptcodes: [],

--
Gitblit v1.9.3