21 Commits

Author SHA1 Message Date
陈琳
2cedcefacb Fix Bug #496: 【住院医生工作站-检查申请】检查申请列表字段命名不规范及单号生成规则不符合医疗行业标准
1. 前端列标题:处方号 → 申请单号(表格列 + 详情弹窗)
2. 后端单号生成:原用 PAR 处方号前缀 → 改为 JCZ + yyMMdd + 5位顺序号
3. 新增 AssignSeqEnum.CHECK_APPLY_NO 枚举项(JCZ 前缀)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
关羽
4feac503a0 Fix Bug #496: 【住院医生工作站-检查申请】检查申请列表字段命名不规范及单号生成规则不符合医疗行业标准
1. 前端 examineApplication.vue:列表表头和详情弹窗中"处方号"改为"申请单号"
2. 后端 RequestFormManageAppServiceImpl:检查申请单单号生成规则由 PAR+流水号 改为 JCZ+yyMMdd+5位顺序号(如:JCZ26051300001),其他类型申请单保持原有PAR规则不变

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
关羽
d747b0b380 Fix Bug #400: 门诊医生站点击【完诊】后,triage_queue_item 表 status 字段未按规范更新为 30
根因:完诊时使用 triageQueueItemService.updateById(queueItem) 更新队列状态,
依赖 MyBatis Plus 的实体级更新策略,可能因字段级更新策略导致 status 字段未实际写入数据库。

修复策略:改用 LambdaUpdateWrapper 直接生成 UPDATE SQL,明确指定 SET status=30,
绕过实体级更新策略,确保 status 字段必定写入数据库。同时增加更新失败日志。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
荀彧
af0a0957d0 Fix Bug #401: 门诊完诊审计日志错误:div_log 表中 pool_id 与 slot_id 存值与设计规范不符
调整完诊时 div_log 的 pool_id/slot_id 获取优先级:优先使用 triage_queue_item
(挂号时录入的号源信息,为权威来源),队列项不存在或值缺失时回退使用
encounter → order → slot → pool 链路

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
赵云
6964f4f0a0 Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
根本原因:
1. 分类联动加载检查方法时,未提取后端返回的 packageId 字段
2. 勾选检查方法后,未从方法中获取套餐信息(isPackage/packageId)
3. 选中带套餐的检查方法后,未调用 loadPackageDetailsForItem 预加载套餐明细

修复内容(4处手术式修改):
- handleCategoryExpand:方法映射增加 packageId 字段
- handleRowClick:回充已有申请单时,从匹配的方法中获取套餐信息
- handleMethodSelect:从方法获取套餐信息并预加载套餐明细
- handleItemSelect:方法映射增加 packageId 字段

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
赵云
b8d663d5fa Fix Bug #412: 门诊医生站:传染病报告卡保存失败,提示报错
根因分析:
- 前端在 buildSubmitData() 中使用 formData.diagnosisId || null 将空字符串转为 null
- 后端 InfectiousDiseaseReportDto.diagId 有 @NotNull 校验,导致 null 值被拒绝
- diagnosisId 来源于 show() 中 diagnosisData?.conditionId || diagnosisData?.definitionId
  使用 || 运算符会将 0 等假值跳过,可能导致 ID 丢失

修复内容:
1. show() 函数:使用显式 null/空字符串检查替代 || 运算符,确保 conditionId/definitionId 正确映射
2. handleSubmit():提交前增加 diagnosisId 非空校验,提前拦截并给出友好提示
3. buildSubmitData():diagId 使用 Number() 显式转换,确保发送正确的 Long 值

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
张飞
e32ef40f48 Fix Bug #362: 住院护士站:入出转管理双击查看详情时,"入科时间"字段显示当前系统时间而非实际入科时间
在 selectAdmissionPatientInfo SQL 中,startTime 原取自 bed.start_time(床位级别的位置记录),
当该 LEFT JOIN 无匹配记录时返回 NULL,前端 fallback 到当前系统时间。
改为 COALESCE(bed.start_time, ae.start_time),无床位记录时回退到 encounter 的入院时间。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
关羽
04903dc0b9 Fix Bug #492: 【门诊手术安排】关闭"手术计费"主弹窗后,项目字典选择列表依然残留悬浮在界面上
根因:el-popover 使用 :visible 受控模式,closeAllPopovers() 将 showPopover 设为 false
后,Vue 尚未完成 DOM 更新时 showChargeDialog 已被设为 false,导致弹窗组件被销毁
而 popover 的 visible 状态变更未传播到 DOM,弹窗消失但 popover 残留。

修复:在 closeChargeDialog 中使用 nextTick 等待 Vue 完成 popover 关闭的 DOM 更新后,
再设置 showChargeDialog = false 关闭主弹窗。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
诸葛亮
cd9dddb948 Fix Bug #494: 住院医生工作站-检查申请:"申请单名称"字段显示为通用名称,未展示具体检查项目名称
根因:medicalExaminations.vue 保存检查申请单时,name 字段硬编码为 "检查申请单",
导致列表页所有记录的申请单名称均显示为固定字符串,无法区分具体检查项目。

修复:将 name 从硬编码改为从已选项目集合中提取 adviceName 并用顿号连接,
如选择 CT、超声两项则显示为 "CT、超声"。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
赵云
14ebcea2e6 Fix Bug #493: 【住院医生工作站-临床医嘱-检验申请】项目未维护执行科室时,医生手动选择发往科室后仍报错且数据被清空
根因:projectWithDepartment 函数定义时遗漏了 type 参数,导致函数体内引用 type 变量时报 ReferenceError(未定义),type === 2 的判断永远无法正确执行。用户在提交时手动选择的发往科室被清空且无法提交。

修复:在函数签名中添加 type 参数,与 working 版本 medicalExaminations.vue 保持一致。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
刘备
7694122409 Fix Bug #489: 【医嘱闭环】医生站签发单条长期药品医嘱,护士校对界面生成重复(两条)待校对记录
在住院医生站签发流程的 handMedication() 方法中增加去重逻辑,
与门诊医生站保持一致,使用 patientId+encounterId+adviceDefinitionId+dose+methodCode+rateCode
作为唯一键,防止前端重复提交导致数据库产生重复医嘱记录。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
刘备
dd0cdf0af3 Fix Bug #491: 【执行科室配置】保存配置时系统报错 - 修复Organization.getName()空指针异常
根因分析:
1. organizationLocationInit() 中 Organization.getName() 未做空值过滤,若数据库存在name为null的科室记录会NPE
2. addOrEditOrgLoc() 中 activityDefinitionMapper.selectById().getName() 未对selectById返回null做防护
3. addOrEditOrgLoc() 缺少organizationId前置校验,空值传入可能导致后续流程异常

修复内容:
- 第74行:stream中增加 .filter(organization -> organization != null && organization.getName() != null)
- 第136-138行:增加organizationId为null时的校验,返回友好错误提示
- 第145-147行:将activityDefinitionMapper.selectById结果先赋值再判空,避免NPE

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
赵云
c6a29aa7f4 Fix Bug #488: 【临床医嘱】双击编辑待签发医嘱,医嘱类型回显为数字且点击确认报接口错误
修复 clickRowDb 函数中编辑条件过于严格的问题:原条件 `row.statusEnum == 1 && !row.requestId`
只允许"待保存"(无requestId)的医嘱进入编辑,导致"待签发"(有requestId)的医嘱无法编辑。
改为 `row.statusEnum == 1`,允许所有待签发状态的医嘱编辑。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
张飞
19b3bf5f3a Fix Bug #477: 住院医生工作站-住院检查申请详情弹窗中"发往科室"字段显示为短横线(-),未正常获取数据
根因分析:
1. 前端组件使用了错误的API获取科室列表:表单使用getDepartmentList(/app-common/department-list)
   保存的targetDepartment ID,但详情弹窗使用getOrgList(/base-data-manage/organization/organization)
   查询,两个接口返回的数据结构和ID不同,导致recursionFun无法匹配到科室名称
2. recursionFun中obj.children可能为null/undefined,直接遍历会抛TypeError
3. getLocationInfo是异步调用,handleViewDetail可能在科室数据加载完成前被调用

修复:
- 统一使用getDepartmentList(@/api/public.js)获取科室数据,与表单组件保持一致
- recursionFun增加children空值保护
- handleViewDetail改为async,打开详情前确保科室数据已加载
2026-05-13 11:03:19 +08:00
刘备
51a75a6787 Fix Bug #468: [住院医生工作站-检验申请] 列表页缺失【单据状态】列,无法闭环管理检验医嘱执行进度
前后端完整链路修复:
- 后端 Mapper: LEFT JOIN wor_service_request 表,通过 CASE MIN(status_enum) 映射单据状态
- 后端 Mapper: 新增状态筛选和关键字搜索(申请单号/检验项目模糊匹配)
- 后端 Service/Controller: 新增 status 和 keyword 参数传递
- 前端 Vue: 列表页添加【单据状态】列,绑定 status 字段
- 前端 Vue: 移除中间状态选项(已采集/已收样),与后端 CASE 映射保持一致

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
荀彧
79a91f0a77 Fix Bug #464: [目录管理-诊疗目录] 新增项目时"零售价"未与"诊疗子项"合计总价自动同步
根本原因: calculateTotalPrice() 中同步零售价的条件只检查了第一个子项 (treatmentItems.value[0]),当第一个子项被清空但其他子项有效时,零售价不会同步。submitForm() 中存在相同问题。

修复内容:
1. calculateTotalPrice(): 使用 Array.some() 检查是否有任何有效子项,而非只检查第一个
2. 当无有效子项时,将 retailPrice 重置为 undefined 避免残留旧值
3. submitForm(): childrenJson 序列化和零售价同步同样改用 some() 检查
4. addItem(): 补充缺失的 name 字段,与初始值结构保持一致

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
荀彧
f1e30bb3a7 Fix Bug #457: 门诊收费:已签发的手术类医嘱在门诊收费列表中不显示项目名称
根因分析:门诊医生站处方列表查询(DoctorStationAdviceAppMapper.xml)中,
手术类医嘱(category_enum=4)的 advice_table_name 固定返回 'wor_activity_definition',
而非 'cli_surgery'。当医生通过"签发"按钮处理手术医嘱时,handService() 据此创建
ChargeItem,导致 product_table = 'wor_activity_definition',但 product_id 实际指向
cli_surgery 表中的手术记录。

门诊收费SQL查询的CASE语句仅匹配 product_table = 'cli_surgery' 的手术项,
因此这些手术医嘱无法匹配,item_name 返回 NULL。

修复方案:在 selectEncounterPatientPrescription 和 selectEncounterPatientPrescriptionWithPrice
的 item_name CASE 表达式中新增兜底分支:
  WHEN context_enum = #{activity} AND service_table = 'wor_service_request'
  THEN COALESCE(T9.surgery_name, wsr.content_json->>'surgeryName',
                wsr.content_json->>'adviceName', T2."name")

按优先级回退获取手术名称:cli_surgery表 → content_json手术名称 → content_json医嘱名称 → 诊疗定义名称

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
刘备
49a2313d7a Fix Bug #458: 门诊医生站:诊疗类医嘱保存成功后,列表"医嘱类型"列显示为空值
根因:mapAdviceTypeLabel 函数依赖 drord_doctor_type 字典数据进行类型映射,
当字典中缺少 value=3(诊疗)的条目时,find() 返回 undefined,函数返回空字符串,
导致保存后刷新列表时"医嘱类型"列显示为空白。

修复:在 mapAdviceTypeLabel 中为诊疗/手术类医嘱(wor_activity_definition 表)
添加兜底映射逻辑:type 3→诊疗, 6→手术, 4→手术, 1→检验, 2→检查, 5→其他,
确保即使字典缺失对应条目也能正确显示类型标签。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
赵云
677106afc2 Fix Bug #448: 门诊划价模块-项目分类过滤失效,选择"耗材"类型时仍能检索出药品
根因: adviceBaseList.vue 中 adviceQueryParams 的 watch 在 popoverVisible=false 时
直接 return,未将参数同步到 queryParams。当 handleFocus 同时修改 adviceQueryParams
和 showPopover 时,Vue 的 watch 触发顺序不确定:
- 若 adviceQueryParams watch 先触发(popoverVisible 仍为 false),则 queryParams 保持旧值
- 随后 popoverVisible watch 触发时虽然会同步参数,但存在时序竞态导致查询参数不正确

修复: 将参数同步逻辑移至 early return 之前,确保 queryParams 始终与 adviceQueryParams
保持一致,API 请求仍在 popoverVisible=true 时才触发。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
华佗
925f3dde41 Fix Bug #442: 手术计费:点击"删除"待签发耗材时异常报错,导致操作失败
根因:DoctorStationAdviceAppMapper.xml 中 getRequestBaseInfo SQL 的第二个 UNION 查询(手术计费耗材从 adm_charge_item 关联 wor_device_request)中,biz_request_flag 和 requester_id 使用了 CI.enterer_id(计费录入人),而非 DR.requester_id(设备申请创建人)。当录入人与当前操作人不一致时,biz_request_flag 为 '0',导致删除操作被后端拒绝。

修复:将 CI.enterer_id 改为 COALESCE(DR.requester_id, CI.enterer_id),优先使用 DeviceRequest 的 requester_id,确保 biz_request_flag 基于正确的创建人计算。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 11:03:19 +08:00
陈琳
ae805eb89c Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
根因分析:
1. handleCategoryExpand 加载了 cat.methods 但模板从未渲染,用户展开分类后看不到检查方法
2. 缺少 isMethodSelected/handleMethodSelect 函数,无法通过勾选检查方法来联动添加到已选择列表
3. 套餐明细展示缺少 CSS 样式(package-details-list/detail-row/detail-name/detail-info)

修复内容:
- 模板: 在分类折叠区域添加 cat.methods 的渲染(检查方法列表 + 勾选框 + 价格)
- 逻辑: 新增 isMethodSelected 和 handleMethodSelect 函数,支持直接勾选检查方法添加到已选择列表
- 样式: 添加套餐明细列表样式 + 检查方法区域样式

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 23:01:48 +08:00
69 changed files with 721 additions and 3392 deletions

View File

@@ -86,13 +86,18 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
return dictDataMapper.selectDictDataByTypeWithSearch(dictType, trimmedKey); return dictDataMapper.selectDictDataByTypeWithSearch(dictType, trimmedKey);
} }
// 直接查询数据库,避免缓存中为空数据导致前端下拉框显示"无数据" // 否则使用原有方法(带缓存)
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType); List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
if (StringUtils.isNotEmpty(dictDatas)) {
return dictDatas;
}
dictDatas = dictDataMapper.selectDictDataByType(dictType);
if (StringUtils.isNotEmpty(dictDatas)) { if (StringUtils.isNotEmpty(dictDatas)) {
DictUtils.setDictCache(dictType, dictDatas); DictUtils.setDictCache(dictType, dictDatas);
}
return dictDatas; return dictDatas;
} }
return null;
}
/** /**
* 根据字典类型ID查询信息 * 根据字典类型ID查询信息

View File

@@ -366,7 +366,7 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型 serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型
serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量 serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量
serviceRequest.setUnitCode(""); // 请求单位编码 serviceRequest.setUnitCode(""); // 请求单位编码
serviceRequest.setCategoryEnum(24); // 请求类型:24-手术(新值域,避开 adviceType 碰撞) serviceRequest.setCategoryEnum(4); // 请求类型4-手术
serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id
serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者 serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者
serviceRequest.setRequesterId(practitionerId); // 开方医生 serviceRequest.setRequesterId(practitionerId); // 开方医生

View File

@@ -7,6 +7,7 @@ import com.core.common.core.domain.R;
import com.core.common.core.domain.model.LoginUser; import com.core.common.core.domain.model.LoginUser;
import com.core.common.utils.SecurityUtils; import com.core.common.utils.SecurityUtils;
import com.openhis.administration.domain.Patient; import com.openhis.administration.domain.Patient;
import com.openhis.administration.service.IOrganizationService;
import com.openhis.administration.service.IPatientService; import com.openhis.administration.service.IPatientService;
import com.openhis.clinical.domain.Surgery; import com.openhis.clinical.domain.Surgery;
import com.openhis.clinical.service.ISurgeryService; import com.openhis.clinical.service.ISurgeryService;
@@ -27,6 +28,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -202,8 +204,6 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
return R.fail("新增手术安排失败"); return R.fail("新增手术安排失败");
} }
syncSurgeryIncisionLevel(opSchedule.getOperCode(), opCreateScheduleDto.getIncisionLevel());
// Bug #247 修复:更新手术申请单状态为已排期 (1) // Bug #247 修复:更新手术申请单状态为已排期 (1)
if (opCreateScheduleDto.getApplyId() != null) { if (opCreateScheduleDto.getApplyId() != null) {
try { try {
@@ -300,8 +300,6 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
return R.fail("修改手术安排失败"); return R.fail("修改手术安排失败");
} }
syncSurgeryIncisionLevel(opScheduleDto.getOperCode(), opScheduleDto.getIncisionLevel());
return R.ok("修改手术安排成功"); return R.ok("修改手术安排成功");
} }
@@ -435,28 +433,6 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
} }
/**
* 同步手术申请表中的切口类型
*/
private void syncSurgeryIncisionLevel(String surgeryNo, Integer incisionLevel) {
if (surgeryNo == null || surgeryNo.isEmpty() || incisionLevel == null) {
return;
}
LambdaQueryWrapper<Surgery> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Surgery::getSurgeryNo, surgeryNo)
.eq(Surgery::getDeleteFlag, "0");
Surgery surgery = surgeryService.getOne(queryWrapper);
if (surgery == null) {
log.warn("未找到需要同步切口类型的手术申请记录 - surgeryNo: {}", surgeryNo);
return;
}
surgery.setIncisionLevel(incisionLevel);
surgery.setUpdateTime(new Date());
surgeryService.updateById(surgery);
}
/** /**
* 填充手术申请中缺失的名称字段 * 填充手术申请中缺失的名称字段
* 在创建手术安排时调用确保关联的cli_surgery表中的名称字段有值 * 在创建手术安排时调用确保关联的cli_surgery表中的名称字段有值

View File

@@ -2,13 +2,9 @@ package com.openhis.web.clinicalmanage.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.openhis.common.enums.ActivityDefCategory;
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService; import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto; import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
import com.openhis.web.clinicalmanage.dto.OpScheduleDto; import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
import com.openhis.web.regdoctorstation.appservice.IRequestFormManageAppService;
import com.openhis.web.regdoctorstation.dto.RequestFormDto;
import com.openhis.web.regdoctorstation.dto.RequestFormPageDto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -30,7 +26,6 @@ import java.util.Map;
public class SurgicalScheduleController { public class SurgicalScheduleController {
private final ISurgicalScheduleAppService surgicalScheduleAppService; private final ISurgicalScheduleAppService surgicalScheduleAppService;
private final IRequestFormManageAppService requestFormManageAppService;
/** /**
* 分页查询手术安排列表 * 分页查询手术安排列表
@@ -92,27 +87,6 @@ public class SurgicalScheduleController {
return surgicalScheduleAppService.deleteSurgerySchedule(scheduleId); return surgicalScheduleAppService.deleteSurgerySchedule(scheduleId);
} }
/**
* 分页查询待排期手术申请列表
*
* @param requestFormDto 查询条件
* @return 手术申请列表
*/
@PostMapping(value = "/apply-list")
public R<IPage<RequestFormPageDto>> getSurgeryApplyList(@RequestBody RequestFormDto requestFormDto) {
if (requestFormDto.getPageNo() == null) {
requestFormDto.setPageNo(1);
}
if (requestFormDto.getPageSize() == null) {
requestFormDto.setPageSize(10);
}
//虽然很想这么写但是库里的手术申请单的type_code都是直接写的SURGERY
// requestFormDto.setTypeCode(ActivityDefCategory.PROCEDURE.getCode());
//只查询手术申请单
requestFormDto.setTypeCode("SURGERY");
return R.ok(requestFormManageAppService.getRequestFormPage(requestFormDto));
}
/** /**
* 导出手术安排列表 * 导出手术安排列表
* *

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Data @Data
@@ -84,11 +85,6 @@ public class OpCreateScheduleDto {
*/ */
private String surgerySite; private String surgerySite;
/**
* 切口类型
*/
private Integer incisionLevel;
/** /**
* 入院时间 * 入院时间
*/ */
@@ -265,11 +261,6 @@ public class OpCreateScheduleDto {
*/ */
private String remark; private String remark;
/**
* 费用类别
*/
private String feeType;
/** /**
* 创建时间 * 创建时间
*/ */

View File

@@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.openhis.surgicalschedule.domain.OpSchedule; import com.openhis.surgicalschedule.domain.OpSchedule;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate; import java.time.LocalDate;
@@ -94,12 +93,6 @@ public class OpScheduleDto extends OpSchedule {
* 手术类型 * 手术类型
*/ */
private String surgeryType; private String surgeryType;
/**
* 切口类型
*/
private Integer incisionLevel;
/** /**
* 申请科室 * 申请科室
*/ */
@@ -114,4 +107,8 @@ public class OpScheduleDto extends OpSchedule {
*/ */
private String createByName; private String createByName;
/**
* 费用类别
*/
private String feeType;
} }

View File

@@ -59,16 +59,6 @@ public interface IDoctorStationAdviceAppService {
*/ */
R<?> getRequestBaseInfo(Long encounterId); R<?> getRequestBaseInfo(Long encounterId);
/**
* 查询医嘱请求数据(支持按生成来源和来源单据号过滤)
*
* @param encounterId 就诊id
* @param generateSourceEnum 生成来源(可选,如手术计费=6
* @param sourceBillNo 来源业务单据号(可选)
* @return 医嘱请求数据
*/
R<?> getRequestBaseInfo(Long encounterId, Integer generateSourceEnum, String sourceBillNo);
/** /**
* 门诊签退医嘱 * 门诊签退医嘱
* *

View File

@@ -35,7 +35,6 @@ import com.openhis.medication.service.IMedicationDispenseService;
import com.openhis.medication.service.IMedicationRequestService; import com.openhis.medication.service.IMedicationRequestService;
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper; import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService; import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
import com.openhis.web.doctorstation.appservice.IDoctorStationInspectionLabApplyService;
import com.openhis.web.doctorstation.dto.*; import com.openhis.web.doctorstation.dto.*;
import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper; import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper;
import com.openhis.web.doctorstation.utils.AdviceUtils; import com.openhis.web.doctorstation.utils.AdviceUtils;
@@ -48,15 +47,12 @@ import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.service.*; import com.openhis.workflow.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -66,9 +62,6 @@ import java.util.stream.Collectors;
@Service @Service
public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService { public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService {
private static final Pattern INSPECTION_APPLY_NO_JSON =
Pattern.compile("\"applyNo\"\\s*:\\s*\"([^\"]+)\"");
@Resource @Resource
AssignSeqUtil assignSeqUtil; AssignSeqUtil assignSeqUtil;
@@ -125,13 +118,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
@Resource @Resource
IInventoryItemService inventoryItemService; IInventoryItemService inventoryItemService;
/**
* 与检验申请实现存在循环依赖,需延迟注入;删除诊疗医嘱时按 contentJson 级联作废检验申请单。
*/
@Resource
@Lazy
private IDoctorStationInspectionLabApplyService iDoctorStationInspectionLabApplyService;
// 缓存 key 前缀 // 缓存 key 前缀
private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:"; private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:";
// 缓存过期时间(小时) // 缓存过期时间(小时)
@@ -242,10 +228,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 医嘱定义ID集合 // 医嘱定义ID集合
List<Long> adviceDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId) List<Long> adviceDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 费用定价主表ID集合过滤null值手术项目无定价定义 // 费用定价主表ID集合
List<Long> chargeItemDefinitionIdList = adviceBaseDtoList.stream() List<Long> chargeItemDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getChargeItemDefinitionId)
.map(AdviceBaseDto::getChargeItemDefinitionId)
.filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 判断是否包含药品或耗材类型(只有这些类型才需要库存相关查询) // 判断是否包含药品或耗材类型(只有这些类型才需要库存相关查询)
@@ -291,9 +275,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
medLocationConfig = Collections.emptyList(); medLocationConfig = Collections.emptyList();
allowedLocByCategory = Collections.emptyMap(); allowedLocByCategory = Collections.emptyMap();
} }
// 费用定价子表信息 - 仅药品/耗材需要批次定价查询,手术/诊疗无库存概念不需要 // 费用定价子表信息 - 使用分批处理避免大量参数问题
List<AdvicePriceDto> childCharge = new ArrayList<>(); List<AdvicePriceDto> childCharge = new ArrayList<>();
if (hasMedOrDevice && chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) { if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) {
// 分批处理每批最多1000个ID增加批次大小以减少查询次数 // 分批处理每批最多1000个ID增加批次大小以减少查询次数
int batchSize = 1000; int batchSize = 1000;
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) { for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
@@ -973,16 +957,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
} }
} }
for (AdviceSaveDto adviceSaveDto : deleteList) { for (AdviceSaveDto adviceSaveDto : deleteList) {
Long requestId = adviceSaveDto.getRequestId(); iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的药品请求
if (requestId == null) {
log.warn("BugFix#442: handMedication - 跳过 requestId 为 null 的删除请求");
continue;
}
iMedicationRequestService.removeById(requestId);
// 删除已经产生的药品发放信息 // 删除已经产生的药品发放信息
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId()); iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
// 🔧 Bug Fix #219: 删除费用项 // 🔧 Bug Fix #219: 删除费用项
Long requestId = adviceSaveDto.getRequestId();
String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST; String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST;
// 直接删除费用项 // 直接删除费用项
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
@@ -1438,11 +1417,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
log.info("BugFix#219: handDevice - 开始删除循环, deleteList.size={}", deleteList.size()); log.info("BugFix#219: handDevice - 开始删除循环, deleteList.size={}", deleteList.size());
for (AdviceSaveDto adviceSaveDto : deleteList) { for (AdviceSaveDto adviceSaveDto : deleteList) {
Long requestId = adviceSaveDto.getRequestId(); Long requestId = adviceSaveDto.getRequestId();
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的耗材请求
if (requestId == null) {
log.warn("BugFix#442: handDevice - 跳过 requestId 为 null 的删除请求");
continue;
}
log.info("BugFix#219: handDevice - 删除开始: requestId={}", requestId); log.info("BugFix#219: handDevice - 删除开始: requestId={}", requestId);
// 1. 删除耗材请求 // 1. 删除耗材请求
@@ -1543,44 +1517,21 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
} }
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
deviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量 deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码 deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号 deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号
deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型 deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型
// 🔧 BugFix #498: categoryEnum=22(检查) 走 ServiceRequest不走 DeviceRequest
// 检查申请单的诊疗定义ID存在 activityId不在 adviceDefinitionId
// deviceDefId 对应耗材定义ID不能用诊疗定义ID填充
if (adviceSaveDto.getCategoryEnum() == 22) {
log.info("handDevice skip - 检查申请单(categoryEnum=22) 走 ServiceRequest 路径,跳过 DeviceRequest 保存");
continue; // 跳过本次循环,不走耗材请求路径
} else if (adviceSaveDto.getAdviceDefinitionId() != null) {
deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id
} else {
log.warn("handDevice - deviceDefId 为空adviceDefinitionId=null, categoryEnum={}", adviceSaveDto.getCategoryEnum());
}
deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者 deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者
deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生 deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生
deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室 deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间 deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
// 发放耗材房若前端未传locationId优先沿用已有DeviceRequest的performLocation否则使用登录用户科室) // 发放耗材房若前端未传locationId使用登录用户科室作为默认值
Long locId = adviceSaveDto.getLocationId(); Long locId = adviceSaveDto.getLocationId();
if (locId == null) {
// 尝试从已有DeviceRequest获取原始的performLocation
if (adviceSaveDto.getRequestId() != null) {
DeviceRequest existingDevice = iDeviceRequestService.getById(adviceSaveDto.getRequestId());
if (existingDevice != null && existingDevice.getPerformLocation() != null) {
locId = existingDevice.getPerformLocation();
log.info("耗材locationId为空使用已有DeviceRequest的performLocation: locationId={}", locId);
}
}
// 如果已有记录也没有performLocation则使用登录用户科室作为兜底
if (locId == null) { if (locId == null) {
locId = SecurityUtils.getLoginUser().getOrgId(); locId = SecurityUtils.getLoginUser().getOrgId();
log.info("耗材locationId为空且无已有记录,使用登录用户科室作为默认值: locationId={}", locId); log.info("耗材locationId为空使用登录用户科室作为默认值: locationId={}", locId);
}
} }
deviceRequest.setPerformLocation(locId); deviceRequest.setPerformLocation(locId);
deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
@@ -1721,21 +1672,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
} }
} }
/**
* 从诊疗医嘱 contentJson 中解析检验申请单号(检验保存时写入形如 {"applyNo":"..."})。
*/
private String extractInspectionApplyNoFromContentJson(String contentJson) {
if (StringUtils.isBlank(contentJson) || !contentJson.contains("applyNo")) {
return null;
}
Matcher m = INSPECTION_APPLY_NO_JSON.matcher(contentJson);
if (!m.find()) {
return null;
}
String applyNo = m.group(1).trim();
return StringUtils.isBlank(applyNo) ? null : applyNo;
}
/** /**
* 处理诊疗 * 处理诊疗
*/ */
@@ -1784,49 +1720,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
} }
} }
} }
// 检验申请单在医嘱 contentJson 中写入 applyNo从医嘱删除时需先级联作废检验单避免检验页签仍显示孤儿申请
Map<String, List<Long>> labApplyNoToRequestIds = new LinkedHashMap<>();
for (AdviceSaveDto adviceSaveDto : deleteList) { for (AdviceSaveDto adviceSaveDto : deleteList) {
Long requestId = adviceSaveDto.getRequestId(); iServiceRequestService.removeById(adviceSaveDto.getRequestId());// 删除诊疗
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的诊疗请求
if (requestId == null) {
log.warn("BugFix#442: handService - 跳过 requestId 为 null 的删除请求");
continue;
}
iServiceRequestService.removeById(requestId);// 删除诊疗
ServiceRequest existing = iServiceRequestService.getById(adviceSaveDto.getRequestId());
if (existing == null) {
continue;
}
String applyNo = extractInspectionApplyNoFromContentJson(existing.getContentJson());
if (StringUtils.isNotBlank(applyNo)) {
labApplyNoToRequestIds.computeIfAbsent(applyNo, k -> new ArrayList<>())
.add(adviceSaveDto.getRequestId());
}
}
Set<Long> labCascadeSkippedRequestIds = new HashSet<>();
for (Map.Entry<String, List<Long>> e : labApplyNoToRequestIds.entrySet()) {
R<?> delLab = iDoctorStationInspectionLabApplyService.deleteInspectionLabApply(e.getKey());
if (delLab != null && R.isSuccess(delLab)) {
labCascadeSkippedRequestIds.addAll(e.getValue());
log.info("handService - 级联作废检验申请单 applyNo={},已跳过重复删除的医嘱 requestIds={}",
e.getKey(), e.getValue());
} else {
String msg = delLab != null && StringUtils.isNotEmpty(delLab.getMsg()) ? delLab.getMsg() : "删除检验申请单失败";
log.warn("handService - 级联作废检验申请单未成功 applyNo={} msg={},将回退为仅删除当前医嘱记录",
e.getKey(), msg);
}
}
for (AdviceSaveDto adviceSaveDto : deleteList) {
if (labCascadeSkippedRequestIds.contains(adviceSaveDto.getRequestId())) {
continue;
}
Long requestId = adviceSaveDto.getRequestId();
iServiceRequestService.removeById(requestId);// 删除诊疗
iServiceRequestService.remove( iServiceRequestService.remove(
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId, new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId,
requestId));// 删除诊疗套餐对应的子项 adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项
// 🔧 Bug Fix #219: 删除费用项 // 🔧 Bug Fix #219: 删除费用项
Long requestId = adviceSaveDto.getRequestId();
String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST; String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST;
// 直接删除费用项 // 直接删除费用项
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId); iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
@@ -1883,9 +1783,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId()); log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId());
} }
// 🔧 Bug Fix #238/#454: 诊疗项目执行科室非空校验(删除操作跳过校验) // 🔧 Bug Fix #238: 诊疗项目执行科室非空校验
if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3 if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3) {
&& !DbOpType.DELETE.getCode().equals(adviceSaveDto.getDbOpType())) {
Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId(); Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId();
if (effectiveOrgId == null) { if (effectiveOrgId == null) {
throw new ServiceException("诊疗项目必须选择执行科室"); throw new ServiceException("诊疗项目必须选择执行科室");
@@ -1907,7 +1806,6 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
} }
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源 serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
serviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量 serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码 serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
@@ -2089,25 +1987,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
*/ */
@Override @Override
public R<?> getRequestBaseInfo(Long encounterId) { public R<?> getRequestBaseInfo(Long encounterId) {
return this.getRequestBaseInfo(encounterId, null, null);
}
@Override
public R<?> getRequestBaseInfo(Long encounterId, Integer generateSourceEnum, String sourceBillNo) {
// 当前账号的参与者id // 当前账号的参与者id
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 未指定generateSourceEnum时默认只查询医生开立的医嘱
int sourceEnum = (generateSourceEnum != null) ? generateSourceEnum : GenerateSource.DOCTOR_PRESCRIPTION.getValue();
// 医嘱请求数据 // 医嘱请求数据
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, null, List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, null,
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(), CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
sourceEnum, sourceBillNo); GenerateSource.DOCTOR_PRESCRIPTION.getValue());
// 手术计费场景sourceBillNo 不为空时过滤掉药品1保留耗材2和诊疗3/6
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
&& dto.getAdviceType() == 1);
}
for (RequestBaseDto requestBaseDto : requestBaseInfo) { for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态 // 请求状态
requestBaseDto requestBaseDto
@@ -2228,7 +2114,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, patientId, List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, patientId,
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(), CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), null); GenerateSource.DOCTOR_PRESCRIPTION.getValue());
for (RequestBaseDto requestBaseDto : requestBaseInfo) { for (RequestBaseDto requestBaseDto : requestBaseInfo) {
// 请求状态 // 请求状态
requestBaseDto requestBaseDto

View File

@@ -261,10 +261,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
// 设置创建时间,避免数据库约束错误 // 设置创建时间,避免数据库约束错误
encounterDiagnosis.setCreateTime(new Date()); encounterDiagnosis.setCreateTime(new Date());
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis); iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
// 回写就诊诊断ID供前端后续更新使用
saveDiagnosisChildParam.setEncounterDiagnosisId(encounterDiagnosis.getId());
} }
return R.ok(saveDiagnosisParam, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"})); return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
} }
@@ -582,11 +580,7 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
@Override @Override
public R<?> saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) { public R<?> saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) {
// 检查卡片编号唯一性(新增时检查,编辑时排除当前记录) // 检查卡片编号唯一性(新增时检查,编辑时排除当前记录)
String cardNo = infectiousDiseaseReportDto.getCardNo(); String cardNo = infectiousDiseaseReportDto.getCardNo().trim();
if (cardNo == null || cardNo.trim().isEmpty()) {
return R.fail("卡片编号不能为空");
}
cardNo = cardNo.trim();
LambdaQueryWrapper<InfectiousDiseaseReport> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<InfectiousDiseaseReport> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo); queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo);
long count = iInfectiousDiseaseReportService.count(queryWrapper); long count = iInfectiousDiseaseReportService.count(queryWrapper);

View File

@@ -307,15 +307,13 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) { if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) {
divPoolId = queueItem.getPoolId(); divPoolId = queueItem.getPoolId();
divSlotId = queueItem.getSlotId(); divSlotId = queueItem.getSlotId();
} } else if (encounter.getOrderId() != null) {
// 队列项 poolId/slotId 缺失时,通过 encounter.orderId → order_main.slot_id → adm_schedule_slot.pool_id 回退获取
if ((divPoolId == null || divSlotId == null) && encounter.getOrderId() != null) {
try { try {
Order order = iOrderService.getById(encounter.getOrderId()); Order order = iOrderService.getById(encounter.getOrderId());
if (order != null && order.getSlotId() != null) { if (order != null && order.getSlotId() != null) {
ScheduleSlot slot = scheduleSlotMapper.selectById(order.getSlotId()); divSlotId = order.getSlotId();
ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId);
if (slot != null) { if (slot != null) {
divSlotId = slot.getId();
divPoolId = slot.getPoolId(); divPoolId = slot.getPoolId();
} }
} }
@@ -326,9 +324,6 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
// 如果队列项存在且未完成,更新队列状态为已完成 // 如果队列项存在且未完成,更新队列状态为已完成
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态 // 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
// Bug #401在更新前记录队列原始完成状态用于判断是否需要写入 div_log
boolean queueWasAlreadyCompleted = queueItem != null
&& TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus());
if (queueItem != null && if (queueItem != null &&
!TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) { !TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) {
java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS); java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
@@ -346,8 +341,6 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
} }
// 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录) // 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录)
// Bug #401使用更新前记录的原始状态判断避免自身更新后将状态改为 COMPLETED 导致误判为"已完成"
if (!queueWasAlreadyCompleted) {
try { try {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
DivLog divLog = new DivLog() DivLog divLog = new DivLog()
@@ -362,7 +355,6 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
} catch (Exception e) { } catch (Exception e) {
log.error("写入div_log审计日志失败", e); log.error("写入div_log审计日志失败", e);
} }
}
// 4. 更新状态、完成时间以及初复诊标识 // 4. 更新状态、完成时间以及初复诊标识
Date now = new Date(); Date now = new Date();

View File

@@ -112,16 +112,11 @@ public class DoctorStationAdviceController {
* 查询医嘱请求数据 * 查询医嘱请求数据
* *
* @param encounterId 就诊id * @param encounterId 就诊id
* @param generateSourceEnum 生成来源(可选,用于按来源过滤,如手术计费=6
* @param sourceBillNo 来源业务单据号(可选,用于按来源单据过滤)
* @return 医嘱请求数据 * @return 医嘱请求数据
*/ */
@GetMapping(value = "/request-base-info") @GetMapping(value = "/request-base-info")
public R<?> getRequestBaseInfo( public R<?> getRequestBaseInfo(@RequestParam(required = false) Long encounterId) {
@RequestParam(required = false) Long encounterId, return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId);
@RequestParam(required = false) Integer generateSourceEnum,
@RequestParam(required = false) String sourceBillNo) {
return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId, generateSourceEnum, sourceBillNo);
} }
/** /**

View File

@@ -122,8 +122,7 @@ public interface DoctorStationAdviceAppMapper {
@Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST, @Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST, @Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId, @Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
@Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum, @Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum);
@Param("sourceBillNo") String sourceBillNo);
/** /**
* 查询就诊费用性质 * 查询就诊费用性质

View File

@@ -178,26 +178,15 @@ public class AdviceUtils {
// 生命提示信息集合 // 生命提示信息集合
List<String> tipsList = new ArrayList<>(); List<String> tipsList = new ArrayList<>();
for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) { for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) {
// 第一步:按 performLocation 匹配指定药房的库存 // 聚合同一位置所有批次的库存总量
List<AdviceInventoryDto> matchedInventories = adviceInventory.stream() List<AdviceInventoryDto> matchedInventories = adviceInventory.stream()
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId()) .filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable()) && CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
&& (medicationRequestUseExe.getPerformLocation() == null && medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId())
|| medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId()))
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件 // 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber()) && (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber()))) || medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 第二步:如果指定药房没有匹配到库存,则放宽条件查询所有药房的库存
if (matchedInventories.isEmpty()) {
matchedInventories = adviceInventory.stream()
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
.collect(Collectors.toList());
}
// 匹配到库存信息 // 匹配到库存信息
if (!matchedInventories.isEmpty()) { if (!matchedInventories.isEmpty()) {
// 聚合所有批次的可用库存 // 聚合所有批次的可用库存

View File

@@ -31,7 +31,6 @@ public class NursingRecordController {
* 获取住院患者信息 分页显示 * 获取住院患者信息 分页显示
* *
* @param nursingSearchParam 查询参数 * @param nursingSearchParam 查询参数
*
* @param searchKey 模糊查询 * @param searchKey 模糊查询
* @param pageNo 当前页码 * @param pageNo 当前页码
* @param pageSize 查询条数 * @param pageSize 查询条数

View File

@@ -63,20 +63,4 @@ public interface IRequestFormManageAppService {
* @return 申请单 * @return 申请单
*/ */
IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto); IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto);
/**
* 删除申请单(仅待签发状态可删除)
*
* @param requestFormId 申请单ID
* @return 结果
*/
R<?> deleteRequestForm(Long requestFormId);
/**
* 撤回申请单(已签发状态撤回至待签发)
*
* @param requestFormId 申请单ID
* @return 结果
*/
R<?> withdrawRequestForm(Long requestFormId);
} }

View File

@@ -341,7 +341,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) && (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发单条医嘱时产生重复记录 // 防重复保存:对新增医嘱进行去重,避免签发单条长期医嘱时产生重复记录
Set<String> longUniqueKeySet = new HashSet<>(); Set<String> longUniqueKeySet = new HashSet<>();
List<RegAdviceSaveDto> longUniqueList = new ArrayList<>(); List<RegAdviceSaveDto> longUniqueList = new ArrayList<>();
for (RegAdviceSaveDto adviceSaveDto : longInsertOrUpdateList) { for (RegAdviceSaveDto adviceSaveDto : longInsertOrUpdateList) {
@@ -351,10 +351,10 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
+ adviceSaveDto.getDose() + "_" + adviceSaveDto.getDose() + "_"
+ adviceSaveDto.getMethodCode() + "_" + adviceSaveDto.getMethodCode() + "_"
+ adviceSaveDto.getRateCode(); + adviceSaveDto.getRateCode();
if (longUniqueKeySet.contains(uniqueKey)) { if (DbOpType.INSERT.getCode().equals(adviceSaveDto.getDbOpType()) && longUniqueKeySet.contains(uniqueKey)) {
log.warn("防重复保存:检测到重复长期医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}", log.warn("防重复保存:检测到重复长期医嘱,跳过保存 - patientId={}, encounterId={}, adviceDefinitionId={}, dose={}",
adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(), adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(),
adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType()); adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDose());
continue; continue;
} }
longUniqueKeySet.add(uniqueKey); longUniqueKeySet.add(uniqueKey);
@@ -429,7 +429,7 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType()))) && (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发时产生重复记录 // 防重复保存:对新增医嘱进行去重
Set<String> tempUniqueKeySet = new HashSet<>(); Set<String> tempUniqueKeySet = new HashSet<>();
List<RegAdviceSaveDto> tempUniqueList = new ArrayList<>(); List<RegAdviceSaveDto> tempUniqueList = new ArrayList<>();
for (RegAdviceSaveDto adviceSaveDto : tempInsertOrUpdateList) { for (RegAdviceSaveDto adviceSaveDto : tempInsertOrUpdateList) {
@@ -439,10 +439,10 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
+ adviceSaveDto.getDose() + "_" + adviceSaveDto.getDose() + "_"
+ adviceSaveDto.getMethodCode() + "_" + adviceSaveDto.getMethodCode() + "_"
+ adviceSaveDto.getRateCode(); + adviceSaveDto.getRateCode();
if (tempUniqueKeySet.contains(uniqueKey)) { if (DbOpType.INSERT.getCode().equals(adviceSaveDto.getDbOpType()) && tempUniqueKeySet.contains(uniqueKey)) {
log.warn("防重复保存:检测到重复临时医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}", log.warn("防重复保存:检测到重复临时医嘱,跳过保存 - patientId={}, encounterId={}, adviceDefinitionId={}, dose={}",
adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(), adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(),
adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType()); adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDose());
continue; continue;
} }
tempUniqueKeySet.add(uniqueKey); tempUniqueKeySet.add(uniqueKey);
@@ -710,21 +710,11 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
// 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新) // 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新)
if (!processedRequestIds.isEmpty()) { if (!processedRequestIds.isEmpty()) {
// 🔧 Bug #487 修复:签发时额外设置 authoredTime确保签发时间被记录
if (is_sign) {
iServiceRequestService.update(null, iServiceRequestService.update(null,
new LambdaUpdateWrapper<ServiceRequest>() new LambdaUpdateWrapper<ServiceRequest>()
.set(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue()) .set(ServiceRequest::getStatusEnum,
.set(ServiceRequest::getAuthoredTime, authoredTime) is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue())
.set(ServiceRequest::getSignCode, signCode)
.in(ServiceRequest::getId, processedRequestIds)); .in(ServiceRequest::getId, processedRequestIds));
log.info("签发诊疗医嘱成功requestIds: {}, signCode: {}", processedRequestIds, signCode);
} else {
iServiceRequestService.update(null,
new LambdaUpdateWrapper<ServiceRequest>()
.set(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue())
.in(ServiceRequest::getId, processedRequestIds));
}
} }
} }
@@ -761,8 +751,6 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
if (is_sign) { if (is_sign) {
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间 deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
} }
// 保存或签发时都需要设置耗材定义ID防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束)
deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId());
// 保存时处理的字段属性 // 保存时处理的字段属性
if (is_save) { if (is_save) {
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
@@ -800,8 +788,6 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
if (is_sign) { if (is_sign) {
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间 deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
} }
// 保存或签发时都需要设置耗材定义ID防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束)
deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId());
// 保存时处理的字段属性 // 保存时处理的字段属性
if (is_save) { if (is_save) {
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));

View File

@@ -1,7 +1,6 @@
package com.openhis.web.regdoctorstation.appservice.impl; package com.openhis.web.regdoctorstation.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
@@ -77,38 +76,12 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) { public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) {
// 申请单ID前端空字符串可能反序列化为0L需同时判0
Long requestFormId = requestFormSaveDto.getRequestFormId();
boolean isEdit = requestFormId != null && requestFormId != 0L;
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
if (activityOrganizationConfig.isEmpty()) {
throw new ServiceException("请先配置当前时间段的执行科室");
}
// 逐个校验activityList中的项目是否都配置了执行科室并收集positionId供后续使用
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
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);
}
}
// 诊疗处方号 // 诊疗处方号
String prescriptionNo; String prescriptionNo;
// 申请单ID
Long requestFormId = requestFormSaveDto.getRequestFormId();
// 编辑场景 // 编辑场景
if (isEdit) { if (requestFormId != null) {
RequestForm requestFormInfo = iRequestFormService.getById(requestFormId); RequestForm requestFormInfo = iRequestFormService.getById(requestFormId);
prescriptionNo = requestFormInfo.getPrescriptionNo(); prescriptionNo = requestFormInfo.getPrescriptionNo();
// 该申请单存在的待发送医嘱个数 // 该申请单存在的待发送医嘱个数
@@ -152,7 +125,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
iRequestFormService.saveOrUpdate(requestForm); iRequestFormService.saveOrUpdate(requestForm);
// 编辑场景时,先删除掉原有诊疗项目及账单再新增 // 编辑场景时,先删除掉原有诊疗项目及账单再新增
if (isEdit) { if (requestFormId != null) {
List<Long> serviceRequestIds = iServiceRequestService List<Long> serviceRequestIds = iServiceRequestService
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo)) .list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
.stream().map(ServiceRequest::getId).collect(Collectors.toList()); .stream().map(ServiceRequest::getId).collect(Collectors.toList());
@@ -166,7 +139,15 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
ServiceRequest serviceRequest; ServiceRequest serviceRequest;
ChargeItem chargeItem; ChargeItem chargeItem;
// 诊疗集合
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
log.info("保存申请单typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId); log.info("保存申请单typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId);
// 诊疗执行科室配置
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
if (activityOrganizationConfig.isEmpty()) {
throw new ServiceException("请先配置当前时间段的执行科室");
}
for (ActivitySaveDto activitySaveDto : activityList) { for (ActivitySaveDto activitySaveDto : activityList) {
serviceRequest = new ServiceRequest(); serviceRequest = new ServiceRequest();
@@ -184,7 +165,9 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
serviceRequest.setEncounterId(encounterId); // 就诊id serviceRequest.setEncounterId(encounterId); // 就诊id
serviceRequest.setAuthoredTime(curDate); // 请求签发时间 serviceRequest.setAuthoredTime(curDate); // 请求签发时间
Long positionId = activityIdToPositionIdMap.get(activitySaveDto.getAdviceDefinitionId()); Long positionId = activityOrganizationConfig.stream()
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
if (positionId == null) { if (positionId == null) {
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室"); throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
} }
@@ -295,7 +278,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
surgeryServiceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue()); surgeryServiceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());
surgeryServiceRequest.setQuantity(BigDecimal.valueOf(1)); surgeryServiceRequest.setQuantity(BigDecimal.valueOf(1));
surgeryServiceRequest.setUnitCode(""); surgeryServiceRequest.setUnitCode("");
surgeryServiceRequest.setCategoryEnum(24); // 24-手术(新值域,避开 adviceType 碰撞) surgeryServiceRequest.setCategoryEnum(4); // 4-手术
// 优先从 activityList 获取手术 ID // 优先从 activityList 获取手术 ID
if (activityList != null && !activityList.isEmpty()) { if (activityList != null && !activityList.isEmpty()) {
Long activityId = activityList.get(0).getAdviceDefinitionId(); Long activityId = activityList.get(0).getAdviceDefinitionId();
@@ -491,90 +474,4 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page); return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
} }
@Override
public R<?> deleteRequestForm(Long requestFormId) {
if (requestFormId == null) {
return R.fail("申请单ID不能为空");
}
RequestForm requestForm = iRequestFormService.getById(requestFormId);
if (requestForm == null) {
return R.fail("申请单不存在");
}
String prescriptionNo = requestForm.getPrescriptionNo();
// 查询该申请单下所有 ServiceRequest含子项
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
new LambdaQueryWrapper<ServiceRequest>()
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
if (serviceRequests == null || serviceRequests.isEmpty()) {
return R.fail("未找到关联的诊疗医嘱");
}
// 校验:只有待签发(status=0)的申请单可删除
boolean allDraft = serviceRequests.stream()
.allMatch(sr -> RequestStatus.DRAFT.getValue().equals(sr.getStatusEnum()));
if (!allDraft) {
return R.fail("只有待签发状态的申请单可删除");
}
List<Long> serviceRequestIds = serviceRequests.stream()
.map(ServiceRequest::getId).collect(Collectors.toList());
// 1. 删除关联的费用项
for (Long srId : serviceRequestIds) {
iChargeItemService.deleteByServiceTableAndId(
CommonConstants.TableName.WOR_SERVICE_REQUEST, srId);
}
// 2. 删除子项 ServiceRequestparentId 非空)
iServiceRequestService.remove(
new LambdaQueryWrapper<ServiceRequest>()
.in(ServiceRequest::getId, serviceRequestIds)
.isNotNull(ServiceRequest::getParentId));
// 3. 删除主项 ServiceRequest
iServiceRequestService.removeByIds(serviceRequestIds);
// 4. 删除申请单
iRequestFormService.removeById(requestFormId);
log.info("检查申请单删除成功requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
return R.ok("删除成功");
}
@Override
public R<?> withdrawRequestForm(Long requestFormId) {
if (requestFormId == null) {
return R.fail("申请单ID不能为空");
}
RequestForm requestForm = iRequestFormService.getById(requestFormId);
if (requestForm == null) {
return R.fail("申请单不存在");
}
String prescriptionNo = requestForm.getPrescriptionNo();
// 查询该申请单下所有 ServiceRequest
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
new LambdaQueryWrapper<ServiceRequest>()
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
if (serviceRequests == null || serviceRequests.isEmpty()) {
return R.fail("未找到关联的诊疗医嘱");
}
// 校验:只有已签发(status=2)的申请单可撤回
boolean allActive = serviceRequests.stream()
.allMatch(sr -> RequestStatus.ACTIVE.getValue().equals(sr.getStatusEnum()));
if (!allActive) {
return R.fail("只有已签发状态的申请单可撤回");
}
// 将所有 ServiceRequest 状态改回待签发(DRAFT=0)
List<Long> serviceRequestIds = serviceRequests.stream()
.map(ServiceRequest::getId).collect(Collectors.toList());
iServiceRequestService.update(
new ServiceRequest().setStatusEnum(RequestStatus.DRAFT.getValue()),
new LambdaUpdateWrapper<ServiceRequest>()
.in(ServiceRequest::getId, serviceRequestIds));
log.info("检查申请单撤回成功requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
return R.ok("撤回成功");
}
} }

View File

@@ -16,9 +16,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 申请单管理 controller * 申请单管理 controller
@@ -83,23 +81,14 @@ public class RequestFormManageController {
* 查询检查申请单 * 查询检查申请单
* *
* @param encounterId 就诊id * @param encounterId 就诊id
* @param startDate 开始日期可选格式yyyy-MM-dd
* @param endDate 结束日期可选格式yyyy-MM-dd
* @param status 单据状态(可选)
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
* @return 检查申请单 * @return 检查申请单
*/ */
@GetMapping(value = "/get-check") @GetMapping(value = "/get-check")
public R<?> getCheckRequestForm( public R<?> getCheckRequestForm(@RequestParam(required = false) Long encounterId) {
@RequestParam(required = false) Long encounterId,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate,
@RequestParam(required = false) String status,
@RequestParam(required = false) String keyword) {
if (encounterId == null) { if (encounterId == null) {
return R.fail("就诊ID不能为空"); return R.fail("就诊ID不能为空");
} }
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode(), startDate, endDate, status, keyword)); return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode()));
} }
/** /**
@@ -152,32 +141,6 @@ public class RequestFormManageController {
} }
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode())); return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode()));
} }
/**
* 分页查询手术申请单全局不需要encounterId用于门诊手术安排查找弹窗
*
* @param surgeryNo 手术单号(模糊查询,可选)
* @param applyTimeStart 申请时间起始(可选)
* @param applyTimeEnd 申请时间截止(可选)
* @param mainDoctorId 主刀医生ID可选
* @param applyDeptId 申请科室ID可选
* @param pageNo 页码默认1
* @param pageSize 每页数量默认10
* @return 分页手术申请单列表
*/
@GetMapping(value = "/get-surgery-page")
public R<IPage<RequestFormPageDto>> getSurgeryRequestFormPage(
@RequestParam(required = false) String surgeryNo,
@RequestParam(required = false) LocalDate applyTimeStart,
@RequestParam(required = false) LocalDate applyTimeEnd,
@RequestParam(required = false) Long mainDoctorId,
@RequestParam(required = false) Long applyDeptId,
@RequestParam(defaultValue = "1") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize) {
RequestFormDto dto = new RequestFormDto(surgeryNo, ActivityDefCategory.PROCEDURE.getCode(), applyTimeStart, applyTimeEnd,
mainDoctorId, applyDeptId, pageNo, pageSize);
return R.ok(iRequestFormManageAppService.getRequestFormPage(dto));
}
/** /**
* 分页查询申请单 * 分页查询申请单
* @return 申请单 * @return 申请单
@@ -186,26 +149,4 @@ public class RequestFormManageController {
public R<IPage<RequestFormPageDto>> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) { public R<IPage<RequestFormPageDto>> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) {
return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto)); return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto));
} }
/**
* 删除申请单(仅待签发状态可删除)
*
* @param data 包含 requestFormId 的请求体
* @return 结果
*/
@PostMapping(value = "/delete")
public R<?> deleteRequestForm(@RequestBody Map<String, Long> data) {
return iRequestFormManageAppService.deleteRequestForm(data.get("requestFormId"));
}
/**
* 撤回申请单(已签发状态撤回至待签发)
*
* @param data 包含 requestFormId 的请求体
* @return 结果
*/
@PostMapping(value = "/withdraw")
public R<?> withdrawRequestForm(@RequestBody Map<String, Long> data) {
return iRequestFormManageAppService.withdrawRequestForm(data.get("requestFormId"));
}
} }

View File

@@ -14,10 +14,6 @@ public class RequestFormDto {
* 手术单号 * 手术单号
*/ */
private String surgeryNo; private String surgeryNo;
/**
* 申请单类型编码
*/
private String typeCode;
/** /**
* 申请时间开始 * 申请时间开始
*/ */

View File

@@ -138,12 +138,4 @@ public class CurrentDayEncounterTencentDto {
*/ */
private String englishName; private String englishName;
/** 号源池ID用于分诊队列 div_log 审计日志) */
@JsonSerialize(using = ToStringSerializer.class)
private Long poolId;
/** 号源槽位ID用于分诊队列 div_log 审计日志) */
@JsonSerialize(using = ToStringSerializer.class)
private Long slotId;
} }

View File

@@ -97,10 +97,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(
wsr.content_json::json->>'surgeryName',
wsr.content_json::json->>'adviceName',
T9sr.surgery_name)
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = 6 THEN T2."name"
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
@@ -112,7 +108,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
WHEN T1.context_enum = 6 THEN T2.yb_no WHEN T1.context_enum = 6 THEN T2.yb_no
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
@@ -123,7 +118,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id)
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
WHEN T1.context_enum = 6 THEN T2.id WHEN T1.context_enum = 6 THEN T2.id
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
@@ -165,11 +159,6 @@
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0' LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0' LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0' LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6
AND T1.service_table = 'wor_service_request'
AND wsr.activity_id IS NOT NULL
AND wsr.activity_id = T9sr.id
AND T9sr.delete_flag = '0'
LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0' LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0'
WHERE T1.encounter_id = #{encounterId} WHERE T1.encounter_id = #{encounterId}
AND T1.status_enum IN (0 AND T1.status_enum IN (0
@@ -234,10 +223,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(
wsr.content_json::json->>'surgeryName',
wsr.content_json::json->>'adviceName',
T9sr.surgery_name)
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
WHEN T1.context_enum = 6 THEN T2."name" WHEN T1.context_enum = 6 THEN T2."name"
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name") WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
@@ -249,7 +234,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
WHEN T1.context_enum = 6 THEN T2.yb_no WHEN T1.context_enum = 6 THEN T2.yb_no
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
@@ -260,7 +244,6 @@
CASE CASE
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id)
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
WHEN T1.context_enum = 6 THEN T2.id WHEN T1.context_enum = 6 THEN T2.id
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0 WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
@@ -303,11 +286,6 @@
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0' LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0' LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0' LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6
AND T1.service_table = 'wor_service_request'
AND wsr.activity_id IS NOT NULL
AND wsr.activity_id = T9sr.id
AND T9sr.delete_flag = '0'
WHERE T1.encounter_id = #{encounterId} WHERE T1.encounter_id = #{encounterId}
AND T1.status_enum IN (0 AND T1.status_enum IN (0
, #{planned} , #{planned}

View File

@@ -71,7 +71,7 @@
</if> </if>
AND os.delete_flag = '0' AND os.delete_flag = '0'
</where> </where>
ORDER BY os.create_time DESC, os.schedule_id DESC ORDER BY os.create_time DESC
</select> </select>
<!-- 根据ID查询手术安排详情--> <!-- 根据ID查询手术安排详情-->
<select id="getSurgeryScheduleDetail" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto"> <select id="getSurgeryScheduleDetail" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
@@ -89,14 +89,15 @@
cs.apply_doctor_name AS apply_doctor_name, cs.apply_doctor_name AS apply_doctor_name,
drf.create_time AS apply_time, drf.create_time AS apply_time,
os.surgery_nature AS surgeryType, os.surgery_nature AS surgeryType,
cs.incision_level AS incisionLevel,
fc.contract_name AS feeType, fc.contract_name AS feeType,
os.fee_type AS feeType,
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
FROM op_schedule os FROM op_schedule os
LEFT JOIN adm_patient ap ON os.patient_id = ap.id 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' 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 adm_organization o ON cs.org_id = o.id
LEFT JOIN adm_encounter ae ON ae.id = cs.encounter_id AND ae.delete_flag = '0'
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
LEFT JOIN ( LEFT JOIN (
SELECT patient_id, identifier_no SELECT patient_id, identifier_no
@@ -185,7 +186,7 @@
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if> <if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if>
<if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if> <if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if>
</where> </where>
ORDER BY os.create_time DESC, os.schedule_id DESC ORDER BY os.create_time DESC
</select> </select>
<!-- 查询时间段内该手术室是否被占用--> <!-- 查询时间段内该手术室是否被占用-->
<select id="isScheduleConflict" resultType="java.lang.Boolean"> <select id="isScheduleConflict" resultType="java.lang.Boolean">

View File

@@ -239,7 +239,7 @@
NULL AS activity_type_dictText, NULL AS activity_type_dictText,
-- 前端"包装单位"列显示使用单位permitted_unit_code -- 前端"包装单位"列显示使用单位permitted_unit_code
T1.permitted_unit_code AS unit_code, T1.permitted_unit_code AS unit_code,
T1.permitted_unit_code AS min_unit_code, '' AS min_unit_code,
'' AS volume, '' AS volume,
'' AS method_code, '' AS method_code,
'' AS rate_code, '' AS rate_code,
@@ -527,9 +527,6 @@
LEFT JOIN cli_condition AS cc ON cc.id = T1.condition_id AND cc.delete_flag = '0' LEFT JOIN cli_condition AS cc ON cc.id = T1.condition_id AND cc.delete_flag = '0'
LEFT JOIN cli_condition_definition AS ccd ON ccd.id = cc.definition_id LEFT JOIN cli_condition_definition AS ccd ON ccd.id = cc.definition_id
WHERE T1.delete_flag = '0' AND T1.tcm_flag = 0 WHERE T1.delete_flag = '0' AND T1.tcm_flag = 0
<if test="generateSourceEnum != null">
AND T1.generate_source_enum = #{generateSourceEnum}
</if>
<if test="historyFlag == '0'.toString()"> <if test="historyFlag == '0'.toString()">
AND T1.encounter_id = #{encounterId} AND T1.encounter_id = #{encounterId}
</if> </if>
@@ -539,8 +536,7 @@
AND T1.refund_medicine_id IS NULL AND T1.refund_medicine_id IS NULL
ORDER BY T1.status_enum,T1.sort_number) ORDER BY T1.status_enum,T1.sort_number)
UNION ALL UNION ALL
-- 🔧 查询仅存在于 adm_charge_item 的"孤儿"耗材数据DeviceRequest 缺失或 generate_source_enum 未设置 -- 🔧 新增:查询门诊术中计费生成的耗材数据(这些数据存在于 adm_charge_item 和 wor_device_request
-- 正常 DeviceRequestgenerate_source_enum 已赋值)由下方 Part 3 统一负责,此处不做重复覆盖避免 UNION ALL 重复行
(SELECT 2 AS advice_type, (SELECT 2 AS advice_type,
CI.service_id AS request_id, CI.service_id AS request_id,
CI.service_id || '-ci-dev' AS unique_key, CI.service_id || '-ci-dev' AS unique_key,
@@ -584,9 +580,6 @@
LEFT JOIN adm_location AS AL ON AL.id = DR.perform_location AND AL.delete_flag = '0' LEFT JOIN adm_location AS AL ON AL.id = DR.perform_location AND AL.delete_flag = '0'
WHERE CI.delete_flag = '0' WHERE CI.delete_flag = '0'
AND CI.service_table = 'wor_device_request' AND CI.service_table = 'wor_device_request'
<if test="generateSourceEnum != null">
AND DR.generate_source_enum IS NULL <!-- 仅匹配孤儿记录normal DeviceRequest 由 Part 3 负责,避免 UNION ALL 重复 -->
</if>
<if test="historyFlag == '0'.toString()"> <if test="historyFlag == '0'.toString()">
AND CI.encounter_id = #{encounterId} AND CI.encounter_id = #{encounterId}
</if> </if>
@@ -702,9 +695,6 @@
-- based_on_table='med_medication_request' → 输液/皮试执行记录,应排除 -- based_on_table='med_medication_request' → 输液/皮试执行记录,应排除
-- based_on_table='exam_apply'/'lab_apply' → 申请单原始医嘱,应保留 -- based_on_table='exam_apply'/'lab_apply' → 申请单原始医嘱,应保留
AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL OR T1.based_on_table NOT IN ('med_medication_request', 'med_medication_dispense')) AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL OR T1.based_on_table NOT IN ('med_medication_request', 'med_medication_dispense'))
<if test="sourceBillNo != null and sourceBillNo != ''">
AND T1.prescription_no = #{sourceBillNo}
</if>
<if test="historyFlag == '0'.toString()"> <if test="historyFlag == '0'.toString()">
AND T1.encounter_id = #{encounterId} AND T1.encounter_id = #{encounterId}
</if> </if>

View File

@@ -264,6 +264,7 @@
WHERE ael.status_enum = #{active} WHERE ael.status_enum = #{active}
AND ael.delete_flag = '0' AND ael.delete_flag = '0'
AND ael.form_enum = #{bed} AND ael.form_enum = #{bed}
LIMIT 1
) AS bed ON bed.encounter_id = ae.id ) AS bed ON bed.encounter_id = ae.id
LEFT JOIN ( LEFT JOIN (
SELECT ael.encounter_id, SELECT ael.encounter_id,
@@ -274,6 +275,7 @@
WHERE ael.status_enum = #{active} WHERE ael.status_enum = #{active}
AND ael.delete_flag = '0' AND ael.delete_flag = '0'
AND ael.form_enum = #{house} AND ael.form_enum = #{house}
LIMIT 1
) AS house ON house.encounter_id = ae.id ) AS house ON house.encounter_id = ae.id
LEFT JOIN ( LEFT JOIN (
SELECT ael.encounter_id, SELECT ael.encounter_id,
@@ -284,6 +286,7 @@
WHERE ael.status_enum = #{active} WHERE ael.status_enum = #{active}
AND ael.delete_flag = '0' AND ael.delete_flag = '0'
AND ael.form_enum = #{ward} AND ael.form_enum = #{ward}
LIMIT 1
) AS ward ON ward.encounter_id = ae.id ) AS ward ON ward.encounter_id = ae.id
LEFT JOIN ( LEFT JOIN (
SELECT aep.encounter_id, SELECT aep.encounter_id,

View File

@@ -155,7 +155,7 @@
ii.performer_check_id, ii.performer_check_id,
ii.category_code, ii.category_code,
ii.dispense_status ii.dispense_status
FROM (( SELECT DISTINCT T1.encounter_id, FROM (( SELECT T1.encounter_id,
T1.tenant_id, T1.tenant_id,
#{medMedicationRequest} AS advice_table, #{medMedicationRequest} AS advice_table,
T1.id AS request_id, T1.id AS request_id,
@@ -293,7 +293,7 @@
T1.sort_number, T1.sort_number,
T1.group_id ) T1.group_id )
UNION UNION
( SELECT DISTINCT T1.encounter_id, ( SELECT T1.encounter_id,
T1.tenant_id, T1.tenant_id,
#{worServiceRequest} AS advice_table, #{worServiceRequest} AS advice_table,
T1.id AS request_id, T1.id AS request_id,

View File

@@ -288,7 +288,7 @@
AND T1.refund_device_id IS NULL AND T1.refund_device_id IS NULL
ORDER BY T1.status_enum) ORDER BY T1.status_enum)
UNION ALL UNION ALL
(SELECT CASE WHEN T1.category_enum IN (4, 24) THEN 6 ELSE 3 END AS advice_type, (SELECT CASE WHEN T1.category_enum = 4 THEN 6 ELSE COALESCE(T1.category_enum, 3) END AS advice_type,
T1.id AS request_id, T1.id AS request_id,
T1.id || '-3' AS unique_key, T1.id || '-3' AS unique_key,
T1.requester_id AS requester_id, T1.requester_id AS requester_id,

View File

@@ -21,7 +21,6 @@
WHEN 5 THEN 5 WHEN 5 THEN 5
WHEN 6 THEN 5 WHEN 6 THEN 5
WHEN 7 THEN 5 WHEN 7 THEN 5
WHEN 8 THEN 6
ELSE NULL ELSE NULL
END AS status END AS status
FROM doc_request_form AS drf FROM doc_request_form AS drf
@@ -49,7 +48,6 @@
WHEN 5 THEN 5 WHEN 5 THEN 5
WHEN 6 THEN 5 WHEN 6 THEN 5
WHEN 7 THEN 5 WHEN 7 THEN 5
WHEN 8 THEN 6
ELSE NULL ELSE NULL
END = #{status}::integer END = #{status}::integer
</if> </if>
@@ -163,9 +161,6 @@
<if test="requestFormDto.surgeryNo != null and requestFormDto.surgeryNo != ''"> <if test="requestFormDto.surgeryNo != null and requestFormDto.surgeryNo != ''">
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%') AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
</if> </if>
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
AND drf.type_code = #{requestFormDto.typeCode}
</if>
<if test="requestFormDto.applyTimeStart != null"> <if test="requestFormDto.applyTimeStart != null">
AND drf.create_time >= #{requestFormDto.applyTimeStart} AND drf.create_time >= #{requestFormDto.applyTimeStart}
</if> </if>

View File

@@ -27,9 +27,7 @@
T9.payment_id, T9.payment_id,
T9.picture_url, T9.picture_url,
T9.birth_date, T9.birth_date,
t9.english_name, t9.english_name
t9.slot_id,
t9.pool_id
from ( from (
SELECT T1.tenant_id AS tenant_id, SELECT T1.tenant_id AS tenant_id,
T1.id AS encounter_id, T1.id AS encounter_id,
@@ -53,9 +51,7 @@
T13.id AS payment_id, T13.id AS payment_id,
ai.picture_url AS picture_url, ai.picture_url AS picture_url,
T8.birth_date AS birth_date, T8.birth_date AS birth_date,
tx.staff_english_name AS english_name, tx.staff_english_name AS english_name
om_slot.slot_id AS slot_id,
om_slot.pool_id AS pool_id
FROM adm_encounter AS T1 FROM adm_encounter AS T1
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0' LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0' LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
@@ -95,8 +91,6 @@
AND T13.status_enum = ${paymentStatus} AND T13.status_enum = ${paymentStatus}
LEFT JOIN adm_invoice AS ai LEFT JOIN adm_invoice AS ai
ON ai.reconciliation_id = T13.id AND ai.delete_flag = '0' ON ai.reconciliation_id = T13.id AND ai.delete_flag = '0'
LEFT JOIN order_main AS om ON T1.order_id = om.id AND om.delete_flag = '0'
LEFT JOIN adm_schedule_slot AS om_slot ON om.slot_id = om_slot.id
WHERE T1.delete_flag = '0' WHERE T1.delete_flag = '0'
AND T1.class_enum = #{classEnum} AND T1.class_enum = #{classEnum}
AND T10.context_enum = #{register} AND T10.context_enum = #{register}

View File

@@ -193,9 +193,6 @@ public class OpSchedule extends HisBaseEntity {
/** 外请专家姓名 */ /** 外请专家姓名 */
private String externalExpertName; private String externalExpertName;
/** 费用类别 */
private String feeType;
/** 备注信息 */ /** 备注信息 */
private String remark; private String remark;

View File

@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS triage_queue_item (
patient_name VARCHAR(255), patient_name VARCHAR(255),
healthcare_name VARCHAR(255), healthcare_name VARCHAR(255),
practitioner_name VARCHAR(255), practitioner_name VARCHAR(255),
status INTEGER NOT NULL DEFAULT 0, -- 分诊队列状态: 0=WAITING(等待), 10=CALLING(叫号中), 20=IN_CLINIC(诊中), 30=COMPLETED(已完成), 40=SKIPPED(已跳过) status VARCHAR(50) NOT NULL, -- WAITING/CALLING/SKIPPED/COMPLETED
queue_order INTEGER NOT NULL, queue_order INTEGER NOT NULL,
create_time TIMESTAMP, create_time TIMESTAMP,
update_time TIMESTAMP, update_time TIMESTAMP,

View File

@@ -1,30 +0,0 @@
-- Bug #400 修复triage_queue_item.status 字段类型修正
-- 原 DDL 将 status 定义为 VARCHAR(50),但 Java 实体 TriageQueueItem.status 为 Integer 类型,
-- 应用层使用 TriageQueueStatus 枚举值0/10/20/30/40写入类型不匹配导致 MyBatis-Plus
-- 无法正确映射 status 字段,完诊时 status 更新为 30 失败。
--
-- 注意:必须在后端实际连接的 schema 中执行dev=hisdev, test=histest, prd=hisprd
-- 执行前请先确认SET search_path TO hisdev; (或对应的 schema
-- 1. 先将已有的字符串值转换为对应的整数值
-- 如果之前写入的是枚举 code如 'waiting'、'completed'),需要先转换
UPDATE triage_queue_item
SET status = CASE
WHEN status IN ('0', 'waiting', 'WAITING') THEN 0
WHEN status IN ('10', 'calling', 'CALLING') THEN 10
WHEN status IN ('20', 'in-clinic', 'IN_CLINIC', 'in-clinic') THEN 20
WHEN status IN ('30', 'completed', 'COMPLETED') THEN 30
WHEN status IN ('40', 'skipped', 'SKIPPED') THEN 40
WHEN status IN ('50', 'refunded', 'REFUNDED') THEN 50
WHEN status IN ('60', 'follow', 'FOLLOW') THEN 60
ELSE 0
END
WHERE status IS NOT NULL AND status !~ '^[0-9]+$';
-- 2. 修改字段类型为 INTEGER
ALTER TABLE triage_queue_item
ALTER COLUMN status TYPE INTEGER USING status::INTEGER;
-- 3. 设置默认值
ALTER TABLE triage_queue_item
ALTER COLUMN status SET DEFAULT 0;

View File

@@ -163,7 +163,7 @@ export function updateCheckPart(data) {
// 查询检查套餐列表 // 查询检查套餐列表
export function listCheckPackage(query) { export function listCheckPackage(query) {
return request({ return request({
url: '/system/package/list', url: '/system/check-package/list',
method: 'get', method: 'get',
params: query params: query
}) })

View File

@@ -1,5 +1,3 @@
import useDictStore from '@/store/modules/dict';
// 日期格式化 // 日期格式化
export function parseTime(time, pattern) { export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) { if (arguments.length === 0 || !time) {
@@ -277,13 +275,30 @@ export function blobValidate(data) {
// 按照频次天数计算总数量 // 按照频次天数计算总数量
export function calculateQuantityByDays(frequency, days) { export function calculateQuantityByDays(frequency, days) {
const dicts = useDictStore().getDict('rate_code'); // const dict = useDict('rate_code').rate_code.value
if (!dicts) return; // const rate = dict.find(item => item.value === frequency).remark
const dict = dicts.find(item => item.value === frequency); // if(rate){
if (!dict?.remark) return; // return Math.floor(Number(rate) * days)
const rate = Number(dict.remark); // } else {
if (isNaN(rate) || !rate) return; // return undefined
const quantity = rate * days; // }
const frequencyMap = {
ST: 1,
QD: 1, // 每日一次
BID: 2, // 每日两次
TID: 3, // 每日三次
QID: 4, // 每日四次
QN: 1, // 每晚一次
QOD: 1 / 2, // 每隔一日一次
QW: 1 / 7, // 每周一次
BIW: 2 / 7, // 每周两次
TIW: 3 / 7, // 每周三次
QOW: 1 / 14, // 隔周一次
};
if (!frequencyMap[frequency]) {
return;
}
const quantity = frequencyMap[frequency] * days;
return quantity < 1 ? 1 : Math.ceil(quantity); return quantity < 1 ? 1 : Math.ceil(quantity);
} }

View File

@@ -178,25 +178,22 @@ service.interceptors.request.use(config => {
} }
return Promise.reject('无效的会话,或者会话已过期,请重新登录。') return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) { } else if (code === 500) {
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理) // 检查是否需要跳过错误提示
if (res.config?.skipErrorMsg) { if (!res.config?.skipErrorMsg) {
return Promise.resolve(res.data)
}
ElMessage({ message: msg, type: 'error' }) ElMessage({ message: msg, type: 'error' })
}
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code === 601) { } else if (code === 601) {
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理) // 检查是否需要跳过错误提示
if (res.config?.skipErrorMsg) { if (!res.config?.skipErrorMsg) {
return Promise.resolve(res.data)
}
ElMessage({ message: msg, type: 'warning' }) ElMessage({ message: msg, type: 'warning' })
}
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code !== 200) { } else if (code !== 200) {
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理) // 检查是否需要跳过错误提示
if (res.config?.skipErrorMsg) { if (!res.config?.skipErrorMsg) {
return Promise.resolve(res.data)
}
ElNotification.error({ title: msg }) ElNotification.error({ title: msg })
}
return Promise.reject('error') return Promise.reject('error')
} else { } else {
return Promise.resolve(res.data) return Promise.resolve(res.data)

View File

@@ -226,14 +226,8 @@ function getList() {
getDiagnosisTreatmentList(queryParams.value).then((res) => { getDiagnosisTreatmentList(queryParams.value).then((res) => {
loading.value = false; loading.value = false;
catagoryList.value = res.data.records.map(record => { catagoryList.value = res.data.records.map(record => {
// 为每一行初始化 filteredOptions确保显示框能正确显示项目名称
const filteredOptions = allImplementDepartmentList.value.slice(0, 100); const filteredOptions = allImplementDepartmentList.value.slice(0, 100);
// 确保后端返回的项目名称选项存在于 filteredOptions 中,避免 el-select 因找不到选项而回显为 ID
if (record.activityDefinitionId && !filteredOptions.some(o => o.value === record.activityDefinitionId)) {
filteredOptions.push({
value: record.activityDefinitionId,
label: record.activityDefinitionId_dictText || record.activityDefinitionId
});
}
return { return {
...record, ...record,
loading: false, loading: false,

View File

@@ -372,6 +372,7 @@ import {
} from './diagnosistreatment'; } from './diagnosistreatment';
import PopoverList from '@/components/OpenHis/popoverList/index.vue'; import PopoverList from '@/components/OpenHis/popoverList/index.vue';
import medicineList from './medicineList.vue'; import medicineList from './medicineList.vue';
import MedicineList from '../components/medicineList.vue';
import {getCurrentInstance, nextTick, watch} from 'vue'; import {getCurrentInstance, nextTick, watch} from 'vue';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
@@ -466,9 +467,9 @@ function calculateTotalPrice() {
try { try {
let sum = 0; let sum = 0;
treatmentItems.value.forEach((item) => { treatmentItems.value.forEach((item) => {
if (item.adviceDefinitionId && item.adviceDefinitionId !== '') { if (item.adviceDefinitionId && item.retailPrice && item.childrenRequestNum) {
const price = Number(item.retailPrice) || 0; const price = parseFloat(item.retailPrice) || 0;
const count = Number(item.childrenRequestNum) || 0; const count = parseInt(item.childrenRequestNum) || 0;
sum += price * count; sum += price * count;
} }
}); });
@@ -478,10 +479,7 @@ function calculateTotalPrice() {
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== '' (item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
); );
if (hasValidItem) { if (hasValidItem) {
// 使用 nextTick 确保总价更新后零售价才更新,避免 Vue 响应式时序问题 form.value.retailPrice = parseFloat(totalPrice.value);
nextTick(() => {
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
});
} else { } else {
form.value.retailPrice = undefined; form.value.retailPrice = undefined;
} }
@@ -567,16 +565,15 @@ function edit() {
form.value.pricingFlag = 1; form.value.pricingFlag = 1;
} }
// 处理子项数据确保包含retailPrice和name字段 // 处理子项数据确保包含retailPrice字段
if (props.item.childrenJson) { if (props.item.childrenJson) {
const parsedItems = JSON.parse(props.item.childrenJson); const parsedItems = JSON.parse(props.item.childrenJson);
treatmentItems.value = parsedItems.map((item) => ({ treatmentItems.value = parsedItems.map((item) => ({
...item, ...item,
name: item.name || '',
retailPrice: item.retailPrice || 0, retailPrice: item.retailPrice || 0,
})); }));
} else { } else {
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 }]; treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
} }
form.value.permittedUnitCode = form.value.permittedUnitCode form.value.permittedUnitCode = form.value.permittedUnitCode
? form.value.permittedUnitCode.toString() ? form.value.permittedUnitCode.toString()
@@ -621,7 +618,7 @@ function reset() {
chrgitmLv: undefined, //医保等级 chrgitmLv: undefined, //医保等级
pricingFlag: 1, // 划价标记,默认允许划价 pricingFlag: 1, // 划价标记,默认允许划价
}; };
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 }]; treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
totalPrice.value = '0.00'; totalPrice.value = '0.00';
proxy.resetForm('diagnosisTreatmentRef'); proxy.resetForm('diagnosisTreatmentRef');
} }
@@ -763,10 +760,7 @@ function selectRow(row, index) {
treatmentItems.value[index].adviceDefinitionId = row.id; treatmentItems.value[index].adviceDefinitionId = row.id;
treatmentItems.value[index].retailPrice = row.retailPrice || 0; treatmentItems.value[index].retailPrice = row.retailPrice || 0;
medicineSearchKey.value = ''; medicineSearchKey.value = '';
// 使用 nextTick 确保 DOM 更新后再计算总价
nextTick(() => {
calculateTotalPrice(); calculateTotalPrice();
});
} }
// 清空诊疗子项 // 清空诊疗子项

View File

@@ -36,7 +36,6 @@ const emit = defineEmits(['selectRow']);
const diagnosisTreatmentList = ref([]); // 原始数据列表 const diagnosisTreatmentList = ref([]); // 原始数据列表
const filteredList = ref([]); // 过滤后的数据列表 const filteredList = ref([]); // 过滤后的数据列表
const hasLoaded = ref(false); // 标记是否已加载数据 const hasLoaded = ref(false); // 标记是否已加载数据
const isLoading = ref(false); // 标记是否正在加载
// 获取诊疗项目列表 // 获取诊疗项目列表
function getList() { function getList() {
@@ -54,7 +53,7 @@ function getList() {
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 }) getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
.then((res) => { .then((res) => {
diagnosisTreatmentList.value = diagnosisTreatmentList.value =
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || []; res.data?.records?.filter((item) => item.childrenJson == null) || [];
filterList(); // 初始化过滤 filterList(); // 初始化过滤
hasLoaded.value = true; // 标记为已加载 hasLoaded.value = true; // 标记为已加载
}) })
@@ -63,47 +62,6 @@ function getList() {
}); });
} }
// 服务端搜索(当用户输入搜索关键词时)
function searchList(searchKey) {
if (!searchKey || searchKey.trim() === '') return;
isLoading.value = true;
// 使用较大的pageSize确保搜索结果尽可能多
getDiagnosisTreatmentList({ statusEnum: 2, searchKey: searchKey.trim(), pageSize: 5000, pageNo: 1 })
.then((res) => {
diagnosisTreatmentList.value =
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || [];
filterList();
})
.catch((err) => {
console.error('搜索诊疗项目数据失败:', err);
})
.finally(() => {
isLoading.value = false;
});
}
// 获取预加载数据(不带搜索关键词时使用)
function loadPreloadedData() {
if (props.preloadedData && props.preloadedData.length > 0) {
diagnosisTreatmentList.value = props.preloadedData;
filterList();
hasLoaded.value = true;
return;
}
if (hasLoaded.value) return;
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
.then((res) => {
diagnosisTreatmentList.value =
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || [];
filterList();
hasLoaded.value = true;
})
.catch((err) => {
console.error('获取诊疗项目数据失败:', err);
});
}
// 监听shouldLoadData属性变化仅在首次为true时加载数据 // 监听shouldLoadData属性变化仅在首次为true时加载数据
watch( watch(
() => props.shouldLoadData, () => props.shouldLoadData,
@@ -128,17 +86,11 @@ watch(
{ immediate: true } { immediate: true }
); );
// 监听搜索关键词变化,有搜索词时走服务端搜索,否则走本地过滤 // 监听搜索关键词变化,实时过滤数据
watch( watch(
() => props.searchKey, () => props.searchKey,
(newVal) => { () => {
if (newVal && newVal.trim() !== '') { filterList();
// 有搜索关键词,走服务端搜索
searchList(newVal);
} else {
// 搜索词为空,使用预加载数据
loadPreloadedData();
}
} }
); );

View File

@@ -122,37 +122,15 @@ function getList() {
return; return;
} }
// 🔧 Bug #448 修复:显式构建请求参数,确保 adviceType 正确传递 queryParams.value.organizationId = props.patientInfo.orgId;
// 不直接使用 queryParams.value避免 undefined 值被发送到后端导致过滤失效 console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(queryParams.value));
const requestParams = {
pageSize: queryParams.value.pageSize,
pageNum: queryParams.value.pageNum,
organizationId: props.patientInfo.orgId,
};
// 只在 adviceType 有值时添加0 是无效值undefined/null 会导致后端查询所有类型) getAdviceBaseInfo(queryParams.value).then((res) => {
if (queryParams.value.adviceType != null && queryParams.value.adviceType !== 0) {
requestParams.adviceType = queryParams.value.adviceType;
}
// 只在 categoryCode 有值时添加
if (queryParams.value.categoryCode) {
requestParams.categoryCode = queryParams.value.categoryCode;
}
// 只在 searchKey 有值时添加
if (queryParams.value.searchKey) {
requestParams.searchKey = queryParams.value.searchKey;
}
console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(requestParams));
getAdviceBaseInfo(requestParams).then((res) => {
console.log('[adviceBaseList] getList() 响应数据:', { console.log('[adviceBaseList] getList() 响应数据:', {
total: res.data?.total, total: res.data?.total,
recordsCount: res.data?.records?.length || 0, recordsCount: res.data?.records?.length || 0,
firstRecord: res.data?.records?.[0]?.adviceName || '无数据', firstRecord: res.data?.records?.[0]?.adviceName || '无数据',
adviceType: requestParams.adviceType adviceType: queryParams.value.adviceType
}); });
adviceBaseList.value = res.data.records || []; adviceBaseList.value = res.data.records || [];
total.value = res.data.total || 0; total.value = res.data.total || 0;

View File

@@ -58,17 +58,10 @@ export function singOut(data) {
/** /**
* 获取患者本次就诊处方 * 获取患者本次就诊处方
*/ */
export function getPrescriptionList(encounterId, generateSourceEnum, sourceBillNo) { export function getPrescriptionList(encounterId) {
let url = '/doctor-station/advice/request-base-info?encounterId=' + encounterId // Add timestamp to bypass browser caching and ensure fresh data is loaded
if (generateSourceEnum != null) {
url += '&generateSourceEnum=' + generateSourceEnum
}
if (sourceBillNo != null) {
url += '&sourceBillNo=' + encodeURIComponent(sourceBillNo)
}
url += '&t=' + Date.now()
return request({ return request({
url: url, url: '/doctor-station/advice/request-base-info?encounterId=' + encounterId + '&t=' + Date.now(),
method: 'get', method: 'get',
}) })
} }

View File

@@ -381,14 +381,6 @@ const props = defineProps({
activeTab: { activeTab: {
type: String, type: String,
}, },
generateSourceEnum: {
type: Number,
default: null,
},
sourceBillNo: {
type: String,
default: null,
},
}); });
const isAdding = ref(false); const isAdding = ref(false);
const isSaving = ref(false); // #437 防重复提交锁 const isSaving = ref(false); // #437 防重复提交锁
@@ -461,7 +453,7 @@ watch(
console.log(prescriptionList.value,"prescriptionList.value") console.log(prescriptionList.value,"prescriptionList.value")
if(newValue&&newValue.length>0){ if(newValue&&newValue.length>0){
let saveList = prescriptionList.value.filter((item) => { let saveList = prescriptionList.value.filter((item) => {
return item.check && item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag) return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
}) })
console.log(saveList,"prescriptionList.value") console.log(saveList,"prescriptionList.value")
if (saveList.length == 0) { if (saveList.length == 0) {
@@ -476,11 +468,7 @@ watch(
function getListInfo(addNewRow) { function getListInfo(addNewRow) {
isAdding.value = false; isAdding.value = false;
getPrescriptionList( getPrescriptionList(props.patientInfo.encounterId).then((res) => {
props.patientInfo.encounterId,
props.generateSourceEnum ?? undefined,
props.sourceBillNo ?? undefined,
).then((res) => {
// 为每行数据添加 adviceTypeValue 字段,用于类型下拉框显示 // 为每行数据添加 adviceTypeValue 字段,用于类型下拉框显示
prescriptionList.value = (res.data || []).map(item => { prescriptionList.value = (res.data || []).map(item => {
// 根据 adviceType 和 categoryCode 找到对应的 adviceTypeValue // 根据 adviceType 和 categoryCode 找到对应的 adviceTypeValue
@@ -887,20 +875,12 @@ function handleDelete() {
if (item.statusEnum != 1 || item.chargeStatus == 5) { if (item.statusEnum != 1 || item.chargeStatus == 5) {
return null; return null;
} }
// 🔧 Bug #442: 非本人创建的医嘱不允许删除(与签发/签退逻辑保持一致)
if (Number(item.bizRequestFlag) !== 1 && item.bizRequestFlag) {
return null;
}
// 🔧 Bug #442: 已保存的行必须有有效的 requestId否则跳过避免后端删除不存在的记录
if (item.requestId == null || item.requestId === undefined || item.requestId === '') {
return null;
}
return { return {
requestId: item.requestId, requestId: item.requestId,
dbOpType: '3', dbOpType: '3',
adviceType: item.adviceType, adviceType: item.adviceType,
}; };
}).filter(item => item !== null); // 过滤掉已签发已收费、非本人创建或无 requestId 的项目 }).filter(item => item !== null); // 过滤掉已签发已收费的项目
if (deleteList.length == 0) { if (deleteList.length == 0) {
proxy.$modal.msgWarning('只能删除待签发且未收费的项目'); proxy.$modal.msgWarning('只能删除待签发且未收费的项目');
@@ -1015,7 +995,7 @@ function handleSave() {
return; return;
} }
let saveList = prescriptionList.value.filter((item) => { let saveList = prescriptionList.value.filter((item) => {
return item.check && item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag) return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
}); });
// let saveList = prescriptionList.value // let saveList = prescriptionList.value
// .filter((item) => { // .filter((item) => {
@@ -1036,14 +1016,6 @@ function handleSave() {
requestId: item.requestId, requestId: item.requestId,
dbOpType: '1', dbOpType: '1',
groupId: item.groupId, groupId: item.groupId,
// 🔧 Bug #443: 补充顶层关键字段(这些不在 contentJson 中,需从 API 响应顶层提取)
encounterId: item.encounterId,
patientId: item.patientId,
locationId: item.positionId,
adviceType: item.adviceType,
adviceTableName: item.adviceTableName,
adviceDefinitionId: item.adviceDefinitionId,
chargeItemId: item.chargeItemId,
}; };
}); });
savePrescriptionSign({ savePrescriptionSign({
@@ -1059,12 +1031,7 @@ function handleSave() {
groupIndexList.value = [] groupIndexList.value = []
groupList.value = [] groupList.value = []
nextId.value = 1; nextId.value = 1;
} else {
proxy.$modal.msgError(res?.msg || '签发失败,请重试');
} }
}).catch((error) => {
console.error('签发失败:', error);
proxy.$modal.msgError(error?.response?.data?.msg || error?.message || '签发失败,请重试');
}); });
} }
@@ -1080,12 +1047,9 @@ function handleSaveSign(row, index) {
proxy.$modal.msgWarning('诊疗项目必须选择执行科室'); proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
return; return;
} }
isSaving.value = true; // #437 立即加锁,消除 TOCTOU 竞态
proxy.$refs['formRef' + index].validate((valid) => { proxy.$refs['formRef' + index].validate((valid) => {
if (!valid) { if (valid) {
isSaving.value = false; // 验证失败释放 isSaving.value = true; // #437 加
return;
}
row.isEdit = false; row.isEdit = false;
isAdding.value = false; isAdding.value = false;
expandOrder.value = []; expandOrder.value = [];
@@ -1103,7 +1067,7 @@ function handleSaveSign(row, index) {
cleanRow.sourceBillNo = props.patientInfo.sourceBillNo; cleanRow.sourceBillNo = props.patientInfo.sourceBillNo;
} }
console.log('cleanRow', cleanRow) console.log('cleanRow', cleanRow)
savePrescription({ adviceSaveList: [cleanRow] }, '1').then((res) => { savePrescription({ adviceSaveList: [cleanRow] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功'); proxy.$modal.msgSuccess('保存成功');
getListInfo(false); getListInfo(false);
@@ -1117,7 +1081,8 @@ function handleSaveSign(row, index) {
}).finally(() => { }).finally(() => {
isSaving.value = false; // #437 释放锁 isSaving.value = false; // #437 释放锁
}); });
}) }
});
} }
// 签退 // 签退

View File

@@ -49,40 +49,6 @@
</el-col> </el-col>
</el-row> </el-row>
<!-- 性别出生日期或实足年龄 -->
<el-row :gutter="16" class="form-row">
<el-col :span="7" class="form-item">
<span class="form-label required">性别</span>
<el-radio-group v-model="form.sex" class="gender-radio-group">
<el-radio value="男"></el-radio>
<el-radio value="女"></el-radio>
<el-radio value="未知">未知</el-radio>
</el-radio-group>
</el-col>
<el-col :span="10" class="form-item">
<span class="form-label required">出生日期</span>
<div class="birth-input-group">
<el-input v-model="form.birthYear" class="birth-input year" placeholder="年" maxlength="4" />
<span class="birth-separator"></span>
<el-input v-model="form.birthMonth" class="birth-input month" placeholder="月" maxlength="2" />
<span class="birth-separator"></span>
<el-input v-model="form.birthDay" class="birth-input day" placeholder="日" maxlength="2" />
<span class="birth-separator"></span>
</div>
</el-col>
<el-col :span="7" class="form-item">
<span class="form-label"> 实足年龄</span>
<div class="age-input-group">
<el-input v-model="form.age" class="age-input" placeholder="年龄" />
<el-select v-model="form.ageUnit" class="age-unit-select">
<el-option label="岁" value="岁" />
<el-option label="月" value="月" />
<el-option label="天" value="天" />
</el-select>
</div>
</el-col>
</el-row>
<!-- 联系电话紧急联系人电话 --> <!-- 联系电话紧急联系人电话 -->
<el-row :gutter="16" class="form-row"> <el-row :gutter="16" class="form-row">
<el-col :span="12" class="form-item"> <el-col :span="12" class="form-item">
@@ -1277,14 +1243,11 @@ async function show(diagnosisData) {
const res = await getNextCardNo(orgCode); const res = await getNextCardNo(orgCode);
if (res.code === 200 && res.data && res.data.length >= 12) { if (res.code === 200 && res.data && res.data.length >= 12) {
cardNo = res.data; cardNo = res.data;
} else {
// API返回失败或不合规时生成临时卡号避免保存时 cardNo 为空导致后端校验失败
cardNo = 'TEMP_' + Date.now();
} }
// API失败或返回不合规时保持为空字符串由用户手动填写或后端自动生成
} catch (err) { } catch (err) {
console.error('获取卡片编号失败:', err); console.error('获取卡片编号失败:', err);
// API调用异常时生成临时卡号 // 保持为空,不使用不合规的临时值
cardNo = 'TEMP_' + Date.now();
} }
form.value = { form.value = {
@@ -1400,9 +1363,6 @@ async function buildSubmitData() {
} else if (formData.otherDisease) { } else if (formData.otherDisease) {
// 其他传染病使用自定义编码 // 其他传染病使用自定义编码
diseaseCode = 'OTHER'; diseaseCode = 'OTHER';
} else if (formData.selectedDiseases && formData.selectedDiseases.length > 0) {
// 兜底:如果 ClassA/B/C 都为空但 selectedDiseases 有值,取第一个作为 diseaseCode
diseaseCode = formData.selectedDiseases[0];
} }
// 转换年龄单位:岁=1, 月=2, 天=3 // 转换年龄单位:岁=1, 月=2, 天=3
@@ -1470,8 +1430,8 @@ async function buildSubmitData() {
function validateFormManually() { function validateFormManually() {
const errors = []; const errors = [];
// 卡片编号验证至少12位后端自动生成16位编号;临时卡号 TEMP_ 开头允许通过 // 卡片编号验证至少12位后端自动生成16位编号
if (form.value.cardNo && !form.value.cardNo.startsWith('TEMP_') && form.value.cardNo.length < 12) { if (form.value.cardNo && form.value.cardNo.length < 12) {
errors.push('卡片编号至少12位'); errors.push('卡片编号至少12位');
} }
@@ -1812,33 +1772,6 @@ defineExpose({ show, showReport, close: handleClose });
color: #999; color: #999;
} }
/* 输入框下划线样式(与 underline-select 保持一致) */
.underline-input :deep(.el-input__wrapper) {
border: none;
border-bottom: 1px solid #dcdfe6;
border-radius: 0;
box-shadow: none;
background: transparent;
}
.underline-input :deep(.el-input__wrapper:hover) {
border-bottom-color: #c0c4cc;
}
.underline-input :deep(.el-input__wrapper.is-focus) {
border-bottom-color: #409eff;
}
.underline-input :deep(.el-input__inner) {
font-size: 12px;
color: #666;
}
.underline-input :deep(.el-input__inner::placeholder) {
font-size: 12px;
color: #999;
}
/* 街道下拉框下划线样式 */ /* 街道下拉框下划线样式 */
.underline-select { .underline-select {
width: 100%; width: 100%;
@@ -2026,53 +1959,4 @@ defineExpose({ show, showReport, close: handleClose });
display: flex !important; display: flex !important;
justify-content: center !important; justify-content: center !important;
} }
/* 性别单选按钮组 */
.gender-radio-group {
display: flex;
gap: 12px;
padding-top: 4px;
}
/* 出生日期输入组 */
.birth-input-group {
display: flex;
align-items: center;
gap: 2px;
}
.birth-input {
text-align: center;
}
.birth-input.year {
width: 70px;
}
.birth-input.month,
.birth-input.day {
width: 50px;
}
.birth-separator {
color: #606266;
font-size: 13px;
margin: 0 2px;
}
/* 年龄输入组 */
.age-input-group {
display: flex;
align-items: center;
gap: 6px;
}
.age-input {
width: 70px;
text-align: center;
}
.age-unit-select {
width: 65px;
}
</style> </style>

View File

@@ -3,56 +3,15 @@
<!-- ====== 顶部卡片申请单列表 ====== --> <!-- ====== 顶部卡片申请单列表 ====== -->
<div class="top-section"> <div class="top-section">
<div class="section-header"> <div class="section-header">
<span class="section-title">检查项目 ({{ filteredApplicationList.length }})</span> <span class="section-title">检查项目 ({{ applicationList.length }})</span>
<div class="header-actions"> <div class="header-actions">
<el-button type="primary" @click="handleAdd" icon="Plus">新增</el-button> <el-button type="primary" @click="handleAdd" icon="Plus">新增</el-button>
<el-button type="success" @click="handleSave" icon="Finished">保存</el-button> <el-button type="success" @click="handleSave" icon="Finished">保存</el-button>
</div> </div>
</div> </div>
<!-- Bug #499: 查询过滤工具栏 -->
<div class="search-toolbar">
<el-form :inline="true" size="small">
<el-form-item label="日期范围">
<el-date-picker
v-model="searchForm.dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchForm.applyStatus" placeholder="全部" clearable style="width: 140px">
<el-option
v-for="opt in statusOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
<el-form-item label="关键字">
<el-input
v-model="searchForm.keyword"
placeholder="申请单号 / 检查项目"
clearable
style="width: 200px"
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch" icon="Search">搜索</el-button>
<el-button @click="handleResetSearch" icon="Refresh">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="filteredApplicationList" :data="applicationList"
:max-height="200" :max-height="200"
highlight-current-row highlight-current-row
@row-click="handleRowClick" @row-click="handleRowClick"
@@ -278,25 +237,9 @@
<el-input v-model="scope.row.applyPart" size="small" /> <el-input v-model="scope.row.applyPart" size="small" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检查方法" min-width="160"> <el-table-column label="检查方法" min-width="120">
<template #default="scope"> <template #default="scope">
<el-select <!-- Bug #384修复: 显示检查方法名称不显示套餐名称 -->
v-if="scope.row.methods && scope.row.methods.length > 1"
:model-value="scope.row.selectedMethod"
value-key="id"
size="small"
style="width: 100%"
placeholder="选择方法"
@update:model-value="(val) => onDetailMethodChange(scope.row, val)"
>
<el-option
v-for="meth in scope.row.methods"
:key="meth.id"
:label="`${meth.name}${meth.packagePrice != null ? ' ¥' + formatDetailAmount(meth.packagePrice) : ''}`"
:value="meth"
/>
</el-select>
<template v-else>
<span v-if="scope.row.selectedMethod"> <span v-if="scope.row.selectedMethod">
{{ scope.row.selectedMethod.name }} {{ scope.row.selectedMethod.name }}
</span> </span>
@@ -305,7 +248,6 @@
</span> </span>
<span v-else style="color: #c0c4cc;">-</span> <span v-else style="color: #c0c4cc;">-</span>
</template> </template>
</template>
</el-table-column> </el-table-column>
<el-table-column label="单位" prop="unit" width="55" align="center" /> <el-table-column label="单位" prop="unit" width="55" align="center" />
<el-table-column label="总量" prop="quantity" width="70" align="center"> <el-table-column label="总量" prop="quantity" width="70" align="center">
@@ -393,9 +335,8 @@
加载中... 加载中...
</div> </div>
<!-- Bug #428修复: 渲染分类联动加载的检查方法列表 --> <!-- Bug #428修复: 渲染分类联动加载的检查方法列表 -->
<!-- Bug #500修复: v-if 改为 v-show避免方法列表加载时 DOM 突然插入导致高度跳变 -->
<div <div
v-show="cat.methods && cat.methods.length > 0" v-if="cat.methods && cat.methods.length > 0"
class="method-section" class="method-section"
> >
<div class="method-section-title">检查方法</div> <div class="method-section-title">检查方法</div>
@@ -429,15 +370,12 @@
v-for="(item, idx) in selectedItems" v-for="(item, idx) in selectedItems"
:key="idx" :key="idx"
class="selected-item-card" class="selected-item-card"
:class="{ 'is-expanded': item.expanded }"
> >
<!-- Bug #384修复 + #426修复: 项目卡片头部,可展开/收起 --> <!-- Bug #384修复: 项目卡片头部可展开/收起 -->
<div class="card-header" @click="toggleItemExpand(item)"> <div class="card-header" @click="toggleItemExpand(item)">
<el-tag v-if="item.isPackage || item.packageName" size="small" type="warning" style="margin-right: 4px; flex-shrink: 0;">套餐</el-tag>
<el-tooltip :content="item.name" placement="top" :show-after="400">
<span class="card-name">{{ item.name }}</span> <span class="card-name">{{ item.name }}</span>
</el-tooltip> <span class="card-price">¥{{ item.price }}</span>
<span class="card-price">¥{{ formatDetailAmount(item.price) }}</span> <!-- 展开图标 -->
<el-icon :class="['expand-icon', { expanded: item.expanded }]"> <el-icon :class="['expand-icon', { expanded: item.expanded }]">
<ArrowDown v-if="!item.expanded" /> <ArrowDown v-if="!item.expanded" />
<ArrowUp v-if="item.expanded" /> <ArrowUp v-if="item.expanded" />
@@ -447,30 +385,24 @@
<el-icon><Close /></el-icon> <el-icon><Close /></el-icon>
</el-button> </el-button>
</div> </div>
<!-- Bug #428: 有套餐 ID 时默认展开;加载中/空/明细均在本区域展示 --> <!-- Bug #428修复: 展开后显示套餐明细或检查方法 -->
<div v-if="item.expanded && shouldShowPackageBody(item)" class="selected-card-body"> <div v-if="item.expanded">
<div v-if="item.packageDetailsLoading" class="package-details-loading">加载中...</div> <!-- 显示套餐明细 -->
<template v-else> <div v-if="item.packageDetails && item.packageDetails.length > 0" class="package-details-list">
<div v-if="getPackageDetailsList(item).length === 0" class="package-details-empty"> <div class="detail-row" v-for="detail in item.packageDetails" :key="detail.id">
暂无套餐明细
</div>
<div v-else class="package-details-list">
<div class="package-details-head">套餐明细</div>
<div
v-for="(detail, dIdx) in getPackageDetailsList(item)"
:key="detail.id ?? detail.itemCode ?? `d-${dIdx}`"
class="detail-row"
>
<el-tooltip :content="detail.name" placement="top" :show-after="500">
<span class="detail-name">{{ detail.name }}</span> <span class="detail-name">{{ detail.name }}</span>
</el-tooltip> <span class="detail-info">数量: {{ detail.quantity }} 单价: ¥{{ detail.price }}</span>
<div class="detail-meta">
<span class="detail-qty">×{{ detail.quantity || 1 }}</span>
<span class="detail-price">¥{{ formatDetailAmount(detail.price) }}</span>
</div> </div>
</div> </div>
<!-- 显示检查方法 -->
<div v-else-if="item.methods && item.methods.length > 0" class="method-list">
<div v-for="method in item.methods" :key="method.id" class="method-option">
<el-checkbox :model-value="item.selectedMethod?.id === method.id" @change="(val) => selectMethodCheckbox(val, item, method)">
<span class="method-name">{{ method.name }}</span>
<span class="method-price">¥{{ method.packagePrice || item.price }}</span>
</el-checkbox>
</div>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>
@@ -487,7 +419,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
import { Printer, Delete, ArrowDown, ArrowUp, Close } from '@element-plus/icons-vue'; import { Printer, Delete, ArrowDown, ArrowUp, Close } from '@element-plus/icons-vue';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import request from '@/utils/request'; import request from '@/utils/request';
import { listCheckMethod, searchCheckMethod, listCheckPackage } from '@/api/system/checkType'; import { listCheckMethod, searchCheckMethod } from '@/api/system/checkType';
import { getEncounterDiagnosis } from '../api.js'; import { getEncounterDiagnosis } from '../api.js';
const props = defineProps({ const props = defineProps({
@@ -505,92 +437,23 @@ const activeDetailTab = ref('applyForm');
const applicationList = ref([]); const applicationList = ref([]);
const selectedItems = ref([]); const selectedItems = ref([]);
// Bug #499: 查询过滤状态
const searchForm = reactive({
dateRange: [],
applyStatus: '',
keyword: ''
});
// 申请单状态选项
const statusOptions = [
{ label: '已开单', value: 0 },
{ label: '已收费', value: 1 },
{ label: '已预约', value: 2 },
{ label: '已签到', value: 3 },
{ label: '部分报告', value: 4 },
{ label: '已完告', value: 5 },
{ label: '已作废', value: 6 }
];
// Bug #499: 过滤后的申请单列表
const filteredApplicationList = computed(() => {
let result = applicationList.value;
// 日期范围过滤
if (searchForm.dateRange && searchForm.dateRange.length === 2) {
const start = searchForm.dateRange[0];
const end = searchForm.dateRange[1];
result = result.filter(item => {
const d = item.applyTime;
if (!d) return false;
const dateStr = d.length > 10 ? d.substring(0, 10) : d;
return dateStr >= start && dateStr <= end;
});
}
// 状态过滤
if (searchForm.applyStatus !== '' && searchForm.applyStatus !== null && searchForm.applyStatus !== undefined) {
result = result.filter(item => item.applyStatus === searchForm.applyStatus);
}
// 关键字过滤(申请单号、申检部位、检查项目名)
if (searchForm.keyword) {
const kw = searchForm.keyword.toLowerCase();
result = result.filter(item => {
return (item.applyNo || '').toLowerCase().includes(kw)
|| (item.inspectionArea || '').toLowerCase().includes(kw);
});
}
return result;
});
// Bug #499: 搜索与重置
function handleSearch() {
// 过滤逻辑由 computed 自动处理
}
function handleResetSearch() {
const now = new Date();
const end = now.toISOString().substring(0, 10);
const start = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString().substring(0, 10);
searchForm.dateRange = [start, end];
searchForm.applyStatus = '';
searchForm.keyword = '';
}
// 初始化默认日期范围为近一周
handleResetSearch();
// 🔧 BugFix#426: 懒加载套餐明细 // 🔧 BugFix#426: 懒加载套餐明细
async function loadPackageDetails(row, treeNode, resolve) { async function loadPackageDetails(row, treeNode, resolve) {
if (!row.packageId) { if (!row.isPackage || !row.packageId) {
resolve([]); resolve([]);
return; return;
} }
try { try {
const res = await request({ const res = await request({
url: `/system/check-type/package/${row.packageId}/details`, url: `/exam/package/${row.packageId}/details`,
method: 'get' method: 'get'
}); });
if (res.code === 200) { if (res.code === 200 && res.data) {
const list = parsePackageDetailsPayload(res); const children = res.data.map(item => ({
const children = list.map((child) => ({ ...item,
...child, name: item.name || item.itemName,
name: child.name || child.itemName, unit: item.unit || '次',
unit: child.unit || '次', price: item.price || item.itemPrice || 0,
price: child.price ?? child.unitPrice ?? child.itemPrice ?? 0,
quantity: row.quantity || 1, quantity: row.quantity || 1,
isPackageDetail: true isPackageDetail: true
})); }));
@@ -604,121 +467,30 @@ async function loadPackageDetails(row, treeNode, resolve) {
} }
} }
// #428修复 + #426修复: 为已选择项目加载套餐明细通过packageId或packageName查询 // #428: 为已选择项目加载套餐明细
/** 套餐明细挂在「部位」或已选的「检查方法」上(方法可带 packageId */
function getPackageCarrier(item) {
return item?.selectedMethod?.packageId ? item.selectedMethod : item;
}
function getPackageDetailsList(item) {
// 明细挂在行对象上,避免仅写入 methods 内嵌对象时首帧不触发视图更新(体感需点两次才展开)
if (Array.isArray(item?.packageDetailsDisplay)) {
return item.packageDetailsDisplay;
}
const carrier = getPackageCarrier(item);
return Array.isArray(carrier?.packageDetails) ? carrier.packageDetails : [];
}
/** 有套餐 ID 的已选行才展示右侧套餐区(加载中 / 空 / 明细列表) */
function shouldShowPackageBody(item) {
return !!getPackageCarrier(item)?.packageId;
}
/** 金额展示:统一两位小数 */
function formatDetailAmount(value) {
const n = Number(value ?? 0);
return Number.isFinite(n) ? n.toFixed(2) : '0.00';
}
/** 默认检查方法:优先与部位 packageId 一致的方法,否则取首个带套餐的方法,否则取第一个 */
function pickDefaultMethod(methods, partItem) {
if (!methods?.length) return null;
if (methods.length === 1) return methods[0];
const pid = partItem?.packageId ?? null;
if (pid != null && pid !== '') {
const matched = methods.find(
(x) => x.packageId != null && String(x.packageId) === String(pid)
);
if (matched) return matched;
}
const withPkg = methods.find((x) => x.packageId != null);
if (withPkg) return withPkg;
return methods[0];
}
function parsePackageDetailsPayload(res) {
const raw =
res?.data?.data ??
res?.data?.records ??
res?.data ??
res?.rows ??
res;
if (!Array.isArray(raw)) return [];
return raw;
}
// #428: 为已选择项目加载套餐明细后端CheckTypeController /system/check-type/package/{id}/details
async function loadPackageDetailsForItem(item) { async function loadPackageDetailsForItem(item) {
const carrier = getPackageCarrier(item); if (!item.isPackage || !item.packageId) {
let packageId = item.packageId || carrier?.packageId;
if (!packageId && !item.packageName) {
return; return;
} }
item.packageDetailsLoading = true;
try { try {
if (!packageId && item.packageName) {
const pkgRes = await listCheckPackage({ packageName: item.packageName });
let packages = pkgRes?.data || [];
if (!Array.isArray(packages)) {
packages = packages.records || packages.data || [];
}
if (packages.length === 0) {
item.packageDetails = [];
item.packageDetailsDisplay = [];
return;
}
packageId = packages[0].id;
item.packageId = packageId;
}
if (!packageId) {
item.packageDetails = [];
item.packageDetailsDisplay = [];
return;
}
const res = await request({ const res = await request({
url: `/system/check-type/package/${packageId}/details`, url: `/exam/package/${item.packageId}/details`,
method: 'get' method: 'get'
}); });
const list = parsePackageDetailsPayload(res); if (res.code === 200 && res.data) {
const mapped = list.map((detail) => ({ item.packageDetails = res.data.map(detail => ({
...detail, ...detail,
name: detail.name || detail.itemName, name: detail.name || detail.itemName,
unit: detail.unit || '次', unit: detail.unit || '次',
price: detail.price ?? detail.unitPrice ?? detail.itemPrice ?? 0, price: detail.price || detail.itemPrice || 0,
quantity: detail.quantity || 1 quantity: detail.quantity || 1
})); }));
item.packageDetailsDisplay = mapped;
carrier.packageDetails = mapped;
if (res.code === 200 && res.data) {
item.packageDetails = Array.isArray(res.data)
? res.data.map((detail) => ({
...detail,
name: detail.name || detail.itemName,
unit: detail.unit || '次',
price: detail.price || detail.unitPrice || 0,
quantity: detail.quantity || 1
}))
: mapped;
} else { } else {
item.packageDetails = mapped; item.packageDetails = [];
} }
} catch (err) { } catch (err) {
console.error('加载套餐明细失败:', err); console.error('加载套餐明细失败:', err);
item.packageDetailsDisplay = [];
carrier.packageDetails = [];
item.packageDetails = []; item.packageDetails = [];
} finally {
item.packageDetailsLoading = false;
} }
} }
const detailTableRef = ref(null); const detailTableRef = ref(null);
@@ -772,7 +544,7 @@ const categoryList = ref([]); // 原始分类+项目数据
const dictSearchKey = ref(''); const dictSearchKey = ref('');
const activeNames = ref(''); // 当前展开的折叠项 const activeNames = ref(''); // 当前展开的折叠项
const categoryLoadingSet = ref(new Set()); // Bug #500: 正在加载方法的分类集合 const categoryLoadingSet = ref(new Set()); // Bug #500: 正在加载方法的分类集合
const currentActiveCategory = ref(null); // Bug #500: 记录当前激活的分类,忽略过期请求响应 const isAnimating = ref(false); // Bug #500: 防止快速切换时折叠动画重叠导致抖动
const allMethods = ref([]); const allMethods = ref([]);
@@ -889,18 +661,15 @@ const availableMethods = computed(() => {
// 当可选方法列表改变时,如果当前选中的方法不在新列表中,则清空 // 当可选方法列表改变时,如果当前选中的方法不在新列表中,则清空
// #428: 分类展开时联动加载检查方法 // #428: 分类展开时联动加载检查方法
// Bug #500: 使用 categoryLoadingSet 替代 dictLoading避免切换分类时整个区域闪烁 // Bug #500: 使用 categoryLoadingSet 替代 dictLoading避免切换分类时整个区域闪烁
// Bug #500: 添加 currentActiveCategory 守卫,忽略过期请求响应,防止快速切换时数据闪烁
async function handleCategoryExpand(cat) { async function handleCategoryExpand(cat) {
if (!cat || !cat.typeName) return; if (!cat || !cat.typeName) return;
// 如果已加载过或正在加载中,跳过
if ((cat.methods && cat.methods.length > 0) || categoryLoadingSet.value.has(cat.typeId)) return; if ((cat.methods && cat.methods.length > 0) || categoryLoadingSet.value.has(cat.typeId)) return;
categoryLoadingSet.value.add(cat.typeId); categoryLoadingSet.value.add(cat.typeId);
currentActiveCategory.value = cat.typeId;
try { try {
const res = await searchCheckMethod({ checkType: cat.typeName }); const res = await searchCheckMethod({ checkType: cat.typeName });
// 忽略过期请求:用户已切换到其他分类,丢弃当前响应
if (currentActiveCategory.value !== cat.typeId) return;
let data = res?.data?.data || res?.data || res?.rows || res; let data = res?.data?.data || res?.data || res?.rows || res;
if (!Array.isArray(data) && res?.data && Array.isArray(res.data.data)) { if (!Array.isArray(data) && res?.data && Array.isArray(res.data.data)) {
data = res.data.data; data = res.data.data;
@@ -919,21 +688,20 @@ async function handleCategoryExpand(cat) {
})); }));
} }
} catch (err) { } catch (err) {
if (currentActiveCategory.value !== cat.typeId) return;
console.error('加载分类检查方法失败', err); console.error('加载分类检查方法失败', err);
} finally { } finally {
categoryLoadingSet.value.delete(cat.typeId); categoryLoadingSet.value.delete(cat.typeId);
} }
} }
// Bug #500修复: 不阻塞 accordion 状态更新,仅防止重复加载同一分类的方法 // Bug #500: 添加防抖逻辑,快速切换时跳过中间状态的动画,避免高度跳变和白屏闪烁
function handleCollapseChange(activeName) { function handleCollapseChange(activeName) {
// 始终记录当前激活的分类,确保 handleCategoryExpand 能正确忽略过期请求 if (isAnimating.value) return; // 动画进行中,忽略后续点击
currentActiveCategory.value = activeName || null;
isAnimating.value = true;
setTimeout(() => { isAnimating.value = false; }, 300); // 与 CSS 过渡时长一致
if (activeName) { if (activeName) {
// Bug #428修复: 直接从 categoryList原始响应式数组查找分类 const cat = filteredCategoryList.value.find(c => c.typeId == activeName);
// 确保后续 handleCategoryExpand 对 cat.methods 的赋值能正确触发 Vue 响应式更新
const cat = categoryList.value.find(c => c.typeId == activeName);
if (cat && (!cat.methods || cat.methods.length === 0)) { if (cat && (!cat.methods || cat.methods.length === 0)) {
handleCategoryExpand(cat); // 异步加载,不 await handleCategoryExpand(cat); // 异步加载,不 await
} }
@@ -1001,8 +769,7 @@ async function loadCategoryList() {
categoryName: t.name, categoryName: t.name,
// “检查类型管理”里配置的执行科室(图三) // “检查类型管理”里配置的执行科室(图三)
performDeptName: t.department || '', performDeptName: t.department || '',
items: [], items: []
methods: [] // #428修复: 初始化 methods 数组,确保 Vue 响应式追踪
}); });
} }
const unclassified = []; const unclassified = [];
@@ -1226,22 +993,12 @@ 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体 const d = res.data || res;
// 但某些情况下可能返回完整 Axios 响应 {data: AjaxResult}。 if (d.data) Object.assign(form, d.data);
// 用 res.code 判定是否已是 AjaxResult 体,避免二次解包导致 items 丢失。 if (d.items && Array.isArray(d.items)) {
const isAjaxResult = res && typeof res === 'object' && res.code !== undefined;
const ajaxBody = isAjaxResult ? res : (res.data || res);
// items 在 AjaxResult 顶层data 字段是 ExamApply 实体
const rawItems = Array.isArray(ajaxBody.items) ? ajaxBody.items : [];
const detailData = ajaxBody.data || {};
if (detailData && typeof detailData === 'object') Object.assign(form, detailData);
if (rawItems.length > 0) {
try { try {
// 为每个项目加载检查方法 // 为每个项目加载检查方法
const itemsWithMethods = await Promise.all(rawItems.map(async m => { const itemsWithMethods = await Promise.all(d.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,
@@ -1251,10 +1008,7 @@ function handleRowClick(row) {
nationalCode: '', checked: true, nationalCode: '', checked: true,
methods: [], methods: [],
selectedMethod: null, selectedMethod: null,
expanded: false, expanded: false // Bug #384修复: 添加展开状态
packageDetailsLoading: false,
isPackage: false,
packageId: null
}; };
// 加载该项目的检查方法 // 加载该项目的检查方法
if (m.bodyPartCode) { if (m.bodyPartCode) {
@@ -1285,13 +1039,6 @@ function handleRowClick(row) {
item.packageId = item.selectedMethod.packageId; item.packageId = item.selectedMethod.packageId;
} }
} }
if (!item.selectedMethod && item.methods.length) {
item.selectedMethod = pickDefaultMethod(item.methods, { packageId: item.packageId });
}
if (item.selectedMethod?.packageId) {
item.packageId = item.selectedMethod.packageId;
item.isPackage = true;
}
} }
} catch (err) { } catch (err) {
console.error('加载检查方法失败', err); console.error('加载检查方法失败', err);
@@ -1301,12 +1048,6 @@ function handleRowClick(row) {
return item; return item;
})); }));
selectedItems.value = itemsWithMethods; selectedItems.value = itemsWithMethods;
for (const it of selectedItems.value) {
if (getPackageCarrier(it)?.packageId) {
await loadPackageDetailsForItem(it);
}
it.expanded = !!getPackageCarrier(it)?.packageId;
}
syncCategoryChecked(); syncCategoryChecked();
// Bug #384修复: 回充后更新检查方法显示 // Bug #384修复: 回充后更新检查方法显示
updateMethodDisplay(); updateMethodDisplay();
@@ -1361,7 +1102,6 @@ async function handleMethodSelect(checked, method, cat) {
if (method.packageId) { if (method.packageId) {
existingItem.isPackage = true; existingItem.isPackage = true;
existingItem.packageId = method.packageId; existingItem.packageId = method.packageId;
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
// 预加载套餐明细 // 预加载套餐明细
loadPackageDetailsForItem(existingItem); loadPackageDetailsForItem(existingItem);
} }
@@ -1372,8 +1112,7 @@ async function handleMethodSelect(checked, method, cat) {
// 如果该项目不存在,创建一个并关联方法 // 如果该项目不存在,创建一个并关联方法
if (selectedItems.value.length > 0) { if (selectedItems.value.length > 0) {
const currentCategory = selectedItems.value[0].checkType; const currentCategory = selectedItems.value[0].checkType;
// Bug #428修复: 使用 cat.typeName 进行比较(与 newItem.checkType 保持一致) const newCategory = cat.typeCode || '';
const newCategory = cat.typeName || '';
if (currentCategory !== newCategory) { if (currentCategory !== newCategory) {
ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目'); ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目');
return; return;
@@ -1389,13 +1128,12 @@ async function handleMethodSelect(checked, method, cat) {
checkType: cat.typeName, checkType: cat.typeName,
nationalCode: targetItem.nationalCode || '', nationalCode: targetItem.nationalCode || '',
checked: true, checked: true,
methods: cat.methods || [method], // #428修复: 复制分类下全部方法,允许用户切换 methods: [method],
selectedMethod: method, selectedMethod: method,
expanded: false, expanded: false,
// 从方法或项目中获取套餐信息 // 从方法中获取套餐信息(优先级高于项目本身的 packageName
isPackage: !!method.packageId || !!targetItem.packageName, isPackage: !!method.packageId || !!targetItem.packageName,
packageId: method.packageId || targetItem.packageId || null, packageId: method.packageId || targetItem.packageId || null
packageName: method.packageName || targetItem.packageName || null // #428修复: 复制 packageName确保套餐明细可加载
}; };
selectedItems.value.push(newItem); selectedItems.value.push(newItem);
@@ -1459,8 +1197,7 @@ async function handleItemSelect(checked, item, cat) {
if (selectedItems.value.length > 0) { if (selectedItems.value.length > 0) {
const currentCategory = selectedItems.value[0].checkType; const currentCategory = selectedItems.value[0].checkType;
// Bug #428修复: 使用 cat.typeName 进行比较(与 effectiveCheckType 保持一致) const newCategory = cat.typeCode || '';
const newCategory = cat.typeName || '';
if (currentCategory !== newCategory) { if (currentCategory !== newCategory) {
ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目'); ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目');
item.checked = false; item.checked = false;
@@ -1468,7 +1205,7 @@ async function handleItemSelect(checked, item, cat) {
} }
} }
const newRow = { selectedItems.value.push({
id: item.id, name: item.name, id: item.id, name: item.name,
price: item.price, quantity: 1, price: item.price, quantity: 1,
serviceFee: item.serviceFee || 0, serviceFee: item.serviceFee || 0,
@@ -1479,27 +1216,10 @@ async function handleItemSelect(checked, item, cat) {
checked: true, checked: true,
methods: methods, methods: methods,
selectedMethod: null, selectedMethod: null,
expanded: false, expanded: false, // Bug #384修复: 新增展开状态,默认不展开
isPackage: !!(item.packageId || item.packageName), isPackage: !!item.packageName, // Bug #428修复: 标记是否为套餐
packageName: item.packageName || null, packageId: item.packageId || null // Bug #428修复: 套餐ID
packageDetailsLoading: false, });
packageId: item.packageId || null
};
selectedItems.value.push(newRow);
// 必须用数组里的响应式行,不能继续改局部 newRowpush 后列表内是 proxy改 raw 对象不会触发右侧卡片更新(会一直卡在「加载中」)
const row = selectedItems.value[selectedItems.value.length - 1];
// 右侧不再展示「检查方法」列表:自动选默认方法(保存、计价仍依赖 selectedMethod
if (methods.length >= 1) {
row.selectedMethod = pickDefaultMethod(methods, item);
}
updateMethodDisplay();
// 有套餐 ID 时默认展开(先显示加载区,明细写入行对象 packageDetailsDisplay
row.expanded = !!getPackageCarrier(row)?.packageId;
if (getPackageCarrier(row)?.packageId) {
await loadPackageDetailsForItem(row);
}
// 自动回填执行科室:按检查项目类型 → 检查类型管理里配置的执行科室 // 自动回填执行科室:按检查项目类型 → 检查类型管理里配置的执行科室
if (selectedItems.value.length === 1 && cat?.performDeptName) { if (selectedItems.value.length === 1 && cat?.performDeptName) {
@@ -1520,31 +1240,21 @@ async function handleItemSelect(checked, item, cat) {
// Bug #382 修复:移除自动切换页签逻辑,保持当前页签状态 // Bug #382 修复:移除自动切换页签逻辑,保持当前页签状态
} }
// Bug #384修复 + #426修复: 展开/收起项目卡片 // Bug #384修复: 展开/收起项目卡片
async function toggleItemExpand(item) { async function toggleItemExpand(item) {
item.expanded = !item.expanded; item.expanded = !item.expanded;
if (item.expanded && (item.isPackage || item.packageName) && (!item.packageDetails || item.packageDetails.length === 0) && !item.packageDetailsLoading) { // 如果是展开且该项目是套餐,加载套餐明细
if (item.expanded && item.isPackage && (!item.packageDetails || item.packageDetails.length === 0)) {
await loadPackageDetailsForItem(item); await loadPackageDetailsForItem(item);
} }
if (item.expanded && shouldShowPackageBody(item)) {
if (getPackageDetailsList(item).length === 0 && !item.packageDetailsLoading) {
await loadPackageDetailsForItem(item);
}
}
} }
// Bug #384修复: 勾选框选择检查方法(单选逻辑) // Bug #384修复: 勾选框选择检查方法(单选逻辑)
async function selectMethodCheckbox(checked, item, method) { function selectMethodCheckbox(checked, item, method) {
if (checked) { if (checked) {
item.selectedMethod = method; item.selectedMethod = method;
if (item.expanded && method.packageId) {
loadPackageDetailsForItem(item);
}
// 动态加载该方法对应的套餐明细
await loadMethodPackageDetails(item, method);
} else { } else {
item.selectedMethod = null; item.selectedMethod = null;
item.methodPackageDetails = [];
} }
// 联动更新表单检查方法显示字段 // 联动更新表单检查方法显示字段
updateMethodDisplay(); updateMethodDisplay();
@@ -1555,72 +1265,6 @@ async function selectMethodCheckbox(checked, item, method) {
}); });
} }
// 根据检查方法的packageName加载对应的套餐明细
async function loadMethodPackageDetails(item, method) {
item.methodPackageLoading = true;
item.methodPackageDetails = [];
try {
if (!method.packageName) {
item.methodPackageLoading = false;
return;
}
// 通过packageName查询套餐获取packageId
const pkgRes = await listCheckPackage({ packageName: method.packageName });
let packages = pkgRes?.data || [];
if (!Array.isArray(packages)) {
packages = packages.records || packages.data || [];
}
if (packages.length === 0) {
item.methodPackageLoading = false;
return;
}
const packageId = packages[0].id;
// 查询套餐明细
const detailRes = await request({
url: `/system/package/${packageId}/details`,
method: 'get'
});
if (detailRes.code === 200 && detailRes.data) {
item.methodPackageDetails = detailRes.data.map(d => ({
id: d.id,
name: d.itemName || d.name,
quantity: d.quantity || 1,
unit: d.unit || '次',
price: d.unitPrice || d.price || 0,
amount: d.amount || d.total || 0,
checked: true // 默认勾选
}));
}
} catch (err) {
console.error('加载方法套餐明细失败:', err);
item.methodPackageDetails = [];
} finally {
item.methodPackageLoading = false;
}
}
/** 检查明细表格中切换检查方法 */
async function onDetailMethodChange(row, val) {
row.selectedMethod = val || null;
if (val?.packageId) {
row.packageId = val.packageId;
row.isPackage = true;
}
row.packageDetailsDisplay = undefined;
const carrier = getPackageCarrier(row);
if (carrier) {
carrier.packageDetails = undefined;
}
updateMethodDisplay();
row.expanded = !!getPackageCarrier(row)?.packageId;
if (getPackageCarrier(row)?.packageId) {
await loadPackageDetailsForItem(row);
}
nextTick(() => {
form.totalAmount = totalAmountCalc.value;
});
}
// Bug #384修复: 更新检查方法显示字段(联动) // Bug #384修复: 更新检查方法显示字段(联动)
function updateMethodDisplay() { function updateMethodDisplay() {
// 找到第一个有选中检查方法的项目 // 找到第一个有选中检查方法的项目
@@ -1710,19 +1354,6 @@ defineExpose({ getList });
gap: 8px; gap: 8px;
} }
/* Bug #499: 查询过滤工具栏 */
.search-toolbar {
margin-bottom: 10px;
padding: 8px 0;
border-bottom: 1px solid #ebeef5;
}
.search-toolbar :deep(.el-form-item) {
margin-bottom: 8px;
}
.search-toolbar :deep(.el-form-item__label) {
font-size: 12px;
}
/* 底部区域:左表单 + 右分类 */ /* 底部区域:左表单 + 右分类 */
.bottom-section { .bottom-section {
display: flex; display: flex;
@@ -1765,7 +1396,7 @@ defineExpose({ getList });
/* 右:分类面板 */ /* 右:分类面板 */
.category-panel { .category-panel {
width: 420px; width: 380px;
flex-shrink: 0; flex-shrink: 0;
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
@@ -1800,7 +1431,6 @@ defineExpose({ getList });
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; /* Bug #500: 防止切换时水平方向溢出导致抖动 */ overflow-x: hidden; /* Bug #500: 防止切换时水平方向溢出导致抖动 */
min-height: 120px; /* Bug #500: 固定最小高度,避免分类切换时 flex 容器高度突变 */
} }
.empty-hint { .empty-hint {
color: #909399; color: #909399;
@@ -1901,11 +1531,8 @@ defineExpose({ getList });
} }
/* 已选择 tags */ /* 已选择 tags */
/* 已选择:加宽,避免套餐明细挤成一团 */
.selected-panel { .selected-panel {
width: 220px; width: 140px; /* Bug #384修复: 加宽以适应展开内容 */
min-width: 200px;
max-width: 280px;
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1913,11 +1540,9 @@ defineExpose({ getList });
.selected-tags { .selected-tags {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 6px;
padding-right: 2px;
} }
.selected-tag { .selected-tag {
max-width: 100%; max-width: 100%;
@@ -1930,40 +1555,30 @@ defineExpose({ getList });
font-size: 12px; font-size: 12px;
} }
/* 已选择项目卡片 */ /* Bug #384修复: 已选择项目卡片(可展开) */
.selected-item-card { .selected-item-card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background: #fff; background: #F5F5F5;
border-radius: 6px; border-radius: 4px;
border: 1px solid #e4e7ed; border: 1px solid #e4e7ed;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
overflow: hidden;
} }
.selected-item-card .card-header { .selected-item-card .card-header {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 10px 10px; padding: 8px 10px;
cursor: pointer; cursor: pointer;
gap: 8px; gap: 4px;
background: linear-gradient(180deg, #f8fafc 0%, #f0f4f8 100%);
border-bottom: 1px solid transparent;
} }
.selected-item-card .card-header:hover { .selected-item-card .card-header:hover {
background: linear-gradient(180deg, #ecf5ff 0%, #e3eef8 100%); background: #E6F7FF;
}
.selected-item-card.is-expanded .card-header {
border-bottom-color: #ebeef5;
} }
.card-name { .card-name {
flex: 1; flex: 1;
min-width: 0; font-size: 12px;
font-size: 13px;
font-weight: 500;
color: #303133; color: #303133;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -1971,23 +1586,19 @@ defineExpose({ getList });
} }
.card-price { .card-price {
font-size: 13px; font-size: 12px;
color: #409eff; color: #1890FF;
font-weight: 600; font-weight: 500;
flex-shrink: 0;
} }
.expand-icon { .expand-icon {
font-size: 14px; font-size: 12px;
color: #909399; color: #909399;
transition: transform 0.2s ease;
flex-shrink: 0;
transition: transform 0.2s; transition: transform 0.2s;
transform: rotate(0deg);
} }
.expand-icon.expanded { .expand-icon.expanded {
transform: rotate(90deg); transform: rotate(180deg);
} }
/* Bug #428修复: 套餐明细列表样式 */ /* Bug #428修复: 套餐明细列表样式 */
@@ -2025,83 +1636,38 @@ defineExpose({ getList });
white-space: nowrap; white-space: nowrap;
} }
/* 展开区域 */ /* Bug #384修复: 检查方法勾选框列表 */
.selected-card-body { .method-list {
background: #fafbfc; padding: 6px 10px;
} background: #fff;
border-top: 1px solid #e4e7ed;
.package-details-loading,
.package-details-empty {
padding: 12px 10px;
font-size: 12px;
color: #909399;
text-align: center;
}
.package-details-empty {
color: #c0c4cc;
}
.package-details-list {
padding: 10px 10px 12px;
}
.package-details-head {
font-size: 11px;
font-weight: 600;
color: #909399;
letter-spacing: 0.02em;
margin-bottom: 8px;
padding-bottom: 6px;
border-bottom: 1px dashed #dcdfe6;
}
.detail-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 8px 12px;
align-items: start;
padding: 10px 0;
border-bottom: 1px solid #ebeef5;
}
.detail-row:last-of-type {
border-bottom: none;
padding-bottom: 2px;
}
.detail-name {
font-size: 12px;
color: #303133;
line-height: 1.5;
word-break: break-word;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
}
.detail-meta {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end;
gap: 4px; gap: 4px;
flex-shrink: 0;
text-align: right;
} }
.detail-qty { .method-option {
display: flex;
align-items: center;
}
.method-option :deep(.el-checkbox__label) {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.method-option .method-name {
font-size: 11px; font-size: 11px;
color: #909399; color: #606266;
font-variant-numeric: tabular-nums;
} }
.detail-price { .method-option .method-price {
font-size: 12px; font-size: 11px;
font-weight: 600;
color: #e6a23c; color: #e6a23c;
font-variant-numeric: tabular-nums; font-weight: 500;
margin-left: 8px;
} }
/* 折叠组件细节 */ /* 折叠组件细节 */
@@ -2114,10 +1680,10 @@ defineExpose({ getList });
height: auto; height: auto;
line-height: 1.5; line-height: 1.5;
} }
/* Bug #500修复: 折叠内容使用明确属性过渡,避免 transition: all 导致子元素意外动画 */ /* Bug #500: 折叠内容添加平滑过渡动画,避免切换时高度跳变 */
:deep(.el-collapse-item__content) { :deep(.el-collapse-item__content) {
padding-bottom: 4px; padding-bottom: 4px;
transition: height 0.3s ease, max-height 0.3s ease; transition: all 0.3s ease;
} }
/* Bug #500: 折叠面板动画容器,添加 overflow:hidden 防止展开时内容溢出导致闪烁 */ /* Bug #500: 折叠面板动画容器,添加 overflow:hidden 防止展开时内容溢出导致闪烁 */
:deep(.el-collapse-item__wrap) { :deep(.el-collapse-item__wrap) {

View File

@@ -589,46 +589,36 @@ function handleUseOrderGroup(row) {
minUnitPrice: orderDetail.minUnitPrice, minUnitPrice: orderDetail.minUnitPrice,
inventoryList: orderDetail.inventoryList || [], inventoryList: orderDetail.inventoryList || [],
priceList: orderDetail.priceList || [], priceList: orderDetail.priceList || [],
partPercent: orderDetail.partPercent ?? 1, partPercent: orderDetail.partPercent || 1,
partAttributeEnum: orderDetail.partAttributeEnum,
unitConversionRatio: orderDetail.unitConversionRatio,
// 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId // 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId
positionId: item.positionId ?? orderDetail.positionId, positionId: item.positionId || orderDetail.positionId,
defaultLotNumber: orderDetail.defaultLotNumber, defaultLotNumber: orderDetail.defaultLotNumber,
// 单位信息 // 单位信息
unitCode: item.unitCode ?? orderDetail.unitCode, unitCode: item.unitCode || orderDetail.unitCode,
categoryCode: item.categoryCode ?? orderDetail.categoryCode,
unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText, unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText,
minUnitCode: orderDetail.minUnitCode, minUnitCode: orderDetail.minUnitCode,
doseUnitCode: orderDetail.doseUnitCode, doseUnitCode: orderDetail.doseUnitCode,
// 合并后的完整对象(用于 setValue // 合并后的完整对象(用于 setValue
// 先展开 orderDetail 获取所有药品基础字段categoryCode、minUnitCode、doseUnitCode、
// partPercent、partAttributeEnum、unitConversionRatio、defaultLotNumber 等),
// 再用组套用户覆盖值覆盖,确保单次剂量/频次/用法/用药天数/总量等不被丢失
mergedDetail: { mergedDetail: {
...orderDetail, ...orderDetail,
adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目', adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目',
adviceType: orderDetail.adviceType, adviceType: orderDetail.adviceType,
quantity: item.quantity, quantity: item.quantity,
unitCode: item.unitCode ?? orderDetail.unitCode, unitCode: item.unitCode || orderDetail.unitCode,
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: item.rateCode || orderDetail.rateCode,
methodCode: item.methodCode ?? orderDetail.methodCode, methodCode: item.methodCode || orderDetail.methodCode,
dispensePerDuration: item.dispensePerDuration ?? orderDetail.dispensePerDuration, dispensePerDuration: item.dispensePerDuration || orderDetail.dispensePerDuration,
doseQuantity: item.doseQuantity ?? orderDetail.doseQuantity, doseQuantity: item.doseQuantity,
// 🔧 Bug #218 / #403 修复positionId 可能存储在 item 本身,优先使用 item.positionId inventoryList: orderDetail.inventoryList || [],
positionId: item.positionId ?? orderDetail.positionId, priceList: orderDetail.priceList || [],
// 执行科室:优先使用组套明细中保存的 orgId partPercent: orderDetail.partPercent || 1,
orgId: item.orgId ?? orderDetail.orgId, // 🔧 Bug #218 修复positionId 可能存储在 item 本身,优先使用 item.positionId
orgName: item.orgName ?? orderDetail.orgName, positionId: item.positionId || orderDetail.positionId,
// 组号(保留组套中的分组信息) defaultLotNumber: orderDetail.defaultLotNumber,
groupId: item.groupId,
groupOrder: item.groupOrder,
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '1',
} }
}; };
}); });

View File

@@ -315,7 +315,6 @@
data-prop="dispensePerDuration"> data-prop="dispensePerDuration">
<el-input-number v-model="scope.row.dispensePerDuration" style="width: 80px" :min="1" <el-input-number v-model="scope.row.dispensePerDuration" style="width: 80px" :min="1"
controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)" controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)"
@input="calculateTotalAmount(scope.row, scope.$index)"
@change="calculateTotalAmount(scope.row, scope.$index)" @change="calculateTotalAmount(scope.row, scope.$index)"
@keyup.enter.prevent=" @keyup.enter.prevent="
handleEnter('dispensePerDuration', scope.row, scope.$index) handleEnter('dispensePerDuration', scope.row, scope.$index)
@@ -875,7 +874,7 @@ import { ArrowDown, Search, Memo, Minus, Plus, Edit, Delete } from '@element-plu
import printUtils, { getPrinterList, PRINT_TEMPLATE, savePrinterToCache, } from '@/utils/printUtils'; import printUtils, { getPrinterList, PRINT_TEMPLATE, savePrinterToCache, } from '@/utils/printUtils';
import Template from "@/views/inpatientDoctor/home/emr/components/template.vue"; import Template from "@/views/inpatientDoctor/home/emr/components/template.vue";
const emit = defineEmits(['selectDiagnosis', 'inspectionListRefresh']); const emit = defineEmits(['selectDiagnosis']);
const total = ref(0); const total = ref(0);
const queryParams = ref({}); const queryParams = ref({});
const prescriptionList = ref([]); const prescriptionList = ref([]);
@@ -2084,21 +2083,6 @@ function getOrgList() {
}); });
} }
/** 诊疗医嘱关联检验申请时 contentJson 含 applyNo */
function getInspectionApplyNoFromAdviceRow(row) {
if (!row || row.adviceType !== 3) {
return null;
}
try {
const raw = row.contentJson;
const j = raw ? (typeof raw === 'string' ? JSON.parse(raw) : raw) : {};
const no = j && j.applyNo != null ? String(j.applyNo).trim() : '';
return no || null;
} catch (e) {
return null;
}
}
function handleDelete() { function handleDelete() {
let selectRows = prescriptionRef.value.getSelectionRows(); let selectRows = prescriptionRef.value.getSelectionRows();
console.log('BugFix#219: handleDelete called, selectRows=', selectRows); console.log('BugFix#219: handleDelete called, selectRows=', selectRows);
@@ -2278,31 +2262,12 @@ function handleDelete() {
} }
if (deleteList.length > 0) { if (deleteList.length > 0) {
const hasLabLinked = deleteList.some((d) => {
const row = normalRows.find((r) => r.requestId === d.requestId);
return row && getInspectionApplyNoFromAdviceRow(row);
});
const runApiDelete = () => {
savePrescription({ adviceSaveList: deleteList }).then((res) => { savePrescription({ adviceSaveList: deleteList }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess('删除成功'); proxy.$modal.msgSuccess('删除成功');
getListInfo(false); getListInfo(false);
emit('inspectionListRefresh');
} }
}); });
};
if (hasLabLinked) {
proxy.$modal
.confirm(
'删除此医嘱将同时作废关联的检验申请单(检验页签中的同单申请及同单下相关医嘱)。是否继续?',
'删除确认',
{ type: 'warning' }
)
.then(runApiDelete)
.catch(() => {});
} else {
runApiDelete();
}
} else if (consultationRows.length == 0) { } else if (consultationRows.length == 0) {
proxy.$modal.msgWarning('所选医嘱不可删除,请先撤回后再删除'); proxy.$modal.msgWarning('所选医嘱不可删除,请先撤回后再删除');
return; return;
@@ -3361,14 +3326,10 @@ function syncGroupFields(row) {
} }
// 同步执行科室 // 同步执行科室
// 🔧 Bug #455: 诊疗类医嘱(adviceType=3)不使用项目配置的执行科室,
// 避免配置ID不在机构树中导致显示原始ID保持患者就诊科室即可
if (row.orgId || row.positionId) { if (row.orgId || row.positionId) {
if (Number(row.adviceType) != 3) {
// 🔧 修复:优先使用项目所属科室(orgId)其次positionId // 🔧 修复:优先使用项目所属科室(orgId)其次positionId
prescriptionList.value[rowIndex.value].orgId = row.orgId || row.positionId; prescriptionList.value[rowIndex.value].orgId = row.orgId || row.positionId;
} }
}
// 同步皮试标记 // 同步皮试标记
if (row.skinTestFlag !== undefined && row.skinTestFlag !== null) { if (row.skinTestFlag !== undefined && row.skinTestFlag !== null) {
@@ -3451,16 +3412,8 @@ async function setValue(row) {
showPopover: false, // 确保查询框关闭 showPopover: false, // 确保查询框关闭
}; };
console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText); console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
// 🔧 Bug #455: 诊疗医嘱(adviceType=3)的执行科室默认使用患者就诊科室, // 🔧 Bug #455: 执行科室默认逻辑使用positionId(诊疗执行科室配置) → 患者就诊科室不再使用row.orgId(项目所属科室)
// 不使用positionId(诊疗目录配置的执行科室)避免配置ID不在机构树中导致显示原始ID
if (Number(row.adviceType) == 3) {
// 覆盖 catalog 传来的 positionId/orgId使用患者就诊科室
prescriptionList.value[rowIndex.value].orgId = props.patientInfo?.orgId;
prescriptionList.value[rowIndex.value].positionId = props.patientInfo?.orgId;
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo?.orgId) || props.patientInfo?.orgName || '';
} else {
prescriptionList.value[rowIndex.value].orgId = row.positionId || props.patientInfo?.orgId; prescriptionList.value[rowIndex.value].orgId = row.positionId || props.patientInfo?.orgId;
}
prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity; prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity;
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1; prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value; prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value;
@@ -3692,10 +3645,7 @@ function handleSaveGroup(orderGroupList) {
unitCode_dictText: item.unitCodeName || '', unitCode_dictText: item.unitCodeName || '',
statusEnum: 1, statusEnum: 1,
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId // 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
// 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室不使用目录配置的ID orgId: item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId,
orgId: item.adviceType === 3
? props.patientInfo?.orgId
: (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId),
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,

View File

@@ -633,12 +633,7 @@ function getList() {
pageSize: 100, pageSize: 100,
encounterId: props.patientInfo.encounterId encounterId: props.patientInfo.encounterId
}).then((res) => { }).then((res) => {
if (res.code === 200) { surgeryList.value = res.data.records || []
surgeryList.value = res.data?.records || []
} else {
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
surgeryList.value = []
}
}).catch(error => { }).catch(error => {
console.error('获取手术列表失败:', error) console.error('获取手术列表失败:', error)
proxy.$modal.msgError('数据加载失败,请稍后重试') proxy.$modal.msgError('数据加载失败,请稍后重试')
@@ -1138,11 +1133,13 @@ function submitForm() {
// 新增手术 // 新增手术
addSurgery(form.value).then((res) => { addSurgery(form.value).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('手术申请提交成功!') proxy.$modal.msgSuccess(res.msg || '手术申请提交成功!')
// 保存麻醉方式 // 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum) sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false open.value = false
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表 emit('saved') // 通知父组件刷新医嘱列表
// 刷新手术申请列表
getList()
} else { } else {
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息') proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
} }
@@ -1154,11 +1151,13 @@ function submitForm() {
// 修改手术 // 修改手术
updateSurgery(form.value).then((res) => { updateSurgery(form.value).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('手术申请修改成功!') proxy.$modal.msgSuccess(res.msg || '手术申请修改成功!')
// 保存麻醉方式 // 保存麻醉方式
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum) sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
open.value = false open.value = false
emit('saved') // 通知父组件刷新医嘱列表及手术申请列表 emit('saved') // 通知父组件刷新医嘱列表
// 刷新手术申请列表
getList()
} else { } else {
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息') proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
} }

View File

@@ -138,8 +138,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="医嘱" name="prescription"> <el-tab-pane label="医嘱" name="prescription">
<prescriptionlist :patientInfo="patientInfo" ref="prescriptionRef" :activeTab="activeTab" <prescriptionlist :patientInfo="patientInfo" ref="prescriptionRef" :activeTab="activeTab"
:outpatientEmrSaved="outpatientEmrSaved" :outpatientEmrSaved="outpatientEmrSaved" />
@inspectionListRefresh="refreshInspectionListFromAdvice" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="中医" name="tcm"> <el-tab-pane label="中医" name="tcm">
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" /> <tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
@@ -153,7 +152,7 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="手术申请" name="surgery"> <el-tab-pane label="手术申请" name="surgery">
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef" <surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" /> @saved="() => prescriptionRef?.getListInfo()" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="电子处方" name="eprescription"> <el-tab-pane label="电子处方" name="eprescription">
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" /> <eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
@@ -313,9 +312,6 @@ const patientDrawerRef = ref();
const prescriptionRef = ref(); const prescriptionRef = ref();
const tcmRef = ref(); const tcmRef = ref();
const inspectionRef = ref(); const inspectionRef = ref();
function refreshInspectionListFromAdvice() {
inspectionRef.value?.getList?.();
}
const examinationRef = ref(); const examinationRef = ref();
const surgeryRef = ref(); const surgeryRef = ref();
const emrRef = ref(); const emrRef = ref();

View File

@@ -51,7 +51,7 @@ const currentSelectRow = ref<any>({});
const queryParams = ref({ const queryParams = ref({
pageSize: 100, pageSize: 100,
pageNo: 1, pageNo: 1,
adviceTypes: [1, 2, 3, 6], adviceTypes: '1,2,3,6',
searchKey: '', searchKey: '',
organizationId: '', organizationId: '',
categoryCode: '', categoryCode: '',
@@ -88,10 +88,10 @@ const tableColumns = computed<TableColumn[]>(() => [
function refresh(adviceType: any, categoryCode: string, searchKey: string) { function refresh(adviceType: any, categoryCode: string, searchKey: string) {
// 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目 // 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目
if (searchKey) { if (searchKey) {
queryParams.value.adviceTypes = [1, 2, 3, 6]; queryParams.value.adviceTypes = '1,2,3,6';
} else { } else {
queryParams.value.adviceTypes = queryParams.value.adviceTypes =
adviceType !== undefined && adviceType !== '' ? [parseInt(adviceType)] : [1, 2, 3, 6]; adviceType !== undefined && adviceType !== '' ? String(adviceType) : '1,2,3,6';
} }
queryParams.value.categoryCode = categoryCode || ''; queryParams.value.categoryCode = categoryCode || '';
queryParams.value.searchKey = searchKey || ''; queryParams.value.searchKey = searchKey || '';
@@ -131,8 +131,7 @@ function getList() {
} }
}); });
}) })
.catch((err) => { .catch(() => {
console.warn('医嘱基础信息加载失败:', err);
adviceBaseList.value = []; adviceBaseList.value = [];
}) })
.finally(() => { .finally(() => {

View File

@@ -44,17 +44,6 @@ export function getSurgery(queryParams) {
}); });
} }
/**
* 分页查询手术申请单全局不需要encounterId用于门诊手术安排查找弹窗
*/
export function getSurgeryPage(queryParams) {
return request({
url: '/reg-doctorstation/request-form/get-surgery-page',
method: 'get',
params: queryParams,
});
}
/** /**
* 查询护理医嘱信息 * 查询护理医嘱信息
*/ */

View File

@@ -49,15 +49,6 @@
<el-option label="已作废" value="7" /> <el-option label="已作废" value="7" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关键字">
<el-input
v-model="filterForm.keyword"
placeholder="申请单号 / 检查项目名称"
clearable
style="width: 220px"
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch" :loading="loading"> <el-button type="primary" @click="handleSearch" :loading="loading">
<el-icon><Search /></el-icon> <el-icon><Search /></el-icon>
@@ -92,43 +83,12 @@
<el-table-column prop="requesterId_dictText" label="申请者" width="120" /> <el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="申请单状态" width="120" align="center"> <el-table-column label="申请单状态" width="120" align="center">
<template #default="scope"> <template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round> <span>{{ parseStatus(scope.row.status) }}</span>
{{ parseStatus(scope.row.status) }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="280" align="center" fixed="right"> <el-table-column label="操作" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<!-- 详情 - 所有状态都显示 -->
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button> <el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
<!-- 待签发修改删除 -->
<template v-if="scope.row.status === '0' || scope.row.status === 0">
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
<!-- 已签发撤回 -->
<template v-else-if="scope.row.status === '1' || scope.row.status === 1">
<el-button link type="warning" @click="handleRecall(scope.row)">撤回</el-button>
</template>
<!-- 已校对/待接收打印 -->
<template v-else-if="scope.row.status === '2' || scope.row.status === 2 || scope.row.status === '3' || scope.row.status === 3">
<el-button link type="primary" @click="handlePrint(scope.row)">打印</el-button>
</template>
<!-- 已接收/已检查看报告 -->
<template v-else-if="scope.row.status === '4' || scope.row.status === 4 || scope.row.status === '5' || scope.row.status === 5">
<el-button link type="success" @click="handleViewReport(scope.row)">看报告</el-button>
</template>
<!-- 已出报告打印看报告 -->
<template v-else-if="scope.row.status === '6' || scope.row.status === 6">
<el-button link type="primary" @click="handlePrint(scope.row)">打印</el-button>
<el-button link type="success" @click="handleViewReport(scope.row)">看报告</el-button>
</template>
<!-- 已作废无额外按钮 -->
<template v-else-if="scope.row.status === '7' || scope.row.status === 7">
</template>
<!-- 其他/未知状态仅详情 -->
<template v-else>
</template>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -177,7 +137,7 @@
<el-descriptions title="申请单描述" :column="2"> <el-descriptions title="申请单描述" :column="2">
<template v-for="(value, key) in descJsonData" :key="key"> <template v-for="(value, key) in descJsonData" :key="key">
<el-descriptions-item v-if="isFieldMatched(key)" :label="getFieldLabel(key)"> <el-descriptions-item v-if="isFieldMatched(key)" :label="getFieldLabel(key)">
{{ transformField(key, value) || '-' }} {{ value || '-' }}
</el-descriptions-item> </el-descriptions-item>
</template> </template>
</el-descriptions> </el-descriptions>
@@ -200,102 +160,15 @@
<el-button @click="detailDialogVisible = false">关闭</el-button> <el-button @click="detailDialogVisible = false">关闭</el-button>
</template> </template>
</el-dialog> </el-dialog>
<!-- 修改申请单弹窗 - 复用检查申请单组件 -->
<el-dialog
v-model="editDialogVisible"
title="修改检查申请"
width="1200px"
destroy-on-close
top="5vh"
:close-on-click-modal="false"
>
<MedicalExaminations
v-if="editDialogVisible"
ref="editFormRef"
:is-edit-mode="true"
:edit-data="editingRow"
:external-patient-info="patientInfo"
/>
<template #footer>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleEditSubmit">确认</el-button>
</template>
</el-dialog>
<!-- 查看报告弹窗 -->
<el-dialog
v-model="reportDialogVisible"
:title="'检查报告 - ' + (reportData?.prescriptionNo || '')"
width="900px"
destroy-on-close
top="5vh"
:close-on-click-modal="false"
>
<div v-loading="reportLoading" class="report-viewer">
<!-- 报告基本信息 -->
<div v-if="reportData" class="report-viewer-container">
<el-descriptions title="报告信息" :column="2" border size="small">
<el-descriptions-item label="患者姓名">{{ reportData.patientName || reportRow?.patientName || '-' }}</el-descriptions-item>
<el-descriptions-item label="申请单号">{{ reportData.prescriptionNo || reportRow?.prescriptionNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="申请单名称">{{ reportData.name || reportRow?.name || '-' }}</el-descriptions-item>
<el-descriptions-item label="报告时间">{{ reportData.reportTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="诊断意见" :span="2">{{ reportData.diagnosis || reportData.conclusion || '-' }}</el-descriptions-item>
</el-descriptions>
<!-- 报告详细内容 -->
<div v-if="reportData.content" class="report-content-section">
<div class="section-title">报告内容</div>
<div class="report-content-text">{{ reportData.content }}</div>
</div>
<!-- 影像预览 - PACS链接 -->
<div v-if="reportData.imageUrl || reportData.pacsUrl" class="report-image-section">
<div class="section-title">
影像预览
<el-button
v-if="reportData.imageUrl || reportData.pacsUrl"
type="primary"
size="small"
plain
style="margin-left: 12px;"
@click="openPacsLink"
>
<el-icon><Link /></el-icon>
打开PACS影像
</el-button>
</div>
<iframe
v-if="reportData.imageUrl"
:src="reportData.imageUrl"
class="report-iframe"
frameborder="0"
/>
<el-empty v-else-if="!reportData.imageUrl && reportData.pacsUrl" description="点击上方按钮打开PACS影像" :image-size="60" />
</div>
<!-- 完全无数据时的提示 -->
<el-empty v-if="!reportData.content && !reportData.imageUrl && !reportData.pacsUrl" description="暂无详细报告数据" :image-size="60" />
</div>
<!-- 未获取到报告 -->
<el-empty v-else description="暂未生成报告" :image-size="80" />
</div>
<template #footer>
<el-button @click="reportDialogVisible = false">关闭</el-button>
</template>
</el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
import {computed, getCurrentInstance, ref, watch, nextTick} from 'vue'; import {computed, getCurrentInstance, ref, watch} from 'vue';
import {Refresh, Search, Link} from '@element-plus/icons-vue'; import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js'; import {patientInfo} from '../../store/patient.js';
import {getCheck, deleteRequestForm, withdrawRequestForm, getTestResult} from './api'; import {getCheck} from './api';
import {getDepartmentList} from '@/api/public.js'; import {getDepartmentList} from '@/api/public.js';
import {getApplicationList, saveCheckd} from '../order/applicationForm/api';
import MedicalExaminations from '../order/applicationForm/medicalExaminations.vue';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
@@ -305,38 +178,11 @@ const detailDialogVisible = ref(false);
const currentDetail = ref(null); const currentDetail = ref(null);
const descJsonData = ref(null); const descJsonData = ref(null);
const orgOptions = ref([]); const orgOptions = ref([]);
const editForm = ref({
name: '',
targetDepartment: '',
symptom: '',
sign: '',
clinicalDiagnosis: '',
otherDiagnosis: '',
relatedResult: '',
attention: '',
examinationPurpose: '',
medicalHistorySummary: '',
});
// 报告弹窗相关
const reportDialogVisible = ref(false);
const reportLoading = ref(false);
const reportData = ref(null);
const reportRow = ref(null);
// 获取近7天的日期范围作为默认值
const getDefaultDateRange = () => {
const now = new Date();
const endDate = now.toISOString().split('T')[0];
const startDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
return [startDate, endDate];
};
// 筛选表单数据 // 筛选表单数据
const filterForm = ref({ const filterForm = ref({
dateRange: getDefaultDateRange(), // 默认近一周 dateRange: [], // [startDate, endDate]
status: '', // 申请单状态 status: '', // 申请单状态
keyword: '', // 关键字搜索
}); });
const fetchData = async () => { const fetchData = async () => {
@@ -361,18 +207,11 @@ const fetchData = async () => {
params.status = filterForm.value.status; params.status = filterForm.value.status;
} }
// 添加关键字搜索
if (filterForm.value.keyword && filterForm.value.keyword.trim()) {
params.keyword = filterForm.value.keyword.trim();
}
const res = await getCheck(params); const res = await getCheck(params);
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
const raw = res.data?.records || res.data; const raw = res.data?.records || res.data;
const list = Array.isArray(raw) ? raw : [raw]; const list = Array.isArray(raw) ? raw : [raw];
console.log('API返回的原始数据:', JSON.stringify(list, null, 2));
tableData.value = list.filter(Boolean); tableData.value = list.filter(Boolean);
console.log('tableData设置后的第一条:', tableData.value[0]);
} else { } else {
tableData.value = []; tableData.value = [];
} }
@@ -404,9 +243,8 @@ const handleSearch = async () => {
* 重置按钮处理 * 重置按钮处理
*/ */
const handleReset = () => { const handleReset = () => {
filterForm.value.dateRange = getDefaultDateRange(); filterForm.value.dateRange = [];
filterForm.value.status = ''; filterForm.value.status = '';
filterForm.value.keyword = '';
fetchData(); fetchData();
}; };
@@ -429,34 +267,9 @@ const parseStatus = (status) => {
return statusMap[String(status)] || '-'; return statusMap[String(status)] || '-';
}; };
/**
* 获取状态标签类型 - 参考临床医嘱样式
* @param {string|number} status - 状态码
* @returns {string} el-tag type
*/
const getStatusTagType = (status) => {
const typeMap = {
'0': 'primary', // 待签发 - 蓝色
'1': 'success', // 已签发 - 绿色
'2': 'success', // 已校对 - 绿色
'3': 'primary', // 待接收 - 蓝色
'4': 'primary', // 已接收 - 蓝色
'5': 'success', // 已检查 - 绿色
'6': 'success', // 已出报告 - 绿色
'7': 'danger', // 已作废 - 红色
};
return typeMap[String(status)] || 'info';
};
const labelMap = { const labelMap = {
categoryType: '项目类别', categoryType: '项目类别',
targetDepartment: '发往科室', targetDepartment: '发往科室',
urgencyLevel: '紧急程度',
allergyHistory: '过敏史',
examinationPurpose: '检查目的',
expectedExaminationTime: '期望检查时间',
medicalHistorySummary: '病史摘要',
allergyConfirmed: '过敏确认',
symptom: '症状', symptom: '症状',
sign: '体征', sign: '体征',
clinicalDiagnosis: '临床诊断', clinicalDiagnosis: '临床诊断',
@@ -465,17 +278,6 @@ const labelMap = {
attention: '注意事项', attention: '注意事项',
}; };
// Fields that need value transformation before display
const transformField = (key, value) => {
if (key === 'urgencyLevel') {
return value === 'emergency' ? '急诊' : '普通';
}
if (key === 'allergyConfirmed') {
return value === true || value === 'true' ? '已口头确认' : '未确认';
}
return value;
};
const isFieldMatched = (key) => { const isFieldMatched = (key) => {
return key in labelMap; return key in labelMap;
}; };
@@ -490,45 +292,50 @@ const hasMatchedFields = computed(() => {
}); });
/** 查询科室 */ /** 查询科室 */
const getLocationInfo = async () => { const getLocationInfo = () => {
try { getDepartmentList().then((res) => {
const res = await getDepartmentList(); orgOptions.value = res.data || [];
orgOptions.value = Array.isArray(res.data) ? res.data : []; });
} catch (e) {
console.warn('科室列表加载失败:', e.message);
orgOptions.value = [];
}
}; };
// 递归查找树形科室节点 const recursionFun = (targetDepartment) => {
const findTreeItem = (list, id) => { let name = '';
if (!list || list.length === 0) return null; for (let index = 0; index < orgOptions.value.length; index++) {
for (const item of list) { const obj = orgOptions.value[index];
if (item.id == id) return item; if (obj.id == targetDepartment) {
if (item.children && item.children.length > 0) { name = obj.name;
const found = findTreeItem(item.children, id); }
if (found) return found; const subObjArray = obj['children'];
if (subObjArray && subObjArray.length > 0) {
for (let index = 0; index < subObjArray.length; index++) {
const item = subObjArray[index];
if (item.id == targetDepartment) {
name = item.name;
} }
} }
return null; }
}
return name;
}; };
const handleViewDetail = async (row) => { const handleViewDetail = async (row) => {
// 确保科室数据已加载,以便将 ID 解析为名称 console.log('targetDepartment========>', JSON.stringify(row));
if (!orgOptions.value || orgOptions.value.length === 0) {
await getLocationInfo();
}
currentDetail.value = row; currentDetail.value = row;
// 解析 descJson // 解析 descJson
if (row.descJson) { if (row.descJson) {
try { try {
const obj = JSON.parse(row.descJson); const obj = JSON.parse(row.descJson);
// 将发往科室 ID 转换为名称 // 确保科室数据已加载
if (obj.targetDepartment) { if (!orgOptions.value || orgOptions.value.length === 0) {
const deptItem = findTreeItem(orgOptions.value, obj.targetDepartment); await new Promise((resolve) => {
obj.targetDepartment = deptItem ? deptItem.name : obj.targetDepartment; getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
resolve();
});
});
} }
obj.targetDepartment = recursionFun(obj.targetDepartment);
descJsonData.value = obj; descJsonData.value = obj;
} catch (e) { } catch (e) {
console.error('解析 descJson 失败:', e); console.error('解析 descJson 失败:', e);
@@ -540,395 +347,6 @@ const handleViewDetail = async (row) => {
detailDialogVisible.value = true; detailDialogVisible.value = true;
}; };
/**
* 删除申请单 - 仅待签发状态可用
*/
const handleDelete = async (row) => {
try {
await proxy.$modal?.confirm?.('确认删除该检查申请单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
const res = await deleteRequestForm({ requestFormId: row.requestFormId });
if (res.code === 200) {
proxy.$modal?.msgSuccess?.('删除成功');
fetchData();
} else {
proxy.$modal?.msgError?.(res.msg || '删除失败');
}
} catch (e) {
// 用户取消操作,不做处理
}
};
/**
* 撤回申请单 - 仅已签发状态可用
*/
const handleRecall = async (row) => {
try {
await proxy.$modal?.confirm?.('确认撤回该申请单?撤回后状态将变更为"待签发"。', '提示', {
confirmButtonText: '确定撤回',
cancelButtonText: '取消',
type: 'warning',
});
const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
if (res.code === 200) {
proxy.$modal?.msgSuccess?.('撤回成功');
fetchData();
} else {
proxy.$modal?.msgError?.(res.msg || '撤回失败');
}
} catch (e) {
// 用户取消操作,不做处理
}
};
/**
* 打印申请单 - 已校对/待接收/已接收/已检查状态可用
* 打印内容与详情展示一致,并包含申请单条码
*/
const handlePrint = async (row) => {
try {
proxy.$modal?.msgInfo?.('正在生成打印预览...');
// 确保科室数据已加载,用于解析发往科室名称
if (!orgOptions.value || orgOptions.value.length === 0) {
await new Promise((resolve) => {
getDepartmentList().then((res) => {
orgOptions.value = res.data || [];
resolve();
});
});
}
// 解析 descJson
let descData = {};
if (row.descJson) {
try {
const obj = JSON.parse(row.descJson);
// 将发往科室ID转换为名称
if (obj.targetDepartment) {
obj.targetDepartment = recursionFun(obj.targetDepartment);
}
descData = obj;
} catch (e) {
console.error('解析 descJson 失败:', e);
}
}
// 构建诊疗项目表格行
let detailRowsHtml = '';
const detailList = row.requestFormDetailList || [];
if (detailList.length > 0) {
detailList.forEach((item, index) => {
detailRowsHtml += `
<tr>
<td style="text-align:center;padding:6px 8px;border:1px solid #ddd;">${index + 1}</td>
<td style="padding:6px 8px;border:1px solid #ddd;">${item.adviceName || '-'}</td>
<td style="text-align:center;padding:6px 8px;border:1px solid #ddd;">${item.quantity || '-'}</td>
<td style="padding:6px 8px;border:1px solid #ddd;">${item.unitCode_dictText || '-'}</td>
<td style="text-align:right;padding:6px 8px;border:1px solid #ddd;">${item.totalPrice != null ? '¥' + Number(item.totalPrice).toFixed(2) : '-'}</td>
</tr>`;
});
}
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
const fieldKeys = ['targetDepartment', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
let descFieldsHtml = '';
fieldKeys.forEach((key) => {
const label = labelMap[key] || key;
if (descData[key] != null && descData[key] !== '') {
descFieldsHtml += `
<div class="info-row">
<span class="label">${label}</span>
<span class="value">${descData[key]}</span>
</div>`;
}
});
// 构建完整打印HTML
const printContent = `
<div class="print-wrapper">
<!-- 标题 -->
<div class="print-header">
<div class="print-title">检查申请单</div>
<div class="print-meta">打印时间:${new Date().toLocaleString()}</div>
</div>
<!-- 基本信息 -->
<div class="print-section">
<div class="section-title">基本信息</div>
<div class="info-grid">
<div class="info-row"><span class="label">患者姓名:</span><span class="value">${row.patientName || '-'}</span></div>
<div class="info-row"><span class="label">申请单名称:</span><span class="value">${row.name || '-'}</span></div>
<div class="info-row"><span class="label">申请单状态:</span><span class="value">${parseStatus(row.status)}</span></div>
<div class="info-row"><span class="label">创建时间:</span><span class="value">${row.createTime || '-'}</span></div>
<div class="info-row"><span class="label">申请单号:</span><span class="value">${row.prescriptionNo || '-'}</span></div>
<div class="info-row"><span class="label">申请者:</span><span class="value">${row.requesterId_dictText || '-'}</span></div>
<div class="info-row"><span class="label">就诊ID</span><span class="value">${row.encounterId || '-'}</span></div>
<div class="info-row"><span class="label">申请单ID</span><span class="value">${row.requestFormId || '-'}</span></div>
</div>
</div>
${descFieldsHtml ? `
<!-- 申请单描述 -->
<div class="print-section">
<div class="section-title">申请单描述</div>
${descFieldsHtml}
</div>` : ''}
${detailRowsHtml ? `
<!-- 诊疗项目 -->
<div class="print-section">
<div class="section-title">诊疗项目</div>
<table class="detail-table">
<thead>
<tr>
<th style="width:50px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">序号</th>
<th style="padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:left;">医嘱名称</th>
<th style="width:60px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">数量</th>
<th style="width:60px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">单位</th>
<th style="width:80px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:right;">总价</th>
</tr>
</thead>
<tbody>${detailRowsHtml}</tbody>
</table>
</div>` : ''}
<!-- 条码区 -->
<div class="barcode-section">
<div class="barcode-container">
<div class="barcode-number">${row.prescriptionNo || ''}</div>
<div class="barcode-label">申请单号 / 扫码核验</div>
</div>
</div>
<div class="print-footer">
<div class="footer-line">本申请单仅供院内使用,请勿外传</div>
</div>
</div>
`;
// 打开新窗口打印
const printWindow = window.open('', '_blank');
if (!printWindow) {
proxy.$modal?.msgError?.('无法打开打印窗口,请检查浏览器弹窗设置');
return;
}
printWindow.document.write(`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>检查申请单 - 打印</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
font-size: 12px;
color: #333;
padding: 20px;
}
.print-wrapper {
max-width: 210mm;
margin: 0 auto;
}
.print-header {
text-align: center;
padding-bottom: 12px;
margin-bottom: 16px;
border-bottom: 2px solid #333;
}
.print-title {
font-size: 20px;
font-weight: bold;
letter-spacing: 4px;
margin-bottom: 6px;
}
.print-meta {
font-size: 11px;
color: #666;
}
.print-section {
margin-bottom: 16px;
}
.section-title {
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
padding-bottom: 4px;
border-bottom: 1px solid #ddd;
}
.info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 6px 16px;
}
.info-row {
font-size: 12px;
line-height: 1.8;
}
.info-row .label {
font-weight: 600;
color: #555;
}
.info-row .value {
color: #333;
}
.detail-table {
width: 100%;
border-collapse: collapse;
margin-top: 6px;
}
.detail-table th {
font-size: 11px;
font-weight: 600;
color: #555;
}
.detail-table td {
font-size: 12px;
}
.barcode-section {
margin-top: 24px;
padding-top: 16px;
border-top: 1px dashed #ccc;
text-align: center;
}
.barcode-container {
display: inline-block;
padding: 12px 24px;
border: 2px solid #333;
border-radius: 6px;
background: #fff;
}
.barcode-number {
font-family: 'Libre Barcode 128', 'Libre Barcode 39', 'Code128', 'C', monospace;
font-size: 42px;
letter-spacing: 4px;
color: #000;
line-height: 1.2;
}
.barcode-label {
font-size: 10px;
color: #888;
margin-top: 4px;
letter-spacing: 2px;
}
.print-footer {
margin-top: 20px;
text-align: center;
}
.footer-line {
font-size: 10px;
color: #aaa;
}
@media print {
body { padding: 0; }
.print-wrapper { max-width: none; }
.barcode-section { page-break-inside: avoid; }
}
</style>
</head>
<body>
${printContent}
</body>
</html>
`);
printWindow.document.close();
// 等待内容渲染后打印
printWindow.onload = function() {
setTimeout(() => {
printWindow.print();
proxy.$modal?.closeAll?.();
}, 300);
};
} catch (error) {
console.error('打印失败:', error);
proxy.$modal?.msgError?.('打印失败: ' + (error.message || '未知错误'));
}
};
/**
* 查看报告 - 仅已出报告状态可用
* 调用报告查询接口弹窗展示结构化报告或影像预览PACS链接
*/
const handleViewReport = async (row) => {
reportRow.value = row;
reportDialogVisible.value = true;
reportLoading.value = true;
reportData.value = null;
try {
const res = await getTestResult({ prescriptionNo: row.prescriptionNo });
if (res.code === 200) {
if (res.data) {
// 支持两种返回格式:
// 1. res.data 为对象(结构化报告):含 patientName, prescriptionNo, reportTime, diagnosis/content, imageUrl/pacsUrl
// 2. res.data 为字符串报告URL映射到 imageUrl 以支持iframe预览
if (typeof res.data === 'string') {
reportData.value = {
prescriptionNo: row.prescriptionNo,
imageUrl: res.data,
};
} else if (typeof res.data === 'object') {
reportData.value = {
...res.data,
prescriptionNo: res.data.prescriptionNo || row.prescriptionNo,
};
}
} else {
reportData.value = null;
}
} else {
reportData.value = null;
proxy.$modal?.msgWarning?.(res.msg || '暂未生成报告');
}
} catch (e) {
console.error('获取报告失败:', e);
reportData.value = null;
proxy.$modal?.msgError?.('获取报告失败');
} finally {
reportLoading.value = false;
}
};
/**
* 打开PACS影像链接
*/
const openPacsLink = () => {
const url = reportData.value?.pacsUrl || reportData.value?.imageUrl;
if (url) {
window.open(url, '_blank');
}
};
// ========== 修改申请单相关 ==========
const editDialogVisible = ref(false);
const editFormRef = ref(null);
const editingRow = ref(null);
// 修改申请单 - 复用检查申请单弹窗
const handleEdit = (row) => {
editingRow.value = { ...row };
editDialogVisible.value = true;
// 弹窗打开后手动调用getList确保数据加载
nextTick(() => {
editFormRef.value?.getList?.();
editFormRef.value?.getLocationInfo?.();
editFormRef.value?.getDiagnosisList?.();
});
};
// 编辑弹窗确认提交
const handleEditSubmit = () => {
// 调用MedicalExaminations组件的submit方法
if (editFormRef.value?.submit) {
editFormRef.value.submit();
}
};
watch( watch(
() => patientInfo.value?.encounterId, () => patientInfo.value?.encounterId,
(val) => { (val) => {
@@ -937,9 +355,8 @@ watch(
getLocationInfo(); getLocationInfo();
} else { } else {
tableData.value = []; tableData.value = [];
filterForm.value.dateRange = getDefaultDateRange(); filterForm.value.dateRange = [];
filterForm.value.status = ''; filterForm.value.status = '';
filterForm.value.keyword = '';
} }
}, },
{ immediate: true } { immediate: true }
@@ -1053,96 +470,4 @@ defineExpose({
overflow: auto; overflow: auto;
} }
} }
// 报告弹窗样式
.report-viewer {
min-height: 200px;
padding: 8px 0;
}
.report-viewer-container {
.report-content-section {
margin-top: 16px;
padding: 12px;
background: #fafafa;
border-radius: 6px;
border: 1px solid #eee;
.section-title {
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
color: #303133;
display: flex;
align-items: center;
}
.report-content-text {
font-size: 13px;
line-height: 1.8;
color: #606266;
white-space: pre-wrap;
}
}
.report-image-section {
margin-top: 16px;
.section-title {
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
color: #303133;
display: flex;
align-items: center;
}
.report-iframe {
width: 100%;
height: 480px;
border: 1px solid #dcdfe6;
border-radius: 4px;
}
}
}
// 状态标签样式 - 参考临床医嘱
:deep(.el-tag) {
border-radius: 2px;
padding: 0 8px;
height: 24px;
line-height: 22px;
font-size: 12px;
border-width: 1px;
}
:deep(.el-tag--info.is-plain) {
background: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
}
:deep(.el-tag--primary.is-plain) {
background: #ecf5ff;
border-color: #d9ecff;
color: #409eff;
}
:deep(.el-tag--success.is-plain) {
background: #f0f9eb;
border-color: #e1f3d8;
color: #67c23a;
}
:deep(.el-tag--warning.is-plain) {
background: #fdf6ec;
border-color: #faecd8;
color: #e6a23c;
}
:deep(.el-tag--danger.is-plain) {
background: #fef0f0;
border-color: #fde2e2;
color: #f56c6c;
}
</style> </style>

View File

@@ -82,11 +82,7 @@
</template> </template>
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="patientName" label="患者姓名" width="120" /> <el-table-column prop="patientName" label="患者姓名" width="120" />
<el-table-column label="申请单名称" width="140"> <el-table-column prop="name" label="申请单名称" width="140" />
<template #default="scope">
<span>{{ buildApplicationName(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="160" /> <el-table-column prop="createTime" label="创建时间" width="160" />
<el-table-column prop="prescriptionNo" label="申请单号" width="140" /> <el-table-column prop="prescriptionNo" label="申请单号" width="140" />
<el-table-column label="单据状态" width="100" align="center"> <el-table-column label="单据状态" width="100" align="center">
@@ -107,11 +103,11 @@
<el-table-column prop="requesterId_dictText" label="申请者" width="120" /> <el-table-column prop="requesterId_dictText" label="申请者" width="120" />
<el-table-column label="操作" align="center" fixed="right" width="160"> <el-table-column label="操作" align="center" fixed="right" width="160">
<template #default="scope"> <template #default="scope">
<template v-if="scope.row.status == 0"> <template v-if="scope.row.billStatus == 0 || scope.row.status == 0">
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button> <el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button> <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
<template v-else-if="scope.row.status == 1"> <template v-else-if="scope.row.billStatus == 1 || scope.row.status == 1">
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button> <el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
</template> </template>
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button> <el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
@@ -141,7 +137,7 @@
<el-descriptions-item label="创建时间">{{ <el-descriptions-item label="创建时间">{{
currentDetail.createTime || '-' currentDetail.createTime || '-'
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="申请单号">{{ <el-descriptions-item label="处方号">{{
currentDetail.prescriptionNo || '-' currentDetail.prescriptionNo || '-'
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="申请者">{{ <el-descriptions-item label="申请者">{{
@@ -191,7 +187,7 @@ import {computed, getCurrentInstance, ref, watch} from 'vue';
import {Refresh, Search} from '@element-plus/icons-vue'; import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js'; import {patientInfo} from '../../store/patient.js';
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api'; import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
import {getDepartmentList} from '@/api/public.js'; import {getOrgList} from '@/views/doctorstation/components/api.js';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
@@ -289,9 +285,6 @@ const labelMap = {
otherDiagnosis: '其他诊断', otherDiagnosis: '其他诊断',
relatedResult: '相关结果', relatedResult: '相关结果',
attention: '注意事项', attention: '注意事项',
applicationType: '申请类型',
specimenName: '标本类型',
executeTime: '执行时间',
}; };
/** /**
@@ -318,8 +311,8 @@ const parsePriorityCode = (descJson) => {
if (!descJson) return '-'; if (!descJson) return '-';
try { try {
const obj = JSON.parse(descJson); const obj = JSON.parse(descJson);
// applicationType: 0-普通, 1-急 // priorityCode: 0-普通, 1-急
return obj.applicationType === 1 ? '急' : '普通'; return obj.priorityCode === 1 ? '急' : '普通';
} catch (e) { } catch (e) {
console.error('解析 descJson 失败:', e); console.error('解析 descJson 失败:', e);
return '-'; return '-';
@@ -343,24 +336,6 @@ const parseSpecimenType = (descJson) => {
} }
}; };
/**
* 根据申请单详情构建申请单名称
* 单一项目:显示项目名称+数量
* 多个项目:显示首个项目名称+数量+"等X项"
*/
const buildApplicationName = (row) => {
const details = row.requestFormDetailList;
if (!details || details.length === 0) {
return row.name || '-';
}
if (details.length === 1) {
const item = details[0];
return `${item.adviceName}${item.quantity || ''}`;
}
const first = details[0];
return `${first.adviceName}${first.quantity || ''}${details.length}`;
};
const isFieldMatched = (key) => { const isFieldMatched = (key) => {
return key in labelMap; return key in labelMap;
}; };
@@ -416,9 +391,6 @@ const handleViewDetail = async (row) => {
try { try {
const obj = JSON.parse(row.descJson); const obj = JSON.parse(row.descJson);
obj.targetDepartment = recursionFun(obj.targetDepartment); obj.targetDepartment = recursionFun(obj.targetDepartment);
// 转换申请类型编码为可读文本
if (obj.applicationType === 0) obj.applicationType = '普通';
else if (obj.applicationType === 1) obj.applicationType = '急诊';
descJsonData.value = obj; descJsonData.value = obj;
} catch (e) { } catch (e) {
console.error('解析 descJson 失败:', e); console.error('解析 descJson 失败:', e);

View File

@@ -568,11 +568,6 @@ function handleMaindise(value, index) {
* 保存诊断 * 保存诊断
*/ */
function handleSaveDiagnosis() { function handleSaveDiagnosis() {
// 防止重复点击保存
if (isSaving.value) {
return;
}
for (let index = 0; index < (form.value.diagnosisList || []).length; index++) { for (let index = 0; index < (form.value.diagnosisList || []).length; index++) {
const item = form.value.diagnosisList[index]; const item = form.value.diagnosisList[index];
if (!item.diagSrtNo) { if (!item.diagSrtNo) {
@@ -605,7 +600,7 @@ function handleSaveDiagnosis() {
// 步骤2重新分配连续的序号从1开始 // 步骤2重新分配连续的序号从1开始
sortedList.forEach((item, index) => { sortedList.forEach((item, index) => {
item.diagSrtNo = index + 1; // 这里是关键!把诊断排序”改成新顺序 item.diagSrtNo = index + 1; // 这里是关键!把诊断排序”改成新顺序
}); });
// 步骤3提交排序后的数据 // 步骤3提交排序后的数据
@@ -615,12 +610,12 @@ function handleSaveDiagnosis() {
diagnosisChildList: sortedList, diagnosisChildList: sortedList,
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
// 步骤4更新本地数据使用全新对象防止响应式问题
form.value.diagnosisList = sortedList.map(item => ({ ...item }));
emits('diagnosisSave', false); emits('diagnosisSave', false);
proxy.$modal.msgSuccess('诊断已保存'); proxy.$modal.msgSuccess('诊断已保存');
// 保存成功后从服务器重新加载数据,确保前后端数据一致
getList();
// 食源性疾病逻辑 // 食源性疾病逻辑
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => { isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
if (res2.code === 20 && res2.data) { if (res2.code === 20 && res2.data) {

View File

@@ -249,7 +249,7 @@ const submit = () => {
requestFormId: '', // 申请单ID requestFormId: '', // 申请单ID
name: '输血申请单', name: '输血申请单',
descJson: JSON.stringify(form), descJson: JSON.stringify(form),
categoryEnum: '23', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞) categoryEnum: '3', // 1 检验 2 检查 3 输血 4 手术
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);

View File

@@ -6,26 +6,9 @@
<template> <template>
<div class="LaboratoryTests-container"> <div class="LaboratoryTests-container">
<div v-loading="loading" class="transfer-wrapper"> <div v-loading="loading" class="transfer-wrapper">
<!-- 远程搜索框 -->
<div class="search-bar">
<el-input
v-model="searchKey"
placeholder="输入项目代码/名称搜索"
clearable
@keyup.enter="handleSearch"
@clear="handleSearch"
style="width: 300px; margin-bottom: 10px"
>
<template #append>
<el-button @click="handleSearch">搜索</el-button>
</template>
</el-input>
<span v-if="!searchKey" class="total-count"> {{ totalCount }} </span>
<span v-else class="total-count">搜索到 {{ filteredCount }} / {{ totalCount }} </span>
</div>
<el-transfer <el-transfer
v-model="transferValue" v-model="transferValue"
:data="transferData" :data="applicationList"
filter-placeholder="项目代码/名称" filter-placeholder="项目代码/名称"
filterable filterable
:titles="['未选择', '已选择']" :titles="['未选择', '已选择']"
@@ -89,52 +72,13 @@
<el-input v-model="form.attention" autocomplete="off" type="textarea" /> <el-input v-model="form.attention" autocomplete="off" type="textarea" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 申请类型 -->
<el-col :span="12">
<el-form-item label="申请类型" prop="applicationType" style="width: 100%">
<el-radio-group v-model="form.applicationType">
<el-radio :value="0">普通</el-radio>
<el-radio :value="1">急诊</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 标本类型 -->
<el-col :span="12">
<el-form-item label="标本类型" prop="specimenName" style="width: 100%">
<el-select v-model="form.specimenName" placeholder="请选择标本类型" style="width: 100%">
<el-option label="血液" value="血液" />
<el-option label="尿液" value="尿液" />
<el-option label="粪便" value="粪便" />
<el-option label="痰液" value="痰液" />
<el-option label="咽拭子" value="咽拭子" />
<el-option label="脑脊液" value="脑脊液" />
<el-option label="胸腹水" value="胸腹水" />
<el-option label="关节液" value="关节液" />
<el-option label="分泌物" value="分泌物" />
<el-option label="其他" value="其他" />
</el-select>
</el-form-item>
</el-col>
<!-- 执行时间 -->
<el-col :span="12">
<el-form-item label="执行时间" prop="executeTime" style="width: 100%">
<el-date-picker
v-model="form.executeTime"
type="datetime"
placeholder="选择执行时间"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
</div> </div>
</template> </template>
<script setup name="LaboratoryTests"> <script setup name="LaboratoryTests">
import {getCurrentInstance, onMounted, reactive, ref, watch, computed} from 'vue'; import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
import {patientInfo} from '../../../store/patient.js'; import {patientInfo} from '../../../store/patient.js';
import {getApplicationList, saveInspection} from './api'; import {getApplicationList, saveInspection} from './api';
import {getOrgList} from '@/views/doctorstation/components/api.js'; import {getOrgList} from '@/views/doctorstation/components/api.js';
@@ -157,15 +101,27 @@ const findTreeItem = (list, id) => {
const emits = defineEmits(['submitOk']); const emits = defineEmits(['submitOk']);
const props = defineProps({}); const props = defineProps({});
const state = reactive({}); const state = reactive({});
const applicationListAll = ref([]); const applicationListAll = ref();
const applicationList = ref();
const loading = ref(false); const loading = ref(false);
const orgOptions = ref([]); const orgOptions = ref([]); // 科室选项
const searchKey = ref(''); const getList = () => {
const totalCount = ref(0); if (!patientInfo.value?.inHospitalOrgId) {
applicationList.value = [];
// 将已加载的全部数据转为 transfer 组件所需的格式 return;
const buildTransferData = (records) => { }
return records.map((item) => { loading.value = true;
getApplicationList({
pageSize: 9999,
pageNum: 1,
categoryCode: '22',
organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3], //1 药品 2耗材 3诊疗
})
.then((res) => {
if (res.code === 200) {
applicationListAll.value = res.data.records;
applicationList.value = res.data.records.map((item) => {
const priceInfo = item.priceList?.[0] || {}; const priceInfo = item.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00'; const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = item.unitCode_dictText || item.unitCode || ''; const unit = item.unitCode_dictText || item.unitCode || '';
@@ -176,66 +132,16 @@ const buildTransferData = (records) => {
key: item.adviceDefinitionId, key: item.adviceDefinitionId,
}; };
}); });
}; console.log('applicationList========>', JSON.stringify(res.data.records));
} else {
// 加载全部数据(不分页,一次性拉取)
const loadAllData = async () => {
if (!patientInfo.value?.inHospitalOrgId) {
applicationListAll.value = [];
return;
}
loading.value = true;
try {
// 使用大 pageSize 一次性拉取所有启用状态的检验类诊疗项目
const res = await getApplicationList({
pageSize: 9999,
pageNo: 1,
categoryCode: '22',
organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
});
if (res.code !== 200) {
proxy.$message.error(res.message); proxy.$message.error(res.message);
applicationListAll.value = []; applicationList.value = [];
return;
} }
applicationListAll.value = res.data?.records || []; })
totalCount.value = res.data?.total || 0; .finally(() => {
} catch (e) {
proxy.$message.error('获取检验项目列表失败');
applicationListAll.value = [];
} finally {
loading.value = false; loading.value = false;
}
};
// 根据搜索关键词过滤数据
const filterData = (key) => {
if (!key || key.trim() === '') {
return applicationListAll.value;
}
const lowerKey = key.toLowerCase().trim();
return applicationListAll.value.filter((item) => {
return (
item.adviceName?.toLowerCase().includes(lowerKey) ||
item.pyStr?.toLowerCase().includes(lowerKey) ||
item.adviceBusNo?.toLowerCase().includes(lowerKey)
);
}); });
}; };
// transfer 组件实际显示的数据(受搜索词影响)
const transferData = computed(() => buildTransferData(filterData(searchKey.value)));
// 当前显示的条数
const filteredCount = computed(() => filterData(searchKey.value).length);
const getList = async () => {
await loadAllData();
};
const handleSearch = () => {
// 搜索时保持已选中的项目不受影响
};
const transferValue = ref([]); const transferValue = ref([]);
const form = reactive({ const form = reactive({
// categoryType: '', // 项目类别 // categoryType: '', // 项目类别
@@ -246,13 +152,11 @@ const form = reactive({
otherDiagnosis: '', // 其他诊断 otherDiagnosis: '', // 其他诊断
relatedResult: '', // 相关结果 relatedResult: '', // 相关结果
attention: '', // 注意事项 attention: '', // 注意事项
applicationType: 0, // 申请类型 0-普通 1-急诊
specimenName: '血液', // 标本类型
executeTime: null, // 执行时间
primaryDiagnosisList: [], //主诊断目录 primaryDiagnosisList: [], //主诊断目录
otherDiagnosisList: [], //其他断目录 otherDiagnosisList: [], //其他断目录
}); });
const rules = reactive({}); const rules = reactive({});
onBeforeMount(() => {});
onMounted(() => { onMounted(() => {
getList(); getList();
}); });
@@ -265,22 +169,12 @@ const projectWithDepartment = (selectProjectIds, type) => {
let isRelease = true; let isRelease = true;
// 选中项目的数组 // 选中项目的数组
const arr = []; const arr = [];
// 根据选中的项目id查找对应的项目(从全部原始数据中查找) // 根据选中的项目id查找对应的项目
selectProjectIds.forEach((element) => { selectProjectIds.forEach((element) => {
const searchData = applicationListAll.value.find((item) => { const searchData = applicationList.value.find((item) => {
return element == item.adviceDefinitionId; return element == item.adviceDefinitionId;
}); });
if (searchData) { arr.push(searchData);
const priceInfo = searchData.priceList?.[0] || {};
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
const unit = searchData.unitCode_dictText || searchData.unitCode || '';
arr.push({
adviceDefinitionId: searchData.adviceDefinitionId,
orgId: searchData.orgId,
label: searchData.adviceName + ' (¥' + price + '/' + unit + ')',
key: searchData.adviceDefinitionId,
});
}
}); });
// 保存用户手动选择的发往科室(提交时需要保留) // 保存用户手动选择的发往科室(提交时需要保留)
const manualDept = type === 2 ? form.targetDepartment : ''; const manualDept = type === 2 ? form.targetDepartment : '';
@@ -306,16 +200,12 @@ const projectWithDepartment = (selectProjectIds, type) => {
if (type === 2 && manualDept) { if (type === 2 && manualDept) {
form.targetDepartment = manualDept; form.targetDepartment = manualDept;
isRelease = true; isRelease = true;
} else if (type === 2 && !manualDept) { } else {
// 提交时用户未手动选择科室,才提示错误
isRelease = false; isRelease = false;
ElMessage({ ElMessage({
type: 'error', type: 'error',
message: '未找到项目执行的科室', message: '未找到项目执行的科室',
}); });
} else {
// type=1(选择项目变化)时,不弹窗,仅清空科室让用户自行选择
isRelease = false;
} }
} }
if (findItem && isRelease) { if (findItem && isRelease) {
@@ -366,12 +256,12 @@ const submit = () => {
requestFormId: '', // 申请单ID requestFormId: '', // 申请单ID
name: '检验申请单', name: '检验申请单',
descJson: JSON.stringify(form), descJson: JSON.stringify(form),
categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞) categoryEnum: '1', // 1 检验 2 检查 3 输血 4 手术
}; };
saveInspection(params).then((res) => { saveInspection(params).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
transferValue.value = []; applicationList.value = [];
emits('submitOk'); emits('submitOk');
} else { } else {
proxy.$message.error(res.message); proxy.$message.error(res.message);
@@ -428,19 +318,6 @@ defineExpose({ state, submit, getLocationInfo, getDiagnosisList, getList });
.transfer-wrapper { .transfer-wrapper {
position: relative; position: relative;
min-height: 300px; min-height: 300px;
.search-bar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 8px;
.total-count {
font-size: 13px;
color: #909399;
white-space: nowrap;
}
}
} }
.el-transfer { .el-transfer {

View File

@@ -227,7 +227,7 @@
</template> </template>
<script setup name="MedicalExaminations"> <script setup name="MedicalExaminations">
import {getCurrentInstance, onMounted, reactive, ref, watch, computed, nextTick} from 'vue'; import {getCurrentInstance, onMounted, reactive, ref, watch, computed} 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';
@@ -251,26 +251,7 @@ const findTreeItem = (list, id) => {
}; };
const emits = defineEmits(['submitOk']); const emits = defineEmits(['submitOk']);
const props = defineProps({ const props = defineProps({});
isEditMode: {
type: Boolean,
default: false,
},
editData: {
type: Object,
default: () => ({}),
},
// 支持通过props传入patientInfo
externalPatientInfo: {
type: Object,
default: null,
},
});
// 优先使用外部传入的patientInfo否则使用store中的
const effectivePatientInfo = computed(() => {
return props.externalPatientInfo || patientInfo.value;
});
const orgOptions = ref([]); const orgOptions = ref([]);
const state = reactive({}); const state = reactive({});
const applicationListAll = ref(); const applicationListAll = ref();
@@ -291,9 +272,7 @@ const isSevereAllergy = computed(() => {
}); });
const getList = () => { const getList = () => {
console.log('getList called, effectivePatientInfo:', effectivePatientInfo.value); if (!patientInfo.value?.inHospitalOrgId) {
if (!effectivePatientInfo.value?.inHospitalOrgId) {
console.log('inHospitalOrgId is missing, setting empty list');
applicationList.value = []; applicationList.value = [];
return; return;
} }
@@ -302,7 +281,7 @@ const getList = () => {
pageSize: 500, pageSize: 500,
pageNum: 1, pageNum: 1,
categoryCode: '23', categoryCode: '23',
organizationId: effectivePatientInfo.value.inHospitalOrgId, organizationId: patientInfo.value.inHospitalOrgId,
adviceTypes: [3], adviceTypes: [3],
}) })
.then((res) => { .then((res) => {
@@ -319,24 +298,6 @@ const getList = () => {
key: item.adviceDefinitionId, key: item.adviceDefinitionId,
}; };
}); });
// 编辑模式下,加载完数据后设置已选项目
if (props.isEditMode && props.editData?.requestFormDetailList?.length) {
nextTick(() => {
// 使用 adviceName 匹配
const selectedNames = props.editData.requestFormDetailList.map(item => item.adviceName);
console.log('getList completed, selectedNames:', selectedNames);
const selectedIds = [];
applicationList.value?.forEach(app => {
// 匹配时去掉价格部分,只比较名称
const appName = app.label?.split(' (')[0];
if (selectedNames.includes(appName)) {
selectedIds.push(app.key);
}
});
console.log('getList completed, matched selectedIds:', selectedIds);
transferValue.value = selectedIds;
});
}
} else { } else {
proxy.$message.error(res.message); proxy.$message.error(res.message);
applicationList.value = []; applicationList.value = [];
@@ -426,65 +387,12 @@ const handleSyncHistory = async () => {
// 自动带入患者过敏史 // 自动带入患者过敏史
const loadPatientAllergyHistory = () => { const loadPatientAllergyHistory = () => {
if (!effectivePatientInfo.value?.patientId) return; if (!patientInfo.value?.patientId) return;
};
// 加载编辑数据
const loadEditData = () => {
if (!props.isEditMode || !props.editData?.requestFormId) return;
console.log('loadEditData called, editData:', props.editData);
// 解析已有的descJson填充表单
if (props.editData.descJson) {
try {
const obj = JSON.parse(props.editData.descJson);
form.targetDepartment = obj.targetDepartment || '';
form.urgencyLevel = obj.urgencyLevel || 'routine';
form.allergyHistory = obj.allergyHistory || '';
form.examinationPurpose = obj.examinationPurpose || '';
form.medicalHistorySummary = obj.medicalHistorySummary || '';
form.expectedExaminationTime = obj.expectedExaminationTime || '';
form.symptom = obj.symptom || '';
form.sign = obj.sign || '';
form.clinicalDiagnosis = obj.clinicalDiagnosis || '';
form.otherDiagnosis = obj.otherDiagnosis || '';
form.relatedResult = obj.relatedResult || '';
form.attention = obj.attention || '';
form.allergyConfirmed = obj.allergyConfirmed || false;
} catch (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, type) => {
let isRelease = true; let isRelease = true;
const arr = []; const arr = [];
// 确保 applicationList 存在
if (!applicationList.value || !Array.isArray(applicationList.value)) {
return true;
}
selectProjectIds.forEach((element) => { selectProjectIds.forEach((element) => {
const searchData = applicationList.value.find((item) => { const searchData = applicationList.value.find((item) => {
return element == item.adviceDefinitionId; return element == item.adviceDefinitionId;
@@ -521,28 +429,9 @@ const projectWithDepartment = (selectProjectIds, type) => {
}; };
watch(() => transferValue.value, (newValue) => { watch(() => transferValue.value, (newValue) => {
console.log('transferValue changed:', newValue);
console.log('applicationList length:', applicationList.value?.length);
projectWithDepartment(newValue, 1); 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 = () => {
return form.urgencyLevel === 'emergency' ? 1 : 0; return form.urgencyLevel === 'emergency' ? 1 : 0;
}; };
@@ -581,32 +470,25 @@ const submit = () => {
adviceType: item.adviceType, adviceType: item.adviceType,
definitionId: item.priceList[0].definitionId, definitionId: item.priceList[0].definitionId,
definitionDetailId: item.priceList[0].definitionDetailId, definitionDetailId: item.priceList[0].definitionDetailId,
accountId: effectivePatientInfo.value.accountId, accountId: patientInfo.value.accountId,
}; };
}); });
const submitForm = { ...form, priorityCode: getPriorityCode() }; const submitForm = { ...form, priorityCode: getPriorityCode() };
console.log('提交 descJson:', JSON.stringify(submitForm)); console.log('提交 descJson:', JSON.stringify(submitForm));
// 如果是编辑模式带上requestFormId
const requestFormId = props.isEditMode ? props.editData?.requestFormId : '';
saveCheckd({ saveCheckd({
activityList: applicationListAllFilter, activityList: applicationListAllFilter,
patientId: effectivePatientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: effectivePatientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
organizationId: effectivePatientInfo.value.inHospitalOrgId, organizationId: patientInfo.value.inHospitalOrgId,
requestFormId: requestFormId, requestFormId: '',
name: applicationListAllFilter.map(item => item.adviceName).join('、'), name: applicationListAllFilter.map(item => item.adviceName).join('、'),
descJson: JSON.stringify(submitForm), descJson: JSON.stringify(submitForm),
categoryEnum: '22', categoryEnum: '2',
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
if (props.isEditMode) {
proxy.$message.success(res.msg || '修改成功');
} else {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);
}
applicationList.value = []; applicationList.value = [];
resetForm(); resetForm();
emits('submitOk'); emits('submitOk');
@@ -642,7 +524,7 @@ const getLocationInfo = () => {
}; };
function getDiagnosisList() { function getDiagnosisList() {
getEncounterDiagnosis(effectivePatientInfo.value.encounterId).then((res) => { getEncounterDiagnosis(patientInfo.value.encounterId).then((res) => {
if (res.code == 200) { if (res.code == 200) {
const datas = (res.data || []).map((item) => { const datas = (res.data || []).map((item) => {
let obj = { ...item }; let obj = { ...item };
@@ -663,24 +545,9 @@ onMounted(() => {
getList(); getList();
getLocationInfo(); getLocationInfo();
loadPatientAllergyHistory(); loadPatientAllergyHistory();
loadEditData();
}); });
// 监听编辑模式变化,重新加载数据 defineExpose({ state, submit, getLocationInfo, getDiagnosisList, resetForm });
watch(
() => props.isEditMode,
(newVal) => {
if (newVal) {
nextTick(() => {
getList();
getLocationInfo();
loadEditData();
});
}
}
);
defineExpose({ state, submit, getLocationInfo, getDiagnosisList, resetForm, getList });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -5,7 +5,8 @@
--> -->
<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">
<div v-loading="loading" style="min-height: 300px;">
<el-transfer <el-transfer
v-model="transferValue" v-model="transferValue"
:data="applicationList" :data="applicationList"
@@ -14,6 +15,7 @@
:titles="['未选择', '已选择']" :titles="['未选择', '已选择']"
/> />
</div> </div>
</div>
<div class="bloodTransfusion-form"> <div class="bloodTransfusion-form">
<el-form :model="form" :rules="rules" ref="formRef" label-width="120px" class="demo-ruleForm"> <el-form :model="form" :rules="rules" ref="formRef" label-width="120px" class="demo-ruleForm">
<el-row :gutter="20"> <el-row :gutter="20">
@@ -86,9 +88,6 @@ import {getApplicationList, saveSurgery} from './api';
import {ElMessage} from 'element-plus'; import {ElMessage} from 'element-plus';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
let surgeryRecordsCache = null; // 原始 API 记录
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
// 递归查找树形科室节点 // 递归查找树形科室节点
const findTreeItem = (list, id) => { const findTreeItem = (list, id) => {
if (!list || list.length === 0) return null; if (!list || list.length === 0) return null;
@@ -104,8 +103,8 @@ const findTreeItem = (list, id) => {
const emits = defineEmits(['submitOk']); const emits = defineEmits(['submitOk']);
const props = defineProps({}); const props = defineProps({});
const state = reactive({}); const state = reactive({});
const applicationListAll = ref(); const applicationListAll = ref([]);
const applicationList = ref(); const applicationList = ref([]);
const orgOptions = ref([]); // 科室选项 const orgOptions = ref([]); // 科室选项
const loading = ref(false); // 加载状态 const loading = ref(false); // 加载状态
const getList = () => { const getList = () => {
@@ -113,12 +112,6 @@ const getList = () => {
applicationList.value = []; applicationList.value = [];
return; return;
} }
// 命中缓存时直接使用,避免重复请求导致加载缓慢
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
applicationList.value = surgeryMappedCache;
applicationListAll.value = surgeryRecordsCache;
return;
}
loading.value = true; loading.value = true;
getApplicationList({ getApplicationList({
pageSize: 500, pageSize: 500,
@@ -141,9 +134,6 @@ const getList = () => {
key: item.adviceDefinitionId, key: item.adviceDefinitionId,
}; };
}); });
// 写入模块缓存,后续打开弹窗直接复用
surgeryRecordsCache = res.data.records;
surgeryMappedCache = applicationList.value;
} else { } else {
console.warn('获取手术项目列表失败:', res.message); console.warn('获取手术项目列表失败:', res.message);
applicationList.value = []; applicationList.value = [];
@@ -267,7 +257,7 @@ const submit = () => {
requestFormId: '', // 申请单ID requestFormId: '', // 申请单ID
name: '手术申请单', name: '手术申请单',
descJson: JSON.stringify(form), descJson: JSON.stringify(form),
categoryEnum: '24', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞) categoryEnum: '4', // 1 检验 2 检查 3 输血 4 手术
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$message.success(res.msg); proxy.$message.success(res.msg);

View File

@@ -197,7 +197,6 @@
style="width: 62%" style="width: 62%"
v-model="scope.row.adviceName" v-model="scope.row.adviceName"
placeholder="请选择项目" placeholder="请选择项目"
@input="handleChange"
@click="handleFocus(scope.row, scope.$index)" @click="handleFocus(scope.row, scope.$index)"
@keyup.enter.stop="handleFocus(scope.row, scope.$index)" @keyup.enter.stop="handleFocus(scope.row, scope.$index)"
@keydown=" @keydown="
@@ -533,7 +532,6 @@ const statusOption = [
let loadingInstance = undefined; let loadingInstance = undefined;
onMounted(() => { onMounted(() => {
document.addEventListener('keydown', escKeyListener); document.addEventListener('keydown', escKeyListener);
getList();
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
@@ -574,6 +572,7 @@ function handleTotalAmount() {
} }
}, new Decimal(0)); }, new Decimal(0));
} }
getList();
function getList() { function getList() {
getDiagnosisDefinitionList(queryParams.value).then((res) => { getDiagnosisDefinitionList(queryParams.value).then((res) => {
// prescriptionList.value = res.data.records; // prescriptionList.value = res.data.records;
@@ -585,11 +584,6 @@ function refresh() {
} }
// 获取列表信息 // 获取列表信息
function getListInfo(addNewRow) { function getListInfo(addNewRow) {
// 守护:未选择患者时不发起 API 请求,避免页面加载时循环报错
if (!patientInfo.value || !patientInfo.value.encounterId) {
console.warn('⚠️ getListInfo 跳过:未选择患者');
return;
}
loadingInstance = ElLoading.service({ fullscreen: true }); loadingInstance = ElLoading.service({ fullscreen: true });
setTimeout(() => { setTimeout(() => {
loadingInstance.close(); loadingInstance.close();
@@ -715,17 +709,9 @@ function loadConfiguredCategories() {
// 数据过滤 // 数据过滤
const filterPrescriptionList = computed(() => { const filterPrescriptionList = computed(() => {
const pList = prescriptionList.value.filter((item) => { const pList = prescriptionList.value.filter((item) => {
// 修复 Bug #488orderClassCode 可能是复合值 '1-2',需提取 adviceType 部分进行比较
let matchAdviceType = true;
if (orderClassCode.value) {
const filterAdviceType = String(orderClassCode.value).includes('-')
? parseInt(String(orderClassCode.value).split('-')[0])
: orderClassCode.value;
matchAdviceType = filterAdviceType == item.adviceType;
}
return ( return (
(!therapyEnum.value || therapyEnum.value == item.therapyEnum) && (!therapyEnum.value || therapyEnum.value == item.therapyEnum) &&
matchAdviceType && (!orderClassCode.value || orderClassCode.value == item.adviceType) &&
(!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId)) (!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId))
); );
}); });
@@ -753,29 +739,13 @@ function getRowDisabled(row) {
/** /**
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值 * 将行的 adviceType + categoryCode 映射为 el-select 的选中值
* 药品子分类使用复合值如 '1-2'adviceType-categoryCode诊疗/手术/全部使用原始值 * 药品子分类使用复合值如 '1-2'adviceType-categoryCode诊疗/手术/全部使用原始值
* 修复 Bug #488当行的 adviceType 在当前配置中找不到匹配选项时,返回最接近的可用值,避免回显为纯数字
*/ */
function getRowSelectValue(row) { function getRowSelectValue(row) {
if (row.adviceType == 1 && row.categoryCode) { if (row.adviceType == 1 && row.categoryCode) {
const compositeValue = '1-' + row.categoryCode; return '1-' + row.categoryCode;
// 检查复合值是否在选项列表中
if (adviceTypeList.value.some(item => item.value === compositeValue)) {
return compositeValue;
}
// 配置的 categoryCode 已变更,回退到第一个药品选项
const firstPharmacy = adviceTypeList.value.find(item => String(item.value).startsWith('1-'));
if (firstPharmacy) {
return firstPharmacy.value;
} }
return row.adviceType; return row.adviceType;
} }
// 诊疗/手术等非药品类型,检查其值是否在选项列表中
if (adviceTypeList.value.some(item => item.value === row.adviceType)) {
return row.adviceType;
}
// 不在选项中的值(如已废弃的 adviceType返回 undefined 让 el-select 显示为空
return undefined;
}
// 新增医嘱 // 新增医嘱
function handleAddPrescription() { function handleAddPrescription() {
@@ -952,9 +922,7 @@ function handleChange(value) {
// 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined // 修复Bug #486当行没有显式选择医嘱类型时row?.adviceType为undefined
// 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤 // 不传categoryCode让搜索在全药库中进行只有行已选择类型时才用对应categoryCode过滤
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : ''; const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
// 修复Bug #453当adviceType为空字符串或NaN时不传具体类型让refresh函数根据searchKey决定搜索范围 tableRef.refresh(adviceType, categoryCode, value);
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
tableRef.refresh(effectiveAdviceType, categoryCode, value);
} }
} }
} }
@@ -1213,10 +1181,8 @@ function handleSave() {
}); });
// 此处签发处方和单行保存处方传参相同后台已经将传参存为JSON字符串此处直接转换为JSON即可 // 此处签发处方和单行保存处方传参相同后台已经将传参存为JSON字符串此处直接转换为JSON即可
loading.value = true; loading.value = true;
let list = []; let list = saveList.map((item) => {
try { const parsedContent = JSON.parse(item.contentJson);
list = saveList.map((item) => {
const parsedContent = item.contentJson ? JSON.parse(item.contentJson) || {} : {};
return { return {
...parsedContent, ...parsedContent,
adviceType: item.adviceType, adviceType: item.adviceType,
@@ -1225,15 +1191,9 @@ function handleSave() {
groupId: item.groupId, groupId: item.groupId,
uniqueKey: undefined, uniqueKey: undefined,
// 确保 therapyEnum 被正确传递 // 确保 therapyEnum 被正确传递
therapyEnum: parsedContent?.therapyEnum || item.therapyEnum || '1', therapyEnum: parsedContent.therapyEnum || item.therapyEnum || '1',
}; };
}); });
} catch (error) {
loading.value = false;
isSaving.value = false;
proxy.$modal.msgError('医嘱内容解析失败,请检查待签发医嘱');
return;
}
// 保存签发按钮 // 保存签发按钮
isSaving.value = true; isSaving.value = true;
console.log('签发处方参数:', { console.log('签发处方参数:', {
@@ -1248,16 +1208,9 @@ function handleSave() {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('签发成功'); proxy.$modal.msgSuccess('签发成功');
isSaving.value = false; isSaving.value = false;
// 乐观更新:立即将已签发医嘱的状态设为"已签发",确保列表实时刷新
saveList.forEach((item) => {
const row = prescriptionList.value.find((r) => r.requestId && r.requestId === item.requestId);
if (row) {
row.statusEnum = 2;
}
});
getListInfo(false); getListInfo(false);
bindMethod.value = {}; bindMethod.value = {};
nextId.value = 1; nextId.value == 1;
} else { } else {
proxy.$modal.msgError(res.message); proxy.$modal.msgError(res.message);
isSaving.value = false; isSaving.value = false;
@@ -1358,12 +1311,11 @@ function handleCancelEdit(row, index) {
function handleSaveSign(row, index) { function handleSaveSign(row, index) {
if (row.adviceType != 2) { if (row.adviceType != 2) {
// 修复 Bug #488严格校验 itemNo确保非空且为有效字符串才发起请求
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId; let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
if (!itemNo || String(itemNo).trim() === '') { if (!itemNo) {
console.warn('绑定设备检查跳过itemNo为空adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + ''); console.warn('绑定设备检查跳过itemNo为空adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + '');
} else { } else {
getBindDevice({ typeCode: row.adviceType, itemNo: String(itemNo) }).then((res) => { getBindDevice({ typeCode: row.adviceType, itemNo: itemNo }).then((res) => {
if (res.data.length == 0) { if (res.data.length == 0) {
return; return;
} }
@@ -1424,21 +1376,13 @@ function handleSaveSign(row, index) {
savePrescription({ regAdviceSaveList: [row] }).then((res) => { savePrescription({ regAdviceSaveList: [row] }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功'); proxy.$modal.msgSuccess('保存成功');
nextId.value = 1; nextId.value == 1;
} }
}); });
} else { } else {
// 新增行:调用保存接口将数据持久化到后端 if (prescriptionList.value[0].adviceName) {
row.dbOpType = '1'; handleAddPrescription();
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
nextId.value = 1;
// 保存成功后刷新列表,确保后端返回的数据带 requestId
getListInfo(false);
} }
});
// 不需要再添加空行,保存成功后由 getListInfo 处理
} }
adviceQueryParams.value.adviceType = undefined; adviceQueryParams.value.adviceType = undefined;
} }
@@ -1479,26 +1423,18 @@ function handleSaveBatch() {
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功'); proxy.$modal.msgSuccess('保存成功');
// 修复 Bug #405保存成功后锁定所有待保存行,避免医嘱条目仍处于可编辑状态 // 修复#405:保存成功后重置所有待保存行的 isEdit 为 false锁定医嘱不再编辑
// saveList 中的 item 与 prescriptionList 是同一对象引用,直接修改即可
saveList.forEach(item => { saveList.forEach(item => {
item.isEdit = false; const row = prescriptionList.value.find(r => r.uniqueKey === item.uniqueKey);
if (row) row.isEdit = false;
}); });
// 兜底:锁定所有 statusEnum == 1 的行,确保没有遗漏
prescriptionList.value.forEach(row => {
if (row.statusEnum == 1) {
row.isEdit = false;
}
});
expandOrder.value = [];
getListInfo(false); getListInfo(false);
nextId.value = 1; nextId.value == 1;
isSaving.value = false; isSaving.value = false;
} }
}) })
.catch((error) => { .catch((error) => {
isSaving.value = false; isSaving.value = false;
proxy.$modal.msgError(error?.msg || '保存失败,请重试');
}); });
} }
@@ -1626,21 +1562,17 @@ function handleSaveGroup(orderGroupList) {
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail // 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
const mergedDetail = item.mergedDetail || { const mergedDetail = item.mergedDetail || {
...(item.orderDetailInfos || {}), ...(item.orderDetailInfos || {}),
adviceName: item.orderDefinitionName || item.orderDetailInfos?.adviceName || '未知项目', adviceName: item.orderDetailInfos?.adviceName || item.orderDefinitionName || '未知项目',
adviceType: item.orderDetailInfos?.adviceType, adviceType: item.orderDetailInfos?.adviceType,
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId, adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
quantity: item.quantity, quantity: item.quantity,
unitCode: item.unitCode || item.orderDetailInfos?.unitCode, unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
unitCodeName: item.unitCodeName, unitCodeName: item.unitCodeName,
// 🔧 Bug #403 修复dose/doseQuantity/dispensePerDuration 需用 null 检查, dose: item.dose || item.orderDetailInfos?.dose,
// 避免组套中值为 null 时回退到医嘱库的 orderDetailInfos
dose: item.dose !== undefined && item.dose !== null ? item.dose : item.orderDetailInfos?.dose,
rateCode: item.rateCode || item.orderDetailInfos?.rateCode, rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
methodCode: item.methodCode || item.orderDetailInfos?.methodCode, methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
dispensePerDuration: item.dispensePerDuration !== undefined && item.dispensePerDuration !== null dispensePerDuration: item.dispensePerDuration || item.orderDetailInfos?.dispensePerDuration,
? item.dispensePerDuration : item.orderDetailInfos?.dispensePerDuration, doseQuantity: item.doseQuantity,
doseQuantity: item.doseQuantity !== undefined && item.doseQuantity !== null
? item.doseQuantity : item.orderDetailInfos?.doseQuantity,
inventoryList: item.orderDetailInfos?.inventoryList || [], inventoryList: item.orderDetailInfos?.inventoryList || [],
priceList: item.orderDetailInfos?.priceList || [], priceList: item.orderDetailInfos?.priceList || [],
partPercent: item.orderDetailInfos?.partPercent || 1, partPercent: item.orderDetailInfos?.partPercent || 1,
@@ -1659,15 +1591,20 @@ function handleSaveGroup(orderGroupList) {
setValue(mergedDetail); setValue(mergedDetail);
// 创建新的处方项目 // 创建新的处方项目
// 🔧 Bug #403 修复:关键字段使用 null-safe 回退到 mergedDetail已由 setValue 填充完整数据)
// 先取 setValue 填充的行数据作为基础
const baseRow = prescriptionList.value[rowIndex.value];
const newRow = { const newRow = {
...baseRow, ...prescriptionList.value[rowIndex.value],
patientId: patientInfo.value.patientId, patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId, encounterId: patientInfo.value.encounterId,
accountId: accountId.value, accountId: accountId.value,
quantity: item.quantity,
methodCode: item.methodCode,
rateCode: item.rateCode,
dispensePerDuration: item.dispensePerDuration,
dose: item.dose,
doseQuantity: item.doseQuantity,
executeNum: 1, executeNum: 1,
unitCode: item.unitCode,
unitCode_dictText: item.unitCodeName || '',
statusEnum: 1, statusEnum: 1,
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '', orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
// 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示 // 🔧 修复:同时保存 orgName确保树匹配不到时仍有中文名称可显示
@@ -1676,33 +1613,19 @@ function handleSaveGroup(orderGroupList) {
conditionId: conditionId.value, conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value, conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value, encounterDiagnosisId: encounterDiagnosisId.value,
therapyEnum: baseRow?.therapyEnum || '1', therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || '1',
}; };
// 覆盖关键字段:优先使用 item 的值,其次 mergedDetail已由 setValue 填充),最后 baseRow
newRow.quantity = item.quantity ?? mergedDetail.quantity ?? baseRow.quantity;
newRow.methodCode = item.methodCode ?? mergedDetail.methodCode ?? baseRow.methodCode;
newRow.rateCode = item.rateCode ?? mergedDetail.rateCode ?? baseRow.rateCode;
newRow.dispensePerDuration = item.dispensePerDuration ?? mergedDetail.dispensePerDuration ?? baseRow.dispensePerDuration;
newRow.dose = item.dose ?? mergedDetail.dose ?? baseRow.dose;
newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity;
newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode;
newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || '';
// 计算价格和总量 // 计算价格和总量
// 🔧 Bug #403 修复:使用 newRow.unitCode已由 setValue 填充)而非 item.unitCode const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode);
// 使用 ?? 替代 || 计算 partPercent确保值为 0 时不会被错误替换
const finalUnitCode = newRow.unitCode;
const unitInfo = unitCodeList.value.find((k) => k.value == finalUnitCode);
const finalQuantity = newRow.quantity;
const partPercent = item.orderDetailInfos?.partPercent ?? mergedDetail.partPercent ?? baseRow.partPercent ?? 1;
if (unitInfo && unitInfo.type == 'minUnit') { if (unitInfo && unitInfo.type == 'minUnit') {
newRow.price = newRow.minUnitPrice; newRow.price = newRow.minUnitPrice;
newRow.totalPrice = ((finalQuantity || 0) * newRow.minUnitPrice).toFixed(6); newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6);
newRow.minUnitQuantity = finalQuantity || 0; newRow.minUnitQuantity = item.quantity;
} else { } else {
newRow.price = newRow.unitPrice; newRow.price = newRow.unitPrice;
newRow.totalPrice = ((finalQuantity || 0) * newRow.unitPrice).toFixed(6); newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
newRow.minUnitQuantity = (finalQuantity || 0) * partPercent; newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
} }
newRow.contentJson = JSON.stringify(newRow); newRow.contentJson = JSON.stringify(newRow);

View File

@@ -296,7 +296,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-empty v-if="!groupSetLoading && groupSetList.length === 0" description="暂无划价组套数据" :image-size="80" />
<div style="margin-top: 15px; text-align: right"> <div style="margin-top: 15px; text-align: right">
<el-button @click="groupSetDialogVisible = false">取消</el-button> <el-button @click="groupSetDialogVisible = false">取消</el-button>
<el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button> <el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button>
@@ -482,68 +481,19 @@ watch(
(visible) => { (visible) => {
if (visible) { if (visible) {
executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss'); executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss');
// 弹窗打开时重新加载科室和位置选项,确保数据最新
loadDepartmentOptions();
getDiseaseInitLoc(16);
} else { } else {
resetData(); resetData();
} }
} }
); );
// 监听科室选项加载完成,为已添加的诊疗项目设置默认执行科室 // 加载科室选项
watch(
() => departmentOptions.value,
(depts) => {
if (!depts || depts.length === 0) return;
feeItemsList.value.forEach(item => {
if (item.adviceType === 3 && !item.positionId) {
const patientOrgId = props.patientInfo.organizationId;
const matched = depts.find(d => String(d.id) === String(patientOrgId));
item.positionId = matched ? String(matched.id) : String(depts[0].id);
}
});
}
);
// 监听位置选项加载完成,为已添加的耗材项目设置默认位置
watch(
() => locationOptions.value,
(locs) => {
if (!locs || locs.length === 0) return;
feeItemsList.value.forEach(item => {
if (item.adviceType === 2 && !item.positionId) {
item.positionId = String(locs[0].value);
}
});
}
);
// 加载科室选项(支持树形/扁平两种数据结构)
function loadDepartmentOptions() { function loadDepartmentOptions() {
getOrgList() getOrgList()
.then((res) => { .then((res) => {
if (res.data) { if (res.data && res.data.records && res.data.records.length > 0) {
// 尝试从树形结构中取:records[0].children departmentOptions.value = 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;
}
}
// 所有方式都失败,置空
departmentOptions.value = [];
}) })
.catch(() => { .catch(() => {
console.warn('科室列表加载失败(可能无权限)'); console.warn('科室列表加载失败(可能无权限)');
@@ -577,27 +527,23 @@ function getDiseaseInitLoc() {
locationOptions.value = []; locationOptions.value = [];
}); });
} }
// 下拉框模糊搜索过滤自定义filter-method配合element-plus filterable使用 // 下拉框模糊搜索过滤
function filterOptions(val, row, optionsKey) { function filterOptions(val, row, optionsKey) {
const key = row.adviceDefinitionId + '_' + optionsKey; const key = row.adviceDefinitionId + '_' + optionsKey;
if (!val || val.trim() === '') { filterKeywords.value[key] = val;
delete filterKeywords.value[key];
} else {
filterKeywords.value[key] = val.toLowerCase();
}
} }
function getFilteredOptions(row, optionsKey) { function getFilteredOptions(row, optionsKey) {
const key = row.adviceDefinitionId + '_' + optionsKey; const key = row.adviceDefinitionId + '_' + optionsKey;
const keyword = filterKeywords.value[key]; const keyword = filterKeywords.value[key];
const options = optionsKey === 'departmentOptions' ? departmentOptions.value : locationOptions.value; const options = optionsKey === 'departmentOptions' ? departmentOptions.value : locationOptions.value;
if (!keyword) { if (!keyword || keyword.trim() === '') {
return options; return options;
} }
const lower = keyword.toLowerCase();
return options.filter(item => { return options.filter(item => {
const name = (item.name || item.label || '').toLowerCase(); const name = (item.name || item.label || '').toLowerCase();
const id = String(item.id || item.value || '').toLowerCase(); const id = String(item.id || item.value || '').toLowerCase();
const py = (item.pyStr || '').toLowerCase(); return name.includes(lower) || id.includes(lower);
return name.includes(keyword) || id.includes(keyword) || py.includes(keyword);
}); });
} }
// 获取组套类型文本 // 获取组套类型文本
@@ -607,14 +553,12 @@ function getItemType_Text(type) {
} }
function getUnitCodeOptions(row) { function getUnitCodeOptions(row) {
const unitCodes = [ const unitCodes = [
{ code: row.unitCode != null ? String(row.unitCode) : null, codeText: row.unitCode_dictText }, { code: row.unitCode, codeText: row.unitCode_dictText },
{ code: row.minUnitCode != null ? String(row.minUnitCode) : null, codeText: row.minUnitCode_dictText }, { code: row.minUnitCode, codeText: row.minUnitCode_dictText },
]; ];
// 过滤掉 code 为空的单位选项
const validUnitCodes = unitCodes.filter(item => item.code != null && item.code !== '');
// 使用 Set 来跟踪已经存在的 code // 使用 Set 来跟踪已经存在的 code
const seenCodes = new Set(); const seenCodes = new Set();
const uniqueUnitCodes = validUnitCodes.filter((item) => { const uniqueUnitCodes = unitCodes.filter((item) => {
// 如果 Set 中没有这个 code就保留它并把它加入 Set // 如果 Set 中没有这个 code就保留它并把它加入 Set
if (!seenCodes.has(item.code)) { if (!seenCodes.has(item.code)) {
seenCodes.add(item.code); seenCodes.add(item.code);
@@ -631,11 +575,11 @@ function unitCodeChange(row) {
// 获取价格 // 获取价格
const price = row.priceList?.[0]?.price || 0; const price = row.priceList?.[0]?.price || 0;
// 根据选择的单位调整单价(统一用字符串比较) // 根据选择的单位调整单价
if (String(row.selectUnitCode) === String(row.unitCode)) { if (row.selectUnitCode === row.unitCode) {
// 如果选择的是大单位 (如 "") // 如果选择的是大单位 (如 "")
row.unitPrice = price.toFixed(6); // 单价就是原价 row.unitPrice = price.toFixed(6); // 单价就是原价
} else if (String(row.selectUnitCode) === String(row.minUnitCode)) { } else if (row.selectUnitCode === row.minUnitCode) {
// 如果选择的是小单位 (如 "") // 如果选择的是小单位 (如 "")
row.unitPrice = (price / (row.partPercent || 1)).toFixed(6); // 单价 = 原价 / 拆零比 row.unitPrice = (price / (row.partPercent || 1)).toFixed(6); // 单价 = 原价 / 拆零比
} }
@@ -683,36 +627,14 @@ function selectChange(row) {
defaultUnitCode = String(row.minUnitCode); defaultUnitCode = String(row.minUnitCode);
} else if (row.unitCode) { } else if (row.unitCode) {
defaultUnitCode = String(row.unitCode); defaultUnitCode = String(row.unitCode);
} else if (row.minUnitCode_dictText) {
// 兜底:如果 minUnitCode 为空但字典文本存在,使用文本作为选项值
defaultUnitCode = row.minUnitCode_dictText;
} else if (row.unitCode_dictText) {
defaultUnitCode = row.unitCode_dictText;
}
// 如果默认单位不在 uniqueUnitCodes 中,添加兜底选项
if (defaultUnitCode && !uniqueUnitCodes.some(u => u.code === defaultUnitCode)) {
uniqueUnitCodes.push({ code: defaultUnitCode, codeText: defaultUnitCode });
} }
// 设置默认执行科室/位置(统一转为字符串,避免 el-select 类型不匹配) // 设置默认执行科室/位置(统一转为字符串,避免 el-select 类型不匹配)
let defaultPositionId = undefined; let defaultPositionId = undefined;
if (row.adviceType === 3 && departmentOptions.value.length > 0) { if (row.adviceType === 3 && departmentOptions.value.length > 0) {
// 诊疗: // 诊疗:优先使用患者所在科室,否则取第一个科室
// 1. 优先使用诊疗目录项目的"所属科室"row.orgId const patientOrgId = props.patientInfo.organizationId;
// 2. 其次使用患者当前病房科室patientInfo.organizationId const matched = departmentOptions.value.find(d => String(d.id) === String(patientOrgId));
// 3. 最后取第一个科室 defaultPositionId = matched ? String(matched.id) : String(departmentOptions.value[0].id);
const orgIdPriority = [row.orgId, props.patientInfo.organizationId];
for (const id of orgIdPriority) {
if (id) {
const matched = departmentOptions.value.find(d => String(d.id) === String(id));
if (matched) {
defaultPositionId = String(matched.id);
break;
}
}
}
if (!defaultPositionId) {
defaultPositionId = String(departmentOptions.value[0].id);
}
} else if (row.adviceType === 2 && locationOptions.value.length > 0) { } else if (row.adviceType === 2 && locationOptions.value.length > 0) {
// 耗材:默认取第一个药房/耗材房 // 耗材:默认取第一个药房/耗材房
defaultPositionId = String(locationOptions.value[0].value); defaultPositionId = String(locationOptions.value[0].value);
@@ -841,7 +763,6 @@ function resetData() {
// 划价组套相关功能 // 划价组套相关功能
function openGroupSetDialog() { function openGroupSetDialog() {
console.log('openGroupSetDialog called');
groupSetDialogVisible.value = true; groupSetDialogVisible.value = true;
groupSetSearchText.value = ''; groupSetSearchText.value = '';
selectedGroupSet.value = null; selectedGroupSet.value = null;
@@ -850,37 +771,19 @@ function openGroupSetDialog() {
function loadGroupSets() { function loadGroupSets() {
groupSetLoading.value = true; groupSetLoading.value = true;
const params = { organizationId: orgId.value }; getOrderGroup({ organizationId: orgId.value })
// 传递搜索关键字,后端 /group-package-for-order 虽不直接支持 searchKey
// 但保持参数传递以便后续扩展
if (groupSetSearchText.value && groupSetSearchText.value.trim()) {
params.searchKey = groupSetSearchText.value.trim();
}
getOrderGroup(params)
.then((res) => { .then((res) => {
const data = res?.data || {}; const data = res?.data || {};
let rawList = [];
if (groupSetRange.value === 1) { if (groupSetRange.value === 1) {
rawList = data.personalList || []; groupSetList.value = data.personalList || [];
} else if (groupSetRange.value === 2) { } else if (groupSetRange.value === 2) {
rawList = data.organizationList || []; groupSetList.value = data.organizationList || [];
} else { } else {
rawList = data.hospitalList || []; groupSetList.value = data.hospitalList || [];
}
// 客户端过滤:根据搜索关键字过滤组套名称
const keyword = groupSetSearchText.value?.trim()?.toLowerCase();
if (keyword) {
groupSetList.value = rawList.filter(item => {
const name = (item.name || item.Name || '').toLowerCase();
return name.includes(keyword);
});
} else {
groupSetList.value = rawList;
} }
}) })
.catch((err) => { .catch(() => {
console.warn('组套列表加载失败(可能无权限):', err); console.warn('组套列表加载失败(可能无权限)');
ElMessage.warning('组套列表加载失败,当前暂无可用组套');
groupSetList.value = []; groupSetList.value = [];
}) })
.finally(() => { .finally(() => {

View File

@@ -28,7 +28,6 @@ export function getOrgList() {
return request({ return request({
url: '/base-data-manage/organization/organization', url: '/base-data-manage/organization/organization',
method: 'get', method: 'get',
params: { pageSize: 100, pageNum: 1 },
}); });
} }
/** /**

View File

@@ -302,29 +302,6 @@ function getSelectRows() {
}); });
return list; return list;
} }
function getTableRef(index) {
return proxy.$refs['tableRef' + index]?.[0];
}
function selectAllRows() {
prescriptionList.value.forEach((item, index) => {
const tableRef = getTableRef(index);
if (!tableRef) {
return;
}
item.forEach((row) => {
tableRef.toggleRowSelection(row, true);
});
});
}
function clearSelection() {
prescriptionList.value.forEach((item, index) => {
getTableRef(index)?.clearSelection();
});
}
function handleRateChange(value, item, row) { function handleRateChange(value, item, row) {
// 拼接当前选中时间 // 拼接当前选中时间
if (value) { if (value) {
@@ -342,8 +319,6 @@ function handleRateChange(value, item, row) {
defineExpose({ defineExpose({
handleGetPrescription, handleGetPrescription,
handleMedicineSummary, handleMedicineSummary,
selectAllRows,
clearSelection,
}); });
</script> </script>

View File

@@ -66,21 +66,13 @@ const props = defineProps({
type: Number, type: Number,
default: 1, default: 1,
}, },
therapyEnum: {
type: Number,
default: undefined,
},
}); });
handleGetPrescription(); handleGetPrescription();
function handleGetPrescription() { function handleGetPrescription() {
loading.value = true; loading.value = true;
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(','); let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
const params = {}; getMedicineSummary({}).then((res) => {
if (props.therapyEnum !== undefined) {
params.therapyEnum = props.therapyEnum;
}
getMedicineSummary(params).then((res) => {
medicineSummaryFormList.value = res.data.records; medicineSummaryFormList.value = res.data.records;
loading.value = false; loading.value = false;
}); });

View File

@@ -69,11 +69,7 @@
</div> </div>
<div> <div>
<span class="descriptions-item-label">全选</span> <span class="descriptions-item-label">全选</span>
<el-switch <el-switch v-model="chooseAll" @change="handelSwicthChange" />
v-model="chooseAll"
:disabled="isDetails != '1'"
@change="handelSwicthChange"
/>
<el-button class="ml20 mr20" type="primary" @click="handleExecute"> 汇总领药 </el-button> <el-button class="ml20 mr20" type="primary" @click="handleExecute"> 汇总领药 </el-button>
</div> </div>
</div> </div>
@@ -85,7 +81,7 @@
:deadline="deadline" :deadline="deadline"
:therapyEnum="therapyEnum" :therapyEnum="therapyEnum"
/> />
<SummaryMedicineList v-else ref="summaryMedicineRefs" :therapyEnum="therapyEnum" /> <SummaryMedicineList v-else />
<!-- <el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleClick"> <!-- <el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleClick">
<el-tab-pane <el-tab-pane
v-for="tab in prescriptionTabs" v-for="tab in prescriptionTabs"
@@ -129,7 +125,6 @@ const therapyEnum = ref(undefined);
// 存储子组件引用的对象 // 存储子组件引用的对象
const prescriptionRefs = ref(); const prescriptionRefs = ref();
const summaryMedicineRefs = ref();
const navigationButtons = inpatientNurseNavs; const navigationButtons = inpatientNurseNavs;
@@ -165,35 +160,24 @@ function handleClick(tabName) {
} }
function handleGetPrescription() { function handleGetPrescription() {
chooseAll.value = false; prescriptionRefs.value.handleGetPrescription();
if (isDetails.value == '1') {
prescriptionRefs.value?.handleGetPrescription();
} else {
summaryMedicineRefs.value?.handleGetPrescription();
}
} }
function handelSwicthChange(value) { function handelSwicthChange() {
if (!prescriptionRefs.value) { if (chooseAll.value) {
chooseAll.value = false; proxy.$refs['prescriptionRefs'].selectAllRows();
return;
}
if (value) {
prescriptionRefs.value.selectAllRows();
} else { } else {
prescriptionRefs.value.clearSelection(); proxy.$refs['prescriptionRefs'].clearSelection();
} }
} }
function handleRadioChange(value) { function handleRadioChange(value) {
chooseAll.value = false;
if (value == '1') { if (value == '1') {
handleGetPrescription(); handleGetPrescription();
} }
} }
function handleTherapyChange() { function handleTherapyChange() {
chooseAll.value = false;
handleGetPrescription(); handleGetPrescription();
} }

View File

@@ -453,14 +453,8 @@ const loadPatientInfo = () => {
interventionForm.value.startTime = dayjs(res.data.startTime).format( interventionForm.value.startTime = dayjs(res.data.startTime).format(
'YYYY-MM-DD HH:mm:ss' 'YYYY-MM-DD HH:mm:ss'
); );
} else if (res.data.inHosTime) {
interventionForm.value.startTime = dayjs(res.data.inHosTime).format(
'YYYY-MM-DD HH:mm:ss'
);
} else { } else {
// 已有患者entranceType == 1不自动填充当前时间避免覆盖历史数据 interventionForm.value.startTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
// 新入科患者由后端默认返回当前时间,或由用户手动选择
interventionForm.value.startTime = '';
} }
interventionForm.value.height = res.data.height; interventionForm.value.height = res.data.height;
interventionForm.value.weight = res.data.weight; interventionForm.value.weight = res.data.weight;

View File

@@ -459,15 +459,10 @@ function handleGetPrescription(skipAutoSelectAll = false) {
// 执行 // 执行
function handleExecute() { function handleExecute() {
let list = getSelectRows(); let list = getSelectRows();
if (list.length === 0) {
proxy.$modal.msgWarning('请选择需要执行的医嘱');
return;
}
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(','); let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
list = list.map((item) => { list = list.map((item) => {
return { return {
requestId: item.requestId, requestId: item.requestId,
encounterId: item.encounterId,
accountId: item.accountId, accountId: item.accountId,
adviceTable: item.adviceTable, adviceTable: item.adviceTable,
executeTimes: item.executeTimes, executeTimes: item.executeTimes,
@@ -476,35 +471,21 @@ function handleExecute() {
console.log(list, 'list'); console.log(list, 'list');
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => { adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// 仅当选中医嘱中包含诊疗类医嘱(可能绑定耗材)时,才调用耗材批号匹配 // 仅当选中医嘱中包含耗材类医嘱时,才调用耗材批号匹配(排除纯药品医嘱场景)
// adviceTable 取值为 med_medication_request药品或 wor_service_request诊疗/耗材) const hasDevice = list.some((item) =>
const hasServiceRequest = list.some((item) => String(item.adviceTable || '').includes('device'),
String(item.adviceTable || '') === 'wor_service_request',
); );
if (hasServiceRequest) { if (hasDevice) {
// 仅传入选中医嘱对应的 encounterId避免其他患者的耗材记录干扰 lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => {
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
if (selectedEncounterIds.length > 0) {
lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true })
.then((matchRes) => {
if (matchRes && matchRes.code !== 200) {
console.warn('lotNumberMatch returned error:', matchRes.msg);
}
})
.catch((error) => {
console.warn('lotNumberMatch failed after adviceExecute:', error); console.warn('lotNumberMatch failed after adviceExecute:', error);
}); });
} }
}
// 刷新列表(不自动全选,保持用户操作前的选择状态) // 刷新列表(不自动全选,保持用户操作前的选择状态)
handleGetPrescription(true); handleGetPrescription(true);
proxy.$modal.msgSuccess(res.msg || '医嘱执行成功'); proxy.$modal.msgSuccess(res.msg || '医嘱执行成功');
} else { } else {
proxy.$modal.msgError(res.msg || '医嘱执行失败'); proxy.$modal.msgError(res.msg || '医嘱执行失败');
} }
}).catch((error) => {
console.error('医嘱执行接口调用失败:', error);
proxy.$modal.msgError('医嘱执行失败,请稍后重试');
}); });
} }

View File

@@ -61,11 +61,7 @@ const props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
/** 表头所选出库仓库:传入后药品列表只含该仓有库存的行,避免选到别仓批号导致 inventory-item-info 一直为 0 */
orgLocationId: {
type: [String, Number],
default: undefined,
},
}); });
const emit = defineEmits(['selectRow']); const emit = defineEmits(['selectRow']);
const queryParams = ref({ const queryParams = ref({
@@ -93,14 +89,11 @@ watch(
queryParams.value.searchKey = newValue.searchKey; queryParams.value.searchKey = newValue.searchKey;
queryParams.value.itemType = newValue.itemType; queryParams.value.itemType = newValue.itemType;
queryParams.value.purchaseFlag = 0; queryParams.value.purchaseFlag = 0;
if (newValue.orgLocationId != null && newValue.orgLocationId !== '') { // queryParams.value.sourceLocationId = newValue.sourceLocationId;
queryParams.value.orgLocationId = newValue.orgLocationId; // queryParams.value.purposeLocationId = newValue.purposeLocationId;
} else {
delete queryParams.value.orgLocationId;
}
throttledGetList(); throttledGetList();
}, },
{ immediate: true, deep: true } { immdiate: true, deep: true }
); );
getList(); getList();

View File

@@ -133,7 +133,6 @@
filterable filterable
style="width: 200px" style="width: 200px"
:disabled="data.isEdit" :disabled="data.isEdit"
@change="onHeaderWarehouseChange"
> >
<el-option <el-option
v-for="item in purposeTypeListOptions" v-for="item in purposeTypeListOptions"
@@ -223,7 +222,6 @@
@selectRow="(row) => selectRow(row, scope.$index)" @selectRow="(row) => selectRow(row, scope.$index)"
:searchKey="medicineSearchKey" :searchKey="medicineSearchKey"
:itemType="itemType" :itemType="itemType"
:orgLocationId="receiptHeaderForm.headerLocationId"
/> />
</template> </template>
</PopoverList> </PopoverList>
@@ -485,46 +483,6 @@ import {useStore} from '@/store/store';
import useTagsViewStore from '@/store/modules/tagsView'; import useTagsViewStore from '@/store/modules/tagsView';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue' import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'
/** 领用保存 IssueDto后端 Jackson 只认 yyyy-MM-dd HH:mm:ss库存接口可能回传 2025/4/2 00:00:00 等 */
function toIssueDateTimeStr(val) {
if (val == null || val === '') return undefined;
if (typeof val === 'string') {
const s = val.trim();
if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(s)) return s;
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return `${s} 00:00:00`;
}
const d = val instanceof Date ? val : new Date(val);
if (Number.isNaN(d.getTime())) return undefined;
return formatDate(d);
}
/** 总库存 totalQuantity 为最小单位;领用数量按当前计量单位折算成最小单位后再比较 */
function getRequisitionQtyInMinUnit(r) {
const q = Number(r.itemQuantity ?? 0);
if (!Number.isFinite(q) || q < 0) return NaN;
const minCode = r.unitList?.minUnitCode;
if (!minCode || r.unitCode === minCode) return q;
const part = Number(r.partPercent ?? 1);
return q * part;
}
function validateRequisitionQtyVsStock(r, lineNo) {
const cap = Number(r.totalQuantity ?? 0);
const reqMin = getRequisitionQtyInMinUnit(r);
if (!Number.isFinite(reqMin)) {
return `${lineNo}行:领用数量请输入有效数字`;
}
if (cap > 0 && reqMin > cap + 1e-9) {
const name = r.name || `${lineNo}`;
return `${name}:领用数量(折合最小单位)不能超过当前仓库可领库存 ${cap},请修改后再保存。`;
}
if (cap <= 0 && reqMin > 0) {
const name = r.name || `${lineNo}`;
return `${name}:当前仓库可领库存为 0不能填写正数领用数量。`;
}
return null;
}
const tagsViewStore = useTagsViewStore(); const tagsViewStore = useTagsViewStore();
const store = useStore(); const store = useStore();
@@ -610,8 +568,6 @@ const data = reactive({
medicationType: [{ required: true, message: '请选择药品类型', trigger: 'change' }], medicationType: [{ required: true, message: '请选择药品类型', trigger: 'change' }],
locationId: [{ required: true, message: '请选择领用部门', trigger: 'change' }], locationId: [{ required: true, message: '请选择领用部门', trigger: 'change' }],
practitionerId: [{ required: true, message: '请选择部门经手人', trigger: 'change' }], practitionerId: [{ required: true, message: '请选择部门经手人', trigger: 'change' }],
// 领用出库按「表头仓库」查 /app-common/inventory-item-info未选仓库会查不到库存并误报「仓库数量为0」
headerLocationId: [{ required: true, message: '请先选择仓库(按仓库查询可领用库存)', trigger: 'change' }],
}, },
tableRules: { tableRules: {
name: [{ required: true, message: '项目不能为空', trigger: 'change' }], name: [{ required: true, message: '项目不能为空', trigger: 'change' }],
@@ -1032,9 +988,10 @@ function selectRow(rowValue, index) {
form.purchaseinventoryList[index].unitList = rowValue.unitList[0]; form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber; form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber;
form.purchaseinventoryList[index].ybNo = rowValue.ybNo; form.purchaseinventoryList[index].ybNo = rowValue.ybNo;
// 出库仓库:优先表头当前所选仓库(避免先选药后选仓时行上一直为空) // #439 fix: 不清空sourceLocationId保留handleAddRow设置的仓库ID
form.purchaseinventoryList[index].sourceLocationId = if (!form.purchaseinventoryList[index].sourceLocationId) {
receiptHeaderForm.headerLocationId || form.purchaseinventoryList[index].sourceLocationId || ''; form.purchaseinventoryList[index].sourceLocationId = receiptHeaderForm.headerLocationId || '';
}
getPharmacyCabinetList().then((res) => { getPharmacyCabinetList().then((res) => {
purposeTypeListOptions.value = res.data; purposeTypeListOptions.value = res.data;
handleLocationClick(1, rowValue, index) handleLocationClick(1, rowValue, index)
@@ -1047,132 +1004,78 @@ function selectRow(rowValue, index) {
}); });
} }
/** 多条库存记录时取可领数量最大的一条(避免仅取 res.data[0] 恰好为 0 */ // 选择仓库
function pickBestOrgQuantityRow(list) {
if (!Array.isArray(list) || list.length === 0) return null;
return list.reduce((best, cur) => {
const cq = Number(cur?.orgQuantity ?? 0);
const bq = Number(best?.orgQuantity ?? 0);
return cq > bq ? cur : best;
});
}
/** 表头「仓库」变化:同步每行 sourceLocationId 并重新拉库存(修复先选药品后选仓库行上仍无仓库 ID */
function onHeaderWarehouseChange() {
const hid = receiptHeaderForm.headerLocationId;
form.purchaseinventoryList.forEach((r) => {
r.sourceLocationId = hid || '';
});
form.purchaseinventoryList.forEach((r, idx) => {
if (hid && r.itemId) {
handleLocationClick(1, {}, idx);
}
});
}
// 选择仓库 / 选药品后拉取该仓库存
function handleLocationClick(item, row, index) { function handleLocationClick(item, row, index) {
getCount({ getCount({
itemId: form.purchaseinventoryList[index].itemId, itemId: form.purchaseinventoryList[index].itemId,
orgLocationId: form.purchaseinventoryList[index].sourceLocationId, orgLocationId: form.purchaseinventoryList[index].sourceLocationId,
// objLocationId:purposeLocationId,
lotNumber: form.purchaseinventoryList[index].lotNumber,
}).then((res) => { }).then((res) => {
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || ''; form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || '';
form.purchaseinventoryList[index].totalQuantity = res.data[0].orgQuantity || 0; form.purchaseinventoryList[index].totalQuantity = res.data[0].orgQuantity || 0;
const r = form.purchaseinventoryList[index];
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || ''; if (res.data[0].price) {
if (!orgLocationId) { form.purchaseinventoryList[index].price = res.data[0].price.toFixed(4);
proxy.$message.warning('请先在表头选择「仓库」。库存按仓库维度查询,未选仓库无法匹配您看到的总库存。'); } else {
r.totalQuantity = 0; form.purchaseinventoryList[index].price = 0;
r.price = 0; }
// 获取供应商id
form.purchaseinventoryList[index].supplierId = res.data[0].supplierId || '';
// 生产日期
form.purchaseinventoryList[index].startTime = res.data[0].productionDate;
// 有效期
form.purchaseinventoryList[index].endTime = res.data[0].expirationDate;
form.purchaseinventoryList[index].unitCode =
form.purchaseinventoryList[index].unitList.minUnitCode;
form.purchaseinventoryList[index].unitCode_dictText =
form.purchaseinventoryList[index].unitList.minUnitCode_dictText;
// 单价 大单位单价
console.log(
form.purchaseinventoryList[index].unitCode ==
form.purchaseinventoryList[index].unitList.minUnitCode,
1212121
);
if (
form.purchaseinventoryList[index].unitCode ==
form.purchaseinventoryList[index].unitList.minUnitCode
) {
form.purchaseinventoryList[index].price =
res.data[0].price / form.purchaseinventoryList[index].partPercent || '';
form.purchaseinventoryList[index].price =
form.purchaseinventoryList[index].price.toFixed(4);
// parseFloat(form.purchaseinventoryList[index].price.toFixed(4))
} else {
console.log(
form.purchaseinventoryList[index].price > 1,
1212,
form.purchaseinventoryList[index].price
);
if (form.purchaseinventoryList[index].price > 1) {
form.purchaseinventoryList[index].price =
form.purchaseinventoryList[index].price.toFixed(4);
}
}
if (form.purchaseinventoryList[index].totalQuantity == 0) {
proxy.$message.warning('仓库数量为0无法调用');
return; return;
} }
if (!r.sourceLocationId) {
r.sourceLocationId = orgLocationId;
}
const lotTrimmed =
r.lotNumber != null && String(r.lotNumber).trim() !== '' ? String(r.lotNumber).trim() : null;
const runGet = (withLot) => {
const params = { itemId: r.itemId, orgLocationId };
if (withLot && lotTrimmed) {
params.lotNumber = lotTrimmed;
}
return getCount(params);
};
const applyFromDto = (d, syncLotFromPick) => {
if (syncLotFromPick && d.lotNumber != null && d.lotNumber !== '') {
r.lotNumber = d.lotNumber;
}
r.itemTable = d.itemTable || '';
r.totalQuantity = d.orgQuantity || 0;
if (d.price) {
r.price = d.price.toFixed(4);
} else { } else {
r.price = 0; form.purchaseinventoryList[index].totalQuantity = 0;
form.purchaseinventoryList[index].price = 0;
// if(form.purchaseinventoryList[index].totalQuantity==0){
proxy.$message.warning('仓库数量为0无法调用');
// }
} }
r.supplierId = d.supplierId || ''; }).catch(() => {
r.startTime = toIssueDateTimeStr(d.productionDate) || ''; form.purchaseinventoryList[index].totalQuantity = 0;
r.endTime = toIssueDateTimeStr(d.expirationDate) || ''; form.purchaseinventoryList[index].price = 0;
r.unitCode = r.unitList.minUnitCode; });
r.unitCode_dictText = r.unitList.minUnitCode_dictText;
if (r.unitCode == r.unitList.minUnitCode) {
r.price = d.price / r.partPercent || '';
r.price = r.price.toFixed(4);
} else if (r.price > 1) {
r.price = r.price.toFixed(4);
}
};
const persistStore = () => {
store.setCurrentDataLYCK({ store.setCurrentDataLYCK({
purchaseinventoryList: form.purchaseinventoryList, purchaseinventoryList: form.purchaseinventoryList,
receiptHeaderForm: receiptHeaderForm, receiptHeaderForm: receiptHeaderForm,
}); });
};
runGet(true)
.then((res) => {
const list = res.data || [];
const d = pickBestOrgQuantityRow(list);
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
if (strictOk) {
applyFromDto(d, false);
if (Number(r.totalQuantity) <= 0) {
proxy.$message.warning('仓库数量为0无法调用');
}
persistStore();
return;
}
if (lotTrimmed) {
return runGet(false).then((res2) => {
const list2 = res2.data || [];
const d2 = pickBestOrgQuantityRow(list2);
if (d2 && Number(d2.orgQuantity ?? 0) > 0) {
applyFromDto(d2, true);
proxy.$message.info(
'所选批号在本仓库无对应库存或批号不一致,已按仓库实物回显批号与可领数量,请核对。'
);
} else {
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');
}
persistStore();
});
}
r.totalQuantity = 0;
r.price = 0;
proxy.$message.warning('仓库数量为0无法调用');
persistStore();
})
.catch(() => {
r.totalQuantity = 0;
r.price = 0;
persistStore();
});
} }
// 切换仓库类型获取药房/药库列表 // 切换仓库类型获取药房/药库列表
// function handleChangeLocationType(value) { // function handleChangeLocationType(value) {
@@ -1329,19 +1232,20 @@ function getMaxCounts(row, index, counts) {
} }
// 计算总价 // 计算总价
function handleTotalPrice(index) { function handleTotalPrice(index) {
const r = form.purchaseinventoryList[index]; form.purchaseinventoryList[index].olditemQuantity =
r.olditemQuantity = r.itemQuantity * (r.partPercent ?? 1); form.purchaseinventoryList[index].itemQuantity * row.partPercent;
r.itemMaxQuantity = r.itemQuantity; form.purchaseinventoryList[index].itemMaxQuantity =
let purchaseItem = r; form.purchaseinventoryList[index].itemQuantity;
let purchaseItem = form.purchaseinventoryList[index];
if (purchaseItem.price > 0 && purchaseItem.itemQuantity > 0) { if (purchaseItem.price > 0 && purchaseItem.itemQuantity > 0) {
r.totalPrice = purchaseItem.price * purchaseItem.itemQuantity; form.purchaseinventoryList[index].totalPrice = purchaseItem.price * purchaseItem.itemQuantity;
r.totalPrice = r.totalPrice.toFixed(4); form.purchaseinventoryList[index].totalPrice =
form.purchaseinventoryList[index].totalPrice.toFixed(4);
// parseFloat(form.purchaseinventoryList[index].totalPrice.toFixed(4))
} }
if (r.itemQuantity == 0) { if (form.purchaseinventoryList[index].itemQuantity == 0) {
r.totalPrice = 0; form.purchaseinventoryList[index].totalPrice = 0;
} }
const qtyErr = validateRequisitionQtyVsStock(r, index + 1);
r.error = !!qtyErr;
store.setCurrentDataLYCK({ store.setCurrentDataLYCK({
purchaseinventoryList: form.purchaseinventoryList, purchaseinventoryList: form.purchaseinventoryList,
receiptHeaderForm: receiptHeaderForm, receiptHeaderForm: receiptHeaderForm,
@@ -1350,15 +1254,6 @@ function handleTotalPrice(index) {
// 保存 // 保存
function handleSave(row, index) { function handleSave(row, index) {
rowList.value = []; rowList.value = [];
for (let i = 0; i < form.purchaseinventoryList.length; i++) {
const line = form.purchaseinventoryList[i];
if (!line) continue;
const err = validateRequisitionQtyVsStock(line, i + 1);
if (err) {
proxy.$message.warning(err);
return;
}
}
form.purchaseinventoryList.map((row, index) => { form.purchaseinventoryList.map((row, index) => {
if (row) { if (row) {
// 触发校验 // 触发校验
@@ -1406,13 +1301,7 @@ function handleSave(row, index) {
}); });
} }
function addTransferProducts(rowList) { function addTransferProducts(rowList) {
const payload = (Array.isArray(rowList) ? rowList : []).map((item) => ({ addTransferProduct(JSON.parse(JSON.stringify(rowList))).then((res) => {
...item,
startTime: toIssueDateTimeStr(item.startTime),
endTime: toIssueDateTimeStr(item.endTime),
occurrenceTime: toIssueDateTimeStr(item.occurrenceTime) ?? item.occurrenceTime,
}));
addTransferProduct(JSON.parse(JSON.stringify(payload))).then((res) => {
// 当前行没有id视为首次新增 // 当前行没有id视为首次新增
// if (!row.id) { // if (!row.id) {
// data.isAdding = false; // 允许新增下一行 // data.isAdding = false; // 允许新增下一行

View File

@@ -76,7 +76,7 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="surgeryList" row-key="id" :row-class-name="getRowClassName" highlight-current-row @current-change="handleCurrentChange"> <el-table v-loading="loading" :data="surgeryList" row-key="id" :row-class-name="getRowClassName">
<!-- 申请日期datetime - 2025-09-19 14:15:00 - 不可操作 --> <!-- 申请日期datetime - 2025-09-19 14:15:00 - 不可操作 -->
<el-table-column label="申请日期" align="center" prop="createTime" width="160"> <el-table-column label="申请日期" align="center" prop="createTime" width="160">
<template #default="scope"> <template #default="scope">
@@ -1405,12 +1405,6 @@ function getRowClassName({ row }) {
return '' return ''
} }
// 当前选中行(高亮)
const currentRow = ref(null)
function handleCurrentChange(row) {
currentRow.value = row
}
// 时间格式化函数 // 时间格式化函数
function parseTime(time, pattern) { function parseTime(time, pattern) {
if (!time) return '' if (!time) return ''

View File

@@ -803,7 +803,7 @@
</el-dialog> </el-dialog>
<!-- 手术计费弹窗 --> <!-- 手术计费弹窗 -->
<el-dialog :title="chargeDialogTitle" v-model="showChargeDialog" width="1400px" @close="closeChargeDialog" append-to-body destroy-on-close> <el-dialog :title="chargeDialogTitle" v-model="showChargeDialog" width="1400px" @close="closeChargeDialog" append-to-body>
<div style="display: flex; justify-content: space-between; height: 80vh"> <div style="display: flex; justify-content: space-between; height: 80vh">
<div style="width: 100%; border: 1px solid #eee; position: relative"> <div style="width: 100%; border: 1px solid #eee; position: relative">
<div style="padding: 10px; border: 1px solid #eee; height: 50px; border-left: 0"> <div style="padding: 10px; border: 1px solid #eee; height: 50px; border-left: 0">
@@ -829,9 +829,7 @@
</el-descriptions> </el-descriptions>
</div> </div>
<div style="padding: 10px"> <div style="padding: 10px">
<prescriptionlist :patientInfo="chargePatientInfo" ref="prescriptionRef" <prescriptionlist v-if="showChargeDialog" :patientInfo="chargePatientInfo" ref="prescriptionRef" />
:generateSourceEnum="1"
:sourceBillNo="chargePatientInfo.sourceBillNo" />
<div class="overlay" v-if="disabled"></div> <div class="overlay" v-if="disabled"></div>
</div> </div>
</div> </div>
@@ -874,59 +872,16 @@ import { Loading } from '@element-plus/icons-vue' // 🔧 新增:导入 Loadin
import { getPrescriptionList } from '@/views/clinicmanagement/bargain/component/api' import { getPrescriptionList } from '@/views/clinicmanagement/bargain/component/api'
// API 导入 // API 导入
import { import { getSurgerySchedulePage, addSurgerySchedule, updateSurgerySchedule, deleteSurgerySchedule, getSurgeryScheduleDetail } from '@/api/surgicalschedule'
getSurgerySchedulePage, import { listUser } from '@/api/system/user'
addSurgerySchedule, import { deptTreeSelect } from '@/api/system/user'
updateSurgerySchedule, import { listOperatingRoom } from '@/api/operatingroom'
deleteSurgerySchedule, import { getSurgery} from '@/views/inpatientDoctor/home/components/applicationShow/api.js'
getSurgeryScheduleDetail import { getTenantPage } from '@/api/system/tenant'
} from '@/api/surgicalschedule'
import { getSurgeryPage} from '@/views/inpatientDoctor/home/components/applicationShow/api.js'
import { getContract } from '@/views/inpatientDoctor/home/components/api.js' import { getContract } from '@/views/inpatientDoctor/home/components/api.js'
import request from '@/utils/request'
import SurgeryCharge from '../charge/surgerycharge/index.vue' import SurgeryCharge from '../charge/surgerycharge/index.vue'
import TemporaryMedical from './temporaryMedical.vue' import TemporaryMedical from './temporaryMedical.vue'
// 静默获取字典列表(跳过拦截器错误提示,手术室护士等角色可能无此权限)
function getTenantPageSilent(query) {
return request({
url: '/system/tenant/page',
method: 'get',
params: query,
skipErrorMsg: true
})
}
// 静默获取科室树(跳过拦截器错误提示)
function deptTreeSelectSilent(params = {}) {
return request({
url: '/base-data-manage/organization/organization',
method: 'get',
params: { typeEnum: 2, ...params },
skipErrorMsg: true
})
}
// 静默获取用户列表(跳过拦截器错误提示)
function listUserSilent(query) {
return request({
url: '/base-data-manage/practitioner/user-practitioner-page',
method: 'get',
params: query,
skipErrorMsg: true
})
}
// 静默获取手术室列表(跳过拦截器错误提示)
function listOperatingRoomSilent(query) {
return request({
url: '/base-data-manage/operating-room/list',
method: 'get',
params: query,
skipErrorMsg: true
})
}
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
const loading = ref(true) const loading = ref(true)
@@ -966,7 +921,7 @@ const form = reactive({
allergyRemark: undefined, allergyRemark: undefined,
surgeryNature: undefined, surgeryNature: undefined,
surgerySite: undefined, surgerySite: undefined,
incisionType: undefined, incisionLevel: undefined,
surgeryLevel: undefined, surgeryLevel: undefined,
admissionTime: undefined, admissionTime: undefined,
@@ -1155,7 +1110,7 @@ onMounted(() => {
// 加载卫生机构列表 // 加载卫生机构列表
function loadOrgList() { function loadOrgList() {
getTenantPageSilent({ pageNo: 1, pageSize: 1000 }) getTenantPage({ pageNo: 1, pageSize: 1000 })
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 200) {
const records = res.data?.records || res.data || [] const records = res.data?.records || res.data || []
@@ -1175,7 +1130,7 @@ function loadOrgList() {
// 加载科室列表 // 加载科室列表
function loadDeptList() { function loadDeptList() {
deptTreeSelectSilent() deptTreeSelect()
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 200) {
const tree = res.data?.records || res.data || [] const tree = res.data?.records || res.data || []
@@ -1195,7 +1150,7 @@ function loadDeptList() {
// 加载医生列表 // 加载医生列表
function loadDoctorList() { function loadDoctorList() {
listUserSilent({ pageNo: 1, pageSize: 1000 }) listUser({ pageNo: 1, pageSize: 1000 })
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 200) {
const records = res.data?.records || [] const records = res.data?.records || []
@@ -1215,7 +1170,7 @@ function loadDoctorList() {
// 加载护士列表 // 加载护士列表
function loadNurseList() { function loadNurseList() {
listUserSilent({ pageNo: 1, pageSize: 1000 }) listUser({ pageNo: 1, pageSize: 1000 })
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 200) {
const records = res.data?.records || [] const records = res.data?.records || []
@@ -1235,7 +1190,7 @@ function loadNurseList() {
// 加载手术室列表 // 加载手术室列表
function loadOperatingRoomList() { function loadOperatingRoomList() {
listOperatingRoomSilent({ pageNo: 1, pageSize: 1000, statusEnum: 1 }) listOperatingRoom({ pageNo: 1, pageSize: 1000, statusEnum: 1 })
.then(res => { .then(res => {
if (res.code === 200) { if (res.code === 200) {
const records = res.data?.records || [] const records = res.data?.records || []
@@ -1433,8 +1388,8 @@ async function handleChargeCharge(row) {
orgId: userStore.organizationId || userStore.orgId || userStore.tenantId || 1, orgId: userStore.organizationId || userStore.orgId || userStore.tenantId || 1,
// 添加账户ID // 添加账户ID
accountId: accountId, accountId: accountId,
// 添加手术单号用于关联对应的手术医嘱 // 添加手术申请单号用于追溯
sourceBillNo: row.operCode, sourceBillNo: row.applyId,
//添加计费标志手术计费 //添加计费标志手术计费
generateSourceEnum: 6 generateSourceEnum: 6
} }
@@ -1456,18 +1411,17 @@ async function handleChargeCharge(row) {
} }
// 关闭计费弹窗 // 关闭计费弹窗
async function closeChargeDialog() { function closeChargeDialog() {
// 先关闭 prescriptionlist 内所有已打开的项目字典 popover // 先关闭 prescriptionlist 内所有已打开的项目字典 popover
if (prescriptionRef.value && prescriptionRef.value.closeAllPopovers) { if (prescriptionRef.value && prescriptionRef.value.closeAllPopovers) {
prescriptionRef.value.closeAllPopovers() prescriptionRef.value.closeAllPopovers()
} }
// 等 Vue 完成 popover 可见性更新的 DOM 操作, // 等 Vue 完成 DOM 更新后再关闭弹窗,确保 popover 先消失
// 因为 el-popover 通过 teleport 渲染在 body 上,需要在 dialog 卸载前完成清理 nextTick(() => {
await nextTick()
// 清空数据,避免下次打开时使用缓存
showChargeDialog.value = false showChargeDialog.value = false
chargePatientInfo.value = {} chargePatientInfo.value = {}
chargeSurgeryInfo.value = {} chargeSurgeryInfo.value = {}
})
} }
// 🔧 新增:标志位,用于区分是"打开"还是"刷新" // 🔧 新增:标志位,用于区分是"打开"还是"刷新"
@@ -1496,8 +1450,7 @@ function handleMedicalAdvice(row) {
role: userStore.roles[0], role: userStore.roles[0],
effectiveOrgId : row.effectiveOrgId, effectiveOrgId : row.effectiveOrgId,
orgId: userStore.orgId, orgId: userStore.orgId,
positionId: userStore.orgId, positionId: userStore.orgId
applyId: row.applyId // 手术申请单ID用于过滤关联医嘱
} }
// 🔧 关键修复:如果已有提交的医嘱数据,并且是同一个患者的就诊,则使用保存的数据 // 🔧 关键修复:如果已有提交的医嘱数据,并且是同一个患者的就诊,则使用保存的数据
@@ -1528,11 +1481,7 @@ function handleMedicalAdvice(row) {
// 先清空旧数据 // 先清空旧数据
temporaryBillingMedicines.value = [] temporaryBillingMedicines.value = []
temporaryAdvices.value = [] temporaryAdvices.value = []
// 🔧 修复 Bug #446: 如果是同一 encounter 且已有提交的医嘱(有 requestId保留签名状态 temporarySigned.value = false // 🔧 重置签名状态
const hasSubmittedAdvices = temporaryAdvices.value.length > 0 &&
temporaryAdvices.value[0]?.originalMedicine?.encounterId === row.visitId &&
temporaryAdvices.value.some(a => a.originalMedicine?.requestId);
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
temporaryMedicalLoading.value = true // 🔧 新增:开始加载 temporaryMedicalLoading.value = true // 🔧 新增:开始加载
// 调用计费接口获取数据 // 调用计费接口获取数据
@@ -1547,13 +1496,9 @@ function handleMedicalAdvice(row) {
const filteredItems = res.data.filter(item => { const filteredItems = res.data.filter(item => {
// 匹配 encounterId // 匹配 encounterId
if (item.encounterId !== row.visitId) return false; if (item.encounterId !== row.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3)
if (item.adviceType !== 1) return false;
// 过滤掉名称为空的项目 // 过滤掉名称为空的项目
const medicineName = item.adviceName || item.advice_name; const medicineName = item.adviceName || item.advice_name;
if (!medicineName || medicineName.trim() === '') return false; if (!medicineName || medicineName.trim() === '') return false;
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId 的不应出现在"待生成"列表)
if (item.requestId) return false;
// 根据药品请求ID去重避免重复显示 // 根据药品请求ID去重避免重复显示
const itemId = item.requestId || item.id; const itemId = item.requestId || item.id;
if (itemId && seenIds.has(itemId)) return false; if (itemId && seenIds.has(itemId)) return false;
@@ -1741,27 +1686,15 @@ function handleTemporaryMedicalSubmit(data) {
} }
}) })
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId // 同步更新计费药品列表:移除已生成医嘱的项目,避免数据重复显示
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量) const submittedIds = new Set(
const submittedKeys = new Set( (data.temporaryAdvices || []).map(a => a.originalMedicine?.requestId || a.originalMedicine?.chargeItemId).filter(Boolean)
(data.temporaryAdvices || []) )
.map(a => { if (submittedIds.size > 0) {
const om = a.originalMedicine || {} temporaryBillingMedicines.value = (data.billingMedicines || []).filter(
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || '' m => !submittedIds.has(m.requestId || m.chargeItemId)
const spec = om.specification || om.volume || ''
const qty = om.quantity || 0
return `${name}|||${spec}|||${qty}`
})
.filter(k => k !== '|||0') // 过滤掉空项
) )
if (submittedKeys.size > 0) {
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
return !submittedKeys.has(key)
})
} else { } else {
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
temporaryBillingMedicines.value = [] temporaryBillingMedicines.value = []
} }
@@ -1815,25 +1748,19 @@ function handleQuoteBilling() {
// 重新拉取计费药品数据 // 重新拉取计费药品数据
if (temporaryPatientInfo.value.visitId) { if (temporaryPatientInfo.value.visitId) {
temporaryMedicalLoading.value = true // 🔧 新增:开始加载 temporaryMedicalLoading.value = true // 🔧 新增:开始加载
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => { getPrescriptionList(temporaryPatientInfo.value.visitId).then((res) => {
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
// 🔧 修复:先清空旧数据,避免数据累积 // 🔧 修复:先清空旧数据,避免数据累积
temporaryBillingMedicines.value = [] temporaryBillingMedicines.value = []
temporaryAdvices.value = [] temporaryAdvices.value = []
// 🔧 修复 Bug #445: 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3) // 🔧 修复:显示所有药品请求数据,不管有没有计费项目
// 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中)
const filteredItems = res.data.filter(item => { const filteredItems = res.data.filter(item => {
// 匹配 encounterId // 匹配 encounterId
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false; if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3)
if (item.adviceType !== 1) return false;
// 过滤掉名称为空的项目 // 过滤掉名称为空的项目
const medicineName = item.adviceName || item.advice_name; const medicineName = item.adviceName || item.advice_name;
if (!medicineName || medicineName.trim() === '') return false; return medicineName && medicineName.trim() !== '';
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId
if (item.requestId) return false;
return true;
}) })
// 🔧 修复限制返回数量最多显示前100条避免数据过多导致页面卡死 // 🔧 修复限制返回数量最多显示前100条避免数据过多导致页面卡死
const maxItems = 100 const maxItems = 100
@@ -2050,12 +1977,7 @@ function resetForm() {
function submitForm() { function submitForm() {
proxy.$refs['surgeryRef'].validate((valid) => { proxy.$refs['surgeryRef'].validate((valid) => {
if (valid) { if (valid) {
const submitData = { const submitData = { ...form, orgId: userStore.orgId }
...form,
orgId: userStore.orgId,
incisionLevel: form.incisionType
}
delete submitData.incisionType
if (!form.scheduleId) { if (!form.scheduleId) {
// 新增手术安排 // 新增手术安排
addSurgerySchedule(submitData).then((res) => { addSurgerySchedule(submitData).then((res) => {
@@ -2101,7 +2023,7 @@ function handleFindApply() {
getSurgicalScheduleList() getSurgicalScheduleList()
} }
// 获取手术申请列表(用于查找”弹窗) // 获取手术申请列表(用于查找”弹窗)
function getSurgicalScheduleList() { function getSurgicalScheduleList() {
applyLoading.value = true applyLoading.value = true
const params = { ...applyQueryParams } const params = { ...applyQueryParams }
@@ -2110,7 +2032,8 @@ function getSurgicalScheduleList() {
params.applyTimeEnd = params.applyTimeRange[1] params.applyTimeEnd = params.applyTimeRange[1]
delete params.applyTimeRange delete params.applyTimeRange
} }
getSurgeryPage(params).then((res) => { getSurgery(params).then((res) => {
// Check if data is nested under data.data or directly under data
const responseData = res.data.data || res.data const responseData = res.data.data || res.data
applyList.value = responseData.records || [] applyList.value = responseData.records || []
applyTotal.value = responseData.total || 0 applyTotal.value = responseData.total || 0

View File

@@ -147,10 +147,9 @@
<el-button class="cancel-btn" @click="handleCancel">取消</el-button> <el-button class="cancel-btn" @click="handleCancel">取消</el-button>
<el-button <el-button
class="sign-btn" class="sign-btn"
:disabled="allItemsSubmitted"
@click="handleSignAndSubmit" @click="handleSignAndSubmit"
> >
{{ allItemsSubmitted ? '已签发' : (isSigned ? '提交医嘱' : '一键签名并生成医嘱') }} {{ isSigned ? '提交医嘱' : '一键签名并生成医嘱' }}
</el-button> </el-button>
</div> </div>
</div> </div>
@@ -311,21 +310,8 @@ const getMethodCodeDict = computed(() => {
return dict return dict
}) })
// 🔧 修复 Bug #446: 检查计费药品是否已全部提交(有 requestId用于区分"首次签名"和"已提交重开"
const allItemsSubmitted = computed(() => {
const meds = props.billingMedicines || []
return meds.length > 0 && meds.every(m => m.requestId)
})
// 响应式数据 - isSigned 从父组件传入的 prop 初始化 // 响应式数据 - isSigned 从父组件传入的 prop 初始化
const isSigned = ref(props.isSignedProp) const isSigned = ref(props.isSignedProp)
// 🔧 修复 Bug #446: 同步父组件 isSignedProp 的变化到本地 isSigned
// ref(props.isSignedProp) 只在初始化时读取一次,父组件后续更新不会自动同步
watch(() => props.isSignedProp, (newVal) => {
isSigned.value = newVal
})
const signatureTime = ref('') const signatureTime = ref('')
const showSignDialog = ref(false) const showSignDialog = ref(false)
const signPassword = ref('') const signPassword = ref('')

View File

@@ -1,5 +0,0 @@
-- Bug #434 修复:为 op_schedule 表添加 incision_level 字段
-- 手术安排表需要存储切口类型,以便在编辑弹窗中正确回显和保存
ALTER TABLE op_schedule ADD COLUMN IF NOT EXISTS incision_level INT2;
COMMENT ON COLUMN op_schedule.incision_level IS '手术切口等级 1-I级切口 2-II级切口 3-III级切口 4-IV级切口';