LIJU 1 week ago
parent
commit
aab76b1ca2
1 changed files with 80 additions and 0 deletions
  1. 80 0
      src/views/medical-advice/nursing-manage/ThreeTestList.vue

+ 80 - 0
src/views/medical-advice/nursing-manage/ThreeTestList.vue

@@ -261,6 +261,7 @@ import PatientBaseList from "@/components/medical-advice/PatientBaseList.vue"
 import twMbEdit from "@/components/medical-advice/nursing-manage/twMbEdit.vue"
 import PsInfo from "@/views/medical-advice/nursing-manage/PsInfo.vue"
 import {queryThreeTestList,saveThreeTest,queyGm,saveGm,deleteYzTemperature,deleteYzTemperatureSum} from "@/api/medical-advice/nursing-manage";
+import {getPatientBaseInfo} from "@/api/medical-advice/medical-advice-management";
 import { getFormatDatetime } from "@/utils/date";
 import {onMounted} from "vue";
 import {stringNotBlank} from "@/utils/blank-utils";
@@ -274,6 +275,8 @@ const yzTemperatureVOS = ref([])
 const yzTemperatureSums = ref([])
 const allPatientList = ref([])
 const curWard = ref('')
+// 患者详细信息列表,用于入院时间验证
+const patientDetailInfoList = ref([])
 //过敏信息
 
 const psDialogFlag = ref(false)
@@ -570,6 +573,26 @@ const selectPatientInfo=(val)=>{
         tempVisitIds.push(visitId)
     }
     queryParam.value.visitIds= tempVisitIds;
+    
+    // 获取所有选中患者的详细信息(包含入院时间)
+    patientDetailInfoList.value = []
+    if (val && val.length > 0) {
+        // 使用 Promise.all 并行获取所有患者的详细信息
+        const promises = val.map(patient => {
+            const params = {
+                inpatientNo: patient.inpatientNo,
+                admissTimes: patient.admissTimes,
+                inOutStatusFlag: '0'
+            }
+            return getPatientBaseInfo(params)
+        })
+        
+        Promise.all(promises).then((results) => {
+            patientDetailInfoList.value = results
+        }).catch((error) => {
+            console.error('获取患者详细信息失败:', error)
+        })
+    }
 }
 
 const activeName = ref('first')
@@ -580,6 +603,11 @@ const saveThreeTestInfo = () =>{
         return
     }
     
+    // 验证入院时间
+    if (!validateSaveDataAdmissionDate()) {
+        return
+    }
+    
     ElMessageBox.confirm('请确认是否保存', {
         cancelButtonText: '取消',
         confirmButtonText: '确定',
@@ -662,6 +690,58 @@ const validateBodyWeightData = () => {
     }
     return true
 }
+
+
+
+// 验证保存数据时的入院时间(使用最晚的入院时间)
+const validateSaveDataAdmissionDate = () => {
+    if (!patientDetailInfoList.value || patientDetailInfoList.value.length === 0) {
+        return true
+    }
+    
+    // 找到最晚的入院时间(最严格的限制)
+    let latestAdmissionDate = null
+    for (const patientInfo of patientDetailInfoList.value) {
+        if (patientInfo && patientInfo.admissDate) {
+            const admissionDate = new Date(patientInfo.admissDate)
+            if (!latestAdmissionDate || admissionDate > latestAdmissionDate) {
+                latestAdmissionDate = admissionDate
+            }
+        }
+    }
+    
+    if (!latestAdmissionDate) {
+        return true
+    }
+    
+    const admissionDateStr = getFormatDatetime(latestAdmissionDate, 'YYYY-MM-DD')
+    
+    // 验证图表数据
+    for (let i = 0; i < yzTemperatureVOS.value.length; i++) {
+        const row = yzTemperatureVOS.value[i]
+        if (row.recDateStr) {
+            const inputDate = new Date(row.recDateStr)
+            if (inputDate < latestAdmissionDate) {
+                ElMessage.error(`第${i + 1}行图表数据:输入日期 ${row.recDateStr} 不能早于患者入院时间 ${admissionDateStr}`)
+                return false
+            }
+        }
+    }
+    
+    // 验证总量数据
+    for (let i = 0; i < yzTemperatureSums.value.length; i++) {
+        const row = yzTemperatureSums.value[i]
+        if (row.recDateStr) {
+            const inputDate = new Date(row.recDateStr)
+            if (inputDate < latestAdmissionDate) {
+                ElMessage.error(`第${i + 1}行总量数据:输入日期 ${row.recDateStr} 不能早于患者入院时间 ${admissionDateStr}`)
+                return false
+            }
+        }
+    }
+    
+    return true
+}
 </script>
 
 <style scoped>