|
|
|
@ -187,4 +187,47 @@ public class ThirdAliDrugService extends ServiceImpl<ThirdAliDrugMapper, ThirdAl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ThirdAliDrug> updateByCpmctymc(String cpmctymc) {
|
|
|
|
|
|
|
|
|
|
ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest();
|
|
|
|
|
// TODO: 2025/1/4 这里用调用的 入参 cpmctymc
|
|
|
|
|
List<ThirdAliDrug> add = null;
|
|
|
|
|
AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust();
|
|
|
|
|
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
|
|
|
|
|
alihealthKytDrugrescodeReqeust.setPhysic_name(cpmctymc);
|
|
|
|
|
request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
|
|
|
|
|
|
|
|
|
// key组装
|
|
|
|
|
AuthAliUser authAliUser = authAliUserService.getOne();
|
|
|
|
|
|
|
|
|
|
//增加次数限制
|
|
|
|
|
Integer drugResCodeCount = authAliUser.getDrugResCodeCount();
|
|
|
|
|
Integer drugResCodeCountMax = authAliUser.getDrugResCodeCountMax();
|
|
|
|
|
if (drugResCodeCount >= drugResCodeCountMax){
|
|
|
|
|
throw new JsonException("当前系统调用阿里药品数据查询接口最大次数已达到,禁止访问,如需访问请联系管理员增加访问次数!");
|
|
|
|
|
}
|
|
|
|
|
drugResCodeCount = drugResCodeCount + 1;
|
|
|
|
|
authAliUser.setDrugResCodeCount(drugResCodeCount);
|
|
|
|
|
authAliUserService.updateById(authAliUser);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request);
|
|
|
|
|
if(baseResponse.getCode() == 20000){
|
|
|
|
|
add = baseResponse.getData();
|
|
|
|
|
}else {
|
|
|
|
|
log.error("阿里访问失败==="+baseResponse.getMessage());
|
|
|
|
|
throw new JsonException(baseResponse.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("阿里访问失败==="+e.getMessage());
|
|
|
|
|
throw new JsonException("阿里访问失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(add)){
|
|
|
|
|
thirdAliDrugAddRequest.setList(add);
|
|
|
|
|
this.addThirdAliDrug(thirdAliDrugAddRequest);
|
|
|
|
|
}
|
|
|
|
|
return add;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|