|
|
@ -109,7 +109,7 @@ public class UdiContrastService {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isDrugExit(String originUuid,String mainId, String thirdSys) {
|
|
|
|
public boolean isDrugExit(String originUuid, String mainId, String thirdSys) {
|
|
|
|
|
|
|
|
|
|
|
|
String deviceRecordKey = null;
|
|
|
|
String deviceRecordKey = null;
|
|
|
|
//国家库的key
|
|
|
|
//国家库的key
|
|
|
@ -267,9 +267,9 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
|
|
BasicInsDrugEntity basicInsDrugEntity = null;
|
|
|
|
BasicInsDrugEntity basicInsDrugEntity = null;
|
|
|
|
BasicInsMaterialEntity basicInsMaterialEntity = null;
|
|
|
|
BasicInsMaterialEntity basicInsMaterialEntity = null;
|
|
|
|
if (thrProductsEntity.getYbbm() != null){
|
|
|
|
if (thrProductsEntity.getYbbm() != null) {
|
|
|
|
//判断药品还是器械
|
|
|
|
//判断药品还是器械
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
if (thrProductsEntity.getProductType() == 2) {
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
ThrInsDrugFeeRequest thrInsDrugFeeRequest = new ThrInsDrugFeeRequest();
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
thrInsDrugFeeRequest.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
List<BasicInsDrugEntity> basicInsDrugEntities = basicInsDrugService.filterList(thrInsDrugFeeRequest);
|
|
|
|
List<BasicInsDrugEntity> basicInsDrugEntities = basicInsDrugService.filterList(thrInsDrugFeeRequest);
|
|
|
@ -277,38 +277,39 @@ public class UdiContrastService {
|
|
|
|
List<BasicInsDrugEntity> filteredEntities = basicInsDrugEntities.stream()
|
|
|
|
List<BasicInsDrugEntity> filteredEntities = basicInsDrugEntities.stream()
|
|
|
|
.filter(entity -> entity.getGenericName() != null) // 过滤掉 genericName 为 null 的元素
|
|
|
|
.filter(entity -> entity.getGenericName() != null) // 过滤掉 genericName 为 null 的元素
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
if (filteredEntities.size() > 0){
|
|
|
|
if (filteredEntities.size() > 0) {
|
|
|
|
basicInsDrugEntity= filteredEntities.get(0);
|
|
|
|
basicInsDrugEntity = filteredEntities.get(0);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity,basicInsMaterialEntity,udiRelevanceEntity);
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity, basicInsMaterialEntity, udiRelevanceEntity);
|
|
|
|
if (!aBoolean){
|
|
|
|
if (!aBoolean) {
|
|
|
|
throw new JsonException(500,"系统繁忙");
|
|
|
|
throw new JsonException(500, "系统繁忙");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int packLevel = 1; // 初始化计数器
|
|
|
|
int packLevel = 1; // 初始化计数器
|
|
|
|
//循环插入
|
|
|
|
//循环插入
|
|
|
|
for (BasicInsDrugEntity basicInsDrug : basicInsDrugEntities){
|
|
|
|
for (BasicInsDrugEntity basicInsDrug : basicInsDrugEntities) {
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
udiProductEntity.setNameCode(basicInsDrug.getTradeName());
|
|
|
|
udiProductEntity.setNameCode(basicInsDrug.getTradeName());
|
|
|
|
udiProductEntity.setPrepnSpec(basicInsDrug.getPackagingSpec() != null ? basicInsDrug.getPackagingSpec() :basicInsDrugEntity.getPackagingSpec());
|
|
|
|
udiProductEntity.setPrepnSpec(basicInsDrug.getPackagingSpec() != null ? basicInsDrug.getPackagingSpec() : basicInsDrugEntity.getPackagingSpec());
|
|
|
|
// udiProductEntity.setPrepnSpec(basicInsDrug.getPrepnSpec() != null ? basicInsDrug.getPrepnSpec() :basicInsDrugEntity.getPrepnSpec());
|
|
|
|
// udiProductEntity.setPrepnSpec(basicInsDrug.getPrepnSpec() != null ? basicInsDrug.getPrepnSpec() :basicInsDrugEntity.getPrepnSpec());
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(basicInsDrug.getApprovalNum() != null ? basicInsDrug.getApprovalNum() :basicInsDrugEntity.getApprovalNum());
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(basicInsDrug.getApprovalNum() != null ? basicInsDrug.getApprovalNum() : basicInsDrugEntity.getApprovalNum());
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
if (basicInsDrugEntity.getInsuranceDrugClass() != null){
|
|
|
|
if (basicInsDrugEntity != null && basicInsDrugEntity.getInsuranceDrugClass() != null) {
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(basicInsDrugEntity.getInsuranceDrugClass()));
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(basicInsDrugEntity.getInsuranceDrugClass()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//最小产品单位
|
|
|
|
//最小产品单位
|
|
|
|
udiProductEntity.setPackUnit(basicInsDrug.getMinPackagingUnit() != null ? basicInsDrug.getMinPackagingUnit() : basicInsDrugEntity.getMinPackagingUnit());
|
|
|
|
udiProductEntity.setPackUnit(basicInsDrug.getMinPackagingUnit() != null ? basicInsDrug.getMinPackagingUnit() : basicInsDrugEntity.getMinPackagingUnit());
|
|
|
|
//设置最小产品数量
|
|
|
|
//设置最小产品数量
|
|
|
|
udiProductEntity.setBhxjsl(basicInsDrug.getMinPackagingQuantity() != null ? basicInsDrug.getMinPackagingQuantity() : basicInsDrugEntity.getMinPackagingQuantity());
|
|
|
|
udiProductEntity.setBhxjsl(basicInsDrug.getMinPackagingQuantity() != null ? basicInsDrug.getMinPackagingQuantity() : basicInsDrugEntity.getMinPackagingQuantity());
|
|
|
|
//设置包装级别
|
|
|
|
//设置包装级别
|
|
|
|
udiProductEntity.setPackLevel(packLevel + "");
|
|
|
|
udiProductEntity.setPackLevel(packLevel + "");
|
|
|
|
//生产厂家
|
|
|
|
//生产厂家
|
|
|
|
udiProductEntity.setManufactory(basicInsDrug.getManufacturerName() != null ? basicInsDrug.getManufacturerName() : basicInsDrugEntity.getManufacturerName());
|
|
|
|
udiProductEntity.setManufactory(basicInsDrug.getManufacturerName() != null ? basicInsDrug.getManufacturerName() : basicInsDrugEntity.getManufacturerName());
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
udiProductEntity.setSptm(basicInsDrug.getEssentialDrugMarkName() != null ? basicInsDrug.getEssentialDrugMarkName() : basicInsDrugEntity.getEssentialDrugMarkName());
|
|
|
|
udiProductEntity.setSptm(basicInsDrug.getEssentialDrugMarkName() != null ? basicInsDrug.getEssentialDrugMarkName() : basicInsDrugEntity.getEssentialDrugMarkName());
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getPrepnUnit() == null ? null : thrProductsEntity.getPrepnUnit());
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getPrepnUnit() == null ? null : thrProductsEntity.getPrepnUnit());
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
@ -331,12 +332,12 @@ public class UdiContrastService {
|
|
|
|
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
//器械
|
|
|
|
//器械
|
|
|
|
ThrInsMaterialFeeRequest request = new ThrInsMaterialFeeRequest();
|
|
|
|
ThrInsMaterialFeeRequest request = new ThrInsMaterialFeeRequest();
|
|
|
|
request.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
request.setMedCatalogCode(thrProductsEntity.getYbbm());
|
|
|
|
List<BasicInsMaterialEntity> basicInsMaterialEntities = basicInsMaterialService.filterList(request);
|
|
|
|
List<BasicInsMaterialEntity> basicInsMaterialEntities = basicInsMaterialService.filterList(request);
|
|
|
|
if (basicInsMaterialEntities.size() > 0){
|
|
|
|
if (basicInsMaterialEntities.size() > 0) {
|
|
|
|
basicInsMaterialEntity = basicInsMaterialEntities.get(0);
|
|
|
|
basicInsMaterialEntity = basicInsMaterialEntities.get(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
@ -370,10 +371,11 @@ public class UdiContrastService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//没有医保编码
|
|
|
|
//没有医保编码
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity,basicInsMaterialEntity,udiRelevanceEntity);
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity, basicInsMaterialEntity, udiRelevanceEntity);
|
|
|
|
if (!aBoolean){
|
|
|
|
if (!aBoolean) {
|
|
|
|
throw new JsonException(500,"系统繁忙,");
|
|
|
|
throw new JsonException(500, "系统繁忙,");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
// UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
// UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
// BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
// BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
// if (thrProductsEntity.getProductType() != 2){
|
|
|
|
// if (thrProductsEntity.getProductType() != 2){
|
|
|
@ -416,11 +418,11 @@ public class UdiContrastService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Boolean insertProduct(ThrProductsEntity thrProductsEntity,BasicInsMaterialEntity basicInsMaterialEntity, UdiRelevanceEntity udiRelevanceEntity ){
|
|
|
|
public Boolean insertProduct(ThrProductsEntity thrProductsEntity, BasicInsMaterialEntity basicInsMaterialEntity, UdiRelevanceEntity udiRelevanceEntity) {
|
|
|
|
//没有医保编码
|
|
|
|
//没有医保编码
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
if (thrProductsEntity.getProductType() != 2){
|
|
|
|
if (thrProductsEntity.getProductType() != 2) {
|
|
|
|
//不是药品就设置namecode
|
|
|
|
//不是药品就设置namecode
|
|
|
|
udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
@ -443,11 +445,11 @@ public class UdiContrastService {
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
|
|
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
if (thrProductsEntity.getProductType() == 2) {
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
udiProductEntity.setRequireScanCode(0);
|
|
|
|
udiProductEntity.setRequireScanCode(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
@ -506,7 +508,7 @@ public class UdiContrastService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer setMedicareType(String insuranceDrugClass){
|
|
|
|
public Integer setMedicareType(String insuranceDrugClass) {
|
|
|
|
if ("甲类".equals(insuranceDrugClass)) {
|
|
|
|
if ("甲类".equals(insuranceDrugClass)) {
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
} else if ("乙类".equals(insuranceDrugClass)) {
|
|
|
|
} else if ("乙类".equals(insuranceDrugClass)) {
|
|
|
@ -518,9 +520,9 @@ public class UdiContrastService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setLevel(String uuid){
|
|
|
|
public void setLevel(String uuid) {
|
|
|
|
List<UdiProductEntity> list = udiProductService.getList(uuid);
|
|
|
|
List<UdiProductEntity> list = udiProductService.getList(uuid);
|
|
|
|
if (list.size() > 1){
|
|
|
|
if (list.size() > 1) {
|
|
|
|
// 根据条件设置上级和下级标识
|
|
|
|
// 根据条件设置上级和下级标识
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
// 设置上级标识
|
|
|
|
// 设置上级标识
|
|
|
|