Browse Source

增加按病历号补录的接口

liuqq 3 years ago
parent
commit
a784ebd825

+ 155 - 0
src/main/java/com/diagbot/facade/supple/SupplementFacade.java

@@ -0,0 +1,155 @@
+package com.diagbot.facade.supple;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.BehospitalInfo;
+import com.diagbot.entity.DoctorAdvice;
+import com.diagbot.entity.MedicalRecord;
+import com.diagbot.facade.ViewFacade;
+import com.diagbot.facade.data.ABehospitalInfoFacade;
+import com.diagbot.facade.data.ADoctorAdviceFacade;
+import com.diagbot.facade.data.AMedicalRecordFacade;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.TZDBConn;
+import com.diagbot.vo.data.XyHomePageVo;
+import com.diagbot.vo.supple.SuppleVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Component
+@Slf4j
+public class SupplementFacade {
+
+    @Autowired
+    private ABehospitalInfoFacade aBehospitalInfoFacade;
+
+    @Autowired
+    private ADoctorAdviceFacade aDoctorAdviceFacade;
+
+    @Autowired
+    private AMedicalRecordFacade aMedicalRecordFacade;
+
+    @Autowired
+    private ViewFacade viewFacade;
+
+    private TZDBConn tzDBConn = new TZDBConn();
+
+    public RespDTO supplementData(SuppleVO suppleVO){
+        if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode()) && suppleVO.getBehospitalCode().contains("_")){
+            //将病历号分开后进行数据获取
+            String[] codes=suppleVO.getBehospitalCode().split("_");
+            suppleVO.setBehospitalCode(codes[0]);
+            suppleVO.setBehospitalNum(codes[1]);
+        }
+
+        //同步病人住院登记信息
+        supplementBehospital(suppleVO);
+
+        //同步病人医嘱
+        supplementAdvice(suppleVO);
+
+        supplementRecord(suppleVO);
+
+        //获取病案首页
+        XyHomePageVo xyHomePageVo = new XyHomePageVo();
+        xyHomePageVo.setBehospitalCode(suppleVO.getBehospitalCode());
+        xyHomePageVo.setHospitalId("35");
+        xyHomePageVo.setFileCode(suppleVO.getBehospitalNum());
+        xyHomePageVo.setDockModeType("0");
+        viewFacade.getHomePageByView(xyHomePageVo);
+
+        return RespDTO.onSuc(null);
+
+
+    }
+
+    /**
+     * @Description:通过病历号进行数据补录-病人住院登记信息
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public void supplementBehospital(SuppleVO suppleVO){
+        try{
+            List<BehospitalInfo> behospitalInfoList = new ArrayList<>();
+            //病历号由“病历号_病历次数”拼接而成
+            String sql="select * from admission_pat_regist where 1=1 ";
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
+                sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
+            }
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
+                sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
+            }
+
+            behospitalInfoList=tzDBConn.getBehospitalInfo(sql);
+            aBehospitalInfoFacade.execute(behospitalInfoList);
+        }catch (Exception e){
+            log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
+        }
+
+    }
+
+    /**
+     * @Description:通过病历号进行数据补录-医嘱
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public void supplementAdvice(SuppleVO suppleVO){
+        try{
+            List<DoctorAdvice> adviceList = new ArrayList<>();
+            //病历号由“病历号_病历次数”拼接而成
+            String sql="select * from doctor_order where 1=1 ";
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
+                sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
+            }
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
+                sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
+            }
+
+            adviceList=tzDBConn.getDoctorAdvice(sql);
+            aDoctorAdviceFacade.execute(adviceList);
+        }catch (Exception e){
+            log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
+        }
+    }
+
+    /**
+     * @Description:通过病历号进行数据补录-病历
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public void supplementRecord(SuppleVO suppleVO){
+        try{
+            List<MedicalRecord> medicalRecordList = new ArrayList<>();
+            //病历号由“病历号_病历次数”拼接而成
+            String sql="select * from record_list where 1=1 ";
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalCode())){
+                sql+=" and behospitalCode='"+ suppleVO.getBehospitalCode() +"'";
+            }
+            if(StringUtil.isNotEmpty(suppleVO.getBehospitalNum())){
+                sql+=" and behospitalNum='"+ suppleVO.getBehospitalNum() +"'";
+            }
+
+            medicalRecordList = tzDBConn.getMedicalRecord(sql);
+            if (medicalRecordList.size() > 0) {
+                aMedicalRecordFacade.execute(medicalRecordList);
+                medicalRecordList.forEach(s -> {
+                    //获取文书详情
+                    String recId = s.getRecId();
+                    //截取rec_id後面的_次數跟接口相對潁上
+                    int inedx = s.getRecId().lastIndexOf("_");
+                    s.setRecId(s.getRecId().substring(0, inedx));
+                    viewFacade.getRecordContent(recId);
+                });
+            }
+        }catch (Exception e){
+            log.error("病历数据刷新异常"+e.getMessage(),new Throwable());
+        }
+    }
+
+
+
+
+}

+ 9 - 0
src/main/java/com/diagbot/vo/supple/SuppleVO.java

@@ -0,0 +1,9 @@
+package com.diagbot.vo.supple;
+
+import lombok.Data;
+
+@Data
+public class SuppleVO {
+    private String behospitalCode;
+    private String behospitalNum;
+}

+ 0 - 0
src/main/java/com/diagbot/web/ADataStrController.java


+ 28 - 0
src/main/java/com/diagbot/web/SupplementController.java

@@ -0,0 +1,28 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.supple.SupplementFacade;
+import com.diagbot.vo.supple.SuppleVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/qc/supplement")
+@Api(value = "对接接口API-数据补录", tags = {"对接接口API-数据补录"})
+public class SupplementController {
+    @Autowired
+    private SupplementFacade supplementFacade;
+
+    @ApiOperation(value = "缺陷详情页-按病历号补录数据")
+    @PostMapping("/supplementData")
+    @SysLogger("supplementData")
+    public RespDTO supplementData(@RequestBody SuppleVO suppleVO){
+        return supplementFacade.supplementData(suppleVO);
+    }
+}

+ 209 - 0
src/main/resources/application-his.yml

@@ -0,0 +1,209 @@
+server:
+  port: 5858
+  max-http-header-size: 10MB
+  tomcat:
+    uri-encoding: utf-8
+
+hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
+  command:
+    QcServiceClient#extract(QueryVo).execution.isolation.thread.timeoutInMilliseconds: 3600000
+    default:
+      execution:
+        timeout:
+          enabled: true
+        isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
+          thread:
+            timeoutInMilliseconds: 20000
+
+ribbon:
+  ReadTimeout: 20000
+  ConnectTimeout: 20000
+  MaxAutoRetries: 0
+  MaxAutoRetriesNextServer: 1
+
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: bus-refresh,health,info,hystrix.stream
+      cors:
+        allowed-origins: "*"
+        allowed-methods: "*"
+  endpoint:
+    health:
+      show-details: always
+
+# 驱动配置信息
+spring:
+  application:
+    name: gateway-service
+  datasource:
+    dynamic:
+      primary: master
+      druid:
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        initialSize: 5
+        minIdle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters.commons-log.connection-logger-name: wall,log4j
+        filter:
+          stat:
+            enabled: true
+            mergeSql: true
+            log-slow-sql: true
+            slow-sql-millis: 2000
+        #监控配置
+        web-stat-filter:
+          enabled: true
+          url-pattern: /*
+          exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+        # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+        stat-view-servlet:
+          enabled: true
+          url-pattern: /druid/*
+          reset-enable: false
+          login-username: root
+          login-password: root
+      datasource:
+        master:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+            platform: mysql
+            url: jdbc:mysql://132.147.253.32:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+            username: root
+            password: lantone
+            druid:
+              initial-size: 5
+        slave:
+          driver-class-name: oracle.jdbc.driver.OracleDriver
+          platform: oracle
+          url: jdbc:oracle:thin:@132.147.254.159:1521/dbserver
+          username: langtong
+          password: langtong
+          druid:
+            initial-size: 5
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+      token: 8 # Token索引
+    host: 132.147.253.31  #Redis服务器地址
+    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: lantone # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+  http:
+    encoding:
+      charset: utf-8
+      force: true
+      enabled: true
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
+myhost: localhost
+oath.self.address: http://${myhost}:${server.port}
+
+# 加解密开关
+encrypt:
+  enable: false
+
+swagger:
+  enable: true
+
+#xml解析成结构化开关
+xml_analyse:
+  enable: false
+
+#函数初始化modeId开关
+initmodeid:
+  enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: false
+
+mrqcLog:
+  enable: false
+
+appeal.address: http://132.147.253.31:8871