|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.glxp.api.service.thrsys;
|
|
|
|
package com.glxp.api.service.thrsys;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
|
|
import cn.hutool.core.lang.tree.Tree;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.glxp.api.dao.thrsys.DeptMaterialCategoryMapper;
|
|
|
|
import com.glxp.api.dao.thrsys.DeptMaterialCategoryMapper;
|
|
|
@ -16,8 +17,8 @@ import com.glxp.api.dao.thrsys.ThrConsumeMaterialCategoryMapper;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ -28,6 +29,10 @@ public class ThrConsumeMaterialCategoryService extends ServiceImpl<ThrConsumeMat
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
DeptMaterialCategoryMapper deptMaterialCategoryMapper;
|
|
|
|
DeptMaterialCategoryMapper deptMaterialCategoryMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过 catalogcode和 三级name 更新 医保分类列表
|
|
|
|
|
|
|
|
* @param item
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void updateYbhcCategory(YbHcflEntityResponse item) {
|
|
|
|
public void updateYbhcCategory(YbHcflEntityResponse item) {
|
|
|
|
String catalogname1 = item.getCatalogname1();
|
|
|
|
String catalogname1 = item.getCatalogname1();
|
|
|
|
String catalogname2 = item.getCatalogname2();
|
|
|
|
String catalogname2 = item.getCatalogname2();
|
|
|
@ -86,16 +91,49 @@ public class ThrConsumeMaterialCategoryService extends ServiceImpl<ThrConsumeMat
|
|
|
|
if (s3 == null )baseMapper.insert(thrConsumeMaterialCategory3);
|
|
|
|
if (s3 == null )baseMapper.insert(thrConsumeMaterialCategory3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取1、2级列表
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
public List<ThrConsumeMaterialCategory> selectCategoryList() {
|
|
|
|
public List<ThrConsumeMaterialCategory> selectCategoryList() {
|
|
|
|
QueryWrapper<ThrConsumeMaterialCategory> qw = new QueryWrapper<>();
|
|
|
|
QueryWrapper<ThrConsumeMaterialCategory> qw = new QueryWrapper<>();
|
|
|
|
qw.in("level",1,2 );
|
|
|
|
qw.in("level",1,2 );
|
|
|
|
return baseMapper.selectList(qw);
|
|
|
|
return baseMapper.selectList(qw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过deptCode获取绑定的医保分类列表的id
|
|
|
|
|
|
|
|
* @param deptCode
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
public List<Long> selectCategoryListByDeptCode(Long deptCode) {
|
|
|
|
public List<Long> selectCategoryListByDeptCode(Long deptCode) {
|
|
|
|
return deptMaterialCategoryMapper.selectCategoryListByDeptCode(deptCode);
|
|
|
|
return deptMaterialCategoryMapper.selectCategoryListByDeptCode(deptCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过deptCode获取绑定的医保分类列表的id
|
|
|
|
|
|
|
|
* @param deptCode
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public List<ThrConsumeMaterialCategory> selectListByDeptCode(Long deptCode) {
|
|
|
|
|
|
|
|
List<ThrConsumeMaterialCategory> list = deptMaterialCategoryMapper.selectListByDeptCode(deptCode);
|
|
|
|
|
|
|
|
List<ThrConsumeMaterialCategory> allCategory = baseMapper.selectList(null);
|
|
|
|
|
|
|
|
Set<ThrConsumeMaterialCategory> set = new HashSet<>();
|
|
|
|
|
|
|
|
list.forEach( x -> {
|
|
|
|
|
|
|
|
ThrConsumeMaterialCategory parentCategoryObject = getParentCategoryObject(allCategory, x);
|
|
|
|
|
|
|
|
if (parentCategoryObject!= null){
|
|
|
|
|
|
|
|
set.add(parentCategoryObject);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
list.addAll(set);
|
|
|
|
|
|
|
|
List<ThrConsumeMaterialCategory> collect = list.stream().sorted(Comparator.comparing(ThrConsumeMaterialCategory::getCategoryId)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
return collect;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 构建医保分类列表树
|
|
|
|
|
|
|
|
* @param categorys
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
public List<Tree<Long>> buildCategoryTreeSelect(List<ThrConsumeMaterialCategory> categorys) {
|
|
|
|
public List<Tree<Long>> buildCategoryTreeSelect(List<ThrConsumeMaterialCategory> categorys) {
|
|
|
|
if (CollUtil.isEmpty(categorys)) {
|
|
|
|
if (CollUtil.isEmpty(categorys)) {
|
|
|
|
return CollUtil.newArrayList();
|
|
|
|
return CollUtil.newArrayList();
|
|
|
@ -106,4 +144,46 @@ public class ThrConsumeMaterialCategoryService extends ServiceImpl<ThrConsumeMat
|
|
|
|
.setName(category.getCategoryName())
|
|
|
|
.setName(category.getCategoryName())
|
|
|
|
.setWeight(category.getCategoryId()));
|
|
|
|
.setWeight(category.getCategoryId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 解析 医保耗材编码 返回 一二三级分类
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public YbHcflEntityResponse parseEncodeReturnName(String catalogCode){
|
|
|
|
|
|
|
|
YbHcflEntityResponse response = new YbHcflEntityResponse();
|
|
|
|
|
|
|
|
response.setCatalogcode(catalogCode);
|
|
|
|
|
|
|
|
if (catalogCode.length() < 7) return response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer catalogcode1 = Integer.valueOf(catalogCode.substring(1, 3));
|
|
|
|
|
|
|
|
Integer catalogcode2 = Integer.valueOf(catalogcode1 + catalogCode.substring(3, 5));
|
|
|
|
|
|
|
|
Integer catalogcode3 = Integer.valueOf(catalogcode2 + catalogCode.substring(5, 7));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<ThrConsumeMaterialCategory> qw = new QueryWrapper<>();
|
|
|
|
|
|
|
|
qw.in("id",catalogcode1,catalogcode2,catalogcode3 );
|
|
|
|
|
|
|
|
List<ThrConsumeMaterialCategory> list = baseMapper.selectList(qw);
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)){
|
|
|
|
|
|
|
|
list.forEach( x -> {
|
|
|
|
|
|
|
|
Integer level = x.getLevel();
|
|
|
|
|
|
|
|
switch (level) {
|
|
|
|
|
|
|
|
case 1: response.setCatalogname1(x.getCategoryName());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: response.setCatalogname2(x.getCategoryName());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: response.setCatalogname3(x.getCategoryName());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ThrConsumeMaterialCategory getParentCategoryObject(List<ThrConsumeMaterialCategory> allCategory,ThrConsumeMaterialCategory category) {
|
|
|
|
|
|
|
|
if (category.getParentCategoryId() == 0) {
|
|
|
|
|
|
|
|
return category;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ThrConsumeMaterialCategory tblCategory = allCategory.stream().filter(
|
|
|
|
|
|
|
|
x -> Objects.equals(x.getCategoryId(), category.getParentCategoryId())
|
|
|
|
|
|
|
|
).findFirst().get();
|
|
|
|
|
|
|
|
return getParentCategoryObject(allCategory,tblCategory);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|