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;
|
||||
}
|
||||
}
|
||||
@@ -60,22 +60,44 @@ test('Bug #570: 门诊预约挂号状态显示及查询逻辑修复', async ({ p
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/outpatient/appointment');
|
||||
|
||||
// 1. 执行预约操作
|
||||
await page.click('button:has-text("预约")').first();
|
||||
await page.click('text=确认预约');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// 2. 验证预约成功后状态显示为“已预约”而非“已锁定”
|
||||
const statusTag = page.locator('.el-table__body tr:first-child .el-tag');
|
||||
await expect(statusTag).toHaveText('已预约');
|
||||
|
||||
// 3. 验证筛选“已预约”状态能正常查询到数据
|
||||
await page.click('.status-filter .el-select');
|
||||
await page.click('text=已预约');
|
||||
await page.click('text=查询');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const rows = await page.locator('.el-table__body tr').count();
|
||||
await page.click('text=查询');
|
||||
await page.waitForTimeout(1000);
|
||||
const rows = await page.locator('.el-table__body-wrapper tbody tr').count();
|
||||
expect(rows).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
// @bug572 @regression
|
||||
test('Bug #572: 传染病报告卡自动同步患者现住址与职业信息', async ({ page }) => {
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="username"]', 'doctor1');
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/outpatient/doctor-workstation');
|
||||
|
||||
// 1. 选择已维护档案的患者
|
||||
await page.click('text=患者2');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// 2. 录入传染病诊断并保存
|
||||
await page.click('text=诊断录入');
|
||||
await page.fill('input[placeholder="输入诊断名称"]', '霍乱');
|
||||
await page.click('text=保存');
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// 3. 等待报卡弹窗自动弹出
|
||||
await page.waitForSelector('.infectious-disease-report-dialog', { state: 'visible' });
|
||||
|
||||
// 4. 验证现住址和职业字段已自动从档案同步填充
|
||||
const addressInput = page.locator('input[name="currentAddress"]');
|
||||
const occupationInput = page.locator('input[name="occupation"]');
|
||||
|
||||
await expect(addressInput).toBeVisible();
|
||||
await expect(occupationInput).toBeVisible();
|
||||
|
||||
// 验证非空且包含有效文本(排除默认占位符或空值)
|
||||
const addressVal = await addressInput.inputValue();
|
||||
const occupationVal = await occupationInput.inputValue();
|
||||
expect(addressVal.length).toBeGreaterThan(0);
|
||||
expect(occupationVal.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user