浏览代码

病案首页合格数导出病历详情页

chengyao 4 年之前
父节点
当前提交
a7177326b0

+ 1 - 1
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -346,7 +346,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
     public List<ExportExcelDTO> unModifyMRPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
     /**
-     * 病案首页不合格数病历详情页导出
+     * 病案首页不合格/合格数病历详情页导出
      *
      * @param qcResultShortPageVO
      * @return

+ 45 - 43
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -7309,6 +7309,10 @@
         FROM
         (SELECT
         be.*,
+        b.LEVEL,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -7322,10 +7326,8 @@
         a.behospital_code,
         a.bed_code,
         a.file_code,
-        b.LEVEL,
-        b.grade_type,
-        b.score_res,
         c.score_res as scoreBn,
+        c.cases_id,
         a.NAME,
         a.sex,
         a.beh_dept_id,
@@ -7341,24 +7343,17 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name,
-        b.gmt_create
+        a.ward_name
         FROM
         med_behospital_info a,
-        med_qcresult_info b,
-        med_qcresult_cases c,
-        qc_cases_entry d
+        med_qcresult_cases c
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND c.is_deleted = 'N'
-        AND d.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND c.cases_id = d.cases_id
         AND a.qc_type_id != 0
+        AND c.cases_id = 243
         <if test="qcResultShortPageVO.titleName != null ">
             <if test="qcResultShortPageVO.titleName == '不合格数'">
                 AND c.`level`='不合格'
@@ -7392,9 +7387,6 @@
         <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
             AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
         </if>
-        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
-            AND b.`level` = #{qcResultShortPageVO.level}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -7411,18 +7403,6 @@
             OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
             OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
         </if>
-        <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
-            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
-        </if>
-        <if test="qcResultShortPageVO.casesEntryId != null ">
-            AND d.id = #{qcResultShortPageVO.casesEntryId}
-        </if>
-<!--        <if test="qcResultShortPageVO.isReject != null">-->
-<!--            AND c.is_reject = #{qcResultShortPageVO.isReject}-->
-<!--        </if>-->
-        <if test="qcResultShortPageVO.ruleType != null">
-            AND d.rule_type = #{qcResultShortPageVO.ruleType}
-        </if>
         )be
         left join med_check_info mci
         on mci.is_deleted = 'N'
@@ -7434,6 +7414,25 @@
         and hm_mci.check_type = 1
         and be.hospital_id = hm_mci.hospital_id
         and be.behospital_code = hm_mci.behospital_code
+        left join med_qcresult_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </if>
+        left join qc_cases_entry d
+        on  d.is_deleted = 'N'
+        AND be.cases_id = d.cases_id
+                <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
+                    AND d.NAME = #{qcResultShortPageVO.casesEntryName}
+                </if>
+                <if test="qcResultShortPageVO.casesEntryId != null ">
+                    AND d.id = #{qcResultShortPageVO.casesEntryId}
+                </if>
+                <if test="qcResultShortPageVO.ruleType != null">
+                    AND d.rule_type = #{qcResultShortPageVO.ruleType}
+                </if>
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code
@@ -7522,6 +7521,10 @@
         FROM
         (SELECT
         be.*,
+        b.grade_type,
+        b.score_res,
+        b.gmt_create,
+        b.LEVEL,
         ifnull(mci.status,0) AS checkStatus,
         ifnull(hm_mci.status,0) AS mrStatus,
         mci.check_name as chName,
@@ -7535,9 +7538,6 @@
         a.behospital_code,
         a.bed_code,
         a.file_code,
-        b.LEVEL,
-        b.grade_type,
-        b.score_res,
         a.NAME,
         a.sex,
         a.beh_dept_id,
@@ -7553,23 +7553,24 @@
         a.director_doctor_name,
         a.diagnose,
         a.placefile_date,
-        a.ward_name,
-        b.gmt_create
+        a.ward_name
         FROM
         med_behospital_info a,
-        med_qcresult_info b,
+        med_qcresult_detail k,
         med_qcresult_cases c,
         qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
         AND c.is_deleted = 'N'
         AND d.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
         AND a.hospital_id = c.hospital_id
-        AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
         AND c.cases_id = d.cases_id
+        AND a.hospital_id = k.hospital_id
+        AND a.behospital_code = k.behospital_code
+        AND c.cases_id = k.cases_id
+        AND k.cases_id = d.cases_id
+        AND k.cases_entry_id = d.id
         <if test="qcResultShortPageVO.titleName != null ">
             <if test="qcResultShortPageVO.titleName == '不合格数'">
                 AND c.`level`='不合格'
@@ -7604,9 +7605,6 @@
         <if test="qcResultShortPageVO.behDeptName != null and qcResultShortPageVO.behDeptName != ''">
             AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
         </if>
-        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
-            AND b.`level` = #{qcResultShortPageVO.level}
-        </if>
         <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
             AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
         </if>
@@ -7629,9 +7627,6 @@
         <if test="qcResultShortPageVO.casesEntryId != null ">
             AND d.id = #{qcResultShortPageVO.casesEntryId}
         </if>
-<!--        <if test="qcResultShortPageVO.isReject != null">-->
-<!--            AND c.is_reject = #{qcResultShortPageVO.isReject}-->
-<!--        </if>-->
         <if test="qcResultShortPageVO.ruleType != null">
             AND d.rule_type = #{qcResultShortPageVO.ruleType}
         </if>
@@ -7646,6 +7641,13 @@
         and hm_mci.check_type = 1
         and be.hospital_id = hm_mci.hospital_id
         and be.behospital_code = hm_mci.behospital_code
+        left join med_qcresult_info b
+        on  b.is_deleted = 'N'
+        AND be.hospital_id = b.hospital_id
+        AND be.behospital_code = b.behospital_code
+        <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
+            AND b.`level` = #{qcResultPageVO.level}
+        </if>
         ) t1
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code