56 Commits

Author SHA1 Message Date
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
赵云
6940c3861d Fix Bug #458: 门诊医生站:诊疗类医嘱保存成功后,列表"医嘱类型"列显示为空值
增强 mapAdviceTypeLabel 函数的兜底映射:在原有表名匹配兜底的基础上,
新增不依赖表名的最终兜底映射(1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=手术),
确保即使字典缺失或表名不匹配也能正确显示类型标签。

同时修复 getListInfo 中 adviceType_dictText 的空字符串判断逻辑,
使用显式 trim() 检查替代 || 运算符,避免后端返回空字符串时未被重新计算。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 21:13:26 +08:00
赵云
6e975bf9c4 Fix Bug #451: 门诊医生站-提交新增手术申请后列表刷新失败
根因:子组件 submitForm 成功后同时调用 getList() 和 emit('saved'),
父组件 @saved 也调用 getList(),导致两个并发请求产生竞态条件;
若后端事务尚未完全提交,getList() 查询可能失败并弹出 msgError。

修复:
1. 子组件移除直接 getList() 调用,统一由父组件 @saved 刷新
2. 父组件添加 500ms 延迟确保后端事务已提交
3. getList() 错误处理改为 console.warn 优雅降级,避免阻断弹窗

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:20:27 +08:00
荀彧
3360cccaa5 Fix Bug #463: [目录管理-诊疗目录] 新增/编辑弹窗中"诊疗子项"检索功能失效,无法搜到已维护的项目
根因:ActivityDefinitionManageMapper.xml 中 getDiseaseTreatmentPage 查询使用 INNER JOIN
关联 adm_charge_item_definition 价格表,导致 55 个没有价格记录的诊疗项目被完全排除
在搜索结果之外。改为 LEFT JOIN 后,即使项目暂无价格记录也能被搜索到。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:16:15 +08:00
荀彧
fe138589a5 Fix Bug #445: 门诊手术安排-已生成医嘱的计费项目未从待生成列表剔除
根因:submit后本地过滤逻辑中submittedKeys的字段名不匹配
- originalMedicine中的名称字段是adviceName而非medicineName,导致
  名称+规格+数量的匹配键无法正确匹配已提交项
- 修复:增加chargeItemId作为首选匹配标识(后端唯一ID最可靠),
  名称匹配增加adviceName字段兜底

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:13:49 +08:00
荀彧
270475adb9 Fix Bug #444: 门诊手术医嘱界面"已引用计费药品"列表未正常显示药品名称
根因分析:
1. 前端 handleMedicalAdvice 调用 getPrescriptionList 时只传 encounterId,
   未传 generateSourceEnum=6 和 sourceBillNo(手术单号),
   后端默认查询 generateSourceEnum=1(医生开立),漏掉了手术计费创建的药品记录
2. 后端 getRequestBaseInfo 在 sourceBillNo 存在时会过滤掉药品(adviceType=1),
   进一步阻断了手术计费药品的返回

修复方案:
- 前端:handleMedicalAdvice 传参 (visitId, 6, operCode) 匹配手术计费记录
- 后端:移除手术计费场景的药品过滤,前端各组件已按 adviceType 自行过滤

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 20:10:17 +08:00
关羽
7d0c93b9a1 Fix Bug #452: 领用出库模块选择药品时提示"仓库数量为0,无法调用",与实际库存数据不符
严格批号查询返回记录但 orgQuantity=0 时,原代码直接调用 applyFromDto 并弹出警告,
未回退到非严格查询(不含 lotNumber)获取同仓库其他有库存的批号。
修复:在 applyFromDto 之前检查 orgQuantity > 0,数量为0时回退到非严格查询。
2026-05-14 19:24:03 +08:00
荀彧
87f5135ddc Fix Bug #426: 门诊医生站-检查开立:已选择列表应支持树形展开,显示套餐明细(项目/数量/单价)
修复 loadMethodPackageDetails 函数中套餐明细 API 地址错误(/system/package/ → /system/check-type/package/),导致套餐明细加载失败返回 404

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 19:06:33 +08:00
关羽
e6c0d03dc1 Fix Bug #443: 手术计费:点击"签发"耗材时异常报错
根因:签发耗材时 handDevice 方法会重复调用 saveOrUpdate 更新已有的 DeviceRequest 记录,
仅设置了部分字段(可能为 null),导致关键字段 performLocation(发放库房)被覆盖为空。
随后 handleDeviceDispense 创建 DeviceDispense 时 locationId 为 null,触发报错。

修复:签发操作(SIGN_ADVICE)跳过 handDevice 处理。因为耗材请求在保存时已创建完成,
签发只需更新状态(下方批量更新逻辑已处理),无需重新走 insert/update 流程。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:15:50 +08:00
赵云
5f7b75667a Fix Bug #402: 住院医生站诊断录入:点击保存诊断后,列表出现重复记录且部分条目元数据缺失
根因:后端 saveDoctorDiagnosis 先删除所有 tcm_flag=0 的记录,再用旧 encounterDiagnosisId
调用 saveOrUpdate,由于记录已删除,UPDATE 失败后 fallback 到 INSERT 导致重复记录。

修复:
1. 后端:不再设置 encounterDiagnosisId,确保 saveOrUpdate 始终执行 INSERT
2. 前端:getList() 后对诊断列表按 ybNo/name 去重,防止重复显示
3. 前端:保存前补全 diagnosisDoctor 和 diagnosisTime 元数据
4. 前端:修复 getTcmDiagnosis 的空值安全访问(res.data?.illness?.length)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:37 +08:00
赵云
2cdda279a4 Fix Bug #435: 门诊手术安排:编辑弹窗中"费用类别"字段数据未回显
根因:getSurgeryScheduleDetail 的 SQL 查询中引用了 fc.contract_name 但
未 JOIN fin_contract 表(以及关联的 adm_encounter、adm_account),导致
PostgreSQL 报错 "missing FROM-clause entry for table fc",接口返回失败,
前端费用类别字段无法获取数据。

修复:添加缺失的三表 JOIN(adm_encounter → adm_account → fin_contract),
并移除重复的 os.fee_type AS feeType 别名。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:13:08 +08:00
bc595e3843 bug499 【住院医生工作站-检查申请】检查申请列表缺失查询过滤功能,不符合临床高效检索要求 数据库语句报错修复 2026-05-14 18:10:46 +08:00
荀彧
53e5ee331b Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
1. handleMethodSelect 中新增/更新已选项时,设置 expanded=true 使套餐明细自动展开
2. toggleItemExpand 中改用 packageDetailsDisplay/carrier.packageDetails 判断是否已加载明细
   (原代码检查非响应式的 item.packageDetails,导致重复加载或加载判断失效)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 18:09:16 +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
关羽
571f254d0e Fix Bug #408: 门诊医生站:检查标签页:选中检查申请记录后,“检查明细”标签页显示“暂无数据”
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:19:52 +08:00
关羽
560813d009 Fix Bug #412: 门诊医生站:传染病报告卡保存失败,提示报错
BeanUtils.copyProperties 不支持 DTO 中 LocalDate/LocalDateTime 到实体中 java.util.Date 的类型转换,导致 onsetDate、diagDate、reportDate、deathDate 等日期字段在拷贝后为 null。新增手动类型转换逻辑确保日期字段正确保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 17:16:39 +08:00
31c2acb4ef bug516 2026-05-14 16:47:21 +08:00
关羽
254de01d2e Fix Bug #523: [住院医生站-临床医嘱] 待保存医嘱总金额显示缺失且编辑态单位选择框变为数字控件
- 总金额列显示横杠: 在 setValue 中为药品类医嘱初始化 totalPrice(有 quantity 时按单价计算,否则为 '0'),确保待保存医嘱的总金额列能正常回显
- 单位选择框变数字控件: setValue 中将 unitCode/doseUnitCode/minUnitCode 统一转为 String 类型,避免 el-select 因值类型不匹配而渲染异常

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:31:02 +08:00
关羽
e21122edf0 Fix Bug #516: [住院医生站-临床医嘱-检验申请] 检验申请单手动填写的"发往科室"与生成的医嘱执行科室不一致
根因:后端 RequestFormManageAppServiceImpl.saveRequestForm() 完全忽略了前端传入的 positionId(用户手动选择的发往科室),
始终从 activityOrganizationConfig 配置表中查询执行科室,导致用户手动选择的科室被默认配置覆盖。

修复:在收集执行科室时优先使用 activitySaveDto.getPositionId()(前端传入的用户选择),
仅在前端未传入时 fallback 到配置表中的执行科室。

**后端开发重点**:优先搜索 Java/Spring 后端代码。
关键词:Controller, Service, Mapper, API, 接口, 数据查询
搜索目录:openhis-server-new/src/, his-repo/src/

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:30:13 +08:00
关羽
e9576ddfa8 Fix Bug #517: [库房管理-领用管理] 业务逻辑校验缺失:允许保存并提交领用数量大于库存数量(零库存领用)的单据
在 RequisitionIssueAppServiceImpl.addOrEditIssueReceipt() 中新增库存校验逻辑,
批量保存时校验领用数量是否超过源仓库实际库存,不足时抛出 ServiceException 阻断保存。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:26:35 +08:00
关羽
b435de9e7b Fix Bug #519: [门诊医生站-诊断-报卡] 已完成传染病报卡的诊断在再次点保存时重复弹出报卡界面
根因:handleInfectiousDiseaseReport() 仅根据诊断名称匹配传染病,未校验该诊断是否已有已提交的报卡记录。

修复方案:
1. 后端 DiagnosisQueryDto 新增 hasInfectiousReport 字段
2. getEncounterDiagnosis SQL 通过 EXISTS 子查询关联 infectious_card 表,
   判断是否存在 status >= 1(已提交/已审核/已上报)的报卡记录
3. 前端 handleInfectiousDiseaseReport() 过滤掉 hasInfectiousReport === 1 的诊断,不再弹出报卡

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:16:46 +08:00
赵云
bc13fd6968 Fix Bug #522: [住院护士站-三测单] 体征录入点击保存后缺乏执行反馈且窗口异常自动关闭
- 添加保存成功提示(proxy.msgSuccess)
- 移除保存成功后自动关闭弹窗的逻辑(closeDialog),保持弹窗开启方便护士核对历史记录和继续录入

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:16:31 +08:00
赵云
d9ad63397b Fix Bug #518: [门诊医生工作站-诊断-传染病报卡] 报卡页面缺失"性别、出生日期、实足年龄"核心字段
根因:infectiousDiseaseReportDialog.vue 读取患者性别时使用了错误的字段名
patientInfo.sex || patientInfo.genderName,但门诊医生站API返回的字段是
genderEnum(数字:1=男,2=女)和genderEnum_enumText(文本:男/女)。
新增 normalizeSexFromPatientInfo 函数,兼容HIS系统所有可能的性别字段命名。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:15:14 +08:00
关羽
bb3e1e300d Fix Bug #508: [住院护士站-住院记账-补费] 点击"划价组套"按钮无任何响应,无法选择组套项目
根因:FeeDialog 内嵌套的"划价组套选择" el-dialog 使用了 append-to-body 但未设置 z-index。
在 Element Plus 中,外层补费弹窗 z-index 约 2000,遮罩层 z-index 2001。内层组套弹窗虽通过
append-to-body 挂载到 body,但其 z-index 2002 可能被外层遮罩遮挡(渲染时序问题),导致弹窗
实际渲染但不可见,表现为"无任何响应"。

修复:为内层 el-dialog 添加 :z-index="3000",确保其渲染在外层弹窗遮罩之上。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:09:53 +08:00
关羽
46358ea03d Fix Bug #455: 门诊医生站-医嘱:开立诊疗医嘱时执行科室默认获取逻辑有误且显示为原始ID
移除else分支中对orgId和positionName的条件判断,确保诊疗类医嘱的执行科室
始终使用患者就诊科室,不被诊疗目录配置的positionId覆盖。
之前的if (!orgId)条件导致目录已配置positionId时不会被覆盖,
若目录配置的ID不在机构树中则显示原始ID。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 16:08:26 +08:00
b5c308d9cb 修复bug 2026-05-14 15:54:00 +08:00
关羽
adfeb8f5e5 Fix Bug #510: [住院医生工作站] 进入页面报错
修复模板中的 Markdown 代码块标记污染(```vue/``` 作为文本渲染),
并恢复被意外移除的 SummaryDrugApplication 组件导入及 ref 声明,
解决页面加载时组件未定义错误和页面渲染异常。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:28:21 +08:00
赵云
fd9309f125 Fix Bug #494: 住院医生工作站-检查申请:申请单名称显示为通用名称,未展示具体检查项目名称
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:19:00 +08:00
关羽
46affb424e Fix Bug #507: [住院护士站-住院记账-补费] 项目单位未获取、执行科室显示内码且缺乏默认/模糊搜索逻辑
1. FeeDialog.vue - getUnitCodeOptions 修复:当 unitCode/minUnitCode 为 null 但对应字典文本存在时,使用文本作为选项值兜底,确保单位下拉框不显示为空
2. newfeeDetailQuery.vue - getLocationInfo 修复:从单一 records[0].children 解析改为支持树形/扁平/数组多种响应结构,并添加 catch 兜底置空数组
3. newfeeDetailQuery.vue - selectOrg 修复:查找失败时返回 '-' 而非显示原始 orgId 内码,空值同样返回 '-'

**后端开发重点**:优先搜索 Java/Spring 后端代码。
关键词:Controller, Service, Mapper, API, 接口, 数据查询
搜索目录:openhis-server-new/src/, his-repo/src/
2026-05-14 15:12:07 +08:00
荀彧
6dcee26b54 Fix Bug #509: [门诊医生站-手术申请] 提交申请后列表未实时刷新展示数据
- 提交成功后直接调用 getList() 刷新手术申请列表,不再仅依赖父组件的 emit('saved') 事件
- 修复原因:父组件通过 surgeryRef?.getList() 可选链调用可能因 ref 未就绪或时序问题导致静默跳过

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 15:11:43 +08:00
关羽
a282234bb0 Fix Bug #497: 【住院医生工作站-检查申请】检查申请列表缺失"申请单状态"列及全流程闭环状态流转逻辑
根因分析:
1. SQL CASE 映射不完整:status_enum=3(COMPLETED) 直接映射为应用状态 4(已接收),
   跳过了 2(已校对) 和 3(待接收)
2. status_enum=8 在数据中存在但枚举类中缺失定义
3. 前端已完整实现状态列和交互逻辑,问题在后端返回的状态值不正确

修复内容:
- RequestFormManageAppMapper.xml: 重构 SQL CASE 语句
  - status_enum=3 + performer_check_id 有值 → 2(已校对),利用护士校对标记区分
  - status_enum=3 + performer_check_id 为空 → 4(已接收)
  - status_enum=4(ON_HOLD) → 3(待接收)
  - status_enum=5/6/7 → 7(已作废)
  - status_enum=8 → 6(已出报告)
- RequestStatus.java: 补充 COMPLETED_REPORT(8) 枚举值

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:26:38 +08:00
荀彧
52fc64c71d Fix Bug #477: 住院医生工作站-检查申请详情弹窗中"发往科室"字段显示为短横线
根因: examineApplication.vue 的 handlePrint 函数调用了未定义的 recursionFun 方法
(ReferenceError),handleViewDetail 使用 findTreeItem 但该方法对后端返回的扁平
科室列表解析不够健壮。与 testApplication.vue 对比后,发现缺少 recursionFun 函数定义。

修复策略: 新增 recursionFun 函数(与 testApplication.vue 一致实现),并在
handleViewDetail 和 handlePrint 中统一使用该方法将 targetDepartment ID 转换为科室名称。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:21:51 +08:00
关羽
0bd1277307 Fix Bug #495: 【医嘱闭环】已校对医嘱无法流转至"医嘱执行"界面,导致费用无法提交执行
Root cause: In getInpatientAdvicePage(), encounterIds and exeStatus were nullified
before buildQueryWrapper to prevent auto-generated SQL conditions, but requestStatus
was NOT nullified. HisQueryUtils.buildQueryWrapper uses reflection to add eq conditions
for ALL non-null fields, so requestStatus: 3 became an extra SQL filter
"AND request_status = 3" that was not intended for the 医嘱执行 page.

The 医嘱执行 page uses exeStatus (not requestStatus) for execution state filtering.
The SQL already handles verified/unverified order filtering via a CASE condition
on status_enum and performer_check_id. The requestStatus parameter is only meant
for frontend tab selection and should not be used as a SQL filter here.

Fix: Nullify requestStatus before buildQueryWrapper, same as encounterIds/exeStatus.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 14:14:56 +08:00
赵云
e0e4c2bcc6 Fix Bug #471: 手术管理-门诊手术安排:手术申请查询结果中混入住院检验申请单数据(脏数据)
根因:门诊手术安排查询弹窗调用 /reg-doctorstation/request-form/get-surgery-page 接口,
SQL 过滤 type_code = '24',但实际手术申请单的 type_code 存储为 'SURGERY'(非'24'),
导致查询返回0条手术记录。同时检验申请单(type_code='22')使用 PAR 前缀处方号,在缺少
type_code 有效过滤时可能混入结果。

修复:将 SQL 过滤器从 type_code = #{typeCode} 改为 type_code IN (#{typeCode}, 'SURGERY'),
兼容两种 type_code 值,确保只返回手术申请单,排除检验/检查申请单数据。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:13:47 +08:00
关羽
41bea23116 Fix Bug #469: [住院医生工作站-检验申请] 完善【操作】列临床业务逻辑:支持按状态动态切换修改、删除、撤回等功能
1. 修复删除/撤回接口参数错误:前端传prescriptionNo但后端期望requestFormId
2. 修改handleEdit从占位提示改为打开编辑弹窗,复用laboratoryTests组件并传入editData
3. laboratoryTests新增editData prop和编辑模式:支持descJson表单回显、已选项目回填、提交时携带requestFormId

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:12:28 +08:00
关羽
12382503f4 Fix Bug #489: 【医嘱闭环】医生站签发单条长期药品医嘱,护士校对界面生成重复(两条)待校对记录
Root cause: The SQL query in AdviceProcessAppMapper.xml used a plain LEFT JOIN with
med_medication_dispense on med_req_id. When a single medication request had multiple
dispense records (e.g., from repeated executions or summary operations), the JOIN
produced multiple rows per request — up to 222 rows for one request. SELECT DISTINCT
could not deduplicate because dispense_status values differed across rows.

Fix: Replace the plain LEFT JOIN with LEFT JOIN LATERAL (subquery ORDER BY create_time
DESC LIMIT 1) to fetch only the most recent dispense record per medication request.
This ensures exactly one row per request regardless of how many dispense records exist.

Verified: SQL query now returns 0 duplicate rows across all medication requests.
2026-05-14 13:10:51 +08:00
赵云
ae50a7042e Fix Bug #468: [住院医生工作站-检验申请] 列表页新增【单据状态】列
列表页增加单据状态列(位于申请单号之后),使用 el-tag 显示状态:
- applyStatus=0 显示"待开立"(灰色标签)
- applyStatus=1 显示"已开立"(绿色标签)
- 已收费且已执行显示"已执行"(绿色标签)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 13:06:59 +08:00
34 changed files with 622 additions and 177 deletions

View File

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

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.AdviceBaseDto;
import com.openhis.web.doctorstation.dto.AdviceSaveParam; import com.openhis.web.doctorstation.dto.AdviceSaveParam;
import com.openhis.web.doctorstation.dto.OrderBindInfoDto; import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
import com.openhis.web.doctorstation.dto.SurgeryItemDto;
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam; import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
import java.util.List; import java.util.List;
@@ -134,4 +135,16 @@ public interface IDoctorStationAdviceAppService {
* @return 已配置的药品类别编码列表 * @return 已配置的药品类别编码列表
*/ */
R<?> getConfiguredCategories(Long organizationId); 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);
} }

View File

@@ -2440,4 +2440,20 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
return R.ok(categoryCodes); 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();
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());
return result;
}
} }

View File

@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date; import java.util.Date;
import java.util.*; import java.util.*;
@@ -598,6 +601,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport(); InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport); BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport);
// BeanUtils.copyProperties 不支持 LocalDate/LocalDateTime 到 java.util.Date 的类型转换,需手动处理
if (infectiousDiseaseReportDto.getOnsetDate() != null) {
infectiousDiseaseReport.setOnsetDate(
Date.from(infectiousDiseaseReportDto.getOnsetDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getDiagDate() != null) {
infectiousDiseaseReport.setDiagDate(
Date.from(infectiousDiseaseReportDto.getDiagDate().atZone(ZoneId.systemDefault()).toInstant()));
}
// deathDate / reportDate 同理
if (infectiousDiseaseReportDto.getDeathDate() != null) {
infectiousDiseaseReport.setDeathDate(
Date.from(infectiousDiseaseReportDto.getDeathDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
if (infectiousDiseaseReportDto.getReportDate() != null) {
infectiousDiseaseReport.setReportDate(
Date.from(infectiousDiseaseReportDto.getReportDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
}
/** /**
* 设置创建人、删除状态、租户ID * 设置创建人、删除状态、租户ID
*/ */

View File

@@ -203,4 +203,22 @@ public class DoctorStationAdviceController {
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId); 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));
}
} }

View File

@@ -96,4 +96,9 @@ public class DiagnosisQueryDto {
*/ */
private String diagnosisDoctor; private String diagnosisDoctor;
/**
* 是否已有传染病报卡0-无1-有)
*/
private Integer hasInfectiousReport;
} }

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,18 @@ public interface DoctorStationAdviceAppMapper {
*/ */
Long getDefaultAccountId(@Param("encounterId") Long encounterId); 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);
} }

View File

@@ -178,6 +178,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
inpatientAdviceParam.setEncounterIds(null); inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus(); Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null); inpatientAdviceParam.setExeStatus(null);
// requestStatus由前端tab控制后端SQL已通过CASE条件处理校对状态过滤无需再作为SQL条件
inpatientAdviceParam.setRequestStatus(null);
// 构建查询条件 // 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null); = HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);

View File

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

View File

@@ -3,29 +3,38 @@
*/ */
package com.openhis.web.inventorymanage.appservice.impl; package com.openhis.web.inventorymanage.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*; import com.core.common.utils.*;
import com.core.common.utils.bean.BeanUtils; import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.DeviceDefinition;
import com.openhis.administration.domain.Practitioner; import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IDeviceDefinitionService;
import com.openhis.administration.service.IPractitionerService; import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*; import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils; import com.openhis.common.utils.HisQueryUtils;
import com.openhis.medication.domain.MedicationDefinition;
import com.openhis.medication.service.IMedicationDefinitionService;
import com.openhis.web.common.dto.UnitDto; import com.openhis.web.common.dto.UnitDto;
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService; import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
import com.openhis.web.inventorymanage.dto.*; import com.openhis.web.inventorymanage.dto.*;
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper; import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.SupplyRequest; import com.openhis.workflow.domain.SupplyRequest;
import com.openhis.workflow.service.IInventoryItemService;
import com.openhis.workflow.service.ISupplyRequestService; import com.openhis.workflow.service.ISupplyRequestService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -48,6 +57,15 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
@Autowired @Autowired
private IPractitionerService practitionerService; private IPractitionerService practitionerService;
@Autowired
private IInventoryItemService inventoryItemService;
@Autowired
private IMedicationDefinitionService medicationDefinitionService;
@Autowired
private IDeviceDefinitionService deviceDefinitionService;
@Autowired @Autowired
private AssignSeqUtil assignSeqUtil; private AssignSeqUtil assignSeqUtil;
@@ -167,6 +185,10 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
// 单据号取得 // 单据号取得
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList()); List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
// 库存校验:领用数量不能超过源仓库实际库存
this.validateRequisitionStock(requisitionIssueDtoList);
// 请求数据取得 // 请求数据取得
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0)); List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
if (!requestList.isEmpty()) { if (!requestList.isEmpty()) {
@@ -328,4 +350,73 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
} }
} }
} }
/**
* 校验领用数量是否超过源仓库实际库存
*
* @param requisitionIssueDtoList 领用出库单据列表
*/
private void validateRequisitionStock(List<IssueDto> requisitionIssueDtoList) {
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
for (IssueDto issueDto : requisitionIssueDtoList) {
Long itemId = issueDto.getItemId();
String lotNumber = issueDto.getLotNumber();
Long sourceLocationId = issueDto.getSourceLocationId();
BigDecimal reqQuantity = issueDto.getItemQuantity();
String itemUnit = issueDto.getUnitCode();
String itemTable = issueDto.getItemTable();
// 根据物品类型查询定义信息(拆零比、常规单位、最小单位)
BigDecimal partPercent = BigDecimal.ONE;
String unitCode = itemUnit;
String minUnitCode = itemUnit;
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
MedicationDefinition medDef = medicationDefinitionService.getById(itemId);
if (medDef != null) {
unitCode = medDef.getUnitCode();
minUnitCode = medDef.getMinUnitCode();
if (medDef.getPartPercent() != null) {
partPercent = medDef.getPartPercent();
}
}
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(itemTable)) {
DeviceDefinition devDef = deviceDefinitionService.getById(itemId);
if (devDef != null) {
unitCode = devDef.getUnitCode();
minUnitCode = devDef.getMinUnitCode();
if (devDef.getPartPercent() != null) {
partPercent = devDef.getPartPercent();
}
}
}
// 计算领用数量折合最小单位的值
BigDecimal reqQuantityInMinUnit;
if (itemUnit.equals(unitCode)) {
// 领用单位 = 包装单位,需乘以拆零比
reqQuantityInMinUnit = reqQuantity.multiply(partPercent);
} else {
// 领用单位 = 最小单位,无需换算
reqQuantityInMinUnit = reqQuantity;
}
// 查询源仓库实际库存(按物品编号、批号、仓库匹配)
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
itemId, lotNumber, sourceLocationId, tenantId);
// 累加匹配批号的总库存库存表quantity字段为最小单位
BigDecimal totalStock = BigDecimal.ZERO;
for (InventoryItem inventoryItem : inventoryItemList) {
if (inventoryItem.getLocationId().equals(sourceLocationId)) {
totalStock = totalStock.add(inventoryItem.getQuantity());
}
}
// 比较领用数量与库存
if (reqQuantityInMinUnit.compareTo(totalStock) > 0) {
throw new ServiceException("操作失败,库存数量不足");
}
}
}
} }

View File

@@ -90,18 +90,26 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
// 逐个校验activityList中的项目是否都配置了执行科室并收集positionId供后续使用 // 逐个校验activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据 // 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
// 🔧 Bug #516: 优先使用前端传入的positionId用户手动选择的发往科室仅在未选择时使用配置的执行科室
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList(); List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致 // 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>(); java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
if (activityList != null && !activityList.isEmpty()) { if (activityList != null && !activityList.isEmpty()) {
for (ActivitySaveDto activitySaveDto : activityList) { for (ActivitySaveDto activitySaveDto : activityList) {
Long positionId = activityOrganizationConfig.stream() // 优先使用前端传入的positionId用户手动选择的科室
Long frontendPositionId = activitySaveDto.getPositionId();
if (frontendPositionId != null) {
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
continue;
}
// 前端未传入时,使用配置的执行科室
Long configPositionId = activityOrganizationConfig.stream()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId())) .filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null); .map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (positionId == null) { if (configPositionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室"); throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
} }
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), positionId); activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
} }
} }

View File

@@ -811,4 +811,29 @@
LIMIT 1 LIMIT 1
</select> </select>
<!-- 手术项目专用分页查询:仅查手术 + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
<select id="getSurgeryPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
SELECT
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.name ASC
</select>
</mapper> </mapper>

View File

@@ -134,7 +134,11 @@
T2.yb_no, T2.yb_no,
T1.onset_date AS onsetDate, T1.onset_date AS onsetDate,
T1.diagnosis_time AS diagnosisTime, T1.diagnosis_time AS diagnosisTime,
T1.doctor AS diagnosisDoctor T1.doctor AS diagnosisDoctor,
CASE WHEN EXISTS (
SELECT 1 FROM infectious_card T4
WHERE T4.diag_id = T2.id AND T4.delete_flag = '0' AND T4.status >= 1
) THEN 1 ELSE 0 END AS hasInfectiousReport
FROM adm_encounter_diagnosis AS T1 FROM adm_encounter_diagnosis AS T1
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
AND T2.delete_flag = '0' AND T2.tcm_flag = 0 AND T2.delete_flag = '0' AND T2.tcm_flag = 0

View File

@@ -280,9 +280,13 @@
aa.balance_amount aa.balance_amount
) AS personal_account ) AS personal_account
ON personal_account.encounter_id = ae.id ON personal_account.encounter_id = ae.id
LEFT JOIN med_medication_dispense mmd LEFT JOIN LATERAL (
ON mmd.med_req_id = T1.id SELECT status_enum
AND mmd.delete_flag = '0' FROM med_medication_dispense
WHERE med_req_id = T1.id AND delete_flag = '0'
ORDER BY create_time DESC
LIMIT 1
) mmd ON true
WHERE T1.delete_flag = '0' WHERE T1.delete_flag = '0'
AND T1.refund_medicine_id IS NULL AND T1.refund_medicine_id IS NULL
AND T1.generate_source_enum = #{doctorPrescription} AND T1.generate_source_enum = #{doctorPrescription}
@@ -301,28 +305,28 @@
T1.occurrence_end_time AS end_time, T1.occurrence_end_time AS end_time,
T1.requester_id AS requester_id, T1.requester_id AS requester_id,
T1.create_time AS request_time, T1.create_time AS request_time,
NULL AS skin_test_flag, NULL::integer AS skin_test_flag,
NULL AS inject_flag, NULL::integer AS inject_flag,
NULL AS group_id, NULL::bigint AS group_id,
T1.performer_check_id, T1.performer_check_id,
T2."name" AS advice_name, T2."name" AS advice_name,
T2.id AS item_id, T2.id AS item_id,
NULL AS volume, NULL::varchar AS volume,
NULL AS lot_number, NULL::varchar AS lot_number,
T1.quantity AS quantity, T1.quantity AS quantity,
T1.unit_code AS unit_code, T1.unit_code AS unit_code,
T1.status_enum AS request_status, T1.status_enum AS request_status,
NULL AS method_code, NULL::varchar AS method_code,
NULL AS rate_code, NULL::varchar AS rate_code,
NULL AS dose, NULL::numeric AS dose,
NULL AS dose_unit_code, NULL::varchar AS dose_unit_code,
ao1.id AS position_id, ao1.id AS position_id,
ao1."name" AS position_name, ao1."name" AS position_name,
NULL AS dispense_per_duration, NULL::integer AS dispense_per_duration,
1 AS part_percent, 1::numeric AS part_percent,
ccd."name" AS condition_definition_name, ccd."name" AS condition_definition_name,
T1.therapy_enum AS therapy_enum, T1.therapy_enum AS therapy_enum,
NULL AS sort_number, NULL::integer AS sort_number,
T1.quantity AS execute_num, T1.quantity AS execute_num,
af.day_times, af.day_times,
ae.bus_no, ae.bus_no,
@@ -337,7 +341,7 @@
personal_account.balance_amount, personal_account.balance_amount,
personal_account.id AS account_id, personal_account.id AS account_id,
T2.category_code, T2.category_code,
NULL AS dispense_status NULL::integer AS dispense_status
FROM wor_service_request AS T1 FROM wor_service_request AS T1
LEFT JOIN wor_activity_definition AS T2 LEFT JOIN wor_activity_definition AS T2
ON T2.id = T1.activity_id ON T2.id = T1.activity_id

View File

@@ -8,20 +8,25 @@
SELECT drf.id AS request_form_id, SELECT drf.id AS request_form_id,
drf.encounter_id, drf.encounter_id,
drf.prescription_no, drf.prescription_no,
drf.NAME, COALESCE(
(SELECT STRING_AGG(DISTINCT wad.name, '、')
FROM wor_service_request wsr2
LEFT JOIN wor_activity_definition wad ON wad.id = wsr2.activity_id AND wad.delete_flag = '0'
WHERE wsr2.prescription_no = drf.prescription_no AND wsr2.delete_flag = '0'),
drf.name
) AS name,
drf.desc_json, drf.desc_json,
drf.requester_id, drf.requester_id,
drf.create_time, drf.create_time,
ap.NAME AS patient_name, ap.NAME AS patient_name,
CASE MIN(wsr.status_enum) CASE
WHEN 1 THEN 0 WHEN MIN(wsr.status_enum) = 1 THEN 0
WHEN 2 THEN 1 WHEN MIN(wsr.status_enum) = 2 THEN 1
WHEN 3 THEN 4 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 4 THEN 4 WHEN MIN(wsr.status_enum) = 3 THEN 4
WHEN 5 THEN 5 WHEN MIN(wsr.status_enum) = 4 THEN 3
WHEN 6 THEN 5 WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
WHEN 7 THEN 5 WHEN MIN(wsr.status_enum) = 8 THEN 6
WHEN 8 THEN 6
ELSE NULL ELSE NULL
END AS status END AS status
FROM doc_request_form AS drf FROM doc_request_form AS drf
@@ -41,15 +46,14 @@
AND drf.create_time &lt;= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second') AND drf.create_time &lt;= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND CASE MIN(wsr.status_enum) AND CASE
WHEN 1 THEN 0 WHEN MIN(wsr.status_enum) = 1 THEN 0
WHEN 2 THEN 1 WHEN MIN(wsr.status_enum) = 2 THEN 1
WHEN 3 THEN 4 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 4 THEN 4 WHEN MIN(wsr.status_enum) = 3 THEN 4
WHEN 5 THEN 5 WHEN MIN(wsr.status_enum) = 4 THEN 3
WHEN 6 THEN 5 WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
WHEN 7 THEN 5 WHEN MIN(wsr.status_enum) = 8 THEN 6
WHEN 8 THEN 6
ELSE NULL ELSE NULL
END = #{status}::integer END = #{status}::integer
</if> </if>
@@ -164,7 +168,7 @@
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%') AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
</if> </if>
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''"> <if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
AND drf.type_code = #{requestFormDto.typeCode} AND drf.type_code IN (#{requestFormDto.typeCode}, 'SURGERY')
</if> </if>
<if test="requestFormDto.applyTimeStart != null"> <if test="requestFormDto.applyTimeStart != null">
AND drf.create_time >= #{requestFormDto.applyTimeStart} AND drf.create_time >= #{requestFormDto.applyTimeStart}

View File

@@ -49,6 +49,11 @@ public enum RequestStatus implements HisEnumInterface {
*/ */
ENDED(7, "ended", "不执行"), ENDED(7, "ended", "不执行"),
/**
* 已出报告
*/
COMPLETED_REPORT(8, "completed_report", "已出报告"),
/** /**
* 未知 * 未知
*/ */

View File

@@ -692,6 +692,7 @@ async function handleFoodDiseasesCheck() {
/** /**
* 传染病报告卡处理 * 传染病报告卡处理
* 通过诊断名称自动识别并勾选传染病报告卡中的疾病 * 通过诊断名称自动识别并勾选传染病报告卡中的疾病
* 修复 Bug #519跳过已有已提交报卡的诊断
*/ */
function handleInfectiousDiseaseReport() { function handleInfectiousDiseaseReport() {
// 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表) // 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表)
@@ -743,8 +744,9 @@ function handleInfectiousDiseaseReport() {
'手足口病': '0311', '手足口病': '0311',
}; };
// 获取所有诊断名称对应的报卡编码 // 获取所有诊断名称对应的报卡编码,但跳过已有已提交报卡的诊断
const allSelectedDiseases = form.value.diagnosisList const allSelectedDiseases = form.value.diagnosisList
.filter(d => d.name && d.hasInfectiousReport !== 1)
.map(d => diseaseNameToCode[d.name] || null) .map(d => diseaseNameToCode[d.name] || null)
.filter(code => code); .filter(code => code);
@@ -752,9 +754,9 @@ function handleInfectiousDiseaseReport() {
return; return;
} }
// 优先使用主诊断 // 优先使用主诊断(同样跳过已有报卡的)
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1); const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1 && d.hasInfectiousReport !== 1);
const firstDiagnosis = form.value.diagnosisList[0]; const firstDiagnosis = form.value.diagnosisList.find(d => d.hasInfectiousReport !== 1) || form.value.diagnosisList[0];
const diagnosisToShow = { const diagnosisToShow = {
...(mainDiagnosis || firstDiagnosis), ...(mainDiagnosis || firstDiagnosis),

View File

@@ -1034,6 +1034,17 @@ function normalizeSex(value) {
return '未知'; return '未知';
} }
function normalizeSexFromPatientInfo(patientInfo) {
// 优先使用文本字段
if (patientInfo.genderEnum_enumText) return patientInfo.genderEnum_enumText;
if (patientInfo.genderName) return patientInfo.genderName;
if (patientInfo.sex) return normalizeSex(patientInfo.sex);
// 使用数字枚举字段
if (patientInfo.genderEnum === 1) return '男';
if (patientInfo.genderEnum === 2) return '女';
return '未知';
}
function normalizeAgeUnit(value) { function normalizeAgeUnit(value) {
const ageUnitMap = { const ageUnitMap = {
1: '岁', 1: '岁',
@@ -1295,7 +1306,7 @@ async function show(diagnosisData) {
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名 patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
parentName: '', // 家长姓名14岁以下患者必填 parentName: '', // 家长姓名14岁以下患者必填
idNo: patientInfo.idCard, // 身份证号 idNo: patientInfo.idCard, // 身份证号
sex: patientInfo.sex || patientInfo.genderName || '男', // 性别 sex: normalizeSexFromPatientInfo(patientInfo), // 性别
// 出生日期信息 // 出生日期信息
birthYear: birthInfo.year, // 出生年份 birthYear: birthInfo.year, // 出生年份

View File

@@ -1226,22 +1226,18 @@ function handleRowClick(row) {
selectedItems.value = []; selectedItems.value = [];
activeDetailTab.value = 'applyForm'; activeDetailTab.value = 'applyForm';
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => { request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
// 响应结构判定:Axios拦截器对 code===200 返回 res.dataAjaxResult体 // 响应结构: Axios拦截器对code===200返回res.dataAjaxResult体
// 但某些情况下可能返回完整 Axios 响应 {data: AjaxResult}。 // 结构为 { code: 200, data: examApply实体, items: [明细数组] }
// 用 res.code 判定是否已是 AjaxResult 体,避免二次解包导致 items 丢失。 const items = Array.isArray(res.items) ? res.items : [];
const isAjaxResult = res && typeof res === 'object' && res.code !== undefined; const dataObj = res.data || {};
const ajaxBody = isAjaxResult ? res : (res.data || res);
// items 在 AjaxResult 顶层data 字段是 ExamApply 实体 // 先填充表单字段
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : []; if (dataObj && typeof dataObj === 'object') Object.assign(form, dataObj);
const detailData = ajaxBody.data || {};
if (detailData && typeof detailData === 'object') Object.assign(form, detailData); if (items.length > 0) {
if (rawItems.length > 0) {
try { try {
// 为每个项目加载检查方法 // 为每个项目加载检查方法
const itemsWithMethods = await Promise.all(rawItems.map(async m => { const itemsWithMethods = await Promise.all(items.map(async m => {
const item = { const item = {
id: m.itemCode, name: m.itemName, id: m.itemCode, name: m.itemName,
price: m.itemFee || 0, quantity: 1, price: m.itemFee || 0, quantity: 1,
@@ -1260,7 +1256,7 @@ function handleRowClick(row) {
if (m.bodyPartCode) { if (m.bodyPartCode) {
try { try {
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode }); const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
// Bug #384修复: 正确解析 API 返回结构 // 正确解析 API 返回结构
let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes; let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes;
if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) { if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) {
methodData = methodRes.data.data; methodData = methodRes.data.data;
@@ -1270,16 +1266,15 @@ function handleRowClick(row) {
id: md.id, id: md.id,
name: md.name, name: md.name,
code: md.code, code: md.code,
price: m.itemFee || 0, // fallback 到已保存的价格 price: m.itemFee || 0,
packageName: md.packageName || '', packageName: md.packageName || '',
packageId: md.packageId || null, packageId: md.packageId || null,
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格 packagePrice: md.packagePrice || null,
serviceFee: md.serviceFee || null serviceFee: md.serviceFee || null
})); }));
// 如果有已保存的检查方法信息,尝试匹配 // 回充已保存的检查方法
if (m.checkMethodId) { if (m.checkMethodId) {
item.selectedMethod = item.methods.find(md => md.id === m.checkMethodId) || null; item.selectedMethod = item.methods.find(md => String(md.id) === String(m.checkMethodId)) || null;
// 从已保存的方法中获取套餐信息
if (item.selectedMethod?.packageId) { if (item.selectedMethod?.packageId) {
item.isPackage = true; item.isPackage = true;
item.packageId = item.selectedMethod.packageId; item.packageId = item.selectedMethod.packageId;
@@ -1295,22 +1290,27 @@ function handleRowClick(row) {
} }
} catch (err) { } catch (err) {
console.error('加载检查方法失败', err); console.error('加载检查方法失败', err);
// 单个项目加载失败不影响其他项目,继续返回 item
} }
} }
return item; return item;
})); }));
// Bug #408修复: 确保明细数据正确加载到selectedItems
selectedItems.value = itemsWithMethods; selectedItems.value = itemsWithMethods;
// 加载套餐明细(单个失败不影响其他项目和明细显示)
for (const it of selectedItems.value) { for (const it of selectedItems.value) {
if (getPackageCarrier(it)?.packageId) { if (getPackageCarrier(it)?.packageId) {
await loadPackageDetailsForItem(it); try {
await loadPackageDetailsForItem(it);
} catch (e) {
console.error('加载套餐明细失败:', it.name, e);
}
} }
it.expanded = !!getPackageCarrier(it)?.packageId; it.expanded = !!getPackageCarrier(it)?.packageId;
} }
syncCategoryChecked(); syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示 // Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay(); updateMethodDisplay();
// 修复【#408】加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见 // Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
activeDetailTab.value = 'applyDetail'; activeDetailTab.value = 'applyDetail';
} catch (err) { } catch (err) {
console.error('加载申请单详情失败', err); console.error('加载申请单详情失败', err);

View File

@@ -56,6 +56,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" /> <el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" />
<el-table-column label="单据状态" prop="applyStatus" width="100" align="center" header-align="center">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.applyStatus)" size="small">
{{ getStatusLabel(scope.row.applyStatus, scope.row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center"> <el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center">
<template #default="scope"> <template #default="scope">
<span>{{ scope.row.itemName }}</span> <span>{{ scope.row.itemName }}</span>
@@ -1445,6 +1452,26 @@ const formatAmount = (amount) => {
return num.toFixed(2) return num.toFixed(2)
} }
// 单据状态标签文字
const getStatusLabel = (applyStatus, row) => {
// applyStatus: 0=待开立, 1=已开立(已签发)
// 结合收费/执行标记推导更丰富的状态
if (applyStatus === 1) {
// 已收费后根据执行标记判断
if (row.needExecute === true) {
return '已执行'
}
return '已开立'
}
return '待开立'
}
// 单据状态标签颜色
const getStatusType = (applyStatus) => {
if (applyStatus === 1) return 'success'
return 'info'
}
// 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss // 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss
const formatDateTime = (date) => { const formatDateTime = (date) => {
if (!date) return '' if (!date) return ''

View File

@@ -3591,13 +3591,10 @@ async function setValue(row) {
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31 prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
} else { } else {
// 诊疗类型adviceType == 3 // 诊疗类型adviceType == 3
// 🔧 Bug Fix #238: 诊疗项目默认使用患者就诊科室 // 🔧 Bug #455: 诊疗项目执行科室强制使用患者就诊科室
if (!prescriptionList.value[rowIndex.value].orgId) { // 不使用目录配置的执行科室可能是错误ID或占位符导致显示原始ID
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId; prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
} prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo.orgId) || props.patientInfo.orgName || '';
if (!prescriptionList.value[rowIndex.value].positionName) {
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(prescriptionList.value[rowIndex.value].orgId) || props.patientInfo.orgName || '';
}
// 🔧 Bug #218 修复使用组套中维护的quantity如果没有则默认1 // 🔧 Bug #218 修复使用组套中维护的quantity如果没有则默认1
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1; prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
// 🔧 Bug #144 修复:安全访问 priceList防止 orderDetailInfos 为空时出错 // 🔧 Bug #144 修复:安全访问 priceList防止 orderDetailInfos 为空时出错

View File

@@ -1142,7 +1142,8 @@ function submitForm() {
// 保存麻醉方式 // 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum) sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false open.value = false
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表 getList() // 提交成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
} else { } else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息') proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
} }
@@ -1158,7 +1159,8 @@ function submitForm() {
// 保存麻醉方式 // 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum) sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false open.value = false
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表 getList() // 修改成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
} else { } else {
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息') proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
} }

View File

@@ -86,7 +86,11 @@
</template> </template>
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="patientName" label="患者姓名" width="120" /> <el-table-column prop="patientName" label="患者姓名" width="120" />
<el-table-column prop="name" label="申请单名称" width="140" /> <el-table-column label="申请单名称" width="140">
<template #default="scope">
<span>{{ buildApplicationName(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="160" /> <el-table-column prop="createTime" label="创建时间" width="160" />
<el-table-column prop="prescriptionNo" label="申请单号" width="140" /> <el-table-column prop="prescriptionNo" label="申请单号" width="140" />
<el-table-column prop="requesterId_dictText" label="申请者" width="120" /> <el-table-column prop="requesterId_dictText" label="申请者" width="120" />
@@ -429,6 +433,23 @@ const parseStatus = (status) => {
return statusMap[String(status)] || '-'; return statusMap[String(status)] || '-';
}; };
/**
* 根据申请单详情构建申请单名称
* 单一项目:显示项目名称
* 多个项目:显示首个项目名称+"等X项"
*/
const buildApplicationName = (row) => {
const details = row.requestFormDetailList;
if (!details || details.length === 0) {
return row.name || '-';
}
if (details.length === 1) {
return details[0].adviceName || row.name || '-';
}
const first = details[0];
return `${first.adviceName || ''}${details.length}`;
};
/** /**
* 获取状态标签类型 - 参考临床医嘱样式 * 获取状态标签类型 - 参考临床医嘱样式
* @param {string|number} status - 状态码 * @param {string|number} status - 状态码
@@ -513,6 +534,30 @@ const findTreeItem = (list, id) => {
return null; return null;
}; };
const recursionFun = (targetDepartment) => {
if (!targetDepartment) return '';
let name = '';
for (let index = 0; index < orgOptions.value.length; index++) {
const obj = orgOptions.value[index];
if (obj.id == targetDepartment) {
name = obj.name;
break;
}
const subObjArray = obj['children'];
if (subObjArray && subObjArray.length > 0) {
for (let i = 0; i < subObjArray.length; i++) {
const item = subObjArray[i];
if (item.id == targetDepartment) {
name = item.name;
break;
}
}
}
if (name) break;
}
return name;
};
const handleViewDetail = async (row) => { const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称 // 确保科室数据已加载,以便将 ID 解析为名称
if (!orgOptions.value || orgOptions.value.length === 0) { if (!orgOptions.value || orgOptions.value.length === 0) {
@@ -526,8 +571,7 @@ const handleViewDetail = async (row) => {
const obj = JSON.parse(row.descJson); const obj = JSON.parse(row.descJson);
// 将发往科室 ID 转换为名称 // 将发往科室 ID 转换为名称
if (obj.targetDepartment) { if (obj.targetDepartment) {
const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment); obj.targetDepartment = recursionFun(obj.targetDepartment);
obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment;
} }
descJsonData.value = obj; descJsonData.value = obj;
} catch (e) { } catch (e) {

View File

@@ -1,6 +1,15 @@
import request from '@/utils/request'; import request from '@/utils/request';
// 申请单相关接口 // 申请单相关接口
// 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存等无关逻辑)
export function getSurgeryPage(params) {
return request({
url: '/doctor-station/advice/surgery-page',
method: 'get',
params: params,
});
}
//医嘱大下拉 //医嘱大下拉
export function getApplicationList(queryParams) { export function getApplicationList(queryParams) {
return request({ return request({

View File

@@ -325,7 +325,12 @@ const projectWithDepartment = (selectProjectIds, type) => {
} }
} }
if (findItem && isRelease) { if (findItem && isRelease) {
form.targetDepartment = findItem.id; // 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
if (type === 2 && manualDept) {
form.targetDepartment = manualDept;
} else {
form.targetDepartment = findItem.id;
}
} }
} }
return isRelease; return isRelease;
@@ -392,7 +397,7 @@ const submit = () => {
unitCode: item.priceList[0].unitCode /** 请求单位编码 */, unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
unitPrice: item.priceList[0].price /** 单价 */, unitPrice: item.priceList[0].price /** 单价 */,
totalPrice: item.priceList[0].price /** 总价 */, totalPrice: item.priceList[0].price /** 总价 */,
positionId: item.positionId || form.targetDepartment, //执行科室id未配置时使用用户手动选择的科室 positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
ybClassEnum: item.ybClassEnum, //类别医保编码 ybClassEnum: item.ybClassEnum, //类别医保编码
conditionId: item.conditionId, //诊断ID conditionId: item.conditionId, //诊断ID
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id

View File

@@ -274,7 +274,7 @@ const getList = () => {
} }
loading.value = true; loading.value = true;
getApplicationList({ getApplicationList({
pageSize: 500, pageSize: 5000,
pageNum: 1, pageNum: 1,
categoryCode: '23', categoryCode: '23',
organizationId: effectivePatientInfo.value.inHospitalOrgId, organizationId: effectivePatientInfo.value.inHospitalOrgId,
@@ -542,9 +542,12 @@ const submit = () => {
let applicationListAllFilter = applicationListAll.value.filter((item) => { let applicationListAllFilter = applicationListAll.value.filter((item) => {
return transferValue.value.includes(item.adviceDefinitionId); return transferValue.value.includes(item.adviceDefinitionId);
}); });
// 从原始记录中提取检查项目名称,用于申请单名称字段
const selectedNames = applicationListAllFilter.map(item => item.adviceName).join('+');
applicationListAllFilter = applicationListAllFilter.map((item) => { applicationListAllFilter = applicationListAllFilter.map((item) => {
return { return {
adviceDefinitionId: item.adviceDefinitionId, adviceDefinitionId: item.adviceDefinitionId,
adviceName: item.adviceName,
quantity: 1, quantity: 1,
unitCode: item.priceList[0].unitCode, unitCode: item.priceList[0].unitCode,
unitPrice: item.priceList[0].price, unitPrice: item.priceList[0].price,
@@ -572,7 +575,7 @@ const submit = () => {
encounterId: effectivePatientInfo.value.encounterId, encounterId: effectivePatientInfo.value.encounterId,
organizationId: effectivePatientInfo.value.inHospitalOrgId, organizationId: effectivePatientInfo.value.inHospitalOrgId,
requestFormId: requestFormId, requestFormId: requestFormId,
name: applicationListAllFilter.map(item => item.adviceName).join('、'), name: selectedNames,
descJson: JSON.stringify(submitForm), descJson: JSON.stringify(submitForm),
categoryEnum: '22', categoryEnum: '22',
}).then((res) => { }).then((res) => {

View File

@@ -5,13 +5,27 @@
--> -->
<template> <template>
<div class="surgery-container"> <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 <el-transfer
ref="transferRef"
v-model="transferValue" v-model="transferValue"
:data="applicationList" :data="applicationList"
filter-placeholder="项目代码/名称" :titles="['待选择', '已选择']"
filterable :format="leftPanelFormat"
:titles="['未选择', '已选择']"
/> />
</div> </div>
<div class="bloodTransfusion-form"> <div class="bloodTransfusion-form">
@@ -78,17 +92,26 @@
</div> </div>
</template> </template>
<script setup name="Surgery"> <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 {patientInfo} from '../../../store/patient.js';
import {getDepartmentList} from '@/api/public.js'; import {getDepartmentList} from '@/api/public.js';
import {getEncounterDiagnosis} from '../../api.js'; import {getEncounterDiagnosis} from '../../api.js';
import {getApplicationList, saveSurgery} from './api'; import {getSurgeryPage, saveSurgery} from './api';
import {ElMessage} from 'element-plus'; import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表 // 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
let surgeryRecordsCache = null; // 原始 API 记录 let surgeryRecordsCache = null; // 原始 API 记录
let surgeryMappedCache = null; // 映射后的 el-transfer 数据 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) => { const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null; if (!list || list.length === 0) return null;
@@ -108,55 +131,82 @@ const applicationListAll = ref();
const applicationList = ref(); const applicationList = ref();
const orgOptions = ref([]); // 科室选项 const orgOptions = ref([]); // 科室选项
const loading = ref(false); // 加载状态 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 = () => { const getList = () => {
if (!patientInfo.value?.inHospitalOrgId) { if (!patientInfo.value?.inHospitalOrgId) {
applicationList.value = []; applicationList.value = [];
return; return;
} }
// 命中缓存时直接使用,避免重复请求导致加载缓慢 // 命中内存缓存时直接使用
if (surgeryMappedCache && surgeryMappedCache.length > 0) { if (surgeryMappedCache && surgeryMappedCache.length > 0) {
applicationList.value = surgeryMappedCache; applicationList.value = surgeryMappedCache;
applicationListAll.value = surgeryRecordsCache; applicationListAll.value = surgeryRecordsCache;
return; return;
} }
loadPage('');
};
/**
* 加载手术项目分页数据
* @param {string} key 搜索关键字(可选)
*/
const loadPage = (key) => {
const orgId = patientInfo.value.inHospitalOrgId;
loading.value = true; loading.value = true;
getApplicationList({ getSurgeryPage({ organizationId: orgId, pageNo: 1, pageSize: 100, searchKey: key || '' })
pageSize: 500,
pageNum: 1,
categoryCode: '24',
organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3, 6], //1 药品 2耗材 3诊疗 6手术
})
.then((res) => { .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 || '';
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);
applicationList.value = []; 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.map(mapToTransferItem);
// 仅在无搜索时缓存
if (!key) {
surgeryRecordsCache = records;
surgeryMappedCache = applicationList.value;
}
loading.value = false;
}) })
.catch((e) => { .catch((e) => {
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e); console.error('手术项目加载失败:', e);
applicationList.value = []; applicationList.value = [];
}) dbTotal.value = 0;
.finally(() => {
loading.value = false; 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 transferValue = ref([]);
const form = reactive({ const form = reactive({
// categoryType: '', // 项目类别 // categoryType: '', // 项目类别
@@ -243,20 +293,15 @@ const submit = () => {
}); });
applicationListAllFilter = applicationListAllFilter.map((item) => { applicationListAllFilter = applicationListAllFilter.map((item) => {
return { return {
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */, adviceDefinitionId: item.adviceDefinitionId,
adviceDefinitionName: item.adviceDefinitionName /** 诊疗定义名称(手术项目名称) */, adviceDefinitionName: item.adviceName,
quantity: 1, // /** 请求数量 */ quantity: 1,
unitCode: item.priceList[0].unitCode /** 请求单位编码 */, unitCode: item.unitCode,
unitPrice: item.priceList[0].price /** 单价 */, unitPrice: item.price,
totalPrice: item.priceList[0].price /** 总价 */, totalPrice: item.price,
positionId: item.positionId, //执行科室id positionId: item.positionId,
ybClassEnum: item.ybClassEnum, //类别医保编码 definitionId: item.chargeItemDefinitionId,
conditionId: item.conditionId, //诊断ID accountId: patientInfo.value.accountId,
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
adviceType: item.adviceType, ///** 医嘱类型 */
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
accountId: patientInfo.value.accountId, // // 账户id
}; };
}); });
saveSurgery({ saveSurgery({

View File

@@ -1503,16 +1503,16 @@ function handleSaveBatch() {
} }
function setValue(row) { function setValue(row) {
// 构造单位列表 // 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
unitCodeList.value = [ unitCodeList.value = [
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' }, { value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
{ {
value: row.doseUnitCode, value: String(row.doseUnitCode ?? ''),
label: row.doseUnitCode_dictText, label: row.doseUnitCode_dictText,
type: 'dose', type: 'dose',
}, },
{ {
value: row.minUnitCode, value: String(row.minUnitCode ?? ''),
label: row.minUnitCode_dictText, label: row.minUnitCode_dictText,
type: 'minUnit', type: 'minUnit',
}, },
@@ -1577,9 +1577,9 @@ function setValue(row) {
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''), 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 // dose: undefined, Removed to preserve dose value from group package
unitCodeList: unitCodeList.value, unitCodeList: unitCodeList.value,
doseUnitCode: row.doseUnitCode, doseUnitCode: String(row.doseUnitCode ?? ''),
minUnitCode: row.minUnitCode, minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode, unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
categoryEnum: row.categoryCode, categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId, definitionId: row.chargeItemDefinitionId,
executeNum: 1, executeNum: 1,
@@ -1595,6 +1595,10 @@ function setValue(row) {
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6) ? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
: prevRow.minUnitPrice, : prevRow.minUnitPrice,
positionName: selectedStock?.locationName, positionName: selectedStock?.locationName,
// 🔧 Bug #523 修复:初始化 totalPrice 为 0避免总金额列显示为横杠
totalPrice: row.quantity
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
: '0',
} }
: { : {
quantity: 1, quantity: 1,

View File

@@ -19,11 +19,9 @@
<el-tab-pane label="检验申请" name="test"> <el-tab-pane label="检验申请" name="test">
<TestApplication ref="testApplicationRef" :show-status-column="true" /> <TestApplication ref="testApplicationRef" :show-status-column="true" />
</el-tab-pane> </el-tab-pane>
```vue
<el-tab-pane label="检查申请" name="examine"> <el-tab-pane label="检查申请" name="examine">
<ExamineApplication ref="examineApplicationRef" /> <ExamineApplication ref="examineApplicationRef" />
</el-tab-pane> </el-tab-pane>
```
<el-tab-pane label="汇总发药申请" name="summaryDrug"> <el-tab-pane label="汇总发药申请" name="summaryDrug">
<SummaryDrugApplication ref="summaryDrugApplicationRef" /> <SummaryDrugApplication ref="summaryDrugApplicationRef" />
</el-tab-pane> </el-tab-pane>
@@ -49,6 +47,7 @@
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue'; import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
import Emr from './emr/index.vue'; import Emr from './emr/index.vue';
import SummaryDrugApplication from './components/applicationShow/summaryDrugApplication.vue';
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue'; import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
import PatientList from '@/components/PatientList/patient-list.vue'; import PatientList from '@/components/PatientList/patient-list.vue';
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient'; import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
@@ -84,6 +83,7 @@ const currentPatientInfo = ref({});
const testApplicationRef = ref(); const testApplicationRef = ref();
const examineApplicationRef = ref(); const examineApplicationRef = ref();
const surgeryApplicationRef = ref(); const surgeryApplicationRef = ref();
const summaryDrugApplicationRef = ref();
const bloodTtransfusionAapplicationRef = ref(); const bloodTtransfusionAapplicationRef = ref();
// 患者列表相关逻辑 // 患者列表相关逻辑

View File

@@ -251,7 +251,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 划价组套选择对话框 --> <!-- 划价组套选择对话框 -->
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body> <el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000">
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px"> <div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
<el-input <el-input
v-model="groupSetSearchText" v-model="groupSetSearchText"
@@ -606,21 +606,26 @@ function getItemType_Text(type) {
return map[type] || '其他'; return map[type] || '其他';
} }
function getUnitCodeOptions(row) { function getUnitCodeOptions(row) {
const unitCodes = [ const unitCodes = [];
{ code: row.unitCode != null ? String(row.unitCode) : null, codeText: row.unitCode_dictText }, // 大单位:优先用 codecode 缺失时用字典文本兜底
{ code: row.minUnitCode != null ? String(row.minUnitCode) : null, codeText: row.minUnitCode_dictText }, if (row.unitCode != null && String(row.unitCode) !== '') {
]; unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText });
// 过滤掉 code 为空的单位选项 } else if (row.unitCode_dictText) {
const validUnitCodes = unitCodes.filter(item => item.code != null && item.code !== ''); unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText });
// 使用 Set 来跟踪已经存在的 code }
// 小单位:同上
if (row.minUnitCode != null && String(row.minUnitCode) !== '') {
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText });
} else if (row.minUnitCode_dictText) {
unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText });
}
// 去重
const seenCodes = new Set(); const seenCodes = new Set();
const uniqueUnitCodes = validUnitCodes.filter((item) => { const uniqueUnitCodes = unitCodes.filter((item) => {
// 如果 Set 中没有这个 code就保留它并把它加入 Set
if (!seenCodes.has(item.code)) { if (!seenCodes.has(item.code)) {
seenCodes.add(item.code); seenCodes.add(item.code);
return true; return true;
} }
// 如果已经存在,就过滤掉
return false; return false;
}); });
return uniqueUnitCodes; return uniqueUnitCodes;

View File

@@ -463,20 +463,45 @@ function watchPatientSelection() {
}, 300); }, 300);
} }
/** 查询科室 */ /** 查询科室(支持树形/扁平多种响应结构) */
const getLocationInfo = () => { const getLocationInfo = () => {
getOrgList().then((res) => { getOrgList().then((res) => {
orgOptions.value = res.data?.records[0]?.children; if (!res.data) {
orgOptions.value = [];
return;
}
// 尝试从树形结构取records[0].children
if (res.data.records && res.data.records.length > 0) {
if (res.data.records[0].children && res.data.records[0].children.length > 0) {
orgOptions.value = res.data.records[0].children;
return;
}
// 如果 records[0] 有 id 和 name非树根节点直接用所有 records
if (res.data.records[0].id) {
orgOptions.value = res.data.records;
return;
}
}
// 兜底:如果 data 本身是数组
if (Array.isArray(res.data)) {
orgOptions.value = res.data;
return;
}
orgOptions.value = [];
}).catch(() => {
console.warn('科室列表加载失败(可能无权限)');
orgOptions.value = [];
}); });
}; };
getLocationInfo(); getLocationInfo();
// 映射 // 映射(查找失败时返回 '-' 而非显示内码)
const selectOrg = (itemid) => { const selectOrg = (itemid) => {
if (!itemid) return '-';
const item = orgOptions.value.find((item) => { const item = orgOptions.value.find((item) => {
return item.id == itemid; return item.id == itemid;
}); });
return item?.name; return item?.name || '-';
}; };
// 重置 // 重置
const onReset = () => { const onReset = () => {

View File

@@ -1057,8 +1057,8 @@ function confirmCharge() {
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD'); params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
addVitalSigns(params).then(res => { addVitalSigns(params).then(res => {
console.log('保存成功:', res);
if (res.code === 200) { if (res.code === 200) {
proxy.msgSuccess('保存成功');
// 保存成功后刷新列表 // 保存成功后刷新列表
getPatientList(); getPatientList();
// 清空表单 // 清空表单
@@ -1087,8 +1087,6 @@ function confirmCharge() {
urineVolume: '', urineVolume: '',
stoolVolume: '', stoolVolume: '',
}; };
// 保存成功后关闭弹窗
closeDialog();
} }
}); });
} }

View File

@@ -534,6 +534,7 @@ const userStore = useUserStore();
const openTraceNoDialog = ref(false) const openTraceNoDialog = ref(false)
const rowData = ref({}) const rowData = ref({})
const ypName = ref('') const ypName = ref('')
const currentIndex = ref(-1)
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } = const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
@@ -1072,13 +1073,6 @@ function onHeaderWarehouseChange() {
// 选择仓库 / 选药品后拉取该仓库存 // 选择仓库 / 选药品后拉取该仓库存
function handleLocationClick(item, row, index) { function handleLocationClick(item, row, index) {
getCount({
itemId: form.purchaseinventoryList[index].itemId,
orgLocationId: form.purchaseinventoryList[index].sourceLocationId,
}).then((res) => {
if (res.data && res.data.length > 0) {
form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || '';
form.purchaseinventoryList[index].totalQuantity = res.data[0].orgQuantity || 0;
const r = form.purchaseinventoryList[index]; const r = form.purchaseinventoryList[index];
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || ''; let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
if (!orgLocationId) { if (!orgLocationId) {
@@ -1481,7 +1475,7 @@ function handleScan(row,index){
rowData.value = row rowData.value = row
rowData.value.itemType = receiptHeaderForm.medicationType rowData.value.itemType = receiptHeaderForm.medicationType
ypName.value = row.name ypName.value = row.name
openTraceNoDialog .value = true; openTraceNoDialog.value = true;
currentIndex.value = index currentIndex.value = index
} }
@@ -1704,6 +1698,17 @@ const exportRequiredParams = ref({
pageSize: 10, pageSize: 10,
busNo: route.query.supplyBusNo busNo: route.query.supplyBusNo
}); });
// 追溯码对话框提交处理
function submit(traceNoData) {
if (currentIndex.value >= 0 && form.purchaseinventoryList[currentIndex.value]) {
form.purchaseinventoryList[currentIndex.value].traceNo = traceNoData.traceNo;
form.purchaseinventoryList[currentIndex.value].ybNo = traceNoData.ybNo;
proxy.$message.success('追溯码保存成功');
}
openTraceNoDialog.value = false;
}
function handleExport() { function handleExport() {
proxy.downloadGet( proxy.downloadGet(
'/issue-manage/requisition/excel-out', '/issue-manage/requisition/excel-out',