liusheng
9 小时以前 28da7e877a08aaff967efa4adf9d2d4ab4b80c67
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -15,6 +15,7 @@
import com.smartor.mapper.*;
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
import com.smartor.service.IPatMedOuthospService;
import com.smartor.service.IServiceSLTDHealthcareRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -48,7 +49,7 @@
    private IPatMedInhospService patMedInhospService;
    @Autowired
    private PatMedOuthospMapper patMedOuthospMapper;
    private IPatMedOuthospService patMedOuthospService;
    @Autowired
    private SysUser2Mapper sysUser2Mapper;
@@ -392,6 +393,13 @@
        params.put("inpatientArea", null);
//        params.put("status", reqVO.getStatusList() != null && !reqVO.getStatusList().isEmpty() ? reqVO.getStatusList().get(0) : null);
        params.put("status", null);
        // 分页参数(门急诊分页采集时使用)
        if (reqVO.getCurrent() != null) {
            params.put("current", reqVO.getCurrent());
        }
        if (reqVO.getSize() != null) {
            params.put("size", reqVO.getSize());
        }
        return params;
    }
@@ -502,19 +510,15 @@
            try {
                //这里用自动忽略重复会有问题,如果表重新建,serialnum索引会丢失。就无法去重,所以还是需要内存里去重
                batchList = DistinctByProperty.distinctByProperty(batchList, PatMedOuthosp::getSerialnum);
                int insertCount = patMedOuthospMapper.batchInsertIgnore(batchList);
                Integer insertCount = 0;
                for (PatMedOuthosp patMedOuthosp : batchList) {
                    insertCount += patMedOuthospService.insertPatMedOuthosp(patMedOuthosp);
                }
                log.info("批量插入门急诊记录,总数:{}, 实际插入:{}", batchList.size(), insertCount);
            } catch (Exception e) {
                log.error("批量插入门急诊记录失败", e);
                // 降级为逐条插入
                for (PatMedOuthosp patMedOuthosp : batchList) {
                    try {
                        patMedOuthospMapper.insertPatMedOuthosp(patMedOuthosp);
                    } catch (Exception ex) {
                        log.warn("单条插入失败:serialnum={}", patMedOuthosp.getSerialnum());
                    }
                }
            }
        }
        return true;
@@ -762,7 +766,7 @@
        patArchive.setPatientno("" + dto.getPatientId());
        patArchive.setIdcardno(StringUtils.isEmpty(dto.getIdCardNo()) ? "" + dto.getMedicalCardId() : dto.getIdCardNo().trim());
        patArchive.setName(dto.getPatientName());
        patArchive.setSourcefrom(2);
        patArchive.setSourcefrom(2L);
        patArchive.setPattype("2");
        patArchive.setSex("男".equals(dto.getGender()) ? 1L : 2L);
        patArchive.setNation(dto.getNation());