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 217924bf..de197c00 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -419,64 +419,69 @@ public class UdiContrastService { ); // udiProductService.insertUdiInfo(udiProductEntity); } + if(thirdAliDrugList!= null && thirdAliDrugList.size() >0){ + for (int i = 0; i < thirdAliDrugList.size(); i++) { + ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); - for (int i = 0; i < thirdAliDrugList.size(); i++) { - ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); + udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); - udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); + // 数据处理 + udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec()); + udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum()); + udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc()); + udiProductEntity.setSpmc(thirdAliDrug.getSpmc()); - // 数据处理 - udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec()); - udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum()); - udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc()); - udiProductEntity.setSpmc(thirdAliDrug.getSpmc()); - - udiProductEntity.setBzgg(thirdAliDrug.getBzgg()); + udiProductEntity.setBzgg(thirdAliDrug.getBzgg()); // udiProductEntity.setMatrial(ybDrug.getMaterialName()); // udiProductEntity.setPackMatrial(ybDrug.getMaterialName()); // udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType())); - //最小产品单位 - udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); - //设置最小产品数量 + //最小产品单位 + udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); + //设置最小产品数量 // udiProductEntity.setBhxjsl(ybDrug.getFactor()); - //生产厂家 + //生产厂家 // udiProductEntity.setManufactory(thirdAliDrug.getManufacturer()); - //商品条码 essentialDrugMarkName sptm + //商品条码 essentialDrugMarkName sptm // udiProductEntity.setSptm(ybDrug.getBusinessLicense()); - udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName()); + udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName()); - List integers = new ArrayList<>(); - if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { - integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); - } - udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel()); - try { - udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); - } catch (IndexOutOfBoundsException e) { - e.printStackTrace(); - Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString()); - udiProductEntity.setBhxjsl(0); - } + List integers = new ArrayList<>(); + if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { + integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); + } + udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel()); + try { + udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1)); + } catch (IndexOutOfBoundsException e) { + e.printStackTrace(); + Log.error("计算包装级别出错" + thirdAliDrug.getPackLevel() + "---" + integers + "-----" + thirdAliDrug.toString()); + udiProductEntity.setBhxjsl(0); + } - if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { - udiProductEntity.setXjdw(ybDrug.getMinUnit()); - if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) { - udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg())); - } else - udiProductEntity.setBhxjsl(ybDrug.getFactor()); - } - if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) { - udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); - } else { - udiProductEntity.setDiType(1); - } - udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); - udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); + if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { + udiProductEntity.setXjdw(ybDrug.getMinUnit()); + if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) { + udiProductEntity.setBhxjsl(DimaUtil.trMinCount(thirdAliDrug.getBzgg())); + } else + udiProductEntity.setBhxjsl(ybDrug.getFactor()); + } + if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) { + udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); + } else { + udiProductEntity.setDiType(1); + } + udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); + udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + udiProductService.insertUdiInfo(udiProductEntity); + } + }else { udiProductService.insertUdiInfo(udiProductEntity); + } + // setLevel(udiRelevanceEntity.getUuid()); UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);