|
|
|
@ -69,6 +69,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
@ -81,7 +82,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
// 目前只有3505调通过上传医保 其他先不配置怕自动上传出问题
|
|
|
|
|
private final String[] buyType_3501 = {};
|
|
|
|
|
private final String[] buyType_3502 = {"SC73200069614118"};
|
|
|
|
|
private final String[] buyType_3504 = { };
|
|
|
|
|
private final String[] buyType_3504 = {};
|
|
|
|
|
|
|
|
|
|
private final String[] buyType_3505 = {"YPCF003", "YPCF002"};
|
|
|
|
|
private final String[] buyType_35051 = {"SC72197936495755"};
|
|
|
|
@ -306,7 +307,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
listNew = new ArrayList();
|
|
|
|
|
// 删除医保编码数据为空的数据
|
|
|
|
|
for (ThrProductsEntity thrProductsEntity : thrProductsEntityList) {
|
|
|
|
|
if(StringUtils.isNotBlank(thrProductsEntity.getYbbm())){
|
|
|
|
|
if (StringUtils.isNotBlank(thrProductsEntity.getYbbm())) {
|
|
|
|
|
listNew.add(thrProductsEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -321,7 +322,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(listNew)){
|
|
|
|
|
if (CollUtil.isNotEmpty(listNew)) {
|
|
|
|
|
for (ThrProductsEntity entity : listNew) {
|
|
|
|
|
entity.setId(null);
|
|
|
|
|
entity.setRemark(entity.getCode());
|
|
|
|
@ -715,7 +716,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
.selectList(Wrappers.lambdaQuery(IoOrderInvoiceEntity.class).eq(IoOrderInvoiceEntity::getOrderIdFk, orderEntity.getBillNo())
|
|
|
|
|
.eq(IoOrderInvoiceEntity::getBindRlFk, i.getBindRlFk())
|
|
|
|
|
.eq(StrUtil.isNotEmpty(i.getBatchNo()), IoOrderInvoiceEntity::getBatchNo, i.getBatchNo()).
|
|
|
|
|
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
|
|
|
|
|
groupBy(IoOrderInvoiceEntity::getInvoiceEncode));
|
|
|
|
|
if (CollectionUtil.isNotEmpty(invoiceList)) {
|
|
|
|
|
fphm = invoiceList.stream().map(IoOrderInvoiceEntity::getInvoiceEncode).collect(Collectors.joining(","));
|
|
|
|
|
if (invoiceList.get(0).getInvoiceDate() != null)
|
|
|
|
@ -1423,31 +1424,31 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
public BaseResponse getPrescribes(UdiwmsBasicSkPrescribeRequest udiwmsBasicSkPrescribeRequest) {
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setDatabaseProductName(getDataSourceType());
|
|
|
|
|
if (IntUtil.value(udiwmsBasicSkPrescribeRequest.getInOutType()) == 0) {
|
|
|
|
|
log.info("udiwmsBasicSkPrescribeRequest11111"+udiwmsBasicSkPrescribeRequest);
|
|
|
|
|
log.info("udiwmsBasicSkPrescribeRequest11111" + udiwmsBasicSkPrescribeRequest);
|
|
|
|
|
LambdaQueryWrapper<VInsurNationGoodsPhysic> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
String startTime = udiwmsBasicSkPrescribeRequest.getStartTime();
|
|
|
|
|
String endTime = udiwmsBasicSkPrescribeRequest.getEndTime();
|
|
|
|
|
wrapper.ge(StrUtil.isNotEmpty(startTime), VInsurNationGoodsPhysic::getSEL_RETN_TIME, DateUtil.parseDate(startTime));
|
|
|
|
|
wrapper.le(StrUtil.isNotEmpty(endTime), VInsurNationGoodsPhysic::getSEL_RETN_TIME, DateUtil.parseDate(endTime));
|
|
|
|
|
wrapper.ge(StrUtil.isNotEmpty(startTime), VInsurNationGoodsPhysic::getSEL_RETN_TIME, DateUtil.parseDate(startTime));
|
|
|
|
|
wrapper.le(StrUtil.isNotEmpty(endTime), VInsurNationGoodsPhysic::getSEL_RETN_TIME, DateUtil.parseDate(endTime));
|
|
|
|
|
|
|
|
|
|
String code = udiwmsBasicSkPrescribeRequest.getCode();
|
|
|
|
|
String fromCorpName = udiwmsBasicSkPrescribeRequest.getFromCorpName();
|
|
|
|
|
String key = udiwmsBasicSkPrescribeRequest.getKey();
|
|
|
|
|
wrapper.and(StrUtil.isNotEmpty(code), t -> t.eq(VInsurNationGoodsPhysic::getSTOOUT_NO, code).or().eq(VInsurNationGoodsPhysic::getRXNO, code));
|
|
|
|
|
wrapper.and(StrUtil.isNotEmpty(key), t -> t.like(VInsurNationGoodsPhysic::getSTOOUT_NO, "%"+key+"%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getRXNO, "%"+key+"%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getPSN_NAME, "%"+key+"%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getPSN_NO, "%"+key+"%")
|
|
|
|
|
wrapper.and(StrUtil.isNotEmpty(key), t -> t.like(VInsurNationGoodsPhysic::getSTOOUT_NO, "%" + key + "%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getRXNO, "%" + key + "%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getPSN_NAME, "%" + key + "%")
|
|
|
|
|
.or().like(VInsurNationGoodsPhysic::getPSN_NO, "%" + key + "%")
|
|
|
|
|
);
|
|
|
|
|
wrapper.and(StrUtil.isNotEmpty(fromCorpName), t -> t.eq(VInsurNationGoodsPhysic::getPSN_NAME, fromCorpName));
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getCode())){
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setQueryCode("'"+udiwmsBasicSkPrescribeRequest.getCode()+"'");
|
|
|
|
|
}else if(StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getKey())) {
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setQueryCode("'"+udiwmsBasicSkPrescribeRequest.getKey()+"'");
|
|
|
|
|
if (StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getCode())) {
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setQueryCode("'" + udiwmsBasicSkPrescribeRequest.getCode() + "'");
|
|
|
|
|
} else if (StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getKey())) {
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setQueryCode("'" + udiwmsBasicSkPrescribeRequest.getKey() + "'");
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
udiwmsBasicSkPrescribeRequest.setQueryCode("null");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1470,7 +1471,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
// 分组
|
|
|
|
|
if(StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getQueryCode()) && !udiwmsBasicSkPrescribeRequest.getQueryCode().equals("null")){
|
|
|
|
|
if (StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getQueryCode()) && !udiwmsBasicSkPrescribeRequest.getQueryCode().equals("null")) {
|
|
|
|
|
Map<String, List<VYpzsPresInfo>> groupedRecords = page.getRecords().stream()
|
|
|
|
|
.collect(Collectors.groupingBy(VYpzsPresInfo::getQUERY_CODE));
|
|
|
|
|
List<VYpzsPresInfo> latestRecords = new ArrayList<>();
|
|
|
|
@ -1711,7 +1712,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
public BaseResponse uploadCollectOrder(PostCollectOrderRequest postCollectOrderRequest) {
|
|
|
|
|
List<IoCollectOrder> collectOrderList = postCollectOrderRequest.getCollectOrderList();
|
|
|
|
|
if (CollUtil.isNotEmpty(collectOrderList)) {
|
|
|
|
|
log.error("collectOrderList"+collectOrderList);
|
|
|
|
|
log.error("collectOrderList" + collectOrderList);
|
|
|
|
|
for (IoCollectOrder ioCollectOrder : collectOrderList) {
|
|
|
|
|
String busType = ioCollectOrder.getBusType();
|
|
|
|
|
if (matchBusType(busType, buyType_3501)) {
|
|
|
|
@ -1789,55 +1790,85 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
List<VYpzsPresInfo> vInsurNationGoodsPhysics = new ArrayList<>();
|
|
|
|
|
String summaryNo;
|
|
|
|
|
if (CollUtil.isNotEmpty(presInfoEntities)) {
|
|
|
|
|
if (presInfoEntities.size() == 1) {//进入拉取周边的同患者同处方 通过患者id 和 周边时间 上下10分钟
|
|
|
|
|
VYpzsPresInfo vYpzsPresInfo = presInfoEntities.get(0);
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<VYpzsPresInfo> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper1.eq(VYpzsPresInfo::getPRESCRIBE_NUMBER, vYpzsPresInfo.getPRESCRIBE_NUMBER());
|
|
|
|
|
presInfoEntities = vYpzsPresInfoMapper.selectList(wrapper1);
|
|
|
|
|
vYpzsPresInfo = presInfoEntities.get(0);
|
|
|
|
|
|
|
|
|
|
String layTimeStr = vYpzsPresInfo.getLAY_TIME();//当前处方的时间
|
|
|
|
|
String sickId = vYpzsPresInfo.getSICK_ID();
|
|
|
|
|
String icCardId = vYpzsPresInfo.getIC_CARD_ID();
|
|
|
|
|
// if (presInfoEntities.size() == 1) {//进入拉取周边的同患者同处方 通过患者id 和 周边时间 上下10分钟
|
|
|
|
|
// VYpzsPresInfo vYpzsPresInfo = presInfoEntities.get(0);
|
|
|
|
|
//
|
|
|
|
|
// LambdaQueryWrapper<VYpzsPresInfo> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
|
// wrapper1.eq(VYpzsPresInfo::getPRESCRIBE_NUMBER, vYpzsPresInfo.getPRESCRIBE_NUMBER());
|
|
|
|
|
// presInfoEntities = vYpzsPresInfoMapper.selectList(wrapper1);
|
|
|
|
|
// vYpzsPresInfo = presInfoEntities.get(0);
|
|
|
|
|
//
|
|
|
|
|
// String layTimeStr = vYpzsPresInfo.getLAY_TIME();//当前处方的时间
|
|
|
|
|
// String sickId = vYpzsPresInfo.getSICK_ID();
|
|
|
|
|
// String icCardId = vYpzsPresInfo.getIC_CARD_ID();
|
|
|
|
|
//
|
|
|
|
|
// // 时间格式处理(补充格式定义)
|
|
|
|
|
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
//
|
|
|
|
|
// // 转换为 LocalDateTime 并计算时间范围
|
|
|
|
|
// LocalDateTime layTime;
|
|
|
|
|
// try {
|
|
|
|
|
// layTimeStr = layTimeStr.replace(".0", "");
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// layTime = LocalDateTime.parse(layTimeStr, formatter);
|
|
|
|
|
//
|
|
|
|
|
// }catch (Exception e){
|
|
|
|
|
// formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// layTime = LocalDateTime.parse(layTimeStr, formatter);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// LocalDateTime startTime = layTime.minusMinutes(10); // 向前10分钟
|
|
|
|
|
// LocalDateTime endTime = layTime.plusMinutes(10); // 向后10分钟
|
|
|
|
|
//
|
|
|
|
|
// summaryNo = layTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + icCardId;
|
|
|
|
|
//
|
|
|
|
|
// LambdaQueryWrapper<VYpzsPresInfo> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
|
// wrapper2.eq(VYpzsPresInfo::getSICK_ID, sickId);
|
|
|
|
|
// // 使用 TO_TIMESTAMP 函数进行转换
|
|
|
|
|
// wrapper2.apply("LAY_TIME BETWEEN TO_TIMESTAMP({0}, 'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP({1}, 'YYYY-MM-DD HH24:MI:SS')",
|
|
|
|
|
// startTime.format(formatter), endTime.format(formatter));
|
|
|
|
|
//
|
|
|
|
|
// vInsurNationGoodsPhysics = vYpzsPresInfoMapper.selectList(wrapper2);
|
|
|
|
|
//
|
|
|
|
|
// }else {
|
|
|
|
|
//区分住院、门诊处方
|
|
|
|
|
LambdaQueryWrapper<VYpzsPresInfo> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
// 时间格式处理(补充格式定义)
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
if (StringUtils.isNotEmpty(udiwmsBasicSkPrescribeRequest.getQueryCode()) && !udiwmsBasicSkPrescribeRequest.getQueryCode().equals("null") && udiwmsBasicSkPrescribeRequest.getBusType().equals("YPCF003")
|
|
|
|
|
&& udiwmsBasicSkPrescribeRequest.getQueryCode().startsWith("'5")) {
|
|
|
|
|
|
|
|
|
|
// 转换为 LocalDateTime 并计算时间范围
|
|
|
|
|
LocalDateTime layTime;
|
|
|
|
|
List<String> collect = presInfoEntities.stream().map(VYpzsPresInfo::getQUERY_CODE).collect(Collectors.toList());
|
|
|
|
|
wrapper1.in(VYpzsPresInfo::getSTOOUT_NO, collect);
|
|
|
|
|
vInsurNationGoodsPhysics = vYpzsPresInfoMapper.selectList(wrapper1);
|
|
|
|
|
String sickId = vInsurNationGoodsPhysics.get(0).getSICK_ID();
|
|
|
|
|
String layTimeStr = vInsurNationGoodsPhysics.get(0).getLAY_TIME();//当前处方的时间
|
|
|
|
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
String result="";
|
|
|
|
|
try {
|
|
|
|
|
layTimeStr = layTimeStr.replace(".0", "");
|
|
|
|
|
Date date = inputFormat.parse(layTimeStr.replace(".000", "").replace(".0", ""));
|
|
|
|
|
result = outputFormat.format(date);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
summaryNo = result + sickId;
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
List<String> collect = presInfoEntities.stream().map(VYpzsPresInfo::getPRESCRIBE_NUMBER).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
layTime = LocalDateTime.parse(layTimeStr, formatter);
|
|
|
|
|
wrapper1.in(VYpzsPresInfo::getPRESCRIBE_NUMBER, collect);
|
|
|
|
|
vInsurNationGoodsPhysics = vYpzsPresInfoMapper.selectList(wrapper1);
|
|
|
|
|
summaryNo = "";
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
layTime = LocalDateTime.parse(layTimeStr, formatter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
LocalDateTime startTime = layTime.minusMinutes(10); // 向前10分钟
|
|
|
|
|
LocalDateTime endTime = layTime.plusMinutes(10); // 向后10分钟
|
|
|
|
|
|
|
|
|
|
summaryNo = layTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + icCardId;
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<VYpzsPresInfo> wrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper2.eq(VYpzsPresInfo::getSICK_ID, sickId);
|
|
|
|
|
// 使用 TO_TIMESTAMP 函数进行转换
|
|
|
|
|
wrapper2.apply("LAY_TIME BETWEEN TO_TIMESTAMP({0}, 'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP({1}, 'YYYY-MM-DD HH24:MI:SS')",
|
|
|
|
|
startTime.format(formatter), endTime.format(formatter));
|
|
|
|
|
|
|
|
|
|
vInsurNationGoodsPhysics = vYpzsPresInfoMapper.selectList(wrapper2);
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
summaryNo = "";
|
|
|
|
|
|
|
|
|
|
List<String> collect = presInfoEntities.stream().map(VYpzsPresInfo::getPRESCRIBE_NUMBER).collect(Collectors.toList());
|
|
|
|
|
LambdaQueryWrapper<VYpzsPresInfo> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
|
wrapper1.in(VYpzsPresInfo::getPRESCRIBE_NUMBER, collect);
|
|
|
|
|
vInsurNationGoodsPhysics = vYpzsPresInfoMapper.selectList(wrapper1);
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
summaryNo = "";
|
|
|
|
|
}
|
|
|
|
@ -1851,9 +1882,12 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
|
|
|
|
|
List<IoCollectOrder> ioCollectOrders = new ArrayList<>();
|
|
|
|
|
groupedByPrescribeNumber.forEach((key, value) -> {
|
|
|
|
|
VYpzsPresInfo presInfoEntity = value.stream()
|
|
|
|
|
.max(Comparator.comparing(VYpzsPresInfo::getLAY_TIME))
|
|
|
|
|
.orElse(null);;
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 根据实际时间格式调整
|
|
|
|
|
VYpzsPresInfo presInfoEntity = Optional.ofNullable(value)
|
|
|
|
|
.flatMap(l -> l.stream()
|
|
|
|
|
.max(Comparator.comparing(info -> LocalDateTime.parse(info.getLAY_TIME().replace(".000", "").replace(".0", ""), formatter))))
|
|
|
|
|
.orElse(null);
|
|
|
|
|
|
|
|
|
|
StringBuilder errorMsg = new StringBuilder();
|
|
|
|
|
IoCollectOrder ioCollectOrder = new IoCollectOrder();
|
|
|
|
|
|
|
|
|
@ -1882,7 +1916,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
ioCollectOrder.setUpdateTime(new Date());
|
|
|
|
|
ioCollectOrder.setSplitStatus(0);
|
|
|
|
|
ioCollectOrder.setTagStatus(0);
|
|
|
|
|
if (StrUtil.isNotEmpty(summaryNo)){
|
|
|
|
|
if (StrUtil.isNotEmpty(summaryNo)) {
|
|
|
|
|
ioCollectOrder.setSummaryNo(summaryNo);
|
|
|
|
|
}
|
|
|
|
|
List<IoCollectOrderBiz> bizList = new ArrayList<>();
|
|
|
|
@ -2153,17 +2187,32 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
// log.error("stoout_no===",stoout_no);
|
|
|
|
|
List<VYpzsPresInfo> list = vYpzsPresInfoMapper
|
|
|
|
|
.selectList(
|
|
|
|
|
new QueryWrapper<VYpzsPresInfo>().eq("PRESCRIBE_NUMBER",ioCollectOrder.getBillNo())
|
|
|
|
|
new QueryWrapper<VYpzsPresInfo>()
|
|
|
|
|
.eq("PRESCRIBE_NUMBER", ioCollectOrder.getBillNo())
|
|
|
|
|
);
|
|
|
|
|
if ( CollUtil.isNotEmpty(list)) {
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 根据实际时间格式调整
|
|
|
|
|
|
|
|
|
|
String stoout_no = list.get(0).getPRESCRIBE_NUMBER();
|
|
|
|
|
|
|
|
|
|
List<VInsurNationGoodsPhysic> vInsurNationGoodsPhysics = goodsPhysicMapper.selectList(new LambdaQueryWrapper<VInsurNationGoodsPhysic>()
|
|
|
|
|
.eq(VInsurNationGoodsPhysic::getRXNO, stoout_no)
|
|
|
|
|
// 使用 apply 方法嵌入原生 SQL 进行日期格式转换
|
|
|
|
|
.apply("TO_CHAR(SEL_RETN_TIME, 'yyyy-MM-dd HH24:MI:SS') = TO_CHAR({0}, 'yyyy-MM-dd HH24:MI:SS')", list.get(0).getLAY_TIME()));
|
|
|
|
|
if ( CollUtil.isNotEmpty(vInsurNationGoodsPhysics)) {
|
|
|
|
|
VYpzsPresInfo vYpzsPresInfo = Optional.ofNullable(list)
|
|
|
|
|
.flatMap(l -> l.stream()
|
|
|
|
|
.max(Comparator.comparing(info -> LocalDateTime.parse(info.getLAY_TIME().replace(".000", "").replace(".0", ""), formatter))))
|
|
|
|
|
.orElse(null);
|
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<VInsurNationGoodsPhysic> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
|
queryWrapper.eq(VInsurNationGoodsPhysic::getRXNO, vYpzsPresInfo.getPRESCRIBE_NUMBER());
|
|
|
|
|
// 使用 apply 方法嵌入原生 SQL 进行日期格式转换
|
|
|
|
|
if (getDataSourceType().equals("Oracle")) {
|
|
|
|
|
queryWrapper.apply("TO_CHAR(SEL_RETN_TIME, 'yyyy-MM-dd HH24:MI:SS') = {0}", vYpzsPresInfo.getLAY_TIME().replace(".000", "").replace(".0", ""));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
queryWrapper.apply("DATE_FORMAT(SEL_RETN_TIME, '%Y-%m-%d %H:%i:%s') = DATE_FORMAT({0}, '%Y-%m-%d %H:%i:%s')", vYpzsPresInfo.getLAY_TIME().replace(".000", "").replace(".0", ""));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<VInsurNationGoodsPhysic> vInsurNationGoodsPhysics = goodsPhysicMapper.selectList(queryWrapper);
|
|
|
|
|
if (CollUtil.isNotEmpty(vInsurNationGoodsPhysics)) {
|
|
|
|
|
List<CollectOrderBizResponse> collectOrderBizResponseList = ioCollectOrder.getCollectOrderBizResponseList();
|
|
|
|
|
|
|
|
|
|
List<Xsck3505Request> xsck3505Requests = new ArrayList<>();
|
|
|
|
@ -2172,11 +2221,11 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
String itemCode = basicUdirelEntity.getMainId();
|
|
|
|
|
for (VInsurNationGoodsPhysic vInsurNationGoodsPhysic : vInsurNationGoodsPhysics) {
|
|
|
|
|
if (vInsurNationGoodsPhysic.getMED_LIST_CODG().equals(itemCode)) {
|
|
|
|
|
String[] codes = new String[0];
|
|
|
|
|
if(StringUtils.isNotEmpty(collectOrderBizResponse.getFinishUdiCode())){
|
|
|
|
|
String[] codes = new String[0];
|
|
|
|
|
if (StringUtils.isNotEmpty(collectOrderBizResponse.getFinishUdiCode())) {
|
|
|
|
|
codes = collectOrderBizResponse.getFinishUdiCode().split(",");
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
collectOrderBizResponse.setTrdnFlag("0");
|
|
|
|
|
}
|
|
|
|
|
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
|
|
|
|
@ -2195,14 +2244,14 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 医保自费类型
|
|
|
|
|
if(StringUtils.isEmpty(vInsurNationGoodsPhysic.getMDTRT_SETL_TYPE()) || !"1".equals(vInsurNationGoodsPhysic.getMDTRT_SETL_TYPE())){
|
|
|
|
|
if (StringUtils.isEmpty(vInsurNationGoodsPhysic.getMDTRT_SETL_TYPE()) || !"1".equals(vInsurNationGoodsPhysic.getMDTRT_SETL_TYPE())) {
|
|
|
|
|
vInsurNationGoodsPhysic.setMDTRT_SETL_TYPE("2");
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(vInsurNationGoodsPhysic.getMDTRT_SN())){
|
|
|
|
|
if (StringUtils.isEmpty(vInsurNationGoodsPhysic.getMDTRT_SN())) {
|
|
|
|
|
vInsurNationGoodsPhysic.setMDTRT_SN(ioCollectOrder.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isEmpty(vInsurNationGoodsPhysic.getFIXMEDINS_BCHNO())){
|
|
|
|
|
if (StringUtils.isEmpty(vInsurNationGoodsPhysic.getFIXMEDINS_BCHNO())) {
|
|
|
|
|
vInsurNationGoodsPhysic.setFIXMEDINS_BCHNO(ioCollectOrder.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
Xsck3505Request xsck3505Request = Xsck3505Request.builder()
|
|
|
|
@ -2252,13 +2301,13 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
baseXsck3505Request.setSelinfoDetail(xsck3505Requests);
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(baseXsck3505Request);
|
|
|
|
|
JSONObject dataJson = JSONObject.parseObject(jsonStr);
|
|
|
|
|
return ybClient.ybPost("3505A", dataJson,ioCollectOrder.getBillNo());
|
|
|
|
|
return ybClient.ybPost("3505A", dataJson, ioCollectOrder.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(500,"上传医保数据为空请核实");
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "上传医保数据为空请核实");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.error(500,"上传医保数据为空请核实");
|
|
|
|
|
return ResultVOUtils.error(500, "上传医保数据为空请核实");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2315,9 +2364,9 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
String formattedDate = sdf.format(ioCollectOrder.getBillTime());
|
|
|
|
|
//todo 处方药标志先写死 后面要商量怎么获得
|
|
|
|
|
String rxFlag ="1";
|
|
|
|
|
log.error("optionUploadCollectOrder35051===item==="+item);
|
|
|
|
|
if(org.apache.commons.lang3.StringUtils.isEmpty(item.getBatchNo())){
|
|
|
|
|
String rxFlag = "1";
|
|
|
|
|
log.error("optionUploadCollectOrder35051===item===" + item);
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isEmpty(item.getBatchNo())) {
|
|
|
|
|
item.setBatchNo("null");
|
|
|
|
|
}
|
|
|
|
|
Xsck35051Request xsck35051Request = Xsck35051Request.builder()
|
|
|
|
@ -2366,7 +2415,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
baseXsck35051Request.setSelinfoDetail(xsck35051Requests);
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(baseXsck35051Request);
|
|
|
|
|
JSONObject dataJson = JSONObject.parseObject(jsonStr);
|
|
|
|
|
return ybClient.ybPost("35051", dataJson,ioCollectOrder.getBillNo());
|
|
|
|
|
return ybClient.ybPost("35051", dataJson, ioCollectOrder.getBillNo());
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "上传医保数据为空请核实");
|
|
|
|
|
}
|
|
|
|
@ -2421,7 +2470,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
basePcsc3501Request.setSelinfoDetail(pcsc3501Requests);
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(basePcsc3501Request);
|
|
|
|
|
JSONObject dataJson = JSONObject.parseObject(jsonStr);
|
|
|
|
|
ybClient.ybPost("3501A", dataJson,ioCollectOrder.getBillNo());
|
|
|
|
|
ybClient.ybPost("3501A", dataJson, ioCollectOrder.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2439,15 +2488,15 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
// if (item.getYbbm().equals(itemCode)) {
|
|
|
|
|
String[] codes = item.getFinishUdiCode().split(",");
|
|
|
|
|
String nameCode = item.getNameCode();
|
|
|
|
|
BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(
|
|
|
|
|
new QueryWrapper<BasicProductsEntity>().eq("nameCode",nameCode).last("limit 1")
|
|
|
|
|
BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(
|
|
|
|
|
new QueryWrapper<BasicProductsEntity>().eq("nameCode", nameCode).last("limit 1")
|
|
|
|
|
);
|
|
|
|
|
if(Objects.isNull(basicProductsEntity)){
|
|
|
|
|
return ResultVOUtils.error(500,"产品为空请检查");
|
|
|
|
|
if (Objects.isNull(basicProductsEntity)) {
|
|
|
|
|
return ResultVOUtils.error(500, "产品为空请检查");
|
|
|
|
|
}
|
|
|
|
|
Integer packLevel = Integer.valueOf(basicProductsEntity.getPackLevel());
|
|
|
|
|
List<DrugInfoRequest> drugTraceList = new ArrayList<>();
|
|
|
|
|
List<String> codeList = new ArrayList<>();
|
|
|
|
|
List<String> codeList = new ArrayList<>();
|
|
|
|
|
// 遍历fruits数组
|
|
|
|
|
for (String code : codes) {
|
|
|
|
|
if (StrUtil.isNotBlank(code)) {
|
|
|
|
@ -2460,8 +2509,8 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 级别为2的产品码不可能只有一个
|
|
|
|
|
if(packLevel >1 && codeList.size() <2){
|
|
|
|
|
return ResultVOUtils.error(500,"大包装码关联关系拉取不到请检查"+code);
|
|
|
|
|
if (packLevel > 1 && codeList.size() < 2) {
|
|
|
|
|
return ResultVOUtils.error(500, "大包装码关联关系拉取不到请检查" + code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -2472,8 +2521,8 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
drugTraceList.add(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isEmpty(drugTraceList)){
|
|
|
|
|
return ResultVOUtils.error(500,"单据要传的码为空请检查");
|
|
|
|
|
if (CollUtil.isEmpty(drugTraceList)) {
|
|
|
|
|
return ResultVOUtils.error(500, "单据要传的码为空请检查");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: 2024/9/10 字段未完全正确对应
|
|
|
|
@ -2499,9 +2548,9 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
baseKcbg3502Request.setInvinfoDetail(kcbg3502Requests);
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(baseKcbg3502Request);
|
|
|
|
|
JSONObject dataJson = JSONObject.parseObject(jsonStr);
|
|
|
|
|
return ybClient.ybPost("3502A", dataJson,ioCollectOrder.getBillNo());
|
|
|
|
|
}else {
|
|
|
|
|
return ResultVOUtils.error(500,"上传医保数据为空请核实");
|
|
|
|
|
return ybClient.ybPost("3502A", dataJson, ioCollectOrder.getBillNo());
|
|
|
|
|
} else {
|
|
|
|
|
return ResultVOUtils.error(500, "上传医保数据为空请核实");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2572,7 +2621,7 @@ public class yxfyClient extends CommonHttpClient {
|
|
|
|
|
baseXsth3506Request.setSelinfoDetail(xsth3506Requests);
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(baseXsth3506Request);
|
|
|
|
|
JSONObject dataJson = JSONObject.parseObject(jsonStr);
|
|
|
|
|
ybClient.ybPost("3506A", dataJson,ioCollectOrder.getBillNo());
|
|
|
|
|
ybClient.ybPost("3506A", dataJson, ioCollectOrder.getBillNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|