From 5f4d48e663c47eb7390e4a1784d773d6814889ff Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 02 九月 2025 13:40:04 +0800
Subject: [PATCH] 测试完成

---
 src/views/patient/patient/outpatient.vue |  311 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 290 insertions(+), 21 deletions(-)

diff --git a/src/views/patient/patient/outpatient.vue b/src/views/patient/patient/outpatient.vue
index 02b2368..a323439 100644
--- a/src/views/patient/patient/outpatient.vue
+++ b/src/views/patient/patient/outpatient.vue
@@ -67,16 +67,16 @@
             ></el-cascader>
           </el-form-item>
           <el-form-item label="灏辫瘖鏃ユ湡">
-              <el-date-picker
-                v-model="dateRange"
-                style="width: 240px"
-                value-format="yyyy-MM-dd"
-                type="daterange"
-                range-separator="-"
-                start-placeholder="寮�濮嬫棩鏈�"
-                end-placeholder="缁撴潫鏃ユ湡"
-              ></el-date-picker>
-              <!-- <el-date-picker
+            <el-date-picker
+              v-model="dateRange"
+              style="width: 240px"
+              value-format="yyyy-MM-dd"
+              type="daterange"
+              range-separator="-"
+              start-placeholder="寮�濮嬫棩鏈�"
+              end-placeholder="缁撴潫鏃ユ湡"
+            ></el-date-picker>
+            <!-- <el-date-picker
                 v-model="dateRange"
                 type="datetimerange"
                 value-format="yyyy-MM-dd HH:mm:ss"
@@ -85,7 +85,7 @@
                 :default-time="['12:00:00']"
               >
               </el-date-picker> -->
-            </el-form-item>
+          </el-form-item>
           <el-row>
             <!-- <el-form-item label=" 灏辫瘖鏃ユ湡 " prop="admitdate">
               <el-date-picker
@@ -150,6 +150,18 @@
               @click="handleDelete"
               v-hasPermi="['system:user:remove']"
               >鍒犻櫎</el-button
+            >
+          </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="19">
@@ -228,7 +240,13 @@
               <el-button
                 size="medium"
                 type="text"
-                @click="gettoken360(scope.row.idcardno,scope.row.drcode,scope.row.drname)"
+                @click="
+                  gettoken360(
+                    scope.row.idcardno,
+                    scope.row.drcode,
+                    scope.row.drname
+                  )
+                "
                 ><span class="button-textsc">{{
                   scope.row.patname
                 }}</span></el-button
@@ -337,7 +355,107 @@
         />
       </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="admitdate"
+                prop="admitdate"
+              >
+                <template slot-scope="scope">
+                  <span>{{ formatTime(scope.row.admitdate) }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column prop="outhospno" 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>
+            </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"
@@ -383,6 +501,7 @@
           </div>
         </el-upload>
       </div>
+
       <!-- 瀵煎叆妫�鏌� -->
       <div class="uploading" v-else-if="dractive == 2">
         <el-table :data="uploadingData" style="width: 100%">
@@ -446,7 +565,7 @@
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 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";
 
@@ -509,6 +628,12 @@
       Labelchange: false, //淇敼鏂板寮圭獥
       propss: { multiple: true },
       optionstag: [], //鏍囩鍒楄〃
+      batchTaskVisible: false, // 寮圭獥鍙鎬�
+      selectedPatients: [], // 閫変腑鐨勬偅鑰呭垪琛�
+      taskList: [], // 浠诲姟鍒楄〃
+      selectedTask: null, // 閫変腑鐨勪换鍔″垪琛�
+      batchLoading: false, // 鎵归噺鎻愪氦鍔犺浇鐘舵��
+      deptcode: "",
       Patientrange: [
         {
           name: "鍏ㄩ儴",
@@ -680,9 +805,9 @@
       if (this.dateRange) {
         this.queryParams.beginTime = this.dateRange[0];
         this.queryParams.endTime = this.dateRange[1];
-      }else{
-        this.queryParams.beginTime = '';
-        this.queryParams.endTime = '';
+      } else {
+        this.queryParams.beginTime = "";
+        this.queryParams.endTime = "";
       }
       listPatouthosp(this.queryParams).then((response) => {
         this.userList = response.rows;
@@ -733,11 +858,11 @@
       });
     },
     //鎮h��360璺宠浆
-    gettoken360(sfzh,drcode,drname) {
+    gettoken360(sfzh, drcode, drname) {
       this.postData.YeWuXX.BingRenXX.ZhengJianHM = sfzh;
-      if (this.postData.XiaoXiTou.ZuHuMC=='涓芥按甯備腑鍖婚櫌') {
-        this.postData.YeWuXX.YongHuXX.YongHuID = '1400398571877961728';
-        this.postData.YeWuXX.YongHuXX.YongHuXM = 'LSZYY';
+      if (this.postData.XiaoXiTou.ZuHuMC == "涓芥按甯備腑鍖婚櫌") {
+        this.postData.YeWuXX.YongHuXX.YongHuID = "1400398571877961728";
+        this.postData.YeWuXX.YongHuXX.YongHuXM = "LSZYY";
       }
 
       query360PatInfo(this.postData).then((res) => {
@@ -796,7 +921,7 @@
         leaveldeptcodes: [],
         leavehospitaldistrictcodes: [],
       };
-        this.handleQuery();
+      this.handleQuery();
     },
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
@@ -913,6 +1038,113 @@
       this.upload.open = false;
       this.dractive = 1;
     },
+    /** 鎵归噺娣诲姞浠诲姟鎸夐挳鐐瑰嚮 */
+    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;
+        }
+      });
+
+      // 鏍¢獙鏄惁鍚屼竴绉戝
+      if (patientDepts.size > 1) {
+        this.$modal.msgError("閫変腑鐨勬偅鑰呬笉灞炰簬鍚屼竴绉戝锛屾棤娉曟壒閲忔坊鍔犱换鍔�");
+        return;
+      }
+
+      // 鑾峰彇閫変腑鎮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: 10,
+        serviceType: 3,
+        type: 2,
+        deptcode: deptcode,
+      };
+      getTasklist(topqueryParams).then((response) => {
+        this.taskList = response.rows;
+        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 = [];
+
+      try {
+        // 閬嶅巻閫変腑鐨勬偅鑰咃紝閫愪釜璋冪敤鎺ュ彛
+        for (const patient of this.selectedPatients) {
+          const params = {
+            taskId: this.selectedTask.taskId,
+            taskName: this.selectedTask.taskName,
+            serviceType: this.selectedTask.serviceType,
+            ...patient,
+            age: "",
+          };
+
+          try {
+            await addSubtask(params);
+            successPatients.push(patient.patname);
+          } catch (error) {
+            failedPatients.push(patient.patname);
+          }
+        }
+
+        // 鏄剧ず澶勭悊缁撴灉
+        let message = `鎴愬姛涓� ${successPatients.length} 鍚嶆偅鑰呮坊鍔犱换鍔;
+        if (failedPatients.length > 0) {
+          message += `锛�${failedPatients.length} 鍚嶆偅鑰呮坊鍔犲け璐;
+        }
+        this.$modal.msgSuccess(message);
+
+        this.batchTaskVisible = false;
+        this.getList(); // 鍒锋柊鎮h�呭垪琛�
+      } catch (error) {
+        this.$modal.msgError("鎵归噺娣诲姞浠诲姟杩囩▼涓嚭閿�");
+      } finally {
+        this.batchLoading = false;
+      }
+    },
+
+    /** 鎵归噺娣诲姞鎮h�呬换鍔℃帴鍙� */
+    batchAddPatientTask(params) {},
   },
 };
 </script>
@@ -963,4 +1195,41 @@
 .button-textsc {
   color: #28cfe6;
 }
+.batch-patient-section,
+.batch-task-section {
+  padding: 15px;
+  border: 1px solid #ebeef5;
+  border-radius: 4px;
+  margin-bottom: 15px;
+}
+
+.el-table--enable-row-hover .el-table__body tr:hover > td {
+  background-color: #f5f7fa;
+}
+.el-table__body tr.current-row > td {
+  background-color: #e6f7ff;
+}
+
+/* 绂佺敤鐘舵�佷笅鎸夐挳鏍峰紡 */
+.el-button.is-disabled {
+  cursor: not-allowed;
+}
+.batch-patient-section h4,
+.batch-task-section h4 {
+  margin-top: 0;
+  margin-bottom: 15px;
+  color: #303133;
+  font-size: 16px;
+}
+
+/* 琛ㄦ牸鏍峰紡浼樺寲 */
+.el-table {
+  margin-bottom: 10px;
+}
+
+/* 寮圭獥搴曢儴鎸夐挳闂磋窛 */
+.dialog-footer {
+  text-align: right;
+  padding: 10px 20px 20px;
+}
 </style>

--
Gitblit v1.9.3