소스 검색

Merge branch 'master' into his/qq

lantone 5 년 전
부모
커밋
fb777d954f

+ 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

+ 31 - 7
src/main/java/com/diagbot/facade/AlgorithmFacade.java

@@ -24,7 +24,12 @@ import java.util.Map;
 public class AlgorithmFacade {
     private final static List<Integer> types = Arrays.asList(0, 1, 2, 3);
 
-    //获取评分结果和等级
+    /**
+     * 获取评分结果和等级
+     *
+     * @param algorithmVO 操作条目的所有信息
+     * @return 评分结果和等级
+     */
     public AlgorithmDTO getAlgorithmRes(AlgorithmVO algorithmVO) {
         AlgorithmDTO algorithmDTO = new AlgorithmDTO();
         BigDecimal score = this.getScore(algorithmVO);
@@ -33,7 +38,12 @@ public class AlgorithmFacade {
         return algorithmDTO;
     }
 
-    //评结果分数
+    /**
+     * 评结果分数
+     *
+     * @param algorithmVO 操作条目的所有信息
+     * @return 评结果分数
+     */
     private BigDecimal getScore(AlgorithmVO algorithmVO) {
         if (!types.contains(algorithmVO.getType())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "操作类型只有0,1,2,3!");
@@ -45,7 +55,12 @@ public class AlgorithmFacade {
         return res;
     }
 
-    //评等级
+    /**
+     * 根据分数评定等级
+     *
+     * @param score 评分分数
+     * @return 等级
+     */
     private String getLevel(BigDecimal score) {
         String level = "甲";
         //得分>90分为甲级
@@ -65,7 +80,11 @@ public class AlgorithmFacade {
         return level;
     }
 
-    //处理数据
+    /**
+     * 处理数据
+     *
+     * @param algorithmVO 操作条目的所有信息
+     */
     private void dataDeal(AlgorithmVO algorithmVO) {
         List<QcResultAlgVO> qcResultAlgVOList = algorithmVO.getQcResultAlgVOList();
         //新增
@@ -105,7 +124,7 @@ public class AlgorithmFacade {
                         break;
                     }
                 }
-                if (!hasData){
+                if (!hasData) {
                     throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "删除的条目不存在!");
                 }
             }
@@ -126,14 +145,19 @@ public class AlgorithmFacade {
                         break;
                     }
                 }
-                if (!hasData){
+                if (!hasData) {
                     throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "修改的条目不存在!");
                 }
             }
         }
     }
 
-    //计算
+    /**
+     * 计算分数
+     *
+     * @param algorithmVO 操作条目的所有信息
+     * @return 评分分数
+     */
     private BigDecimal cal(AlgorithmVO algorithmVO) {
         BigDecimal res = new BigDecimal(100);
         //模块总分

+ 55 - 2
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;
@@ -50,6 +52,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -88,6 +91,8 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     AuthServiceClient authServiceClient;
     @Autowired
     QcCasesEntryPagedataFacade qcCasesEntryPagedataFacade;
+    @Value("${encrypt.enable}")
+    Boolean encryptFlag;
 
     public IPage<BehospitalInfoDTO> pageFac(BehospitalPageVO behospitalPageVO) {
         //入参验证
@@ -201,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");
 
         // 获取医嘱
@@ -258,6 +278,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         addData("输血后效果评价", recMap, medrecVoList);
         addData("病理检验送检单", recMap, medrecVoList);
 
+        addDataWithInnerKey("知情同意书", recMap, medrecVoList);
+        addDataWithInnerKey("谈话告知书", recMap, medrecVoList);
+
         // 会诊记录
         addDataWithKey("会诊", recMap, medrecVoList,
                 Arrays.asList("会诊记录", "会诊结果单", "会诊申请单"));
@@ -274,8 +297,10 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         }
 
         // 病案首页
-        addDataWithFirstPage("病案首页",  homePage, medrecVoList, dicMap,
-                homePageList, homeOperationInfoList);
+        if (homePage != null) {
+            addDataWithFirstPage("病案首页", homePage, medrecVoList, dicMap,
+                    homePageList, homeOperationInfoList);
+        }
 
         queryVo.setMedrec(medrecVoList);
 
@@ -380,6 +405,34 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
     }
 
 
+    /**
+     * 拼接数据(例如:知情同意书、谈话告知书)
+     *
+     * @param key
+     * @param recMap
+     * @param medrecVoList
+     */
+    public void addDataWithInnerKey(String key, Map<String, List<RecordContentDTO>> recMap, List<MedrecVo> medrecVoList) {
+        MedrecVo medrecVo = new MedrecVo();
+        medrecVo.setTitle(key);
+        Map<String, Object> content = new HashMap<>();
+        Map<String, List<String>> listMap = new HashMap<>();
+        List<RecordContentDTO> recordContentDTOList = recMap.get(key);
+        if (ListUtil.isNotEmpty(recordContentDTOList)) {
+            Map<String, List<RecordContentDTO>> keyMap =
+                    EntityUtil.makeEntityListMap(recordContentDTOList, "recTitle");
+            Set<String> keyList = keyMap.keySet();
+            for (String k : keyList) {
+                if (ListUtil.isNotEmpty(keyMap.get(k))) {
+                    listMap.put(k, keyMap.get(k).stream().map(r -> r.getContentText()).collect(Collectors.toList()));
+                }
+            }
+            content.put("content", listMap);
+            medrecVo.setContent(content);
+            medrecVoList.add(medrecVo);
+        }
+    }
+
     /**
      * 拼接数据(医嘱),从数据字典获取信息转换
      *

+ 16 - 0
src/main/java/com/diagbot/facade/QcCasesFacade.java

@@ -33,12 +33,23 @@ public class QcCasesFacade extends QcCasesServiceImpl {
     @Autowired
     private QcCasesHospitalFacade qcCasesHospitalFacade;
 
+    /**
+     * 获取医院模块数据信息
+     *
+     * @return 医院模块数据信息
+     */
     public List<QcCasesDTO> getQcCasesFac() {
         QcCasesQueryVO queryVO = new QcCasesQueryVO();
         queryVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
         return this.getQcCases(queryVO);
     }
 
+    /**
+     * 批量更新模块数据
+     *
+     * @param qcCasesSaveVOList 更新的模块数据
+     * @return 是否成功
+     */
     public Boolean saveQcCases(QcCasesSaveListVO qcCasesSaveVOList) {
         if (null != qcCasesSaveVOList
                 && ListUtil.isNotEmpty(qcCasesSaveVOList.getQcCasesSaveVOList())) {
@@ -56,6 +67,11 @@ public class QcCasesFacade extends QcCasesServiceImpl {
 
     }
 
+    /**
+     * 获取基础模块数据信息
+     *
+     * @return 基础模块数据信息列表
+     */
     public List<QcCasesAllDTO> getQcCasesAlls() {
         QueryWrapper<QcCases> qc = new QueryWrapper<>();
         qc.eq("is_deleted", IsDeleteEnum.N.getKey());

+ 22 - 5
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -46,6 +46,12 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
     @Autowired
     private BehospitalInfoFacade behospitalInfoFacade;
 
+    /**
+     * 修改评分结果信息
+     *
+     * @param qcresultVO 修改评分结果信息
+     * @return 评分的结果
+     */
     public AnalyzeDTO changeQcResult(QcresultVO qcresultVO) {
         //入参验证
         if (StringUtil.isBlank(qcresultVO.getBehospitalCode())) {
@@ -63,7 +69,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", hospitalId)
                         .eq("behospital_code", qcresultVO.getBehospitalCode()));
-        if (mrcnt < 1){
+        if (mrcnt < 1) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该医院下该病历号不存在!");
         }
         //验证是否评估过
@@ -73,7 +79,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", hospitalId)
                         .eq("behospital_code", qcresultVO.getBehospitalCode()));
-        if (cnt < 1){
+        if (cnt < 1) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历尚未评分,请先评分!");
         }
         //查询质控评分明细信息
@@ -97,7 +103,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         AnalyzeVO analyzeVO = new AnalyzeVO();
         analyzeVO.setHospitalId(hospitalId);
         analyzeVO.setBehospitalCode(qcresultVO.getBehospitalCode());
-        Date date = this.saveQcResult(algorithmDTO, algorithmVO, analyzeVO,null, null, false);
+        Date date = this.saveQcResult(algorithmDTO, algorithmVO, analyzeVO, null, null, false);
         //返回参数组装
         AnalyzeDTO analyzeDTO = new AnalyzeDTO();
         analyzeDTO.setBehospitalCode(qcresultVO.getBehospitalCode());
@@ -110,6 +116,17 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         return analyzeDTO;
     }
 
+    /**
+     * 保存评分结果信息
+     *
+     * @param algorithmDTO 评分结果
+     * @param algorithmVO  操作的条目
+     * @param analyzeVO    病历信息
+     * @param pageData     大数据解析出来的页面信息
+     * @param menuData     菜单信息
+     * @param isTask       是否是任务
+     * @return 评分的时间
+     */
     public Date saveQcResult(AlgorithmDTO algorithmDTO, AlgorithmVO algorithmVO, AnalyzeVO analyzeVO,
                              String pageData, String menuData, Boolean isTask) {
         //更新质控评分结果信息
@@ -147,10 +164,10 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         } else {
             qcresultInfo.setGradeType(2);
         }
-        if (StringUtil.isNotBlank(pageData)){
+        if (StringUtil.isNotBlank(pageData)) {
             qcresultInfo.setPageData(pageData);
         }
-        if (StringUtil.isNotBlank(menuData)){
+        if (StringUtil.isNotBlank(menuData)) {
             qcresultInfo.setMenuData(menuData);
         }
 

+ 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: true
+
 swagger:
   enable: true

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

@@ -154,5 +154,8 @@ myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 qc.address: http://192.168.2.232:6009
 
+encrypt:
+  enable: true
+
 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>
 
 

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

@@ -34,7 +34,7 @@
             AND a.hospital_id = #{hospitalId}
         </if>
         <if test="startDate != null and startDate != ''">
-            <![CDATA[ and a.leave_hospital_date >= #{startDate}]]>
+            <![CDATA[ and a.behospital_date >= #{startDate}]]>
         </if>
         <if test="gradeType != null and gradeType != ''">
             AND b.grade_type = #{gradeType}