|
|
|
@ -2,11 +2,13 @@ package com.glxp.api.service.basic;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.entity.thrsys.BasicInsDrugEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.BasicInsMaterialEntity;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
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.apache.xmlbeans.impl.xb.xsdschema.Public;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
@ -274,7 +276,54 @@ public class UdiContrastService {
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (filteredEntities.size() > 0){
|
|
|
|
|
basicInsDrugEntity= filteredEntities.get(0);
|
|
|
|
|
}else {
|
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity,basicInsMaterialEntity,udiRelevanceEntity);
|
|
|
|
|
if (!aBoolean){
|
|
|
|
|
throw new JsonException(500,"系统繁忙");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//循环插入
|
|
|
|
|
for (BasicInsDrugEntity basicInsDrug : basicInsDrugEntities){
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
udiProductEntity.setNameCode(basicInsDrug.getTradeName());
|
|
|
|
|
udiProductEntity.setBzgg(basicInsDrug.getPackagingSpec() != null ? basicInsDrug.getPackagingSpec() :basicInsDrugEntity.getPackagingSpec());
|
|
|
|
|
udiProductEntity.setPrepnSpec(basicInsDrug.getPrepnSpec() != null ? basicInsDrug.getPrepnSpec() :basicInsDrugEntity.getPrepnSpec());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(basicInsDrug.getApprovalNum() != null ? basicInsDrug.getApprovalNum() :basicInsDrugEntity.getApprovalNum());
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
if (basicInsDrugEntity.getInsuranceDrugClass() != null){
|
|
|
|
|
udiProductEntity.setMedicareType(setMedicareType(basicInsDrugEntity.getInsuranceDrugClass()));
|
|
|
|
|
}
|
|
|
|
|
//最小产品单位
|
|
|
|
|
udiProductEntity.setPackUnit(basicInsDrug.getMinPackagingUnit() != null ? basicInsDrug.getMinPackagingUnit() : basicInsDrugEntity.getMinPackagingUnit());
|
|
|
|
|
//设置最小产品数量
|
|
|
|
|
udiProductEntity.setBhxjsl(basicInsDrug.getMinPackagingQuantity() != null ? basicInsDrug.getMinPackagingQuantity() : basicInsDrugEntity.getMinPackagingQuantity());
|
|
|
|
|
//生产厂家
|
|
|
|
|
udiProductEntity.setManufactory(basicInsDrug.getManufacturerName() != null ? basicInsDrug.getManufacturerName() : basicInsDrugEntity.getManufacturerName());
|
|
|
|
|
//商品条码 essentialDrugMarkName sptm
|
|
|
|
|
udiProductEntity.setSptm(basicInsDrug.getEssentialDrugMarkName() != null ? basicInsDrug.getEssentialDrugMarkName() : basicInsDrugEntity.getEssentialDrugMarkName());
|
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getPrepnUnit() == null ? null : thrProductsEntity.getPrepnUnit());
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice(null);
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
}
|
|
|
|
|
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);
|
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
return ;
|
|
|
|
|
}else {
|
|
|
|
|
//器械
|
|
|
|
|
ThrInsMaterialFeeRequest request = new ThrInsMaterialFeeRequest();
|
|
|
|
@ -283,9 +332,85 @@ public class UdiContrastService {
|
|
|
|
|
if (basicInsMaterialEntities.size() > 0){
|
|
|
|
|
basicInsMaterialEntity = basicInsMaterialEntities.get(0);
|
|
|
|
|
}
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
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());
|
|
|
|
|
udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
//包装单位
|
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getPrepnUnit() == null ? null : thrProductsEntity.getPrepnUnit());
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
udiProductEntity.setRequireScanCode(0);
|
|
|
|
|
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
udiProductEntity.setPrice(null);
|
|
|
|
|
}
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, udiProductEntity);
|
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//没有医保编码
|
|
|
|
|
Boolean aBoolean = insertProduct(thrProductsEntity,basicInsMaterialEntity,udiRelevanceEntity);
|
|
|
|
|
if (!aBoolean){
|
|
|
|
|
throw new JsonException(500,"系统繁忙,");
|
|
|
|
|
}
|
|
|
|
|
// 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());
|
|
|
|
|
// }
|
|
|
|
|
// udiProductEntity.setBzgg(thrProductsEntity.getSpec());
|
|
|
|
|
// udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
// udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
//
|
|
|
|
|
// //包装单位
|
|
|
|
|
// udiProductEntity.setPrepnUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
// udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
// udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
// udiProductEntity.setDiType(1);
|
|
|
|
|
// udiProductEntity.setScbssfbhph("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhscrq("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhsxrq("是");
|
|
|
|
|
// udiProductEntity.setScbssfbhxlh("否");
|
|
|
|
|
//
|
|
|
|
|
// udiProductEntity.setProductsType(thrProductsEntity.getProductType());
|
|
|
|
|
// if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
// udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
// udiProductEntity.setMajorStatus(1);
|
|
|
|
|
// }else {
|
|
|
|
|
// udiProductEntity.setRequireScanCode(0);
|
|
|
|
|
// }
|
|
|
|
|
// if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
|
|
|
|
|
// udiProductEntity.setPrice(null);
|
|
|
|
|
// }
|
|
|
|
|
// udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
// udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
// udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, udiProductEntity);
|
|
|
|
|
// udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean insertProduct(ThrProductsEntity thrProductsEntity,BasicInsMaterialEntity basicInsMaterialEntity, UdiRelevanceEntity udiRelevanceEntity ){
|
|
|
|
|
//没有医保编码
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
|
|
|
|
|
if (thrProductsEntity.getProductType() != 2){
|
|
|
|
@ -296,29 +421,12 @@ public class UdiContrastService {
|
|
|
|
|
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.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
|
|
|
|
|
//包装单位
|
|
|
|
|
udiProductEntity.setPrepnUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
udiProductEntity.setPackUnit(thrProductsEntity.getMeasname());
|
|
|
|
|
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
|
|
|
|
|
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
@ -331,6 +439,7 @@ public class UdiContrastService {
|
|
|
|
|
if (thrProductsEntity.getProductType() == 2){
|
|
|
|
|
udiProductEntity.setRequireScanCode(1);
|
|
|
|
|
udiProductEntity.setMajorStatus(1);
|
|
|
|
|
udiProductEntity.setPhysicType(3);
|
|
|
|
|
}else {
|
|
|
|
|
udiProductEntity.setRequireScanCode(0);
|
|
|
|
|
}
|
|
|
|
@ -340,8 +449,8 @@ public class UdiContrastService {
|
|
|
|
|
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, udiProductEntity);
|
|
|
|
|
|
|
|
|
|
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|