feat: 体外诊断

v3
chenhc 6 months ago
parent 4ae136069b
commit 6c6f679beb

@ -79,4 +79,13 @@ public class UdchsThirdApiController {
ybDrugService.updateDrugList();
return ResultVOUtils.success("手动触发ybDrug数据更新");
}
@ApiOperation("手动触发ybTwzd数据全量更新")
// @AuthRuleAnnotation("udiwms/erp/manual/trig/ybHcfl")
@PostMapping("/udiwms/erp/manual/trig/ybTwzd")
public BaseResponse<?> manualTrigYbTwzdl() {
ybHcflService.updateYbTwzdList();
return ResultVOUtils.success("手动触发ybTwzd数据全量更新");
}
}

@ -0,0 +1,195 @@
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 YbTwzdResponse {
@JsonProperty("records")
private Integer records;
@JsonProperty("total")
private Integer total;
@JsonProperty("rows")
private List<RowsDTO> 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("id")
private String id;
@JsonProperty("goodsId")
private String goodsId;
@JsonProperty("code")
private String code;
@JsonProperty("specificationCode")
private String specificationCode;
@JsonProperty("catalogFullName")
private String catalogFullName;
@JsonProperty("catalogName1")
private String catalogName1;
@JsonProperty("catalogName2")
private String catalogName2;
@JsonProperty("catalogName3")
private String catalogName3;
@JsonProperty("reagentTestingCode")
private String reagentTestingCode;
@JsonProperty("testingFullDesc")
private String testingFullDesc;
@JsonProperty("testingCategoryName1")
private String testingCategoryName1;
@JsonProperty("testingCategoryName2")
private String testingCategoryName2;
@JsonProperty("reagentUseType")
private int reagentUseType;
@JsonProperty("reagentCheckType")
private int reagentCheckType;
@JsonProperty("reagentCheckNum")
private int reagentCheckNum;
@JsonProperty("reagentCheckItem")
private String reagentCheckItem;
@JsonProperty("reagentFixedType")
private int reagentFixedType;
@JsonProperty("specification")
private String specification;
@JsonProperty("hcybCode")
private String hcybCode;
@JsonProperty("ggxhCode")
private String ggxhCode;
@JsonProperty("marketStatus")
private String marketStatus;
@JsonProperty("udiCode")
private String udiCode;
@JsonProperty("unit")
private String unit;
@JsonProperty("volume")
private String volume;
@JsonProperty("serve")
private int serve;
@JsonProperty("other")
private String other;
@JsonProperty("applicableInstruments")
private String applicableInstruments;
@JsonProperty("productId")
private String productId;
@JsonProperty("productName")
private String productName;
@JsonProperty("isImport")
private String isImport;
@JsonProperty("regcardId")
private String regcardId;
@JsonProperty("regcardNm")
private String regcardNm;
@JsonProperty("regcardProductName")
private String regcardProductName;
@JsonProperty("registrant")
private String registrant;
@JsonProperty("managerLevel")
private String managerLevel;
@JsonProperty("companyId")
private String companyId;
@JsonProperty("companyName")
private String companyName;
@JsonProperty("businessLicense")
private String businessLicense;
@JsonProperty("companyCode")
private String companyCode;
@JsonProperty("dataTime")
private String dataTime;
@JsonProperty("releaseVersion")
private String releaseVersion;
@JsonProperty("productCode")
private String productCode;
@JsonProperty("originCode")
private String originCode;
@JsonProperty("originCodeStatus")
private String originCodeStatus;
@JsonProperty("modifyType")
private String modifyType;
}
}

@ -4,10 +4,7 @@ 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;
import com.glxp.udidl.admin.res.chs.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -26,6 +23,10 @@ public class ChsYbChsHttpClient {
*
*/
String getHcflUrl = "https://code.nhsa.gov.cn/hc/stdSpecification/getStdSpecificationListDataCompanyReport.html";
/**
*
*/
String getTwzdUrl = "https://code.nhsa.gov.cn/sj/publish/cms_sj/product.html";
/**
*
*/
@ -54,6 +55,28 @@ public class ChsYbChsHttpClient {
});
return baseResponse;
}
//获取HCF列表
public YbTwzdResponse getYbTwzdList(Integer pageNum, Integer pageSize) {
Map<String, Object> params = new HashMap<>();
params.put("_search",false);
params.put("nd",System.currentTimeMillis());
params.put("rows", pageSize);
params.put("page", pageNum);
params.put("sord", "asc");
params.put("code", "C");
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
String response = sendPost(getTwzdUrl+getParams(params), "",Charset.forName("utf-8"));
YbTwzdResponse baseResponse = JSONObject.parseObject(response, new TypeReference<YbTwzdResponse>() {
});
return baseResponse;
}
//获取HCF列表
public YbDrugResponse getYbDrugList(Integer pageNum, Integer pageSize,String goodsCode) {
Map<String, Object> params = new HashMap<>();

@ -1,13 +1,16 @@
package com.glxp.udidl.admin.service.chsapi;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.glxp.udidl.admin.res.chs.YbHcflResponse;
import com.glxp.udidl.admin.res.chs.YbTwzdResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.dao.chs.YbHcflMapper;
import com.glxp.udidl.admin.entity.chs.YbHcflEntity;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
@ -51,4 +54,73 @@ public class ChsYbHcflService extends ServiceImpl<YbHcflMapper, YbHcflEntity> {
}
/**
* YbHcf
*
*/
public void updateYbTwzdList(){
Integer pageNum = 1;
Integer pageSize = 200;
//1、获取数据
YbTwzdResponse ybTwzdResponse = ybChsHttpClient.getYbTwzdList(pageNum, pageSize);
Integer total = ybTwzdResponse.getTotal();
//处理第一批数据
processUpdatesYbTwzd(ybTwzdResponse);
//处理后续数据
if (total>pageNum){
for (int i = 2; i <= total ; i++) {
System.out.println("更新数据库的YbTwzd列表数据"+ i);
processUpdatesYbTwzd(ybChsHttpClient.getYbTwzdList(i, pageSize));
}
}
}
/**
*
* @param ybTwzdResponse
*/
private void processUpdatesYbTwzd(YbTwzdResponse ybTwzdResponse) {
List<YbTwzdResponse.RowsDTO> list = ybTwzdResponse.getRows();
if (CollUtil.isNotEmpty(list)){
List<YbHcflEntity> ybHcflEntities = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
YbTwzdResponse.RowsDTO rowsDTO = list.get(i);
YbHcflEntity ybHcflEntity = new YbHcflEntity();
ybHcflEntity.setSpecificationCode(rowsDTO.getCode());
ybHcflEntity.setSpecificationId(null);
ybHcflEntity.setCatalogcode(rowsDTO.getSpecificationCode());
ybHcflEntity.setCatalogname1(rowsDTO.getCatalogName1());
ybHcflEntity.setCatalogname2(rowsDTO.getCatalogName2());
ybHcflEntity.setCatalogname3(rowsDTO.getCatalogName3());
ybHcflEntity.setCommonnamecode(null);
ybHcflEntity.setCommonname(null);
ybHcflEntity.setMatrialcode(null);
ybHcflEntity.setMatrial(rowsDTO.getTestingFullDesc());
ybHcflEntity.setCharacteristiccode(null);
ybHcflEntity.setCharacteristic(rowsDTO.getProductName());
ybHcflEntity.setSeparateCharges(null);
ybHcflEntity.setPaymentType(null);
ybHcflEntity.setPaymentStandard(null);
ybHcflEntity.setIsusing("1");
ybHcflEntity.setSpecificationType(null);
ybHcflEntity.setProductStatusS(null);
ybHcflEntity.setProductCount(null);
ybHcflEntity.setCompCount(null);
ybHcflEntity.setRegCount(null);
ybHcflEntity.setGoodsCount(null);
ybHcflEntities.add(ybHcflEntity);
}
if (CollUtil.isNotEmpty(ybHcflEntities)){
ybHcflMapper.batchSaveOrUpdateBySpecificationCode(ybHcflEntities);
}
}
}
}

@ -46,7 +46,9 @@ public class YbDrugServiceImpl implements YbDrugService {
YbDrugResponse ybDrugResponse = ybChsHttpClient.getYbDrugList(1, 1,goodsCode);
List<YbDrugResponse.RowsDTO> lists = ybDrugResponse.getRows();
List<YbDrug> ybHcflEntities = BeanUtil.copyToList(lists, YbDrug.class);
ybDrugMapper.batchSaveOrUpdateByGoodsCode(ybHcflEntities);
if (CollUtil.isNotEmpty(ybHcflEntities)){
ybDrugMapper.batchSaveOrUpdateByGoodsCode(ybHcflEntities);
}
pageSimpleResponse.setTotal(Long.valueOf(lists.size()));
pageSimpleResponse.setList(ybHcflEntities);
}else {

Loading…
Cancel
Save