1、选入药品调用国家库或者阿里接口进行拉取药品码段数据插入我们的表

2、医保接口也没有的时候也调用接口
3、key使用阿里用户表获取
dev_unify
qiuyt 4 months ago
parent a240f24839
commit 42785d87a5

@ -21,6 +21,7 @@ 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;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -110,6 +111,7 @@ public class AlihealthBusController {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("国家库查询阿里产品访问出现错误==="+e.getMessage()); log.error("国家库查询阿里产品访问出现错误==="+e.getMessage());
} }
if(thirdAliDrugsListGjk!= null && thirdAliDrugsListGjk.size() >0){ if(thirdAliDrugsListGjk!= null && thirdAliDrugsListGjk.size() >0){
@ -121,7 +123,7 @@ public class AlihealthBusController {
thirdAliDrugListNew = baseResponse.getData(); thirdAliDrugListNew = baseResponse.getData();
}else { }else {
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
throw new JsonException(500, "阿里接口未查到产品信息"); return ResultVOUtils.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
} }
// 上传到国家库 // 上传到国家库
@ -132,6 +134,7 @@ public class AlihealthBusController {
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());
} }
return ResultVOUtils.success(thirdAliDrugListNew); return ResultVOUtils.success(thirdAliDrugListNew);

@ -9,7 +9,7 @@ import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust; import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust;
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.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliSearchbillInsertReqeust; import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust;
import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse;
import com.glxp.api.service.collect.RelCodeBatchService; import com.glxp.api.service.collect.RelCodeBatchService;
import com.glxp.api.service.collect.RelCodeDetailService; import com.glxp.api.service.collect.RelCodeDetailService;
@ -112,14 +112,14 @@ public class TestCodeController {
} }
} }
return baseResponse;
return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); // return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
} }
@PostMapping("/test2") @PostMapping("/test2")
public BaseResponse test2() { public BaseResponse test2() {
AlihealthThirdAliSearchbillInsertReqeust alihealthThirdAliSearchbillInsertReqeust = new AlihealthThirdAliSearchbillInsertReqeust(); AlihealthKytThirdAliSearchbillInsertReqeust alihealthKytThirdAliSearchbillInsertReqeust = new AlihealthKytThirdAliSearchbillInsertReqeust();
alihealthThirdAliSearchbillInsertReqeust.setErpId("123"); alihealthKytThirdAliSearchbillInsertReqeust.setErpId("123");
alihealthThirdAliSearchbillInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); alihealthKytThirdAliSearchbillInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01");
AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = new AlihealthKytSearchbillReqeust(); AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = new AlihealthKytSearchbillReqeust();
alihealthKytSearchbillReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytSearchbillReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0");
alihealthKytSearchbillReqeust.setAuth_ref_user_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytSearchbillReqeust.setAuth_ref_user_id("ef99b78bd9c54c1284f813149c858fb0");
@ -131,7 +131,7 @@ public class TestCodeController {
alihealthKytSearchbillReqeust.setApp_key("31721223"); alihealthKytSearchbillReqeust.setApp_key("31721223");
alihealthThirdAliSearchbillInsertReqeust.setAlihealthKytSearchbillReqeust(alihealthKytSearchbillReqeust); alihealthKytThirdAliSearchbillInsertReqeust.setAlihealthKytSearchbillReqeust(alihealthKytSearchbillReqeust);
// BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); // BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust);
// if(baseResponse.getCode() == 20000){ // if(baseResponse.getCode() == 20000){
// List<ThirdAliDrug> list = baseResponse.getData(); // List<ThirdAliDrug> list = baseResponse.getData();
@ -152,6 +152,6 @@ public class TestCodeController {
// //
// } // }
return alihealthUtils.thirdAliSearchbillInsert(alihealthThirdAliSearchbillInsertReqeust); return alihealthUtils.thirdAliSearchbillInsert(alihealthKytThirdAliSearchbillInsertReqeust);
} }
} }

@ -0,0 +1,8 @@
package com.glxp.api.dao.auth;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.AuthAliUser;
public interface AuthAliUserDao extends BaseMapperPlus<AuthAliUser, AuthAliUser, AuthAliUser> {
}

@ -0,0 +1,37 @@
package com.glxp.api.entity.auth;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthAliUser {
private Long id;
/**
* ID
*/
private String erpid;
/**
* KEY
*/
private String appkey;
/**
*
*/
private String appsecret;
/**
*
*/
private String refentid;
/**
* 1 2
*/
private String type;
}

@ -1,11 +1,10 @@
package com.glxp.api.req.alihealth.local; package com.glxp.api.req.alihealth.local;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust; import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust;
import lombok.Data; import lombok.Data;
@Data @Data
public class AlihealthThirdAliSearchbillInsertReqeust { public class AlihealthKytThirdAliSearchbillInsertReqeust {
private String erpId; private String erpId;
private String appSecret; private String appSecret;
private AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust; private AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust;

@ -63,7 +63,7 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter
// thirdAliDrug.setId(); // thirdAliDrug.setId();
thirdAliDrugShare.setType(jsonObject.getStr("physic_type")); thirdAliDrugShare.setType(jsonObject.getStr("physic_type"));
thirdAliDrugShare.setManufacturer(jsonObject.getStr("ent_name")); thirdAliDrugShare.setManufacturer(jsonObject.getStr("ent_name"));
thirdAliDrugShare.setCpmctymc(jsonObject.getStr("physic_name")); thirdAliDrugShare.setCpmctymc(jsonObject.getStr("physic_name").trim());
thirdAliDrugShare.setForm(jsonObject.getStr("prepn_type_desc")); thirdAliDrugShare.setForm(jsonObject.getStr("prepn_type_desc"));
thirdAliDrugShare.setSpmc(jsonObject.getStr("prod_name")); thirdAliDrugShare.setSpmc(jsonObject.getStr("prod_name"));
thirdAliDrugShare.setErpId(erpId); thirdAliDrugShare.setErpId(erpId);
@ -82,7 +82,7 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter
BeanUtils.copyProperties(thirdAliDrugShare,thirdAliDrugShareTwo); BeanUtils.copyProperties(thirdAliDrugShare,thirdAliDrugShareTwo);
thirdAliDrugShareTwo.setFormSpec(oubType.getStr("prepn_spec")); thirdAliDrugShareTwo.setFormSpec(oubType.getStr("prepn_spec"));
thirdAliDrugShareTwo.setBzgg(oubType.getStr("package_spec")); thirdAliDrugShareTwo.setBzgg(oubType.getStr("package_spec"));
thirdAliDrugShareTwo.setApprovalNum(oubType.getStr("approve_no")); thirdAliDrugShareTwo.setApprovalNum(oubType.getStr("approve_no").trim());
thirdAliDrugShareTwo.setPrepnUnit(oubType.getStr("prepn_unit")); thirdAliDrugShareTwo.setPrepnUnit(oubType.getStr("prepn_unit"));
thirdAliDrugShareTwo.setPrepnUnitName(oubType.getStr("prepn_unit_name")); thirdAliDrugShareTwo.setPrepnUnitName(oubType.getStr("prepn_unit_name"));
@ -90,16 +90,20 @@ public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParameter
if (oubType.containsKey("code_res_list")) { if (oubType.containsKey("code_res_list")) {
List<JSONObject> codeReslist = (List) oubType.getJSONObject("code_res_list").getJSONArray("code_res_list"); JSONObject jsonObjectCodeRes = oubType.getJSONObject("code_res_list");
for (JSONObject codeRes : codeReslist) { if(jsonObjectCodeRes.containsKey("code_res_list")){
ThirdAliDrug thirdAliDrug = new ThirdAliDrug(); List<JSONObject> codeReslist = (List) jsonObjectCodeRes.getJSONArray("code_res_list");
BeanUtils.copyProperties(thirdAliDrugShareTwo,thirdAliDrug); for (JSONObject codeRes : codeReslist) {
// 码有值才加入 ThirdAliDrug thirdAliDrug = new ThirdAliDrug();
thirdAliDrug.setNameCode(codeRes.getStr("res_code")); BeanUtils.copyProperties(thirdAliDrugShareTwo,thirdAliDrug);
thirdAliDrug.setPackRatio(codeRes.getStr("pkg_ratio")); // 码有值才加入
thirdAliDrug.setPackLevel(StringUtils.isEmpty(codeRes.getStr("code_level")) ? "0" : codeRes.getStr("code_level")); thirdAliDrug.setNameCode(codeRes.getStr("res_code"));
list.add(thirdAliDrug); thirdAliDrug.setPackRatio(codeRes.getStr("pkg_ratio"));
thirdAliDrug.setPackLevel(StringUtils.isEmpty(codeRes.getStr("code_level")) ? null: codeRes.getStr("code_level"));
list.add(thirdAliDrug);
}
} }
} }
} }
} }

@ -0,0 +1,25 @@
package com.glxp.api.service.auth;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.auth.AuthAliUserDao;
import com.glxp.api.entity.auth.AuthAliUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class AuthAliUserService extends ServiceImpl<AuthAliUserDao, AuthAliUser> {
@Resource
private AuthAliUserDao authAliUserDao;
public AuthAliUser getOne(){
AuthAliUser authAliUser = this.getOne(new QueryWrapper<AuthAliUser>()
.last("limit 1")
);
if(authAliUser == null){
authAliUser = new AuthAliUser();
}
return authAliUser;
}
}

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.constant.ConstantStatus; import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.auth.AuthAliUser;
import com.glxp.api.entity.auth.CustomerInfoEntity; import com.glxp.api.entity.auth.CustomerInfoEntity;
import com.glxp.api.entity.basic.UdiProductEntity; import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.basic.UdiRelevanceEntity;
@ -27,6 +28,7 @@ import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest; import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest;
import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.auth.AuthAliUserService;
import com.glxp.api.service.auth.CustomerInfoService; import com.glxp.api.service.auth.CustomerInfoService;
import com.glxp.api.service.auth.CustomerService; import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.thrsys.BasicInsMaterialService; import com.glxp.api.service.thrsys.BasicInsMaterialService;
@ -78,6 +80,8 @@ public class UdiContrastService {
private AlihealthUtils alihealthUtils; private AlihealthUtils alihealthUtils;
@Value("${UDI_SERVER_URL}") @Value("${UDI_SERVER_URL}")
private String udiUrl; private String udiUrl;
@Resource
private AuthAliUserService authAliUserService;
public boolean isExit(String originUuid, String mainId, String thirdSys) { public boolean isExit(String originUuid, String mainId, String thirdSys) {
@ -260,6 +264,29 @@ public class UdiContrastService {
UdiProductEntity udiProductEntity = new UdiProductEntity(); UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity); BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
YbDrug ybDrug=new YbDrug(); YbDrug ybDrug=new YbDrug();
// 数据处理
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);
//设置包装级别
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) { if (list != null && list.size() > 0) {
ybDrug = list.get(0); ybDrug = list.get(0);
// 数据做处理好查询阿里接口 // 数据做处理好查询阿里接口
@ -268,9 +295,6 @@ public class UdiContrastService {
ybDrug.setApprovalCode(charArr[0]); ybDrug.setApprovalCode(charArr[0]);
} }
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
// udiProductEntity.setNameCode(thrProductsEntity.getCode()); // udiProductEntity.setNameCode(thrProductsEntity.getCode());
udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook()); udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook());
udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode()); udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode());
@ -285,51 +309,17 @@ public class UdiContrastService {
udiProductEntity.setPackUnit(ybDrug.getUnit()); udiProductEntity.setPackUnit(ybDrug.getUnit());
//设置最小产品数量 //设置最小产品数量
udiProductEntity.setBhxjsl(ybDrug.getFactor()); udiProductEntity.setBhxjsl(ybDrug.getFactor());
//设置包装级别
udiProductEntity.setPackLevel(1 + "");
//生产厂家 //生产厂家
udiProductEntity.setManufactory(ybDrug.getCompanyNameSc()); udiProductEntity.setManufactory(ybDrug.getCompanyNameSc());
//商品条码 essentialDrugMarkName sptm //商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense()); // udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel()); udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel());
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);
} else { } 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(
@ -371,28 +361,40 @@ public class UdiContrastService {
}else { }else {
List<ThirdAliDrug> thirdAliDrugListNew = null; List<ThirdAliDrug> thirdAliDrugListNew = null;
AuthAliUser authAliUser = authAliUserService.getOne();
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
alihealthThirdAliDrugInsertReqeust.setErpId("73157692795424"); alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc()); alihealthKytDrugrescodeReqeust.setPhysic_name(udiProductEntity.getCpmctymc());
alihealthKytDrugrescodeReqeust.setApproval_licence_no(udiProductEntity.getZczbhhzbapzbh()); 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(authAliUser.getAppkey());
alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true); try {
if(baseResponse.getCode() == 20000){ BaseResponse<List<ThirdAliDrug>> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust,true);
thirdAliDrugListNew = baseResponse.getData(); if(baseResponse.getCode() == 20000){
thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); thirdAliDrugListNew = baseResponse.getData();
if(thirdAliDrugService.addOrUpdate(thirdAliDrugListNew)){
}else {
udiProductService.insertUdiInfo(udiProductEntity); }else {
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); log.error("阿里接口未查到产品信息===");
udiProductService.insertUdiInfo(udiProductEntity);
}
}else {
log.error("阿里接口未查到产品信息==="+baseResponse.getMessage());
udiProductService.insertUdiInfo(udiProductEntity);
// throw new JsonException(500, "阿里接口未查到产品信息"); // throw new JsonException(500, "阿里接口未查到产品信息");
}
}catch (Exception e){
log.error("阿里接口查询产品信息出现错误==="+e.getMessage());
udiProductService.insertUdiInfo(udiProductEntity);
} }
if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){ if(thirdAliDrugListNew!=null && thirdAliDrugListNew.size() > 0 ){
try { try {
// 上传到国家库 // 上传到国家库
@ -462,7 +464,7 @@ public class UdiContrastService {
} else } else
udiProductEntity.setBhxjsl(ybDrug.getFactor()); udiProductEntity.setBhxjsl(ybDrug.getFactor());
} }
if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel().equals("0")) { if (thirdAliDrug.getPackLevel() != null && !thirdAliDrug.getPackLevel().equals("0")) {
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
} else { } else {
udiProductEntity.setDiType(1); udiProductEntity.setDiType(1);

@ -22,7 +22,9 @@ public class DimaUtil {
// 存储每层级的倍数关系 // 存储每层级的倍数关系
List<Integer> calculatedLevels = new ArrayList<>(); List<Integer> calculatedLevels = new ArrayList<>();
for (int i = levels.length - 1; i > 0; i--) { for (int i = levels.length - 1; i > 0; i--) {
calculatedLevels.add(levels[i] / levels[i - 1]); if(levels[i - 1] > 0){
calculatedLevels.add(levels[i] / levels[i - 1]);
}
} }
// 最后加上最小单位(第一层级为 1 // 最后加上最小单位(第一层级为 1
@ -33,7 +35,6 @@ public class DimaUtil {
for (int i = calculatedLevels.size() - 1; i >= 0; i--) { for (int i = calculatedLevels.size() - 1; i >= 0; i--) {
reversed.add(calculatedLevels.get(i)); reversed.add(calculatedLevels.get(i));
} }
return reversed; return reversed;
} }

@ -12,7 +12,7 @@ import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust;
import com.glxp.api.req.alihealth.AlihealthKytSinglerelationReqeust; import com.glxp.api.req.alihealth.AlihealthKytSinglerelationReqeust;
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.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliSearchbillInsertReqeust; import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust;
import com.glxp.api.res.alihealth.AlihealthKytDrugrescodeResponse; import com.glxp.api.res.alihealth.AlihealthKytDrugrescodeResponse;
import com.glxp.api.res.alihealth.AlihealthKytSearchbillResponse; import com.glxp.api.res.alihealth.AlihealthKytSearchbillResponse;
import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse;
@ -64,22 +64,22 @@ public class AlihealthUtils {
/** /**
* *
* *
* @param alihealthThirdAliDrugInsertReqeust * @param alihealthKytThirdAliSearchbillInsertReqeust
*/ */
public BaseResponse<List<ThirdAliDrug>> thirdAliSearchbillInsert(AlihealthThirdAliSearchbillInsertReqeust alihealthThirdAliDrugInsertReqeust) { public BaseResponse<List<ThirdAliDrug>> thirdAliSearchbillInsert(AlihealthKytThirdAliSearchbillInsertReqeust alihealthKytThirdAliSearchbillInsertReqeust) {
if (alihealthThirdAliDrugInsertReqeust.getAlihealthKytSearchbillReqeust() == null) { if (alihealthKytThirdAliSearchbillInsertReqeust.getAlihealthKytSearchbillReqeust() == null) {
return ResultVOUtils.error("入参不能为空"); return ResultVOUtils.error("入参不能为空");
} }
AlihealthKytSearchbillResponse alihealthKytDrugrescodeResponse = null; AlihealthKytSearchbillResponse alihealthKytDrugrescodeResponse = null;
AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytSearchbillReqeust(); AlihealthKytSearchbillReqeust alihealthKytSearchbillReqeust = alihealthKytThirdAliSearchbillInsertReqeust.getAlihealthKytSearchbillReqeust();
if (alihealthKytSearchbillReqeust != null if (alihealthKytSearchbillReqeust != null
&& org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytSearchbillReqeust.getApp_key()) && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytSearchbillReqeust.getApp_key())
&& org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getAppSecret()) && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytThirdAliSearchbillInsertReqeust.getAppSecret())
) { ) {
try { try {
Map map = alihealthUtils.disposeSign(alihealthKytSearchbillReqeust, alihealthThirdAliDrugInsertReqeust.getAppSecret()); Map map = alihealthUtils.disposeSign(alihealthKytSearchbillReqeust, alihealthKytThirdAliSearchbillInsertReqeust.getAppSecret());
String json = HttpUtil.get(alihealthUrl, map); String json = HttpUtil.get(alihealthUrl, map);
alihealthKytDrugrescodeResponse = new AlihealthKytSearchbillResponse(json); alihealthKytDrugrescodeResponse = new AlihealthKytSearchbillResponse(json);
@ -92,7 +92,7 @@ public class AlihealthUtils {
return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空"); return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空");
} }
if (alihealthKytDrugrescodeResponse.judgeCall()) { if (alihealthKytDrugrescodeResponse.judgeCall()) {
List<ThirdAliSearchbill> list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthThirdAliDrugInsertReqeust.getErpId()); List<ThirdAliSearchbill> list = alihealthKytDrugrescodeResponse.disposeThirdAliSearchbill(alihealthKytThirdAliSearchbillInsertReqeust.getErpId());
return ResultVOUtils.success(list); return ResultVOUtils.success(list);
} else { } else {
return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info()); return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info());
@ -134,10 +134,11 @@ 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 {
String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name();
// 重新上传标识为true就改变一下 // 重新上传标识为true就改变一下
if ("未查询到相关信息".equals(alihealthKytDrugrescodeResponse.getMsg_info()) if ("未查询到相关信息".equals(alihealthKytDrugrescodeResponse.getMsg_info())
&& callBool) { && callBool && (physicName.contains("(") || physicName.contains(""))) {
String physicName = alihealthKytDrugrescodeReqeust.getPhysic_name();
if (physicName.contains("(")) { if (physicName.contains("(")) {
physicName = physicName.replace("(", "").replace(")", ""); physicName = physicName.replace("(", "").replace(")", "");

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.auth.AuthAliUserDao">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.auth.AuthAliUser">
<!--@mbg.generated-->
<!--@Table auth_ali_user-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="erpId" jdbcType="INTEGER" property="erpid" />
<result column="appKey" jdbcType="VARCHAR" property="appkey" />
<result column="appSecret" jdbcType="VARCHAR" property="appsecret" />
<result column="refEntId" jdbcType="VARCHAR" property="refentid" />
<result column="type" jdbcType="VARCHAR" property="type" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, erpId, appKey, appSecret, refEntId, `type`
</sql>
</mapper>

@ -1229,3 +1229,13 @@ CALL Pro_Temp_ColumnWork('third_ali_drug', 'physicTypeDesc',
CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName', CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName',
' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''包装单位''', ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''包装单位''',
1); 1);
CREATE TABLE IF NOT EXISTS `auth_ali_user` (
`id` bigint NOT NULL,
`erpId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '第三方ID',
`appKey` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里KEY',
`appSecret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '阿里密钥',
`refEntId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '厂家标识',
`type` varchar(255) DEFAULT NULL COMMENT '1 为生成企业 2为零售药店',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Loading…
Cancel
Save