From 94f16f6a5770c10fce8267e9e851dfc35d8dfbc2 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 26 八月 2022 15:42:47 +0800
Subject: [PATCH] 新增读卡器功能

---
 src/views/home/index.vue |  169 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 99 insertions(+), 70 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 1ab53d4..a612b9a 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -21,6 +21,7 @@
         const AudioRef = ref()
         const AudioRef2 = ref()
         const AudioRef3 = ref()
+        const AudioRef4=ref()
         const isLink = computed(() => {
             return !sockte.isLink
         })
@@ -32,6 +33,9 @@
         })
         const xyjInfo = computed(() => {
             return sockte.xyjSockte
+        })
+        const dkqInfo = computed(() => {
+            return sockte.dkqSockte
         })
         const patientInfo = computed(() => {
             return patientInfoStore().patientInfo
@@ -52,6 +56,7 @@
                 }
                 else {
                     clearInterval(timer)
+                    const datetimeCON=patientInfoStore().patientInfo.datetime
                     patientInfoStore().setpatientInfo({
                         id: 0,
                         code: '',
@@ -59,7 +64,8 @@
                         patientAvatarIcon: '',
                         deviceCode: '',
                         hemoCode: '',
-                        pureWeight: ''
+                        pureWeight: '',
+                        datetime:datetimeCON
                     })
                     state.clockNum = patientInfoStore().viewNumber
                     sockteStore().setweightSockte({
@@ -103,9 +109,8 @@
             mai_bu: ""//脉搏
         })
         watch(
-            () => patientInfo.value.id,
+            () => patientInfo.value.datetime,
             () => {
-                console.log('患者变化了', patientInfo)
                 if (patientInfo.value.id !== 0) {
                     AudioRef.value.play();
                     sockteStore().setweightSockte({
@@ -124,6 +129,11 @@
                     })
                     settime()
 
+                }else{
+                  if(patientInfo.value.name===''){
+                    AudioRef4.value.play();
+                  }
+                  
                 }
             }
         )
@@ -186,6 +196,17 @@
                 }
             }
         )
+        watch(
+            () => dkqInfo.value.resultTime,
+            () => {
+              console.log(dkqInfo.value,'读卡器')
+                if (dkqInfo.value.result !== ''&&dkqInfo.value.result !== undefined) {
+                  const code=dkqInfo.value.result.split(",")[0]
+                  console.log('获取读卡器的code',code)
+                  sendPationCode(code)
+                }
+            }
+        )
         watch(() => viewNumber,
             () => {
                 state.clockNum = viewNumber.value
@@ -209,7 +230,7 @@
             }, 1000)
         })
         return {
-            ...toRefs(state), isLink, netLink, weightInfo, patientInfo, xyjInfo, inputRef, AudioRef0, AudioRef, AudioRef2, AudioRef3, inputChabge
+            ...toRefs(state), isLink, netLink, weightInfo, patientInfo, xyjInfo, inputRef, AudioRef0, AudioRef, AudioRef4, AudioRef2, AudioRef3, inputChabge
         }
     }
 }
@@ -217,122 +238,128 @@
 <template>
     <div class="page flex-col">
          <!-- 提醒刷卡 -->
-        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step1.mp3" ref="AudioRef0" id="eventAudio"></audio>
+        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step1.mp3" ref="AudioRef0" id="eventAudio2"></audio>
         <!-- 患者信息读取成功 -->
-        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step2.mp3" ref="AudioRef" id="eventAudio"></audio>
+        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step2.mp3" ref="AudioRef" id="eventAudio2"></audio>
         <!-- 体重结果回传成功 -->
-        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step3.mp3" ref="AudioRef2" id="eventAudio"></audio>
+        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step3.mp3" ref="AudioRef2" id="eventAudio3"></audio>
         <!-- 血压结果回传成功 -->
-        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step4.mp3" ref="AudioRef3" id="eventAudio"></audio>
+        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step4.mp3" ref="AudioRef3" id="eventAudio4"></audio>
+        <!-- 没有找到患者 -->
+        <audio src="https://dhcdn.leon056.com/hemo/autoselfsign/step5.mp3" ref="AudioRef4" id="eventAudio5"></audio>
         <el-dialog title="提示" v-model="netLink" width="30%">
             <span>无法链接到网络!</span>
         </el-dialog>
         <el-dialog title="提示" v-model="isLink" width="30%">
             <span>sockte连接失败正在重连。。。。。。</span>
         </el-dialog>
-      <div class="box_7 flex-col justify-between">
-        <div class="header flex-col">
-          <div class="box_8 flex-row">
-            <img
-              class="image_1"
-              referrerpolicy="no-referrer"
-              :src="logo"
+      <div class="header flex-row">
+        <img
+          class="image_1"
+          referrerpolicy="no-referrer"
+          :src="logo"
+        />
+        <el-input
+              v-model="inputCode"
+              ref="inputRef"
+              id="inputCode"
+              class="inputCode"
+              @change="inputChabge"
+              placeholder="请输入患者卡号或扫描条码"
             />
-            <el-input id="inputCode" style="width:50px"  @change="inputChabge" v-model="inputCode" ref="inputRef" placeholder="" />
-            <span class="text_1">自助签到</span> <span class="text_2">{{clockNum}}</span>
-          </div>
-        </div>
-        <div class="grid_3 flex-row">
-          <div class="section_1 flex-col">
-            <div class="block_2 flex-row justify-between">
-              <div class="image-wrapper_1 flex-col">
-                <img
-                  class="image_2"
-                  referrerpolicy="no-referrer"
-                  :src="patientInfo.patientAvatarIcon"
-                />
+        <span class="text_1">自助签到</span> <span class="text_2">{{clockNum}}</span>
+      </div>
+      <div class="body flex-col">
+        <div class="grid_6 flex-row">
+          <div class="box_1 flex-row">
+            <img
+              class="image_2"
+              referrerpolicy="no-referrer"
+              :src="patientInfo.patientAvatarIcon"
+            />
+            
+            <!-- <div class="inputDeep">
+              <input id="inputCode"  type="text" @change="inputChabge" ref="inputRef" :value="inputCode">
+            
+            </div> -->
+            <div class="group_9 flex-col">
+              <div class="text-wrapper_31 flex-row justify-between">
+                <span class="text_3">姓名:</span>
+                <span class="text_4">{{patientInfo.name}}</span>
               </div>
-              <div class="group_6 flex-col">
-                <div class="text-wrapper_13 flex-row justify-between">
-                  <span class="text_3">姓名:</span>
-                  <span class="text_4">{{patientInfo.name}}</span>
-                </div>
-                <div class="block_1 flex-col"></div>
-                <div class="text-wrapper_14 flex-row justify-between">
-                  <span class="text_5">透析号:</span>
-                  <span class="text_6">{{patientInfo.hemoCode}}</span>
-                </div>
+              <div class="group_1 flex-col"></div>
+              <div class="text-wrapper_32 flex-row justify-between">
+                <span class="text_5">透析号:</span>
+                <span class="text_6">{{patientInfo.hemoCode}}</span>
               </div>
             </div>
           </div>
-          <div class="section_4 flex-col">
-            <div class="group_7 flex-row justify-between">
+          <div class="box_2 flex-col">
+            <div class="block_11 flex-row justify-between">
               <span class="text_7">血压(mmHg):</span>
               <img
+                class="image_3"
                 v-if="xyjInfo.state === 2"
-                class="group_1"
                 referrerpolicy="no-referrer"
                 :src="state1"
               />
               <img
-               v-if="xyjInfo.state === 1"
-                class="group_1"
+                class="image_3"
+                v-if="xyjInfo.state === 1"
                 referrerpolicy="no-referrer"
                 :src="state2"
               />
               <img
-              v-if="xyjInfo.state === 0"
-                class="group_1"
+                class="image_3"
+                v-if="xyjInfo.state === 0"
                 referrerpolicy="no-referrer"
                 :src="state3"
               />
             </div>
-            <div class="text-wrapper_15 flex-row">
+            <div class="text-wrapper_33 flex-row">
               <span class="text_8">{{ gao_ya }}/{{ di_ya }}</span>
             </div>
           </div>
-          <div class="section_5 flex-col">
-            <div class="box_9 flex-col">
-              <div class="text-wrapper_16 flex-row justify-between">
-                <span class="text_9">机号:</span>
-                <span class="text_10">{{patientInfo.deviceCode}}</span>
-              </div>
-              <div class="box_3 flex-col"></div>
-              <div class="text-wrapper_17 flex-row justify-between">
-                <span class="text_11">干体重(kg):</span>
-                <span class="text_12">{{ patientInfo.pureWeight }}</span>
-              </div>
-              <div class="box_4 flex-col"></div>
-              <div class="text-wrapper_18 flex-row justify-between">
-                <span class="text_13">目标脱水量(L):</span>
-                <span class="text_14">{{aimTSL}}</span>
-              </div>
+          <div class="box_3 flex-col">
+            <div class="text-wrapper_34 flex-row justify-between">
+              <span class="text_9">机号:</span> <span class="text_10">{{patientInfo.deviceCode}}</span>
+            </div>
+            <div class="block_1 flex-col"></div>
+            <div class="text-wrapper_35 flex-row justify-between">
+              <span class="text_11">干体重(kg):</span>
+              <span class="text_12">{{ patientInfo.pureWeight }}</span>
+            </div>
+            <div class="block_2 flex-col"></div>
+            <div class="text-wrapper_36 flex-row justify-between">
+              <span class="text_13">目标脱水量(L):</span>
+              <span class="text_14">{{aimTSL}}</span>
             </div>
           </div>
-          <div class="section_6 flex-col">
-            <div class="section_12 flex-row justify-between">
+          <div class="box_4 flex-col">
+            <div class="section_10 flex-row justify-between">
               <span class="text_15">透前体重(kg):</span>
               <img
                 v-if="weightInfo.state === 2"
-                class="group_1"
+                class="image_4"
                 referrerpolicy="no-referrer"
                 :src="state1"
               />
               <img
-               v-if="weightInfo.state === 1"
-                class="group_1"
+                v-if="weightInfo.state === 1"
+                class="image_4"
                 referrerpolicy="no-referrer"
                 :src="state2"
               />
               <img
-              v-if="weightInfo.state === 0"
-                class="group_1"
+                v-if="weightInfo.state === 0"
+                class="image_4"
                 referrerpolicy="no-referrer"
                 :src="state3"
               />
             </div>
-            <div class="section_13 flex-row justify-between">
+            <div class="section_11 flex-row justify-between">
               <span class="text_16">{{ weightInfo.result }}</span>
+
             </div>
           </div>
         </div>
@@ -343,4 +370,6 @@
 <style>
 @import './css/common.css';
 @import './css/index.css';
+
+
 </style>

--
Gitblit v1.8.0