fix(BUG-179): 修复入科选床入院体征数据未保存问题

问题描述:
- 入科选床弹窗中填写的入院体征数据(身高、体重、体温等)未保存到数据库
- 重新打开弹窗时数据未显示

根因分析:
1. 前端提交时过滤空字符串,导致空值的体征字段未被提交
2. 后端保存时只保存非空值,且未清除已有数据,导致旧数据残留

修复方案:
1. 前端: transferInDialog.vue - 体征字段(height, weight等)即使为空字符串也要提交
2. 后端: ATDManageAppServiceImpl.java - 保存前先删除已有体征记录,再保存新数据

测试建议:
- 测试填写完整体征数据后保存并重新打开
- 测试清空部分体征字段后保存并重新打开
- 测试修改已有体征数据后保存

Closes BUG-179
This commit is contained in:
2026-03-18 11:26:04 +08:00
parent 1e7e0453e6
commit 8f2405ee34
2 changed files with 20 additions and 3 deletions

View File

@@ -833,12 +833,23 @@ public class ATDManageAppServiceImpl implements IATDManageAppService {
= ((List<DocStatisticsDto>) docStatisticsAppService.queryByEncounterId(encounterId).getData()).stream()
.filter(item -> DocDefinitionEnum.ADMISSION_VITAL_SIGNS.getValue().equals(item.getSource())).toList();
List<DocStatisticsDto> 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());

View File

@@ -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;
}
});