feat: 部门与医保耗材信息分类接口开发

dev_fifo1.0
chenhc 1 year ago
parent 961bd20bbc
commit a273cbce06

@ -5,8 +5,11 @@ import com.glxp.api.annotation.RepeatSubmit;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.Constant;
import com.glxp.api.dao.thrsys.ThrConsumeMaterialCategoryMapper;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.sync.BasicExportStatusRequest;
import com.glxp.api.res.chs.YbHcflEntityResponse;
import com.glxp.api.service.thrsys.ThrConsumeMaterialCategoryService;
import com.glxp.api.service.thrsys.ThrInvOrderService;
import com.glxp.api.task.TestStatOrderService;
import com.glxp.api.util.MsDateUtil;
@ -17,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
@Slf4j
@RestController
@ -26,6 +30,12 @@ public class TestController {
@Resource
ThrInvOrderService thrInvOrderService;
@Resource
ThrConsumeMaterialCategoryService thrConsumeMaterialCategoryService;
@Resource
ThrConsumeMaterialCategoryMapper thrConsumeMaterialCategoryMapper;
@GetMapping("/test/stat/order")
public BaseResponse getStatus(BasicExportStatusRequest basicExportStatusRequest) throws Exception {
@ -97,10 +107,16 @@ public class TestController {
return ResultVOUtils.success("");
}
// @GetMapping("/test/scanInvSfOrderGenerateSfOrder")
// public BaseResponse scanInvSfOrderGenerateSfOrder() {
// thrInvOrderService.scanInvSfOrderGenerateSfOrder();
// return ResultVOUtils.success("");
// }
@GetMapping("/test/ybhcInit")
public BaseResponse ybhcInit() {
//获取分组全表数据
List<YbHcflEntityResponse> list = thrConsumeMaterialCategoryMapper.getYbhcListGroup();
list.forEach( item -> {
thrConsumeMaterialCategoryService.updateYbhcCategory(item);
});
return ResultVOUtils.success("");
}
}

@ -0,0 +1,51 @@
package com.glxp.api.controller.thrsys;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.auth.SysMenu;
import com.glxp.api.entity.thrsys.ThrConsumeMaterialCategory;
import com.glxp.api.entity.thrsys.ThrConsumeMaterialCategoryTree;
import com.glxp.api.service.thrsys.DeptMaterialCategoryService;
import com.glxp.api.service.thrsys.ThrConsumeMaterialCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
public class ThrConsumeMaterialCategoryController {
@Resource
ThrConsumeMaterialCategoryService thrConsumeMaterialCategoryService;
/**
*
*
* @param deptCode code
*/
@GetMapping(value = "/deptCategoryTreeselect/{deptCode}")
public BaseResponse deptCategoryTreeselect(@PathVariable("deptCode") Long deptCode) {
List<ThrConsumeMaterialCategory> list = thrConsumeMaterialCategoryService.selectCategoryList();
// List<ThrConsumeMaterialCategoryTree> categorys = new ArrayList<>(list.size());
// list.forEach( item ->{
// ThrConsumeMaterialCategoryTree tree = new ThrConsumeMaterialCategoryTree();
// BeanUtils.copyProperties(item,tree);
// categorys.add(tree);
// });
Map<String, Object> ajax = new HashMap<>();
ajax.put("checkedKeys", thrConsumeMaterialCategoryService.selectCategoryListByDeptCode(deptCode));
ajax.put("categorys", thrConsumeMaterialCategoryService.buildCategoryTreeSelect(list));
return ResultVOUtils.success(ajax);
}
}

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.DeptMaterialCategory;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DeptMaterialCategoryMapper extends BaseMapper<DeptMaterialCategory> {
List<Long> selectCategoryListByDeptCode(Long deptCode);
}

@ -2,8 +2,12 @@ package com.glxp.api.dao.thrsys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.ThrConsumeMaterialCategory;
import com.glxp.api.res.chs.YbHcflEntityResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ThrConsumeMaterialCategoryMapper extends BaseMapper<ThrConsumeMaterialCategory> {
}
List<YbHcflEntityResponse> getYbhcListGroup();
}

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.glxp.api.entity.auth.SysMenu;
import com.glxp.api.entity.auth.TreeEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@ -88,4 +90,4 @@ public class ThrConsumeMaterialCategory implements Serializable {
private String remark;
private static final long serialVersionUID = 1L;
}
}

@ -0,0 +1,93 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.glxp.api.entity.auth.TreeEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@ApiModel(value="com-glxp-api-entity-thrsys-ThrConsumeMaterialCategory")
@Data
@TableName(value = "thr_consume_material_category")
public class ThrConsumeMaterialCategoryTree extends TreeEntity<ThrConsumeMaterialCategoryTree> implements Serializable {
/**
* ID
*/
@TableId(value = "categoryId", type = IdType.INPUT)
@ApiModelProperty(value="分类ID")
private Long categoryId;
/**
* ID
*/
@TableField(value = "parentCategoryId")
@ApiModelProperty(value="父级分类ID关联自身表")
private Long parentCategoryId;
/**
*
*/
@TableField(value = "categoryName")
@ApiModelProperty(value="分类名称")
private String categoryName;
/**
*
*/
@TableField(value = "description")
@ApiModelProperty(value="分类描述")
private String description;
/**
*
*/
@TableField(value = "`level`")
@ApiModelProperty(value="分类级别")
private Integer level;
/**
*
*/
@TableField(value = "`createUser`")
@ApiModelProperty(value="创建人")
private String createUser;
/**
*
*/
@TableField(value = "createTime")
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
*
*/
@TableField(value = "updateUser")
@ApiModelProperty(value="更新人")
private String updateUser;
/**
*
*/
@TableField(value = "updateTime")
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
*
*/
@TableField(value = "remark")
@ApiModelProperty(value="备注")
private String remark;
private static final long serialVersionUID = 1L;
}

@ -1,12 +1,109 @@
package com.glxp.api.service.thrsys;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.thrsys.DeptMaterialCategoryMapper;
import com.glxp.api.entity.auth.SysRole;
import com.glxp.api.entity.thrsys.ThrConsumeMaterialCategoryTree;
import com.glxp.api.res.chs.YbHcflEntityResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.util.TreeBuildUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.entity.thrsys.ThrConsumeMaterialCategory;
import com.glxp.api.dao.thrsys.ThrConsumeMaterialCategoryMapper;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ThrConsumeMaterialCategoryService extends ServiceImpl<ThrConsumeMaterialCategoryMapper, ThrConsumeMaterialCategory> {
@Resource
CustomerService customerService;
@Resource
DeptMaterialCategoryMapper deptMaterialCategoryMapper;
public void updateYbhcCategory(YbHcflEntityResponse item) {
String catalogname1 = item.getCatalogname1();
String catalogname2 = item.getCatalogname2();
String catalogname3 = item.getCatalogname3();
String catalogcode = item.getCatalogcode();
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));
Date now = new Date();
String userId = String.valueOf(customerService.getUserId());
ThrConsumeMaterialCategory thrConsumeMaterialCategory1 = new ThrConsumeMaterialCategory();
thrConsumeMaterialCategory1.setCategoryId(Long.valueOf(catalogcode1));
thrConsumeMaterialCategory1.setParentCategoryId(0l);
thrConsumeMaterialCategory1.setCategoryName(catalogname1);
thrConsumeMaterialCategory1.setDescription(catalogname1);
thrConsumeMaterialCategory1.setLevel(1);
thrConsumeMaterialCategory1.setCreateUser(userId);
thrConsumeMaterialCategory1.setCreateTime(now);
thrConsumeMaterialCategory1.setUpdateUser(userId);
thrConsumeMaterialCategory1.setUpdateTime(now);
thrConsumeMaterialCategory1.setRemark(catalogname1);
ThrConsumeMaterialCategory thrConsumeMaterialCategory2 = new ThrConsumeMaterialCategory();
thrConsumeMaterialCategory2.setCategoryId(Long.valueOf(catalogcode2));
thrConsumeMaterialCategory2.setParentCategoryId(Long.valueOf(catalogcode1));
thrConsumeMaterialCategory2.setCategoryName(catalogname2);
thrConsumeMaterialCategory2.setDescription(catalogname2);
thrConsumeMaterialCategory2.setLevel(2);
thrConsumeMaterialCategory2.setCreateUser(userId);
thrConsumeMaterialCategory2.setCreateTime(now);
thrConsumeMaterialCategory2.setUpdateUser(userId);
thrConsumeMaterialCategory2.setUpdateTime(now);
thrConsumeMaterialCategory2.setRemark(catalogname2);
ThrConsumeMaterialCategory thrConsumeMaterialCategory3 = new ThrConsumeMaterialCategory();
thrConsumeMaterialCategory3.setCategoryId(Long.valueOf(catalogcode3));
thrConsumeMaterialCategory3.setParentCategoryId(Long.valueOf(catalogcode2));
thrConsumeMaterialCategory3.setCategoryName(catalogname3);
thrConsumeMaterialCategory3.setDescription(catalogname3);
thrConsumeMaterialCategory3.setLevel(3);
thrConsumeMaterialCategory3.setCreateUser(userId);
thrConsumeMaterialCategory3.setCreateTime(now);
thrConsumeMaterialCategory3.setUpdateUser(userId);
thrConsumeMaterialCategory3.setUpdateTime(now);
thrConsumeMaterialCategory3.setRemark(catalogname3);
ThrConsumeMaterialCategory s1 = baseMapper.selectById(catalogcode1);
ThrConsumeMaterialCategory s2 = baseMapper.selectById(catalogcode2);
ThrConsumeMaterialCategory s3 = baseMapper.selectById(catalogcode3);
if (s1 == null )baseMapper.insert(thrConsumeMaterialCategory1);
if (s2 == null )baseMapper.insert(thrConsumeMaterialCategory2);
if (s3 == null )baseMapper.insert(thrConsumeMaterialCategory3);
}
public List<ThrConsumeMaterialCategory> selectCategoryList() {
QueryWrapper<ThrConsumeMaterialCategory> qw = new QueryWrapper<>();
qw.in("level",1,2 );
return baseMapper.selectList(qw);
}
public List<Long> selectCategoryListByDeptCode(Long deptCode) {
return deptMaterialCategoryMapper.selectCategoryListByDeptCode(deptCode);
}
public List<Tree<Long>> buildCategoryTreeSelect(List<ThrConsumeMaterialCategory> categorys) {
if (CollUtil.isEmpty(categorys)) {
return CollUtil.newArrayList();
}
return TreeBuildUtils.buildCategory(categorys, (category, tree) ->
tree.setId(category.getCategoryId())
.setParentId(category.getParentCategoryId())
.setName(category.getCategoryName())
.setWeight(category.getCategoryId()));
}
}

@ -29,4 +29,12 @@ public class TreeBuildUtils extends TreeUtil {
return TreeUtil.build(list, k, DEFAULT_CONFIG, nodeParser);
}
public static <T, K> List<Tree<K>> buildCategory(List<T> list, NodeParser<T, K> nodeParser) {
if (CollUtil.isEmpty(list)) {
return null;
}
K k = ReflectUtils.invokeGetter(list.get(0), "parentCategoryId");
return TreeUtil.build(list, k, DEFAULT_CONFIG, nodeParser);
}
}

@ -3,7 +3,7 @@
<mapper namespace="com.glxp.api.dao.thrsys.DeptMaterialCategoryMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.DeptMaterialCategory">
<!--@mbg.generated-->
<!--@Table udi_wms_pt.dept_material_category-->
<!--@Table dept_material_category-->
<result column="deptCode" jdbcType="BIGINT" property="deptCode" />
<result column="categoryId" jdbcType="BIGINT" property="categoryId" />
</resultMap>
@ -11,4 +11,10 @@
<!--@mbg.generated-->
deptCode, categoryId
</sql>
</mapper>
<select id="selectCategoryListByDeptCode" resultType="java.lang.Long">
select categoryId
from dept_material_category
where deptCode = #{deptCode}
</select>
</mapper>

@ -17,7 +17,13 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
categoryId, parentCategoryId, categoryName, description, `level`, `createUser`, createTime,
categoryId, parentCategoryId, categoryName, description, `level`, `createUser`, createTime,
updateUser, updateTime, remark
</sql>
</mapper>
<select id="getYbhcListGroup" resultType="com.glxp.api.res.chs.YbHcflEntityResponse">
SELECT catalogcode,catalogname2,catalogname3,catalogname1 from yb_hcfl
GROUP BY catalogname3
</select>
</mapper>

@ -1930,3 +1930,8 @@ CREATE TABLE IF NOT EXISTS dept_material_category
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci COMMENT = '部门医保耗材分类关系表'
ROW_FORMAT = DYNAMIC;
INSERT IGNORE INTO auth_menu(`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query_param`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`,
`icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (1866, '科室出库', 1655, 888, 'inout/IoDepartmentOrder', 'inout/IoDepartmentOrder', NULL, 1, 0, 'C', '0', '0', NULL, NULL, '超级用户', '2023-06-14 15:00:11', NULL, NULL, NULL);

Loading…
Cancel
Save