|
|
|
@ -14,20 +14,21 @@ 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.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.basic.AddProductRequest;
|
|
|
|
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
|
|
|
|
import com.glxp.api.req.basic.UdiInfoRequest;
|
|
|
|
|
import com.glxp.api.req.basic.UpdateLevelDrugRequest;
|
|
|
|
|
import com.glxp.api.req.basic.*;
|
|
|
|
|
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
|
|
|
|
|
import com.glxp.api.res.DiLevelResponse;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiContrastService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiProductService;
|
|
|
|
|
import com.glxp.api.service.thrsys.ThirdAliDrugService;
|
|
|
|
|
import com.glxp.api.service.thrsys.ThrProductsService;
|
|
|
|
|
import com.glxp.api.service.thrsys.YbDrugService;
|
|
|
|
|
import com.glxp.api.util.DimaUtil;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import com.glxp.api.util.PinyinUtils;
|
|
|
|
|
import com.glxp.api.util.alihealth.CopyUtils;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import com.glxp.api.util.udi.UdiInfoUtil;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -613,22 +614,39 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
private UdiProductService udiProductService;
|
|
|
|
|
@Resource
|
|
|
|
|
private ThirdAliDrugService thirdAliDrugService;
|
|
|
|
|
@Resource
|
|
|
|
|
private YbDrugService ybDrugService;
|
|
|
|
|
@Resource
|
|
|
|
|
private UdiContrastService udiContrastService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) {
|
|
|
|
|
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm());
|
|
|
|
|
ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq("nameCode", thirdAliDrugRequest.getNameCode()).last("limit 1")
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq("nameCode", thirdAliDrugRequest.getNameCodeRow()).last("limit 1")
|
|
|
|
|
);
|
|
|
|
|
if (thirdAliDrugServiceOne != null) {
|
|
|
|
|
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq("bzgg", thirdAliDrugServiceOne.getBzgg()).eq("packRatio", thirdAliDrugServiceOne.getPackRatio())
|
|
|
|
|
new QueryWrapper<ThirdAliDrug>().eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getBzgg()),"bzgg", thirdAliDrugServiceOne.getBzgg())
|
|
|
|
|
.eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getPackRatio()),"packRatio", thirdAliDrugServiceOne.getPackRatio())
|
|
|
|
|
.eq(StringUtils.isNotBlank( thirdAliDrugRequest.getCpmctymc()),"cpmctymc", thirdAliDrugRequest.getCpmctymc())
|
|
|
|
|
.eq(StringUtils.isNotBlank( thirdAliDrugRequest.getManufacturer()),"manufacturer", thirdAliDrugRequest.getManufacturer())
|
|
|
|
|
.eq(StringUtils.isNotBlank( thirdAliDrugRequest.getApprovalNum()),"approvalNum", thirdAliDrugRequest.getApprovalNum())
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm());
|
|
|
|
|
for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) {
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
|
YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest();
|
|
|
|
|
ybHcflDetailFilterRequest.setLimit(1);
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
@ -653,30 +671,62 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setUpdateTime(new Date());
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
// for (int i = 0; i < thirdAliDrugList.size(); i++) {
|
|
|
|
|
// ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
|
|
|
|
|
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(udiContrastService.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());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setNameCode(CopyUtils.copyNullStr(udiProductEntity.getNameCode(), thirdAliDrug.getNameCode()));
|
|
|
|
|
|
|
|
|
|
// 数据处理
|
|
|
|
|
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
|
|
|
|
|
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(thirdAliDrug.getBzgg());
|
|
|
|
|
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(thirdAliDrug.getPackUnitName());
|
|
|
|
|
udiProductEntity.setPackUnit(CopyUtils.copyNullStr(udiProductEntity.getPackUnit(), thirdAliDrug.getPackUnitName()));
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
// udiProductEntity.setBhxjsl(ybDrug.getFactor());
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
// udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
|
|
|
|
|
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
|
|
|
|
|
udiProductEntity.setPrepnUnit(CopyUtils.copyNullStr(udiProductEntity.getPrepnUnit(), thirdAliDrug.getPrepnUnitName()));
|
|
|
|
|
|
|
|
|
|
List<Integer> integers = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) {
|
|
|
|
@ -707,9 +757,6 @@ public class UdiProductServiceImpl implements UdiProductService {
|
|
|
|
|
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
|
|
|
|
|
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|