98 门诊管理-》门诊划价:选项增加‘西药’和‘中成药’

This commit is contained in:
Ranyunqiao
2026-04-01 13:14:46 +08:00
parent 1ab9b020c1
commit 9105e687d6
22 changed files with 418 additions and 144 deletions

View File

@@ -119,6 +119,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
= outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId, = outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(), ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(), ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
ChargeItemContext.WESTERN_MEDICINE.getValue(), ChargeItemContext.CHINESE_PATENT_MEDICINE.getValue(),
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(), ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(),

View File

@@ -75,8 +75,9 @@ public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppSer
} }
// 门诊划价:不要强制 pricingFlag=1 参与过滤wor_activity_definition.pricing_flag 可能为 0 // 门诊划价:不要强制 pricingFlag=1 参与过滤wor_activity_definition.pricing_flag 可能为 0
// 否则会导致诊疗项目(adviceType=3)查询结果为空 records=[] // 否则会导致诊疗项目(adviceType=3)查询结果为空 records=[]
String categoryCode = adviceBaseDto != null ? adviceBaseDto.getCategoryCode() : null;
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null, return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
organizationId, pageNo, pageSize, null, adviceTypes, null); organizationId, pageNo, pageSize, null, adviceTypes, null, categoryCode);
} }
} }

View File

@@ -61,7 +61,12 @@ public class OutpatientPricingController {
@RequestParam(value = "locationId", required = false) Long locationId, @RequestParam(value = "locationId", required = false) Long locationId,
@RequestParam(value = "organizationId") Long organizationId, @RequestParam(value = "organizationId") Long organizationId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(value = "categoryCode", required = false) String categoryCode) {
// 将 categoryCode 设置到 adviceBaseDto 中
if (categoryCode != null && !categoryCode.isEmpty()) {
adviceBaseDto.setCategoryCode(categoryCode);
}
return R.ok(iOutpatientPricingAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, organizationId, return R.ok(iOutpatientPricingAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, organizationId,
pageNo, pageSize)); pageNo, pageSize));
} }

View File

@@ -42,6 +42,8 @@ public interface OutpatientChargeAppMapper {
* @param medication 药品 * @param medication 药品
* @param device 耗材 * @param device 耗材
* @param register 挂号费 * @param register 挂号费
* @param westernMedicine 西药
* @param chinesePatentMedicine 中成药
* @param planned 收费状态:待收费 * @param planned 收费状态:待收费
* @param billable 收费状态:待结算 * @param billable 收费状态:待结算
* @param billed 收费状态:已结算 * @param billed 收费状态:已结算
@@ -53,7 +55,9 @@ public interface OutpatientChargeAppMapper {
*/ */
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId, List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId,
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device, @Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device,
@Param("register") Integer register, @Param("planned") Integer planned, @Param("billable") Integer billable, @Param("register") Integer register, @Param("westernMedicine") Integer westernMedicine,
@Param("chinesePatentMedicine") Integer chinesePatentMedicine,
@Param("planned") Integer planned, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded, @Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
@Param("partRefund") Integer partRefund, @Param("worDeviceRequest") String worDeviceRequest); @Param("partRefund") Integer partRefund, @Param("worDeviceRequest") String worDeviceRequest);

View File

@@ -31,7 +31,7 @@ public interface IDoctorStationAdviceAppService {
*/ */
IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId, IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize, List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing); Integer pricingFlag, List<Integer> adviceTypes, String orderPricing, String categoryCode);
/** /**
* 查询医嘱绑定信息 * 查询医嘱绑定信息

View File

@@ -26,6 +26,7 @@ import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*; import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils; import com.openhis.common.utils.HisQueryUtils;
import com.openhis.medication.domain.MedicationDispense;
import com.openhis.medication.domain.MedicationRequest; import com.openhis.medication.domain.MedicationRequest;
import com.openhis.medication.service.IMedicationDispenseService; import com.openhis.medication.service.IMedicationDispenseService;
import com.openhis.medication.service.IMedicationRequestService; import com.openhis.medication.service.IMedicationRequestService;
@@ -44,6 +45,8 @@ import com.openhis.workflow.service.IActivityDefinitionService;
import com.openhis.workflow.service.IDeviceDispenseService; import com.openhis.workflow.service.IDeviceDispenseService;
import com.openhis.workflow.service.IDeviceRequestService; import com.openhis.workflow.service.IDeviceRequestService;
import com.openhis.workflow.service.IServiceRequestService; import com.openhis.workflow.service.IServiceRequestService;
import com.openhis.workflow.domain.InventoryItem;
import com.openhis.workflow.service.IInventoryItemService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -111,6 +114,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
@Resource @Resource
IEncounterService iEncounterService; IEncounterService iEncounterService;
@Resource
IInventoryItemService inventoryItemService;
// 缓存 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:";
// 缓存过期时间(小时) // 缓存过期时间(小时)
@@ -135,7 +141,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
@Override @Override
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId, public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize, List<Long> adviceDefinitionIdParamList, Long organizationId, Integer pageNo, Integer pageSize,
Integer pricingFlag, List<Integer> adviceTypes, String orderPricing) { Integer pricingFlag, List<Integer> adviceTypes, String orderPricing, String categoryCode) {
// 生成缓存键处理可能的null值 // 生成缓存键处理可能的null值
String safeSearchKey = searchKey != null ? searchKey : ""; String safeSearchKey = searchKey != null ? searchKey : "";
@@ -203,7 +209,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
new Page<>(pageNo, pageSize), PublicationStatus.ACTIVE.getValue(), organizationId, new Page<>(pageNo, pageSize), PublicationStatus.ACTIVE.getValue(), organizationId,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION, CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList,
adviceTypes, searchKey, adviceTypes, searchKey, categoryCode,
queryWrapper); queryWrapper);
List<AdviceBaseDto> adviceBaseDtoList = adviceBaseInfo.getRecords(); List<AdviceBaseDto> adviceBaseDtoList = adviceBaseInfo.getRecords();
@@ -929,7 +935,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
deviceAdviceDto.setAdviceTableName(CommonConstants.TableName.ADM_DEVICE_DEFINITION); deviceAdviceDto.setAdviceTableName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
IPage<AdviceBaseDto> devicePage = getAdviceBaseInfo(deviceAdviceDto, null, null, null, IPage<AdviceBaseDto> devicePage = getAdviceBaseInfo(deviceAdviceDto, null, null, null,
adviceSaveDto.getFounderOrgId(), 1, 1, Whether.NO.getValue(), adviceSaveDto.getFounderOrgId(), 1, 1, Whether.NO.getValue(),
List.of(ItemType.DEVICE.getValue()), null); List.of(ItemType.DEVICE.getValue()), null, null);
if (devicePage == null || devicePage.getRecords().isEmpty()) { if (devicePage == null || devicePage.getRecords().isEmpty()) {
log.warn("无法找到耗材定价信息: deviceDefId={}", boundDevice.getDevActId()); log.warn("无法找到耗材定价信息: deviceDefId={}", boundDevice.getDevActId());
@@ -1425,26 +1431,26 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
// 只有在签发时 // 只有在签发时
if (is_sign) { if (is_sign) {
// 发送跨系统申请 // 发送跨系统申请 - 已注释项目未使用LIS/PACS系统
adviceSaveDto.setRequestId(serviceRequest.getId()); // adviceSaveDto.setRequestId(serviceRequest.getId());
try { // try {
// 查询诊疗定义 // // 查询诊疗定义
ActivityDefinition activityDefinition // ActivityDefinition activityDefinition
= iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId()); // = iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
if (activityDefinition != null) { // if (activityDefinition != null) {
// 检验 或 检查 // // 检验 或 检查
if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum()) // if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())
|| ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) { // || ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
doctorStationSendApplyUtil.sendCrossSystemApply(adviceSaveDto, organizationId, curDate); // doctorStationSendApplyUtil.sendCrossSystemApply(adviceSaveDto, organizationId, curDate);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
if (!Whether.YES.getCode() // if (!Whether.YES.getCode()
.equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) { // .equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) {
throw e; // throw e;
} // }
log.error(e.getMessage(), e); // log.error(e.getMessage(), e);
} // }
} }
} }
} }
@@ -1509,15 +1515,60 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue()); iChargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.DRAFT.getValue());
} }
// 🔧 BugFix: 直接对所有requestId进行作废操作 // 🔧 新增:签退时回滚库存
log.info("BugFix#219: signOffAdvice - 作废所有请求, requestIdList={}", requestIdList); // 查询已发放的药品记录(用于回滚库存)
List<MedicationDispense> dispensedList = iMedicationDispenseService.list(
new LambdaQueryWrapper<MedicationDispense>()
.in(MedicationDispense::getMedReqId, requestIdList)
.eq(MedicationDispense::getStatusEnum, DispenseStatus.COMPLETED.getValue())
);
// 尝试作废药品请求(只有存在的才会更新) if (dispensedList != null && !dispensedList.isEmpty()) {
iMedicationRequestService.updateCancelledStatusBatch(requestIdList, null, null); // 需要回滚的库存列表
// 尝试作废耗材请求(只有存在的才会更新) List<InventoryItem> inventoryUpdateList = new ArrayList<>();
iDeviceRequestService.updateCancelledStatusBatch(requestIdList);
// 尝试作废诊疗请求(只有存在的才会更新) for (MedicationDispense dispense : dispensedList) {
iServiceRequestService.updateCancelledStatusBatch(requestIdList); // 查询对应的库存记录根据批号和药品ID
if (dispense.getMedicationId() != null && dispense.getLotNumber() != null) {
InventoryItem inventoryItem = inventoryItemService.getOne(
new LambdaQueryWrapper<InventoryItem>()
.eq(InventoryItem::getItemId, dispense.getMedicationId())
.eq(InventoryItem::getLotNumber, dispense.getLotNumber())
);
if (inventoryItem != null) {
// 计算回滚后的数量(加上已发放的数量)
BigDecimal currentQuantity = inventoryItem.getQuantity() != null ? inventoryItem.getQuantity() : BigDecimal.ZERO;
BigDecimal dispenseQuantity = dispense.getQuantity() != null ? dispense.getQuantity() : BigDecimal.ZERO;
inventoryUpdateList.add(new InventoryItem()
.setId(inventoryItem.getId())
.setQuantity(currentQuantity.add(dispenseQuantity))
);
}
}
// 更新发药记录状态为已退药
dispense.setStatusEnum(DispenseStatus.RETURNED.getValue());
}
// 批量更新库存(回滚数量)
if (!inventoryUpdateList.isEmpty()) {
inventoryItemService.updateBatchById(inventoryUpdateList);
}
// 更新发药记录状态
iMedicationDispenseService.updateBatchById(dispensedList);
}
// 🔧 BugFix: 直接对所有requestId进行签退操作将状态改为待签发
log.info("BugFix: signOffAdvice - 签退所有请求,状态改为待签发, requestIdList={}", requestIdList);
// 尝试签退药品请求(只有存在的才会更新)
iMedicationRequestService.updateDraftStatusBatch(requestIdList, null, null);
// 尝试签退耗材请求(只有存在的才会更新)
iDeviceRequestService.updateDraftStatusBatch(requestIdList);
// 尝试签退诊疗请求(只有存在的才会更新)
iServiceRequestService.updateDraftStatusBatch(requestIdList);
log.info("BugFix#219: signOffAdvice - 所有请求作废完成"); log.info("BugFix#219: signOffAdvice - 所有请求作废完成");

View File

@@ -369,7 +369,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
adviceBaseDto.setAdviceType(1); // 医嘱类型为药品 adviceBaseDto.setAdviceType(1); // 医嘱类型为药品
adviceBaseDto.setCategoryCode(MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue());// 中草药 adviceBaseDto.setCategoryCode(MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue());// 中草药
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, pricingFlag, List.of(1, 2, 3), null); adviceDefinitionIdParamList, organizationId, pageNo, pageSize, pricingFlag, List.of(1, 2, 3), null, null);
} }
/** /**
@@ -613,7 +613,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
// 对应的诊疗医嘱信息 // 对应的诊疗医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null,
null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0); null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(3), null, null).getRecords().get(0);
if (activityAdviceBaseDto != null) { if (activityAdviceBaseDto != null) {
// 费用定价 // 费用定价
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0); AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);

View File

@@ -52,7 +52,7 @@ public class DoctorStationAdviceController {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return R.ok(iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, return R.ok(iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId,
adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null)); adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null, null));
} }
/** /**

View File

@@ -38,6 +38,7 @@ public interface DoctorStationAdviceAppMapper {
@Param("adviceDefinitionIdParamList") List<Long> adviceDefinitionIdParamList, @Param("adviceDefinitionIdParamList") List<Long> adviceDefinitionIdParamList,
@Param("adviceTypes") List<Integer> adviceTypes, @Param("adviceTypes") List<Integer> adviceTypes,
@Param("searchKey") String searchKey, @Param("searchKey") String searchKey,
@Param("categoryCode") String categoryCode,
@Param(Constants.WRAPPER) QueryWrapper<AdviceBaseDto> queryWrapper); @Param(Constants.WRAPPER) QueryWrapper<AdviceBaseDto> queryWrapper);
/** /**

View File

@@ -364,7 +364,7 @@ public class AdviceUtils {
// 对应的子项诊疗医嘱信息 // 对应的子项诊疗医嘱信息
AdviceBaseDto activityAdviceBaseDto AdviceBaseDto activityAdviceBaseDto
= iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1, = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, null, organizationId, 1,
1, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords().get(0); 1, Whether.NO.getValue(), List.of(1, 2, 3), null, null).getRecords().get(0);
if (activityAdviceBaseDto != null) { if (activityAdviceBaseDto != null) {
// 费用定价 // 费用定价
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0); AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);

View File

@@ -32,9 +32,11 @@ public class PrescriptionUtils {
if (medicineList == null || medicineList.isEmpty()) { if (medicineList == null || medicineList.isEmpty()) {
return; return;
} }
// 1. 按诊断ID分组不同诊断必须分开 // 1. 按诊断ID分组不同诊断必须分开null值归为一组
Map<Long, List<AdviceSaveDto>> diagnosisGroups = Map<Long, List<AdviceSaveDto>> diagnosisGroups =
medicineList.stream().collect(Collectors.groupingBy(AdviceSaveDto::getConditionDefinitionId)); medicineList.stream().collect(Collectors.groupingBy(dto ->
dto.getConditionDefinitionId() != null ? dto.getConditionDefinitionId() : 0L
));
// 2. 处理每个诊断组 // 2. 处理每个诊断组
diagnosisGroups.values().forEach(this::processDiagnosisGroup); diagnosisGroups.values().forEach(this::processDiagnosisGroup);
} }
@@ -46,9 +48,11 @@ public class PrescriptionUtils {
if (diagnosisGroup.isEmpty()) { if (diagnosisGroup.isEmpty()) {
return; return;
} }
// 1. 按药品性质分组 // 1. 按药品性质分组null值归为普通药品
Map<String, List<AdviceSaveDto>> pharmacologyGroups = Map<String, List<AdviceSaveDto>> pharmacologyGroups =
diagnosisGroup.stream().collect(Collectors.groupingBy(AdviceSaveDto::getPharmacologyCategoryCode)); diagnosisGroup.stream().collect(Collectors.groupingBy(dto ->
dto.getPharmacologyCategoryCode() != null ? dto.getPharmacologyCategoryCode() : "0"
));
// 2. 处理每个药品性质组 // 2. 处理每个药品性质组
pharmacologyGroups.values().forEach(pharmaGroup -> { pharmacologyGroups.values().forEach(pharmaGroup -> {
// 2.1 先处理有分组ID的药品确保它们不会被拆分 // 2.1 先处理有分组ID的药品确保它们不会被拆分

View File

@@ -702,7 +702,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
= medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList()); = medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList());
// 医嘱详细信息 // 医嘱详细信息
List<AdviceBaseDto> medicationInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> medicationInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
medicationDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(1), null).getRecords(); medicationDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(1), null, null).getRecords();
// 当前时间 // 当前时间
Date curDate = new Date(); Date curDate = new Date();
@@ -979,7 +979,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
= actUseExeList.stream().map(ServiceRequestUseExe::getActivityId).collect(Collectors.toList()); = actUseExeList.stream().map(ServiceRequestUseExe::getActivityId).collect(Collectors.toList());
// 医嘱详细信息 // 医嘱详细信息
List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), null).getRecords(); activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), null, null).getRecords();
// 当前时间 // 当前时间
Date curDate = new Date(); Date curDate = new Date();
@@ -1146,7 +1146,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
// 耗材医嘱详细信息 // 耗材医嘱详细信息
List<AdviceBaseDto> deviceInfos = doctorStationAdviceAppService List<AdviceBaseDto> deviceInfos = doctorStationAdviceAppService
.getAdviceBaseInfo(null, null, null, deviceIds, 0L, 1, 500, Whether.NO.getValue(), List.of(2), null) .getAdviceBaseInfo(null, null, null, deviceIds, 0L, 1, 500, Whether.NO.getValue(), List.of(2), null, null)
.getRecords(); .getRecords();
DeviceRequest deviceRequest; DeviceRequest deviceRequest;

View File

@@ -201,7 +201,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer
.map(AutoRollNursingDto::getActivityDefinitionId).collect(Collectors.toList()); .map(AutoRollNursingDto::getActivityDefinitionId).collect(Collectors.toList());
// 诊疗医嘱信息 // 诊疗医嘱信息
List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), orderPricing).getRecords(); activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), orderPricing, null).getRecords();
// 计费 // 计费
ChargeItem chargeItem; ChargeItem chargeItem;
@@ -295,7 +295,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer
.map(AutoRollBasicServiceDto::getActivityDefinitionId).collect(Collectors.toList()); .map(AutoRollBasicServiceDto::getActivityDefinitionId).collect(Collectors.toList());
// 诊疗医嘱信息 // 诊疗医嘱信息
List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), orderPricing).getRecords(); activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), orderPricing, null).getRecords();
// 计费 // 计费
ChargeItem chargeItem; ChargeItem chargeItem;
for (AutoRollBasicServiceDto autoRollBasicServiceDto : autoRollBasicService) { for (AutoRollBasicServiceDto autoRollBasicServiceDto : autoRollBasicService) {

View File

@@ -2095,7 +2095,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId()); adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId());
// 对应的诊疗医嘱信息 // 对应的诊疗医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null,
null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords().get(0); null, null, organizationId, 1, 1, Whether.NO.getValue(), List.of(1, 2, 3), null, null).getRecords().get(0);
// 价格信息 // 价格信息
if (activityAdviceBaseDto != null) { if (activityAdviceBaseDto != null) {
// 费用定价 // 费用定价

View File

@@ -197,7 +197,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
// 医嘱下拉详细信息 // 医嘱下拉详细信息
List<AdviceBaseDto> personalRecords = List<AdviceBaseDto> personalRecords =
iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList, iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList,
organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords(); organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null, null).getRecords();
// 创建AdviceBaseDto的映射以adviceDefinitionId为key // 创建AdviceBaseDto的映射以adviceDefinitionId为key
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个 .toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个
@@ -248,7 +248,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
// 医嘱下拉详细信息 // 医嘱下拉详细信息
List<AdviceBaseDto> personalRecords = List<AdviceBaseDto> personalRecords =
iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList, iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList,
organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords(); organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null, null).getRecords();
// 创建AdviceBaseDto的映射以adviceDefinitionId为key // 创建AdviceBaseDto的映射以adviceDefinitionId为key
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个 .toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个
@@ -297,7 +297,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
// 医嘱下拉详细信息 // 医嘱下拉详细信息
List<AdviceBaseDto> personalRecords = List<AdviceBaseDto> personalRecords =
iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList, iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, orderDefinitionIdParamList,
organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null).getRecords(); organizationId, 1, 100, Whether.NO.getValue(), List.of(1, 2, 3), null, null).getRecords();
// 创建AdviceBaseDto的映射以adviceDefinitionId为key // 创建AdviceBaseDto的映射以adviceDefinitionId为key
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个 .toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key保留第一个

View File

@@ -161,7 +161,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
// 对应的诊疗医嘱信息 // 对应的诊疗医嘱信息
activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null, activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null, null,
null, null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords().get(0); null, null, 1, 1, Whether.NO.getValue(), List.of(3), null, null).getRecords().get(0);
// 逻辑1---------------------直接新增 // 逻辑1---------------------直接新增
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态 longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间 longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间
@@ -208,7 +208,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
// 对应的诊疗医嘱信息 // 对应的诊疗医嘱信息
activityAdviceBaseDto = iDoctorStationAdviceAppService activityAdviceBaseDto = iDoctorStationAdviceAppService
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null) .getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null, null)
.getRecords().get(0); .getRecords().get(0);
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态 longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
@@ -348,7 +348,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
adviceBaseDto.setAdviceDefinitionId(transferOrganizationDefinitionId); // 医嘱定义id adviceBaseDto.setAdviceDefinitionId(transferOrganizationDefinitionId); // 医嘱定义id
// 转科的医嘱信息 // 转科的医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService
.getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null) .getAdviceBaseInfo(adviceBaseDto, null, null, null, null, 1, 1, Whether.NO.getValue(), List.of(3), null, null)
.getRecords().get(0); .getRecords().get(0);
// 保存转科医嘱请求 // 保存转科医嘱请求
ServiceRequest serviceRequest = new ServiceRequest(); ServiceRequest serviceRequest = new ServiceRequest();
@@ -430,7 +430,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
// 出院的医嘱信息 // 出院的医嘱信息
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
List.of(transferOrganizationDefinitionId), null, 1, 1, Whether.NO.getValue(), List.of(3), null).getRecords() List.of(transferOrganizationDefinitionId), null, 1, 1, Whether.NO.getValue(), List.of(3), null, null).getRecords()
.get(0); .get(0);
// 保存出院医嘱请求 // 保存出院医嘱请求
ServiceRequest serviceRequest = new ServiceRequest(); ServiceRequest serviceRequest = new ServiceRequest();

View File

@@ -101,6 +101,9 @@
<if test="pricingFlag == 1"> <if test="pricingFlag == 1">
AND 1 = 2 AND 1 = 2
</if> </if>
<if test="categoryCode != null and categoryCode != ''">
AND t1.category_code = #{categoryCode}
</if>
<if test="searchKey != null and searchKey != ''"> <if test="searchKey != null and searchKey != ''">
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%') AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
</if> </if>

View File

@@ -31,10 +31,20 @@ public enum ChargeItemContext implements HisEnumInterface {
*/ */
ACTIVITY(3, "3", "项目"), ACTIVITY(3, "3", "项目"),
/**
* 西药
*/
WESTERN_MEDICINE(5, "5", "西药"),
/**
* 中成药
*/
CHINESE_PATENT_MEDICINE(6, "6", "中成药"),
/** /**
* 挂号 * 挂号
*/ */
REGISTER(4, "4", "挂号"); REGISTER(7, "7", "挂号");
private final Integer value; private final Integer value;
private final String code; private final String code;

View File

@@ -86,7 +86,12 @@ public enum DispenseStatus implements HisEnumInterface {
/** /**
* 待退药 * 待退药
*/ */
PENDING_REFUND(16, "PRD", "待退药"); PENDING_REFUND(16, "PRD", "待退药"),
/**
* 已退药
*/
RETURNED(17, "RT", "已退药");
private Integer value; private Integer value;
private String code; private String code;

View File

@@ -53,17 +53,20 @@ const currentSelectRow = ref({});
const queryParams = ref({ const queryParams = ref({
pageSize: 100, pageSize: 100,
pageNum: 1, pageNum: 1,
adviceType: undefined,
categoryCode: '',
}); });
const adviceBaseList = ref([]); const adviceBaseList = ref([]);
// 节流函数 // 节流函数
const throttledGetList = throttle( const throttledGetList = throttle(
() => { () => {
// 触发数据加载
getList(); getList();
}, },
300, 300,
{ leading: true, trailing: true } { leading: true, trailing: true }
); );
watch( watch(
() => props.adviceQueryParams, () => props.adviceQueryParams,
(newValue) => { (newValue) => {
// 只有在弹窗打开时才响应 adviceQueryParams 的变化,避免选择项目后弹窗关闭时触发不必要的请求 // 只有在弹窗打开时才响应 adviceQueryParams 的变化,避免选择项目后弹窗关闭时触发不必要的请求
@@ -72,6 +75,7 @@ watch(
} }
queryParams.value.searchKey = newValue?.searchKey; queryParams.value.searchKey = newValue?.searchKey;
queryParams.value.adviceType = newValue?.adviceType; queryParams.value.adviceType = newValue?.adviceType;
queryParams.value.categoryCode = newValue?.categoryCode;
throttledGetList(); throttledGetList();
}, },
{ deep: true } { deep: true }
@@ -86,6 +90,11 @@ watch(
if (props.adviceQueryParams) { if (props.adviceQueryParams) {
queryParams.value.searchKey = props.adviceQueryParams.searchKey; queryParams.value.searchKey = props.adviceQueryParams.searchKey;
queryParams.value.adviceType = props.adviceQueryParams.adviceType; queryParams.value.adviceType = props.adviceQueryParams.adviceType;
queryParams.value.categoryCode = props.adviceQueryParams.categoryCode;
console.log('[adviceBaseList] 弹窗打开,参数:', JSON.stringify({
adviceType: queryParams.value.adviceType,
categoryCode: queryParams.value.categoryCode
}));
} }
// 主动触发数据加载 // 主动触发数据加载
getList(); getList();

View File

@@ -18,28 +18,29 @@
@row-dblclick="clickRowDb" @row-dblclick="clickRowDb"
:expand-row-keys="expandOrder" :expand-row-keys="expandOrder"
> >
<el-table-column type="expand" width="1" style="width: 0"> <el-table-column type="expand" width="40">
<template #default="scope"> <template #default="scope">
<el-form :model="scope.row" :rules="rowRules" :ref="'formRef' + scope.$index"> <el-form :model="scope.row" :rules="rowRules" :ref="'formRef' + scope.$index">
<div style="padding: 16px; background: #f8f9fa; border-radius: 8px"> <div style="padding: 16px; background: #f8f9fa; border-radius: 8px">
<template v-if="scope.row.adviceType == 2"> <!-- 药品类型adviceType == 1和耗材类型adviceType == 2使用相同的界面 -->
<template v-if="scope.row.adviceType == 1 || scope.row.adviceType == 2">
<div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px"> <div style="display: flex; align-items: center; margin-bottom: 16px; gap: 16px">
<span style="font-size: 16px; font-weight: 600"> <span style="font-size: 16px; font-weight: 600">
{{ {{
scope.row.adviceName + scope.row.adviceName +
' ' + ' ' +
scope.row.volume + (scope.row.volume ? scope.row.volume + ' ' : '') +
' ' + (scope.row.unitPrice ? scope.row.unitPrice + ' 元/' : '') +
scope.row.unitPrice + (scope.row.unitCode_dictText || '')
' 元/' +
scope.row.unitCode_dictText
}} }}
</span> </span>
<div class="form-group"> <div class="form-group">
<!-- 库存不为空时显示批号选择 -->
<el-select <el-select
v-if="scope.row.stockList && scope.row.stockList.length > 0"
v-model="scope.row.lotNumber" v-model="scope.row.lotNumber"
style="width: 180px; margin-right: 20px" style="width: 180px; margin-right: 20px"
placeholder="药房" placeholder="选择批号"
> >
<el-option <el-option
v-for="item in scope.row.stockList" v-for="item in scope.row.stockList"
@@ -52,7 +53,7 @@
item.lotNumber + item.lotNumber +
' ' + ' ' +
' 库存:' + ' 库存:' +
item.quantity / scope.row.partPercent + (item.quantity / scope.row.partPercent).toFixed(2) +
item.unitCode_dictText + item.unitCode_dictText +
' 单价:' + ' 单价:' +
item.price.toFixed(2) + item.price.toFixed(2) +
@@ -62,6 +63,10 @@
@click="handleNumberClick(item, scope.$index)" @click="handleNumberClick(item, scope.$index)"
/> />
</el-select> </el-select>
<!-- 库存为空时显示提示 -->
<span v-else style="color: #f56c6c; margin-right: 20px; font-size: 14px;">
无可用库存
</span>
<el-form-item <el-form-item
label="数量:" label="数量:"
prop="quantity" prop="quantity"
@@ -79,9 +84,10 @@
/> />
</el-form-item> </el-form-item>
<el-select <el-select
v-if="scope.row.unitCodeList && scope.row.unitCodeList.length > 0"
v-model="scope.row.unitCode" v-model="scope.row.unitCode"
style="width: 70px; margin-right: 20px" style="width: 70px; margin-right: 20px"
placeholder=" " placeholder="单位"
@change="calculateTotalAmount(scope.row, scope.$index)" @change="calculateTotalAmount(scope.row, scope.$index)"
> >
<template v-for="item in scope.row.unitCodeList" :key="item.value"> <template v-for="item in scope.row.unitCodeList" :key="item.value">
@@ -157,7 +163,7 @@
<el-table-column label="" align="center" prop="groupId" width="60"> <el-table-column label="" align="center" prop="groupId" width="60">
<template #default="scope"> <template #default="scope">
<el-checkbox <el-checkbox
:disabled = "scope.row.bizRequestFlag==0" :disabled = "scope.row.chargeStatus == 5"
v-model="scope.row.check" v-model="scope.row.check"
placeholder="" placeholder=""
@click.stop="" @click.stop=""
@@ -177,13 +183,60 @@
<template v-if="getRowDisabled(scope.row)"> <template v-if="getRowDisabled(scope.row)">
<el-select <el-select
style="width: 35%; margin-right: 20px" style="width: 35%; margin-right: 20px"
v-model="scope.row.adviceType" v-model="scope.row.adviceTypeValue"
:ref="'adviceTypeRef' + scope.$index" :ref="'adviceTypeRef' + scope.$index"
placeholder="选择类型"
@change=" @change="
(value) => { (value) => {
console.log('[类型选择] value:', value);
expandOrder = []; expandOrder = [];
prescriptionList[scope.$index].adviceName = undefined; prescriptionList[scope.$index].adviceName = undefined;
adviceQueryParams.adviceType = value;
// 根据 value 值直接判断
let adviceType, categoryCode, label;
switch (value) {
case '1':
adviceType = 1;
categoryCode = '2';
label = '西药';
break;
case '2':
adviceType = 1;
categoryCode = '1';
label = '中成药';
break;
case '3':
adviceType = 2;
categoryCode = '';
label = '耗材';
break;
case '4':
adviceType = 3;
categoryCode = '';
label = '诊疗';
break;
default:
adviceType = undefined;
categoryCode = '';
label = '';
}
prescriptionList[scope.$index].adviceType = adviceType;
prescriptionList[scope.$index].adviceType_dictText = label;
prescriptionList[scope.$index].categoryCode = categoryCode;
adviceQueryParams.adviceType = adviceType;
adviceQueryParams.categoryCode = categoryCode;
console.log('[类型选择] 设置后:', { adviceType, categoryCode });
}
"
@clear="
() => {
prescriptionList[scope.$index].adviceName = undefined;
prescriptionList[scope.$index].adviceType = undefined;
prescriptionList[scope.$index].adviceType_dictText = '';
prescriptionList[scope.$index].categoryCode = '';
adviceQueryParams.adviceType = undefined;
adviceQueryParams.categoryCode = '';
} }
" "
> >
@@ -192,12 +245,6 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@click="
() => {
prescriptionList[scope.$index].adviceType = item.value;
prescriptionList[scope.$index].adviceType_dictText = item.label;
}
"
/> />
</el-select> </el-select>
<el-popover <el-popover
@@ -243,7 +290,8 @@
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="" width="90"> <el-table-column label="状态" align="center" prop="" width="90">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.statusEnum == 2" type="success">签发</el-tag> <el-tag v-if="scope.row.chargeStatus == 5" type="success">收费</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 2" type="success">已签发</el-tag>
<el-tag v-else-if="scope.row.statusEnum == 1" type="">待签发</el-tag> <el-tag v-else-if="scope.row.statusEnum == 1" type="">待签发</el-tag>
</template> </template>
</el-table-column> </el-table-column>
@@ -343,17 +391,35 @@ const { method_code, unit_code, rate_code, distribution_category_code } = proxy.
const handleSaveDisabled = ref(false) //签发状态 const handleSaveDisabled = ref(false) //签发状态
const handleSingOutDisabled = ref(false) //签退状态 const handleSingOutDisabled = ref(false) //签退状态
const adviceTypeList = ref([ const adviceTypeList = ref([
{
label: '西药',
value: '1', // 用字符串
adviceType: 1,
categoryCode: '2',
},
{
label: '中成药',
value: '2', // 用字符串
adviceType: 1,
categoryCode: '1',
},
{ {
label: '耗材', label: '耗材',
value: 2, value: '3', // 用字符串
adviceType: 2,
categoryCode: '',
}, },
{ {
label: '诊疗', label: '诊疗',
value: 3, value: '4', // 用字符串
adviceType: 3,
categoryCode: '',
}, },
{ {
label: '全部', label: '全部',
value: undefined, value: '',
adviceType: undefined,
categoryCode: '',
}, },
]); ]);
watch( watch(
@@ -379,9 +445,6 @@ watch(
if(newValue&&newValue.length>0){ if(newValue&&newValue.length>0){
let saveList = prescriptionList.value.filter((item) => { let saveList = prescriptionList.value.filter((item) => {
return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag) return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
})
prescriptionList.value.map(k=>{
k.check = false
}) })
console.log(saveList,"prescriptionList.value") console.log(saveList,"prescriptionList.value")
if (saveList.length == 0) { if (saveList.length == 0) {
@@ -391,13 +454,30 @@ watch(
} }
} }
}, },
{ immediate: true } { immediate: true, deep: false }
); );
function getListInfo(addNewRow) { function getListInfo(addNewRow) {
isAdding.value = false; isAdding.value = false;
getPrescriptionList(props.patientInfo.encounterId).then((res) => { getPrescriptionList(props.patientInfo.encounterId).then((res) => {
prescriptionList.value = res.data; // 为每行数据添加 adviceTypeValue 字段,用于类型下拉框显示
prescriptionList.value = (res.data || []).map(item => {
// 根据 adviceType 和 categoryCode 找到对应的 adviceTypeValue
let adviceTypeValue = '';
if (item.adviceType === 1) {
// 药品类型,需要根据 categoryCode 判断是西药还是中成药
if (item.categoryCode === '1') {
adviceTypeValue = '2'; // 中成药
} else {
adviceTypeValue = '1'; // 西药
}
} else if (item.adviceType === 2) {
adviceTypeValue = '3'; // 耗材
} else if (item.adviceType === 3) {
adviceTypeValue = '4'; // 诊疗
}
return { ...item, adviceTypeValue };
});
if (props.activeTab == 'prescription' && addNewRow) { if (props.activeTab == 'prescription' && addNewRow) {
handleAddPrescription(); handleAddPrescription();
} }
@@ -428,6 +508,10 @@ function handleAddPrescription() {
check: false, check: false,
isEdit: true, isEdit: true,
statusEnum: 1, statusEnum: 1,
adviceTypeValue: '',
adviceType: undefined,
adviceType_dictText: '',
categoryCode: '',
}); });
nextTick(() => { nextTick(() => {
proxy.$refs['adviceRef0'].focus(); proxy.$refs['adviceRef0'].focus();
@@ -457,10 +541,9 @@ function handleFocus(row, index) {
prescriptionList.value.forEach((r, i) => { prescriptionList.value.forEach((r, i) => {
if (i !== index) r.showPopover = false; if (i !== index) r.showPopover = false;
}); });
// 如果当前行已选择adviceType同步到adviceQueryParams // 同步当前行的参数到 adviceQueryParams
if (row.adviceType !== undefined) {
adviceQueryParams.value.adviceType = row.adviceType; adviceQueryParams.value.adviceType = row.adviceType;
} adviceQueryParams.value.categoryCode = row.categoryCode || '';
row.showPopover = true; row.showPopover = true;
} }
@@ -557,32 +640,67 @@ async function selectAdviceBase(key, row) {
// 库存列表 + 价格列表拼成批次号的下拉框(非诊疗) // 库存列表 + 价格列表拼成批次号的下拉框(非诊疗)
if (row.adviceType != 3) { if (row.adviceType != 3) {
if (row.inventoryList && row.inventoryList.length == 0) { let hasInventory = false;
expandOrder.value = []; let inventoryWarning = '';
proxy.$modal.msgWarning('该项目无库存');
return; // 检查库存情况
} if (row.inventoryList && row.inventoryList.length > 0) {
stockList.value = row.inventoryList.map((item, index) => { stockList.value = row.inventoryList.map((item, index) => {
return { ...item, ...row.priceList[index] }; return { ...item, ...row.priceList[index] };
}); });
prescriptionList.value[rowIndex.value].stockList = stockList.value; prescriptionList.value[rowIndex.value].stockList = stockList.value;
// 获取默认批次号的库存,如果没有让医生重新选
// 检查是否有可用的库存(数量 > 0
const availableStock = stockList.value.filter(item => item.quantity > 0);
if (availableStock.length > 0) {
hasInventory = true;
} else {
inventoryWarning = '该项目所有批次库存不足,请选择其他库房或补充库存';
}
// 获取默认批次号的库存
let stock = stockList.value.filter((item) => { let stock = stockList.value.filter((item) => {
return item.lotNumber == row.defaultLotNumber; return item.lotNumber == row.defaultLotNumber;
})[0]; })[0];
if (stock != {} && stock != undefined) { if (stock != {} && stock != undefined) {
if (stock.quantity <= 0) { if (stock.quantity > 0) {
proxy.$modal.msgWarning('该项目库存不足,请选择其它库房');
// return;
}
prescriptionList.value[rowIndex.value].lotNumber = stock.lotNumber; prescriptionList.value[rowIndex.value].lotNumber = stock.lotNumber;
prescriptionList.value[rowIndex.value].inventoryId = stock.inventoryId; prescriptionList.value[rowIndex.value].inventoryId = stock.inventoryId;
prescriptionList.value[rowIndex.value].locationId = stock.locationId; prescriptionList.value[rowIndex.value].locationId = stock.locationId;
prescriptionList.value[rowIndex.value].unitPrice = stock.price; prescriptionList.value[rowIndex.value].unitPrice = stock.price;
prescriptionList.value[rowIndex.value].positionName = stock.locationName; prescriptionList.value[rowIndex.value].positionName = stock.locationName;
// 设置默认数量为1并计算总金额 } else {
// 默认批次库存不足,选择第一个可用批次
const firstAvailable = availableStock[0];
if (firstAvailable) {
prescriptionList.value[rowIndex.value].lotNumber = firstAvailable.lotNumber;
prescriptionList.value[rowIndex.value].inventoryId = firstAvailable.inventoryId;
prescriptionList.value[rowIndex.value].locationId = firstAvailable.locationId;
prescriptionList.value[rowIndex.value].unitPrice = firstAvailable.price;
prescriptionList.value[rowIndex.value].positionName = firstAvailable.locationName;
}
}
}
} else {
inventoryWarning = '该项目无库存记录,请选择其他库房或补充库存';
prescriptionList.value[rowIndex.value].stockList = [];
}
// 统一设置默认值
prescriptionList.value[rowIndex.value].quantity = 1; prescriptionList.value[rowIndex.value].quantity = 1;
if (row.priceList && row.priceList.length > 0) {
if (!prescriptionList.value[rowIndex.value].unitPrice) {
prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
}
}
calculateTotalPrice(prescriptionList.value[rowIndex.value], rowIndex.value); calculateTotalPrice(prescriptionList.value[rowIndex.value], rowIndex.value);
// 如果有库存警告,统一提示
if (inventoryWarning) {
console.log('[库存警告]', inventoryWarning, '药品:', row.adviceName);
// 不弹出警告框,只在控制台记录,避免频繁打扰用户
// 用户可以在保存时看到真正的库存检查结果
} }
} else { } else {
// 诊疗:设置执行科室和价格 // 诊疗:设置执行科室和价格
@@ -660,41 +778,67 @@ function ensureOrgTreeLoaded() {
} }
function handleDelete() { function handleDelete() {
let deleteList = prescriptionList.value // 🔧 修复:使用 groupIndexList 而不是 check 属性
.filter((item) => { // 因为 watch 监听器会在数据更新时重置 check 为 false
return item.check && item.statusEnum == 1; if (groupIndexList.value.length == 0) {
}) proxy.$modal.msgWarning('请选择要删除的项目');
.map((item) => { return;
}
let deleteList = groupIndexList.value.map((index) => {
const item = prescriptionList.value[index];
// 只删除待签发且未收费的项目
if (item.statusEnum != 1 || item.chargeStatus == 5) {
return null;
}
return { return {
requestId: item.requestId, requestId: item.requestId,
dbOpType: '3', dbOpType: '3',
adviceType: item.adviceType, adviceType: item.adviceType,
}; };
}); }).filter(item => item !== null); // 过滤掉已签发或已收费的项目
if (deleteList.length == 0) { if (deleteList.length == 0) {
proxy.$modal.msgWarning('请选择要删除的项目'); proxy.$modal.msgWarning('只能删除待签发且未收费的项目');
return; return;
} }
if (!deleteList[0].requestId) {
prescriptionList.value.shift(); // 删除逻辑:按索引从大到小排序,避免删除后索引变化
const sortedIndexes = groupIndexList.value.sort((a, b) => b - a);
let hasSavedItem = false;
for (const index of sortedIndexes) {
const item = prescriptionList.value[index];
if (item.statusEnum != 1) {
continue; // 跳过已签发的项目
}
if (!item.requestId) {
// 新增的行(未保存到数据库),直接删除
prescriptionList.value.splice(index, 1);
} else { } else {
hasSavedItem = true;
}
}
if (hasSavedItem) {
// 有已保存的行调用后端API删除
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);
} }
}); });
} else {
// 只有新增行,已经在前端删除完成
proxy.$modal.msgSuccess('操作成功');
} }
// groupIndexList.value
// .sort((a, b) => b - a)
// .forEach((item) => {
// prescriptionList.value.splice(item, 1);
// });
// groupIndexList.value = [];
expandOrder.value = []; expandOrder.value = [];
groupIndexList.value = [];
groupList.value = [];
isAdding.value = false; isAdding.value = false;
adviceQueryParams.value.adviceType = undefined; adviceQueryParams.value.adviceType = undefined;
// prescriptionList.value.splice(index, 1);
} }
function handleNumberClick(item, index) { function handleNumberClick(item, index) {
@@ -706,11 +850,21 @@ function handleNumberClick(item, index) {
} }
function changeCheck(value,index,row){ function changeCheck(value,index,row){
if (value) { if (value) {
if (groupIndexList.value.indexOf(index) === -1) {
groupIndexList.value.push(index) groupIndexList.value.push(index)
}
if (groupList.value.indexOf(row) === -1) {
groupList.value.push(row) groupList.value.push(row)
}
} else { } else {
groupIndexList.value.splice(groupIndexList.value.indexOf(index), 1) const idx1 = groupIndexList.value.indexOf(index)
groupList.value.splice(groupList.value.indexOf(index), 1) if (idx1 !== -1) {
groupIndexList.value.splice(idx1, 1)
}
const idx2 = groupList.value.indexOf(row)
if (idx2 !== -1) {
groupList.value.splice(idx2, 1)
}
} }
groupList.value.map(k=>{ groupList.value.map(k=>{
if(k.check){ if(k.check){
@@ -844,14 +998,14 @@ function handleSingOut() {
return item.check; return item.check;
}) })
.filter((item) => { .filter((item) => {
return item.statusEnum == 2&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag) return item.statusEnum == 2 && item.chargeStatus != 5 && (Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
}) })
.map((item) => { .map((item) => {
return item.requestId; return item.requestId;
}); });
console.log(requestIdList,"签退") console.log(requestIdList,"签退")
if (requestIdList.length == 0) { if (requestIdList.length == 0) {
proxy.$modal.msgWarning('未选择可签退的医嘱'); proxy.$modal.msgWarning('未选择可签退的医嘱(已收费项目不可签退)');
return return
} }
singOut(requestIdList).then((res) => { singOut(requestIdList).then((res) => {

View File

@@ -957,6 +957,32 @@ const { method_code, unit_code, rate_code, distribution_category_code, drord_doc
'drord_doctor_type' 'drord_doctor_type'
); );
// 格式化价格显示
function formatPrice(price, suffix = ' 元', defaultValue = '-') {
if (price !== undefined && price !== null && !isNaN(price) && isFinite(price)) {
return Number(price).toFixed(2) + suffix;
}
return defaultValue;
}
// 格式化价格(用于编辑状态,不带单位)
function formatPriceEdit(price) {
if (price !== undefined && price !== null && !isNaN(price) && isFinite(price)) {
return Number(price).toFixed(2);
}
return '0.00';
}
// 格式化剂量显示
function formatDose(dose, unitText) {
return dose ? dose + ' ' + (unitText || '') : '';
}
// 格式化数量显示
function formatQuantity(quantity, unitText) {
return quantity ? quantity + ' ' + (unitText || '') : '';
}
// 删除硬编码的adviceTypeList直接使用drord_doctor_type字典 // 删除硬编码的adviceTypeList直接使用drord_doctor_type字典
// drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部 // drord_doctor_type: 1=西药, 2=中成药, 3=诊疗, 4=耗材, 5=会诊, 6=全部
const adviceTypeList = ref([ const adviceTypeList = ref([