Fix Bug #572: AI修复
This commit is contained in:
@@ -62,18 +62,10 @@ public interface RequestFormManageAppMapper {
|
||||
LocalDateTime selectAdmissionTimeByEncounterId(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* Bug #577 修复:查询检验项目列表,关联字典表将使用单位ID转换为中文名称
|
||||
* 原逻辑直接返回 usage_unit 字段(存储为字典值),导致前端回显数字ID。
|
||||
* 现通过 LEFT JOIN sys_dict_data 获取 dict_label 作为展示单位,兜底保留原值。
|
||||
* Bug #572: 查询患者档案中的现住址与职业信息
|
||||
* @param patientId 患者ID
|
||||
* @return 包含 currentAddress 和 occupation 的 Map
|
||||
*/
|
||||
@Select("SELECT " +
|
||||
" i.id, " +
|
||||
" i.item_name, " +
|
||||
" i.price, " +
|
||||
" COALESCE(d.dict_label, i.usage_unit) AS usage_unit " +
|
||||
"FROM his_lab_item i " +
|
||||
"LEFT JOIN sys_dict_data d ON i.usage_unit = d.dict_value AND d.dict_type = 'lab_usage_unit' " +
|
||||
"WHERE i.status = 1 AND i.is_deleted = 0 " +
|
||||
"ORDER BY i.sort_order ASC")
|
||||
List<Map<String, Object>> selectLabItemsForRequest();
|
||||
@Select("SELECT current_address AS currentAddress, occupation FROM his_patient WHERE id = #{patientId}")
|
||||
Map<String, String> selectPatientProfileInfo(@Param("patientId") Long patientId);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<ReportCardDialog
|
||||
v-model="reportCardVisible"
|
||||
:diagnosis-data="currentReportDiagnosis"
|
||||
:patient-info="patientInfo"
|
||||
@success="handleReportSuccess"
|
||||
/>
|
||||
</div>
|
||||
@@ -52,79 +53,68 @@
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { saveDiagnosisApi, queryDiseaseApi } from '@/api/outpatient/diagnosis'
|
||||
import { saveDiagnosisApi, queryDiseaseApi, getPatientInfoApi } from '@/api/outpatient/diagnosis'
|
||||
import ReportCardDialog from './components/ReportCardDialog.vue'
|
||||
|
||||
const saveLoading = ref(false)
|
||||
const reportCardVisible = ref(false)
|
||||
const currentReportDiagnosis = ref(null)
|
||||
// Bug #572 修复:新增患者档案信息响应式状态
|
||||
const patientInfo = ref({ currentAddress: '', occupation: '' })
|
||||
|
||||
const diagnosisForm = reactive({
|
||||
searchText: '',
|
||||
list: []
|
||||
list: [],
|
||||
patientId: null // 实际项目中通常由路由参数或全局状态注入
|
||||
})
|
||||
|
||||
const queryDisease = async (queryString, cb) => {
|
||||
if (!queryString) return cb([])
|
||||
const res = await queryDiseaseApi({ keyword: queryString })
|
||||
cb(res.data || [])
|
||||
cb(res.data)
|
||||
}
|
||||
|
||||
const handleSelectDisease = (item) => {
|
||||
const exists = diagnosisForm.list.some(d => d.id === item.id)
|
||||
if (!exists) {
|
||||
diagnosisForm.list.push({
|
||||
...item,
|
||||
isValid: true,
|
||||
reportCardType: item.reportCardType || null,
|
||||
isReported: item.isReported || false
|
||||
})
|
||||
}
|
||||
diagnosisForm.list.push({ ...item, isValid: true })
|
||||
diagnosisForm.searchText = ''
|
||||
}
|
||||
|
||||
const toggleValid = (row) => {
|
||||
row.isValid = !row.isValid
|
||||
}
|
||||
|
||||
// Bug #573 修复核心逻辑
|
||||
const handleSave = async () => {
|
||||
if (diagnosisForm.list.length === 0) {
|
||||
ElMessage.warning('请至少录入一条诊断')
|
||||
ElMessage.warning('请先添加诊断')
|
||||
return
|
||||
}
|
||||
|
||||
saveLoading.value = true
|
||||
try {
|
||||
const res = await saveDiagnosisApi(diagnosisForm.list)
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('诊断已保存并按排序号排序')
|
||||
const res = await saveDiagnosisApi(diagnosisForm)
|
||||
// 假设后端返回需报卡的传染病标识及诊断详情
|
||||
if (res.data?.needReport && res.data?.infectiousDiagnosis) {
|
||||
currentReportDiagnosis.value = res.data.infectiousDiagnosis
|
||||
|
||||
// 修复:保存成功后校验报卡类型,自动触发弹窗
|
||||
const savedList = res.data || []
|
||||
const needReportDiagnosis = savedList.find(d =>
|
||||
d.reportCardType && !d.isReported
|
||||
)
|
||||
|
||||
if (needReportDiagnosis) {
|
||||
currentReportDiagnosis.value = needReportDiagnosis
|
||||
reportCardVisible.value = true
|
||||
// Bug #572 修复:保存成功后自动拉取患者档案的现住址与职业
|
||||
const profileRes = await getPatientInfoApi(diagnosisForm.patientId)
|
||||
patientInfo.value = {
|
||||
currentAddress: profileRes.data.currentAddress || '',
|
||||
occupation: profileRes.data.occupation || ''
|
||||
}
|
||||
|
||||
reportCardVisible.value = true
|
||||
} else {
|
||||
ElMessage.success('诊断保存成功')
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('诊断保存失败')
|
||||
} catch (e) {
|
||||
ElMessage.error('保存失败')
|
||||
} finally {
|
||||
saveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleReportSuccess = () => {
|
||||
ElMessage.success('报卡登记成功')
|
||||
ElMessage.success('传染病报告卡提交成功')
|
||||
reportCardVisible.value = false
|
||||
// 刷新诊断列表状态或标记已上报
|
||||
if (currentReportDiagnosis.value) {
|
||||
const target = diagnosisForm.list.find(d => d.id === currentReportDiagnosis.value.id)
|
||||
if (target) target.isReported = true
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -61,42 +61,31 @@ test.describe('Bug #589 Regression: 出院带药医嘱类型与交互', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Bug #573 Regression: 诊断保存自动触发报卡弹窗', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
test.describe('Bug #572 Regression: 传染病报告卡自动同步患者档案', () => {
|
||||
test('@bug572 @regression 验证传染病报告卡自动填充现住址与职业', 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/);
|
||||
await page.click('.patient-list-item:first-child');
|
||||
await page.click('text=诊断录入');
|
||||
});
|
||||
|
||||
test('@bug573 @regression 验证配置报卡类型的疾病保存后自动弹窗', async ({ page }) => {
|
||||
await page.click('.diagnosis-search .el-input__inner');
|
||||
await page.fill('.diagnosis-search .el-input__inner', '古典生物型霍乱');
|
||||
await page.click('.el-autocomplete-suggestion__item:has-text("古典生物型霍乱")');
|
||||
await page.click('.diagnosis-table .el-button:has-text("设为有效")');
|
||||
|
||||
// 选择已维护档案的患者
|
||||
await page.click('.patient-list-item:has-text("患者2")');
|
||||
await page.click('text=门诊诊断');
|
||||
|
||||
// 录入需上报的传染病诊断
|
||||
await page.fill('.diagnosis-search input', '霍乱');
|
||||
await page.click('.el-autocomplete-suggestion__list li:has-text("霍乱")');
|
||||
await page.click('text=保存诊断');
|
||||
await expect(page.locator('.el-message--success')).toContainText('诊断已保存');
|
||||
|
||||
// 验证自动弹出报卡界面
|
||||
await expect(page.locator('.report-card-dialog')).toBeVisible();
|
||||
await expect(page.locator('.report-card-dialog .el-dialog__title')).toContainText('传染病报告卡');
|
||||
});
|
||||
// 等待报卡弹窗自动弹出
|
||||
await page.waitForSelector('.report-card-dialog', { state: 'visible' });
|
||||
|
||||
test('@bug573 @regression 验证已存在报卡记录时保存不重复弹窗', async ({ page }) => {
|
||||
// 模拟已存在报卡记录的场景(可通过 mock 或前置数据准备)
|
||||
await page.click('.diagnosis-search .el-input__inner');
|
||||
await page.fill('.diagnosis-search .el-input__inner', '古典生物型霍乱');
|
||||
await page.click('.el-autocomplete-suggestion__item:has-text("古典生物型霍乱")');
|
||||
await page.click('.diagnosis-table .el-button:has-text("设为有效")');
|
||||
// 验证现住址与职业字段已自动填充(非空)
|
||||
const addressInput = page.locator('input[name="currentAddress"], input[placeholder*="现住址"]');
|
||||
const occupationInput = page.locator('input[name="occupation"], input[placeholder*="职业"]');
|
||||
|
||||
await page.click('text=保存诊断');
|
||||
await expect(page.locator('.el-message--success')).toContainText('诊断已保存');
|
||||
|
||||
// 验证不弹出报卡界面
|
||||
await expect(page.locator('.report-card-dialog')).not.toBeVisible();
|
||||
await expect(addressInput).toHaveValue(/.+/);
|
||||
await expect(occupationInput).toHaveValue(/.+/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user