|  |  | 
 |  |  | 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.ICollectHISService; | 
 |  |  | 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; | 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SysUserImportMapper sysUserImportMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private HeLibraryMapper heLibraryMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ICollectHISService ichService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Value("${localIP}") | 
 |  |  |     private String localIP; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     IXHGatherPatArchiveService ixhGatherPatArchiveService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     ICollectHISService icollectHis; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Value("${appid}") | 
 |  |  | 
 |  |  |                 //丽水有的医院还没法做长期任务随访 | 
 |  |  |                 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; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |                                     serviceSubtask.setResult("error"); | 
 |  |  |                                     serviceSubtask.setRemark(patArchive.getNotrequiredreason()); | 
 |  |  |                                     serviceSubtask.setSendstate(4L); | 
 |  |  | //                                    serviceSubtask.setFinishtime(new Date()); | 
 |  |  |                                     iServiceSubtaskService.insertServiceSubtask(serviceSubtask); | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  | 
 |  |  |                                 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<>(); | 
 |  |  | 
 |  |  |         } | 
 |  |  |         return toHex(md5.digest()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void collectHIS() { | 
 |  |  |         try { | 
 |  |  |             // HIS数据采集 | 
 |  |  |             HnDataGatherVO hnDataGatherVO = new HnDataGatherVO(); | 
 |  |  |             log.info("【dealHisData】HIS开始采集数据"); | 
 |  |  |             ichService.hnDataGather(hnDataGatherVO); | 
 |  |  |             log.info("【dealHisData】HIS结束采集数据"); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("【dealHisData】HIS数据采集异常", e); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |