Bläddra i källkod

总后台-医生管理增加患者转交功能

cgp 2 dagar sedan
förälder
incheckning
cca3e8b73e
2 ändrade filer med 206 tillägg och 7 borttagningar
  1. 25 0
      src/api/his/doctor.js
  2. 181 7
      src/views/his/doctor/type1.vue

+ 25 - 0
src/api/his/doctor.js

@@ -158,3 +158,28 @@ export function doctorOptions() {
 
   })
 }
+
+// 获取某个医生下的所有患者
+export function getDoctorPatients(doctorId) {
+  return request({
+    url: '/his/doctor/patients/' + doctorId,
+    method: 'get'
+  })
+}
+
+// 执行患者转交
+export function transferPatient(data) {
+  return request({
+    url: '/his/doctor/transferPatient',
+    method: 'post',
+    data: data
+  })
+}
+
+//获取医生列表
+export function getDoctorList() {
+  return request({
+    url: '/his/doctor/getDoctorList',
+    method: 'get'
+  })
+}

+ 181 - 7
src/views/his/doctor/type1.vue

@@ -294,6 +294,11 @@
              v-hasPermi="['his:doctor:inquiry']"
             @click="doctorInquiry(scope.row)"
           >常用处方</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="openTransfer(scope.row)"
+          >转交患者</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -787,10 +792,71 @@
       :visible.sync="show.open">
       <doctorDetails  ref="doctorDetails" />
     </el-drawer>
+
+    <!-- ======================== 患者转交弹窗 ======================== -->
+    <el-dialog title="患者转交" :visible.sync="transferDialogVisible" width="800px" append-to-body @close="closeTransfer">
+      <el-row :gutter="20">
+        <!-- 选择目标医生 -->
+        <el-col :span="24">
+          <el-form :inline="true" size="small">
+            <el-form-item label="目标医生" required>
+              <el-select v-model="transferForm.targetDoctorId" placeholder="请选择目标医生" filterable clearable style="width: 280px;">
+                <el-option
+                  v-for="item in allDoctorList"
+                  :key="item.doctorId"
+                  :label="item.doctorName"
+                  :value="item.doctorId"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </el-col>
+      </el-row>
+
+      <!-- 患者列表 -->
+      <el-row :gutter="20">
+        <el-col :span="24">
+          <div style="margin-bottom: 10px;">
+            <span style="font-weight: bold;">当前医生患者列表(共 {{ patientList.length }} 人)</span>
+            <el-button type="primary" size="mini" style="margin-left: 15px;" @click="toggleAllPatients">
+              {{ isAllSelected ? '取消全选' : '全选患者' }}
+            </el-button>
+          </div>
+          <el-table
+            ref="patientTable"
+            :data="patientList"
+            border
+            height="350"
+            @selection-change="handlePatientSelectionChange"
+          >
+            <el-table-column type="selection" width="55" align="center" />
+            <el-table-column label="患者姓名" prop="patientName" show-overflow-tooltip />
+            <el-table-column label="性别" prop="sex" width="80">
+              <template slot-scope="scope">
+                <dict-tag :options="sexOptions" :value="scope.row.sex"/>
+              </template>
+            </el-table-column>
+            <el-table-column label="年龄" prop="age" width="80" />
+            <el-table-column label="电话" prop="phone" width="130" />
+            <el-table-column label="接诊时间" prop="receptionTime" width="160">
+              <template slot-scope="scope">
+                <span>{{ parseTime(scope.row.receptionTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-col>
+      </el-row>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" :disabled="!transferForm.targetDoctorId || transferForm.selectedPatientIds.length === 0" @click="submitTransfer">提 交</el-button>
+        <el-button @click="closeTransfer">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- ======================== 患者转交弹窗结束 ======================== -->
   </div>
 </template>
 <script>
-import {editFollow,getAllFollowDoctorList,getUserList, listDoctor, getWxaCodeUnLimit,getDoctor, listdocuser,delDoctor, addDoctor, updateDoctor, exportDoctor ,updateAuditDoctor,getDoctorPrice,editDoctorPrice,editPassWord,editPrice} from "@/api/his/doctor";
+import {editFollow,getAllFollowDoctorList,getUserList, listDoctor, getWxaCodeUnLimit,getDoctor, listdocuser,delDoctor, addDoctor, updateDoctor, exportDoctor ,updateAuditDoctor,getDoctorPrice,editDoctorPrice,editPassWord,editPrice,getDoctorPatients,transferPatient,getDoctorList} from "@/api/his/doctor";
 import{listDepartment} from "@/api/his/disease";
 import{listAllHospital} from "@/api/his/hospital";
 import {getCitys} from "@/api/store/city";
@@ -827,8 +893,6 @@ export default {
       uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
       certificateBack:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
       practise:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
-      practiseBack:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
-      baseUrl: process.env.VUE_APP_BASE_API,
       orOptions: [],
 	  storeOPtions: [],
       isauditOptions: [],
@@ -932,6 +996,16 @@ export default {
         isAudit:1,
         remark:null,
       },
+      // ========== 患者转交相关数据 ==========
+      transferDialogVisible: false,
+      transferForm: {
+        targetDoctorId: null,
+        selectedPatientIds: []
+      },
+      patientList: [],
+      allDoctorList: [],
+      currentSourceDoctorId: null,
+      // ====================================
       // 表单校验
       rules: {
         doctorName: [
@@ -970,9 +1044,6 @@ export default {
         status: [
           { required: true, message: "状态不能为空", trigger: "blur" }
         ],
-        isAudit: [
-          { required: true, message: "状态不能为空", trigger: "blur" }
-        ],
         isAccept: [
           { required: true, message: "是否可抢单不能为空", trigger: "blur" }
         ],
@@ -1554,8 +1625,111 @@ export default {
       getAllAiRoleList().then(response => {
          this.aiOption = response.data;
       })
-    }
+    },
+    // ======================== 患者转交相关方法 ========================
+    /** 打开转交弹窗 */
+    openTransfer(row) {
+      this.transferDialogVisible = true;
+      this.currentSourceDoctorId = row.doctorId;
+      this.transferForm.targetDoctorId = null;
+      this.patientList = [];
+      // 加载该医生下的患者列表
+      this.loadDoctorPatients(row.doctorId);
+      // 加载所有医生列表(供目标选择)
+      this.loadAllDoctorList();
+    },
+
+    /** 获取医生患者 */
+    loadDoctorPatients(doctorId) {
+      getDoctorPatients(doctorId).then(response => {
+        this.patientList = response.data;
+        // 清空表格选中
+        this.$nextTick(() => {
+          this.$refs.patientTable.clearSelection();
+        });
+      });
+    },
 
+    /** 获取全部医生列表 */
+    loadAllDoctorList() {
+      getDoctorList().then(response => {
+        this.allDoctorList = response.data;
+      })
+    },
+
+    /** 患者表格多选变化 */
+    handlePatientSelectionChange(selection) {
+      this.transferForm.selectedPatientIds = selection.map(item => item.id);
+    },
+
+    /** 全选/取消全选 */
+    toggleAllPatients() {
+      if (this.isAllSelected) {
+        this.$refs.patientTable.clearSelection();
+      } else {
+        this.patientList.forEach(row => {
+          this.$refs.patientTable.toggleRowSelection(row, true);
+        });
+      }
+    },
+
+    /** 提交转交 */
+    submitTransfer() {
+      if (!this.transferForm.targetDoctorId) {
+        this.$message.warning('请选择目标医生');
+        return;
+      }
+      if (this.transferForm.selectedPatientIds.length === 0) {
+        this.$message.warning('请至少选择一位患者');
+        return;
+      }
+
+      // 从 allDoctorList 中获取目标医生名称
+      const targetDoctor = this.allDoctorList.find(item => item.doctorId === this.transferForm.targetDoctorId);
+      const targetDoctorName = targetDoctor ? targetDoctor.doctorName : '';
+
+      this.$confirm(`确认将选中的 ${this.transferForm.selectedPatientIds.length} 位患者转交给目标医生吗?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const param = {
+          sourceDoctorId: this.currentSourceDoctorId,
+          targetDoctorId: this.transferForm.targetDoctorId,
+          targetDoctorName: targetDoctorName,      // 带上目标医生名称
+          patientIds: this.transferForm.selectedPatientIds
+        };
+        transferPatient(param).then(response => {
+          if (response.code === 200) {
+            this.$message.success('患者转交成功');
+            this.transferDialogVisible = false;
+            // 如需刷新列表可在此调用 getList()
+          } else {
+            this.$message.error(response.msg);
+          }
+        });
+      }).catch(() => {});
+    },
+
+    /** 关闭弹窗 */
+    closeTransfer() {
+      this.transferDialogVisible = false;
+      this.currentSourceDoctorId = null;
+      this.patientList = [];
+      this.transferForm = {
+        targetDoctorId: null,
+        selectedPatientIds: []
+      };
+    },
+    // ======================== 患者转交相关方法结束 ========================
+
+  },
+  computed: {
+    // 是否已全选
+    isAllSelected() {
+      if (this.patientList.length === 0) return false;
+      return this.transferForm.selectedPatientIds.length === this.patientList.length;
+    }
   }
 };
 </script>