选入药品逻辑更改

dev_unify
qiuyt 7 months ago
parent f1a16d24b7
commit a240f24839

@ -1,12 +1,22 @@
package com.glxp.api.controller.alihealth; package com.glxp.api.controller.alihealth;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.annotation.Log; import com.glxp.api.annotation.Log;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType; import com.glxp.api.constant.BusinessType;
import com.glxp.api.entity.auth.CustomerInfoEntity;
import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust; import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust;
import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse; import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse;
import com.glxp.api.util.alihealth.AlihealthUtils; import com.glxp.api.util.alihealth.AlihealthUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -17,6 +27,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
@ -26,6 +38,8 @@ public class AlihealthBusController {
private AlihealthUtils alihealthUtils; private AlihealthUtils alihealthUtils;
@Value("${ALIHEALTH_URL:http://gw.api.taobao.com/router/rest}") @Value("${ALIHEALTH_URL:http://gw.api.taobao.com/router/rest}")
private String alihealthUrl; private String alihealthUrl;
@Value("${UDI_SERVER_URL}")
private String udiUrl;
@PostMapping("/spms/alihealth/relCodeInsert") @PostMapping("/spms/alihealth/relCodeInsert")
@Log(title = "阿里健康自动赋码关联关系", businessType = BusinessType.OTHER) @Log(title = "阿里健康自动赋码关联关系", businessType = BusinessType.OTHER)
public BaseResponse relCodeInsert(@RequestBody AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust) { public BaseResponse relCodeInsert(@RequestBody AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust) {
@ -67,4 +81,62 @@ public class AlihealthBusController {
} }
} }
@PostMapping("/spms/alihealth/thirdAliDrugList")
@Log(title = "获取阿里药品码段信息列表包括查询国家库", businessType = BusinessType.OTHER)
public BaseResponse<List<ThirdAliDrug>> thirdAliDrugList(@RequestBody AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) {
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust();
Map map = new HashMap();
if(com.glxp.api.util.StringUtils.isNotEmpty(alihealthKytDrugrescodeReqeust.getPhysic_name())){
map.put("cpmctymc",alihealthKytDrugrescodeReqeust.getPhysic_name());
}
if(com.glxp.api.util.StringUtils.isNotEmpty(alihealthKytDrugrescodeReqeust.getApproval_licence_no())){
map.put("approvalNum",alihealthKytDrugrescodeReqeust.getApproval_licence_no());
}
List<ThirdAliDrug> thirdAliDrugsListGjk = null;
try {
String response = HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map);
BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() {
});
if (udiDlDeviceResponse != null
) {
// 查询国家库是否有值 有值直接返回没值查询阿里接口
thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList();
}
} catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误==="+e.getMessage());
}
if(thirdAliDrugsListGjk!= null && thirdAliDrugsListGjk.size() >0){
return ResultVOUtils.success(thirdAliDrugsListGjk);
}else {
List<ThirdAliDrug> thirdAliDrugListNew;
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
if(baseResponse.getCode() == 20000){
thirdAliDrugListNew = baseResponse.getData();
}else {
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
throw new JsonException(500, "阿里接口未查到产品信息");
}
// 上传到国家库
try {
Map mapNew = new HashMap();
mapNew.put("list",thirdAliDrugListNew);
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());
}
return ResultVOUtils.success(thirdAliDrugListNew);
}
// udiProductService.insertUdiInfo(udiProductEntity);
}
} }

@ -93,7 +93,7 @@ public class TestCodeController {
alihealthKytDrugrescodeReqeust.setApp_key("31721223"); alihealthKytDrugrescodeReqeust.setApp_key("31721223");
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
if(baseResponse.getCode() == 20000){ if(baseResponse.getCode() == 20000){
List<ThirdAliDrug> list = baseResponse.getData(); List<ThirdAliDrug> list = baseResponse.getData();
if(list!=null && list.size() >0){ if(list!=null && list.size() >0){
@ -113,7 +113,7 @@ public class TestCodeController {
} }
return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
} }
@PostMapping("/test2") @PostMapping("/test2")
public BaseResponse test2() { public BaseResponse test2() {

@ -7,5 +7,6 @@ import lombok.Data;
public class AlihealthThirdAliDrugInsertReqeust { public class AlihealthThirdAliDrugInsertReqeust {
private String erpId; private String erpId;
private String appSecret; private String appSecret;
private AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust; private AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust;
} }

@ -227,7 +227,6 @@ public class UdiContrastService {
@Resource @Resource
ThirdAliDrugService thirdAliDrugService; ThirdAliDrugService thirdAliDrugService;
// @Transactional // @Transactional
public void createOnlyMainId(String mainId) { public void createOnlyMainId(String mainId) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
@ -260,15 +259,15 @@ public class UdiContrastService {
UdiProductEntity udiProductEntity = new UdiProductEntity(); UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug=new YbDrug();
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
YbDrug ybDrug = list.get(0); ybDrug = list.get(0);
// 数据做处理好查询阿里接口 // 数据做处理好查询阿里接口
ybDrug.setRegisteredProductName(ybDrug.getRegisteredProductName().replace("(", "").replace(")", "")); if(ybDrug.getApprovalCode().contains("(")){
if (ybDrug.getApprovalCode().contains("(")) {
String[] charArr = ybDrug.getRegisteredProductName().split("\\("); String[] charArr = ybDrug.getRegisteredProductName().split("\\(");
ybDrug.setRegisteredProductName(charArr[0]); ybDrug.setApprovalCode(charArr[0]);
} }
ybDrug.setApprovalCode(ybDrug.getApprovalCode().replace("(", "").replace(")", ""));
udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductEntity.setId(IdUtil.getSnowflakeNextId());
@ -309,27 +308,51 @@ public class UdiContrastService {
udiProductEntity.setUpdateTime(new Date()); udiProductEntity.setUpdateTime(new Date());
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
} else {
// 数据处理
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
udiProductEntity.setUuid(udiRelevanceEntity.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);
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
udiProductEntity.setPrice("0.00");
}
udiProductEntity.setUpdateTime(new Date());
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
}
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list( List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>() new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName()) .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode()) .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh())
); );
if (CollUtil.isNotEmpty(thirdAliDrugList)) { if (CollUtil.isNotEmpty(thirdAliDrugList)) {
} else { } else {
Map map = new HashMap(); Map map = new HashMap();
if (StringUtils.isNotEmpty(ybDrug.getRegisteredProductName())) { if(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc())){
map.put("cpmctymc", ybDrug.getRegisteredProductName()); map.put("cpmctymc",udiProductEntity.getCpmctymc());
} }
if (StringUtils.isNotEmpty(ybDrug.getApprovalCode())) { if(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh())){
map.put("approvalNum", ybDrug.getApprovalCode()); map.put("approvalNum",udiProductEntity.getZczbhhzbapzbh());
} }
List<ThirdAliDrug> thirdAliDrugsListGjk = null; List<ThirdAliDrug> thirdAliDrugsListGjk = null;
try { try {
String response = HttpUtil.get(udiUrl + "/udiwms/aliDrug/getDrugLevelList", map); String response = HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map);
BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse = BaseResponse<PageSimpleResponse<ThirdAliDrug>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() { JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThirdAliDrug>>>() {
@ -341,57 +364,58 @@ public class UdiContrastService {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误===" + e.getMessage()); log.error("国家库查询阿里产品访问出现错误==="+e.getMessage());
} }
if (thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)) { if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){
} else { }else {
List<ThirdAliDrug> thirdAliDrugListNew = null; List<ThirdAliDrug> thirdAliDrugListNew = null;
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424"); alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424");
alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01");
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(ybDrug.getRegisteredProductName()); alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(ybDrug.getApprovalCode()); alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh());
alihealthKytDrugrescodeReqeust.setPage_size(100); alihealthKytDrugrescodeReqeust.setPage_size(100);
alihealthKytDrugrescodeReqeust.setPage(1); alihealthKytDrugrescodeReqeust.setPage(1);
alihealthKytDrugrescodeReqeust.setApp_key("31721223"); alihealthKytDrugrescodeReqeust.setApp_key("31721223");
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
if (baseResponse.getCode() == 20000) { if(baseResponse.getCode() == 20000){
thirdAliDrugListNew = baseResponse.getData(); thirdAliDrugListNew = baseResponse.getData();
thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); thirdAliDrugService.addOrUpdate(thirdAliDrugListNew);
} else { }else {
udiProductService.insertUdiInfo(udiProductEntity); udiProductService.insertUdiInfo(udiProductEntity);
log.error("阿里接口未查到产品信息===" + baseResponse.getMessage()); log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
// throw new JsonException(500, "阿里接口未查到产品信息"); // throw new JsonException(500, "阿里接口未查到产品信息");
} }
if (thirdAliDrugListNew != null && thirdAliDrugListNew.size() > 0) { if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){
try { try {
// 上传到国家库 // 上传到国家库
Map mapNew = new HashMap(); Map mapNew = new HashMap();
mapNew.put("list", thirdAliDrugListNew); mapNew.put("list",thirdAliDrugListNew);
String response = HttpUtil.post(udiUrl + "/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew)); String response = HttpUtil.post(udiUrl+"/udiwms/aliDrug/addThirdAliDrug", JSONUtil.toJsonStr(mapNew));
BaseResponse baseResponseAdd = JSONUtil.toBean(response, BaseResponse.class); BaseResponse baseResponseAdd = JSONUtil.toBean(response,BaseResponse.class);
log.info("成功上传国家库阿里产品数据"); log.info("成功上传国家库阿里产品数据");
} catch (Exception e) { } catch (Exception e) {
log.error("国家库上传阿里产品访问出现错误===" + e.getMessage()); log.error("国家库上传阿里产品访问出现错误==="+e.getMessage());
} }
} }
} }
// udiProductService.insertUdiInfo(udiProductEntity);
}
thirdAliDrugList = thirdAliDrugService.list( thirdAliDrugList = thirdAliDrugService.list(
new QueryWrapper<ThirdAliDrug>() new QueryWrapper<ThirdAliDrug>()
.eq(StringUtils.isNotEmpty(ybDrug.getRegisteredProductName()), "cpmctymc", ybDrug.getRegisteredProductName()) .eq(StringUtils.isNotEmpty(udiProductEntity.getCpmctymc()),"cpmctymc",udiProductEntity.getCpmctymc())
.eq(StringUtils.isNotEmpty(ybDrug.getApprovalCode()), "approvalNum", ybDrug.getApprovalCode()) .eq(StringUtils.isNotEmpty(udiProductEntity.getZczbhhzbapzbh()),"approvalNum",udiProductEntity.getZczbhhzbapzbh())
); );
// udiProductService.insertUdiInfo(udiProductEntity);
}
for (int i = 0; i < thirdAliDrugList.size(); i++) { for (int i = 0; i < thirdAliDrugList.size(); i++) {
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
List<Integer> integers = new ArrayList<>(); List<Integer> integers = new ArrayList<>();
@ -408,6 +432,29 @@ public class UdiContrastService {
} }
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.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.setPackLevel(1 + "");
//生产厂家
udiProductEntity.setManufactory(thirdAliDrug.getManufacturer());
//商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(thirdAliDrug.getPrepnUnitName());
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit()); udiProductEntity.setXjdw(ybDrug.getMinUnit());
if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) { if (DimaUtil.trMinCount(thirdAliDrug.getBzgg()) != null) {
@ -426,10 +473,6 @@ public class UdiContrastService {
udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductEntity.setId(IdUtil.getSnowflakeNextId());
udiProductService.insertUdiInfo(udiProductEntity); udiProductService.insertUdiInfo(udiProductEntity);
} }
} else {
udiProductService.insertUdiInfo(udiProductEntity);
}
// setLevel(udiRelevanceEntity.getUuid()); // setLevel(udiRelevanceEntity.getUuid());
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid); udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);

@ -60,6 +60,7 @@ public class AlihealthUtils {
//// AlibabaAlihealthDrugtraceTopLsydQueryRelationResponse alibabaAlihealthDrugtraceTopLsydQueryRelationResponse //// AlibabaAlihealthDrugtraceTopLsydQueryRelationResponse alibabaAlihealthDrugtraceTopLsydQueryRelationResponse
// //
// } // }
/** /**
* *
* *
@ -98,12 +99,13 @@ public class AlihealthUtils {
} }
} }
/** /**
* *
* *
* @param alihealthThirdAliDrugInsertReqeust * @param alihealthThirdAliDrugInsertReqeust
*/ */
public BaseResponse<List<ThirdAliDrug>> thirdAliDrugInsert(AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) { public BaseResponse<List<ThirdAliDrug>> thirdAliDrugInsert(AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust, Boolean callBool) {
if (alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust() == null) { if (alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust() == null) {
return ResultVOUtils.error("入参不能为空"); return ResultVOUtils.error("入参不能为空");
} }
@ -132,6 +134,21 @@ public class AlihealthUtils {
List<ThirdAliDrug> list = alihealthKytDrugrescodeResponse.disposeThirdAliDrugList(alihealthThirdAliDrugInsertReqeust.getErpId()); List<ThirdAliDrug> list = alihealthKytDrugrescodeResponse.disposeThirdAliDrugList(alihealthThirdAliDrugInsertReqeust.getErpId());
return ResultVOUtils.success(list); return ResultVOUtils.success(list);
} else { } else {
// 重新上传标识为true就改变一下
if ("未查询到相关信息".equals(alihealthKytDrugrescodeResponse.getMsg_info())
&& callBool) {
String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name();
if (physicName.contains("(")) {
physicName = physicName.replace("(", "").replace(")", "");
} else if (physicName.contains("")) {
physicName = physicName.replace("", "(").replace("", ")");
}
alihealthKytDrugrescodeReqeust.setPhysic_name(physicName);
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust, false);
}
return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info()); return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info());
} }
@ -176,7 +193,7 @@ public class AlihealthUtils {
public Map disposeSign(AlihealthKytCommonParametersReqeust alihealthKytCommonParametersReqeust, String secret) { public Map disposeSign(AlihealthKytCommonParametersReqeust alihealthKytCommonParametersReqeust, String secret) {
Map<String,Object> map = BeanUtil.beanToMap(alihealthKytCommonParametersReqeust); Map<String, Object> map = BeanUtil.beanToMap(alihealthKytCommonParametersReqeust);
String sign; String sign;
try { try {
sign = new AlihealthUtils().signTopRequest(map, secret, "md5"); sign = new AlihealthUtils().signTopRequest(map, secret, "md5");
@ -189,7 +206,7 @@ public class AlihealthUtils {
} }
public String signTopRequest(Map<String,Object> params, String secret, String signMethod) throws IOException { public String signTopRequest(Map<String, Object> params, String secret, String signMethod) throws IOException {
// 第一步:检查参数是否已经排序 // 第一步:检查参数是否已经排序
String[] keys = params.keySet().toArray(new String[0]); String[] keys = params.keySet().toArray(new String[0]);
Arrays.sort(keys); Arrays.sort(keys);
@ -201,11 +218,11 @@ public class AlihealthUtils {
} }
for (String key : keys) { for (String key : keys) {
Object value = params.get(key); Object value = params.get(key);
if(value instanceof String){ if (value instanceof String) {
if ( StringUtils.areNotEmpty(key, (String) value)) { if (StringUtils.areNotEmpty(key, (String) value)) {
query.append(key).append(value); query.append(key).append(value);
} }
}else { } else {
if (!Objects.isNull(value)) { if (!Objects.isNull(value)) {
query.append(key).append(value); query.append(key).append(value);
} }

Loading…
Cancel
Save