xiaochan 1 anno fa
parent
commit
7a50432954

+ 29 - 1
src/main/java/thyyxxk/webserver/WebServerApplication.java

@@ -1,11 +1,17 @@
 package thyyxxk.webserver;
 
 import com.dtflys.forest.springboot.annotation.ForestScan;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 /**
  * @author dj
@@ -15,8 +21,30 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 @EnableScheduling
 @EnableConfigurationProperties
 @ForestScan(basePackages = "thyyxxk.webserver.service.externalhttp")
+@Slf4j
 public class WebServerApplication {
     public static void main(String[] args) {
-        SpringApplication.run(WebServerApplication.class, args);
+        ConfigurableApplicationContext application = SpringApplication.run(WebServerApplication.class, args);
+        try {
+            log.info("Done-CY");
+            Environment env = application.getEnvironment();
+            String ip = InetAddress.getLocalHost().getHostAddress();
+            String port = env.getProperty("server.port");
+            String property = env.getProperty("server.servlet.context-path");
+            String path = property == null ? "" : property;
+            log.info("\n\t" +
+                    "----------------------------------------------------------\n\t" +
+                    "Application Sailrui-Boot is running! Access URLs:\n\t" +
+                    "Local: \t\t" +
+                    "http://localhost:{}{}/\n\t" +
+                    "External: \t" +
+                    "http://{}:{}{}/\n\t" +
+                    "------------------------------------------------------------", port, path, ip, port, path);
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+
     }
+
+
 }

+ 1 - 0
src/main/java/thyyxxk/webserver/config/exception/ExceptionEnum.java

@@ -17,6 +17,7 @@ public enum ExceptionEnum {
      * 提示成功
      */
     SUCCESS_AND_NOTIFICATION(201, "操作成功"),
+    SUCCESS_AND_ALERT(202, "操作成功"),
 
     // 以下是需要消息提示的错误
     INTERNAL_SERVER_ERROR(1001, "服务器内部错误!"),

+ 14 - 5
src/main/java/thyyxxk/webserver/controller/PublicController.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.controller;
 
+import cn.hutool.core.net.NetUtil;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -17,17 +18,18 @@ import thyyxxk.webserver.entity.publicapi.ItemDrug;
 import thyyxxk.webserver.entity.publicapi.ZkList;
 import thyyxxk.webserver.entity.zhuyuanyisheng.PatientAllergenInfo;
 import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.utils.IpAddressUtil;
 import thyyxxk.webserver.utils.ListUtil;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.SnowFlakeId;
 
+import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.FilenameFilter;
 import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.*;
 
 /**
  * <p>
@@ -184,6 +186,7 @@ public class PublicController {
 
     @GetMapping("/getOperationGuide")
     @PassToken
+
     public ResultVo<String> getOperationGuide(@RequestParam("folderName") String folderName) {
         String path = "D:\\a.snapshot\\download\\操作指南\\" + folderName;
         File folder = new File(path);
@@ -199,7 +202,6 @@ public class PublicController {
         return ResultVoUtil.success("v1.1.0");
     }
 
-
     static class MyExtFilter implements FilenameFilter {
         private final String ext;
 
@@ -246,4 +248,11 @@ public class PublicController {
     public ResultVo<List<ItemDrug>> getItemDrug(@RequestParam("code") String code) {
         return service.getItemDrug(code);
     }
+
+    @PassToken
+    @GetMapping("/getIp")
+    public ResultVo<LinkedHashSet<String>> getIp() {
+        return ResultVoUtil.success(NetUtil.localIpv4s());
+    }
+
 }

+ 21 - 11
src/main/java/thyyxxk/webserver/dao/his/hospitalizationCosts/HospitalizationCostsDao.java

@@ -16,19 +16,29 @@ public interface HospitalizationCostsDao extends BaseMapper<ZyDetailChargeTable>
     @Select("select count(1) from  yp_zd_dict where code = #{code} and serial = #{serial} and drug_kind = '0013'")
     Integer getDrugKing(String code, String serial);
 
-    @Select("select b.class as class_code," +
-            "       a.drug_flag as drug_class," +
-            "       a.mini_unit," +
-            "       c.refundable_fees as refundable_fees " +
-            "from yz_act_order a, " +
-            "     yz_supply_type b," +
-            "     yp_zd_unit c " +
-            "where a.supply_code = b.supply_code" +
-            "      and c.code = a.mini_unit " +
-            "  and a.act_order_no = #{order} ")
+    @Select("select b.class           as class_code,\n" +
+            "       a.drug_flag       as drug_class,\n" +
+            "       a.mini_unit,\n" +
+            "       c.refundable_fees as refundable_fees\n" +
+            "from yz_act_order a,\n" +
+            "     yz_supply_type b,\n" +
+            "     yp_zd_unit c\n" +
+            "where a.supply_code = b.supply_code\n" +
+            "  and c.code = a.mini_unit\n" +
+            "  and a.act_order_no = #{order}\n" +
+            "union all\n" +
+            "select b.class           as class_code,\n" +
+            "       a.drug_flag       as drug_class,\n" +
+            "       a.mini_unit,\n" +
+            "       c.refundable_fees as refundable_fees\n" +
+            "from yz_erase_order a,\n" +
+            "     yz_supply_type b,\n" +
+            "     yp_zd_unit c\n" +
+            "where a.supply_code = b.supply_code\n" +
+            "  and c.code = a.mini_unit\n" +
+            "  and a.act_order_no = #{order}")
     HospitalizationCostsService.OrderInfo selectDrugClassByOrderNo(BigDecimal order);
 
-
     /**
      * 插入数据
      *

+ 3 - 3
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/OrderQuashService.java

@@ -68,7 +68,7 @@ public class OrderQuashService {
 
         // 有费用中间表申请
         if (dao.selectZyPatientFee(param.getActOrderNo()) > 0) {
-            return insertTheRequest(param, "医嘱存在医嘱确费");
+            return insertTheRequest(param, "项目,医嘱已确费");
         }
 
         param.setState(2).setApproverRemark("系统自动审核。");
@@ -77,7 +77,7 @@ public class OrderQuashService {
         // 插入申请表数据
         dao.insert(param);
         revocationOfMedicalOrders(param);
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "撤销成功,如果医嘱还存在请刷新页面。", 1);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_ALERT, "撤销成功,如果医嘱还存在请刷新页面。", 1);
     }
 
     private ResultVo<Integer> insertTheRequest(ReqOrderQuash param, String message) {
@@ -91,7 +91,7 @@ public class OrderQuashService {
             dao.insert(param);
         }
         log.info("日志:{}", JSON.toJSONString(param));
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, message + "无法撤销,已经向医务部提出申请,审核通过后撤销医嘱。", 0);
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_ALERT, message + "无法撤销,已经向医务部提出申请,审核通过后撤销医嘱。", 0);
     }
 
 

+ 36 - 0
src/main/java/thyyxxk/webserver/utils/IpAddressUtil.java

@@ -0,0 +1,36 @@
+package thyyxxk.webserver.utils;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class IpAddressUtil {
+    public static String getIPAddress(HttpServletRequest request) {
+        String ip = null;
+        //X-Forwarded-For:Squid 服务代理
+        String ipAddresses = request.getHeader("X-Forwarded-For");
+        if (ipAddresses == null || ipAddresses.isEmpty() || "unknown".equalsIgnoreCase(ipAddresses)) {
+            //Proxy-Client-IP:apache 服务代理
+            ipAddresses = request.getHeader("Proxy-Client-IP");
+        }
+        if (ipAddresses == null || ipAddresses.isEmpty() || "unknown".equalsIgnoreCase(ipAddresses)) {
+            //WL-Proxy-Client-IP:weblogic 服务代理
+            ipAddresses = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if (ipAddresses == null || ipAddresses.isEmpty() || "unknown".equalsIgnoreCase(ipAddresses)) {
+            //HTTP_CLIENT_IP:有些代理服务器
+            ipAddresses = request.getHeader("HTTP_CLIENT_IP");
+        }
+        if (ipAddresses == null || ipAddresses.isEmpty() || "unknown".equalsIgnoreCase(ipAddresses)) {
+            //X-Real-IP:nginx服务代理
+            ipAddresses = request.getHeader("X-Real-IP");
+        }
+        //有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP
+        if (ipAddresses != null && !ipAddresses.isEmpty()) {
+            ip = ipAddresses.split(",")[0];
+        }
+        //还是不能获取到,最后再通过request.getRemoteAddr();获取
+        if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ipAddresses)) {
+            ip = request.getRemoteAddr();
+        }
+        return ip;
+    }
+}

+ 165 - 0
src/main/resources/application-cytest.yml

@@ -0,0 +1,165 @@
+server:
+  port: 8708
+  tomcat:
+    uri-encoding: utf-8
+    threads:
+      min-spare: 20
+      max: 800
+    accept-count: 200
+    max-connections: 10000
+  servlet:
+    encoding:
+      charset: utf-8
+spring:
+  thymeleaf:
+    cache: false
+  datasource:
+    dynamic:
+      primary: his
+      strict: false
+      datasource:
+        his:
+          url: "jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb"
+          username: "sa"
+          password:
+          driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
+        lis:
+          url: "jdbc:sqlserver://172.16.32.178:1433;databaseName=eLimsCore"
+          username: "sa"
+          password: "hnthxyyy"
+          driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
+        dev:
+          url: "jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb"
+          username: "sa"
+          password:
+          driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
+    druid:
+      #type: com.alibaba.druid.pool.DruidDataSource
+      #初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
+      initial-size: 40
+      #最大连接池数量
+      max-active: 100
+      #最小连接池数量
+      min-idle: 40
+      #获取连接时最大等待时间,单位毫秒
+      max-wait: 60000
+      #使用非公平锁。
+      use-unfair-lock: true
+      #用来检测连接是否有效的sql,要求是一个查询语句。
+      validation-query: SELECT 1
+      #建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
+      test-while-idle: true
+      #申请连接时执行validationQuery检测连接是否有效,
+      test-on-borrow: true
+      #归还连接时执行validationQuery检测连接是否有效,
+      test-on-return: false
+      #Destroy线程会检测连接的间隔时间,testWhileIdle的判断依据,详细看testWhileIdle属性的说明
+      time-between-eviction-runs-millis: 60000
+      #配置一个连接在池中最小生存的时间,单位是毫秒
+      min-evictable-idle-time-millis: 300000
+      #监控统计用的filter:stat  日志用的filter:log4j    防御sql注入的filter:wall
+      filters: stat
+      #是否缓存preparedStatement,也就是PSCache,在mysql5.5以下的版本中没有PSCache功能,建议关闭掉
+      pool-prepared-statements: false
+      #要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。
+      max-pool-prepared-statement-per-connection-size: 200
+      #对于长时间不使用的连接强制关闭
+      remove-abandoned: true
+      #数据库链接超过180秒开始关闭空闲连接 秒为单位
+      remove-abandoned-timeout: 180
+      #将当前关闭动作记录到日志  此配置项会影响性能,只在排查的时候打开,系统运行时最好关闭。
+      log-abandoned: true
+  autoconfigure:
+    exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 去除druid配置
+  jackson:
+    time-zone: Asia/Shanghai
+    date-format: yyyy-MM-dd HH:mm:ss
+  mvc:
+    format:
+      date: yyyy-MM-dd
+      date-time: yyyy-MM-dd HH:mm:ss
+forest:
+  timeout: 0
+  read-timeout: 0
+  log-enabled: true
+  log-request: true
+  log-response-status: true
+  connect-timeout: 1500
+  variables:
+    socketCenter: http://localhost:8707/socketApi
+
+mybatis-plus:
+  configuration:
+    map-underscore-to-camel-case: true
+  global-config:
+    enableSqlRunner: true
+
+management:
+  server:
+    port: 9093
+  endpoints:
+    web:
+      base-path: /actuator
+      exposure:
+        include: '*'
+  metrics:
+    export:
+      simple:
+        enabled: true
+      jmx:
+        enabled: true
+      prometheus:
+        enabled: true
+    distribution:
+      percentiles-histogram:
+        http:
+          server:
+            requests: false
+      minimum-expected-value:
+        http:
+          server:
+            requests: 20ms
+      maximum-expected-value:
+        http:
+          server:
+            requests: 200ms
+  endpoint:
+    metrics:
+      enabled: true
+    health:
+      show-details: always
+      probes:
+        enabled: true
+    prometheus:
+      enabled: true
+
+execute-scheduled: false
+is-prod: false
+triage-notify-url: http://localhost:8082/triage/roomScreen/pushMsg
+si-tj-url: http://jkglcsx.server.zhongmeihealth.com/openInter
+
+#正式环境
+si-api-url: http://dms.hun.hsip.gov.cn/isp-api/powercsb/1101
+si-access-key: 04eMGRg7beAO6vqwrZiLacV8Uy3jNn7QGDUcBO
+si-secret-key: SK3Oip3a2R3NLz2xm58Mpmi69oFu96KrdKNRKglN
+si-zy-fee-url: http://172.16.32.166:1000
+si-mz-fee-url: http://172.16.32.166:1100/mzFee
+si-injury-fee-url: http://172.16.32.163:2100/siInjury
+#si-injury-systm-url: http://172.16.32.163:2000/siInjury
+thmz-api-url: http://172.16.32.160:81/thmz/api/v1
+
+#测试环境
+#si-api-url: http://10.93.30.130:20001/isp-api/powercsb/1101
+#si-access-key: Zgs5jfxaKb86XbCuUzLK9EhFjiQfHR1vydaPzp
+#si-secret-key: SKT2ETMT3XkAYApqh79DCnN9ZjfbQEBMPU0GyLz9
+#si-zy-fee-url: http://localhost:1000
+#si-mz-fee-url: http://localhost:1100/mzFee
+#si-injury-fee-url: http://localhost:2100/siInjury
+si-injury-systm-url: http://localhost:2000/siInjury
+#thmz-api-url: http://172.16.30.33:81/thmz/api/v1
+
+appletThmzUrl: http://172.16.30.119:8089/thmz
+
+logging:
+  level:
+    thyyxxk.webserver.dao: debug