Sfoglia il codice sorgente

Merge branch 'master' into test

zhoutg 5 anni fa
parent
commit
3a5bd2d56b

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

@@ -13,7 +13,7 @@ Target Server Type    : MYSQL
 Target Server Version : 50725
 File Encoding         : 65001
 
-Date: 2020-04-17 09:14:26
+Date: 2020-04-17 13:49:32
 */
 
 SET FOREIGN_KEY_CHECKS=0;
@@ -177,9 +177,10 @@ CREATE TABLE `med_behospital_info` (
   `behospital_code` varchar(16) NOT NULL COMMENT '病人住院ID',
   `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
   `name` varchar(32) NOT NULL COMMENT '姓名',
-  `sex` varchar(2) DEFAULT NULL COMMENT '性别',
+  `sex` varchar(2) DEFAULT NULL COMMENT '性别(男,女)',
   `birthday` datetime DEFAULT NULL COMMENT '出生日期',
   `file_code` varchar(16) DEFAULT NULL COMMENT '档案号',
+  `qc_type_id` bigint(20) DEFAULT '1' COMMENT '质控类型',
   `ward_code` varchar(16) DEFAULT NULL COMMENT '病区编码',
   `ward_name` varchar(32) DEFAULT NULL COMMENT '病区名称',
   `beh_dept_id` varchar(16) NOT NULL COMMENT '住院科室ID',
@@ -436,6 +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',
   `rec_date` varchar(50) DEFAULT NULL COMMENT '病历日期',
   `rec_title` varchar(128) DEFAULT NULL COMMENT '病历标题',
   `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
@@ -484,7 +486,7 @@ CREATE TABLE `med_qcresult_detail` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=29445 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+) ENGINE=InnoDB AUTO_INCREMENT=32130 DEFAULT CHARSET=utf8 COMMENT='质控评分明细信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_qcresult_info
@@ -506,7 +508,7 @@ CREATE TABLE `med_qcresult_info` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=234 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
+) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 COMMENT='质控评分主表信息\r\n每次评分增加一条信息,前面所有评分is_deleted全部设置为Y';
 
 -- ----------------------------
 -- Table structure for med_record_type
@@ -617,7 +619,7 @@ CREATE TABLE `qc_mode` (
   `modifier` varchar(60) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8 COMMENT='病历';
+) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8 COMMENT='病历';
 
 -- ----------------------------
 -- Table structure for qc_model_hospital

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

@@ -155,6 +155,9 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         analyzeVO.setHospitalId(hospitalId);
         // 获取质控条目
         List<QcCasesEntryDTO> qcCasesEntryDTOList = qcCasesEntryFacade.getQcCasesEntry(analyzeVO);
+        if(ListUtil.isEmpty(qcCasesEntryDTOList)){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "该病历找不到质控条目!");
+        }
 
         // 获取病历所有数据
         Map<String, Map<String, String>> dicMap = sysDictionaryFacade.getDictionaryWithKey(); // 获取字典信息

+ 8 - 10
src/main/java/com/diagbot/facade/QcModeFacade.java

@@ -7,9 +7,9 @@ import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.QcModeServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -27,23 +27,21 @@ public class QcModeFacade extends QcModeServiceImpl {
                 .orderByAsc("parent_id", "order_no")
         );
 
-        Iterator<QcMode> iterator = qcModeList.iterator();
-        while (iterator.hasNext()) {
-            QcMode qcMode = iterator.next();
-            if (!pageData.containsKey(qcMode.getName()) && !"病程信息".equals(qcMode.getName())) {
-                iterator.remove();
-            }
-        }
-
         Map<Long, List<QcMode>> map = EntityUtil.makeEntityListMap(qcModeList, "parentId");
+
         // 获取根节点
         List<QcMode> root = map.get(-1L);
         List<QcModeDTO> res = BeanUtil.listCopyTo(root, QcModeDTO.class);
 
-        for (QcModeDTO qcModeDTO : res) {
+        for (int i = 0; i < res.size(); i++) {
+            QcModeDTO qcModeDTO = res.get(i);
             if (map.containsKey(qcModeDTO.getId())) {
                 qcModeDTO.setSonMode(BeanUtil.listCopyTo(map.get(qcModeDTO.getId()), QcModeDTO.class));
             }
+            // 如果病程信息下无内容,则删除
+            if ("病程信息".equals(qcModeDTO.getName()) && ListUtil.isEmpty(qcModeDTO.getSonMode())) {
+                res.remove(i--);
+            }
         }
         return res;
     }

+ 2 - 0
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -19,6 +19,7 @@ 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;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.Map;
 
@@ -78,6 +79,7 @@ public class BehospitalInfoController {
     @PostMapping("/analyze_rpc")
     @SysLogger("analyze_rpc")
     @Transactional
+    @ApiIgnore
     public RespDTO<AnalyzeDTO> analyze_rpc(@RequestBody AnalyzeVO analyzeVO) {
         return RespDTO.onSuc(behospitalInfoFacade.analyze(analyzeVO));
     }

+ 11 - 8
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -19,14 +19,17 @@
     </resultMap>
 
     <select id="getRecordContent"  resultType="com.diagbot.dto.RecordContentDTO">
-        select t.*,c.content_blob, c.content_text from (
-            SELECT a.rec_id, a.rec_title, b.stand_model_name FROM `med_medical_record` a, qc_model_hospital b
-            where a.is_deleted = 'N'  and a.rec_title = b.hospital_model_name
-            and a.hospital_id = #{hospitalId}
-            and b.hospital_id = #{hospitalId}
-            and a.behospital_code = #{behospitalCode}
-            and b.stand_model_name is not null) t, med_medical_record_content c
-        where t.rec_id = c.rec_id and c.is_deleted = 'N'
+        select t1.rec_id, t1.rec_title, t2.name stand_model_name, t3.content_text
+        from med_medical_record t1, qc_mode t2, med_medical_record_content t3
+        where
+             t1.is_deleted = 'N'
+        and t2.is_deleted = 'N'
+        and t3.is_deleted = 'N'
+        and t1.mode_id = t2.id
+        and t1.hospital_id = t3.hospital_id
+        and t1.rec_id = t3.rec_id
+        and t1.hospital_id = #{hospitalId}
+        and t1.behospital_code = #{behospitalCode}
     </select>
 
 </mapper>

+ 15 - 21
src/main/resources/mapper/QcCasesEntryMapper.xml

@@ -22,30 +22,24 @@
 
     <select id="getQcCasesEntry" parameterType="com.diagbot.vo.AnalyzeVO" resultType="com.diagbot.dto.QcCasesEntryDTO">
         SELECT DISTINCT
-            t7.`code`,t7.mode_id, t6.msg
+        t4.`code`,
+        t4.mode_id,
+        t3.msg
         FROM
-            med_medical_record t1,
-            qc_model_hospital t2,
-            med_record_type t3,
-            qc_type_doc t4,
-            qc_type_cases_entry t5,
-            qc_cases_entry_hospital t6,
-            qc_cases_entry t7
+        med_behospital_info t1,
+        qc_type_cases_entry t2,
+        qc_cases_entry_hospital t3,
+        qc_cases_entry t4
         WHERE
-            t1.hospital_id = t2.hospital_id
-        AND t2.stand_model_name = '入院记录'
-        AND t2.hospital_model_name = t1.rec_title
-        AND t3.type_name = t2.hospital_model_name
-        AND t3.hospital_id = t4.hospital_id
-        AND t3.type_id = t4.hospital_type_id
+        t1.qc_type_id = t2.type_id
+        AND t2.case_entry_id = t3.cases_entry_id
+        AND t1.hospital_id = t3.hospital_id
+        AND t3.cases_entry_id = t4.id
+        AND t3.is_used = 1
+        AND t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
         AND t4.is_deleted = 'N'
-        AND t5.is_deleted = 'N'
-        AND t6.is_deleted = 'N'
-        AND t7.is_deleted = 'N'
-        AND t4.type_id = t5.type_id
-        AND t5.case_entry_id = t6.cases_entry_id
-        AND t6.cases_entry_id = t7.id
-        AND t6.is_used = 1
         <if test="hospitalId != null and hospitalId != ''">
             AND t1.hospital_id = #{hospitalId}
         </if>