选入药品逻辑更改以后以国家库为标准

dev_drug
qiuyt 3 months ago
parent bd72cca59e
commit eb9a2bafa6

@ -18,7 +18,9 @@ import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.alihealth.AliYljgBillDetail; import com.glxp.api.entity.alihealth.AliYljgBillDetail;
import com.glxp.api.entity.alihealth.AliYljgBillDetailDrugCode; import com.glxp.api.entity.alihealth.AliYljgBillDetailDrugCode;
import com.glxp.api.entity.alihealth.AliYljgSearchbill; import com.glxp.api.entity.alihealth.AliYljgSearchbill;
import com.glxp.api.entity.thrsys.CodeRel;
import com.glxp.api.entity.thrsys.ThirdAliDrug; import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.entity.thrsys.YbDrug;
import com.glxp.api.req.alihealth.AliYljgSearchbillReqeust; import com.glxp.api.req.alihealth.AliYljgSearchbillReqeust;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust; import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust;
@ -27,8 +29,11 @@ import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse; import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse;
import com.glxp.api.service.alihealth.AlihealthBusService; import com.glxp.api.service.alihealth.AlihealthBusService;
import com.glxp.api.service.basic.UdiContrastService;
import com.glxp.api.service.inout.IoOrderService; import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.util.JsonUtils;
import com.glxp.api.util.alihealth.AlihealthUtils; import com.glxp.api.util.alihealth.AlihealthUtils;
import com.google.api.client.json.Json;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -92,10 +97,37 @@ public class AlihealthBusController extends BaseController {
} }
} }
@Resource
private UdiContrastService udiContrastService;
@PostMapping("/spms/alihealth/thirdAliDrugList") @PostMapping("/spms/alihealth/thirdAliDrugList")
@Log(title = "获取阿里药品码段信息列表包括查询国家库", businessType = BusinessType.OTHER) @Log(title = "获取阿里药品码段信息列表包括查询国家库", businessType = BusinessType.OTHER)
public BaseResponse<List<ThirdAliDrug>> thirdAliDrugList(@RequestBody AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) { public BaseResponse<List<ThirdAliDrug>> thirdAliDrugList(@RequestBody AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) {
List<ThirdAliDrug> thirdAliDrugsListGjk = null;
// 本地查询和新增都先注释了 到时候加到这边来
YbDrug ybDrug = alihealthThirdAliDrugInsertReqeust.getYbDrug();
if(StringUtils.isNotEmpty(ybDrug.getGoodsCode())){
// 用医保编码查询国家库药品信息
try {
CodeRel codeReNew = new CodeRel();
codeReNew.setYbbm(ybDrug.getGoodsCode());
String response = HttpUtil.post(udiUrl + "/udchs/codeRel/listAndAliDrug", JSONUtil.toJsonStr(codeReNew));
BaseResponse<List<ThirdAliDrug>> responseListAndAliDrug =
JSONObject.parseObject(response, new TypeReference<BaseResponse<List<ThirdAliDrug>>>() {
});
if(responseListAndAliDrug.getCode() == 20000){
thirdAliDrugsListGjk = responseListAndAliDrug.getData();
if(thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() >0){
return ResultVOUtils.success(thirdAliDrugsListGjk);
}
}
} catch (Exception e) {
log.error("国家库===用医保编码查询国家库药品信息===出现错误===" + e.getMessage());
}
}
// 查询国家库药品信息 并且要插入到多玛融合表
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust(); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust();
Map map = new HashMap(); Map map = new HashMap();
@ -111,7 +143,14 @@ public class AlihealthBusController extends BaseController {
map.put("manufacturer", alihealthThirdAliDrugInsertReqeust.getManufactory()); map.put("manufacturer", alihealthThirdAliDrugInsertReqeust.getManufactory());
} }
List<ThirdAliDrug> thirdAliDrugsListGjk = null; if (com.glxp.api.util.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getFormSpec())) {
map.put("formSpec", alihealthThirdAliDrugInsertReqeust.getFormSpec());
}
if (com.glxp.api.util.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getBzgg())) {
map.put("bzgg", alihealthThirdAliDrugInsertReqeust.getBzgg());
}
if(alihealthThirdAliDrugInsertReqeust.getGjkSwitch()){ if(alihealthThirdAliDrugInsertReqeust.getGjkSwitch()){
try { try {
String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map); String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map);
@ -125,38 +164,70 @@ public class AlihealthBusController extends BaseController {
thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList();
} }
} catch (Exception e) { } catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误===" + e.getMessage()); log.error("国家库===查询药品信息===出现错误===" + e.getMessage());
} }
} }
if (thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() > 0) { if (thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() > 0) {
return ResultVOUtils.success(thirdAliDrugsListGjk);
} else { } else {
List<ThirdAliDrug> thirdAliDrugListNew; // BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsertAll(alihealthThirdAliDrugInsertReqeust);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsertAll(alihealthThirdAliDrugInsertReqeust); // if (baseResponse.getCode() == 20000) {
if (baseResponse.getCode() == 20000) { // thirdAliDrugsListGjk = baseResponse.getData();
thirdAliDrugListNew = baseResponse.getData(); // } else {
} else { // log.error("阿里接口未查到产品信息===" + baseResponse.getMessage());
log.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); // return ResultVOUtils.error("阿里接口未查到产品信息===" + baseResponse.getMessage());
return ResultVOUtils.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); //
// }
// // 上传到国家库
// try {
// Map mapNew = new HashMap();
// mapNew.put("list", thirdAliDrugsListGjk);
// 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());
// }
} }
// 上传到国家库 // 上传多玛关系于处理规则在插入到融合表
try { if(StringUtils.isNotEmpty(ybDrug.getGoodsCode())
Map mapNew = new HashMap(); ){
mapNew.put("list", thirdAliDrugListNew); // 规则匹配
String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); thirdAliDrugsListGjk = udiContrastService.disposeYbDrugList(thirdAliDrugsListGjk,ybDrug);
BaseResponse baseResponseAdd = JSONUtil.toBean(response, BaseResponse.class); if(thirdAliDrugsListGjk!=null && thirdAliDrugsListGjk.size()>0){
log.info("成功上传国家库阿里产品数据"); List<CodeRel> list = new ArrayList<>();
} catch (Exception e) { for (ThirdAliDrug thirdAliDrug : thirdAliDrugsListGjk) {
CodeRel codeRel = new CodeRel();
codeRel.setDrugCode(thirdAliDrug.getNameCode());
codeRel.setYbbm(ybDrug.getGoodsCode());
codeRel.setUpdateTime(new Date());
list.add(codeRel);
}
try {
String response = HttpUtil.post(udiUrl + "/udchs/codeRel/updateBatch", JSONUtil.toJsonStr(list));
BaseResponse<String> baseResponse = JSONUtil.toBean(response,BaseResponse.class);
if(baseResponse.getCode() == 2000){
log.error("国家库===上传多码关系===成功===");
}else {
log.error("国家库===上传多码关系===出现错误===" + baseResponse.getMessage());
}
log.error("国家库上传阿里产品访问出现错误===" + e.getMessage()); } catch (Exception e) {
log.error("国家库===上传多码关系===出现错误===" + e.getMessage());
}
} }
return ResultVOUtils.success(thirdAliDrugListNew);
} }
return ResultVOUtils.success(thirdAliDrugsListGjk);
// udiProductService.insertUdiInfo(udiProductEntity); // udiProductService.insertUdiInfo(udiProductEntity);
} }

@ -102,12 +102,16 @@ public class ThirdAliDrugController extends BaseController {
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid()); alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret()); alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
alihealthThirdAliDrugInsertReqeust.setManufactory(thirdAliDrug.getManufacturer()); alihealthThirdAliDrugInsertReqeust.setManufactory(thirdAliDrug.getManufacturer());
alihealthThirdAliDrugInsertReqeust.setGjkSwitch(false); alihealthThirdAliDrugInsertReqeust.setBzgg(thirdAliDrug.getBzgg());
alihealthThirdAliDrugInsertReqeust.setFormSpec(thirdAliDrug.getFormSpec());
alihealthThirdAliDrugInsertReqeust.setGjkSwitch(true);
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum());
alihealthKytDrugrescodeReqeust.setPackage_spec(thirdAliDrug.getBzgg()); // alihealthKytDrugrescodeReqeust.setEnt_name(thirdAliDrug.getManufacturer());
alihealthKytDrugrescodeReqeust.setPrepn_spec(thirdAliDrug.getFormSpec()); // alihealthKytDrugrescodeReqeust.setPackage_spec(thirdAliDrug.getBzgg());
// alihealthKytDrugrescodeReqeust.setPrepn_spec(thirdAliDrug.getFormSpec());
alihealthKytDrugrescodeReqeust.setPage_size(200); alihealthKytDrugrescodeReqeust.setPage_size(200);
alihealthKytDrugrescodeReqeust.setPage(1); alihealthKytDrugrescodeReqeust.setPage(1);
@ -123,13 +127,13 @@ public class ThirdAliDrugController extends BaseController {
list = thirdAliDrugService.filterList(thirdAliDrug); list = thirdAliDrugService.filterList(thirdAliDrug);
} else { } else {
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息"); log.error("获取阿里和国家库码段信息===未查到产品信息");
} }
} else { } else {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage()); log.error("获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage()); // udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage(); // error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
@ -137,7 +141,7 @@ public class ThirdAliDrugController extends BaseController {
} }
} catch (Exception e) { } catch (Exception e) {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage()); log.error("获取阿里和国家库码段信息出现错误===" + e.getMessage());
} }
} }

@ -1,5 +1,6 @@
package com.glxp.api.req.alihealth.local; package com.glxp.api.req.alihealth.local;
import com.glxp.api.entity.thrsys.YbDrug;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import lombok.Data; import lombok.Data;
@ -9,6 +10,9 @@ public class AlihealthThirdAliDrugInsertReqeust {
private String appSecret; private String appSecret;
private String manufactory; private String manufactory;
private Boolean gjkSwitch = true; private Boolean gjkSwitch = true;
private YbDrug ybDrug;
private String formSpec;
private String bzgg;
private AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust; private AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust;
} }

@ -10,6 +10,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.constant.ConstantStatus; import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.alihealth.AlihealthBusController;
import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.auth.AuthAliUser; import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiProductEntity;
@ -231,7 +232,8 @@ public class UdiContrastService {
@Resource @Resource
ThirdAliDrugService thirdAliDrugService; ThirdAliDrugService thirdAliDrugService;
@Resource
private AlihealthBusController alihealthBusController;
// @Transactional // @Transactional
public void createOnlyMainId(String mainId) { public void createOnlyMainId(String mainId) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
@ -322,112 +324,80 @@ public class UdiContrastService {
if (StrUtil.isEmpty(udiProductEntity.getZczbhhzbapzbh()) || StrUtil.isEmpty(udiProductEntity.getCpmctymc())) { if (StrUtil.isEmpty(udiProductEntity.getZczbhhzbapzbh()) || StrUtil.isEmpty(udiProductEntity.getCpmctymc())) {
return; return;
} }
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list( // 本地查询先注释了
new QueryWrapper<ThirdAliDrug>() List<ThirdAliDrug> thirdAliDrugList = new ArrayList<>();
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh()) // List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
.eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory()) // new QueryWrapper<ThirdAliDrug>()
// .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
); // .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
if (CollUtil.isNotEmpty(thirdAliDrugList)) { // .eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory())
//
} else { // );
Map map = new HashMap(); // if (CollUtil.isNotEmpty(thirdAliDrugList)) {
if (StringUtils.isNotEmpty(udiProductEntity.getCpmctymc())) { //
map.put("cpmctymc", udiProductEntity.getCpmctymc()); // } else {
} AuthAliUser authAliUser = authAliUserService.getOne();
if (StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh())) { AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
map.put("approvalNum", udiProductEntity.getZczbhhzbapzbh()); alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
} // alihealthThirdAliDrugInsertReqeust.setManufactory(udiProductEntity.getManufactory());
if (StringUtils.isNotEmpty(udiProductEntity.getManufactory())) { alihealthThirdAliDrugInsertReqeust.setYbDrug(ybDrug);
map.put("manufacturer", udiProductEntity.getManufactory()); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
} alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh());
List<ThirdAliDrug> thirdAliDrugsListGjk = null; alihealthKytDrugrescodeReqeust.setPage_size(200);
alihealthKytDrugrescodeReqeust.setPage(1);
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
try { try {
String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map); BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse = if (baseResponse.getCode() == 20000) {
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() { thirdAliDrugList = (List) baseResponse.getData();
}); // if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
if (udiDlDeviceResponse != null) { // thirdAliDrugList = thirdAliDrugService.list(
// 查询国家库是否有值 有值直接返回没值查询阿里接口 // new QueryWrapper<ThirdAliDrug>()
thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); // .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
// .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
// .eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory())
//
// );
// } else {
// log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
// udiProductService.insertUdiInfo(udiProductEntity);
//
// }
}
} catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误===" + e.getMessage());
}
if (thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)) { } else {
log.error("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
} else { // udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
List<ThirdAliDrug> thirdAliDrugListNew = null; // error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
AuthAliUser authAliUser = authAliUserService.getOne();
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
alihealthThirdAliDrugInsertReqeust.setManufactory(udiProductEntity.getManufactory());
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh());
alihealthKytDrugrescodeReqeust.setPage_size(200);
alihealthKytDrugrescodeReqeust.setPage(1);
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
try {
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsertAll(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
thirdAliDrugListNew = baseResponse.getData();
if (thirdAliDrugService.addOrUpdate(thirdAliDrugListNew)) {
} else {
log.error("阿里接口未查到产品信息===");
udiProductService.insertUdiInfo(udiProductEntity);
}
} else {
log.error("阿里接口未查到产品信息===" + baseResponse.getMessage());
udiProductService.insertUdiInfo(udiProductEntity);
// throw new JsonException(500, "阿里接口未查到产品信息");
}
} catch (Exception e) {
log.error("阿里接口查询产品信息出现错误===" + e.getMessage());
udiProductService.insertUdiInfo(udiProductEntity); udiProductService.insertUdiInfo(udiProductEntity);
}
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);
log.info("成功上传国家库阿里产品数据");
} catch (Exception e) {
log.error("国家库上传阿里产品访问出现错误===" + e.getMessage());
}
} }
} catch (Exception e) {
log.error("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage();
udiProductService.insertUdiInfo(udiProductEntity);
} }
thirdAliDrugList = thirdAliDrugService.list( // thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>() // new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc()) // .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh()) // .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
.eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory()) // .eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory())
); // );
// udiProductService.insertUdiInfo(udiProductEntity); // udiProductService.insertUdiInfo(udiProductEntity);
} // }
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
thirdAliDrugList = disposeYbDrugList(thirdAliDrugList,ybDrug);
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
for (int i = 0; i < thirdAliDrugList.size(); i++) { for (int i = 0; i < thirdAliDrugList.size(); i++) {
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
@ -489,10 +459,6 @@ public class UdiContrastService {
udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductEntity.setId(IdUtil.getSnowflakeNextId());
udiProductService.insertUdiInfo(udiProductEntity); udiProductService.insertUdiInfo(udiProductEntity);
} }
}else {
udiProductService.insertUdiInfo(udiProductEntity);
}
try { try {
udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType())); udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType()));
@ -604,23 +570,26 @@ public class UdiContrastService {
} }
public List<ThirdAliDrug> disposeYbDrugList(List<ThirdAliDrug> thirdAliDrugList,YbDrug ybDrug){ public List<ThirdAliDrug> disposeYbDrugList(List<ThirdAliDrug> thirdAliDrugList,YbDrug ybDrug){
List<ThirdAliDrug> list1 = new ArrayList<>(); List<ThirdAliDrug> list1 = new ArrayList<>();
List<ThirdAliDrug> list2 = new ArrayList<>(); if(thirdAliDrugList!=null && thirdAliDrugList.size() >0){
for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) { // List<ThirdAliDrug> list2 = new ArrayList<>();
String str = drugRulesVerify(ybDrug,thirdAliDrug); for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) {
if(StringUtils.isNotEmpty(str)){ String str = drugRulesVerify(ybDrug,thirdAliDrug);
if(str.equals("1")){ if(StringUtils.isNotEmpty(str)){
list1.add(thirdAliDrug); if(str.equals("1")){
}else if(str.equals("2")){ list1.add(thirdAliDrug);
list2.add(thirdAliDrug); }else if(str.equals("2")){
list1.add(thirdAliDrug);
}
} }
} }
// if(list1 !=null && list1.size() >0){
// return list1;
// }else if(list2 !=null && list2.size() >0){
// return list2;
// }
} }
if(list1 !=null && list1.size() >0){
return list1; return list1;
}else if(list2 !=null && list2.size() >0){
return list2;
}
return new ArrayList<>();
} }
public String drugRulesVerify(YbDrug ybDrug,ThirdAliDrug thirdAliDrug ){ public String drugRulesVerify(YbDrug ybDrug,ThirdAliDrug thirdAliDrug ){
try { try {

@ -3,6 +3,8 @@ package com.glxp.api.service.basic.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
@ -12,6 +14,7 @@ import com.glxp.api.dao.basic.UdiProductDao;
import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.thrsys.CodeRel;
import com.glxp.api.entity.thrsys.ThirdAliDrug; import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.YbDrug; import com.glxp.api.entity.thrsys.YbDrug;
@ -42,6 +45,7 @@ import org.jfree.util.Log;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -274,6 +278,8 @@ public class UdiProductServiceImpl implements UdiProductService {
String di = FilterUdiUtils.getDiStr(nameCode); String di = FilterUdiUtils.getDiStr(nameCode);
return udiProductDao.selectAllowNoBatch(di); return udiProductDao.selectAllowNoBatch(di);
} }
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@Override @Override
@ -297,6 +303,7 @@ public class UdiProductServiceImpl implements UdiProductService {
if (addProductRequest.getRelId() != null) { if (addProductRequest.getRelId() != null) {
udiRelevanceEntity = udiRelevanceDao.selectById(addProductRequest.getRelId()); udiRelevanceEntity = udiRelevanceDao.selectById(addProductRequest.getRelId());
List<UdiProductEntity> udiProductEntities = udiProductDao.findByUuids(udiRelevanceEntity.getUuid()); List<UdiProductEntity> udiProductEntities = udiProductDao.findByUuids(udiRelevanceEntity.getUuid());
List<CodeRel> list = new ArrayList<>();
for (UdiProductEntity udiProductEntity : udiProductEntities) { for (UdiProductEntity udiProductEntity : udiProductEntities) {
addProductRequest.setNameCode(udiProductEntity.getNameCode()); addProductRequest.setNameCode(udiProductEntity.getNameCode());
addProductRequest.setId(udiProductEntity.getId()); addProductRequest.setId(udiProductEntity.getId());
@ -310,11 +317,38 @@ public class UdiProductServiceImpl implements UdiProductService {
if (IntUtil.value(udiProductEntity.getPackLevel()) == 1) { if (IntUtil.value(udiProductEntity.getPackLevel()) == 1) {
udiProductEntity.setDiType(1); udiProductEntity.setDiType(1);
} }
CodeRel codeRel = new CodeRel();
codeRel.setDrugCode(udiProductEntity.getNameCode());
codeRel.setYbbm(udiProductEntity.getYbbm());
codeRel.setUpdateTime(new Date());
list.add(codeRel);
int i = udiProductDao.updateById(udiProductEntity); int i = udiProductDao.updateById(udiProductEntity);
if (i == 0) { if (i == 0) {
throw new JsonException(500, "更新错误"); throw new JsonException(500, "更新错误");
} }
} }
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<String> baseResponse = JSONUtil.toBean(response,BaseResponse.class);
if(baseResponse.getCode() == 2000){
log.error("国家库===上传多码关系===成功===");
}else {
log.error("国家库===上传多码关系===出现错误===" + baseResponse.getMessage());
}
} catch (Exception e) {
log.error("国家库===上传多码关系===出现错误===" + e.getMessage());
}
}
}
//修改关联表 //修改关联表
// udiRelevanceEntity.setUseLeverCount(addProductRequest.getUseLeverCount()); // udiRelevanceEntity.setUseLeverCount(addProductRequest.getUseLeverCount());

Loading…
Cancel
Save