diff --git a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java index 8f0c03f9..2552e97a 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java @@ -19,6 +19,7 @@ import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.entity.thrsys.CodeRel; import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity; import com.glxp.api.http.NmpaUdiClient; @@ -407,6 +408,12 @@ public class UdiContrastController { @PostMapping("/udi/udirel/drug/delLevel") public BaseResponse delLevel(@RequestBody AddProductRequest addProductRequest) { boolean b = udiProductService.deleteByNameCode(addProductRequest.getNameCode()); + if(b == true){ + CodeRel codeRel = new CodeRel(); + codeRel.setYbbm(addProductRequest.getYbbm()); + codeRel.setDrugCode(addProductRequest.getNameCode()); + udiContrastService.deleteRelCode(codeRel); + } return ResultVOUtils.success("删除成功!"); } diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java b/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java index 939d4d6e..84f58314 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java @@ -110,6 +110,7 @@ public class ThirdAliDrugController extends BaseController { alihealthThirdAliDrugInsertReqeust.setGjkSwitch(true); alihealthThirdAliDrugInsertReqeust.setPage(thirdAliDrug.getPage()); alihealthThirdAliDrugInsertReqeust.setLimit(thirdAliDrug.getLimit()); + alihealthThirdAliDrugInsertReqeust.setDrugCheckMark(true); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); @@ -126,8 +127,6 @@ public class ThirdAliDrugController extends BaseController { BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust); if (baseResponse.getCode() == 20000) { - list = thirdAliDrugService.filterList(thirdAliDrug); - if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) { list = thirdAliDrugService.filterList(thirdAliDrug); 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 0855ac95..ad4e836a 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -635,6 +635,26 @@ public class UdiContrastService { } + public void deleteRelCode(CodeRel codeRel) { + + try { + String response = HttpUtil.post(udiUrl + "/udchs/codeRel/delete", JSONUtil.toJsonStr(codeRel)); + BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class); + + if (baseResponse.getCode() == 2000) { + + } else { + log.error("国家库===删除多玛关系===出现错误===" + baseResponse.getMessage()); + + } + + } catch (Exception e) { + log.error("国家库===删除多玛关系===出现错误===" + e.getMessage()); + + } + } + + public List disposeYbDrugList(List thirdAliDrugList, YbDrug ybDrug, List codeIn) { List list1 = new ArrayList<>(); String result = null; 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 f7660295..d4dfa65d 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 @@ -278,6 +278,7 @@ public class UdiProductServiceImpl implements UdiProductService { String di = FilterUdiUtils.getDiStr(nameCode); return udiProductDao.selectAllowNoBatch(di); } + @Value("${UDI_SERVER_URL}") private String udiUrl; @@ -331,27 +332,9 @@ public class UdiProductServiceImpl implements UdiProductService { throw new JsonException(500, "更新错误"); } } - if(list!=null && list.size() >0){ + if (list != null && list.size() > 0) { // 上传多玛关系 - if( list!=null && list.size()>0 - ){ - try { - String response = HttpUtil.post(udiUrl + "/udchs/codeRel/updateBatch", JSONUtil.toJsonStr(list)); - BaseResponse baseResponse = JSONUtil.toBean(response,BaseResponse.class); - - if(baseResponse.getCode() == 2000){ - log.error("国家库===上传多码关系===成功==="); - - }else { - log.error("国家库===上传多码关系===出现错误===" + baseResponse.getMessage()); - - } - - } catch (Exception e) { - log.error("国家库===上传多码关系===出现错误===" + e.getMessage()); - - } - } + udiContrastService.codeRelUpdateBatch(list); } //修改关联表 @@ -488,6 +471,28 @@ public class UdiProductServiceImpl implements UdiProductService { udiProductDao.insert(udiProductEntity1); } updateLevelCount(udiRelevanceEntity); + // 上传多玛融合表 + List udiProductEntityList = udiProductDao.selectList( + new QueryWrapper().eq(StringUtils.isNotBlank(udiProductEntity1.getUuid()), "uuid", udiProductEntity1.getUuid()) + + ); + List codeRelArrayList = new ArrayList<>(); + if (udiProductEntityList != null && udiProductEntityList.size() > 0) { + for (UdiProductEntity udiProductEntity : udiProductEntityList) { + CodeRel codeRel = new CodeRel(); + codeRel.setDrugCode(udiProductEntity.getNameCode()); + codeRel.setUpdateTime(new Date()); + codeRel.setYbbm(udiRelevanceEntity.getMainId()); + codeRel.setPackUnit(udiProductEntity.getPackUnit()); + codeRel.setBhxjsl(udiProductEntity.getBhxjsl()); + codeRel.setXjdw(udiProductEntity.getXjdw()); + codeRel.setYbBzgg(udiProductEntity.getBzgg()); + codeRelArrayList.add(codeRel); + } + // 上传到多码融合表 + udiContrastService.codeRelUpdateBatch(codeRelArrayList); + } + // if (IntUtil.value(udiProductEntity1.getPackLevel()) == 1) { // calculateDistCount(udiProductEntity1, udiRelevanceEntity); // calculateUseCount(udiProductEntity1, udiRelevanceEntity); @@ -664,27 +669,30 @@ public class UdiProductServiceImpl implements UdiProductService { private UdiContrastService udiContrastService; @Resource private UdiRelevanceService udiRelevanceService; + @Override public BaseResponse saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) { - Integer detailSort=0; + Integer detailSort = 0; ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne( new QueryWrapper().eq("nameCode", thirdAliDrugRequest.getNameCodeRow()).last("limit 1") ); String str = ""; if (thirdAliDrugServiceOne != null) { List thirdAliDrugList = thirdAliDrugService.list( - new QueryWrapper().eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getBzgg()),"bzgg", thirdAliDrugServiceOne.getBzgg()) - .eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getPackRatio()),"packRatio", thirdAliDrugServiceOne.getPackRatio()) - .like(StringUtils.isNotBlank( thirdAliDrugRequest.getCpmctymc()),"cpmctymc", thirdAliDrugRequest.getCpmctymc()) - .like(StringUtils.isNotBlank( thirdAliDrugRequest.getManufacturer()),"manufacturer", thirdAliDrugRequest.getManufacturer()) - .eq(StringUtils.isNotBlank( thirdAliDrugRequest.getApprovalNum()),"approvalNum", thirdAliDrugRequest.getApprovalNum()) - .like(StringUtils.isNotBlank( thirdAliDrugRequest.getFormSpec()),"formSpec", thirdAliDrugRequest.getFormSpec()) - .like(StringUtils.isNotBlank( thirdAliDrugRequest.getBzgg()),"bzgg", thirdAliDrugRequest.getBzgg()) + new QueryWrapper().eq(StringUtils.isNotBlank(thirdAliDrugServiceOne.getBzgg()), "bzgg", thirdAliDrugServiceOne.getBzgg()) + .eq(StringUtils.isNotBlank(thirdAliDrugServiceOne.getPackRatio()), "packRatio", thirdAliDrugServiceOne.getPackRatio()) + .like(StringUtils.isNotBlank(thirdAliDrugRequest.getCpmctymc()), "cpmctymc", thirdAliDrugRequest.getCpmctymc()) + .like(StringUtils.isNotBlank(thirdAliDrugRequest.getManufacturer()), "manufacturer", thirdAliDrugRequest.getManufacturer()) + .like(StringUtils.isNotBlank(thirdAliDrugRequest.getApprovalNum()), "approvalNum", thirdAliDrugRequest.getApprovalNum()) + .like(StringUtils.isNotBlank(thirdAliDrugRequest.getFormSpec()), "formSpec", thirdAliDrugRequest.getFormSpec()) + .like(StringUtils.isNotBlank(thirdAliDrugRequest.getBzgg()), "bzgg", thirdAliDrugRequest.getBzgg()) ); if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { + // 多码融合表拼接参数 + List codeRelArrayList = new ArrayList<>(); udiProductDao.delete(new QueryWrapper() - .eq("uuid",thirdAliDrugRequest.getUuid()) + .eq("uuid", thirdAliDrugRequest.getUuid()) .isNull("nameCode") ); ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm()); @@ -757,7 +765,7 @@ public class UdiProductServiceImpl implements UdiProductService { } - udiProductEntity.setNameCode(CopyUtils.copyNullStr(udiProductEntity.getNameCode(), thirdAliDrug.getNameCode())); + udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); // 数据处理 udiProductEntity.setPrepnSpec(CopyUtils.copyNullStr(udiProductEntity.getPrepnSpec(), thirdAliDrug.getFormSpec())); @@ -793,42 +801,67 @@ public class UdiProductServiceImpl implements UdiProductService { udiProductEntity.setBhxjsl(0); } + if (IntUtil.value(udiProductEntity.getBhxjsl()) == 0) { + udiProductEntity.setBhxjsl(IntUtil.value(ybDrug.getFactor())); + } 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()); + } else { + udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); + } 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.setPackUnit(thirdAliDrug.getPackUnitName()); udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + + + + CodeRel codeRel = new CodeRel(); + codeRel.setDrugCode(thirdAliDrug.getNameCode()); + codeRel.setUpdateTime(new Date()); + codeRel.setYbbm(ybDrug.getGoodsCode()); + codeRel.setPackUnit(udiProductEntity.getPackUnit()); + codeRel.setBhxjsl(udiProductEntity.getBhxjsl()); + codeRel.setXjdw(udiProductEntity.getXjdw()); + codeRel.setYbBzgg(udiProductEntity.getBzgg()); + codeRelArrayList.add(codeRel); + + // 多码融合存在就以多码融合为准 + udiProductEntity.setPackUnit(CopyUtils.copyNullStr(thirdAliDrug.getPackUnit(), udiProductEntity.getPackUnit())); + udiProductEntity.setBhxjsl(CopyUtils.copyNullNum(thirdAliDrug.getBhxjsl(), udiProductEntity.getBhxjsl())); + udiProductEntity.setXjdw(CopyUtils.copyNullStr(thirdAliDrug.getXjdw(), udiProductEntity.getXjdw())); + udiProductEntity.setBzgg(CopyUtils.copyNullStr(thirdAliDrug.getBzgg(), udiProductEntity.getBzgg())); + udiProductService.insertUdiInfo(udiProductEntity); } UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); try { udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType())); - detailSort = udiRelevanceEntity.getDetailSort(); - }catch (Exception e){ - log.error("明细分类转换出现错误"+e.getMessage()); + detailSort = udiRelevanceEntity.getDetailSort(); + } catch (Exception e) { + log.error("明细分类转换出现错误" + e.getMessage()); } - udiRelevanceService.update(udiRelevanceEntity,new QueryWrapper() - .eq("uuid",thirdAliDrugRequest.getUuid()) + udiRelevanceService.update(udiRelevanceEntity, new QueryWrapper() + .eq("uuid", thirdAliDrugRequest.getUuid()) ); + udiContrastService.codeRelUpdateBatch(codeRelArrayList); return ResultVOUtils.success(detailSort); } } // } - return ResultVOUtils.error("获取错误"); + return ResultVOUtils.error("获取错误"); }