feat: 供三方调用接口开发
parent
6dc6e5ab3b
commit
1cde4618ad
@ -0,0 +1,71 @@
|
|||||||
|
package com.glxp.api.controller.thrsys;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
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.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.forthird.ForInvOutScanCodeResponse;
|
||||||
|
import com.glxp.api.res.inv.InvProductResponse;
|
||||||
|
import com.glxp.api.service.forthird.ForThirdSysApiService;
|
||||||
|
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.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class ForThirdSysApiController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ForThirdSysApiService forThirdSysApiService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B001 查询指定科室高值/普耗库存
|
||||||
|
* @param filterInvProductRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/forThirdSysApi/inv/products/filter")
|
||||||
|
public BaseResponse invProductsFilter(@RequestBody FilterInvProductRequest filterInvProductRequest) {
|
||||||
|
if (ObjectUtil.isNull(filterInvProductRequest)){
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
PageSimpleResponse<InvProductResponse> pageSimpleResponse =
|
||||||
|
forThirdSysApiService.invProductsFilter(filterInvProductRequest);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B002 查询耗材字典
|
||||||
|
* @param filterUdiRelRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/forThirdSysApi/basic/products/search")
|
||||||
|
public BaseResponse basicProductsSearch(@RequestBody FilterUdiRelRequest filterUdiRelRequest) {
|
||||||
|
if (ObjectUtil.isNull(filterUdiRelRequest)){
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
PageSimpleResponse<UdiRelevanceResponse> pageSimpleResponse =
|
||||||
|
forThirdSysApiService.basicProductsSearch(filterUdiRelRequest);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B003 高值耗材实时出库/退库
|
||||||
|
* @param forInvOutScanCodeRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/forThirdSysApi/inv/out/scanCode")
|
||||||
|
public BaseResponse invOutScanCode(@RequestBody @Valid ForInvOutScanCodeRequest forInvOutScanCodeRequest) {
|
||||||
|
ForInvOutScanCodeResponse forInvOutScanCodeResponse = forThirdSysApiService.invOutScanCode(forInvOutScanCodeRequest);
|
||||||
|
return ResultVOUtils.success(forInvOutScanCodeResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.glxp.api.req.forthird;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ForBasicProductsSearchFilter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UDI码
|
||||||
|
*/
|
||||||
|
private String udiCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方产品编码
|
||||||
|
*/
|
||||||
|
private String mainId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DI主标识
|
||||||
|
*/
|
||||||
|
private String nameCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称通用名称
|
||||||
|
*/
|
||||||
|
private String cpmctymc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格型号
|
||||||
|
*/
|
||||||
|
private String ggxh;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.res.forthird;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ForInvOutScanCodeResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UDI管理系统生成的单据号
|
||||||
|
*/
|
||||||
|
private String billNo;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.glxp.api.service.forthird;
|
||||||
|
|
||||||
|
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.forthird.ForInvOutScanCodeResponse;
|
||||||
|
import com.glxp.api.res.inv.InvProductResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ForThirdSysApiService {
|
||||||
|
|
||||||
|
PageSimpleResponse<InvProductResponse> invProductsFilter(FilterInvProductRequest filterInvProductRequest);
|
||||||
|
|
||||||
|
PageSimpleResponse<UdiRelevanceResponse> basicProductsSearch(FilterUdiRelRequest filterUdiRelRequest);
|
||||||
|
|
||||||
|
ForInvOutScanCodeResponse invOutScanCode(ForInvOutScanCodeRequest forInvOutScanCodeRequest);
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
package com.glxp.api.service.forthird.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.entity.basic.UdiEntity;
|
||||||
|
import com.glxp.api.exception.JsonException;
|
||||||
|
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.forthird.ForInvOutScanCodeResponse;
|
||||||
|
import com.glxp.api.res.inv.InvProductPageResponse;
|
||||||
|
import com.glxp.api.res.inv.InvProductResponse;
|
||||||
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
||||||
|
import com.glxp.api.service.forthird.ForThirdSysApiService;
|
||||||
|
import com.glxp.api.service.inv.impl.InvProductService;
|
||||||
|
import com.glxp.api.util.StringUtils;
|
||||||
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class ForThirdSysApiServiceImpl implements ForThirdSysApiService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
InvProductService invProductService;
|
||||||
|
@Resource
|
||||||
|
UdiRelevanceService udiRelevanceService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageSimpleResponse<InvProductResponse> invProductsFilter(FilterInvProductRequest filterInvProductRequest) {
|
||||||
|
buildForInvProductsFilter(filterInvProductRequest);
|
||||||
|
List<InvProductResponse> list = invProductService.filterList(filterInvProductRequest);
|
||||||
|
PageInfo<InvProductResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse<InvProductResponse> pageResponse = new InvProductPageResponse();
|
||||||
|
pageResponse.setList(pageInfo.getList());
|
||||||
|
pageResponse.setTotal(pageInfo.getTotal());
|
||||||
|
return pageResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageSimpleResponse<UdiRelevanceResponse> basicProductsSearch(FilterUdiRelRequest filterUdiRelRequest) {
|
||||||
|
buildForBasicProductsSearchFilter(filterUdiRelRequest);
|
||||||
|
List<UdiRelevanceResponse> list = udiRelevanceService.filterUdiGp(filterUdiRelRequest);
|
||||||
|
PageInfo<UdiRelevanceResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse<UdiRelevanceResponse> pageResponse = new InvProductPageResponse();
|
||||||
|
pageResponse.setList(pageInfo.getList());
|
||||||
|
pageResponse.setTotal(pageInfo.getTotal());
|
||||||
|
return pageResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForInvOutScanCodeResponse invOutScanCode(ForInvOutScanCodeRequest forInvOutScanCodeRequest) {
|
||||||
|
ForInvOutScanCodeResponse forInvOutScanCodeResponse = new ForInvOutScanCodeResponse();
|
||||||
|
System.out.println(JSON.toJSONString(forInvOutScanCodeRequest));
|
||||||
|
// TODO: 2024/3/15 以获取到业务单据实体 需要对单据进行操作 成功返回 单据号
|
||||||
|
|
||||||
|
|
||||||
|
String billNo = "1212121";
|
||||||
|
forInvOutScanCodeResponse.setBillNo(billNo);
|
||||||
|
return forInvOutScanCodeResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildForBasicProductsSearchFilter(FilterUdiRelRequest filterUdiRelRequest) {
|
||||||
|
String udiCode = filterUdiRelRequest.getUdiCode().trim();
|
||||||
|
if (StringUtils.isNotEmpty(udiCode)){
|
||||||
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(udiCode);
|
||||||
|
if (ObjectUtil.isNull(udiEntity)) throw new JsonException("udiCode:["+udiCode+"],解析错误!");
|
||||||
|
String udi = udiEntity.getUdi().trim();
|
||||||
|
if (StringUtils.isNotEmpty(udi)) filterUdiRelRequest.setNameCode(udi);
|
||||||
|
}
|
||||||
|
if (filterUdiRelRequest.getPage() == null) {
|
||||||
|
filterUdiRelRequest.setPage(1);
|
||||||
|
}
|
||||||
|
if (filterUdiRelRequest.getLimit() == null) {
|
||||||
|
filterUdiRelRequest.setLimit(10);
|
||||||
|
}
|
||||||
|
if (filterUdiRelRequest.getPage() != null) {
|
||||||
|
int offset = (filterUdiRelRequest.getPage() - 1) * filterUdiRelRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, filterUdiRelRequest.getLimit());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildForInvProductsFilter(FilterInvProductRequest filterInvProductRequest) {
|
||||||
|
String udiCode = filterInvProductRequest.getUdiCode().trim();
|
||||||
|
if (StringUtils.isNotEmpty(udiCode)){
|
||||||
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(udiCode);
|
||||||
|
if (ObjectUtil.isNull(udiEntity)) throw new JsonException("udiCode:["+udiCode+"],解析错误!");
|
||||||
|
String udi = udiEntity.getUdi().trim();
|
||||||
|
String batchNo = udiEntity.getBatchNo().trim();
|
||||||
|
if (StringUtils.isNotEmpty(udi)) filterInvProductRequest.setNameCode(udi);
|
||||||
|
if (StringUtils.isNotEmpty(batchNo)) filterInvProductRequest.setBatchNo(batchNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterInvProductRequest.getPage() == null) {
|
||||||
|
filterInvProductRequest.setPage(1);
|
||||||
|
}
|
||||||
|
if (filterInvProductRequest.getLimit() == null) {
|
||||||
|
filterInvProductRequest.setLimit(10);
|
||||||
|
}
|
||||||
|
if (filterInvProductRequest.getPage() != null) {
|
||||||
|
int offset = (filterInvProductRequest.getPage() - 1) * filterInvProductRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, filterInvProductRequest.getLimit());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue