选入药品逻辑优化

dev_drug
qiuyt 3 months ago
parent 67c76aa67d
commit 9ea978e725

@ -19,6 +19,7 @@ import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.system.CompanyEntity;
import com.glxp.api.entity.thrsys.CodeRel;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.NmpaUdiClient;
@ -407,6 +408,12 @@ public class UdiContrastController {
@PostMapping("/udi/udirel/drug/delLevel")
public BaseResponse delLevel(@RequestBody AddProductRequest addProductRequest) {
boolean b = udiProductService.deleteByNameCode(addProductRequest.getNameCode());
if(b == true){
CodeRel codeRel = new CodeRel();
codeRel.setYbbm(addProductRequest.getYbbm());
codeRel.setDrugCode(addProductRequest.getNameCode());
udiContrastService.deleteRelCode(codeRel);
}
return ResultVOUtils.success("删除成功!");
}

@ -110,6 +110,7 @@ public class ThirdAliDrugController extends BaseController {
alihealthThirdAliDrugInsertReqeust.setGjkSwitch(true);
alihealthThirdAliDrugInsertReqeust.setPage(thirdAliDrug.getPage());
alihealthThirdAliDrugInsertReqeust.setLimit(thirdAliDrug.getLimit());
alihealthThirdAliDrugInsertReqeust.setDrugCheckMark(true);
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum());
@ -126,8 +127,6 @@ public class ThirdAliDrugController extends BaseController {
BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
list = thirdAliDrugService.filterList(thirdAliDrug);
if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
list = thirdAliDrugService.filterList(thirdAliDrug);

@ -635,6 +635,26 @@ public class UdiContrastService {
}
public void deleteRelCode(CodeRel codeRel) {
try {
String response = HttpUtil.post(udiUrl + "/udchs/codeRel/delete", JSONUtil.toJsonStr(codeRel));
BaseResponse<String> baseResponse = JSONUtil.toBean(response, BaseResponse.class);
if (baseResponse.getCode() == 2000) {
} else {
log.error("国家库===删除多玛关系===出现错误===" + baseResponse.getMessage());
}
} catch (Exception e) {
log.error("国家库===删除多玛关系===出现错误===" + e.getMessage());
}
}
public List<ThirdAliDrug> disposeYbDrugList(List<ThirdAliDrug> thirdAliDrugList, YbDrug ybDrug, List<String> codeIn) {
List<ThirdAliDrug> list1 = new ArrayList<>();
String result = null;

@ -278,6 +278,7 @@ public class UdiProductServiceImpl implements UdiProductService {
String di = FilterUdiUtils.getDiStr(nameCode);
return udiProductDao.selectAllowNoBatch(di);
}
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@ -331,27 +332,9 @@ public class UdiProductServiceImpl implements UdiProductService {
throw new JsonException(500, "更新错误");
}
}
if(list!=null && list.size() >0){
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());
}
}
udiContrastService.codeRelUpdateBatch(list);
}
//修改关联表
@ -488,6 +471,28 @@ public class UdiProductServiceImpl implements UdiProductService {
udiProductDao.insert(udiProductEntity1);
}
updateLevelCount(udiRelevanceEntity);
// 上传多玛融合表
List<UdiProductEntity> udiProductEntityList = udiProductDao.selectList(
new QueryWrapper<UdiProductEntity>().eq(StringUtils.isNotBlank(udiProductEntity1.getUuid()), "uuid", udiProductEntity1.getUuid())
);
List<CodeRel> codeRelArrayList = new ArrayList<>();
if (udiProductEntityList != null && udiProductEntityList.size() > 0) {
for (UdiProductEntity udiProductEntity : udiProductEntityList) {
CodeRel codeRel = new CodeRel();
codeRel.setDrugCode(udiProductEntity.getNameCode());
codeRel.setUpdateTime(new Date());
codeRel.setYbbm(udiRelevanceEntity.getMainId());
codeRel.setPackUnit(udiProductEntity.getPackUnit());
codeRel.setBhxjsl(udiProductEntity.getBhxjsl());
codeRel.setXjdw(udiProductEntity.getXjdw());
codeRel.setYbBzgg(udiProductEntity.getBzgg());
codeRelArrayList.add(codeRel);
}
// 上传到多码融合表
udiContrastService.codeRelUpdateBatch(codeRelArrayList);
}
// if (IntUtil.value(udiProductEntity1.getPackLevel()) == 1) {
// calculateDistCount(udiProductEntity1, udiRelevanceEntity);
// calculateUseCount(udiProductEntity1, udiRelevanceEntity);
@ -664,27 +669,30 @@ public class UdiProductServiceImpl implements UdiProductService {
private UdiContrastService udiContrastService;
@Resource
private UdiRelevanceService udiRelevanceService;
@Override
public BaseResponse saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) {
Integer detailSort=0;
Integer detailSort = 0;
ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne(
new QueryWrapper<ThirdAliDrug>().eq("nameCode", thirdAliDrugRequest.getNameCodeRow()).last("limit 1")
);
String str = "";
if (thirdAliDrugServiceOne != null) {
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>().eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getBzgg()),"bzgg", thirdAliDrugServiceOne.getBzgg())
.eq(StringUtils.isNotBlank( thirdAliDrugServiceOne.getPackRatio()),"packRatio", thirdAliDrugServiceOne.getPackRatio())
.like(StringUtils.isNotBlank( thirdAliDrugRequest.getCpmctymc()),"cpmctymc", thirdAliDrugRequest.getCpmctymc())
.like(StringUtils.isNotBlank( thirdAliDrugRequest.getManufacturer()),"manufacturer", thirdAliDrugRequest.getManufacturer())
.eq(StringUtils.isNotBlank( thirdAliDrugRequest.getApprovalNum()),"approvalNum", thirdAliDrugRequest.getApprovalNum())
.like(StringUtils.isNotBlank( thirdAliDrugRequest.getFormSpec()),"formSpec", thirdAliDrugRequest.getFormSpec())
.like(StringUtils.isNotBlank( thirdAliDrugRequest.getBzgg()),"bzgg", thirdAliDrugRequest.getBzgg())
new QueryWrapper<ThirdAliDrug>().eq(StringUtils.isNotBlank(thirdAliDrugServiceOne.getBzgg()), "bzgg", thirdAliDrugServiceOne.getBzgg())
.eq(StringUtils.isNotBlank(thirdAliDrugServiceOne.getPackRatio()), "packRatio", thirdAliDrugServiceOne.getPackRatio())
.like(StringUtils.isNotBlank(thirdAliDrugRequest.getCpmctymc()), "cpmctymc", thirdAliDrugRequest.getCpmctymc())
.like(StringUtils.isNotBlank(thirdAliDrugRequest.getManufacturer()), "manufacturer", thirdAliDrugRequest.getManufacturer())
.like(StringUtils.isNotBlank(thirdAliDrugRequest.getApprovalNum()), "approvalNum", thirdAliDrugRequest.getApprovalNum())
.like(StringUtils.isNotBlank(thirdAliDrugRequest.getFormSpec()), "formSpec", thirdAliDrugRequest.getFormSpec())
.like(StringUtils.isNotBlank(thirdAliDrugRequest.getBzgg()), "bzgg", thirdAliDrugRequest.getBzgg())
);
if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) {
// 多码融合表拼接参数
List<CodeRel> codeRelArrayList = new ArrayList<>();
udiProductDao.delete(new QueryWrapper<UdiProductEntity>()
.eq("uuid",thirdAliDrugRequest.getUuid())
.eq("uuid", thirdAliDrugRequest.getUuid())
.isNull("nameCode")
);
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm());
@ -757,7 +765,7 @@ public class UdiProductServiceImpl implements UdiProductService {
}
udiProductEntity.setNameCode(CopyUtils.copyNullStr(udiProductEntity.getNameCode(), thirdAliDrug.getNameCode()));
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
// 数据处理
udiProductEntity.setPrepnSpec(CopyUtils.copyNullStr(udiProductEntity.getPrepnSpec(), thirdAliDrug.getFormSpec()));
@ -793,42 +801,67 @@ public class UdiProductServiceImpl implements UdiProductService {
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.setXjdw(thirdAliDrug.getPrepnUnitName());
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
// udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
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);
}
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
try {
udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType()));
detailSort = udiRelevanceEntity.getDetailSort();
}catch (Exception e){
log.error("明细分类转换出现错误"+e.getMessage());
detailSort = udiRelevanceEntity.getDetailSort();
} catch (Exception e) {
log.error("明细分类转换出现错误" + e.getMessage());
}
udiRelevanceService.update(udiRelevanceEntity,new QueryWrapper<UdiRelevanceEntity>()
.eq("uuid",thirdAliDrugRequest.getUuid())
udiRelevanceService.update(udiRelevanceEntity, new QueryWrapper<UdiRelevanceEntity>()
.eq("uuid", thirdAliDrugRequest.getUuid())
);
udiContrastService.codeRelUpdateBatch(codeRelArrayList);
return ResultVOUtils.success(detailSort);
}
}
// }
return ResultVOUtils.error("获取错误");
return ResultVOUtils.error("获取错误");
}

Loading…
Cancel
Save