Fix Bug #497: 【住院医生工作站-检查申请】检查申请列表缺失"申请单状态"列及全流程闭环状态流转逻辑
根因: 1. 列位置回归问题 — commit718e7a90已将"申请单状态"列移至"申请单号"之后, 但后续 commite65f1212合并时意外恢复为"申请单号→申请者→申请单状态"的错误顺序。 2. SQL 状态计算冗余 — Mapper XML 使用复杂的 CASE + MIN(wsr.status_enum) 聚合表达式 从 wor_service_request 计算状态,但 doc_request_form 表已有 status 字段直接存储状态值。 CASE 表达式在 MIN=0 时返回 NULL(虽然当前枚举没有 0 值),且聚合逻辑在多条 ServiceRequest 记录场景下可能不准确。 修复: - 前端:恢复"申请单号→申请单状态→申请者→操作"的列顺序 - 后端:简化 SQL 为直接使用 drf.status 字段,删除 CASE 表达式及 WHERE 中的聚合过滤 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -19,16 +19,7 @@
|
|||||||
drf.requester_id,
|
drf.requester_id,
|
||||||
drf.create_time,
|
drf.create_time,
|
||||||
ap.NAME AS patient_name,
|
ap.NAME AS patient_name,
|
||||||
CASE
|
drf.status
|
||||||
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
|
||||||
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
|
||||||
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
|
||||||
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
|
||||||
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
|
||||||
ELSE NULL
|
|
||||||
END AS status
|
|
||||||
FROM doc_request_form AS drf
|
FROM doc_request_form AS drf
|
||||||
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
|
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
|
||||||
AND ae.delete_flag = '0'
|
AND ae.delete_flag = '0'
|
||||||
@@ -46,16 +37,7 @@
|
|||||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
AND CASE
|
AND drf.status = #{status}::integer
|
||||||
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
|
||||||
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
|
||||||
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
|
||||||
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
|
||||||
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
|
||||||
ELSE NULL
|
|
||||||
END = #{status}::integer
|
|
||||||
</if>
|
</if>
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||||
@@ -71,7 +53,7 @@
|
|||||||
))
|
))
|
||||||
</if>
|
</if>
|
||||||
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||||
drf.requester_id, drf.create_time, ap.name
|
drf.requester_id, drf.create_time, ap.name, drf.status
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
|
|||||||
@@ -93,7 +93,6 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||||
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
||||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
|
||||||
<el-table-column label="申请单状态" width="120" align="center">
|
<el-table-column label="申请单状态" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round>
|
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round>
|
||||||
@@ -101,6 +100,7 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||||
<el-table-column label="操作" width="280" align="center" fixed="right">
|
<el-table-column label="操作" width="280" align="center" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<!-- 详情 - 所有状态都显示 -->
|
<!-- 详情 - 所有状态都显示 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user