Fix Bug #477: 住院医生工作站-住院检查申请详情弹窗中"发往科室"字段显示为短横线(-),未正常获取数据

根因:handleViewDetail 为同步方法,点击详情时 getLocationInfo 尚未返回,
orgOptions 为空导致 recursionFun 无法将 targetDepartment ID 解析为科室名称。

修复:
1. 前端(4个申请组件):handleViewDetail 改为 async,解析 descJson 前确保 orgOptions 已加载
2. 前端:watch encounterId 改为 Promise.all 并行加载数据和科室列表
3. 后端:新增 keyword 关键字筛选参数(申请单号/检查项目模糊匹配)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-11 14:03:40 +08:00
parent 8fae6fe3d5
commit 8093f8acda
9 changed files with 100 additions and 43 deletions

View File

@@ -33,7 +33,7 @@ public interface IRequestFormManageAppService {
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode); List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode);
/** /**
* 查询申请单(支持筛选) * 查询申请单(支持日期和状态筛选)
* *
* @param encounterId 就诊id * @param encounterId 就诊id
* @param typeCode 申请单类型 * @param typeCode 申请单类型
@@ -44,6 +44,19 @@ public interface IRequestFormManageAppService {
*/ */
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status); List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status);
/**
* 查询申请单(支持日期、状态和关键字筛选)
*
* @param encounterId 就诊id
* @param typeCode 申请单类型
* @param startDate 开始日期可选格式yyyy-MM-dd
* @param endDate 结束日期可选格式yyyy-MM-dd
* @param status 单据状态(可选)
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
* @return 申请单列表
*/
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status, String keyword);
/** /**
* 分页查询申请单 * 分页查询申请单
* *

View File

@@ -415,7 +415,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
@Override @Override
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode) { public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode) {
// 调用重载方法,不传筛选参数 // 调用重载方法,不传筛选参数
return getRequestForm(encounterId, typeCode, null, null, null); return getRequestForm(encounterId, typeCode, null, null, null, null);
} }
/** /**
@@ -426,16 +426,17 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
* @param startDate 开始日期可选格式yyyy-MM-dd * @param startDate 开始日期可选格式yyyy-MM-dd
* @param endDate 结束日期可选格式yyyy-MM-dd * @param endDate 结束日期可选格式yyyy-MM-dd
* @param status 单据状态(可选) * @param status 单据状态(可选)
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
* @return 申请单列表 * @return 申请单列表
*/ */
@Override @Override
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status) { public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status, String keyword) {
// 检查参数 // 检查参数
if (encounterId == null) { if (encounterId == null) {
return new java.util.ArrayList<>(); // 返回空列表而不是查询数据库 return new java.util.ArrayList<>(); // 返回空列表而不是查询数据库
} }
List<RequestFormQueryDto> requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode, startDate, endDate, status); List<RequestFormQueryDto> requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode, startDate, endDate, status, keyword);
for (RequestFormQueryDto requestFormQueryDto : requestFormList) { for (RequestFormQueryDto requestFormQueryDto : requestFormList) {
// 查询处方详情 // 查询处方详情
List<RequestFormDetailQueryDto> requestFormDetail = List<RequestFormDetailQueryDto> requestFormDetail =

View File

@@ -84,6 +84,7 @@ public class RequestFormManageController {
* @param startDate 开始日期可选格式yyyy-MM-dd * @param startDate 开始日期可选格式yyyy-MM-dd
* @param endDate 结束日期可选格式yyyy-MM-dd * @param endDate 结束日期可选格式yyyy-MM-dd
* @param status 单据状态(可选) * @param status 单据状态(可选)
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
* @return 检查申请单 * @return 检查申请单
*/ */
@GetMapping(value = "/get-check") @GetMapping(value = "/get-check")
@@ -91,11 +92,12 @@ public class RequestFormManageController {
@RequestParam(required = false) Long encounterId, @RequestParam(required = false) Long encounterId,
@RequestParam(required = false) String startDate, @RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate, @RequestParam(required = false) String endDate,
@RequestParam(required = false) String status) { @RequestParam(required = false) String status,
@RequestParam(required = false) String keyword) {
if (encounterId == null) { if (encounterId == null) {
return R.fail("就诊ID不能为空"); return R.fail("就诊ID不能为空");
} }
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode(), startDate, endDate, status)); return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode(), startDate, endDate, status, keyword));
} }
/** /**

View File

@@ -37,13 +37,15 @@ public interface RequestFormManageAppMapper {
* @param startDate 开始日期可选格式yyyy-MM-dd * @param startDate 开始日期可选格式yyyy-MM-dd
* @param endDate 结束日期可选格式yyyy-MM-dd * @param endDate 结束日期可选格式yyyy-MM-dd
* @param status 单据状态(可选) * @param status 单据状态(可选)
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
* @return 申请单列表 * @return 申请单列表
*/ */
List<RequestFormQueryDto> getRequestForm(@Param("encounterId") Long encounterId, List<RequestFormQueryDto> getRequestForm(@Param("encounterId") Long encounterId,
@Param("typeCode") String typeCode, @Param("typeCode") String typeCode,
@Param("startDate") String startDate, @Param("startDate") String startDate,
@Param("endDate") String endDate, @Param("endDate") String endDate,
@Param("status") String status); @Param("status") String status,
@Param("keyword") String keyword);
/** /**
* 查询申请单详情 * 查询申请单详情

View File

@@ -31,6 +31,16 @@
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND drf.status = #{status}::integer AND drf.status = #{status}::integer
</if> </if>
<if test="keyword != null and keyword != ''">
AND (drf.prescription_no LIKE CONCAT('%', #{keyword}, '%')
OR EXISTS (
SELECT 1 FROM wor_service_request wsr_kw
LEFT JOIN wor_activity_definition wad_kw ON wad_kw.id = wsr_kw.activity_id
WHERE wsr_kw.prescription_no = drf.prescription_no
AND wsr_kw.delete_flag = '0'
AND wad_kw.name LIKE CONCAT('%', #{keyword}, '%')
))
</if>
</select> </select>
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto"> <select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">

View File

@@ -175,10 +175,9 @@ const hasMatchedFields = computed(() => {
}); });
/** 查询科室 */ /** 查询科室 */
const getLocationInfo = () => { const getLocationInfo = async () => {
getOrgList().then((res) => { const res = await getOrgList();
orgOptions.value = res.data.records; orgOptions.value = res.data.records;
});
}; };
const recursionFun = (targetDepartment) => { const recursionFun = (targetDepartment) => {
@@ -199,7 +198,12 @@ const recursionFun = (targetDepartment) => {
return name; return name;
}; };
const handleViewDetail = (row) => { const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row; currentDetail.value = row;
// 解析 descJson // 解析 descJson
if (row.descJson) { if (row.descJson) {
@@ -220,10 +224,9 @@ const handleViewDetail = (row) => {
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { async (val) => {
if (val) { if (val) {
fetchData(); await Promise.all([fetchData(), getLocationInfo()]);
getLocationInfo();
} else { } else {
tableData.value = []; tableData.value = [];
} }

View File

@@ -496,10 +496,9 @@ const hasMatchedFields = computed(() => {
}); });
/** 查询科室 */ /** 查询科室 */
const getLocationInfo = () => { const getLocationInfo = async () => {
getOrgList().then((res) => { const res = await getOrgList();
orgOptions.value = res.data.records; orgOptions.value = res.data.records;
});
}; };
const recursionFun = (targetDepartment) => { const recursionFun = (targetDepartment) => {
@@ -527,9 +526,14 @@ const recursionFun = (targetDepartment) => {
return name; return name;
}; };
const handleViewDetail = (row) => { const handleViewDetail = async (row) => {
console.log('targetDepartment========>', JSON.stringify(row)); console.log('targetDepartment========>', JSON.stringify(row));
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row; currentDetail.value = row;
// 解析 descJson // 解析 descJson
if (row.descJson) { if (row.descJson) {
@@ -780,10 +784,9 @@ const handleViewReport = async (row) => {
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { async (val) => {
if (val) { if (val) {
fetchData(); await Promise.all([fetchData(), getLocationInfo()]);
getLocationInfo();
} else { } else {
tableData.value = []; tableData.value = [];
filterForm.value.dateRange = getDefaultDateRange(); filterForm.value.dateRange = getDefaultDateRange();

View File

@@ -181,10 +181,9 @@ const hasMatchedFields = computed(() => {
}); });
/** 查询科室 */ /** 查询科室 */
const getLocationInfo = () => { const getLocationInfo = async () => {
getOrgList().then((res) => { const res = await getOrgList();
orgOptions.value = res.data.records; orgOptions.value = res.data.records;
});
}; };
const recursionFun = (targetDepartment) => { const recursionFun = (targetDepartment) => {
@@ -205,7 +204,12 @@ const recursionFun = (targetDepartment) => {
return name; return name;
}; };
const handleViewDetail = (row) => { const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row; currentDetail.value = row;
// 解析 descJson // 解析 descJson
if (row.descJson) { if (row.descJson) {
@@ -226,10 +230,9 @@ const handleViewDetail = (row) => {
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { async (val) => {
if (val) { if (val) {
fetchData(); await Promise.all([fetchData(), getLocationInfo()]);
getLocationInfo();
} else { } else {
tableData.value = []; tableData.value = [];
} }

View File

@@ -47,6 +47,15 @@
<el-option label="已作废" value="5" /> <el-option label="已作废" value="5" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关键字">
<el-input
v-model="filterForm.keyword"
placeholder="申请单号/检验项目"
clearable
style="width: 200px"
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch" :loading="loading"> <el-button type="primary" @click="handleSearch" :loading="loading">
<el-icon><Search /></el-icon> <el-icon><Search /></el-icon>
@@ -188,6 +197,7 @@ const orgOptions = ref([]);
const filterForm = ref({ const filterForm = ref({
dateRange: [], // [startDate, endDate] dateRange: [], // [startDate, endDate]
status: '', // 单据状态 status: '', // 单据状态
keyword: '', // 关键字搜索
}); });
const fetchData = async () => { const fetchData = async () => {
@@ -212,6 +222,11 @@ const fetchData = async () => {
params.status = filterForm.value.status; params.status = filterForm.value.status;
} }
// 添加关键字搜索
if (filterForm.value.keyword && filterForm.value.keyword.trim()) {
params.keyword = filterForm.value.keyword.trim();
}
const res = await getInspection(params); const res = await getInspection(params);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
const raw = res.data?.records || res.data; const raw = res.data?.records || res.data;
@@ -251,6 +266,7 @@ const handleReset = () => {
// 重置筛选条件为默认值 // 重置筛选条件为默认值
filterForm.value.dateRange = []; filterForm.value.dateRange = [];
filterForm.value.status = ''; filterForm.value.status = '';
filterForm.value.keyword = '';
// 重新加载数据 // 重新加载数据
fetchData(); fetchData();
}; };
@@ -331,10 +347,9 @@ const hasMatchedFields = computed(() => {
}); });
/** 查询科室 */ /** 查询科室 */
const getLocationInfo = () => { const getLocationInfo = async () => {
getDepartmentList().then((res) => { const res = await getDepartmentList();
orgOptions.value = res.data || []; orgOptions.value = res.data || [];
});
}; };
const recursionFun = (targetDepartment) => { const recursionFun = (targetDepartment) => {
@@ -357,7 +372,12 @@ const recursionFun = (targetDepartment) => {
return name; return name;
}; };
const handleViewDetail = (row) => { const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row; currentDetail.value = row;
// 解析 descJson // 解析 descJson
if (row.descJson) { if (row.descJson) {
@@ -378,7 +398,7 @@ const handleViewDetail = (row) => {
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { async (val) => {
if (val) { if (val) {
// 设置默认日期范围为近7天 // 设置默认日期范围为近7天
const today = new Date(); const today = new Date();
@@ -398,13 +418,13 @@ watch(
formatDate(today) formatDate(today)
]; ];
fetchData(); await Promise.all([fetchData(), getLocationInfo()]);
getLocationInfo();
} else { } else {
tableData.value = []; tableData.value = [];
// 重置筛选条件 // 重置筛选条件
filterForm.value.dateRange = []; filterForm.value.dateRange = [];
filterForm.value.status = ''; filterForm.value.status = '';
filterForm.value.keyword = '';
} }
}, },
{ immediate: true } { immediate: true }