从供应商选入药品选入药品层级功能搬到内网
parent
5c04226f78
commit
03fd8680bf
@ -0,0 +1,150 @@
|
|||||||
|
package com.glxp.api.controller.thrsys;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.annotation.CusRedissonAnnotation;
|
||||||
|
import com.glxp.api.annotation.RepeatSubmit;
|
||||||
|
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.RedissonCacheKey;
|
||||||
|
import com.glxp.api.controller.BaseController;
|
||||||
|
import com.glxp.api.entity.auth.AuthAliUser;
|
||||||
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
||||||
|
import com.glxp.api.entity.thrsys.ThirdAliDrug;
|
||||||
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
||||||
|
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
|
||||||
|
import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.service.auth.AuthAliUserService;
|
||||||
|
import com.glxp.api.service.basic.UdiProductService;
|
||||||
|
import com.glxp.api.service.thrsys.ThirdAliDrugService;
|
||||||
|
import com.glxp.api.util.StringUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class ThirdAliDrugController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ThirdAliDrugService thirdAliDrugService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AuthAliUserService authAliUserService;
|
||||||
|
@Resource
|
||||||
|
private UdiProductService udiProductService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SpGetHttpClient spGetHttpClient;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/aliDrug/getDrugLevelList")
|
||||||
|
public BaseResponse getDrugLevelList(ThirdAliDrugRequest thirdAliDrug, BindingResult bindingResult) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(thirdAliDrug.getApprovalNum()) && StrUtil.isEmpty(thirdAliDrug.getNameCode()) &&
|
||||||
|
StrUtil.isEmpty(thirdAliDrug.getCpmctymc()) && StrUtil.isEmpty(thirdAliDrug.getManufacturer())
|
||||||
|
) {
|
||||||
|
return ResultVOUtils.success("查询参数不能为空");
|
||||||
|
}
|
||||||
|
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
|
||||||
|
filterUdiRelRequest.setUuid(thirdAliDrug.getUuid());
|
||||||
|
List<UdiProductEntity> udiInfoEntities = udiProductService.filterAllUdiInfo(filterUdiRelRequest);
|
||||||
|
List<String> nameCodeIn = new ArrayList<>();
|
||||||
|
if(udiInfoEntities!=null && udiInfoEntities.size() >0){
|
||||||
|
for (UdiProductEntity udiInfoEntity : udiInfoEntities) {
|
||||||
|
if(StringUtils.isNotEmpty(udiInfoEntity.getNameCode())){
|
||||||
|
nameCodeIn.add(udiInfoEntity.getNameCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
thirdAliDrug.setNameCodeIn(nameCodeIn);
|
||||||
|
List<ThirdAliDrug> list = thirdAliDrugService.filterList(thirdAliDrug);
|
||||||
|
if(list == null || list.size() == 0){
|
||||||
|
AuthAliUser authAliUser = authAliUserService.getOne();
|
||||||
|
AlihealthThirdAliDrugInsertReqeust alihealthThirdAliDrugInsertReqeust = new AlihealthThirdAliDrugInsertReqeust();
|
||||||
|
alihealthThirdAliDrugInsertReqeust.setErpId(authAliUser.getErpid());
|
||||||
|
alihealthThirdAliDrugInsertReqeust.setAppSecret(authAliUser.getAppsecret());
|
||||||
|
alihealthThirdAliDrugInsertReqeust.setManufactory(thirdAliDrug.getManufacturer());
|
||||||
|
AlihealthKytDrugrescodeReqeust alihealthKytDrugrescodeReqeust = new AlihealthKytDrugrescodeReqeust();
|
||||||
|
alihealthKytDrugrescodeReqeust.setPhysic_name(thirdAliDrug.getCpmctymc());
|
||||||
|
alihealthKytDrugrescodeReqeust.setApproval_licence_no(thirdAliDrug.getApprovalNum());
|
||||||
|
alihealthKytDrugrescodeReqeust.setPage_size(100);
|
||||||
|
alihealthKytDrugrescodeReqeust.setPage(1);
|
||||||
|
alihealthKytDrugrescodeReqeust.setApp_key(authAliUser.getAppkey());
|
||||||
|
alihealthKytDrugrescodeReqeust.setRef_ent_id(authAliUser.getRefentid());
|
||||||
|
alihealthThirdAliDrugInsertReqeust.setAlihealthKytDrugrescodeReqeust(alihealthKytDrugrescodeReqeust);
|
||||||
|
try {
|
||||||
|
BaseResponse baseResponse = spGetHttpClient.thirdAliDrugList(alihealthThirdAliDrugInsertReqeust);
|
||||||
|
if (baseResponse.getCode() == 20000) {
|
||||||
|
|
||||||
|
|
||||||
|
if (thirdAliDrugService.addOrUpdate((List) baseResponse.getData())) {
|
||||||
|
list = thirdAliDrugService.filterList(thirdAliDrug);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.info("供应商平台获取阿里和国家库码段信息===未查到产品信息");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
|
||||||
|
// udiProductEntity.setBasicPrductRemak8("供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage());
|
||||||
|
// error = "供应商平台获取阿里和国家库码段信息出现错误===" + baseResponse.getMessage();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.info("供应商平台获取阿里和国家库码段信息出现错误===" + e.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageInfo<ThirdAliDrug> pageInfo = new PageInfo<>(list);
|
||||||
|
PageSimpleResponse<ThirdAliDrug> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(list);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/aliDrug/getDrugLevelListBycode")
|
||||||
|
public BaseResponse getDrugLevelListBycode(ThirdAliDrugRequest thirdAliDrug, BindingResult bindingResult) {
|
||||||
|
String nameCode = thirdAliDrug.getNameCode();
|
||||||
|
if (StrUtil.isEmpty(nameCode)) {
|
||||||
|
return ResultVOUtils.error("标识参数不能为空");
|
||||||
|
}
|
||||||
|
ThirdAliDrug one = thirdAliDrugService.getOne(new LambdaQueryWrapper<ThirdAliDrug>().eq(ThirdAliDrug::getNameCode, nameCode));
|
||||||
|
if (one == null) {
|
||||||
|
return ResultVOUtils.error("标识参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ThirdAliDrug> list = thirdAliDrugService.list(new LambdaQueryWrapper<ThirdAliDrug>()
|
||||||
|
.eq(ThirdAliDrug::getApprovalNum, one.getApprovalNum())
|
||||||
|
.eq(ThirdAliDrug::getCpmctymc, one.getCpmctymc())
|
||||||
|
.eq(ThirdAliDrug::getForm, one.getForm())
|
||||||
|
.eq(ThirdAliDrug::getBzgg, one.getBzgg())
|
||||||
|
.eq(ThirdAliDrug::getPackRatio, one.getPackRatio()));
|
||||||
|
|
||||||
|
return ResultVOUtils.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
<?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.thrsys.ThirdAliDrugMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThirdAliDrug">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table third_ali_drug-->
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||||
|
<result column="manufacturer" jdbcType="VARCHAR" property="manufacturer"/>
|
||||||
|
<result column="cpmctymc" jdbcType="VARCHAR" property="cpmctymc"/>
|
||||||
|
<result column="form" jdbcType="VARCHAR" property="form"/>
|
||||||
|
<result column="formSpec" jdbcType="VARCHAR" property="formSpec"/>
|
||||||
|
<result column="bzgg" jdbcType="VARCHAR" property="bzgg"/>
|
||||||
|
<result column="spmc" jdbcType="VARCHAR" property="spmc"/>
|
||||||
|
<result column="nameCode" jdbcType="VARCHAR" property="nameCode"/>
|
||||||
|
<result column="packRatio" jdbcType="VARCHAR" property="packRatio"/>
|
||||||
|
<result column="packLevel" jdbcType="VARCHAR" property="packLevel"/>
|
||||||
|
<result column="erpId" jdbcType="VARCHAR" property="packLevel"/>
|
||||||
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id,
|
||||||
|
`type`,
|
||||||
|
manufacturer,
|
||||||
|
cpmctymc,
|
||||||
|
form,
|
||||||
|
formSpec,
|
||||||
|
bzgg,
|
||||||
|
spmc,
|
||||||
|
nameCode,
|
||||||
|
packRatio,
|
||||||
|
packLevel,
|
||||||
|
createTime,
|
||||||
|
erpId,
|
||||||
|
updateTime
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDrugsByNameCodes" resultType="int">
|
||||||
|
SELECT count(1)
|
||||||
|
FROM third_ali_drug
|
||||||
|
WHERE nameCode = #{nameCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 自定义saveOrUpdateBatch方法 -->
|
||||||
|
<insert id="saveOrUpdateBatch" parameterType="com.glxp.api.entity.thrsys.ThirdAliDrug">
|
||||||
|
replace INTO third_ali_drug (`type`, manufacturer, cpmctymc, form, formSpec, bzgg, spmc, nameCode, packRatio,
|
||||||
|
packLevel, createTime, updateTime, erpId, approvalNum)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator="," index="index">
|
||||||
|
(#{item.type}, #{item.manufacturer}, #{item.cpmctymc}, #{item.form}, #{item.formSpec}, #{item.bzgg},
|
||||||
|
#{item.spmc}, #{item.nameCode},
|
||||||
|
#{item.packRatio}, #{item.packLevel}, #{item.createTime}, #{item.updateTime}, #{item.erpId},
|
||||||
|
#{item.approvalNum})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="filterList" parameterType="com.glxp.api.req.thrsys.ThirdAliDrugRequest"
|
||||||
|
resultType="com.glxp.api.entity.thrsys.ThirdAliDrug">
|
||||||
|
select id,
|
||||||
|
`type`,
|
||||||
|
manufacturer,
|
||||||
|
cpmctymc,
|
||||||
|
form,
|
||||||
|
formSpec,
|
||||||
|
bzgg,
|
||||||
|
spmc,
|
||||||
|
nameCode,
|
||||||
|
packRatio,
|
||||||
|
packLevel,
|
||||||
|
createTime,
|
||||||
|
erpId,
|
||||||
|
updateTime,
|
||||||
|
approvalNum
|
||||||
|
from third_ali_drug
|
||||||
|
<where>
|
||||||
|
<if test="cpmctymc != '' and cpmctymc != null">
|
||||||
|
AND cpmctymc LIKE concat('%', #{cpmctymc}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="nameCode != '' and nameCode != null">
|
||||||
|
AND nameCode LIKE concat('%', #{nameCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="approvalNum != '' and approvalNum != null">
|
||||||
|
AND approvalNum = #{approvalNum}
|
||||||
|
</if>
|
||||||
|
<if test="nameCodeIn!=null and nameCodeIn.size()>0">
|
||||||
|
AND nameCode NOT IN
|
||||||
|
<foreach collection="nameCodeIn" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="manufacturer != '' and manufacturer != null">
|
||||||
|
AND manufacturer LIKE concat('%', #{manufacturer}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by cpmctymc,approvalNum,packRatio,packLevel
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue