|
|
|
@ -1,23 +1,36 @@
|
|
|
|
|
package com.glxp.api.controller.thrsys;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
|
|
|
|
import com.glxp.api.req.forthird.ForInvOutScanCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterInvProductRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRlSupResponse;
|
|
|
|
|
import com.glxp.api.res.forthird.ForInvOutScanCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inv.InvProductResponse;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.api.service.forthird.ForThirdSysApiService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPreinProductDetailService;
|
|
|
|
|
import com.glxp.api.service.inv.impl.InvProductDetailService;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@ -25,9 +38,19 @@ public class ForThirdSysApiController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
ForThirdSysApiService forThirdSysApiService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreinProductDetailService invPreinProductDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvPreProductDetailService invPreProductDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvProductDetailService invProductDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* B001 查询指定科室高值/普耗库存
|
|
|
|
|
* B001 查询指定普耗库存
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvProductRequest
|
|
|
|
|
* @return
|
|
|
|
@ -42,6 +65,50 @@ public class ForThirdSysApiController {
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* B001 查询指定科室高值
|
|
|
|
|
*
|
|
|
|
|
* @param filterInvProductRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/forThirdSysApi/inv/high/products/filter")
|
|
|
|
|
public BaseResponse invHighProductsFilter(@RequestBody FilterInvProductRequest filterInvProductRequest) {
|
|
|
|
|
if (ObjectUtil.isNull(filterInvProductRequest)) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
int count = 0;
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterInvProductRequest.getUdiCode());
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = null;
|
|
|
|
|
udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(udiEntity.getUdi(), false);
|
|
|
|
|
if (udiRelevanceResponses.size() == 0) {
|
|
|
|
|
return ResultVOUtils.error("收费项目未对照!");
|
|
|
|
|
}
|
|
|
|
|
//1.获取预验收库存
|
|
|
|
|
InvWarehouseEntity preInInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN);
|
|
|
|
|
if (StrUtil.isNotEmpty(udiEntity.getSerialNo())) {
|
|
|
|
|
count = invPreinProductDetailService.vailStockCountByCode(null, preInInv.getCode(), null, filterInvProductRequest.getUdiCode());
|
|
|
|
|
} else
|
|
|
|
|
count = invPreinProductDetailService.vailStockCount(udiRelevanceResponses.get(0).getRelId(), udiEntity.getBatchNo(), null, null, preInInv.getCode(), null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2.获取寄售库存
|
|
|
|
|
InvWarehouseEntity preInv = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_ADVANCE);
|
|
|
|
|
count = invPreProductDetailService.vailStockCount(udiRelevanceResponses.get(0).getRelId(), udiEntity.getBatchNo(), null, null, preInv.getCode(), null);
|
|
|
|
|
|
|
|
|
|
//3.获取入账库库存
|
|
|
|
|
count = invProductDetailService.vailStockCount(udiRelevanceResponses.get(0).getRelId(), udiEntity.getBatchNo(), null, null, filterInvProductRequest.getInvCode(), null, true);
|
|
|
|
|
|
|
|
|
|
InvProductResponse invProductResponse = new InvProductResponse();
|
|
|
|
|
BeanUtil.copyProperties(udiRelevanceResponses.get(0), invProductResponse);
|
|
|
|
|
invProductResponse.setReCount(count);
|
|
|
|
|
|
|
|
|
|
PageSimpleResponse<InvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(1);
|
|
|
|
|
pageSimpleResponse.setList(Arrays.asList(invProductResponse));
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* B002 查询耗材字典
|
|
|
|
|
*
|
|
|
|
|