Browse Source

Merge branch 'dev/29290610_1.3.3' into debug

gaodm 5 years ago
parent
commit
a93b342131

+ 3 - 4
doc/006.20200604v1.3.1/qc_initv1.3.1.sql

@@ -26,10 +26,9 @@ ALTER TABLE `med_record_type` ADD `gmt_modified` datetime NOT NULL DEFAULT '1970
 ALTER TABLE `med_record_type` ADD `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值' AFTER `gmt_modified`;
 ALTER TABLE `med_record_type` ADD `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改' AFTER `creator`;
 
-INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('33', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '单项否决占比', '17', 'YH-ZKK-DXFZZB_XQ', '1', '1', '10', '用户-质控科-单项否决占比_详情');
-
-INSERT INTO `sys_role_menu` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '33', '用户-质控科-单项否决占比_详情');
 
 INSERT INTO `qc_mode` (`id`, `name`, `order_no`, `parent_id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES ('56', '日常病程录', '210', '37', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', NULL);
 
-delete from sys_dictionary_info where group_type = 0 and is_deleted = 'Y';
+delete from sys_dictionary_info where group_type = 0 and is_deleted = 'Y';
+
+ALTER TABLE `qc_cases_entry_hospital` MODIFY COLUMN  `is_reject` int(3) NOT NULL DEFAULT '0' COMMENT '单项否决(1-单项否决 0-非)' AFTER `is_used`;

+ 3 - 0
doc/008.20200610v1.3.3/qc_initv1.3.3.sql

@@ -0,0 +1,3 @@
+use `qc`;
+
+ALTER TABLE `med_behospital_info` ADD `placefile_date` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '归档时间' AFTER `is_placefile`;

+ 5 - 0
src/main/java/com/diagbot/dto/BehospitalInfoDTO.java

@@ -106,4 +106,9 @@ public class BehospitalInfoDTO implements Serializable {
     private String directorDoctorName ;
 
     private String behDoctorName;
+
+    /**
+     * 归档时间
+     */
+    private Date placefileDate;
 }

+ 5 - 5
src/main/java/com/diagbot/dto/DeptEntryNumDTO.java

@@ -26,11 +26,11 @@ public class DeptEntryNumDTO {
      * 科室名称
      */
     private String deptName;
-    private Integer totleNum;
-    private Integer num;
-    private Double percent;
-    private String percentStr;
-    private Double score;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
+    private Double score = 0d;
     private Integer isReject;
     private Integer ruleType;
 }

+ 5 - 5
src/main/java/com/diagbot/dto/EntryNumDTO.java

@@ -21,11 +21,11 @@ public class EntryNumDTO {
      * 模块名称
      */
     private String casesName;
-    private Integer totleNum;
-    private Integer num;
-    private Double percent;
-    private String percentStr;
-    private Double score;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
+    private Double score = 0d;
     private Integer isReject;
     private Integer ruleType;
 }

+ 17 - 17
src/main/java/com/diagbot/dto/HomePageNumDTO.java

@@ -15,23 +15,23 @@ public class HomePageNumDTO {
     private String deptName;
     private String doctorId;
     private String doctorName;
-    private Integer entryNum;
-    private Integer mrNum;
-    private Double totleValue;
-    private Double averageValue;
-    private Integer firstLevelNum;
-    private Integer secondLevelNum;
-    private Double firstLevelPercent;
-    private Double secondLevelPercent;
-    private String firstLevelPercentStr;
-    private String secondLevelPercentStr;
+    private Integer entryNum = 0;
+    private Integer mrNum = 0;
+    private Double totleValue = 0d;
+    private Double averageValue = 0d;
+    private Integer firstLevelNum = 0;
+    private Integer secondLevelNum = 0;
+    private Double firstLevelPercent = 0.00d;
+    private Double secondLevelPercent = 0.00d;
+    private String firstLevelPercentStr = "0.00%";
+    private String secondLevelPercentStr = "0.00%";
     private String deptClassId;
     private String deptClass;
-    private Integer emptyNum;
-    private Integer errorNum;
-    private Integer entryTotleNum;
-    private Double emptyPercent;
-    private Double errorPercent;
-    private String emptyPercentStr;
-    private String errorPercentStr;
+    private Integer emptyNum = 0;
+    private Integer errorNum = 0;
+    private Integer entryTotleNum = 0;
+    private Double emptyPercent = 0.00d;
+    private Double errorPercent = 0.00d;
+    private String emptyPercentStr = "0.00%";
+    private String errorPercentStr = "0.00%";
 }

+ 4 - 4
src/main/java/com/diagbot/dto/NumDTO.java

@@ -13,8 +13,8 @@ import lombok.Setter;
 public class NumDTO {
     private String id;
     private String name;
-    private Integer totleNum;
-    private Integer num;
-    private Double percent;
-    private String percentStr;
+    private Integer totleNum = 0;
+    private Integer num = 0;
+    private Double percent = 0.00d;
+    private String percentStr = "0.00%";
 }

+ 13 - 0
src/main/java/com/diagbot/entity/BehospitalInfo.java

@@ -153,6 +153,11 @@ public class BehospitalInfo implements Serializable {
      */
     private String isPlacefile;
 
+    /**
+     * 归档时间
+     */
+    private Date placefileDate;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */
@@ -386,6 +391,14 @@ public class BehospitalInfo implements Serializable {
         this.isPlacefile = isPlacefile;
     }
 
+    public Date getPlacefileDate() {
+        return placefileDate;
+    }
+
+    public void setPlacefileDate(Date placefileDate) {
+        this.placefileDate = placefileDate;
+    }
+
     public String getIsDeleted() {
         return isDeleted;
     }

+ 12 - 5
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -498,6 +498,9 @@ public class ConsoleByDeptFacade {
                 filterPageByDeptVO.setDeptName(deptList.get(0).getDeptName());
             }
         }
+        if (filterPageByDeptVO.getDeptName().equals(filterPageByDeptVO.getDoctorName())) {
+            filterPageByDeptVO.setDoctorName("");
+        }
         filterPageByDeptVOSet(filterPageByDeptVO);
         IPage<DeptEntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryAndDeptPage(filterPageByDeptVO);
         return page;
@@ -590,9 +593,13 @@ public class ConsoleByDeptFacade {
         filterOrderByDeptVO.setHospitalId(hosptialId);
         filterOrderByDeptVO.setUserId(Long.valueOf(userId));
         List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatisticsByDept(filterOrderByDeptVO);
-        HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
-        if (item != null) {
-            records.add(0, item);
+        //没有医生过滤时增加全科室数据
+        if (StringUtil.isBlank(filterOrderByDeptVO.getName())
+                || filterOrderByDeptVO.getName().equals(filterOrderByDeptVO.getDeptName())) {
+            HomePageNumDTO item = getGlobleRecord(records, filterOrderByDeptVO.getDeptName());
+            if (item != null) {
+                records.add(0, item);
+            }
         }
         return records;
     }
@@ -702,7 +709,7 @@ public class ConsoleByDeptFacade {
                 .stream()
                 .map(HomePageNumDTO::getEmptyNum)
                 .reduce(0, Integer::sum);
-        Double emptyPercent = BigDecimal.valueOf(emptyNum)
+        Double emptyPercent = BigDecimal.valueOf(entryTotleNum - emptyNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String emptyPercentStr
@@ -712,7 +719,7 @@ public class ConsoleByDeptFacade {
                 .stream()
                 .map(HomePageNumDTO::getErrorNum)
                 .reduce(0, Integer::sum);
-        Double errorPercent = BigDecimal.valueOf(errorNum)
+        Double errorPercent = BigDecimal.valueOf(entryTotleNum - errorNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String errorPercentStr

+ 12 - 6
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -467,6 +467,9 @@ public class ConsoleFacade {
      */
     public IPage<EntryNumDTO> entryCountGroupByEntryPage(FilterPageVO filterPageVO) {
         filterPageVOSet(filterPageVO);
+        if (filterPageVO.getDeptName().equals("全院")) {
+            filterPageVO.setDeptName("");
+        }
         IPage<EntryNumDTO> page = qcresultInfoFacade.entryCountGroupByEntryPage(filterPageVO);
         return page;
     }
@@ -574,7 +577,7 @@ public class ConsoleFacade {
         filterOrderVO.setStartDate(startDate);
         filterOrderVO.setEndDate(endDate);
         filterOrderVO.setHospitalId(hosptialId);
-        List<LevelStatisticsDTO> records = behospitalInfoFacade.levelStatisticsByDeptClass(filterOrderVO);
+        List<LevelStatisticsDTO> records = behospitalInfoFacade.levelStatisticsByDeptClass2(filterOrderVO);
         return records;
     }
 
@@ -592,9 +595,12 @@ public class ConsoleFacade {
         filterOrderVO.setEndDate(endDate);
         filterOrderVO.setHospitalId(hosptialId);
         List<HomePageNumDTO> records = behospitalInfoFacade.homePageLevelStatistics(filterOrderVO);
-        HomePageNumDTO item = getGlobleRecord(records);
-        if (item != null) {
-            records.add(0, item);
+        //没有科室过滤时增加全院数据
+        if (StringUtil.isBlank(filterOrderVO.getName()) || filterOrderVO.getName().equals("全院")) {
+            HomePageNumDTO item = getGlobleRecord(records);
+            if (item != null) {
+                records.add(0, item);
+            }
         }
         return records;
     }
@@ -697,7 +703,7 @@ public class ConsoleFacade {
                 .stream()
                 .map(HomePageNumDTO::getEmptyNum)
                 .reduce(0, Integer::sum);
-        Double emptyPercent = BigDecimal.valueOf(emptyNum)
+        Double emptyPercent = BigDecimal.valueOf(entryTotleNum - emptyNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String emptyPercentStr
@@ -707,7 +713,7 @@ public class ConsoleFacade {
                 .stream()
                 .map(HomePageNumDTO::getErrorNum)
                 .reduce(0, Integer::sum);
-        Double errorPercent = BigDecimal.valueOf(errorNum)
+        Double errorPercent = BigDecimal.valueOf(entryTotleNum - errorNum)
                 .divide(BigDecimal.valueOf(entryTotleNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String errorPercentStr

+ 8 - 0
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -182,6 +182,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO);
+
 
     List<ExportExcelDTO> exportExcel();
 

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

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.ExportExcelDTO;
-import com.diagbot.dto.ExportQcresultDTO;
 import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.MsgDTO;
@@ -184,6 +183,14 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     public List<LevelStatisticsDTO> levelStatisticsByDeptClass(FilterOrderVO filterOrderVO);
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO);
+
     List<ExportExcelDTO> exportExcel();
 
     /**

+ 13 - 3
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.BehospitalInfoDTO;
 import com.diagbot.dto.DeptNumDTO;
-import com.diagbot.dto.ExportQcresultDTO;
 import com.diagbot.dto.ExportExcelDTO;
 import com.diagbot.dto.HomePageNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
@@ -247,8 +246,19 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return baseMapper.levelStatisticsByDeptClass(filterOrderVO);
     }
 
+    /**
+     * 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空)
+     *
+     * @param filterOrderVO
+     * @return
+     */
+    @Override
+    public List<LevelStatisticsDTO> levelStatisticsByDeptClass2(FilterOrderVO filterOrderVO) {
+        return baseMapper.levelStatisticsByDeptClass2(filterOrderVO);
+    }
+
     @Override
-    public List<ExportExcelDTO> exportExcel(){
+    public List<ExportExcelDTO> exportExcel() {
         return baseMapper.exportExcel();
     }
 
@@ -268,7 +278,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @param exportQcresultVO
      * @return
      */
-    public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO){
+    public List<ExportExcelDTO> exportQcresultByDept(ExportQcresultVO exportQcresultVO) {
         return baseMapper.exportQcresultByDept(exportQcresultVO);
     }
 }

+ 229 - 10
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -31,6 +31,7 @@
         <result column="director_doctor_id" property="directorDoctorId"/>
         <result column="director_doctor_name" property="directorDoctorName"/>
         <result column="is_placefile" property="isPlacefile"/>
+        <result column="placefile_date" property="placefileDate"/>
         <result column="is_deleted" property="isDeleted"/>
         <result column="gmt_create" property="gmtCreate"/>
         <result column="gmt_modified" property="gmtModified"/>
@@ -1208,6 +1209,222 @@
         </if>
     </select>
 
+    <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空) -->
+    <select id="levelStatisticsByDeptClass2" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
+        SELECT
+        t1.deptId,
+        t1.deptName,
+        t1.deptClassId,
+        t1.deptClass,
+        t2.entryNum,
+        t1.mrNum,
+        t1.totleValue,
+        t1.averageValue,
+        t1.firstLevelNum,
+        t1.secondLevelNum,
+        t1.thirdLevelNum,
+        t1.firstLevelPercent,
+        t1.secondLevelPercent,
+        t1.thirdLevelPercent,
+        t1.firstLevelPercentStr,
+        t1.secondLevelPercentStr,
+        t1.thirdLevelPercentStr
+        FROM
+        (
+        SELECT
+        tt1.deptId,
+        tt1.deptName,
+        e.dept_id AS deptClassId,
+        e.dept_name AS deptClass,
+        count( DISTINCT tt1.behospitalCode ) AS mrNum,
+        ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
+        ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END ) AS firstLevelNum,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END ) AS secondLevelNum,
+        COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END ) AS thirdLevelNum,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS firstLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS secondLevelPercent,
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS thirdLevelPercent,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS firstLevelPercentStr,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS secondLevelPercentStr,
+        concat(
+        ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
+        '%'
+        ) AS thirdLevelPercentStr
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        d.parent_dept_id AS parentDeptId,
+        a.hospital_id AS hospitalId,
+        a.behospital_code AS behospitalCode,
+        c.score_res AS score,
+        c.LEVEL
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        bas_dept_info d
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = d.dept_id
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        ) tt1
+        LEFT JOIN bas_dept_info e ON tt1.parentDeptId = e.dept_id
+        AND e.is_deleted = 'N'
+        AND tt1.hospitalId = e.hospital_id
+        <if test="deptClass != null and deptClass != ''">
+            WHERE e.dept_name = #{deptClass}
+        </if>
+        GROUP BY
+        tt1.deptId,
+        tt1.deptName,
+        e.dept_id,
+        e.dept_name
+        ) t1,
+        (
+        SELECT
+        tt2.deptId,
+        tt2.deptName,
+        g.dept_id AS deptClassId,
+        g.dept_name AS deptClass,
+        count( * ) AS entryNum
+        FROM
+        (
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        f.parent_dept_id AS parentDeptId,
+        a.hospital_id AS hospitalId,
+        a.behospital_code AS behospitalCode
+        FROM
+        med_behospital_info a,
+        med_qcresult_info c,
+        med_qcresult_detail d,
+        qc_cases_entry e,
+        bas_dept_info f
+        WHERE
+        a.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = d.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = c.behospital_code
+        AND a.behospital_code = d.behospital_code
+        AND d.cases_id = e.cases_id
+        AND d.cases_entry_id = e.id
+        AND a.beh_dept_id = f.dept_id
+        AND a.is_placefile = '1'
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
+        </if>
+        <if test="endDate != null and endDate != ''">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
+        </if>
+        <if test="level != null and level != ''">
+            and c.level = #{level}
+        </if>
+        <if test="name != null and name != ''">
+            and a.beh_dept_name like CONCAT('%',#{name},'%')
+        </if>
+        ) tt2
+        LEFT JOIN bas_dept_info g ON tt2.parentDeptId = g.dept_id
+        AND g.is_deleted = 'N'
+        AND tt2.hospitalId = g.hospital_id
+        <if test="deptClass != null and deptClass != ''">
+            WHERE g.dept_name = #{deptClass}
+        </if>
+        GROUP BY
+        tt2.deptId,
+        tt2.deptName,
+        g.dept_id,
+        g.dept_name
+        ) t2
+        WHERE
+        t1.deptId = t2.deptId
+        AND t1.deptName = t2.deptName
+        <if test="asc != null and asc !=''">
+            order by
+            <choose>
+                <when test='asc=="deptId"'>deptId asc</when>
+                <when test='asc=="deptName"'>deptName asc</when>
+                <when test='asc=="deptClassId"'>deptClassId asc</when>
+                <when test='asc=="deptClass"'>deptClass asc</when>
+                <when test='asc=="entryNum"'>entryNum asc</when>
+                <when test='asc=="mrNum"'>mrNum asc</when>
+                <when test='asc=="totleValue"'>totleValue asc</when>
+                <when test='asc=="averageValue"'>averageValue asc</when>
+                <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
+                <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
+                <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
+                <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
+                <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
+                <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
+                <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
+                <otherwise>deptName asc</otherwise>
+            </choose>
+        </if>
+        <if test="desc != null and desc!=''">
+            order by
+            <choose>
+                <when test='desc=="deptId"'>deptId desc</when>
+                <when test='desc=="deptName"'>deptName desc</when>
+                <when test='desc=="deptClassId"'>deptClassId desc</when>
+                <when test='desc=="deptClass"'>deptClass desc</when>
+                <when test='desc=="entryNum"'>entryNum desc</when>
+                <when test='desc=="mrNum"'>mrNum desc</when>
+                <when test='desc=="totleValue"'>totleValue desc</when>
+                <when test='desc=="averageValue"'>averageValue desc</when>
+                <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
+                <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
+                <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
+                <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
+                <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
+                <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
+                <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
+                <otherwise>deptName desc</otherwise>
+            </choose>
+        </if>
+    </select>
+
     <!-- 病案首页合格率占比 -全院-->
     <select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
             resultType="com.diagbot.dto.HomePageNumDTO">
@@ -1333,17 +1550,17 @@
         h1.mrNum,
         h2.entryNum,
         h1.mrNum * h2.entryNum AS entryTotleNum,
-        ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
-        ROUND( h1.errorNum / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
-        CONCAT( ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
-        CONCAT( ROUND( h1.errorNum /( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
+        ROUND( ( h1.mrNum * h2.entryNum  - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
+        ROUND( ( h1.mrNum * h2.entryNum  - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
         FROM
         (
         SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
         sum( d.rule_type = 1 ) AS emptyNum,
-        round( sum( d.rule_type = 2 )/ 2, 0 ) AS errorNum,
+        sum( d.rule_type = 2 ) AS errorNum,
         count( DISTINCT a.behospital_code ) AS mrNum
         FROM
         med_behospital_info a,
@@ -1359,6 +1576,7 @@
         AND a.hospital_id = c.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
+        AND b.cases_id = c.cases_id
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         AND a.is_placefile = '1'
@@ -1789,17 +2007,17 @@
         h1.mrNum,
         h2.entryNum,
         h1.mrNum * h2.entryNum AS entryTotleNum,
-        ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
-        ROUND( h1.errorNum / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
-        CONCAT( ROUND( h1.emptyNum / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
-        CONCAT( ROUND( h1.errorNum /( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
+        ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
+        ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
+        CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
         FROM
         (
         SELECT
         CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
         CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
         sum( d.rule_type = 1 ) AS emptyNum,
-        round( sum( d.rule_type = 2 )/ 2, 0 ) AS errorNum,
+        sum( d.rule_type = 2 ) AS errorNum,
         count( DISTINCT a.behospital_code ) AS mrNum
         FROM
         med_behospital_info a,
@@ -1818,6 +2036,7 @@
         AND a.hospital_id = e.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
+        AND b.cases_id = c.cases_id
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         AND a.is_placefile = '1'

+ 20 - 3
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -149,7 +149,8 @@
         a.beh_dept_id,
         a.beh_dept_name
         ORDER  BY
-        percent DESC
+        percent DESC,
+        a.beh_dept_name ASC
     </select>
 
     <!-- 按模块统计质控缺陷数 -->
@@ -333,6 +334,9 @@
         GROUP BY
         e.id,
         e.NAME,
+        <if test="filterPageVO.isReject == null">
+            d.is_reject,
+        </if>
         e.cases_id,
         e.cases_name
         ) t1,
@@ -808,6 +812,9 @@
         e.NAME,
         a.beh_dept_id,
         a.beh_dept_name,
+        <if test="filterPageByDeptVO.isReject == null">
+             d.is_reject,
+        </if>
         e.cases_id,
         e.cases_name
         ) t1,
@@ -1436,7 +1443,12 @@
             AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
         </if>
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
-            AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            <if test="filterPageByDeptVO.doctorName=='未知'">
+                AND (a.doctor_name is null OR a.doctor_name='')
+            </if>
+            <if test="filterPageByDeptVO.doctorName!='未知'">
+                AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            </if>
         </if>
         <if test="filterPageByDeptVO.ruleType != null ">
             AND e.rule_type = #{filterPageByDeptVO.ruleType}
@@ -1506,7 +1518,12 @@
             AND a.beh_dept_name like CONCAT('%', #{filterPageByDeptVO.deptName},'%')
         </if>
         <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
-        AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            <if test="filterPageByDeptVO.doctorName=='未知'">
+                AND (a.doctor_name is null OR a.doctor_name='')
+            </if>
+            <if test="filterPageByDeptVO.doctorName!='未知'">
+                AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName},'%')
+            </if>
         </if>
         <if test="filterPageByDeptVO.ruleType != null ">
             AND e.rule_type = #{filterPageByDeptVO.ruleType}