| | |
| | | @Autowired |
| | | private SysConfigMapper sysConfigMapper; |
| | | |
| | | @Autowired |
| | | private IServiceTaskScheduleService serviceTaskScheduleService; |
| | | |
| | | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { |
| | | System.out.println(StringUtils.format("æ§è¡å¤åæ¹æ³ï¼ å符串类å{}ï¼å¸å°ç±»å{}ï¼é¿æ´å{}ï¼æµ®ç¹å{}ï¼æ´å½¢{}", s, b, l, d, i)); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤çæ£è
ä¿¡æ¯ï¼è¿å
¥åä»»å¡è¡¨ |
| | | */ |
| | | public void dealOutHospInfoByDimension() { |
| | | String config = configService.selectConfigByKey("visit.early.day"); |
| | | if (port.equals("8095")) { |
| | | //åºé¢è¡¨ |
| | | iPatMedInhospService.dealOutHospInfoByDimension(config); |
| | | //é¨è¯è¡¨(æ°åçææ¶ä¸åé¨è¯é访) |
| | | if (!active.equals("xh")) { |
| | | //iPatMedOuthospService.dealOutpatientInfo(); |
| | | } |
| | | } |
| | | } |
| | | // /** |
| | | // * å¤çæ£è
ä¿¡æ¯ï¼è¿å
¥åä»»å¡è¡¨ |
| | | // */ |
| | | // public void dealOutHospInfoByDimension() { |
| | | // String config = configService.selectConfigByKey("visit.early.day"); |
| | | // if (port.equals("8095")) { |
| | | // //åºé¢è¡¨ |
| | | // iPatMedInhospService.dealOutHospInfoByDimension(config); |
| | | // //é¨è¯è¡¨(æ°åçææ¶ä¸åé¨è¯é访) |
| | | // if (!active.equals("xh")) { |
| | | // //iPatMedOuthospService.dealOutpatientInfo(); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | int result = QwenLLMUtil.matchRegex(questionText, voiceText, value, regexText); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼å¾ªç¯ä»»å¡æ»å¨è°åº¦ã |
| | | * <p> |
| | | * æ«æææ schedule_style=1 ç计åï¼è¥æ¬è½® subtask å
¨é¨ finalizeï¼sendstate â 1/2/3ï¼ï¼ |
| | | * åå
éæ¬è½®æ£è
å°ä¸ä¸è½®ï¼æ¨è¿ current_loop_count ä¸ visit_timeã |
| | | * <p> |
| | | * 建议æ¯å°æ¶ææ¯åå°æ¶æ§è¡ä¸æ¬¡ï¼é¿å
轮次积åã |
| | | */ |
| | | public void rollTaskGroupCycle() { |
| | | log.info("ãrollTaskGroupCycleãå¼å§æ«æå¾ªç¯ä»»å¡ç»"); |
| | | try { |
| | | int rolled = serviceTaskScheduleService.rollCycleTasks(); |
| | | log.info("ãrollTaskGroupCycleãæ¬æ¬¡æ¨è¿ {} 个计å", rolled); |
| | | } catch (Exception e) { |
| | | log.error("ãrollTaskGroupCycleãæ»å¨è°åº¦å¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.common; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.ServiceSubtaskMapper; |
| | | import com.smartor.mapper.ServiceSubtaskPreachformMapper; |
| | | 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.stereotype.Component; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼subtask çæå¨ |
| | | * <p> |
| | | * åä¸èè´£ï¼æ ¹æ® schedule + detailList 为æ¯ä¸ªæ£è
æ´¾ç subtaskã |
| | | * åæ¶æå¡ä¸¤æ¡è·¯å¾ï¼ |
| | | * (a) å端æå¨å¾éæ£è
ï¼insertOrUpdateTaskï¼ ââ æ§ 6 åå
¥å£ï¼ |
| | | * (b) HIS èªå¨çº³å
¥æ°åºé¢æ£è
ï¼PatMedInhospServiceImpl.writeInSubTaskï¼ ââ æ° 5 åå
¥å£ã |
| | | * 两æ¡è·¯å¾ç»ä¸ä» baseSubtask ä¸ååºåæ¥å段ï¼é¿å
çæå¨ä¸ PatTaskRelevance/ServiceTaskVO è¦åã |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ScheduleSubtaskBuilder { |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskPreachformMapper serviceSubtaskPreachformMapper; |
| | | |
| | | /** |
| | | * 为å个æ£è
æ´¾ç subtaskï¼appltype=5ï¼ââ è§£è¦å
¥å£ï¼èªå¨çº³å
¥ & æå¨å¾éç»ä¸èµ°è¿éï¼ã |
| | | * <p> |
| | | * é循ç¯ï¼æ detailList 䏿¬¡æ§éºå¹³ N æ¡ï¼ |
| | | * å¾ªç¯ ï¼æ schedule.currentLoopCount çæå½åè½® N æ¡ï¼åç»è½®æ¬¡ç±è°åº¦å¨æ»å¨å»ºã |
| | | * |
| | | * @param serviceTask 主任å¡ï¼å·²è½åºï¼ |
| | | * @param schedule å·²è½åºç主计å |
| | | * @param detailList æç»åè¡¨ï¼æ seq ååºï¼ |
| | | * @param baseSubtask æ¨¡æ¿ subtaskï¼å·²å¡«å
æ£è
åºç¡ä¿¡æ¯ + åºåæ¥å段ï¼ï¼æ¹æ³å
伿·±æ·è´ |
| | | * @param preachformList åéæ¹å¼ï¼è°ç¨æ¹å·²è§£æå¥½ï¼å¯ä¸ºç©ºï¼ |
| | | */ |
| | | public void buildSubtasksForPatient(ServiceTask serviceTask, |
| | | ServiceTaskSchedule schedule, |
| | | List<ServiceTaskScheduleDetail> detailList, |
| | | ServiceSubtask baseSubtask, |
| | | List<Map<String, Object>> preachformList) { |
| | | if (CollectionUtils.isEmpty(detailList)) { |
| | | throw new BaseException("ä»»å¡ç»æç»ä¸ºç©ºï¼æ æ³çæ subtask, taskid=" + serviceTask.getTaskid()); |
| | | } |
| | | |
| | | Date benchmark = resolveBenchmark(schedule, baseSubtask); |
| | | long currentLoop = schedule.getCurrentLoopCount() == null ? 0L : schedule.getCurrentLoopCount(); |
| | | |
| | | for (ServiceTaskScheduleDetail detail : detailList) { |
| | | ServiceSubtask subtask = copyFromBase(baseSubtask); |
| | | |
| | | // åæº¯å段 |
| | | subtask.setScheduleId(schedule.getId()); |
| | | subtask.setScheduleDetailId(detail.getId()); |
| | | subtask.setScheduleSeq(detail.getSeq()); |
| | | subtask.setLoopCount(currentLoop); |
| | | |
| | | // 模æ¿ï¼detail ä¼å
äº task |
| | | if (detail.getTemplateid() != null) { |
| | | subtask.setTemplateid(detail.getTemplateid()); |
| | | subtask.setTemplatename(detail.getTemplatename()); |
| | | } |
| | | if (detail.getLibtemplateid() != null) { |
| | | subtask.setLibtemplateid(detail.getLibtemplateid()); |
| | | } |
| | | |
| | | // æ¶é´ï¼åºåæ¥ + dayOffset |
| | | Date visitTime = addDays(benchmark, detail.getDayOffset()); |
| | | subtask.setVisitTime(visitTime); |
| | | subtask.setSenddate(visitTime); |
| | | subtask.setLongSendTime(visitTime); |
| | | |
| | | // ç¶æï¼ä¸åæµç¨ä¸è´ï¼æ°å»ºå置为å¾
åé |
| | | subtask.setSendstate(2L); |
| | | subtask.setCreateTime(DateUtils.getNowDate()); |
| | | subtask.setUpdateTime(DateUtils.getNowDate()); |
| | | |
| | | serviceSubtaskMapper.insertServiceSubtask(subtask); |
| | | |
| | | insertPreachform(serviceTask, preachformList, subtask); |
| | | |
| | | log.info("[ä»»å¡ç»] taskid={} patid={} çæ subtask id={} seq={} dayOffset={} visitTime={}", |
| | | serviceTask.getTaskid(), baseSubtask.getPatid(), |
| | | subtask.getId(), detail.getSeq(), detail.getDayOffset(), visitTime); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
¼å®¹å
¥å£ï¼å端æå¨å¾éæ£è
ï¼insertOrUpdateTaskï¼ã |
| | | * æ patTaskRelevance çåºåæ¥å段åå¡«å° baseSubtask åï¼å§æç»è§£è¦å
¥å£ã |
| | | */ |
| | | public void buildSubtasksForPatient(ServiceTask serviceTask, |
| | | ServiceTaskVO serviceTaskVO, |
| | | ServiceTaskSchedule schedule, |
| | | List<ServiceTaskScheduleDetail> detailList, |
| | | PatTaskRelevance patTaskRelevance, |
| | | ServiceSubtask baseSubtask) { |
| | | // åå¡«åºåæ¥åæ®µï¼æå¨è·¯å¾ç baseSubtask ç± VO æ¼è£
ï¼åºåæ¥å段å¯è½æªå¡«å
¨ï¼ |
| | | if (baseSubtask.getStarttime() == null) { |
| | | baseSubtask.setStarttime(patTaskRelevance.getInhosptime() != null |
| | | ? patTaskRelevance.getInhosptime() : patTaskRelevance.getStarttime()); |
| | | } |
| | | if (baseSubtask.getEndtime() == null) { |
| | | baseSubtask.setEndtime(patTaskRelevance.getEndtime()); |
| | | } |
| | | if (baseSubtask.getAdmindate() == null) { |
| | | baseSubtask.setAdmindate(patTaskRelevance.getVisittime()); |
| | | } |
| | | buildSubtasksForPatient(serviceTask, schedule, detailList, baseSubtask, |
| | | serviceTaskVO.getPreachformList()); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ® scheduleBenchmark è§£æåºåæ¶é´ï¼ |
| | | * 0-èªå®ä¹æ¶é´ 1-å
¥é¢æ¶é´ 2-åºé¢æ¶é´ 3-å°±è¯æ¶é´ 4-å
¥ç»æ¶é´ |
| | | * å
¨é¨ä» baseSubtask åï¼åä¸å°å
åºå½åæ¶é´ã |
| | | */ |
| | | private Date resolveBenchmark(ServiceTaskSchedule schedule, ServiceSubtask base) { |
| | | Integer benchmark = schedule.getScheduleBenchmark() == null ? 0 : schedule.getScheduleBenchmark(); |
| | | Date now = DateUtils.getNowDate(); |
| | | switch (benchmark) { |
| | | case 1: |
| | | return base.getStarttime() != null ? base.getStarttime() : now; |
| | | case 2: |
| | | return base.getEndtime() != null ? base.getEndtime() : now; |
| | | case 3: |
| | | return base.getAdmindate() != null ? base.getAdmindate() : now; |
| | | case 4: |
| | | return base.getCreateTime() != null ? base.getCreateTime() : now; |
| | | case 0: |
| | | default: |
| | | return schedule.getScheduleBenchmarkCustomTime() != null |
| | | ? schedule.getScheduleBenchmarkCustomTime() : now; |
| | | } |
| | | } |
| | | |
| | | private Date addDays(Date base, int dayOffset) { |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(base); |
| | | c.add(Calendar.DAY_OF_MONTH, dayOffset); |
| | | return c.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * å service_subtask_preachformï¼åéæ¹å¼ç±è°ç¨æ¹å¤å¥½ã |
| | | */ |
| | | private void insertPreachform(ServiceTask serviceTask, List<Map<String, Object>> pfList, ServiceSubtask subtask) { |
| | | if (CollectionUtils.isEmpty(pfList)) { |
| | | return; |
| | | } |
| | | for (Map<String, Object> map : pfList) { |
| | | ServiceSubtaskPreachform pf = new ServiceSubtaskPreachform(); |
| | | pf.setSort(ObjectUtils.isEmpty(map.get("sort")) ? 0 : Long.valueOf(map.get("sort").toString())); |
| | | pf.setPreachform(ObjectUtils.isEmpty(map.get("preachform")) ? "" : map.get("preachform").toString()); |
| | | pf.setCompensateTime(ObjectUtils.isEmpty(map.get("compensateTime")) ? "" : map.get("compensateTime").toString()); |
| | | pf.setTaskid(serviceTask.getTaskid()); |
| | | pf.setSubid(subtask.getId()); |
| | | pf.setSendstate("1"); |
| | | pf.setOrgid(serviceTask.getOrgid()); |
| | | pf.setCreateTime(new Date()); |
| | | serviceSubtaskPreachformMapper.insertServiceSubtaskPreachform(pf); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ·±æ·è´ baseSubtask å°ä¸ä¸ªæ°å¯¹è±¡ï¼æ¯æ¬¡ insert å id ä¼ååï¼å¿
é¡»ç¬ç«å®ä¾ï¼ã |
| | | * ç¨ fastjson åæ·±æ·è´ï¼çä¸å setã |
| | | */ |
| | | private ServiceSubtask copyFromBase(ServiceSubtask base) { |
| | | String json = JSON.toJSONString(base); |
| | | ServiceSubtask copy = JSON.parseObject(json, ServiceSubtask.class); |
| | | // 主é®ãid å¿
é¡»æ¸
æï¼å¦å useGeneratedKeys ä»ä¼ç¨ä¸è½®ç id 触å主é®å²çª |
| | | copy.setId(null); |
| | | return copy; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå·²æä»»å¡è¿½å æ£è
ç请æ±ä½ï¼ç¨äºæå
è§£å³413é®é¢ï¼ |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "AppendPatientsReq", description = "åå·²æä»»å¡è¿½å æ£è
") |
| | | public class AppendPatientsReq { |
| | | |
| | | @ApiModelProperty(value = "ä»»å¡IDï¼insertOrUpdateTask ç¬¬ä¸æ¬¡è°ç¨åè¿åç taskIdï¼", required = true) |
| | | private Long taskId; |
| | | |
| | | @ApiModelProperty(value = "æ¬æ¹æ¬¡æ£è
å表") |
| | | private List<PatTaskRelevance> patTaskRelevances; |
| | | } |
| | |
| | | private String diagcheckFlag; |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼é¦è½®çº³å
¥æ è®°ï¼0æªå¤ç 1å·²çæé¦è½® 2æ å¹é
/失败 |
| | | * ç¬ç«äº dept/ward/diag check_flagï¼ä¸ä¾ä»»å¡ç»ç¬ç«æ«æä½¿ç¨ï¼åç»è½®æ¬¡ç± rollTaskGroupCycle è´è´£ã |
| | | */ |
| | | @ApiModelProperty(value = "ä»»å¡ç»(appltype=5)é¦è½®çº³å
¥æ è®°ï¼0æªå¤ç 1å·²çæé¦è½® 2æ å¹é
/失败") |
| | | private String scheduleCheckFlag; |
| | | |
| | | /** |
| | | * å
¥é¢ç§å®¤é¿æä»»å¡ï¼æ¯å¦å¤çï¼0æªå¤ç 1å¤ç |
| | | */ |
| | | @ApiModelProperty(value = "å
¥é¢ç§å®¤é¿æä»»å¡ï¼æ¯å¦å¤çï¼0æªå¤ç 1å¤çæå 2å¤ç失败 ") |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "ç»æå鿥æ") |
| | | private Date endSendDateTime; |
| | | |
| | | // ===================== ä»»å¡ç»ï¼appltype=5ï¼åæº¯åæ®µ ===================== |
| | | |
| | | /** |
| | | * å
³è service_task_schedule.idï¼appltype=5 æ¶ä½¿ç¨ï¼ |
| | | */ |
| | | @ApiModelProperty(value = "å
³è service_task_schedule.idï¼appltype=5ï¼") |
| | | private Long scheduleId; |
| | | |
| | | /** |
| | | * å
³è service_task_schedule_detail.id |
| | | */ |
| | | @ApiModelProperty(value = "å
³è service_task_schedule_detail.id") |
| | | private Long scheduleDetailId; |
| | | |
| | | /** |
| | | * æ¬æ¡ subtask å¨è®¡åä¸ç顺åºå· |
| | | */ |
| | | @ApiModelProperty(value = "æ¬æ¡ subtask å¨è®¡åä¸ç顺åºå·") |
| | | private Integer scheduleSeq; |
| | | |
| | | /** |
| | | * æå¨å¾ªç¯è½®æ¬¡ï¼é循ç¯ä»»å¡ä¸º0ï¼ |
| | | */ |
| | | @ApiModelProperty(value = "æå¨å¾ªç¯è½®æ¬¡ï¼é循ç¯ä»»å¡ä¸º0ï¼") |
| | | private Long loopCount; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * é访任å¡è®¡å主表 service_task_schedule |
| | | * <p> |
| | | * ç¨äº appltype=5ï¼æä»»å¡ç»ï¼ï¼ä¸ä¸ª service_task 对åºä¸æ¡ schedule + 夿¡ detailï¼ |
| | | * åä¸åºé¢è®°å½æ®æ¤å¯çæå¤ä¸ª service_subtaskã |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ServiceTaskSchedule", description = "é访任å¡è®¡å主表") |
| | | public class ServiceTaskSchedule extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @ApiModelProperty("主é®id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * å
³è service_task.taskid |
| | | */ |
| | | @ApiModelProperty("å
³è service_task.taskid") |
| | | @Excel(name = "ä»»å¡id") |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * æå¤§å¾ªç¯æ¬¡æ°ï¼å¾ªç¯ä»»å¡ç¨ï¼NULLæ0表示æ éï¼ |
| | | */ |
| | | @ApiModelProperty("æå¤§å¾ªç¯æ¬¡æ°ï¼å¾ªç¯ä»»å¡ç¨ï¼NULLæ0表示æ éï¼") |
| | | private Long maxLoopCount; |
| | | |
| | | /** |
| | | * å½åå·²å®æå¾ªç¯æ¬¡æ° |
| | | */ |
| | | @ApiModelProperty("å½åå·²å®æå¾ªç¯æ¬¡æ°") |
| | | private Long currentLoopCount; |
| | | |
| | | /** |
| | | * å½åæ§è¡é¡ºåºå· |
| | | */ |
| | | @ApiModelProperty("å½åæ§è¡é¡ºåºå·") |
| | | private Integer currentSeq; |
| | | |
| | | /** |
| | | * ä¸ä¸æ§è¡é¡ºåºå· |
| | | */ |
| | | @ApiModelProperty("ä¸ä¸æ§è¡é¡ºåºå·") |
| | | private Integer nextSeq; |
| | | |
| | | /** |
| | | * æ§è¡å¨ææ¹å¼(1-å¾ªç¯ 0-é循ç¯) |
| | | */ |
| | | @ApiModelProperty("æ§è¡å¨ææ¹å¼(1-å¾ªç¯ 0-é循ç¯)") |
| | | private Integer scheduleStyle; |
| | | |
| | | /** |
| | | * å¾ªç¯æ¶é´æ° |
| | | */ |
| | | @ApiModelProperty("å¾ªç¯æ¶é´æ°") |
| | | private Integer scheduleTimeNum; |
| | | |
| | | /** |
| | | * å¾ªç¯æ¶é´åä½; 1-天 2-å¨ 3-æ 4-å¹´ |
| | | */ |
| | | @ApiModelProperty("å¾ªç¯æ¶é´åä½; 1-天 2-å¨ 3-æ 4-å¹´") |
| | | private Integer scheduleTimeUnit; |
| | | |
| | | /** |
| | | * 䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | @ApiModelProperty("䏿¬¡æ§è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date nextExecuteTime; |
| | | |
| | | /** |
| | | * 卿åºåç±»å; 0-èªå®ä¹æ¶é´ 1-å
¥é¢æ¶é´ 2-åºé¢æ¶é´ 3-å°±è¯æ¶é´ 4-å
¥ç»æ¶é´ |
| | | */ |
| | | @ApiModelProperty("卿åºåç±»å; 0-èªå®ä¹æ¶é´ 1-å
¥é¢æ¶é´ 2-åºé¢æ¶é´ 3-å°±è¯æ¶é´ 4-å
¥ç»æ¶é´") |
| | | private Integer scheduleBenchmark; |
| | | |
| | | /** |
| | | * 卿åºåèªå®ä¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty("卿åºåèªå®ä¹æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date scheduleBenchmarkCustomTime; |
| | | |
| | | /** |
| | | * å 餿 è®°ï¼0åå¨ 1å é¤ï¼ |
| | | */ |
| | | @ApiModelProperty("å 餿 è®°ï¼0åå¨ 1å é¤ï¼") |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * æºæID |
| | | */ |
| | | @ApiModelProperty("æºæID") |
| | | private String orgid; |
| | | |
| | | /** |
| | | * é¢åºID |
| | | */ |
| | | @ApiModelProperty("é¢åºID") |
| | | private String campusid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * é访任å¡è®¡åæç»è¡¨ service_task_schedule_detail |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "ServiceTaskScheduleDetail", description = "é访任å¡è®¡åæç»è¡¨") |
| | | public class ServiceTaskScheduleDetail extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @ApiModelProperty("主é®") |
| | | private Long id; |
| | | |
| | | /** |
| | | * å
³è service_task.taskid |
| | | */ |
| | | @ApiModelProperty("å
³è service_task.taskid") |
| | | @Excel(name = "ä»»å¡id") |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * å
³è service_task_schedule.id |
| | | */ |
| | | @ApiModelProperty("å
³è service_task_schedule.id") |
| | | private Long scheduleid; |
| | | |
| | | /** |
| | | * 顺åºå·ï¼ä»1å¼å§ |
| | | */ |
| | | @ApiModelProperty("顺åºå·ï¼ä»1å¼å§") |
| | | private Integer seq; |
| | | |
| | | /** |
| | | * é´é天æ°ï¼åºå®ä»»å¡ï¼ç¸å¯¹åºåæ¥ï¼å¾ªç¯ä»»å¡ï¼ç¸å¯¹ä¸ä¸æ¬¡å®ææ¥ï¼ |
| | | */ |
| | | @ApiModelProperty("é´é天æ°ï¼åºå®ä»»å¡ï¼ç¸å¯¹åºåæ¥ï¼å¾ªç¯ä»»å¡ï¼ç¸å¯¹ä¸ä¸æ¬¡å®ææ¥ï¼") |
| | | private Integer dayOffset; |
| | | |
| | | /** |
| | | * 该次使ç¨ç模æ¿ID |
| | | */ |
| | | @ApiModelProperty("该次使ç¨ç模æ¿ID") |
| | | private Long templateid; |
| | | |
| | | /** |
| | | * 模æ¿åºID |
| | | */ |
| | | @ApiModelProperty("模æ¿åºID") |
| | | private Long libtemplateid; |
| | | |
| | | /** |
| | | * 模æ¿åç§° |
| | | */ |
| | | @ApiModelProperty("模æ¿åç§°") |
| | | private String templatename; |
| | | |
| | | /** |
| | | * 该次èªå®ä¹å
容ï¼JSONï¼kcb/jsy/text_paramçï¼ |
| | | */ |
| | | @ApiModelProperty("该次èªå®ä¹å
容ï¼JSONï¼kcb/jsy/text_paramçï¼") |
| | | private String content; |
| | | |
| | | /** |
| | | * 䏿¬¡æ§è¡æ¶é´ |
| | | */ |
| | | @ApiModelProperty("䏿¬¡æ§è¡æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date nextExecuteTime; |
| | | |
| | | /** |
| | | * å 餿 è®°ï¼0åå¨ 1å é¤ï¼ |
| | | */ |
| | | @ApiModelProperty("å 餿 è®°ï¼0åå¨ 1å é¤ï¼") |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * æºæID |
| | | */ |
| | | @ApiModelProperty("æºæID") |
| | | private String orgid; |
| | | |
| | | /** |
| | | * é¢åºID |
| | | */ |
| | | @ApiModelProperty("é¢åºID") |
| | | private String campusid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é访任å¡è®¡å VOï¼ä¸»è®¡å + æç»åè¡¨ï¼ |
| | | * ç¨äº appltype=5 ä»»å¡ç»å建/ä¿®æ¹çå
¥åã |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "ServiceTaskScheduleVO", description = "é访任å¡è®¡å") |
| | | public class ServiceTaskScheduleVO extends ServiceTaskSchedule { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 计åæç»åè¡¨ï¼æ seq æåºï¼ |
| | | */ |
| | | @ApiModelProperty("计åæç»åè¡¨ï¼æ seq æåºï¼") |
| | | private List<ServiceTaskScheduleDetail> detailList; |
| | | } |
| | |
| | | @Excel(name = "ææ¯ç级ç¼ç ") |
| | | private String oplevelcode; |
| | | /** |
| | | * éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»å |
| | | * éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»åã5ãæä»»å¡ç» |
| | | */ |
| | | @ApiModelProperty("éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»å") |
| | | @Excel(name = "éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»å") |
| | | @ApiModelProperty("éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»åã5ãæä»»å¡ç»") |
| | | @Excel(name = "éç¨æ¡ä»¶ç±»åï¼1ãæç§å®¤ã2ãæç
åºã3ãæç¾ç
è¯æã4ãæææ¯ç±»åã5ãæä»»å¡ç»") |
| | | private String appltype; |
| | | |
| | | @ApiModelProperty(value = "é访é¨é¨ç¼ç ") |
| | |
| | | @ApiModelProperty(value = "ç¾ç
ç
ç§") |
| | | @Excel(name = " ç¾ç
ç
ç§") |
| | | private String diagType; |
| | | |
| | | /** |
| | | * ä»»å¡ç»è®¡åï¼appltype=5 å¿
å¡«ï¼ä¸»è®¡å + æç»åè¡¨ï¼ |
| | | */ |
| | | @ApiModelProperty(value = "ä»»å¡ç»è®¡åï¼appltype=5 å¿
å¡«ï¼ä¸»è®¡å+æç»ï¼") |
| | | private ServiceTaskScheduleVO serviceTaskScheduleVO; |
| | | } |
| | |
| | | @ApiModelProperty("å 餿 å¿ï¼0ï¼æªå é¤ 1ï¼å·²å é¤ï¼") |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨ï¼éè¡¨åæ®µï¼ï¼æé¤ç appltypeãä¸»æ«æä¼ "5" 以æé¤ä»»å¡ç»ã |
| | | */ |
| | | @ApiModelProperty("æ¥è¯¢ç¨ï¼æé¤çappltypeï¼å¦5ï¼ä¸»æ«ææé¤ä»»å¡ç»ï¼") |
| | | private String excludeAppltype; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨ï¼éè¡¨åæ®µï¼ï¼éå®ç appltypeãä»»å¡ç»æ«æä¼ "5" åªæ¥ä»»å¡ç»ã |
| | | */ |
| | | @ApiModelProperty("æ¥è¯¢ç¨ï¼éå®çappltypeï¼å¦5ï¼åªæ¥ä»»å¡ç»ï¼") |
| | | private String queryAppltype; |
| | | |
| | | } |
| | | |
| | |
| | | @Excel(name = "ç¶ID") |
| | | private Long pid; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨ï¼éè¡¨åæ®µï¼ï¼æé¤ç appltypeãä¸»æ«æä¼ "5" 以æé¤ä»»å¡ç»ã |
| | | */ |
| | | @ApiModelProperty("æ¥è¯¢ç¨ï¼æé¤çappltypeï¼å¦5ï¼ä¸»æ«ææé¤ä»»å¡ç»ï¼") |
| | | private String excludeAppltype; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨ï¼éè¡¨åæ®µï¼ï¼éå®ç appltypeãä»»å¡ç»æ«æä¼ "5" åªæ¥ä»»å¡ç»ã |
| | | */ |
| | | @ApiModelProperty("æ¥è¯¢ç¨ï¼éå®çappltypeï¼å¦5ï¼åªæ¥ä»»å¡ç»ï¼") |
| | | private String queryAppltype; |
| | | |
| | | } |
| | | |
| | |
| | | public int insertServiceSubtask(ServiceSubtask ServiceSubtask); |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼ï¼ç»è®¡æä¸è½®æ¬¡å
ä»å¨è¿è¡ç subtask æ°éã |
| | | * ä»å¨è¿è¡ = sendstate in (1,2,3) 䏿ªå é¤ã |
| | | * ç¨äºå¤ææ¬è½®æ¯å¦å·²å
¨é¨ finalizeï¼æå/失败/䏿§è¡/è¶
æ¶ï¼ã |
| | | * |
| | | * @param scheduleId 计åä¸»é® |
| | | * @param loopCount 轮次ï¼0=é¦è½®ï¼ |
| | | */ |
| | | public int countActiveByScheduleIdAndLoop(@Param("scheduleId") Long scheduleId, |
| | | @Param("loopCount") Long loopCount); |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼ï¼æåæä¸è½®æ¬¡çå
¨é¨ subtaskï¼ç¨äºå
éå°ä¸ä¸è½®ï¼ã |
| | | */ |
| | | public List<ServiceSubtask> selectByScheduleIdAndLoop(@Param("scheduleId") Long scheduleId, |
| | | @Param("loopCount") Long loopCount); |
| | | |
| | | /** |
| | | * éè®¿åæ¶çï¼åºé访æ¶é´<å®é
é访æ¶é´ |
| | | * |
| | | * @param ServiceSubtask |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.ServiceTaskScheduleDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é访任å¡è®¡åæç» Mapper æ¥å£ |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Mapper |
| | | public interface ServiceTaskScheduleDetailMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢æç» |
| | | */ |
| | | ServiceTaskScheduleDetail selectServiceTaskScheduleDetailById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æç»å表 |
| | | */ |
| | | List<ServiceTaskScheduleDetail> selectServiceTaskScheduleDetailList(ServiceTaskScheduleDetail detail); |
| | | |
| | | /** |
| | | * æ scheduleid æ¥è¯¢æç»åè¡¨ï¼æ seq ååºï¼ |
| | | */ |
| | | List<ServiceTaskScheduleDetail> selectByScheduleid(@Param("scheduleid") Long scheduleid); |
| | | |
| | | /** |
| | | * æ taskid æ¥è¯¢æç»åè¡¨ï¼æ seq ååºï¼ |
| | | */ |
| | | List<ServiceTaskScheduleDetail> selectByTaskid(@Param("taskid") Long taskid); |
| | | |
| | | /** |
| | | * æ°å¢æç» |
| | | */ |
| | | int insertServiceTaskScheduleDetail(ServiceTaskScheduleDetail detail); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢æç» |
| | | */ |
| | | int batchInsertServiceTaskScheduleDetail(@Param("list") List<ServiceTaskScheduleDetail> list); |
| | | |
| | | /** |
| | | * ä¿®æ¹æç» |
| | | */ |
| | | int updateServiceTaskScheduleDetail(ServiceTaskScheduleDetail detail); |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼æ idï¼ |
| | | */ |
| | | int deleteServiceTaskScheduleDetailById(Long id); |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼æ scheduleidï¼ï¼ä¿®æ¹ä»»å¡æ¶æ¸
ç©ºæ§æç» |
| | | */ |
| | | int deleteByScheduleid(@Param("scheduleid") Long scheduleid); |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼æ taskidï¼ |
| | | */ |
| | | int deleteByTaskid(@Param("taskid") Long taskid); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.ServiceTaskSchedule; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é访任å¡è®¡å主表 Mapper æ¥å£ |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Mapper |
| | | public interface ServiceTaskScheduleMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¡å详æ
|
| | | */ |
| | | ServiceTaskSchedule selectServiceTaskScheduleById(Long id); |
| | | |
| | | /** |
| | | * éè¿ taskid æ¥è¯¢ä»»å¡å¯¹åºçææè®¡åï¼appltype=5 ä¸å¯¹ä¸ï¼ |
| | | */ |
| | | ServiceTaskSchedule selectByTaskid(@Param("taskid") Long taskid); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¡åå表 |
| | | */ |
| | | List<ServiceTaskSchedule> selectServiceTaskScheduleList(ServiceTaskSchedule serviceTaskSchedule); |
| | | |
| | | /** |
| | | * æ°å¢è®¡å |
| | | */ |
| | | int insertServiceTaskSchedule(ServiceTaskSchedule serviceTaskSchedule); |
| | | |
| | | /** |
| | | * ä¿®æ¹è®¡å |
| | | */ |
| | | int updateServiceTaskSchedule(ServiceTaskSchedule serviceTaskSchedule); |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼æ idï¼ |
| | | */ |
| | | int deleteServiceTaskScheduleById(Long id); |
| | | |
| | | /** |
| | | * é»è¾å é¤ï¼æ taskidï¼ï¼ä¿®æ¹ä»»å¡æ¶æ¸
空æ§è®¡å |
| | | */ |
| | | int deleteByTaskid(@Param("taskid") Long taskid); |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼æ»å¨è°åº¦ç¨ï¼æ¥è¯¢æææªè¾¾ä¸éç循ç¯è®¡åã |
| | | * æ¡ä»¶ï¼schedule_style=1 ä¸ (max_loop_count is null or max_loop_count=0 or current_loop_count < max_loop_count) |
| | | * éå¶è¿åæ¡æ°é¿å
é¿äºå¡ã |
| | | */ |
| | | List<ServiceTaskSchedule> selectActiveCycleSchedules(@Param("limit") int limit); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.service; |
| | | |
| | | import com.smartor.domain.ServiceTaskSchedule; |
| | | import com.smartor.domain.ServiceTaskScheduleDetail; |
| | | import com.smartor.domain.ServiceTaskScheduleVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é访任å¡è®¡å Service æ¥å£ |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | public interface IServiceTaskScheduleService { |
| | | |
| | | /** |
| | | * ä¿å计åï¼å«æç»ï¼ã |
| | | * è¥ taskid å·²æè®¡åï¼å
è½¯å æ§çï¼åæ°å»ºã |
| | | * |
| | | * @param vo 主计å + æç» |
| | | * @return ä¿ååç主计åï¼å«ä¸»é®ï¼ |
| | | */ |
| | | ServiceTaskSchedule saveScheduleWithDetail(ServiceTaskScheduleVO vo); |
| | | |
| | | /** |
| | | * æ taskid æ¥è¯¢è®¡å详æ
ï¼å«æç»ï¼ |
| | | */ |
| | | ServiceTaskScheduleVO getScheduleByTaskid(Long taskid); |
| | | |
| | | /** |
| | | * éè¿ taskid æ¥è¯¢ä¸»è®¡å |
| | | */ |
| | | ServiceTaskSchedule selectByTaskid(Long taskid); |
| | | |
| | | /** |
| | | * éè¿ scheduleid æ¥è¯¢æç» |
| | | */ |
| | | List<ServiceTaskScheduleDetail> selectDetailByScheduleid(Long scheduleid); |
| | | |
| | | /** |
| | | * æ taskid 软å 主计å + æç» |
| | | */ |
| | | int removeByTaskid(Long taskid); |
| | | |
| | | /** |
| | | * 循ç¯ä»»å¡æ»å¨è°åº¦ï¼ |
| | | * <p> |
| | | * æ«æææ schedule_style=1 çææè®¡åï¼è¥ current_loop_count 已达ä¸éåè·³è¿ï¼ |
| | | * å¦åå¤å®æ¬è½®ï¼current_loop_countï¼æ¯å¦å·²å
¨é¨ finalizeï¼sendstate â 1/2/3ï¼ã |
| | | * æ¯ -> çæä¸ä¸è½® subtaskï¼å
éæ¬è½®çæ£è
ï¼visit_time = æ¬è½® visit_time + N天/å¨/æ/å¹´ï¼ï¼ |
| | | * current_loop_count + 1ï¼next_execute_time æ¨è¿ã |
| | | * å¦ -> è·³è¿çå¾
䏿¬¡æ«æã |
| | | * <p> |
| | | * ç± RyTask 宿¶è°ç¨ï¼åæ¬¡æ«æéå¶ 200 æ¡é¿å
é¿äºå¡ã |
| | | * |
| | | * @return å®é
æ¨è¿äºå¤å°ä¸ªè®¡å |
| | | */ |
| | | int rollCycleTasks(); |
| | | } |
| | |
| | | private IServiceSubtaskDetailTraceService traceService; |
| | | |
| | | @Autowired |
| | | private IServiceTaskScheduleService serviceTaskScheduleService; |
| | | |
| | | @Autowired |
| | | private com.smartor.common.ScheduleSubtaskBuilder scheduleSubtaskBuilder; |
| | | |
| | | @Autowired |
| | | private FtpService ftpService; |
| | | |
| | | @Autowired |
| | |
| | | serviceTaskoperService.insertServiceTaskoper(serviceTaskoper); |
| | | } |
| | | |
| | | } else if (serviceTaskVO.getAppltype().equals("5")) { |
| | | // ä»»å¡ç»ï¼å¿
é¡»ä¸ºé¿æä»»å¡ï¼å¦å findMatchingTaskIds æ«ä¸å°ï¼æ æ³èªå¨çº³å
¥æ°åºé¢æ£è
ï¼ |
| | | if (serviceTaskVO.getLongTask() == null || serviceTaskVO.getLongTask() != 1) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»å¿
é¡»ä¸ºé¿æä»»å¡ï¼longTask=1ï¼"); |
| | | } |
| | | // ä¿å计å + æç» |
| | | ServiceTaskScheduleVO scheduleVO = serviceTaskVO.getServiceTaskScheduleVO(); |
| | | if (scheduleVO == null) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»ï¼serviceTaskScheduleVO ä¸è½ä¸ºç©º"); |
| | | } |
| | | scheduleVO.setTaskid(serviceTask.getTaskid()); |
| | | scheduleVO.setOrgid(serviceTask.getOrgid()); |
| | | scheduleVO.setCampusid(serviceTask.getCampusid()); |
| | | scheduleVO.setCreateBy(serviceTask.getCreateBy()); |
| | | log.info("----serviceTaskScheduleçå¼ä¸ºï¼{}", scheduleVO); |
| | | serviceTaskScheduleService.saveScheduleWithDetail(scheduleVO); |
| | | // ç»å®ç»´åº¦åæ¡ä»¶è¡¨ï¼ä¾ HIS èªå¨çº³å
¥å¹é
ï¼longtask æ=1ï¼ |
| | | bindDimensionCondition(serviceTask, serviceTaskVO); |
| | | } else { |
| | | ServiceTaskdept serviceTaskdept = new ServiceTaskdept(); |
| | | serviceTaskdept.setTaskId(serviceTask.getTaskid()); |
| | |
| | | serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime()); |
| | | serviceSubtask.setVisitTime(patTaskRelevance.getVisittime()); |
| | | } |
| | | |
| | | // ===== appltype=5 ä»»å¡ç»ï¼æ schedule ç detailList æ´¾ç夿¡ subtask ===== |
| | | if ("5".equals(serviceTaskVO.getAppltype())) { |
| | | ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTask.getTaskid()); |
| | | if (schedule == null) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»ï¼æªæ¾å° taskid=" + serviceTask.getTaskid() + " ç计å"); |
| | | } |
| | | List<ServiceTaskScheduleDetail> detailList = |
| | | serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId()); |
| | | scheduleSubtaskBuilder.buildSubtasksForPatient( |
| | | serviceTask, serviceTaskVO, schedule, detailList, patTaskRelevance, serviceSubtask); |
| | | continue; |
| | | } |
| | | |
| | | serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | serviceSubtask.getId().intValue(); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | } else if (serviceTaskVO.getAppltype().equals("5")) { |
| | | // ä»»å¡ç»ä¿®æ¹ï¼å æ§ schedule + æç»ï¼é建ãsubtask ä¸é¢å·²æ¹éæ¸
çã |
| | | if (serviceTaskVO.getLongTask() == null || serviceTaskVO.getLongTask() != 1) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»å¿
é¡»ä¸ºé¿æä»»å¡ï¼longTask=1ï¼"); |
| | | } |
| | | ServiceTaskScheduleVO scheduleVO = serviceTaskVO.getServiceTaskScheduleVO(); |
| | | if (scheduleVO == null) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»ï¼serviceTaskScheduleVO ä¸è½ä¸ºç©º"); |
| | | } |
| | | scheduleVO.setTaskid(serviceTask.getTaskid()); |
| | | scheduleVO.setOrgid(serviceTask.getOrgid()); |
| | | scheduleVO.setCampusid(serviceTask.getCampusid()); |
| | | scheduleVO.setCreateBy(serviceTask.getUpdateBy()); |
| | | serviceTaskScheduleService.saveScheduleWithDetail(scheduleVO); |
| | | // å
æ¸
æ§ç»´åº¦æ¡ä»¶è¡¨ï¼åæææ°å
¥åéåï¼é²è¿æç»´åº¦æ®ç导è´è¯¯çº³å
¥ï¼ |
| | | clearDimensionCondition(serviceTask.getTaskid()); |
| | | bindDimensionCondition(serviceTask, serviceTaskVO); |
| | | } |
| | | } |
| | | if (ObjectUtils.isNotEmpty(serviceTaskVO.getIvrTaskTemplateVO())) { |
| | |
| | | serviceSubtask.setVisitTime(patTaskRelevance.getVisittime()); |
| | | serviceSubtask.setTextParam(new Gson().toJson(serviceTaskVO.getTextParam())); |
| | | if (patTaskRelevance.getIsoperation() != null) { |
| | | // appltype=5 ä»»å¡ç»ï¼è¿½å æ£è
ï¼isoperation=1ï¼èµ°è®¡åæ´¾çï¼ä¿®æ¹ï¼2ï¼/å é¤ï¼3ï¼ä»èµ°åé»è¾ |
| | | if ("5".equals(serviceTaskVO.getAppltype()) && patTaskRelevance.getIsoperation() == 1) { |
| | | ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTask.getTaskid()); |
| | | if (schedule == null) { |
| | | throw new BaseException("appltype=5 ä»»å¡ç»ï¼æªæ¾å° taskid=" + serviceTask.getTaskid() + " ç计å"); |
| | | } |
| | | List<ServiceTaskScheduleDetail> detailList = |
| | | serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId()); |
| | | serviceSubtask.setUpdateBy(serviceTask.getUpdateBy()); |
| | | serviceSubtask.setCreateBy(serviceTask.getUpdateBy()); |
| | | scheduleSubtaskBuilder.buildSubtasksForPatient( |
| | | serviceTask, serviceTaskVO, schedule, detailList, patTaskRelevance, serviceSubtask); |
| | | continue; |
| | | } |
| | | if (patTaskRelevance.getIsoperation() == 2) { |
| | | serviceSubtask.setUpdateBy(serviceTask.getUpdateBy()); |
| | | serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask); |
| | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼ç»å®ç»´åº¦åæ¡ä»¶è¡¨ï¼ä¾ HIS èªå¨çº³å
¥å¹é
ã |
| | | * longtask æ=1ï¼å¦åç¬ç«æ«æ/ä¸»æ«ææ longtask=1 æ¥ä¸å°ï¼ã |
| | | * å¤ç¨ç°æ service_taskdeptï¼ç§å®¤deptType=1/ç
åºdeptType=2ï¼ãservice_taskdiagï¼ç¾ç
ï¼ã |
| | | * ææ¯ç»´åº¦æ¬æä¸åï¼æä¸æ¯æèªå¨çº³å
¥ï¼ã |
| | | */ |
| | | private void bindDimensionCondition(ServiceTask serviceTask, ServiceTaskVO vo) { |
| | | // ç§å®¤ |
| | | if (StringUtils.isNotEmpty(vo.getDeptcode())) { |
| | | for (String deptCode : vo.getDeptcode().split(",")) { |
| | | if (StringUtils.isEmpty(deptCode)) continue; |
| | | ServiceTaskdept d = new ServiceTaskdept(); |
| | | d.setTaskId(serviceTask.getTaskid()); |
| | | d.setTaskName(serviceTask.getTaskName()); |
| | | d.setOrgid(serviceTask.getOrgid()); |
| | | d.setLongtask(1L); |
| | | d.setDeptCode(deptCode); |
| | | d.setDeptType("1"); |
| | | d.setServiceType(vo.getServiceType()); |
| | | serviceTaskdeptService.insertServiceTaskdept(d); |
| | | } |
| | | } |
| | | // ç
åº |
| | | if (StringUtils.isNotEmpty(vo.getLeavehospitaldistrictcode())) { |
| | | for (String wardCode : vo.getLeavehospitaldistrictcode().split(",")) { |
| | | if (StringUtils.isEmpty(wardCode)) continue; |
| | | ServiceTaskdept d = new ServiceTaskdept(); |
| | | d.setTaskId(serviceTask.getTaskid()); |
| | | d.setTaskName(serviceTask.getTaskName()); |
| | | d.setOrgid(serviceTask.getOrgid()); |
| | | d.setLongtask(1L); |
| | | d.setDeptCode(wardCode); |
| | | d.setDeptType("2"); |
| | | d.setServiceType(vo.getServiceType()); |
| | | serviceTaskdeptService.insertServiceTaskdept(d); |
| | | } |
| | | } |
| | | // ç¾ç
ï¼ç¨ split(",")ï¼å¿ç
§æ appltype=3 ç°ç½ç split("$") bugï¼ |
| | | if (StringUtils.isNotEmpty(vo.getIcd10code())) { |
| | | String[] codes = vo.getIcd10code().split(","); |
| | | String[] names = StringUtils.isNotEmpty(vo.getIcd10name()) ? vo.getIcd10name().split(",") : new String[0]; |
| | | for (int i = 0; i < codes.length; i++) { |
| | | if (StringUtils.isEmpty(codes[i])) continue; |
| | | ServiceTaskdiag dg = new ServiceTaskdiag(); |
| | | dg.setTaskId(serviceTask.getTaskid()); |
| | | dg.setTaskName(serviceTask.getTaskName()); |
| | | dg.setOrgid(serviceTask.getOrgid()); |
| | | dg.setLongtask(1L); |
| | | dg.setServiceType(vo.getServiceType()); |
| | | dg.setIcd10code(codes[i]); |
| | | dg.setIcd10name(i < names.length ? names[i] : null); |
| | | dg.setGuid(serviceTask.getGuid()); |
| | | dg.setCreateTime(new Date()); |
| | | serviceTaskdiagService.insertServiceTaskdiag(dg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡ç»ä¿®æ¹æ¶ï¼å
软å 该 task æ§ç维度æ¡ä»¶è¡¨è®°å½ï¼é²è¿æç»´åº¦æ®ç导è´è¯¯çº³å
¥ï¼ã |
| | | */ |
| | | private void clearDimensionCondition(Long taskId) { |
| | | ServiceTaskdept dq = new ServiceTaskdept(); |
| | | dq.setTaskId(taskId); |
| | | List<ServiceTaskdept> depts = serviceTaskdeptService.selectServiceTaskdeptList(dq); |
| | | if (CollectionUtils.isNotEmpty(depts)) { |
| | | for (ServiceTaskdept d : depts) { |
| | | serviceTaskdeptService.deleteServiceTaskdeptById(d.getId()); |
| | | } |
| | | } |
| | | ServiceTaskdiag gq = new ServiceTaskdiag(); |
| | | gq.setTaskId(taskId); |
| | | List<ServiceTaskdiag> diags = serviceTaskdiagService.selectServiceTaskdiagList(gq); |
| | | if (CollectionUtils.isNotEmpty(diags)) { |
| | | for (ServiceTaskdiag g : diags) { |
| | | serviceTaskdiagService.deleteServiceTaskdiagById(g.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void phoneCallBack(PhoneCallBackVO phoneCallBackVO) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.smartor.domain.ServiceSubtask; |
| | | import com.smartor.domain.ServiceSubtaskPreachform; |
| | | import com.smartor.domain.ServiceTaskSchedule; |
| | | import com.smartor.domain.ServiceTaskScheduleDetail; |
| | | import com.smartor.domain.ServiceTaskScheduleVO; |
| | | import com.smartor.mapper.ServiceSubtaskMapper; |
| | | import com.smartor.mapper.ServiceSubtaskPreachformMapper; |
| | | import com.smartor.mapper.ServiceTaskScheduleDetailMapper; |
| | | import com.smartor.mapper.ServiceTaskScheduleMapper; |
| | | import com.smartor.service.IServiceTaskScheduleService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * é访任å¡è®¡å Service å®ç° |
| | | * |
| | | * @author smartor |
| | | * @date 2026-06-30 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ServiceTaskScheduleServiceImpl implements IServiceTaskScheduleService { |
| | | |
| | | @Autowired |
| | | private ServiceTaskScheduleMapper serviceTaskScheduleMapper; |
| | | |
| | | @Autowired |
| | | private ServiceTaskScheduleDetailMapper serviceTaskScheduleDetailMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskPreachformMapper serviceSubtaskPreachformMapper; |
| | | |
| | | /** 忬¡æ«æçæå¤§è®¡åæ°ï¼é¿å
é¿äºå¡ã */ |
| | | private static final int ROLL_BATCH_LIMIT = 200; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ServiceTaskSchedule saveScheduleWithDetail(ServiceTaskScheduleVO vo) { |
| | | if (vo == null || vo.getTaskid() == null) { |
| | | throw new BaseException("ä»»å¡è®¡åå
¥åéæ³ï¼taskid ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (CollectionUtils.isEmpty(vo.getDetailList())) { |
| | | throw new BaseException("ä»»å¡è®¡åæç»ä¸è½ä¸ºç©ºï¼è³å°ä¸æ¡ detailï¼"); |
| | | } |
| | | |
| | | // 1. æ§è®¡å软å |
| | | serviceTaskScheduleMapper.deleteByTaskid(vo.getTaskid()); |
| | | serviceTaskScheduleDetailMapper.deleteByTaskid(vo.getTaskid()); |
| | | |
| | | // 2. 主计åè½åº |
| | | Date now = DateUtils.getNowDate(); |
| | | ServiceTaskSchedule schedule = new ServiceTaskSchedule(); |
| | | // æ·è´ç¶ç±»ï¼ServiceTaskScheduleï¼å段 |
| | | schedule.setTaskid(vo.getTaskid()); |
| | | schedule.setMaxLoopCount(vo.getMaxLoopCount()); |
| | | schedule.setCurrentLoopCount(vo.getCurrentLoopCount() == null ? 0L : vo.getCurrentLoopCount()); |
| | | schedule.setCurrentSeq(vo.getCurrentSeq() == null ? 0 : vo.getCurrentSeq()); |
| | | schedule.setNextSeq(vo.getNextSeq() == null ? 1 : vo.getNextSeq()); |
| | | schedule.setScheduleStyle(vo.getScheduleStyle() == null ? 0 : vo.getScheduleStyle()); |
| | | schedule.setScheduleTimeNum(vo.getScheduleTimeNum() == null ? 0 : vo.getScheduleTimeNum()); |
| | | schedule.setScheduleTimeUnit(vo.getScheduleTimeUnit() == null ? 0 : vo.getScheduleTimeUnit()); |
| | | schedule.setNextExecuteTime(vo.getNextExecuteTime()); |
| | | schedule.setScheduleBenchmark(vo.getScheduleBenchmark() == null ? 0 : vo.getScheduleBenchmark()); |
| | | schedule.setScheduleBenchmarkCustomTime(vo.getScheduleBenchmarkCustomTime()); |
| | | schedule.setRemark(vo.getRemark()); |
| | | schedule.setDelFlag("0"); |
| | | schedule.setCreateBy(vo.getCreateBy()); |
| | | schedule.setUpdateBy(vo.getCreateBy()); |
| | | schedule.setCreateTime(now); |
| | | schedule.setUpdateTime(now); |
| | | schedule.setOrgid(vo.getOrgid()); |
| | | schedule.setCampusid(vo.getCampusid()); |
| | | serviceTaskScheduleMapper.insertServiceTaskSchedule(schedule); |
| | | |
| | | // 3. æç»è½åº |
| | | List<ServiceTaskScheduleDetail> detailList = vo.getDetailList(); |
| | | int seq = 1; |
| | | for (ServiceTaskScheduleDetail detail : detailList) { |
| | | detail.setTaskid(vo.getTaskid()); |
| | | detail.setScheduleid(schedule.getId()); |
| | | if (detail.getSeq() == null) { |
| | | detail.setSeq(seq); |
| | | } |
| | | if (detail.getDayOffset() == null) { |
| | | throw new BaseException("计åæç» seq=" + detail.getSeq() + " ç dayOffset ä¸è½ä¸ºç©º"); |
| | | } |
| | | detail.setDelFlag("0"); |
| | | detail.setCreateBy(vo.getCreateBy()); |
| | | detail.setUpdateBy(vo.getCreateBy()); |
| | | detail.setCreateTime(now); |
| | | detail.setUpdateTime(now); |
| | | detail.setOrgid(vo.getOrgid()); |
| | | detail.setCampusid(vo.getCampusid()); |
| | | seq++; |
| | | } |
| | | serviceTaskScheduleDetailMapper.batchInsertServiceTaskScheduleDetail(detailList); |
| | | |
| | | log.info("[ä»»å¡ç»] taskid={} 计åä¿å宿, scheduleId={}, detail æ¡æ°={}", |
| | | vo.getTaskid(), schedule.getId(), detailList.size()); |
| | | return schedule; |
| | | } |
| | | |
| | | @Override |
| | | public ServiceTaskScheduleVO getScheduleByTaskid(Long taskid) { |
| | | ServiceTaskSchedule schedule = serviceTaskScheduleMapper.selectByTaskid(taskid); |
| | | if (schedule == null) { |
| | | return null; |
| | | } |
| | | ServiceTaskScheduleVO vo = new ServiceTaskScheduleVO(); |
| | | vo.setId(schedule.getId()); |
| | | vo.setTaskid(schedule.getTaskid()); |
| | | vo.setMaxLoopCount(schedule.getMaxLoopCount()); |
| | | vo.setCurrentLoopCount(schedule.getCurrentLoopCount()); |
| | | vo.setCurrentSeq(schedule.getCurrentSeq()); |
| | | vo.setNextSeq(schedule.getNextSeq()); |
| | | vo.setScheduleStyle(schedule.getScheduleStyle()); |
| | | vo.setScheduleTimeNum(schedule.getScheduleTimeNum()); |
| | | vo.setScheduleTimeUnit(schedule.getScheduleTimeUnit()); |
| | | vo.setNextExecuteTime(schedule.getNextExecuteTime()); |
| | | vo.setScheduleBenchmark(schedule.getScheduleBenchmark()); |
| | | vo.setScheduleBenchmarkCustomTime(schedule.getScheduleBenchmarkCustomTime()); |
| | | vo.setRemark(schedule.getRemark()); |
| | | vo.setOrgid(schedule.getOrgid()); |
| | | vo.setCampusid(schedule.getCampusid()); |
| | | vo.setDetailList(serviceTaskScheduleDetailMapper.selectByScheduleid(schedule.getId())); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public ServiceTaskSchedule selectByTaskid(Long taskid) { |
| | | return serviceTaskScheduleMapper.selectByTaskid(taskid); |
| | | } |
| | | |
| | | @Override |
| | | public List<ServiceTaskScheduleDetail> selectDetailByScheduleid(Long scheduleid) { |
| | | return serviceTaskScheduleDetailMapper.selectByScheduleid(scheduleid); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int removeByTaskid(Long taskid) { |
| | | int n = serviceTaskScheduleMapper.deleteByTaskid(taskid); |
| | | serviceTaskScheduleDetailMapper.deleteByTaskid(taskid); |
| | | return n; |
| | | } |
| | | |
| | | @Override |
| | | public int rollCycleTasks() { |
| | | List<ServiceTaskSchedule> schedules = serviceTaskScheduleMapper.selectActiveCycleSchedules(ROLL_BATCH_LIMIT); |
| | | if (CollectionUtils.isEmpty(schedules)) { |
| | | return 0; |
| | | } |
| | | log.info("[ä»»å¡ç»-æ»å¨] æ«æå° {} 个å¾
è¯ä¼°ç循ç¯è®¡å", schedules.size()); |
| | | int rolled = 0; |
| | | for (ServiceTaskSchedule schedule : schedules) { |
| | | try { |
| | | // éè¿ AOP 代çè°ç¨ï¼ç¡®ä¿ @Transactional çæ |
| | | if (SpringUtils.getAopProxy(this).rollOneSchedule(schedule)) { |
| | | rolled++; |
| | | } |
| | | } catch (Exception e) { |
| | | // åæ¡å¤±è´¥ä¸å½±åå
¶å®è®¡åï¼è®°æ¥å¿ç»§ç» |
| | | log.error("[ä»»å¡ç»-æ»å¨] scheduleId={} æ»å¨å¤±è´¥ï¼{}", schedule.getId(), e.getMessage(), e); |
| | | } |
| | | } |
| | | log.info("[ä»»å¡ç»-æ»å¨] æ¬æ¬¡æ¨è¿ {} 个计å", rolled); |
| | | return rolled; |
| | | } |
| | | |
| | | /** |
| | | * å个计åçæ»å¨ï¼æ¬è½®å
¨é¨ finalize ææ¨è¿ï¼æ¯æ¬¡ä»
æ¨è¿ 1 è½®ã |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean rollOneSchedule(ServiceTaskSchedule schedule) { |
| | | Long scheduleId = schedule.getId(); |
| | | Long currentLoop = schedule.getCurrentLoopCount() == null ? 0L : schedule.getCurrentLoopCount(); |
| | | |
| | | // ä¸éæ ¡éª |
| | | Long max = schedule.getMaxLoopCount(); |
| | | if (max != null && max > 0 && currentLoop + 1 >= max) { |
| | | // 注æï¼å
夿"åå¼ä¸è½®æ¯å¦ä¼è¶
é"ââcurrentLoop æ¯å·²å®æè½®æ¬¡ï¼ä¸ä¸è½®å· = currentLoop+1 |
| | | // å½ currentLoop+1 == max æ¶æ£å¥½å¤äºæåä¸è½®ï¼ä¸åäº§çæ°ä¸è½® |
| | | if (currentLoop >= max) { |
| | | log.info("[ä»»å¡ç»-æ»å¨] scheduleId={} 已达 maxLoopCount={}, è·³è¿", scheduleId, max); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | // æ¬è½®æ¯å¦å®æ |
| | | int active = serviceSubtaskMapper.countActiveByScheduleIdAndLoop(scheduleId, currentLoop); |
| | | if (active > 0) { |
| | | log.debug("[ä»»å¡ç»-æ»å¨] scheduleId={} loop={} 仿 {} æ¡ subtask æªç»æ, è·³è¿", scheduleId, currentLoop, active); |
| | | return false; |
| | | } |
| | | |
| | | // ææ¬è½® subtask åå
鿍¡æ¿ï¼åå»éåçæ£è
éåï¼ |
| | | List<ServiceSubtask> currentLoopSubtasks = |
| | | serviceSubtaskMapper.selectByScheduleIdAndLoop(scheduleId, currentLoop); |
| | | if (CollectionUtils.isEmpty(currentLoopSubtasks)) { |
| | | log.warn("[ä»»å¡ç»-æ»å¨] scheduleId={} loop={} æ¾ä¸å°æ¬è½® subtask, è·³è¿", scheduleId, currentLoop); |
| | | return false; |
| | | } |
| | | |
| | | // ææ¬è®¡åæç»ï¼seq -> detailï¼ç¨æ¥å®ä½ä¸ä¸è½®æ¯æ¡ subtask ç¨åªä¸ªæ¨¡æ¿ |
| | | List<ServiceTaskScheduleDetail> detailList = |
| | | serviceTaskScheduleDetailMapper.selectByScheduleid(scheduleId); |
| | | if (CollectionUtils.isEmpty(detailList)) { |
| | | log.warn("[ä»»å¡ç»-æ»å¨] scheduleId={} æç»ä¸ºç©º, è·³è¿", scheduleId); |
| | | return false; |
| | | } |
| | | |
| | | // æ¨è¿æ¥é¿ï¼è½®é´éï¼ |
| | | int stepNum = schedule.getScheduleTimeNum() == null ? 0 : schedule.getScheduleTimeNum(); |
| | | int stepUnit = schedule.getScheduleTimeUnit() == null ? 1 : schedule.getScheduleTimeUnit(); |
| | | if (stepNum <= 0) { |
| | | log.warn("[ä»»å¡ç»-æ»å¨] scheduleId={} scheduleTimeNum={} éæ³, è·³è¿", scheduleId, stepNum); |
| | | return false; |
| | | } |
| | | |
| | | long nextLoop = currentLoop + 1; |
| | | |
| | | // æ patid+inhospid å»éï¼åæ£è
æ¬è½®å¯è½æ N æ¡ detailï¼æ¨¡æ¿ä»»éå
¶ä¸å³å¯ââå
éæ¶æ seq å¤ç¨æç»ï¼ |
| | | // 为ç®åï¼ç´æ¥æ schedule_seq å¤å¶ N æ¡ï¼æ¯æ¡ç¨å¯¹åº detailã |
| | | Date now = DateUtils.getNowDate(); |
| | | // æ detailList æ seq ç´¢å¼ |
| | | java.util.Map<Integer, ServiceTaskScheduleDetail> detailBySeq = new java.util.HashMap<>(detailList.size()); |
| | | for (ServiceTaskScheduleDetail d : detailList) { |
| | | detailBySeq.put(d.getSeq(), d); |
| | | } |
| | | |
| | | int produced = 0; |
| | | for (ServiceSubtask src : currentLoopSubtasks) { |
| | | ServiceTaskScheduleDetail detail = detailBySeq.get(src.getScheduleSeq()); |
| | | if (detail == null) { |
| | | log.warn("[ä»»å¡ç»-æ»å¨] scheduleId={} æ¾ä¸å° seq={} 对åºçæç», è·³è¿ subtask id={}", |
| | | scheduleId, src.getScheduleSeq(), src.getId()); |
| | | continue; |
| | | } |
| | | ServiceSubtask copy = cloneForNextLoop(src, detail, nextLoop, stepNum, stepUnit, now); |
| | | serviceSubtaskMapper.insertServiceSubtask(copy); |
| | | // å¤å¶ preachform |
| | | copyPreachform(src.getId(), copy); |
| | | produced++; |
| | | } |
| | | |
| | | // æ¨è¿ schedule ç current_loop_count / next_seq / next_execute_time |
| | | ServiceTaskSchedule upd = new ServiceTaskSchedule(); |
| | | upd.setId(scheduleId); |
| | | upd.setCurrentLoopCount(nextLoop); |
| | | upd.setCurrentSeq(1); |
| | | upd.setNextSeq(detailList.size() > 1 ? 2 : 1); |
| | | upd.setNextExecuteTime(advance(now, stepNum, stepUnit)); |
| | | upd.setUpdateTime(now); |
| | | serviceTaskScheduleMapper.updateServiceTaskSchedule(upd); |
| | | |
| | | log.info("[ä»»å¡ç»-æ»å¨] scheduleId={} æ¨è¿å°ç¬¬ {} è½®, æ°å»º {} æ¡ subtask", scheduleId, nextLoop, produced); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * å
é subtask å°ä¸ä¸è½®ï¼æ¸
主é®ãæ¸
åç¾åæ®µãæ¨è¿ visit_timeã设置 loop_countã |
| | | */ |
| | | private ServiceSubtask cloneForNextLoop(ServiceSubtask src, ServiceTaskScheduleDetail detail, |
| | | long nextLoop, int stepNum, int stepUnit, Date now) { |
| | | ServiceSubtask copy = JSON.parseObject(JSON.toJSONString(src), ServiceSubtask.class); |
| | | copy.setId(null); |
| | | copy.setSenduuid(null); |
| | | copy.setResult(null); |
| | | copy.setFinishtime(null); |
| | | copy.setExrecallcount(null); |
| | | copy.setCurrentPreachform(null); |
| | | copy.setSendstate(2L); |
| | | copy.setLoopCount(nextLoop); |
| | | copy.setScheduleDetailId(detail.getId()); |
| | | // 模æ¿ï¼detail ä¼å
|
| | | if (detail.getTemplateid() != null) { |
| | | copy.setTemplateid(detail.getTemplateid()); |
| | | copy.setTemplatename(detail.getTemplatename()); |
| | | } |
| | | if (detail.getLibtemplateid() != null) { |
| | | copy.setLibtemplateid(detail.getLibtemplateid()); |
| | | } |
| | | Date base = src.getVisitTime() != null ? src.getVisitTime() : now; |
| | | Date nextVisit = advance(base, stepNum, stepUnit); |
| | | copy.setVisitTime(nextVisit); |
| | | copy.setSenddate(nextVisit); |
| | | copy.setLongSendTime(nextVisit); |
| | | copy.setCreateTime(now); |
| | | copy.setUpdateTime(now); |
| | | return copy; |
| | | } |
| | | |
| | | /** |
| | | * å¤å¶æº subtask çåéæ¹å¼è¡å°æ° subtaskã |
| | | */ |
| | | private void copyPreachform(Long srcSubId, ServiceSubtask newSubtask) { |
| | | ServiceSubtaskPreachform q = new ServiceSubtaskPreachform(); |
| | | q.setSubid(srcSubId); |
| | | q.setTaskid(newSubtask.getTaskid()); |
| | | List<ServiceSubtaskPreachform> list = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(q); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | for (ServiceSubtaskPreachform src : list) { |
| | | ServiceSubtaskPreachform pf = new ServiceSubtaskPreachform(); |
| | | pf.setSort(src.getSort()); |
| | | pf.setPreachform(src.getPreachform()); |
| | | pf.setCompensateTime(src.getCompensateTime()); |
| | | pf.setTaskid(newSubtask.getTaskid()); |
| | | pf.setSubid(newSubtask.getId()); |
| | | pf.setSendstate("1"); |
| | | pf.setOrgid(newSubtask.getOrgid()); |
| | | pf.setCreateTime(new Date()); |
| | | serviceSubtaskPreachformMapper.insertServiceSubtaskPreachform(pf); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ schedule_time_unit æ¨è¿æ¶é´ï¼1-天 2-å¨ 3-æ 4-å¹´ |
| | | */ |
| | | private Date advance(Date base, int num, int unit) { |
| | | Calendar c = Calendar.getInstance(); |
| | | c.setTime(base); |
| | | switch (unit) { |
| | | case 2: |
| | | c.add(Calendar.WEEK_OF_YEAR, num); |
| | | break; |
| | | case 3: |
| | | c.add(Calendar.MONTH, num); |
| | | break; |
| | | case 4: |
| | | c.add(Calendar.YEAR, num); |
| | | break; |
| | | case 1: |
| | | default: |
| | | c.add(Calendar.DAY_OF_MONTH, num); |
| | | } |
| | | return c.getTime(); |
| | | } |
| | | } |
| | |
| | | <result property="inDeptcheckFlag" column="in_deptcheck_flag"/> |
| | | <result property="wardcheckFlag" column="wardcheck_flag"/> |
| | | <result property="diagcheckFlag" column="diagcheck_flag"/> |
| | | <result property="scheduleCheckFlag" column="schedulecheck_flag"/> |
| | | <result property="age" column="age"/> |
| | | <result property="sex" column="sex"/> |
| | | <result property="telcode" column="telcode"/> |
| | |
| | | in_deptcheck_flag, |
| | | in_wardcheck_flag, |
| | | diagcheck_flag, |
| | | schedulecheck_flag, |
| | | inhospstate, |
| | | patno, |
| | | long_task_reason, |
| | |
| | | b.in_deptcheck_flag, |
| | | b.in_wardcheck_flag, |
| | | b.diagcheck_flag, |
| | | b.schedulecheck_flag, |
| | | b.inhospstate, |
| | | b.patno, |
| | | b.inhospno, |
| | |
| | | <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if> |
| | | <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if> |
| | | <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if> |
| | | <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if> |
| | | <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if> |
| | | <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if> |
| | | <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if> |
| | |
| | | b.in_deptcheck_flag, |
| | | b.in_wardcheck_flag, |
| | | b.diagcheck_flag, |
| | | b.schedulecheck_flag, |
| | | b.inhospstate, |
| | | b.patno, |
| | | b.inhospno, |
| | |
| | | <if test="campusid != null ">and b.campusid = #{campusid}</if> |
| | | <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if> |
| | | <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if> |
| | | <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if> |
| | | <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if> |
| | | <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if> |
| | | <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if> |
| | |
| | | <if test="patno != null">patno = #{patno},</if> |
| | | <if test="inhospstate != null">inhospstate = #{inhospstate},</if> |
| | | <if test="deptcheckFlag != null">deptcheck_flag = #{deptcheckFlag},</if> |
| | | <if test="scheduleCheckFlag != null">schedulecheck_flag = #{scheduleCheckFlag},</if> |
| | | <if test="wardcheckFlag != null">wardcheck_flag = #{wardcheckFlag},</if> |
| | | <if test="inDeptcheckFlag != null">in_deptcheck_flag = #{inDeptcheckFlag},</if> |
| | | <if test="inWardcheckFlag != null">in_wardcheck_flag = #{inWardcheckFlag},</if> |
| | |
| | | FROM INFORMATION_SCHEMA.TABLES |
| | | WHERE TABLE_NAME = 'service_out_path' |
| | | AND table_schema = DATABASE() |
| | | and onorgid |
| | | -- and onorgid |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result property="continueCount" column="continue_count"/> |
| | | <result property="continueTimeNext" column="continue_time_next"/> |
| | | <result property="operationItemId" column="operation_item_id"/> |
| | | <result property="scheduleId" column="schedule_id"/> |
| | | <result property="scheduleDetailId" column="schedule_detail_id"/> |
| | | <result property="scheduleSeq" column="schedule_seq"/> |
| | | <result property="loopCount" column="loop_count"/> |
| | | </resultMap> |
| | | |
| | | <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2"> |
| | |
| | | continue_count, |
| | | continue_time_next, |
| | | operation_item_id, |
| | | schedule_id, |
| | | schedule_detail_id, |
| | | schedule_seq, |
| | | loop_count, |
| | | task_situation |
| | | from service_subtask |
| | | </sql> |
| | |
| | | <if test="continueTimeNext != null ">continue_time_next,</if> |
| | | <if test="continueContent != null ">continue_content,</if> |
| | | <if test="operationItemId != null ">operation_item_id,</if> |
| | | <if test="scheduleId != null ">schedule_id,</if> |
| | | <if test="scheduleDetailId != null ">schedule_detail_id,</if> |
| | | <if test="scheduleSeq != null ">schedule_seq,</if> |
| | | <if test="loopCount != null ">loop_count,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="sendname != null">#{sendname},</if> |
| | |
| | | <if test="continueTimeNext != null ">#{continueTimeNext,jdbcType=TIMESTAMP},</if> |
| | | <if test="continueContent != null ">#{continueContent},</if> |
| | | <if test="operationItemId != null ">#{operationItemId},</if> |
| | | <if test="scheduleId != null ">#{scheduleId},</if> |
| | | <if test="scheduleDetailId != null ">#{scheduleDetailId},</if> |
| | | <if test="scheduleSeq != null ">#{scheduleSeq},</if> |
| | | <if test="loopCount != null ">#{loopCount},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if> |
| | | <if test="continueContent != null ">continue_content = #{continueContent},</if> |
| | | <if test="operationItemId != null ">operation_item_id = #{operationItemId},</if> |
| | | <if test="scheduleId != null ">schedule_id = #{scheduleId},</if> |
| | | <if test="scheduleDetailId != null ">schedule_detail_id = #{scheduleDetailId},</if> |
| | | <if test="scheduleSeq != null ">schedule_seq = #{scheduleSeq},</if> |
| | | <if test="loopCount != null ">loop_count = #{loopCount},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | </choose> |
| | | </select> |
| | | |
| | | <!-- ä»»å¡ç»ï¼appltype=5ï¼æ»å¨è°åº¦ç¨ï¼æ¬è½®ä»å¨è·çæ°é --> |
| | | <select id="countActiveByScheduleIdAndLoop" resultType="int"> |
| | | select count(1) |
| | | from service_subtask |
| | | where schedule_id = #{scheduleId} |
| | | and loop_count = #{loopCount} |
| | | and (del_flag is null or del_flag = '0') |
| | | and sendstate in (1, 2, 3) |
| | | </select> |
| | | |
| | | <!-- ä»»å¡ç»ï¼appltype=5ï¼æ»å¨è°åº¦ç¨ï¼ææ¬è½®å
¨é subtaskï¼ä½ä¸ºä¸ä¸è½®çå
鿍¡æ¿ --> |
| | | <select id="selectByScheduleIdAndLoop" resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where schedule_id = #{scheduleId} |
| | | and loop_count = #{loopCount} |
| | | and (del_flag is null or del_flag = '0') |
| | | order by schedule_seq asc, id asc |
| | | </select> |
| | | |
| | | </mapper> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ServiceTaskScheduleDetailMapper"> |
| | | |
| | | <resultMap type="com.smartor.domain.ServiceTaskScheduleDetail" id="ServiceTaskScheduleDetailResult"> |
| | | <id property="id" column="id"/> |
| | | <result property="taskid" column="taskid"/> |
| | | <result property="scheduleid" column="scheduleid"/> |
| | | <result property="seq" column="seq"/> |
| | | <result property="dayOffset" column="day_offset"/> |
| | | <result property="templateid" column="templateid"/> |
| | | <result property="libtemplateid" column="libtemplateid"/> |
| | | <result property="templatename" column="templatename"/> |
| | | <result property="content" column="content"/> |
| | | <result property="nextExecuteTime" column="next_execute_time"/> |
| | | <result property="remark" column="remark"/> |
| | | <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="orgid" column="orgid"/> |
| | | <result property="campusid" column="campusid"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectServiceTaskScheduleDetailVo"> |
| | | select id, |
| | | taskid, |
| | | scheduleid, |
| | | seq, |
| | | day_offset, |
| | | templateid, |
| | | libtemplateid, |
| | | templatename, |
| | | content, |
| | | next_execute_time, |
| | | remark, |
| | | del_flag, |
| | | create_by, |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | orgid, |
| | | campusid |
| | | from service_task_schedule_detail |
| | | </sql> |
| | | |
| | | <select id="selectServiceTaskScheduleDetailById" parameterType="Long" |
| | | resultMap="ServiceTaskScheduleDetailResult"> |
| | | <include refid="selectServiceTaskScheduleDetailVo"/> |
| | | where id = #{id} and del_flag = '0' |
| | | </select> |
| | | |
| | | <select id="selectServiceTaskScheduleDetailList" |
| | | parameterType="com.smartor.domain.ServiceTaskScheduleDetail" |
| | | resultMap="ServiceTaskScheduleDetailResult"> |
| | | <include refid="selectServiceTaskScheduleDetailVo"/> |
| | | where del_flag = '0' |
| | | <if test="taskid != null">and taskid = #{taskid}</if> |
| | | <if test="scheduleid != null">and scheduleid = #{scheduleid}</if> |
| | | <if test="seq != null">and seq = #{seq}</if> |
| | | <if test="templateid != null">and templateid = #{templateid}</if> |
| | | order by seq asc |
| | | </select> |
| | | |
| | | <select id="selectByScheduleid" resultMap="ServiceTaskScheduleDetailResult"> |
| | | <include refid="selectServiceTaskScheduleDetailVo"/> |
| | | where scheduleid = #{scheduleid} and del_flag = '0' |
| | | order by seq asc |
| | | </select> |
| | | |
| | | <select id="selectByTaskid" resultMap="ServiceTaskScheduleDetailResult"> |
| | | <include refid="selectServiceTaskScheduleDetailVo"/> |
| | | where taskid = #{taskid} and del_flag = '0' |
| | | order by seq asc |
| | | </select> |
| | | |
| | | <insert id="insertServiceTaskScheduleDetail" parameterType="com.smartor.domain.ServiceTaskScheduleDetail" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into service_task_schedule_detail |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">taskid,</if> |
| | | <if test="scheduleid != null">scheduleid,</if> |
| | | <if test="seq != null">seq,</if> |
| | | <if test="dayOffset != null">day_offset,</if> |
| | | <if test="templateid != null">templateid,</if> |
| | | <if test="libtemplateid != null">libtemplateid,</if> |
| | | <if test="templatename != null">templatename,</if> |
| | | <if test="content != null">content,</if> |
| | | <if test="nextExecuteTime != null">next_execute_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="delFlag != null">del_flag,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="orgid != null">orgid,</if> |
| | | <if test="campusid != null">campusid,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">#{taskid},</if> |
| | | <if test="scheduleid != null">#{scheduleid},</if> |
| | | <if test="seq != null">#{seq},</if> |
| | | <if test="dayOffset != null">#{dayOffset},</if> |
| | | <if test="templateid != null">#{templateid},</if> |
| | | <if test="libtemplateid != null">#{libtemplateid},</if> |
| | | <if test="templatename != null">#{templatename},</if> |
| | | <if test="content != null">#{content},</if> |
| | | <if test="nextExecuteTime != null">#{nextExecuteTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="orgid != null">#{orgid},</if> |
| | | <if test="campusid != null">#{campusid},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <insert id="batchInsertServiceTaskScheduleDetail" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into service_task_schedule_detail |
| | | (taskid, scheduleid, seq, day_offset, templateid, libtemplateid, templatename, content, |
| | | next_execute_time, remark, del_flag, create_by, create_time, update_by, update_time, orgid, campusid) |
| | | values |
| | | <foreach collection="list" item="item" separator=","> |
| | | (#{item.taskid}, #{item.scheduleid}, #{item.seq}, #{item.dayOffset}, |
| | | #{item.templateid}, #{item.libtemplateid}, #{item.templatename}, #{item.content}, |
| | | #{item.nextExecuteTime}, #{item.remark}, |
| | | <choose> |
| | | <when test="item.delFlag != null">#{item.delFlag}</when> |
| | | <otherwise>'0'</otherwise> |
| | | </choose>, |
| | | #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, |
| | | #{item.orgid}, #{item.campusid}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <update id="updateServiceTaskScheduleDetail" parameterType="com.smartor.domain.ServiceTaskScheduleDetail"> |
| | | update service_task_schedule_detail |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="taskid != null">taskid = #{taskid},</if> |
| | | <if test="scheduleid != null">scheduleid = #{scheduleid},</if> |
| | | <if test="seq != null">seq = #{seq},</if> |
| | | <if test="dayOffset != null">day_offset = #{dayOffset},</if> |
| | | <if test="templateid != null">templateid = #{templateid},</if> |
| | | <if test="libtemplateid != null">libtemplateid = #{libtemplateid},</if> |
| | | <if test="templatename != null">templatename = #{templatename},</if> |
| | | <if test="content != null">content = #{content},</if> |
| | | <if test="nextExecuteTime != null">next_execute_time = #{nextExecuteTime},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="campusid != null">campusid = #{campusid},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteServiceTaskScheduleDetailById" parameterType="Long"> |
| | | update service_task_schedule_detail |
| | | set del_flag = '1', |
| | | update_time = now() |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteByScheduleid"> |
| | | update service_task_schedule_detail |
| | | set del_flag = '1', |
| | | update_time = now() |
| | | where scheduleid = #{scheduleid} |
| | | and del_flag = '0' |
| | | </update> |
| | | |
| | | <update id="deleteByTaskid"> |
| | | update service_task_schedule_detail |
| | | set del_flag = '1', |
| | | update_time = now() |
| | | where taskid = #{taskid} |
| | | and del_flag = '0' |
| | | </update> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ServiceTaskScheduleMapper"> |
| | | |
| | | <resultMap type="com.smartor.domain.ServiceTaskSchedule" id="ServiceTaskScheduleResult"> |
| | | <id property="id" column="id"/> |
| | | <result property="taskid" column="taskid"/> |
| | | <result property="maxLoopCount" column="max_loop_count"/> |
| | | <result property="currentLoopCount" column="current_loop_count"/> |
| | | <result property="currentSeq" column="current_seq"/> |
| | | <result property="nextSeq" column="next_seq"/> |
| | | <result property="scheduleStyle" column="schedule_style"/> |
| | | <result property="scheduleTimeNum" column="schedule_time_num"/> |
| | | <result property="scheduleTimeUnit" column="schedule_time_unit"/> |
| | | <result property="nextExecuteTime" column="next_execute_time"/> |
| | | <result property="scheduleBenchmark" column="schedule_benchmark"/> |
| | | <result property="scheduleBenchmarkCustomTime" column="schedule_benchmark_custom_time"/> |
| | | <result property="remark" column="remark"/> |
| | | <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="orgid" column="orgid"/> |
| | | <result property="campusid" column="campusid"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectServiceTaskScheduleVo"> |
| | | select id, |
| | | taskid, |
| | | max_loop_count, |
| | | current_loop_count, |
| | | current_seq, |
| | | next_seq, |
| | | schedule_style, |
| | | schedule_time_num, |
| | | schedule_time_unit, |
| | | next_execute_time, |
| | | schedule_benchmark, |
| | | schedule_benchmark_custom_time, |
| | | remark, |
| | | del_flag, |
| | | create_by, |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | orgid, |
| | | campusid |
| | | from service_task_schedule |
| | | </sql> |
| | | |
| | | <select id="selectServiceTaskScheduleById" parameterType="Long" resultMap="ServiceTaskScheduleResult"> |
| | | <include refid="selectServiceTaskScheduleVo"/> |
| | | where id = #{id} and del_flag = '0' |
| | | </select> |
| | | |
| | | <select id="selectByTaskid" resultMap="ServiceTaskScheduleResult"> |
| | | <include refid="selectServiceTaskScheduleVo"/> |
| | | where taskid = #{taskid} and del_flag = '0' |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectServiceTaskScheduleList" parameterType="com.smartor.domain.ServiceTaskSchedule" |
| | | resultMap="ServiceTaskScheduleResult"> |
| | | <include refid="selectServiceTaskScheduleVo"/> |
| | | where del_flag = '0' |
| | | <if test="taskid != null">and taskid = #{taskid}</if> |
| | | <if test="scheduleStyle != null">and schedule_style = #{scheduleStyle}</if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <insert id="insertServiceTaskSchedule" parameterType="com.smartor.domain.ServiceTaskSchedule" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into service_task_schedule |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">taskid,</if> |
| | | <if test="maxLoopCount != null">max_loop_count,</if> |
| | | <if test="currentLoopCount != null">current_loop_count,</if> |
| | | <if test="currentSeq != null">current_seq,</if> |
| | | <if test="nextSeq != null">next_seq,</if> |
| | | <if test="scheduleStyle != null">schedule_style,</if> |
| | | <if test="scheduleTimeNum != null">schedule_time_num,</if> |
| | | <if test="scheduleTimeUnit != null">schedule_time_unit,</if> |
| | | <if test="nextExecuteTime != null">next_execute_time,</if> |
| | | <if test="scheduleBenchmark != null">schedule_benchmark,</if> |
| | | <if test="scheduleBenchmarkCustomTime != null">schedule_benchmark_custom_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="delFlag != null">del_flag,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="orgid != null">orgid,</if> |
| | | <if test="campusid != null">campusid,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">#{taskid},</if> |
| | | <if test="maxLoopCount != null">#{maxLoopCount},</if> |
| | | <if test="currentLoopCount != null">#{currentLoopCount},</if> |
| | | <if test="currentSeq != null">#{currentSeq},</if> |
| | | <if test="nextSeq != null">#{nextSeq},</if> |
| | | <if test="scheduleStyle != null">#{scheduleStyle},</if> |
| | | <if test="scheduleTimeNum != null">#{scheduleTimeNum},</if> |
| | | <if test="scheduleTimeUnit != null">#{scheduleTimeUnit},</if> |
| | | <if test="nextExecuteTime != null">#{nextExecuteTime},</if> |
| | | <if test="scheduleBenchmark != null">#{scheduleBenchmark},</if> |
| | | <if test="scheduleBenchmarkCustomTime != null">#{scheduleBenchmarkCustomTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="orgid != null">#{orgid},</if> |
| | | <if test="campusid != null">#{campusid},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateServiceTaskSchedule" parameterType="com.smartor.domain.ServiceTaskSchedule"> |
| | | update service_task_schedule |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="taskid != null">taskid = #{taskid},</if> |
| | | <if test="maxLoopCount != null">max_loop_count = #{maxLoopCount},</if> |
| | | <if test="currentLoopCount != null">current_loop_count = #{currentLoopCount},</if> |
| | | <if test="currentSeq != null">current_seq = #{currentSeq},</if> |
| | | <if test="nextSeq != null">next_seq = #{nextSeq},</if> |
| | | <if test="scheduleStyle != null">schedule_style = #{scheduleStyle},</if> |
| | | <if test="scheduleTimeNum != null">schedule_time_num = #{scheduleTimeNum},</if> |
| | | <if test="scheduleTimeUnit != null">schedule_time_unit = #{scheduleTimeUnit},</if> |
| | | <if test="nextExecuteTime != null">next_execute_time = #{nextExecuteTime},</if> |
| | | <if test="scheduleBenchmark != null">schedule_benchmark = #{scheduleBenchmark},</if> |
| | | <if test="scheduleBenchmarkCustomTime != null"> |
| | | schedule_benchmark_custom_time = #{scheduleBenchmarkCustomTime}, |
| | | </if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="campusid != null">campusid = #{campusid},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteServiceTaskScheduleById" parameterType="Long"> |
| | | update service_task_schedule |
| | | set del_flag = '1', |
| | | update_time = now() |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteByTaskid"> |
| | | update service_task_schedule |
| | | set del_flag = '1', |
| | | update_time = now() |
| | | where taskid = #{taskid} |
| | | and del_flag = '0' |
| | | </update> |
| | | |
| | | <select id="selectActiveCycleSchedules" resultMap="ServiceTaskScheduleResult"> |
| | | <include refid="selectServiceTaskScheduleVo"/> |
| | | where del_flag = '0' |
| | | and schedule_style = 1 |
| | | and (max_loop_count is null |
| | | or max_loop_count = 0 |
| | | or current_loop_count < max_loop_count) |
| | | order by id asc |
| | | limit #{limit} |
| | | </select> |
| | | |
| | | </mapper> |