35 Commits

Author SHA1 Message Date
关羽
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
关羽
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
30 changed files with 507 additions and 205 deletions

View File

@@ -200,9 +200,10 @@ public interface ICommonService {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
R<?> lotNumberMatch(List<Long> encounterIdList);
R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList);
/**
* 根据机构ID获取机构名称

View File

@@ -39,8 +39,10 @@ import com.openhis.web.common.dto.*;
import com.openhis.web.common.mapper.CommonAppMapper;
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
import com.openhis.workflow.domain.DeviceDispense;
import com.openhis.workflow.domain.DeviceRequest;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IInventoryItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,6 +101,9 @@ public class CommonServiceImpl implements ICommonService {
@Resource
private IDeviceDispenseService deviceDispenseService;
@Resource
private IDeviceRequestService deviceRequestService;
/**
* 获取药房列表
*
@@ -678,10 +683,11 @@ public class CommonServiceImpl implements ICommonService {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
@Override
public R<?> lotNumberMatch(List<Long> encounterIdList) {
public R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList) {
// 查询患者待发放的药品信息
List<MedicationDispense> medicationDispenseList = medicationDispenseService
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
@@ -798,10 +804,27 @@ public class CommonServiceImpl implements ICommonService {
}
}
// 查询患者待发放的耗材信息
List<DeviceDispense> deviceDispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
LambdaQueryWrapper<DeviceDispense> deviceDispenseQuery = new LambdaQueryWrapper<DeviceDispense>()
.in(DeviceDispense::getEncounterId, encounterIdList)
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode());
// 若传入requestIdList则仅查询与指定医嘱请求关联的耗材避免其他未执行医嘱的耗材记录干扰
if (requestIdList != null && !requestIdList.isEmpty()) {
List<Long> deviceReqIds = deviceRequestService
.list(new LambdaQueryWrapper<DeviceRequest>()
.in(DeviceRequest::getBasedOnId, requestIdList)
.eq(DeviceRequest::getBasedOnTable, CommonConstants.TableName.WOR_SERVICE_REQUEST))
.stream()
.map(DeviceRequest::getId)
.collect(java.util.stream.Collectors.toList());
if (!deviceReqIds.isEmpty()) {
deviceDispenseQuery.in(DeviceDispense::getDeviceReqId, deviceReqIds);
} else {
// 无关联的耗材请求,直接跳过耗材校验
deviceDispenseQuery.eq(DeviceDispense::getId, -1L);
}
}
List<DeviceDispense> deviceDispenseList = deviceDispenseService.list(deviceDispenseQuery);
// 耗材批号匹配
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
// 获取待发放的耗材id

View File

@@ -274,10 +274,13 @@ public class CommonAppController {
* 批号匹配
*
* @param encounterIdList 就诊id列表
* @param requestIdList 医嘱请求id列表可选用于限定仅校验与当前执行医嘱关联的耗材
* @return 处理结果
*/
@GetMapping("/lot-number-match")
public R<?> lotNumberMatch(@RequestParam(value = "encounterIdList") List<Long> encounterIdList) {
return commonService.lotNumberMatch(encounterIdList);
public R<?> lotNumberMatch(
@RequestParam(value = "encounterIdList") List<Long> encounterIdList,
@RequestParam(value = "requestIdList", required = false) List<Long> requestIdList) {
return commonService.lotNumberMatch(encounterIdList, requestIdList);
}
}

View File

@@ -728,8 +728,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
/**
* 处理耗材请求
* 🔧 BugFix #443: 签发时跳过 handDevice避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
*/
this.handDevice(deviceList, curDate, adviceOpType);
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
this.handDevice(deviceList, curDate, adviceOpType);
}
// 签发时,把草稿状态的账单更新为待收费
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
@@ -2103,11 +2107,9 @@ 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);
// 手术计费场景sourceBillNo 不为空时过滤掉药品1保留耗材2和诊疗3/6
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
&& dto.getAdviceType() == 1);
}
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态
requestBaseDto

View File

@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.*;
@@ -243,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
EncounterDiagnosis encounterDiagnosis;
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
encounterDiagnosis = new EncounterDiagnosis();
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
// 如果设置旧的 IDsaveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
encounterDiagnosis.setEncounterId(encounterId);
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
@@ -598,6 +602,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
InfectiousDiseaseReport infectiousDiseaseReport = new 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
*/

View File

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

View File

@@ -178,7 +178,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
inpatientAdviceParam.setEncounterIds(null);
Integer exeStatus = inpatientAdviceParam.getExeStatus();
inpatientAdviceParam.setExeStatus(null);
// requestStatus由前端tab控制后端SQL已通过CASE条件处理校对状态过滤无需再作为SQL条件
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
inpatientAdviceParam.setRequestStatus(null);
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper
@@ -198,7 +198,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), requestStatus);
inpatientAdvicePage.getRecords().forEach(e -> {
// 是否皮试
e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));

View File

@@ -69,5 +69,6 @@ public interface AdviceProcessAppMapper {
@Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor,
@Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp,
@Param("doctorPrescription") Integer doctorPrescription);
@Param("doctorPrescription") Integer doctorPrescription,
@Param("requestStatus") Integer requestStatus);
}

View File

@@ -3,29 +3,38 @@
*/
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.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.DeviceDefinition;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IDeviceDefinitionService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
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.inventorymanage.appservice.IRequisitionIssueAppService;
import com.openhis.web.inventorymanage.dto.*;
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.SupplyRequest;
import com.openhis.workflow.service.IInventoryItemService;
import com.openhis.workflow.service.ISupplyRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -48,6 +57,15 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
@Autowired
private IPractitionerService practitionerService;
@Autowired
private IInventoryItemService inventoryItemService;
@Autowired
private IMedicationDefinitionService medicationDefinitionService;
@Autowired
private IDeviceDefinitionService deviceDefinitionService;
@Autowired
private AssignSeqUtil assignSeqUtil;
@@ -167,6 +185,10 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
// 单据号取得
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
// 库存校验:领用数量不能超过源仓库实际库存
this.validateRequisitionStock(requisitionIssueDtoList);
// 请求数据取得
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
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

@@ -81,28 +81,35 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
Long requestFormId = requestFormSaveDto.getRequestFormId();
boolean isEdit = requestFormId != null && requestFormId != 0L;
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
if (activityOrganizationConfig.isEmpty()) {
throw new ServiceException("请先配置当前时间段的执行科室");
}
// 逐个校验activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 校验所有activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
if (activityList == null || activityList.isEmpty()) {
throw new ServiceException("请选择检查项目");
}
// 🔧 Bug #475: 查询诊疗执行科室配置
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
// 缓存校验结果,先全部验证通过后再进行数据库操作
// 优先使用前端传入的positionId用户手动选择的发往科室仅在未选择时使用配置的执行科室
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
if (activityList != null && !activityList.isEmpty()) {
for (ActivitySaveDto activitySaveDto : activityList) {
Long positionId = activityOrganizationConfig.stream()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (positionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
}
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), positionId);
for (ActivitySaveDto activitySaveDto : activityList) {
// 优先使用前端传入的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()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (configPositionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
}
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
}
// 诊疗处方号

View File

@@ -91,13 +91,15 @@
os.surgery_nature AS surgeryType,
cs.incision_level AS incisionLevel,
fc.contract_name AS feeType,
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
/* 只JOIN必要的价格表使用INNER JOIN避免笛卡尔积 */
INNER JOIN adm_charge_item_definition T2
/* 价格表使用LEFT JOIN避免因缺少价格记录导致搜索不到项目 */
LEFT JOIN adm_charge_item_definition T2
ON T1.id = T2.instance_id
AND T2.instance_table = 'wor_activity_definition'
/* 检验类型关联 */

View File

@@ -134,7 +134,11 @@
T2.yb_no,
T1.onset_date AS onsetDate,
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
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
AND T2.delete_flag = '0' AND T2.tcm_flag = 0

View File

@@ -290,6 +290,7 @@
WHERE T1.delete_flag = '0'
AND T1.refund_medicine_id IS NULL
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END
@@ -422,6 +423,7 @@
AND af.delete_flag = '0'
WHERE T1.delete_flag = '0'
AND T1.generate_source_enum = #{doctorPrescription}
AND T1.status_enum = #{requestStatus}
AND CASE WHEN T1.status_enum = #{draft}
THEN T1.performer_check_id IS NOT NULL
ELSE 1=1 END

View File

@@ -45,18 +45,6 @@
<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 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 = #{status}::integer
</if>
<if test="keyword != null and keyword != ''">
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
OR EXISTS (
@@ -72,12 +60,28 @@
</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
WHEN MIN(wsr.status_enum) = 1 THEN 0
WHEN MIN(wsr.status_enum) = 2 THEN 1
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
WHEN MIN(wsr.status_enum) = 3 THEN 4
WHEN MIN(wsr.status_enum) = 4 THEN 3
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
WHEN MIN(wsr.status_enum) = 8 THEN 6
ELSE NULL
END = #{status}::integer
</if>
</select>
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
SELECT wsr.quantity,
wsr.unit_code,
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
COALESCE(
wad.NAME,
wsr.content_json::jsonb->>'surgeryName',
'检验项目'
) AS advice_name,
aci.total_price
FROM wor_service_request AS wsr
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
@@ -87,6 +91,7 @@
AND aci.delete_flag = '0'
WHERE wsr.delete_flag = '0'
AND wsr.prescription_no = #{prescriptionNo}
ORDER BY wsr.id
</select>
<select id="getActivityOrganizationConfig"

View File

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

View File

@@ -389,7 +389,8 @@
</el-checkbox>
<span class="item-price">¥{{ item.price }}/{{ item.unit || "" }}</span>
</div>
<div v-if="categoryLoadingSet.has(cat.typeId)" class="category-loading-hint">
<!-- Bug #500修复: 使用 v-show + 占位符,避免加载提示出现/消失时高度跳变 -->
<div v-show="categoryLoadingSet.has(cat.typeId)" class="category-loading-hint">
加载中...
</div>
<!-- Bug #428修复: 渲染分类联动加载的检查方法列表 -->
@@ -1226,22 +1227,18 @@ function handleRowClick(row) {
selectedItems.value = [];
activeDetailTab.value = 'applyForm';
request({ url: `/exam/apply/${row.applyNo}`, method: 'get' }).then(async res => {
// 响应结构判定:Axios拦截器对 code===200 返回 res.dataAjaxResult体
// 但某些情况下可能返回完整 Axios 响应 {data: AjaxResult}。
// 用 res.code 判定是否已是 AjaxResult 体,避免二次解包导致 items 丢失。
const isAjaxResult = res && typeof res === 'object' && res.code !== undefined;
const ajaxBody = isAjaxResult ? res : (res.data || res);
// 响应结构: Axios拦截器对code===200返回res.dataAjaxResult体
// 结构为 { code: 200, data: examApply实体, items: [明细数组] }
const items = Array.isArray(res.items) ? res.items : [];
const dataObj = res.data || {};
// items 在 AjaxResult 顶层data 字段是 ExamApply 实体
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : [];
const detailData = ajaxBody.data || {};
// 先填充表单字段
if (dataObj && typeof dataObj === 'object') Object.assign(form, dataObj);
if (detailData && typeof detailData === 'object') Object.assign(form, detailData);
if (rawItems.length > 0) {
if (items.length > 0) {
try {
// 为每个项目加载检查方法
const itemsWithMethods = await Promise.all(rawItems.map(async m => {
const itemsWithMethods = await Promise.all(items.map(async m => {
const item = {
id: m.itemCode, name: m.itemName,
price: m.itemFee || 0, quantity: 1,
@@ -1260,7 +1257,7 @@ function handleRowClick(row) {
if (m.bodyPartCode) {
try {
const methodRes = await searchCheckMethod({ checkType: m.bodyPartCode });
// Bug #384修复: 正确解析 API 返回结构
// 正确解析 API 返回结构
let methodData = methodRes?.data?.data || methodRes?.data || methodRes?.rows || methodRes;
if (!Array.isArray(methodData) && methodRes?.data && Array.isArray(methodRes.data.data)) {
methodData = methodRes.data.data;
@@ -1270,16 +1267,15 @@ function handleRowClick(row) {
id: md.id,
name: md.name,
code: md.code,
price: m.itemFee || 0, // fallback 到已保存的价格
price: m.itemFee || 0,
packageName: md.packageName || '',
packageId: md.packageId || null,
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
packagePrice: md.packagePrice || null,
serviceFee: md.serviceFee || null
}));
// 如果有已保存的检查方法信息,尝试匹配
// 回充已保存的检查方法
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) {
item.isPackage = true;
item.packageId = item.selectedMethod.packageId;
@@ -1295,22 +1291,27 @@ function handleRowClick(row) {
}
} catch (err) {
console.error('加载检查方法失败', err);
// 单个项目加载失败不影响其他项目,继续返回 item
}
}
return item;
}));
// Bug #408修复: 确保明细数据正确加载到selectedItems
selectedItems.value = itemsWithMethods;
// 加载套餐明细(单个失败不影响其他项目和明细显示)
for (const it of selectedItems.value) {
if (getPackageCarrier(it)?.packageId) {
await loadPackageDetailsForItem(it);
try {
await loadPackageDetailsForItem(it);
} catch (e) {
console.error('加载套餐明细失败:', it.name, e);
}
}
it.expanded = !!getPackageCarrier(it)?.packageId;
}
syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay();
// 修复【#408】加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
// Bug #408修复: 加载申请单详情后自动切换到检查明细页签,确保已加载的明细数据可见
activeDetailTab.value = 'applyDetail';
} catch (err) {
console.error('加载申请单详情失败', err);
@@ -1362,8 +1363,9 @@ async function handleMethodSelect(checked, method, cat) {
existingItem.isPackage = true;
existingItem.packageId = method.packageId;
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
// 预加载套餐明细
loadPackageDetailsForItem(existingItem);
await loadPackageDetailsForItem(existingItem);
}
updateMethodDisplay();
return;
@@ -1399,9 +1401,10 @@ async function handleMethodSelect(checked, method, cat) {
};
selectedItems.value.push(newItem);
// 如果是套餐,预加载套餐明细
// 如果是套餐,预加载套餐明细并默认展开
if (newItem.isPackage && newItem.packageId) {
loadPackageDetailsForItem(newItem);
newItem.expanded = true;
await loadPackageDetailsForItem(newItem);
}
// 自动回填执行科室
@@ -1523,7 +1526,10 @@ async function handleItemSelect(checked, item, cat) {
// Bug #384修复 + #426修复: 展开/收起项目卡片
async function toggleItemExpand(item) {
item.expanded = !item.expanded;
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) {
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) {
await loadPackageDetailsForItem(item);
}
if (item.expanded && shouldShowPackageBody(item)) {
@@ -1577,7 +1583,7 @@ async function loadMethodPackageDetails(item, method) {
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/package/${packageId}/details`,
url: `/system/check-type/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {
@@ -1799,8 +1805,8 @@ defineExpose({ getList });
.collapse-scroll {
flex: 1;
overflow-y: auto;
overflow-x: hidden; /* Bug #500: 防止切换时水平方向溢出导致抖动 */
min-height: 120px; /* Bug #500: 固定最小高度,避免分类切换时 flex 容器高度突变 */
overflow-x: hidden;
min-height: 350px; /* Bug #500: 增大最小高度,确保切换分类时容器高度不会收缩导致抖动 */
}
.empty-hint {
color: #909399;
@@ -2114,18 +2120,18 @@ defineExpose({ getList });
height: auto;
line-height: 1.5;
}
/* Bug #500修复: 折叠内容使用明确属性过渡,避免 transition: all 导致子元素意外动画 */
/* Bug #500修复: 折叠内容不添加额外过渡动画,避免与 el-collapse 内部动画冲突导致双重动画/闪烁 */
:deep(.el-collapse-item__content) {
padding-bottom: 4px;
transition: height 0.3s ease, max-height 0.3s ease;
}
/* Bug #500: 折叠面板动画容器,添加 overflow:hidden 防止展开时内容溢出导致闪烁 */
/* Bug #500: 折叠面板容器不加 border保持简洁 */
:deep(.el-collapse-item__wrap) {
border: none;
overflow: hidden;
}
/* Bug #500: 分类项不加 margin 过渡,避免展开/收起时意外位移 */
:deep(.el-collapse-item) {
transition: margin 0.2s ease;
/* 不使用 transition,依赖 el-collapse 原生动画 */
}
/* Bug #500: 分类加载中提示样式 */
.category-loading-hint {

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,6 +1036,15 @@ 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 '';
};
@@ -1663,7 +1672,11 @@ function getListInfo(addNewRow) {
// 检查 adviceTableName如果是耗材表则应该是耗材类型
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText需重新计算
const backendDictText = item.adviceType_dictText;
let adviceType_dictText = (backendDictText && backendDictText.trim())
? backendDictText
: mapAdviceTypeLabel(adviceType, adviceTableName);
// 如果是会诊类型,设置为会诊类型
if (isConsultation) {

View File

@@ -636,12 +636,11 @@ function getList() {
if (res.code === 200) {
surgeryList.value = res.data?.records || []
} else {
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
surgeryList.value = []
}
}).catch(error => {
console.error('获取手术列表失败:', error)
proxy.$modal.msgError('数据加载失败,请稍后重试')
console.warn('手术列表请求异常:', error)
surgeryList.value = []
}).finally(() => {
loading.value = false
@@ -1142,8 +1141,10 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
getList() // 提交成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
// 子组件自身主动刷新列表(立即),确保数据展示不依赖父组件事件
getList()
// 通知父组件刷新医嘱列表(父组件也会带延迟再次刷新手术列表作为兜底)
emit('saved')
} else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
}
@@ -1159,8 +1160,10 @@ function submitForm() {
// 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false
getList() // 修改成功后直接刷新列表
emit('saved') // 通知父组件刷新医嘱列表
// 子组件自身主动刷新列表(立即)
getList()
// 由父组件 @saved 事件负责刷新列表
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(); surgeryRef?.getList() }" />
@saved="() => { prescriptionRef?.getListInfo(); setTimeout(() => surgeryRef?.getList(), 500) }" />
</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">
<!-- 详情 - 所有状态都显示 -->
@@ -678,15 +678,16 @@ const handlePrint = async (row) => {
}
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
const fieldKeys = ['targetDepartment', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
const fieldKeys = ['targetDepartment', 'urgencyLevel', 'expectedExaminationTime', 'allergyHistory', 'examinationPurpose', 'medicalHistorySummary', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
let descFieldsHtml = '';
fieldKeys.forEach((key) => {
const label = labelMap[key] || key;
if (descData[key] != null && descData[key] !== '') {
const value = transformField(key, descData[key]);
if (value != null && value !== '') {
descFieldsHtml += `
<div class="info-row">
<span class="label">${label}</span>
<span class="value">${descData[key]}</span>
<span class="value">${value}</span>
</div>`;
}
});

View File

@@ -136,7 +136,7 @@
currentDetail.patientName || '-'
}}</el-descriptions-item>
<el-descriptions-item label="申请单名称">{{
currentDetail.name || '-'
buildApplicationName(currentDetail)
}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{
currentDetail.createTime || '-'

View File

@@ -289,43 +289,62 @@ function getList() {
return obj;
});
form.value.diagnosisList = datas;
// form.value.diagnosisList = res.data;
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
deduplicateDiagnosisList();
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) {
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')
});
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')
});
});
// 将新数据添加到现有列表中
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;
});
}
emits('diagnosisSave', false);
// 重新排序整个列表
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();
}
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) => {
@@ -603,6 +622,18 @@ 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

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

View File

@@ -142,6 +142,11 @@
<el-table-column label="医嘱" align="center" prop="productName" width="300">
<template #default="scope">
<template v-if="getRowDisabled(scope.row)">
<!-- 当行的 adviceType 不在当前选项列表中时显示标签而非下拉框 -->
<template v-if="!hasAdviceTypeOption(scope.row)">
<el-tag size="small" type="primary">{{ getAdviceTypeLabel(scope.row.adviceType) }}</el-tag>
</template>
<template v-else>
<el-select
style="width: 35%; margin-right: 8px"
:model-value="getRowSelectValue(scope.row)"
@@ -216,6 +221,7 @@
/>
</template>
</el-popover>
</template>
</template>
<span v-else>{{ scope.row.adviceName }}</span>
</template>
@@ -750,6 +756,31 @@ function getRowDisabled(row) {
return row.isEdit;
}
/**
* 判断行的 adviceType 是否在当前 adviceTypeList 选项中有匹配项
* 修复 Bug #488避免 el-select 因无匹配选项而回显为纯数字
*/
function hasAdviceTypeOption(row) {
if (!row.adviceType && row.adviceType !== 0) return false;
if (row.adviceType == 1 && row.categoryCode) {
const compositeValue = '1-' + row.categoryCode;
return adviceTypeList.value.some(item => item.value === compositeValue);
}
return adviceTypeList.value.some(item => item.value === row.adviceType);
}
/**
* 将原始 adviceType 数字映射为人类可读标签
* 修复 Bug #488当 adviceType 不在选项列表中时,显示标签而非数字
*/
function getAdviceTypeLabel(type) {
if (!type && type !== 0) return '';
// 优先使用字典文本(如果后端返回了 adviceType_dictText
// 但由于当前行数据可能没有 dictText提供兜底映射
const fallbackMap = { 1: '西药', 2: '中成药', 3: '诊疗', 4: '耗材', 5: '会诊', 6: '手术', 23: '检查' };
return fallbackMap[type] || String(type);
}
/**
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
* 药品子分类使用复合值如 '1-2'adviceType-categoryCode诊疗/手术/全部使用原始值
@@ -832,13 +863,22 @@ function clickRowDb(row, column, event) {
}
row.showPopover = false;
// 仅”待签发(statusEnum==1)”允许编辑;”已签发(statusEnum==2)”及之后状态不允许编辑
if (row.statusEnum == 1) {
// 使用 Number() 做类型转换,确保后端返回的数值能正确比较
if (Number(row.statusEnum) === 1) {
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
row.therapyEnum = String(row.therapyEnum ?? '1');
row.isEdit = true;
const index = prescriptionList.value.findIndex((item) => item.uniqueKey === row.uniqueKey);
prescriptionList.value[index] = row;
expandOrder.value = [row.uniqueKey];
if (index !== -1) {
prescriptionList.value.splice(index, 1, row);
// 使用 nextTick 确保数据更新后再设置展开状态,保证 el-table 能正确识别 row-key
nextTick(() => {
expandOrder.value = [row.uniqueKey];
});
} else {
console.warn('⚠️ clickRowDb 未找到匹配行: uniqueKey=', row.uniqueKey, ', row=', row);
proxy.$modal.msgWarning('无法进入编辑模式,请刷新列表后重试');
}
}
}
@@ -910,9 +950,8 @@ 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 : '') : '';
// 当行没有显式选择医嘱类型时使用已配置的默认categoryCode确保后端能返回结果
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
const searchKey = row.adviceName || '';
nextTick(() => {
@@ -949,9 +988,8 @@ 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 : '') : '';
// 当行没有显式选择医嘱类型时使用已配置的默认categoryCode确保后端能返回结果
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
// 修复Bug #453当adviceType为空字符串或NaN时不传具体类型让refresh函数根据searchKey决定搜索范围
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
tableRef.refresh(effectiveAdviceType, categoryCode, value);
@@ -1378,6 +1416,9 @@ function handleSaveSign(row, index) {
bindMethod.value[itemNo] = true;
}
}
}).catch(() => {
// 绑定设备接口失败不影响主流程保存,静默降级
console.warn('绑定设备检查接口调用失败adviceType=' + row.adviceType + ', itemNo=' + itemNo + '');
});
}
}
@@ -1503,16 +1544,16 @@ function handleSaveBatch() {
}
function setValue(row) {
// 构造单位列表
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
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,
type: 'dose',
},
{
value: row.minUnitCode,
value: String(row.minUnitCode ?? ''),
label: row.minUnitCode_dictText,
type: 'minUnit',
},
@@ -1577,9 +1618,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: row.doseUnitCode,
minUnitCode: row.minUnitCode,
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
doseUnitCode: String(row.doseUnitCode ?? ''),
minUnitCode: String(row.minUnitCode ?? ''),
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
categoryEnum: row.categoryCode,
definitionId: row.chargeItemDefinitionId,
executeNum: 1,
@@ -1595,6 +1636,10 @@ 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,

View File

@@ -1,5 +1,6 @@
<template>
<el-dialog v-model="dialogVisible" title="补费" width="80%" :close-on-click-modal="false">
<div class="fee-dialog-wrapper">
<el-dialog v-model="dialogVisible" title="补费" width="80%" :close-on-click-modal="false">
<div style="font-size: 16px; font-weight: bold; margin-bottom: 10px">
患者信息{{
props.patientInfo.patientName +
@@ -251,7 +252,7 @@
</div>
</el-dialog>
<!-- 划价组套选择对话框 -->
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000">
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000" destroy-on-close>
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
<el-input
v-model="groupSetSearchText"
@@ -302,6 +303,7 @@
<el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
@@ -519,31 +521,28 @@ watch(
}
);
// 加载科室选项(支持树形/扁平两种数据结构)
// 加载科室选项(递归扁平化树形结构)
function loadDepartmentOptions() {
getOrgList()
.then((res) => {
if (res.data) {
// 尝试从树形结构中取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) {
departmentOptions.value = res.data.records[0].children;
return;
}
// 如果 records[0] 有 id 和 name非树根节点直接用所有 records
if (res.data.records[0].id) {
departmentOptions.value = res.data.records;
return;
}
}
// 兜底:如果 records 不存在或为空,尝试直接使用 data 本身
if (Array.isArray(res.data)) {
departmentOptions.value = res.data;
return;
}
if (!res?.data?.records?.length) {
departmentOptions.value = [];
return;
}
// 所有方式都失败,置空
departmentOptions.value = [];
// 递归扁平化树形结构,提取所有科室节点
const flattenTree = (nodes) => {
const result = [];
for (const node of nodes) {
if (node?.id && node?.name) {
result.push(node);
}
if (node?.children?.length) {
result.push(...flattenTree(node.children));
}
}
return result;
};
departmentOptions.value = flattenTree(res.data.records);
})
.catch(() => {
console.warn('科室列表加载失败(可能无权限)');
@@ -609,13 +608,13 @@ function getUnitCodeOptions(row) {
const unitCodes = [];
// 大单位:优先用 codecode 缺失时用字典文本兜底
if (row.unitCode != null && String(row.unitCode) !== '') {
unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText });
unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText || String(row.unitCode) });
} else if (row.unitCode_dictText) {
unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText });
}
// 小单位:同上
if (row.minUnitCode != null && String(row.minUnitCode) !== '') {
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText });
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText || String(row.minUnitCode) });
} else if (row.minUnitCode_dictText) {
unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText });
}

View File

@@ -241,6 +241,8 @@ const loading = ref(false);
const chooseAll = ref(false);
// 独立维护选中行ID集合避免el-table内部selection状态异常导致联动全选
const selectedRowIds = ref(new Set());
// 跳过选中事件级联:程序化调用 toggleRowSelection 时阻止 handleRowSelect 触发 selectAllCheckboxesInRow
const skipSelectCascade = ref(false);
const props = defineProps({
exeStatus: {
type: Number,
@@ -484,8 +486,13 @@ function handleExecute() {
if (hasServiceRequest) {
// 仅传入选中医嘱对应的 encounterId避免其他患者的耗材记录干扰
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
// 仅传入诊疗类医嘱的 requestId让后端仅校验与本次执行相关的耗材避免其他未执行医嘱的耗材记录干扰
const selectedRequestIds = list
.filter((item) => String(item.adviceTable || '') === 'wor_service_request')
.map((item) => item.requestId)
.filter(Boolean);
if (selectedEncounterIds.length > 0) {
lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true })
lotNumberMatch({ encounterIdList: selectedEncounterIds, requestIdList: selectedRequestIds }, { skipErrorMsg: true })
.then((matchRes) => {
if (matchRes && matchRes.code !== 200) {
console.warn('lotNumberMatch returned error:', matchRes.msg);
@@ -650,6 +657,7 @@ function handleRateChange(value, date, time, row, rateItem) {
}
function handelSwicthChange(value) {
skipSelectCascade.value = true;
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
@@ -670,12 +678,15 @@ function handelSwicthChange(value) {
}
}
});
skipSelectCascade.value = false;
}
// 默认选中全部行
function defaultSelectAllRows() {
// 清空并重建选中集合
selectedRowIds.value.clear();
// 阻止 toggleRowSelection 触发 handleRowSelect 中的 selectAllCheckboxesInRow 级联
skipSelectCascade.value = true;
prescriptionList.value.forEach((item, index) => {
const tableRef = proxy.$refs['tableRef' + index];
if (tableRef && tableRef[0]) {
@@ -688,6 +699,7 @@ function defaultSelectAllRows() {
});
}
});
skipSelectCascade.value = false;
// 更新全选开关状态
chooseAll.value = true;
}
@@ -764,6 +776,7 @@ function checkAndToggleRowSelection(row) {
const isCurrentlySelected = selectedRowIds.value.has(row.requestId);
// 根据checkbox状态更新表格行选中状态
skipSelectCascade.value = true;
if (isAllSelected && !isCurrentlySelected) {
selectedRowIds.value.add(row.requestId);
tableRef[0].toggleRowSelection(row, true);
@@ -771,6 +784,7 @@ function checkAndToggleRowSelection(row) {
selectedRowIds.value.delete(row.requestId);
tableRef[0].toggleRowSelection(row, false);
}
skipSelectCascade.value = false;
}
}
});
@@ -782,8 +796,10 @@ function handleRowSelect(selection, row, tableIndex) {
if (isSelected) {
selectedRowIds.value.add(row.requestId);
// 选中选中该行内部的所有checkbox
selectAllCheckboxesInRow(row);
// 仅在非程序化选中时,联动选中该行内部的所有checkbox
if (!skipSelectCascade.value) {
selectAllCheckboxesInRow(row);
}
} else {
selectedRowIds.value.delete(row.requestId);
// 取消选中行时取消选中该行内部的所有checkbox

View File

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

View File

@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
// 严格批号查询有库存orgQuantity > 0
if (d && Number(d.orgQuantity ?? 0) > 0) {
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,6 +1157,8 @@ function handleLocationClick(item, row, index) {
persistStore();
});
}
// 没有指定批号,直接提示
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');

View File

@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
// 调用计费接口获取数据
getPrescriptionList(row.visitId).then((res) => {
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
console.log('=== 拉取计费数据返回结果 ===', res)
if (res.code === 200 && res.data) {
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
@@ -1741,27 +1741,39 @@ function handleTemporaryMedicalSubmit(data) {
}
})
// 🔧 修复 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') // 过滤掉空项
)
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
// 匹配键:优先使用 chargeItemId后端费用项目ID最可靠其次使用 名称+规格+数量 组合
const submittedKeys = new Set()
const submittedChargeIds = new Set()
if (submittedKeys.size > 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) {
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
// 优先用 chargeItemId 匹配
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
return false
}
// 兜底用 名称+规格+数量 匹配
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
return !submittedKeys.has(key)
})
} else {
// 如果没有任何匹配,清空待生成列表(所有项目都已提交)
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
temporaryBillingMedicines.value = []
}