提交merge1.3
This commit is contained in:
@@ -2,12 +2,16 @@ package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inhospitalnursestation.dto.AdmissionPageParam;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
=======
|
||||
import com.core.common.core.domain.R;
|
||||
>>>>>>> v1.3
|
||||
|
||||
/**
|
||||
* 住院汇总发药 应用实现接口
|
||||
@@ -18,8 +22,9 @@ import com.openhis.web.pharmacymanage.dto.*;
|
||||
public interface ISummaryDispenseMedicineAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
* 汇总发药
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
@@ -87,10 +92,17 @@ public interface ISummaryDispenseMedicineAppService {
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> SummaryDispenseMedicine(List<DispenseItemDto> dispenseMedicineList);
|
||||
=======
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> SummaryDispenseMedicine(List<String> summaryNoList);
|
||||
>>>>>>> v1.3
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@@ -103,6 +115,36 @@ public interface ISummaryDispenseMedicineAppService {
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineReturn(List<DispenseItemDto> dispenseMedicineList);
|
||||
=======
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> dispenseCancel(List<String> summaryNoList);
|
||||
|
||||
// /**
|
||||
// * 住院发药
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// void makeExcelFile(MedicineSummarySearchParam searchParam, Integer pageNo, Integer pageSize, String searchKey,
|
||||
// HttpServletRequest request, HttpServletResponse response);
|
||||
//
|
||||
// /**
|
||||
// * 住院汇总
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// void takeExcelField(FromSearchParam searchParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
// HttpServletRequest request, HttpServletResponse response);
|
||||
>>>>>>> v1.3
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseItemDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
import com.openhis.yb.dto.MedicalInventory3511Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3512Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3513Param;
|
||||
|
||||
/**
|
||||
* 处方管理 应用实现接口
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -20,7 +19,10 @@ import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
@@ -28,7 +30,6 @@ import com.openhis.administration.service.ITraceNoManageService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
@@ -213,10 +214,10 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
|| dispenseDeviceList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
return R.fail("请选择调配药师");
|
||||
}
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发药单id列表
|
||||
List<Long> devDispenseIdList =
|
||||
dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
<<<<<<< HEAD
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
@@ -257,12 +258,65 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
=======
|
||||
|
||||
// 获取耗材待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + 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)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 材料发放信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
@@ -291,7 +345,8 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(deviceDispense.getDeviceDefId())
|
||||
.setLotNumber(deviceDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION));
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setDispenseId(deviceDispense.getId()));
|
||||
if (deviceDispense.getTraceNo() == null) {
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
|
||||
@@ -333,39 +388,39 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 设置进销存参数
|
||||
List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// 用itemId分组
|
||||
Map<Long, DeviceDefinition> deviceMap =
|
||||
deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// 设置库存变更参数
|
||||
for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
if (dev != null) {
|
||||
dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
.setYbNo(dev.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate());
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
// // 返回信息
|
||||
// String returnMsg = null;
|
||||
// List<String> uploadFailedNoList;
|
||||
// // 调用医保商品销售接口
|
||||
// String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// // 医保开关
|
||||
// if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// // 设置进销存参数
|
||||
// List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
// supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// // 用itemId分组
|
||||
// Map<Long, DeviceDefinition> deviceMap =
|
||||
// deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// // 设置库存变更参数
|
||||
// for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
// if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
// DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
// if (dev != null) {
|
||||
// dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
// .setYbNo(dev.getYbNo());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
// uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
// YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
// if (uploadFailedNoList != null) {
|
||||
// returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
// } else {
|
||||
// returnMsg = "3505商品销售上传成功";
|
||||
// }
|
||||
// }
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +442,6 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发申请id列表
|
||||
List<Long> devRequestIdList =
|
||||
chargeItemList.stream().map(ChargeItem::getServiceId).collect(Collectors.toList());
|
||||
@@ -395,6 +449,7 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
List<Long> devDispenseIdList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList))
|
||||
.stream().map(DeviceDispense::getId).collect(Collectors.toList());
|
||||
<<<<<<< HEAD
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
@@ -435,12 +490,65 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
=======
|
||||
|
||||
// 获取耗材待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + 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)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发耗材信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
@@ -475,39 +583,39 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
|
||||
}
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 设置进销存参数
|
||||
List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// 用itemId分组
|
||||
Map<Long, DeviceDefinition> deviceMap =
|
||||
deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// 设置库存变更参数
|
||||
for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
if (dev != null) {
|
||||
dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
.setYbNo(dev.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate());
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
// // 返回信息
|
||||
// String returnMsg = null;
|
||||
// // 调用医保商品销售接口
|
||||
// String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// List<String> uploadFailedNoList = new ArrayList<>();
|
||||
// // 医保开关
|
||||
// if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// // 设置进销存参数
|
||||
// List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
// supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// // 用itemId分组
|
||||
// Map<Long, DeviceDefinition> deviceMap =
|
||||
// deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// // 设置库存变更参数
|
||||
// for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
// if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
// DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
// if (dev != null) {
|
||||
// dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
// .setYbNo(dev.getYbNo());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
// uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
// YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
// if (uploadFailedNoList != null) {
|
||||
// returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
// } else {
|
||||
// returnMsg = "3505商品销售上传成功";
|
||||
// }
|
||||
// }
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
=======
|
||||
import static com.openhis.common.constant.CommonConstants.ExcelOut.*;
|
||||
import static com.openhis.common.constant.CommonConstants.SheetName.SHEET_NAME_DRUG_DETAIL;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
>>>>>>> v1.3
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.openhis.web.inventorymanage.dto.ReceiptPageDto;
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -18,12 +32,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.core.domain.entity.SysDictData;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.core.common.exception.NonCaptureException;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
>>>>>>> v1.3
|
||||
import com.core.system.service.ISysDictTypeService;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
<<<<<<< HEAD
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
=======
|
||||
import com.openhis.common.enums.ConditionCode;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
>>>>>>> v1.3
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.RequestStatus;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
@@ -56,7 +81,10 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
* 获取页面初始化信息
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
@@ -92,17 +120,33 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
@Override
|
||||
public R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 1:住院 2:门诊
|
||||
Integer flg = medDetailsSearchParam.getFlag();
|
||||
medDetailsSearchParam.setFlag(null);
|
||||
// 统计类型 1 3 5 明细
|
||||
Integer statisticalType = medDetailsSearchParam.getInventoryScope();
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (CommonConstants.StatisticalType.DETAIL_DEVICE_TYPE.equals(statisticalType)) {
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
medDetailsSearchParam.setInventoryScope(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage =
|
||||
medicationDetailsMapper.selectAmbPractitionerDetailPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
EncounterClass.AMB.getValue(), DispenseStatus.COMPLETED.getValue(), RequestStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.REFUNDED.getValue(), 1, flg, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
=======
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
ConditionCode.LOT_NUMBER_COST.getCode());
|
||||
>>>>>>> v1.3
|
||||
|
||||
return R.ok(medDetailsPage);
|
||||
|
||||
@@ -127,6 +171,7 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
// 先获取Page对象,再获取其中的记录列表
|
||||
Page<MedDetailedAccountPageDto> pageData = (Page<MedDetailedAccountPageDto>)result.getData();
|
||||
List<MedDetailedAccountPageDto> dataList = pageData.getRecords();
|
||||
<<<<<<< HEAD
|
||||
|
||||
// 获取字典数据
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
@@ -141,10 +186,31 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
&& dictData.getDictValue().equals(unitCode)) {
|
||||
medDetailedAccountPageDto.setUnitCode_dictText(dictData.getDictLabel());
|
||||
break;
|
||||
=======
|
||||
// 判断项目类别
|
||||
try {
|
||||
// 获取字典数据
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode = medDetailedAccountPageDto.getUnitCode();
|
||||
// 添加空值检查
|
||||
if (unitCode != null && sysDictTypeService != null) {
|
||||
// 缓存字典数据,避免重复查询
|
||||
List<SysDictData> unitCodelist =
|
||||
sysDictTypeService.selectDictDataByType(CommonConstants.FieldName.UnitCode);
|
||||
if (unitCodelist != null) {
|
||||
for (SysDictData dictData : unitCodelist) {
|
||||
if (dictData != null && dictData.getDictValue() != null
|
||||
&& dictData.getDictValue().equals(unitCode)) {
|
||||
// 设置字典数据
|
||||
medDetailedAccountPageDto.setUnitCode_dictText(dictData.getDictLabel());
|
||||
break;
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
// 将发药数量与单位拼接
|
||||
@@ -242,6 +308,107 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
e.printStackTrace();
|
||||
System.out.printf("导出Excel失败:" + e.getMessage());
|
||||
}
|
||||
=======
|
||||
|
||||
// 将发药数量与单位拼接
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
|
||||
Integer dispenseQuantity = medDetailedAccountPageDto.getDispenseQuantity();
|
||||
// 空值处理:单位为空时只显示数量
|
||||
String quantityStr = dispenseQuantity != null ? dispenseQuantity.toString() : "0";
|
||||
if (StringUtils.isNotBlank(unitCode_dictText)) {
|
||||
medDetailedAccountPageDto.setDispenseQuantityStr(quantityStr + unitCode_dictText);
|
||||
} else {
|
||||
medDetailedAccountPageDto.setDispenseQuantityStr(quantityStr);
|
||||
}
|
||||
}
|
||||
|
||||
// 将退药数量与单位拼接
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
|
||||
Integer refundQuantity = medDetailedAccountPageDto.getRefundQuantity();
|
||||
// 空值处理:数量为空时默认为0
|
||||
String quantityStr = refundQuantity != null ? refundQuantity.toString() : CONSTANTZERO;
|
||||
// 单位为空时只显示数量
|
||||
if (StringUtils.isNotBlank(unitCode_dictText)) {
|
||||
medDetailedAccountPageDto.setRefundQuantityStr(quantityStr + unitCode_dictText);
|
||||
} else {
|
||||
medDetailedAccountPageDto.setRefundQuantityStr(quantityStr);
|
||||
}
|
||||
}
|
||||
|
||||
// 将退药金额保留两位小数
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取退药金额
|
||||
BigDecimal refundPrice = medDetailedAccountPageDto.getRefundPrice();
|
||||
// 为空导出0.00
|
||||
if (refundPrice == null) {
|
||||
medDetailedAccountPageDto.setRefundPriceStr(CONSTANT_ZERO_DML);
|
||||
// 等于零导出0.00
|
||||
} else if (refundPrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setRefundPriceStr(CONSTANT_ZERO_DML);
|
||||
// 不为零导出退药金额且保留两位小数
|
||||
} else {
|
||||
refundPrice = refundPrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setRefundPriceStr(refundPrice.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 发药金额
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取发药金额
|
||||
BigDecimal dispensePrice = medDetailedAccountPageDto.getDispensePrice();
|
||||
// 为空导出0.00
|
||||
if (dispensePrice == null) {
|
||||
medDetailedAccountPageDto.setDispensePriceStr(CONSTANT_ZERO_DML);
|
||||
// 等于零导出0.00
|
||||
} else if (dispensePrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setDispensePriceStr(CONSTANT_ZERO_DML);
|
||||
// 不为零导出金额且保留两位小数
|
||||
} else {
|
||||
dispensePrice = dispensePrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setDispensePriceStr(dispensePrice.toString());
|
||||
}
|
||||
|
||||
}
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
BigDecimal costPrice = medDetailedAccountPageDto.getCostPrice();
|
||||
if (costPrice == null) {
|
||||
medDetailedAccountPageDto.setCostPriceStr(CONSTANT_ZERO_DML);
|
||||
} else if (costPrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setCostPriceStr(CONSTANT_ZERO_DML);
|
||||
} else {
|
||||
costPrice = costPrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setCostPriceStr(costPrice.toString());
|
||||
}
|
||||
}
|
||||
// 添加项目类别
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取项目类别值
|
||||
String itemTable = medDetailedAccountPageDto.getItemTable();
|
||||
// 类别不为空且在med_medication_definition中导出药材
|
||||
if (itemTable != null) {
|
||||
if (itemTable.equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION)) {
|
||||
medDetailedAccountPageDto.setItemTable(MEDICATION);
|
||||
}
|
||||
// 类别不为空且在adm_device_definition中导出耗材
|
||||
if (itemTable.equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION)) {
|
||||
medDetailedAccountPageDto.setItemTable(DEVICE);
|
||||
}
|
||||
// 类别为空则导出未知类型
|
||||
} else {
|
||||
medDetailedAccountPageDto.setItemTable(UNKONWN_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil<MedDetailedAccountPageDto> util = new ExcelUtil<>(MedDetailedAccountPageDto.class);
|
||||
util.exportExcel(response, dataList, SHEET_NAME_DRUG_DETAIL);
|
||||
} catch (Exception e) {
|
||||
throw new NonCaptureException(StringUtils.format("导出excel失败"), e);
|
||||
}
|
||||
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,18 +426,33 @@ public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppSer
|
||||
public R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
|
||||
// 1:住院 2:门诊
|
||||
Integer flg = medDetailsSearchParam.getFlag();
|
||||
medDetailsSearchParam.setFlag(null);
|
||||
|
||||
// 统计类型 2 4 6
|
||||
Integer statisticalType = medDetailsSearchParam.getInventoryScope();
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (CommonConstants.StatisticalType.ACCOUNT_DEVICE_TYPE.equals(statisticalType)) {
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
medDetailsSearchParam.setInventoryScope(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage =
|
||||
medicationDetailsMapper.selectAmbPractitionerDetailPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
EncounterClass.AMB.getValue(), DispenseStatus.COMPLETED.getValue(), RequestStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.REFUNDED.getValue(), 2, flg, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
=======
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
ConditionCode.LOT_NUMBER_COST.getCode());
|
||||
>>>>>>> v1.3
|
||||
|
||||
return R.ok(medDetailsPage);
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
>>>>>>> v1.3
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -33,6 +37,7 @@ import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
@@ -119,9 +124,6 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
@Resource
|
||||
private YbHttpUtils ybHttpUtils;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
@@ -141,10 +143,10 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
|
||||
// 发药状态
|
||||
List<ReturnMedicineInitDto.RefundStatusOption> refundStatusOptions = new ArrayList<>();
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(RequestStatus.CANCELLED.getValue(),
|
||||
RequestStatus.CANCELLED.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(RequestStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.PENDING_REFUND.getValue(),
|
||||
DispenseStatus.PENDING_REFUND.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.REFUNDED.getValue(),
|
||||
DispenseStatus.REFUNDED.getInfo()));
|
||||
initDto.setDepartmentOptions(organizationOptions).setRefundStatusOptions(refundStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
@@ -168,8 +170,8 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询退药患者分页列表
|
||||
Page<EncounterInfoDto> encounterInfoPage = returnMedicineMapper
|
||||
.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
|
||||
Page<EncounterInfoDto> encounterInfoPage =
|
||||
returnMedicineMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
@@ -195,8 +197,8 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
// 获取退药信息
|
||||
List<ReturnMedicineInfoDto> returnMedicineInfoList = returnMedicineMapper.selectReturnMedicineInfo(encounterId,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
||||
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus, RequestStatus.CANCELLED.getValue(),
|
||||
RequestStatus.COMPLETED.getValue());
|
||||
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus,
|
||||
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.REFUNDED.getValue());
|
||||
returnMedicineInfoList.forEach(returnMedicineInfoDto -> {
|
||||
// 退药状态
|
||||
returnMedicineInfoDto.setRefundEnum_enumText(
|
||||
@@ -234,55 +236,64 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
|
||||
}
|
||||
});
|
||||
// 获取药品发放id列表
|
||||
List<Long> medDispenseIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品退药请求id列表
|
||||
List<Long> medRequestIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
|
||||
if (!medRequestIdList.isEmpty()) {
|
||||
// 药品已退药信息查询
|
||||
List<MedicationDispense> refundList = medicationDispenseService.list(
|
||||
new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getMedReqId, medRequestIdList));
|
||||
if (refundList != null) {
|
||||
if (refundList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("药品已退药,请勿重复退药");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 退药单列表
|
||||
List<MedicationDispense> medicationRefundList = new ArrayList<>();
|
||||
// 进销存参数
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
if (!medDispenseIdList.isEmpty()) {
|
||||
// 药品已发放信息查询
|
||||
List<MedicationDispense> medicationDispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
// 根据发药单对应生成退药单
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
// 退药的药品请求id
|
||||
for (ReturnMedicineDto returnMedicineDto : returnMedicineList) {
|
||||
if (returnMedicineDto.getDispenseId().equals(medicationDispense.getId())) {
|
||||
medicationDispense.setMedReqId(returnMedicineDto.getRequestId());
|
||||
}
|
||||
}
|
||||
// 药品发放编码
|
||||
medicationDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
|
||||
|
||||
// 处理退药
|
||||
// 获取药品退药id列表
|
||||
List<Long> medReturnIdList = new ArrayList<>();
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 获取药品退药id列表
|
||||
medReturnIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品退药请求id列表
|
||||
List<Long> medRequestIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (medReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
if (medRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 药品退药信息查询
|
||||
List<MedicationDispense> refundMedList = medicationDispenseService.listByIds(medReturnIdList);
|
||||
// 药品退药请求查询
|
||||
List<MedicationRequest> refundMedRequestList = medicationRequestService.listByIds(medRequestIdList);
|
||||
if (refundMedList == null || refundMedList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 重复退药校验
|
||||
if (refundMedList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("药品已退药,请勿重复退药");
|
||||
}
|
||||
|
||||
// 更新退药单
|
||||
for (MedicationDispense medicationDispense : refundMedList) {
|
||||
// 退药状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 退药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 退药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
medicationDispense.setId(null);
|
||||
medicationRefundList.add(medicationDispense);
|
||||
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto()
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber()));
|
||||
SupplyItemDetailDto supplyItemDetailDto = new SupplyItemDetailDto();
|
||||
for (MedicationRequest medicationRequest : refundMedRequestList) {
|
||||
// 根据退药id查询退药请求id(用于医保关联)
|
||||
if (medicationDispense.getMedReqId().equals(medicationRequest.getId())) {
|
||||
supplyItemDetailDto.setRequestId(medicationRequest.getRefundMedicineId());
|
||||
}
|
||||
}
|
||||
supplyItemDetailDto.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber());
|
||||
supplyItemDetailList.add(supplyItemDetailDto);
|
||||
|
||||
// 追溯码表相关处理
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
@@ -312,52 +323,46 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
}
|
||||
}
|
||||
}
|
||||
medicationDispenseService.saveBatch(medicationRefundList);
|
||||
// 退药更新
|
||||
medicationDispenseService.updateBatchById(refundMedList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
medicationRequestService.updateCompletedStatusBatch(medRequestIdList, null, null);
|
||||
}
|
||||
// 获取耗材发放id列表
|
||||
List<Long> devDispenseIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取退耗材请求id列表
|
||||
List<Long> devRequestIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (!devRequestIdList.isEmpty()) {
|
||||
// 药品已退药信息查询
|
||||
List<DeviceDispense> refundList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList));
|
||||
if (refundList != null) {
|
||||
if (refundList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("耗材已退,请勿重复操作");
|
||||
}
|
||||
|
||||
// 处理退耗材
|
||||
// 获取退耗材id列表
|
||||
List<Long> devReturnIdList = new ArrayList<>();
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
// 获取退耗材id列表
|
||||
devReturnIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取退耗材请求id列表
|
||||
List<Long> devRequestIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (devReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
}
|
||||
// 退耗材单列表
|
||||
List<DeviceDispense> devRefundList = new ArrayList<>();
|
||||
if (!devDispenseIdList.isEmpty()) {
|
||||
// 耗材已发放信息查询
|
||||
List<DeviceDispense> deviceDispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// 根据发药单对应生成退药单
|
||||
for (DeviceDispense deviceDispense : deviceDispenseList) {
|
||||
// 耗材发放编码
|
||||
deviceDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
|
||||
// 退耗材的耗材请求id
|
||||
for (ReturnMedicineDto returnDeviceDto : returnDeviceList) {
|
||||
if (returnDeviceDto.getDispenseId().equals(deviceDispense.getId())) {
|
||||
deviceDispense.setDeviceReqId(returnDeviceDto.getRequestId());
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
|
||||
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
}
|
||||
}
|
||||
if (devRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 退耗材信息查询
|
||||
List<DeviceDispense> refundDevList = deviceDispenseService.listByIds(devReturnIdList);
|
||||
if (refundDevList == null || refundDevList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 重复退耗材校验
|
||||
if (refundDevList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("耗材已退,请勿重复操作");
|
||||
}
|
||||
// 更新退耗材单状态
|
||||
for (DeviceDispense deviceDispense : refundDevList) {
|
||||
// 退药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 退药状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
deviceDispense.setId(null);
|
||||
devRefundList.add(deviceDispense);
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList
|
||||
.add(new SupplyItemDetailDto().setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
@@ -387,13 +392,17 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
// traceNoManageList.add(traceNoManage);
|
||||
// }
|
||||
}
|
||||
deviceDispenseService.saveBatch(devRefundList);
|
||||
deviceDispenseService.updateBatchById(refundDevList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
|
||||
}
|
||||
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(traceNoManageList);
|
||||
|
||||
// 处理退库存
|
||||
// 获取库存信息
|
||||
<<<<<<< HEAD
|
||||
List<UnDispenseInventoryDto> inventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
@@ -412,14 +421,47 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
|
||||
inventoryItem.setQuantity(inventory.getInventoryQuantity()
|
||||
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
|
||||
=======
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devReturnIdList, medReturnIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + 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()) {
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
}
|
||||
// 理论上不出bug的情况下以项目id,批号,仓库进行分组处理库存一定唯一所以get(0)
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryList.get(0).getInventoryId())
|
||||
.setQuantity(inventoryList.get(0).getInventoryQuantity().add(minQuantity)));
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(traceNoManageList);
|
||||
} else {
|
||||
throw new ServiceException("请检查库存信息");
|
||||
}
|
||||
|
||||
// 处理退药医保
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
@@ -428,13 +470,13 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<DeviceDefinition> deviceDefinitions = new ArrayList<>();
|
||||
List<MedicationDefinition> medicationDefinitions = new ArrayList<>();
|
||||
if (!medicationRefundList.isEmpty()) {
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 设置进销存参数
|
||||
medicationDefinitions = medicationDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
}
|
||||
if (!devRefundList.isEmpty()) {
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
deviceDefinitions = deviceDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
@@ -450,30 +492,30 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
.collect(Collectors.toMap(DeviceDefinition::getId, Function.identity())) : new HashMap<>();
|
||||
|
||||
// 设置库存变更参数,添加完整判空
|
||||
for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
if (dto == null)
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
if (supplyItemDetailDto == null)
|
||||
continue;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dto.getItemTable())) {
|
||||
if (dto.getItemId() != null) {
|
||||
MedicationDefinition med = medicationMap.get(dto.getItemId());
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
MedicationDefinition med = medicationMap.get(supplyItemDetailDto.getItemId());
|
||||
if (med != null) {
|
||||
dto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent())
|
||||
supplyItemDetailDto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent())
|
||||
.setRxFlag(med.getRxFlag()).setYbNo(med.getYbNo());
|
||||
}
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
if (dto.getItemId() != null) {
|
||||
DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
DeviceDefinition dev = deviceMap.get(supplyItemDetailDto.getItemId());
|
||||
if (dev != null) {
|
||||
dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent())
|
||||
supplyItemDetailDto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent())
|
||||
.setRxFlag(dev.getRxFlag()).setYbNo(dev.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = this.ybReturnIntegrated(medDispenseIdList, devDispenseIdList);
|
||||
uploadFailedNoList = this.ybReturnIntegrated(medReturnIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate());
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3506商品销售退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
@@ -503,7 +545,16 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
if (dispenseInventoryDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
result = ybService.cancelMerchandise(getMedical3505Result(dispenseInventoryDto));
|
||||
Pair<Medical3506Param, Contract> medical3506Pair = getMedical3506Param(dispenseInventoryDto);
|
||||
// 如果自费则自动取省医保
|
||||
Contract contract = medical3506Pair.getRight();
|
||||
if (contract != null) {
|
||||
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(medical3506Pair.getRight().getBusNo())) {
|
||||
contract = null;
|
||||
}
|
||||
}
|
||||
result = ybService.cancelMerchandise(medical3506Pair.getLeft(), contract);
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
@@ -512,19 +563,19 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Medical3506Param getMedical3505Result(DispenseInventoryDto dispenseInventoryDto) {
|
||||
private Pair<Medical3506Param, Contract> getMedical3506Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3506Param medical3506Param = new Medical3506Param();
|
||||
ChargeItem chargeItem = null;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
// 查询费用结算信息
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
}
|
||||
if (chargeItem == null) {
|
||||
@@ -602,9 +653,9 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
}
|
||||
}
|
||||
medical3506Param.setMedListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getRefundId().toString())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
|
||||
.setManuDate(dispenseInventoryDto.getProductionDate())
|
||||
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
|
||||
@@ -635,7 +686,11 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
return medical3506Param;
|
||||
=======
|
||||
return Pair.of(medical3506Param, contract);
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
private MedicalInventory3511Param getMedical3511Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
<<<<<<< HEAD
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
=======
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
>>>>>>> v1.3
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
<<<<<<< HEAD
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -33,17 +41,33 @@ import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
=======
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
>>>>>>> v1.3
|
||||
import com.openhis.administration.service.ITraceNoManageService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
<<<<<<< HEAD
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
<<<<<<< HEAD
|
||||
import com.openhis.medication.service.impl.MedicationRequestServiceImpl;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto;
|
||||
@@ -59,10 +83,16 @@ import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.SummaryDispenseMedicineMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper;
|
||||
=======
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
>>>>>>> v1.3
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
@@ -77,6 +107,7 @@ import com.openhis.workflow.service.ISupplyRequestService;
|
||||
public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMedicineAppService {
|
||||
|
||||
@Resource
|
||||
<<<<<<< HEAD
|
||||
private IPractitionerAppService practitionerAppService;
|
||||
|
||||
@Resource
|
||||
@@ -100,6 +131,13 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
@Resource
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
=======
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
>>>>>>> v1.3
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@@ -108,12 +146,27 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
<<<<<<< HEAD
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
|
||||
|
||||
@Resource
|
||||
private IMedicineSummaryAppService inpatientMedicineCollectionAppService;
|
||||
=======
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDefinitionService medicationDefinitionService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppService;
|
||||
>>>>>>> v1.3
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseMapper westernMedicineDispenseMapper;
|
||||
@@ -149,8 +202,9 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
* 汇总发药
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
@@ -569,10 +623,85 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
=======
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> SummaryDispenseMedicine(List<String> summaryNoList) {
|
||||
if (summaryNoList == null || summaryNoList.isEmpty()) {
|
||||
return R.fail("未选择汇总单");
|
||||
}
|
||||
|
||||
// 根据汇总单号查所有发放信息
|
||||
List<MedicationDispense> medDispenseList = medicationDispenseService.getMedDispenseBySummaryNo(summaryNoList);
|
||||
if (medDispenseList == null || medDispenseList.isEmpty()) {
|
||||
return R.fail("未查询到发药单明细,请刷新后重试");
|
||||
}
|
||||
List<Long> medDispenseIdList =
|
||||
medDispenseList.stream().map(MedicationDispense::getId).collect(Collectors.toList());
|
||||
// 获取药品待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + 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)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
}
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Date now = DateUtils.getNowDate();
|
||||
>>>>>>> v1.3
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
<<<<<<< HEAD
|
||||
if (dispenseList != null) {
|
||||
// if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
// .anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
|
||||
@@ -646,6 +775,87 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
=======
|
||||
// 更新发药明细状态
|
||||
for (MedicationDispense medicationDispense : medDispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(now);
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(now);
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(medicationDispense.getMedicationId())
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION));
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(medicationDispense.getMedicationId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// 仓库
|
||||
.setLocationId(medicationDispense.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(medicationDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(medDispenseList);
|
||||
// 查询汇总申请和汇总发放信息
|
||||
List<SupplyRequest> supplyRequestList = supplyRequestService.getSupplyByBusNoBatch(summaryNoList);
|
||||
if (supplyRequestList == null || supplyRequestList.isEmpty()) {
|
||||
throw new ServiceException("未找到汇总申请信息");
|
||||
}
|
||||
List<Long> requestId = supplyRequestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
List<SupplyDelivery> supplyDeliveryList = supplyDeliveryService.selectByRequestIdList(requestId);
|
||||
if (supplyDeliveryList == null || supplyDeliveryList.isEmpty()) {
|
||||
throw new ServiceException("未找到汇总发放信息");
|
||||
}
|
||||
if (supplyDeliveryList.stream().anyMatch(x -> x.getStatusEnum().equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("汇总已发放,请勿重复操作");
|
||||
}
|
||||
// 汇总发放更新
|
||||
for (SupplyDelivery supplyDelivery : supplyDeliveryList) {
|
||||
// 药品发放状态
|
||||
supplyDelivery.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 发药时间
|
||||
supplyDelivery.setOccurrenceTime(now);
|
||||
// 发药人
|
||||
supplyDelivery.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
}
|
||||
supplyDeliveryService.updateBatchById(supplyDeliveryList);
|
||||
// 汇总发放申请更新
|
||||
for (SupplyRequest supplyRequest : supplyRequestList) {
|
||||
// 审核状态:已通过
|
||||
supplyRequest.setStatusEnum(SupplyStatus.AGREE.getValue())
|
||||
// 审核人
|
||||
.setApproverId(SecurityUtils.getLoginUser().getPractitionerId())
|
||||
// 审核时间
|
||||
.setApprovalTime(now);
|
||||
}
|
||||
supplyRequestService.updateBatchById(supplyRequestList);
|
||||
|
||||
>>>>>>> v1.3
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
@@ -654,7 +864,8 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 设置进销存参数
|
||||
List<MedicationDefinition> medicationDefinitions = medicationDefinitionService.listByIds(
|
||||
@@ -674,19 +885,24 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
}
|
||||
uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
<<<<<<< HEAD
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate());
|
||||
=======
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
>>>>>>> v1.3
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@@ -706,6 +922,21 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
summaryFlag = true;
|
||||
}
|
||||
|
||||
=======
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> dispenseCancel(List<String> summaryNoList) {
|
||||
if (summaryNoList == null || summaryNoList.isEmpty()) {
|
||||
return R.fail("未选择汇总单");
|
||||
}
|
||||
|
||||
// 根据汇总单号查所有发放id
|
||||
List<Long> medDispenseIdList = medicationDispenseService.getMedDispenseBySummaryNo(summaryNoList).stream()
|
||||
.map(MedicationDispense::getId).toList();
|
||||
|
||||
>>>>>>> v1.3
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
@@ -714,16 +945,26 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
<<<<<<< HEAD
|
||||
medicationDispense.setNotPerformedReasonEnum(dispenseMedicineList.get(0).getNotPerformedReasonEnum());
|
||||
=======
|
||||
// medicationDispense.setNotPerformedReasonEnum(dispenseMedicineList.get(0).getNotPerformedReasonEnum());
|
||||
>>>>>>> v1.3
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseList);
|
||||
// 汇总发放更新
|
||||
<<<<<<< HEAD
|
||||
if (summaryFlag) {
|
||||
List<Long> requestId = supplyRequestService.getSupplyByBusNo(dispenseMedicineList.get(0).getBusNo())
|
||||
.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
=======
|
||||
for (String summaryNo : summaryNoList) {
|
||||
List<Long> requestId = supplyRequestService.getSupplyByBusNo(summaryNo).stream()
|
||||
.map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
>>>>>>> v1.3
|
||||
List<SupplyDelivery> supplyDeliveryList = supplyDeliveryService.selectByRequestIdList(requestId);
|
||||
for (SupplyDelivery supplyDelivery : supplyDeliveryList) {
|
||||
// 药品发放状态
|
||||
@@ -736,6 +977,7 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
@@ -952,4 +1194,6 @@ public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMe
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"退药"}));
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.stream.Stream;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -37,8 +38,10 @@ import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||
@@ -50,6 +53,7 @@ import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.dto.Medical3505Param;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.YbHttpUtils;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
import reactor.util.annotation.Nullable;
|
||||
@@ -69,6 +73,9 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@@ -81,6 +88,9 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
@Resource
|
||||
private YbManager ybService;
|
||||
|
||||
@Resource
|
||||
private YbHttpUtils ybHttpUtils;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
@@ -221,7 +231,8 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
Page<ItemDispenseOrderDto> medicineDispenseOrderPage =
|
||||
westernMedicineDispenseMapper.selectMedicineDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus,
|
||||
PublicationStatus.ACTIVE.getValue());
|
||||
medicineDispenseOrderPage.getRecords().forEach(medicineDispenseOrder -> {
|
||||
// 发药状态
|
||||
medicineDispenseOrder.setStatusEnum_enumText(
|
||||
@@ -240,6 +251,20 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicinePrepare(List<DispenseItemDto> dispenseMedicineList) {
|
||||
// 追溯码集合
|
||||
List<String> traceNoList =
|
||||
dispenseMedicineList.stream().map(DispenseItemDto::getTraceNo).collect(Collectors.toList());
|
||||
// 非输液药品的已出库追溯码
|
||||
List<String> outTraceNoList = westernMedicineDispenseMapper.getOutTraceNo(TraceNoStatus.OUT.getValue(),
|
||||
Whether.YES.getValue(), SplitPropertyCode.OUTPATIENT_MIN_UNIT_CEIL.getValue(),
|
||||
SplitPropertyCode.OUTPATIENT_MIN_UNIT_TOTAL_CEIL.getValue(), SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
// 取交集
|
||||
if (!traceNoList.isEmpty() && !outTraceNoList.isEmpty()) {
|
||||
List<String> list = traceNoList.stream().filter(outTraceNoList::contains).collect(Collectors.toList());
|
||||
if (!list.isEmpty()) {
|
||||
throw new ServiceException("追溯码【" + String.join(",", list) + "】已出库");
|
||||
}
|
||||
}
|
||||
// 配药人检查
|
||||
if (dispenseMedicineList.get(0).getPreparerId() == null
|
||||
|| dispenseMedicineList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
@@ -248,6 +273,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList =
|
||||
dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
<<<<<<< HEAD
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
@@ -291,9 +317,12 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
|
||||
@@ -309,9 +338,35 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
// 配药时间
|
||||
medicationDispense.setPrepareTime(DateUtils.getNowDate());
|
||||
for (DispenseItemDto dispenseItemDto : dispenseMedicineList) {
|
||||
if (medicationDispense.getId().equals(dispenseItemDto.getDispenseId()))
|
||||
if (medicationDispense.getId().equals(dispenseItemDto.getDispenseId())) {
|
||||
// 药品追溯码
|
||||
medicationDispense.setTraceNo(dispenseItemDto.getTraceNo());
|
||||
// 批次号
|
||||
medicationDispense.setLotNumber(dispenseItemDto.getLotNumber());
|
||||
// 药品数量
|
||||
medicationDispense.setQuantity(dispenseItemDto.getQuantity());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查询对应的药品医嘱
|
||||
List<MedicationRequest> medicationRequests = medicationRequestService.listByIds(
|
||||
dispenseList.stream().map(MedicationDispense::getMedReqId).distinct().collect(Collectors.toList()));
|
||||
// 根据请求id做map
|
||||
Map<Long, List<MedicationDispense>> dispenseMap =
|
||||
dispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
|
||||
for (MedicationRequest medicationRequest : medicationRequests) {
|
||||
List<MedicationDispense> medicationDispenseList = dispenseMap.get(medicationRequest.getId());
|
||||
BigDecimal dispenseQuantity = BigDecimal.ZERO;
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
if (medicationRequest.getUnitCode().equals(medicationDispense.getUnitCode())) {
|
||||
dispenseQuantity = dispenseQuantity.add(medicationDispense.getQuantity());
|
||||
} else {
|
||||
throw new ServiceException("配药失败,请检查发药单单位");
|
||||
}
|
||||
}
|
||||
// 校验开药数量与待发药数量是否相同
|
||||
if (dispenseQuantity.compareTo(medicationRequest.getQuantity()) != 0) {
|
||||
throw new ServiceException("配药失败,请检查发药单数量");
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
@@ -331,10 +386,10 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineDispense(List<DispenseItemDto> dispenseMedicineList) {
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList =
|
||||
dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
<<<<<<< HEAD
|
||||
|
||||
// 获取药品发放库存信息
|
||||
List<UnDispenseInventoryDto> inventoryList =
|
||||
@@ -379,76 +434,139 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
return R.fail(unDispenseInventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(unDispenseInventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
=======
|
||||
// 获取药品待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 发药单状态校验
|
||||
if (unDispenseInventoryList.stream().map(UnDispenseInventoryDto::getDispenseStatus)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
|
||||
throw new ServiceException("发药失败,请检查发药单状态");
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + 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)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
|
||||
// 发药单待更新列表
|
||||
List<MedicationDispense> dispenseUpdateList = new ArrayList<>();
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
// 进销存参数列表
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
|
||||
throw new ServiceException("发药失败,请检查发药单状态");
|
||||
} else {
|
||||
for (MedicationDispense medicationDispense : dispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(medicationDispense.getMedicationId())
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION));
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(medicationDispense.getMedicationId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// 仓库
|
||||
.setLocationId(medicationDispense.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(medicationDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
// 当前时间
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
// 当前用户id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : unDispenseInventoryList) {
|
||||
MedicationDispense medicationDispense = new MedicationDispense();
|
||||
// 发药单id
|
||||
medicationDispense.setId(unDispenseInventoryDto.getDispenseId());
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(nowDate);
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(unDispenseInventoryDto.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(nowDate);
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(practitionerId);
|
||||
dispenseUpdateList.add(medicationDispense);
|
||||
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(unDispenseInventoryDto.getItemId())
|
||||
.setLotNumber(unDispenseInventoryDto.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setRequestId(unDispenseInventoryDto.getRequestId()));
|
||||
|
||||
// 处理追溯码相关
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
if (unDispenseInventoryDto.getTraceNo() != null) {
|
||||
String[] traceNoList = unDispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(unDispenseInventoryDto.getItemId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// 仓库
|
||||
.setLocationId(unDispenseInventoryDto.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(unDispenseInventoryDto.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(unDispenseInventoryDto.getDispenseUnit())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseUpdateList);
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
if (!tracesNoManageList.isEmpty()) {
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
@@ -473,7 +591,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
}
|
||||
uploadFailedNoList = this.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate());
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
@@ -535,7 +653,16 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
if (dispenseInventoryDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
result = ybService.merchandise(getMedical3505Param(dispenseInventoryDto));
|
||||
Pair<Medical3505Param, Contract> medical3505Pair = getMedical3505Param(dispenseInventoryDto);
|
||||
// 如果自费则自动取省医保
|
||||
Contract contract = medical3505Pair.getRight();
|
||||
if (contract != null) {
|
||||
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(medical3505Pair.getRight().getBusNo())) {
|
||||
contract = null;
|
||||
}
|
||||
}
|
||||
result = ybService.merchandise(medical3505Pair.getLeft(), contract);
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
@@ -544,7 +671,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Medical3505Param getMedical3505Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
private Pair<Medical3505Param, Contract> getMedical3505Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3505Param medical3505Param = new Medical3505Param();
|
||||
ChargeItem chargeItem = null;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
@@ -638,7 +765,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
}
|
||||
}
|
||||
medical3505Param.setMedListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getReqId().toString())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setPrscDrName(dispenseInventoryDto.getPractitionerName())
|
||||
.setPharName(dispenseInventoryDto.getDispenseName())
|
||||
@@ -674,7 +801,6 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3505Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
return medical3505Param;
|
||||
|
||||
return Pair.of(medical3505Param, contract);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,7 +29,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@AllArgsConstructor
|
||||
public class MedicalDeviceDispenseController {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
public IMedicalDeviceDispenseAppService medicalDeviceDispenseAppService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -29,7 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@AllArgsConstructor
|
||||
public class MedicationDetailsController {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
public IMedicationDetailsAppService medicationDetailsAppService;
|
||||
|
||||
/**
|
||||
@@ -117,6 +118,21 @@ public class MedicationDetailsController {
|
||||
// return medicationDetailsAppService.getMedRunningAccountPage(medDetailsSearchParam, pageNo, pageSize, searchKey,
|
||||
// request);
|
||||
// }
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
|
||||
/**
|
||||
* 发药明细导出
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param response 请求数据
|
||||
* @param request 请求数据
|
||||
*/
|
||||
>>>>>>> v1.3
|
||||
@GetMapping(value = "/excel-out")
|
||||
public void exportExcel(MedDetailsSearchParam medDetailsSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,7 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@AllArgsConstructor
|
||||
public class PendingMedicationDetailsController {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
public IPendingMedicationDetailsAppService pendingMedicationDetailsAppService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.openhis.web.pharmacymanage.controller;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
<<<<<<< HEAD
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -10,6 +11,13 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import com.openhis.web.inhospitalnursestation.dto.AdmissionPageParam;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
=======
|
||||
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
>>>>>>> v1.3
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppService;
|
||||
@@ -34,6 +42,7 @@ public class SummaryDispenseMedicineController {
|
||||
public ISummaryDispenseMedicineAppService medicineSummaryDispenseService;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
@@ -124,11 +133,22 @@ public class SummaryDispenseMedicineController {
|
||||
@PutMapping("/summary-dispense-medicine")
|
||||
public R<?> SummaryDispenseMedicine(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
|
||||
return medicineSummaryDispenseService.SummaryDispenseMedicine(dispenseMedicineList);
|
||||
=======
|
||||
* 汇总发药
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/summary-dispense-medicine")
|
||||
public R<?> SummaryDispenseMedicine(@RequestBody List<String> summaryNoList) {
|
||||
return medicineSummaryDispenseService.SummaryDispenseMedicine(summaryNoList);
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
<<<<<<< HEAD
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@@ -181,4 +201,49 @@ public class SummaryDispenseMedicineController {
|
||||
|
||||
|
||||
|
||||
=======
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/dispense-cancel")
|
||||
public R<?> dispenseCancel(@RequestBody List<String> summaryNoList) {
|
||||
return medicineSummaryDispenseService.dispenseCancel(summaryNoList);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 住院发药
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// @GetMapping(value = "/excel-out")
|
||||
// public void excelOut(MedicineSummarySearchParam searchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10000") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
|
||||
// HttpServletResponse response) {
|
||||
// medicineSummaryDispenseService.makeExcelFile(searchParam, pageNo, pageSize, searchKey, request, response);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 住院汇总
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// @GetMapping("/excel-put")
|
||||
// public void excelPut(FromSearchParam searchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10000") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
|
||||
// HttpServletResponse response) {
|
||||
// medicineSummaryDispenseService.takeExcelField(searchParam, searchKey, pageNo, pageSize, request, response);
|
||||
// }
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.openhis.yb.dto.MedicalInventory3511Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3512Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3513Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
|
||||
@@ -33,6 +33,10 @@ public class DispenseInventoryDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long reqId;
|
||||
|
||||
/** 退的请求id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long refundId;
|
||||
|
||||
/** 病人id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
@@ -43,7 +47,7 @@ public class DispenseInventoryDto {
|
||||
/** 请求数量 */
|
||||
private BigDecimal dispenseQuantity;
|
||||
|
||||
/** 发放数量 */
|
||||
/** 发放状态 */
|
||||
private Integer dispenseStatus;
|
||||
|
||||
/** 库存项目表主键ID */
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 发药/耗材信息
|
||||
*
|
||||
@@ -27,6 +29,15 @@ public class DispenseItemDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/** 发药数量 */
|
||||
private BigDecimal quantity;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
>>>>>>> v1.3
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
|
||||
|
||||
@@ -73,9 +73,15 @@ public class EncounterInfoDto {
|
||||
/** 就诊日期 */
|
||||
private String receptionTime;
|
||||
|
||||
/** 住院日期 */
|
||||
private String startTime;
|
||||
|
||||
/** 年龄 */
|
||||
private String age;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 库存明细dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryDetailDto {
|
||||
|
||||
/** 库存项目表主键ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long inventoryId;
|
||||
|
||||
/** 项目ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 库房ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 拆零单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String inventoryUnitCode;
|
||||
private String inventoryUnitCode_dictText;
|
||||
|
||||
/** 大单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String maxUnitCode;
|
||||
private String maxUnitCode_dictText;
|
||||
|
||||
/** 当前库存数量(拆零单位) */
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 批号 */
|
||||
private String inventoryLotNumber;
|
||||
|
||||
/** 有效期止 */
|
||||
private Date expirationDate;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -58,19 +59,31 @@ public class ItemDispenseOrderDto {
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "发放药房",sort = 3)
|
||||
=======
|
||||
@Excel(name = "发放药房", sort = 3)
|
||||
>>>>>>> v1.3
|
||||
private String locationName;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "批次号",sort = 4)
|
||||
=======
|
||||
@Excel(name = "批次号", sort = 4)
|
||||
>>>>>>> v1.3
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "科室",sort = 5)
|
||||
=======
|
||||
@Excel(name = "科室", sort = 5)
|
||||
>>>>>>> v1.3
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
@@ -82,13 +95,21 @@ public class ItemDispenseOrderDto {
|
||||
/**
|
||||
* 开单医生
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "开单医生",sort = 6)
|
||||
=======
|
||||
@Excel(name = "开单医生", sort = 6)
|
||||
>>>>>>> v1.3
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 发药医生
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "发药医生",sort = 7)
|
||||
=======
|
||||
@Excel(name = "发药医生", sort = 7)
|
||||
>>>>>>> v1.3
|
||||
private String dispenseDoctorName;
|
||||
|
||||
/**
|
||||
@@ -96,7 +117,11 @@ public class ItemDispenseOrderDto {
|
||||
*/
|
||||
@Dict(dictCode = "med_category_code")
|
||||
private String itemType;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "项目类型",sort = 8)
|
||||
=======
|
||||
@Excel(name = "项目类型", sort = 8)
|
||||
>>>>>>> v1.3
|
||||
private String itemType_dictText;
|
||||
|
||||
|
||||
@@ -105,45 +130,83 @@ public class ItemDispenseOrderDto {
|
||||
* 发药状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "发药状态",sort = 9)
|
||||
=======
|
||||
@Excel(name = "发药状态", sort = 9)
|
||||
>>>>>>> v1.3
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 诊断名称
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "诊断名称",sort = 10)
|
||||
=======
|
||||
@Excel(name = "诊断名称", sort = 10)
|
||||
>>>>>>> v1.3
|
||||
private String conditionName;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "处方号",sort = 11)
|
||||
=======
|
||||
@Excel(name = "处方号", sort = 11)
|
||||
>>>>>>> v1.3
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "项目名称",sort = 1,width = 30)
|
||||
=======
|
||||
@Excel(name = "项目名称", sort = 1, width = 30)
|
||||
>>>>>>> v1.3
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String merchandiseName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "规格",sort = 2,width = 30)
|
||||
=======
|
||||
@Excel(name = "规格", sort = 2, width = 30)
|
||||
>>>>>>> v1.3
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 单次剂量
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "单次剂量",sort = 12)
|
||||
=======
|
||||
@Excel(name = "单次剂量", sort = 12)
|
||||
>>>>>>> v1.3
|
||||
private BigDecimal dose;
|
||||
|
||||
/**
|
||||
* 拆零比
|
||||
*/
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/**
|
||||
* 用药频次
|
||||
*/
|
||||
@Dict(dictCode = "rate_code")
|
||||
private String rateCode;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "用药频次",sort = 13)
|
||||
=======
|
||||
@Excel(name = "用药频次", sort = 13)
|
||||
>>>>>>> v1.3
|
||||
private String rateCode_dictText;
|
||||
|
||||
/**
|
||||
@@ -151,7 +214,11 @@ public class ItemDispenseOrderDto {
|
||||
*/
|
||||
@Dict(dictCode = "method_code")
|
||||
private String methodCode;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "用法",sort = 14)
|
||||
=======
|
||||
@Excel(name = "用法", sort = 14)
|
||||
>>>>>>> v1.3
|
||||
private String methodCode_dictText;
|
||||
|
||||
|
||||
@@ -161,7 +228,11 @@ public class ItemDispenseOrderDto {
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String doseUnitCode;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "剂量单位",sort = 15)
|
||||
=======
|
||||
@Excel(name = "剂量单位", sort = 15)
|
||||
>>>>>>> v1.3
|
||||
private String doseUnitCode_dictText;
|
||||
|
||||
|
||||
@@ -171,38 +242,68 @@ public class ItemDispenseOrderDto {
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "单位",sort = 16)
|
||||
=======
|
||||
@Excel(name = "单位", sort = 16)
|
||||
>>>>>>> v1.3
|
||||
private String unitCode_dictText;
|
||||
|
||||
|
||||
/**
|
||||
* 单次发药数
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "单次发药数",sort = 17)
|
||||
=======
|
||||
@Excel(name = "单次发药数", sort = 17)
|
||||
>>>>>>> v1.3
|
||||
private Integer dispensePerQuantity;
|
||||
|
||||
/**
|
||||
* 每次发药供应天数
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "每次发药供应天数",sort = 18)
|
||||
=======
|
||||
@Excel(name = "每次发药供应天数", sort = 18)
|
||||
>>>>>>> v1.3
|
||||
private Integer dispensePerDuration;
|
||||
|
||||
/**
|
||||
* 请求数量
|
||||
*/
|
||||
private BigDecimal requestQuantity;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "数量",sort = 19)
|
||||
private Integer quantity;
|
||||
=======
|
||||
@Excel(name = "数量", sort = 19)
|
||||
private BigDecimal quantity;
|
||||
>>>>>>> v1.3
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "单价",sort = 20)
|
||||
=======
|
||||
@Excel(name = "单价", sort = 20)
|
||||
>>>>>>> v1.3
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "金额",sort = 21)
|
||||
=======
|
||||
@Excel(name = "金额", sort = 21)
|
||||
>>>>>>> v1.3
|
||||
private BigDecimal totalPrice;
|
||||
/**
|
||||
* 组合号
|
||||
@@ -214,11 +315,16 @@ public class ItemDispenseOrderDto {
|
||||
* 就诊NO
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "就诊NO",sort = 24)
|
||||
=======
|
||||
@Excel(name = "就诊NO", sort = 24)
|
||||
>>>>>>> v1.3
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 开具日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "开具日期",sort = 25, dateFormat = "yyyy-MM-dd HH:mm:ss",width = 25)
|
||||
private Date reqAuthoredTime;
|
||||
|
||||
@@ -232,17 +338,62 @@ public class ItemDispenseOrderDto {
|
||||
|
||||
/** 所在表 */
|
||||
@Excel(name = "所在表",sort = 28,width = 30)
|
||||
=======
|
||||
@Excel(name = "开具日期", sort = 25, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private Date reqAuthoredTime;
|
||||
|
||||
/** 接收皮试标志 */
|
||||
@Excel(name = "皮试标志", sort = 26)
|
||||
private String skinTestFlagDesc;
|
||||
private Integer skinTestFlag;
|
||||
|
||||
/** 接收中药标识 */
|
||||
@Excel(name = "中药标识", sort = 27)
|
||||
private String tcmFlagDesc;
|
||||
private Integer tcmFlag;
|
||||
|
||||
/** 所在表 */
|
||||
@Excel(name = "所在表", sort = 28, width = 30)
|
||||
>>>>>>> v1.3
|
||||
private String itemTable;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "生产厂家",sort = 22,width = 35)
|
||||
=======
|
||||
@Excel(name = "生产厂家", sort = 22, width = 35)
|
||||
>>>>>>> v1.3
|
||||
private String manufacturerText;
|
||||
|
||||
/**
|
||||
* 追溯码
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
@Excel(name = "追溯码",sort = 23)
|
||||
=======
|
||||
@Excel(name = "追溯码", sort = 23)
|
||||
>>>>>>> v1.3
|
||||
private String traceNo;
|
||||
|
||||
/**
|
||||
* 就诊类型
|
||||
*/
|
||||
@Dict(dictCode = "med_type")
|
||||
private String medTypeCode;
|
||||
private String medTypeCode_dictText;
|
||||
|
||||
|
||||
/** 输液标志 */
|
||||
private Integer injectFlag;
|
||||
|
||||
|
||||
/** 拆分属性 */
|
||||
private Integer partAttributeEnum;
|
||||
|
||||
/**
|
||||
* 库存明细列表
|
||||
*/
|
||||
private List<InventoryDetailDto> inventoryDetailList;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -20,15 +22,26 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailedAccountPageDto {
|
||||
<<<<<<< HEAD
|
||||
/** 门诊号 */
|
||||
=======
|
||||
/**
|
||||
* 门诊号
|
||||
*/
|
||||
>>>>>>> v1.3
|
||||
private String outpatientNo;
|
||||
|
||||
/** 处方号 */
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 患者 */
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
<<<<<<< HEAD
|
||||
/** 项目类别 */
|
||||
private String pinYin;
|
||||
|
||||
@@ -58,11 +71,61 @@ public class MedDetailedAccountPageDto {
|
||||
|
||||
/** 药品项目 */
|
||||
@Excel(name = "药品项目")
|
||||
=======
|
||||
/**
|
||||
* 接收发药数量
|
||||
*/
|
||||
@Excel(name = "发药数量", sort = 8)
|
||||
private String dispenseQuantityStr;
|
||||
|
||||
/**
|
||||
* 接收发药金额
|
||||
*/
|
||||
@Excel(name = "发药金额", sort = 9)
|
||||
private String dispensePriceStr;
|
||||
|
||||
/**
|
||||
* 接收退药数量
|
||||
*/
|
||||
@Excel(name = "退药数量", sort = 10)
|
||||
private String refundQuantityStr;
|
||||
|
||||
/**
|
||||
* 接收退药金额
|
||||
*/
|
||||
@Excel(name = "退药金额", sort = 11)
|
||||
private String refundPriceStr;
|
||||
/**
|
||||
* 成本金额
|
||||
*/
|
||||
@Excel(name = "成本金额", sort = 12)
|
||||
private String costPriceStr;
|
||||
|
||||
/**
|
||||
* 发药人
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String practitionerId;
|
||||
|
||||
/**
|
||||
* 发药人名称
|
||||
*/
|
||||
@Excel(name = "发药人", sort = 1)
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 药品项目
|
||||
*/
|
||||
@Excel(name = "药品项目", sort = 3)
|
||||
>>>>>>> v1.3
|
||||
private String medicationName;
|
||||
|
||||
/** 药品拼音 */
|
||||
/**
|
||||
* 药品拼音
|
||||
*/
|
||||
private String pyStr;
|
||||
|
||||
<<<<<<< HEAD
|
||||
/** 项目编码 */
|
||||
@Excel(name = "药品编码")
|
||||
private String busNo;
|
||||
@@ -77,20 +140,56 @@ public class MedDetailedAccountPageDto {
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
=======
|
||||
/**
|
||||
* 项目编码
|
||||
*/
|
||||
@Excel(name = "药品编码", sort = 5)
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 发药编码
|
||||
*/
|
||||
@Excel(name = "发药单号", sort = 2)
|
||||
private String dispenseNo;
|
||||
|
||||
/**
|
||||
* 医保编码
|
||||
*/
|
||||
@Excel(name = "医保编码", sort = 6, width = 30)
|
||||
private String ybNo;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Excel(name = "规格", sort = 7, width = 30)
|
||||
>>>>>>> v1.3
|
||||
private String totalVolume;
|
||||
|
||||
/** 发药数量 */
|
||||
/**
|
||||
* 发药数量
|
||||
*/
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/** 发药金额 */
|
||||
/**
|
||||
* 发药金额
|
||||
*/
|
||||
private BigDecimal dispensePrice;
|
||||
|
||||
/** 退药数量 */
|
||||
/**
|
||||
* 退药数量
|
||||
*/
|
||||
private Integer refundQuantity;
|
||||
|
||||
/** 退药金额 */
|
||||
/**
|
||||
* 退药金额
|
||||
*/
|
||||
private BigDecimal refundPrice;
|
||||
/**
|
||||
* 成本金额
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
/** 批号 */
|
||||
@Excel(name = "生产批号")
|
||||
private String lotNumber;
|
||||
@@ -101,23 +200,60 @@ public class MedDetailedAccountPageDto {
|
||||
|
||||
/** 供应商 */
|
||||
@Excel(name = "供应商")
|
||||
=======
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "生产批号", sort = 13)
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 厂商
|
||||
*/
|
||||
@Excel(name = "厂家/产地", sort = 14, width = 35)
|
||||
private String manufacturerText;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@Excel(name = "供应商", sort = 15, width = 35)
|
||||
>>>>>>> v1.3
|
||||
private String supplierName;
|
||||
|
||||
/** 发药单位 */
|
||||
/**
|
||||
* 发药单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 退药单位 */
|
||||
/**
|
||||
* 退药单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String refundUnitCode;
|
||||
private String refundUnitCode_dictText;
|
||||
|
||||
<<<<<<< HEAD
|
||||
/** 发药时间 */
|
||||
@Excel(name = "发药时间", dateFormat="yyyy-MM-dd HH:mm:ss")
|
||||
private Date dispenseTime;
|
||||
|
||||
/** 项目所在表 */
|
||||
// @Excel(name = "项目类别")
|
||||
=======
|
||||
/**
|
||||
* 发药时间
|
||||
*/
|
||||
@Excel(name = "发药时间", sort = 16, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 35)
|
||||
private Date dispenseTime;
|
||||
|
||||
/**
|
||||
* 项目所在表
|
||||
*/
|
||||
@Excel(name = "项目类别", sort = 4)
|
||||
>>>>>>> v1.3
|
||||
private String itemTable;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发药明细查询条件
|
||||
@@ -42,4 +41,10 @@ public class MedDetailsSearchParam {
|
||||
|
||||
/** 项目所在表 */
|
||||
private String itemTable;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
/** 统计类型 */
|
||||
private Integer inventoryScope;
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
@@ -5,8 +5,12 @@ package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
<<<<<<< HEAD
|
||||
import java.util.List;
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
@@ -23,10 +27,10 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedicineSummaryDto {
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
@Excel(name = "单据号", sort = 8, width = 35)
|
||||
private String busNo;
|
||||
|
||||
/** 供应请求id */
|
||||
@@ -44,6 +48,7 @@ public class MedicineSummaryDto {
|
||||
/**
|
||||
* 项目名
|
||||
*/
|
||||
@Excel(name = "项目名", sort = 2, width = 40)
|
||||
private String itemName;
|
||||
|
||||
/** 项目id */
|
||||
@@ -53,18 +58,32 @@ public class MedicineSummaryDto {
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Excel(name = "规格", sort = 3)
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号", sort = 4)
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 请求数
|
||||
*/
|
||||
@Excel(name = "数量", sort = 5)
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@Excel(name = "序号", sort = 1)
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
@Excel(name = "生产厂家", sort = 7, width = 45)
|
||||
private String manufacturerText;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@@ -85,6 +104,7 @@ public class MedicineSummaryDto {
|
||||
/** 发放地点 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sourceLocationId;
|
||||
@Excel(name = "发放地点", sort = 6)
|
||||
private String sourceLocationName;
|
||||
|
||||
/** 申请科室 */
|
||||
@@ -108,22 +128,4 @@ public class MedicineSummaryDto {
|
||||
|
||||
/** 患者信息 */
|
||||
private String patientInfo;
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<MedicineSummaryDto.Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
|
||||
public Option() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public class UnDispenseInventoryDto implements Serializable {
|
||||
/** 发药ID */
|
||||
private Long dispenseId;
|
||||
|
||||
/** 请求ID */
|
||||
private Long requestId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long itemId;
|
||||
|
||||
@@ -47,6 +50,9 @@ public class UnDispenseInventoryDto implements Serializable {
|
||||
/** 已发数量 */
|
||||
private BigDecimal dispenseQuantity;
|
||||
|
||||
/** 发药状态 */
|
||||
private Integer dispenseStatus;
|
||||
|
||||
/** 发药数量 */
|
||||
private BigDecimal quantity;
|
||||
|
||||
@@ -61,4 +67,7 @@ public class UnDispenseInventoryDto implements Serializable {
|
||||
|
||||
/** 有效期至 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 追溯码 */
|
||||
private String TraceNo;
|
||||
}
|
||||
|
||||
@@ -20,20 +20,33 @@ public interface MedicationDetailsMapper {
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param amb 发药类型:门诊
|
||||
* @param completed 发药状态:已发药
|
||||
* @param refunded 发药状态:已退药
|
||||
<<<<<<< HEAD
|
||||
* @param dispenseEnum 统计类型
|
||||
* @param medMedicationDefinition 药品
|
||||
* @param admDeviceDefinition 耗材
|
||||
=======
|
||||
* @param statisticalType 统计类型
|
||||
* @param flg 1:住院 2:门诊
|
||||
* @param medMedicationDefinition 药品
|
||||
* @param admDeviceDefinition 耗材
|
||||
* @param costEnum 命中条件枚举:产品批号进价
|
||||
>>>>>>> v1.3
|
||||
* @return 门诊人员发药明细表
|
||||
*/
|
||||
Page<MedDetailedAccountPageDto> selectAmbPractitionerDetailPage(@Param("page") Page<MedDetailedAccountPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper, @Param("amb") Integer amb,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper,
|
||||
@Param("completed") Integer completed, @Param("agree") Integer agree, @Param("refunded") Integer refunded,
|
||||
<<<<<<< HEAD
|
||||
@Param("dispenseEnum") Integer dispenseEnum, @Param("flg") Integer flg,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition);
|
||||
=======
|
||||
@Param("statisticalType") Integer statisticalType, @Param("flg") Integer flg,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("costEnum") String costEnum);
|
||||
>>>>>>> v1.3
|
||||
|
||||
// /**
|
||||
// * 门诊发药明细流水账
|
||||
|
||||
@@ -24,11 +24,14 @@ public interface ReturnMedicineMapper {
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param amb 就诊类型:门诊
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
|
||||
<<<<<<< HEAD
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper, @Param("amb") Integer amb);
|
||||
=======
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper);
|
||||
>>>>>>> v1.3
|
||||
|
||||
/**
|
||||
* 申请退药清单查询
|
||||
@@ -39,15 +42,15 @@ public interface ReturnMedicineMapper {
|
||||
* @param medicine 项目类型:药品
|
||||
* @param device 项目类型:耗材
|
||||
* @param refundStatus 退药状态
|
||||
* @param inRefund 退药状态:待退药
|
||||
* @param completed 退药状态:已完成
|
||||
* @param pendingRefund 退药状态:待退药
|
||||
* @param refunded 退药状态:已退药
|
||||
* @return 申请退药清单
|
||||
*/
|
||||
List<ReturnMedicineInfoDto> selectReturnMedicineInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest,
|
||||
@Param("medicine") Integer medicine, @Param("device") Integer device,
|
||||
@Param("refundStatus") Integer refundStatus, @Param("inRefund") Integer inRefund,
|
||||
@Param("completed") Integer completed);
|
||||
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
|
||||
@Param("refunded") Integer refunded);
|
||||
|
||||
/**
|
||||
* 库存信息查询
|
||||
|
||||
@@ -3,17 +3,15 @@
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.openhis.web.pharmacymanage.dto.FromSearchParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
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.pharmacymanage.dto.MedicineSummaryDto;
|
||||
import com.openhis.web.pharmacymanage.dto.MedicineSummarySearchParam;
|
||||
|
||||
@Repository
|
||||
<<<<<<< HEAD
|
||||
public interface SummaryDispenseMedicineMapper {
|
||||
|
||||
/**
|
||||
@@ -36,3 +34,6 @@ public interface SummaryDispenseMedicineMapper {
|
||||
Page<MedicineSummaryDto> selectOrderInfo(@Param("page") Page<MedicineSummaryDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<FromSearchParam> queryWrapper);
|
||||
}
|
||||
=======
|
||||
public interface SummaryDispenseMedicineMapper {}
|
||||
>>>>>>> v1.3
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
|
||||
@Repository
|
||||
@@ -47,13 +48,14 @@ public interface WesternMedicineDispenseMapper {
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param dispenseStatus 发药状态
|
||||
* @param active 库房状态:启用
|
||||
* @return 发耗材单列表
|
||||
*/
|
||||
Page<ItemDispenseOrderDto> selectMedicineDispenseOrderPage(@Param("page") Page<ItemDispenseOrderDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<ItemDispenseOrderDto> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress, @Param("completed") Integer completed,
|
||||
@Param("preparation") Integer preparation, @Param("prepared") Integer prepared,
|
||||
@Param("dispenseStatus") Integer dispenseStatus);
|
||||
@Param("dispenseStatus") Integer dispenseStatus, @Param("active") Integer active);
|
||||
|
||||
/**
|
||||
* 获取配药人下拉选列表
|
||||
@@ -62,4 +64,28 @@ public interface WesternMedicineDispenseMapper {
|
||||
* @return 配药人下拉选列表
|
||||
*/
|
||||
List<Practitioner> getPreparerDoctorList(@Param("pharmacist") String pharmacist);
|
||||
|
||||
/**
|
||||
* 查询药品库存详细信息
|
||||
*
|
||||
* @param medicationIdList 药品id列表
|
||||
* @param locationIdList 库房id列表
|
||||
* @param active 库存状态:启用
|
||||
* @return 库存详细信息
|
||||
*/
|
||||
List<InventoryDetailDto> selectMedicineInventoryDetail(@Param("medicationIdList") List<Long> medicationIdList,
|
||||
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
|
||||
|
||||
/**
|
||||
* 查询非输液药品的已出库追溯码
|
||||
*
|
||||
* @param status 出
|
||||
* @param injectFlag 输液标记
|
||||
* @param operationType 操作类型 | 发药
|
||||
* @return 非输液药品的已出库追溯码
|
||||
*/
|
||||
List<String> getOutTraceNo(@Param("status") Integer status, @Param("injectFlag") Integer injectFlag,
|
||||
@Param("outpatientMinUnitCeil") Integer outpatientMinUnitCeil,
|
||||
@Param("outpatientMinUnitTotalCeil") Integer outpatientMinUnitTotalCeil,
|
||||
@Param("operationType") Integer operationType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user