From 1d4a5e64b2ce21342d35c9c2c85f353508f06a39 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 28 四月 2025 18:48:38 +0800
Subject: [PATCH] 代码提交
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 137 ++++++++++++++++++++++++++++++++++-----------
1 files changed, 102 insertions(+), 35 deletions(-)
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index fe5f22b..4191ba6 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -1,8 +1,6 @@
package com.ruoyi.quartz.task;
-import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
-import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.reflect.TypeToken;
@@ -11,18 +9,16 @@
import com.google.gson.JsonObject;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.ServiceFromEnum;
-import com.ruoyi.common.utils.DtoConversionUtils;
+import com.ruoyi.common.enums.WxGZHEnum;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
-import com.smartor.common.SendService;
import com.smartor.domain.*;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.ServiceTaskMapper;
import com.smartor.mapper.SysUserImportMapper;
import com.smartor.service.*;
-import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -35,12 +31,12 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
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;
@@ -50,6 +46,8 @@
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toHex;
/**
* 瀹氭椂浠诲姟璋冨害娴嬭瘯
@@ -70,6 +68,9 @@
@Autowired
private IPatMedInhospService iPatMedInhospService;
+
+ @Autowired
+ private IPatMedOuthospService iPatMedOuthospService;
@Autowired
private IPatMedOperationService iPatMedOperationService;
@@ -95,11 +96,11 @@
@Value("${pub_key}")
private String pub_key;
- @Value("${thirdWXUrl}")
- private String thirdWXUrl;
-
@Value("${req_path}")
private String req_path;
+
+ @Value("${visitHosp}")
+ private Integer visitHosp;
@Autowired
private ServiceTaskMapper serviceTaskMapper;
@@ -133,6 +134,12 @@
@Value("${hosp_info_url}")
private String hospInfoUrl;
+
+ @Value("${appid}")
+ private String appid;
+
+ @Value("${server.port}")
+ private String port;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("鎵ц澶氬弬鏂规硶锛� 瀛楃涓茬被鍨媨}锛屽竷灏旂被鍨媨}锛岄暱鏁村瀷{}锛屾诞鐐瑰瀷{}锛屾暣褰}", s, b, l, d, i));
@@ -220,7 +227,7 @@
public void dealHisData2() {
//灏嗘偅鑰呬俊鎭�佸嚭闄€�侀棬璇婃暟鎹叏閮ㄩ噰闆�
// 鎸囧畾鐨勫紑濮嬫棩鏈�
- LocalDate endDate = LocalDate.of(2024, 9, 1);
+ LocalDate endDate = LocalDate.of(2025, 3, 3);
// 褰撳墠鏃ユ湡
LocalDate currentDate = LocalDate.now();
// 瀹氫箟鏃ユ湡鏍煎紡
@@ -239,7 +246,14 @@
* 澶勭悊鎮h�呬俊鎭紝杩涘叆瀛愪换鍔¤〃
*/
public void dealOutHospInfo() {
- iPatMedInhospService.dealOutHospInfo();
+ if (port.equals("8095")) {
+ //鍑洪櫌琛�
+ iPatMedInhospService.dealOutHospInfo();
+ //闂ㄨ瘖琛�
+ if (visitHosp != 1) {
+ iPatMedOuthospService.dealOutpatientInfo();
+ }
+ }
}
@@ -247,17 +261,19 @@
* 澶勭悊鎵嬫湳淇℃伅锛岃繘鍏ュ瓙浠诲姟琛�
*/
public void dealOperationInfo() {
- iPatMedOperationService.dealOperationInfo();
+ if (port.equals("8095")) iPatMedOperationService.dealOperationInfo();
+
}
/**
* 澶勭悊鎮h�呬俊鎭紝杩涘叆瀛愪换鍔¤〃(寰俊灏忕▼搴�)
*/
public void dealOutHospInfoXHC() {
- PatMedInhosp patMedInhosp = new PatMedInhosp();
- //鑾峰彇鏈鐞嗙殑鏁版嵁
- List<ServicePatientTemp> servicePatientTemps = iServicePatientTempService.selectServicePatientTempList(new ServicePatientTemp());
-
+ if (port.equals("8095")) {
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+ //鑾峰彇鏈鐞嗙殑鏁版嵁
+ List<ServicePatientTemp> servicePatientTemps = iServicePatientTempService.selectServicePatientTempList(new ServicePatientTemp());
+ }
}
@@ -335,6 +351,14 @@
//濡備綍浠诲姟琚�滄殏鍋溾�濇垨鈥滅粓姝⑩��
break;
}
+ if (org.apache.commons.lang3.StringUtils.isEmpty(serviceSubtask.getPhone())) {
+ serviceSubtask.setRemark("鎵嬫満鍙蜂负绌�");
+ serviceSubtask.setSendstate(4L);
+ serviceSubtask.setResult("error");
+ serviceSubtask.setFinishtime(new Date());
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ continue;
+ }
boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
//璇存槑鏄珛鍗冲彂閫�(鍏堟妸娑堟伅鏀惧埌cache-0涓紝 displayNo涓嶇煡閬撴�庝箞閰嶇疆)
if (dateToday) {
@@ -404,6 +428,8 @@
ssvo.setCreateStartTime(startOfDayDate);
ssvo.setCreateEndTime(endOfDayDate);
ssvo.setCreateBy(serviceSubtask.getCreateBy());
+ ssvo.setSendname(serviceSubtask.getSendname());
+ ssvo.setSfzh(serviceSubtask.getSfzh());
List<ServiceSubtask> serviceSubtaskListByCreateTime = serviceSubtaskMapper.selectServiceSubtaskListByCreateTime(ssvo);
if (CollectionUtils.isEmpty(serviceSubtaskListByCreateTime))
serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
@@ -509,9 +535,34 @@
String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
String url = null;
url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false";
- String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "鏃�");
- Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
+// String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "鏃�");
+ //鑾峰彇寰俊鍏紬鍙疯姹備俊鎭牴鎹満鏋処D
+ List<String> wxqqxx = WxGZHEnum.getDescByCode(patArchive.getOrgid());
+ if (CollectionUtils.isEmpty(wxqqxx) || wxqqxx.size() < 4) {
+ ServiceSubtask ss = new ServiceSubtask();
+ ss.setResult("error");
+ ss.setRemark("璇ユ満鏋勭殑鍏紬鍙烽厤缃俊鎭笉鍏紝鏃犳硶閫氳繃鍏紬鍙峰彂閫�");
+ ss.setSendstate(5L);
+ ss.setId(serviceSubtask.getId());
+ ss.setFinishtime(new Date());
+ serviceSubtaskMapper.updateServiceSubtask(ss);
+ continue;
+ }
+
+ if (StringUtils.isEmpty(patArchive.getPatidHis())) {
+ ServiceSubtask ss = new ServiceSubtask();
+ ss.setResult("error");
+ ss.setRemark("鍏紬鍙峰彂閫佸け璐�,his绯荤粺鐨勬偅鑰卛d涓虹┖");
+ ss.setSendstate(5L);
+ ss.setId(serviceSubtask.getId());
+ ss.setFinishtime(new Date());
+ serviceSubtaskMapper.updateServiceSubtask(ss);
+ continue;
+ }
+ String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx);
+
+ Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
//浠诲姟鍙戦�佽褰�
ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
@@ -590,7 +641,7 @@
String filename = null;
if (cry.equals("0")) filename = "鍏ラ櫌淇℃伅" + System.currentTimeMillis();
if (cry.equals("1")) filename = "鍑洪櫌淇℃伅" + System.currentTimeMillis();
- File file = new File("D:\\public\\鍗庡崜闆嗘垚骞冲彴鏁版嵁\\" + filename);
+ File file = new File("D:\\public\\HIS鏁版嵁閲囬泦\\" + filename);
if (!file.exists()) {
// 濡傛灉鏂囦欢涓嶅瓨鍦紝鍒欏垱寤烘柊鏂囦欢
try {
@@ -643,7 +694,7 @@
patArchive.setPlaceOfResidence(StringUtils.isNotEmpty(thiedInhospInfo.getPatiHomeAddr()) ? thiedInhospInfo.getPatiHomeAddr().replace("null", "") : "");
try {
if (StringUtils.isNotEmpty(thiedInhospInfo.getPatiBirthday()))
- patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(thiedInhospInfo.getPatiBirthday()));
+ patArchive.setBirthdate(new SimpleDateFormat("yyyy-MM-dd").parse(thiedInhospInfo.getPatiBirthday()));
} catch (ParseException e) {
e.printStackTrace();
}
@@ -672,6 +723,7 @@
patMedInhosp.setNurseId(thiedInhospInfo.getNurseId());
patMedInhosp.setNurseName(thiedInhospInfo.getNurseName());
patMedInhosp.setSerialnum(thiedInhospInfo.getInpatientId());
+ patMedInhosp.setFuflag("1");
if (cry.equals("0")) {
patMedInhosp.setInhospstate("0");
} else if (cry.equals("1")) {
@@ -764,26 +816,41 @@
return key;
}
- private String getWXCode(String idcard, String url, String taskName, String taskDesc, String submitprompt) {
+ private String getWXCode(String idcard, String url, String taskName, String taskDesc, String phone, String setPatientname, String setPatientid, List<String> wxqqxx) {
XinHuaWXReq xinHuaWXReq = new XinHuaWXReq();
xinHuaWXReq.setIdcard(idcard);
xinHuaWXReq.setUrl(url);
- xinHuaWXReq.setKeyword1("娴欎腑鍖诲ぇ浜岄櫌鍑洪櫌闅忚");
- xinHuaWXReq.setKeyword2(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
- xinHuaWXReq.setKeyword3(taskName);
- xinHuaWXReq.setKeyword4("鐤剧梾搴峰娉ㄦ剰浜嬮」");
+ xinHuaWXReq.setPatientid(setPatientid);
+ xinHuaWXReq.setPatientname(setPatientname);
+ xinHuaWXReq.setMobile(phone);
+ xinHuaWXReq.setMedcardno(null);
+ xinHuaWXReq.setTitlename(taskName);
+ xinHuaWXReq.setContent(taskDesc);
+ xinHuaWXReq.setAppid(wxqqxx.get(1));
+ log.error("----getWXCode---xinHuaWXReq鐨勫嚭鍙備负锛歿}", xinHuaWXReq);
+ String body = new Gson().toJson(xinHuaWXReq);
+ String encode = encode(wxqqxx.get(2).concat(body));
+ Map<String, String> headerMap = new HashMap<>();
+ headerMap.put("sign", encode);
+ String result = HttpUtils.sendPostByHeader(wxqqxx.get(3), body, headerMap);
- String result = HttpUtils.sendPost(thirdWXUrl, new Gson().toJson(xinHuaWXReq));
JSONObject jsonObject = JSONObject.parseObject(result);
- log.error("jsonObject鐨勬暟鎹负锛歿}", jsonObject.toString());
-// String code = (String) jsonObject.get("code");
- return jsonObject.toString();
+ String code = (String) jsonObject.toString();
+ return code;
}
-// public static void main(String[] args) {
-// LocalDateTime originalDateTime = LocalDateTime.now();
-// LocalDateTime startOfDay = originalDateTime.with(LocalTime.MIN);
-// System.out.println("Original DateTime: " + originalDateTime);
-// System.out.println("Start of Day: " + startOfDay);
-// }
+
+ public String encode(String arg) {
+ if (arg == null) {
+ arg = "";
+ }
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ md5.update(arg.getBytes("UTF-8"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return toHex(md5.digest());
+ }
}
--
Gitblit v1.9.3