From 864ec46a6e54246f921e6e87f31844a2c53c4125 Mon Sep 17 00:00:00 2001 From: qiuyt Date: Fri, 29 Nov 2024 16:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E7=94=A8=E9=98=BF?= =?UTF-8?q?=E9=87=8C=E6=9F=A5=E8=AF=A2=E8=8D=AF=E5=93=81=E7=A0=81=E6=AE=B5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E9=80=89=E5=85=A5=E8=8D=AF=E5=93=81?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E5=88=A4=E6=96=AD=E5=9B=BD=E5=AE=B6=E5=BA=93?= =?UTF-8?q?=E6=9C=89=E6=B2=A1=E6=9C=89=E6=9C=89=E5=B0=B1=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=20=E6=B2=A1=E6=9C=89=E5=B0=B1=E5=8E=BB=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E9=98=BF=E9=87=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 + .../alihealth/AlihealthBusController.java | 8 +- .../basic/UdiContrastController.java | 3 +- .../controller/test/TestCodeController.java | 52 ++++++- .../glxp/api/entity/thrsys/ThirdAliDrug.java | 37 ++++- .../AlihealthKytDrugrescodeReqeust.java | 24 +++ .../AlihealthRelCodeInsertReqeust.java | 2 +- .../AlihealthThirdAliDrugInsertReqeust.java | 11 ++ .../AlihealthKytCommonParametersResponse.java | 8 +- .../AlihealthKytDrugrescodeResponse.java | 111 ++++++++++++++ .../glxp/api/service/CustomServiceImpl.java | 4 + .../api/service/basic/UdiContrastService.java | 145 +++++++++++++++--- .../service/collect/RelCodeBatchService.java | 3 +- .../java/com/glxp/api/service/thrsys/App.java | 74 +++++++++ .../service/thrsys/ThirdAliDrugService.java | 23 +++ .../api/util/alihealth/AlihealthUtils.java | 122 ++++++++++----- src/main/resources/schemas/schema_v2.4.sql | 20 +++ 17 files changed, 577 insertions(+), 77 deletions(-) create mode 100644 src/main/java/com/glxp/api/req/alihealth/AlihealthKytDrugrescodeReqeust.java rename src/main/java/com/glxp/api/req/alihealth/{ => local}/AlihealthRelCodeInsertReqeust.java (87%) create mode 100644 src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliDrugInsertReqeust.java create mode 100644 src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java create mode 100644 src/main/java/com/glxp/api/service/thrsys/App.java diff --git a/pom.xml b/pom.xml index be65ec0b..0098507c 100644 --- a/pom.xml +++ b/pom.xml @@ -400,6 +400,13 @@ system ${pom.basedir}/src/main/resources/lib/alicode-1.0.jar + + + org.javassist + javassist + 3.28.0-GA + + 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 0282e1fb..3bf1f0a6 100644 --- a/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java +++ b/src/main/java/com/glxp/api/controller/alihealth/AlihealthBusController.java @@ -1,23 +1,17 @@ package com.glxp.api.controller.alihealth; import cn.hutool.http.HttpUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.glxp.api.annotation.Log; -import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.BusinessType; -import com.glxp.api.entity.collect.RelCodeBatch; import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust; -import com.glxp.api.req.alihealth.AlihealthRelCodeInsertReqeust; -import com.glxp.api.req.system.DeleteRequest; -import com.glxp.api.req.thrsys.AuthCompanyRequest; +import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse; import com.glxp.api.util.alihealth.AlihealthUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; -import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; diff --git a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java index 1f6e7dcf..6a426ad7 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java @@ -12,6 +12,7 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.AsyncDiDlHelper; import com.glxp.api.constant.BusinessType; import com.glxp.api.constant.ConstantStatus; +import com.glxp.api.controller.BaseController; import com.glxp.api.entity.basic.CompanyProductRelevanceEntity; import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.basic.UdiProductEntity; @@ -50,7 +51,7 @@ import java.util.List; * 耗材字典关联相关接口 */ @RestController -public class UdiContrastController { +public class UdiContrastController{ @Resource NmpaUdiClient udiDlHttpClient; diff --git a/src/main/java/com/glxp/api/controller/test/TestCodeController.java b/src/main/java/com/glxp/api/controller/test/TestCodeController.java index b6875391..365e3b0d 100644 --- a/src/main/java/com/glxp/api/controller/test/TestCodeController.java +++ b/src/main/java/com/glxp/api/controller/test/TestCodeController.java @@ -1,20 +1,70 @@ package com.glxp.api.controller.test; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.entity.collect.RelCodeBatch; +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.service.thrsys.ThirdAliDrugService; import com.glxp.api.util.alihealth.AlihealthUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Objects; @RestController public class TestCodeController { @Resource private AlihealthUtils alihealthUtils; - + @Resource + private ThirdAliDrugService thirdAliDrugService; // @PostMapping("/test") // public BaseResponse test() { // return alihealthUtils.relCodeInsert("73157692795424", "88979920013901715365"); // } + @PostMapping("/test1") + public BaseResponse test() { + AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); + alihealthThirdAliDrugInsertReqeust.setErpId("123"); + alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); + AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); + alihealthKytDrugrescodeReqeust.setPhysic_name("苯巴比妥片"); +// alihealthKytDrugrescodeReqeust.setApproval_licence_no(); +// alihealthKytDrugrescodeReqeust.setStart_date(); +// alihealthKytDrugrescodeReqeust.setEnd_date(); +// alihealthKytDrugrescodeReqeust.setEnt_name(); +// alihealthKytDrugrescodeReqeust.setPackage_spec(); +// alihealthKytDrugrescodeReqeust.setPrepn_spec(); + alihealthKytDrugrescodeReqeust.setPage_size(20); + alihealthKytDrugrescodeReqeust.setPage(1); + alihealthKytDrugrescodeReqeust.setApp_key("31721223"); + alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); + alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); + BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); + if(baseResponse.getCode() == 20000){ + List list = baseResponse.getData(); + if(list!=null && list.size() >0){ + for (ThirdAliDrug thirdAliDrug : list) { + ThirdAliDrug thirdAliDrugNew = thirdAliDrugService.getOne(new QueryWrapper().eq("nameCode", thirdAliDrug.getNameCode()) + .last("limit 1") + ); + if (Objects.isNull(thirdAliDrugNew)) { + + thirdAliDrugService.save(thirdAliDrug); + + } else { + thirdAliDrugService.update(thirdAliDrug, new QueryWrapper().eq("nameCode", thirdAliDrug.getNameCode())); + } + } + } + + } + + return alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); + } } diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java b/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java index 64c34ba2..3861eae4 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThirdAliDrug.java @@ -123,7 +123,42 @@ public class ThirdAliDrug implements Serializable { @ApiModelProperty(value = "更新时间") private Date updateTime; - + /** + * 制剂单位描述 + */ + @TableField(value = "prepnUnit") + @ApiModelProperty(value = "制剂单位描述") + private String prepnUnit; + /** + * 制剂单位描述 + */ + @TableField(value = "prepnUnitName") + @ApiModelProperty(value = "制剂单位描述") + private String prepnUnitName; + /** + * 药品详情类型 + */ + @TableField(value = "physicDetailType") + @ApiModelProperty(value = "药品详情类型") + private String physicDetailType; + /** + * 药品类型详情描述 + */ + @TableField(value = "physicDetailTypeDesc") + @ApiModelProperty(value = "药品类型详情描述") + private String physicDetailTypeDesc; + /** + * 药品类型描述 + */ + @TableField(value = "physicTypeDesc") + @ApiModelProperty(value = "药品类型描述") + private String physicTypeDesc; + /** + * 包装单位 + */ + @TableField(value = "packUnitName") + @ApiModelProperty(value = "包装单位") + private String packUnitName; private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/glxp/api/req/alihealth/AlihealthKytDrugrescodeReqeust.java b/src/main/java/com/glxp/api/req/alihealth/AlihealthKytDrugrescodeReqeust.java new file mode 100644 index 00000000..20772d31 --- /dev/null +++ b/src/main/java/com/glxp/api/req/alihealth/AlihealthKytDrugrescodeReqeust.java @@ -0,0 +1,24 @@ +package com.glxp.api.req.alihealth; + +import io.swagger.models.auth.In; +import lombok.Data; + +@Data +public class AlihealthKytDrugrescodeReqeust extends AlihealthKytCommonParametersReqeust { + private String ref_ent_id; + private String physic_name; + private String approval_licence_no; + private String start_date; + private String end_date; + private String ent_name; + private String package_spec; + + private String prepn_spec; + private Integer page_size; + private Integer page; + + + public AlihealthKytDrugrescodeReqeust(){ + this.setMethod("alibaba.alihealth.drug.kyt.drugrescode"); + } +} diff --git a/src/main/java/com/glxp/api/req/alihealth/AlihealthRelCodeInsertReqeust.java b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthRelCodeInsertReqeust.java similarity index 87% rename from src/main/java/com/glxp/api/req/alihealth/AlihealthRelCodeInsertReqeust.java rename to src/main/java/com/glxp/api/req/alihealth/local/AlihealthRelCodeInsertReqeust.java index 1d99e94d..29120197 100644 --- a/src/main/java/com/glxp/api/req/alihealth/AlihealthRelCodeInsertReqeust.java +++ b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthRelCodeInsertReqeust.java @@ -1,4 +1,4 @@ -package com.glxp.api.req.alihealth; +package com.glxp.api.req.alihealth.local; import lombok.Data; diff --git a/src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliDrugInsertReqeust.java b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliDrugInsertReqeust.java new file mode 100644 index 00000000..7fae9155 --- /dev/null +++ b/src/main/java/com/glxp/api/req/alihealth/local/AlihealthThirdAliDrugInsertReqeust.java @@ -0,0 +1,11 @@ +package com.glxp.api.req.alihealth.local; + +import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; +import lombok.Data; + +@Data +public class AlihealthThirdAliDrugInsertReqeust { + private String erpId; + private String appSecret; + private AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust; +} diff --git a/src/main/java/com/glxp/api/res/alihealth/AlihealthKytCommonParametersResponse.java b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytCommonParametersResponse.java index 1c7545fa..82ccfbc6 100644 --- a/src/main/java/com/glxp/api/res/alihealth/AlihealthKytCommonParametersResponse.java +++ b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytCommonParametersResponse.java @@ -3,6 +3,7 @@ package com.glxp.api.res.alihealth; import cn.hutool.json.JSONObject; import com.alibaba.fastjson.JSONArray; import lombok.Data; +import org.apache.commons.lang.StringUtils; import org.apache.poi.ss.formula.functions.T; import java.util.Map; @@ -14,6 +15,11 @@ public class AlihealthKytCommonParametersResponse { private String response_success; - + public boolean judgeCall(){ + if(StringUtils.isNotEmpty(this.getMsg_info()) && this.getMsg_info().equals("调用成功")){ + return true; + } + return false; + } } diff --git a/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java new file mode 100644 index 00000000..2e8cc933 --- /dev/null +++ b/src/main/java/com/glxp/api/res/alihealth/AlihealthKytDrugrescodeResponse.java @@ -0,0 +1,111 @@ +package com.glxp.api.res.alihealth; + +import java.util.Date; + +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.glxp.api.entity.collect.RelCodeDetail; +import com.glxp.api.entity.thrsys.ThirdAliDrug; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Data +public class AlihealthKytDrugrescodeResponse extends AlihealthKytCommonParametersResponse { + private Integer total_num; + private JSONArray drug_table_dto; + private Integer page; + private Integer page_size; + + public AlihealthKytDrugrescodeResponse(String json) { + // 初始化请求的值 + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(json); + JSONObject jsonObjectResult = null; + for (String s : jsonObject.keySet()) { + jsonObjectResult = jsonObject.getJSONObject(s).getJSONObject("result"); + + } + AlihealthKytCommonParametersResponse alihealthKytCommonParametersResponse = JSONUtil.toBean(jsonObjectResult.toString(), + AlihealthKytCommonParametersResponse.class); + BeanUtils.copyProperties(alihealthKytCommonParametersResponse, this); + if (StringUtils.isNotEmpty(this.getMsg_info()) + && this.getMsg_info().equals("调用成功") + ) { + this.disposeResult(jsonObjectResult); + } + + } + + public void disposeResult(JSONObject jsonObjectResult) { + JSONObject jsonObjectModel = jsonObjectResult.getJSONObject("model"); + if (!Objects.isNull(jsonObjectModel)) { + this.setTotal_num(jsonObjectModel.getInt("total_num")); + this.setDrug_table_dto(jsonObjectModel.getJSONObject("result_list").getJSONArray("drug_table_dto")); + this.setPage(jsonObjectModel.getInt("page")); + this.setPage_size(jsonObjectModel.getInt("page_size")); + + } + } + + public List disposeThirdAliDrugList(String erpId) { + List list = new ArrayList<>(); + List jsonArray = (List) this.getDrug_table_dto(); + if (jsonArray != null && jsonArray.size() > 0) { + for (JSONObject jsonObject : jsonArray) { + if (!Objects.isNull(jsonObject)) { + ThirdAliDrug thirdAliDrugShare = new ThirdAliDrug(); +// thirdAliDrug.setId(); + thirdAliDrugShare.setType(jsonObject.getStr("physic_type")); + thirdAliDrugShare.setManufacturer(jsonObject.getStr("ent_name")); + thirdAliDrugShare.setCpmctymc(jsonObject.getStr("physic_name")); + thirdAliDrugShare.setForm(jsonObject.getStr("prepn_type_desc")); + thirdAliDrugShare.setSpmc(jsonObject.getStr("prod_name")); + thirdAliDrugShare.setErpId(erpId); + thirdAliDrugShare.setCreateTime(new Date()); + thirdAliDrugShare.setUpdateTime(new Date()); + + thirdAliDrugShare.setPhysicDetailType(jsonObject.getStr("physic_detail_type")); + thirdAliDrugShare.setPhysicDetailTypeDesc(jsonObject.getStr("physic_detail_type_desc")); + thirdAliDrugShare.setPhysicTypeDesc(jsonObject.getStr("physic_type_desc")); + // 阿里额外的字段 prepn_unit prepn_unit_name physic_detail_type physic_detail_type_desc physic_type_desc + ; + List jsonArraySubType = (List) jsonObject.getJSONObject("sub_type_list").getJSONArray("sub_type_list"); + if (jsonArraySubType != null && jsonArraySubType.size() > 0) { + for (JSONObject oubType : jsonArraySubType) { + ThirdAliDrug thirdAliDrugShareTwo = new ThirdAliDrug(); + BeanUtils.copyProperties(thirdAliDrugShare,thirdAliDrugShareTwo); + thirdAliDrugShareTwo.setFormSpec(oubType.getStr("prepn_spec")); + thirdAliDrugShareTwo.setBzgg(oubType.getStr("package_spec")); + thirdAliDrugShareTwo.setApprovalNum(oubType.getStr("approve_no")); + + thirdAliDrugShareTwo.setPrepnUnit(oubType.getStr("prepn_unit")); + thirdAliDrugShareTwo.setPrepnUnitName(oubType.getStr("prepn_unit_name")); + thirdAliDrugShareTwo.setPackUnitName(oubType.getStr("pack_unit_name")); + + + if (oubType.containsKey("code_res_list")) { + List codeReslist = (List) oubType.getJSONObject("code_res_list").getJSONArray("code_res_list"); + for (JSONObject codeRes : codeReslist) { + ThirdAliDrug thirdAliDrug = new ThirdAliDrug(); + BeanUtils.copyProperties(thirdAliDrugShareTwo,thirdAliDrug); + // 码有值才加入 + thirdAliDrug.setNameCode(codeRes.getStr("res_code")); + thirdAliDrug.setPackRatio(codeRes.getStr("pkg_ratio")); + thirdAliDrug.setPackLevel(StringUtils.isEmpty(codeRes.getStr("code_level")) ? "0" : codeRes.getStr("code_level")); + list.add(thirdAliDrug); + } + } + } + } + } + } + } + return list; + } +} diff --git a/src/main/java/com/glxp/api/service/CustomServiceImpl.java b/src/main/java/com/glxp/api/service/CustomServiceImpl.java index d398bd11..f21355ca 100644 --- a/src/main/java/com/glxp/api/service/CustomServiceImpl.java +++ b/src/main/java/com/glxp/api/service/CustomServiceImpl.java @@ -26,4 +26,8 @@ public class CustomServiceImpl, T> extends Servi public boolean replaceBatch(List entityList) { return baseMapper.replaceBatchs(entityList); } + + public static void main(String[] args) { + + } } 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 8fbe1219..39fdf6e4 100644 --- a/src/main/java/com/glxp/api/service/basic/UdiContrastService.java +++ b/src/main/java/com/glxp/api/service/basic/UdiContrastService.java @@ -3,6 +3,12 @@ package com.glxp.api.service.basic; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +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.conditions.query.QueryWrapper; +import com.glxp.api.common.res.BaseResponse; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.entity.basic.UdiProductEntity; @@ -10,32 +16,38 @@ import com.glxp.api.entity.basic.UdiRelevanceEntity; import com.glxp.api.entity.thrsys.*; import com.glxp.api.exception.JsonException; import com.glxp.api.http.NmpaUdiClient; +import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; +import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust; 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.ThrInsDrugFeeRequest; import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest; +import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.service.thrsys.BasicInsMaterialService; import com.glxp.api.service.thrsys.ThirdAliDrugService; import com.glxp.api.service.thrsys.ThrProductsService; import com.glxp.api.service.thrsys.YbDrugService; import com.glxp.api.util.*; +import com.glxp.api.util.alihealth.AlihealthUtils; import com.glxp.api.util.udi.UdiInfoUtil; +import lombok.extern.slf4j.Slf4j; import org.jfree.util.Log; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; /** * 耗材字典对照 */ @Service +@Slf4j public class UdiContrastService { @Resource @@ -55,6 +67,10 @@ public class UdiContrastService { BasicInsMaterialService basicInsMaterialService; @Resource YbDrugService ybDrugService; + @Resource + private AlihealthUtils alihealthUtils; + @Value("${UDI_SERVER_URL}") + private String udiUrl; public boolean isExit(String originUuid, String mainId, String thirdSys) { @@ -204,7 +220,7 @@ public class UdiContrastService { @Resource ThirdAliDrugService thirdAliDrugService; - + @Transactional public void createOnlyMainId(String mainId) { FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); filterThrProductsRequest.setCode(mainId); @@ -275,35 +291,118 @@ public class UdiContrastService { } udiProductEntity.setUpdateTime(new Date()); udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); - List thirdAliDrugList = thirdAliDrugService.findByByApproved(ybDrug.getApprovalCode()); + + List thirdAliDrugList = thirdAliDrugService.list( + new QueryWrapper() + .eq(StringUtils.isNotEmpty(thrProductsEntity.getName()),"cpmctymc",thrProductsEntity.getName()) + .eq(StringUtils.isNotEmpty(thrProductsEntity.getZczbhhzbapzbh()),"approvalNum",thrProductsEntity.getZczbhhzbapzbh()) + ); if (CollUtil.isNotEmpty(thirdAliDrugList)) { - for (int i = 0; i < thirdAliDrugList.size(); i++) { - ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); - List integers = new ArrayList<>(); - if (StrUtil.isNotEmpty(thirdAliDrug.getPackRatio())) { - integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio()); + + } else { + Map map = new HashMap(); + if(StringUtils.isNotEmpty(thrProductsEntity.getName())){ + map.put("cpmctymc",thrProductsEntity.getName()); + + } + if(StringUtils.isNotEmpty(thrProductsEntity.getZczbhhzbapzbh())){ + map.put("approvalNum",thrProductsEntity.getZczbhhzbapzbh()); + + } + List thirdAliDrugsListGjk = null; + + try { + String response = HttpUtil.get(udiUrl+"/udiwms/aliDrug/getDrugLevelList",map); + BaseResponse> udiDlDeviceResponse = + JSONObject.parseObject(response, new TypeReference>>() { + + }); + if (udiDlDeviceResponse != null) { + // 查询国家库是否有值 有值直接返回没值查询阿里接口 + thirdAliDrugsListGjk = udiDlDeviceResponse.getData().getList(); + + + } + } catch (Exception e) { + log.error("国家库查询阿里产品访问出现错误==="+e.getMessage()); + } + + if(thirdAliDrugService.addOrUpdate(thirdAliDrugsListGjk)){ + + }else { + List thirdAliDrugListNew; + AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust(); + alihealthThirdAliDrugInsertReqeust.setErpId("123"); + alihealthThirdAliDrugInsertReqeust.setAppSecret("5231c601505706a9d49823c3dfe2cb01"); + AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); + alihealthKytDrugrescodeReqeust.setPhysic_name(thrProductsEntity.getName()); + alihealthKytDrugrescodeReqeust.setApproval_licence_no(thrProductsEntity.getZczbhhzbapzbh()); + alihealthKytDrugrescodeReqeust.setPage_size(100); + alihealthKytDrugrescodeReqeust.setPage(1); + alihealthKytDrugrescodeReqeust.setApp_key("31721223"); + alihealthKytDrugrescodeReqeust.setRef_ent_id("ef99b78bd9c54c1284f813149c858fb0"); + alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); + BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsert(alihealthThirdAliDrugInsertReqeust); + if(baseResponse.getCode() == 20000){ + thirdAliDrugListNew = baseResponse.getData(); + thirdAliDrugService.addOrUpdate(thirdAliDrugListNew); + }else { + log.error("阿里接口未查到产品信息==="+baseResponse.getMessage()); + throw new JsonException(500, "阿里接口未查到产品信息"); + } - 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()); + 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()); } - udiProductEntity.setNameCode(thirdAliDrug.getNameCode()); - if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { - udiProductEntity.setXjdw(ybDrug.getMinUnit()); - udiProductEntity.setBhxjsl(ybDrug.getFactor()); - } + } + +// udiProductService.insertUdiInfo(udiProductEntity); + } + thirdAliDrugList = thirdAliDrugService.list( + new QueryWrapper() + .eq(StringUtils.isNotEmpty(thrProductsEntity.getName()),"cpmctymc",thrProductsEntity.getName()) + .eq(StringUtils.isNotEmpty(thrProductsEntity.getZczbhhzbapzbh()),"approvalNum",thrProductsEntity.getZczbhhzbapzbh()) + ); + for (int i = 0; i < thirdAliDrugList.size(); i++) { + ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i); + 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.setNameCode(thirdAliDrug.getNameCode()); + if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) { + udiProductEntity.setXjdw(ybDrug.getMinUnit()); + udiProductEntity.setBhxjsl(ybDrug.getFactor()); + } + if (thirdAliDrug.getPackLevel() != null || !thirdAliDrug.getPackLevel() .equals("0") ){ udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4); - udiProductEntity.setId(IdUtil.getSnowflakeNextId()); - udiProductService.insertUdiInfo(udiProductEntity); + }else { + udiProductEntity.setDiType(1); } - } else { + udiProductEntity.setXjdw(thirdAliDrug.getPrepnUnitName()); + udiProductEntity.setPackUnit(thirdAliDrug.getPackUnitName()); + + udiProductEntity.setId(IdUtil.getSnowflakeNextId()); udiProductService.insertUdiInfo(udiProductEntity); } } + // setLevel(udiRelevanceEntity.getUuid()); UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid()); udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid); diff --git a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java index 9c9e0097..d497e285 100644 --- a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java +++ b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java @@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; import com.glxp.api.common.res.BaseResponse; -import com.glxp.api.dao.basic.BasicProductsDao; import com.glxp.api.dao.collect.RelCodeBatchMapper; import com.glxp.api.dao.inout.IoCodeTempDao; import com.glxp.api.entity.auth.AuthAdmin; @@ -27,7 +26,7 @@ import com.glxp.api.entity.collect.RelCodeDetail; import com.glxp.api.entity.inout.IoCodeTempEntity; import com.glxp.api.entity.sync.SyncDataSetEntity; import com.glxp.api.exception.JsonException; -import com.glxp.api.req.alihealth.AlihealthRelCodeInsertReqeust; +import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; import com.glxp.api.req.collect.RelCodeBatchRequest; import com.glxp.api.req.collect.RelCodeDetailRequest; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; diff --git a/src/main/java/com/glxp/api/service/thrsys/App.java b/src/main/java/com/glxp/api/service/thrsys/App.java new file mode 100644 index 00000000..51ab8af9 --- /dev/null +++ b/src/main/java/com/glxp/api/service/thrsys/App.java @@ -0,0 +1,74 @@ +package com.glxp.api.service.thrsys; + +import javassist.ClassPool; +import javassist.CtClass; +import javassist.CtMethod; + +public class App { + public static void main(String[] args) { + try { + ClassPool pool = ClassPool.getDefault(); + // 此处改为你实际的的 MyBatisCodeHelper-Pro-obfuss.jar 的路径 + pool.insertClassPath("C:\\Users\\Lenovo\\AppData\\Roaming\\JetBrains\\IntelliJIdea2023.2\\plugins\\MyBatisCodeHelper-Pro\\lib\\MyBatisCodeHelper-Pro-obfuss.jar"); + // 通过绝对定位,加载指定的类 + CtClass cc = pool.get("com.ccnode.codegenerator.Y.e.e"); + + // 获取validTo的get方法 + // public Long e() + CtMethod getValidToMethod = cc.getDeclaredMethod("a"); + + // 获取validTo的set方法的参数:Long + CtClass[] params = new CtClass[]{pool.get("java.lang.Long")}; + + // 获取validTo的set方法 + // public void a(Long l2) + CtMethod setValidToMethod = cc.getDeclaredMethod("a", params); + + // 获取valid的set方法的参数:Boolean + CtClass[] params1 = new CtClass[]{pool.get("java.lang.Boolean")}; + // 获取Valid的set方法 + // public void a(Boolean bl) + CtMethod setValidMethod = cc.getDeclaredMethod("a", params1); + + // 获取valid的get方法 + // public Boolean b() + CtMethod getValidMethod = cc.getDeclaredMethod("e"); + + // 修改validTo的get方法 + // 直接返回4797976044000 + StringBuilder builder = new StringBuilder(); + builder.append("{") + .append(" return new Long(4797976044000L);") + .append("}"); + getValidToMethod.setBody(builder.toString()); + + // 修改validTo的set方法 + // 直接设为4797976044000 + StringBuilder builder1 = new StringBuilder(); + builder1.append("{") + .append(" this.a = new Long(4797976044000L);") + .append("}"); + setValidToMethod.setBody(builder1.toString()); + + // 修改valid的set方法 + // 设为True + String getValidMethodBuilder = "{" + + " return Boolean.TRUE;" + + "}"; + getValidMethod.setBody(getValidMethodBuilder); + + // 修改valid的get方法 + // 直接返回True + String setValidMethodBuilder = "{" + + "this.c = Boolean.TRUE;" + + "}"; + setValidMethod.setBody(setValidMethodBuilder); + + // 将修改后的Class b写入指定文件夹 + cc.writeFile("C:\\Users\\Lenovo\\Desktop\\第三方\\a"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} + diff --git a/src/main/java/com/glxp/api/service/thrsys/ThirdAliDrugService.java b/src/main/java/com/glxp/api/service/thrsys/ThirdAliDrugService.java index 76e6a784..b12a8a6e 100644 --- a/src/main/java/com/glxp/api/service/thrsys/ThirdAliDrugService.java +++ b/src/main/java/com/glxp/api/service/thrsys/ThirdAliDrugService.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.glxp.api.exception.JsonException; import com.glxp.api.req.thrsys.ThirdAliDrugRequest; @@ -244,4 +245,26 @@ public class ThirdAliDrugService extends ServiceImpl findByByApproved(String approvalNum) { return this.baseMapper.selectList(new LambdaQueryWrapper().eq(ThirdAliDrug::getApprovalNum, approvalNum)); } + + public boolean addOrUpdate(List list) { + if(list!=null && list.size() >0){ + for (ThirdAliDrug thirdAliDrug : list) { + ThirdAliDrug thirdAliDrugNew = this.getOne(new QueryWrapper().eq("nameCode", thirdAliDrug.getNameCode()) + .last("limit 1") + ); + if (Objects.isNull(thirdAliDrugNew)) { + + this.save(thirdAliDrug); + + } else { + this.update(thirdAliDrug, new QueryWrapper().eq("nameCode", thirdAliDrug.getNameCode())); + } + } + return true; + + }else { + return false; + } + } + } 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 f3fce6a9..409c30d1 100644 --- a/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java +++ b/src/main/java/com/glxp/api/util/alihealth/AlihealthUtils.java @@ -2,29 +2,21 @@ package com.glxp.api.util.alihealth; import cn.hutool.core.bean.BeanUtil; import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONUtil; -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.dao.collect.RelCodeDetailMapper; -import com.glxp.api.entity.auth.CustomerInfoEntity; -import com.glxp.api.entity.collect.RelCodeBatch; -import com.glxp.api.entity.collect.RelCodeDetail; +import com.glxp.api.entity.thrsys.ThirdAliDrug; import com.glxp.api.req.alihealth.AlihealthKytCommonParametersReqeust; -import com.glxp.api.req.alihealth.AlihealthKytGetentinfoReqeust; +import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust; import com.glxp.api.req.alihealth.AlihealthKytSinglerelationReqeust; -import com.glxp.api.req.alihealth.AlihealthRelCodeInsertReqeust; -import com.glxp.api.res.alihealth.AlihealthKytCommonParametersResponse; -import com.glxp.api.res.alihealth.AlihealthKytGetentinfoResponse; +import com.glxp.api.req.alihealth.local.AlihealthRelCodeInsertReqeust; +import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust; +import com.glxp.api.res.alihealth.AlihealthKytDrugrescodeResponse; import com.glxp.api.res.alihealth.AlihealthKytSinglerelationResponse; import com.glxp.api.service.auth.CustomerInfoService; import com.glxp.api.service.collect.RelCodeBatchService; import com.glxp.api.service.collect.RelCodeDetailService; import com.taobao.api.Constants; import com.taobao.api.internal.util.StringUtils; -import com.taobao.api.response.AlibabaAlihealthDrugtraceTopLsydQueryRelationResponse; -import io.swagger.models.auth.In; -import org.apache.poi.ss.formula.functions.T; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -36,10 +28,10 @@ import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.MessageDigest; -import java.text.SimpleDateFormat; import java.util.*; import static com.taobao.api.internal.util.TaobaoUtils.byte2hex; + @Component public class AlihealthUtils { @Resource @@ -52,7 +44,8 @@ public class AlihealthUtils { private RelCodeBatchService relCodeBatchService; @Value("${ALIHEALTH_URL:http://gw.api.taobao.com/router/rest}") private String alihealthUrl; -// public static void main(String[] args) { + + // public static void main(String[] args) { // // alihealthKytSinglerelationReqeust.setSign(sign); // String ss = HttpUtil.get("http://gw.api.taobao.com/router/rest",BeanUtil.beanToMap(alihealthKytSinglerelationReqeust)); @@ -64,58 +57,98 @@ public class AlihealthUtils { // // } + /** + * 查询药品码段信息 + * + * @param alihealthThirdAliDrugInsertReqeust + */ + public BaseResponse> thirdAliDrugInsert(AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust) { + if (alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust() == null) { + return ResultVOUtils.error("入参不能为空"); + } + AlihealthKytDrugrescodeResponse alihealthKytDrugrescodeResponse = null; + AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = alihealthThirdAliDrugInsertReqeust.getAlihealthKytDrugrescodeReqeust(); + + if (alihealthKytDrugrescodeReqeust != null + && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytDrugrescodeReqeust.getApp_key()) + && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthThirdAliDrugInsertReqeust.getAppSecret()) + ) { + try { + + Map map = alihealthUtils.disposeSign(alihealthKytDrugrescodeReqeust, alihealthThirdAliDrugInsertReqeust.getAppSecret()); + String json = HttpUtil.get(alihealthUrl, map); + alihealthKytDrugrescodeResponse = new AlihealthKytDrugrescodeResponse(json); + + } catch (Exception e) { + e.printStackTrace(); + return ResultVOUtils.error("阿里健康接口调用失败===" + e.getMessage()); + } + + } else { + return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空"); + } + if (alihealthKytDrugrescodeResponse.judgeCall()) { + List list = alihealthKytDrugrescodeResponse.disposeThirdAliDrugList(alihealthThirdAliDrugInsertReqeust.getErpId()); + return ResultVOUtils.success(list); + } else { + return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytDrugrescodeResponse.getMsg_info()); + + } + } + //TODO 调用阿里接口用码进行批量处理只测试了两个包装层级的 暂时没有三个包装层级的数据做测试 到时候有数据之后要好好测试一下 @Transactional(rollbackFor = Exception.class) - public BaseResponse relCodeInsert(AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust){ + public BaseResponse relCodeInsert(AlihealthRelCodeInsertReqeust alihealthRelCodeInsertReqeust) { AlihealthKytSinglerelationResponse alihealthKytSinglerelationResponse = null; - if(alihealthRelCodeInsertReqeust != null + if (alihealthRelCodeInsertReqeust != null && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthRelCodeInsertReqeust.getAppKey()) && org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthRelCodeInsertReqeust.getAppSecret()) - ){ + ) { try { - AlihealthKytSinglerelationReqeust alihealthKytSinglerelationReqeust =new AlihealthKytSinglerelationReqeust(); + AlihealthKytSinglerelationReqeust alihealthKytSinglerelationReqeust = new AlihealthKytSinglerelationReqeust(); alihealthKytSinglerelationReqeust.setRef_ent_id(alihealthRelCodeInsertReqeust.getRefEntId()); alihealthKytSinglerelationReqeust.setDes_ref_ent_id(alihealthRelCodeInsertReqeust.getRefEntId()); alihealthKytSinglerelationReqeust.setCode(alihealthRelCodeInsertReqeust.getCode()); alihealthKytSinglerelationReqeust.setApp_key(alihealthRelCodeInsertReqeust.getAppKey()); - Map map = alihealthUtils.disposeSign(alihealthKytSinglerelationReqeust,alihealthRelCodeInsertReqeust.getAppSecret()); - String json = HttpUtil.get(alihealthUrl,map); - alihealthKytSinglerelationResponse =new AlihealthKytSinglerelationResponse(json); + Map map = alihealthUtils.disposeSign(alihealthKytSinglerelationReqeust, alihealthRelCodeInsertReqeust.getAppSecret()); + String json = HttpUtil.get(alihealthUrl, map); + alihealthKytSinglerelationResponse = new AlihealthKytSinglerelationResponse(json); - }catch (Exception e){ - return ResultVOUtils.error("阿里健康接口调用失败===请检查厂商的key和密文是否对"); + } catch (Exception e) { + return ResultVOUtils.error("阿里健康接口调用失败===" + e.getMessage()); } - }else { + } else { return ResultVOUtils.error("阿里健康接口调用失败===用户找不到或者key和秘钥为空"); } - if(org.apache.commons.lang3.StringUtils.isNotEmpty(alihealthKytSinglerelationResponse.getMsg_info()) - && alihealthKytSinglerelationResponse.getMsg_info().equals("调用成功") - ){ + if (alihealthKytSinglerelationResponse.judgeCall()) { + alihealthKytSinglerelationResponse.setRefEntId(alihealthRelCodeInsertReqeust.getRefEntId()); - return ResultVOUtils.success(alihealthKytSinglerelationResponse ); - }else { - return ResultVOUtils.error("阿里健康接口调用失败==="+alihealthKytSinglerelationResponse.getMsg_info()); + return ResultVOUtils.success(alihealthKytSinglerelationResponse); + } else { + return ResultVOUtils.error("阿里健康接口调用失败===" + alihealthKytSinglerelationResponse.getMsg_info()); } } - public Map disposeSign(AlihealthKytCommonParametersReqeust alihealthKytCommonParametersReqeust, String secret){ - Map map = BeanUtil.beanToMap(alihealthKytCommonParametersReqeust); + public Map disposeSign(AlihealthKytCommonParametersReqeust alihealthKytCommonParametersReqeust, String secret) { + + Map map = BeanUtil.beanToMap(alihealthKytCommonParametersReqeust); String sign; try { sign = new AlihealthUtils().signTopRequest(map, secret, "md5"); alihealthKytCommonParametersReqeust.setSign(sign); - return BeanUtil.beanToMap(alihealthKytCommonParametersReqeust); + return BeanUtil.beanToMap(alihealthKytCommonParametersReqeust); } catch (IOException e) { } return null; } - public String signTopRequest(Map params, String secret, String signMethod) throws IOException { + + public String signTopRequest(Map params, String secret, String signMethod) throws IOException { // 第一步:检查参数是否已经排序 String[] keys = params.keySet().toArray(new String[0]); Arrays.sort(keys); @@ -126,10 +159,18 @@ public class AlihealthUtils { query.append(secret); } for (String key : keys) { - String value = params.get(key); - if (StringUtils.areNotEmpty(key, value)) { + Object value = params.get(key); + if(value instanceof String){ + if ( StringUtils.areNotEmpty(key, (String) value)) { + query.append(key).append(value); + } + }else { + if (!Objects.isNull(value)) { query.append(key).append(value); } + } +// StringUtils.areNotEmpty(key, value) + } @@ -146,7 +187,7 @@ public class AlihealthUtils { return byte2hex(bytes); } - public byte[] encryptHMAC(String data, String secret) throws IOException { + public byte[] encryptHMAC(String data, String secret) throws IOException { byte[] bytes = null; try { SecretKey secretKey = new SecretKeySpec(secret.getBytes(Constants.CHARSET_UTF8), "HmacMD5"); @@ -159,10 +200,11 @@ public class AlihealthUtils { return bytes; } - public byte[] encryptMD5(String data) throws IOException { + public byte[] encryptMD5(String data) throws IOException { return encryptMD5(data.getBytes(Constants.CHARSET_UTF8)); } - public byte[] encryptMD5(byte[] data) throws IOException { + + public byte[] encryptMD5(byte[] data) throws IOException { byte[] bytes = null; try { MessageDigest md = MessageDigest.getInstance("MD5"); diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 419fa617..ac803b71 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -1209,3 +1209,23 @@ CALL Pro_Temp_ColumnWork('customer_info', 'refEntId', 1); INSERT ignore INTO `sys_param_config` (`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`, `paramType`, `paramExplain`, `updateTime`) VALUES (20100, 0, '是否全部维护关联关系', 'warning_relCode_switch', '1', 1, 0, '0:否;1:是', NULL); + + +CALL Pro_Temp_ColumnWork('third_ali_drug', 'prepnUnit', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''制剂单位描述''', + 1); +CALL Pro_Temp_ColumnWork('third_ali_drug', 'prepnUnitName', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''制剂单位描述''', + 1); +CALL Pro_Temp_ColumnWork('third_ali_drug', 'physicDetailType', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''药品详情类型''', + 1); +CALL Pro_Temp_ColumnWork('third_ali_drug', 'physicDetailTypeDesc ', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''药品类型详情描述''', + 1); +CALL Pro_Temp_ColumnWork('third_ali_drug', 'physicTypeDesc', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''药品类型描述''', + 1); +CALL Pro_Temp_ColumnWork('third_ali_drug', 'packUnitName', + ' varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT ''包装单位''', + 1);