提交merge1.3
This commit is contained in:
@@ -129,7 +129,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(OutpatientTreatmentEncounterDto outpatientTreatmentEncounterDto,
|
||||
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
|
||||
// 设置模糊查询的字段名
|
||||
HashSet<String> searchFields = new HashSet<>();
|
||||
@@ -137,20 +137,20 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
searchFields.add(CommonConstants.FieldName.PatientPyStr);
|
||||
searchFields.add(CommonConstants.FieldName.PatientWbStr);
|
||||
// 构建查询条件
|
||||
QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
|
||||
QueryWrapper<OutpatientTreatmentEncounterDto> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(outpatientTreatmentEncounterDto, searchKey, searchFields, request);
|
||||
|
||||
// 查询就诊病人列表
|
||||
Page<OutpatientTreatmentEncounterDto> encounterInfoPageDto =
|
||||
outpatientTreatmentAppMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
EncounterClass.AMB.getValue(), RequestStatus.COMPLETED.getValue(), RequestStatus.CANCELLED.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(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
// 计算年龄
|
||||
prescriptionPatientInfoDto.setAge(prescriptionPatientInfoDto.getBirthDate() != null
|
||||
? AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()) : "");
|
||||
? AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()) : "");
|
||||
});
|
||||
return R.ok(encounterInfoPageDto);
|
||||
}
|
||||
@@ -165,21 +165,21 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOutpatientTreatmentInfo(OutpatientTreatmentInfoDto outpatientTreatmentInfoDto, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(outpatientTreatmentInfoDto, null, null, null);
|
||||
QueryWrapper<OutpatientTreatmentInfoDto> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(outpatientTreatmentInfoDto, null, null, null);
|
||||
|
||||
// 查询处置单
|
||||
IPage<OutpatientTreatmentInfoDto> treatmentInfo = outpatientTreatmentAppMapper.selectTreatmentInfoPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, RequestStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.DRAFT.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
|
||||
new Page<>(pageNo, pageSize), queryWrapper, RequestStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.DRAFT.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
|
||||
List<OutpatientTreatmentInfoDto> treatmentList = treatmentInfo.getRecords();
|
||||
|
||||
// 获取请求ids
|
||||
List<Long> reqIds =
|
||||
treatmentList.stream().map(OutpatientTreatmentInfoDto::getRequestId).collect(Collectors.toList());
|
||||
List<Long> reqIds
|
||||
= treatmentList.stream().map(OutpatientTreatmentInfoDto::getRequestId).collect(Collectors.toList());
|
||||
Map<Long, List<Procedure>> procedureRecordGroup = new HashMap<>();
|
||||
if (!reqIds.isEmpty()) {
|
||||
// 查询执行记录
|
||||
@@ -188,7 +188,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
if (procedureRecords != null && !procedureRecords.isEmpty()) {
|
||||
// 根据服务请求id分组
|
||||
procedureRecordGroup = procedureRecords.stream()
|
||||
.collect(Collectors.groupingBy(Procedure::getRequestId, Collectors.toList()));
|
||||
.collect(Collectors.groupingBy(Procedure::getRequestId, Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,12 +218,12 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
// 发放状态
|
||||
if (treatment.getDispenseStatus() != null) {
|
||||
treatment.setDispenseStatus_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, treatment.getDispenseStatus()));
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, treatment.getDispenseStatus()));
|
||||
}
|
||||
// 收费状态
|
||||
if (treatment.getChargeStatus() != null) {
|
||||
treatment.setChargeStatus_enumText(
|
||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, treatment.getChargeStatus()));
|
||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, treatment.getChargeStatus()));
|
||||
}
|
||||
}
|
||||
return R.ok(treatmentInfo);
|
||||
@@ -242,7 +242,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
performRecordList.forEach(performRecordDto -> {
|
||||
// 获取执行状态
|
||||
performRecordDto
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, performRecordDto.getStatusEnum()));
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, performRecordDto.getStatusEnum()));
|
||||
});
|
||||
return R.ok(performRecordList);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ 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.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
||||
serviceMedPerformList.add(item);
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
|
||||
devicePerformList.add(item);
|
||||
@@ -270,18 +270,18 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
// 分别处理诊疗/药品执行和耗材发放
|
||||
if (!serviceMedPerformList.isEmpty()) {
|
||||
List<ChargeItem> chargeItemList = chargeItemService.getChargeItemInfoByReqId(
|
||||
serviceMedPerformList.stream().map(PerformInfoDto::getRequestId).collect(Collectors.toList()));
|
||||
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));
|
||||
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()));
|
||||
.anyMatch(chargeItem -> ChargeItemStatus.BILLED.getValue().equals(chargeItem.getStatusEnum()));
|
||||
}).toList();
|
||||
// 处理诊疗执行
|
||||
for (PerformInfoDto performInfoDto : serviceMedPerformList) {
|
||||
@@ -299,8 +299,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
exeCount = serviceRequest.getQuantity().intValue();
|
||||
}
|
||||
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(performInfoDto.getRequestTable())) {
|
||||
MedicationRequest medicationRequest =
|
||||
medicationRequestService.getById(performInfoDto.getRequestId());
|
||||
MedicationRequest medicationRequest
|
||||
= medicationRequestService.getById(performInfoDto.getRequestId());
|
||||
if (medicationRequest != null) {
|
||||
encounterId = medicationRequest.getEncounterId();
|
||||
requestId = medicationRequest.getId();
|
||||
@@ -310,7 +310,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
}
|
||||
// 根据请求id查询执行记录
|
||||
List<Procedure> procedureRecordList = procedureService
|
||||
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
|
||||
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
|
||||
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
|
||||
// 初始化计数器
|
||||
int performCount = 0;
|
||||
@@ -327,8 +327,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
if (performCount - cancelCount < exeCount) {
|
||||
// 未执行则新增执行记录
|
||||
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
|
||||
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
|
||||
ProcedureCategory.OUTPATIENT_ADVICE, null, null, DateUtils.getNowDate(), groupId, null);
|
||||
performInfoDto.getRequestTable(), EventStatus.COMPLETED,
|
||||
ProcedureCategory.OUTPATIENT_ADVICE, null, null, DateUtils.getNowDate(), groupId, null);
|
||||
if (procedureId == null) {
|
||||
throw new ServiceException("执行失败,请联系管理员");
|
||||
}
|
||||
@@ -336,8 +336,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
} else {
|
||||
// 新增执行记录
|
||||
Long procedureId = procedureService.addProcedureRecord(encounterId, patientId, requestId,
|
||||
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
|
||||
null, null, DateUtils.getNowDate(), groupId, null);
|
||||
performInfoDto.getRequestTable(), EventStatus.COMPLETED, ProcedureCategory.OUTPATIENT_ADVICE,
|
||||
null, null, DateUtils.getNowDate(), groupId, null);
|
||||
if (procedureId == null) {
|
||||
throw new ServiceException("执行失败,请联系管理员");
|
||||
}
|
||||
@@ -352,22 +352,19 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
List<Long> devRequestIdList = devicePerformList.stream().map(PerformInfoDto::getRequestId).toList();
|
||||
// 获取耗材发放id列表
|
||||
List<Long> devDispenseIdList = performInfoList.stream().map(PerformInfoDto::getDispenseId).toList();
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 更新请求状态为已完成
|
||||
LambdaUpdateWrapper<DeviceRequest> updateWrapper =
|
||||
new LambdaUpdateWrapper<DeviceRequest>().in(DeviceRequest::getId, devRequestIdList)
|
||||
.set(DeviceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue());
|
||||
LambdaUpdateWrapper<DeviceRequest> updateWrapper
|
||||
= new LambdaUpdateWrapper<DeviceRequest>().in(DeviceRequest::getId, devRequestIdList)
|
||||
.set(DeviceRequest::getStatusEnum, RequestStatus.COMPLETED.getValue());
|
||||
deviceRequestService.update(updateWrapper);
|
||||
>>>>>>> v1.3
|
||||
// 发耗材信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
.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();
|
||||
.filter(x -> DispenseStatus.PREPARATION.getValue().equals(x.getStatusEnum())).toList();
|
||||
for (DeviceDispense deviceDispense : unDispenseList) {
|
||||
// 耗材发放状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
@@ -379,7 +376,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
|
||||
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
devUnDispenseIdList.add(deviceDispense.getId());
|
||||
}
|
||||
// 药品发放更新
|
||||
@@ -387,74 +384,24 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
// 获取库存信息
|
||||
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);
|
||||
=======
|
||||
|
||||
// 获取药品待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList = returnMedicineMapper.selectInventoryInfoList(
|
||||
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
devUnDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String,
|
||||
List<UnDispenseInventoryDto>> unDispenseInventoryMap = unDispenseInventoryList.stream()
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap = unDispenseInventoryList.stream()
|
||||
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLotNumber()
|
||||
+ CommonConstants.Common.DASH + x.getLocationId()));
|
||||
+ CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
|
||||
.anyMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
.anyMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
throw new ServiceException(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
@@ -467,15 +414,15 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity = unDispenseInventoryDto.getQuantity()
|
||||
.multiply(unDispenseInventoryDto.getPartPercent());
|
||||
.multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue()
|
||||
.equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
.equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
@@ -486,31 +433,13 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
}
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
<<<<<<< HEAD
|
||||
// 更新请求状态为已完成
|
||||
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 ybSwitch =
|
||||
@@ -525,7 +454,6 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
// returnMsg = "3505商品销售上传成功";
|
||||
// }
|
||||
// }
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
return R.ok("执行成功");
|
||||
}
|
||||
@@ -543,7 +471,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
List<PerformInfoDto> deviceCancelList = 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.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
||||
serviceMedCancelList.add(item);
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
|
||||
deviceCancelList.add(item);
|
||||
@@ -555,7 +483,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
for (PerformInfoDto performInfoDto : serviceMedCancelList) {
|
||||
// 根据请求id查询执行记录
|
||||
List<Procedure> procedureRecordList = procedureService
|
||||
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
|
||||
.getProcedureRecords(List.of(performInfoDto.getRequestId()), performInfoDto.getRequestTable());
|
||||
if (procedureRecordList != null && !procedureRecordList.isEmpty()) {
|
||||
Procedure procedure = procedureRecordList.get(0);
|
||||
// 初始化计数器
|
||||
@@ -573,9 +501,9 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
if (performCount - cancelCount > 0) {
|
||||
// 已执行则新增取消执行记录
|
||||
Long procedureId = procedureService.addProcedureRecord(procedure.getEncounterId(),
|
||||
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
|
||||
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
|
||||
null, DateUtils.getNowDate(), performInfoDto.getGroupId(), null);
|
||||
procedure.getPatientId(), procedure.getRequestId(), procedure.getRequestTable(),
|
||||
EventStatus.CANCEL, ProcedureCategory.OUTPATIENT_ADVICE, performInfoDto.getLocationId(),
|
||||
null, DateUtils.getNowDate(), performInfoDto.getGroupId(), null);
|
||||
if (procedureId == null) {
|
||||
throw new ServiceException("取消执行失败,请联系管理员");
|
||||
}
|
||||
@@ -597,8 +525,8 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
Long requestId = deviceRequest.getId();
|
||||
// 查询待退的耗材请求
|
||||
DeviceRequest deviceRefundRequest = deviceRequestService.getOne(new LambdaQueryWrapper<DeviceRequest>()
|
||||
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
|
||||
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
.eq(DeviceRequest::getRefundDeviceId, performInfoDto.getRequestId())
|
||||
.eq(DeviceRequest::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
if (deviceRefundRequest != null) {
|
||||
if (deviceRefundRequest.getStatusEnum().equals(RequestStatus.CANCELLED.getValue())) {
|
||||
// 获取待退的耗材请求id
|
||||
@@ -626,7 +554,7 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
if (!devRefundRequestIdList.isEmpty() && !devDispenseIdList.isEmpty()) {
|
||||
// 耗材已发放信息查询
|
||||
List<DeviceDispense> deviceDispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// 根据发药单对应生成退药单
|
||||
for (DeviceDispense deviceDispense : deviceDispenseList) {
|
||||
// 耗材发放编码
|
||||
@@ -648,51 +576,12 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
deviceRequestService.updateCompletedStatusBatch(devRefundRequestIdList);
|
||||
|
||||
<<<<<<< HEAD
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList,
|
||||
null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (inventoryList != null && !inventoryList.isEmpty()) {
|
||||
// 设置库存数量
|
||||
for (UnDispenseInventoryDto inventory : inventoryList) {
|
||||
// 库存表项目设定
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
// id
|
||||
inventoryItem.setId(inventory.getInventoryId());
|
||||
// 库存数量
|
||||
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
|
||||
inventoryItem
|
||||
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
|
||||
inventoryItem.setQuantity(inventory.getInventoryQuantity()
|
||||
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
}
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 调用医保商品销售退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
if (!devRefundList.isEmpty()) {
|
||||
List<String> uploadFailedNoList =
|
||||
returnedMedicineAppServiceImpl.ybReturnIntegrated(new ArrayList<>(), devDispenseIdList);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3506商品销售退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3506商品销售退货上传成功";
|
||||
=======
|
||||
// 扣库
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(
|
||||
devDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
devDispenseIdList, null, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (inventoryList != null && !inventoryList.isEmpty()) {
|
||||
// 设置库存数量
|
||||
for (UnDispenseInventoryDto inventory : inventoryList) {
|
||||
@@ -704,14 +593,13 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
|
||||
inventoryItem
|
||||
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
|
||||
.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
|
||||
inventoryItem.setQuantity(inventory.getInventoryQuantity()
|
||||
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
|
||||
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
// 库存更新
|
||||
@@ -743,11 +631,11 @@ public class OutpatientTreatmentAppServiceImpl implements IOutpatientTreatmentAp
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBloodTransfusionPatch(Long requestId) {
|
||||
BloodTransfusionPatchDto bloodTransfusionPatch =
|
||||
outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
|
||||
BloodTransfusionPatchDto bloodTransfusionPatch
|
||||
= outpatientTreatmentAppMapper.getBloodTransfusionPatch(requestId);
|
||||
// 性别枚举
|
||||
bloodTransfusionPatch.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, bloodTransfusionPatch.getGenderEnum()));
|
||||
// 计算年龄
|
||||
if (bloodTransfusionPatch.getBirthDate() != null) {
|
||||
bloodTransfusionPatch.setAge(AgeCalculatorUtil.getAge(bloodTransfusionPatch.getBirthDate()));
|
||||
|
||||
Reference in New Issue
Block a user