| | |
| | | |
| | | /** |
| | | * 同步任务 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 同步患者基本信息 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 同步出入院信息 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 同步门诊信息 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | @Override |
| | | public Boolean hnDataGather(HnDataGatherVO hnDataGatherVO) { |
| | | if(ObjectUtils.isEmpty(hnDataGatherVO.getStartTime()) ) |
| | | hnDataGatherVO.setStartTime(new Date()); |
| | | if(ObjectUtils.isEmpty(hnDataGatherVO.getEndTime()) ) |
| | | hnDataGatherVO.setEndTime(new Date()); |
| | | if (ObjectUtils.isEmpty(hnDataGatherVO.getStartTime())) hnDataGatherVO.setStartTime(new Date()); |
| | | if (ObjectUtils.isEmpty(hnDataGatherVO.getEndTime())) hnDataGatherVO.setEndTime(new Date()); |
| | | LocalDate startDate = hnDataGatherVO.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = hnDataGatherVO.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | |
| | |
| | | |
| | | //新增用户与部门 |
| | | //List<SysUserDept> sysUserDept = chMapper.yhyksxx(sysUser1); |
| | | List<SysUserDept> sysUserDept = sysUserDeptAll.stream() |
| | | .filter((SysUserDept b) -> b.getUserCode().equals(sysUser1.getHisUserId())) |
| | | .collect(Collectors.toList()); |
| | | List<SysUserDept> sysUserDept = sysUserDeptAll.stream().filter((SysUserDept b) -> b.getUserCode().equals(sysUser1.getHisUserId())).collect(Collectors.toList()); |
| | | |
| | | for (SysUserDept sud : sysUserDept) { |
| | | if (usersTemp.size() > 0) { |
| | | sud.setUserId(usersTemp.get(0).getUserId()); |
| | | SysDept sysDeptTemp = sysDept2Mapper.selectDeptByCode(sud.getDeptCode()); |
| | | if (sysDeptTemp != null) |
| | | sud.setDeptId(sysDeptTemp.getDeptId()); |
| | | sysUserDeptMapper.insertSysUserDept(sud); |
| | | } |
| | | } |
| | |
| | | log.info("selectDeptList的采集到的数量为:{}", sysDepts.size()); |
| | | // count = sysDept2Mapper.batchDept(sysDepts); |
| | | for(SysDept row : sysDepts){ |
| | | SysDept sysDeptTemp= sysDept2Mapper.selectDeptByCode(row.getDeptCode()); |
| | | SysDept sysDeptTemp = sysDept2Mapper.selectDeptByCode(row.getDeptCode(), null); |
| | | if(sysDeptTemp!=null&&sysDeptTemp.getDeptName()!=null){ |
| | | row.setDeptId(sysDeptTemp.getDeptId()); |
| | | count+=sysDept2Mapper.updateDept(row); |
| | |
| | | return count; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查并执行分表的核心方法 |
| | | * |
| | | * @param tableName 要检查的表名 |
| | | */ |
| | | private synchronized void checkAndShard(String tableName) { |
| | | long currentCount = shardingMapper.getTableCount(tableName); |
| | | |
| | | if (currentCount >= SHARDING_THRESHOLD) { |
| | | log.warn("表 '{}' 已达到分表阈值 {},准备执行分表操作...", tableName, SHARDING_THRESHOLD); |
| | | |
| | | String newTableName = tableName + "_" + java.time.LocalDate.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyy_MM")); |
| | | Long maxId = shardingMapper.getMaxId(tableName); |
| | | if (maxId == null) maxId = 0L; |
| | | |
| | | shardingMapper.renameTable(tableName, newTableName); |
| | | log.info("已将表 '{}' 重命名为 '{}'", tableName, newTableName); |
| | | |
| | | shardingMapper.createLikeTable(tableName, newTableName); |
| | | log.info("已创建新表 '{}'", tableName); |
| | | |
| | | shardingMapper.setAutoIncrement(tableName, maxId + 1); |
| | | log.info("已设置新表 '{}' 的自增ID起始值为 {}", tableName, maxId + 1); |
| | | |
| | | log.info("表 '{}' 的分表操作完成!", tableName); |
| | | } |
| | | } |
| | | |
| | | } |