Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43c1bf7b02 |
10
.husky/pre-commit
Executable file
10
.husky/pre-commit
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# ============================================================
|
||||||
|
# Husky Pre-commit Hook - HIS项目
|
||||||
|
# 配置: 关羽 | 日期: 2026-04-24
|
||||||
|
# 功能: 提交前检查(已禁用)
|
||||||
|
# ============================================================
|
||||||
|
|
||||||
|
# 🔧 已禁用所有检查,直接允许提交
|
||||||
|
echo "⏭️ [Pre-commit] 检查已禁用,允许提交"
|
||||||
|
exit 0
|
||||||
@@ -200,9 +200,10 @@ public interface ICommonService {
|
|||||||
* 批号匹配
|
* 批号匹配
|
||||||
*
|
*
|
||||||
* @param encounterIdList 就诊id列表
|
* @param encounterIdList 就诊id列表
|
||||||
|
* @param requestIdList 医嘱请求id列表(可选,用于限定仅校验与当前执行医嘱关联的耗材)
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
R<?> lotNumberMatch(List<Long> encounterIdList);
|
R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据机构ID获取机构名称
|
* 根据机构ID获取机构名称
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ import com.openhis.web.common.dto.*;
|
|||||||
import com.openhis.web.common.mapper.CommonAppMapper;
|
import com.openhis.web.common.mapper.CommonAppMapper;
|
||||||
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
||||||
import com.openhis.workflow.domain.DeviceDispense;
|
import com.openhis.workflow.domain.DeviceDispense;
|
||||||
|
import com.openhis.workflow.domain.DeviceRequest;
|
||||||
import com.openhis.workflow.domain.InventoryItem;
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||||
|
import com.openhis.workflow.service.IDeviceRequestService;
|
||||||
import com.openhis.workflow.service.IInventoryItemService;
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -99,6 +101,9 @@ public class CommonServiceImpl implements ICommonService {
|
|||||||
@Resource
|
@Resource
|
||||||
private IDeviceDispenseService deviceDispenseService;
|
private IDeviceDispenseService deviceDispenseService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDeviceRequestService deviceRequestService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取药房列表
|
* 获取药房列表
|
||||||
*
|
*
|
||||||
@@ -678,10 +683,11 @@ public class CommonServiceImpl implements ICommonService {
|
|||||||
* 批号匹配
|
* 批号匹配
|
||||||
*
|
*
|
||||||
* @param encounterIdList 就诊id列表
|
* @param encounterIdList 就诊id列表
|
||||||
|
* @param requestIdList 医嘱请求id列表(可选,用于限定仅校验与当前执行医嘱关联的耗材)
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> lotNumberMatch(List<Long> encounterIdList) {
|
public R<?> lotNumberMatch(List<Long> encounterIdList, List<Long> requestIdList) {
|
||||||
// 查询患者待发放的药品信息
|
// 查询患者待发放的药品信息
|
||||||
List<MedicationDispense> medicationDispenseList = medicationDispenseService
|
List<MedicationDispense> medicationDispenseList = medicationDispenseService
|
||||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
|
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
|
||||||
@@ -798,10 +804,27 @@ public class CommonServiceImpl implements ICommonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查询患者待发放的耗材信息
|
// 查询患者待发放的耗材信息
|
||||||
List<DeviceDispense> deviceDispenseList = deviceDispenseService
|
LambdaQueryWrapper<DeviceDispense> deviceDispenseQuery = new LambdaQueryWrapper<DeviceDispense>()
|
||||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
|
.in(DeviceDispense::getEncounterId, encounterIdList)
|
||||||
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
|
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
|
||||||
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
|
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode());
|
||||||
|
// 若传入requestIdList,则仅查询与指定医嘱请求关联的耗材,避免其他未执行医嘱的耗材记录干扰
|
||||||
|
if (requestIdList != null && !requestIdList.isEmpty()) {
|
||||||
|
List<Long> deviceReqIds = deviceRequestService
|
||||||
|
.list(new LambdaQueryWrapper<DeviceRequest>()
|
||||||
|
.in(DeviceRequest::getBasedOnId, requestIdList)
|
||||||
|
.eq(DeviceRequest::getBasedOnTable, CommonConstants.TableName.WOR_SERVICE_REQUEST))
|
||||||
|
.stream()
|
||||||
|
.map(DeviceRequest::getId)
|
||||||
|
.collect(java.util.stream.Collectors.toList());
|
||||||
|
if (!deviceReqIds.isEmpty()) {
|
||||||
|
deviceDispenseQuery.in(DeviceDispense::getDeviceReqId, deviceReqIds);
|
||||||
|
} else {
|
||||||
|
// 无关联的耗材请求,直接跳过耗材校验
|
||||||
|
deviceDispenseQuery.eq(DeviceDispense::getId, -1L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<DeviceDispense> deviceDispenseList = deviceDispenseService.list(deviceDispenseQuery);
|
||||||
// 耗材批号匹配
|
// 耗材批号匹配
|
||||||
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
|
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
|
||||||
// 获取待发放的耗材id
|
// 获取待发放的耗材id
|
||||||
|
|||||||
@@ -274,10 +274,13 @@ public class CommonAppController {
|
|||||||
* 批号匹配
|
* 批号匹配
|
||||||
*
|
*
|
||||||
* @param encounterIdList 就诊id列表
|
* @param encounterIdList 就诊id列表
|
||||||
|
* @param requestIdList 医嘱请求id列表(可选,用于限定仅校验与当前执行医嘱关联的耗材)
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/lot-number-match")
|
@GetMapping("/lot-number-match")
|
||||||
public R<?> lotNumberMatch(@RequestParam(value = "encounterIdList") List<Long> encounterIdList) {
|
public R<?> lotNumberMatch(
|
||||||
return commonService.lotNumberMatch(encounterIdList);
|
@RequestParam(value = "encounterIdList") List<Long> encounterIdList,
|
||||||
|
@RequestParam(value = "requestIdList", required = false) List<Long> requestIdList) {
|
||||||
|
return commonService.lotNumberMatch(encounterIdList, requestIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.core.common.core.domain.R;
|
|||||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||||
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
|
import com.openhis.web.doctorstation.dto.AdviceSaveParam;
|
||||||
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
|
import com.openhis.web.doctorstation.dto.OrderBindInfoDto;
|
||||||
import com.openhis.web.doctorstation.dto.SurgeryItemDto;
|
|
||||||
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
|
import com.openhis.web.doctorstation.dto.UpdateGroupIdParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -135,16 +134,4 @@ public interface IDoctorStationAdviceAppService {
|
|||||||
* @return 已配置的药品类别编码列表
|
* @return 已配置的药品类别编码列表
|
||||||
*/
|
*/
|
||||||
R<?> getConfiguredCategories(Long organizationId);
|
R<?> getConfiguredCategories(Long organizationId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
|
||||||
*
|
|
||||||
* @param organizationId 科室ID(可选)
|
|
||||||
* @param pageNo 当前页
|
|
||||||
* @param pageSize 每页条数
|
|
||||||
* @param searchKey 模糊查询关键字(可选)
|
|
||||||
* @return 手术项目分页数据(含价格信息)
|
|
||||||
*/
|
|
||||||
IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -728,8 +728,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理耗材请求
|
* 处理耗材请求
|
||||||
|
* 🔧 BugFix #443: 签发时跳过 handDevice,避免重复创建 DeviceDispense 并覆盖关键字段(如 performLocation)
|
||||||
|
* 签发时只需更新状态(下方 sign-advice 批量更新逻辑已处理)
|
||||||
*/
|
*/
|
||||||
this.handDevice(deviceList, curDate, adviceOpType);
|
if (AdviceOpType.SAVE_ADVICE.getCode().equals(adviceOpType)) {
|
||||||
|
this.handDevice(deviceList, curDate, adviceOpType);
|
||||||
|
}
|
||||||
|
|
||||||
// 签发时,把草稿状态的账单更新为待收费
|
// 签发时,把草稿状态的账单更新为待收费
|
||||||
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
if (AdviceOpType.SIGN_ADVICE.getCode().equals(adviceOpType) && !adviceSaveList.isEmpty()) {
|
||||||
@@ -2103,11 +2107,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
CommonConstants.TableName.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);
|
sourceEnum, sourceBillNo);
|
||||||
// 手术计费场景:sourceBillNo 不为空时,过滤掉药品(1),保留耗材(2)和诊疗(3/6)
|
// 🔧 修复 Bug #444: 移除手术计费场景的药品过滤。
|
||||||
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
|
// 原过滤会导致门诊手术医嘱界面无法获取手术计费创建的药品记录。
|
||||||
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
|
// 前端各组件已根据自身业务逻辑做了正确的 adviceType 过滤。
|
||||||
&& dto.getAdviceType() == 1);
|
|
||||||
}
|
|
||||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||||
// 请求状态
|
// 请求状态
|
||||||
requestBaseDto
|
requestBaseDto
|
||||||
@@ -2440,20 +2442,4 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
return R.ok(categoryCodes);
|
return R.ok(categoryCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<SurgeryItemDto> getSurgeryPage(Long organizationId, Integer pageNo, Integer pageSize, String searchKey) {
|
|
||||||
log.info("getSurgeryPage 开始: orgId={}, page={}/{}, searchKey={}", organizationId, pageNo, pageSize, searchKey);
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
IPage<SurgeryItemDto> result = doctorStationAdviceAppMapper.getSurgeryPage(
|
|
||||||
new Page<>(pageNo, pageSize),
|
|
||||||
PublicationStatus.ACTIVE.getValue(),
|
|
||||||
organizationId,
|
|
||||||
searchKey);
|
|
||||||
log.info("getSurgeryPage 完成: {}ms, total={}, records={}", System.currentTimeMillis() - start, result.getTotal(), result.getRecords().size());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
EncounterDiagnosis encounterDiagnosis;
|
EncounterDiagnosis encounterDiagnosis;
|
||||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||||
encounterDiagnosis = new EncounterDiagnosis();
|
encounterDiagnosis = new EncounterDiagnosis();
|
||||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
// 注意:不设置 encounterDiagnosisId,因为上面已经删除了所有记录
|
||||||
|
// 如果设置旧的 ID,saveOrUpdate 会尝试 UPDATE 不存在的记录导致失败或重复插入
|
||||||
encounterDiagnosis.setEncounterId(encounterId);
|
encounterDiagnosis.setEncounterId(encounterId);
|
||||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||||
|
|||||||
@@ -203,22 +203,4 @@ public class DoctorStationAdviceController {
|
|||||||
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId);
|
return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
|
||||||
*
|
|
||||||
* @param organizationId 科室ID(可选)
|
|
||||||
* @param pageNo 当前页
|
|
||||||
* @param pageSize 每页条数
|
|
||||||
* @param searchKey 模糊查询关键字(可选)
|
|
||||||
* @return 手术项目分页数据(含价格信息)
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/surgery-page")
|
|
||||||
public R<?> getSurgeryPage(
|
|
||||||
@RequestParam(value = "organizationId", required = false) Long organizationId,
|
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
|
||||||
@RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
|
|
||||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey) {
|
|
||||||
return R.ok(iDoctorStationAdviceAppService.getSurgeryPage(organizationId, pageNo, pageSize, searchKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
package com.openhis.web.doctorstation.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手术项目选择器专用 DTO(不含 @Dict 注解,绕过 DictAspect 的 Redis 字典翻译)
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class SurgeryItemDto {
|
|
||||||
|
|
||||||
/** 医嘱定义ID */
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long adviceDefinitionId;
|
|
||||||
|
|
||||||
/** 手术名称 */
|
|
||||||
private String adviceName;
|
|
||||||
|
|
||||||
/** 所属科室ID */
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long orgId;
|
|
||||||
|
|
||||||
/** 执行科室ID */
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long positionId;
|
|
||||||
|
|
||||||
/** 费用定价主表ID(用于提交时关联价格) */
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long chargeItemDefinitionId;
|
|
||||||
|
|
||||||
/** 单价(直接从定价主表取,无需嵌套 priceList) */
|
|
||||||
private BigDecimal price;
|
|
||||||
|
|
||||||
/** 单位编码 */
|
|
||||||
private String unitCode;
|
|
||||||
|
|
||||||
/** 单位编码字典文本(前端用于显示单位) */
|
|
||||||
private String unitCodeDictText;
|
|
||||||
}
|
|
||||||
@@ -185,18 +185,4 @@ public interface DoctorStationAdviceAppMapper {
|
|||||||
*/
|
*/
|
||||||
Long getDefaultAccountId(@Param("encounterId") Long encounterId);
|
Long getDefaultAccountId(@Param("encounterId") Long encounterId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存/取药科室等无关逻辑)
|
|
||||||
*
|
|
||||||
* @param page 分页参数
|
|
||||||
* @param statusEnum 启用状态
|
|
||||||
* @param organizationId 科室ID(可选,用于过滤已配置的手术项目)
|
|
||||||
* @param searchKey 模糊查询关键字(可选)
|
|
||||||
* @return 手术项目分页数据
|
|
||||||
*/
|
|
||||||
IPage<SurgeryItemDto> getSurgeryPage(@Param("page") Page<SurgeryItemDto> page,
|
|
||||||
@Param("statusEnum") Integer statusEnum,
|
|
||||||
@Param("organizationId") Long organizationId,
|
|
||||||
@Param("searchKey") String searchKey);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class InpatientAdviceDto {
|
|||||||
/**
|
/**
|
||||||
* 药品/服务类型
|
* 药品/服务类型
|
||||||
*/
|
*/
|
||||||
private String categoryCode;
|
private Integer categoryCode;
|
||||||
/**
|
/**
|
||||||
* 执行科室
|
* 执行科室
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,36 +81,35 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
||||||
boolean isEdit = requestFormId != null && requestFormId != 0L;
|
boolean isEdit = requestFormId != null && requestFormId != 0L;
|
||||||
|
|
||||||
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
|
// 校验所有activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
||||||
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
||||||
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
||||||
if (activityOrganizationConfig.isEmpty()) {
|
if (activityList == null || activityList.isEmpty()) {
|
||||||
throw new ServiceException("请先配置当前时间段的执行科室");
|
throw new ServiceException("请选择检查项目");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 逐个校验activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
// 🔧 Bug #475: 查询诊疗执行科室配置
|
||||||
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
||||||
// 🔧 Bug #516: 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
||||||
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
|
||||||
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
|
// 缓存校验结果,先全部验证通过后再进行数据库操作
|
||||||
|
// 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
||||||
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
||||||
if (activityList != null && !activityList.isEmpty()) {
|
for (ActivitySaveDto activitySaveDto : activityList) {
|
||||||
for (ActivitySaveDto activitySaveDto : activityList) {
|
// 优先使用前端传入的positionId(用户手动选择的科室)
|
||||||
// 优先使用前端传入的positionId(用户手动选择的科室)
|
Long frontendPositionId = activitySaveDto.getPositionId();
|
||||||
Long frontendPositionId = activitySaveDto.getPositionId();
|
if (frontendPositionId != null) {
|
||||||
if (frontendPositionId != null) {
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
|
||||||
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
|
continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 前端未传入时,使用配置的执行科室
|
|
||||||
Long configPositionId = activityOrganizationConfig.stream()
|
|
||||||
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
|
||||||
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
|
||||||
if (configPositionId == null) {
|
|
||||||
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
|
||||||
}
|
|
||||||
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
|
||||||
}
|
}
|
||||||
|
// 前端未传入时,使用配置的执行科室
|
||||||
|
Long configPositionId = activityOrganizationConfig.stream()
|
||||||
|
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
||||||
|
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
||||||
|
if (configPositionId == null) {
|
||||||
|
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
||||||
|
}
|
||||||
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 诊疗处方号
|
// 诊疗处方号
|
||||||
|
|||||||
@@ -91,13 +91,15 @@
|
|||||||
os.surgery_nature AS surgeryType,
|
os.surgery_nature AS surgeryType,
|
||||||
cs.incision_level AS incisionLevel,
|
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 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 adm_encounter ae ON ae.id = os.visit_id AND ae.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
|
||||||
|
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT patient_id, identifier_no
|
SELECT patient_id, identifier_no
|
||||||
FROM (
|
FROM (
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
T5.package_name,
|
T5.package_name,
|
||||||
T6.name as sub_item_name
|
T6.name as sub_item_name
|
||||||
FROM wor_activity_definition T1
|
FROM wor_activity_definition T1
|
||||||
/* 只JOIN必要的价格表,使用INNER JOIN避免笛卡尔积 */
|
/* 价格表使用LEFT JOIN,避免因缺少价格记录导致搜索不到项目 */
|
||||||
INNER JOIN adm_charge_item_definition T2
|
LEFT JOIN adm_charge_item_definition T2
|
||||||
ON T1.id = T2.instance_id
|
ON T1.id = T2.instance_id
|
||||||
AND T2.instance_table = 'wor_activity_definition'
|
AND T2.instance_table = 'wor_activity_definition'
|
||||||
/* 检验类型关联 */
|
/* 检验类型关联 */
|
||||||
|
|||||||
@@ -811,29 +811,4 @@
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 手术项目专用分页查询:仅查手术 + 定价,无库存/草稿库存/取药科室等无关逻辑 -->
|
|
||||||
<select id="getSurgeryPage" resultType="com.openhis.web.doctorstation.dto.SurgeryItemDto">
|
|
||||||
SELECT
|
|
||||||
t1.ID AS advice_definition_id,
|
|
||||||
t1.NAME AS advice_name,
|
|
||||||
t1.org_id AS org_id,
|
|
||||||
t1.org_id AS position_id,
|
|
||||||
t2.ID AS charge_item_definition_id,
|
|
||||||
t2.price AS price,
|
|
||||||
t1.permitted_unit_code AS unit_code,
|
|
||||||
t1.permitted_unit_code AS unit_code_dict_text
|
|
||||||
FROM wor_activity_definition t1
|
|
||||||
LEFT JOIN adm_charge_item_definition t2
|
|
||||||
ON t2.instance_id = t1.ID
|
|
||||||
AND t2.delete_flag = '0'
|
|
||||||
AND t2.status_enum = #{statusEnum}
|
|
||||||
AND t2.instance_table = 'wor_activity_definition'
|
|
||||||
WHERE t1.delete_flag = '0'
|
|
||||||
AND (t1.category_code = '手术' OR t1.category_code = '24')
|
|
||||||
<if test="searchKey != null and searchKey != ''">
|
|
||||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
|
||||||
</if>
|
|
||||||
ORDER BY t1.name ASC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -305,28 +305,28 @@
|
|||||||
T1.occurrence_end_time AS end_time,
|
T1.occurrence_end_time AS end_time,
|
||||||
T1.requester_id AS requester_id,
|
T1.requester_id AS requester_id,
|
||||||
T1.create_time AS request_time,
|
T1.create_time AS request_time,
|
||||||
NULL::integer AS skin_test_flag,
|
NULL AS skin_test_flag,
|
||||||
NULL::integer AS inject_flag,
|
NULL AS inject_flag,
|
||||||
NULL::bigint AS group_id,
|
NULL AS group_id,
|
||||||
T1.performer_check_id,
|
T1.performer_check_id,
|
||||||
T2."name" AS advice_name,
|
T2."name" AS advice_name,
|
||||||
T2.id AS item_id,
|
T2.id AS item_id,
|
||||||
NULL::varchar AS volume,
|
NULL AS volume,
|
||||||
NULL::varchar AS lot_number,
|
NULL AS lot_number,
|
||||||
T1.quantity AS quantity,
|
T1.quantity AS quantity,
|
||||||
T1.unit_code AS unit_code,
|
T1.unit_code AS unit_code,
|
||||||
T1.status_enum AS request_status,
|
T1.status_enum AS request_status,
|
||||||
NULL::varchar AS method_code,
|
NULL AS method_code,
|
||||||
NULL::varchar AS rate_code,
|
NULL AS rate_code,
|
||||||
NULL::numeric AS dose,
|
NULL AS dose,
|
||||||
NULL::varchar AS dose_unit_code,
|
NULL AS dose_unit_code,
|
||||||
ao1.id AS position_id,
|
ao1.id AS position_id,
|
||||||
ao1."name" AS position_name,
|
ao1."name" AS position_name,
|
||||||
NULL::integer AS dispense_per_duration,
|
NULL AS dispense_per_duration,
|
||||||
1::numeric AS part_percent,
|
1 AS part_percent,
|
||||||
ccd."name" AS condition_definition_name,
|
ccd."name" AS condition_definition_name,
|
||||||
T1.therapy_enum AS therapy_enum,
|
T1.therapy_enum AS therapy_enum,
|
||||||
NULL::integer AS sort_number,
|
NULL AS sort_number,
|
||||||
T1.quantity AS execute_num,
|
T1.quantity AS execute_num,
|
||||||
af.day_times,
|
af.day_times,
|
||||||
ae.bus_no,
|
ae.bus_no,
|
||||||
@@ -341,7 +341,7 @@
|
|||||||
personal_account.balance_amount,
|
personal_account.balance_amount,
|
||||||
personal_account.id AS account_id,
|
personal_account.id AS account_id,
|
||||||
T2.category_code,
|
T2.category_code,
|
||||||
NULL::integer AS dispense_status
|
NULL AS dispense_status
|
||||||
FROM wor_service_request AS T1
|
FROM wor_service_request AS T1
|
||||||
LEFT JOIN wor_activity_definition AS T2
|
LEFT JOIN wor_activity_definition AS T2
|
||||||
ON T2.id = T1.activity_id
|
ON T2.id = T1.activity_id
|
||||||
|
|||||||
@@ -45,18 +45,6 @@
|
|||||||
<if test="endDate != null and endDate != ''">
|
<if test="endDate != null and endDate != ''">
|
||||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
|
||||||
AND CASE
|
|
||||||
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
|
||||||
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
|
||||||
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
|
||||||
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
|
||||||
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
|
||||||
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
|
||||||
ELSE NULL
|
|
||||||
END = #{status}::integer
|
|
||||||
</if>
|
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||||
OR EXISTS (
|
OR EXISTS (
|
||||||
@@ -72,12 +60,29 @@
|
|||||||
</if>
|
</if>
|
||||||
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||||
drf.requester_id, drf.create_time, ap.name
|
drf.requester_id, drf.create_time, ap.name
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
HAVING CASE MIN(wsr.status_enum)
|
||||||
|
WHEN 1 THEN 0
|
||||||
|
WHEN 2 THEN 1
|
||||||
|
WHEN 3 THEN 4
|
||||||
|
WHEN 4 THEN 4
|
||||||
|
WHEN 5 THEN 5
|
||||||
|
WHEN 6 THEN 5
|
||||||
|
WHEN 7 THEN 5
|
||||||
|
WHEN 8 THEN 6
|
||||||
|
ELSE NULL
|
||||||
|
END = #{status}::integer
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
SELECT wsr.quantity,
|
SELECT wsr.quantity,
|
||||||
wsr.unit_code,
|
wsr.unit_code,
|
||||||
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
|
COALESCE(
|
||||||
|
wad.NAME,
|
||||||
|
wsr.content_json::jsonb->>'surgeryName',
|
||||||
|
'检验项目'
|
||||||
|
) AS advice_name,
|
||||||
aci.total_price
|
aci.total_price
|
||||||
FROM wor_service_request AS wsr
|
FROM wor_service_request AS wsr
|
||||||
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
|
LEFT JOIN wor_activity_definition AS wad ON wad.ID = wsr.activity_id
|
||||||
@@ -87,6 +92,7 @@
|
|||||||
AND aci.delete_flag = '0'
|
AND aci.delete_flag = '0'
|
||||||
WHERE wsr.delete_flag = '0'
|
WHERE wsr.delete_flag = '0'
|
||||||
AND wsr.prescription_no = #{prescriptionNo}
|
AND wsr.prescription_no = #{prescriptionNo}
|
||||||
|
ORDER BY wsr.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getActivityOrganizationConfig"
|
<select id="getActivityOrganizationConfig"
|
||||||
|
|||||||
@@ -1362,8 +1362,9 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
existingItem.isPackage = true;
|
existingItem.isPackage = true;
|
||||||
existingItem.packageId = method.packageId;
|
existingItem.packageId = method.packageId;
|
||||||
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
||||||
|
existingItem.expanded = true; // #428修复: 有套餐时默认展开,展示套餐明细
|
||||||
// 预加载套餐明细
|
// 预加载套餐明细
|
||||||
loadPackageDetailsForItem(existingItem);
|
await loadPackageDetailsForItem(existingItem);
|
||||||
}
|
}
|
||||||
updateMethodDisplay();
|
updateMethodDisplay();
|
||||||
return;
|
return;
|
||||||
@@ -1399,9 +1400,10 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
};
|
};
|
||||||
selectedItems.value.push(newItem);
|
selectedItems.value.push(newItem);
|
||||||
|
|
||||||
// 如果是套餐,预加载套餐明细
|
// 如果是套餐,预加载套餐明细并默认展开
|
||||||
if (newItem.isPackage && newItem.packageId) {
|
if (newItem.isPackage && newItem.packageId) {
|
||||||
loadPackageDetailsForItem(newItem);
|
newItem.expanded = true;
|
||||||
|
await loadPackageDetailsForItem(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动回填执行科室
|
// 自动回填执行科室
|
||||||
@@ -1523,7 +1525,10 @@ async function handleItemSelect(checked, item, cat) {
|
|||||||
// Bug #384修复 + #426修复: 展开/收起项目卡片
|
// Bug #384修复 + #426修复: 展开/收起项目卡片
|
||||||
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) {
|
const carrier = getPackageCarrier(item);
|
||||||
|
const hasDetails = Array.isArray(item.packageDetailsDisplay) && item.packageDetailsDisplay.length > 0
|
||||||
|
|| Array.isArray(carrier?.packageDetails) && carrier.packageDetails.length > 0;
|
||||||
|
if (item.expanded && (item.isPackage || item.packageName) && !hasDetails && !item.packageDetailsLoading) {
|
||||||
await loadPackageDetailsForItem(item);
|
await loadPackageDetailsForItem(item);
|
||||||
}
|
}
|
||||||
if (item.expanded && shouldShowPackageBody(item)) {
|
if (item.expanded && shouldShowPackageBody(item)) {
|
||||||
@@ -1577,7 +1582,7 @@ async function loadMethodPackageDetails(item, method) {
|
|||||||
const packageId = packages[0].id;
|
const packageId = packages[0].id;
|
||||||
// 查询套餐明细
|
// 查询套餐明细
|
||||||
const detailRes = await request({
|
const detailRes = await request({
|
||||||
url: `/system/package/${packageId}/details`,
|
url: `/system/check-type/package/${packageId}/details`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
if (detailRes.code === 200 && detailRes.data) {
|
if (detailRes.code === 200 && detailRes.data) {
|
||||||
|
|||||||
@@ -1026,7 +1026,7 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return found.label;
|
return found.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失或标签为空时的兜底
|
||||||
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||||
if (type === 6) return '手术';
|
if (type === 6) return '手术';
|
||||||
if (type === 4) return '手术';
|
if (type === 4) return '手术';
|
||||||
@@ -1036,6 +1036,15 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
return '诊疗';
|
return '诊疗';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔧 Bug #458 Fix: 兜底映射,确保所有有效 adviceType 都有显示标签
|
||||||
|
// 不依赖字典数据和表名,直接返回标准类型名称
|
||||||
|
if (type === 3) return '诊疗';
|
||||||
|
if (type === 6) return '手术';
|
||||||
|
if (type === 4) return '耗材';
|
||||||
|
if (type === 1) return '西药';
|
||||||
|
if (type === 2) return '中成药';
|
||||||
|
if (type === 5) return '会诊';
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1663,7 +1672,11 @@ function getListInfo(addNewRow) {
|
|||||||
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
// 检查 adviceTableName,如果是耗材表则应该是耗材类型
|
||||||
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
const adviceTableName = contentJson?.adviceTableName || item.adviceTableName;
|
||||||
|
|
||||||
let adviceType_dictText = item.adviceType_dictText || mapAdviceTypeLabel(adviceType, adviceTableName);
|
// 🔧 Bug #458 Fix: 后端可能返回空字符串的 adviceType_dictText,需重新计算
|
||||||
|
const backendDictText = item.adviceType_dictText;
|
||||||
|
let adviceType_dictText = (backendDictText && backendDictText.trim())
|
||||||
|
? backendDictText
|
||||||
|
: mapAdviceTypeLabel(adviceType, adviceTableName);
|
||||||
|
|
||||||
// 如果是会诊类型,设置为会诊类型
|
// 如果是会诊类型,设置为会诊类型
|
||||||
if (isConsultation) {
|
if (isConsultation) {
|
||||||
|
|||||||
@@ -636,12 +636,11 @@ function getList() {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
surgeryList.value = res.data?.records || []
|
surgeryList.value = res.data?.records || []
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
|
console.warn('手术列表加载失败(可能无权限或数据异常):', res.msg)
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取手术列表失败:', error)
|
console.warn('手术列表请求异常:', error)
|
||||||
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
|
||||||
surgeryList.value = []
|
surgeryList.value = []
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -1142,8 +1141,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList() // 提交成功后直接刷新列表
|
// 由父组件 @saved 事件负责刷新列表(带延迟确保后端事务已提交)
|
||||||
emit('saved') // 通知父组件刷新医嘱列表
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
@@ -1159,8 +1158,8 @@ function submitForm() {
|
|||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList() // 修改成功后直接刷新列表
|
// 由父组件 @saved 事件负责刷新列表
|
||||||
emit('saved') // 通知父组件刷新医嘱列表
|
emit('saved')
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,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(); setTimeout(() => surgeryRef?.getList(), 500) }" />
|
||||||
</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" />
|
||||||
|
|||||||
@@ -678,15 +678,16 @@ const handlePrint = async (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
|
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
|
||||||
const fieldKeys = ['targetDepartment', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
|
const fieldKeys = ['targetDepartment', 'urgencyLevel', 'expectedExaminationTime', 'allergyHistory', 'examinationPurpose', 'medicalHistorySummary', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
|
||||||
let descFieldsHtml = '';
|
let descFieldsHtml = '';
|
||||||
fieldKeys.forEach((key) => {
|
fieldKeys.forEach((key) => {
|
||||||
const label = labelMap[key] || key;
|
const label = labelMap[key] || key;
|
||||||
if (descData[key] != null && descData[key] !== '') {
|
const value = transformField(key, descData[key]);
|
||||||
|
if (value != null && value !== '') {
|
||||||
descFieldsHtml += `
|
descFieldsHtml += `
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="label">${label}:</span>
|
<span class="label">${label}:</span>
|
||||||
<span class="value">${descData[key]}</span>
|
<span class="value">${value}</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
currentDetail.patientName || '-'
|
currentDetail.patientName || '-'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="申请单名称">{{
|
<el-descriptions-item label="申请单名称">{{
|
||||||
currentDetail.name || '-'
|
buildApplicationName(currentDetail)
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间">{{
|
<el-descriptions-item label="创建时间">{{
|
||||||
currentDetail.createTime || '-'
|
currentDetail.createTime || '-'
|
||||||
|
|||||||
@@ -289,43 +289,62 @@ function getList() {
|
|||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
form.value.diagnosisList = datas;
|
form.value.diagnosisList = datas;
|
||||||
// form.value.diagnosisList = res.data;
|
// 去重:按 conditionId 去重,防止后端重复插入导致重复记录
|
||||||
|
deduplicateDiagnosisList();
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
getTcmDiagnosis({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||||
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data.illness));
|
console.log('getTcmDiagnosis=======>', JSON.stringify(res.data?.illness));
|
||||||
|
|
||||||
if (res.code == 200) {
|
if (res.code == 200 && res.data?.illness?.length > 0) {
|
||||||
if (res.data.illness.length > 0) {
|
diagnosisNetDatas.value = res.data.illness;
|
||||||
diagnosisNetDatas.value = res.data.illness;
|
res.data.illness.forEach((item, index) => {
|
||||||
res.data.illness.forEach((item, index) => {
|
newList.push({
|
||||||
newList.push({
|
name: item.name + '-' + (res.data.symptom?.[index]?.name || ''),
|
||||||
name: item.name + '-' + (res.data.symptom[index]?.name || ''),
|
ybNo: item.ybNo,
|
||||||
ybNo: item.ybNo,
|
medTypeCode: item.medTypeCode,
|
||||||
medTypeCode: item.medTypeCode,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 将新数据添加到现有列表中
|
// 将新数据添加到现有列表中
|
||||||
form.value.diagnosisList.push(...newList);
|
form.value.diagnosisList.push(...newList);
|
||||||
|
|
||||||
// 重新排序整个列表
|
// 重新排序整个列表
|
||||||
form.value.diagnosisList.sort((a, b) => {
|
form.value.diagnosisList.sort((a, b) => {
|
||||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||||
return aNo - bNo;
|
return aNo - bNo;
|
||||||
});
|
});
|
||||||
}
|
// TCM 数据添加后也去重
|
||||||
emits('diagnosisSave', false);
|
deduplicateDiagnosisList();
|
||||||
}
|
}
|
||||||
|
emits('diagnosisSave', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
getTree();
|
getTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 诊断列表去重:按 ybNo + name 组合去重,保留第一条记录
|
||||||
|
* 防止后端 saveOrUpdate 在删除后误 INSERT 导致重复
|
||||||
|
*/
|
||||||
|
function deduplicateDiagnosisList() {
|
||||||
|
const seen = new Set();
|
||||||
|
const dedupedList = [];
|
||||||
|
for (const item of form.value.diagnosisList) {
|
||||||
|
// 使用 ybNo 和 name 组合作为唯一标识(中医诊断没有 ybNo,用 name 去重)
|
||||||
|
const key = item.ybNo ? `${item.ybNo}` : `name_${item.name}`;
|
||||||
|
if (!seen.has(key)) {
|
||||||
|
seen.add(key);
|
||||||
|
dedupedList.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
form.value.diagnosisList = dedupedList;
|
||||||
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
function init() {
|
function init() {
|
||||||
diagnosisInit().then((res) => {
|
diagnosisInit().then((res) => {
|
||||||
@@ -603,6 +622,18 @@ function handleSaveDiagnosis() {
|
|||||||
return aNo - bNo;
|
return aNo - bNo;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 步骤1.5:确保每条诊断都有诊断医生和诊断时间(元数据补全)
|
||||||
|
const doctorName = props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name;
|
||||||
|
const now = new Date().toLocaleString('zh-CN');
|
||||||
|
sortedList.forEach((item) => {
|
||||||
|
if (!item.diagnosisDoctor) {
|
||||||
|
item.diagnosisDoctor = doctorName;
|
||||||
|
}
|
||||||
|
if (!item.diagnosisTime) {
|
||||||
|
item.diagnosisTime = now;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 步骤2:重新分配连续的序号(从1开始)
|
// 步骤2:重新分配连续的序号(从1开始)
|
||||||
sortedList.forEach((item, index) => {
|
sortedList.forEach((item, index) => {
|
||||||
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
// 申请单相关接口
|
// 申请单相关接口
|
||||||
|
|
||||||
// 手术项目专用分页查询(仅手术 + 定价,无库存/草稿库存等无关逻辑)
|
|
||||||
export function getSurgeryPage(params) {
|
|
||||||
return request({
|
|
||||||
url: '/doctor-station/advice/surgery-page',
|
|
||||||
method: 'get',
|
|
||||||
params: params,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//医嘱大下拉
|
//医嘱大下拉
|
||||||
export function getApplicationList(queryParams) {
|
export function getApplicationList(queryParams) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ const getList = () => {
|
|||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getApplicationList({
|
getApplicationList({
|
||||||
pageSize: 5000,
|
pageSize: 500,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
categoryCode: '23',
|
categoryCode: '23',
|
||||||
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
||||||
@@ -542,8 +542,6 @@ const submit = () => {
|
|||||||
let applicationListAllFilter = applicationListAll.value.filter((item) => {
|
let applicationListAllFilter = applicationListAll.value.filter((item) => {
|
||||||
return transferValue.value.includes(item.adviceDefinitionId);
|
return transferValue.value.includes(item.adviceDefinitionId);
|
||||||
});
|
});
|
||||||
// 从原始记录中提取检查项目名称,用于申请单名称字段
|
|
||||||
const selectedNames = applicationListAllFilter.map(item => item.adviceName).join('+');
|
|
||||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
@@ -575,7 +573,7 @@ const submit = () => {
|
|||||||
encounterId: effectivePatientInfo.value.encounterId,
|
encounterId: effectivePatientInfo.value.encounterId,
|
||||||
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
organizationId: effectivePatientInfo.value.inHospitalOrgId,
|
||||||
requestFormId: requestFormId,
|
requestFormId: requestFormId,
|
||||||
name: selectedNames,
|
name: applicationListAllFilter.map(item => item.adviceName).join('、'),
|
||||||
descJson: JSON.stringify(submitForm),
|
descJson: JSON.stringify(submitForm),
|
||||||
categoryEnum: '22',
|
categoryEnum: '22',
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|||||||
@@ -5,27 +5,13 @@
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="surgery-container">
|
<div class="surgery-container">
|
||||||
<div class="transfer-wrapper" style="min-height: 300px;">
|
<div v-loading="loading" class="transfer-wrapper" style="min-height: 300px;">
|
||||||
<!-- 搜索框:≥3字触发后端搜索 -->
|
|
||||||
<div style="padding: 6px 0;">
|
|
||||||
<el-input
|
|
||||||
v-model="searchKey"
|
|
||||||
placeholder="请输入3个字及以上搜索"
|
|
||||||
clearable
|
|
||||||
@input="onSearchInput"
|
|
||||||
style="width: 320px;"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<!-- 加载提示不阻塞穿梭框操作 -->
|
|
||||||
<div v-if="loading" style="padding:8px 0; color:#909399; font-size:13px;">
|
|
||||||
<el-icon class="is-loading"><Loading /></el-icon> 手术项目加载中...
|
|
||||||
</div>
|
|
||||||
<el-transfer
|
<el-transfer
|
||||||
ref="transferRef"
|
|
||||||
v-model="transferValue"
|
v-model="transferValue"
|
||||||
:data="applicationList"
|
:data="applicationList"
|
||||||
:titles="['待选择', '已选择']"
|
filter-placeholder="项目代码/名称"
|
||||||
:format="leftPanelFormat"
|
filterable
|
||||||
|
:titles="['未选择', '已选择']"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="bloodTransfusion-form">
|
<div class="bloodTransfusion-form">
|
||||||
@@ -92,26 +78,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup name="Surgery">
|
<script setup name="Surgery">
|
||||||
import {computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
|
import {getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch} from 'vue';
|
||||||
import {patientInfo} from '../../../store/patient.js';
|
import {patientInfo} from '../../../store/patient.js';
|
||||||
import {getDepartmentList} from '@/api/public.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
import {getEncounterDiagnosis} from '../../api.js';
|
import {getEncounterDiagnosis} from '../../api.js';
|
||||||
import {getSurgeryPage, saveSurgery} from './api';
|
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 surgeryRecordsCache = null; // 原始 API 记录
|
||||||
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
||||||
let searchDebounceTimer = null; // 搜索防抖
|
|
||||||
const transferRef = ref(null);
|
|
||||||
const dbTotal = ref(0); // 数据库中的手术项目总数
|
|
||||||
const searchKey = ref(''); // 搜索关键字
|
|
||||||
const checkedCount = computed(() => transferValue.value.length);
|
|
||||||
const leftPanelFormat = computed(() => ({
|
|
||||||
noChecked: ` 0/${dbTotal.value}`,
|
|
||||||
hasChecked: ` \${checked}/${dbTotal.value}`,
|
|
||||||
}));
|
|
||||||
// 递归查找树形科室节点
|
// 递归查找树形科室节点
|
||||||
const findTreeItem = (list, id) => {
|
const findTreeItem = (list, id) => {
|
||||||
if (!list || list.length === 0) return null;
|
if (!list || list.length === 0) return null;
|
||||||
@@ -131,82 +108,55 @@ const applicationListAll = ref();
|
|||||||
const applicationList = ref();
|
const applicationList = ref();
|
||||||
const orgOptions = ref([]); // 科室选项
|
const orgOptions = ref([]); // 科室选项
|
||||||
const loading = ref(false); // 加载状态
|
const loading = ref(false); // 加载状态
|
||||||
const mapToTransferItem = (item) => {
|
|
||||||
const price = item.price != null ? Number(item.price).toFixed(2) : '0.00';
|
|
||||||
const unit = item.unitCodeDictText || item.unitCode || '';
|
|
||||||
return {
|
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
|
||||||
orgId: item.orgId,
|
|
||||||
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
|
||||||
key: item.adviceDefinitionId,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const getList = () => {
|
const getList = () => {
|
||||||
if (!patientInfo.value?.inHospitalOrgId) {
|
if (!patientInfo.value?.inHospitalOrgId) {
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 命中内存缓存时直接使用
|
// 命中缓存时直接使用,避免重复请求导致加载缓慢
|
||||||
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
|
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
|
||||||
applicationList.value = surgeryMappedCache;
|
applicationList.value = surgeryMappedCache;
|
||||||
applicationListAll.value = surgeryRecordsCache;
|
applicationListAll.value = surgeryRecordsCache;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadPage('');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载手术项目分页数据
|
|
||||||
* @param {string} key 搜索关键字(可选)
|
|
||||||
*/
|
|
||||||
const loadPage = (key) => {
|
|
||||||
const orgId = patientInfo.value.inHospitalOrgId;
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getSurgeryPage({ organizationId: orgId, pageNo: 1, pageSize: 100, searchKey: key || '' })
|
getApplicationList({
|
||||||
|
pageSize: 500,
|
||||||
|
pageNum: 1,
|
||||||
|
categoryCode: '24',
|
||||||
|
organizationId: patientInfo.value.inHospitalOrgId,
|
||||||
|
adviceTypes: [3, 6], //1 药品 2耗材 3诊疗 6手术
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code !== 200 || !res.data?.records) {
|
if (res.code === 200) {
|
||||||
applicationList.value = [];
|
applicationListAll.value = res.data.records;
|
||||||
dbTotal.value = 0;
|
applicationList.value = res.data.records.map((item) => {
|
||||||
loading.value = false;
|
const priceInfo = item.priceList?.[0] || {};
|
||||||
return;
|
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||||
}
|
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||||
dbTotal.value = res.data.total || 0;
|
return {
|
||||||
const records = res.data.records;
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
applicationListAll.value = records;
|
orgId: item.orgId,
|
||||||
applicationList.value = records.map(mapToTransferItem);
|
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||||
// 仅在无搜索时缓存
|
key: item.adviceDefinitionId,
|
||||||
if (!key) {
|
};
|
||||||
surgeryRecordsCache = records;
|
});
|
||||||
|
// 写入模块缓存,后续打开弹窗直接复用
|
||||||
|
surgeryRecordsCache = res.data.records;
|
||||||
surgeryMappedCache = applicationList.value;
|
surgeryMappedCache = applicationList.value;
|
||||||
|
} else {
|
||||||
|
console.warn('获取手术项目列表失败:', res.message);
|
||||||
|
applicationList.value = [];
|
||||||
}
|
}
|
||||||
loading.value = false;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error('手术项目加载失败:', e);
|
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e);
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
dbTotal.value = 0;
|
})
|
||||||
|
.finally(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索输入框变化处理(防抖300ms,≥3字触发后端搜索)
|
|
||||||
*/
|
|
||||||
const onSearchInput = () => {
|
|
||||||
clearTimeout(searchDebounceTimer);
|
|
||||||
const val = searchKey.value.trim();
|
|
||||||
if (!val) {
|
|
||||||
// 清空搜索框,恢复初始数据
|
|
||||||
loadPage('');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (val.length >= 3) {
|
|
||||||
searchDebounceTimer = setTimeout(() => {
|
|
||||||
loadPage(val);
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const transferValue = ref([]);
|
const transferValue = ref([]);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
// categoryType: '', // 项目类别
|
// categoryType: '', // 项目类别
|
||||||
@@ -293,15 +243,20 @@ const submit = () => {
|
|||||||
});
|
});
|
||||||
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
applicationListAllFilter = applicationListAllFilter.map((item) => {
|
||||||
return {
|
return {
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
adviceDefinitionId: item.adviceDefinitionId /** 诊疗定义id */,
|
||||||
adviceDefinitionName: item.adviceName,
|
adviceDefinitionName: item.adviceDefinitionName /** 诊疗定义名称(手术项目名称) */,
|
||||||
quantity: 1,
|
quantity: 1, // /** 请求数量 */
|
||||||
unitCode: item.unitCode,
|
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
||||||
unitPrice: item.price,
|
unitPrice: item.priceList[0].price /** 单价 */,
|
||||||
totalPrice: item.price,
|
totalPrice: item.priceList[0].price /** 总价 */,
|
||||||
positionId: item.positionId,
|
positionId: item.positionId, //执行科室id
|
||||||
definitionId: item.chargeItemDefinitionId,
|
ybClassEnum: item.ybClassEnum, //类别医保编码
|
||||||
accountId: patientInfo.value.accountId,
|
conditionId: item.conditionId, //诊断ID
|
||||||
|
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
||||||
|
adviceType: item.adviceType, ///** 医嘱类型 */
|
||||||
|
definitionId: item.priceList[0].definitionId, //费用定价主表ID */
|
||||||
|
definitionDetailId: item.definitionDetailId, //费用定价子表ID */
|
||||||
|
accountId: patientInfo.value.accountId, // // 账户id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
saveSurgery({
|
saveSurgery({
|
||||||
|
|||||||
@@ -910,9 +910,8 @@ function handleFocus(row, index) {
|
|||||||
// 用 adviceType + categoryCode 组合查找匹配的选项
|
// 用 adviceType + categoryCode 组合查找匹配的选项
|
||||||
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
||||||
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
||||||
// 修复Bug #486:当行没有显式选择医嘱类型时(row.adviceType为undefined),
|
// 当行没有显式选择医嘱类型时,使用已配置的默认categoryCode,确保后端能返回结果
|
||||||
// 不传categoryCode,让搜索在全药库中进行;只有行已选择类型时才用对应categoryCode过滤
|
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
|
||||||
const categoryCode = row.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
|
|
||||||
const searchKey = row.adviceName || '';
|
const searchKey = row.adviceName || '';
|
||||||
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@@ -949,9 +948,8 @@ function handleChange(value) {
|
|||||||
// 用 adviceType + categoryCode 组合查找匹配的选项
|
// 用 adviceType + categoryCode 组合查找匹配的选项
|
||||||
const selectValue = (adviceType == 1 && row?.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
const selectValue = (adviceType == 1 && row?.categoryCode) ? '1-' + row.categoryCode : adviceType;
|
||||||
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
|
||||||
// 修复Bug #486:当行没有显式选择医嘱类型时(row?.adviceType为undefined),
|
// 当行没有显式选择医嘱类型时,使用已配置的默认categoryCode,确保后端能返回结果
|
||||||
// 不传categoryCode,让搜索在全药库中进行;只有行已选择类型时才用对应categoryCode过滤
|
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : (adviceQueryParams.value.categoryCode || '');
|
||||||
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
|
|
||||||
// 修复Bug #453:当adviceType为空字符串或NaN时,不传具体类型,让refresh函数根据searchKey决定搜索范围
|
// 修复Bug #453:当adviceType为空字符串或NaN时,不传具体类型,让refresh函数根据searchKey决定搜索范围
|
||||||
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
|
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
|
||||||
tableRef.refresh(effectiveAdviceType, categoryCode, value);
|
tableRef.refresh(effectiveAdviceType, categoryCode, value);
|
||||||
|
|||||||
@@ -241,6 +241,8 @@ const loading = ref(false);
|
|||||||
const chooseAll = ref(false);
|
const chooseAll = ref(false);
|
||||||
// 独立维护选中行ID集合,避免el-table内部selection状态异常导致联动全选
|
// 独立维护选中行ID集合,避免el-table内部selection状态异常导致联动全选
|
||||||
const selectedRowIds = ref(new Set());
|
const selectedRowIds = ref(new Set());
|
||||||
|
// 跳过选中事件级联:程序化调用 toggleRowSelection 时阻止 handleRowSelect 触发 selectAllCheckboxesInRow
|
||||||
|
const skipSelectCascade = ref(false);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
exeStatus: {
|
exeStatus: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -484,8 +486,13 @@ function handleExecute() {
|
|||||||
if (hasServiceRequest) {
|
if (hasServiceRequest) {
|
||||||
// 仅传入选中医嘱对应的 encounterId,避免其他患者的耗材记录干扰
|
// 仅传入选中医嘱对应的 encounterId,避免其他患者的耗材记录干扰
|
||||||
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
|
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
|
||||||
|
// 仅传入诊疗类医嘱的 requestId,让后端仅校验与本次执行相关的耗材,避免其他未执行医嘱的耗材记录干扰
|
||||||
|
const selectedRequestIds = list
|
||||||
|
.filter((item) => String(item.adviceTable || '') === 'wor_service_request')
|
||||||
|
.map((item) => item.requestId)
|
||||||
|
.filter(Boolean);
|
||||||
if (selectedEncounterIds.length > 0) {
|
if (selectedEncounterIds.length > 0) {
|
||||||
lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true })
|
lotNumberMatch({ encounterIdList: selectedEncounterIds, requestIdList: selectedRequestIds }, { skipErrorMsg: true })
|
||||||
.then((matchRes) => {
|
.then((matchRes) => {
|
||||||
if (matchRes && matchRes.code !== 200) {
|
if (matchRes && matchRes.code !== 200) {
|
||||||
console.warn('lotNumberMatch returned error:', matchRes.msg);
|
console.warn('lotNumberMatch returned error:', matchRes.msg);
|
||||||
@@ -650,6 +657,7 @@ function handleRateChange(value, date, time, row, rateItem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handelSwicthChange(value) {
|
function handelSwicthChange(value) {
|
||||||
|
skipSelectCascade.value = true;
|
||||||
prescriptionList.value.forEach((item, index) => {
|
prescriptionList.value.forEach((item, index) => {
|
||||||
const tableRef = proxy.$refs['tableRef' + index];
|
const tableRef = proxy.$refs['tableRef' + index];
|
||||||
if (tableRef && tableRef[0]) {
|
if (tableRef && tableRef[0]) {
|
||||||
@@ -670,12 +678,15 @@ function handelSwicthChange(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
skipSelectCascade.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认选中全部行
|
// 默认选中全部行
|
||||||
function defaultSelectAllRows() {
|
function defaultSelectAllRows() {
|
||||||
// 清空并重建选中集合
|
// 清空并重建选中集合
|
||||||
selectedRowIds.value.clear();
|
selectedRowIds.value.clear();
|
||||||
|
// 阻止 toggleRowSelection 触发 handleRowSelect 中的 selectAllCheckboxesInRow 级联
|
||||||
|
skipSelectCascade.value = true;
|
||||||
prescriptionList.value.forEach((item, index) => {
|
prescriptionList.value.forEach((item, index) => {
|
||||||
const tableRef = proxy.$refs['tableRef' + index];
|
const tableRef = proxy.$refs['tableRef' + index];
|
||||||
if (tableRef && tableRef[0]) {
|
if (tableRef && tableRef[0]) {
|
||||||
@@ -688,6 +699,7 @@ function defaultSelectAllRows() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
skipSelectCascade.value = false;
|
||||||
// 更新全选开关状态
|
// 更新全选开关状态
|
||||||
chooseAll.value = true;
|
chooseAll.value = true;
|
||||||
}
|
}
|
||||||
@@ -764,6 +776,7 @@ function checkAndToggleRowSelection(row) {
|
|||||||
const isCurrentlySelected = selectedRowIds.value.has(row.requestId);
|
const isCurrentlySelected = selectedRowIds.value.has(row.requestId);
|
||||||
|
|
||||||
// 根据checkbox状态更新表格行选中状态
|
// 根据checkbox状态更新表格行选中状态
|
||||||
|
skipSelectCascade.value = true;
|
||||||
if (isAllSelected && !isCurrentlySelected) {
|
if (isAllSelected && !isCurrentlySelected) {
|
||||||
selectedRowIds.value.add(row.requestId);
|
selectedRowIds.value.add(row.requestId);
|
||||||
tableRef[0].toggleRowSelection(row, true);
|
tableRef[0].toggleRowSelection(row, true);
|
||||||
@@ -771,6 +784,7 @@ function checkAndToggleRowSelection(row) {
|
|||||||
selectedRowIds.value.delete(row.requestId);
|
selectedRowIds.value.delete(row.requestId);
|
||||||
tableRef[0].toggleRowSelection(row, false);
|
tableRef[0].toggleRowSelection(row, false);
|
||||||
}
|
}
|
||||||
|
skipSelectCascade.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -782,8 +796,10 @@ function handleRowSelect(selection, row, tableIndex) {
|
|||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
selectedRowIds.value.add(row.requestId);
|
selectedRowIds.value.add(row.requestId);
|
||||||
// 选中行时,选中该行内部的所有checkbox
|
// 仅在非程序化选中时,联动选中该行内部的所有checkbox
|
||||||
selectAllCheckboxesInRow(row);
|
if (!skipSelectCascade.value) {
|
||||||
|
selectAllCheckboxesInRow(row);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedRowIds.value.delete(row.requestId);
|
selectedRowIds.value.delete(row.requestId);
|
||||||
// 取消选中行时,取消选中该行内部的所有checkbox
|
// 取消选中行时,取消选中该行内部的所有checkbox
|
||||||
|
|||||||
@@ -1131,15 +1131,15 @@ function handleLocationClick(item, row, index) {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
const list = res.data || [];
|
const list = res.data || [];
|
||||||
const d = pickBestOrgQuantityRow(list);
|
const d = pickBestOrgQuantityRow(list);
|
||||||
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
|
|
||||||
if (strictOk) {
|
// 严格批号查询有库存(orgQuantity > 0)
|
||||||
|
if (d && Number(d.orgQuantity ?? 0) > 0) {
|
||||||
applyFromDto(d, false);
|
applyFromDto(d, false);
|
||||||
if (Number(r.totalQuantity) <= 0) {
|
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
|
||||||
}
|
|
||||||
persistStore();
|
persistStore();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 严格查询无库存或数量为0 → 回退到非严格查询(查同仓库其他批号)
|
||||||
if (lotTrimmed) {
|
if (lotTrimmed) {
|
||||||
return runGet(false).then((res2) => {
|
return runGet(false).then((res2) => {
|
||||||
const list2 = res2.data || [];
|
const list2 = res2.data || [];
|
||||||
@@ -1157,6 +1157,8 @@ function handleLocationClick(item, row, index) {
|
|||||||
persistStore();
|
persistStore();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 没有指定批号,直接提示
|
||||||
r.totalQuantity = 0;
|
r.totalQuantity = 0;
|
||||||
r.price = 0;
|
r.price = 0;
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
|
|||||||
@@ -1535,8 +1535,8 @@ function handleMedicalAdvice(row) {
|
|||||||
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
|
|
||||||
// 调用计费接口获取数据
|
// 调用计费接口获取数据(使用手术计费来源参数,匹配 surgery billing 创建的记录)
|
||||||
getPrescriptionList(row.visitId).then((res) => {
|
getPrescriptionList(row.visitId, 6, row.operCode).then((res) => {
|
||||||
console.log('=== 拉取计费数据返回结果 ===', res)
|
console.log('=== 拉取计费数据返回结果 ===', res)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
||||||
@@ -1741,27 +1741,39 @@ function handleTemporaryMedicalSubmit(data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
|
// 🔧 修复 Bug #445: 使用稳定可靠的字段组合匹配已提交项目,从已生成列表中剔除待生成项
|
||||||
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
|
// 匹配键:优先使用 chargeItemId(后端费用项目ID,最可靠),其次使用 名称+规格+数量 组合
|
||||||
const submittedKeys = new Set(
|
const submittedKeys = new Set()
|
||||||
(data.temporaryAdvices || [])
|
const submittedChargeIds = new Set()
|
||||||
.map(a => {
|
|
||||||
const om = a.originalMedicine || {}
|
|
||||||
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
|
||||||
const spec = om.specification || om.volume || ''
|
|
||||||
const qty = om.quantity || 0
|
|
||||||
return `${name}|||${spec}|||${qty}`
|
|
||||||
})
|
|
||||||
.filter(k => k !== '|||0') // 过滤掉空项
|
|
||||||
)
|
|
||||||
|
|
||||||
if (submittedKeys.size > 0) {
|
;(data.temporaryAdvices || []).forEach(a => {
|
||||||
|
const om = a.originalMedicine || {}
|
||||||
|
// 收集 chargeItemId(最可靠的匹配标识)
|
||||||
|
if (om.chargeItemId) {
|
||||||
|
submittedChargeIds.add(om.chargeItemId)
|
||||||
|
}
|
||||||
|
// 构建名称+规格+数量的匹配键(用于无 chargeItemId 的兜底匹配)
|
||||||
|
// 注意:originalMedicine 中的名称字段是 adviceName(来自 billingMedicines.map 时的字段)
|
||||||
|
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
||||||
|
const spec = om.specification || om.volume || ''
|
||||||
|
const qty = om.quantity || 0
|
||||||
|
if (name) {
|
||||||
|
submittedKeys.add(`${name}|||${spec}|||${qty}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (submittedChargeIds.size > 0 || submittedKeys.size > 0) {
|
||||||
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
||||||
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
|
// 优先用 chargeItemId 匹配
|
||||||
|
if (m.chargeItemId && submittedChargeIds.has(m.chargeItemId)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// 兜底用 名称+规格+数量 匹配
|
||||||
|
const key = `${m.medicineName || m.adviceName || ''}|||${m.specification || m.volume || ''}|||${m.quantity || 0}`
|
||||||
return !submittedKeys.has(key)
|
return !submittedKeys.has(key)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
|
// 如果没有任何匹配标识,清空待生成列表(保守策略:认为所有项目都已提交)
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user