|
|
|
@ -40,6 +40,7 @@ import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiRlSupService;
|
|
|
|
|
import com.glxp.api.service.basic.impl.BasicDestinyRelService;
|
|
|
|
|
import com.glxp.api.service.inout.IoAddInoutService;
|
|
|
|
|
import com.glxp.api.service.inout.IoCheckInoutService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailBizService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
|
import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
@ -91,6 +92,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
@Resource
|
|
|
|
|
IoAddInoutService ioAddInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCheckInoutService ioCheckInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeTempDao ioCodeTempDao;
|
|
|
|
@ -179,20 +182,38 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
List<ThrInvResultResponse> list = baseResponse.getData().getList();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
|
|
|
|
|
//根据患者分组过滤
|
|
|
|
|
Map<String, List<ThrInvResultResponse>> groupedByInv = list.stream()
|
|
|
|
|
.collect(Collectors.groupingBy(ThrInvResultResponse::getSickerCode));
|
|
|
|
|
groupedByInv.forEach((invCode, invResultResponses) -> {
|
|
|
|
|
String billNo = generateBillNo(filterInvProductRequest);//单据号
|
|
|
|
|
//处理 返回实体 转换成 单据 和 单据明细
|
|
|
|
|
ThrInvOrder thrInvOrder = new ThrInvOrder();
|
|
|
|
|
List<ThrInvOrderDetail> thrInvOrderDetails = new ArrayList<>();
|
|
|
|
|
String thirdSys = filterInvProductRequest.getThirdSys();
|
|
|
|
|
handleExternalConvertThrInvGhOrderDetail(list, thrInvOrderDetails, billNo, thirdSys, thrInvOrder);
|
|
|
|
|
handleExternalConvertThrInvGhOrderDetail(invResultResponses, thrInvOrderDetails, billNo, thirdSys, thrInvOrder);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) {
|
|
|
|
|
handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, list.get(0), Constant.THR_INV_GH_ORDER_TYPE);
|
|
|
|
|
handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, invResultResponses.get(0), Constant.THR_INV_GH_ORDER_TYPE);
|
|
|
|
|
|
|
|
|
|
//保存数据
|
|
|
|
|
thrInvOrderMapper.insert(thrInvOrder);
|
|
|
|
|
thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails);
|
|
|
|
|
|
|
|
|
|
//是否自动生成出入库单据
|
|
|
|
|
if (IntUtil.value(systemParamConfigService.selectValueByParamKey("gh_out_auto_gen")) > 0) {
|
|
|
|
|
GenerateOrderRequest generateOrderRequest = new GenerateOrderRequest();
|
|
|
|
|
generateOrderRequest.setBillNo(thrInvOrder.getBillNo());
|
|
|
|
|
generateOrderRequest.setAction(thrInvOrder.getBillType());
|
|
|
|
|
// generateOrderRequest.setFromCorp(thrInvOrder.getFromCorp());
|
|
|
|
|
generateGhOrder(generateOrderRequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -220,7 +241,6 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
String thrCode = item.getThrCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long relId = basicProductsEntity.getId();
|
|
|
|
|
Integer count;
|
|
|
|
|
if (ConstantType.TYPE_PUT.equals(mainAction)) {
|
|
|
|
@ -483,6 +503,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
ioOrderEntity.setCorpOrderId(billNo);//单据号
|
|
|
|
|
ioOrderEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderEntity.setCreateTime(new Date());
|
|
|
|
|
ioOrderEntity.setCustomerId("110");
|
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
|
ioOrderEntity.setCreateUser(userId + "");
|
|
|
|
|
ioOrderEntity.setUpdateUser(userId + "");
|
|
|
|
@ -490,10 +511,10 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
|
|
|
|
|
List<IoCodeTempEntity> newIoCodeTemps = new ArrayList<>(thrInvOrderDetails.size());
|
|
|
|
|
|
|
|
|
|
//码校验
|
|
|
|
|
if (!checkIoCodeTemps(thrInvOrderDetails)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//码校验,提交时统一校验
|
|
|
|
|
// if (!checkIoCodeTemps(thrInvOrderDetails)) {
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (!copyIoCodeTemps(entry.getValue(), newIoCodeTemps, newBillNo, generateOrderRequest)) {
|
|
|
|
|
return false;
|
|
|
|
@ -508,10 +529,12 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService {
|
|
|
|
|
for (IoCodeTempEntity codeTempEntity : newIoCodeTemps) {
|
|
|
|
|
addInoutService.genOrderDetailCode(ioOrderEntity, codeTempEntity);
|
|
|
|
|
}
|
|
|
|
|
ioAddInoutService.dealProcess(ioOrderEntity);
|
|
|
|
|
if (!ioCheckInoutService.checkManual(ioOrderEntity.getBillNo())) {
|
|
|
|
|
ioCheckInoutService.check(ioOrderEntity.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ioAddInoutService.dealProcess(ioOrderEntity);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|