Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # openhis-ui-vue3/src/views/clinicmanagement/bargain/component/prescriptionlist.vue
This commit is contained in:
@@ -119,6 +119,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
|
||||
= outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
|
||||
ChargeItemContext.WESTERN_MEDICINE.getValue(), ChargeItemContext.CHINESE_PATENT_MEDICINE.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(),
|
||||
|
||||
@@ -75,8 +75,9 @@ public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppSer
|
||||
}
|
||||
// 门诊划价:不要强制 pricingFlag=1 参与过滤(wor_activity_definition.pricing_flag 可能为 0),
|
||||
// 否则会导致诊疗项目(adviceType=3)查询结果为空 records=[]
|
||||
String categoryCode = adviceBaseDto != null ? adviceBaseDto.getCategoryCode() : null;
|
||||
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
|
||||
organizationId, pageNo, pageSize, null, adviceTypes, null);
|
||||
organizationId, pageNo, pageSize, null, adviceTypes, null, categoryCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,12 @@ public class OutpatientPricingController {
|
||||
@RequestParam(value = "locationId", required = false) Long locationId,
|
||||
@RequestParam(value = "organizationId") Long organizationId,
|
||||
@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,
|
||||
pageNo, pageSize));
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public interface OutpatientChargeAppMapper {
|
||||
* @param medication 药品
|
||||
* @param device 耗材
|
||||
* @param register 挂号费
|
||||
* @param westernMedicine 西药
|
||||
* @param chinesePatentMedicine 中成药
|
||||
* @param planned 收费状态:待收费
|
||||
* @param billable 收费状态:待结算
|
||||
* @param billed 收费状态:已结算
|
||||
@@ -53,7 +55,9 @@ public interface OutpatientChargeAppMapper {
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId,
|
||||
@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("partRefund") Integer partRefund, @Param("worDeviceRequest") String worDeviceRequest);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface IDoctorStationAdviceAppService {
|
||||
*/
|
||||
IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
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);
|
||||
|
||||
/**
|
||||
* 查询医嘱绑定信息
|
||||
|
||||
@@ -19,11 +19,4 @@ public interface IDoctorStationInspectionLabApplyService {
|
||||
* @return 删除结果
|
||||
*/
|
||||
R<?> deleteInspectionLabApply(String applyNo);
|
||||
|
||||
/**
|
||||
* 生成检验申请单号
|
||||
* 规则:LS + YYYYMMDD + 5位流水号(每日从1开始递增)
|
||||
* @return 申请单号
|
||||
*/
|
||||
String generateApplyNo();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
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.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -111,6 +114,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
@Resource
|
||||
IEncounterService iEncounterService;
|
||||
|
||||
@Resource
|
||||
IInventoryItemService inventoryItemService;
|
||||
|
||||
// 缓存 key 前缀
|
||||
private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:";
|
||||
// 缓存过期时间(小时)
|
||||
@@ -135,7 +141,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
@Override
|
||||
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
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值
|
||||
String safeSearchKey = searchKey != null ? searchKey : "";
|
||||
@@ -203,7 +209,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
new Page<>(pageNo, pageSize), PublicationStatus.ACTIVE.getValue(), organizationId,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, pricingFlag, adviceDefinitionIdParamList,
|
||||
adviceTypes, searchKey,
|
||||
adviceTypes, searchKey, categoryCode,
|
||||
queryWrapper);
|
||||
List<AdviceBaseDto> adviceBaseDtoList = adviceBaseInfo.getRecords();
|
||||
|
||||
@@ -932,7 +938,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
deviceAdviceDto.setAdviceTableName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
IPage<AdviceBaseDto> devicePage = getAdviceBaseInfo(deviceAdviceDto, null, null, null,
|
||||
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()) {
|
||||
log.warn("无法找到耗材定价信息: deviceDefId={}", boundDevice.getDevActId());
|
||||
@@ -1428,26 +1434,26 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
|
||||
// 只有在签发时
|
||||
if (is_sign) {
|
||||
// 发送跨系统申请
|
||||
adviceSaveDto.setRequestId(serviceRequest.getId());
|
||||
try {
|
||||
// 查询诊疗定义
|
||||
ActivityDefinition activityDefinition
|
||||
= iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
|
||||
if (activityDefinition != null) {
|
||||
// 检验 或 检查
|
||||
if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())
|
||||
|| ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
|
||||
doctorStationSendApplyUtil.sendCrossSystemApply(adviceSaveDto, organizationId, curDate);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (!Whether.YES.getCode()
|
||||
.equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) {
|
||||
throw e;
|
||||
}
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
// 发送跨系统申请 - 已注释,项目未使用LIS/PACS系统
|
||||
// adviceSaveDto.setRequestId(serviceRequest.getId());
|
||||
// try {
|
||||
// // 查询诊疗定义
|
||||
// ActivityDefinition activityDefinition
|
||||
// = iActivityDefinitionService.getById(adviceSaveDto.getAdviceDefinitionId());
|
||||
// if (activityDefinition != null) {
|
||||
// // 检验 或 检查
|
||||
// if (ActivityType.PROOF.getValue().equals(activityDefinition.getTypeEnum())
|
||||
// || ActivityType.TEST.getValue().equals(activityDefinition.getTypeEnum())) {
|
||||
// doctorStationSendApplyUtil.sendCrossSystemApply(adviceSaveDto, organizationId, curDate);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// if (!Whether.YES.getCode()
|
||||
// .equals(TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_PACS_ERROR_IGNORE))) {
|
||||
// throw e;
|
||||
// }
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1512,15 +1518,60 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
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())
|
||||
);
|
||||
|
||||
// 尝试作废药品请求(只有存在的才会更新)
|
||||
iMedicationRequestService.updateCancelledStatusBatch(requestIdList, null, null);
|
||||
// 尝试作废耗材请求(只有存在的才会更新)
|
||||
iDeviceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||
// 尝试作废诊疗请求(只有存在的才会更新)
|
||||
iServiceRequestService.updateCancelledStatusBatch(requestIdList);
|
||||
if (dispensedList != null && !dispensedList.isEmpty()) {
|
||||
// 需要回滚的库存列表
|
||||
List<InventoryItem> inventoryUpdateList = new ArrayList<>();
|
||||
|
||||
for (MedicationDispense dispense : dispensedList) {
|
||||
// 查询对应的库存记录(根据批号和药品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 - 所有请求作废完成");
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ public class DoctorStationChineseMedicalAppServiceImpl implements IDoctorStation
|
||||
adviceBaseDto.setAdviceType(1); // 医嘱类型为药品
|
||||
adviceBaseDto.setCategoryCode(MedCategoryCode.CHINESE_HERBAL_MEDICINE.getValue());// 中草药
|
||||
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,
|
||||
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) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
|
||||
@@ -94,8 +94,39 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
* 保存检验申请单信息逻辑
|
||||
* 保存检验申请单信息同时根据检验申请单检验项目数据保存检验申请单明细信息
|
||||
*/
|
||||
log.debug("保存检验申请单信息:{}", doctorStationLabApplyDto);
|
||||
log.debug("保存申请单明细信息:{}",doctorStationLabApplyDto.getLabApplyItemList());
|
||||
|
||||
// 申请单号为空或"待生成"时,由后端生成新单号
|
||||
String applyNo = doctorStationLabApplyDto.getApplyNo();
|
||||
boolean isNewApplyNo = false;
|
||||
if (applyNo == null || applyNo.trim().isEmpty() || "待生成".equals(applyNo) || "自动生成".equals(applyNo)) {
|
||||
applyNo = generateApplyNo();
|
||||
isNewApplyNo = true;
|
||||
}
|
||||
// 将生成的单号设置回 DTO
|
||||
doctorStationLabApplyDto.setApplyNo(applyNo);
|
||||
|
||||
try {
|
||||
// 执行保存逻辑
|
||||
doSaveInspectionLabApply(doctorStationLabApplyDto, applyNo);
|
||||
} catch (Exception e) {
|
||||
// 记录废号日志(申请单号已生成但保存失败)
|
||||
if (isNewApplyNo) {
|
||||
log.error("申请单号 {} 因保存失败成为废号,原因:{}", applyNo, e.getMessage());
|
||||
}
|
||||
throw e; // 重新抛出异常,让事务回滚
|
||||
}
|
||||
|
||||
// 返回生成的申请单号
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("applyNo", applyNo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行保存检验申请单的实际逻辑
|
||||
*/
|
||||
private void doSaveInspectionLabApply(DoctorStationLabApplyDto doctorStationLabApplyDto, String applyNo) {
|
||||
|
||||
//获取当前登陆用户 ID
|
||||
String userId = String.valueOf(SecurityUtils.getLoginUser().getUserId());
|
||||
InspectionLabApply inspectionLabApply = new InspectionLabApply();
|
||||
@@ -108,18 +139,30 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
inspectionLabApply.setOperatorId(userId);
|
||||
inspectionLabApply.setCreateTime(new Date());
|
||||
inspectionLabApply.setDeleteFlag(DelFlag.NO.getCode());
|
||||
// 申请日期使用服务器当前系统时间
|
||||
inspectionLabApply.setApplyTime(new Date());
|
||||
|
||||
log.debug("保存检验申请单信息:{}", inspectionLabApply);
|
||||
inspectionLabApplyService.saveOrUpdate(inspectionLabApply);
|
||||
|
||||
// 金额校验和重算:后端重新计算金额,防止前端篡改
|
||||
java.math.BigDecimal totalAmount = java.math.BigDecimal.ZERO;
|
||||
int index = 0;
|
||||
|
||||
//遍历 doctorStationLabApplyDto.getLabApplyItemList()
|
||||
int index = 0;
|
||||
for (DoctorStationLabApplyItemDto doctorStationLabApplyItemDto : doctorStationLabApplyDto.getLabApplyItemList()) {
|
||||
//将 dto 数据复制到 InspectionLabApplyItem 对象中
|
||||
InspectionLabApplyItem inspectionLabApplyItem = new InspectionLabApplyItem();
|
||||
BeanUtils.copyProperties(doctorStationLabApplyItemDto, inspectionLabApplyItem);
|
||||
|
||||
// 后端重新计算金额:金额 = 单价 × 数量
|
||||
java.math.BigDecimal itemPrice = doctorStationLabApplyItemDto.getItemPrice();
|
||||
java.math.BigDecimal itemQty = doctorStationLabApplyItemDto.getItemQty();
|
||||
if (itemPrice != null && itemQty != null) {
|
||||
java.math.BigDecimal calculatedAmount = itemPrice.multiply(itemQty).setScale(2, java.math.RoundingMode.HALF_UP);
|
||||
inspectionLabApplyItem.setItemAmount(calculatedAmount);
|
||||
totalAmount = totalAmount.add(calculatedAmount);
|
||||
}
|
||||
|
||||
//设置从表申请单明细的申请单号
|
||||
inspectionLabApplyItem.setApplyNo(doctorStationLabApplyDto.getApplyNo());
|
||||
//执行科室代码,取值于检验申请单明细(前端传递的字典值)
|
||||
@@ -131,7 +174,6 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
index++;
|
||||
|
||||
inspectionLabApplyItem.setDeleteFlag(DelFlag.NO.getCode());
|
||||
log.debug("保存申请单明细信息:{}", inspectionLabApplyItem);
|
||||
inspectionLabApplyItemService.saveOrUpdate(inspectionLabApplyItem);
|
||||
|
||||
//创建条码对象
|
||||
@@ -147,8 +189,6 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
barCode.setCreateTime(new Date());
|
||||
barCode.setDeleteFlag(DelFlag.NO.getCode());
|
||||
|
||||
|
||||
log.debug("插入条码数据前,barCode:{}",barCode);
|
||||
inspectionLabBarCodeService.saveOrUpdate(barCode);
|
||||
}
|
||||
|
||||
@@ -195,15 +235,12 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
);
|
||||
if (organization != null) {
|
||||
positionId = organization.getId();
|
||||
} else {
|
||||
log.warn("未找到执行科室代码对应的科室:{}", performDeptCode);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有指定执行科室,使用当前医生所在的科室作为默认执行科室
|
||||
if (positionId == null) {
|
||||
positionId = SecurityUtils.getDeptId();
|
||||
log.debug("检验项目未指定执行科室,使用当前科室:{}", positionId);
|
||||
}
|
||||
|
||||
// 4. 创建医嘱保存对象
|
||||
@@ -282,12 +319,7 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
adviceSaveParam.setAdviceSaveList(adviceSaveList);
|
||||
|
||||
// 调用门诊医嘱保存接口,创建关联的医嘱记录
|
||||
try {
|
||||
iDoctorStationAdviceAppService.saveAdvice(adviceSaveParam, "1"); // "1"表示保存操作
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("创建关联医嘱记录失败", e);
|
||||
}
|
||||
return R.ok();
|
||||
iDoctorStationAdviceAppService.saveAdvice(adviceSaveParam, "1"); // "1"表示保存操作
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,8 +591,7 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
* 支持并发安全:使用 Redis 原子递增保证唯一性
|
||||
* @return 申请单号
|
||||
*/
|
||||
@Override
|
||||
public String generateApplyNo() {
|
||||
private String generateApplyNo() {
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
String dateStr = today.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
@@ -574,8 +605,8 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
// 使用 Redis 原子递增获取流水号(并发安全)
|
||||
long sequence = redisCache.incr(redisKey, 1);
|
||||
|
||||
// 设置 Redis key 过期时间为 2 天,避免数据积累
|
||||
redisCache.expire(redisKey, 2 * 24 * 60 * 60);
|
||||
// 设置 Redis key 过期时间(每天的 key 按日期独立,隔天不再使用,25小时确保跨午夜场景安全)
|
||||
redisCache.expire(redisKey, 25 * 60 * 60);
|
||||
|
||||
// 格式化流水号为5位,不足前补0
|
||||
String sequenceStr = String.format("%05d", sequence);
|
||||
@@ -583,7 +614,6 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
||||
// 生成完整的申请单号
|
||||
String applyNo = prefix + sequenceStr;
|
||||
|
||||
log.debug("生成检验申请单号:{}", applyNo);
|
||||
return applyNo;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DoctorStationAdviceController {
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,18 +64,4 @@ public class DoctorStationInspectionLabApplyController {
|
||||
log.debug("删除检验申请单:{}", applyNo);
|
||||
return R.ok(iDoctorStationInspectionLabApplyService.deleteInspectionLabApply(applyNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成检验申请单号
|
||||
* 规则:LS + YYYYMMDD + 5位流水号(每日从1开始递增)
|
||||
* @return 申请单号
|
||||
*/
|
||||
@GetMapping(value = "/generate-apply-no")
|
||||
public R<?> generateApplyNo(){
|
||||
log.debug("生成检验申请单号");
|
||||
String applyNo = iDoctorStationInspectionLabApplyService.generateApplyNo();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("applyNo", applyNo);
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public interface DoctorStationAdviceAppMapper {
|
||||
@Param("adviceDefinitionIdParamList") List<Long> adviceDefinitionIdParamList,
|
||||
@Param("adviceTypes") List<Integer> adviceTypes,
|
||||
@Param("searchKey") String searchKey,
|
||||
@Param("categoryCode") String categoryCode,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<AdviceBaseDto> queryWrapper);
|
||||
|
||||
/**
|
||||
|
||||
@@ -364,7 +364,7 @@ public class AdviceUtils {
|
||||
// 对应的子项诊疗医嘱信息
|
||||
AdviceBaseDto activityAdviceBaseDto
|
||||
= 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) {
|
||||
// 费用定价
|
||||
AdvicePriceDto advicePriceDto = activityAdviceBaseDto.getPriceList().get(0);
|
||||
|
||||
@@ -32,9 +32,11 @@ public class PrescriptionUtils {
|
||||
if (medicineList == null || medicineList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 1. 按诊断ID分组(不同诊断必须分开)
|
||||
// 1. 按诊断ID分组(不同诊断必须分开,null值归为一组)
|
||||
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. 处理每个诊断组
|
||||
diagnosisGroups.values().forEach(this::processDiagnosisGroup);
|
||||
}
|
||||
@@ -46,9 +48,11 @@ public class PrescriptionUtils {
|
||||
if (diagnosisGroup.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 1. 按药品性质分组
|
||||
// 1. 按药品性质分组(null值归为普通药品)
|
||||
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. 处理每个药品性质组
|
||||
pharmacologyGroups.values().forEach(pharmaGroup -> {
|
||||
// 2.1 先处理有分组ID的药品(确保它们不会被拆分)
|
||||
|
||||
@@ -702,7 +702,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
||||
= medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList());
|
||||
// 医嘱详细信息
|
||||
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();
|
||||
@@ -979,7 +979,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
||||
= actUseExeList.stream().map(ServiceRequestUseExe::getActivityId).collect(Collectors.toList());
|
||||
// 医嘱详细信息
|
||||
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();
|
||||
@@ -1146,7 +1146,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
||||
|
||||
// 耗材医嘱详细信息
|
||||
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();
|
||||
|
||||
DeviceRequest deviceRequest;
|
||||
|
||||
@@ -201,7 +201,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer
|
||||
.map(AutoRollNursingDto::getActivityDefinitionId).collect(Collectors.toList());
|
||||
// 诊疗医嘱信息
|
||||
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;
|
||||
@@ -295,7 +295,7 @@ public class EncounterAutoRollAppServiceImpl implements IEncounterAutoRollAppSer
|
||||
.map(AutoRollBasicServiceDto::getActivityDefinitionId).collect(Collectors.toList());
|
||||
// 诊疗医嘱信息
|
||||
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;
|
||||
for (AutoRollBasicServiceDto autoRollBasicServiceDto : autoRollBasicService) {
|
||||
|
||||
@@ -2095,7 +2095,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId());
|
||||
// 对应的诊疗医嘱信息
|
||||
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) {
|
||||
// 费用定价
|
||||
|
||||
@@ -197,7 +197,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
|
||||
// 医嘱下拉详细信息
|
||||
List<AdviceBaseDto> personalRecords =
|
||||
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
|
||||
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
|
||||
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key,保留第一个
|
||||
@@ -248,7 +248,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
|
||||
// 医嘱下拉详细信息
|
||||
List<AdviceBaseDto> personalRecords =
|
||||
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
|
||||
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
|
||||
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key,保留第一个
|
||||
@@ -297,7 +297,7 @@ public class OrdersGroupPackageAppServiceImpl implements IOrdersGroupPackageAppS
|
||||
// 医嘱下拉详细信息
|
||||
List<AdviceBaseDto> personalRecords =
|
||||
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
|
||||
Map<Long, AdviceBaseDto> adviceMap = personalRecords.stream().collect(Collectors
|
||||
.toMap(AdviceBaseDto::getAdviceDefinitionId, advice -> advice, (existing, replacement) -> existing // 如果有重复key,保留第一个
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
|
||||
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
|
||||
// 对应的诊疗医嘱信息
|
||||
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---------------------直接新增
|
||||
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
|
||||
longServiceRequest.setOccurrenceStartTime(startTime); // 医嘱开始时间
|
||||
@@ -208,7 +208,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
|
||||
adviceBaseDto.setAdviceDefinitionId(definitionId); // 医嘱定义id
|
||||
// 对应的诊疗医嘱信息
|
||||
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);
|
||||
|
||||
longServiceRequest.setStatusEnum(RequestStatus.DRAFT.getValue());// 请求状态
|
||||
@@ -348,7 +348,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
|
||||
adviceBaseDto.setAdviceDefinitionId(transferOrganizationDefinitionId); // 医嘱定义id
|
||||
// 转科的医嘱信息
|
||||
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);
|
||||
// 保存转科医嘱请求
|
||||
ServiceRequest serviceRequest = new ServiceRequest();
|
||||
@@ -430,7 +430,7 @@ public class SpecialAdviceAppServiceImpl implements ISpecialAdviceAppService {
|
||||
|
||||
// 出院的医嘱信息
|
||||
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);
|
||||
// 保存出院医嘱请求
|
||||
ServiceRequest serviceRequest = new ServiceRequest();
|
||||
|
||||
@@ -101,6 +101,9 @@
|
||||
<if test="pricingFlag == 1">
|
||||
AND 1 = 2
|
||||
</if>
|
||||
<if test="categoryCode != null and categoryCode != ''">
|
||||
AND t1.category_code = #{categoryCode}
|
||||
</if>
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%')
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user