From 6ab4b1e0b68e4c347110e37018fa005603f53904 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期二, 29 九月 2026 23:49:04 +0800
Subject: [PATCH] ai优化

---
 src/views/ecg/doctor/components/DevReadyPanel.vue |  140 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 117 insertions(+), 23 deletions(-)

diff --git a/src/views/ecg/doctor/components/DevReadyPanel.vue b/src/views/ecg/doctor/components/DevReadyPanel.vue
index b06dfca..831a7fb 100644
--- a/src/views/ecg/doctor/components/DevReadyPanel.vue
+++ b/src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -9,29 +9,46 @@
       :rules="formRules"
       label-width="100px"
       v-loading="formLoading"
+   
     >
+     <el-row>
+    <el-col :span="12">
       <el-form-item label="妫�鏌ラ」鐩�" prop="">
-        {{formData?.checkType && getCheckTypeName(formData?.checkType)}}
+        {{getCheckTypeName(formData.checkType)}}
       </el-form-item>
-      <el-form-item label="鎮h�呯紪鍙�" prop="patId">
+      </el-col>
+      <el-col :span="12">
+      <el-form-item label="鎮h�呯紪鍙�" prop="patId" >
         <el-input v-model="formData.patId" placeholder="璇疯緭鍏ユ偅鑰呯紪鍙�" @input="getRentInfoByPatId" />
         <Barcode v-if="displayBarCode" :value="displayBarCode" :width=100 />
         <el-button @click="copyBarcode()">澶嶅埗</el-button>
       </el-form-item>
+      </el-col>
+      <el-col :span="12">
       <el-form-item label="鎮h�呭悕绉�" prop="patName">
         <el-input v-model="formData.patName" placeholder="璇疯緭鍏ユ偅鑰呭悕绉�" />
       </el-form-item>
-
+     </el-col>
+     <!-- 闇�姹�1锛氭偅鑰呬俊鎭� 18 椤圭粺涓�灞曠ず锛堝悗绔凡浠庨绾﹀崟骞抽摵鍥炲~锛宻etPatient 宸茶祴鍊煎埌 formData锛� -->
+     <PatientInfoBlock :data="formData" check-type-field="checkType" :span="12" />
+      <el-col :span="12">
+  
       <el-form-item label="鎮h�呮弿杩�" prop="patDeptDesc">
-        <dict-tag v-if="formData.patDetails?.source" :type="DICT_TYPE.ECG_PAT_SOURCE" :value="formData.patDetails?.source" />
-        {{formData?.patDetails?.deptDesc}} {{formData?.patDetails?.wardDesc}} {{formData?.patDetails?.bedNo}}
+        <dict-tag v-if="formData.patSrc ?? formData.patDetails?.source" :type="DICT_TYPE.ECG_PAT_SOURCE" :value="formData.patSrc ?? formData.patDetails?.source" />
+        {{ formData.patWardDesc || formData?.patDetails?.wardDesc || '-' }} {{ formData.patBedNo || formData?.patDetails?.bedNo || '-' }}
       </el-form-item>
+           </el-col>
+      <el-col :span="12">
       <el-form-item label="璁惧缂栧彿" prop="devId">
         <el-input v-model="formData.devId" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" @input="getDevInfo"/>
       </el-form-item>
+           </el-col>
+      <el-col :span="12">
       <el-form-item label="璁惧鎻忚堪" prop="">
         {{ devInfo?.brand||'-' }} {{ devInfo?.model||'-' }} {{ tranlateDevState(devInfo?.state) }}
       </el-form-item>
+           </el-col>
+      <el-col :span="12">
       <el-form-item label="棰嗙敤鏃堕棿" prop="rentTime">
         <el-date-picker
           v-model="formData.rentTime"
@@ -40,6 +57,14 @@
           placeholder="閫夋嫨棰嗙敤鏃堕棿"
         />
       </el-form-item>
+           </el-col>
+      <el-col :span="12">
+       <el-form-item label="澶氳�愯嵂" prop="tolerance">
+         <!-- 闇�姹�6锛氱粺涓�璧板瓧鍏� ecg_tolerance锛�0=鏃� 1=澶氳�� 2=澶氶噸鑰愯嵂锛夛紱NULL 鎸�"鏃�"鏄剧ず锛圦12锛� -->
+         <dict-tag :type="DICT_TYPE.ECG_TOLERANCE" :value="formData.tolerance ?? 0" />
+        </el-form-item>
+             </el-col>
+      </el-row>
       <el-form-item label="澶囨敞" prop="remark">
         <el-input v-model="formData.remark" placeholder="璇疯緭鍏ュ娉�" />
       </el-form-item>
@@ -51,10 +76,11 @@
         </el-radio-group>
       </el-form-item>
 -->
+        
     </el-form>
     <el-button @click="submitForm" type="primary" :disabled="formLoading">棰嗙敤瀹屾垚</el-button>
     <el-checkbox style="margin-left:10px" label="鑷姩&nbsp;" v-model="autoPrint" />
-    <el-button @click="printBill(formData.patId!, formData.checkType!)">鎵撳嵃灏忕エ</el-button>
+    <el-button @click="printBill(formData.patDetails?.appointmentId)">鎵撳嵃灏忕エ</el-button>
     <el-button @click="cancelReady"  :disabled="formLoading">鏀惧純棰嗙敤</el-button>
     <el-button @click="resetForm()">閲� 缃�</el-button>
     <el-button v-if="needAutoFeeConfirm(formData.checkType)" @click="feeConfirm"  :disabled="formLoading">纭垂</el-button>
@@ -147,9 +173,11 @@
 import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
 import {useCheckTypeStore} from '@/store/modules/checkType'
 import {calGender, getBookBeginTime} from "@/utils";
-import {DICT_TYPE} from "@/utils/dict";
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 import {tranlateDevState} from "@/utils/statusFormatter";
 import {getCheckTypeName, needAutoFeeConfirm} from "../../../../utils/checkTypeFormatter";
+// 闇�姹�1锛氭偅鑰呬俊鎭� 18 椤圭粺涓�灞曠ず鍧�
+import PatientInfoBlock from "@/views/ecg/doctor/components/PatientInfoBlock.vue";
 
 /** 璁惧棰嗙敤 琛ㄥ崟 */
 defineComponent({ name: 'DevReadyPanel' })
@@ -215,6 +243,9 @@
 
 // 鏍规嵁鎮h�呮垨璁惧, 鑾峰彇 Free鐨勭璧�
 const getFreeRentInfo = async (devRentVO) => {
+  if ((devRentVO.devId == null || devRentVO.devId === '') && (devRentVO.patId == null || devRentVO.patId === '') )
+    return
+
   const data = await DevRentApi.getFreeRent(devRentVO)
   if (null === data)
     return
@@ -238,7 +269,7 @@
     await DevRentApi.devReady(formData.value)
 
     if (autoPrint.value && formData.value.patId && formData.value.checkType) {
-      printBill(formData.value.patId, formData.value.checkType)
+      printBill(formData.value.patDetails?.appointmentId)
     }
 
     // 鑷姩纭垂
@@ -281,9 +312,30 @@
     checkType: undefined,
     rentTime: new Date().getTime(),
     returnTime: undefined,
+    tolerance: undefined,
     remark: undefined,
     patDetails: undefined,
     paid: undefined,
+    // 闇�姹�1锛歅atientInfoBlock 渚濊禆鐨勫钩閾哄瓧娈碉紝鍏堝垵濮嬪寲涓� undefined锛�
+    // 闅忓悗鐢� setPatient 浠� QueueVO 璧嬪�硷紙涓嶅垵濮嬪寲浼氳涓嶅埌灞炴�э級
+    applyNo: undefined,
+    episodeId: undefined,
+    patGender: undefined,
+    patBirthday: undefined,
+    registerDate: undefined,
+    doctor: undefined,
+    doctorTime: undefined,
+    patSrc: undefined,
+    patMobile: undefined,
+    patPhone: undefined,
+    patWardDesc: undefined,
+    patBedNo: undefined,
+    medicalCard: undefined,
+    doctorAdviceNo: undefined,
+    outpatientNo: undefined,
+    patIdentityId: undefined,
+    status: undefined,
+    seqNum: undefined,
   }
   formRef.value?.resetFields()
 
@@ -302,6 +354,24 @@
   formData.value.patId = queueVO?.patId
   formData.value.patName = queueVO?.patName
   formData.value.checkType = queueVO?.bookCheckType
+  formData.value.tolerance = queueVO?.tolerance // 澶氳�愯嵂锛屽悗绔粠棰勭害鍗曡ˉ榻�
+  // 闇�姹�1锛氫互涓嬪钩閾哄瓧娈电敱鍚庣浠庨绾﹀崟鍥炲~鍒� QueueRespVO锛�
+  // 蹇呴』鏄惧紡璧嬪�肩粰 formData锛屽惁鍒欐ā鏉块噷璇讳笉鍒帮紙鍘熷厛鍙祴鍊间簡涓婇潰 6 涓級銆�
+  formData.value.patGender = queueVO?.patGender
+  formData.value.patBirthday = queueVO?.patBirthday
+  formData.value.registerDate = queueVO?.registerDate
+  formData.value.doctor = queueVO?.doctor
+  formData.value.doctorTime = queueVO?.doctorTime
+  formData.value.patSrc = queueVO?.patSrc
+  formData.value.patMobile = queueVO?.patMobile
+  formData.value.patPhone = queueVO?.patPhone
+  formData.value.patWardDesc = queueVO?.patWardDesc
+  formData.value.patBedNo = queueVO?.patBedNo
+  formData.value.medicalCard = queueVO?.medicalCard
+  formData.value.outpatientNo = queueVO?.outpatientNo
+    // 闇�姹�1锛氬尰鍢卞彿锛堟鍓� 3 涓潰鏉块兘閬楁紡浜嗚瀛楁鐨勮祴鍊硷紝瀵艰嚧 PatientInfoBlock 鎭掓樉绀� '-'锛�
+    formData.value.doctorAdviceNo = queueVO?.doctorAdviceNo
+  formData.value.patIdentityId = queueVO?.patIdentityId
   getFreeRentInfo(formData.value)  // 寰呮鏌ョ殑淇℃伅  @ dev_rent 琛�
   copyBarcode()
 }
@@ -354,10 +424,11 @@
   devInfo.value.state = data.devState
 }
 
-const printBill = async (patId: string, checkType: number, printMode?: number) => {
+const printBill = async (appointmentId: number | null | undefined, printMode?: number) => {
+  if ( appointmentId == null )
+    return
 
-  const curAppointment: AppointmentVO = await AppointmentApi.getCurAppointmentByPatIdAndCheckType( patId, checkType )
-  //console.info( curAppointment )
+  const curAppointment: AppointmentVO = await AppointmentApi.getAppointment( appointmentId )
 
 // 寮曞叆鍚庝娇鐢ㄧず渚�
   hiprint.init({
@@ -442,33 +513,51 @@
 
 const feeConfirm = async () => {
   if (formData.value.id == null) {
-    message.error(t('璇峰厛棰嗙敤'))
+    message.error('璇峰厛棰嗙敤')
     return
   }
 
-  const result = await DevRentApi.feeConfirm(formData.value.id)
-  if (0 === result)
-    message.success(t('纭垂鎿嶄綔鎴愬姛'))
+ try {
+    const result = await DevRentApi.feeConfirm(formData.value.id)
+    if (0 === result) {
+      //message.success('纭垂鎿嶄綔鎴愬姛')
+    }
+  } catch (err) {
+    // 妗嗘灦 浼氱粰鍑� 鍚庡彴鐨� 閿欒淇℃伅
+  }
 }
 
 const feeCancel = async () => {
   if (formData.value.id == null) {
-    message.error(t('璇峰厛棰嗙敤'))
+    message.error('璇峰厛棰嗙敤')
     return
   }
 
-  const result = await DevRentApi.feeCancel(formData.value.id)
-  if (0 === result)
-    message.success(t('鎿嶄綔鎴愬姛'))
+  try {
+    const result = await DevRentApi.feeCancel(formData.value.id)
+    if (0 === result) {
+      //message.success('纭垂鍙栨秷鎴愬姛')
+    }
+  } catch (err) {
+    // 妗嗘灦 浼氱粰鍑� 鍚庡彴鐨� 閿欒淇℃伅
+  }
 }
 
+/**
+ * 鑾峰彇鏉″舰鐮侊紝鏄剧ず涓庡惁  鍚屼竴涓��
+ */
 const getDisplayBarcode = (): string => {
   if (formData.value.checkType == null)
     return ""
 
-  const displayBarcode: number[] = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType!)
-  if (formData.value.patDetails == null || formData.value.patDetails.source == null ||
-      !displayBarcode.includes( formData.value.patDetails.source ))
+  if (formData.value.patDetails?.source == null)
+    return ""
+
+  const displayBarcode: number[] = checkTypeStore.getCheckTypeDispBarCode(formData.value.checkType)
+  if (displayBarcode == null || displayBarcode.length === 0)
+    return ""
+
+  if (!displayBarcode.includes( formData.value.patDetails.source ))
     return ""
 
   return getBarcode()
@@ -492,7 +581,12 @@
 
 const copyBarcode = async () => {
   displayBarCode.value = getDisplayBarcode()
-  await navigator.clipboard.writeText( getBarcode() );
+
+  const barCode = getBarcode()
+  if (isStringEmpty(barCode))
+    return
+
+  await navigator.clipboard.writeText( barCode );
 }
 
 /** 鍒濆鍖� **/

--
Gitblit v1.9.3