liusheng
15 小时以前 1be48553ad7b1994ed6f7d0d868f0ef7ba8a67af
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -3,23 +3,22 @@
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.MsgLSEnum;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.enums.VisitSendStateEnum;
import com.ruoyi.common.enums.WxGZHEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.OkHttpExample;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.quartz.service.ICollectHISMapperService;
import com.ruoyi.quartz.service.impl.CollectHISMapperServiceImpl;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.domain.*;
import com.smartor.mapper.HeLibraryMapper;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.ServiceTaskMapper;
import com.smartor.mapper.SysUserImportMapper;
@@ -30,20 +29,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -92,6 +84,9 @@
    @Autowired
    private SysUserImportMapper sysUserImportMapper;
    @Autowired
    private HeLibraryMapper heLibraryMapper;
    @Value("${localIP}")
    private String localIP;
@@ -137,6 +132,9 @@
    @Autowired
    IXHGatherPatArchiveService ixhGatherPatArchiveService;
    @Autowired
    ICollectHISMapperService icollectHis;
    @Value("${appid}")
@@ -359,10 +357,21 @@
                //丽水有的医院还没法做长期任务随访
                List<ServiceSubtask> subtaskList2 = new ArrayList<>();
                if (visitHosp == 2) {
                    for (ServiceSubtask serviceSubtask : subtaskList) {
                        Boolean b = VisitSendStateEnum.getDescByCode(serviceSubtask.getOrgid());
                        if (b) subtaskList2.add(serviceSubtask);
                    try {
                        for (ServiceSubtask serviceSubtask : subtaskList) {
                            Boolean b = VisitSendStateEnum.getDescByCode(serviceSubtask.getOrgid());
                            if (b) subtaskList2.add(serviceSubtask);
                        }
                    } catch (Exception e) {
                        log.error("-------长期任务异常为:", e);
                        continue;
                    }
//                    for (ServiceSubtask serviceSubtask : subtaskList) {
//                        Boolean b = VisitSendStateEnum.getDescByCode(serviceSubtask.getOrgid());
//
//                        if (b) subtaskList2.add(serviceSubtask);
//                    }
                    subtaskList = subtaskList2;
                }
@@ -478,7 +487,6 @@
                                    serviceSubtask.setResult("error");
                                    serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                    serviceSubtask.setSendstate(4L);
//                                    serviceSubtask.setFinishtime(new Date());
                                    iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                    continue;
                                }
@@ -497,9 +505,18 @@
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "填写。感谢您配合!");
                                //先判断一下发的是不是宣教
                                if (!"3".equals(serviceSubtask.getType())) {
                                    sendMagParam.setPhone(serviceSubtask.getPhone());
                                    sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                    sendMagParam.setContent("【新华医院】您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "填写。感谢您配合!");
                                } else {
                                    HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(serviceSubtask.getLibtemplateid());
                                    if ("2".equals(heLibrary.getHetype())) {
                                        sendMagParam.setPhone(serviceSubtask.getPhone());
                                        sendMagParam.setContent(heLibrary.getPreachcontent());
                                    }
                                }
                                String isSuccess = null;
                                if (visitHosp == 1) {
                                    Map<String, String> req = new HashMap<>();
@@ -747,4 +764,16 @@
        }
        return toHex(md5.digest());
    }
    public void collectHIS() {
        try {
            // HIS数据采集
            HnDataGatherVO hnDataGatherVO = new HnDataGatherVO();
            log.info("【dealHisData】HIS开始采集数据");
            ihnGatherPatArchiveService.hnDataGather(hnDataGatherVO);
            log.info("【dealHisData】HIS结束采集数据");
        } catch (Exception e) {
            log.error("【dealHisData】HIS数据采集异常", e);
        }
    }
}