选入产品带入层级

dev_unify
yewj 5 months ago
parent 37f7a7ea76
commit 5f11772edb

@ -7,10 +7,7 @@ import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.thrsys.BasicInsMaterialEntity;
import com.glxp.api.entity.thrsys.ThrProductsAddDiEntity;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.YbDrug;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.exception.JsonException;
import com.glxp.api.http.NmpaUdiClient;
import com.glxp.api.req.basic.UdiCombineRequest;
@ -21,12 +18,10 @@ import com.glxp.api.req.thrsys.ThrInsDrugFeeRequest;
import com.glxp.api.req.thrsys.ThrInsMaterialFeeRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.thrsys.BasicInsMaterialService;
import com.glxp.api.service.thrsys.ThirdAliDrugService;
import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.service.thrsys.YbDrugService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.*;
import com.glxp.api.util.udi.UdiInfoUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -205,6 +200,8 @@ public class UdiContrastService {
.orElse(null);
}
@Resource
ThirdAliDrugService thirdAliDrugService;
public void createOnlyMainId(String mainId) {
FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
@ -233,18 +230,20 @@ public class UdiContrastService {
ybHcflDetailFilterRequest.setPage(1);
ybHcflDetailFilterRequest.setGoodsCode(thrProductsEntity.getYbbm());
List<YbDrug> list = ybDrugService.getList(ybHcflDetailFilterRequest);
UdiProductEntity udiProductEntity = new UdiProductEntity();
BeanUtils.copyProperties(thrProductsEntity, udiProductEntity);
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
if (list != null && list.size() > 0){
if (list != null && list.size() > 0) {
YbDrug ybDrug = list.get(0);
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
udiProductEntity.setPrepnSpec(ybDrug.getRealityOutlook());
udiProductEntity.setZczbhhzbapzbh(ybDrug.getApprovalCode());
udiProductEntity.setCpmctymc(ybDrug.getRegisteredProductName());
udiProductEntity.setSpmc(ybDrug.getGoodsName());
udiProductEntity.setBzgg(String.valueOf(ybDrug.getFactor())+ ybDrug.getMinUnit() + "/" + ybDrug.getUnit());
udiProductEntity.setBzgg(String.valueOf(ybDrug.getFactor()) + ybDrug.getMinUnit() + "/" + ybDrug.getUnit());
udiProductEntity.setMatrial(ybDrug.getMaterialName());
udiProductEntity.setPackMatrial(ybDrug.getMaterialName());
udiProductEntity.setMedicareType(setMedicareType(ybDrug.getProductInsuranceType()));
@ -259,28 +258,46 @@ public class UdiContrastService {
//商品条码 essentialDrugMarkName sptm
// udiProductEntity.setSptm(ybDrug.getBusinessLicense());
udiProductEntity.setPrepnUnit(ybDrug.getRealityMedicinemodel());
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("0.00");
}
udiProductEntity.setUpdateTime(new Date());
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
List<ThirdAliDrug> thirdAliDrugList = thirdAliDrugService.findByByApproved(ybDrug.getApprovalCode());
if (CollUtil.isNotEmpty(thirdAliDrugList)) {
for (int i = 0; i < thirdAliDrugList.size(); i++) {
ThirdAliDrug thirdAliDrug = thirdAliDrugList.get(i);
List<Integer> integers = DimaUtil.calculateLevels(thirdAliDrug.getPackRatio());
udiProductEntity.setPackLevel(thirdAliDrug.getPackLevel());
udiProductEntity.setBhxjsl(integers.get(IntUtil.value(thirdAliDrug.getPackLevel()) - 1));
udiProductEntity.setNameCode(thirdAliDrug.getNameCode());
if (IntUtil.value(thirdAliDrug.getPackLevel()) == 1) {
udiProductEntity.setXjdw(ybDrug.getMinUnit());
udiProductEntity.setBhxjsl(ybDrug.getFactor());
}
udiProductEntity.setDiType(IntUtil.value(thirdAliDrug.getPackLevel()) == 1 ? 1 : 4);
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
udiProductService.insertUdiInfo(udiProductEntity);
}
} else {
udiProductService.insertUdiInfo(udiProductEntity);
}
}
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("0.00");
}
udiProductEntity.setUpdateTime(new Date());
udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
udiProductService.insertUdiInfo(udiProductEntity);
// setLevel(udiRelevanceEntity.getUuid());
UdiProductEntity byUuid = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
udiRelevanceEntity = udiRelevanceService.insertDefaultLevel(udiRelevanceEntity, byUuid);
udiRelevanceService.insertUdiRelevance(udiRelevanceEntity);
udiProductService.updateLevelCount(udiRelevanceEntity);
} else {
//器械
ThrInsMaterialFeeRequest request = new ThrInsMaterialFeeRequest();

@ -172,7 +172,7 @@ public class UdiProductServiceImpl implements UdiProductService {
@Override
public boolean insertUdiInfos(List<UdiProductEntity> udiInfoEntities) {
return udiProductDao.insertUdiInfos(udiInfoEntities);
return udiProductDao.replaceBatchs(udiInfoEntities);
}
@Override

@ -3,6 +3,7 @@ package com.glxp.api.service.thrsys;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
@ -238,4 +239,9 @@ public class ThirdAliDrugService extends ServiceImpl<ThirdAliDrugMapper, ThirdAl
}
return this.baseMapper.filterList(thirdAliDrug);
}
public List<ThirdAliDrug> findByByApproved(String approvalNum) {
return this.baseMapper.selectList(new LambdaQueryWrapper<ThirdAliDrug>().eq(ThirdAliDrug::getApprovalNum, approvalNum));
}
}

@ -0,0 +1,37 @@
package com.glxp.api.util;
import java.util.ArrayList;
import java.util.List;
/**
* @author AnthonyYwj
* @date 2024/11/12
*/
public class DimaUtil {
public static List<Integer> calculateLevels(String ratio) {
// 分割比例字符串并转成整数数组
String[] parts = ratio.split(":");
int[] levels = new int[parts.length];
for (int i = 0; i < parts.length; i++) {
levels[i] = Integer.parseInt(parts[i]);
}
// 存储每层级的倍数关系
List<Integer> calculatedLevels = new ArrayList<>();
for (int i = levels.length - 1; i > 0; i--) {
calculatedLevels.add(levels[i] / levels[i - 1]);
}
// 最后加上最小单位(第一层级为 1
calculatedLevels.add(1);
// 结果倒序
List<Integer> reversed = new ArrayList<>();
for (int i = calculatedLevels.size() - 1; i >= 0; i--) {
reversed.add(calculatedLevels.get(i));
}
return reversed;
}
}

@ -95,10 +95,10 @@
basic_products.cphhhbh,
basic_products.hchzsb
FROM (company_product_relevance
inner JOIN basic_udirel
ON company_product_relevance.udiRlIdFk = basic_udirel.id)
inner JOIN basic_products
ON basic_udirel.uuid = basic_products.uuid
inner JOIN basic_udirel
ON company_product_relevance.udiRlIdFk = basic_udirel.id)
inner JOIN basic_products
ON basic_udirel.uuid = basic_products.uuid
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat(#{ylqxzcrbarmc}, '%')
@ -175,7 +175,7 @@
resultType="com.glxp.api.entity.basic.UdiProductEntity">
SELECT basic_products.*, basic_udirel.purType, basic_udirel.hcType
FROM basic_products
LEFT JOIN basic_udirel ON basic_udirel.uuid = basic_products.uuid
LEFT JOIN basic_udirel ON basic_udirel.uuid = basic_products.uuid
WHERE (basic_products.nameCode = #{nameCode})
limit 1
</select>
@ -201,7 +201,8 @@
catalogname3,
matrial,
destinyType,
productsType,prepnUnit,prepnSpec,storageCondition,transportCondition,indate,packMatrial,majorType,majorStatus,physicType,medicareType,bzgg,
productsType, prepnUnit, prepnSpec, storageCondition, transportCondition, indate, packMatrial, majorType,
majorStatus, physicType, medicareType, bzgg, xjdw,
requireScanCode)
values (#{id}, #{uuid},
#{originUuid},
@ -275,80 +276,80 @@
#{majorStatus},
#{physicType},
#{medicareType},
#{bzgg},
#{bzgg}, #{xjdw},
#{requireScanCode})
</insert>
<insert id="insertUdiInfos" parameterType="java.util.List">
replace INTO basic_products
(id, uuid, originUuid, nameCode, deviceRecordKey, packRatio, packLevel, packUnit, bhxjsl, bhzxxsbzsl,
zxxsbzbhsydysl, bhxjcpbm, bzcj, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm,
ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, sydycpbs, sjcpbm, versionNumber, diType, ybbm, sptm,
manufactory, measname, productType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, cpms,
allowNoBatch, allowNoExpire,
allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2,
basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7,
basicPrductRemak8, updateTime, sfwblztlcp, cgzmraqxgxx, sfbjwycxsy, zdcfsycs, sfwwjbz, syqsfxyjxmj,
mjfs, categoryName, pinyinInitial)
zxxsbzbhsydysl, bhxjcpbm, bzcj, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm,
ylqxzcrbarmc, zczbhhzbapzbh, ylqxzcrbarywmc, sydycpbs, sjcpbm, versionNumber, diType, ybbm, sptm,
manufactory, measname, productType, scbssfbhph, scbssfbhxlh, scbssfbhscrq, scbssfbhsxrq, cpms,
allowNoBatch, allowNoExpire,
allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2,
basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7,
basicPrductRemak8, updateTime, sfwblztlcp, cgzmraqxgxx, sfbjwycxsy, zdcfsycs, sfwwjbz, syqsfxyjxmj,
mjfs, categoryName, pinyinInitial, xjdw)
values
<foreach collection="udiInfoEntities" item="item" index="index"
separator=",">
(#{item.id},
#{item.uuid},
#{item.originUuid},
#{item.nameCode},
#{item.deviceRecordKey},
#{item.packRatio},
#{item.packLevel},
#{item.packUnit},
#{item.bhxjsl},
#{item.bhzxxsbzsl},
#{item.zxxsbzbhsydysl},
#{item.bhxjcpbm},
#{item.bzcj},
#{item.cpmctymc},
#{item.cplb},
#{item.flbm},
#{item.ggxh},
#{item.qxlb},
#{item.tyshxydm},
#{item.ylqxzcrbarmc},
#{item.zczbhhzbapzbh},
#{item.ylqxzcrbarywmc},
#{item.sydycpbs},
#{item.sjcpbm},
#{item.versionNumber},
#{item.diType},
#{item.ybbm},
#{item.sptm},
#{item.manufactory},
#{item.measname},
#{item.productType},
#{item.scbssfbhph},
#{item.scbssfbhxlh},
#{item.scbssfbhscrq},
#{item.scbssfbhsxrq},
#{item.cpms},
#{item.allowNoBatch},
#{item.allowNoExpire},
#{item.allowNoProduct}, #{item.allowNoSerial},
#{item.spmc},
#{item.cplx},
#{item.hchzsb},
#{item.cpdls},
#{item.price},
#{item.basicPrductRemak1},
#{item.basicPrductRemak2},
#{item.basicPrductRemak3},
#{item.basicPrductRemak4},
#{item.basicPrductRemak5},
#{item.basicPrductRemak6},
#{item.basicPrductRemak7},
#{item.basicPrductRemak8}, #{item.updateTime}, #{item.sfwblztlcp}, #{item.cgzmraqxgxx}, #{item.sfbjwycxsy},
#{item.zdcfsycs},
#{item.sfwwjbz}, #{item.syqsfxyjxmj}, #{item.mjfs},
#{item.categoryName}, #{item.pinyinInitial})
#{item.uuid},
#{item.originUuid},
#{item.nameCode},
#{item.deviceRecordKey},
#{item.packRatio},
#{item.packLevel},
#{item.packUnit},
#{item.bhxjsl},
#{item.bhzxxsbzsl},
#{item.zxxsbzbhsydysl},
#{item.bhxjcpbm},
#{item.bzcj},
#{item.cpmctymc},
#{item.cplb},
#{item.flbm},
#{item.ggxh},
#{item.qxlb},
#{item.tyshxydm},
#{item.ylqxzcrbarmc},
#{item.zczbhhzbapzbh},
#{item.ylqxzcrbarywmc},
#{item.sydycpbs},
#{item.sjcpbm},
#{item.versionNumber},
#{item.diType},
#{item.ybbm},
#{item.sptm},
#{item.manufactory},
#{item.measname},
#{item.productType},
#{item.scbssfbhph},
#{item.scbssfbhxlh},
#{item.scbssfbhscrq},
#{item.scbssfbhsxrq},
#{item.cpms},
#{item.allowNoBatch},
#{item.allowNoExpire},
#{item.allowNoProduct}, #{item.allowNoSerial},
#{item.spmc},
#{item.cplx},
#{item.hchzsb},
#{item.cpdls},
#{item.price},
#{item.basicPrductRemak1},
#{item.basicPrductRemak2},
#{item.basicPrductRemak3},
#{item.basicPrductRemak4},
#{item.basicPrductRemak5},
#{item.basicPrductRemak6},
#{item.basicPrductRemak7},
#{item.basicPrductRemak8}, #{item.updateTime}, #{item.sfwblztlcp}, #{item.cgzmraqxgxx}, #{item.sfbjwycxsy},
#{item.zdcfsycs},
#{item.sfwwjbz}, #{item.syqsfxyjxmj}, #{item.mjfs},
#{item.categoryName}, #{item.pinyinInitial}, #{item.xjdw})
</foreach>
</insert>
@ -1006,7 +1007,6 @@
<if test="matrial != null">
matrial=#{matrial},
</if>
</trim>
where id = #{id}
</update>
@ -1038,7 +1038,7 @@
<select id="selectGgxhList" resultType="java.lang.String">
select distinct ggxh
from basic_products
left join basic_udirel on basic_products.uuid = basic_udirel.uuid
left join basic_udirel on basic_products.uuid = basic_udirel.uuid
where basic_udirel.id = #{relId}
</select>

Loading…
Cancel
Save