diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index f2cedb0e..c5022a6b 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -426,8 +426,13 @@ public class UdiContrastService { // udiProductService.insertUdiInfo(udiProductEntity); } if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { + int errCount = 0; for (int i = 0; i < thirdAliDrugList.size(); i++) { ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); + if(!drugRulesVerify(ybDrug,thirdAliDrug)){ + errCount++; + continue; + } udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); @@ -487,6 +492,9 @@ public class UdiContrastService { udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductService.insertUdiInfo(udiProductEntity); } + if(errCount == thirdAliDrugList.size()){ + udiProductService.insertUdiInfo(udiProductEntity); + } try { udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType())); @@ -595,6 +603,33 @@ public class UdiContrastService { } } + public boolean drugRulesVerify(YbDrug ybDrug,ThirdAliDrug thirdAliDrug ){ + try { + Integer bzggInt = DimaUtil.trMinCount(thirdAliDrug.getBzgg()); + // 按照医保数量与阿里包装规格对比 + if((bzggInt == ybDrug.getFactor())){ + return true; + } + // 医保规格拆分与阿里规格拆分做匹配 + List list = DimaUtil.extractNumbers(ybDrug.getRealityOutlook()); + if(list!=null && list.size() >0){ + for (String str : list) { + if(str.equals(bzggInt+"")){ + return true; + } + } + } + // 医保的规格与阿里制剂规格完全匹配 + if(thirdAliDrug.getFormSpec().equals(ybDrug.getRealityOutlook())){ + return true; + } + }catch (Exception e){ + log.error("药品校验出现错误==="+e.getMessage()); + return false; + } + return false; + + } public void createOnlyApply(ThrProductsAddDiEntity thrProductsAddDiEntity) { diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java index b2a5b346..e085ce26 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java @@ -637,8 +637,8 @@ public class UdiProductServiceImpl implements UdiProductService { List thirdAliDrugList = thirdAliDrugService.list( new QueryWrapper().eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getBzgg()),"bzgg", thirdAliDrugServiceOne.getBzgg()) .eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getPackRatio()),"packRatio", thirdAliDrugServiceOne.getPackRatio()) - .eq(StringUtils.isNotBlank( thirdAliDrugRequest.getCpmctymc()),"cpmctymc", thirdAliDrugRequest.getCpmctymc()) - .eq(StringUtils.isNotBlank( thirdAliDrugRequest.getManufacturer()),"manufacturer", thirdAliDrugRequest.getManufacturer()) + .like(StringUtils.isNotBlank( thirdAliDrugRequest.getCpmctymc()),"cpmctymc", thirdAliDrugRequest.getCpmctymc()) + .like(StringUtils.isNotBlank( thirdAliDrugRequest.getManufacturer()),"manufacturer", thirdAliDrugRequest.getManufacturer()) .eq(StringUtils.isNotBlank( thirdAliDrugRequest.getApprovalNum()),"approvalNum", thirdAliDrugRequest.getApprovalNum()) ); diff --git a/src/main/java/com/glxp/api/util/DimaUtil.java b/src/main/java/com/glxp/api/util/DimaUtil.java index 111bf39e..bcd7f939 100644 --- a/src/main/java/com/glxp/api/util/DimaUtil.java +++ b/src/main/java/com/glxp/api/util/DimaUtil.java @@ -51,4 +51,32 @@ public class DimaUtil { return null; } + public static List trMinCountAll(String bzgg) { + List list = new ArrayList<>(); + // 定义正则表达式模式,用于匹配数字 + Pattern pattern = Pattern.compile("\\d+"); + Matcher matcher = pattern.matcher(bzgg); + + if (matcher.find()) { + list.add( Integer.parseInt(matcher.group())); + } + return list; + + } + public static List extractNumbers(String input) { + List numberList = new ArrayList<>(); + // 匹配小数的正则表达式 + Pattern decimalPattern = Pattern.compile("\\d+\\.\\d+"); + Matcher decimalMatcher = decimalPattern.matcher(input); + while (decimalMatcher.find()) { + numberList.add(decimalMatcher.group()); + } + // 匹配整数的正则表达式 + Pattern integerPattern = Pattern.compile("\\d+"); + Matcher integerMatcher = integerPattern.matcher(input); + while (integerMatcher.find()) { + numberList.add(integerMatcher.group()); + } + return numberList; + } }