chenyincheng
2023-03-23 63ba63b49f07fdbeffaf0b5a0b7ae8cfedf405f7
src/views/home/index.vue
@@ -47,6 +47,9 @@
    const weightInfo = computed(() => {
      return sockte.weightSockte
    })
    const faceInfo = computed(() => {
      return sockte.faceInfoSockte
    })
    const xyjInfo = computed(() => {
      return sockte.xyjSockte
    })
@@ -87,7 +90,7 @@
          sockteStore().setweightSockte({
            type: '体重秤',
            deviceName: '',
            result: '',
            result: '0',
            resultTime: '',
            state: 2
          })
@@ -136,7 +139,7 @@
    watch(
      () => patientInfo.value.datetime,
      () => {
        console.log('患者信息变化', patientInfo.value)
        console.log('患者信息变化,置空临时患者code', patientInfo.value)
        patientCodeLs = ''
        patientCodeLsXy = ''
        console.log(patientCodeLs, '患者codec初始化')
@@ -165,9 +168,9 @@
        }
        // 没有找到患者
        else if (patientInfo.value.name === '') {
          speech.value?.speak({ text: "没有找到患者,请重新刷卡" }).then(() => {
            console.log("播报完成...")
          })
          // speech.value?.speak({ text: "没有找到患者,请重新刷卡" }).then(() => {
          //   console.log("播报完成...")
          // })
          if (isUseFaceRecogService.value) {
            state.dialogVisible = true
          }
@@ -187,43 +190,36 @@
    );
    watch(
      () => weightInfo.value.resultTime,
      () => {
      async () => {
        console.log("体重变化了", weightInfo.value)
        if (patientInfo.value.id === 0) {
          speech.value?.speak({ text: "没有识别的患者,请先验证患者" }).then(() => {
            console.log("播报完成...")
          })
        }
        if (weightInfo.value.result !== "0") {
        // 体重不能0
        if (weightInfo.value.result !== "0"&&patientInfo.value.code!=='') {
            // 发送结果到sockte服务
            const mode = {
              patientCode: patientInfo.value.code,
              weight: weightInfo.value.result,
              bloodPressure: ''
            }
            console.log('发送患者结果,前提是患者code 不能重复', mode)
            if (patientCodeLs !== mode.patientCode) {
              const tt = mode.weight.replace('.', '点')
              console.log('发送患者结果', tt)
              speech.value?.speak({ text: `称重完成,${tt}kg` }).then(() => {
                console.log("播报完成...")
              })
              // api上传
              updatePatient(mode).then(re => {
                console.log(re)
              }).catch(() => {
                ElMessage.error('结果上报出错,请联系后台管理员')
              })
              // sendPationSet(mode)
              console.log(111111)
              patientCodeLs = mode.patientCode
              for(let x=0;x<3;x++){
                const res= await updatePatient(mode)
                if(res.code===200){
                  return false
                }
              }
            }
            else {
              // console.log(`patientCodeLs===${patientCodeLs} ,mode.patCode${mode.patientCode}`)
              // speech.value?.speak({ text: "不能重复称重,请先刷卡然后再称重" }).then(() => {
              //   console.log("播报完成...")
              // })
            }
               // 临时患者code=当前患者code
               console.log(22222222222)
                patientCodeLs = mode.patientCode
              }
            // 计算目标脱水量
            if (Number(weightInfo.value.result) > 0 && Number(patientInfo.value.pureWeight) !== 0) {
              state.aimTSL = (Number(weightInfo.value.result) - Number(patientInfo.value.pureWeight)- Number(patientInfo.value.clothesWeight)).toFixed(2)
@@ -289,6 +285,14 @@
        }
      }
    );
    watch(
      ()=>faceInfo.value.result,
      ()=>{
        console.log('页面收到了人脸识别')
        sendPationCodeApi(faceInfo.value.result)
        // console.log(faceInfo.value.result)
      }
    )
    watch(() => viewNumber,
      () => {
        state.clockNum = viewNumber.value
@@ -431,12 +435,12 @@
          <el-row class="rowdiv">
            <el-col :span="12">
              <div class="lableclass">
                机号:
                衣物重(kg):
              </div>
            </el-col>
            <el-col :span="12">
              <div class="textclass">
                {{ patientInfo.deviceCode }}
                {{ patientInfo.clothesWeight }}
              </div>
            </el-col>
          </el-row>