feat: 修复
							parent
							
								
									8c94f1db23
								
							
						
					
					
						commit
						67e4600796
					
				| @ -0,0 +1,17 @@ | ||||
| package com.glxp.api.dao.thrsys; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.glxp.api.entity.thrsys.YbDrug; | ||||
| import com.glxp.api.req.basic.YbDrugDetailFilterRequest; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @Mapper | ||||
| public interface YbDrugMapper extends BaseMapper<YbDrug> { | ||||
| 
 | ||||
|     void batchSaveOrUpdateByGoodsCode(@Param("list")List<YbDrug> ybHcflEntities); | ||||
| 
 | ||||
|     List<YbDrug> list(YbDrugDetailFilterRequest param); | ||||
| } | ||||
| @ -0,0 +1,149 @@ | ||||
| package com.glxp.api.entity.thrsys; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import lombok.Data; | ||||
| 
 | ||||
| import java.io.Serializable; | ||||
| 
 | ||||
| /** | ||||
|  * 药品 | ||||
|  */ | ||||
| @Data | ||||
| @TableName(value = "yb_drug") | ||||
| public class YbDrug implements Serializable { | ||||
| 
 | ||||
|     /** | ||||
|     * 统一社会信用代码 | ||||
|     */ | ||||
|     @TableField(value = "businessLicense") | ||||
|     private String businessLicense; | ||||
| 
 | ||||
|     /** | ||||
|     * 公司名称 | ||||
|     */ | ||||
|     @TableField(value = "companyNameSc") | ||||
|     private String companyNameSc; | ||||
| 
 | ||||
|     /** | ||||
|     * 注批准文号 | ||||
|     */ | ||||
|     @TableField(value = "approvalCode") | ||||
|     private String approvalCode; | ||||
| 
 | ||||
|     /** | ||||
|     * 药品本位码 | ||||
|     */ | ||||
|     @TableField(value = "goodsStandardCode") | ||||
|     private String goodsStandardCode; | ||||
| 
 | ||||
|     /** | ||||
|     * baseId | ||||
|     */ | ||||
|     @TableField(value = "baseId") | ||||
|     private String baseId; | ||||
| 
 | ||||
|     /** | ||||
|     * 产品名 | ||||
|     */ | ||||
|     @TableField(value = "productName") | ||||
|     private String productName; | ||||
| 
 | ||||
|     /** | ||||
|     * 产品分类码 | ||||
|     */ | ||||
|     @TableField(value = "productMedicinemodel") | ||||
|     private String productMedicinemodel; | ||||
| 
 | ||||
|     /** | ||||
|     * 注册名称 | ||||
|     */ | ||||
|     @TableField(value = "registeredProductName") | ||||
|     private String registeredProductName; | ||||
| 
 | ||||
|     /** | ||||
|     * 药品企业 | ||||
|     */ | ||||
|     @TableField(value = "listingHolder") | ||||
|     private String listingHolder; | ||||
| 
 | ||||
|     /** | ||||
|     * 注册剂型 | ||||
|     */ | ||||
|     @TableField(value = "registeredMedicinemodel") | ||||
|     private String registeredMedicinemodel; | ||||
| 
 | ||||
|     /** | ||||
|     * 最小制剂单位 | ||||
|     */ | ||||
|     @TableField(value = "minUnit") | ||||
|     private String minUnit; | ||||
| 
 | ||||
|     /** | ||||
|     * 最小包装数量 | ||||
|     */ | ||||
|     @TableField(value = "factor") | ||||
|     private Integer factor; | ||||
| 
 | ||||
|     @TableField(value = "goodsName") | ||||
|     private String goodsName; | ||||
| 
 | ||||
|     @TableField(value = "dataSouce") | ||||
|     private String dataSouce; | ||||
| 
 | ||||
|     /** | ||||
|     * 规格 | ||||
|     */ | ||||
|     @TableField(value = "realityOutlook") | ||||
|     private String realityOutlook; | ||||
| 
 | ||||
|     @TableField(value = "productRemark") | ||||
|     private String productRemark; | ||||
| 
 | ||||
|     @TableField(value = "subpackager") | ||||
|     private String subpackager; | ||||
| 
 | ||||
|     @TableField(value = "version") | ||||
|     private String version; | ||||
| 
 | ||||
|     @TableField(value = "productInsuranceType") | ||||
|     private String productInsuranceType; | ||||
| 
 | ||||
|     /** | ||||
|     * 剂型 | ||||
|     */ | ||||
|     @TableField(value = "realityMedicinemodel") | ||||
|     private String realityMedicinemodel; | ||||
| 
 | ||||
|     @TableField(value = "marketState") | ||||
|     private String marketState; | ||||
| 
 | ||||
|     /** | ||||
|     * 包装材质 | ||||
|     */ | ||||
|     @TableField(value = "materialName") | ||||
|     private String materialName; | ||||
| 
 | ||||
|     /** | ||||
|     * 最小包装单位 | ||||
|     */ | ||||
|     @TableField(value = "unit") | ||||
|     private String unit; | ||||
| 
 | ||||
|     /** | ||||
|     * 注册规格 | ||||
|     */ | ||||
|     @TableField(value = "registeredOutlook") | ||||
|     private String registeredOutlook; | ||||
| 
 | ||||
|     @TableField(value = "productCode") | ||||
|     private String productCode; | ||||
| 
 | ||||
|     /** | ||||
|     * 药品代码 | ||||
|     */ | ||||
|     @TableField(value = "goodsCode") | ||||
|     private String goodsCode; | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,15 @@ | ||||
| package com.glxp.api.req.basic; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| import org.hibernate.validator.constraints.Length; | ||||
| 
 | ||||
| @Data | ||||
| public class YbDrugDetailFilterRequest { | ||||
| 
 | ||||
| 
 | ||||
|     private String goodsCode; | ||||
| 
 | ||||
|     private Integer page; | ||||
|     private Integer limit; | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,34 @@ | ||||
| package com.glxp.api.service.thrsys; | ||||
| 
 | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import com.glxp.api.common.res.BaseResponse; | ||||
| import com.glxp.api.dao.thrsys.YbDrugMapper; | ||||
| import com.glxp.api.entity.thrsys.YbDrug; | ||||
| import com.glxp.api.http.ErpBasicClient; | ||||
| import com.glxp.api.req.basic.YbDrugDetailFilterRequest; | ||||
| import com.glxp.api.res.PageSimpleResponse; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.List; | ||||
| 
 | ||||
| @Service | ||||
| public class YbDrugService { | ||||
| 
 | ||||
|     @Resource | ||||
|     YbDrugMapper ybDrugMapper; | ||||
|     @Resource | ||||
|     ErpBasicClient erpBasicClient; | ||||
| 
 | ||||
|     public List<YbDrug> getList(YbDrugDetailFilterRequest ybHcflDetailFilterRequest) { | ||||
|         List<YbDrug> list = ybDrugMapper.list(ybHcflDetailFilterRequest); | ||||
|         if (CollUtil.isEmpty(list)){ | ||||
|             BaseResponse<PageSimpleResponse<YbDrug>> ybDrugDetail = erpBasicClient.getYbDrugDetail(ybHcflDetailFilterRequest); | ||||
|             PageSimpleResponse<YbDrug> data = ybDrugDetail.getData(); | ||||
|             List<YbDrug> list1 = data.getList(); | ||||
|             ybDrugMapper.batchSaveOrUpdateByGoodsCode(list1); | ||||
|             return list1; | ||||
|         } | ||||
|         return list; | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,135 @@ | ||||
| <?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.YbDrugMapper"> | ||||
| 
 | ||||
|  <!-- 自定义批量保存数据--> | ||||
|   <insert id="batchSaveOrUpdateByGoodsCode" parameterType="int"> | ||||
|     INSERT INTO | ||||
|       yb_drug | ||||
|     ( | ||||
|         businessLicense, | ||||
|         companyNameSc, | ||||
|         approvalCode, | ||||
|         goodsStandardCode, | ||||
|         baseId, | ||||
|         productName, | ||||
|         productMedicinemodel, | ||||
|         registeredProductName, | ||||
|         listingHolder, | ||||
|         registeredMedicinemodel, | ||||
|         minUnit, | ||||
|         factor, | ||||
|         goodsName, | ||||
|         dataSouce, | ||||
|         realityOutlook, | ||||
|         productRemark, | ||||
|         subpackager, | ||||
|         version, | ||||
|         productInsuranceType, | ||||
|         realityMedicinemodel, | ||||
|         marketState, | ||||
|         materialName, | ||||
|         unit, | ||||
|         registeredOutlook, | ||||
|         productCode, | ||||
|         goodsCode | ||||
|     ) | ||||
|     VALUES | ||||
|     <foreach collection="list" item="item" separator=","> | ||||
|      ( | ||||
|          #{item.businessLicense}, | ||||
|          #{item.companyNameSc}, | ||||
|          #{item.approvalCode}, | ||||
|          #{item.goodsStandardCode}, | ||||
|          #{item.baseId}, | ||||
|          #{item.productName}, | ||||
|          #{item.productMedicinemodel}, | ||||
|          #{item.registeredProductName}, | ||||
|          #{item.listingHolder}, | ||||
|          #{item.registeredMedicinemodel}, | ||||
|          #{item.minUnit}, | ||||
|          #{item.factor}, | ||||
|          #{item.goodsName}, | ||||
|          #{item.dataSouce}, | ||||
|          #{item.realityOutlook}, | ||||
|          #{item.productRemark}, | ||||
|          #{item.subpackager}, | ||||
|          #{item.version}, | ||||
|          #{item.productInsuranceType}, | ||||
|          #{item.realityMedicinemodel}, | ||||
|          #{item.marketState}, | ||||
|          #{item.materialName}, | ||||
|          #{item.unit}, | ||||
|          #{item.registeredOutlook}, | ||||
|          #{item.productCode}, | ||||
|          #{item.goodsCode} | ||||
|       ) | ||||
|     </foreach> | ||||
|     ON DUPLICATE KEY UPDATE | ||||
|     businessLicense = VALUES(businessLicense), | ||||
|     companyNameSc = VALUES(companyNameSc), | ||||
|     approvalCode = VALUES(approvalCode), | ||||
|     goodsStandardCode = VALUES(goodsStandardCode), | ||||
|     baseId = VALUES(baseId), | ||||
|     productName = VALUES(productName), | ||||
|     productMedicinemodel = VALUES(productMedicinemodel), | ||||
|     registeredProductName = VALUES(registeredProductName), | ||||
|     listingHolder= VALUES(listingHolder), | ||||
|     registeredMedicinemodel = VALUES(registeredMedicinemodel), | ||||
|     minUnit = VALUES(minUnit), | ||||
|     factor = VALUES(factor), | ||||
|     goodsName = VALUES(goodsName), | ||||
|     dataSouce = VALUES(dataSouce), | ||||
|     realityOutlook = VALUES(realityOutlook), | ||||
|     productRemark = VALUES(productRemark), | ||||
|     subpackager = VALUES(subpackager), | ||||
|     version = VALUES(version), | ||||
|     productInsuranceType = VALUES(productInsuranceType), | ||||
|     realityMedicinemodel = VALUES(realityMedicinemodel), | ||||
|     marketState = VALUES(marketState), | ||||
|     materialName = VALUES(materialName), | ||||
|     unit = VALUES(unit), | ||||
|     registeredOutlook = VALUES(registeredOutlook), | ||||
|     productCode = VALUES(productCode), | ||||
|     goodsCode = VALUES(goodsCode) | ||||
|   </insert> | ||||
| 
 | ||||
| 
 | ||||
|     <select id="list" resultType="com.glxp.api.entity.thrsys.YbDrug" parameterType="com.glxp.api.entity.thrsys.YbDrug"> | ||||
|         select | ||||
|         businessLicense, | ||||
|         companyNameSc, | ||||
|         approvalCode, | ||||
|         goodsStandardCode, | ||||
|         baseId, | ||||
|         productName, | ||||
|         productMedicinemodel, | ||||
|         registeredProductName, | ||||
|         listingHolder, | ||||
|         registeredMedicinemodel, | ||||
|         minUnit, | ||||
|         factor, | ||||
|         goodsName, | ||||
|         dataSouce, | ||||
|         realityOutlook, | ||||
|         productRemark, | ||||
|         subpackager, | ||||
|         version, | ||||
|         productInsuranceType, | ||||
|         realityMedicinemodel, | ||||
|         marketState, | ||||
|         materialName, | ||||
|         unit, | ||||
|         registeredOutlook, | ||||
|         productCode, | ||||
|         goodsCode | ||||
|         from yb_drug | ||||
|         <where> | ||||
|             <if test="goodsCode != '' and goodsCode != null"> | ||||
|                 and goodsCode like concat(#{goodsCode},'%') | ||||
|             </if> | ||||
|         </where> | ||||
|         order by goodsCode DESC | ||||
|     </select> | ||||
| 
 | ||||
| </mapper> | ||||
					Loading…
					
					
				
		Reference in New Issue