|
|
|
@ -5,15 +5,14 @@ import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.dao.basic.UdiRelevanceDao;
|
|
|
|
|
import com.glxp.api.dto.BasicProductsCreateDto;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAliUser;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.BasicInsMaterialEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThirdAliDrug;
|
|
|
|
|
import com.glxp.api.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.YbDrug;
|
|
|
|
|
import com.glxp.api.entity.thrsys.*;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.http.NmpaUdiClient;
|
|
|
|
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
|
|
|
@ -25,6 +24,7 @@ import com.glxp.api.req.basic.YbDrugDetailFilterRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
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.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.AuthAliUserService;
|
|
|
|
|
import com.glxp.api.service.thrsys.BasicInsMaterialService;
|
|
|
|
@ -228,10 +228,6 @@ public class UdiContrastService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<UdiRelevanceResponse> filterAll(FilterUdiRelRequest filterUdiRelRequest) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceDao.contrastJoinSelect(filterUdiRelRequest);
|
|
|
|
|
return udiRelevanceEntities;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void createUnionContrast(UdiCombineRequest udiCombineRequest, String key) {
|
|
|
|
@ -259,10 +255,8 @@ public class UdiContrastService {
|
|
|
|
|
.orElse(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
ThirdAliDrugService thirdAliDrugService;
|
|
|
|
|
|
|
|
|
|
public void createOnlyMainId(String mainId) {
|
|
|
|
|
public BaseResponse createOnlyMainId(BasicProductsCreateDto basicProductsCreateDto) {
|
|
|
|
|
String mainId = basicProductsCreateDto.getMainId();
|
|
|
|
|
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
|
|
|
|
|
filterThrProductsRequest.setCode(mainId);
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(mainId);
|
|
|
|
@ -282,7 +276,6 @@ public class UdiContrastService {
|
|
|
|
|
if (thrProductsEntity.getYbbm() != null) {
|
|
|
|
|
//判断药品还是器械
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2) {
|
|
|
|
|
String error = null;
|
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
|
YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest();
|
|
|
|
@ -290,217 +283,48 @@ public class UdiContrastService {
|
|
|
|
|
ybHcflDetailFilterRequest.setPage(1);
|
|
|
|
|
ybHcflDetailFilterRequest.setGoodsCode(thrProductsEntity.getYbbm());
|
|
|
|
|
List<YbDrug> list = ybDrugService.getList(ybHcflDetailFilterRequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
YbDrug ybDrug = new YbDrug();
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
//设置包装级别
|
|
|
|
|
udiProductEntity.setPackLevel(1 + "");
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice("0.00");
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
YbDrug ybDrug;
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
ybDrug = list.get(0);
|
|
|
|
|
// 数据做处理好查询阿里接口
|
|
|
|
|
if (ybDrug.getApprovalCode().contains("(")) {
|
|
|
|
|
String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
|
|
|
|
|
ybDrug.setApprovalCode(charArr[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode());
|
|
|
|
|
udiProductEntity.setCpmctymc(ybDrug.getRegisteredProductName());
|
|
|
|
|
udiProductEntity.setSpmc(ybDrug.getGoodsName());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setBzgg(String.valueOf(ybDrug.getFactor()) + ybDrug.getMinUnit() + "/" + ybDrug.getUnit());
|
|
|
|
|
udiProductEntity.setMatrial(ybDrug.getMaterialName());
|
|
|
|
|
udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
|
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(ybDrug.getUnit());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
udiProductEntity.setBhxjsl(ybDrug.getFactor());
|
|
|
|
|
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(ybDrug.getCompanyNameSc());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
}
|
|
|
|
|
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.getManufactory()), "manufacturer", udiProductEntity.getManufactory())
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
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(100);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPage(1);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
|
|
|
|
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())
|
|
|
|
|
.eq(StringUtils.isNotEmpty(udiProductEntity.getManufactory()), "manufacturer", udiProductEntity.getManufactory())
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} 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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.error(500, "未能查询到此医保编码");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
|
|
|
|
|
thirdAliDrugList = disposeYbDrugList(thirdAliDrugList,ybDrug);
|
|
|
|
|
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < thirdAliDrugList.size(); i++) {
|
|
|
|
|
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setPrepnSpec(CopyUtils.copyNullStr(udiProductEntity.getPrepnSpec(), thirdAliDrug.getFormSpec()));
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(CopyUtils.copyNullStr(udiProductEntity.getZczbhhzbapzbh(), thirdAliDrug.getApprovalNum()));
|
|
|
|
|
udiProductEntity.setCpmctymc(CopyUtils.copyNullStr(udiProductEntity.getCpmctymc(), thirdAliDrug.getCpmctymc()));
|
|
|
|
|
udiProductEntity.setSpmc(CopyUtils.copyNullStr(udiProductEntity.getSpmc(), thirdAliDrug.getSpmc()));
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setBzgg(CopyUtils.copyNullStr(udiProductEntity.getBzgg(), thirdAliDrug.getBzgg()));
|
|
|
|
|
udiProductEntity.setPackRatio(CopyUtils.copyNullStr(udiProductEntity.getPackRatio(), thirdAliDrug.getPackRatio()));
|
|
|
|
|
// udiProductEntity.setMatrial(ybDrug.getMaterialName());
|
|
|
|
|
// udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
|
|
|
|
|
// udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(CopyUtils.copyNullStr(udiProductEntity.getPackUnit(), thirdAliDrug.getPackUnitName()));
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
// udiProductEntity.setBhxjsl(ybDrug.getFactor());
|
|
|
|
|
//生产厂家
|
|
|
|
|
// udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(CopyUtils.copyNullStr(udiProductEntity.getPrepnUnit(), thirdAliDrug.getPrepnUnitName()));
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType()));
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("明细分类转换出现错误"+e.getMessage());
|
|
|
|
|
if (StrUtil.isEmpty(ybDrug.getApprovalCode()) || StrUtil.isEmpty(ybDrug.getRegisteredProductName())) {
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
// 本地查询先注释了
|
|
|
|
|
// 查询多玛融合库
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugList = new ArrayList<>();
|
|
|
|
|
AuthAliUser authAliUser = authAliUserService.getOne();
|
|
|
|
|
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setSelectCodeRelMark(true);
|
|
|
|
|
// alihealthThirdAliDrugInsertReqeust.setManufactory(udiProductEntity.getManufactory());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setYbDrug(ybDrug);
|
|
|
|
|
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPhysic_name(ybDrug.getRegisteredProductName());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApproval_licence_no(ybDrug.getApprovalCode());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPage_size(200);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPage(1);
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
|
|
|
|
|
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse<PageSimpleResponse<ThirdAliDrug>> baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
|
|
|
|
|
if (baseResponse.getCode() == 20000) {
|
|
|
|
|
thirdAliDrugList = baseResponse.getData().getList();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
// 处理药品数据
|
|
|
|
|
disposeDrugData(basicProductsCreateDto,thrProductsEntity,ybDrug,thirdAliDrugList,udiRelevanceEntity);
|
|
|
|
|
// setLevel(udiRelevanceEntity.getUuid());
|
|
|
|
|
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);
|
|
|
|
|
// udiRelevanceEntity.setThirdId4(error);
|
|
|
|
|
udiRelevanceEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
udiProductService.updateLevelCount(udiRelevanceEntity);
|
|
|
|
|
} else {
|
|
|
|
@ -516,12 +340,13 @@ public class UdiContrastService {
|
|
|
|
|
udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
udiProductEntity.setPackUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
if (basicInsMaterialEntity != null){
|
|
|
|
|
if (basicInsMaterialEntity != null) {
|
|
|
|
|
udiProductEntity.setGgxh(basicInsMaterialEntity.getSpecification() != null ? basicInsMaterialEntity.getSpecification() : thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setManufactory(basicInsMaterialEntity.getManufacturerName() != null ? basicInsMaterialEntity.getManufacturerName() : thrProductsEntity.getManufactory());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setGgxh(thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
//包装单位
|
|
|
|
@ -552,48 +377,155 @@ public class UdiContrastService {
|
|
|
|
|
if (!aBoolean) {
|
|
|
|
|
throw new JsonException(500, "系统繁忙,");
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
// UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
// BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
// if (thrProductsEntity.getProductType() != 2){
|
|
|
|
|
// //不是药品就设置namecode
|
|
|
|
|
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
// udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
// udiProductEntity.setPackUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
// udiProductEntity.setGgxh(basicInsMaterialEntity != null ? basicInsMaterialEntity.getSpecification() : thrProductsEntity.getSpec());
|
|
|
|
|
// udiProductEntity.setManufactory(basicInsMaterialEntity != null ? basicInsMaterialEntity.getManufacturerName() : thrProductsEntity.getManufactory());
|
|
|
|
|
// }
|
|
|
|
|
// udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
// udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
// udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
//
|
|
|
|
|
// //包装单位
|
|
|
|
|
// udiProductEntity.setPrepnUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
// udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
// udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
// udiProductEntity.setDiType(1);
|
|
|
|
|
// udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
//
|
|
|
|
|
// udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
// if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
// udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
// udiProductEntity.setMajorStatus(1);
|
|
|
|
|
// }else {
|
|
|
|
|
// udiProductEntity.setRequireScanCode(0);
|
|
|
|
|
// }
|
|
|
|
|
// if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
// udiProductEntity.setPrice(null);
|
|
|
|
|
// }
|
|
|
|
|
// udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
// udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
// udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, udiProductEntity);
|
|
|
|
|
// udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public UdiProductEntity disposeDrugDataNew(ThrProductsEntity thrProductsEntity,UdiRelevanceEntity udiRelevanceEntity, YbDrug ybDrug){
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
//设置包装级别
|
|
|
|
|
udiProductEntity.setPackLevel(1 + "");
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice("0.00");
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode());
|
|
|
|
|
udiProductEntity.setCpmctymc(ybDrug.getRegisteredProductName());
|
|
|
|
|
udiProductEntity.setSpmc(ybDrug.getGoodsName());
|
|
|
|
|
udiProductEntity.setBzgg(String.valueOf(ybDrug.getFactor()) + ybDrug.getMinUnit() + "/" + ybDrug.getUnit());
|
|
|
|
|
udiProductEntity.setMatrial(ybDrug.getMaterialName());
|
|
|
|
|
udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
|
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(ybDrug.getUnit());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
udiProductEntity.setBhxjsl(ybDrug.getFactor());
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(ybDrug.getCompanyNameSc());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel());
|
|
|
|
|
|
|
|
|
|
return udiProductEntity;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 处理药品数据
|
|
|
|
|
*
|
|
|
|
|
* @param thrProductsEntity
|
|
|
|
|
* @param ybDrug
|
|
|
|
|
* @param thirdAliDrugList
|
|
|
|
|
*/
|
|
|
|
|
public void disposeDrugData(BasicProductsCreateDto basicProductsCreateDto, ThrProductsEntity thrProductsEntity
|
|
|
|
|
, YbDrug ybDrug, List<ThirdAliDrug> thirdAliDrugList,UdiRelevanceEntity udiRelevanceEntity) {
|
|
|
|
|
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
|
|
|
|
|
List<CodeRel> codeRelArrayList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < thirdAliDrugList.size(); i++) {
|
|
|
|
|
UdiProductEntity udiProductEntity = disposeDrugDataNew(thrProductsEntity,udiRelevanceEntity,ybDrug);
|
|
|
|
|
|
|
|
|
|
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setPrepnSpec(CopyUtils.copyNullStr(udiProductEntity.getPrepnSpec(), thirdAliDrug.getFormSpec()));
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(CopyUtils.copyNullStr(udiProductEntity.getZczbhhzbapzbh(), thirdAliDrug.getApprovalNum()));
|
|
|
|
|
udiProductEntity.setCpmctymc(CopyUtils.copyNullStr(udiProductEntity.getCpmctymc(), thirdAliDrug.getCpmctymc()));
|
|
|
|
|
udiProductEntity.setSpmc(CopyUtils.copyNullStr(udiProductEntity.getSpmc(), thirdAliDrug.getSpmc()));
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setBzgg(CopyUtils.copyNullStr(udiProductEntity.getBzgg(), thirdAliDrug.getBzgg()));
|
|
|
|
|
udiProductEntity.setPackRatio(CopyUtils.copyNullStr(udiProductEntity.getPackRatio(), thirdAliDrug.getPackRatio()));
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(CopyUtils.copyNullStr(udiProductEntity.getPackUnit(), thirdAliDrug.getPackUnitName()));
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(CopyUtils.copyNullStr(udiProductEntity.getPrepnUnit(), thirdAliDrug.getPrepnUnitName()));
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
// 多码融合表拼接参数
|
|
|
|
|
if (basicProductsCreateDto.isAddCodeRelMark()) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType()));
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("明细分类转换出现错误" + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
// 上传到多码融合表
|
|
|
|
|
if (basicProductsCreateDto.isAddCodeRelMark()
|
|
|
|
|
&& CollUtil.isNotEmpty(codeRelArrayList)) {
|
|
|
|
|
spGetHttpClient.codeRelUpdateBatch(codeRelArrayList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UdiProductEntity udiProductEntity = disposeDrugDataNew(thrProductsEntity,udiRelevanceEntity,ybDrug);
|
|
|
|
|
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<ThirdAliDrug> disposeYbDrugList(List<ThirdAliDrug> thirdAliDrugList,YbDrug ybDrug){
|
|
|
|
|
List<ThirdAliDrug> list1 = new ArrayList<>();
|
|
|
|
|
List<ThirdAliDrug> list2 = new ArrayList<>();
|
|
|
|
|