Browse Source

死亡人数统计修改/条目缺陷占比优化

chengyao 4 years ago
parent
commit
85e4a1d3cc

+ 12 - 6
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -731,16 +731,22 @@
     <!-- 死亡人数统计-全院-首页 -->
     <select id="deathCount" parameterType="com.diagbot.vo.FilterVO" resultType="int">
         SELECT
-        COUNT(*)
+        a.behospital_code,
+        b.mode_id,
+        b.rec_id
         FROM
         med_behospital_info a,
-        med_home_page b
+        med_medical_record b,
+        med_medical_record_content c
         WHERE
-        a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
+            a.is_deleted = 'N'
+        and	b.is_deleted = 'N'
+        and	c.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 b.return_to_type = '死亡'
+        AND b.rec_id = c.rec_id
+        and b.mode_id = '24'
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>

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

@@ -430,6 +430,107 @@
 
     <!-- 条目缺陷占比(内页) -->
     <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
+        SELECT
+        t1.id AS id,
+        t1.name AS name,
+        t1.casesId AS casesId,
+        t1.casesName AS casesName,
+        t1.num AS num,
+        t2.mrNum AS totleNum,
+        t1.isReject AS isReject,
+        t1.score AS score,
+        Round( t1.num / t2.mrNum, 4 ) AS percent,
+        CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
+        from(
+        SELECT
+        id,
+        name,
+        casesId,
+        casesName,
+        isReject,
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            score_run as score,
+        </if>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            score,
+        </if>
+        count(*) num
+        from new_table_name
+        WHERE
+        is_deleted = 'N'
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile != ''">
+            and is_placefile = #{filterPageVO.isPlacefile}
+        </if>
+        AND qc_type_id != 0
+        <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
+            AND hospital_id = #{filterPageVO.hospitalId}
+        </if>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterPageVO.isReject != null">
+            AND is_reject = #{filterPageVO.isReject}
+        </if>
+        <if test="filterPageVO.name != null and filterPageVO.name != ''">
+            AND name like CONCAT('%', #{filterPageVO.name},'%')
+        </if>
+        <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
+            AND cases_name = #{filterPageVO.casesName}
+        </if>
+        GROUP BY
+        id,
+        isReject,
+        casesId)t1,
+
+        ( SELECT
+        count(*) AS mrNum
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = c.behospital_code
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile != ''">
+            and a.is_placefile = #{filterPageVO.isPlacefile}
+        </if>
+        AND a.qc_type_id != 0
+        <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
+            AND a.hospital_id = #{filterPageVO.hospitalId}
+        </if>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
+        </if>
+        )t2
+    </select>
+   <!-- <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
         SELECT
         t.*
         FROM
@@ -564,7 +665,7 @@
         ) t2
         ) t
     </select>
-
+-->
     <!-- 单项否决缺陷占比(首页) -->
     <select id="entryRejectPercent" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.EntryNumDTO">
         SELECT