2/18 anxi

axxyy
wangwei 2 months ago
parent 890518746e
commit 20b4ff0434

@ -0,0 +1,916 @@
package com.glxp.mipsdl.client.axxyy;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.mipsdl.client.CommonHttpClient;
import com.glxp.mipsdl.config.ThirdSysConfig;
import com.glxp.mipsdl.constant.ConstantType;
import com.glxp.mipsdl.constant.Constants;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao;
import com.glxp.mipsdl.dao.basic.BasicCorpDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.dao.basic.UdiRlSupDao;
import com.glxp.mipsdl.dao.inout.IoCodeDao;
import com.glxp.mipsdl.dao.inout.IoOrderDao;
import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao;
import com.glxp.mipsdl.dao.thrsys.*;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity;
import com.glxp.mipsdl.entity.basic.BasicCorpEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.entity.inout.*;
import com.glxp.mipsdl.entity.njxyy.A005;
import com.glxp.mipsdl.entity.njxyy.ProductEntity;
import com.glxp.mipsdl.entity.njxyy.SickerEntity;
import com.glxp.mipsdl.entity.system.UdiEntity;
import com.glxp.mipsdl.entity.thrsys.*;
import com.glxp.mipsdl.http.HttpClient;
import com.glxp.mipsdl.req.base.*;
import com.glxp.mipsdl.req.base.forthird.*;
import com.glxp.mipsdl.req.ctqyy.GetSickRequest;
import com.glxp.mipsdl.req.njxyy.PostThrProductRequest;
import com.glxp.mipsdl.req.phxyy.PhBusTypeRequest;
import com.glxp.mipsdl.req.phxyy.PhOrderRequest;
import com.glxp.mipsdl.req.phxyy.PhUnitRequest;
import com.glxp.mipsdl.req.post.*;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.res.PageSimpleResponse;
import com.glxp.mipsdl.res.udiwms.*;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.service.njxyy.A005Service;
import com.glxp.mipsdl.service.order.OrderUploadLogService;
import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService;
import com.glxp.mipsdl.thirddao.njxyy.ThrCorpMapper;
import com.glxp.mipsdl.thirddao.njxyy.ThrProductsMapper;
import com.glxp.mipsdl.thirddao.njxyy.ThrSickerMapper;
import com.glxp.mipsdl.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* Client
*/
@Slf4j
@Service(value = "100017HttpClient") //bean注册名称使用编码 + HttpClient文件接口加 FileClient
public class AxxyyClient extends CommonHttpClient {
@Resource
private ThrSystemDetailService thrSystemDetailService;
@Resource
private HttpClient httpClient;
@Resource
private ThrBustypeOriginDao thrBustypeOriginDao;
@Resource
private IoOrderDao orderDao;
@Resource
private ThrSystemBusApiDao thrSystemBusApiDao;
@Resource
private BasicBussinessTypeDao basicBussinessTypeDao;
@Resource
private BasicCorpDao basicCorpDao;
@Resource
private IoCodeDao codeDao;
@Resource
private AuthWarehouseDao authWarehouseDao;
@Resource
private ThrInvWarehouseDao thrInvWarehouseDao;
@Resource
private AuthWarehouseService authWarehouseService;
@Resource
private ThirdSysConfig thirdSysConfig;
@Resource
private IoOrderDetailBizDao orderDetailBizDao;
@Resource
private SubmitOrderUtil submitOrderUtil;
@Resource
private BasicUdirelDao basicUdirelDao;
@Resource
private UdiRlSupDao udiRlSupDao;
@Resource
ThrProductsDao thrProductsDao;
@Resource
private OrderUploadLogService orderUploadLogService;
@Resource
private ThrOrderUploadBustypesMapper thrOrderUploadBustypesMapper;
@Resource
ThrCorpMapper thrCorpMapper;
@Resource
ThrProductsMapper thrProductsMapper;
@Resource
ThrSickerMapper thrSickerMapper;
/**
* ---(A001)
*
* @param udiwmsProductRequest
* @return
*/
@Override
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest) {
IPage<ProductEntity> page = new Page<>(udiwmsProductRequest.getPage(), udiwmsProductRequest.getLimit());
IPage<ProductEntity> productEntityIPage = thrProductsMapper.selectPage(page, new QueryWrapper<ProductEntity>()
.lambda()
.like(StringUtils.isNotBlank(udiwmsProductRequest.getCode()), ProductEntity::getCode, udiwmsProductRequest.getCode())
.like(StringUtils.isNotBlank(udiwmsProductRequest.getName()), ProductEntity::getName, udiwmsProductRequest.getName()));
PageSimpleResponse<ProductEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(productEntityIPage.getTotal());
pageSimpleResponse.setList(productEntityIPage.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
/**
* --( A003)
*
* @param getSickRequest
* @return
*/
public BaseResponse getSickInfo(GetSickRequest getSickRequest) {
IPage<SickerEntity> page = new Page<>(getSickRequest.getPage(), getSickRequest.getLimit());
IPage<SickerEntity> productEntityIPage = thrSickerMapper.selectPage(page, new QueryWrapper<SickerEntity>()
.lambda()
.like(StringUtils.isNotBlank(getSickRequest.getCode()), SickerEntity::getIdentityNo, getSickRequest.getCode())
.like(StringUtils.isNotBlank(getSickRequest.getName()), SickerEntity::getName, getSickRequest.getName()));
List<BasicSkSickerResponse> basicSkSickerResponses = new ArrayList<>();
productEntityIPage.getRecords().forEach(sickerEntity -> {
basicSkSickerResponses.add(BasicSkSickerResponse.builder()
.sickerId(sickerEntity.getInpatientID())
.code(sickerEntity.getCurno())
.name(sickerEntity.getName())
.adNum(sickerEntity.getInpatientID())
.idNum(sickerEntity.getIdentityNo())
.phone(sickerEntity.getCellPhoneNo())
.gender(sickerEntity.getSex())
.bornDate(sickerEntity.getBirthDate())
.guardianName(sickerEntity.getOperName())
.build());
});
PageSimpleResponse<BasicSkSickerResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(productEntityIPage.getTotal());
pageSimpleResponse.setList(basicSkSickerResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
* --A004
*
* @return
*/
@Override
public BaseResponse postRelProduct(PostRelProductRequest postThrInvProductsRequest) {
List<UdiRelevanceResponse> datas = postThrInvProductsRequest.getDatas();
BaseResponse baseResponse = null;
if (CollUtil.isNotEmpty(datas)) {
for (UdiRelevanceResponse udiRelevanceResponse : datas) {
PostThrProductRequest postThrProductsRequest = new PostThrProductRequest();
BeanUtil.copyProperties(udiRelevanceResponse, postThrProductsRequest);
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_POST_THR_PRODUCTS_URL), postThrProductsRequest);
baseResponse = JSONObject.parseObject(response, BaseResponse.class);
log.error(baseResponse.getMessage());
// return baseResponse;
}
}
return ResultVOUtils.success(baseResponse);
}
/**
* B001 /
*
* @param forInvProductsFilter
* @return
*/
@Override
public BaseResponse queryUdiInvProductsFilter(ForInvProductsFilter forInvProductsFilter) {
//入参业务系统字段控制
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
BeanUtils.copyProperties(forInvProductsFilter, filterInvProductRequest);
//调用业务系统http
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvProductsFilterUrl(), filterInvProductRequest);
//业务系统返回参数 字段控制
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000) {
PageSimpleResponse<InvProductResponse> pageSimpleResponse =
JSONObject.parseObject(String.valueOf(baseResponse.getData()), PageSimpleResponse.class);
List<InvProductResponse> list = pageSimpleResponse.getList();
//处理list字段 进行实体转换 过滤掉不必要字段
String json = JSON.toJSONString(list);
List<ForInvProductsResponse> newList = JSON.parseArray(json, ForInvProductsResponse.class);
PageSimpleResponse<ForInvProductsResponse> newPageSimpleResponse = new PageSimpleResponse<>();
newPageSimpleResponse.setTotal(pageSimpleResponse.getTotal());
newPageSimpleResponse.setList(newList);
baseResponse.setData(newPageSimpleResponse);
}
return baseResponse;
}
/**
*
*
* @param forInvProductsFilter
* @return
*/
@Override
public BaseResponse queryUdiHighInvProductsFilter(ForInvProductsFilter forInvProductsFilter) {
//入参业务系统字段控制
FilterInvProductRequest filterInvProductRequest = new FilterInvProductRequest();
BeanUtils.copyProperties(forInvProductsFilter, filterInvProductRequest);
log.info("HIS扫码获取高值耗材库存" + JSONUtil.toJsonStr(forInvProductsFilter));
//调用业务系统http
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvHighProductsFilterUrl(), filterInvProductRequest);
//业务系统返回参数 字段控制
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000) {
PageSimpleResponse<InvProductResponse> pageSimpleResponse =
JSONObject.parseObject(String.valueOf(baseResponse.getData()), PageSimpleResponse.class);
List<InvProductResponse> list = pageSimpleResponse.getList();
//处理list字段 进行实体转换 过滤掉不必要字段
String json = JSON.toJSONString(list);
List<ForInvProductsResponse> newList = JSON.parseArray(json, ForInvProductsResponse.class);
PageSimpleResponse<ForInvProductsResponse> newPageSimpleResponse = new PageSimpleResponse<>();
newPageSimpleResponse.setTotal(pageSimpleResponse.getTotal());
newPageSimpleResponse.setList(newList);
baseResponse.setData(newPageSimpleResponse);
}
return baseResponse;
}
/**
*
*
* @param udiwmsUnitRequest
* @return
*/
@Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
PhUnitRequest phUnitRequest = new PhUnitRequest();
BeanUtil.copyProperties(udiwmsUnitRequest, phUnitRequest);
IPage<ThrCorpEntity> page = new Page<>(udiwmsUnitRequest.getPage(), udiwmsUnitRequest.getLimit());
IPage<ThrCorpEntity> thrCorpEntityPage = thrCorpMapper.selectPage(page, new QueryWrapper<ThrCorpEntity>()
.lambda()
.like(StringUtils.isNotBlank(phUnitRequest.getUnitId()), ThrCorpEntity::getUnitId, phUnitRequest.getUnitId())
.like(StringUtils.isNotBlank(phUnitRequest.getName()), ThrCorpEntity::getName, phUnitRequest.getName()));
PageSimpleResponse<ThrCorpEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(thrCorpEntityPage.getTotal());
pageSimpleResponse.setList(thrCorpEntityPage.getRecords());
return ResultVOUtils.success(pageSimpleResponse);
}
@Override
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest) {
PhBusTypeRequest phBusTypeRequest = new PhBusTypeRequest();
BeanUtil.copyProperties(udiwmsBusTypeRequest, phBusTypeRequest);
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_BUS_TYPE_QUERY_URL), phBusTypeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getOrders(UdiwmsOrderQueryRequest udiwmsOrderQueryRequest) {
if (StrUtil.isBlank(udiwmsOrderQueryRequest.getBillType())) {
return ResultVOUtils.error(500, "单据类型不能为空");
}
//查询绑定的第三方单据类型
String thirdAction = thrBustypeOriginDao.findThirdActionByBillType(udiwmsOrderQueryRequest.getBillType(), DictUtl.CURRENT_HOSP_CODE);
udiwmsOrderQueryRequest.setBillType(thirdAction);
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_ORDER_QUERY_URL), udiwmsOrderQueryRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest) {
if (true)
return ResultVOUtils.error(500, "暂时不传");
if (StrUtil.isBlank(udiwmsOrderRequest.getBillNo())) {
return ResultVOUtils.error(500, "单据号不能为空");
}
PhOrderRequest phOrderRequest = new PhOrderRequest();
BeanUtil.copyProperties(udiwmsOrderRequest, phOrderRequest);
//查询单据和详情信息,组装第三方系统接口参数
IoOrderEntity orderEntity = orderDao.selectOne(new LambdaQueryWrapper<IoOrderEntity>().eq(IoOrderEntity::getBillNo, udiwmsOrderRequest.getBillNo()).last("limit 1"));
if (orderEntity.getAuditTime() == null)
phOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getCreateTime()));
else {
phOrderRequest.setBillDate(DateUtil.formatDateTime(orderEntity.getAuditTime()));
}
//查询对应的第三方单据类型
ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiDao.selectOne(new LambdaQueryWrapper<ThrSystemBusApiEntity>().eq(ThrSystemBusApiEntity::getCode, udiwmsOrderRequest.getBillType()));
if (StrUtil.isBlank(thrSystemBusApiEntity.getUrl())) {
return ResultVOUtils.error(500, "接口未配置,无法提交!");
}
phOrderRequest.setBillType(thrSystemBusApiEntity.getThirdBuyCode());
//查询单据类型,设置往来单位信息
BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeDao.selectByAction(udiwmsOrderRequest.getBillType());
if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_HOSPTIAL)) {
//医院客户
phOrderRequest.setCorpId(orderEntity.getFromCorp());
//查询客户名称
String corpName = basicCorpDao.selectNameByErpId(orderEntity.getFromCorp());
phOrderRequest.setCorpName(corpName);
} else if (basicBussinessTypeEntity.getCorpType().equals(Constants.CORP_INTTERNAL)) {
//内部科室
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, udiwmsOrderRequest.getCorpId()));
try {
//根据第三方系统标识,获取对应字段的值
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
phOrderRequest.setCorpId(thrInvWarehouseEntity.getCode());
phOrderRequest.setCorpName(thrInvWarehouseEntity.getName());
} catch (Exception e) {
log.error("查询单据对应往来单位的第三方仓库信息异常", e);
}
} else {
//供应商
BasicCorpEntity basicCorpEntity = basicCorpDao.selectByErpId(orderEntity.getFromCorp());
if (null != basicCorpEntity) {
phOrderRequest.setCorpId(basicCorpEntity.getThirdId());
phOrderRequest.setCorpName(basicCorpEntity.getName());
} else {
String msg = "查询单据对应的第三方往来单位信息异常";
orderUploadLogService.updateLocalErr(orderEntity, msg);
log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
return ResultVOUtils.error(500, msg);
}
// ThrCorpEntity thrCorp = thrCorpService.getThrCorp(udiwmsOrderRequest.getCorpId());
// if (null != thrCorp) {
// phOrderRequest.setCorpId(thrCorp.getUnitId());
// phOrderRequest.setCorpName(thrCorp.getName());
// } else {
// String msg = "查询单据对应的第三方往来单位信息异常";
// orderUploadLogService.updateLocalErr(orderEntity, msg);
// log.error("----单据提交-----" + orderEntity.getBillNo() + msg);
// return ResultVOUtils.error(500, msg);
// }
}
//查询仓库信息
AuthWarehouseEntity warehouseEntity = authWarehouseDao.selectOne(new LambdaQueryWrapper<AuthWarehouseEntity>().eq(AuthWarehouseEntity::getCode, orderEntity.getInvCode()));
try {
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>()
.eq(ThrInvWarehouseEntity::getCode, authWarehouseService.getThirdInvCode(warehouseEntity))
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
if (thrInvWarehouseEntity != null) {
phOrderRequest.setLocInvCode(thrInvWarehouseEntity.getCode());
phOrderRequest.setLocInvName(thrInvWarehouseEntity.getName());
phOrderRequest.setLocStorageCode(thrInvWarehouseEntity.getCode());
phOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
} else {
orderUploadLogService.updateLocalErr(orderEntity, "查询第三方系统仓库信息异常");
return ResultVOUtils.error(500, "查询第三方系统仓库信息异常");
}
} catch (Exception e) {
log.error("查询第三方系统仓库信息异常", ExceptionUtil.stacktraceToString(e));
orderUploadLogService.updateLocalErr(orderEntity, "查询第三方系统仓库信息异常" + ExceptionUtil.stacktraceToString(e));
return ResultVOUtils.error(500, "查询第三方系统仓库信息异常");
}
phOrderRequest.setBillFlag("1");
if (StrUtil.nullToEmpty(thrSystemBusApiEntity.getUrl()).equals("useOut")) {
phOrderRequest.setCorpId(phOrderRequest.getLocStorageCode());
phOrderRequest.setCorpName(phOrderRequest.getLocStorageName());
ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, "29")
.eq(ThrInvWarehouseEntity::getThirdSysFk, thirdSysConfig.getThirdId()));
phOrderRequest.setLocStorageCode("29");
phOrderRequest.setLocStorageName(thrInvWarehouseEntity.getName());
}
//设置单据出入库类型
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
phOrderRequest.setInoutType(1); //入库
} else if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
phOrderRequest.setInoutType(2); //出库
}
phOrderRequest.setRemark("UDI单据" + udiwmsOrderRequest.getBillNo()); //备注
//组装单据明细数据
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderEntity.getBillNo())
);
List<UdiwmsOrderDetailRequest> items = new ArrayList<>();
//查询业务单据详情
List<IoOrderDetailBizEntity> detailBizEntities = orderDetailBizDao.selectList(new LambdaQueryWrapper<IoOrderDetailBizEntity>().eq(IoOrderDetailBizEntity::getOrderIdFk, orderEntity.getBillNo()));
// setOrderDetailList(ioCodeEntities, items, detailBizEntities);
List<IoOrderDetailBizEntity> stockOrderDetailEntities = transferSerList(detailBizEntities, orderEntity.getBillNo());
// Collections.sort(stockOrderDetailEntities, (o1, o2) -> {
// String o1Str = o1.getCoName() + o1.getSpec() + o1.getBatchNo() + o1.getSerialNo();
// String o2Str = o2.getCoName() + o2.getSpec() + o2.getBatchNo() + o1.getSerialNo();
// Integer cp = o1Str.compareTo(o2Str);
// return cp;
// });
for (IoOrderDetailBizEntity stockOrderDetailEntity : stockOrderDetailEntities) {
BasicUdirelEntity udiRelevanceEntity = basicUdirelDao.selectById(stockOrderDetailEntity.getBindRlFk());
// if (StrUtil.isNotEmpty(udiRelevanceEntity.getMainId())) {
// ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new QueryWrapper<ThrProductsEntity>().eq("code", udiRelevanceEntity.getMainId()).last("limit 1"));
// if (thrProductsEntity != null && StrUtil.isNotEmpty(thrProductsEntity.getRegisterNo())) {
// stockOrderDetailEntity.setCertCode(thrProductsEntity.getRegisterNo());
// }
// }
UdiwmsOrderDetailRequest item = new UdiwmsOrderDetailRequest();
BeanUtil.copyProperties(stockOrderDetailEntity, item);
item.setManufactory(stockOrderDetailEntity.getManufacturer());
item.setProductDate(stockOrderDetailEntity.getProductDate());
item.setExpireDate(stockOrderDetailEntity.getExpireDate());
item.setBatchNo(stockOrderDetailEntity.getBatchNo());
if (StrUtil.isNotEmpty(stockOrderDetailEntity.getProductDate())) {
// item.setProductDate(com.glxp.mipsdl.admin.util.DateUtil.formatExpireTime("20" + stockOrderDetailEntity.getProductDate()));
}
if (StrUtil.isNotEmpty(stockOrderDetailEntity.getExpireDate())) {
// item.setExpireDate(com.glxp.mipsdl.admin.util.DateUtil.formatExpireTime("20" + stockOrderDetailEntity.getExpireDate()));
}
// item.setMeasname(udiRelevanceEntity.getMeasname());
item.setStandard(stockOrderDetailEntity.getSpec());
item.setRegisterNo(stockOrderDetailEntity.getCertCode().replace(";", ""));
IoOrderUploadLogEntity uploadLog = new IoOrderUploadLogEntity();
try {
item.setPrice(stockOrderDetailEntity.getPrice());
// item.setFirstSalesInvNo(stockOrderDetailEntity.getFirstSalesInvNo());
// item.setSecSalesInvNo(stockOrderDetailEntity.getSecSalesInvNo());
// item.setInvoiceDate(stockOrderDetailEntity.getInvoiceDate());
// item.setSecSalesListNo(stockOrderDetailEntity.getSecSalesListNo());
item.setBillNo(orderEntity.getBillNo());
String fphm = "";
String fprq = null;
List<IoOrderInvoiceEntity> invoiceList = IoOrderInvoiceEntity.builder().build()
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
.eq(IoOrderInvoiceEntity::getBindRlFk, stockOrderDetailEntity.getBindRlFk())
.eq(StrUtil.isNotEmpty(stockOrderDetailEntity.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, stockOrderDetailEntity.getBatchNo()).
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
if (CollectionUtil.isNotEmpty(invoiceList)) {
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
if (invoiceList.get(0).getInvoiceDate() != null)
fprq = DateUtil.formatDateTime(invoiceList.get(0).getInvoiceDate());
}
item.setFirstSalesInvNo(fphm);
item.setSecSalesInvNo(fphm);
item.setInvoiceDate(fprq);
boolean isNeedFp = false;
ThrOrderUploadBustypesEntity thrOrderUploadBustypesEntity = thrOrderUploadBustypesMapper.selectOne(new QueryWrapper<ThrOrderUploadBustypesEntity>().eq("action", basicBussinessTypeEntity.getAction()).last("limit 1"));
if (thrOrderUploadBustypesEntity != null && IntUtil.value(thrOrderUploadBustypesEntity.getOrderStatus()) == 3) {
isNeedFp = true;
}
if (basicBussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT) && StrUtil.isEmpty(fphm) && isNeedFp) {
String errMsg = "提交失败,错误信息:" + stockOrderDetailEntity.getCoName() + "发票缺失,请补齐后重新提交";
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
}
ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new QueryWrapper<ThrProductsEntity>().eq("code", udiRelevanceEntity.getMainId()).last("limit 1"));
if (StrUtil.isEmpty(udiRelevanceEntity.getMainId()) || thrProductsEntity == null || StrUtil.isEmpty(thrProductsEntity.getCode())) {
String errMsg = "提交失败,错误信息:" + "产品DI未关联第三方产品信息";
orderUploadLogService.updateLocalErr(orderEntity, errMsg);
return ResultVOUtils.error(500, errMsg);
} else {
item.setProductId(thrProductsEntity.getCode());
item.setProductName(thrProductsEntity.getName());
}
items.add(item);
} catch (Exception e) {
log.error(e.getMessage(), e);
uploadLog.setStatus(3);
String errMsg = "提交失败,错误信息:" + e.getMessage();
uploadLog.setResult(errMsg);
orderUploadLogService.insertOrUpdate(uploadLog);
return ResultVOUtils.error(500, errMsg);
}
}
Collections.reverse(items);
phOrderRequest.setItem(items);
return submitOrderUtil.submitOrder(orderEntity, phOrderRequest);
}
public List<IoOrderDetailBizEntity> transferSerList(List<IoOrderDetailBizEntity> stockOrderDetailEntities, String orderId) {
List<IoOrderDetailBizEntity> resultList = new ArrayList<>();
List<IoCodeEntity> ioCodeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>()
.eq(IoCodeEntity::getOrderId, orderId)
);
if (CollUtil.isNotEmpty(ioCodeEntities)) {
for (IoCodeEntity codeDetaiEntity : ioCodeEntities) {
if (CollUtil.isNotEmpty(stockOrderDetailEntities)) {
for (IoOrderDetailBizEntity stockOrderDetailEntity : stockOrderDetailEntities) {
if (IntUtil.value(codeDetaiEntity.getRelId()) == IntUtil.value(stockOrderDetailEntity.getBindRlFk())
&& StrUtil.trimToEmpty(codeDetaiEntity.getBatchNo()).equals(StrUtil.trimToEmpty(stockOrderDetailEntity.getBatchNo()))) {
IoOrderDetailBizEntity item = new IoOrderDetailBizEntity();
BeanUtils.copyProperties(stockOrderDetailEntity, item);
item.setSerialNo(codeDetaiEntity.getSerialNo());
item.setCount(codeDetaiEntity.getReCount());
item.setReCount(codeDetaiEntity.getReCount());
resultList.add(item);
break;
}
}
}
}
}
return resultList;
}
@Override
public BaseResponse getInvProducts(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_INV_PI_URL), udiwmsInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_WAREHOUSE_QUERY_URL), udiwmsWarehouseRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
postThrProductsRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostPiUrl(), postThrProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
postThrCorpRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostCorpUrl(), postThrCorpRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
postFileThrOrderRequest.setUploadType("文件导入");
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostOrderUrl(), postFileThrOrderRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), postThrInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
/**
* HIS
*
* @param forBasicProductsSearchFilter
* @return
*/
@Override
public BaseResponse queryUdiBasicProductsSearch(ForBasicProductsSearchFilter forBasicProductsSearchFilter) {
//入参业务系统字段控制
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
BeanUtils.copyProperties(forBasicProductsSearchFilter, filterUdiRelRequest);
log.info("HIS获取普耗库存" + JSONUtil.toJsonStr(forBasicProductsSearchFilter));
//调用业务系统http
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostBasicProductsSearch(), filterUdiRelRequest);
//业务系统返回参数 字段控制
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000) {
PageSimpleResponse<UdiRelevanceResponse> pageSimpleResponse =
JSONObject.parseObject(String.valueOf(baseResponse.getData()), PageSimpleResponse.class);
List<UdiRelevanceResponse> list = pageSimpleResponse.getList();
//处理list字段 进行实体转换 过滤掉不必要字段
String json = JSON.toJSONString(list);
List<ForBasicProductsSearchResponse> newList = JSON.parseArray(json, ForBasicProductsSearchResponse.class);
PageSimpleResponse<ForBasicProductsSearchResponse> newPageSimpleResponse = new PageSimpleResponse<>();
newPageSimpleResponse.setTotal(pageSimpleResponse.getTotal());
newPageSimpleResponse.setList(newList);
baseResponse.setData(newPageSimpleResponse);
}
return baseResponse;
}
@Override
public BaseResponse queryUdiInvOutScanCode(ForInvOutScanCodeFilter forInvOutScanCodeFilter) {
log.error(forInvOutScanCodeFilter.toString());
ForInvOutScanCodeRequest forInvOutScanCodeRequest = new ForInvOutScanCodeRequest();
IoOrderRequest ioOrderRequest = new IoOrderRequest();
ioOrderRequest.setCreateTime(new Date());
ForInvOutScanCodeFilter.Billbaseinfo billbaseinfo = forInvOutScanCodeFilter.getBillbaseinfo();
ioOrderRequest.setCreateUser(billbaseinfo.getUserid());
if (StrUtil.isNotEmpty(billbaseinfo.getDeptid())) {
AuthWarehouseEntity authWarehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("thirdId", billbaseinfo.getDeptid()).last("limit 1"));
if (authWarehouseEntity == null)
return ResultVOUtils.error(500, "UDI系统科室未对照");
ioOrderRequest.setInvCode(authWarehouseEntity.getCode());
ioOrderRequest.setDeptCode(authWarehouseEntity.getParentId());
} else
return ResultVOUtils.error(500, "HIS执行科室不能为空");
ForInvOutScanCodeFilter.Patientinfo patientinfo = forInvOutScanCodeFilter.getPatientinfo();
ioOrderRequest.setFromCorp(patientinfo.getInpatientid());
ioOrderRequest.setRemark(patientinfo.getInpatientid() + "-" + patientinfo.getName());
ioOrderRequest.setSickerAdNum(patientinfo.getInpatientid());
List<ForInvOutScanCodeFilter.Highvalue> highvalues = forInvOutScanCodeFilter.getHighvaluelist();
if (CollUtil.isEmpty(highvalues))
return ResultVOUtils.error(500, "耗材使用信息不能为空!");
List<IoOrderCodeRequest> codeRequestListYb = new ArrayList<>();
List<IoOrderCodeRequest> codeRequestListJs = new ArrayList<>();
List<IoOrderCodeRequest> codeRequestListYys = new ArrayList<>();
String billNo = "";
for (ForInvOutScanCodeFilter.Highvalue highvalue : highvalues) {
IoOrderCodeRequest codeRequest = new IoOrderCodeRequest();
codeRequest.setCode(highvalue.getUdicode());
codeRequest.setInvCode(ioOrderRequest.getInvCode());
codeRequest.setAction(ioOrderRequest.getAction());
if (StrUtil.isNotEmpty(highvalue.getPrice())) {
codeRequest.setPrice(new BigDecimal(highvalue.getPrice()));
}
if (IntUtil.value(highvalue.getQuantity()) == 0) {
return ResultVOUtils.error(500, "耗材数量不能为空!");
}
codeRequest.setCount(IntUtil.value(highvalue.getQuantity()));
UdiEntity udiEntity = FilterUdiUtils.getUdi(codeRequest.getCode());
if (udiEntity == null || StrUtil.isEmpty(udiEntity.getUdi())) {
return ResultVOUtils.error(500, "UDI码格式错误");
}
BasicUdirelEntity udirelEntity = basicUdirelDao.selectByNameCode(udiEntity.getUdi());
CompanyProductRelevanceRequest companyProductRelevanceRequest = new CompanyProductRelevanceRequest();
companyProductRelevanceRequest.setUuid(udirelEntity.getUuid());
List<UdiRlSupResponse> udiRlSupResponses = udiRlSupDao.filterUdiGp(companyProductRelevanceRequest);
if (udirelEntity == null) {
return ResultVOUtils.error(500, "耗材字典未对照!");
}
if (IntUtil.value(udirelEntity.getPurType()) == 2) {
return ResultVOUtils.success("YAS" + CustomUtil.getUnitId());
}
if (codeRequest.getCount() == 0) {
return ResultVOUtils.error(500, "扫码数量不能为零!");
} else if (codeRequest.getCount() > 0) {
//收费入库
ioOrderRequest.setAction("SC20250702001");
codeRequestListYb.add(codeRequest);
forInvOutScanCodeRequest.setCodeRequestList(codeRequestListYb);
forInvOutScanCodeRequest.setIoOrderRequest(ioOrderRequest);
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvOutScanCode(), forInvOutScanCodeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000){
ForInvOutScanCodeResponse forInvOutScanCodeResponse = JSONObject.parseObject(String.valueOf(baseResponse.getData()), ForInvOutScanCodeResponse.class);
billNo = billNo + forInvOutScanCodeResponse.getBillNo() + ";";
}else {
return baseResponse;
}
} else {
// //判断库存
// List<IoCodeEntity> codeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>().eq(IoCodeEntity::getCode, codeRequest.getCode()).eq(IoCodeEntity::getAction, "SC20250702002"));
// if (CollUtil.isEmpty(codeEntities)) {
// codeEntities = codeDao.selectList(new LambdaQueryWrapper<IoCodeEntity>().eq(IoCodeEntity::getErrUdiCode, codeRequest.getCode()).eq(IoCodeEntity::getAction, "SC20250702002"));
// if (CollUtil.isEmpty(codeEntities)) {
// return ResultVOUtils.error(500, "该UDI码未出库");
// }
// }
codeRequestListYb.add(codeRequest);
if (IntUtil.value(udirelEntity.getPurType()) == 2) {
if (CollUtil.isNotEmpty(udiRlSupResponses)){
long customerId = udiRlSupResponses.get(0).getCustomerId();
if(customerId != 0l){
codeRequest.setSupId(String.valueOf(customerId));
}else {
return ResultVOUtils.error(500, "预验收产品供应商ID未维护");
}
}else {
return ResultVOUtils.error(500, "预验收产品供应商ID为找到");
}
codeRequestListYys.add(codeRequest);
} else if (IntUtil.value(udirelEntity.getPurType()) == 3) {
if (CollUtil.isNotEmpty(udiRlSupResponses)){
long customerId = udiRlSupResponses.get(0).getCustomerId();
if(customerId != 0l){
codeRequest.setSupId(String.valueOf(customerId));
}else {
return ResultVOUtils.error(500, "预验收产品供应商ID未维护");
}
}else {
return ResultVOUtils.error(500, "寄售产品供应商ID为找到");
}
codeRequestListJs.add(codeRequest);
}
{
//收费退库 入账
ioOrderRequest.setAction("SC20250702002");
forInvOutScanCodeRequest.setCodeRequestList(codeRequestListYb);
forInvOutScanCodeRequest.setIoOrderRequest(ioOrderRequest);
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvOutScanCode(), forInvOutScanCodeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000){
ForInvOutScanCodeResponse forInvOutScanCodeResponse = JSONObject.parseObject(String.valueOf(baseResponse.getData()), ForInvOutScanCodeResponse.class);
billNo = billNo + forInvOutScanCodeResponse.getBillNo() + ";";
}else {
return baseResponse;
}
}
if (CollUtil.isNotEmpty(codeRequestListYys)){
//收费退库 预验收
ioOrderRequest.setAction("SC73399619155911");
ioOrderRequest.setInvCode("1000001");
ioOrderRequest.setFromCorp(codeRequestListYys.get(0).getSupId());
forInvOutScanCodeRequest.setCodeRequestList(codeRequestListYys);
forInvOutScanCodeRequest.setIoOrderRequest(ioOrderRequest);
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvOutScanCode(), forInvOutScanCodeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000){
ForInvOutScanCodeResponse forInvOutScanCodeResponse = JSONObject.parseObject(String.valueOf(baseResponse.getData()), ForInvOutScanCodeResponse.class);
billNo = billNo + forInvOutScanCodeResponse.getBillNo();
}else {
return baseResponse;
}
}
if (CollUtil.isNotEmpty(codeRequestListJs)){
//收费退库 寄售
ioOrderRequest.setAction("SC73399555402219");
ioOrderRequest.setInvCode("1000002");
ioOrderRequest.setFromCorp(codeRequestListJs.get(0).getSupId());
forInvOutScanCodeRequest.setCodeRequestList(codeRequestListJs);
forInvOutScanCodeRequest.setIoOrderRequest(ioOrderRequest);
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvOutScanCode(), forInvOutScanCodeRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
if (baseResponse.getCode() == 20000){
ForInvOutScanCodeResponse forInvOutScanCodeResponse = JSONObject.parseObject(String.valueOf(baseResponse.getData()), ForInvOutScanCodeResponse.class);
billNo = billNo + forInvOutScanCodeResponse.getBillNo();
}else {
return baseResponse;
}
}
}
}
return ResultVOUtils.success(billNo);
}
@Override
public BaseResponse testConnect() {
UdiwmsUnitRequest udiwmsUnitRequest = new UdiwmsUnitRequest();
udiwmsUnitRequest.setPage(1);
udiwmsUnitRequest.setLimit(2);
BaseResponse baseResponse = getUnit(udiwmsUnitRequest);
if (baseResponse.getCode() == 20000) {
return ResultVOUtils.success("连接第三方系统成功!");
}
return ResultVOUtils.success("连接第三方服务成功,连接第三方系统成功!");
}
@Override
public BaseResponse queryUdiInvProducts(UdiwmsQueryUdiInvProductsRequest queryUdiInvProductsRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getQueryInvUrl(), queryUdiInvProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse submitProducts(UdiwmsAddProductsRequest udiwmsAddProductsRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), udiwmsAddProductsRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse submitUnit(UdiwmsAddUnitRequest udiwmsAddUnitRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), udiwmsAddUnitRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Override
public BaseResponse submitPreInOrders(UdiwmsPreInOrderRequest udiwmsPreInOrderRequest) {
String response = httpClient.postUDIWMSJson(thirdSysConfig.getPostInvPiUrl(), udiwmsPreInOrderRequest);
BaseResponse baseResponse = JSONObject.parseObject(response, BaseResponse.class);
return baseResponse;
}
@Resource
A005Service a005Service;
/**
*
*
* @param udiwmsInvProductsRequest
* @return
*/
@Override
public BaseResponse getInvResult(UdiwmsInvProductsRequest udiwmsInvProductsRequest) {
udiwmsInvProductsRequest.setDatabaseProductName(getDataSourceType());
if (udiwmsInvProductsRequest != null && udiwmsInvProductsRequest.getStartDate() != null && udiwmsInvProductsRequest.getEndDate() != null){
udiwmsInvProductsRequest.setStartDate(DateUtil.formatDate(DateUtil.parseDate(udiwmsInvProductsRequest.getStartDate()), "yyyyMMdd"));
udiwmsInvProductsRequest.setEndDate(DateUtil.formatDate(DateUtil.parseDate(udiwmsInvProductsRequest.getEndDate()), "yyyyMMdd"));
}else {
return ResultVOUtils.error(500,"缺少开始结束日期必要参数");
}
List<A005> a005s = a005Service.filterList(udiwmsInvProductsRequest);
List<ThrInvResultResponse> thrInvResultResponses = new ArrayList<>();
if (CollUtil.isNotEmpty(a005s)) {
for (A005 ptxhInvResponse : a005s) {
//判断是否普耗 是 add
Integer byMainId = basicUdirelDao.findByMainId(ptxhInvResponse.getThrcode());
if (byMainId == null || byMainId == 0){
ThrInvResultResponse thrInvResultResponse = new ThrInvResultResponse();
thrInvResultResponse.setThrCode(ptxhInvResponse.getThrcode());
thrInvResultResponse.setCpmctymc(ptxhInvResponse.getCpmctymc());
thrInvResultResponse.setGgxh(ptxhInvResponse.getGgxh());
thrInvResultResponse.setBatchNo(ptxhInvResponse.getBatchno());
thrInvResultResponse.setMeasname(ptxhInvResponse.getMeasname());
thrInvResultResponse.setPrice(ptxhInvResponse.getPrice());
thrInvResultResponse.setAmount(ptxhInvResponse.getAmount());
thrInvResultResponse.setSickerCode(ptxhInvResponse.getCorpid());
thrInvResultResponse.setSickerName(ptxhInvResponse.getCorpname());
thrInvResultResponse.setDeptName(ptxhInvResponse.getInvname());
thrInvResultResponse.setDeptCode(ptxhInvResponse.getInvcode());
thrInvResultResponse.setInvName(ptxhInvResponse.getInvname());
thrInvResultResponse.setInvCode(ptxhInvResponse.getInvcode());
thrInvResultResponse.setManufacturer(ptxhInvResponse.getManufacturer());
thrInvResultResponse.setManufactoryCode(ptxhInvResponse.getManufactorycode());
thrInvResultResponse.setMainAction(ConstantType.TYPE_OUT);
if (ptxhInvResponse.getRecount() >= 0){
thrInvResultResponse.setBillType("OUT"); //收费出库
thrInvResultResponse.setInCount(0);
thrInvResultResponse.setOutCount(ptxhInvResponse.getRecount());
thrInvResultResponse.setReCount(ptxhInvResponse.getRecount());
}else {
thrInvResultResponse.setBillType("IN"); //退费入库
thrInvResultResponse.setInCount(-ptxhInvResponse.getRecount());
thrInvResultResponse.setOutCount(0);
thrInvResultResponse.setReCount(-ptxhInvResponse.getRecount());
}
thrInvResultResponse.setType("1");
thrInvResultResponse.setChargeTime(ptxhInvResponse.getRemark1());
thrInvResultResponse.setChargeUser("系统默认操作");
thrInvResultResponses.add(thrInvResultResponse);
}
}
}
PageSimpleResponse<ThrInvResultResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(thrInvResultResponses.size() + 0l);
pageSimpleResponse.setList(thrInvResultResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -0,0 +1,103 @@
package com.glxp.mipsdl.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.ClientProcessor;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.req.base.forthird.ForInvProductsFilter;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;
/**
* @author : zhuzhu
* @date : 2025/2/17 16:27
* @modyified By :
*/
@Slf4j
@RestController
public class ExAxxyyController {
@Resource
BasicUdirelDao basicUdirelDao;
@Resource
AuthWarehouseDao authWarehouseDao;
/**
* B001 /
*
* @param forInvProductsFilter
* @return
*/
@PostMapping("/ex/udiwms/inv/products/filter")
public BaseResponse invProductsFilter(@RequestBody ForInvProductsFilter forInvProductsFilter) {
if (ObjectUtil.isNull(forInvProductsFilter)) {
return ResultVOUtils.error(500, "查询条件不能为空");
}
if (StrUtil.isEmpty(forInvProductsFilter.getUdiCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getNameCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getCpmctymc()) &&
StrUtil.isEmpty(forInvProductsFilter.getBatchNo()) &&
StrUtil.isEmpty(forInvProductsFilter.getInvCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getSupName())) {
return ResultVOUtils.error(500, "查询条件不能为空!");
}
if (forInvProductsFilter.getPage() == null) {
forInvProductsFilter.setPage(1);
forInvProductsFilter.setLimit(20);
}
ForInvProductsFilter newRequest = new ForInvProductsFilter();
if (StrUtil.isEmpty(forInvProductsFilter.getInvCode()))
return ResultVOUtils.error(500, "科室编码不能为空!");
AuthWarehouseEntity authWarehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("thirdId", forInvProductsFilter.getInvCode()).last("limit 1"));
if (authWarehouseEntity == null)
return ResultVOUtils.error(500, "科室编码未对照!");
else
forInvProductsFilter.setInvCode(authWarehouseEntity.getCode());
if (StrUtil.isNotEmpty(forInvProductsFilter.getUdiCode())) {
newRequest.setPage(forInvProductsFilter.getPage());
newRequest.setLimit(forInvProductsFilter.getLimit());
newRequest.setInvCode(forInvProductsFilter.getInvCode());
newRequest.setUdiCode(forInvProductsFilter.getUdiCode());
return ClientProcessor.getHttpClient().queryUdiHighInvProductsFilter(newRequest);
} else {
if (StrUtil.isEmpty(forInvProductsFilter.getXmbm())) {
return ResultVOUtils.error(500, "项目编码不能为空!");
}
List<BasicUdirelEntity> basicUdirelEntityList = basicUdirelDao.selectList(new QueryWrapper<BasicUdirelEntity>().eq("mainId", forInvProductsFilter.getXmbm()));
if (CollUtil.isNotEmpty(basicUdirelEntityList)) {
newRequest.setRelIdFk(basicUdirelEntityList.get(0).getId() + "");
} else {
return ResultVOUtils.error(500, "项目编码未对照!");
}
newRequest.setPage(forInvProductsFilter.getPage());
newRequest.setLimit(forInvProductsFilter.getLimit());
newRequest.setBatchNo(forInvProductsFilter.getBatchNo());
newRequest.setCpmctymc(forInvProductsFilter.getCpmctymc());
newRequest.setInvCode(forInvProductsFilter.getInvCode());
newRequest.setNameCode(forInvProductsFilter.getNameCode());
newRequest.setSupName(forInvProductsFilter.getSupName());
// newRequest.setUdiCode(forInvProductsFilter.getUdiCode());
return ClientProcessor.getHttpClient().queryUdiInvProductsFilter(newRequest);
}
}
}

@ -1,142 +1,142 @@
package com.glxp.mipsdl.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.mipsdl.client.ClientProcessor;
import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
import com.glxp.mipsdl.req.base.UdiwmsQueryUdiInvProductsRequest;
import com.glxp.mipsdl.req.base.forthird.ForBasicProductsSearchFilter;
import com.glxp.mipsdl.req.base.forthird.ForInvOutScanCodeFilter;
import com.glxp.mipsdl.req.base.forthird.ForInvProductsFilter;
import com.glxp.mipsdl.res.BaseResponse;
import com.glxp.mipsdl.service.auth.AuthWarehouseService;
import com.glxp.mipsdl.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
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;
/**
* --
*/
@Slf4j
@RestController
public class ExNjxyyController {
@Resource
BasicUdirelDao basicUdirelDao;
@Resource
AuthWarehouseDao authWarehouseDao;
/**
* B001 /
*
* @param forInvProductsFilter
* @return
*/
@PostMapping("/ex/udiwms/inv/products/filter")
public BaseResponse invProductsFilter(@RequestBody ForInvProductsFilter forInvProductsFilter) {
if (ObjectUtil.isNull(forInvProductsFilter)) {
return ResultVOUtils.error(500, "查询条件不能为空");
}
if (StrUtil.isEmpty(forInvProductsFilter.getUdiCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getNameCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getCpmctymc()) &&
StrUtil.isEmpty(forInvProductsFilter.getBatchNo()) &&
StrUtil.isEmpty(forInvProductsFilter.getInvCode()) &&
StrUtil.isEmpty(forInvProductsFilter.getSupName())) {
return ResultVOUtils.error(500, "查询条件不能为空!");
}
if (forInvProductsFilter.getPage() == null) {
forInvProductsFilter.setPage(1);
forInvProductsFilter.setLimit(20);
}
ForInvProductsFilter newRequest = new ForInvProductsFilter();
if (StrUtil.isEmpty(forInvProductsFilter.getInvCode()))
return ResultVOUtils.error(500, "科室编码不能为空!");
AuthWarehouseEntity authWarehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("thirdId", forInvProductsFilter.getInvCode()).last("limit 1"));
if (authWarehouseEntity == null)
return ResultVOUtils.error(500, "科室编码未对照!");
else
forInvProductsFilter.setInvCode(authWarehouseEntity.getCode());
if (StrUtil.isNotEmpty(forInvProductsFilter.getUdiCode())) {
newRequest.setPage(forInvProductsFilter.getPage());
newRequest.setLimit(forInvProductsFilter.getLimit());
newRequest.setInvCode(forInvProductsFilter.getInvCode());
newRequest.setUdiCode(forInvProductsFilter.getUdiCode());
return ClientProcessor.getHttpClient().queryUdiHighInvProductsFilter(newRequest);
} else {
if (StrUtil.isEmpty(forInvProductsFilter.getXmbm())) {
return ResultVOUtils.error(500, "项目编码不能为空!");
}
List<BasicUdirelEntity> basicUdirelEntityList = basicUdirelDao.selectList(new QueryWrapper<BasicUdirelEntity>().eq("mainId", forInvProductsFilter.getXmbm()));
if (CollUtil.isNotEmpty(basicUdirelEntityList)) {
newRequest.setRelIdFk(basicUdirelEntityList.get(0).getId() + "");
} else {
return ResultVOUtils.error(500, "项目编码未对照!");
}
newRequest.setPage(forInvProductsFilter.getPage());
newRequest.setLimit(forInvProductsFilter.getLimit());
newRequest.setBatchNo(forInvProductsFilter.getBatchNo());
newRequest.setCpmctymc(forInvProductsFilter.getCpmctymc());
newRequest.setInvCode(forInvProductsFilter.getInvCode());
newRequest.setNameCode(forInvProductsFilter.getNameCode());
newRequest.setSupName(forInvProductsFilter.getSupName());
//package com.glxp.mipsdl.controller;
//
//import cn.hutool.core.collection.CollUtil;
//import cn.hutool.core.util.ObjectUtil;
//import cn.hutool.core.util.StrUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.glxp.mipsdl.client.ClientProcessor;
//import com.glxp.mipsdl.dao.auth.AuthWarehouseDao;
//import com.glxp.mipsdl.dao.basic.BasicUdirelDao;
//import com.glxp.mipsdl.entity.auth.AuthWarehouseEntity;
//import com.glxp.mipsdl.entity.basic.BasicUdirelEntity;
//import com.glxp.mipsdl.req.base.UdiwmsQueryUdiInvProductsRequest;
//import com.glxp.mipsdl.req.base.forthird.ForBasicProductsSearchFilter;
//import com.glxp.mipsdl.req.base.forthird.ForInvOutScanCodeFilter;
//import com.glxp.mipsdl.req.base.forthird.ForInvProductsFilter;
//import com.glxp.mipsdl.res.BaseResponse;
//import com.glxp.mipsdl.service.auth.AuthWarehouseService;
//import com.glxp.mipsdl.util.ResultVOUtils;
//import lombok.extern.slf4j.Slf4j;
//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;
//
///**
// * 南靖县医院--提供给第三方系统调用的接口
// */
//@Slf4j
//@RestController
//public class ExNjxyyController {
//
//
// @Resource
// BasicUdirelDao basicUdirelDao;
// @Resource
// AuthWarehouseDao authWarehouseDao;
//
// /**
// * B001 查询指定科室高值/普耗库存
// *
// * @param forInvProductsFilter
// * @return
// */
// @PostMapping("/ex/udiwms/inv/products/filter")
// public BaseResponse invProductsFilter(@RequestBody ForInvProductsFilter forInvProductsFilter) {
// if (ObjectUtil.isNull(forInvProductsFilter)) {
// return ResultVOUtils.error(500, "查询条件不能为空");
// }
// if (StrUtil.isEmpty(forInvProductsFilter.getUdiCode()) &&
// StrUtil.isEmpty(forInvProductsFilter.getNameCode()) &&
// StrUtil.isEmpty(forInvProductsFilter.getCpmctymc()) &&
// StrUtil.isEmpty(forInvProductsFilter.getBatchNo()) &&
// StrUtil.isEmpty(forInvProductsFilter.getInvCode()) &&
// StrUtil.isEmpty(forInvProductsFilter.getSupName())) {
// return ResultVOUtils.error(500, "查询条件不能为空!");
// }
// if (forInvProductsFilter.getPage() == null) {
// forInvProductsFilter.setPage(1);
// forInvProductsFilter.setLimit(20);
// }
// ForInvProductsFilter newRequest = new ForInvProductsFilter();
//
// if (StrUtil.isEmpty(forInvProductsFilter.getInvCode()))
// return ResultVOUtils.error(500, "科室编码不能为空!");
// AuthWarehouseEntity authWarehouseEntity = authWarehouseDao.selectOne(new QueryWrapper<AuthWarehouseEntity>().eq("thirdId", forInvProductsFilter.getInvCode()).last("limit 1"));
// if (authWarehouseEntity == null)
// return ResultVOUtils.error(500, "科室编码未对照!");
// else
// forInvProductsFilter.setInvCode(authWarehouseEntity.getCode());
//
// if (StrUtil.isNotEmpty(forInvProductsFilter.getUdiCode())) {
// newRequest.setPage(forInvProductsFilter.getPage());
// newRequest.setLimit(forInvProductsFilter.getLimit());
// newRequest.setInvCode(forInvProductsFilter.getInvCode());
// newRequest.setUdiCode(forInvProductsFilter.getUdiCode());
return ClientProcessor.getHttpClient().queryUdiInvProductsFilter(newRequest);
}
}
/**
* B002
*
* @param forBasicProductsSearchFilter
* @return
*/
@PostMapping("/ex/udiwms/basic/products/search")
public BaseResponse basicProductsSearch(@RequestBody ForBasicProductsSearchFilter forBasicProductsSearchFilter) {
if (ObjectUtil.isNull(forBasicProductsSearchFilter)) {
return ResultVOUtils.error(500, "查询条件不能为空");
}
if (StrUtil.isEmpty(forBasicProductsSearchFilter.getUdiCode()) &&
StrUtil.isEmpty(forBasicProductsSearchFilter.getNameCode()) &&
StrUtil.isEmpty(forBasicProductsSearchFilter.getCpmctymc()) &&
StrUtil.isEmpty(forBasicProductsSearchFilter.getMainId()) &&
StrUtil.isEmpty(forBasicProductsSearchFilter.getGgxh())) {
return ResultVOUtils.error(500, "查询条件不能为空!");
}
if (forBasicProductsSearchFilter.getPage() == null) {
forBasicProductsSearchFilter.setPage(1);
forBasicProductsSearchFilter.setLimit(20);
}
return ClientProcessor.getHttpClient().queryUdiBasicProductsSearch(forBasicProductsSearchFilter);
}
/**
* B003 /退
*
* @param forInvOutScanCodeFilter
* @return
*/
@PostMapping("/ex/udiwms/inv/out/scanCode")
public BaseResponse invOutScanCode(@RequestBody ForInvOutScanCodeFilter forInvOutScanCodeFilter) {
return ClientProcessor.getHttpClient().queryUdiInvOutScanCode(forInvOutScanCodeFilter);
}
}
// return ClientProcessor.getHttpClient().queryUdiHighInvProductsFilter(newRequest);
// } else {
// if (StrUtil.isEmpty(forInvProductsFilter.getXmbm())) {
// return ResultVOUtils.error(500, "项目编码不能为空!");
// }
// List<BasicUdirelEntity> basicUdirelEntityList = basicUdirelDao.selectList(new QueryWrapper<BasicUdirelEntity>().eq("mainId", forInvProductsFilter.getXmbm()));
// if (CollUtil.isNotEmpty(basicUdirelEntityList)) {
// newRequest.setRelIdFk(basicUdirelEntityList.get(0).getId() + "");
// } else {
// return ResultVOUtils.error(500, "项目编码未对照!");
// }
// newRequest.setPage(forInvProductsFilter.getPage());
// newRequest.setLimit(forInvProductsFilter.getLimit());
// newRequest.setBatchNo(forInvProductsFilter.getBatchNo());
// newRequest.setCpmctymc(forInvProductsFilter.getCpmctymc());
// newRequest.setInvCode(forInvProductsFilter.getInvCode());
// newRequest.setNameCode(forInvProductsFilter.getNameCode());
// newRequest.setSupName(forInvProductsFilter.getSupName());
//// newRequest.setUdiCode(forInvProductsFilter.getUdiCode());
// return ClientProcessor.getHttpClient().queryUdiInvProductsFilter(newRequest);
// }
//
//
// }
//
//
// /**
// * B002 查询耗材字典
// *
// * @param forBasicProductsSearchFilter
// * @return
// */
// @PostMapping("/ex/udiwms/basic/products/search")
// public BaseResponse basicProductsSearch(@RequestBody ForBasicProductsSearchFilter forBasicProductsSearchFilter) {
// if (ObjectUtil.isNull(forBasicProductsSearchFilter)) {
// return ResultVOUtils.error(500, "查询条件不能为空");
// }
// if (StrUtil.isEmpty(forBasicProductsSearchFilter.getUdiCode()) &&
// StrUtil.isEmpty(forBasicProductsSearchFilter.getNameCode()) &&
// StrUtil.isEmpty(forBasicProductsSearchFilter.getCpmctymc()) &&
// StrUtil.isEmpty(forBasicProductsSearchFilter.getMainId()) &&
// StrUtil.isEmpty(forBasicProductsSearchFilter.getGgxh())) {
// return ResultVOUtils.error(500, "查询条件不能为空!");
// }
// if (forBasicProductsSearchFilter.getPage() == null) {
// forBasicProductsSearchFilter.setPage(1);
// forBasicProductsSearchFilter.setLimit(20);
// }
// return ClientProcessor.getHttpClient().queryUdiBasicProductsSearch(forBasicProductsSearchFilter);
// }
//
// /**
// * B003 高值耗材实时出库/退库
// *
// * @param forInvOutScanCodeFilter
// * @return
// */
// @PostMapping("/ex/udiwms/inv/out/scanCode")
// public BaseResponse invOutScanCode(@RequestBody ForInvOutScanCodeFilter forInvOutScanCodeFilter) {
// return ClientProcessor.getHttpClient().queryUdiInvOutScanCode(forInvOutScanCodeFilter);
// }
//
//
//}

@ -5,19 +5,19 @@ spring:
strict: false
datasource:
master:
url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:p6spy:mysql://127.0.0.1:3306/lh_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
njsql:
url: jdbc:p6spy:mysql://127.0.0.1:3306/view_nj?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
hikari:
connection-timeout: 60000
maximum-pool-size: 60
minimum-idle: 10
# njsql:
# url: jdbc:p6spy:mysql://127.0.0.1:3306/view_nj?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
# username: root
# password: 123456
# driver-class-name: com.p6spy.engine.spy.P6SpyDriver
# hikari:
# connection-timeout: 60000
# maximum-pool-size: 60
# minimum-idle: 10
hikari:
connection-timeout: 60000
maximum-pool-size: 60

@ -20,7 +20,7 @@ THIRD_ID: thirdId
THIRD_NAME: thirdName
#UDI管理系统地址
UDIWMS_IP: http://127.0.0.1:9991
UDIWMS_IP: http://192.168.0.44:9991
#mybatis-plus配置
mybatis-plus:

@ -58,5 +58,13 @@
{
"code": "100014",
"name": "四川平武县医院"
},
{
"code": "100016",
"name": "龙海中医院"
},
{
"code": "100017",
"name": "安溪县医院"
}
]

Loading…
Cancel
Save