diff --git a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java index d1d234a..55e0647 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java @@ -65,9 +65,9 @@ public class ThirdAliDrugController { // 剔除当前选入的产品编码要给他删了再重新查一次判断 如果还是查不到就去查阿里 thirdAliDrug.setNameCodeIn(null); List listNew = thirdAliDrugService.filterList(thirdAliDrug); - if (CollUtil.isEmpty(listNew)){ + if (CollUtil.isEmpty(listNew)) { ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest(); - AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust(); + AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust(); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); @@ -78,13 +78,13 @@ public class ThirdAliDrugController { request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); try { BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request); - if(baseResponse.getCode() == 20000){ + if (baseResponse.getCode() == 20000) { list = baseResponse.getData(); - }else { - log.error("阿里访问失败==="+baseResponse.getMessage()); + } else { + log.error("阿里访问失败===" + baseResponse.getMessage()); } - }catch (Exception e){ - log.error("阿里访问失败==="+e.getMessage()); + } catch (Exception e) { + log.error("阿里访问失败===" + e.getMessage()); } List finalList = list; ThreadUtil.execAsync(() -> { @@ -92,23 +92,53 @@ public class ThirdAliDrugController { thirdAliDrugAddRequest.setList(finalList); thirdAliDrugService.addThirdAliDrug(thirdAliDrugAddRequest); } catch (Exception e) { - log.error("异步更新阿里药品数据错误==="+e.getMessage()); + log.error("异步更新阿里药品数据错误===" + e.getMessage()); } }); // 判断中文括号和英文括号的就今昔新的结果进行剔除 - if(thirdAliDrug.getCpmctymc().contains("(") || thirdAliDrug.getCpmctymc().contains("(")){ - List listResult = new ArrayList<>(); - if(CollUtil.isNotEmpty(list)){ - for (ThirdAliDrug aliDrug : list) { - if(!nameCodeIn.contains(aliDrug.getNameCode())){ - listResult.add(aliDrug); - - } + if(thirdAliDrug.getCpmctymc().contains("(") || thirdAliDrug.getCpmctymc().contains("(") + || !( + StrUtil.isEmpty(thirdAliDrug.getApprovalNum()) && StrUtil.isEmpty(thirdAliDrug.getNameCode()) && + StrUtil.isEmpty(thirdAliDrug.getManufacturer())&& + StrUtil.isEmpty(thirdAliDrug.getFormSpec())&& + StrUtil.isEmpty(thirdAliDrug.getBzgg()) + ) + ){ + List listResult = new ArrayList<>(); + + if (CollUtil.isNotEmpty(list)) { + for (ThirdAliDrug aliDrug : list) { +// String cpmctymc = StringUtils.isEmpty(aliDrug.getCpmctymc()) ? "":aliDrug.getCpmctymc(); + String nameCode = thirdAliDrug.getNameCode(); + String approvalNum = thirdAliDrug.getApprovalNum(); + String manufacturer = thirdAliDrug.getManufacturer(); + String formSpec = thirdAliDrug.getFormSpec(); + String bzgg = thirdAliDrug.getBzgg(); + if (StringUtils.isNotEmpty(nameCode) && !nameCode.contains(aliDrug.getNameCode())) { + continue; + } + if (StringUtils.isNotEmpty(approvalNum) && !nameCode.contains(aliDrug.getApprovalNum())) { + continue; + } + if (StringUtils.isNotEmpty(manufacturer) && !nameCode.contains(aliDrug.getManufacturer())) { + continue; + } + if (StringUtils.isNotEmpty(formSpec) && !nameCode.contains(aliDrug.getFormSpec())) { + continue; } - list = listResult; + if (StringUtils.isNotEmpty(bzgg) && !nameCode.contains(aliDrug.getBzgg())) { + continue; + } + if (nameCodeIn.contains(aliDrug.getNameCode())) { + continue; + } + listResult.add(aliDrug); + } + list = listResult; } + } }