| | |
| | | log.error("门急就诊时间不能为空"); |
| | | return 0; |
| | | } |
| | | // 需要插入到哪个表,根据就诊时间的日期来定,如果根据就诊时间来确定的表不存在,则存在pat_med_outhosp表中 |
| | | String targetTable = resolveTargetTable(patMedOuthosp.getAdmitdate()); |
| | | if (targetTable == null) { |
| | | return 0; |
| | | } |
| | | // 插入前按 serialnum 查重,防止重复采集导致重复入库 |
| | | if (org.apache.commons.lang3.StringUtils.isNotBlank(patMedOuthosp.getSerialnum())) { |
| | | int exists = patMedOuthospMapper.countBySerialnum(targetTable, patMedOuthosp.getSerialnum()); |
| | | if (exists > 0) { |
| | | log.debug("[insert] serialnum={} 已存在于表 {},跳过插入", patMedOuthosp.getSerialnum(), targetTable); |
| | | return 0; |
| | | } |
| | | } |
| | | patMedOuthosp.setCreateTime(DateUtils.getNowDate()); |
| | | patMedOuthosp.setUpdateTime(DateUtils.getNowDate()); |
| | | patMedOuthosp.setGuid(UUID.randomUUID().toString()); |
| | | //需要插入到哪个表,根据就诊时间的日期来定,如果根据就诊时间来确定的表不存在,则存在pat_med_outhosp表中 |
| | | String targetTable = resolveTargetTable(patMedOuthosp.getAdmitdate()); |
| | | if (targetTable != null) { |
| | | log.info("[insert] 路由到分表: {}", targetTable); |
| | | return patMedOuthospMapper.insertIntoTable(targetTable, patMedOuthosp); |
| | | } |
| | | return 0; |
| | | log.info("[insert] 路由到分表: {}", targetTable); |
| | | return patMedOuthospMapper.insertIntoTable(targetTable, patMedOuthosp); |
| | | } |
| | | |
| | | /** |