Fix Bug #572: AI修复
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.openhis.application.service.impl;
|
||||
|
||||
import com.openhis.application.domain.dto.InfectiousDiseaseReportDto;
|
||||
import com.openhis.application.domain.entity.Diagnosis;
|
||||
import com.openhis.application.domain.entity.Patient;
|
||||
import com.openhis.application.mapper.DiagnosisMapper;
|
||||
import com.openhis.application.mapper.PatientMapper;
|
||||
import com.openhis.application.service.InfectiousDiseaseReportService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 传染病报告卡业务实现
|
||||
*
|
||||
* 修复 Bug #572:原逻辑在初始化报卡 DTO 时仅填充了诊断基础信息,
|
||||
* 遗漏了患者档案中的“现住址”与“职业”字段同步,导致前端弹窗显示为空。
|
||||
* 现增加患者档案查询与字段映射逻辑。
|
||||
*/
|
||||
@Service
|
||||
public class InfectiousDiseaseReportServiceImpl implements InfectiousDiseaseReportService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(InfectiousDiseaseReportServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private PatientMapper patientMapper;
|
||||
|
||||
@Autowired
|
||||
private DiagnosisMapper diagnosisMapper;
|
||||
|
||||
@Override
|
||||
public InfectiousDiseaseReportDto generateReportCard(Long patientId, Long diagnosisId) {
|
||||
InfectiousDiseaseReportDto reportDto = new InfectiousDiseaseReportDto();
|
||||
|
||||
// 1. 填充诊断相关信息
|
||||
Diagnosis diagnosis = diagnosisMapper.selectById(diagnosisId);
|
||||
if (diagnosis != null) {
|
||||
reportDto.setDiagnosisName(diagnosis.getName());
|
||||
reportDto.setDiagnosisTime(diagnosis.getCreateTime());
|
||||
reportDto.setDiagnosisCode(diagnosis.getCode());
|
||||
}
|
||||
|
||||
// 2. 修复 Bug #572:自动同步并填充患者档案中的“现住址”与“职业”信息
|
||||
Patient patient = patientMapper.selectById(patientId);
|
||||
if (patient != null) {
|
||||
reportDto.setPatientName(patient.getName());
|
||||
reportDto.setPatientIdCard(patient.getIdCard());
|
||||
reportDto.setGender(patient.getGender());
|
||||
reportDto.setBirthDate(patient.getBirthDate());
|
||||
|
||||
// 核心修复:映射现住址与职业
|
||||
reportDto.setCurrentAddress(patient.getCurrentAddress());
|
||||
reportDto.setOccupation(patient.getOccupation());
|
||||
|
||||
logger.info("已自动同步患者[{}]档案信息至传染病报告卡,现住址:[{}],职业:[{}]",
|
||||
patientId, patient.getCurrentAddress(), patient.getOccupation());
|
||||
} else {
|
||||
logger.warn("未找到患者[{}]档案信息,报告卡患者基础字段将为空", patientId);
|
||||
}
|
||||
|
||||
return reportDto;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user