Pārlūkot izejas kodu

Merge branch 'master' into test

zhoutg 5 gadi atpakaļ
vecāks
revīzija
2c6b0118f5

+ 7 - 5
doc/001.20200417第一版本/qc_init.sql

@@ -437,7 +437,7 @@ CREATE TABLE `med_medical_record` (
   `behospital_code` varchar(50) DEFAULT NULL COMMENT '病人住院ID',
   `org_code` varchar(20) DEFAULT NULL COMMENT '组织机构代码',
   `rec_type_id` varchar(100) DEFAULT NULL COMMENT '病历类别编号',
-  `mode_id` bigint(20) DEFAULT NULL COMMENT '模块id',
+  `mode_id` bigint(20) DEFAULT 0 COMMENT '模块id',
   `rec_date` varchar(50) DEFAULT NULL COMMENT '病历日期',
   `rec_title` varchar(128) DEFAULT NULL COMMENT '病历标题',
   `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
@@ -485,8 +485,9 @@ CREATE TABLE `med_qcresult_detail` (
   `creator` varchar(60) DEFAULT '0' COMMENT '创建人,0表示无创建人值',
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=32130 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+  PRIMARY KEY (`id`),
+  KEY `behospital_code` (`behospital_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_qcresult_info
@@ -507,8 +508,9 @@ CREATE TABLE `med_qcresult_info` (
   `creator` varchar(60) DEFAULT '0' COMMENT '创建人,0表示无创建人值',
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+  PRIMARY KEY (`id`),
+  KEY `behospital_code` (`behospital_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_record_type

+ 19 - 0
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -28,6 +28,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.BehospitalInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EncrypDES;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.MapUtil;
@@ -42,6 +43,7 @@ import com.diagbot.vo.QcResultAlgVO;
 import com.diagbot.vo.QueryVo;
 import com.diagbot.vo.RecordContentVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -89,6 +91,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     AuthServiceClient authServiceClient;
     @Autowired
     QcCasesEntryPagedataFacade qcCasesEntryPagedataFacade;
+    @Value("${encrypt.enable}")
+    Boolean encryptFlag;
 
     public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
         //入参验证
@@ -202,6 +206,21 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         RecordContentVO recordContentVO = new RecordContentVO();
         BeanUtil.copyProperties(analyzeVO, recordContentVO);
         List<RecordContentDTO> recordContentDTOList = medicalRecordFacade.getRecordContentFac(recordContentVO);
+        String recTitle = "";
+        // 解密数据
+        if (encryptFlag) {
+            try {
+                EncrypDES encrypDES = new EncrypDES();
+                for (RecordContentDTO recordContentDTO : recordContentDTOList) {
+                    recTitle = recordContentDTO.getRecTitle();
+                    recordContentDTO.setContentText(encrypDES.decryptor(recordContentDTO.getContentText()));
+                }
+            } catch (Exception e) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "解密错误!病历号=【" + analyzeVO.getBehospitalCode() + "】,医院文书名称=【" + recTitle + "】");
+            }
+        }
+
         Map<String, List<RecordContentDTO>> recMap = EntityUtil.makeEntityListMap(recordContentDTOList, "standModelName");
 
         // 获取医嘱

+ 73 - 0
src/main/java/com/diagbot/util/EncrypDES.java

@@ -0,0 +1,73 @@
+package com.diagbot.util;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.crypto.*;
+import javax.crypto.spec.DESKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidKeyException;
+
+/**
+ * @ClassName org.diagbot.pub.utils.security.EncrypDES
+ * @Description TODO
+ * @Author fyeman
+ * @Date 2019/2/22/022 14:44
+ * @Version 1.0
+ **/
+public class EncrypDES {
+    //随机加密串
+    private String key = "AUYEJHHH2019";
+    // SecretKey 负责保存对称密钥
+    private SecretKey deskey;
+    // Cipher负责完成加密或解密工作
+    private Cipher c;
+    // 该字节数组负责保存加密的结果
+    private byte[] cipherByte;
+
+    public EncrypDES() throws Exception {
+        DESKeySpec desKey = new DESKeySpec(key.getBytes("utf-8"));
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+        // 生成密钥
+        deskey = keyFactory.generateSecret(desKey);
+        // 生成Cipher对象,指定其支持的DES算法
+        c = Cipher.getInstance("DES");
+    }
+
+    /**
+     * 对字符串加密
+     *
+     * @param str
+     * @return
+     * @throws InvalidKeyException
+     * @throws IllegalBlockSizeException
+     * @throws BadPaddingException
+     */
+    public String encrytor(String str) throws InvalidKeyException,
+            IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
+        // 根据密钥,对Cipher对象进行初始化,ENCRYPT_MODE表示加密模式
+        c.init(Cipher.ENCRYPT_MODE, deskey);
+        byte[] src = str.getBytes("utf-8");
+        // 加密,结果保存进cipherByte
+        cipherByte = c.doFinal(src);
+        return Base64.encodeBase64String(cipherByte);
+    }
+
+    /**
+     * 对字符串解密
+     *
+     * @param str
+     * @return
+     * @throws InvalidKeyException
+     * @throws IllegalBlockSizeException
+     * @throws BadPaddingException
+     */
+    public String decryptor(String str) throws InvalidKeyException,
+            IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException {
+        byte[] buff = Base64.decodeBase64(str);
+        // 根据密钥,对Cipher对象进行初始化,DECRYPT_MODE表示加密模式
+        c.init(Cipher.DECRYPT_MODE, deskey);
+        cipherByte = c.doFinal(buff);
+        return new String(cipherByte, "utf-8");
+    }
+}
+

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

@@ -154,5 +154,8 @@ myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+encrypt:
+  enable: false
+
 swagger:
   enable: true

+ 4 - 1
src/main/resources/application-local.yml

@@ -152,7 +152,10 @@ mybatis-plus:
 
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.232:6009
+qc.address: http://192.168.3.117:6009
+
+encrypt:
+  enable: false
 
 swagger:
   enable: true

+ 3 - 0
src/main/resources/application-pre.yml

@@ -154,5 +154,8 @@ myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+encrypt:
+  enable: false
+
 swagger:
   enable: true

+ 3 - 0
src/main/resources/application-pro.yml

@@ -154,5 +154,8 @@ myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+encrypt:
+  enable: false
+
 swagger:
   enable: true

+ 3 - 0
src/main/resources/application-test.yml

@@ -154,5 +154,8 @@ myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+encrypt:
+  enable: false
+
 swagger:
   enable: true

+ 1 - 1
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -81,7 +81,7 @@
         and c.hospital_id = d.hospital_id
         and c.hospital_id = #{hospitalId}
         and c.behospital_code = #{behospitalCode}
-        order by a.order_no
+        order by b.order_no, a.order_no
     </select>