From 8f2405ee34ac3fb876cef748e60d824a8e25e423 Mon Sep 17 00:00:00 2001 From: chenqi Date: Wed, 18 Mar 2026 11:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(BUG-179):=20=E4=BF=AE=E5=A4=8D=E5=85=A5?= =?UTF-8?q?=E7=A7=91=E9=80=89=E5=BA=8A=E5=85=A5=E9=99=A2=E4=BD=93=E5=BE=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9C=AA=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题描述: - 入科选床弹窗中填写的入院体征数据(身高、体重、体温等)未保存到数据库 - 重新打开弹窗时数据未显示 根因分析: 1. 前端提交时过滤空字符串,导致空值的体征字段未被提交 2. 后端保存时只保存非空值,且未清除已有数据,导致旧数据残留 修复方案: 1. 前端: transferInDialog.vue - 体征字段(height, weight等)即使为空字符串也要提交 2. 后端: ATDManageAppServiceImpl.java - 保存前先删除已有体征记录,再保存新数据 测试建议: - 测试填写完整体征数据后保存并重新打开 - 测试清空部分体征字段后保存并重新打开 - 测试修改已有体征数据后保存 Closes BUG-179 --- .../appservice/impl/ATDManageAppServiceImpl.java | 15 +++++++++++++-- .../inOut/components/transferInDialog.vue | 8 +++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java index 2f159586..0e78b07f 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/inhospitalnursestation/appservice/impl/ATDManageAppServiceImpl.java @@ -833,12 +833,23 @@ public class ATDManageAppServiceImpl implements IATDManageAppService { = ((List) docStatisticsAppService.queryByEncounterId(encounterId).getData()).stream() .filter(item -> DocDefinitionEnum.ADMISSION_VITAL_SIGNS.getValue().equals(item.getSource())).toList(); List list = new ArrayList<>(data); + + // 先删除所有已有的入院体征记录(重新保存最新数据) + for (DocStatisticsDto existingItem : data) { + if (existingItem.getId() != null) { + docStatisticsMapper.deleteById(existingItem.getId()); + } + } + list.clear(); + map.keySet().forEach(key -> { - if (map.get(key) != null && !map.get(key).isEmpty()) { + String value = map.get(key); + // 只保存非空值 + if (value != null && !value.isEmpty() && !" ".equals(value)) { DocStatisticsDefinitionDto docStatisticsDefinitionDto = definitionDtoHashMap.get(key); DocStatisticsDto statistics = new DocStatisticsDto(); statistics.setStatisticDefinitionCode(key); - statistics.setValue(map.get(key)); + statistics.setValue(value); statistics.setEncounterId(encounterId); statistics.setPatientId(encounter.getPatientId()); statistics.setStatisticDefinitionId(docStatisticsDefinitionDto.getId()); diff --git a/openhis-ui-vue3/src/views/inpatientNurse/inOut/components/transferInDialog.vue b/openhis-ui-vue3/src/views/inpatientNurse/inOut/components/transferInDialog.vue index 29c3df0f..307fc995 100644 --- a/openhis-ui-vue3/src/views/inpatientNurse/inOut/components/transferInDialog.vue +++ b/openhis-ui-vue3/src/views/inpatientNurse/inOut/components/transferInDialog.vue @@ -571,7 +571,13 @@ const handleSubmit = async () => { Object.keys(interventionForm.value).forEach(key => { const value = interventionForm.value[key]; // 保留非空的值(0、false等有效值也需要保留) - if (value !== '' && value !== null && value !== undefined) { + // 特别注意:体征字段(height, weight等)即使为空字符串也要提交,用于清除已有数据 + const vitalSignFields = ['height', 'weight', 'temperature', 'hertRate', 'pulse', 'endBloodPressure', 'highBloodPressure']; + if (vitalSignFields.includes(key)) { + // 体征字段:提交所有值,包括空字符串(用于清除数据) + formData[key] = value === undefined ? '' : value; + } else if (value !== '' && value !== null && value !== undefined) { + // 其他字段:只保留非空值 formData[key] = value; } });