1、编辑药品选入产品标识重新建个请求写逻辑

2、药品编辑维护选入查询阿里逻辑
dev_unify
qiuyt 4 months ago
parent 3e1de294b0
commit 72d9611ccc

@ -23,6 +23,7 @@ import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.NmpaUdiClient;
import com.glxp.api.req.basic.*;
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
import com.glxp.api.res.DiLevelResponse;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
@ -372,7 +373,12 @@ public class UdiContrastController{
udiProductService.saveOrUpadateLevelDrug(updateLevelDrugRequest);
return ResultVOUtils.success("更新成功");
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/updateLevelDrugAli")
public BaseResponse updateLevelDrugAli(@RequestBody ThirdAliDrugRequest thirdAliDrug) {
udiProductService.saveOrUpadateLevelDrugAli(thirdAliDrug);
return ResultVOUtils.success("更新成功");
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/calculateDistCount")
public BaseResponse calculateDistCount(@RequestBody UdiProductEntity udiProductEntity) {

@ -2,6 +2,7 @@ package com.glxp.api.controller.thrsys;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.api.annotation.CusRedissonAnnotation;
import com.glxp.api.annotation.RepeatSubmit;
@ -10,13 +11,20 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.RedissonCacheKey;
import com.glxp.api.controller.BaseController;
import com.glxp.api.controller.alihealth.AlihealthBusController;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.collect.RelCodeDetailResponse;
import com.glxp.api.res.thrsys.ThrCorpsResponse;
import com.glxp.api.service.auth.AuthAliUserService;
import com.glxp.api.service.thrsys.ThirdAliDrugService;
import com.glxp.api.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -28,10 +36,15 @@ import javax.annotation.Resource;
import java.util.List;
@RestController
@Slf4j
public class ThirdAliDrugController extends BaseController {
@Resource
private ThirdAliDrugService thirdAliDrugService;
@Resource
private AlihealthBusController alihealthBusController;
@Resource
private AuthAliUserService authAliUserService;
/**
*
@ -62,6 +75,46 @@ public class ThirdAliDrugController extends BaseController {
return ResultVOUtils.success("查询参数不能为空");
}
List<ThirdAliDrug> list = thirdAliDrugService.filterList(thirdAliDrug);
if(list == null || list.size() == 0){
AuthAliUser authAliUser = authAliUserService.getOne();
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum());
alihealthKytDrugrescodeReqeust.setPage_size(100);
alihealthKytDrugrescodeReqeust.setPage(1);
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
try {
BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
if (baseResponse.getCode() == 20000) {
if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
list = thirdAliDrugService.filterList(thirdAliDrug);
} else {
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
}
} else {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
}
} catch (Exception e) {
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
}
}
PageInfo<ThirdAliDrug> pageInfo = new PageInfo<>(list);
PageSimpleResponse<ThirdAliDrug> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());

@ -92,6 +92,9 @@ public class ThirdAliDrugRequest extends ListPageRequest {
@ApiModelProperty(value = "包装级别")
private String erpId;
/**
*
*/
@ -106,7 +109,50 @@ public class ThirdAliDrugRequest extends ListPageRequest {
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
*
*/
@TableField(value = "prepnUnit")
@ApiModelProperty(value = "制剂单位描述")
private String prepnUnit;
/**
*
*/
@TableField(value = "prepnUnitName")
@ApiModelProperty(value = "制剂单位描述")
private String prepnUnitName;
/**
*
*/
@TableField(value = "physicDetailType")
@ApiModelProperty(value = "药品详情类型")
private String physicDetailType;
/**
*
*/
@TableField(value = "physicDetailTypeDesc")
@ApiModelProperty(value = "药品类型详情描述")
private String physicDetailTypeDesc;
/**
*
*/
@TableField(value = "physicTypeDesc")
@ApiModelProperty(value = "药品类型描述")
private String physicTypeDesc;
/**
*
*/
@TableField(value = "packUnitName")
@ApiModelProperty(value = "包装单位")
private String packUnitName;
private String approvalNum;
private String uuid;
private String ybbm;
}

@ -316,6 +316,8 @@ public class UdiContrastService {
//商品条码 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;

@ -6,6 +6,7 @@ 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.thrsys.ThirdAliDrugRequest;
import com.glxp.api.res.DiLevelResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
@ -84,4 +85,7 @@ public interface UdiProductService {
boolean deleteByNameCode(String nameCode);
UdiProductEntity findProductByNameCode(String nameCode);
void saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest);
}

@ -10,19 +10,29 @@ import com.glxp.api.dao.basic.UdiProductDao;
import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
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.thrsys.ThirdAliDrugRequest;
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.UdiProductService;
import com.glxp.api.service.thrsys.ThirdAliDrugService;
import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.util.DimaUtil;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.PinyinUtils;
import com.glxp.api.util.udi.FilterUdiUtils;
import com.glxp.api.util.udi.UdiInfoUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.jfree.util.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -461,8 +471,8 @@ public class UdiProductServiceImpl implements UdiProductService {
List<UdiProductEntity> udiInfoEntities = findByUuids(udiRelevanceEntity.getUuid());
List<DiLevelResponse> diLevelResponses = new ArrayList<>();
if (CollUtil.isNotEmpty(udiInfoEntities)) {
for (UdiProductEntity udiProductEntity:udiInfoEntities){
if(udiProductEntity.getPackLevel() == null){
for (UdiProductEntity udiProductEntity : udiInfoEntities) {
if (udiProductEntity.getPackLevel() == null) {
udiProductEntity.setPackLevel("1");
}
}
@ -595,6 +605,121 @@ public class UdiProductServiceImpl implements UdiProductService {
return udiProductDao.findByNameCode(nameCode);
}
@Resource
private ThrProductsService thrProductsService;
@Resource
private UdiProductService udiProductService;
@Resource
private ThirdAliDrugService thirdAliDrugService;
@Override
public void saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) {
// 查询现在如果有码为空的就进行替代掉
List<UdiProductEntity> list = udiProductDao.selectList(
new QueryWrapper<UdiProductEntity>().eq("uuid", thirdAliDrugRequest.getUuid())
);
ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm());
ThirdAliDrug thirdAliDrug = thirdAliDrugService.getOne(
new QueryWrapper<ThirdAliDrug>().eq("nameCode",thirdAliDrugRequest.getNameCode()).last("limit 1")
);
UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug = new YbDrug();
// 数据处理
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
udiProductEntity.setUuid(thirdAliDrugRequest.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);
// for (int i = 0; i < thirdAliDrugList.size(); i++) {
// ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
// 数据处理
udiProductEntity.setPrepnSpec(thirdAliDrug.getFormSpec());
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
udiProductEntity.setSpmc(thirdAliDrug.getSpmc());
udiProductEntity.setBzgg(thirdAliDrug.getBzgg());
// udiProductEntity.setMatrial(ybDrug.getMaterialName());
// udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
// udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
//最小产品单位
udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName());
//设置最小产品数量
// udiProductEntity.setBhxjsl(ybDrug.getFactor());
//生产厂家
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(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(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());
udiProductEntity.setCpmctymc(thirdAliDrug.getCpmctymc());
udiProductEntity.setZczbhhzbapzbh(thirdAliDrug.getApprovalNum());
if (list != null && list.size() == 1) {
if (StringUtils.isEmpty(udiProductEntity.getNameCode())) {
udiProductEntity.setId(list.get(0).getId());
udiProductDao.updateById(udiProductEntity);
return;
}
}
udiProductService.insertUdiInfo(udiProductEntity);
// }
}
/**
*
*/

@ -686,20 +686,26 @@ public class IoCodeTempService {
.last("limit 1")
);
if(relCodeBatchOne!=null){
genDetaiEntity.setBatchNo(relCodeBatchOne.getBatchNo());
genDetaiEntity.setProduceDate(relCodeBatchOne.getMadeDate());
genDetaiEntity.setExpireDate(relCodeBatchOne.getValidateDate());
String mabeDate = relCodeBatchOne.getMadeDate();
String validateDate = relCodeBatchOne.getValidateDate();
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setBatchNo(relCodeBatchOne.getBatchNo());
if(relCodeBatchOne.getMadeDate().length() > 10){
ioOrderDetailBizEntity.setProductDate( relCodeBatchOne.getMadeDate().replace("-","").substring(2,8));
if(mabeDate.length() > 10){
mabeDate =mabeDate.replace("-","").substring(2,8);
}
if(relCodeBatchOne.getValidateDate().length() > 10){
ioOrderDetailBizEntity.setExpireDate(relCodeBatchOne.getValidateDate().replace("-","").substring(2,8));
if(validateDate.length() > 10){
validateDate = validateDate.replace("-","").substring(2,8);
}
genDetaiEntity.setBatchNo(relCodeBatchOne.getBatchNo());
genDetaiEntity.setProduceDate(mabeDate);
genDetaiEntity.setExpireDate(validateDate);
IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setBatchNo(relCodeBatchOne.getBatchNo());
ioOrderDetailBizEntity.setProductDate( mabeDate);
ioOrderDetailBizEntity.setExpireDate(validateDate);
ioOrderDetailBizDao.update(ioOrderDetailBizEntity,
new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk",orderEntity.getBillNo())

@ -3,6 +3,7 @@ package com.glxp.api.service.thrsys;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
@ -266,5 +267,26 @@ public class ThirdAliDrugService extends ServiceImpl<ThirdAliDrugMapper, ThirdAl
return false;
}
}
public boolean addOrUpdateJson(List list) {
if(list!=null && list.size() >0){
for (Object object : list) {
ThirdAliDrug thirdAliDrug = JSONUtil.toBean(object.toString(),ThirdAliDrug.class);
ThirdAliDrug thirdAliDrugNew = this.getOne(new QueryWrapper<ThirdAliDrug>().eq("nameCode", thirdAliDrug.getNameCode())
.last("limit 1")
);
if (Objects.isNull(thirdAliDrugNew)) {
this.save(thirdAliDrug);
} else {
this.update(thirdAliDrug, new QueryWrapper<ThirdAliDrug>().eq("nameCode", thirdAliDrug.getNameCode()));
}
}
return true;
}else {
return false;
}
}
}

Loading…
Cancel
Save