From 1b145b5655fa023032c8713bb2375bccdf0fc314 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期四, 24 十月 2024 11:13:40 +0800
Subject: [PATCH] 领用完成后 立即刷新 患者列表

---
 src/views/ecg/callingscreen/roomscreen.vue |  106 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 95 insertions(+), 11 deletions(-)

diff --git a/src/views/ecg/callingscreen/roomscreen.vue b/src/views/ecg/callingscreen/roomscreen.vue
index decf64a..4d7a15c 100644
--- a/src/views/ecg/callingscreen/roomscreen.vue
+++ b/src/views/ecg/callingscreen/roomscreen.vue
@@ -1,15 +1,19 @@
 <script setup lang="ts">
 
 import {RoomBedVO} from "@/api/ecg/doctor";
-import {DICT_TYPE} from "@/utils/dict";
 import {RoomApi} from "@/api/ecg/room";
-import {CallingVO, statusMap, ScreenApi} from "@/api/ecg/screen";
+import {ScreenQueueVO, ScreenApi} from "@/api/ecg/screen";
+import {CallApi, CallVO} from "@/api/ecg/call";
+import {queueStatusConvert} from "../../../utils/statusFormatter";
 
 defineOptions({ name: 'roomscreen' })
 
-const list = ref<CallingVO[]>([]) // 鍒楄〃鐨勬暟鎹�
+const list = ref<ScreenQueueVO[]>([]) // 鍒楄〃鐨勬暟鎹�
+//const listPassed = ref<ScreenQueueVO[]>([]) // 杩囧彿鍒楄〃鐨勬暟鎹�
 
-const roomBed : RoomBedVO = ref<RoomBedVO>({
+let curSpeakPat : CallVO | null = null;
+
+const roomBed = ref<RoomBedVO>({
   roomId : null,
   roomName: null,
   bedNo: null
@@ -17,7 +21,8 @@
 
 const getList = async () => {
   const data = await ScreenApi.getRoomScreenData()
-  list.value = data
+  list.value = data[1]
+  // listPassed.value = data[2]
 }
 
 const getRoomByIp = async () => {
@@ -27,9 +32,65 @@
 
 const startScrolling = () => {
   setInterval(() => {
-    // console.info("...")
     getList()
+    if ( curSpeakPat === null ) {
+      initiateSpeak()
+    }
   }, 3000); // 姣忎袱绉掓粴鍔ㄤ竴娆�
+}
+
+const nameDesensitize = (patName) => {
+  if (patName.length == 2) {
+    //鎴彇name 瀛楃涓叉埅鍙栫涓�涓瓧绗︼紝
+    return patName.substring(0, 1) + '*';
+  } else if (patName.length == 3) {
+    //鎴彇绗竴涓拰绗笁涓瓧绗�
+    return patName.substring(0, 1) + '*' + patName.substring(2, 3);
+  } else if (patName.length > 3) {
+    //鎴彇绗竴涓拰澶т簬绗�4涓瓧绗�
+    return (
+        patName.substring(0, 1) + '*' + '*' + patName.substring(3, patName.length)
+    );
+  }
+}
+
+const tableRowClassName = ({row, rowIndex}: {
+  row: ScreenQueueVO
+  rowIndex: number
+}) => {
+  if (row.status === 5) {
+    return 'warning-row'
+  } else if (row.status === 7) {
+    return 'warning-row'  //return 'success-row'
+  }
+  return ''
+}
+
+const onSpeachEndEvent = async (event) => {
+  console.log("Speech ended... " + event.currentTarget.text);
+  curSpeakPat!.called = 1
+  await CallApi.updateCall(curSpeakPat!)
+  initiateSpeak()
+}
+
+const initiateSpeak = async () => {
+  curSpeakPat = await CallApi.getNextInstallCall()
+  if (curSpeakPat !== null) {
+    speak("璇枫��" + curSpeakPat.patName + "鍒�" + curSpeakPat.roomName + "瑁呮満");
+  }
+}
+
+const speak = (msg) => {
+  console.info("speak " + msg);
+  var speech = new SpeechSynthesisUtterance()
+  speech.text = msg + "銆傘�傘��" + msg + "銆傘�傘��" + msg  + "銆傘�傘��"
+  speech.pitch = 1 // 鑾峰彇骞惰缃瘽璇殑闊宠皟(0-2 榛樿1锛屽�艰秺澶ц秺灏栭攼,瓒婁綆瓒婁綆娌�)
+  speech.rate = 0.9 // 鑾峰彇骞惰缃璇濈殑閫熷害(0.1-10 榛樿1锛屽�艰秺澶ц閫熻秺蹇�,瓒婂皬璇�熻秺鎱�)
+  speech.volume = 100 // 鑾峰彇骞惰缃璇濈殑闊抽噺
+  speech.lang = 'zh-CN' // 璁剧疆鎾斁璇█
+
+  speech.onend = onSpeachEndEvent
+  speechSynthesis.speak(speech)
 }
 
 onMounted( () => {
@@ -45,20 +106,35 @@
     <el-main>
       <el-table
           :data="list"
-          stripe
           :show-header="false"
-          style="width: 100%; height: 100%; border: solid var(--el-color-primary-light-7); font-size: 18px;">
+          style="width: 100%; height: 100%; border: solid var(--el-color-primary-light-7); font-size: 18px;"
+          :row-class-name="tableRowClassName"
+      >
         <el-table-column
             prop="patName"
             label="鎮h�呭鍚�"
-            width="80"/>
-        <el-table-column label="鐘舵��" align="center" :prop="status" width="80">
+            width="80">
           <template #default="scope">
-            {{ statusMap.get(scope.row.status) }}
+            {{scope.row.seqNum}} &nbsp; {{ nameDesensitize(scope.row.patName) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="鐘舵��" align="center" width="130">
+          <template #default="scope">
+<!--            <dict-tag :type="DICT_TYPE.ECG_QUEUE_STATUS" :value="scope.row.status" />-->
+            {{queueStatusConvert(scope.row.status)}}
           </template>
         </el-table-column>
       </el-table>
     </el-main>
+    <el-button @click="speak('娆㈣繋浣跨敤')" >娆㈣繋浣跨敤</el-button>
+<!--
+    <el-footer height="100px" style="padding: 0 0">
+          <el-header height="30px" style="background-color: #98b8e5; line-height: 30px;">杩囧彿鍖�</el-header>
+          <span v-for="(passedItem, index) in listPassed" :key="index">
+                {{nameDesensitize(passedItem.patName) + "&nbsp;&nbsp;&nbsp;&nbsp;"}}
+          </span>
+    </el-footer>
+-->
   </el-container>
 </template>
 
@@ -84,4 +160,12 @@
   text-align: center;
   line-height: 160px;
 }
+
+.el-table ::v-deep .warning-row {
+  --el-table-tr-bg-color: var(--el-color-warning-light-9);
+}
+.el-table ::v-deep .success-row {
+  --el-table-tr-bg-color: var(--el-color-success-light-9);
+}
+
 </style>

--
Gitblit v1.9.3