From 3c98cf98e35ab35471ba5fa95562f0ad46b495d3 Mon Sep 17 00:00:00 2001 From: qiuyt Date: Tue, 7 Jan 2025 11:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=BF=E9=87=8C=E8=8D=AF=E5=93=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=20=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=88=B0=E5=B0=B1?= =?UTF-8?q?=E5=8E=BB=E6=9F=A5=E9=98=BF=E9=87=8C=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=87=A0=E4=B8=AA=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collect/ThirdAliDrugController.java | 41 ++++++++++++++++++- .../mapper/collect/ThirdAliDrugMapper.xml | 6 +++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java index 20bee6a..1189062 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/collect/ThirdAliDrugController.java @@ -1,16 +1,21 @@ package com.glxp.udidl.admin.controller.collect; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.pagehelper.PageInfo; import com.glxp.udidl.admin.entity.collect.ThirdAliDrug; import com.glxp.udidl.admin.enums.ResultEnum; +import com.glxp.udidl.admin.req.alihealth.AlihealthKytDrugrescodeReqeust; +import com.glxp.udidl.admin.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust; import com.glxp.udidl.admin.req.collect.ThirdAliDrugAddRequest; import com.glxp.udidl.admin.req.collect.ThirdAliDrugRequest; import com.glxp.udidl.admin.res.BaseResponse; import com.glxp.udidl.admin.res.PageSimpleResponse; import com.glxp.udidl.admin.service.collect.ThirdAliDrugService; import com.glxp.udidl.admin.util.ResultVOUtils; +import com.glxp.udidl.admin.util.alihealth.AlihealthUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -20,6 +25,7 @@ import javax.validation.Valid; import java.util.List; @RestController +@Slf4j public class ThirdAliDrugController { @Resource @@ -30,7 +36,8 @@ public class ThirdAliDrugController { thirdAliDrugService.addThirdAliDrug(relCodeBatchRequest); return ResultVOUtils.success("添加成功!"); } - + @Resource + private AlihealthUtils alihealthUtils; @GetMapping("/udiwms/aliDrug/getDrugLevelList") public BaseResponse getDrugLevelList(ThirdAliDrugRequest thirdAliDrug, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -40,11 +47,41 @@ public class ThirdAliDrugController { if (StrUtil.isEmpty(thirdAliDrug.getApprovalNum()) && StrUtil.isEmpty(thirdAliDrug.getNameCode()) && StrUtil.isEmpty(thirdAliDrug.getCpmctymc())&& - StrUtil.isEmpty(thirdAliDrug.getManufacturer()) + StrUtil.isEmpty(thirdAliDrug.getManufacturer())&& + StrUtil.isEmpty(thirdAliDrug.getFormSpec())&& + StrUtil.isEmpty(thirdAliDrug.getBzgg()) ) { return ResultVOUtils.success("查询参数不能为空"); } List list = thirdAliDrugService.filterList(thirdAliDrug); + if (CollUtil.isEmpty(list)){ + ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest(); + List add = null; + AlihealthThirdAliDrugInsertReqeust request = new AlihealthThirdAliDrugInsertReqeust(); + AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust(); + alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc()); + alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum()); + alihealthKytDrugrescodeReqeust.setEnt_name(thirdAliDrug.getManufacturer()); + alihealthKytDrugrescodeReqeust.setPackage_spec(thirdAliDrug.getBzgg()); + alihealthKytDrugrescodeReqeust.setPrepn_spec(thirdAliDrug.getFormSpec()); + + request.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust); + try { + BaseResponse> baseResponse = alihealthUtils.thirdAliDrugInsertAll(request); + if(baseResponse.getCode() == 20000){ + add = baseResponse.getData(); + }else { + log.error("阿里访问失败==="+baseResponse.getMessage()); + } + }catch (Exception e){ + log.error("阿里访问失败==="+e.getMessage()); + } + + thirdAliDrugAddRequest.setList(add); + thirdAliDrugService.addThirdAliDrug(thirdAliDrugAddRequest); + list = thirdAliDrugService.filterList(thirdAliDrug); + + } PageInfo pageInfo = new PageInfo<>(list); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); diff --git a/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml b/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml index 973d060..c10b727 100644 --- a/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml +++ b/src/main/resources/mybatis/mapper/collect/ThirdAliDrugMapper.xml @@ -94,6 +94,12 @@ AND manufacturer = #{manufacturer} + + AND formSpec LIKE concat('%', #{formSpec}, '%') + + + AND bzgg LIKE concat('%', #{bzgg}, '%') +