|
|
|
@ -7,6 +7,7 @@ import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAliUser;
|
|
|
|
|
import com.glxp.api.entity.thrsys.*;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
|
|
|
@ -17,6 +18,7 @@ import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse;
|
|
|
|
|
import com.glxp.api.service.auth.AuthAliUserService;
|
|
|
|
|
import com.glxp.api.service.thrsys.*;
|
|
|
|
|
import com.glxp.api.util.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -74,6 +76,8 @@ public class UdiContrastService {
|
|
|
|
|
YbDrugService ybDrugService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SpGetHttpClient spGetHttpClient;
|
|
|
|
|
@Resource
|
|
|
|
|
private AuthAliUserService authAliUserService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isExit(String originUuid, String mainId, String thirdSys) {
|
|
|
|
@ -284,7 +288,7 @@ public class UdiContrastService {
|
|
|
|
|
if (thrProductsEntity.getYbbm() != null) {
|
|
|
|
|
//判断药品还是器械
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2) {
|
|
|
|
|
String error=null;
|
|
|
|
|
String error = null;
|
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
|
YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest();
|
|
|
|
@ -296,7 +300,7 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
YbDrug ybDrug=new YbDrug();
|
|
|
|
|
YbDrug ybDrug = new YbDrug();
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
@ -323,8 +327,8 @@ public class UdiContrastService {
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
ybDrug = list.get(0);
|
|
|
|
|
// 数据做处理好查询阿里接口
|
|
|
|
|
if(ybDrug.getApprovalCode().contains("(")){
|
|
|
|
|
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
|
|
|
|
|
if (ybDrug.getApprovalCode().contains("(")) {
|
|
|
|
|
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
|
|
|
|
|
ybDrug.setApprovalCode(charArr[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -353,7 +357,6 @@ public class UdiContrastService {
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>()
|
|
|
|
@ -363,103 +366,112 @@ public class UdiContrastService {
|
|
|
|
|
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
AuthAliUser authAliUser = authAliUserService.getOne();
|
|
|
|
|
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424");
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01");
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
|
|
|
|
|
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPage_size(100);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPage(1);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApp_key("31721223");
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
|
|
|
|
BaseResponse baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
thirdAliDrugService.addOrUpdate((List) baseResponse.getData());
|
|
|
|
|
thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>()
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
|
|
|
|
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
|
|
|
|
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage();
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
|
|
|
|
|
thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>()
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()), "cpmctymc", udiProductEntity.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()), "approvalNum", udiProductEntity.getZczbhhzbapzbh())
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
|
|
|
|
|
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
|
|
|
|
|
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
|
|
|
|
|
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
|
|
|
|
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
|
|
|
|
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage();
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < thirdAliDrugList.size(); i++) {
|
|
|
|
|
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
List<Integer> 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);
|
|
|
|
|
}
|
|
|
|
|
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
List<Integer> 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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.setPackLevel(1 + "");
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
//设置包装级别
|
|
|
|
|
udiProductEntity.setPackLevel(1 + "");
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
|
|
|
|
|
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.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// setLevel(udiRelevanceEntity.getUuid());
|
|
|
|
|