lighter vor 3 Monaten
Ursprung
Commit
ffd2c465fc

+ 1 - 1
pom.xml

@@ -23,7 +23,7 @@
         <thyy-haikang>0.0.5</thyy-haikang>
         <thyy-emr-query>1.5.1</thyy-emr-query>
         <thyy-thirdpart-api>0.0.4</thyy-thirdpart-api>
-        <thyy-scheduled>0.0.3</thyy-scheduled>
+        <thyy-scheduled>0.0.4</thyy-scheduled>
         <thyy-plugins>0.0.1</thyy-plugins>
         <thyy-hospitalized>0.0.1</thyy-hospitalized>
         <thyy-medinsur>0.0.1</thyy-medinsur>

+ 7 - 0
thyy-medinsur/pom.xml

@@ -21,6 +21,13 @@
             <groupId>org.thyy.business</groupId>
             <artifactId>thyy-utils</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.opengauss</groupId>
+            <artifactId>opengauss-jdbc</artifactId>
+            <version>5.0.0</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 0
thyy-medinsur/src/main/java/org/thyy/medinsur/ThyyMedinsurApplication.java

@@ -3,7 +3,9 @@ package org.thyy.medinsur;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
 
+@ComponentScan("org.thyy.*")
 @MapperScan("org.thyy.medinsur.dao")
 @SpringBootApplication
 public class ThyyMedinsurApplication {

+ 26 - 0
thyy-medinsur/src/main/java/org/thyy/medinsur/controller/ZyMedInsurController.java

@@ -0,0 +1,26 @@
+package org.thyy.medinsur.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.thyy.medinsur.dao.BaseDao;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/zyMedInsur")
+public class ZyMedInsurController {
+    private final BaseDao dao;
+
+    @Autowired
+    public ZyMedInsurController(BaseDao dao) {
+        this.dao = dao;
+    }
+
+    @GetMapping("/get")
+    public List<Map<String, String>> getMedInsur() {
+        return dao.getMedInsur();
+    }
+}

+ 14 - 0
thyy-medinsur/src/main/java/org/thyy/medinsur/dao/BaseDao.java

@@ -0,0 +1,14 @@
+package org.thyy.medinsur.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface BaseDao {
+
+    @Select("select * from a_employee_mi")
+    List<Map<String, String>> getMedInsur();
+}

+ 4 - 4
thyy-medinsur/src/main/resources/application-dev.yml

@@ -7,10 +7,10 @@ spring:
   application:
     name: thyy-medinsur-api
   datasource:
-    url: "jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb"
-    username: "sa"
-    password:
-    driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
+    url: "jdbc:postgresql://172.16.32.206:7654/hisdb"
+    username: "thyy"
+    password: "thyy@2018"
+    driver-class-name: "org.postgresql.Driver"
     druid:
       #type: com.alibaba.druid.pool.DruidDataSource
       #初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时

+ 13 - 8
thyy-scheduled/src/main/java/org/thyy/scheduled/service/DpccService.java

@@ -62,8 +62,6 @@ public class DpccService {
                 + "&username=" + dpcc.getClientName()
                 + "&password=" + dpcc.getPassword();
 
-        log.info("DPCC获取TOKEN地址:{}", url);
-
         JSONObject response = template.postForObject(url,
                 new HttpEntity<>(null, headers), JSONObject.class);
         log.info("DPCC获取TOKEN:{}", response);
@@ -294,12 +292,19 @@ public class DpccService {
         JSONObject data = new JSONObject();
         data.put("data", encrypt);
         HttpEntity<JSONObject> body = new HttpEntity<>(data, headers);
-        String response = new RestTemplate().postForObject(url, body, String.class);
-        log.info("DPCC上传{}返回:{}", label, response);
-//        if (StrUtil.isNotBlank(response)) {
-//            JSONObject json = JSON.parseObject(response);
-//            Integer code = json.getInteger("code");
-//        }
+        try {
+            String response = new RestTemplate().postForObject(url, body, String.class);
+            log.info("DPCC上传{}返回:{}", label, response);
+        } catch (Exception e) {
+            String errMsg = e.getMessage();
+            if (StrUtil.isBlank(errMsg)) {
+                errMsg = null == e.getCause() ? e.toString() : e.getCause().getMessage();
+            }
+            log.error("DPCC上传{}出错:{}", label, errMsg);
+            if (errMsg.contains("401 Unauthorized")) {
+                getToken();
+            }
+        }
     }
 
     enum Type {

+ 1 - 1
thyy-scheduled/src/main/resources/application-prod.yml

@@ -55,7 +55,7 @@ spring:
       date-time: yyyy-MM-dd HH:mm:ss
 
 thyy:
-  main-address: http://172.16.32.160:8077
+  main-address: http://172.16.32.133:8077
   corpwx:
     corp-id-secret: wwf0b23c8b36012b34
     address-book-secret: wpHuNePfiDyotmpXjy5hUYGF0w8Ks5OPHSQp22z8oBk