From 1be48553ad7b1994ed6f7d0d868f0ef7ba8a67af Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 26 八月 2025 16:55:59 +0800 Subject: [PATCH] 修复患者首页严重BUG,HIS视图同步 --- ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java | 3 .idea/jarRepositories.xml | 22 + smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java | 4 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java | 2 ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml | 635 +++++++++++++++++++++++++++++++++ smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml | 2 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 17 .idea/modules.xml | 2 ruoyi-generator/ruoyi-generator.iml | 2 ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/CollectHISMapper.java | 97 +++++ ruoyi-admin/src/main/resources/application-druid.yml | 23 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java | 4 ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISMapperService.java | 66 +++ ruoyi-common/ruoyi-common.iml | 2 ruoyi-quartz/ruoyi-quartz.iml | 2 ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java | 247 +++++++++++++ ruoyi-framework/ruoyi-framework.iml | 2 17 files changed, 1,116 insertions(+), 16 deletions(-) diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 3818f08..0507aeb 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -3,6 +3,11 @@ <component name="RemoteRepositoriesConfiguration"> <remote-repository> <option name="id" value="central" /> + <option name="name" value="Central Repositories" /> + <option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" /> + </remote-repository> + <remote-repository> + <option name="id" value="central" /> <option name="name" value="Central Repository" /> <option name="url" value="https://repo.maven.apache.org/maven2" /> </remote-repository> @@ -12,9 +17,24 @@ <option name="url" value="http://122.49.30.5:8981/nexus/content/repositories/releases/" /> </remote-repository> <remote-repository> + <option name="id" value="nexus" /> + <option name="name" value="Public Repositories" /> + <option name="url" value="http://211.90.241.109:7008/repository/maven-public/" /> + </remote-repository> + <remote-repository> + <option name="id" value="release" /> + <option name="name" value="Release Repositories" /> + <option name="url" value="http://211.90.241.109:7008/repository/maven-releases/" /> + </remote-repository> + <remote-repository> <option name="id" value="central" /> <option name="name" value="Maven Central repository" /> <option name="url" value="https://repo1.maven.org/maven2" /> + </remote-repository> + <remote-repository> + <option name="id" value="snapshots" /> + <option name="name" value="Snapshot Repositories" /> + <option name="url" value="http://211.90.241.109:7008/repository/maven-snapshots/" /> </remote-repository> <remote-repository> <option name="id" value="aliyun" /> @@ -67,4 +87,4 @@ <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> </remote-repository> </component> -</project> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 8a75ce6..871a3b1 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -11,4 +11,4 @@ <module fileurl="file://$PROJECT_DIR$/smartor/smartor.iml" filepath="$PROJECT_DIR$/smartor/smartor.iml" /> </modules> </component> -</project> +</project> \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java index 43ae3f8..d0f6fa1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java @@ -175,7 +175,7 @@ @ApiOperation("鏌ヨ鎮h�呭垪琛�") @PostMapping("/patInfoByContion") public TableDataInfo patInfoByCondition(@RequestBody PatArchiveReq patArchive) { -// PageUtils.startPageByPost(patArchive.getPageNum(), patArchive.getPageSize()); +// PageUtils.startPageByPost(patArchive.getPageNum(), patArchive.getPageSize()); LoginUser loginUser = getLoginUser(); SysUser user = loginUser.getUser(); patArchive.setOrgid(user.getOrgid()); @@ -189,6 +189,8 @@ long count = PageUtils.count(new ISelect() { @Override public void doSelect() { + patArchive.setPageNum(null); + patArchive.setPageSize(null); patArchiveService.patInfoByContion(patArchive); } }); diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index a0a398b..d00d5a5 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -47,12 +47,21 @@ # 浠庡簱鏁版嵁婧� slave: +# url: jdbc:oracle:thin:@//192.168.88.46:1521/orcl +# username: qebemr +# password: qebsoft +# driver-class-name: oracle.jdbc.OracleDriver + enabled: true + url: jdbc:mysql://192.168.100.10:3306/emr?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: smartor + password: Smartor.2023 + driverClassName: com.mysql.cj.jdbc.Driver # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(鍏徃) - # enabled: true - # url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor - # username: sa - # password: Hxerp2000 - # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver +# enabled: true +# url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor +# username: sa +# password: Hxerp2000 +# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴(涔変箤浜岄櫌) # enabled: true @@ -104,12 +113,12 @@ # redis 閰嶇疆 redis: host: 127.0.0.1 - port: 6020 + port: 6379 # 鏁版嵁搴撶储寮� database: 0 # 瀵嗙爜 - password: Smartor + password: # 杩炴帴瓒呮椂鏃堕棿 timeout: 10s lettuce: diff --git a/ruoyi-common/ruoyi-common.iml b/ruoyi-common/ruoyi-common.iml index 3b4d47d..1daccae 100644 --- a/ruoyi-common/ruoyi-common.iml +++ b/ruoyi-common/ruoyi-common.iml @@ -5,4 +5,4 @@ <configuration /> </facet> </component> -</module> +</module> \ No newline at end of file diff --git a/ruoyi-framework/ruoyi-framework.iml b/ruoyi-framework/ruoyi-framework.iml index 3b4d47d..1daccae 100644 --- a/ruoyi-framework/ruoyi-framework.iml +++ b/ruoyi-framework/ruoyi-framework.iml @@ -5,4 +5,4 @@ <configuration /> </facet> </component> -</module> +</module> \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java index e9704bf..e22d207 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java @@ -52,7 +52,7 @@ { log.info("鐧诲綍鐢ㄦ埛锛歿} 宸茶鍋滅敤.", username); throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + split[0] + " 宸插仠鐢�"); - }else if(!user.getOrgid().equals(split[1])){ + }else if(!user.getOrgid().trim().equals(split[1].trim())){ log.info("鐧诲綍鐢ㄦ埛锛歿} 涓嶆槸鏈櫌甯愬彿锛歿}", username,split[1]); throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛�" + split[0] + " 涓嶆槸鏈櫌鐨�"); } diff --git a/ruoyi-generator/ruoyi-generator.iml b/ruoyi-generator/ruoyi-generator.iml index 3b4d47d..1daccae 100644 --- a/ruoyi-generator/ruoyi-generator.iml +++ b/ruoyi-generator/ruoyi-generator.iml @@ -5,4 +5,4 @@ <configuration /> </facet> </component> -</module> +</module> \ No newline at end of file diff --git a/ruoyi-quartz/ruoyi-quartz.iml b/ruoyi-quartz/ruoyi-quartz.iml index 3b4d47d..1daccae 100644 --- a/ruoyi-quartz/ruoyi-quartz.iml +++ b/ruoyi-quartz/ruoyi-quartz.iml @@ -5,4 +5,4 @@ <configuration /> </facet> </component> -</module> +</module> \ No newline at end of file diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java index 5695f47..16134f3 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java @@ -2,6 +2,8 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.quartz.service.ICollectHISMapperService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.DeleteMapping; @@ -31,6 +33,7 @@ @Autowired private ISysJobLogService jobLogService; + /** * 鏌ヨ瀹氭椂浠诲姟璋冨害鏃ュ織鍒楄〃 */ diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/CollectHISMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/CollectHISMapper.java new file mode 100644 index 0000000..44c9a95 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/CollectHISMapper.java @@ -0,0 +1,97 @@ +package com.ruoyi.quartz.mapper; + +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.Icd10; +import com.smartor.domain.PatArchive; +import com.smartor.domain.PatMedInhosp; +import com.smartor.domain.PatMedOuthosp; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +@DataSource(value = DataSourceType.SLAVE) +@Mapper +public interface CollectHISMapper { + + + /** + * 鏌ヨ鎮h�呮。妗堝垪琛� + * + * @param patArchive 鎮h�呮。妗� + * @return 鎮h�呮。妗堥泦鍚� + */ + public List<PatArchive> selectPatArchiveList(PatArchive patArchive); + + /** + * 鐢ㄦ埛涓庤鑹蹭俊鎭� + * + * @param sysUser + * @return + */ + public SysUserRole yhyjsxx(SysUser sysUser); + + /** + * 鐢ㄦ埛涓庣瀹や俊鎭� + * + * @param sysUser + * @return + */ + public SysUserDept yhyksxx(SysUser sysUser); + + /** + * 鍑哄叆闄俊鎭� + * + * @param patMedInhosp + * @return + */ + 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); + + /** + * 闂ㄦ�ヨ瘖淇℃伅 + * + * @param patMedOuthosp + * @return + */ + public List<PatMedOuthosp> selectPatMedOuthospList(PatMedOuthosp patMedOuthosp); + + + /** + * /** + * 鏌ヨ鐤剧梾鍒楄〃 + * + * @param icd10 鐤剧梾 + * @return 鐤剧梾闆嗗悎 + */ + public List<Icd10> selectIcd10List(Icd10 icd10); + + /** + * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃 + * + * @param sysUser 鐢ㄦ埛淇℃伅 + * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 + */ + public List<SysUser> selectUserList(SysUser sysUser); + + /** + * 鏌ヨ閮ㄩ棬绠$悊鏁版嵁 + * + * @param dept 閮ㄩ棬淇℃伅 + * @return 閮ㄩ棬淇℃伅闆嗗悎 + */ + public List<SysDept> selectDeptList(SysDept dept); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISMapperService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISMapperService.java new file mode 100644 index 0000000..bc65cb3 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ICollectHISMapperService.java @@ -0,0 +1,66 @@ +package com.ruoyi.quartz.service; + +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.smartor.domain.*; + +import java.util.List; + +public interface ICollectHISMapperService { + /** + * 鏌ヨ鎮h�呮。妗堝垪琛� + * + * @param patArchive 鎮h�呮。妗� + * @return 鎮h�呮。妗堥泦鍚� + */ + public List<PatArchive> selectPatArchiveList(PatArchive patArchive); + + /** + * 鍑哄叆闄俊鎭� + * + * @param patMedInhosp + * @return + */ + public Integer selectPatMedInhospList(PatMedInhosp patMedInhosp); + + /** + * 娌冲崡鏁版嵁閲囬泦 + * + * @param patMedInhosp + * @return + */ + public Boolean hnDataGather(HnDataGatherVO patMedInhosp); + + /** + * 闂ㄦ�ヨ瘖淇℃伅 + * + * @param id + * @return + */ + public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp); + + + /** + * 鏌ヨ鐤剧梾鍒楄〃 + * + * @param icd10 鐤剧梾 + * @return 鐤剧梾闆嗗悎 + */ + public Integer selectIcd10List(Icd10 icd10); + + /** + * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃 + * + * @param sysUser 鐢ㄦ埛淇℃伅 + * @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅 + */ + public Integer selectUserList(SysUser sysUser); + + /** + * 鏌ヨ閮ㄩ棬绠$悊鏁版嵁 + * + * @param dept 閮ㄩ棬淇℃伅 + * @return 閮ㄩ棬淇℃伅闆嗗悎 + */ + public Integer selectDeptList(SysDept dept); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java new file mode 100644 index 0000000..2bee790 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISMapperServiceImpl.java @@ -0,0 +1,247 @@ +package com.ruoyi.quartz.service.impl; + +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.ruoyi.common.utils.StringUtils; +import com.ruoyi.quartz.mapper.CollectHISMapper; +import com.ruoyi.quartz.service.ICollectHISMapperService; +import com.smartor.domain.*; +import com.smartor.mapper.*; +import com.smartor.service.impl.PatArchiveServiceImpl; +import com.smartor.service.impl.PatMedInhospServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +@Slf4j +@Service +public class CollectHISMapperServiceImpl implements ICollectHISMapperService { + @Autowired + private HNGatherPatArchiveMapper hnGatherPatArchiveMapper; + + @Autowired + private SysUser2Mapper sysUser2Mapper; + + @Autowired + private SysUserRole2Mapper sysUserRoleMapper; + + @Autowired + private SysDept2Mapper sysDept2Mapper; + + @Autowired + private SysUserDeptMapper sysUserDeptMapper; + + @Autowired + private Icd10Mapper icd10Mapper; + + @Autowired + private PatMedOuthospMapper patMedOuthospMapper; + + @Autowired + private PatMedInhospMapper patMedInhospMapper; + + @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) { + List<PatMedInhosp> patMedInhospList = hnGatherPatArchiveMapper.selectPatMedInhospList(patMedInhosp); + for (PatMedInhosp pm : patMedInhospList) { + 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 { + patArchiveMapper.insertPatArchiveSingle(patArchives.get(0)); + pm.setPatid(patArchives.get(0).getId()); + } + patMedInhospMapper.insertPatMedInhosp(pm); + } + return 0; + } + + @Override + public Boolean hnDataGather(HnDataGatherVO hnDataGatherVO) { + + LocalDate startDate = hnDataGatherVO.getStartOutHospTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate endDate = hnDataGatherVO.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 = 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 = selectPatMedOuthospList(patMedOuthosp); + } + return true; + } + + + @Override + public Integer selectPatMedOuthospList(PatMedOuthosp patMedOuthosp) { + List<PatMedOuthosp> patMedOuthosps = hnGatherPatArchiveMapper.selectPatMedOuthospList(patMedOuthosp); + log.info("selectPatMedOuthospList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", patMedOuthosps.size()); + Integer i = null; + for (PatMedOuthosp patMedOuthosp1 : patMedOuthosps) { + //鑾峰彇鎮h�呭熀鏈俊鎭� + PatArchive patArchive = new PatArchive(); + patArchive.setPatientno(patMedOuthosp1.getPatno()); + List<PatArchive> patArchives = hnGatherPatArchiveMapper.selectPatArchiveList(patArchive); + + //鏍规嵁patno鍒ゆ柇鏈湴鎮h�呭熀鏈俊鎭槸鍚﹀瓨鍦� + 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 { + if (CollectionUtils.isEmpty(patArchives)) { + continue; + } + patArchiveMapper.insertPatArchiveSingle(patArchives.get(0)); + patMedOuthosp1.setPatid(patArchives.get(0).getId()); + } + i = patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp1); + } + + return i; + } + + @Override + public Integer selectIcd10List(Icd10 icd10) { + List<Icd10> icd10s = hnGatherPatArchiveMapper.selectIcd10List(icd10); + log.info("selectIcd10List鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", icd10s.size()); + int i = icd10Mapper.batchIcd10(icd10s); + return i; + } + + @Override + public Integer selectUserList(SysUser sysUser) { + List<SysUser> sysUserList = hnGatherPatArchiveMapper.selectUserList(sysUser); + log.info("sysUserList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysUserList.size()); + int i = sysUser2Mapper.batchUser(sysUserList); + for (SysUser sysUser1 : sysUserList) { + log.info("sysUser1鐨処D涓猴細{}", sysUser1.getUserId()); + log.info("sysUser1鐨凥ISUSERID涓猴細{}", 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; + } + + @Override + public Integer selectDeptList(SysDept dept) { + List<SysDept> sysDepts = hnGatherPatArchiveMapper.selectDeptList(dept); + log.info("selectDeptList鐨勯噰闆嗗埌鐨勬暟閲忎负锛歿}", sysDepts.size()); + 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("宸茶缃柊琛� '{}' 鐨勮嚜澧濱D璧峰鍊间负 {}", tableName, maxId + 1); + + log.info("琛� '{}' 鐨勫垎琛ㄦ搷浣滃畬鎴愶紒", tableName); + } + } + +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java index 51f383f..938a6c2 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java @@ -14,6 +14,8 @@ import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.HttpUtils; +import com.ruoyi.quartz.service.ICollectHISMapperService; +import com.ruoyi.quartz.service.impl.CollectHISMapperServiceImpl; import com.smartor.common.LSHospTokenUtil; import com.smartor.domain.*; import com.smartor.mapper.HeLibraryMapper; @@ -130,6 +132,9 @@ @Autowired IXHGatherPatArchiveService ixhGatherPatArchiveService; + + @Autowired + ICollectHISMapperService icollectHis; @Value("${appid}") @@ -759,4 +764,16 @@ } return toHex(md5.digest()); } + + public void collectHIS() { + try { + // HIS鏁版嵁閲囬泦 + HnDataGatherVO hnDataGatherVO = new HnDataGatherVO(); + log.info("銆恉ealHisData銆慔IS寮�濮嬮噰闆嗘暟鎹�"); + ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO); + log.info("銆恉ealHisData銆慔IS缁撴潫閲囬泦鏁版嵁"); + } catch (Exception e) { + log.error("銆恉ealHisData銆慔IS鏁版嵁閲囬泦寮傚父", e); + } + } } diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml new file mode 100644 index 0000000..b3fed9d --- /dev/null +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml @@ -0,0 +1,635 @@ +<?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.ruoyi.quartz.mapper.CollectHISMapper"> + + <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"/> + <result property="sourcefrom" column="sourcefrom"/> + <result property="notrequiredFlag" column="notrequired_flag"/> + <result property="notrequiredreason" column="notrequiredreason"/> + <result property="patidHis" column="patid_his"/> + <result property="sdFlag" column="sd_flag"/> + <result property="pattype" column="pattype"/> + <result property="viptype" column="viptype"/> + <result property="name" column="name"/> + <result property="sex" column="sex"/> + <result property="nation" column="nation"/> + <result property="nativePlace" column="native_place"/> + <result property="placeOfResidence" column="place_of_residence"/> + <result property="birthplace" column="birthplace"/> + <result property="idcardno" column="idcardno"/> + <result property="birthdate" column="birthdate"/> + <result property="age" column="age"/> + <result property="age2" column="age2"/> + <result property="sourcefrom" column="sourcefrom"/> + <result property="archivetime" column="archivetime"/> + <result property="archiveby" column="archiveby"/> + <result property="telcode" column="telcode"/> + <result property="relativetelcode" column="relativetelcode"/> + <result property="idcardtype" column="idcardtype"/> + <result property="orgid" column="orgid"/> + <result property="openid" column="openid"/> + <result property="delFlag" column="del_flag"/> + <result property="dept" column="deptname"/> + <result property="deptcode" column="deptcode"/> + <result property="drcode" column="drcode"/> + <result property="drname" column="drname"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="tag" column="tag"/> + <result property="pattype" column="pattype"/> + <result property="bedNo" column="bedno"/> + <result property="inhosptime" column="inhosptime"/> + <result property="ageUnit" column="age_unit"/> + <result property="ageUnit2" column="age_unit2"/> + <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/> + <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/> + <result property="careFacilities" column="care_facilities"/> + <result property="casePath" column="case_path"/> + <result property="degreeOfEducation" column="degree_of_education"/> + <result property="maritalStatus" column="marital_status"/> + <result property="income" column="income"/> + <result property="medicareType" column="medicare_type"/> + <result property="carePerson" column="care_person"/> + <result property="casePersonAge" column="case_person_age"/> + <result property="guid" column="guid"/> + <result property="filterDrname" column="filter_drname"/> + <result property="filterDrcode" column="filter_drcode"/> + </resultMap> + + + <resultMap type="com.smartor.domain.PatArchiveOthreInfo" id="PatArchiveOthreInfoResult"> + <result property="id" column="id"/> + <result property="notrequiredFlag" column="notrequired_flag"/> + <result property="notrequiredreason" column="notrequiredreason"/> + <result property="patientno" column="patientno"/> + <result property="sourcefrom" column="sourcefrom"/> + <result property="patidHis" column="patid_his"/> + <result property="sdFlag" column="sd_flag"/> + <result property="pattype" column="pattype"/> + <result property="viptype" column="viptype"/> + <result property="name" column="name"/> + <result property="sex" column="sex"/> + <result property="nation" column="nation"/> + <result property="nativePlace" column="native_place"/> + <result property="placeOfResidence" column="place_of_residence"/> + <result property="birthplace" column="birthplace"/> + <result property="idcardno" column="idcardno"/> + <result property="birthdate" column="birthdate"/> + <result property="age" column="age"/> + <result property="age2" column="age2"/> + <result property="sourcefrom" column="sourcefrom"/> + <result property="archivetime" column="archivetime"/> + <result property="archiveby" column="archiveby"/> + <result property="telcode" column="telcode"/> + <result property="relativetelcode" column="relativetelcode"/> + <result property="idcardtype" column="idcardtype"/> + <result property="orgid" column="orgid"/> + <result property="openid" column="openid"/> + <result property="delFlag" column="del_flag"/> + <result property="dept" column="deptname"/> + <result property="deptcode" column="deptcode"/> + <result property="drcode" column="drcode"/> + <result property="drname" column="drname"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="tag" column="tag"/> + <result property="pattype" column="pattype"/> + <result property="bedNo" column="bedno"/> + <result property="starttime" column="starttime"/> + <result property="endtime" column="endtime"/> + <result property="ageUnit" column="age_unit"/> + <result property="ageUnit2" column="age_unit2"/> + <result property="inhospno" column="inhospno"/> + <result property="nurseId" column="nurse_id"/> + <result property="nurseName" column="nurse_name"/> + <result property="outWayName" column="out_way_name"/> + <result property="outWayId" column="out_way_id"/> + <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/> + <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/> + <result property="guid" column="guid"/> + <result property="leavediagname" column="leavediagname"/> + <result property="leaveicd10code" column="leaveicd10code"/> + <result property="filterDrname" column="filter_drname"/> + <result property="filterDrcode" column="filter_drcode"/> + </resultMap> + + <resultMap type="com.smartor.domain.PatMedInhosp" id="PatMedInhospResult"> + <result property="inhospid" column="inhospid"/> + <result property="inhospno" column="inhospno"/> + <result property="serialnum" column="serialnum"/> + <result property="hospitalname" column="hospitalname"/> + <result property="hospitalcode" column="hospitalcode"/> + <result property="hospitaldistrictcode" column="hospitaldistrictcode"/> + <result property="hospitaldistrictname" column="hospitaldistrictname"/> + <result property="icd10code" column="icd10code"/> + <result property="diagname" column="diagname"/> + <result property="starttime" column="starttime"/> + <result property="endtime" column="endtime"/> + <result property="deptcode" column="deptcode"/> + <result property="deptname" column="deptname"/> + <result property="roomno" column="roomno"/> + <result property="bedNo" column="bed_no"/> + <result property="orgid" column="orgid"/> + <result property="delFlag" column="del_flag"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="patid" column="patid"/> + <result property="leavediagname" column="leavediagname"/> + <result property="leaveicd10code" column="leaveicd10code"/> + <result property="drcode" column="drcode"/> + <result property="drname" column="drname"/> + <result property="schemestatus" column="schemestatus"/> + <result property="generalschemestatus" column="generalschemestatus"/> + <result property="leaveldeptcode" column="leaveldeptcode"/> + <result property="leaveldeptname" column="leaveldeptname"/> + <result property="hospitaldistrictid" column="hospitaldistrictid"/> + <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/> + <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/> + <result property="leavehospitaldistrictid" column="leavehospitaldistrictid"/> + <result property="deptid" column="deptid"/> + <result property="leaveldeptid" column="leaveldeptid"/> + <result property="schemetime" column="schemetime"/> + <result property="patname" column="patname"/> + <result property="patno" column="patno"/> + <result property="inhospstate" column="inhospstate"/> + <result property="deptcheckFlag" column="deptcheck_flag"/> + <result property="wardcheckFlag" column="wardcheck_flag"/> + <result property="diagcheckFlag" column="diagcheck_flag"/> + <result property="age" column="age"/> + <result property="sex" column="sex"/> + <result property="telcode" column="telcode"/> + <result property="longTaskReason" column="long_task_reason"/> + <result property="nurseId" column="nurse_id"/> + <result property="nurseName" column="nurse_name"/> + <result property="outWayId" column="out_way_id"/> + <result property="outWayName" column="out_way_name"/> + <result property="guid" column="guid"/> + <result property="operator" column="operator"/> + <result property="operatorId" column="operator_id"/> + <result property="remark" column="remark"/> + <result property="tagname" column="tagname"/> + <result property="fuflag" column="fuflag"/> + <result property="fudate" column="fudate"/> + <result property="fuperiod" column="fuperiod"/> + <result property="futypecode" column="futypecode"/> + <result property="futypedesc" column="futypedesc"/> + <result property="fuadvice" column="fuadvice"/> + <result property="fuspecialadvice" column="fuspecialadvice"/> + </resultMap> + + <resultMap type="com.smartor.domain.PatMedOuthosp" id="PatMedOuthospResult"> + <result property="id" column="id"/> + <result property="serialnum" column="serialnum"/> + <result property="patid" column="patid"/> + <result property="hospitalname" column="hospitalname"/> + <result property="hospitalcode" column="hospitalcode"/> + <result property="icd10code" column="icd10code"/> + <result property="diagname" column="diagname"/> + <result property="deptcode" column="deptcode"/> + <result property="deptname" column="deptname"/> + <result property="drcode" column="drcode"/> + <result property="drname" column="drname"/> + <result property="admitdate" column="admitdate"/> + <result property="orgid" column="orgid"/> + <result property="delFlag" column="del_flag"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="isupload" column="isupload"/> + <result property="uploadTime" column="upload_time"/> + <result property="schemestatus" column="schemestatus"/> + <result property="deptid" column="deptid"/> + <result property="schemetime" column="schemetime"/> + <result property="hpi" column="hpi"/> + <result property="mainsuit" column="mainsuit"/> + <result property="outhospno" column="outhospno"/> + <result property="patname" column="patname"/> + <result property="guid" column="guid"/> + <result property="patno" column="patno"/> + <result property="diagcheckFlag" column="diagcheck_flag"/> + <result property="idcardno" column="idcardno"/> + <result property="remark" column="remark"/> + </resultMap> + + + <resultMap type="com.smartor.domain.Icd10" id="Icd10Result"> + <result property="icdid" column="icdid"/> + <result property="icdcode" column="icdcode"/> + <result property="icdname" column="icdname"/> + <result property="icdpym" column="icdpym"/> + <result property="icdwbm" column="icdwbm"/> + <result property="orgid" column="orgid"/> + <result property="delFlag" column="del_flag"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="pid" column="pid"/> + <result property="guid" column="guid"/> + <result property="lastflag" column="lastflag"/> + <result property="chimedflag" column="chimedflag"/> + <result property="hisIcdid" column="his_icdid"/> + </resultMap> + + + <resultMap type="com.ruoyi.common.core.domain.entity.SysDept" id="SysDeptResult"> + <id property="deptId" column="dept_id"/> + <id property="hisDeptId" column="his_dept_id"/> + <result property="parentId" column="parent_id"/> + <result property="hisParentId" column="his_parent_id"/> + <result property="ancestors" column="ancestors"/> + <result property="deptName" column="dept_name"/> + <result property="orderNum" column="order_num"/> + <result property="leader" column="leader"/> + <result property="phone" column="phone"/> + <result property="email" column="email"/> + <result property="status" column="status"/> + <result property="delFlag" column="del_flag"/> + <result property="parentName" column="parent_name"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="deptCode" column="dept_code"/> + <result property="deptType" column="dept_type"/> + <result property="guid" column="guid"/> + <result property="orgid" column="orgid"/> + <result property="type" column="type"/> + </resultMap> + + <resultMap type="com.ruoyi.common.core.domain.entity.SysUser" id="SysUserResult"> + <id property="userId" column="user_id"/> + <id property="orgid" column="orgid"/> + <id property="hisUserId" column="his_user_id"/> + <result property="deptId" column="dept_id"/> + <result property="hospInfo" column="hosp_info"/> + <result property="deptInfo" column="dept_info"/> + <result property="userName" column="user_name"/> + <result property="nickName" column="nick_name"/> + <result property="email" column="email"/> + <result property="phonenumber" column="phonenumber"/> + <result property="sex" column="sex"/> + <result property="avatar" column="avatar"/> + <result property="password" column="password"/> + <result property="status" column="status"/> + <result property="delFlag" column="del_flag"/> + <result property="loginIp" column="login_ip"/> + <result property="loginDate" column="login_date"/> + <result property="createBy" column="create_by"/> + <result property="idCard" column="id_card"/> + <result property="createTime" column="create_time"/> + <result property="updateBy" column="update_by"/> + <result property="title" column="title"/> + <result property="birthday" column="birthday"/> + <result property="jobPhone" column="job_phone"/> + <result property="updateTime" column="update_time"/> + <result property="remark" column="remark"/> + <result property="userType" column="user_type"/> + <result property="searchscope" column="searchscope"/> + <result property="guid" column="guid"/> + </resultMap> + + <sql id="selectPatArchiveVo"> + select notrequired_flag, + notrequiredreason, + patientno, + patid_his, + sd_flag, + name, + sex, + idcardno, + birthdate, + age, + nation, + native_place, + place_of_residence, + birthplace, + sourcefrom, + archivetime, + archiveby, + telcode, + relativetelcode, + idcardtype, + orgid, + openid, + viptype, + care_facilities, + case_path, + degree_of_education, + marital_status, + income, + medicare_type, + care_person, + case_person_age + from healthy_archive + </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"/> + <where> + <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> + <if test="idcardno != null and idcardno != ''">and idcardno = #{idcardno}</if> + <if test="sourcefrom != null ">and sourcefrom = #{sourcefrom}</if> + <if test="telcode != null and telcode != ''">and telcode = #{telcode}</if> + <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> + <if test="id != null and id != ''">and id = #{id}</if> + <if test="isupload != null ">and isupload = #{isupload}</if> + <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 = 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="age != null ">and age = #{age}</if> + <if test="age2 != null ">and age2 = #{age2}</if> + <if test="ageUnit2 != null ">and age_unit2 = #{ageUnit2}</if> + <if test="notrequiredFlag != null ">and notrequired_flag = #{notrequiredFlag}</if> + <if test="notrequiredreason != null ">and notrequiredreason = #{notrequiredreason}</if> + <if test="careFacilities != null ">and care_facilities = #{careFacilities}</if> + <if test="casePath != null ">and case_path = #{casePath}</if> + <if test="degreeOfEducation != null ">and degree_of_education = #{degreeOfEducation}</if> + <if test="maritalStatus != null ">and marital_status = #{maritalStatus}</if> + <if test="income != null ">and income = #{income}</if> + <if test="medicareType != null ">and medicare_type = #{medicareType}</if> + <if test="carePerson != null ">and care_person = #{carePerson}</if> + <if test="casePersonAge != null ">and case_person_age = #{casePersonAge}</if> + <if test="filterDrname != null ">and filter_drname = #{filterDrname}</if> + <if test="filterDrcode != null ">and filter_drcode = #{filterDrcode}</if> + </where> + </select> + + + <select id="selectPatMedInhospListCount" parameterType="com.smartor.domain.PatMedInhosp" resultType="Long"> + select count(*) + FROM healthy_inhosp + </select> + + <select id="selectPatArchiveListByLastId" resultMap="PatArchiveResult"> + SELECT * + FROM ( + SELECT *, + ROW_NUMBER() OVER (ORDER BY patid_his) as row_num + FROM healthy_archive + ) 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 healthy_inhosp + ) a + WHERE row_num > #{lastRowNumber} LIMIT #{ps} + </select> + + <select id="selectPatArchiveCount" parameterType="com.smartor.domain.PatMedInhosp" resultType="Long"> + select count(*) + FROM healthy_archive + </select> + + + <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult"> + select + b.nurse_id, + b.nurse_name, + b.patname, + b.out_way_id, + b.out_way_name, + b.inhospstate, + b.patno, + b.inhospno, + b.serialnum, + b.hospitalname, + b.hospitalcode, + b.hospitaldistrictcode, + b.hospitaldistrictname, + b.icd10code, + b.diagname, + b.starttime, + b.endtime, + b.deptcode, + b.deptname, + b.roomno, + b.bed_no, + b.orgid, + b.leavediagname, + b.leaveicd10code, + b.drcode, + b.drname, + b.leaveldeptcode, + b.leaveldeptname, + b.hospitaldistrictid, + b.leavehospitaldistrictcode, + b.leavehospitaldistrictname, + b.leavehospitaldistrictid, + b.deptid, + b.leaveldeptid + + FROM + healthy_inhosp b + <where> + + <if test="startOutHospTime != null ">and to_char(b.endtime,'YYMMDD') >= + to_char(#{startOutHospTime}::date,'YYMMDD') + </if> + <if test="endOutHospTime != null ">and to_char(b.endtime,'YYMMDD') <= + to_char(#{endOutHospTime}::date,'YYMMDD') + </if> + <if test="startInHospTime != null ">and to_char(b.starttime,'YYMMDD') >= + to_char(#{startInHospTime}::date,'%y%m%d') + </if> + <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="serialnum != null ">and b.serialnum = #{serialnum}</if> + <if test="patno != null ">and b.patno = #{patno}</if> + <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if> + <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if> + <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if> + <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if> + <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if> + <if test="orgid != null ">and b.orgid = #{orgid}</if> + </where> + </select> + + + <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp" + resultMap="PatMedOuthospResult"> + select + outhospno, + patno, + serialnum, + hospitalname, + hospitalcode, + icd10code, + diagname, + deptcode, + deptname, + drcode, + drname, + admitdate, + orgid, + schemestatus, + deptid, + schemetime, + hpi, + patname, + mainsuit + from healthy_outhosp + <where> + + <if test="beginTime != null ">and to_char( admitdate,'YYMMDD') >= + to_char(#{beginTime}::date,'YYMMDD') + </if> + <if test="endTime != null ">and to_char( admitdate,'YYMMDD') <= + to_char(#{endTime}::date,'YYMMDD') + </if> + + </where> + </select> + + + <select id="selectIcd10List" parameterType="com.smartor.domain.Icd10" resultMap="Icd10Result"> + select + icdcode, + his_icdid, + lastflag, + chimedflag, + icdname, + icdpym + from healthy_disease + <where> + <if test="icdcode != null and icdcode != ''">and icdcode = #{icdcode}</if> + <if test="lastflag != null and lastflag != ''">and lastflag = #{lastflag}</if> + <if test="chimedflag != null and chimedflag != ''">and chimedflag = #{chimedflag}</if> + <if test="icdname != null and icdname != ''">and icdname like concat('%', #{icdname}, '%')</if> + <if test="icdpym != null and icdpym != ''">and icdpym = #{icdpym}</if> + <if test="icdwbm != null and icdwbm != ''">and icdwbm = #{icdwbm}</if> + <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> + <if test="pid != null ">and pid = #{pid}</if> + <if test="guid != null and guid != ''">and guid = #{guid}</if> + <if test="hisIcdid != null and hisIcdid != ''">and his_icdid = #{hisIcdid}</if> + </where> + </select> + + + <select id="selectUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult"> + select + u.title,u.his_user_id, u.searchscope, u.dept_id, u.user_type, + u.nick_name, u.user_name, u.email,u.id_card, u.avatar, + u.birthday,u.orgid,u.job_phone,u.phonenumber, u.sex, u.status + from healthy_user u + <where> + <if test="userId != null and userId != 0"> + AND u.user_id = #{userId} + </if> + <if test="userName != null and userName != ''"> + AND u.user_name like concat('%', #{userName}, '%') + </if> + <if test="nickName != null and nickName != ''"> + AND u.nick_name like concat('%', #{nickName}, '%') + </if> + <if test="status != null and status != ''"> + AND u.status = #{status} + </if> + <if test="idCard != null and idCard != ''"> + AND u.id_card = #{idCard} + </if> + <if test="title != null and title != ''"> + AND u.title = #{title} + </if> + <if test="jobPhone != null and jobPhone != ''"> + AND u.job_phone = #{jobPhone} + </if> + <if test="birthday != null and birthday != ''"> + AND u.birthday = #{birthday} + </if> + <if test="hisUserId != null and hisUserId != ''"> + AND u.his_user_id = #{hisUserId} + </if> + <if test="phonenumber != null and phonenumber != ''"> + AND u.phonenumber like concat('%', #{phonenumber}, '%') + </if> + </where> + </select> + + <select id="selectDeptList" parameterType="com.ruoyi.common.core.domain.entity.SysDept" resultMap="SysDeptResult"> + SELECT d.dept_code, + d.TYPE, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.phone, + d.dept_type, + d.email, + d.status, + d.his_dept_id, + d.his_parent_id + FROM healthy_dept d + + </select> + +</mapper> \ No newline at end of file diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java index 292224e..3d1cb8f 100644 --- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java @@ -565,7 +565,9 @@ @Override public List<PatArchive> patInfoByContion(PatArchiveReq patArchive) { List<PatArchive> patArchives = new ArrayList<>(); - + if(ObjectUtils.isNotEmpty(patArchive.getPageNum())){ + patArchive.setPageNum(patArchive.getPageNum()*patArchive.getPageSize()-patArchive.getPageNum()); + } //鏍规嵁鏉′欢鑾峰彇鎮h�呬俊鎭� // List<PatArchive> patArchiveList = patArchiveMapper.patInfoByContion(patArchive); List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>(); diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml index 1dc9730..009a676 100644 --- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml @@ -519,6 +519,8 @@ </if> </where> order by a.update_time desc + <if test="pageSize != null and pageSize != ''"> limit ${pageNum},${pageSize} </if> + </select> -- Gitblit v1.9.3