解决合并冲突

This commit is contained in:
2025-12-10 14:20:24 +08:00
parent e1385cb3e6
commit 18f6a845e6
804 changed files with 61881 additions and 13577 deletions

View File

@@ -16,6 +16,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.exception.ServiceException;
import com.core.common.utils.*;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.administration.service.IChargeItemService;
import com.openhis.clinical.domain.Procedure;
import com.openhis.clinical.service.IProcedureService;
import com.openhis.common.constant.CommonConstants;
@@ -35,7 +37,7 @@ import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.outpatientmanage.mapper.OutpatientTreatmentAppMapper;
import com.openhis.web.pharmacymanage.appservice.impl.ReturnMedicineAppServiceImpl;
import com.openhis.web.pharmacymanage.appservice.impl.WesternMedicineDispenseAppServiceImpl;
import com.openhis.web.pharmacymanage.dto.InventoryDto;
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
import com.openhis.workflow.domain.DeviceDispense;
import com.openhis.workflow.domain.DeviceRequest;
@@ -87,6 +89,9 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
@Resource
private ReturnMedicineAppServiceImpl returnedMedicineAppServiceImpl;
@Resource
private IChargeItemService chargeItemService;
@Resource
private AssignSeqUtil assignSeqUtil;
@@ -134,8 +139,9 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
// 查询就诊病人列表
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto = outpatientTreatmentAppMapper
.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto =
outpatientTreatmentAppMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
EncounterClass.AMB.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.getValue());
encounterInfoPageDto.getRecords().forEach(prescriptionPatientInfoDto -> {
// 性别
prescriptionPatientInfoDto.setGenderEnum_enumText(
@@ -253,16 +259,28 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
List<PerformInfoDto> devicePerformList = new ArrayList<>();
for (PerformInfoDto item : performInfoList) {
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())
|| CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
|| CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
serviceMedPerformList.add(item);
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
devicePerformList.add(item);
}
// else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
// devicePerformList.add(item);
// }
}
// 分别处理诊疗/药品执行和耗材发放
if (!serviceMedPerformList.isEmpty()) {
List<ChargeItem> chargeItemList = chargeItemService.getChargeItemInfoByReqId(
serviceMedPerformList.stream().map(PerformInfoDto::getRequestId).collect(Collectors.toList()));
if (chargeItemList == null || chargeItemList.isEmpty()) {
throw new ServiceException("未找到对应的收费项,请联系管理员");
}
// 按requestId分组收费项
Map<Long, List<ChargeItem>> chargeItemMap =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getServiceId));
// 过滤出已收费的执行项目
serviceMedPerformList = serviceMedPerformList.stream().filter(performInfo -> {
List<ChargeItem> chargeItems = chargeItemMap.get(performInfo.getRequestId());
return chargeItems != null && chargeItems.stream()
.anyMatch(chargeItem -> ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum()));
}).toList();
// 处理诊疗执行
for (PerformInfoDto performInfoDto : serviceMedPerformList) {
Long groupId = performInfoDto.getGroupId();
@@ -323,107 +341,110 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
}
}
}
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// todo因长大农大在执行的时候都不发耗材暂时注释掉
// // 返回信息
// String returnMsg = null;
// if (!devicePerformList.isEmpty()) {
// // 耗材请求id列表
// List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// // 获取耗材发放id列表
// List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
// // 获取库存信息
// List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
// CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// // 按每个耗材分组
// Map<Long, List<InventoryDto>> groupedByItemId =
// inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
// // 遍历每个分组校验库存状态
// for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
// List<InventoryDto> groupItems = entry.getValue();
// if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
// .allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// // 库存停供校验
// return R.fail(groupItems.get(0).getItemName() + "库存已停供");
// }
// }
// List<InventoryItem> inventoryItemList = new ArrayList<>();
// if (!inventoryList.isEmpty()) {
// for (InventoryDto inventoryDto : inventoryList) {
// if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
// InventoryItem inventoryItem = new InventoryItem();
// // 库存数量判定
// if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
// // 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
// BigDecimal quantity =
// inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
// // 库存数量判定
// if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// // 库存数量不足
// return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
// } else {
// inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
// }
// } else {
// // 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
// BigDecimal quantity = inventoryDto.getInventoryQuantity()
// .subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
// // 库存数量判定
// if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// // 库存数量不足
// return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
// } else {
// inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
// }
// }
// inventoryItemList.add(inventoryItem);
// }
// }
// }
// // 发耗材信息查询
// List<DeviceDispense> dispenseList = deviceDispenseService
// .list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// if (dispenseList != null) {
// for (DeviceDispense deviceDispense : dispenseList) {
// if (deviceDispense.getStatusEnum().equals(DispenseStatus.PREPARATION.getValue())) {
// // 耗材发放状态
// deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
// // 发药数量
// deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
// // 发药时间
// deviceDispense.setDispenseTime(DateUtils.getNowDate());
// // 发药人
// deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// // 根据数量设置追溯码
// deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
// Collections.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
// }
// }
// // 药品发放更新
// deviceDispenseService.updateBatchById(dispenseList);
// } else {
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
// }
// // 库存更新
// inventoryItemService.updateBatchById(inventoryItemList);
// // 更新请求状态为已完成
// deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
// // 调用医保商品销售接口
// String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
// // 医保开关
// if (Whether.YES.getCode().equals(ybSwitch)) {
// List<String> uploadFailedNoList =
// westernMedicineDispenseAppServiceImpl.ybMedicineIntegrated(null, devDispenseIdList);
// if (uploadFailedNoList != null) {
// returnMsg = "3505商品销售上传错误错误项目编码" + uploadFailedNoList;
// } else {
// returnMsg = "3505商品销售上传成功";
// }
// }
// }
// 返回信息
String returnMsg = null;
if (!devicePerformList.isEmpty()) {
// 耗材请求id列表
List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
// 获取耗材发放id列表
List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
// 发耗材信息查询
List<DeviceDispense> dispenseList = deviceDispenseService
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
// 获取耗材待发放id列表
List<Long> devUnDispenseIdList = new ArrayList<>();
if (dispenseList != null) {
List<DeviceDispense> unDispenseList = dispenseList.stream()
.filter(x -> DispenseStatus.PREPARATION.getValue().equals(x.getStatusEnum())).toList();
for (DeviceDispense deviceDispense : unDispenseList) {
// 耗材发放状态
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
// 发药数量
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
// 发药时间
deviceDispense.setDispenseTime(DateUtils.getNowDate());
// 发药人
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
// 根据数量设置追溯码
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
devUnDispenseIdList.add(deviceDispense.getId());
}
// 药品发放更新
deviceDispenseService.updateBatchById(dispenseList);
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 获取库存信息
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
// 按每个耗材分组
Map<Long, List<UnDispenseInventoryDto>> groupedByItemId =
inventoryList.stream().collect(Collectors.groupingBy(UnDispenseInventoryDto::getItemId));
// 遍历每个分组校验库存状态
for (Map.Entry<Long, List<UnDispenseInventoryDto>> entry : groupedByItemId.entrySet()) {
List<UnDispenseInventoryDto> groupItems = entry.getValue();
if (groupItems.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
// 库存停供校验
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
}
}
List<InventoryItem> inventoryItemList = new ArrayList<>();
if (!inventoryList.isEmpty()) {
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())) {
InventoryItem inventoryItem = new InventoryItem();
// 库存数量判定
if (unDispenseInventoryDto.getDispenseUnit()
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity()
.subtract(unDispenseInventoryDto.getQuantity());
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
} else {
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
BigDecimal quantity = unDispenseInventoryDto.getInventoryQuantity().subtract(
unDispenseInventoryDto.getPartPercent().multiply(unDispenseInventoryDto.getQuantity()));
// 库存数量判定
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
// 库存数量不足
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
} else {
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
}
}
inventoryItemList.add(inventoryItem);
}
}
}
// 库存更新
inventoryItemService.updateBatchById(inventoryItemList);
// 更新请求状态为已完成
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
// 调用医保商品销售接口
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
// 医保开关
if (Whether.YES.getCode().equals(ybSwitch)) {
List<String> uploadFailedNoList =
westernMedicineDispenseAppServiceImpl.ybMedicineIntegrated(null, devDispenseIdList);
if (uploadFailedNoList != null) {
returnMsg = "3505商品销售上传错误错误项目编码" + uploadFailedNoList;
} else {
returnMsg = "3505商品销售上传成功";
}
}
}
return R.ok("执行成功");
}
@@ -479,8 +500,6 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
}
}
}
} else {
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
// 返回信息
@@ -501,7 +520,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
if (deviceRefundRequest != null) {
if (deviceRefundRequest.getStatusEnum().equals(EventStatus.CANCEL.getValue())) {
if (deviceRefundRequest.getStatusEnum().equals(RequestStatus.CANCELLED.getValue())) {
// 获取待退的耗材请求id
devRefundRequestIdList.add(deviceRefundRequest.getId());
devRequestIdPairList.add(new Pair<>(requestId, deviceRefundRequest.getId()));
@@ -550,11 +569,12 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
List<InventoryItem> inventoryItemList = new ArrayList<>();
// 获取库存信息
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList,
null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
if (inventoryList != null && !inventoryList.isEmpty()) {
// 设置库存数量
for (InventoryDto inventory : inventoryList) {
for (UnDispenseInventoryDto inventory : inventoryList) {
// 库存表项目设定
InventoryItem inventoryItem = new InventoryItem();
// id

View File

@@ -66,10 +66,10 @@ public class OutpatientInfusionController {
* @return 门诊输液待执行记录列表
*/
@GetMapping(value = "/infusion-pending-record")
public R<?> getInfusionPendingRecord(@RequestParam Long encounterId,@RequestParam Integer serviceStatus,
public R<?> getInfusionPendingRecord(@RequestParam Long encounterId, @RequestParam Integer serviceStatus,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return outpatientInfusionAppService.getInfusionPendingRecord(encounterId, serviceStatus,pageNo, pageSize);
return outpatientInfusionAppService.getInfusionPendingRecord(encounterId, serviceStatus, pageNo, pageSize);
}
/**

View File

@@ -5,16 +5,16 @@ package com.openhis.web.outpatientmanage.mapper;
import java.util.List;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.common.dto.PerformRecordDto;
import com.openhis.web.outpatientmanage.dto.BloodTransfusionPatchDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentEncounterDto;
import com.openhis.web.outpatientmanage.dto.OutpatientTreatmentInfoDto;
import com.openhis.web.common.dto.PerformRecordDto;
@Repository
public interface OutpatientTreatmentAppMapper {
@@ -25,12 +25,14 @@ public interface OutpatientTreatmentAppMapper {
* @param page 分页
* @param queryWrapper 查询条件
* @param amb 就诊类型:门诊
* @param completed 请求状态:已完成
* @param cancelled 请求状态:取消
* @return 就诊病人列表
*/
Page<OutpatientTreatmentEncounterDto> selectEncounterInfoListPage(
@Param("page") Page<OutpatientTreatmentEncounterDto> page,
@Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper,
@Param("amb") Integer amb);
@Param(Constants.WRAPPER) QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper, @Param("amb") Integer amb,
@Param("completed") Integer completed, @Param("cancelled") Integer cancelled);
/**
* 处置项目查询