Browse Source

模块统计质控缺陷数保留到小数点后三位以免出现0.00%还有数据的情况

cb 7 months ago
parent
commit
de1c9deb33

+ 4 - 0
src/main/java/com/diagbot/facade/data/ABehospitalInfoFacade.java

@@ -164,6 +164,10 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @return
      */
     private Long initQcTypeId(BehospitalInfo s) {
+        // 如果是婴儿(isBaby = 1),直接返回0,不进行质控
+        if (s.getIsBaby().equals(1)) {
+            return 0L;
+        }
         Long qcTypeId = Long.valueOf("0");
         //根据科室查找对应质控类型
         List<QcType> qcTypeList = qcTypeFacade.list(new QueryWrapper<QcType>()

+ 107 - 103
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -44,109 +44,113 @@
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        SELECT * FROM (
-        select   t.*,
-        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
-        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
-        g.check_type AS ch_type,
-        h.check_type AS mr_type,
-        g.check_name AS ch_name,
-        h.check_name AS mr_name,
-        g.check_time AS ch_time,
-        h.check_time AS mr_time
-        from (
-        select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
-        grade_time,IF(c.age is null, null,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') ))as age,e.score_res as score_bn from med_behospital_info a
-        LEFT JOIN med_qcresult_info b
-        on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
-        left join med_home_page c
-        on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
-        LEFT JOIN med_qcresult_cases e
-        on  a.behospital_code = e.behospital_code
-        AND e.is_deleted = 'N'
-        and e.cases_id = 243
-        ) t
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type in(0,2) ) g
-        ON t.behospital_code = g.behospital_code
-        AND t.hospital_id = g.hospital_id
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
-        ON t.behospital_code = h.behospital_code
-        AND t.hospital_id = h.hospital_id
-        where t.is_deleted = 'N'
-        <if test="isDaytime != null and isDaytime != ''">
-            AND t.is_daytime = #{isDaytime}
-        </if>
-        <if test="diagnose != null and diagnose != ''">
-            AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
-        </if>
-        <if test="deptName != null and deptName != ''">
-            and t.beh_dept_name= #{deptName}
-        </if>
-        <if test="doctorName != null and doctorName != ''">
-            and CONCAT(
-            IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
-            like CONCAT('%',#{doctorName},'%')
-        </if>
-        <if test="name != null and name != ''">
-            and t.name like CONCAT('%',#{name},'%')
-        </if>
-        <if test="doctorCode != null and doctorCode != ''">
-            and (t.doctor_id = #{doctorCode}
-            or t.beh_doctor_id = #{doctorCode}
-            or t.director_doctor_id = #{doctorCode})
-        </if>
-        <if test="hospitalId != null">
-            and t.hospital_id = #{hospitalId}
-        </if>
-        <if test="behospitalCode != null and behospitalCode != ''">
-            and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
-        </if>
-        <if test="fileCode != null and fileCode != ''">
-            and t.file_code like CONCAT('%',#{fileCode},'%')
-        </if>
-        <if test="behosDateStart != null">
-            <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
-        </if>
-        <if test="behosDateEnd != null">
-            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
-        </if>
-        <if test="leaveHosDateStart != null">
-            <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
-        </if>
-        <if test="leaveHosDateEnd != null">
-            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
-        </if>
-        <if test="level != null and level != ''">
-            and t.level = #{level}
-        </if>
-        <if test="isPlacefile != null and isPlacefile != ''">
-            and t.is_placefile = #{isPlacefile}
-        </if>
-        and t.qc_type_id != 0) p
-        where p.is_deleted="N"
-        <if test="checkStatus != null ">
-            and p.check_status = #{checkStatus}
-        </if>
-        <if test="mrStatus != null ">
-            AND p.mr_status = #{mrStatus}
-        </if>
-        <if test="chName != null and chName !=''">
-            AND p.ch_name like CONCAT('%',#{chName},'%')
-        </if>
-        <if test="mrName != null and mrName !=''">
-            AND p.mr_name like CONCAT('%',#{mrName},'%')
-        </if>
-        <if test="chTimeStart != null">
-            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
-        </if>
-        <if test="chTimeEnd != null">
-            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
-        </if>
-        <if test="mrTimeStart != null">
-            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
-        </if>
-        <if test="mrTimeEnd != null">
-            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        <if test="qcType != 0">
+            SELECT * FROM (
+            SELECT
+            t.*,
+            CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+            CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+            g.check_type AS ch_type,
+            h.check_type AS mr_type,
+            g.check_name AS ch_name,
+            h.check_name AS mr_name,
+            g.check_time AS ch_time,
+            h.check_time AS mr_time
+            FROM (
+            SELECT
+            a.*,
+            IFNULL(b.level, '未评分') AS `level`,
+            b.grade_type,
+            b.score_res,
+            b.gmt_create AS grade_time,
+            IF(c.age IS NULL, NULL, CONCAT(IFNULL(c.age, ''), IFNULL(c.age_unit, ''))) AS age,
+            e.score_res AS score_bn
+            FROM med_behospital_info a
+            LEFT JOIN med_qcresult_info b ON a.behospital_code = b.behospital_code AND b.is_deleted = 'N'
+            LEFT JOIN med_home_page c ON a.behospital_code = c.behospital_code AND c.is_deleted = 'N'
+            LEFT JOIN med_qcresult_cases e ON a.behospital_code = e.behospital_code AND e.is_deleted = 'N' AND e.cases_id = 243
+            ) t
+            LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type IN (0, 2)) g ON t.behospital_code = g.behospital_code AND t.hospital_id = g.hospital_id
+            LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 1) h ON t.behospital_code = h.behospital_code AND t.hospital_id = h.hospital_id
+            WHERE t.is_deleted = 'N'
+            <if test="isDaytime != null and isDaytime != ''">
+                AND t.is_daytime = #{isDaytime}
+            </if>
+            <if test="diagnose != null and diagnose != ''">
+                AND t.diagnose LIKE CONCAT('%', #{diagnose}, '%')
+            </if>
+            <if test="deptName != null and deptName != ''">
+                AND t.beh_dept_name = #{deptName}
+            </if>
+            <if test="doctorName != null and doctorName != ''">
+                AND CONCAT(
+                IFNULL(t.doctor_name, ''),
+                IFNULL(t.beh_doctor_name, ''),
+                IFNULL(t.director_doctor_name, '')
+                ) LIKE CONCAT('%', #{doctorName}, '%')
+            </if>
+            <if test="name != null and name != ''">
+                AND t.name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="doctorCode != null and doctorCode != ''">
+                AND (t.doctor_id = #{doctorCode}
+                OR t.beh_doctor_id = #{doctorCode}
+                OR t.director_doctor_id = #{doctorCode})
+            </if>
+            <if test="hospitalId != null">
+                AND t.hospital_id = #{hospitalId}
+            </if>
+            <if test="behospitalCode != null and behospitalCode != ''">
+                AND t.behospital_code LIKE CONCAT('%', #{behospitalCode}, '%')
+            </if>
+            <if test="fileCode != null and fileCode != ''">
+                AND t.file_code LIKE CONCAT('%', #{fileCode}, '%')
+            </if>
+            <if test="behosDateStart != null">
+                <![CDATA[ AND t.behospital_date >= #{behosDateStart}]]>
+            </if>
+            <if test="behosDateEnd != null">
+                <![CDATA[ AND t.behospital_date < #{behosDateEnd}]]>
+            </if>
+            <if test="leaveHosDateStart != null">
+                <![CDATA[ AND t.leave_hospital_date >= #{leaveHosDateStart}]]>
+            </if>
+            <if test="leaveHosDateEnd != null">
+                <![CDATA[ AND t.leave_hospital_date < #{leaveHosDateEnd}]]>
+            </if>
+            <if test="level != null and level != ''">
+                AND t.level = #{level}
+            </if>
+            <if test="isPlacefile != null and isPlacefile != ''">
+                AND t.is_placefile = #{isPlacefile}
+            </if>
+            AND t.qc_type_id != 0
+            ) p
+            WHERE p.is_deleted = 'N'
+            <if test="checkStatus != null">
+                AND p.check_status = #{checkStatus}
+            </if>
+            <if test="mrStatus != null">
+                AND p.mr_status = #{mrStatus}
+            </if>
+            <if test="chName != null and chName != ''">
+                AND p.ch_name LIKE CONCAT('%', #{chName}, '%')
+            </if>
+            <if test="mrName != null and mrName != ''">
+                AND p.mr_name LIKE CONCAT('%', #{mrName}, '%')
+            </if>
+            <if test="chTimeStart != null">
+                <![CDATA[ AND p.ch_time >= #{chTimeStart}]]>
+            </if>
+            <if test="chTimeEnd != null">
+                <![CDATA[ AND p.ch_time < #{chTimeEnd}]]>
+            </if>
+            <if test="mrTimeStart != null">
+                <![CDATA[ AND p.mr_time >= #{mrTimeStart}]]>
+            </if>
+            <if test="mrTimeEnd != null">
+                <![CDATA[ AND p.mr_time < #{mrTimeEnd}]]>
+            </if>
         </if>
     </select>