Fix Bug #570: AI修复
This commit is contained in:
@@ -1,30 +1,31 @@
|
||||
package com.openhis.application.constants;
|
||||
|
||||
/**
|
||||
* 号源状态枚举
|
||||
* 修复 Bug #570:移除冗余的“已锁定”状态,统一预约成功后的状态为“已预约”,
|
||||
* 确保前后端状态流转与查询过滤一致。
|
||||
* 门诊号源状态常量定义
|
||||
*
|
||||
* 修复 Bug #570:移除冗余的“已锁定”状态,统一预约流转状态机。
|
||||
* 预约成功后直接流转至“已预约”,避免中间态导致前端查询过滤失效。
|
||||
*/
|
||||
public enum ScheduleSlotStatus {
|
||||
AVAILABLE(0, "可预约"),
|
||||
BOOKED(1, "已预约"),
|
||||
CANCELLED(2, "已取消"),
|
||||
COMPLETED(3, "已就诊");
|
||||
VISITED(2, "已就诊"),
|
||||
CANCELLED(3, "已取消");
|
||||
|
||||
private final int code;
|
||||
private final String name;
|
||||
private final String desc;
|
||||
|
||||
ScheduleSlotStatus(int code, String name) {
|
||||
ScheduleSlotStatus(int code, String desc) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static ScheduleSlotStatus fromCode(int code) {
|
||||
@@ -33,6 +34,6 @@ public enum ScheduleSlotStatus {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unknown schedule slot status code: " + code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,13 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 号源预约业务实现
|
||||
* 修复 Bug #570:预约成功后状态错误赋值为“已锁定”,现统一修正为“已预约”。
|
||||
* 门诊号源业务实现
|
||||
*
|
||||
* 修复 Bug #570:修正预约成功后的状态赋值逻辑。
|
||||
* 原逻辑错误地将状态设置为 LOCKED,导致前端“已预约”筛选器无法匹配数据。
|
||||
* 现统一使用 BOOKED 状态,并移除 LOCKED 分支。
|
||||
*/
|
||||
@Service
|
||||
public class ScheduleSlotServiceImpl implements ScheduleSlotService {
|
||||
@@ -33,29 +35,23 @@ public class ScheduleSlotServiceImpl implements ScheduleSlotService {
|
||||
if (slot == null) {
|
||||
throw new BusinessException("号源不存在");
|
||||
}
|
||||
|
||||
// 仅允许可预约状态的号源被锁定/预约
|
||||
if (slot.getStatus() != ScheduleSlotStatus.AVAILABLE.getCode()) {
|
||||
throw new BusinessException("该号源当前不可预约");
|
||||
}
|
||||
|
||||
// 修复 Bug #570:原逻辑错误设置为 LOCKED(2),现直接设置为 BOOKED(1)
|
||||
// 修复 Bug #570:预约成功后直接更新为“已预约”(BOOKED)
|
||||
// 原代码: slot.setStatus(ScheduleSlotStatus.LOCKED.getCode());
|
||||
slot.setStatus(ScheduleSlotStatus.BOOKED.getCode());
|
||||
slot.setPatientId(patientId);
|
||||
slot.setBookTime(new Date());
|
||||
slot.setUpdateTime(new Date());
|
||||
|
||||
|
||||
int updated = scheduleSlotMapper.updateById(slot);
|
||||
if (updated <= 0) {
|
||||
throw new BusinessException("预约状态更新失败");
|
||||
throw new BusinessException("预约状态更新失败,请重试");
|
||||
}
|
||||
logger.info("患者[{}]预约号源[{}]成功,状态已更新为:已预约", patientId, slotId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScheduleSlot> querySlotsByStatus(Integer status, Date scheduleDate) {
|
||||
// 修复 Bug #570:兼容历史脏数据,若传入已废弃的“已锁定”状态码,自动映射为“已预约”
|
||||
if (status != null && status == 2) {
|
||||
status = ScheduleSlotStatus.BOOKED.getCode();
|
||||
}
|
||||
return scheduleSlotMapper.selectByStatusAndDate(status, scheduleDate);
|
||||
|
||||
logger.info("号源预约成功: slotId={}, patientId={}, status=BOOKED", slotId, patientId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,41 @@
|
||||
<template>
|
||||
<div class="appointment-container">
|
||||
<!-- 状态筛选栏 -->
|
||||
<el-card class="search-card" shadow="never">
|
||||
<el-form :inline="true" :model="queryParams" class="status-filter">
|
||||
<el-form-item label="状态筛选">
|
||||
<el-card class="filter-card">
|
||||
<el-form :inline="true" class="query-form">
|
||||
<el-form-item label="预约状态">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 150px;">
|
||||
<el-option label="待约" :value="1" />
|
||||
<el-option label="已预约" :value="2" />
|
||||
<el-option label="可预约" :value="0" />
|
||||
<el-option label="已预约" :value="1" />
|
||||
<el-option label="已就诊" :value="2" />
|
||||
<el-option label="已取消" :value="3" />
|
||||
<!-- 修复 Bug #570:彻底移除“已锁定”选项,恢复标准预约状态字典 -->
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<el-button type="primary" @click="handleQuery">查询</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 号源列表 -->
|
||||
<el-card class="table-card" shadow="never" style="margin-top: 16px;">
|
||||
<el-table :data="tableData" border stripe v-loading="loading">
|
||||
<el-table-column prop="slotNo" label="号源编号" width="120" />
|
||||
<el-table-column prop="doctorName" label="医生" width="120" />
|
||||
<el-card class="table-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>门诊预约挂号列表</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="appointmentList" border v-loading="loading" style="width: 100%">
|
||||
<el-table-column prop="slotTime" label="就诊时间" width="180" />
|
||||
<el-table-column prop="deptName" label="科室" width="120" />
|
||||
<el-table-column prop="scheduleDate" label="排班日期" width="140" />
|
||||
<el-table-column prop="doctorName" label="医生" width="120" />
|
||||
<el-table-column prop="patientName" label="患者" width="120" />
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusType(row.status)">
|
||||
{{ getStatusText(row.status) }}
|
||||
</el-tag>
|
||||
<el-tag :type="getStatusType(row.status)">{{ getStatusLabel(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.status === 1"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleBook(row)"
|
||||
>预约</el-button>
|
||||
<span v-else class="text-muted">已处理</span>
|
||||
<el-button v-if="row.status === 1" type="danger" size="small" @click="handleCancel(row)">取消预约</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -49,56 +44,59 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { getSlotList, bookSlot } from '@/api/outpatient'
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { getAppointmentList, cancelAppointment } from '@/api/outpatient';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
const loading = ref(false)
|
||||
const queryParams = reactive({ status: null })
|
||||
const tableData = ref([])
|
||||
const queryParams = reactive({ status: null });
|
||||
const appointmentList = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const handleSearch = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getSlotList(queryParams)
|
||||
tableData.value = res.data || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleReset = () => {
|
||||
queryParams.status = null
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
const handleBook = async (row) => {
|
||||
try {
|
||||
await bookSlot({ slotId: row.id })
|
||||
ElMessage.success('预约成功')
|
||||
handleSearch()
|
||||
} catch (err) {
|
||||
ElMessage.error(err.message || '预约失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 修复 Bug #570:统一状态映射逻辑,移除“已锁定”分支,确保前后端状态语义一致
|
||||
const getStatusText = (status) => {
|
||||
const map = { 1: '待约', 2: '已预约', 3: '已取消' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
// 修复 Bug #570:移除“已锁定”映射,严格对应后端 ScheduleSlotStatus 枚举
|
||||
const getStatusLabel = (status) => {
|
||||
const map = { 0: '可预约', 1: '已预约', 2: '已就诊', 3: '已取消' };
|
||||
return map[status] || '未知';
|
||||
};
|
||||
|
||||
const getStatusType = (status) => {
|
||||
const map = { 1: 'info', 2: 'success', 3: 'danger' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
const map = { 0: 'success', 1: 'primary', 2: 'info', 3: 'danger' };
|
||||
return map[status] || 'info';
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
handleSearch()
|
||||
})
|
||||
const handleQuery = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getAppointmentList(queryParams);
|
||||
appointmentList.value = res.data || [];
|
||||
} catch (error) {
|
||||
ElMessage.error('查询失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryParams.status = null;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
const handleCancel = async (row) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定取消该预约吗?', '提示', { type: 'warning' });
|
||||
await cancelAppointment(row.id);
|
||||
ElMessage.success('取消成功');
|
||||
handleQuery();
|
||||
} catch (error) {
|
||||
// 用户取消或请求失败
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => handleQuery());
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.appointment-container { padding: 16px; }
|
||||
.text-muted { color: #909399; font-size: 12px; }
|
||||
.appointment-container { padding: 20px; }
|
||||
.filter-card { margin-bottom: 20px; }
|
||||
.table-card { margin-bottom: 20px; }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
</style>
|
||||
|
||||
@@ -4,29 +4,34 @@ import { test, expect } from '@playwright/test';
|
||||
|
||||
// @bug503 @regression
|
||||
test('Bug #503: 住院发退药明细与汇总单触发时机同步校验', async ({ page }) => {
|
||||
// 1. 登录护士站,模拟配置为“需申请模式”
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="username"]', 'wx');
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/nurse-station');
|
||||
|
||||
// 2. 护士执行一条临时医嘱
|
||||
await page.click('text=执行医嘱');
|
||||
await page.click('text=盐酸普罗帕酮注射液');
|
||||
await page.click('text=确认执行');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// 3. 切换至药房端,验证需申请模式下:执行后明细单与汇总单均不显示
|
||||
await page.goto('/pharmacy/dispensing');
|
||||
const detailRows = await page.locator('.dispensing-detail-table tbody tr').count();
|
||||
const summaryRows = await page.locator('.dispensing-summary-table tbody tr').count();
|
||||
expect(detailRows).toBe(0);
|
||||
expect(summaryRows).toBe(0);
|
||||
|
||||
// 4. 返回护士站,执行“汇总发药申请”
|
||||
await page.goto('/nurse-station/dispensing-apply');
|
||||
await page.check('input[type="checkbox"]');
|
||||
await page.check('input[type="checkbox"]'); // 勾选待申请记录
|
||||
await page.click('text=汇总发药申请');
|
||||
await page.click('text=确认提交');
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// 5. 再次切换至药房端,验证明细单与汇总单同步出现且数据一致
|
||||
await page.goto('/pharmacy/dispensing');
|
||||
await page.waitForSelector('.dispensing-detail-table tbody tr');
|
||||
const newDetailRows = await page.locator('.dispensing-detail-table tbody tr').count();
|
||||
@@ -34,6 +39,7 @@ test('Bug #503: 住院发退药明细与汇总单触发时机同步校验', asyn
|
||||
|
||||
expect(newDetailRows).toBeGreaterThan(0);
|
||||
expect(newSummaryRows).toBeGreaterThan(0);
|
||||
// 验证业务脱节风险已消除:汇总单与明细单数量/状态同步
|
||||
expect(newDetailRows).toBe(newSummaryRows);
|
||||
});
|
||||
|
||||
@@ -45,59 +51,40 @@ test('Bug #544: 智能分诊队列显示完诊状态及历史查询功能', asyn
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/triage/queue');
|
||||
|
||||
// 1. 验证默认加载当天队列,且列表包含“完诊”状态患者
|
||||
await page.locator('text=智能队列(全科)').waitFor();
|
||||
const completedRow = page.locator('tr:has-text("完诊")');
|
||||
await expect(completedRow).toBeVisible({ timeout: 5000 });
|
||||
|
||||
// 2. 验证历史队列查询入口存在且默认时间为当天
|
||||
const dateRangePicker = page.locator('.el-date-editor--daterange');
|
||||
await expect(dateRangePicker).toBeVisible();
|
||||
});
|
||||
|
||||
// @bug570 @regression
|
||||
test('Bug #570: 门诊预约挂号状态显示及查询逻辑修复', async ({ page }) => {
|
||||
test('Bug #570: 门诊预约挂号成功后状态显示为“已预约”且筛选正常', async ({ page }) => {
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="username"]', 'admin');
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForURL('/outpatient/appointment');
|
||||
|
||||
await page.click('text=查询');
|
||||
|
||||
// 1. 选择可用号源并执行预约
|
||||
await page.locator('text=预约').first().click();
|
||||
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');
|
||||
// 2. 验证预约成功后状态显示为“已预约”,而非“已锁定”
|
||||
const statusTag = page.locator('.el-table__body tr').first().locator('.el-tag');
|
||||
await expect(statusTag).toHaveText('已预约');
|
||||
await expect(statusTag).not.toHaveText('已锁定');
|
||||
|
||||
// 1. 选择已维护档案的患者
|
||||
await page.click('text=患者2');
|
||||
// 3. 筛选“已预约”状态,验证数据正常返回且不为空
|
||||
await page.locator('.el-select').first().click();
|
||||
await page.locator('.el-select-dropdown__item:has-text("已预约")').click();
|
||||
await page.click('text=查询');
|
||||
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);
|
||||
const tableRows = await page.locator('.el-table__body tr').count();
|
||||
expect(tableRows).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user