52 Commits

Author SHA1 Message Date
关羽
bd471223a4 Fix Bug #478: 【住院医生工作站-检验申请】点击"详情"查看检验单时,"发往科室"字段回显异常(显示为"-")
根因:desc_json 中 targetDepartment 存为空字符串,实际执行科室保存在 wor_service_request.org_id 中
修复:在 getRequestForm SQL 中用 CASE 表达式将 org_id 注入 desc_json,当前端已有值时不覆盖

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:15:34 +08:00
关羽
ed644c4a91 Fix Bug #497: 【住院医生工作站-检查申请】检查申请列表缺失"申请单状态"列及全流程闭环状态流转逻辑
根因:
1. 列位置回归问题 — commit 718e7a90 已将"申请单状态"列移至"申请单号"之后,
   但后续 commit e65f1212 合并时意外恢复为"申请单号→申请者→申请单状态"的错误顺序。
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>
2026-05-16 15:11:59 +08:00
赵云
7799de81de Fix Bug #476: 根因+修复方案摘要 2026-05-16 14:55:05 +08:00
关羽
5f5d1c548a Fix Bug #472: 住院医生工作站-手术申请单:勾选手术项目无效,导致无法正常开立医嘱
根因:getSurgeryPage SQL 的 LEFT JOIN 在价格表存在多条记录时产生重复行,
导致 el-transfer 中出现相同 key 的条目,Vue diff 算法无法正确追踪选中状态

修复:
- SQL 添加 DISTINCT ON (t1.ID) 去重(与旧版 getAdviceBaseInfo 一致)
- 前端 applicationList 初始化为空数组 + 过滤空 adviceDefinitionId
- 同步修复 getExaminationPage 的相同问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:28:24 +08:00
关羽
02b9dc8725 Fix Bug #468: [住院医生工作站-检验申请] 修复单据状态列前后端状态码映射不一致
根因:Bug #468 初次修复时添加了【单据状态】列和筛选功能,但前端状态码映射
与后端 SQL CASE 表达式不一致:
- 后端 SQL 将 status_enum=5,6,7 映射为显示码 7(已作废),前端却用 5
- 后端 SQL 将 status_enum=8 映射为显示码 6(已出报告),前端却用 4
导致已作废/已出报告状态显示为"-"且筛选失效。

修复:前端 filter 选项值和 parseBillStatus 映射表与后端 SQL CASE 对齐。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:21:06 +08:00
关羽
7af922684a Fix Bug #470: 住院医生工作站-手术申请单加载手术项目添加Redis缓存+修复loading状态
根因:getSurgeryPage接口缺少Redis缓存层,每次弹窗打开都直接查数据库。
修复:1. 后端getSurgeryPage添加Redis缓存(24h过期),与getAdviceBaseInfo保持一致
      2. 前端getList()命中内存缓存时显式清除loading状态,防止加载动画卡住

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:18:55 +08:00
关羽
be334f8f53 Fix Bug #461: [系统管理-执行科室配置] 保存项目配置后,项目名称回显为ID码,未显示正确名称
**后端开发重点**:优先搜索 Java/Spring 后端代码。
关键词:Controller, Service, Mapper, API, 接口, 数据查询
搜索目录:openhis-server-new/src/, his-repo/src/

在 getOrgLocPage 方法中手动填充 activityDefinitionId_dictText,
确保前端能正确回显项目名称而非 ID 码。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:16:27 +08:00
赵云
395ef2548e Fix Bug #469: [住院医生工作站-检验申请] 完善【操作】列临床业务逻辑:支持按状态动态切换修改、删除、撤回等功能
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-16 14:09:48 +08:00
赵云
f3f55f9fd0 Fix Bug #463: 根因+修复方案摘要 2026-05-16 13:58:47 +08:00
关羽
7f9e01f6b2 Fix Bug #454: 门诊医生站-医嘱页签:删除"待签发"状态的检验项目时,错误触发"执行科室"校验导致删除失败
前端补充:删除医嘱前添加确认弹窗,对诊疗类项目提示"删除此医嘱将同时删除关联的检验申请单",
满足Bug期望中"触发级联删除前应有明确提示"的要求。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 13:28:33 +08:00
关羽
b7708dec7d Fix Bug #445: 门诊手术安排-临时医嘱生成界面:引用计费时过滤已生成医嘱项目
根因: handleQuoteBilling 从后端拉取计费数据后,只用 requestId 过滤已生成项目,
但已生成医嘱的计费项在后端可能没有 requestId(从 adm_charge_item 关联来的项目 requestId 为空),
导致已提交项目重新出现在"待生成"列表中。

修复: 在 handleQuoteBilling 中,用 chargeItemId/requestId/id 三重匹配,
与已有的 temporaryAdvices 做比对,排除已生成项目。

**后端开发重点**:优先搜索 Java/Spring 后端代码。
关键词:Controller, Service, Mapper, API, 接口, 数据查询
搜索目录:openhis-server-new/src/, his-repo/src/
2026-05-16 13:19:02 +08:00
关羽
e473e5159b Fix Bug #444: 根因+修复方案摘要
## 根因分析
门诊手术安排的"生成临时医嘱"界面中,"已引用计费药品"列表未正常显示药品名称。
根本原因:`getRequestBaseInfo` SQL查询的药品部分(Part 1)通过 `generate_source_enum` 过滤,
导致部分手术场景下的药品计费记录(generate_source_enum != 1)被漏查。
之前的修复(commit 97d0011)仅在前端添加了名称回退字段,未解决后端数据查询遗漏问题。

## 修复方案
在 DoctorStationAdviceAppMapper.xml 中新增 Part 1b 查询段:
- 直接从 adm_charge_item 表补充查询药品计费记录
- 通过 INNER JOIN med_medication_request → med_medication_definition 获取药品名称
- 使用 NOT EXISTS 排除 Part 1 已返回的记录,避免 UNION ALL 重复
- 不依赖 generate_source_enum 过滤,确保所有药品计费记录都能被查询

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 13:14:15 +08:00
关羽
a52bd8fe8a Fix Bug #439: 根因+修复方案摘要 2026-05-16 12:51:43 +08:00
关羽
bbf230ea76 Fix Bug #434: 根因+修复方案摘要 2026-05-16 12:51:11 +08:00
关羽
a7ea08f075 Fix Bug #432: 门诊手术安排:新增手术安排保存时报错 - 根因+修复方案
根因:OpCreateScheduleDto缺少@JsonIgnoreProperties注解,Jackson默认
FAIL_ON_UNKNOWN_PROPERTIES=true,前端提交的表单包含DTO中不存在的字段
(identifierNo、patientName、gender、age、birthDay等)导致反序列化失败

修复:在OpCreateScheduleDto类上添加@JsonIgnoreProperties(ignoreUnknown = true)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 12:20:06 +08:00
关羽
cd88bfc7d4 Fix Bug #433: 门诊手术安排:编辑弹窗内"麻醉方法"回显为代码且"外请专家姓名"数据未加载
根因:1) 删除了错误的 anesthesiaTypeEnum 转换行(该字段不存在于 OpScheduleDto 中)
     2) 使用 nextTick 包裹字典字段类型转换,确保 Object.assign 响应式更新完成后
        el-select 已渲染选项再设置值,避免类型不匹配导致无法回显

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 12:17:15 +08:00
赵云
3ab3ddbdf1 Fix Bug #428: 根因+修复方案摘要 2026-05-16 12:11:12 +08:00
关羽
d2cb02eeef Fix Bug #401: 门诊完诊审计日志错误:div_log 表中 pool_id 与 slot_id 存值与设计规范不符
根因:queueWasAlreadyCompleted 条件限制导致队列已由分诊台完诊时,
医生站完诊不写 div_log 审计日志,造成审计记录缺失。
数据库12条COMPLETE记录中6条pool_id/slot_id为NULL(50%)。

修复:移除 queueWasAlreadyCompleted 条件限制,确保每次完诊操作
都生成审计日志;保留 queueWasAlreadyCompleted 日志用于排查。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 12:11:01 +08:00
赵云
8850689f1f Fix Bug #426: 门诊医生站-检查开立:已选择列表应支持树形展开,显示套餐明细(项目/数量/单价)
根因: Element Plus el-table 懒加载模式下,tree-props.hasChildren 要求行数据
包含 hasChildren: true 才能显示展开箭头。所有创建套餐项的代码路径都设置了
isPackage: true 和 packageId,但未设置 hasChildren 属性。

修复: 在 7 处代码路径中补充 hasChildren 属性设置。
2026-05-16 12:02:35 +08:00
关羽
4c7d362946 Fix Bug #403: 住院医生工作站:应用医嘱组套后,药品明细字段内容丢失未正确引入表格
组套应用时数据预处理缺失部分关键字段(doseUnitCode_dictText/positionName/
injectFlag/skinTestFlag),导致父组件构建行数据时无法获取完整信息。
在orderGroupDrawer的processed item中显式补充这些字段。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 11:57:54 +08:00
51ae3aad29 bug524 [门诊/医生个人报卡管理] 传染病报告卡保存后数据回显失败:病例分类、日期及分型字段为空 2026-05-15 18:16:12 +08:00
d984b89967 bug432 门诊手术安排:新增手术安排保存时报错 2026-05-15 18:14:44 +08:00
wangjian963
b9aabd53ce Fix Bug 505505 【业务逻辑缺陷】药品医嘱已由药房发药,护士仍能在“医嘱校对”模块执行“退回”操作
[门诊手术安排]“手术申请查询”弹窗底部,分页组件与界底部元素重叠,影响操作。
2026-05-15 17:34:29 +08:00
关羽
73ed5e1d33 Fix Bug #534: 【手术管理-门诊手术安排】点击"签发"按钮抛出异常,导致业务中断
修复两个问题:
1. prescriptionlist.vue 签发时 organizationId 可能为 undefined,添加回退值确保后端接收有效值
2. index.vue 计费弹窗缺少 generateSourceEnum 参数传递,导致 getListInfo 查询时无法正确过滤手术计费项目

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:00:11 +08:00
关羽
d3cd122656 Fix Bug #536: [门诊手术安排]"手术申请查询"弹窗底部,分页组件与界面底部元素重叠,影响操作。
根因:弹窗 body 无高度约束,窗口缩小时内容溢出导致分页与 footer 重叠。
修复:为弹窗添加 max-height: 75vh + overflow-y: auto 约束,分页与 footer 增加间距和分隔线。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:29:42 +08:00
荀彧
0930fbae93 Fix Bug #535: 【住院护士站-医嘱校对】已校验过的医嘱错误显示于"未校对"列表中,导致数据状态联动失效
根因:后端 getInpatientAdvicePage 方法中将 requestStatus 置为 null,
未按前端 tab 传入的状态值过滤,导致无论切换哪个 tab 都返回全部医嘱。
SQL 中的 CASE 条件仅处理 DRAFT 状态的 performer_check_id 校验,
并未按 request_status 字段过滤。

修复:保存 requestStatus 后,在查询结果集上按 requestStatus 手动过滤,
与 exeStatus 的过滤方式保持一致。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:26:17 +08:00
关羽
cace025d14 Fix Bug #533: 【门诊手术安排-计费】添加药品费用项目保存提示成功,但列表页未同步显示计费药品项目
根因:DoctorStationAdviceAppServiceImpl 中 handMedication/handDevice/handService 方法
硬编码 generateSourceEnum=1(医生开立),但前端手术计费传入 generateSourceEnum=6,
查询时按 6 过滤导致找不到记录。

修复:1. GenerateSource 枚举新增 SURGERY_BILLING(6)
      2. 8处 setGenerateSourceEnum 改为优先使用 DTO 的 generateSourceEnum,
         空时回退到 DOCTOR_PRESCRIPTION

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 16:09:29 +08:00
关羽
91f29bf693 Fix Bug #533: 【门诊手术安排-计费】添加药品费用项目保存提示成功,但列表页未同步显示计费药品项目
根因:手术计费弹窗中 prescriptionlist 组件的 generateSourceEnum prop 被硬编码为 1,
但保存时 handleSaveSign 将 generateSourceEnum 设为 6(手术计费)。
保存后调用 getListInfo 刷新列表时,用 generateSourceEnum=1 查询,
后端返回 generateSourceEnum=6 的数据不匹配,导致列表为空。

修复:移除硬编码的 :generateSourceEnum="1" prop,
让组件通过 sourceBillNo 过滤即可正确显示保存的手术计费项目。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:58:39 +08:00
a6337ae397 fix bug249:手术管理-》门诊手术安排:【新增手术安排】-》【查找】在门诊医生站已【删除】作废的手术申请单在查询界面还能查询出来 2026-05-15 15:44:36 +08:00
赵云
c2e089c0d2 Fix Bug #532: 【手术管理】点击"查看"或"编辑"按钮弹出 SQL 语法报错。
根因:getSurgeryScheduleDetail SQL 查询中引用了 fc.contract_name AS feeType,
但 fc (fin_contract) 表从未被 JOIN,导致 SQL 语法错误。
修复:删除未关联表的 fc.contract_name 字段,保留已有的 os.fee_type AS feeType。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 15:42:02 +08:00
Ranyunqiao
e65f12125b 403 住院医生工作站:应用医嘱组套后,药品明细字段内容丢失未正确引入表格 521 [住院医生站-临床医嘱-检查申请] 手工选择执行科室后,保存仍提示“未找到项目执行的科室” 528 [住院医生工作站-检查申请] 修改申请单成功后,弹窗未自动关闭且列表数据未自动刷新 531 [住院医生站-临床医嘱-检查] 检查申请单打开数据没有正常加载 2026-05-15 14:20:30 +08:00
Ranyunqiao
12d0733c0c Merge remote-tracking branch 'origin/develop' into develop 2026-05-15 09:44:38 +08:00
Ranyunqiao
610fff704a bug 470 494 2026-05-15 09:44:26 +08:00
wangjian963
0aa7dd9b82 Revert "Merge remote-tracking branch 'origin/develop' into develop"
This reverts commit 5946c1ea4b, reversing
changes made to 8d905c9844.
2026-05-15 09:33:35 +08:00
wangjian963
5946c1ea4b Merge remote-tracking branch 'origin/develop' into develop 2026-05-15 09:26:51 +08:00
wangjian963
8d905c9844 Reapply "Fix Bug #489-regression: [住院护士站-医嘱处理] UNION加SELECT DISTINCT后NULL列类型推断失败导致接口异常"
This reverts commit 49fc905316.
2026-05-15 09:23:13 +08:00
wangjian963
49fc905316 Revert "Fix Bug #489-regression: [住院护士站-医嘱处理] UNION加SELECT DISTINCT后NULL列类型推断失败导致接口异常"
This reverts commit 4e7e79d9c0.
2026-05-15 09:19:02 +08:00
关羽
3ee09b22c7 Fix Bug #511: [住院医生工作站-临床医嘱] 护士退回的医嘱在医生站双击无法进入编辑模式,导致无法修改重发
- 使用 Number() 做 statusEnum 类型转换并用 === 严格比较,避免前后端类型不一致导致双击无响应
- 使用 splice 替代直接赋值更新 prescriptionList,确保 Vue 响应式系统能正确触发渲染更新
- 使用 nextTick 包裹 expandOrder 设置,确保数据更新后再设置展开状态,保证 el-table 正确识别 row-key
- 增加 findIndex 返回 -1 时的错误处理,给用户可见提示而非静默失败
2026-05-15 01:28:18 +08:00
关羽
6b4f897b9c Fix Bug #509: [门诊医生站-手术申请] 提交申请后列表未实时刷新展示数据,且提示语需优化
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 01:09:52 +08:00
关羽
848a55cf23 Fix Bug #507: [住院护士站-住院记账-补费] 项目单位未获取、执行科室显示内码且缺乏默认/模糊搜索逻辑
根因分析:
1. 执行科室显示内码:loadDepartmentOptions 只读取树形结构的第一层(records[0].children),
   但后端返回的是多层嵌套的树形数据。修复为递归扁平化 flattenTree() 提取所有科室节点。
2. 单位字段为空:getUnitCodeOptions 中 unitCode_dictText/minUnitCode_dictText 为 null 时,
   option 的 codeText 为 null 导致 el-select 无法显示。修复为 fallback 到 code 值本身。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 01:08:23 +08:00
荀彧
4ae4421827 Fix Bug #498: 【住院医生工作站-检查申请】检查申请列表状态筛选HAVING子句与SELECT映射不一致导致筛选失败
SELECT的CASE映射将status_enum=4映射为3(待接收),但HAVING子句将status_enum=4映射为4,
导致按"待接收"或"已接收"状态筛选时无结果返回。同时修正status_enum=5/6/7的映射从5→7。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:27:01 +08:00
关羽
4138dc39f6 Fix Bug #495: 【医嘱闭环】已校对医嘱无法流转至"医嘱执行"界面,导致费用无法提交执行
后端SQL查询未过滤requestStatus(医嘱请求状态),导致医嘱执行页面的"待执行"tab
返回所有状态医嘱而非仅返回已校对(status=3)的医嘱。修复方式:
1. AdviceProcessAppMapper.java: 新增requestStatus参数
2. AdviceProcessAppMapper.xml: 在med_medication_request和wor_service_request子查询的
   WHERE条件中增加 AND T1.status_enum = #{requestStatus} 过滤
3. AdviceProcessAppServiceImpl.java: 保存requestStatus并传递给mapper,
   替代原注释"后端SQL已通过CASE条件处理"的错误假设

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:21:55 +08:00
荀彧
718e7a90c5 Fix Bug #497: 【住院医生工作站-检查申请】检查申请列表调整"申请单状态"列位置至申请单号后
将列表中的"申请单状态"列从申请者列之后移至申请单号之后,使列顺序为:申请单号→申请单状态→申请者→操作,与检验申请列表保持一致。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:14:59 +08:00
荀彧
68c682ad49 Fix Bug #508: [住院护士站-住院记账-补费] 点击"划价组套"按钮无任何响应,无法选择组套项目
根因分析:FeeDialog组件模板有两个根元素(两个el-dialog),在Vue 3中虽支持多根组件,
但Element Plus的嵌套el-dialog配合append-to-body在多根场景下可能出现渲染/挂载问题。

修复方案:
1. 将两个el-dialog包裹在单一根<div>中,确保组件挂载行为与项目中其他正常工作的嵌套弹窗一致
2. 内层弹窗增加destroy-on-close,确保每次打开时DOM完全重建,避免残留状态导致的不显示问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:13:04 +08:00
荀彧
c7368db889 Fix Bug #500: 【门诊医生站】检查申请右侧"检查项目分类"切换时,界面出现明显抖动/闪烁
根因分析:
1. el-collapse-item__content 上的 transition: height/max-height 0.3s 与 Element Plus
   内部 accordion 动画冲突,造成"双重动画"效果,表现为切换分类时高度跳变
2. collapse-scroll 的 min-height: 120px 过小,切换内容较少的分类时容器收缩导致布局抖动
3. 分类内"加载中..."提示使用 v-if,出现/消失时引起 collapse content 高度突变

修复策略:
- 移除 el-collapse-item__content 和 el-collapse-item 的自定义 transition 属性,
  让 el-collapse 使用原生动画,消除双重动画
- 增大 collapse-scroll 的 min-height 从 120px 到 350px,确保切换时容器不收缩
- 将加载提示的 v-if 改为 v-show,避免 DOM 插入/移除引起高度跳变

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 00:02:32 +08:00
荀彧
e64370bb67 Fix Bug #486: [住院医生工作站-临床医嘱] 医嘱检索框不支持全局模糊搜索,未选"医嘱类型"时检索结果为空
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 23:18:55 +08:00
关羽
078439245b Fix Bug #488: 【临床医嘱】双击编辑待签发医嘱,医嘱类型回显为数字且点击确认报接口错误
问题1-医嘱类型回显为数字: 编辑待签发医嘱时,当行的adviceType值(如3/诊疗)
不在当前adviceTypeList选项列表中时,el-select会回显为纯数字。
修复:新增hasAdviceTypeOption和getAdviceTypeLabel函数,当类型无匹配选项时
显示el-tag标签而非空下拉框,避免数字回显。

问题2-点击确认报itemNo接口错误: getBindDevice接口调用无catch处理,
接口失败时promise rejection阻断主流程保存。
修复:为getBindDevice调用链添加.catch()静默降级,确保绑定设备接口失败
不影响医嘱主流程保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 23:12:33 +08:00
关羽
1124b1010d Fix Bug #480: [住院护士站-医嘱执行] 非耗材类医嘱执行报"耗材库存"错误且全选逻辑联动异常
根因分析:
1. 耗材库存报错:lotNumberMatch() 按 encounterId 查询 ALL 待发放 DeviceDispense,
   不区分是否为本次执行的医嘱。若该就诊存在其他未执行的耗材记录且库存为零,
   整个调用就会失败,导致非耗材类医嘱执行也被拦截。
2. 全选联动异常:toggleRowSelection() 程序化选中会触发 @select 事件,
   handleRowSelect 中调用 selectAllCheckboxesInRow 导致级联全选。

修复方案:
- 后端:lotNumberMatch 新增 requestIdList 可选参数,当传入时通过 DeviceRequest.basedOnId
  过滤仅校验与本次执行医嘱关联的耗材记录,避免其他未执行医嘱干扰
- 前端:handleExecute 传入 selectedRequestIds(仅诊疗类医嘱的 requestId)
- 前端:新增 skipSelectCascade 标志,程序化 toggleRowSelection 时阻止 handleRowSelect
  触发 selectAllCheckboxesInRow,消除级联反馈环

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:22:01 +08:00
关羽
f41b86a143 Fix Bug #476: 住院医生工作-检查申请单界面缺失核心临床字段(紧急程度、过敏史、检查目的等)
补充打印功能中缺失的核心临床字段:紧急程度、期望检查时间、过敏史、检查目的、病史摘要,
并对urgencyLevel等编码字段应用transformField进行值转换显示。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:11:25 +08:00
关羽
d3310ade51 Fix Bug #467: [住院医生工作站-检验申请] 列表显示信息不规范:标题术语错误且单据名称未展示具体检验项目
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:10:56 +08:00
关羽
1dbf7859ea Fix Bug #475: 【住院医生工作站】开立检查申请单报错"请先配置当前时间段的执行科室"后,系统仍生成申请记录
合并验证逻辑:移除独立的"配置列表是否为空"检查,改为在遍历 activityList
时统一验证每个项目的执行科室配置。所有验证在任何数据库操作之前完成,
确保验证失败时不会产生脏数据。同时增加 activityList 为空时的明确提示。
2026-05-14 22:09:06 +08:00
wangjian963
4e7e79d9c0 Fix Bug #489-regression: [住院护士站-医嘱处理] UNION加SELECT DISTINCT后NULL列类型推断失败导致接口异常
Root cause: Bug #489修复为UNION添加SELECT DISTINCT后,PostgreSQL无法将
服务侧无类型NULL文字自动匹配药品侧对应列的类型,报错"UNION types integer
and text cannot be matched"(错误位置: skin_test_flag列,第9列)。

Fix:
- InpatientAdviceDto.categoryCode: Integer → String,与DB varchar对齐
- AdviceProcessAppMapper.xml: 服务侧UNION 13处NULL添加PostgreSQL显式类型
  强转(::integer / ::bigint / ::numeric / ::varchar),同时part_percent
  的'1'改为'1::numeric'以安全匹配药品侧numeric类型
2026-05-14 17:53:31 +08:00
47 changed files with 1529 additions and 621 deletions

View File

@@ -0,0 +1,66 @@
# Bug #403 分析报告
## 根因分析
**Bug现象**:住院医生工作站应用医嘱组套后,药品明细字段(单次剂量、总量、总金额、药房/科室)丢失。
**数据流追踪**
1. **后端 `getGroupPackageForOrder`** (OrdersGroupPackageAppServiceImpl.java:168)
- 查询组套明细 SQLOrdersGroupPackageAppMapper.xml:37-82返回`dose`, `quantity`, `doseQuantity`, `rateCode`, `methodCode`, `dispensePerDuration` 等字段
- 通过 `getAdviceBaseInfo` 获取 `AdviceBaseDto` 赋值给 `detail.setOrderDetailInfos()`,包含:`doseUnitCode`, `doseUnitCode_dictText`, `positionId`, `inventoryList`, `priceList`, `partPercent`
2. **前端 `orderGroupDrawer.vue`** `handleUseOrderGroup` (line 568-694)
- 对每个组套明细项进行预处理,合并组套字段和医嘱库字段
- 通过 `emit('useOrderGroup', processedDetailList)` 发送到父组件
3. **前端 `inpatientDoctor/home/components/order/index.vue`** `handleSaveGroup` (line 1546-1639)
- 接收 `orderGroupList`,对每个 item 调用 `setValue(mergedDetail)` 填充行数据
- 然后用 `item` 的字段显式覆盖创建 `newRow`
**根因定位**`handleSaveGroup` 在构建 `newRow`line 1594-1617`item` 直接取值覆盖了 `setValue` 设置的值。问题在于:
1. **`item.unitCodeName` 可能为 undefined**:组套明细 SQL 中 `unitCodeName` 来自字典关联 `sys_dict_data`,如果字典匹配不上则为 null。`newRow``unitCode_dictText` 直接使用 `item.unitCodeName || ''`,导致显示为空。
2. **`positionName` 未在 `orderGroupDrawer` 处理项中显式设置**:虽然 `setValue` 会通过库存查询设置 `positionName`,但 `orderGroupDrawer.vue``handleUseOrderGroup` 没有将 `positionName`(或至少 `orderDetail.positionName`)包含在 processed item 中,导致 `setValue` 的库存查找依赖 `inventoryList`,而 `inventoryList` 来自后端 `AdviceBaseDto`
3. **`doseUnitCode_dictText` 依赖 `setValue``unitCodeList`**`orderGroupDrawer` 的处理项中没有显式包含 `doseUnitCode_dictText`,完全依赖 `mergedDetail` 中 spread 的 `orderDetail` 字段。
## 影响范围
- 前端文件:`openhis-ui-vue3/src/views/doctorstation/components/prescription/orderGroupDrawer.vue`
- 前端文件:`openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue`
- 影响场景:住院医生工作站和门诊医生工作站应用医嘱组套
## 修复方案
**修改 `orderGroupDrawer.vue` 的 `handleUseOrderGroup` 函数**line 630-688
在 processed item 的 return 对象中显式添加缺失的字段:
- `doseUnitCode_dictText`:从 orderDetail 获取剂量单位显示文本
- `positionName`:从 orderDetail 获取执行科室/药房名称
- `injectFlag` / `injectFlag_enumText`:注射标识
- `skinTestFlag` / `skinTestFlag_enumText`:皮试标识
- `partPercent``partAttributeEnum``unitConversionRatio`:用于价格计算的关键字段
这些字段在 `orderDetail`AdviceBaseDto中都有只是没有在 processed item 的顶层显式设置。`handleSaveGroup``newRow` 通过 `...prescriptionList.value[rowIndex.value]` spread 能获取到 `setValue` 设置的值,但显式在顶层包含可以确保数据流的完整性。
## 验证计划
1. 修改代码后,用 `node --check` 验证语法
2. 在住院医生工作站测试:选择患者 → 点击组套 → 预览组套 → 应用到当前患者
3. 验证表格中显示的字段:单次剂量、总量、总金额、药房/科室均有值
---
## 修复结果:✅ 成功10行改动
**修改文件**`openhis-ui-vue3/src/views/doctorstation/components/prescription/orderGroupDrawer.vue`
**改动说明**:在 `handleUseOrderGroup` 函数的 processed item 中显式添加了以下缺失字段:
- `doseUnitCode_dictText`:剂量单位显示文本(如"mg"),用于"单次剂量"列的后缀显示
- `positionName`:药房/科室名称,用于"药房/科室"列显示
- `injectFlag` / `injectFlag_enumText`:注射药品标识及文本
- `skinTestFlag` / `skinTestFlag_enumText`:皮试标识及文本
**策略**策略A直接修复代码逻辑—— 组套应用时数据预处理缺失部分关键字段,导致父组件 `handleSaveGroup` 构建行数据时无法获取完整信息。补充字段后,`setValue``newRow` 构造均能正确传递这些数据到表格。

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env sh
# ============================================================
# Husky Pre-commit Hook - HIS项目
# 配置: 关羽 | 日期: 2026-04-24
# 功能: 提交前检查(已禁用)
# ============================================================
# 🔧 已禁用所有检查,直接允许提交
echo "⏭️ [Pre-commit] 检查已禁用,允许提交"
exit 0

28
ANALYSIS.md Normal file
View File

@@ -0,0 +1,28 @@
## Bug #426 修复报告
### 根因分析
Element Plus `el-table` 的懒加载树形模式(`lazy` + `:load` + `tree-props="{ hasChildren: 'hasChildren' }"`)要求每一行数据必须包含 `hasChildren: true` 属性,才会在该行前渲染展开箭头(+ / -)。
代码中所有创建 `selectedItems` 行对象的路径共7处都正确设置了 `isPackage: true``packageId`,但**遗漏了 `hasChildren` 属性**,导致树形表格无法识别哪些行是可展开的套餐项。
### 影响范围
- **文件**: `examinationApplication.vue`(前端)
- **涉及函数**: `handleItemSelect``handleMethodSelect``handleRowClick``onDetailMethodChange`
- **数据表**: 无数据库变更
### 修复方案
在7处代码路径中`packageId` 存在时同步设置 `hasChildren: true`
1. `handleRowClick` 初始 item 创建: `hasChildren: false`
2. `handleRowClick` 回充时设置 `isPackage` 两处: `hasChildren: true`
3. `handleMethodSelect` 已存在项更新: `hasChildren: true`
4. `handleMethodSelect` 新项创建: `hasChildren: !!(method.packageId || targetItem.packageId)`
5. `handleItemSelect` 新行创建: `hasChildren: !!(item.packageId)`
6. `onDetailMethodChange` 方法切换: `hasChildren: true`
### 验证计划
- 在门诊医生站选择检查套餐后,"检查明细" tab 的树形表格应显示展开箭头
- 点击展开箭头应懒加载套餐明细(项目名称、数量、单价)
- 回充已保存申请单时套餐项应正确显示展开箭头
修复结果:✅ 成功13行改动

54
ANALYSIS_433.md Normal file
View File

@@ -0,0 +1,54 @@
# Bug #433 分析报告
## 根因分析
### 问题1麻醉方法回显为代码
**数据流**:
1. 数据库 `op_schedule.anes_method` 字段为 VARCHAR存值为字典代码字符串如 `"2"`
2. 后端 `OpSchedule.anesMethod` 为 String 类型,通过 `getSurgeryScheduleDetail` 查询返回
3. 前端 el-select 选项通过 `useDict('anesthesia_type')` 加载,选项值为 `Number(item.value)` 即数字类型
4. `handleEdit``Object.assign(form, data)``form.anesMethod` 为字符串 `"2"`
**根因**: `form.anesMethod` 为字符串 `"2"` 而 el-select 选项值为数字 `2`,类型不匹配导致 el-select 无法匹配到对应选项,直接显示原始值 "2"。
**现有代码的问题**: 代码中有两行转换逻辑:
```javascript
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod) // OK
if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum) // 多余
```
第二行 `data.anesthesiaTypeEnum` 不是 `OpScheduleDto` 的字段SQL 查询也不包含此字段,因此永远为 null。但如果某些情况下后端返回了此字段例如值为 0会错误覆盖第一行的正确赋值。
### 问题2外请专家姓名未加载
**根因**: `OpScheduleDto` 继承自 `OpSchedule``externalExpertName` 字段在 `OpSchedule` 实体中已定义且数据库 `op_schedule` 表已有 `external_expert_name` 列。`getSurgeryScheduleDetail` 查询使用 `SELECT os.*`,会返回该字段。前端 `form` 中也已定义 `externalExpertName`
经数据库查询验证,当前数据中 `external_expert_name` 字段确实为空(尚未有用户填写过此字段)。但需确保 `Object.assign` 正确映射,且 `isExternalExpert` 类型匹配 el-radio 的 `:value="1"` / `:value="0"`
## 影响范围
- **前端**: `openhis-ui-vue3/src/views/surgicalschedule/index.vue``handleEdit``handleView` 方法
- **后端**: 无需修改(字段已存在且正常返回)
- **数据库**: 无需修改(字段已存在)
## 修复方案
`handleEdit``handleView` 方法中:
1. 删除多余的 `anesthesiaTypeEnum` 转换行
2. 使用 `$nextTick` 确保类型转换在 `Object.assign` 后在下一个 tick 执行,确保 Vue 响应式系统已处理完 `Object.assign` 的变更后再设置值
3. 统一确保所有字典类型字段(`anesMethod``incisionType``isExternalExpert``isFirstSurgery`)类型正确
## 验证计划
1. 修改后用 `node --check` 验证 .vue 语法
2. 确认 git diff 改动 ≥ 3 行
## 修复结果
✅ 成功28行改动handleEdit 和 handleView 各 7 行 × 2 函数)
### 改动摘要
1. **删除错误行**: `if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum)` — 此字段不在 OpScheduleDto 中SQL 也不返回,若返回会错误覆盖 anesMethod
2. **使用 nextTick 包裹类型转换**: 确保 Object.assign 触发的 Vue 响应式更新完成后再设置字典字段值,避免 el-select 在 DOM 更新前无法匹配选项
3. **同时修复 handleEdit 和 handleView**: 两处代码一致,均需要同步修复

50
ANALYSIS_434.md Normal file
View File

@@ -0,0 +1,50 @@
# Bug #434 分析报告
## 根因分析
### 问题:编辑弹窗中"切口类型"字段未正确回显数据
**数据流追踪**:
1. 用户点击"编辑"→ 前端调用 `getSurgeryScheduleDetail(row.scheduleId)`
2. 后端 SQL: `cs.incision_level AS incisionLevel`
3. PostgreSQL 返回列名: `incisionlevel` (全小写)
4. MyBatis 尝试将 `incisionlevel` 映射到 `OpScheduleDto.incisionLevel`
5. 映射失败!→ `data.incisionLevel` 为 null → `form.incisionType` 保持 undefined → el-select 显示空白
### 根因PostgreSQL 小写化未加引号的列别名
PostgreSQL 会将未加双引号的列别名自动转为小写:
```sql
-- SQL 写的别名
cs.incision_level AS incisionLevel
-- PostgreSQL 实际返回的列名
incisionlevel 全小写!
```
MyBatis 收到列名 `incisionlevel`(全小写),尝试匹配 Java 属性 `incisionLevel`(驼峰)。由于 `mapUnderscoreToCamelCase` 只对含下划线的列生效(`incisionlevel` 无下划线),匹配失败。
**对比 `anes_method` 为什么能工作**:
- SQL: `os.anes_method`(无 AS 别名)
- PostgreSQL 返回: `anes_method`(保留下划线)
- MyBatis `mapUnderscoreToCamelCase`: `anes_method``anesMethod`
**对比同 mapper 中的 `surgeryNo` 为什么能工作**:
- SQL: `os.oper_code AS surgeryNo` → PostgreSQL 返回 `surgeryno`
-`OpSchedule` 实体中**没有** `surgeryNo` 字段,只有 `operCode`
- `os.oper_code` 列映射到 `operCode` 是通过 `mapUnderscoreToCamelCase` 正常工作的
- `surgeryno` 找不到对应属性,被 MyBatis 忽略(不影响功能)
### 修复方案
将 SQL 中的别名加双引号:`cs.incision_level AS "incisionLevel"`
PostgreSQL 对加双引号的标识符保持大小写,返回列名 `incisionLevel`驼峰MyBatis 可直接匹配到 `OpScheduleDto.incisionLevel` 属性。
### 影响范围
- **后端**: `SurgicalScheduleAppMapper.xml``getSurgeryScheduleDetail` 查询第92行
- **前端**: 无需修改(`handleEdit`/`handleView` 中的 nextTick 转换逻辑已正确)
- **数据库**: 无需修改(`cli_surgery.incision_level` 字段已存在且有数据)
## 验证计划
1. 修改 SQL 后,运行相同查询验证列名变为 `incisionLevel`
2. 确认前端 `node --check` 语法通过

72
BUG_470_ANALYSIS.md Normal file
View File

@@ -0,0 +1,72 @@
# Bug #470 分析报告
## 根因分析
### 症状
住院医生工作站-手术申请单加载手术项目耗时过长,影响医生开单效率。
### 根本原因
**后端 `getSurgeryPage` 接口缺少 Redis 缓存层。**
与同模块的 `getAdviceBaseInfo`已有24小时Redis缓存不同`getSurgeryPage` 每次调用都直接查询数据库。
**代码对比:**
- `getAdviceBaseInfo`DoctorStationAdviceAppServiceImpl.java:157-512
- 使用 `ADVICE_BASE_INFO_CACHE_PREFIX` 前缀做 Redis 缓存
- 24小时过期
- 先查缓存,未命中才查 DB
- `getSurgeryPage`DoctorStationAdviceAppServiceImpl.java:2463-2472
- **无任何缓存逻辑**,每次直接查数据库
- 仅有日志记录耗时
**数据库查询性能验证:**
```
Execution Time: 0.400 ms (10102条手术项目已有 idx_wor_activity_def_surgery 索引)
Planning Time: 4.349 ms
```
数据库查询本身很快(<1ms但每次弹窗打开都重复执行查询 + 序列化 + 网络传输累积延迟明显
**辅助因素:**
1. `applicationFormBottomBtn.vue` 的对话框设置了 `destroy-on-close`每次关闭都会销毁 Surgery 组件
2. 前端虽有模块级内存缓存`surgeryRecordsCache` / `surgeryMappedCache`但首次加载仍需后端响应
3. 前端 `getList()` 命中缓存时未清除 `loading.value`导致 loading 动画可能卡住
### 影响范围
**涉及文件:**
- `openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java` 后端手术分页查询实现需加缓存
- `openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/surgery.vue` 前端手术申请单组件需修复 loading 状态
**涉及数据表:**
- `wor_activity_definition` 活动定义表手术项目源表10,102条手术记录
- `adm_charge_item_definition` 收费项定义表定价关联
## 修复方案
### 后端:给 `getSurgeryPage` 添加 Redis 缓存
**改动文件:** `DoctorStationAdviceAppServiceImpl.java`
1. 新增缓存键常量`SURGERY_PAGE_CACHE_PREFIX = "surgery:page:"`
2. 在无搜索关键字时尝试从 Redis 读取缓存
3. 缓存未命中时查询数据库后写入 Redis24小时过期
4. 有搜索关键字时不缓存避免缓存爆炸
**改动量:** 20
### 前端:修复 `getList()` 缓存命中时的 loading 状态
**改动文件:** `surgery.vue`
1. `getList()` 方法中当命中内存缓存时显式设置 `loading.value = false`
**改动量:** 1
## 验证计划
1. 编译验证 Java 代码
2. 语法验证 Vue 文件`node --check surgery.vue`
3. 手动验证登录医生工作站打开手术申请单观察加载速度首次应有loading二次打开应秒开

65
BUG_472_ANALYSIS.md Normal file
View File

@@ -0,0 +1,65 @@
# Bug #472 深度分析报告
## 标题
住院医生工作站-手术申请单:勾选手术项目无效,导致无法正常开立医嘱
## 根因分析
### 问题链路
1. 当前分支将手术项目数据源从 `getApplicationList` 改为专用接口 `getSurgeryPage`
2. `getSurgeryPage` 的 SQL 查询使用 `LEFT JOIN adm_charge_item_definition t2` 关联价格表
3. **关键问题**SQL 中缺少 `DISTINCT ON (t1.ID)` 去重逻辑
4. 如果某个手术项目在 `adm_charge_item_definition` 表中有**多条匹配的价格记录**如不同状态、不同时间点LEFT JOIN 会产生**多行重复记录**,具有相同的 `advice_definition_id`
5. 前端 `mapToTransferItem` 将这些重复记录映射为 el-transfer 数据项,所有重复项的 `key` 相同
6. el-transfer 组件内部使用 key 进行 Vue 的列表渲染追踪。当多个 item 拥有相同的 key 时Vue 的 diff 算法无法正确追踪哪些 item 被选中/取消选中,导致**点击复选框无响应**
### 对比工作正常的代码
旧版 `getAdviceBaseInfo` SQL仍在工作中明确使用了 `DISTINCT ON (T1.ID)` 去重:
```sql
SELECT DISTINCT ON (T1.ID) ...
```
新版 `getSurgeryPage` SQL 遗漏了这个去重逻辑。
## 影响范围
- **前端**`surgery.vue` — el-transfer 复选框交互异常
- **后端 SQL**`DoctorStationAdviceAppMapper.xml` — getSurgeryPage 查询缺少去重
- **数据库表**`wor_activity_definition`(手术项目定义)、`adm_charge_item_definition`(价格定义)
- **同类问题**`getExaminationPage` 查询也存在相同缺陷
## 修复方案
### 1. 后端 SQL 修复(根因修复)
`DoctorStationAdviceAppMapper.xml``getSurgeryPage``getExaminationPage` 查询中添加 `DISTINCT ON (t1.ID)`
- `DISTINCT ON (t1.ID)` 确保每个手术/检查项目只返回一行
- PostgreSQL 的 DISTINCT ON 按 t1.ID 去重,保留每个组的第一行
### 2. 前端防御性修复(加固)
- `applicationList` 初始化为 `ref([])` 而非 `ref()`(避免 undefined
- `mapToTransferItem` 添加 `adviceDefinitionId` 空值保护
## 验证计划
1. 修改 SQL 后,进入住院医生工作站 → 手术申请单
2. 确认"未选择"列表中每个手术项目只显示一次(无重复)
3. 点击复选框,项目应被正确选中并移入"已选择"列表
4. 点击确认按钮,应成功开立手术申请
---
## 修复结果
**修复策略**策略A直接修复代码逻辑
**根因修复**
- SQL `getSurgeryPage``getExaminationPage` 添加 `DISTINCT ON (t1.ID)` 去重
- ORDER BY 调整为 `t1.ID, t1.name ASC, t2.ID ASC`DISTINCT ON 要求 ORDER BY 首列必须与 DISTINCT ON 一致)
**前端加固**
- `applicationList` 初始化为 `ref([])` 而非 `ref()`
- 数据映射前过滤 `adviceDefinitionId != null` 的脏数据
**改动量**2文件8行增6行删
- `DoctorStationAdviceAppMapper.xml`+4/-4DISTINCT ON + ORDER BY 调整)
- `surgery.vue`+4/-2初始化空数组 + 空值过滤)
**修复结果:✅ 成功8行改动**

43
bug432_analysis.md Normal file
View File

@@ -0,0 +1,43 @@
# Bug #432 分析报告
## 根因分析
**根因**:后端 `OpCreateScheduleDto` 缺少 `@JsonIgnoreProperties(ignoreUnknown = true)` 注解。
Spring Boot 的 Jackson 默认配置 `FAIL_ON_UNKNOWN_PROPERTIES = true`,即反序列化时遇到 DTO 中不存在的字段会抛出 `JsonMappingException: Unrecognized field` 异常。
前端 `submitForm()` 使用 `{ ...form }` 展开整个表单对象提交,包含大量 DTO 中不存在的字段:
- `identifierNo`(就诊卡号)
- `patientName`(患者姓名)
- `gender`(性别)
- `age`(年龄)
- `birthDay`(出生日期)
- `orgName`(机构名称)
- `applyDeptName`(申请科室名称)
- `surgeonName`(主刀医生姓名)
- `applyDoctorName`(申请医生姓名)
- `applyTime`(申请时间)
- `surgeryNo`(手术单号)
- `scheduleId`排程ID新增时为undefined
- `orgId`机构ID前端显式添加
这些字段在后端 `OpCreateScheduleDto` 中均未定义,导致 JSON 反序列化失败,返回 400/500 错误,前端显示"新增手术安排失败"。
## 影响范围
- **后端文件**`OpCreateScheduleDto.java`
- **影响接口**`POST /clinical-manage/surgery-schedule/create`(新增手术安排)
- **影响数据表**`op_schedule`
- **前端无需修改**:前端提交逻辑正确,问题在后端 DTO 配置
## 修复方案
`OpCreateScheduleDto` 类上添加 `@JsonIgnoreProperties(ignoreUnknown = true)` 注解,使 Jackson 在反序列化时忽略 DTO 中不存在的字段。
这是最小侵入性修复(仅添加 1 行注解),不影响现有业务逻辑。
## 验证计划
1. 修改后运行 Maven 编译确认无语法错误
2. 部署后按 Bug 步骤操作:新增手术安排 → 查找并选择手术申请 → 填写入室时间 → 保存
3. 确认保存成功,无报错

119
docs/bug439_analysis.md Normal file
View File

@@ -0,0 +1,119 @@
# Bug #439 分析报告
## Bug描述
领用出库:选择领用药品后"总库存数量"列数据未显示
## 数据流分析
1. 用户点击"添加行" → 新增一行totalQuantity 初始化为空字符串 ''
2. 用户在"项目"列通过 PopoverList 选择药品 → 触发 `selectRow(rowValue, index)`
3. `selectRow` 设置药品基本信息,然后调用 `handleLocationClick(1, rowValue, index)`
4. `handleLocationClick` 调用 `getCount({ itemId, orgLocationId })` 获取库存
5. `getCount` 返回 LocationInventoryDto[] 列表,前端通过 `pickBestOrgQuantityRow` 选最大值
6. `applyFromDto` 设置 `r.totalQuantity = d.orgQuantity || 0`
## 根因定位
`selectRow` 函数中第1022-1049行选择药品后
```javascript
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
```
但后端 `/app-common/inventory-item` 接口返回的 `unitList` 只设置了 `unitCode``minUnitCode`**没有设置 `unitCode_dictText``minUnitCode_dictText`**。
`handleLocationClick``applyFromDto`第1099-1121行
```javascript
r.unitCode = r.unitList.minUnitCode;
r.unitCode_dictText = r.unitList.minUnitCode_dictText; // ← undefined!
if (r.unitCode == r.unitList.minUnitCode) { // ← 这个条件始终为 true
r.price = d.price / r.partPercent || '';
r.price = r.price.toFixed(4);
}
```
关键问题:`r.unitCode` 刚被设为 `r.unitList.minUnitCode`,然后条件 `r.unitCode == r.unitList.minUnitCode` 始终为 true
导致即使价格很小(如 0.05/1=0.05),也会进入这个分支。
但这不是总库存数量未显示的根本原因。
**真正根因:`handleLocationClick` 函数在调用 `getCount` 获取库存数据后,`applyFromDto` 中 `r.totalQuantity = d.orgQuantity || 0` 的赋值逻辑依赖 `d.orgQuantity > 0` 的前置判断。**
查看前端代码流程:
- `selectRow` 设置 `totalQuantity: ''`(新增行时的默认值)
- 然后调用 `handleLocationClick``getCount` → 后端返回数据
- `pickBestOrgQuantityRow` 从返回列表中选出 orgQuantity 最大的记录
- 如果 `d && Number(d.orgQuantity ?? 0) > 0` → 调用 `applyFromDto` → 设置 `r.totalQuantity = d.orgQuantity || 0`
- 如果条件不满足(所有记录 orgQuantity 都为 0 或返回空列表)→ **`applyFromDto` 不被调用** → `r.totalQuantity` 保持空字符串 ''
进一步分析发现:
- 如果后端 `getCount` 返回空列表(该药品在该仓库无库存),`d` 为 null`applyFromDto` 不会被调用
- 但如果该药品在仓库确实有库存,问题可能出在前端数据传递上
**核心问题在于 `unitList` 结构不完整:**
`selectRow``rowValue.unitList` 来自药品列表查询结果,其 `unitList` 由后端 `CommonServiceImpl.getInventoryItemList` 构建,
只包含 `unitCode``minUnitCode`,缺少 `unitCode_dictText``minUnitCode_dictText`
`handleLocationClick``applyFromDto` 中,`r.unitCode``r.unitCode_dictText` 的赋值依赖于 `unitList` 中的字段。
如果 `r.unitList` 是从 `rowValue.unitList[0]` 赋值而来(在 `selectRow` 中),那它应该至少有 `unitCode``minUnitCode`
**但是!** 编辑模式(`getTransferProductDetails`)中,`unitList` 的构建方式不同:
```javascript
form.purchaseinventoryList[index].unitList = e.unitList[0]; // 编辑详情时
```
新增模式(`selectRow`)中:
```javascript
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
```
两种方式获取的 `unitList` 结构可能不同。
**根本原因:**
`handleLocationClick` 中的 `getCount` API 调用,返回的 `LocationInventoryDto` 确实包含 `orgQuantity`
前端通过 `pickBestOrgQuantityRow` 选出最大值的记录后,调用 `applyFromDto` 设置 `totalQuantity`
如果药品在仓库有库存但 `totalQuantity` 仍为空白,说明 `applyFromDto` 中的 `d.orgQuantity` 可能为 `null`/`undefined`
经检查 `selectInventoryItemInfo` SQL
```sql
SUM(CASE WHEN T1.location_id = #{orgLocationId} THEN T1.quantity ELSE 0 END) AS org_quantity
```
`objLocationId` 为 null/空时WHERE 子句为:
```sql
AND T1.location_id = #{orgLocationId}
```
这意味着查询结果中的所有记录都来自 `orgLocationId` 对应的仓库。
此时 `org_quantity` 应该等于 `SUM(T1.quantity)`
**如果查询结果为空(该药品在该仓库没有库存记录),则前端 `d` 为 null`applyFromDto` 不被调用totalQuantity 保持空字符串。**
但 Bug 的期望是"应实时检索并填充总库存数量"——如果仓库确实没有该药品的库存,那显示空白是合理的。
但如果仓库有库存却未显示说明前端传递的参数orgLocationId 或 itemId有问题。
**最终根因:前端 `handleLocationClick` 函数中,`orgLocationId` 的取值可能为空字符串,**
**导致后端查询时使用空字符串作为 location_id 条件,查不到任何记录。**
```javascript
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
```
虽然 Bug 步骤中说先选了"西药库",但如果 `receiptHeaderForm.headerLocationId` 在 selectRow 时已正确设置,
`r.sourceLocationId` 也应该被设置(在 selectRow 第1037行
```javascript
form.purchaseinventoryList[index].sourceLocationId =
receiptHeaderForm.headerLocationId || form.purchaseinventoryList[index].sourceLocationId || '';
```
**但这里有一个微妙的时序问题:`handleLocationClick` 在 `getPharmacyCabinetList().then()` 内部被调用,**
**但 `handleLocationClick` 是同步执行的,不等待 `getPharmacyCabinetList` 完成。**
**这本身不影响 `orgLocationId` 的取值,因为 `orgLocationId` 不依赖 `getPharmacyCabinetList`。**
## 修复方案
1. 确保 `applyFromDto` 即使在 `orgQuantity` 为 0 时也能被调用,正确显示"0"而不是空白
2. 确保 `unitList` 包含必要的字典文本字段
## 影响范围
- 前端文件openhis-ui-vue3/src/views/medicationmanagement/requisitionManagement/requisitionManagement/index.vue
- 涉及函数:`selectRow``handleLocationClick`

44
docs/bug462_analysis.md Normal file
View File

@@ -0,0 +1,44 @@
# Bug #462 分析报告
## Bug 描述
[目录管理-诊疗目录] 编辑弹窗中"所需标本"下拉框数据加载失败,显示为"无数据"
## 根因分析
### 数据流追踪
1. 前端组件 `diagnosisTreatmentDialog.vue` 第168-178行渲染"所需标本"下拉框
2. 下拉框选项来自 `specimen_code` 变量第172行 `v-for="category in specimen_code"`
3. `specimen_code` 通过 `proxy.useDict('specimen_code', ...)` 加载第378-386行
4. `useDict` 调用 API `/system/dict/data/type/specimen_code``src/utils/dict.js` 第16行
5. 后端 `SysDictDataController.dictType()` 处理请求第65-73行**无权限校验**
6. 最终查询 `sys_dict_data` 表,条件:`status = '0' AND dict_type = 'specimen_code'`
### 根因
`sys_dict_type` 表中 **缺少 `specimen_code` 字典类型**,导致 `sys_dict_data` 表中也无对应的标本数据记录。
前端 `useDict('specimen_code')` 调用 API 后返回空数组 `[]`,下拉框 `v-for` 遍历空数组,没有任何 `<el-option>` 渲染Element Plus 显示默认空状态文案"无数据"。
**与 Bug #433 对比**Bug #433 是"麻醉方法回显为代码"和"外请专家姓名数据未加载",根因也是字典数据缺失。本次 Bug #462 属于同类问题——新增字典类型时只在前端引用了 `useDict('specimen_code')`,但后端数据库中未创建对应的字典类型和数据。
## 影响范围
- **前端文件**`openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/diagnosisTreatmentDialog.vue`(仅一处引用)
- **后端文件**:无代码变更,纯数据问题
- **数据库表**`sys_dict_type`(插入字典类型)、`sys_dict_data`插入7条标本数据
- **影响接口**`GET /system/dict/data/type/specimen_code`
## 修复方案
执行 DDL 脚本 `sql/bug_462_add_specimen_code_dict.sql`
1.`sys_dict_type` 表插入 `specimen_code` 字典类型dict_name='所需标本'
2.`sys_dict_data` 表插入7条标本记录
- 血液(1)、尿液(2)、粪便(3)、呼吸道(4)、无菌体液(5)、生殖道(6)、其他(99)
**注意**:数据库中已存在该字典数据(由测试验证),需检查 DDL 是否已执行。
若数据已存在但前端仍显示"无数据",则需重启后端服务刷新字典缓存(`SysDictTypeServiceImpl.loadingDictCache()`)。
## 验证计划
1. 确认数据库中 `sys_dict_type` 存在 `specimen_code` 记录
2. 确认数据库中 `sys_dict_data` 存在7条 `specimen_code` 数据status='0'
3. 重启后端服务(刷新字典缓存)
4. 前端进入诊疗目录编辑弹窗,点击"所需标本"下拉框应显示7条标本选项
5. 选择任意标本后保存,再次编辑应正确回显已选标本

View File

@@ -121,6 +121,18 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
// 查询机构位置分页列表
Page<OrgLocQueryDto> orgLocQueryDtoPage =
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
// 手动填充项目名称字典翻译,确保前端能正确回显项目名称
if (orgLocQueryDtoPage != null && !orgLocQueryDtoPage.getRecords().isEmpty()) {
for (OrgLocQueryDto dto : orgLocQueryDtoPage.getRecords()) {
if (dto.getActivityDefinitionId() != null) {
ActivityDefinition activityDef =
activityDefinitionMapper.selectById(dto.getActivityDefinitionId());
if (activityDef != null && activityDef.getName() != null) {
dto.setActivityDefinitionId_dictText(activityDef.getName());
}
}
}
}
return R.ok(orgLocQueryDtoPage);
}

View File

@@ -83,6 +83,9 @@ public class InfectiousCardDto {
/** 病例分类 */
private String diseaseType;
/** 病例分类 */
private Integer caseClass;
/** 发病日期 */
private LocalDate onsetDate;

View File

@@ -1,5 +1,6 @@
package com.openhis.web.clinicalmanage.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@@ -7,6 +8,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class OpCreateScheduleDto {
/**
* 申请单ID

View File

@@ -5,6 +5,7 @@ import com.core.common.core.domain.R;
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
import com.openhis.web.doctorstation.dto.SurgeryItemDto;
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
import java.util.List;
@@ -134,4 +135,18 @@ public interface IDoctorStationAdviceAppService {
* @return 已配置的药品类别编码列表
*/
R<?> getConfiguredCategories(Long organizationId);
/**
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
*
* @param organizationId 科室ID可选
* @param pageNo 当前页
* @param pageSize 每页条数
* @param searchKey 模糊查询关键字(可选)
* @return 手术项目分页数据(含价格信息)
*/
IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
}

View File

@@ -728,12 +728,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理耗材请求
* 🔧 BugFix #443: 签发时跳过 handDevice避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
*/
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
this.handDevice(deviceList, curDate, adviceOpType);
}
this.handDevice(deviceList, curDate, adviceOpType);
// 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
@@ -1111,7 +1107,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
if (is_save) {
medicationRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
}
medicationRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
medicationRequest.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
medicationRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
medicationRequest.setExecuteNum(adviceSaveDto.getExecuteNum()); // 执行次数
medicationRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
@@ -1157,7 +1155,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setId(adviceSaveDto.getChargeItemId()); // 费用项id
chargeItem.setStatusEnum(2); // 已生成医嘱
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(medicationRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setPrescriptionNo(adviceSaveDto.getPrescriptionNo()); // 处方号
chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者
chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型
@@ -1251,7 +1251,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
deviceRequest.setCreateBy(currentUsername);
deviceRequest.setCreateTime(curDate);
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue());
deviceRequest.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue());
deviceRequest.setQuantity(boundDevice.getQuantity());
deviceRequest.setUnitCode(boundDevice.getUnitCode());
deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum());
@@ -1317,7 +1319,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
deviceChargeItem.setCreateTime(curDate);
deviceChargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());
deviceChargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo()));
deviceChargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue());
deviceChargeItem.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue());
deviceChargeItem.setPrescriptionNo(adviceSaveDto.getPrescriptionNo()); // 处方号,与药品一致
deviceChargeItem.setPatientId(adviceSaveDto.getPatientId());
deviceChargeItem.setContextEnum(ChargeItemContext.DEVICE.getValue()); // 耗材类型
@@ -1546,7 +1550,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
if (is_save) {
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
}
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
deviceRequest.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
deviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
@@ -1609,7 +1615,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setCreateTime(curDate); // 补全创建时间
chargeItem.setStatusEnum(2); // 已生成医嘱
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者
chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型
chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
@@ -1910,7 +1918,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
if (is_save) {
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
}
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
serviceRequest.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
serviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
@@ -1961,7 +1971,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
chargeItem.setCreateTime(curDate); // 补全创建时间
chargeItem.setStatusEnum(2); // 已生成医嘱
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setGenerateSourceEnum(adviceSaveDto.getGenerateSourceEnum() != null
? adviceSaveDto.getGenerateSourceEnum()
: GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者
chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型
chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
@@ -2107,9 +2119,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
sourceEnum, sourceBillNo);
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
// 手术计费场景sourceBillNo 不为空时过滤掉药品1保留耗材2和诊疗3/6
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
&& dto.getAdviceType() == 1);
}
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto
@@ -2442,4 +2456,52 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
return R.ok(categoryCodes);
}
/**
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
*/
@Override
public IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
log.info("getSurgeryPage 开始: orgId={}, page={}/{}, searchKey={}", organizationId, pageNo, pageSize, searchKey);
long start = System.currentTimeMillis();
// 无搜索时尝试从 Redis 缓存读取(手术项目变更频率低,适合缓存)
String safeOrgId = organizationId != null ? organizationId.toString() : "";
String cacheKey = "surgery:page:" + safeOrgId + ":" + pageNo + ":" + pageSize;
boolean useCache = (searchKey == null || searchKey.trim().isEmpty());
if (useCache) {
Object cachedObj = redisCache.getCacheObject(cacheKey);
if (cachedObj instanceof com.baomidou.mybatisplus.extension.plugins.pagination.Page) {
log.info("从 Redis 缓存获取手术项目, key: {}, records: {}", cacheKey,
((IPage<?>) cachedObj).getRecords().size());
return (IPage<SurgeryItemDto>) cachedObj;
}
}
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getSurgeryPage(
new Page<>(pageNo, pageSize),
PublicationStatus.ACTIVE.getValue(),
organizationId,
searchKey);
log.info("getSurgeryPage 完成: {}ms, total={}, records={}", System.currentTimeMillis() - start, result.getTotal(), result.getRecords().size());
// 无搜索时将结果写入缓存
if (useCache && result instanceof com.baomidou.mybatisplus.extension.plugins.pagination.Page) {
redisCache.setCacheObject(cacheKey, result, (int) CACHE_EXPIRE_HOURS, java.util.concurrent.TimeUnit.HOURS);
log.info("缓存手术项目, key: {}, 过期时间: {} 小时", cacheKey, CACHE_EXPIRE_HOURS);
}
return result;
}
@Override
public IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getExaminationPage(
new Page<>(pageNo, pageSize),
PublicationStatus.ACTIVE.getValue(),
organizationId,
searchKey);
return result;
}
}

View File

@@ -246,8 +246,7 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
EncounterDiagnosis encounterDiagnosis;
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
encounterDiagnosis = new EncounterDiagnosis();
// 注意:不设置 encounterDiagnosisId因为上面已经删除了所有记录
// 如果设置旧的 IDsaveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
encounterDiagnosis.setEncounterId(encounterId);
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());

View File

@@ -345,23 +345,25 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
encounterId, tenantId);
}
// 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录)
// Bug #401使用更新前记录的原始状态判断,避免自身更新后将状态改为 COMPLETED 导致误判为"已完成"
if (!queueWasAlreadyCompleted) {
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
DivLog divLog = new DivLog()
.setPoolId(divPoolId)
.setSlotId(divSlotId)
.setOpUserId(loginUser != null ? loginUser.getUserId() : null)
.setAction("COMPLETE")
.setCreateTime(LocalDateTime.now())
.setUpdateAt(LocalDateTime.now())
.setCreatedAt(LocalDateTime.now());
divLogService.save(divLog);
} catch (Exception e) {
log.error("写入div_log审计日志失败", e);
// 写入 div_log 审计日志(每次完诊都生成记录,确保审计链路完整
// Bug #401移除 queueWasAlreadyCompleted 条件限制,避免队列已由分诊台完诊时
// 医生站完诊不写日志导致审计记录缺失;同时保留 queueWasAlreadyCompleted 日志用于排查
try {
LoginUser loginUser = SecurityUtils.getLoginUser();
DivLog divLog = new DivLog()
.setPoolId(divPoolId)
.setSlotId(divSlotId)
.setOpUserId(loginUser != null ? loginUser.getUserId() : null)
.setAction("COMPLETE")
.setCreateTime(LocalDateTime.now())
.setUpdateAt(LocalDateTime.now())
.setCreatedAt(LocalDateTime.now());
divLogService.save(divLog);
if (queueWasAlreadyCompleted) {
log.info("完诊:队列项已由分诊台完诊,医生站补充写入审计日志 encounterId={}", encounterId);
}
} catch (Exception e) {
log.error("写入div_log审计日志失败", e);
}
// 4. 更新状态、完成时间以及初复诊标识

View File

@@ -203,4 +203,31 @@ public class DoctorStationAdviceController {
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId);
}
/**
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
*
* @param organizationId 科室ID可选
* @param pageNo 当前页
* @param pageSize 每页条数
* @param searchKey 模糊查询关键字(可选)
* @return 手术项目分页数据(含价格信息)
*/
@GetMapping(value = "/surgery-page")
public R<?> getSurgeryPage(
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
return R.ok(iDoctorStationAdviceAppService.getSurgeryPage(organizationId, pageNo, pageSize, searchKey));
}
@GetMapping(value = "/examination-page")
public R<?> getExaminationPage(
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
return R.ok(iDoctorStationAdviceAppService.getExaminationPage(organizationId, pageNo, pageSize, searchKey));
}
}

View File

@@ -112,12 +112,15 @@ public class InfectiousDiseaseReportDto {
private Integer caseClass;
/** 发病日期(默认诊断时间,病原携带者填初检日期) */
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate onsetDate;
/** 诊断日期(精确到小时) */
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime diagDate;
/** 死亡日期(死亡病例必填) */
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate deathDate;
/** 订正病名(订正报告必填) */
@@ -136,6 +139,7 @@ public class InfectiousDiseaseReportDto {
private String reportDoc;
/** 填卡日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate reportDate;
/** 报卡名称代码 1-中华人民共和国传染病报告卡 */

View File

@@ -0,0 +1,42 @@
package com.openhis.web.doctorstation.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.math.BigDecimal;
/**
* 手术项目选择器专用 DTO不含 @Dict 注解,绕过 DictAspect 的 Redis 字典翻译)
*/
@Data
public class SurgeryItemDto {
/** 医嘱定义ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long adviceDefinitionId;
/** 手术名称 */
private String adviceName;
/** 所属科室ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long orgId;
/** 执行科室ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long positionId;
/** 费用定价主表ID用于提交时关联价格 */
@JsonSerialize(using = ToStringSerializer.class)
private Long chargeItemDefinitionId;
/** 单价(直接从定价主表取,无需嵌套 priceList */
private BigDecimal price;
/** 单位编码 */
private String unitCode;
/** 单位编码字典文本(前端用于显示单位) */
private String unitCodeDictText;
}

View File

@@ -185,4 +185,23 @@ public interface DoctorStationAdviceAppMapper {
*/
Long getDefaultAccountId(@Param("encounterId") Long encounterId);
/**
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
*
* @param page 分页参数
* @param statusEnum 启用状态
* @param organizationId 科室ID可选用于过滤已配置的手术项目
* @param searchKey 模糊查询关键字(可选)
* @return 手术项目分页数据
*/
IPage<SurgeryItemDto> getSurgeryPage(@Param("page") Page<SurgeryItemDto> page,
@Param("statusEnum") Integer statusEnum,
@Param("organizationId") Long organizationId,
@Param("searchKey") String searchKey);
IPage<SurgeryItemDto> getExaminationPage(@Param("page") Page<SurgeryItemDto> page,
@Param("statusEnum") Integer statusEnum,
@Param("organizationId") Long organizationId,
@Param("searchKey") String searchKey);
}

View File

@@ -178,8 +178,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null);
// requestStatus由前端tab控制后端SQL已通过CASE条件处理校对状态过滤无需再作为SQL条件
inpatientAdviceParam.setRequestStatus(null);
// requestStatus由前端tab传入通过QueryWrapper自动添加到SQL外层WHERE过滤
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
@@ -368,7 +367,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
.in(MedicationDispense::getMedReqId, medReqIds)
.eq(MedicationDispense::getStatusEnum, DispenseStatus.COMPLETED.getValue()));
if (!dispenseList.isEmpty()) {
return R.fail("医嘱已发药,无法退回");
return R.fail("药品已由药房发放,请先执行退药处理,不可直接退回");
}
}
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();

View File

@@ -245,7 +245,7 @@ public class InpatientAdviceDto {
/**
* 药品/服务类型
*/
private Integer categoryCode;
private String categoryCode;
/**
* 执行科室
*/

View File

@@ -89,17 +89,14 @@
cs.apply_doctor_name AS apply_doctor_name,
drf.create_time AS apply_time,
os.surgery_nature AS surgeryType,
cs.incision_level AS incisionLevel,
fc.contract_name AS feeType,
cs.incision_level AS "incisionLevel",
os.fee_type AS feeType,
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
FROM op_schedule os
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
LEFT JOIN adm_organization o ON cs.org_id = o.id
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
LEFT JOIN adm_encounter ae ON ae.id = os.visit_id AND ae.delete_flag = '0'
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
LEFT JOIN (
SELECT patient_id, identifier_no
FROM (

View File

@@ -42,8 +42,8 @@
T5.package_name,
T6.name as sub_item_name
FROM wor_activity_definition T1
/* 价格表使用LEFT JOIN避免因缺少价格记录导致搜索不到项目 */
LEFT JOIN adm_charge_item_definition T2
/* 只JOIN必要的价格表使用INNER JOIN避免笛卡尔积 */
INNER JOIN adm_charge_item_definition T2
ON T1.id = T2.instance_id
AND T2.instance_table = 'wor_activity_definition'
/* 检验类型关联 */

View File

@@ -539,6 +539,65 @@
AND T1.refund_medicine_id IS NULL
ORDER BY T1.status_enum,T1.sort_number)
UNION ALL
-- 🔧 Bug #444: 直接从计费项目表补充查询药品记录用于覆盖med_medication_request有记录但generate_source_enum不匹配的场景
(SELECT 1 AS advice_type,
T1.service_id AS request_id,
T1.service_id || '-ci-med' AS unique_key,
'' AS prescription_no,
T1.enterer_id AS requester_id,
T1.entered_date AS request_time,
CASE WHEN T1.enterer_id = #{practitionerId} THEN '1' ELSE '0' END AS biz_request_flag,
T2.content_json AS content_json,
NULL AS skin_test_flag,
NULL AS inject_flag,
NULL AS group_id,
T3.NAME AS advice_name,
T4.total_volume AS volume,
T2.lot_number AS lot_number,
T1.quantity_value AS quantity,
T1.quantity_unit AS unit_code,
T1.status_enum AS status_enum,
'' AS method_code,
'' AS rate_code,
NULL AS dose,
'' AS dose_unit_code,
T1.id AS charge_item_id,
T1.unit_price AS unit_price,
T1.total_price AS total_price,
T1.status_enum AS charge_status,
NULL AS position_id,
'' AS position_name,
NULL AS dispense_per_duration,
T3.part_percent AS part_percent,
'' AS condition_definition_name,
T2.sort_number AS sort_number,
NULL AS based_on_id,
NULL AS category_enum,
T1.encounter_id AS encounter_id,
T1.patient_id AS patient_id,
'med_medication_definition' AS advice_table_name,
T3.ID AS advice_definition_id
FROM adm_charge_item AS T1
INNER JOIN med_medication_request AS T2 ON T2.ID = T1.service_id AND T2.delete_flag = '0'
LEFT JOIN med_medication_definition AS T3 ON T3.ID = T2.medication_id AND T3.delete_flag = '0'
LEFT JOIN med_medication AS T4 ON T4.medication_def_id = T3.ID AND T4.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.service_table = #{MED_MEDICATION_REQUEST}
<if test="historyFlag == '0'.toString()">
AND T1.encounter_id = #{encounterId}
</if>
<if test="historyFlag == '1'.toString()">
AND T1.patient_id = #{patientId} AND T1.encounter_id != #{encounterId}
</if>
AND NOT EXISTS (
SELECT 1 FROM med_medication_request T5
WHERE T5.ID = T1.service_id AND T5.delete_flag = '0'
<if test="generateSourceEnum != null">
AND T5.generate_source_enum = #{generateSourceEnum}
</if>
)
ORDER BY T1.entered_date)
UNION ALL
-- 🔧 查询仅存在于 adm_charge_item 的"孤儿"耗材数据DeviceRequest 缺失或 generate_source_enum 未设置)
-- 正常 DeviceRequestgenerate_source_enum 已赋值)由下方 Part 3 统一负责,此处不做重复覆盖避免 UNION ALL 重复行
(SELECT 2 AS advice_type,
@@ -811,4 +870,54 @@
LIMIT 1
</select>
<!-- 手术项目专用分页查询:仅查手术 + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
<select id="getSurgeryPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
SELECT DISTINCT ON (t1.ID)
t1.ID AS advice_definition_id,
t1.NAME AS advice_name,
t1.org_id AS org_id,
t1.org_id AS position_id,
t2.ID AS charge_item_definition_id,
t2.price AS price,
t1.permitted_unit_code AS unit_code,
t1.permitted_unit_code AS unit_code_dict_text
FROM wor_activity_definition t1
LEFT JOIN adm_charge_item_definition t2
ON t2.instance_id = t1.ID
AND t2.delete_flag = '0'
AND t2.status_enum = #{statusEnum}
AND t2.instance_table = 'wor_activity_definition'
WHERE t1.delete_flag = '0'
AND (t1.category_code = '手术' OR t1.category_code = '24')
<if test="searchKey != null and searchKey != ''">
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
</if>
ORDER BY t1.ID, t1.name ASC, t2.ID ASC
</select>
<!-- 检查项目专用分页查询:仅查检查(23) + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
<select id="getExaminationPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
SELECT DISTINCT ON (t1.ID)
t1.ID AS advice_definition_id,
t1.NAME AS advice_name,
t1.org_id AS org_id,
t1.org_id AS position_id,
t2.ID AS charge_item_definition_id,
t2.price AS price,
t1.permitted_unit_code AS unit_code,
t1.permitted_unit_code AS unit_code_dict_text
FROM wor_activity_definition t1
LEFT JOIN adm_charge_item_definition t2
ON t2.instance_id = t1.ID
AND t2.delete_flag = '0'
AND t2.status_enum = #{statusEnum}
AND t2.instance_table = 'wor_activity_definition'
WHERE t1.delete_flag = '0'
AND t1.category_code = '23'
<if test="searchKey != null and searchKey != ''">
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
</if>
ORDER BY t1.ID, t1.name ASC, t2.ID ASC
</select>
</mapper>

View File

@@ -305,28 +305,28 @@
T1.occurrence_end_time AS end_time,
T1.requester_id AS requester_id,
T1.create_time AS request_time,
NULL AS skin_test_flag,
NULL AS inject_flag,
NULL AS group_id,
NULL::integer AS skin_test_flag,
NULL::integer AS inject_flag,
NULL::bigint AS group_id,
T1.performer_check_id,
T2."name" AS advice_name,
T2.id AS item_id,
NULL AS volume,
NULL AS lot_number,
NULL::varchar AS volume,
NULL::varchar AS lot_number,
T1.quantity AS quantity,
T1.unit_code AS unit_code,
T1.status_enum AS request_status,
NULL AS method_code,
NULL AS rate_code,
NULL AS dose,
NULL AS dose_unit_code,
NULL::varchar AS method_code,
NULL::varchar AS rate_code,
NULL::numeric AS dose,
NULL::varchar AS dose_unit_code,
ao1.id AS position_id,
ao1."name" AS position_name,
NULL AS dispense_per_duration,
1 AS part_percent,
NULL::integer AS dispense_per_duration,
1::numeric AS part_percent,
ccd."name" AS condition_definition_name,
T1.therapy_enum AS therapy_enum,
NULL AS sort_number,
NULL::integer AS sort_number,
T1.quantity AS execute_num,
af.day_times,
ae.bus_no,
@@ -341,7 +341,7 @@
personal_account.balance_amount,
personal_account.id AS account_id,
T2.category_code,
NULL AS dispense_status
NULL::integer AS dispense_status
FROM wor_service_request AS T1
LEFT JOIN wor_activity_definition AS T2
ON T2.id = T1.activity_id

View File

@@ -44,7 +44,9 @@
sdd.dict_label AS unit_code_name,
togpd.dose AS dose,
togpd.rate_code AS rate_code,
rate_d.dict_label AS rate_code_dictText,
togpd.method_code AS method_code,
method_d.dict_label AS method_code_dictText,
togpd.dose_quantity AS dose_quantity,
togpd.group_id,
togpd.group_order AS group_order,
@@ -67,8 +69,9 @@
AND togpd.order_definition_id = adm.ID
LEFT JOIN wor_activity_definition AS wor ON togpd.order_definition_table = 'wor_activity_definition'
AND togpd.order_definition_id = wor.ID
LEFT JOIN sys_dict_data AS sdd ON sdd.dict_value = togpd.unit_code AND sdd.dict_type = 'unit_code' AND
sdd.status = '0'
LEFT JOIN sys_dict_data AS sdd ON sdd.dict_value = togpd.unit_code AND sdd.dict_type = 'unit_code' AND sdd.status = '0'
LEFT JOIN sys_dict_data AS rate_d ON rate_d.dict_value = togpd.rate_code AND rate_d.dict_type = 'rate_code' AND rate_d.status = '0'
LEFT JOIN sys_dict_data AS method_d ON method_d.dict_value = togpd.method_code AND method_d.dict_type = 'method_code' AND method_d.status = '0'
WHERE togpd.delete_flag = '0'
<if test="groupPackageIds != null and !groupPackageIds.isEmpty()">
AND togpd.group_package_id IN

View File

@@ -15,20 +15,15 @@
WHERE wsr2.prescription_no = drf.prescription_no AND wsr2.delete_flag = '0'),
drf.name
) AS name,
drf.desc_json,
CASE
WHEN drf.desc_json::jsonb ->> 'targetDepartment' = '' AND MIN(wsr.org_id) IS NOT NULL THEN
(drf.desc_json::jsonb || jsonb_build_object('targetDepartment', MIN(wsr.org_id)::text))::text
ELSE drf.desc_json
END AS desc_json,
drf.requester_id,
drf.create_time,
ap.NAME AS patient_name,
CASE
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
drf.status
FROM doc_request_form AS drf
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
AND ae.delete_flag = '0'
@@ -45,6 +40,9 @@
<if test="endDate != null and endDate != ''">
AND drf.create_time &lt;= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
</if>
<if test="status != null and status != ''">
AND drf.status = #{status}::integer
</if>
<if test="keyword != null and keyword != ''">
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
OR EXISTS (
@@ -59,24 +57,12 @@
))
</if>
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
drf.requester_id, drf.create_time, ap.name
<if test="status != null and status != ''">
HAVING CASE MIN(wsr.status_enum)
WHEN 1 THEN 0
WHEN 2 THEN 1
WHEN 3 THEN 4
WHEN 4 THEN 4
WHEN 5 THEN 5
WHEN 6 THEN 5
WHEN 7 THEN 5
WHEN 8 THEN 6
ELSE NULL
END = #{status}::integer
</if>
drf.requester_id, drf.create_time, ap.name, drf.status
</select>
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
SELECT wsr.quantity,
SELECT wsr.activity_id AS activity_id,
wsr.quantity,
wsr.unit_code,
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
aci.total_price
@@ -148,9 +134,9 @@
fc.contract_name AS fee_type,
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifier_no
FROM doc_request_form drf
LEFT JOIN cli_surgery cs ON cs.surgery_no = drf.prescription_no AND cs.delete_flag = '0'
LEFT JOIN adm_patient ap ON ap.id = cs.patient_id AND ap.delete_flag = '0'
LEFT JOIN adm_encounter ae ON ae.id = cs.encounter_id AND ae.delete_flag = '0'
INNER JOIN cli_surgery cs ON cs.surgery_no = drf.prescription_no AND cs.delete_flag = '0'
INNER JOIN adm_patient ap ON ap.id = cs.patient_id AND ap.delete_flag = '0'
INNER JOIN adm_encounter ae ON ae.id = cs.encounter_id AND ae.delete_flag = '0'
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
LEFT JOIN op_schedule os ON os.apply_id = drf.id AND os.delete_flag = '0'
@@ -185,6 +171,8 @@
</if>
AND drf.delete_flag = '0'
AND os.schedule_id IS NULL
<!-- 已取消(4)、已完成(3)的手术申请不参与门诊手术安排查找 -->
AND cs.status_enum NOT IN (3, 4)
</where>
ORDER BY drf.create_time DESC
</select>

View File

@@ -39,7 +39,12 @@ public enum GenerateSource implements HisEnumInterface {
/**
* 自动滚费
*/
AUTO_ROLL_FEES(5, "5", "自动滚费");
AUTO_ROLL_FEES(5, "5", "自动滚费"),
/**
* 手术计费
*/
SURGERY_BILLING(6, "6", "手术计费");
private final Integer value;
private final String code;

View File

@@ -926,23 +926,36 @@ function handleDelete() {
}
if (hasSavedItem) {
// 有已保存的行调用后端API删除
savePrescription({ adviceSaveList: deleteList }).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
getListInfo(false);
}
// 🔧 Bug #454: 删除前弹出确认提示,告知用户将级联删除关联检验申请单
const hasLabItem = deleteList.some(item => item.adviceType === 3);
const confirmMsg = hasLabItem
? '删除此医嘱将同时删除关联的检验申请单,是否确认删除?'
: '确认删除选中的医嘱项目吗?';
proxy.$modal.confirm(confirmMsg).then(() => {
savePrescription({ adviceSaveList: deleteList }).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
getListInfo(false);
expandOrder.value = [];
groupIndexList.value = [];
groupList.value = [];
isAdding.value = false;
adviceQueryParams.value.adviceType = undefined;
}
});
}).catch(() => {
// 用户取消删除
});
} else {
// 只有新增行,已经在前端删除完成
proxy.$modal.msgSuccess('操作成功');
expandOrder.value = [];
groupIndexList.value = [];
groupList.value = [];
isAdding.value = false;
adviceQueryParams.value.adviceType = undefined;
}
expandOrder.value = [];
groupIndexList.value = [];
groupList.value = [];
isAdding.value = false;
adviceQueryParams.value.adviceType = undefined;
}
function handleNumberClick(item, index) {
@@ -1046,8 +1059,10 @@ function handleSave() {
chargeItemId: item.chargeItemId,
};
});
// 确保 organizationId 不为 undefined手术计费场景下可能缺失 orgId
const orgId = props.patientInfo.orgId || props.patientInfo.effectiveOrgId || 1;
savePrescriptionSign({
organizationId: props.patientInfo.orgId,
organizationId: orgId,
adviceSaveList: list,
}).then((res) => {
if (res.code === 200) {
@@ -1064,6 +1079,7 @@ function handleSave() {
}
}).catch((error) => {
console.error('签发失败:', error);
console.warn('签发操作失败(可能无权限或后端异常):', error?.response?.data?.msg || error?.message);
proxy.$modal.msgError(error?.response?.data?.msg || error?.message || '签发失败,请重试');
});
}

View File

@@ -1025,7 +1025,11 @@ function parseBirthDate(birthDate) {
function normalizeDate(value) {
if (!value) return '';
return String(value).split(/[T ]/)[0];
const datePart = String(value).split(/[T ]/)[0].replace(/\//g, '-');
const parts = datePart.split('-');
if (parts.length !== 3) return datePart;
const [year, month, day] = parts;
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;
}
function normalizeSex(value) {
@@ -1116,7 +1120,7 @@ function showReport(reportData = {}, readOnly = true) {
addressHouse: reportData.addressHouse || '',
patientBelong: reportData.patientBelong || 1,
occupation: reportData.occupation || '',
caseClass: reportData.diseaseType != null ? String(reportData.diseaseType) : '',
caseClass: reportData.caseClass != null ? String(reportData.caseClass) : '',
onsetDate: normalizeDate(reportData.onsetDate),
diagDate: normalizeDate(reportData.diagDate),
deathDate: normalizeDate(reportData.deathDate),
@@ -1125,7 +1129,7 @@ function showReport(reportData = {}, readOnly = true) {
selectedClassB: diseaseSelection.selectedClassB,
selectedClassC: diseaseSelection.selectedClassC,
otherDisease: reportData.otherDisease || (diseaseCode === 'OTHER' ? reportData.diseaseName || '' : ''),
diseaseType: reportData.diseaseSubtype || '',
diseaseType: reportData.diseaseSubtype || reportData.diseaseType || '',
reportOrg: reportData.reportOrg || '',
reportOrgPhone: reportData.reportOrgPhone || '',
reportDoc: reportData.reportDoc || '',
@@ -1466,7 +1470,7 @@ async function buildSubmitData() {
reportDate: formData.reportDate || null,
cardNameCode: 1, // 默认中华人民共和国传染病报告卡
registrationSource: 1, // 默认门诊
status: '',
status: null,
deptId: props.deptId || null,
doctorId: props.doctorId || null,
};

View File

@@ -1250,7 +1250,8 @@ function handleRowClick(row) {
expanded: false,
packageDetailsLoading: false,
isPackage: false,
packageId: null
packageId: null,
hasChildren: false // #426修复: 树形表格懒加载展开标记后续根据packageId动态设置
};
// 加载该项目的检查方法
if (m.bodyPartCode) {
@@ -1278,6 +1279,7 @@ function handleRowClick(row) {
if (item.selectedMethod?.packageId) {
item.isPackage = true;
item.packageId = item.selectedMethod.packageId;
item.hasChildren = true; // #426修复
}
}
if (!item.selectedMethod && item.methods.length) {
@@ -1286,6 +1288,7 @@ function handleRowClick(row) {
if (item.selectedMethod?.packageId) {
item.packageId = item.selectedMethod.packageId;
item.isPackage = true;
item.hasChildren = true; // #426修复
}
}
} catch (err) {
@@ -1361,10 +1364,10 @@ async function handleMethodSelect(checked, method, cat) {
if (method.packageId) {
existingItem.isPackage = true;
existingItem.packageId = method.packageId;
existingItem.hasChildren = true; // #426修复
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
// 预加载套餐明细
await loadPackageDetailsForItem(existingItem);
loadPackageDetailsForItem(existingItem);
}
updateMethodDisplay();
return;
@@ -1396,14 +1399,14 @@ async function handleMethodSelect(checked, method, cat) {
// 从方法或项目中获取套餐信息
isPackage: !!method.packageId || !!targetItem.packageName,
packageId: method.packageId || targetItem.packageId || null,
packageName: method.packageName || targetItem.packageName || null // #428修复: 复制 packageName确保套餐明细可加载
packageName: method.packageName || targetItem.packageName || null, // #428修复: 复制 packageName确保套餐明细可加载
hasChildren: !!(method.packageId || targetItem.packageId) // #426修复: 树形表格懒加载展开标记
};
selectedItems.value.push(newItem);
// 如果是套餐,预加载套餐明细并默认展开
// 如果是套餐,预加载套餐明细
if (newItem.isPackage && newItem.packageId) {
newItem.expanded = true;
await loadPackageDetailsForItem(newItem);
loadPackageDetailsForItem(newItem);
}
// 自动回填执行科室
@@ -1485,7 +1488,8 @@ async function handleItemSelect(checked, item, cat) {
isPackage: !!(item.packageId || item.packageName),
packageName: item.packageName || null,
packageDetailsLoading: false,
packageId: item.packageId || null
packageId: item.packageId || null,
hasChildren: !!(item.packageId) // #426修复: 树形表格懒加载展开标记
};
selectedItems.value.push(newRow);
// 必须用数组里的响应式行,不能继续改局部 newRowpush 后列表内是 proxy改 raw 对象不会触发右侧卡片更新(会一直卡在「加载中」)
@@ -1525,10 +1529,7 @@ async function handleItemSelect(checked, item, cat) {
// Bug #384修复 + #426修复: 展开/收起项目卡片
async function toggleItemExpand(item) {
item.expanded = !item.expanded;
const carrier = getPackageCarrier(item);
const hasDetails = Array.isArray(item.packageDetailsDisplay) && item.packageDetailsDisplay.length > 0
|| Array.isArray(carrier?.packageDetails) && carrier.packageDetails.length > 0;
if (item.expanded && (item.isPackage || item.packageName) && !hasDetails && !item.packageDetailsLoading) {
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) {
await loadPackageDetailsForItem(item);
}
if (item.expanded && shouldShowPackageBody(item)) {
@@ -1582,7 +1583,7 @@ async function loadMethodPackageDetails(item, method) {
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/check-type/package/${packageId}/details`,
url: `/system/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {
@@ -1610,6 +1611,7 @@ async function onDetailMethodChange(row, val) {
if (val?.packageId) {
row.packageId = val.packageId;
row.isPackage = true;
row.hasChildren = true; // #426修复
}
row.packageDetailsDisplay = undefined;
const carrier = getPackageCarrier(row);

View File

@@ -564,22 +564,74 @@ function handleRemoveItem(index) {
editingGroup.value.detailList.splice(index, 1);
}
// 单击应用按钮
function handleUseOrderGroup(row) {
// 单击应用按钮(应用组套)
async function handleUseOrderGroup(row) {
if (!row.detailList || row.detailList.length === 0) {
ElMessage.warning('该组套没有明细项');
return;
}
// 🔧 Bug 修复:组套保存时未持久化 orderDetailInfos导致应用时缺失医嘱库信息。
// 通过 API 批量查询补全,确保 setValue 能获取到 adviceType、inventoryList、priceList 等关键字段。
const itemsMissingDetail = row.detailList.filter(
item => !item.orderDetailInfos || Object.keys(item.orderDetailInfos).length === 0
);
const detailMap = {};
if (itemsMissingDetail.length > 0) {
const ids = itemsMissingDetail
.map(item => item.orderDefinitionId)
.filter(Boolean)
.join(',');
if (ids) {
try {
const res = await getAdviceBaseInfo({
adviceDefinitionIdParamList: ids,
organizationId: props.organizationId,
});
const records = res.data?.records || res.rows || [];
records.forEach(rec => {
if (rec.adviceDefinitionId) {
detailMap[rec.adviceDefinitionId] = rec;
}
});
} catch (e) {
// 批量查询失败,使用原始 orderDetailInfos
}
}
}
// 🔧 辅助函数:根据字典 code 查找对应的 dictText
const findDictText = (dictList, code) => {
if (!code || !dictList?.value?.length) return '';
const found = dictList.value.find(d => d.value === code);
return found?.label || '';
};
// 🔧 数据预处理:确保每个明细项都有完整的医嘱信息
const processedDetailList = row.detailList.map(item => {
const orderDetail = item.orderDetailInfos || {};
// 优先使用组套中已带的 orderDetailInfos否则使用 API 查询结果
const orderDetail = (item.orderDetailInfos && Object.keys(item.orderDetailInfos).length > 0)
? item.orderDetailInfos
: (detailMap[item.orderDefinitionId] || {});
// 🔧 修复:组套明细只存了 methodCode/rateCode没有 dictText。
// 用字典查找补充 dictText确保界面显示正确的用法/频次名称。
const resolvedMethodCode = item.methodCode ?? orderDetail.methodCode;
const resolvedRateCode = item.rateCode ?? orderDetail.rateCode;
const methodCodeDictText = item.methodCode_dictText
|| findDictText(method_code, resolvedMethodCode)
|| orderDetail.methodCode_dictText
|| '';
const rateCodeDictText = item.rateCode_dictText
|| findDictText(rate_code, resolvedRateCode)
|| orderDetail.rateCode_dictText
|| '';
return {
// 组套明细字段
...item,
// 医嘱库字段(可能为空,需要兜底)
// 医嘱库字段
adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目',
adviceType: orderDetail.adviceType,
adviceDefinitionId: item.orderDefinitionId || orderDetail.adviceDefinitionId,
@@ -592,7 +644,6 @@ function handleUseOrderGroup(row) {
partPercent: orderDetail.partPercent ?? 1,
partAttributeEnum: orderDetail.partAttributeEnum,
unitConversionRatio: orderDetail.unitConversionRatio,
// 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId
positionId: item.positionId ?? orderDetail.positionId,
defaultLotNumber: orderDetail.defaultLotNumber,
@@ -602,6 +653,20 @@ function handleUseOrderGroup(row) {
unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText,
minUnitCode: orderDetail.minUnitCode,
doseUnitCode: orderDetail.doseUnitCode,
doseUnitCode_dictText: orderDetail.doseUnitCode_dictText || '',
// 药房/科室名称setValue 通过库存查找设置,但需确保 orderDetail 中有)
positionName: orderDetail.positionName || '',
// 注射/皮试标识(表格列显示依赖这些字段)
injectFlag: orderDetail.injectFlag,
injectFlag_enumText: orderDetail.injectFlag_enumText || '',
skinTestFlag: orderDetail.skinTestFlag,
skinTestFlag_enumText: orderDetail.skinTestFlag_enumText || '',
// 字典文本(传递到 item 层级,避免后续代码依赖 mergedDetail 再查一次)
methodCode_dictText: methodCodeDictText,
rateCode_dictText: rateCodeDictText,
// 合并后的完整对象(用于 setValue
// 先展开 orderDetail 获取所有药品基础字段categoryCode、minUnitCode、doseUnitCode、
@@ -616,19 +681,19 @@ function handleUseOrderGroup(row) {
categoryCode: item.categoryCode ?? orderDetail.categoryCode,
unitCodeName: item.unitCodeName,
dose: item.dose ?? orderDetail.dose,
rateCode: item.rateCode ?? orderDetail.rateCode,
methodCode: item.methodCode ?? orderDetail.methodCode,
rateCode: resolvedRateCode,
rateCode_dictText: rateCodeDictText,
methodCode: resolvedMethodCode,
methodCode_dictText: methodCodeDictText,
dispensePerDuration: item.dispensePerDuration ?? orderDetail.dispensePerDuration,
doseQuantity: item.doseQuantity ?? orderDetail.doseQuantity,
// 🔧 Bug #218 / #403 修复positionId 可能存储在 item 本身,优先使用 item.positionId
positionId: item.positionId ?? orderDetail.positionId,
// 执行科室:优先使用组套明细中保存的 orgId
orgId: item.orgId ?? orderDetail.orgId,
orgName: item.orgName ?? orderDetail.orgName,
// 组号(保留组套中的分组信息)
groupId: item.groupId,
groupOrder: item.groupOrder,
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '1',
// 🔧 类型默认为临时医嘱2=临时1=长期)
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '2',
}
};
});
@@ -645,9 +710,9 @@ function handlePreviewGroup(row) {
}
// 确认应用组套(从预览对话框)
function confirmUseGroup() {
async function confirmUseGroup() {
if (currentGroup.value) {
handleUseOrderGroup(currentGroup.value);
await handleUseOrderGroup(currentGroup.value);
previewVisible.value = false;
}
}

View File

@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
return found.label;
}
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
if (type === 6) return '手术';
if (type === 4) return '手术';
@@ -1036,15 +1036,6 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
return '诊疗';
}
// 🔧 Bug #458 Fix: 兜底映射,确保所有有效 adviceType 都有显示标签
// 不依赖字典数据和表名,直接返回标准类型名称
if (type === 3) return '诊疗';
if (type === 6) return '手术';
if (type === 4) return '耗材';
if (type === 1) return '西药';
if (type === 2) return '中成药';
if (type === 5) return '会诊';
return '';
};
@@ -1672,11 +1663,7 @@ function getListInfo(addNewRow) {
// 检查 adviceTableName如果是耗材表则应该是耗材类型
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText需重新计算
const backendDictText = item.adviceType_dictText;
let adviceType_dictText = (backendDictText && backendDictText.trim())
? backendDictText
: mapAdviceTypeLabel(adviceType, adviceTableName);
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
// 如果是会诊类型,设置为会诊类型
if (isConsultation) {
@@ -3675,6 +3662,13 @@ function handleSaveGroup(orderGroupList) {
defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
};
// 🔧 Bug 修复:字典查找兜底,防止 mergedDetail 中 dictText 为空
const findDictText = (dictList, code) => {
if (!code || !dictList?.length) return '';
const found = dictList.find(d => d.value === code);
return found?.label || '';
};
// 在 setValue 之前预初始化空行
prescriptionList.value[rowIndex.value] = {
uniqueKey: nextId.value++,
@@ -3685,43 +3679,105 @@ function handleSaveGroup(orderGroupList) {
// 使用医嘱项目详情设置值
setValue(mergedDetail);
// 🔧 Bug 修复:使用 mergedDetail 优先,避免 item 中 undefined 覆盖 setValue 中已设置的字段
const resolvedQuantity = mergedDetail.quantity ?? item.quantity ?? 1;
const resolvedDose = mergedDetail.dose ?? item.dose;
const resolvedMethodCode = mergedDetail.methodCode ?? item.methodCode;
const resolvedRateCode = mergedDetail.rateCode ?? item.rateCode;
const resolvedUnitCode = mergedDetail.unitCode ?? item.unitCode;
// 🔧 Bug 修复setValue 可能因库存不足提前 return导致 unitPrice/minUnitPrice 等字段未设置。
// 从 mergedDetail 或 item 中获取兜底值,避免价格计算产生 NaN。
const safePrice = (val) => {
const n = Number(val);
return (n !== undefined && n !== null && !isNaN(n) && isFinite(n)) ? n : 0;
};
const resolvedUnitPrice = safePrice(
prescriptionList.value[rowIndex.value]?.unitPrice
?? mergedDetail.unitPrice
?? item.unitPrice
?? 0
);
const resolvedMinUnitPrice = safePrice(
prescriptionList.value[rowIndex.value]?.minUnitPrice
?? mergedDetail.minUnitPrice
?? item.minUnitPrice
?? 0
);
const resolvedPartPercent = safePrice(
item.orderDetailInfos?.partPercent
?? mergedDetail.partPercent
?? 1
);
// 创建新的处方项目
const newRow = {
...prescriptionList.value[rowIndex.value],
patientId: props.patientInfo.patientId,
encounterId: props.patientInfo.encounterId,
accountId: accountId.value,
quantity: item.quantity,
methodCode: item.methodCode,
rateCode: item.rateCode,
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
quantity: resolvedQuantity,
methodCode: resolvedMethodCode,
methodCode_dictText: mergedDetail.methodCode_dictText
|| findDictText(method_code.value, resolvedMethodCode)
|| '',
rateCode: resolvedRateCode,
rateCode_dictText: mergedDetail.rateCode_dictText
|| findDictText(rate_code.value, resolvedRateCode)
|| '',
dispensePerDuration: mergedDetail.dispensePerDuration ?? item.dispensePerDuration,
dose: resolvedDose,
doseQuantity: mergedDetail.doseQuantity ?? item.doseQuantity,
executeNum: 1,
unitCode: item.unitCode,
unitCode_dictText: item.unitCodeName || '',
unitCode: resolvedUnitCode,
unitCode_dictText: item.unitCodeName
|| mergedDetail.unitCodeName
|| findDictText(unit_code.value, resolvedUnitCode)
|| '',
doseUnitCode: mergedDetail.doseUnitCode,
doseUnitCode_dictText: mergedDetail.doseUnitCode_dictText || '',
// 🔧 确保 price/adviceType 字段有安全默认值(避免 NaN 导致模板条件判断失效)
unitPrice: resolvedUnitPrice,
minUnitPrice: resolvedMinUnitPrice,
unitTempPrice: resolvedUnitPrice,
adviceType: prescriptionList.value[rowIndex.value]?.adviceType
|| Number(mergedDetail.adviceType)
|| Number(item.adviceType)
|| 0,
adviceType_dictText: prescriptionList.value[rowIndex.value]?.adviceType_dictText
|| mergedDetail.adviceType_dictText
|| item.adviceType_dictText
|| '',
statusEnum: 1,
// 🔧 类型组套应用默认为临时医嘱2=临时1=长期)
therapyEnum: mergedDetail.therapyEnum ?? item.therapyEnum ?? '2',
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
// 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室不使用目录配置的ID
orgId: item.adviceType === 3
? props.patientInfo?.orgId
: (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId),
positionName: prescriptionList.value[rowIndex.value]?.positionName
|| mergedDetail.orgName
|| mergedDetail.positionName
|| findOrgNameById(mergedDetail.orgId || props.patientInfo?.orgId)
|| '',
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value,
diagnosisName: diagnosisName.value,
};
// 计算价格和总量
const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode);
// 计算价格和总量(使用安全值)
const unitInfo = unitCodeList.value.find((k) => k.value == resolvedUnitCode);
if (unitInfo && unitInfo.type == 'minUnit') {
newRow.price = newRow.minUnitPrice;
newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity;
newRow.price = resolvedMinUnitPrice;
newRow.totalPrice = (resolvedQuantity * resolvedMinUnitPrice).toFixed(6);
newRow.minUnitQuantity = resolvedQuantity;
} else {
newRow.price = newRow.unitPrice;
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
newRow.price = resolvedUnitPrice;
newRow.totalPrice = (resolvedQuantity * resolvedUnitPrice).toFixed(6);
newRow.minUnitQuantity = resolvedQuantity * resolvedPartPercent;
}
newRow.contentJson = JSON.stringify(newRow);

View File

@@ -636,11 +636,12 @@ function getList() {
if (res.code === 200) {
surgeryList.value = res.data?.records || []
} else {
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
surgeryList.value = []
}
}).catch(error => {
console.warn('手术列表请求异常:', error)
console.error('获取手术列表失败:', error)
proxy.$modal.msgError('数据加载失败,请稍后重试')
surgeryList.value = []
}).finally(() => {
loading.value = false
@@ -1141,8 +1142,8 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
emit('saved')
getList() // 提交成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
} else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
}
@@ -1158,8 +1159,8 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
// 由父组件 @saved 事件负责刷新列表
emit('saved')
getList() // 修改成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
} else {
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
}

View File

@@ -153,7 +153,7 @@
</el-tab-pane>
<el-tab-pane label="手术申请" name="surgery">
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
</el-tab-pane>
<el-tab-pane label="电子处方" name="eprescription">
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />

View File

@@ -93,7 +93,6 @@
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="160" />
<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">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round>
@@ -101,6 +100,7 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" width="280" align="center" fixed="right">
<template #default="scope">
<!-- 详情 - 所有状态都显示 -->
@@ -220,6 +220,7 @@
:is-edit-mode="true"
:edit-data="editingRow"
:external-patient-info="patientInfo"
@submit-ok="handleEditSuccess"
/>
<template #footer>
<el-button @click="editDialogVisible = false">取消</el-button>
@@ -967,12 +968,17 @@ const handleEdit = (row) => {
// 编辑弹窗确认提交
const handleEditSubmit = () => {
// 调用MedicalExaminations组件的submit方法
if (editFormRef.value?.submit) {
editFormRef.value.submit();
}
};
// 编辑保存成功回调:关闭弹窗并刷新列表
const handleEditSuccess = () => {
editDialogVisible.value = false;
fetchData();
};
watch(
() => patientInfo.value?.encounterId,
(val) => {

View File

@@ -41,8 +41,8 @@
<el-option label="全部" value="" />
<el-option label="待签发" value="0" />
<el-option label="已签发" value="1" />
<el-option label="报告已出" value="4" />
<el-option label="已作废" value="5" />
<el-option label="已出报告" value="6" />
<el-option label="已作废" value="7" />
</el-select>
</el-form-item>
<el-form-item label="关键字">
@@ -105,15 +105,18 @@
</template>
</el-table-column>
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" align="center" fixed="right" width="160">
<el-table-column label="操作" align="center" fixed="right" width="180">
<template #default="scope">
<!-- 待签发可修改删除 -->
<template v-if="scope.row.status == 0">
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
<!-- 已签发可撤回 -->
<template v-else-if="scope.row.status == 1">
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
</template>
<!-- 已校对(2)待接收(3)已接收(4)已检查(6)已作废(7)仅查看详情 -->
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
@@ -328,8 +331,11 @@ const parseBillStatus = (status) => {
const statusMap = {
'0': '待签发',
'1': '已签发',
'4': '报告已出',
'5': '已作废',
'2': '已校对',
'3': '待接收',
'4': '已收样',
'6': '已出报告',
'7': '已作废',
};
return statusMap[String(status)] || '-';
};

View File

@@ -289,62 +289,43 @@ function getList() {
return obj;
});
form.value.diagnosisList = datas;
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
deduplicateDiagnosisList();
// form.value.diagnosisList = res.data;
emits('diagnosisSave', false);
}
});
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data?.illness));
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data.illness));
if (res.code == 200 && res.data?.illness?.length > 0) {
diagnosisNetDatas.value = res.data.illness;
res.data.illness.forEach((item, index) => {
newList.push({
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
diagnosisTime: new Date().toLocaleString('zh-CN')
if (res.code == 200) {
if (res.data.illness.length > 0) {
diagnosisNetDatas.value = res.data.illness;
res.data.illness.forEach((item, index) => {
newList.push({
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
ybNo: item.ybNo,
medTypeCode: item.medTypeCode,
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
diagnosisTime: new Date().toLocaleString('zh-CN')
});
});
});
// 将新数据添加到现有列表中
form.value.diagnosisList.push(...newList);
// 将新数据添加到现有列表中
form.value.diagnosisList.push(...newList);
// 重新排序整个列表
form.value.diagnosisList.sort((a, b) => {
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
return aNo - bNo;
});
// TCM 数据添加后也去重
deduplicateDiagnosisList();
// 重新排序整个列表
form.value.diagnosisList.sort((a, b) => {
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
return aNo - bNo;
});
}
emits('diagnosisSave', false);
}
emits('diagnosisSave', false);
});
getTree();
}
/**
* 诊断列表去重:按 ybNo + name 组合去重,保留第一条记录
* 防止后端 saveOrUpdate 在删除后误 INSERT 导致重复
*/
function deduplicateDiagnosisList() {
const seen = new Set();
const dedupedList = [];
for (const item of form.value.diagnosisList) {
// 使用 ybNo 和 name 组合作为唯一标识(中医诊断没有 ybNo用 name 去重)
const key = item.ybNo ? `${item.ybNo}` : `name_${item.name}`;
if (!seen.has(key)) {
seen.add(key);
dedupedList.push(item);
}
}
form.value.diagnosisList = dedupedList;
}
init();
function init() {
diagnosisInit().then((res) => {
@@ -622,18 +603,6 @@ function handleSaveDiagnosis() {
return aNo - bNo;
});
// 步骤1.5:确保每条诊断都有诊断医生和诊断时间(元数据补全)
const doctorName = props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name;
const now = new Date().toLocaleString('zh-CN');
sortedList.forEach((item) => {
if (!item.diagnosisDoctor) {
item.diagnosisDoctor = doctorName;
}
if (!item.diagnosisTime) {
item.diagnosisTime = now;
}
});
// 步骤2重新分配连续的序号从1开始
sortedList.forEach((item, index) => {
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序

View File

@@ -1,6 +1,24 @@
import request from '@/utils/request';
// 申请单相关接口
// 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存等无关逻辑)
export function getSurgeryPage(params) {
return request({
url: '/doctor-station/advice/surgery-page',
method: 'get',
params: params,
});
}
// 检查项目专用分页查询(仅检查(23) + 定价,绕过 AOP 校验提升加载速度)
export function getExaminationPage(params) {
return request({
url: '/doctor-station/advice/examination-page',
method: 'get',
params: params,
});
}
//医嘱大下拉
export function getApplicationList(queryParams) {
return request({

View File

@@ -206,7 +206,7 @@ import dayjs from 'dayjs';
import {patientInfo} from '../../../store/patient.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveCheckd} from './api';
import {getExaminationPage, saveCheckd} from './api';
import {ElMessage, ElMessageBox} from 'element-plus';
import {WarningFilled, Warning, Refresh, Files, Document, EditPen, Aim, DocumentCopy} from '@element-plus/icons-vue';
@@ -266,27 +266,23 @@ const isSevereAllergy = computed(() => {
});
const getList = () => {
console.log('getList called, effectivePatientInfo:', effectivePatientInfo.value);
if (!effectivePatientInfo.value?.inHospitalOrgId) {
console.log('inHospitalOrgId is missing, setting empty list');
applicationList.value = [];
return;
}
loading.value = true;
getApplicationList({
pageSize: 500,
pageNum: 1,
categoryCode: '23',
getExaminationPage({
organizationId: effectivePatientInfo.value.inHospitalOrgId,
adviceTypes: [3],
pageNo: 1,
pageSize: 5000,
searchKey: '',
})
.then((res) => {
if (res.code === 200) {
if (res.code === 200 && res.data?.records) {
applicationListAll.value = res.data.records;
applicationList.value = res.data.records.map((item) => {
const priceInfo = item.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = item.unitCode_dictText || item.unitCode || '';
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
const unit = item.unitCodeDictText || item.unitCode || '';
return {
adviceDefinitionId: item.adviceDefinitionId,
orgId: item.orgId,
@@ -299,7 +295,6 @@ const getList = () => {
nextTick(() => {
// 使用 adviceName 匹配
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
console.log('getList completed, selectedNames:', selectedNames);
const selectedIds = [];
applicationList.value?.forEach(app => {
// 匹配时去掉价格部分,只比较名称
@@ -308,7 +303,6 @@ const getList = () => {
selectedIds.push(app.key);
}
});
console.log('getList completed, matched selectedIds:', selectedIds);
transferValue.value = selectedIds;
});
}
@@ -404,13 +398,11 @@ const loadPatientAllergyHistory = () => {
if (!effectivePatientInfo.value?.patientId) return;
};
// 加载编辑数据
// 加载编辑数据 — 只负责解析 descJson 填充表单字段
// 已选项目的匹配由 getList 数据加载完成后统一处理
const loadEditData = () => {
if (!props.isEditMode || !props.editData?.requestFormId) return;
console.log('loadEditData called, editData:', props.editData);
// 解析已有的descJson填充表单
if (props.editData.descJson) {
try {
const obj = JSON.parse(props.editData.descJson);
@@ -431,91 +423,16 @@ const loadEditData = () => {
console.error('解析descJson失败:', e);
}
}
// 设置已选项目从requestFormDetailList获取
// 注意:后端返回的字段是 adviceName不是 adviceDefinitionId
console.log('requestFormDetailList:', props.editData.requestFormDetailList);
if (props.editData.requestFormDetailList && props.editData.requestFormDetailList.length) {
// 使用 adviceName 匹配
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
console.log('setting transferValue by adviceName to:', selectedNames);
// 通过名称匹配找到对应的 key
const selectedIds = [];
applicationList.value?.forEach(app => {
if (selectedNames.includes(app.label?.split(' (')[0])) {
selectedIds.push(app.key);
}
});
console.log('matched selectedIds:', selectedIds);
transferValue.value = selectedIds;
} else {
console.log('requestFormDetailList is empty or undefined');
}
};
const projectWithDepartment = (selectProjectIds, type) => {
let isRelease = true;
const arr = [];
// 确保 applicationList 存在
if (!applicationList.value || !Array.isArray(applicationList.value)) {
return true;
}
selectProjectIds.forEach((element) => {
const searchData = applicationList.value.find((item) => {
return element == item.adviceDefinitionId;
});
arr.push(searchData);
});
// 只有当选择了项目arr 非空)时才设置 targetDepartment
if (arr.length > 0) {
const obj = arr[0];
// 检查是否有未定义的项目applicationList 中找不到)
if (!obj) {
console.warn('未找到项目定义,无法设置执行科室');
return false;
}
const isCompare = arr.every((item) => item && item.orgId == obj.orgId);
if (!isCompare) {
ElMessage({ type: 'error', message: '执行科室不同' });
isRelease = false;
}
const findItem = findTreeItem(orgOptions.value, obj.orgId);
if (!findItem) {
isRelease = false;
ElMessage({ type: 'error', message: '未找到项目执行的科室' });
}
if (type == 1 && isRelease) {
form.targetDepartment = findItem.id;
console.log('targetDepartment 设置为:', form.targetDepartment, '科室名称:', findItem.name);
}
} else {
// 清空选择时,也要清空 targetDepartment
const projectWithDepartment = (selectProjectIds) => {
if (!selectProjectIds || selectProjectIds.length === 0) {
form.targetDepartment = '';
}
return isRelease;
};
watch(() => transferValue.value, (newValue) => {
console.log('transferValue changed:', newValue);
console.log('applicationList length:', applicationList.value?.length);
projectWithDepartment(newValue, 1);
});
// 监听 applicationList 加载完成,重新设置已选项目
watch(() => applicationList.value, (newList) => {
if (newList && newList.length > 0 && props.isEditMode && props.editData?.requestFormDetailList?.length) {
console.log('applicationList loaded, re-setting transferValue');
// 使用 adviceName 匹配
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
const selectedIds = [];
newList.forEach(app => {
const appName = app.label?.split(' (')[0];
if (selectedNames.includes(appName)) {
selectedIds.push(app.key);
}
});
transferValue.value = selectedIds;
}
projectWithDepartment(newValue);
});
const getPriorityCode = () => {
@@ -526,8 +443,8 @@ const submit = () => {
if (transferValue.value.length == 0) {
return proxy.$message.error('请选择检查项目');
}
if (!projectWithDepartment(transferValue.value, 2)) {
return;
if (!form.targetDepartment) {
return proxy.$message.error('请选择发往科室');
}
if (!form.examinationPurpose) {
return ElMessageBox.alert('请输入检查目的', '提示', { confirmButtonText: '确定', type: 'warning' });
@@ -542,21 +459,25 @@ const submit = () => {
let applicationListAllFilter = applicationListAll.value.filter((item) => {
return transferValue.value.includes(item.adviceDefinitionId);
});
// 从原始记录中提取检查项目名称,用于申请单名称字段
const selectedNames = applicationListAllFilter.map(item => item.adviceName).join('+');
applicationListAllFilter = applicationListAllFilter.map((item) => {
// 新接口 getExaminationPage 返回扁平字段price/unitCode兼容旧接口 priceList[0]
const priceInfo = item.priceList?.[0] || {};
return {
adviceDefinitionId: item.adviceDefinitionId,
adviceName: item.adviceName,
quantity: 1,
unitCode: item.priceList[0].unitCode,
unitPrice: item.priceList[0].price,
totalPrice: item.priceList[0].price,
unitCode: item.unitCode || priceInfo.unitCode || '',
unitPrice: item.price ?? priceInfo.price ?? 0,
totalPrice: item.price ?? priceInfo.price ?? 0,
positionId: item.positionId,
ybClassEnum: item.ybClassEnum,
conditionId: item.conditionId,
encounterDiagnosisId: item.encounterDiagnosisId,
adviceType: item.adviceType,
definitionId: item.priceList[0].definitionId,
definitionDetailId: item.priceList[0].definitionDetailId,
definitionId: item.chargeItemDefinitionId || priceInfo.definitionId || '',
definitionDetailId: item.definitionDetailId || priceInfo.definitionDetailId || '',
accountId: effectivePatientInfo.value.accountId,
};
});
@@ -573,7 +494,7 @@ const submit = () => {
encounterId: effectivePatientInfo.value.encounterId,
organizationId: effectivePatientInfo.value.inHospitalOrgId,
requestFormId: requestFormId,
name: applicationListAllFilter.map(item => item.adviceName).join('、'),
name: selectedNames,
descJson: JSON.stringify(submitForm),
categoryEnum: '22',
}).then((res) => {

View File

@@ -5,13 +5,27 @@
-->
<template>
<div class="surgery-container">
<div v-loading="loading" class="transfer-wrapper" style="min-height: 300px;">
<div class="transfer-wrapper" style="min-height: 300px;">
<!-- 搜索框3字触发后端搜索 -->
<div style="padding: 6px 0;">
<el-input
v-model="searchKey"
placeholder="请输入3个字及以上搜索"
clearable
@input="onSearchInput"
style="width: 320px;"
/>
</div>
<!-- 加载提示不阻塞穿梭框操作 -->
<div v-if="loading" style="padding:8px 0; color:#909399; font-size:13px;">
<el-icon class="is-loading"><Loading /></el-icon> 手术项目加载中...
</div>
<el-transfer
ref="transferRef"
v-model="transferValue"
:data="applicationList"
filter-placeholder="项目代码/名称"
filterable
:titles="['未选择', '已选择']"
:titles="['待选择', '已选择']"
:format="leftPanelFormat"
/>
</div>
<div class="bloodTransfusion-form">
@@ -78,17 +92,26 @@
</div>
</template>
<script setup name="Surgery">
import {getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
import {computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
import {patientInfo} from '../../../store/patient.js';
import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveSurgery} from './api';
import {getSurgeryPage, saveSurgery} from './api';
import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance();
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
let surgeryRecordsCache = null; // 原始 API 记录
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
let searchDebounceTimer = null; // 搜索防抖
const transferRef = ref(null);
const dbTotal = ref(0); // 数据库中的手术项目总数
const searchKey = ref(''); // 搜索关键字
const checkedCount = computed(() => transferValue.value.length);
const leftPanelFormat = computed(() => ({
noChecked: ` 0/${dbTotal.value}`,
hasChecked: ` \${checked}/${dbTotal.value}`,
}));
// 递归查找树形科室节点
const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null;
@@ -105,58 +128,88 @@ const emits = defineEmits(['submitOk']);
const props = defineProps({});
const state = reactive({});
const applicationListAll = ref();
const applicationList = ref();
const applicationList = ref([]);
const orgOptions = ref([]); // 科室选项
const loading = ref(false); // 加载状态
const mapToTransferItem = (item) => {
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
const unit = item.unitCodeDictText || item.unitCode || '';
return {
adviceDefinitionId: item.adviceDefinitionId,
orgId: item.orgId,
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
key: item.adviceDefinitionId,
};
};
const getList = () => {
if (!patientInfo.value?.inHospitalOrgId) {
applicationList.value = [];
return;
}
// 命中缓存时直接使用,避免重复请求导致加载缓慢
// 命中内存缓存时直接使用
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
applicationList.value = surgeryMappedCache;
applicationListAll.value = surgeryRecordsCache;
loading.value = false;
return;
}
loadPage('');
};
/**
* 加载手术项目分页数据
* @param {string} key 搜索关键字(可选)
*/
const loadPage = (key) => {
const orgId = patientInfo.value.inHospitalOrgId;
loading.value = true;
getApplicationList({
pageSize: 500,
pageNum: 1,
categoryCode: '24',
organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3, 6], //1 药品 2耗材 3诊疗 6手术
})
getSurgeryPage({ organizationId: orgId, pageNo: 1, pageSize: 100, searchKey: key || '' })
.then((res) => {
if (res.code === 200) {
applicationListAll.value = res.data.records;
applicationList.value = res.data.records.map((item) => {
const priceInfo = item.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = item.unitCode_dictText || item.unitCode || '';
return {
adviceDefinitionId: item.adviceDefinitionId,
orgId: item.orgId,
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
key: item.adviceDefinitionId,
};
});
// 写入模块缓存,后续打开弹窗直接复用
surgeryRecordsCache = res.data.records;
surgeryMappedCache = applicationList.value;
} else {
console.warn('获取手术项目列表失败:', res.message);
if (res.code !== 200 || !res.data?.records) {
applicationList.value = [];
dbTotal.value = 0;
loading.value = false;
return;
}
dbTotal.value = res.data.total || 0;
const records = res.data.records;
applicationListAll.value = records;
applicationList.value = records
.filter(item => item.adviceDefinitionId != null)
.map(mapToTransferItem);
// 仅在无搜索时缓存
if (!key) {
surgeryRecordsCache = records;
surgeryMappedCache = applicationList.value;
}
loading.value = false;
})
.catch((e) => {
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e);
console.error('手术项目加载失败:', e);
applicationList.value = [];
})
.finally(() => {
dbTotal.value = 0;
loading.value = false;
});
};
/**
* 搜索输入框变化处理防抖300ms≥3字触发后端搜索
*/
const onSearchInput = () => {
clearTimeout(searchDebounceTimer);
const val = searchKey.value.trim();
if (!val) {
// 清空搜索框,恢复初始数据
loadPage('');
return;
}
if (val.length >= 3) {
searchDebounceTimer = setTimeout(() => {
loadPage(val);
}, 300);
}
};
const transferValue = ref([]);
const form = reactive({
// categoryType: '', // 项目类别
@@ -243,20 +296,15 @@ const submit = () => {
});
applicationListAllFilter = applicationListAllFilter.map((item) => {
return {
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */,
adviceDefinitionName: item.adviceDefinitionName /** 诊疗定义名称(手术项目名称) */,
quantity: 1, // /** 请求数量 */
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
unitPrice: item.priceList[0].price /** 单价 */,
totalPrice: item.priceList[0].price /** 总价 */,
positionId: item.positionId, //执行科室id
ybClassEnum: item.ybClassEnum, //类别医保编码
conditionId: item.conditionId, //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
adviceType: item.adviceType, ///** 医嘱类型 */
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
accountId: patientInfo.value.accountId, // // 账户id
adviceDefinitionId: item.adviceDefinitionId,
adviceDefinitionName: item.adviceName,
quantity: 1,
unitCode: item.unitCode,
unitPrice: item.price,
totalPrice: item.price,
positionId: item.positionId,
definitionId: item.chargeItemDefinitionId,
accountId: patientInfo.value.accountId,
};
});
saveSurgery({

View File

@@ -380,7 +380,7 @@ const form = ref({
prescriptionList: prescriptionList.value,
});
const adviceQueryParams = ref({
adviceType: '',
adviceType: 1,
categoryCode: '', // 初始为空,等待加载配置后动态设置
searchKey: '',
});
@@ -533,7 +533,6 @@ const statusOption = [
let loadingInstance = undefined;
onMounted(() => {
document.addEventListener('keydown', escKeyListener);
getList();
});
onBeforeUnmount(() => {
@@ -574,6 +573,7 @@ function handleTotalAmount() {
}
}, new Decimal(0));
}
getList();
function getList() {
getDiagnosisDefinitionList(queryParams.value).then((res) => {
// prescriptionList.value = res.data.records;
@@ -585,11 +585,6 @@ function refresh() {
}
// 获取列表信息
function getListInfo(addNewRow) {
// 守护:未选择患者时不发起 API 请求,避免页面加载时循环报错
if (!patientInfo.value || !patientInfo.value.encounterId) {
console.warn('⚠️ getListInfo 跳过:未选择患者');
return;
}
loadingInstance = ElLoading.service({ fullscreen: true });
setTimeout(() => {
loadingInstance.close();
@@ -691,7 +686,7 @@ function loadConfiguredCategories() {
nextTick(() => {
// 创建新对象触发响应式更新
adviceQueryParams.value = {
adviceType: '',
adviceType: 1,
categoryCode: defaultCategoryCode,
searchKey: '',
};
@@ -715,17 +710,9 @@ function loadConfiguredCategories() {
// 数据过滤
const filterPrescriptionList = computed(() => {
const pList = prescriptionList.value.filter((item) => {
// 修复 Bug #488orderClassCode 可能是复合值 '1-2',需提取 adviceType 部分进行比较
let matchAdviceType = true;
if (orderClassCode.value) {
const filterAdviceType = String(orderClassCode.value).includes('-')
? parseInt(String(orderClassCode.value).split('-')[0])
: orderClassCode.value;
matchAdviceType = filterAdviceType == item.adviceType;
}
return (
(!therapyEnum.value || therapyEnum.value == item.therapyEnum) &&
matchAdviceType &&
(!orderClassCode.value || orderClassCode.value == item.adviceType) &&
(!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId))
);
});
@@ -753,28 +740,12 @@ function getRowDisabled(row) {
/**
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
* 药品子分类使用复合值如 '1-2'adviceType-categoryCode诊疗/手术/全部使用原始值
* 修复 Bug #488当行的 adviceType 在当前配置中找不到匹配选项时,返回最接近的可用值,避免回显为纯数字
*/
function getRowSelectValue(row) {
if (row.adviceType == 1 && row.categoryCode) {
const compositeValue = '1-' + row.categoryCode;
// 检查复合值是否在选项列表中
if (adviceTypeList.value.some(item => item.value === compositeValue)) {
return compositeValue;
}
// 配置的 categoryCode 已变更,回退到第一个药品选项
const firstPharmacy = adviceTypeList.value.find(item => String(item.value).startsWith('1-'));
if (firstPharmacy) {
return firstPharmacy.value;
}
return row.adviceType;
return '1-' + row.categoryCode;
}
// 诊疗/手术等非药品类型,检查其值是否在选项列表中
if (adviceTypeList.value.some(item => item.value === row.adviceType)) {
return row.adviceType;
}
// 不在选项中的值(如已废弃的 adviceType返回 undefined 让 el-select 显示为空
return undefined;
return row.adviceType;
}
// 新增医嘱
@@ -831,8 +802,8 @@ function clickRowDb(row, column, event) {
return;
}
row.showPopover = false;
// 仅”待签发(statusEnum==1)”允许编辑;”已签发(statusEnum==2)”及之后状态不允许编辑
if (row.statusEnum == 1) {
// 待签发(已保存 requestId存在)”允许编辑;仅“待保存(无requestId)”允许编辑
if (row.statusEnum == 1 && !row.requestId) {
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
row.therapyEnum = String(row.therapyEnum ?? '1');
row.isEdit = true;
@@ -910,9 +881,9 @@ function handleFocus(row, index) {
// 用 adviceType + categoryCode 组合查找匹配的选项
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
// 修复Bug #486当行没有显式选择医嘱类型时row.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
// If the row has an explicit adviceType (saved/existing row), use its own categoryCode.
// If no type is selected (new row), use empty string for global search across all categories.
const categoryCode = selectedItem ? selectedItem.categoryCode : (row.adviceType != null ? (row.categoryCode || '') : '');
const searchKey = row.adviceName || '';
nextTick(() => {
@@ -949,12 +920,9 @@ function handleChange(value) {
// 用 adviceType + categoryCode 组合查找匹配的选项
const selectValue = (adviceType == 1 && row?.categoryCode) ? '1-' + row.categoryCode : adviceType;
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
// 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
// 修复Bug #453当adviceType为空字符串或NaN时不传具体类型让refresh函数根据searchKey决定搜索范围
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
tableRef.refresh(effectiveAdviceType, categoryCode, value);
// 修复Bug #486当行没有显式选择医嘱类型时不传categoryCode让搜索在全药库中进行
const categoryCode = selectedItem ? selectedItem.categoryCode : (row?.adviceType !== undefined ? (adviceQueryParams.value.categoryCode || '') : '');
tableRef.refresh(adviceType, categoryCode, value);
}
}
}
@@ -1213,27 +1181,19 @@ function handleSave() {
});
// 此处签发处方和单行保存处方传参相同后台已经将传参存为JSON字符串此处直接转换为JSON即可
loading.value = true;
let list = [];
try {
list = saveList.map((item) => {
const parsedContent = item.contentJson ? JSON.parse(item.contentJson) || {} : {};
return {
...parsedContent,
adviceType: item.adviceType,
requestId: item.requestId,
dbOpType: '1',
groupId: item.groupId,
uniqueKey: undefined,
// 确保 therapyEnum 被正确传递
therapyEnum: parsedContent?.therapyEnum || item.therapyEnum || '1',
};
});
} catch (error) {
loading.value = false;
isSaving.value = false;
proxy.$modal.msgError('医嘱内容解析失败,请检查待签发医嘱');
return;
}
let list = saveList.map((item) => {
const parsedContent = JSON.parse(item.contentJson);
return {
...parsedContent,
adviceType: item.adviceType,
requestId: item.requestId,
dbOpType: '1',
groupId: item.groupId,
uniqueKey: undefined,
// 确保 therapyEnum 被正确传递
therapyEnum: parsedContent.therapyEnum || item.therapyEnum || '1',
};
});
// 保存签发按钮
isSaving.value = true;
console.log('签发处方参数:', {
@@ -1248,16 +1208,9 @@ function handleSave() {
if (res.code === 200) {
proxy.$modal.msgSuccess('签发成功');
isSaving.value = false;
// 乐观更新:立即将已签发医嘱的状态设为"已签发",确保列表实时刷新
saveList.forEach((item) => {
const row = prescriptionList.value.find((r) => r.requestId && r.requestId === item.requestId);
if (row) {
row.statusEnum = 2;
}
});
getListInfo(false);
bindMethod.value = {};
nextId.value = 1;
nextId.value == 1;
} else {
proxy.$modal.msgError(res.message);
isSaving.value = false;
@@ -1358,12 +1311,11 @@ function handleCancelEdit(row, index) {
function handleSaveSign(row, index) {
if (row.adviceType != 2) {
// 修复 Bug #488严格校验 itemNo确保非空且为有效字符串才发起请求
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
if (!itemNo || String(itemNo).trim() === '') {
if (!itemNo) {
console.warn('绑定设备检查跳过itemNo为空adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + '');
} else {
getBindDevice({ typeCode: row.adviceType, itemNo: String(itemNo) }).then((res) => {
getBindDevice({ typeCode: row.adviceType, itemNo: itemNo }).then((res) => {
if (res.data.length == 0) {
return;
}
@@ -1424,21 +1376,13 @@ function handleSaveSign(row, index) {
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
nextId.value = 1;
nextId.value == 1;
}
});
} else {
// 新增行:调用保存接口将数据持久化到后端
row.dbOpType = '1';
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
nextId.value = 1;
// 保存成功后刷新列表,确保后端返回的数据带 requestId
getListInfo(false);
}
});
// 不需要再添加空行,保存成功后由 getListInfo 处理
if (prescriptionList.value[0].adviceName) {
handleAddPrescription();
}
}
adviceQueryParams.value.adviceType = undefined;
}
@@ -1479,40 +1423,32 @@ function handleSaveBatch() {
.then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
// 修复 Bug #405保存成功后锁定所有待保存行,避免医嘱条目仍处于可编辑状态
// saveList 中的 item 与 prescriptionList 是同一对象引用,直接修改即可
// 修复#405:保存成功后重置所有待保存行的 isEdit 为 false锁定医嘱不再编辑
saveList.forEach(item => {
item.isEdit = false;
const row = prescriptionList.value.find(r => r.uniqueKey === item.uniqueKey);
if (row) row.isEdit = false;
});
// 兜底:锁定所有 statusEnum == 1 的行,确保没有遗漏
prescriptionList.value.forEach(row => {
if (row.statusEnum == 1) {
row.isEdit = false;
}
});
expandOrder.value = [];
getListInfo(false);
nextId.value = 1;
nextId.value == 1;
isSaving.value = false;
}
})
.catch((error) => {
isSaving.value = false;
proxy.$modal.msgError(error?.msg || '保存失败,请重试');
});
}
function setValue(row) {
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
// 构造单位列表
unitCodeList.value = [
{ value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' },
{
value: String(row.doseUnitCode ?? ''),
value: row.doseUnitCode,
label: row.doseUnitCode_dictText,
type: 'dose',
},
{
value: String(row.minUnitCode ?? ''),
value: row.minUnitCode,
label: row.minUnitCode_dictText,
type: 'minUnit',
},
@@ -1577,9 +1513,9 @@ function setValue(row) {
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''),
// dose: undefined, Removed to preserve dose value from group package
unitCodeList: unitCodeList.value,
doseUnitCode: String(row.doseUnitCode ?? ''),
minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
doseUnitCode: row.doseUnitCode,
minUnitCode: row.minUnitCode,
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
@@ -1595,10 +1531,6 @@ function setValue(row) {
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
: prevRow.minUnitPrice,
positionName: selectedStock?.locationName,
// 🔧 Bug #523 修复:初始化 totalPrice 为 0避免总金额列显示为横杠
totalPrice: row.quantity
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
: '0',
}
: {
quantity: 1,
@@ -1630,21 +1562,17 @@ function handleSaveGroup(orderGroupList) {
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
const mergedDetail = item.mergedDetail || {
...(item.orderDetailInfos || {}),
adviceName: item.orderDefinitionName || item.orderDetailInfos?.adviceName || '未知项目',
adviceName: item.orderDetailInfos?.adviceName || item.orderDefinitionName || '未知项目',
adviceType: item.orderDetailInfos?.adviceType,
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
quantity: item.quantity,
unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
unitCodeName: item.unitCodeName,
// 🔧 Bug #403 修复dose/doseQuantity/dispensePerDuration 需用 null 检查,
// 避免组套中值为 null 时回退到医嘱库的 orderDetailInfos
dose: item.dose !== undefined && item.dose !== null ? item.dose : item.orderDetailInfos?.dose,
dose: item.dose || item.orderDetailInfos?.dose,
rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
dispensePerDuration: item.dispensePerDuration !== undefined && item.dispensePerDuration !== null
? item.dispensePerDuration : item.orderDetailInfos?.dispensePerDuration,
doseQuantity: item.doseQuantity !== undefined && item.doseQuantity !== null
? item.doseQuantity : item.orderDetailInfos?.doseQuantity,
dispensePerDuration: item.dispensePerDuration || item.orderDetailInfos?.dispensePerDuration,
doseQuantity: item.doseQuantity,
inventoryList: item.orderDetailInfos?.inventoryList || [],
priceList: item.orderDetailInfos?.priceList || [],
partPercent: item.orderDetailInfos?.partPercent || 1,
@@ -1663,15 +1591,20 @@ function handleSaveGroup(orderGroupList) {
setValue(mergedDetail);
// 创建新的处方项目
// 🔧 Bug #403 修复:关键字段使用 null-safe 回退到 mergedDetail已由 setValue 填充完整数据)
// 先取 setValue 填充的行数据作为基础
const baseRow = prescriptionList.value[rowIndex.value];
const newRow = {
...baseRow,
...prescriptionList.value[rowIndex.value],
patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId,
accountId: accountId.value,
quantity: item.quantity,
methodCode: item.methodCode,
rateCode: item.rateCode,
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
executeNum: 1,
unitCode: item.unitCode,
unitCode_dictText: item.unitCodeName || '',
statusEnum: 1,
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
// 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示
@@ -1680,33 +1613,19 @@ function handleSaveGroup(orderGroupList) {
conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value,
therapyEnum: baseRow?.therapyEnum || '1',
therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || '1',
};
// 覆盖关键字段:优先使用 item 的值,其次 mergedDetail已由 setValue 填充),最后 baseRow
newRow.quantity = item.quantity ?? mergedDetail.quantity ?? baseRow.quantity;
newRow.methodCode = item.methodCode ?? mergedDetail.methodCode ?? baseRow.methodCode;
newRow.rateCode = item.rateCode ?? mergedDetail.rateCode ?? baseRow.rateCode;
newRow.dispensePerDuration = item.dispensePerDuration ?? mergedDetail.dispensePerDuration ?? baseRow.dispensePerDuration;
newRow.dose = item.dose ?? mergedDetail.dose ?? baseRow.dose;
newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity;
newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode;
newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || '';
// 计算价格和总量
// 🔧 Bug #403 修复:使用 newRow.unitCode已由 setValue 填充)而非 item.unitCode
// 使用 ?? 替代 || 计算 partPercent确保值为 0 时不会被错误替换
const finalUnitCode = newRow.unitCode;
const unitInfo = unitCodeList.value.find((k) => k.value == finalUnitCode);
const finalQuantity = newRow.quantity;
const partPercent = item.orderDetailInfos?.partPercent ?? mergedDetail.partPercent ?? baseRow.partPercent ?? 1;
const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode);
if (unitInfo && unitInfo.type == 'minUnit') {
newRow.price = newRow.minUnitPrice;
newRow.totalPrice = ((finalQuantity || 0) * newRow.minUnitPrice).toFixed(6);
newRow.minUnitQuantity = finalQuantity || 0;
newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity;
} else {
newRow.price = newRow.unitPrice;
newRow.totalPrice = ((finalQuantity || 0) * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = (finalQuantity || 0) * partPercent;
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
}
newRow.contentJson = JSON.stringify(newRow);

View File

@@ -23,7 +23,7 @@
<span class="descriptions-item-label">全选</span>
<el-switch v-model="chooseAll" @change="handelSwitchChange" />
<el-button class="ml20" type="primary" @click="handleCheck"> 核对通过 </el-button>
<el-button class="ml20 mr20" type="danger" @click="handleCancel"> 退回 </el-button>
<el-button class="ml20 mr20" type="danger" :disabled="hasDispensedSelected" @click="handleCancel"> 退回 </el-button>
</div>
</div>
<div
@@ -152,6 +152,7 @@
</div>
</template>
<script setup>
import {ref, computed} from 'vue';
import {adviceVerify, cancel, getPrescriptionList} from './api';
import {patientInfoList} from '../../components/store/patient.js';
import {formatDateStr} from '@/utils/index';
@@ -163,6 +164,11 @@ const type = ref(null);
const { proxy } = getCurrentInstance();
const loading = ref(false);
const chooseAll = ref(false);
const selectionTrigger = ref(0);
const hasDispensedSelected = computed(() => {
selectionTrigger.value;
return getSelectRows().some(item => item.dispenseStatus === 4);
});
const props = defineProps({
requestStatus: {
type: Number,
@@ -262,7 +268,9 @@ function getGroupMarkers() {
}
// 选择框改变时的处理
function handleSelectionChange(selection, row) {}
function handleSelectionChange(selection, row) {
selectionTrigger.value++;
}
/**
* 核对通过
@@ -291,7 +299,7 @@ function handleCancel() {
// 校验已发药的医嘱不允许退回
let dispensedItems = list.filter(item => item.dispenseStatus === 4);
if (dispensedItems.length > 0) {
proxy.$message.error('该医嘱已发药,无法退回');
proxy.$message.error('该药品已由药房发放,请先执行退药处理,不可直接退回');
return;
}
cancel(list).then((res) => {
@@ -310,12 +318,16 @@ function getSelectRows() {
// 获取选中的医嘱信息
let list = [];
prescriptionList.value.forEach((item, index) => {
list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()];
const ref = proxy.$refs['tableRef' + index];
if (ref && ref[0]) {
list = [...list, ...ref[0].getSelectionRows()];
}
});
return list.map((item) => {
return {
requestId: item.requestId,
requestTable: item.adviceTable,
dispenseStatus: item.dispenseStatus,
};
});
}

View File

@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
// 严格批号查询有库存orgQuantity > 0
if (d && Number(d.orgQuantity ?? 0) > 0) {
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
applyFromDto(d, false);
if (Number(r.totalQuantity) <= 0) {
proxy.$message.warning('仓库数量为0无法调用');
}
persistStore();
return;
}
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
if (lotTrimmed) {
return runGet(false).then((res2) => {
const list2 = res2.data || [];
@@ -1157,8 +1157,6 @@ function handleLocationClick(item, row, index) {
persistStore();
});
}
// 没有指定批号,直接提示
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');

View File

@@ -546,7 +546,7 @@
v-model="form.admissionTime"
type="datetime"
placeholder="选择入室时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -558,7 +558,7 @@
v-model="form.entryTime"
type="datetime"
placeholder="选择进室时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -570,7 +570,7 @@
v-model="form.anesStart"
type="datetime"
placeholder="选择麻醉开始时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -584,7 +584,7 @@
v-model="form.startTime"
type="datetime"
placeholder="选择切开时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -596,7 +596,7 @@
v-model="form.endTime"
type="datetime"
placeholder="选择手术结束时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -608,7 +608,7 @@
v-model="form.anesEnd"
type="datetime"
placeholder="选择麻醉结束时间"
value-format="YYYY-MM-DDTHH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
@@ -689,7 +689,7 @@
</el-dialog>
<!-- 手术申请查询弹窗 -->
<el-dialog :title="'手术申请查询'" v-model="showApplyDialog" width="1200px" @close="cancelApplyDialog">
<el-dialog :title="'手术申请查询'" v-model="showApplyDialog" width="1200px" @close="cancelApplyDialog" class="surgery-apply-dialog">
<!-- 查询条件区 -->
<el-form :model="applyQueryParams" ref="applyQueryRef" :inline="true" class="query-form">
<el-form-item label="手术单号" prop="surgeryNo">
@@ -749,8 +749,8 @@
@row-click="handleApplyRowClick"
:row-class-name="tableRowClassName"
style="width: 100%"
max-height="400"
:scroll="{ y: 400 }"
max-height="340"
:scroll="{ y: 340 }"
>
<el-table-column type="selection" width="55" :selectable="handleSelectable" />
<el-table-column label="ID" align="center" width="80" fixed>
@@ -781,7 +781,7 @@
</el-table>
<!-- 底部分页区 -->
<div class="pagination-container" style="margin-top: 10px; padding-bottom: 10px">
<div class="pagination-container apply-pagination" style="margin-top: 10px; padding-bottom: 20px">
<pagination
v-show="applyTotal > 0"
:total="applyTotal"
@@ -792,10 +792,12 @@
@pagination="getSurgicalScheduleList"
/>
</div>
<!-- 分页与底部操作区之间的间隔 -->
<div style="height: 48px"></div>
<!-- 底部操作区 -->
<template #footer>
<div class="dialog-footer">
<div class="dialog-footer" style="margin-top: 24px; padding-top: 12px; border-top: 1px solid #ebeef5">
<el-button @click="cancelApplyDialog">取消</el-button>
<el-button type="primary" @click="confirmApply">确认</el-button>
</div>
@@ -1323,13 +1325,13 @@ function handleEdit(row) {
if (res.code === 200) {
const data = res.data
Object.assign(form, data)
// 修复#433确保字典字段类型与下拉选项一致Number类型
// 后端OpSchedule.anesMethod为String类型需转为Number与el-select匹配
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum)
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
if (data.feeType != null) form.feeType = data.feeType
if (data.isExternalExpert != null) form.isExternalExpert = Number(data.isExternalExpert)
// 使用nextTick确保在Vue响应式更新后再赋值避免el-select无法匹配选项
nextTick(() => {
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
if (data.feeType != null) form.feeType = data.feeType
if (data.isExternalExpert != null) form.isExternalExpert = Number(data.isExternalExpert)
})
} else {
proxy.$modal.msgError('获取手术安排详情失败')
}
@@ -1349,13 +1351,13 @@ function handleView(row) {
if (res.code === 200) {
const data = res.data
Object.assign(form, data)
// 修复#433确保字典字段类型与下拉选项一致Number类型
// 后端OpSchedule.anesMethod为String类型需转为Number与el-select匹配
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
if (data.anesthesiaTypeEnum != null) form.anesMethod = Number(data.anesthesiaTypeEnum)
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
if (data.feeType != null) form.feeType = data.feeType
if (data.isExternalExpert != null) form.isExternalExpert = Number(data.isExternalExpert)
// 使用nextTick确保在Vue响应式更新后再赋值避免el-select无法匹配选项
nextTick(() => {
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
if (data.feeType != null) form.feeType = data.feeType
if (data.isExternalExpert != null) form.isExternalExpert = Number(data.isExternalExpert)
})
} else {
proxy.$modal.msgError('获取手术安排详情失败')
}
@@ -1535,8 +1537,8 @@ function handleMedicalAdvice(row) {
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
// 调用计费接口获取数据
getPrescriptionList(row.visitId).then((res) => {
console.log('=== 拉取计费数据返回结果 ===', res)
if (res.code === 200 && res.data) {
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
@@ -1741,39 +1743,27 @@ function handleTemporaryMedicalSubmit(data) {
}
})
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
// 匹配键:优先使用 chargeItemId后端费用项目ID最可靠其次使用 名称+规格+数量 组合
const submittedKeys = new Set()
const submittedChargeIds = new Set()
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
const submittedKeys = new Set(
(data.temporaryAdvices || [])
.map(a => {
const om = a.originalMedicine || {}
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
const spec = om.specification || om.volume || ''
const qty = om.quantity || 0
return `${name}|||${spec}|||${qty}`
})
.filter(k => k !== '|||0') // 过滤掉空项
)
;(data.temporaryAdvices || []).forEach(a => {
const om = a.originalMedicine || {}
// 收集 chargeItemId最可靠的匹配标识
if (om.chargeItemId) {
submittedChargeIds.add(om.chargeItemId)
}
// 构建名称+规格+数量的匹配键(用于无 chargeItemId 的兜底匹配)
// 注意originalMedicine 中的名称字段是 adviceName来自 billingMedicines.map 时的字段)
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
const spec = om.specification || om.volume || ''
const qty = om.quantity || 0
if (name) {
submittedKeys.add(`${name}|||${spec}|||${qty}`)
}
})
if (submittedChargeIds.size > 0 || submittedKeys.size > 0) {
if (submittedKeys.size > 0) {
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
// 优先用 chargeItemId 匹配
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
return false
}
// 兜底用 名称+规格+数量 匹配
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
return !submittedKeys.has(key)
})
} else {
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
// 如果没有任何匹配,清空待生成列表(所有项目都已提交)
temporaryBillingMedicines.value = []
}
@@ -1954,6 +1944,30 @@ function handleQuoteBilling() {
}
})
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表
// 原因:后端返回的计费数据中,已生成医嘱的项目可能没有 requestId 字段
// 方案:用 chargeItemId/requestId/id 与已有的 temporaryAdvices 做匹配,排除已生成项目
if (temporaryAdvices.value.length > 0) {
const existingAdviceIds = new Set()
temporaryAdvices.value.forEach(a => {
const om = a.originalMedicine || {}
if (om.requestId) existingAdviceIds.add(String(om.requestId))
if (om.chargeItemId) existingAdviceIds.add(String(om.chargeItemId))
if (om.id) existingAdviceIds.add(String(om.id))
})
if (existingAdviceIds.size > 0) {
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
const mRequestId = m.requestId != null ? String(m.requestId) : null
const mChargeItemId = m.chargeItemId != null ? String(m.chargeItemId) : null
const mId = m.id != null ? String(m.id) : null
if (mRequestId && existingAdviceIds.has(mRequestId)) return false
if (mChargeItemId && existingAdviceIds.has(mChargeItemId)) return false
if (mId && existingAdviceIds.has(mId)) return false
return true
})
}
}
temporaryMedicalLoading.value = false // 🔧 新增:加载完成
ElMessage.success('已成功引用最新计费药品信息!')
} else {
@@ -2362,6 +2376,22 @@ function getRowClassName({ row, rowIndex }) {
margin-left: 10px;
}
/* 手术申请查询弹窗 — 分页与footer间距 */
.surgery-apply-dialog :deep(.el-dialog__body) {
padding-bottom: 32px;
}
.surgery-apply-dialog :deep(.el-dialog__footer) {
padding-top: 0;
}
.surgery-apply-dialog :deep(.apply-pagination) {
padding-bottom: 24px;
margin-bottom: 16px;
border-bottom: 1px solid #ebeef5;
}
.surgery-apply-dialog :deep(.apply-pagination .el-pagination) {
margin-right: 80px;
}
/* 选中行样式 */
:deep(.el-table .selected-row) {
background-color: #ecf5ff !important;
@@ -2372,3 +2402,21 @@ function getRowClassName({ row, rowIndex }) {
}
</style>
<style>
/* 手术申请查询弹窗 — 非 scoped 确保穿透 teleport */
.surgery-apply-dialog .apply-pagination {
padding-bottom: 24px !important;
margin-bottom: 16px !important;
border-bottom: 1px solid #ebeef5 !important;
}
.surgery-apply-dialog .apply-pagination .el-pagination {
margin-right: 80px !important;
}
.surgery-apply-dialog .el-dialog__body {
padding-bottom: 32px !important;
}
.surgery-apply-dialog .el-dialog__footer {
padding-top: 0 !important;
}
</style>