36 Commits

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

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

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

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

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

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

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

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

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

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

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

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

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

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:11:25 +08:00
关羽
d3310ade51 Fix Bug #467: [住院医生工作站-检验申请] 列表显示信息不规范:标题术语错误且单据名称未展示具体检验项目
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:10:56 +08:00
关羽
1dbf7859ea Fix Bug #475: 【住院医生工作站】开立检查申请单报错"请先配置当前时间段的执行科室"后,系统仍生成申请记录
合并验证逻辑:移除独立的"配置列表是否为空"检查,改为在遍历 activityList
时统一验证每个项目的执行科室配置。所有验证在任何数据库操作之前完成,
确保验证失败时不会产生脏数据。同时增加 activityList 为空时的明确提示。
2026-05-14 22:09:06 +08:00
赵云
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
19 changed files with 560 additions and 233 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,18 @@ 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);
IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
} }

View File

@@ -2440,4 +2440,30 @@ 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;
}
@Override
public IPage<SurgeryItemDto> getExaminationPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getExaminationPage(
new Page<>(pageNo, pageSize),
PublicationStatus.ACTIVE.getValue(),
organizationId,
searchKey);
return result;
}
} }

View File

@@ -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,31 @@ 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));
}
@GetMapping(value = "/examination-page")
public R<?> getExaminationPage(
@RequestParam(value = "organizationId", required = false) Long organizationId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
return R.ok(iDoctorStationAdviceAppService.getExaminationPage(organizationId, pageNo, pageSize, searchKey));
}
} }

View File

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

View File

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

View File

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

View File

@@ -811,4 +811,54 @@
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>
<!-- 检查项目专用分页查询:仅查检查(23) + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
<select id="getExaminationPage" 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 = '23'
<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

@@ -305,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,
@@ -341,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

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

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

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

View File

@@ -3662,6 +3662,13 @@ function handleSaveGroup(orderGroupList) {
defaultLotNumber: item.orderDetailInfos?.defaultLotNumber, defaultLotNumber: item.orderDetailInfos?.defaultLotNumber,
}; };
// 🔧 Bug 修复:字典查找兜底,防止 mergedDetail 中 dictText 为空
const findDictText = (dictList, code) => {
if (!code || !dictList?.length) return '';
const found = dictList.find(d => d.value === code);
return found?.label || '';
};
// 在 setValue 之前预初始化空行 // 在 setValue 之前预初始化空行
prescriptionList.value[rowIndex.value] = { prescriptionList.value[rowIndex.value] = {
uniqueKey: nextId.value++, uniqueKey: nextId.value++,
@@ -3672,43 +3679,105 @@ function handleSaveGroup(orderGroupList) {
// 使用医嘱项目详情设置值 // 使用医嘱项目详情设置值
setValue(mergedDetail); setValue(mergedDetail);
// 🔧 Bug 修复:使用 mergedDetail 优先,避免 item 中 undefined 覆盖 setValue 中已设置的字段
const resolvedQuantity = mergedDetail.quantity ?? item.quantity ?? 1;
const resolvedDose = mergedDetail.dose ?? item.dose;
const resolvedMethodCode = mergedDetail.methodCode ?? item.methodCode;
const resolvedRateCode = mergedDetail.rateCode ?? item.rateCode;
const resolvedUnitCode = mergedDetail.unitCode ?? item.unitCode;
// 🔧 Bug 修复setValue 可能因库存不足提前 return导致 unitPrice/minUnitPrice 等字段未设置。
// 从 mergedDetail 或 item 中获取兜底值,避免价格计算产生 NaN。
const safePrice = (val) => {
const n = Number(val);
return (n !== undefined && n !== null && !isNaN(n) && isFinite(n)) ? n : 0;
};
const resolvedUnitPrice = safePrice(
prescriptionList.value[rowIndex.value]?.unitPrice
?? mergedDetail.unitPrice
?? item.unitPrice
?? 0
);
const resolvedMinUnitPrice = safePrice(
prescriptionList.value[rowIndex.value]?.minUnitPrice
?? mergedDetail.minUnitPrice
?? item.minUnitPrice
?? 0
);
const resolvedPartPercent = safePrice(
item.orderDetailInfos?.partPercent
?? mergedDetail.partPercent
?? 1
);
// 创建新的处方项目 // 创建新的处方项目
const newRow = { const newRow = {
...prescriptionList.value[rowIndex.value], ...prescriptionList.value[rowIndex.value],
patientId: props.patientInfo.patientId, patientId: props.patientInfo.patientId,
encounterId: props.patientInfo.encounterId, encounterId: props.patientInfo.encounterId,
accountId: accountId.value, accountId: accountId.value,
quantity: item.quantity, quantity: resolvedQuantity,
methodCode: item.methodCode, methodCode: resolvedMethodCode,
rateCode: item.rateCode, methodCode_dictText: mergedDetail.methodCode_dictText
dispensePerDuration: item.dispensePerDuration, || findDictText(method_code.value, resolvedMethodCode)
dose: item.dose, || '',
doseQuantity: item.doseQuantity, rateCode: resolvedRateCode,
rateCode_dictText: mergedDetail.rateCode_dictText
|| findDictText(rate_code.value, resolvedRateCode)
|| '',
dispensePerDuration: mergedDetail.dispensePerDuration ?? item.dispensePerDuration,
dose: resolvedDose,
doseQuantity: mergedDetail.doseQuantity ?? item.doseQuantity,
executeNum: 1, executeNum: 1,
unitCode: item.unitCode, unitCode: resolvedUnitCode,
unitCode_dictText: item.unitCodeName || '', unitCode_dictText: item.unitCodeName
|| mergedDetail.unitCodeName
|| findDictText(unit_code.value, resolvedUnitCode)
|| '',
doseUnitCode: mergedDetail.doseUnitCode,
doseUnitCode_dictText: mergedDetail.doseUnitCode_dictText || '',
// 🔧 确保 price/adviceType 字段有安全默认值(避免 NaN 导致模板条件判断失效)
unitPrice: resolvedUnitPrice,
minUnitPrice: resolvedMinUnitPrice,
unitTempPrice: resolvedUnitPrice,
adviceType: prescriptionList.value[rowIndex.value]?.adviceType
|| Number(mergedDetail.adviceType)
|| Number(item.adviceType)
|| 0,
adviceType_dictText: prescriptionList.value[rowIndex.value]?.adviceType_dictText
|| mergedDetail.adviceType_dictText
|| item.adviceType_dictText
|| '',
statusEnum: 1, statusEnum: 1,
// 🔧 类型组套应用默认为临时医嘱2=临时1=长期)
therapyEnum: mergedDetail.therapyEnum ?? item.therapyEnum ?? '2',
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId // 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
// 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室不使用目录配置的ID // 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室不使用目录配置的ID
orgId: item.adviceType === 3 orgId: item.adviceType === 3
? props.patientInfo?.orgId ? props.patientInfo?.orgId
: (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId), : (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId),
positionName: prescriptionList.value[rowIndex.value]?.positionName
|| mergedDetail.orgName
|| mergedDetail.positionName
|| findOrgNameById(mergedDetail.orgId || props.patientInfo?.orgId)
|| '',
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1', dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
conditionId: conditionId.value, conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value, conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value, encounterDiagnosisId: encounterDiagnosisId.value,
diagnosisName: diagnosisName.value,
}; };
// 计算价格和总量 // 计算价格和总量(使用安全值)
const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode); const unitInfo = unitCodeList.value.find((k) => k.value == resolvedUnitCode);
if (unitInfo && unitInfo.type == 'minUnit') { if (unitInfo && unitInfo.type == 'minUnit') {
newRow.price = newRow.minUnitPrice; newRow.price = resolvedMinUnitPrice;
newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6); newRow.totalPrice = (resolvedQuantity * resolvedMinUnitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity; newRow.minUnitQuantity = resolvedQuantity;
} else { } else {
newRow.price = newRow.unitPrice; newRow.price = resolvedUnitPrice;
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6); newRow.totalPrice = (resolvedQuantity * resolvedUnitPrice).toFixed(6);
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1); newRow.minUnitQuantity = resolvedQuantity * resolvedPartPercent;
} }
newRow.contentJson = JSON.stringify(newRow); newRow.contentJson = JSON.stringify(newRow);

View File

@@ -220,6 +220,7 @@
:is-edit-mode="true" :is-edit-mode="true"
:edit-data="editingRow" :edit-data="editingRow"
:external-patient-info="patientInfo" :external-patient-info="patientInfo"
@submit-ok="handleEditSuccess"
/> />
<template #footer> <template #footer>
<el-button @click="editDialogVisible = false">取消</el-button> <el-button @click="editDialogVisible = false">取消</el-button>
@@ -967,12 +968,17 @@ const handleEdit = (row) => {
// 编辑弹窗确认提交 // 编辑弹窗确认提交
const handleEditSubmit = () => { const handleEditSubmit = () => {
// 调用MedicalExaminations组件的submit方法
if (editFormRef.value?.submit) { if (editFormRef.value?.submit) {
editFormRef.value.submit(); editFormRef.value.submit();
} }
}; };
// 编辑保存成功回调:关闭弹窗并刷新列表
const handleEditSuccess = () => {
editDialogVisible.value = false;
fetchData();
};
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { (val) => {

View File

@@ -1,6 +1,24 @@
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,
});
}
// 检查项目专用分页查询(仅检查(23) + 定价,绕过 AOP 校验提升加载速度)
export function getExaminationPage(params) {
return request({
url: '/doctor-station/advice/examination-page',
method: 'get',
params: params,
});
}
//医嘱大下拉 //医嘱大下拉
export function getApplicationList(queryParams) { export function getApplicationList(queryParams) {
return request({ return request({

View File

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

@@ -1668,18 +1668,27 @@ function handleSaveGroup(orderGroupList) {
const baseRow = prescriptionList.value[rowIndex.value]; const baseRow = prescriptionList.value[rowIndex.value];
const newRow = { const newRow = {
...baseRow, ...baseRow,
isEdit: false,
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
executeNum: 1, executeNum: 1,
statusEnum: 1, statusEnum: 1,
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '', orgId: resolveOrgId(
// 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示 (item.orderDetailInfos?.orgId || mergedDetail.orgId)
orgName: findOrgName(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || item.orderDetailInfos?.orgName || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '', ? (item.orderDetailInfos?.orgId || mergedDetail.orgId)
: patientInfo.value?.inHospitalOrgId
) || '',
orgName: findOrgName(
(item.orderDetailInfos?.orgId || mergedDetail.orgId)
? (item.orderDetailInfos?.orgId || mergedDetail.orgId)
: patientInfo.value?.inHospitalOrgId
) || item.orderDetailInfos?.orgName || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '',
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1', dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
conditionId: conditionId.value, conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value, conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value, encounterDiagnosisId: encounterDiagnosisId.value,
diagnosisName: diagnosisName.value,
therapyEnum: baseRow?.therapyEnum || '1', therapyEnum: baseRow?.therapyEnum || '1',
}; };
// 覆盖关键字段:优先使用 item 的值,其次 mergedDetail已由 setValue 填充),最后 baseRow // 覆盖关键字段:优先使用 item 的值,其次 mergedDetail已由 setValue 填充),最后 baseRow
@@ -1691,6 +1700,16 @@ function handleSaveGroup(orderGroupList) {
newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity; newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity;
newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode; newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode;
newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || ''; newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || '';
// 确保价格字段有兜底值setValue 可能因库存不足提前 return 导致未设置)
newRow.unitPrice = baseRow.unitPrice ?? mergedDetail.unitPrice ?? 0;
newRow.minUnitPrice = baseRow.minUnitPrice ?? mergedDetail.minUnitPrice ?? 0;
newRow.unitTempPrice = newRow.unitPrice;
newRow.methodCode_dictText = mergedDetail.methodCode_dictText || item.methodCode_dictText || '';
newRow.rateCode_dictText = mergedDetail.rateCode_dictText || item.rateCode_dictText || '';
newRow.doseUnitCode = mergedDetail.doseUnitCode || item.doseUnitCode || baseRow.doseUnitCode;
newRow.doseUnitCode_dictText = mergedDetail.doseUnitCode_dictText || item.doseUnitCode_dictText || '';
newRow.orgId = mergedDetail.orgId || mergedDetail.positionId || baseRow.orgId || '';
newRow.positionName = mergedDetail.orgName || mergedDetail.positionName || baseRow.positionName || '';
// 计算价格和总量 // 计算价格和总量
// 🔧 Bug #403 修复:使用 newRow.unitCode已由 setValue 填充)而非 item.unitCode // 🔧 Bug #403 修复:使用 newRow.unitCode已由 setValue 填充)而非 item.unitCode