|
|
|
@ -1,5 +1,11 @@
|
|
|
|
|
package com.glxp.api.service.basic;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.entity.thrsys.BasicInsDrugEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.BasicInsMaterialEntity;
|
|
|
|
|
import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
|
|
|
|
|
import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest;
|
|
|
|
|
import com.glxp.api.service.thrsys.BasicInsDrugService;
|
|
|
|
|
import com.glxp.api.service.thrsys.BasicInsMaterialService;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
@ -21,13 +27,12 @@ import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.util.udi.UdiInfoUtil;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 耗材字典对照
|
|
|
|
@ -48,6 +53,13 @@ public class UdiContrastService {
|
|
|
|
|
@Resource
|
|
|
|
|
NmpaUdiClient udiDlHttpClient;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
BasicInsDrugService basicInsDrugService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
BasicInsMaterialService basicInsMaterialService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isExit(String originUuid, String mainId, String thirdSys) {
|
|
|
|
|
|
|
|
|
|
String deviceRecordKey = null;
|
|
|
|
@ -249,25 +261,64 @@ public class UdiContrastService {
|
|
|
|
|
udiRelevanceEntity.setAutoCode(true);
|
|
|
|
|
udiRelevanceEntity.setIsDisable(false);
|
|
|
|
|
|
|
|
|
|
BasicInsDrugEntity basicInsDrugEntity = null;
|
|
|
|
|
BasicInsMaterialEntity basicInsMaterialEntity = null;
|
|
|
|
|
if (thrProductsEntity.getYbbm() != null){
|
|
|
|
|
//判断药品还是器械
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
|
List<BasicInsDrugEntity> basicInsDrugEntities = basicInsDrugService.filterList(thrInsDrugFeeRequest);
|
|
|
|
|
List<BasicInsDrugEntity> filteredEntities = basicInsDrugEntities.stream()
|
|
|
|
|
.filter(entity -> entity.getGenericName() != null) // 过滤掉 genericName 为 null 的元素
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (filteredEntities.size() > 0){
|
|
|
|
|
basicInsDrugEntity= filteredEntities.get(0);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//器械
|
|
|
|
|
ThrInsMaterialFeeRequest request = new ThrInsMaterialFeeRequest();
|
|
|
|
|
request.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
|
List<BasicInsMaterialEntity> basicInsMaterialEntities = basicInsMaterialService.filterList(request);
|
|
|
|
|
if (basicInsMaterialEntities.size() > 0){
|
|
|
|
|
basicInsMaterialEntity = basicInsMaterialEntities.get(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
if (thrProductsEntity.getProductType() != 2){
|
|
|
|
|
//不是药品就设置namecode
|
|
|
|
|
udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
udiProductEntity.setPackUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
udiProductEntity.setGgxh(basicInsMaterialEntity != null ? basicInsMaterialEntity.getSpecification() : thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setManufactory(basicInsMaterialEntity != null ? basicInsMaterialEntity.getManufacturerName() : thrProductsEntity.getManufactory());
|
|
|
|
|
}
|
|
|
|
|
if (basicInsDrugEntity != null){
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
//药品设置
|
|
|
|
|
udiProductEntity.setBzgg(basicInsDrugEntity.getPackagingSpec());
|
|
|
|
|
udiProductEntity.setPrepnSpec(basicInsDrugEntity.getPrepnSpec());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(basicInsDrugEntity.getApprovalNum());
|
|
|
|
|
if (basicInsDrugEntity.getInsuranceDrugClass() != null){
|
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(basicInsDrugEntity.getInsuranceDrugClass()));
|
|
|
|
|
}
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(basicInsDrugEntity.getMinPackagingUnit());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
udiProductEntity.setBhxjsl(basicInsDrugEntity.getMinPackagingQuantity());
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(basicInsDrugEntity.getManufacturerName() != null ? basicInsDrugEntity.getManufacturerName() : thrProductsEntity.getManufactory());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
udiProductEntity.setManufactory(thrProductsEntity.getManufactory());
|
|
|
|
|
udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
udiProductEntity.setGgxh(thrProductsEntity.getSpec());
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
//不是药品就设置namecode
|
|
|
|
|
udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
}
|
|
|
|
|
if (thrProductsEntity.getProductType() != 2){
|
|
|
|
|
//不是药品就设置namecode
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//包装单位
|
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
@ -339,4 +390,16 @@ public class UdiContrastService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer setMedicareType(String insuranceDrugClass){
|
|
|
|
|
if ("甲类".equals(insuranceDrugClass)) {
|
|
|
|
|
return 1;
|
|
|
|
|
} else if ("乙类".equals(insuranceDrugClass)) {
|
|
|
|
|
return 2;
|
|
|
|
|
} else if ("丙类".equals(insuranceDrugClass)) {
|
|
|
|
|
return 3;
|
|
|
|
|
} else {
|
|
|
|
|
return null; // 或者 throw new IllegalArgumentException("未知的医保类别");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|