Fix Bug #572: AI修复

This commit is contained in:
2026-05-26 23:29:40 +08:00
parent 5b7cbca3d6
commit fc7f28a264
4 changed files with 218 additions and 86 deletions

View File

@@ -0,0 +1,24 @@
package com.openhis.web.outpatient.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/**
* 患者档案数据库操作 Mapper
*/
@Mapper
public interface PatientProfileMapper {
/**
* Bug #572 Fix: 查询患者档案中的现住址与职业信息
* 用于传染病报告卡初始化时自动填充
*
* @param patientId 患者主键ID
* @return 包含 current_address 和 occupation 的 Map
*/
@Select("SELECT current_address, occupation FROM hisdev.patient_profile WHERE patient_id = #{patientId}")
Map<String, String> selectAddressAndOccupationByPatientId(@Param("patientId") Long patientId);
}

View File

@@ -0,0 +1,44 @@
package com.openhis.web.outpatient.service;
import com.openhis.web.outpatient.dto.InfectiousDiseaseReportDTO;
import com.openhis.web.outpatient.mapper.PatientProfileMapper;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 传染病报告卡服务实现
*/
@Service
public class InfectiousDiseaseReportServiceImpl implements InfectiousDiseaseReportService {
private final PatientProfileMapper patientProfileMapper;
public InfectiousDiseaseReportServiceImpl(PatientProfileMapper patientProfileMapper) {
this.patientProfileMapper = patientProfileMapper;
}
/**
* Bug #572 Fix: 初始化传染病报告卡数据
* 原逻辑未关联患者档案表,导致现住址与职业字段为空。
* 现补充档案查询逻辑,自动映射至报卡 DTO。
*/
@Override
public InfectiousDiseaseReportDTO initReportCard(Long patientId) {
if (patientId == null) {
throw new IllegalArgumentException("患者ID不能为空");
}
InfectiousDiseaseReportDTO report = new InfectiousDiseaseReportDTO();
report.setPatientId(patientId);
// 自动同步患者档案中的现住址与职业
Map<String, String> profile = patientProfileMapper.selectAddressAndOccupationByPatientId(patientId);
if (profile != null) {
report.setCurrentAddress(profile.get("current_address"));
report.setOccupation(profile.get("occupation"));
}
return report;
}
}