From eac98ace7f775a9e347ddeea8af8870a8b562543 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Tue, 24 Sep 2024 11:07:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../udchs/UdchsThirdApiController.java | 12 ++ .../udchs/UdchsYbDrugController.java | 36 +++++ .../udidl/admin/dao/chs/YbDrugMapper.java | 18 +++ .../glxp/udidl/admin/dto/udchs/BaseParam.java | 3 + .../glxp/udidl/admin/entity/chs/YbDrug.java | 153 ++++++++++++++++++ .../udidl/admin/res/chs/YbDrugResponse.java | 112 +++++++++++++ .../service/chsapi/ChsYbChsHttpClient.java | 28 ++++ .../service/chsapi/ChsYbDrugService.java | 54 +++++++ .../admin/service/udchs/YbDrugService.java | 8 + .../service/udchs/impl/YbDrugServiceImpl.java | 62 +++++++ .../mybatis/mapper/udchs/YbDrugMapper.xml | 135 ++++++++++++++++ 11 files changed, 621 insertions(+) create mode 100644 src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsYbDrugController.java create mode 100644 src/main/java/com/glxp/udidl/admin/dao/chs/YbDrugMapper.java create mode 100644 src/main/java/com/glxp/udidl/admin/entity/chs/YbDrug.java create mode 100644 src/main/java/com/glxp/udidl/admin/res/chs/YbDrugResponse.java create mode 100644 src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java create mode 100644 src/main/java/com/glxp/udidl/admin/service/udchs/YbDrugService.java create mode 100644 src/main/java/com/glxp/udidl/admin/service/udchs/impl/YbDrugServiceImpl.java create mode 100644 src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml diff --git a/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsThirdApiController.java b/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsThirdApiController.java index b896509..11f9253 100644 --- a/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsThirdApiController.java +++ b/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsThirdApiController.java @@ -1,6 +1,7 @@ package com.glxp.udidl.admin.controller.udchs; import com.glxp.udidl.admin.res.BaseResponse; +import com.glxp.udidl.admin.service.chsapi.ChsYbDrugService; import com.glxp.udidl.admin.service.chsapi.ChsYbHcflService; import com.glxp.udidl.admin.service.chsapi.ChsYbHcxxGgService; import com.glxp.udidl.admin.service.chsapi.ChsYbHcxxService; @@ -23,6 +24,8 @@ public class UdchsThirdApiController { ChsYbHcxxService ybHcxxService; @Autowired ChsYbHcxxGgService ybHcxxGgService; + @Autowired + ChsYbDrugService ybDrugService; @ApiOperation("手动触发ybHcfl数据全量更新") // @AuthRuleAnnotation("udiwms/erp/manual/trig/ybHcfl") @@ -67,4 +70,13 @@ public class UdchsThirdApiController { ybHcxxGgService.updateYbHcxxGgList(specificationCode); return ResultVOUtils.success("手动触发ybHcxxGg数据更新通过父code!"); } + + + + @ApiOperation("手动触发ybDrug数据更新") + @PostMapping("/udiwms/erp/manual/trig/ybDrugByCode") + public BaseResponse ybDrugByCode() { + ybDrugService.updateDrugList(); + return ResultVOUtils.success("手动触发ybDrug数据更新!"); + } } diff --git a/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsYbDrugController.java b/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsYbDrugController.java new file mode 100644 index 0000000..478c708 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/controller/udchs/UdchsYbDrugController.java @@ -0,0 +1,36 @@ +package com.glxp.udidl.admin.controller.udchs; + +import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; +import com.glxp.udidl.admin.dto.udchs.BaseParam; +import com.glxp.udidl.admin.entity.chs.YbDrug; +import com.glxp.udidl.admin.entity.chs.YbHcflEntity; +import com.glxp.udidl.admin.res.BaseResponse; +import com.glxp.udidl.admin.service.udchs.YbDrugService; +import com.glxp.udidl.admin.service.udchs.YbHcflService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 国家医保 + */ +@Api(tags = "国家医保药品信息接口") +@RestController +@RequestMapping("/udchs/ybDrug") +public class UdchsYbDrugController { + + @Autowired + private YbDrugService ybDrugService; + + @ApiOperation(value = "国家医保耗材分类目录信息", response = YbDrug.class) + @PostMapping("/list") + public BaseResponse getList(@RequestBody BaseParam param) { + return ybDrugService.getList(param); + } + +} diff --git a/src/main/java/com/glxp/udidl/admin/dao/chs/YbDrugMapper.java b/src/main/java/com/glxp/udidl/admin/dao/chs/YbDrugMapper.java new file mode 100644 index 0000000..76d9c9a --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/dao/chs/YbDrugMapper.java @@ -0,0 +1,18 @@ +package com.glxp.udidl.admin.dao.chs; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.glxp.udidl.admin.dto.udchs.BaseParam; +import com.glxp.udidl.admin.entity.chs.YbDrug; +import com.glxp.udidl.admin.entity.chs.YbHcflEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface YbDrugMapper extends BaseMapper { + + void batchSaveOrUpdateByGoodsCode(@Param("list")List ybHcflEntities); + + List list(BaseParam param); +} \ No newline at end of file diff --git a/src/main/java/com/glxp/udidl/admin/dto/udchs/BaseParam.java b/src/main/java/com/glxp/udidl/admin/dto/udchs/BaseParam.java index e3d8553..840078d 100644 --- a/src/main/java/com/glxp/udidl/admin/dto/udchs/BaseParam.java +++ b/src/main/java/com/glxp/udidl/admin/dto/udchs/BaseParam.java @@ -13,6 +13,9 @@ public class BaseParam extends ListPageRequest { @ApiModelProperty(name = "specificationCode", value = "名称,支持模糊查询") private String specificationCode;//名称,支持模糊查询 + @ApiModelProperty(name = "goodsCode", value = "名称,支持模糊查询") + private String goodsCode;//名称,支持模糊查询 + @ApiModelProperty(name = "codeShow", value = "名称,支持模糊查询") private String codeShow;//名称,支持模糊查询 diff --git a/src/main/java/com/glxp/udidl/admin/entity/chs/YbDrug.java b/src/main/java/com/glxp/udidl/admin/entity/chs/YbDrug.java new file mode 100644 index 0000000..7ce3746 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/entity/chs/YbDrug.java @@ -0,0 +1,153 @@ +package com.glxp.udidl.admin.entity.chs; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +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; + + +} \ No newline at end of file diff --git a/src/main/java/com/glxp/udidl/admin/res/chs/YbDrugResponse.java b/src/main/java/com/glxp/udidl/admin/res/chs/YbDrugResponse.java new file mode 100644 index 0000000..1963aa2 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/res/chs/YbDrugResponse.java @@ -0,0 +1,112 @@ +package com.glxp.udidl.admin.res.chs; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@NoArgsConstructor +@Data +public class YbDrugResponse { + + @JsonProperty("records") + private Integer records; + @JsonProperty("total") + private Integer total; + @JsonProperty("rows") + private List rows; + @JsonProperty("page") + private Integer page; + @JsonProperty("count") + private Integer count; + @JsonProperty("firstResult") + private Integer firstResult; + @JsonProperty("maxResults") + private Integer maxResults; + @JsonProperty("success") + private Boolean success; + @JsonProperty("result") + private String result; + @JsonProperty("conditions") + private ConditionsDTO conditions; + @JsonProperty("msg") + private String msg; + @JsonProperty("form") + private String form; + @JsonProperty("code") + private Integer code; + @JsonProperty("operCount") + private Integer operCount; + @JsonProperty("sord") + private String sord; + @JsonProperty("sidx") + private String sidx; + @JsonProperty("orderby") + private String orderby; + + @NoArgsConstructor + @Data + public static class ConditionsDTO { + @JsonProperty("orderColumn") + private Integer orderColumn; + } + + @NoArgsConstructor + @Data + public static class RowsDTO { + @JsonProperty("businessLicense") + private String businessLicense; + @JsonProperty("companyNameSc") + private String companyNameSc; + @JsonProperty("approvalCode") + private String approvalCode; + @JsonProperty("goodsStandardCode") + private String goodsStandardCode; + @JsonProperty("baseId") + private String baseId; + @JsonProperty("productName") + private String productName; + @JsonProperty("productMedicinemodel") + private String productMedicinemodel; + @JsonProperty("registeredProductName") + private String registeredProductName; + @JsonProperty("listingHolder") + private String listingHolder; + @JsonProperty("registeredMedicinemodel") + private String registeredMedicinemodel; + @JsonProperty("minUnit") + private String minUnit; + @JsonProperty("factor") + private Integer factor; + @JsonProperty("goodsName") + private String goodsName; + @JsonProperty("dataSouce") + private String dataSouce; + @JsonProperty("realityOutlook") + private String realityOutlook; + @JsonProperty("productRemark") + private String productRemark; + @JsonProperty("subpackager") + private String subpackager; + @JsonProperty("version") + private String version; + @JsonProperty("productInsuranceType") + private String productInsuranceType; + @JsonProperty("realityMedicinemodel") + private String realityMedicinemodel; + @JsonProperty("marketState") + private String marketState; + @JsonProperty("materialName") + private String materialName; + @JsonProperty("unit") + private String unit; + @JsonProperty("registeredOutlook") + private String registeredOutlook; + @JsonProperty("productCode") + private String productCode; + @JsonProperty("goodsCode") + private String goodsCode; + + } +} diff --git a/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbChsHttpClient.java b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbChsHttpClient.java index ba336fc..4cce2d1 100644 --- a/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbChsHttpClient.java +++ b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbChsHttpClient.java @@ -1,7 +1,10 @@ package com.glxp.udidl.admin.service.chsapi; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; +import com.glxp.udidl.admin.res.chs.YbDrugResponse; import com.glxp.udidl.admin.res.chs.YbHcflResponse; import com.glxp.udidl.admin.res.chs.YbHcxxGgResponse; import com.glxp.udidl.admin.res.chs.YbHcxxResponse; @@ -31,6 +34,10 @@ public class ChsYbChsHttpClient { * 获取医用耗材规格信息 */ String getHcxxGgUrl = "https://code.nhsa.gov.cn/hc/stdYgbData/getPublicHcDataList.html"; + /** + * 获取医用耗材规格信息 + */ + String getDrugUrl = "https://code.nhsa.gov.cn/yp/stdGoodsPublic/getStdGoodsPublicData.html"; //获取HCF列表 @@ -47,6 +54,27 @@ public class ChsYbChsHttpClient { }); return baseResponse; } + //获取HCF列表 + public YbDrugResponse getYbDrugList(Integer pageNum, Integer pageSize,String goodsCode) { + Map params = new HashMap<>(); + params.put("_search",false); + params.put("nd",System.currentTimeMillis()); + params.put("rows", pageSize); + params.put("page", pageNum); + if (StrUtil.isNotBlank(goodsCode)) params.put("goodsCode", goodsCode); + + try { + Thread.sleep(15000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + String response = sendPost(getDrugUrl+getParams(params), "",Charset.forName("utf-8")); + response = response.replace("”", "").replace("“", "").replace("\\\"" , "").replace("\\\"" , "").replace("\\", ""); + System.out.println(response); + YbDrugResponse baseResponse = JSONObject.parseObject(response, new TypeReference() { + }); + return baseResponse; + } //获取Hcxx列表 public YbHcxxResponse getYbHcxxList(Integer pageNum, Integer pageSize) { diff --git a/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java new file mode 100644 index 0000000..8fc72a5 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java @@ -0,0 +1,54 @@ +package com.glxp.udidl.admin.service.chsapi; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.glxp.udidl.admin.dao.chs.YbDrugMapper; +import com.glxp.udidl.admin.dao.chs.YbHcflMapper; +import com.glxp.udidl.admin.entity.chs.YbDrug; +import com.glxp.udidl.admin.entity.chs.YbHcflEntity; +import com.glxp.udidl.admin.res.chs.YbDrugResponse; +import com.glxp.udidl.admin.res.chs.YbHcflResponse; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class ChsYbDrugService extends ServiceImpl { + + @Resource + ChsYbChsHttpClient ybChsHttpClient; + @Resource + YbDrugMapper ybDrugMapper; + + + public void updateDrugList(){ + Integer pageNum = 148; + Integer pageSize = 200; + + //1、获取数据 + YbDrugResponse ybDrugResponse = ybChsHttpClient.getYbDrugList(pageNum, pageSize,null); + Integer total = ybDrugResponse.getTotal(); + //处理第一批数据 + processUpdates(ybDrugResponse); + //处理后续数据 + if (total>pageNum){ + for (int i = 149; i <= total ; i++) { + System.out.println("更新数据库的YbDrug列表数据"+ i); + processUpdates(ybChsHttpClient.getYbDrugList(i, pageSize,null)); + } + } + } + + /** + * 处理比对更新 + * @param ybDrugResponse + */ + private void processUpdates(YbDrugResponse ybDrugResponse) { + List list = ybDrugResponse.getRows(); + List ybHcflEntities = BeanUtil.copyToList(list, YbDrug.class); + ybDrugMapper.batchSaveOrUpdateByGoodsCode(ybHcflEntities); + } + + +} diff --git a/src/main/java/com/glxp/udidl/admin/service/udchs/YbDrugService.java b/src/main/java/com/glxp/udidl/admin/service/udchs/YbDrugService.java new file mode 100644 index 0000000..584dea4 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/service/udchs/YbDrugService.java @@ -0,0 +1,8 @@ +package com.glxp.udidl.admin.service.udchs; + +import com.glxp.udidl.admin.dto.udchs.BaseParam; +import com.glxp.udidl.admin.res.BaseResponse; + +public interface YbDrugService { + BaseResponse getList(BaseParam param); +} diff --git a/src/main/java/com/glxp/udidl/admin/service/udchs/impl/YbDrugServiceImpl.java b/src/main/java/com/glxp/udidl/admin/service/udchs/impl/YbDrugServiceImpl.java new file mode 100644 index 0000000..07b8bc4 --- /dev/null +++ b/src/main/java/com/glxp/udidl/admin/service/udchs/impl/YbDrugServiceImpl.java @@ -0,0 +1,62 @@ +package com.glxp.udidl.admin.service.udchs.impl; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.glxp.udidl.admin.dao.chs.YbDrugMapper; +import com.glxp.udidl.admin.dao.chs.YbHcflMapper; +import com.glxp.udidl.admin.dto.udchs.BaseParam; +import com.glxp.udidl.admin.entity.chs.YbDrug; +import com.glxp.udidl.admin.entity.chs.YbHcflEntity; +import com.glxp.udidl.admin.res.BaseResponse; +import com.glxp.udidl.admin.res.PageSimpleResponse; +import com.glxp.udidl.admin.res.chs.YbDrugResponse; +import com.glxp.udidl.admin.service.chsapi.ChsYbChsHttpClient; +import com.glxp.udidl.admin.service.udchs.YbDrugService; +import com.glxp.udidl.admin.service.udchs.YbHcflService; +import com.glxp.udidl.admin.util.ResultVOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class YbDrugServiceImpl implements YbDrugService { + + @Autowired + private YbDrugMapper mapper; + @Resource + ChsYbChsHttpClient ybChsHttpClient; + @Resource + YbDrugMapper ybDrugMapper; + + @Override + public BaseResponse getList(BaseParam param) { + PageHelper.startPage(param.getPage(), param.getLimit()); + List list = mapper.list(param); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + if (CollUtil.isEmpty(list)){ + String goodsCode = param.getGoodsCode(); + if (StrUtil.isNotBlank(goodsCode)){ + YbDrugResponse ybDrugResponse = ybChsHttpClient.getYbDrugList(1, 1,goodsCode); + List lists = ybDrugResponse.getRows(); + List ybHcflEntities = BeanUtil.copyToList(lists, YbDrug.class); + ybDrugMapper.batchSaveOrUpdateByGoodsCode(ybHcflEntities); + pageSimpleResponse.setTotal(Long.valueOf(lists.size())); + pageSimpleResponse.setList(ybHcflEntities); + }else { + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(list); + } + }else { + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(list); + } + return ResultVOUtils.success(pageSimpleResponse); + } +} diff --git a/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml b/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml new file mode 100644 index 0000000..48d895c --- /dev/null +++ b/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml @@ -0,0 +1,135 @@ + + + + + + + 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 + + ( + #{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} + ) + + 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) + + + + + + \ No newline at end of file From e97d05479b7e4c23493653baf13fdaec7b2b9e12 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Tue, 24 Sep 2024 11:07:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java index 8fc72a5..3ba5f27 100644 --- a/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java +++ b/src/main/java/com/glxp/udidl/admin/service/chsapi/ChsYbDrugService.java @@ -23,7 +23,7 @@ public class ChsYbDrugService extends ServiceImpl { public void updateDrugList(){ - Integer pageNum = 148; + Integer pageNum = 1; Integer pageSize = 200; //1、获取数据 @@ -33,7 +33,7 @@ public class ChsYbDrugService extends ServiceImpl { processUpdates(ybDrugResponse); //处理后续数据 if (total>pageNum){ - for (int i = 149; i <= total ; i++) { + for (int i = 2; i <= total ; i++) { System.out.println("更新数据库的YbDrug列表数据"+ i); processUpdates(ybChsHttpClient.getYbDrugList(i, pageSize,null)); } From d103a597640af7af1477df2361ad6865d1fc6fbc Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Tue, 24 Sep 2024 14:04:47 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/schemas/schema_v2.1.sql | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index de3dadc..6576887 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -127,3 +127,32 @@ SET FOREIGN_KEY_CHECKS = 1; +CREATE TABLE IF NOT EXISTS `yb_drug` ( + `businessLicense` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '统一社会信用代码', + `companyNameSc` varchar(255) DEFAULT NULL COMMENT '公司名称', + `approvalCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '注批准文号', + `goodsStandardCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '药品本位码', + `baseId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'baseId', + `productName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '产品名', + `productMedicinemodel` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '产品分类码', + `registeredProductName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '注册名称', + `listingHolder` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '药品企业', + `registeredMedicinemodel` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '注册剂型', + `minUnit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最小制剂单位', + `factor` int DEFAULT NULL COMMENT '最小包装数量', + `goodsName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `dataSouce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `realityOutlook` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '规格', + `productRemark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `subpackager` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `version` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `productInsuranceType` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `realityMedicinemodel` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '剂型', + `marketState` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `materialName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '包装材质', + `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '最小包装单位', + `registeredOutlook` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '注册规格', + `productCode` varchar(255) DEFAULT NULL, + `goodsCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '药品代码', + PRIMARY KEY (`goodsCode`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file From f81b5621be396cce600e1efea4dfc2029cc514b2 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Tue, 24 Sep 2024 14:23:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml b/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml index 48d895c..cb02466 100644 --- a/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml +++ b/src/main/resources/mybatis/mapper/udchs/YbDrugMapper.xml @@ -96,7 +96,7 @@