1、每次选入有括号和罗马数字的等进行多次转换查询

2、查询睡眠写在接口上
3、药品选入层级增加连带选入 剔除已经存在的药品
dev_unify
qiuyt 4 months ago
parent 74fd21c176
commit 36d193986d

@ -13,15 +13,18 @@ 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.basic.UdiProductEntity;
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.basic.FilterUdiRelRequest;
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.basic.UdiProductService;
import com.glxp.api.service.thrsys.ThirdAliDrugService;
import com.glxp.api.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
@ -33,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@RestController
@ -45,6 +49,8 @@ public class ThirdAliDrugController extends BaseController {
private AlihealthBusController alihealthBusController;
@Resource
private AuthAliUserService authAliUserService;
@Resource
private UdiProductService udiProductService;
/**
*
@ -74,6 +80,17 @@ public class ThirdAliDrugController extends BaseController {
) {
return ResultVOUtils.success("查询参数不能为空");
}
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setUuid(thirdAliDrug.getUuid());
List<UdiProductEntity> udiInfoEntities = udiProductService.filterAllUdiInfo(filterUdiRelRequest);
List<String> nameCodeIn = null;
if(udiInfoEntities!=null && udiInfoEntities.size() >0){
nameCodeIn = new ArrayList<>();
for (UdiProductEntity udiInfoEntity : udiInfoEntities) {
nameCodeIn.add(udiInfoEntity.getNameCode());
}
}
thirdAliDrug.setNameCodeIn(nameCodeIn);
List<ThirdAliDrug> list = thirdAliDrugService.filterList(thirdAliDrug);
if(list == null || list.size() == 0){
AuthAliUser authAliUser = authAliUserService.getOne();

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ThirdAliDrugRequest extends ListPageRequest {
@ -153,6 +154,7 @@ public class ThirdAliDrugRequest extends ListPageRequest {
private String uuid;
private String ybbm;
private List<String> nameCodeIn;
}

@ -253,7 +253,6 @@ public class BasicBackUpdateProductService {
// udiRelevanceService.insertUdiRelevanceignore(udiRelevanceEntity1);
// }
try {
Thread.sleep(600);
udiContrastService.createOnlyMainId(thrProductsEntity.getCode());
} catch (Exception e) {

@ -615,108 +615,106 @@ public class UdiProductServiceImpl implements UdiProductService {
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(
ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne(
new QueryWrapper<ThirdAliDrug>().eq("nameCode",thirdAliDrugRequest.getNameCode()).last("limit 1")
);
if(thirdAliDrugServiceOne != null){
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>().eq("bzgg",thirdAliDrugServiceOne.getBzgg()).eq("packRatio",thirdAliDrugServiceOne.getPackRatio())
);
if(thirdAliDrugList != null && thirdAliDrugList.size() >0){
for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) {
UdiProductEntity udiProductEntity = new UdiProductEntity();
UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug = new YbDrug();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug = new YbDrug();
// 数据处理
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
// 数据处理
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);
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.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.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
//生产厂家
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
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);
}
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;
}
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());
udiProductService.insertUdiInfo(udiProductEntity);
}
}
}
udiProductService.insertUdiInfo(udiProductEntity);
// }

@ -111,10 +111,9 @@ public class AlihealthUtils {
List<ThirdAliDrug> resultList = new ArrayList<>();
AlihealthKytDrugrescodeReqeust drugRequest = request.getAlihealthKytDrugrescodeReqeust();
String originalName = drugRequest.getPhysic_name();
BaseResponse<List<ThirdAliDrug>> baseResponse = null;
// 尝试原始名称
baseResponse = tryInsertAndCollect(request, resultList);
BaseResponse<List<ThirdAliDrug>> listBaseResponse = tryInsertAndCollect(request, resultList);
// 处理括号转换
if (containsBrackets(originalName)) {
@ -123,7 +122,7 @@ public class AlihealthUtils {
AlihealthThirdAliDrugInsertReqeust tempRequest = new AlihealthThirdAliDrugInsertReqeust();
BeanUtils.copyProperties(request, tempRequest);
tempRequest.getAlihealthKytDrugrescodeReqeust().setPhysic_name(convertedName);
BaseResponse<List<ThirdAliDrug>> listBaseResponse = tryInsertAndCollect(tempRequest, resultList);
listBaseResponse = tryInsertAndCollect(tempRequest, resultList);
}
// 处理罗马数字转换
@ -133,14 +132,14 @@ public class AlihealthUtils {
AlihealthThirdAliDrugInsertReqeust tempRequest = new AlihealthThirdAliDrugInsertReqeust();
BeanUtils.copyProperties(request, tempRequest);
tempRequest.getAlihealthKytDrugrescodeReqeust().setPhysic_name(convertedName);
BaseResponse<List<ThirdAliDrug>> listBaseResponse = tryInsertAndCollect(tempRequest, resultList);
listBaseResponse = tryInsertAndCollect(tempRequest, resultList);
}
// 设置结果
if (!resultList.isEmpty()) {
baseResponse.setData(resultList);
ResultVOUtils.success(resultList);
}
return baseResponse;
return listBaseResponse;
}
// 辅助方法
@ -203,11 +202,12 @@ public class AlihealthUtils {
&& org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getAppSecret())
) {
try {
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust2 = new AlihealthKytDrugrescodeReqeust();
BeanUtils.copyProperties(alihealthKytDrugrescodeReqeust,alihealthKytDrugrescodeReqeust2);
Map map = alihealthUtils.disposeSign(alihealthKytDrugrescodeReqeust2, alihealthThirdAliDrugInsertReqeust.getAppSecret());
Thread.sleep(600);
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeustNew = new AlihealthKytDrugrescodeReqeust();
BeanUtils.copyProperties(alihealthKytDrugrescodeReqeust,alihealthKytDrugrescodeReqeustNew);
Map map = alihealthUtils.disposeSign(alihealthKytDrugrescodeReqeustNew, alihealthThirdAliDrugInsertReqeust.getAppSecret());
String json = HttpUtil.get(alihealthUrl, map);
log.error("阿里健康接口调用成功===" + json);
log.error("阿里健康接口调用结果===" + json);
alihealthKytDrugrescodeResponse = new AlihealthKytDrugrescodeResponse(json);
} catch (Exception e) {

@ -85,6 +85,13 @@
<if test="approvalNum != '' and approvalNum != null">
AND approvalNum = #{approvalNum}
</if>
<if test="nameCodeIn != null">
AND nameCode NOT IN
<foreach collection="nameCodeIn" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
order by cpmctymc,approvalNum,packRatio,packLevel
</select>

Loading…
Cancel
Save