liusheng
3 天以前 4d537968ac6efb3a5e3d0f8ea5071d5254eb63c3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HNGatherPatArchiveController.java
@@ -9,10 +9,7 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.PatMedInhosp;
import com.smartor.domain.PatMedOuthosp;
import com.smartor.domain.PatMedReq;
import com.smartor.domain.PatMedRes;
import com.smartor.domain.*;
import com.smartor.service.IHNGatherPatArchiveService;
import com.smartor.service.IPatMedOuthospService;
import com.smartor.service.impl.HNGatherPatArchiveServiceImpl;
@@ -48,35 +45,12 @@
    /**
     * 河南数据采集
     */
    //@PreAuthorize("@ss.hasPermi('smartor:patouthosp:list')")
    @PostMapping("/selectGatherList")
    @PostMapping("/hnDataGather")
    @ApiOperation("河南数据采集")
    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;
    public AjaxResult hnDataGather(@RequestBody HnDataGatherVO hnDataGatherVO) {
        log.info("开始按天同步用户数据,时间范围: {} 到 {}", hnDataGatherVO.getStartOutHospTime(), hnDataGatherVO.getEndOutHospTime());
        Boolean aBoolean = ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO);
        return AjaxResult.success(aBoolean);
    }
}