浏览代码

no message

xiaochan 4 月之前
父节点
当前提交
01e149630e

+ 0 - 2
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/JianYanJianChaDao.java

@@ -582,6 +582,4 @@ public interface JianYanJianChaDao {
             "  and b.occ_code = c.code\n" +
             " and  ${ew.sqlSegment};")
     List<JyJcCheckItemDto> selectJyJcCheckItemDto(@Param("ew") QueryWrapper<?> queryWrapper, String tableName);
-
-
 }

+ 20 - 7
src/main/java/thyyxxk/webserver/service/ca/CaServer.java

@@ -12,6 +12,7 @@ import cn.hutool.crypto.asymmetric.RSA;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.dtflys.forest.Forest;
 import com.dtflys.forest.http.ForestRequest;
 import com.dtflys.forest.logging.LogConfiguration;
@@ -468,7 +469,7 @@ public class CaServer implements Assertion {
                 .execute(String.class);
 
         redisData.setUuid(value.getUuid());
-        cache.put("ca-emr-" + value.getDocumentId(), redisData);
+        cache.put("ca-emr-" + value.getDocumentId(), JSONUtil.toJsonStr(redisData));
         return getStringResultVo(execute, caDocumentId, value.getUuid());
     }
 
@@ -481,10 +482,12 @@ public class CaServer implements Assertion {
             cache.del(redisKey);
             redisData.setPdf(EmrServer.getPdfBase(value.getDocumentId()));
         } else {
-            redisData = (CaSignClass.H5EventSignRedis) cache.get(redisKey);
-            if (redisData == null) {
+            String redisStr = cache.get(redisKey);
+            if (redisStr == null) {
                 throw new BizException(ExceptionEnum.LOGICAL_ERROR, "签名超时请重新签名。");
             }
+            redisData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
+
             if (!redisData.getUuid().equals(value.getUuid())) {
                 throw new BizException(ExceptionEnum.LOGICAL_ERROR, "有其他人正在签署,本次签名失效。");
             }
@@ -541,11 +544,14 @@ public class CaServer implements Assertion {
         }
         JSONObject rst = res.getData();
         String key = getRedisKey(documentId);
-        CaSignClass.H5EventSignRedis redisData = (CaSignClass.H5EventSignRedis) cache.get(key);
-        if (redisData == null) {
+        String redisStr = cache.get(key);
+        if (redisStr == null) {
             throw new BizException(ExceptionEnum.LOGICAL_ERROR, "签名错误,文书不存在。");
         }
 
+
+        CaSignClass.H5EventSignRedis redisData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
+
         if (!redisData.getUuid().equals(uuid)) {
             throw new BizException(ExceptionEnum.LOGICAL_ERROR, "有其他人正在签署,本次签名失效。");
         }
@@ -561,7 +567,7 @@ public class CaServer implements Assertion {
             redisData.setData(new ArrayList<>());
         }
         redisData.getData().add(saveData);
-        cache.setData(key, redisData);
+        cache.setData(key, JSON.toJSONString(redisData));
         return ResultVoUtil.success(true);
     }
 
@@ -572,7 +578,14 @@ public class CaServer implements Assertion {
     public void completeQrCode(String documentId) {
         EmrPatientData data = emrPatientDao.selectById(documentId);
         String redisKey = getRedisKey(documentId);
-        CaSignClass.H5EventSignRedis redisServerData = (CaSignClass.H5EventSignRedis) cache.get(redisKey);
+
+        String redisStr = cache.get(redisKey);
+
+        if (redisStr == null) {
+            throw new BizException(ExceptionEnum.ERROR_MESSAGE, "文件不存在");
+        }
+
+        CaSignClass.H5EventSignRedis redisServerData = JSONUtil.toBean(redisStr, CaSignClass.H5EventSignRedis.class);
         CaSignClass.Upload upload = CaSignClass.Upload.builder()
                 .file(redisServerData.getPdf())
                 .fileName(documentId)

+ 14 - 7
src/main/java/thyyxxk/webserver/service/hutoolcache/CaCache.java

@@ -3,14 +3,19 @@ package thyyxxk.webserver.service.hutoolcache;
 import cn.hutool.cache.CacheUtil;
 import cn.hutool.cache.impl.TimedCache;
 import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.json.JSONUtil;
 import org.springframework.stereotype.Component;
 
+import java.io.File;
 import java.util.List;
 
 @Component
-public class CaCache implements HutoolCacheInterface<Object> {
+public class CaCache implements HutoolCacheInterface<String> {
     // 默认 60 分钟过期
-    TimedCache<String, Object> cache = CacheUtil.newTimedCache(DateUnit.MINUTE.getMillis() * 30);
+    TimedCache<String, String> cache = CacheUtil.newTimedCache(DateUnit.MINUTE.getMillis() * 30);
+
+    private final static String PATH = System.getProperty("user.dir") + File.separator + "cache" + File.separator;
 
     @Override
     public void del(String key) {
@@ -18,23 +23,25 @@ public class CaCache implements HutoolCacheInterface<Object> {
     }
 
     @Override
-    public void put(String key, Object value) {
+    public void put(String key, String value) {
         if (value == null) {
             return;
         }
+        FileUtil.writeUtf8String(value, PATH + key + ".txt");
         cache.put(key, value);
     }
 
-    public void setData(String key, Object value) {
+    public void setData(String key, String value) {
         this.put(key, value);
     }
 
     @Override
-    public Object get(String key) {
-        return cache.get(key);
+    public String get(String key) {
+        throw new RuntimeException("请使用 getToBen");
+//        return cache.get(key);
     }
 
-    public Object getDefaultValue(String key, Object defaultValue) {
+    public String getDefaultValue(String key, String defaultValue) {
         if (cache.get(key) != null) {
             return cache.get(key);
         }

+ 0 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/JianYanJianChaShenQingService.java

@@ -488,7 +488,6 @@ public class JianYanJianChaShenQingService {
         }
 
         insertData(param, huanZheXinXi, content);
-
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_EL_MESSAGE);
     }
 

+ 5 - 0
src/main/resources/application-dev.yml

@@ -17,6 +17,11 @@ spring:
       primary: his
       strict: false
       datasource:
+        prod:
+          url: "jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb"
+          username: "sa"
+          password:
+          driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
         his:
           url: "jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb"
           username: "sa"