ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -864,6 +864,7 @@ if (failSendstate.equals("4") || failSendstate.equals("5")) { serviceSubtask.setCurrentPreachform(preachform); serviceSubtask.setSendstate(7L); serviceSubtask.setFinishtime(null); serviceSubtask.setRemark("处理补偿任务,当前处理最后补偿,全部执行失败(超时)"); serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); return true; ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskRuleController.java
@@ -2,10 +2,15 @@ import java.util.List; import com.github.pagehelper.ISelect; import com.ruoyi.common.annotation.AddOrgId; import com.ruoyi.common.utils.PageUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import javax.servlet.http.HttpServletResponse; import org.apache.commons.collections4.CollectionUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -34,8 +39,7 @@ @Api("任务执行规则") @RestController @RequestMapping("/smartor/taskrule") public class ServiceTaskRuleController extends BaseController { public class ServiceTaskRuleController extends BaseController { @Autowired private IServiceTaskRuleService serviceTaskRuleService; @@ -46,11 +50,24 @@ //@PreAuthorize("@ss.hasPermi('smartor:rule:list')") @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") @PostMapping("/list") public TableDataInfo list(@RequestBody ServiceTaskRule serviceTaskRule) { startPage(); public TableDataInfo list(@RequestBody ServiceTaskRule serviceTaskRule) { PageUtils.startPageByPost(serviceTaskRule.getPageNum(), serviceTaskRule.getPageSize()); List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule); return getDataTable(list); if (CollectionUtils.isNotEmpty(list)) { //获取total long total = PageUtils.count(new ISelect() { @Override public void doSelect() { serviceTaskRule.setPageNum(null); serviceTaskRule.setPageSize(null); serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule); } }); return getDataTable2(total, list); } return getDataTable2(0, list); } /** @@ -60,8 +77,7 @@ //@PreAuthorize("@ss.hasPermi('smartor:rule:export')") @Log(title = "任务执行规则", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ServiceTaskRule serviceTaskRule) { public void export(HttpServletResponse response, ServiceTaskRule serviceTaskRule) { List<ServiceTaskRule> list = serviceTaskRuleService.selectServiceTaskRuleList(serviceTaskRule); ExcelUtil<ServiceTaskRule> util = new ExcelUtil<ServiceTaskRule>(ServiceTaskRule.class); util.exportExcel(response, list, "任务执行规则数据"); @@ -73,8 +89,7 @@ @ApiOperation("获取任务执行规则详细信息") //@PreAuthorize("@ss.hasPermi('smartor:rule:query')") @GetMapping(value = "/getInfo/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) { return success(serviceTaskRuleService.selectServiceTaskRuleById(id)); } @@ -86,8 +101,7 @@ @Log(title = "任务执行规则", businessType = BusinessType.INSERT) @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") @PostMapping("/add") public AjaxResult add(@RequestBody ServiceTaskRule serviceTaskRule) { public AjaxResult add(@RequestBody ServiceTaskRule serviceTaskRule) { return toAjax(serviceTaskRuleService.insertServiceTaskRule(serviceTaskRule)); } @@ -99,8 +113,7 @@ @Log(title = "任务执行规则", businessType = BusinessType.UPDATE) @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") @PostMapping("/edit") public AjaxResult edit(@RequestBody ServiceTaskRule serviceTaskRule) { public AjaxResult edit(@RequestBody ServiceTaskRule serviceTaskRule) { return toAjax(serviceTaskRuleService.updateServiceTaskRule(serviceTaskRule)); } @@ -110,9 +123,8 @@ @ApiOperation("删除任务执行规则") //@PreAuthorize("@ss.hasPermi('smartor:rule:remove')") @Log(title = "任务执行规则", businessType = BusinessType.DELETE) @GetMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { @GetMapping("/remove/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(serviceTaskRuleService.deleteServiceTaskRuleByIds(ids)); } } ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -361,50 +361,11 @@ serviceSLTDInhospReqVO.setStartTailTime(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); } List<String> listStr = new ArrayList<>(); listStr.add("FH0109.26"); listStr.add("FH0109.24"); serviceSLTDInhospReqVO.setStatusList(listStr); log.info("【dealHisData】省立同德“入院”采集数据入参:{}", serviceSLTDInhospReqVO); serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO); log.info("【dealHisData】省立同德“入院”結束采集数据,院区:{}", cid); // 门急诊分页采集:每页1000条,直到无数据为止(南华附一的先不采门急诊数据) // if (active.trim().equals("sltd")) { // log.info("【dealHisData】省立同德“门急诊”开始分页采集数据,院区:{}", cid); // serviceSLTDInhospReqVO.setStartHeadTime(null); // serviceSLTDInhospReqVO.setStartTailTime(null); // serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime); // serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime); // if (active.trim().equals("nhfy")) { // serviceSLTDInhospReqVO.setEncounterTimeStart(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); // serviceSLTDInhospReqVO.setEncounterTimeEnd(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); // } // serviceSLTDInhospReqVO.setStatusList(null); // List<String> list1 = new ArrayList<>(); // list1.add("FH0108.01"); // list1.add("FH0108.03"); // serviceSLTDInhospReqVO.setHealthcareRecordTypeList(list1); // long outpPage = 1L; // final long OUTP_PAGE_SIZE = 1000L; // while (true) { // serviceSLTDInhospReqVO.setCurrent(outpPage); // serviceSLTDInhospReqVO.setSize(OUTP_PAGE_SIZE); // log.info("【dealHisData】省立同德“门急诊”采集第{}页数据,院区:{}", outpPage, cid); // List<ServiceSLTDInhospResDTO> outpResult = serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO); // if (CollectionUtils.isEmpty(outpResult)) { // log.info("【dealHisData】省立同德“门急诊”第{}页无数据,采集结束,院区:{}", outpPage, cid); // break; // } // log.info("【dealHisData】省立同德“门急诊”第{}页采集{}条,院区:{}", outpPage, outpResult.size(), cid); // if (outpResult.size() < OUTP_PAGE_SIZE) { // break; // } // outpPage++; // } // // 清除分页参数,避免影响后续出入院查询 // serviceSLTDInhospReqVO.setCurrent(null); // serviceSLTDInhospReqVO.setSize(null); // log.info("【dealHisData】省立同德“门急诊”分页采集完成,院区:{}", cid); // } log.info("【dealHisData】省立同德“出院”开始采集数据,院区:{}", cid); serviceSLTDInhospReqVO.setStartHeadTime(null); @@ -432,6 +393,93 @@ } catch (Exception e) { log.error("【dealHisData】省立同德数据采集异常", e); } } } /** * HIS省立同德门急诊数据采集(这个只能一天执行一次,不能半个小时执行一个,数据量太大,影响性能) * 定时任务:门诊数据 * todayZeroStr 当前的时间 例如:2026-05-06 00:00:00 */ public void dealHisDataMZ(String todayZeroStr) { log.info("【dealHisData】门急诊数据开始执行HIS数据采集任务"); // 获取昨天0点到今天0点的时间范围 LocalDateTime todayZero = LocalDateTime.now().with(LocalTime.MIN); if (StringUtils.isNotBlank(todayZeroStr)) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); todayZero = LocalDateTime.parse(todayZeroStr, formatter); } LocalDateTime yesterdayZero = todayZero.minusDays(1); if (active.trim().equals("sltd") || active.trim().equals("nhfy")) { //省立同德与华南附一用同一套采集方法(都是来未来提供) try { //获取省立同德要采集的院区 SysConfig cf = new SysConfig(); cf.setConfigKey("sltd.gather.campusid"); cf.setOrgid("20001001"); List<SysConfig> sysConfigcampusids = configService.selectConfigList(cf); List<Long> campusidList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(sysConfigcampusids)) { String[] split = sysConfigcampusids.get(0).getConfigValue().split(","); campusidList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList()); } else { log.error("SysConfig中的院区ID为空!"); return; } // 省立同德数据采集 for (Long cid : campusidList) { String nowTime = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); ServiceSLTDInhospReqVO serviceSLTDInhospReqVO = new ServiceSLTDInhospReqVO(); serviceSLTDInhospReqVO.setOrgId("20001001"); serviceSLTDInhospReqVO.setCampusId(cid); serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime); serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime); // 门急诊分页采集:每页1000条,直到无数据为止(南华附一的先不采门急诊数据) if (active.trim().equals("sltd")) { log.info("【dealHisData】省立同德“门急诊”开始分页采集数据,院区:{}", cid); serviceSLTDInhospReqVO.setStartHeadTime(null); serviceSLTDInhospReqVO.setStartTailTime(null); serviceSLTDInhospReqVO.setEncounterTimeStart(nowTime); serviceSLTDInhospReqVO.setEncounterTimeEnd(nowTime); if (active.trim().equals("nhfy")) { serviceSLTDInhospReqVO.setEncounterTimeStart(yesterdayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); serviceSLTDInhospReqVO.setEncounterTimeEnd(todayZero.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); } serviceSLTDInhospReqVO.setStatusList(null); List<String> list1 = new ArrayList<>(); list1.add("FH0108.01"); list1.add("FH0108.03"); serviceSLTDInhospReqVO.setHealthcareRecordTypeList(list1); long outpPage = 1L; final long OUTP_PAGE_SIZE = 1000L; while (true) { serviceSLTDInhospReqVO.setCurrent(outpPage); serviceSLTDInhospReqVO.setSize(OUTP_PAGE_SIZE); log.info("【dealHisData】省立同德“门急诊”采集第{}页数据,院区:{}", outpPage, cid); List<ServiceSLTDInhospResDTO> outpResult = serviceSLTDHealthcareRecordService.queryHealthcareRecordList(serviceSLTDInhospReqVO); if (CollectionUtils.isEmpty(outpResult)) { log.info("【dealHisData】省立同德“门急诊”第{}页无数据,采集结束,院区:{}", outpPage, cid); break; } log.info("【dealHisData】省立同德“门急诊”第{}页采集{}条,院区:{}", outpPage, outpResult.size(), cid); if (outpResult.size() < OUTP_PAGE_SIZE) { break; } outpPage++; } // 清除分页参数,避免影响后续出入院查询 serviceSLTDInhospReqVO.setCurrent(null); serviceSLTDInhospReqVO.setSize(null); log.info("【dealHisData】省立同德“门急诊”分页采集完成,院区:{}", cid); } } } catch (Exception e) { log.error("【dealHisData】省立同德数据门急诊采集异常", e); } } } @@ -1079,6 +1127,7 @@ if (allSendStateNot1AndNot9) { //说明全发送失败了 serviceSubtask.setSendstate(7L); serviceSubtask.setFinishtime(null); log.error("getSendPreachform方法 检查是否所有sendstate不等于9, 全失败了"); serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + "," + "所有发送方式均未获取结果,任务失败(超时)" : "所有发送方式均未获取结果,任务失败(超时)"); serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -476,6 +476,13 @@ private String leavediagname; /** * 入院诊断名称 */ @Excel(name = " 入院诊断名称") @ApiModelProperty(value = "入院诊断名称") private String diagname; /** * 患者ID */ @Excel(name = " 患者ID") smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -961,7 +961,8 @@ serviceSubtask.setLeavehospitaldistrictname(patMedInhosp1.getHospitaldistrictname()); } serviceSubtask.setLeaveicd10code(patMedInhosp1.getLeaveicd10code()); serviceSubtask.setLeavediagname(patMedInhosp1.getDiagname()); serviceSubtask.setLeavediagname(patMedInhosp1.getLeavediagname()); serviceSubtask.setDiagname(patMedInhosp1.getDiagname()); serviceSubtask.setTemplateid(serviceTask.getTemplateid()); serviceSubtask.setTemplatename(serviceTask.getTemplatename()); serviceSubtask.setPatid(patArchive.getId()); @@ -1026,6 +1027,13 @@ } } } //如果患者的入院和出院时间一致,可以不用随访(南华附一肿瘤一病区提出) if (active.equals("nhfy") && patMedInhosp1.getStarttime() != null && patMedInhosp1.getEndtime() != null && DateUtils.differentDaysByMillisecond(patMedInhosp1.getStarttime(), patMedInhosp1.getEndtime()) == 0) { serviceSubtask.setRemark("患者当天出院,不用随访"); serviceSubtask.setResult("error"); //不执行 serviceSubtask.setSendstate(4L); } //患者发送时间 @@ -1557,52 +1565,52 @@ // —— 将=2的次要规则对应flag设为"2"(跳过) log.info("【基于规则】首要规则有成功(count={}),将次要规则对应flag设为2", primaryGeneratedCount); if (deptIsSecondary) { updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark)?remark+";首要规则已生成,次要规则跳过":"首要规则已生成,次要规则跳过"); updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); } if (!active.equals("xh")) { if (wardIsSecondary) { updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark)?remark+";首要规则已生成,次要规则跳过":"首要规则已生成,次要规则跳过"); updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); } if (diagIsSecondary) { updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark)?remark+";首要规则已生成,次要规则跳过":"首要规则已生成,次要规则跳过"); updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); } } // —— 对于=1且生成成功的,将其对应flag设为"1" if (deptIsPrimary && deptGenCount > 0) { updateCheckFlag(patMedInhosp1, 1, "1", StringUtils.isNotEmpty(remark)?remark+";科室首要规则生成成功":"科室首要规则生成成功"); updateCheckFlag(patMedInhosp1, 1, "1", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则生成成功" : "科室首要规则生成成功"); } if (!active.equals("xh")) { if (wardIsPrimary && wardGenCount > 0) { updateCheckFlag(patMedInhosp1, 2, "1", StringUtils.isNotEmpty(remark)?remark+";病区首要规则生成成功":"病区首要规则生成成功"); updateCheckFlag(patMedInhosp1, 2, "1", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则生成成功" : "病区首要规则生成成功"); } if (diagIsPrimary && diagGenCount > 0) { updateCheckFlag(patMedInhosp1, 3, "1", StringUtils.isNotEmpty(remark)?remark+";疾病首要规则生成成功":"疾病首要规则生成成功"); updateCheckFlag(patMedInhosp1, 3, "1", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则生成成功" : "疾病首要规则生成成功"); } } // —— 对于=1但生成失败的,将其对应flag设为"2" if (deptIsPrimary && deptGenCount == 0) { updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark)?remark+";科室首要规则生成失败":"科室首要规则生成失败"); updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则生成失败" : "科室首要规则生成失败"); } if (!active.equals("xh")) { if (wardIsPrimary && wardGenCount == 0) { updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark)?remark+";病区首要规则生成失败":"病区首要规则生成失败"); updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则生成失败" : "病区首要规则生成失败"); } if (diagIsPrimary && diagGenCount == 0) { updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark)?remark+";疾病首要规则生成失败":"疾病首要规则生成失败"); updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则生成失败" : "疾病首要规则生成失败"); } } } else { // 所有首要规则全部失败,将=1的flag设为"2",然后执行=2的方法 log.info("【基于规则】首要规则全部失败,将=1的flag设为2,开始执行次要规则"); if (deptIsPrimary) { updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark)?remark+";科室首要规则全部失败":"科室首要规则全部失败"); updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则全部失败" : "科室首要规则全部失败"); } if (!active.equals("xh")) { if (wardIsPrimary) { updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark)?remark+";病区首要规则全部失败":"病区首要规则全部失败"); updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则全部失败" : "病区首要规则全部失败"); } if (diagIsPrimary) { updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark)?remark+";疾病首要规则全部失败":"疾病首要规则全部失败"); updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则全部失败" : "疾病首要规则全部失败"); } } // 执行次要规则(=2)的方法 smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -353,7 +353,7 @@ private String determineCry(ServiceSLTDInhospReqVO reqVO) { if (CollectionUtils.isEmpty(reqVO.getStatusList())) return null; if (reqVO.getStatusList().contains("FH0109.26")) { if (reqVO.getStatusList().contains("FH0109.24")) { //入院 return "0"; } else if (reqVO.getStatusList().contains("FH0109.27")) { @@ -488,7 +488,7 @@ log.info("【parseResponseData】门急诊数据已处理,跳过 type={}", type); } break; case "FH0109.26": case "FH0109.24": log.info("【parseResponseData】解析住院数据"); inHospitalDate(resultList, cry); break; smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -52,6 +52,7 @@ <result property="wechat" column="wechat"/> <result property="leaveicd10code" column="leaveicd10code"/> <result property="leavediagname" column="leavediagname"/> <result property="diagname" column="diagname"/> <result property="deptname" column="deptname"/> <result property="admindate" column="admindate"/> <result property="roomno" column="roomno"/> @@ -147,6 +148,7 @@ select id, hosp_type, task_guid, diagname, patfrom, management_doctor, management_doctor_code, smartor/src/main/resources/mapper/smartor/SvyTaskTemplateScriptMapper.xml
@@ -83,7 +83,7 @@ <select id="selectSvyTaskTemplateScriptList" parameterType="com.smartor.domain.SvyTaskTemplateScript" resultMap="SvyTaskTemplateScriptResult"> <include refid="selectSvyTaskTemplateScriptVo"/> where 1=1 where del_flag=0 <if test="taskid != null ">and taskid = #{taskid}</if> <if test="isMydException != null ">and is_myd_exception = #{isMydException}</if> <if test="dimension != null ">and dimension = #{dimension}</if>