| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Array; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import static com.ruoyi.framework.datasource.DynamicDataSourceContextHolder.log; |
| | | |
| | | /** |
| | | * æ²³åé鿣è
ä¿¡æ¯æ¥å£Controller |
| | |
| | | //@PreAuthorize("@ss.hasPermi('smartor:patouthosp:list')") |
| | | @PostMapping("/selectGatherList") |
| | | @ApiOperation("æ²³åæ°æ®éé") |
| | | public Integer selectUserList(@RequestBody SysUser sysUser) { |
| | | // Integer integer = ihnGatherPatArchiveService.selectUserList(null); |
| | | // Integer deptInt = ihnGatherPatArchiveService.selectDeptList(null); |
| | | // Integer icdInt = ihnGatherPatArchiveService.selectIcd10List(null); |
| | | Integer integer = ihnGatherPatArchiveService.selectPatMedInhospList(new PatMedInhosp()); |
| | | return integer; |
| | | public Integer selectUserList(@RequestBody PatMedInhosp patMedInhosp) { |
| | | // Integer sd = ihnGatherPatArchiveService.selectDeptList(null); |
| | | // Integer su = ihnGatherPatArchiveService.selectUserList(null); |
| | | // Integer icd = ihnGatherPatArchiveService.selectIcd10List(null); |
| | | |
| | | log.info("å¼å§æå¤©åæ¥ç¨æ·æ°æ®ï¼æ¶é´èå´: {} å° {}", patMedInhosp.getStartOutHospTime(), patMedInhosp.getEndOutHospTime()); |
| | | |
| | | LocalDate startDate = patMedInhosp.getStartOutHospTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate endDate = patMedInhosp.getEndOutHospTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | |
| | | Integer po = null; |
| | | // 循ç¯å¤çæ¯ä¸å¤© |
| | | for (LocalDate currentDate = startDate; !currentDate.isAfter(endDate); currentDate = currentDate.plusDays(1)) { |
| | | PatMedInhosp dailyCondition = new PatMedInhosp(); |
| | | LocalDateTime dayStart = currentDate.atStartOfDay(); |
| | | LocalDateTime dayEnd = currentDate.atTime(23, 59, 59); |
| | | dailyCondition.setStartOutHospTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant())); |
| | | dailyCondition.setEndOutHospTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant())); |
| | | Integer pi = ihnGatherPatArchiveService.selectPatMedInhospList(dailyCondition); |
| | | |
| | | PatMedOuthosp patMedOuthosp = new PatMedOuthosp(); |
| | | patMedOuthosp.setBeginTime(Date.from(dayStart.atZone(ZoneId.systemDefault()).toInstant())); |
| | | patMedOuthosp.setEndTime(Date.from(dayEnd.atZone(ZoneId.systemDefault()).toInstant())); |
| | | po = ihnGatherPatArchiveService.selectPatMedOuthospList(patMedOuthosp); |
| | | } |
| | | return po; |
| | | } |
| | | |
| | | } |
| | |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é(å
¬å¸) |
| | | enabled: true |
| | | url: jdbc:postgresql://10.10.13.108:5432/hdr |
| | | url: jdbc:postgresql://10.10.13.108:5432/hdr?socketTimeout=300000 |
| | | username: mbsjjk |
| | | password: sjjk@2025 |
| | | driver-class-name: org.postgresql.Driver |
| | |
| | | # validationQuery: SELECT 1 FROM DUAL |
| | | validationQuery: SELECT 1 |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnBorrow: true |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | |
| | | # å½é
åèµæºæä»¶è·¯å¾ |
| | | basename: i18n/messages |
| | | profiles: |
| | | active: druid |
| | | active: hn |
| | | # æä»¶ä¸ä¼ |
| | | servlet: |
| | | multipart: |
| | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.ScheduledThreadPoolExecutor; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | |
| | | * ä¿®æ¹ SQLï¼æ³¨å
¥ orgid æ¡ä»¶ |
| | | * |
| | | * @param originalSql åå§ SQL |
| | | * @param orgId å½åå»é¢ ID |
| | | * @param orgid å½åå»é¢ ID |
| | | * @return ä¿®æ¹åç SQL |
| | | */ |
| | | private String modifySqlWithOrgId(String originalSql, String orgid) { |
| | | if (originalSql.contains("insert into") || originalSql.contains("INSERT INTO") || originalSql.contains("from sys_menu") || originalSql.contains("sys_job") || originalSql.contains("update sys_menu") || originalSql.contains("information_schema.tables") || originalSql.contains("information_schema.columns") || originalSql.contains("gen_table") || originalSql.toUpperCase().contains("ORGID IS NULL") || originalSql.toUpperCase().contains("FROM CRYXX") || originalSql.toUpperCase().contains("FROM MZXX") || originalSql.toUpperCase().contains("FROM JBXX") || originalSql.toUpperCase().contains("FROM BMXX")) { |
| | | if (originalSql.contains("insert into") |
| | | || originalSql.contains("INSERT INTO") |
| | | || originalSql.contains("from sys_menu") |
| | | || originalSql.contains("sys_job") |
| | | || originalSql.contains("update sys_menu") |
| | | || originalSql.contains("information_schema.tables") |
| | | || originalSql.contains("information_schema.columns") |
| | | || originalSql.contains("gen_table") |
| | | || originalSql.toUpperCase().contains("ORGID IS NULL") |
| | | || originalSql.toUpperCase().contains("FROM CRYXX") |
| | | || originalSql.toUpperCase().contains("FROM MZXX") |
| | | || originalSql.toUpperCase().contains("FROM JBXX") |
| | | || originalSql.toUpperCase().contains("FROM BMXX") |
| | | || originalSql.toUpperCase().contains("FROM HZJBXX") |
| | | || originalSql.toUpperCase().contains("RENAME TABLE") |
| | | || originalSql.toUpperCase().contains("FROM YHYKSXX") |
| | | || originalSql.toUpperCase().contains("FROM YHYJSXX") |
| | | || originalSql.toUpperCase().contains("ALTER TABLE") |
| | | || originalSql.toUpperCase().contains("CREATE TABLE")) { |
| | | return originalSql; |
| | | } |
| | | // æå orgid ç WHERE åå¥ |
| | |
| | | private String idcardno; |
| | | |
| | | |
| | | /** |
| | | * å°±è¯å¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å°±è¯å¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date starttime; |
| | | |
| | | /** |
| | | * å°±è¯ç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å°±è¯ç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endtime; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.annotation.DataSource; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import com.ruoyi.common.enums.DataSourceType; |
| | | import com.smartor.domain.*; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public List<PatArchive> selectPatArchiveList(PatArchive patArchive); |
| | | |
| | | /** |
| | | * ç¨æ·ä¸è§è²ä¿¡æ¯ |
| | | * |
| | | * @param sysUser |
| | | * @return |
| | | */ |
| | | public SysUserRole yhyjsxx(SysUser sysUser); |
| | | |
| | | /** |
| | | * ç¨æ·ä¸ç§å®¤ä¿¡æ¯ |
| | | * |
| | | * @param sysUser |
| | | * @return |
| | | */ |
| | | public SysUserDept yhyksxx(SysUser sysUser); |
| | | |
| | | /** |
| | | * åºå
¥é¢ä¿¡æ¯ |
| | | * |
| | | * @param patMedInhosp |
| | |
| | | public List<PatMedInhosp> selectPatMedInhospList(PatMedInhosp patMedInhosp); |
| | | |
| | | public Long selectPatMedInhospListCount(PatMedInhosp patMedInhosp); |
| | | |
| | | List<PatArchive> selectPatArchiveListByLastId(@Param("lastRowNumber") long lastRowNumber, @Param("ps") int ps); |
| | | |
| | | List<PatMedInhosp> selectPatMedInhospListByLastId(@Param("lastRowNumber") long lastRowNumber, @Param("ps") int ps); |
| | | |
| | | public Long selectPatArchiveCount(PatMedInhosp patMedInhosp); |
| | | |
| | | /** |
| | |
| | | import com.smartor.domain.PatArchiveOthreInfo; |
| | | import com.smartor.domain.PatArchiveReq; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public PatArchive selectPatArchiveByPatid(Long patid); |
| | | |
| | | List<PatArchive> selectPatArchiveByPatnos(@Param("patnos") List<String> patnos); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
æ¡£æ¡å表 |
| | | * |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.PatArchive; |
| | | import com.smartor.domain.PatArchiveOthreInfo; |
| | | import com.smartor.domain.PatArchiveReq; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£è
æ¡£æ¡Mapperæ¥å£ |
| | | * |
| | | * @author smartor |
| | | * @date 2023-03-04 |
| | | */ |
| | | @Mapper |
| | | public interface ShardingMapper { |
| | | long getTableCount(@Param("tableName") String tableName); |
| | | |
| | | Long getMaxId(@Param("tableName") String tableName); |
| | | |
| | | void renameTable(@Param("oldName") String oldName, @Param("newName") String newName); |
| | | |
| | | void createLikeTable(@Param("newTableName") String newTableName, @Param("templateTableName") String templateTableName); |
| | | |
| | | void setAutoIncrement(@Param("tableName") String tableName, @Param("value") long value); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·ä¸è§è²å
³è表 æ°æ®å± |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysUserRole2Mapper |
| | | { |
| | | /** |
| | | * éè¿ç¨æ·IDå é¤ç¨æ·åè§è²å
³è |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteUserRoleByUserId(Long userId); |
| | | |
| | | /** |
| | | * æ¹éå é¤ç¨æ·åè§è²å
³è |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteUserRole(Long[] ids); |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢è§è²ä½¿ç¨æ°é |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | | public int countUserRoleByRoleId(Long roleId); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢ç¨æ·è§è²ä¿¡æ¯ |
| | | * |
| | | * @param userRoleList ç¨æ·è§è²å表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batchUserRole(List<SysUserRole> userRoleList); |
| | | |
| | | /** |
| | | * å é¤ç¨æ·åè§è²å
³èä¿¡æ¯ |
| | | * |
| | | * @param userRole ç¨æ·åè§è²å
³èä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteUserRoleInfo(SysUserRole userRole); |
| | | |
| | | /** |
| | | * æ¹éåæ¶ææç¨æ·è§è² |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @param userIds éè¦å é¤çç¨æ·æ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.core.domain.entity.SysUserDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUserRole; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IHNGatherPatArchiveService; |
| | | import com.smartor.service.IPatArchiveService; |
| | | import com.smartor.service.IPatMedInhospService; |
| | | import com.smartor.service.IPatMedPhysicalService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFDateUtil; |
| | | import org.apache.poi.ss.usermodel.DataFormatter; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ£è
æ¡£æ¡Serviceä¸å¡å±å¤ç |
| | |
| | | private SysUser2Mapper sysUser2Mapper; |
| | | |
| | | @Autowired |
| | | private SysUserRole2Mapper sysUserRoleMapper; |
| | | |
| | | @Autowired |
| | | private SysDept2Mapper sysDept2Mapper; |
| | | |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | |
| | | @Autowired |
| | | private Icd10Mapper icd10Mapper; |
| | |
| | | @Autowired |
| | | private PatArchiveMapper patArchiveMapper; |
| | | |
| | | @Autowired |
| | | private ThreadPoolTaskExecutor taskExecutor; |
| | | |
| | | @Autowired |
| | | private ShardingMapper shardingMapper; |
| | | |
| | | private static final long SHARDING_THRESHOLD = 5_000_000L; |
| | | private static final String PAT_ARCHIVE_TABLE = "pat_archive"; |
| | | private static final String PAT_MED_INHOSP_TABLE = "pat_med_inhosp"; |
| | | |
| | | |
| | | @Override |
| | | public List<PatArchive> selectPatArchiveList(PatArchive patArchive) { |
| | | return hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | } |
| | | |
| | | // @Override |
| | | // public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) { |
| | | // // 弿¥æ§è¡æ´ä¸ªæ°æ®åæ¥ä»»å¡ |
| | | // taskExecutor.execute(() -> { |
| | | // log.info("å¼å§æ§è¡æ°æ®åæ¥ä»»å¡..."); |
| | | // syncPatArchivesInOrder(); // å
忥æ£è
|
| | | // syncPatMedInhosp(); // å忥åºå
¥é¢ |
| | | // log.info("æ°æ®åæ¥ä»»å¡æäº¤å®æ¯ã"); |
| | | // }); |
| | | // return 0; // è¿å0表示任å¡å·²æäº¤å°åå°æ§è¡ |
| | | // } |
| | | |
| | | |
| | | @Override |
| | | public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp) { |
| | | Long patArchiveCount = hnGatherPatArchiveMapper.selectPatArchiveCount(null); |
| | | Long patOffst = (patArchiveCount + 1000 - 1) / 1000; |
| | | PatArchive patArchive = new PatArchive(); |
| | | Long patSize = 0L; |
| | | for (int i = 0; i <= patOffst; i++) { |
| | | patArchive.setPs(1000); |
| | | patArchive.setPn(1000 * i); |
| | | List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | if (patArchives != null && !patArchives.isEmpty()) { |
| | | patArchiveMapper.insertPatArchive(patArchives); |
| | | } |
| | | patSize = patSize + patArchives.size(); |
| | | } |
| | | log.info("patArchiveså¤çç»æä¸å
±:{}", patSize); |
| | | |
| | | |
| | | Long count = hnGatherPatArchiveMapper.selectPatMedInhospListCount(null); |
| | | Long aa = (count + 1000 - 1) / 1000; |
| | | //è¿è¡å页æ¥è¯¢ |
| | | for (int i = 0; i <= aa; i++) { |
| | | patMedInhosp.setPs(1000); |
| | | patMedInhosp.setPn(1000 * i); |
| | | List<PatMedInhosp> patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp); |
| | | for (PatMedInhosp pm : patMedInhospList) { |
| | | String patno = pm.getPatno(); |
| | | PatArchive pa = new PatArchive(); |
| | | //å
廿们èªå·±ç表ééè¿patnoæ¥è¯¢è¯¥æ£è
æ¯å¦åå¨ |
| | | pa.setPatientno(patno); |
| | | List<PatArchive> patArchives = patArchiveMapper.selectPatArchiveList(pa); |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatientno(pm.getPatno()); |
| | | List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | if (CollectionUtils.isEmpty(patArchives)) { |
| | | //空äºç´æ¥ä¸¢æ |
| | | continue; |
| | | } |
| | | PatArchive pa = new PatArchive(); |
| | | pa.setPatientno(patArchives.get(0).getPatientno()); |
| | | List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | pm.setPatid(patArchives1.get(0).getId()); |
| | | } else { |
| | | //ç´æ¥å°patidæ¾å°åºå
¥é¢è¡¨ä¸ |
| | | patArchiveMapper.insertPatArchiveSingle(patArchives.get(0)); |
| | | pm.setPatid(patArchives.get(0).getId()); |
| | | } |
| | | patMedInhospMapper.insertPatMedInhosp(pm); |
| | | } |
| | | if (patMedInhospList != null && !patMedInhospList.isEmpty()) { |
| | | patMedInhospMapper.insertPatMedInhospBatch(patMedInhospList); |
| | | return 0; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) { |
| | | List<PatMedOuthosp> patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp); |
| | | log.info("selectPatMedOuthospListçééå°çæ°é为ï¼{}", patMedOuthosps.size()); |
| | | int i = patMedOuthospMapper.batchPatMedOuthosp(patMedOuthosps); |
| | | Integer i = null; |
| | | for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { |
| | | //è·åæ£è
åºæ¬ä¿¡æ¯ |
| | | PatArchive patArchive = new PatArchive(); |
| | | patArchive.setPatientno(patMedOuthosp1.getPatno()); |
| | | List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); |
| | | |
| | | //æ ¹æ®patno夿æ¬å°æ£è
åºæ¬ä¿¡æ¯æ¯å¦åå¨ |
| | | PatArchive pa = new PatArchive(); |
| | | pa.setPatientno(patMedOuthosp1.getPatno()); |
| | | List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | patMedOuthosp1.setPatid(patArchives1.get(0).getId()); |
| | | } else { |
| | | patArchiveMapper.insertPatArchiveSingle(patArchives.get(0)); |
| | | patMedOuthosp1.setPatid(patArchives.get(0).getId()); |
| | | } |
| | | i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1); |
| | | } |
| | | |
| | | return i; |
| | | } |
| | |
| | | List<SysUser> sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser); |
| | | log.info("sysUserListçééå°çæ°é为ï¼{}", sysUserList.size()); |
| | | int i = sysUser2Mapper.batchUser(sysUserList); |
| | | for (SysUser sysUser1 : sysUserList) { |
| | | log.info("sysUser1çID为ï¼{}", sysUser1.getUserId()); |
| | | log.info("sysUser1çHISUSERID为ï¼{}", sysUser1.getHisUserId()); |
| | | //æ°å¢ç¨æ·ä¸è§è² |
| | | SysUserRole yhyjsxx = hnGatherPatArchiveMapper.yhyjsxx(sysUser1); |
| | | if (yhyjsxx == null) continue; |
| | | yhyjsxx.setUserId(sysUser1.getUserId()); |
| | | List<SysUserRole> userRoleList = new ArrayList<>(); |
| | | userRoleList.add(yhyjsxx); |
| | | sysUserRoleMapper.batchUserRole(userRoleList); |
| | | |
| | | //æ°å¢ç¨æ·ä¸é¨é¨ |
| | | if (StringUtils.isEmpty(sysUser1.getHisUserId())) continue; |
| | | SysUserDept sysUserDept = hnGatherPatArchiveMapper.yhyksxx(sysUser1); |
| | | if (Objects.isNull(sysUserDept) || sysUserDept.getDeptId() == null) continue; |
| | | SysDept dept = new SysDept(); |
| | | dept.setHisDeptId(sysUserDept.getDeptId().toString()); |
| | | List<SysDept> sysDepts = sysDept2Mapper.selectDeptList(dept); |
| | | if (CollectionUtils.isNotEmpty(sysDepts)) { |
| | | sysUserDept.setDeptId(sysDepts.get(0).getDeptId()); |
| | | sysUserDept.setDeptCode(sysDepts.get(0).getDeptCode()); |
| | | } |
| | | sysUserDept.setUserId(sysUser1.getUserId()); |
| | | sysUserDeptMapper.insertSysUserDept(sysUserDept); |
| | | |
| | | } |
| | | |
| | | return i; |
| | | } |
| | | |
| | |
| | | int i = sysDept2Mapper.batchDept(sysDepts); |
| | | return i; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ£æ¥å¹¶æ§è¡åè¡¨çæ ¸å¿æ¹æ³ |
| | | * |
| | | * @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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.smartor.mapper.HNGatherPatArchiveMapper"> |
| | | |
| | | |
| | | <resultMap type="com.ruoyi.common.core.domain.entity.SysUserDept" id="SysUserDeptResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="orgid" column="orgid"/> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="deptId" column="dept_id"/> |
| | | <result property="delFlag" column="del_flag"/> |
| | | <result property="deptCode" column="dept_code"/> |
| | | <result property="deptName" column="dept_name"/> |
| | | <result property="deptType" column="dept_type"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap type="com.ruoyi.common.core.domain.entity.SysUserRole" id="SysUserRoleResult"> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="roleId" column="role_id"/> |
| | | <result property="orgid" column="orgid"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="patientno" column="patientno"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectPatArchiveVo"> |
| | | select id, |
| | | notrequired_flag, |
| | | select notrequired_flag, |
| | | notrequiredreason, |
| | | patientno, |
| | | filter_drname, |
| | | filter_drcode, |
| | | patid_his, |
| | | age_unit, |
| | | age_unit2, |
| | | sd_flag, |
| | | name, |
| | | sex, |
| | | idcardno, |
| | | birthdate, |
| | | age, |
| | | age2, |
| | | nation, |
| | | native_place, |
| | | place_of_residence, |
| | |
| | | idcardtype, |
| | | orgid, |
| | | openid, |
| | | del_flag, |
| | | update_by, |
| | | update_time, |
| | | create_by, |
| | | create_time, |
| | | isupload, |
| | | pattype, |
| | | viptype, |
| | | upload_time, |
| | | care_facilities, |
| | | case_path, |
| | | degree_of_education, |
| | |
| | | income, |
| | | medicare_type, |
| | | care_person, |
| | | guid, |
| | | case_person_age |
| | | from hzjbxx |
| | | </sql> |
| | | |
| | | |
| | | <select id="yhyjsxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserRoleResult"> |
| | | select user_id, role_id, orgid |
| | | FROM yhyjsxx |
| | | <where> |
| | | <if test="hisUserId != null ">and user_id = #{hisUserId}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="yhyksxx" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserDeptResult"> |
| | | select user_id, user_code, dept_type,department_id as |
| | | dept_id,dept_name,deptparent,del_flag,orgid,create_time,create_by,update_time,update_by |
| | | FROM yhyksxx |
| | | <where> |
| | | user_id != 'admin' |
| | | <if test="hisUserId != null ">and user_id = #{hisUserId}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectPatArchiveList" parameterType="com.smartor.domain.PatArchive" resultMap="PatArchiveResult"> |
| | | <include refid="selectPatArchiveVo"/> |
| | |
| | | <if test="uploadTime != null ">and upload_time = #{uploadTime}</if> |
| | | <if test="viptype != null ">and viptype = #{viptype}</if> |
| | | <if test="pattype != null ">and pattype = #{pattype}</if> |
| | | <if test="patientno != null ">and patientno = #{patientno}</if> |
| | | <if test="patientno != null ">and patientno = CAST(#{patientno} AS INTEGER)</if> |
| | | <if test="patidHis != null ">and patid_his = #{patidHis}</if> |
| | | <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if> |
| | | <if test="ageUnit != null ">and age_unit = #{ageUnit}</if> |
| | |
| | | <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if> |
| | | <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if> |
| | | </where> |
| | | limit #{ps} OFFSET #{pn} |
| | | </select> |
| | | |
| | | |
| | |
| | | select count(*) |
| | | FROM cryxx |
| | | </select> |
| | | |
| | | <select id="selectPatArchiveListByLastId" resultMap="PatArchiveResult"> |
| | | SELECT * |
| | | FROM ( |
| | | SELECT *, |
| | | ROW_NUMBER() OVER (ORDER BY patid_his) as row_num |
| | | FROM hzjbxx |
| | | ) a |
| | | WHERE row_num > #{lastRowNumber} LIMIT #{ps} |
| | | </select> |
| | | |
| | | <select id="selectPatMedInhospListByLastId" resultMap="PatMedInhospResult"> |
| | | SELECT * |
| | | FROM (SELECT *, |
| | | ROW_NUMBER() OVER (ORDER BY patno) as row_num |
| | | FROM cryxx |
| | | ) a |
| | | WHERE row_num > #{lastRowNumber} LIMIT #{ps} |
| | | </select> |
| | | |
| | | <select id="selectPatArchiveCount" parameterType="com.smartor.domain.PatMedInhosp" resultType="Long"> |
| | | select count(*) |
| | | FROM hzjbxx |
| | |
| | | FROM |
| | | cryxx b |
| | | <where> |
| | | <if test="startOutHospTime != null ">and date_format(b.endtime,'%y%m%d') >= |
| | | date_format(#{startOutHospTime},'%y%m%d') |
| | | |
| | | <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') >= |
| | | to_char(#{startOutHospTime}::date,'YYMMDD') |
| | | </if> |
| | | <if test="endOutHospTime != null ">and date_format(b.endtime,'%y%m%d') <= |
| | | date_format(#{endOutHospTime},'%y%m%d') |
| | | <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') <= |
| | | to_char(#{endOutHospTime}::date,'YYMMDD') |
| | | </if> |
| | | <if test="startInHospTime != null ">and date_format(b.starttime,'%y%m%d') >= |
| | | date_format(#{startInHospTime},'%y%m%d') |
| | | <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') >= |
| | | to_char(#{startInHospTime}::date,'%y%m%d') |
| | | </if> |
| | | <if test="endInHospTime != null ">and date_format(b.starttime,'%y%m%d') <= |
| | | date_format(#{endInHospTime},'%y%m%d') |
| | | <if test="endInHospTime != null ">and to_char(b.starttime,'YYMMDD') <= |
| | | to_char(#{endInHospTime}::date,'YYMMDD') |
| | | </if> |
| | | <if test="inhospno != null ">and b.inhospno = #{inhospno}</if> |
| | | <if test="fuflag != null ">and b.fuflag = #{fuflag}</if> |
| | |
| | | <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if> |
| | | <if test="orgid != null ">and b.orgid = #{orgid}</if> |
| | | </where> |
| | | limit #{ps} OFFSET #{pn} |
| | | </select> |
| | | |
| | | |
| | |
| | | mainsuit |
| | | from mzxx |
| | | <where> |
| | | <if test="deptname != null and deptname != ''">and deptname like concat('%', #{deptname}, '%')</if> |
| | | <if test="drname != null and drname != ''">and drname like concat('%', #{drname}, '%')</if> |
| | | <if test="patname != null and patname != ''">and patname like concat('%', #{patname}, '%')</if> |
| | | <if test="beginTime != null ">and date_format( admitdate,'%y%m%d') >= |
| | | date_format(#{beginTime},'%y%m%d') |
| | | |
| | | <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') >= |
| | | to_char(#{beginTime}::date,'YYMMDD') |
| | | </if> |
| | | <if test="endTime != null ">and date_format( admitdate,'%y%m%d') <= |
| | | date_format(#{endTime},'%y%m%d') |
| | | <if test="endTime != null ">and to_char( admitdate,'YYMMDD') <= |
| | | to_char(#{endTime}::date,'YYMMDD') |
| | | </if> |
| | | <if test="patid != null ">and patid = #{patid}</if> |
| | | <if test="patno != null ">and patno = #{patno}</if> |
| | | <if test="outhospno != null and outhospno != ''">and outhospno = #{outhospno}</if> |
| | | <if test="diagcheckFlag != null and diagcheckFlag != ''">and diagcheck_flag = #{diagcheckFlag}</if> |
| | | |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | </if> |
| | | <if test="phonenumber != null and phonenumber != ''"> |
| | | AND u.phonenumber like concat('%', #{phonenumber}, '%') |
| | | </if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- å¼å§æ¶é´æ£ç´¢ --> |
| | | AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- ç»ææ¶é´æ£ç´¢ --> |
| | | AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | where id = #{id} and del_flag=0 |
| | | </select> |
| | | |
| | | <select id="selectPatArchiveByPatnos" resultMap="PatArchiveResult"> |
| | | SELECT id, patientno |
| | | FROM pat_archive |
| | | WHERE patientno IN |
| | | <foreach item="patno" collection="patnos" open="(" separator="," close=")"> |
| | | #{patno} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <insert id="insertPatArchiveSingle" parameterType="com.smartor.domain.PatArchive" useGeneratedKeys="true" |
| | | keyProperty="id"> |
| | | insert into pat_archive |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <insert id="insertPatArchive"> |
| | | <insert id="insertPatArchive" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into |
| | | pat_archive(name,viptype,sex,idcardno,birthdate,place_of_residence,age,age2,sourcefrom,archivetime,archiveby,telcode,relativetelcode,idcardtype,orgid,openid,dduserid,update_by,update_time |
| | | ,create_by,create_time,isupload,upload_time,pattype,nation,birthplace,native_place,patientno,patid_his,sd_flag,age_unit,age_unit2,notrequired_flag,notrequiredreason,care_facilities,case_path, |
| | |
| | | </insert> |
| | | |
| | | |
| | | <insert id="insertPatMedInhospBatch" parameterType="java.util.List"> |
| | | <insert id="insertPatMedInhospBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="item.inhospid"> |
| | | insert into pat_med_inhosp ( |
| | | serialnum, hospitalname, hospitalcode, hospitaldistrictcode, hospitaldistrictname, |
| | | icd10code, diagname, starttime, endtime, deptcode, deptname, roomno, bed_no, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.smartor.mapper.ShardingMapper"> |
| | | <select id="getTableCount" resultType="long"> |
| | | SELECT count(*) |
| | | FROM ${tableName} |
| | | </select> |
| | | |
| | | <select id="getMaxId" resultType="long"> |
| | | SELECT max(id) |
| | | FROM ${tableName} |
| | | </select> |
| | | |
| | | <update id="renameTable"> |
| | | RENAME |
| | | TABLE |
| | | ${oldName} |
| | | TO |
| | | ${newName} |
| | | </update> |
| | | |
| | | <update id="createLikeTable"> |
| | | CREATE TABLE ${newTableName} LIKE ${templateTableName} |
| | | </update> |
| | | |
| | | <update id="setAutoIncrement"> |
| | | ALTER TABLE ${tableName} AUTO_INCREMENT = #{value} |
| | | </update> |
| | | </mapper> |
| | |
| | | </insert> |
| | | |
| | | |
| | | <insert id="batchUser"> |
| | | <insert id="batchUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | user_id, dept_id, user_name, nick_name, email, avatar, phonenumber, sex, password, status, create_by, remark, |
| | | user_type, dept_info, hosp_info, searchscope, id_card, title, job_phone, birthday, his_user_id, guid, orgid, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.smartor.mapper.SysUserRole2Mapper"> |
| | | |
| | | <resultMap type="SysUserRole" id="SysUserRoleResult"> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="roleId" column="role_id"/> |
| | | <result property="guid" column="guid"/> |
| | | <result property="orgid" column="orgid"/> |
| | | </resultMap> |
| | | |
| | | <delete id="deleteUserRoleByUserId" parameterType="Long"> |
| | | delete |
| | | from sys_user_role |
| | | where user_id = #{userId} |
| | | </delete> |
| | | |
| | | <select id="countUserRoleByRoleId" resultType="Integer"> |
| | | select count(1) |
| | | from sys_user_role |
| | | where role_id = #{roleId} |
| | | </select> |
| | | |
| | | <delete id="deleteUserRole" parameterType="Long"> |
| | | delete from sys_user_role where user_id in |
| | | <foreach collection="array" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <insert id="batchUserRole"> |
| | | insert into sys_user_role(user_id, role_id,guid,orgid) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.userId},#{item.roleId},#{item.guid},#{item.orgid}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="deleteUserRoleInfo" parameterType="SysUserRole"> |
| | | delete |
| | | from sys_user_role |
| | | where user_id = #{userId} |
| | | and role_id = #{roleId} |
| | | </delete> |
| | | |
| | | <delete id="deleteUserRoleInfos"> |
| | | delete from sys_user_role where role_id=#{roleId} and user_id in |
| | | <foreach collection="userIds" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |