Parcourir la source

条目缺陷占比优化调整

chengyao il y a 5 ans
Parent
commit
1300e1604d

+ 1 - 4
src/main/java/com/diagbot/dto/EntryNumDTO.java

@@ -39,10 +39,7 @@ public class EntryNumDTO {
      */
     @Excel(name = "数量", orderNum = "5")
     private Integer num = 0;
-    /**
-     * 条目缺陷占比
-     */
-    private Double percent = 0.00d;
+
     /**
      * 条目缺陷占比(百分比)
      */

+ 1 - 1
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -153,7 +153,7 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
     public IPage<DeptEntryNumDTO> entryCountGroupByEntryAndDeptPage(@Param("filterPageByDeptVO") FilterPageByDeptVO filterPageByDeptVO);
 
     /**
-     * 条目缺陷占比(内页)
+     * 条目缺陷占比基础数据(内页)
      *
      * @return
      */

+ 6 - 5
src/main/java/com/diagbot/service/impl/QcresultInfoServiceImpl.java

@@ -215,7 +215,8 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
         //缺陷总数
           Integer sumInteget = baseMapper.entryGroupByEntrySum(filterPageVO.getHospitalId(),filterPageVO.getIsPlacefile(),
                                                                 filterPageVO.getStartDate(),filterPageVO.getEndDate());
-        Set<Long> ids = new HashSet<Long>();
+        float nsum = 0;
+          Set<Long> ids = new HashSet<Long>();
         List<EntryNumDTO> records = entryNumDTOIPage.getRecords();
         if(CollectionUtils.isEmpty(records)){
             return null;
@@ -223,11 +224,12 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
         for (EntryNumDTO record : records) {
             ids.add(record.getId());
             int num = record.getNum().intValue();
-            int sum = sumInteget.intValue();
-            float nsum =(float) num/sum;
+            if(sumInteget!=null && sumInteget!=0 ){
+                int sum = sumInteget.intValue();
+                 nsum =(float) num/sum;
+            }
             DecimalFormat df = new DecimalFormat("0.00");
             String percent = df.format(nsum*100);
-            record.setPercent(Double.valueOf(percent));
             record.setPercentStr(percent+"%");
             record.setTotleNum(sumInteget);
         }
@@ -279,7 +281,6 @@ public class QcresultInfoServiceImpl extends ServiceImpl<QcresultInfoMapper, Qcr
 
     /**
      * 各科室甲/乙/丙级病历占比
-     *
      * @param filterVO
      * @return
      */

+ 59 - 60
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -430,22 +430,22 @@
 
     <!-- 条目缺陷占比(内页) -->
     <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
-        SELECT
-        tt2.id as id,
-        tt2.NAME as name,
-        tt2.cases_id AS casesId,
-        tt2.cases_name AS casesName,
-        tt1.num as num,
-        tt1.is_reject AS isReject
-        FROM
-        (
-        SELECT
-        a.hospital_id,
-        d.cases_entry_id,
-        d.cases_id,
-        count(*) AS num,
-        d.is_reject
-        FROM
+    SELECT
+    tt2.id as id,
+    tt2.name as name,
+    tt2.cases_id as casesId,
+    tt2.cases_name as casesName,
+    tt1.num as num,
+    tt1.is_reject as isReject
+    FROM
+    (
+    SELECT
+    a.hospital_id,
+    d.cases_entry_id,
+    d.cases_id,
+    count(*) as num,
+    d.is_reject
+    FROM
         med_behospital_info a,
         med_qcresult_detail d
         WHERE
@@ -453,51 +453,50 @@
         AND d.is_deleted = 'N'
         AND a.hospital_id = d.hospital_id
         AND a.behospital_code = d.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.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>
-        <if test="filterPageVO.isReject != null">
-            AND d.is_reject = #{filterPageVO.isReject}
-        </if>
-        GROUP BY
-        d.cases_entry_id,
-        d.is_reject,
-        d.cases_id
-        having
-        1=1
+    <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>
-        ) tt1,
-        qc_cases_entry tt2
-        WHERE
-        tt2.is_deleted = 'N'
-        AND tt1.cases_id = tt2.cases_id
-        AND tt1.cases_entry_id = tt2.id
-        <if test="filterPageVO.name != null and filterPageVO.name != ''">
-            AND tt2.name like CONCAT('%', #{filterPageVO.name},'%')
-        </if>
-        <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
-            AND tt2.cases_name = #{filterPageVO.casesName}
-        </if>
-    </select>
+    <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>
+    <if test="filterPageVO.isReject != null">
+        AND d.is_reject = #{filterPageVO.isReject}
+    </if>
+    GROUP BY
+    d.cases_entry_id,
+    d.is_reject,
+    d.cases_id
+    ) tt1,
+    qc_cases_entry tt2
+    WHERE
+    tt2.is_deleted = 'N'
+    AND tt1.cases_id = tt2.cases_id
+    AND tt1.cases_entry_id = tt2.id
+    <if test="filterPageVO.name != null and filterPageVO.name != ''">
+        AND tt2.name like CONCAT('%', #{filterPageVO.name},'%')
+    </if>
+    <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
+        AND tt2.cases_name = #{filterPageVO.casesName}
+    </if>
+
+        </select>
     <!-- 条目缺陷占比缺陷总量(内页) -->
     <select id="entryGroupByEntrySum" resultType="java.lang.Integer">
         SELECT
@@ -557,8 +556,8 @@
             ${item}
         </foreach>
     </select>
-
-   <!-- <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
+    <!-- 条目缺陷占比原始数据统计(内页) -->
+  <!--  <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.EntryNumDTO">
         SELECT
         t.*
         FROM