Explorar el Código

H5数据统计-扣分大于5逻辑修改
计算方式:【科室病历扣分≥5占比】=【科室病历扣分≥5病历数】÷【全院病历扣分≥5病历总数】

zhaops hace 3 años
padre
commit
fd01d9412d
Se han modificado 1 ficheros con 74 adiciones y 7 borrados
  1. 74 7
      src/main/resources/mapper/QcresultInfoMapper.xml

+ 74 - 7
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -2579,13 +2579,19 @@
 
     <!--病历扣分大于等于5分占比(H5)-->
     <select id="deductGT5ByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
+        SELECT
+        k1.deptId,
+        k1.deptName,
+        k1.num,
+        k2.totleNum,
+        Round( k1.num / k2.totleNum, 4 ) AS percent,
+        CONCAT( Round( k1.num / k2.totleNum * 100, 2 ), '%' ) AS percentStr
+        FROM
+        (
         SELECT
         t1.beh_dept_id AS deptId,
         t1.beh_dept_name AS deptName,
-        sum( t2.totleScore - t1.score_res >= 5 ) AS num,
-        count(*) AS totleNum,
-        Round( sum( t2.totleScore - t1.score_res >= 5 ) / count(*), 4 ) AS percent,
-        CONCAT( Round( sum( t2.totleScore - t1.score_res >= 5 ) / count(*) * 100, 2 ), '%' ) AS percentStr
+        count(*) AS num
         FROM
         (
         SELECT
@@ -2644,13 +2650,74 @@
         `sys_hospital_set`
         WHERE
         CODE = 'score_type'
-        <if test="hospitalId != null and hospitalId != ''">
-            AND hospital_id = #{hospitalId}
-        </if>
+        AND hospital_id = '5'
         ) t2
+        WHERE
+        t2.totleScore - t1.score_res >= 5
         GROUP BY
         t1.beh_dept_id,
         t1.beh_dept_name
+        ) k1,
+        (
+        SELECT
+        count(*) AS totleNum
+        FROM
+        (
+        SELECT
+        a.*,
+        b.score_res
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.behospital_code = b.behospital_code
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        AND a.qc_type_id != 0
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
+        </if>
+        ) t1,
+        (
+        SELECT
+        `value`,
+        hospital_id,
+        CASE
+        `value`
+        WHEN 0 THEN
+        120
+        WHEN 1 THEN
+        100
+        END AS totleScore
+        FROM
+        `sys_hospital_set`
+        WHERE
+        CODE = 'score_type'
+        AND hospital_id = '5'
+        ) t2
+        WHERE
+        t2.totleScore - t1.score_res >= 5
+        ) k2
         ORDER BY
         percent DESC
     </select>