diff --git a/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java b/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java index 993f68e9..eb201c8c 100644 --- a/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java +++ b/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java @@ -6,6 +6,7 @@ import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.CusRedissonAnnotation; import com.glxp.api.annotation.Log; @@ -37,6 +38,7 @@ import com.glxp.api.util.IntUtil; import com.glxp.api.util.JsonUtils; import com.glxp.api.util.alihealth.AlihealthUtils; import com.glxp.api.util.alihealth.CopyUtils; +import com.glxp.api.util.alihealth.PaginationUtil; import com.google.api.client.json.Json; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -104,10 +106,12 @@ public class AlihealthBusController extends BaseController { @Resource private UdiContrastService udiContrastService; + @PostMapping("/spms/alihealth/thirdAliDrugList") @Log(title = "获取阿里药品码段信息列表包括查询国家库", businessType = BusinessType.OTHER) - public BaseResponse> thirdAliDrugList(@RequestBody AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) { + public BaseResponse> thirdAliDrugList(@RequestBody AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) { List thirdAliDrugsListGjk = null; + PageSimpleResponse pageSimpleResponse =new PageSimpleResponse(); // 本地查询和新增都先注释了 到时候加到这边来 YbDrug ybDrug = alihealthThirdAliDrugInsertReqeust.getYbDrug(); if(ybDrug!= null && StringUtils.isNotEmpty(ybDrug.getGoodsCode())){ @@ -123,8 +127,12 @@ public class AlihealthBusController extends BaseController { if(responseListAndAliDrug.getCode() == 20000){ thirdAliDrugsListGjk = responseListAndAliDrug.getData(); if(thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() >0){ - return ResultVOUtils.success(thirdAliDrugsListGjk); + pageSimpleResponse.setList(thirdAliDrugsListGjk); + return ResultVOUtils.success(pageSimpleResponse); } + }else { + pageSimpleResponse.setList(thirdAliDrugsListGjk); + return ResultVOUtils.success(pageSimpleResponse); } } catch (Exception e) { log.error("国家库===用医保编码查询国家库药品信息===出现错误===" + e.getMessage()); @@ -133,7 +141,8 @@ public class AlihealthBusController extends BaseController { } // 校验标识判断 为false不会后续增加多玛融合库的逻辑 直接返回 if(alihealthThirdAliDrugInsertReqeust.isDrugCheckMark() == false){ - return ResultVOUtils.success(thirdAliDrugsListGjk); + pageSimpleResponse.setList(thirdAliDrugsListGjk); + return ResultVOUtils.success(pageSimpleResponse); } // 查询国家库药品信息 并且要插入到多玛融合表 @@ -162,6 +171,7 @@ public class AlihealthBusController extends BaseController { } map.put("page", alihealthThirdAliDrugInsertReqeust.getPage()); map.put("limit", alihealthThirdAliDrugInsertReqeust.getLimit()); + map.put("nameCodeIn", alihealthThirdAliDrugInsertReqeust.getNameCodeIn()); if(alihealthThirdAliDrugInsertReqeust.getGjkSwitch()){ @@ -175,6 +185,12 @@ public class AlihealthBusController extends BaseController { ) { // 查询国家库是否有值 有值直接返回没值查询阿里接口 thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); + if(thirdAliDrugsListGjk.size() == udiDlDeviceResponse.getData().getTotal()){ + thirdAliDrugsListGjk = PaginationUtil.getPage(thirdAliDrugsListGjk, alihealthThirdAliDrugInsertReqeust.getPage() + , alihealthThirdAliDrugInsertReqeust.getLimit()); + } + pageSimpleResponse.setList(thirdAliDrugsListGjk); + pageSimpleResponse.setTotal(Long.valueOf(udiDlDeviceResponse.getData().getTotal())); } } catch (Exception e) { log.error("国家库===查询药品信息===出现错误===" + e.getMessage()); @@ -182,38 +198,38 @@ public class AlihealthBusController extends BaseController { } } - if (thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() > 0) { - - } else { -// BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(alihealthThirdAliDrugInsertReqeust); -// if (baseResponse.getCode() == 20000) { -// thirdAliDrugsListGjk = baseResponse.getData(); -// } else { -// log.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); -// return ResultVOUtils.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); +// if (thirdAliDrugsListGjk != null && thirdAliDrugsListGjk.size() > 0) { // -// } -// // 上传到国家库 -// try { -// Map mapNew = new HashMap(); -// mapNew.put("list", thirdAliDrugsListGjk); -// String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); -// BaseResponse baseResponseAdd = JSONUtil.toBean(response, BaseResponse.class); -// log.info("成功上传国家库阿里产品数据"); -// } catch (Exception e) { +// } else { +//// BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(alihealthThirdAliDrugInsertReqeust); +//// if (baseResponse.getCode() == 20000) { +//// thirdAliDrugsListGjk = baseResponse.getData(); +//// } else { +//// log.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); +//// return ResultVOUtils.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); +//// +//// } +//// // 上传到国家库 +//// try { +//// Map mapNew = new HashMap(); +//// mapNew.put("list", thirdAliDrugsListGjk); +//// String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); +//// BaseResponse baseResponseAdd = JSONUtil.toBean(response, BaseResponse.class); +//// log.info("成功上传国家库阿里产品数据"); +//// } catch (Exception e) { +//// +//// log.error("国家库上传阿里产品访问出现错误===" + e.getMessage()); +//// } // -// log.error("国家库上传阿里产品访问出现错误===" + e.getMessage()); -// } - - } - // 上传多玛关系于处理规则在插入到融合表 - if(ybDrug!= null && StringUtils.isNotEmpty(ybDrug.getGoodsCode()) - ){ - // 规则匹配 - thirdAliDrugsListGjk = udiContrastService.disposeYbDrugList(thirdAliDrugsListGjk,ybDrug,alihealthThirdAliDrugInsertReqeust.getNameCodeIn()); - - } - return ResultVOUtils.success(thirdAliDrugsListGjk); +// } +// // 上传多玛关系于处理规则在插入到融合表 +// if(ybDrug!= null && StringUtils.isNotEmpty(ybDrug.getGoodsCode()) +// ){ +// // 规则匹配 +// thirdAliDrugsListGjk = udiContrastService.disposeYbDrugList(thirdAliDrugsListGjk,ybDrug,alihealthThirdAliDrugInsertReqeust.getNameCodeIn()); +// +// } + return ResultVOUtils.success(pageSimpleResponse); // udiProductService.insertUdiInfo(udiProductEntity); } diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java b/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java index 84f58314..225a86a1 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThirdAliDrugController.java @@ -1,5 +1,6 @@ package com.glxp.api.controller.thrsys; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -123,16 +124,13 @@ public class ThirdAliDrugController extends BaseController { alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey()); alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid()); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); + Integer total = 0; try { - BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust); + BaseResponse> baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust); if (baseResponse.getCode() == 20000) { - - if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) { - list = thirdAliDrugService.filterList(thirdAliDrug); - - } else { - log.error("获取阿里和国家库码段信息===未查到产品信息"); - + if (!CollUtil.isEmpty(baseResponse.getData().getList())){ + list = baseResponse.getData().getList(); + total = baseResponse.getData().getTotal(); } @@ -151,7 +149,7 @@ public class ThirdAliDrugController extends BaseController { // } PageInfo pageInfo = new PageInfo<>(list); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); - pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setTotal(Long.valueOf(total)); pageSimpleResponse.setList(list); return ResultVOUtils.success(pageSimpleResponse); } diff --git a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java index ad4e836a..ec3004ca 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; 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.controller.alihealth.AlihealthBusController; import com.glxp.api.dao.basic.UdiRelevanceDao; @@ -25,6 +26,7 @@ import com.glxp.api.req.basic.UdiCombineRequest; import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.basic.YbDrugDetailFilterRequest; import com.glxp.api.req.thrsys.FilterThrProductsRequest; +import com.glxp.api.req.thrsys.ThirdAliDrugRequest; import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest; import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest; import com.glxp.api.res.PageSimpleResponse; @@ -360,9 +362,9 @@ public class UdiContrastService { alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid()); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); try { - BaseResponse baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust); + BaseResponse> baseResponse = alihealthBusController.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust); if (baseResponse.getCode() == 20000) { - thirdAliDrugList = (List) baseResponse.getData(); + thirdAliDrugList = baseResponse.getData().getList(); // if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) { // thirdAliDrugList = thirdAliDrugService.list( @@ -616,7 +618,7 @@ public class UdiContrastService { String response = HttpUtil.post(udiUrl + "/udchs/codeRel/updateBatch", JSONUtil.toJsonStr(list)); BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class); - if (baseResponse.getCode() == 2000) { + if (baseResponse.getCode() == 20000) { log.error("国家库===上传多码关系===" + list.get(0).getYbbm() + "成功==="); } else { @@ -641,7 +643,7 @@ public class UdiContrastService { String response = HttpUtil.post(udiUrl + "/udchs/codeRel/delete", JSONUtil.toJsonStr(codeRel)); BaseResponse baseResponse = JSONUtil.toBean(response, BaseResponse.class); - if (baseResponse.getCode() == 2000) { + if (baseResponse.getCode() == 20000) { } else { log.error("国家库===删除多玛关系===出现错误===" + baseResponse.getMessage()); @@ -654,7 +656,29 @@ public class UdiContrastService { } } + public List optThirdAliDrug(ThirdAliDrugRequest thirdAliDrugRequest) { + List thirdAliDrugList = new ArrayList<>(); + try { + String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/optThirdAliDrug", JSONUtil.toJsonStr(thirdAliDrugRequest)); + BaseResponse> baseResponse = + JSONObject.parseObject(response, new TypeReference>>() { + + }); + if (baseResponse.getCode() == 20000) { + thirdAliDrugList =baseResponse.getData(); + } else { + log.error("国家库===查询选入数据失败===" + baseResponse.getMessage()); + } + + } catch (Exception e) { + log.error("国家库===查询选入数据失败===出现错误===" + e.getMessage()); + + } + return thirdAliDrugList; + + + } public List disposeYbDrugList(List thirdAliDrugList, YbDrug ybDrug, List codeIn) { List list1 = new ArrayList<>(); String result = null; diff --git a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java index f9a63266..1c7af05f 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/UdiProductServiceImpl.java @@ -474,9 +474,9 @@ public class UdiProductServiceImpl implements UdiProductService { // 上传多玛融合表 List codeRelArrayList = new ArrayList<>(); - if(StringUtils.isNotEmpty(updateLevelDrugRequest.getPackUnit()) - || !Objects.isNull(updateLevelDrugRequest.getBhxjsl()) || StringUtils.isNotEmpty(updateLevelDrugRequest.getXjdw()) - ){ + if (StringUtils.isNotEmpty(updateLevelDrugRequest.getPackUnit()) + || !Objects.isNull(updateLevelDrugRequest.getBhxjsl()) || StringUtils.isNotEmpty(updateLevelDrugRequest.getXjdw()) + ) { CodeRel codeRel = new CodeRel(); codeRel.setDrugCode(udiProductEntity1.getNameCode()); codeRel.setUpdateTime(new Date()); @@ -673,192 +673,184 @@ public class UdiProductServiceImpl implements UdiProductService { @Override public BaseResponse saveOrUpadateLevelDrugAli(ThirdAliDrugRequest thirdAliDrugRequest) { Integer detailSort = 0; - ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne( - new QueryWrapper().eq("nameCode", thirdAliDrugRequest.getNameCodeRow()).last("limit 1") - ); +// ThirdAliDrug thirdAliDrugServiceOne = thirdAliDrugService.getOne( +// new QueryWrapper().eq("nameCode", thirdAliDrugRequest.getNameCodeRow()).last("limit 1") +// ); String str = ""; - if (thirdAliDrugServiceOne != null) { - List thirdAliDrugList = thirdAliDrugService.list( - new QueryWrapper().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()) - + List thirdAliDrugList = new ArrayList<>(); + thirdAliDrugRequest.setNameCode(thirdAliDrugRequest.getNameCodeRow()); + thirdAliDrugList = udiContrastService.optThirdAliDrug(thirdAliDrugRequest); + if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { + // 多码融合表拼接参数 + List codeRelArrayList = new ArrayList<>(); + udiProductDao.delete(new QueryWrapper() + .eq("uuid", thirdAliDrugRequest.getUuid()) + .isNull("nameCode") ); - if (thirdAliDrugList != null && thirdAliDrugList.size() > 0) { - // 多码融合表拼接参数 - List codeRelArrayList = new ArrayList<>(); - udiProductDao.delete(new QueryWrapper() - .eq("uuid", thirdAliDrugRequest.getUuid()) - .isNull("nameCode") - ); - ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm()); - for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) { - ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest(); - thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm()); - YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest(); - ybHcflDetailFilterRequest.setLimit(1); - ybHcflDetailFilterRequest.setPage(1); - ybHcflDetailFilterRequest.setGoodsCode(thrProductsEntity.getYbbm()); - List list = ybDrugService.getList(ybHcflDetailFilterRequest); - - - UdiProductEntity udiProductEntity = new UdiProductEntity(); - BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); - YbDrug ybDrug = new YbDrug(); - - // 数据处理 - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); + ThrProductsEntity thrProductsEntity = thrProductsService.selectByCode(thirdAliDrugRequest.getYbbm()); + for (ThirdAliDrug thirdAliDrug : thirdAliDrugList) { + ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest(); + thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm()); + YbDrugDetailFilterRequest ybHcflDetailFilterRequest = new YbDrugDetailFilterRequest(); + ybHcflDetailFilterRequest.setLimit(1); + ybHcflDetailFilterRequest.setPage(1); + ybHcflDetailFilterRequest.setGoodsCode(thrProductsEntity.getYbbm()); + List 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(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.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); + + if (list != null && list.size() > 0) { + ybDrug = list.get(0); + // 数据做处理好查询阿里接口 + if (ybDrug.getApprovalCode().contains("(")) { + String[] charArr = ybDrug.getRegisteredProductName().split("\\("); + ybDrug.setApprovalCode(charArr[0]); } - udiProductEntity.setUpdateTime(new Date()); - udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); - - 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.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.setManufactory(ybDrug.getCompanyNameSc()); + //商品条码 essentialDrugMarkName sptm // udiProductEntity.setSptm(ybDrug.getBusinessLicense()); - udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel()); - } else { - udiProductEntity.setCpmctymc(thrProductsEntity.getName()); - } + udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel()); + } else { + udiProductEntity.setCpmctymc(thrProductsEntity.getName()); + } - udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); + 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.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.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.setPackUnit(CopyUtils.copyNullStr(udiProductEntity.getPackUnit(), thirdAliDrug.getPackUnitName())); + //设置最小产品数量 // udiProductEntity.setBhxjsl(ybDrug.getFactor()); - //生产厂家 + //生产厂家 // udiProductEntity.setManufactory(thirdAliDrug.getManufacturer()); - //商品条码 essentialDrugMarkName sptm + //商品条码 essentialDrugMarkName sptm // udiProductEntity.setSptm(ybDrug.getBusinessLicense()); - udiProductEntity.setPrepnUnit(CopyUtils.copyNullStr(udiProductEntity.getPrepnUnit(), thirdAliDrug.getPrepnUnitName())); + udiProductEntity.setPrepnUnit(CopyUtils.copyNullStr(udiProductEntity.getPrepnUnit(), thirdAliDrug.getPrepnUnitName())); - List 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 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 (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); - } + } + if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) { + udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); + } else { + udiProductEntity.setDiType(1); + } // udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); - + 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())); + 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); - udiProductService.insertUdiInfo(udiProductEntity); - } + // 多码融合存在就以多码融合为准 + 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())); - UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); - try { - udiRelevanceEntity.setDetailSort(Integer.valueOf(thirdAliDrugList.get(0).getPhysicDetailType())); - detailSort = udiRelevanceEntity.getDetailSort(); - } catch (Exception e) { - log.error("明细分类转换出现错误" + e.getMessage()); - } - udiRelevanceService.update(udiRelevanceEntity, new QueryWrapper() - .eq("uuid", thirdAliDrugRequest.getUuid()) - ); - udiContrastService.codeRelUpdateBatch(codeRelArrayList); - return ResultVOUtils.success(detailSort); + 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()); } + udiRelevanceService.update(udiRelevanceEntity, new QueryWrapper() + .eq("uuid", thirdAliDrugRequest.getUuid()) + ); + udiContrastService.codeRelUpdateBatch(codeRelArrayList); + return ResultVOUtils.success(detailSort); + } + // } return ResultVOUtils.error("获取错误"); diff --git a/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java b/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java index c61e5ac4..21cfcfd9 100644 --- a/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java +++ b/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java @@ -137,7 +137,7 @@ public class AlihealthUtils { // 设置结果 if (!resultList.isEmpty()) { - ResultVOUtils.success(resultList); + return ResultVOUtils.success(resultList); } return listBaseResponse; } diff --git a/src/main/java/com/glxp/api/util/alihealth/PaginationUtil.java b/src/main/java/com/glxp/api/util/alihealth/PaginationUtil.java new file mode 100644 index 00000000..a5cbc165 --- /dev/null +++ b/src/main/java/com/glxp/api/util/alihealth/PaginationUtil.java @@ -0,0 +1,15 @@ +package com.glxp.api.util.alihealth; + +import java.util.ArrayList; +import java.util.List; + +public class PaginationUtil { + public static List getPage(List list, int pageNumber, int pageSize) { + int startIndex = (pageNumber - 1) * pageSize; + int endIndex = Math.min(startIndex + pageSize, list.size()); + if (startIndex >= list.size()) { + return new ArrayList<>(); + } + return list.subList(startIndex, endIndex); + } +} diff --git a/src/main/resources/mybatis/mapper/thrsys/ThirdAliDrugMapper.xml b/src/main/resources/mybatis/mapper/thrsys/ThirdAliDrugMapper.xml index 030669ec..5b47fee2 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThirdAliDrugMapper.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThirdAliDrugMapper.xml @@ -77,7 +77,7 @@ from third_ali_drug - AND cpmctymc LIKE concat('%', #{cpmctymc}, '%') + AND cpmctymc LIKE concat( #{cpmctymc}, '%') AND nameCode LIKE concat('%', #{nameCode}, '%')