|
|
|
@ -231,6 +231,7 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
ThirdAliDrugService thirdAliDrugService;
|
|
|
|
|
|
|
|
|
|
// @Transactional
|
|
|
|
|
public void createOnlyMainId(String mainId) {
|
|
|
|
|
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
|
|
|
@ -263,7 +264,7 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
YbDrug ybDrug=new YbDrug();
|
|
|
|
|
YbDrug ybDrug = new YbDrug();
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
@ -290,7 +291,7 @@ public class UdiContrastService {
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
ybDrug = list.get(0);
|
|
|
|
|
// 数据做处理好查询阿里接口
|
|
|
|
|
if(ybDrug.getApprovalCode().contains("(")){
|
|
|
|
|
if (ybDrug.getApprovalCode().contains("(")) {
|
|
|
|
|
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
|
|
|
|
|
ybDrug.setApprovalCode(charArr[0]);
|
|
|
|
|
}
|
|
|
|
@ -315,34 +316,31 @@ public class UdiContrastService {
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getZczbhhzbapzbh()) || StrUtil.isEmpty(udiProductEntity.getCpmctymc())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>()
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Map map = new HashMap();
|
|
|
|
|
if(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc())){
|
|
|
|
|
map.put("cpmctymc",udiProductEntity.getCpmctymc());
|
|
|
|
|
if (StringUtils.isNotEmpty(udiProductEntity.getCpmctymc())) {
|
|
|
|
|
map.put("cpmctymc", udiProductEntity.getCpmctymc());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh())){
|
|
|
|
|
map.put("approvalNum",udiProductEntity.getZczbhhzbapzbh());
|
|
|
|
|
if (StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh())) {
|
|
|
|
|
map.put("approvalNum", udiProductEntity.getZczbhhzbapzbh());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugsListGjk = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String response = HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map);
|
|
|
|
|
String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map);
|
|
|
|
|
BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse =
|
|
|
|
|
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() {
|
|
|
|
|
|
|
|
|
@ -354,12 +352,12 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("国家库查询阿里产品访问出现错误==="+e.getMessage());
|
|
|
|
|
log.error("国家库查询阿里产品访问出现错误===" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){
|
|
|
|
|
if (thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)) {
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugListNew = null;
|
|
|
|
|
AuthAliUser authAliUser = authAliUserService.getOne();
|
|
|
|
|
|
|
|
|
@ -375,36 +373,36 @@ public class UdiContrastService {
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
|
|
|
|
|
if(baseResponse.getCode() == 20000){
|
|
|
|
|
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust, true);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
thirdAliDrugListNew = baseResponse.getData();
|
|
|
|
|
if(thirdAliDrugService.addOrUpdate(thirdAliDrugListNew)){
|
|
|
|
|
if (thirdAliDrugService.addOrUpdate(thirdAliDrugListNew)) {
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
log.error("阿里接口未查到产品信息===");
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
|
|
|
|
|
} else {
|
|
|
|
|
log.error("阿里接口未查到产品信息===" + baseResponse.getMessage());
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
// throw new JsonException(500, "阿里接口未查到产品信息");
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("阿里接口查询产品信息出现错误==="+e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("阿里接口查询产品信息出现错误===" + e.getMessage());
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){
|
|
|
|
|
if (thirdAliDrugListNew != null && thirdAliDrugListNew.size() > 0) {
|
|
|
|
|
try {
|
|
|
|
|
// 上传到国家库
|
|
|
|
|
Map mapNew = new HashMap();
|
|
|
|
|
mapNew.put("list",thirdAliDrugListNew);
|
|
|
|
|
String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew));
|
|
|
|
|
BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class);
|
|
|
|
|
mapNew.put("list", thirdAliDrugListNew);
|
|
|
|
|
String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew));
|
|
|
|
|
BaseResponse baseResponseAdd = JSONUtil.toBean(response, BaseResponse.class);
|
|
|
|
|
log.info("成功上传国家库阿里产品数据");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("国家库上传阿里产品访问出现错误==="+e.getMessage());
|
|
|
|
|
log.error("国家库上传阿里产品访问出现错误===" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -412,8 +410,8 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>()
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
);
|
|
|
|
|
// udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|