阿里药品相关

查询不到就去查阿里新增
增加几个查询条件
v3
qiuyt 3 months ago
parent 6096150bdf
commit 3c98cf98e3

@ -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<ThirdAliDrug> list = thirdAliDrugService.filterList(thirdAliDrug);
if (CollUtil.isEmpty(list)){
ThirdAliDrugAddRequest thirdAliDrugAddRequest = new ThirdAliDrugAddRequest();
List<ThirdAliDrug> 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<List<ThirdAliDrug>> 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<ThirdAliDrug> pageInfo = new PageInfo<>(list);
PageSimpleResponse<ThirdAliDrug> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());

@ -94,6 +94,12 @@
<if test="manufacturer != '' and manufacturer != null">
AND manufacturer = #{manufacturer}
</if>
<if test="formSpec != '' and formSpec != null">
AND formSpec LIKE concat('%', #{formSpec}, '%')
</if>
<if test="bzgg != '' and bzgg != null">
AND bzgg LIKE concat('%', #{bzgg}, '%')
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save