Pārlūkot izejas kodu

解决平均分列表页无法排序bug

songxinlu 3 gadi atpakaļ
vecāks
revīzija
830b700282

+ 3 - 3
src/main/java/com/diagbot/dto/DoctorAverageStatisticsDTO.java

@@ -37,13 +37,13 @@ public class DoctorAverageStatisticsDTO implements Serializable {
     private Double averageValue = 0d;
 
     @ApiModelProperty(value = "甲级病历数")
-    private String firstLevelStrNum = "0";
+    private Integer firstLevelStrNum = 0;
 
     @ApiModelProperty(value = "乙级病历数")
-    private String secondLevelStrNum = "0";
+    private Integer secondLevelStrNum = 0;
 
     @ApiModelProperty(value = "丙级病历数")
-    private String thirdLevelStrNum = "0";
+    private Integer thirdLevelStrNum = 0;
 
 
 }

+ 6 - 0
src/main/java/com/diagbot/vo/DoctorAverageStatisticsVO.java

@@ -8,6 +8,7 @@ import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * @Description: 医生质控平均分页面统计-接口入参
@@ -46,4 +47,9 @@ public class DoctorAverageStatisticsVO extends Page implements Serializable {
 
     @ApiModelProperty(value = "医院id", hidden = true)
     private String hospitalId;
+
+    @ApiModelProperty(value = "升序")
+    private List<String> asc;
+    @ApiModelProperty(value = "降序")
+    private List<String> desc;
 }

+ 68 - 3
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -19795,9 +19795,9 @@
         CASE WHEN (a.beh_dept_id is null OR a.beh_dept_id = '' OR a.beh_dept_id = '-') THEN '-' ELSE a.beh_dept_id END AS deptId,
         CASE WHEN (a.beh_dept_name is null OR a.beh_dept_name = '' OR a.beh_dept_name = '-') THEN '-' ELSE a.beh_dept_name END AS deptName,
         ROUND( avg( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
-        SUM( c.`level` = '甲' ) AS firstLevelNum,
-        SUM( c.`level` = '乙' ) AS secondLevelNum,
-        SUM( c.`level` = '丙' ) AS thirdLevelNum
+        SUM( c.`level` = '甲' ) AS firstLevelStrNum,
+        SUM( c.`level` = '乙' ) AS secondLevelStrNum,
+        SUM( c.`level` = '丙' ) AS thirdLevelStrNum
         FROM
         med_behospital_info a,
         med_qcresult_info c
@@ -19939,6 +19939,71 @@
         AND t1.doctorName = t2.doctorName
         AND t1.deptId = t2.deptId
         AND t1.deptName = t2.deptName
+        <if test="doctorAverageStatisticsVO.asc !=null and doctorAverageStatisticsVO.asc.size > 0 and doctorAverageStatisticsVO.desc !=null and doctorAverageStatisticsVO.desc.size > 0">
+            order by
+            <foreach collection="doctorAverageStatisticsVO.asc" item="item" open=" " close=" " separator=",">
+                <choose>
+                    <when test='item=="doctorName"'>t1.doctorName</when>
+                    <when test='item=="deptId"'>t1.deptId</when>
+                    <when test='item=="deptName"'>t1.deptName</when>
+                    <when test='item=="averageValue"'>t1.averageValue</when>
+                    <when test='item=="firstLevelStrNum"'>t1.firstLevelStrNum</when>
+                    <when test='item=="secondLevelStrNum"'>t1.secondLevelStrNum</when>
+                    <when test='item=="thirdLevelStrNum"'>t1.thirdLevelStrNum</when>
+                    <when test='item=="entryNum"'>t2.entryNum</when>
+                    <otherwise>t1.doctorId</otherwise>
+                </choose>
+            </foreach>
+            asc,
+            <foreach collection="doctorAverageStatisticsVO.desc" item="item" open=" " close=" " separator=",">
+                <choose>
+                    <when test='item=="doctorName"'>t1.doctorName</when>
+                    <when test='item=="deptId"'>t1.deptId</when>
+                    <when test='item=="deptName"'>t1.deptName</when>
+                    <when test='item=="averageValue"'>t1.averageValue</when>
+                    <when test='item=="firstLevelStrNum"'>t1.firstLevelStrNum</when>
+                    <when test='item=="secondLevelStrNum"'>t1.secondLevelStrNum</when>
+                    <when test='item=="thirdLevelStrNum"'>t1.thirdLevelStrNum</when>
+                    <when test='item=="entryNum"'>t2.entryNum</when>
+                    <otherwise>t1.doctorId</otherwise>
+                </choose>
+            </foreach>
+            desc
+        </if>
+        <if test="doctorAverageStatisticsVO.asc !=null and doctorAverageStatisticsVO.asc.size > 0 and (doctorAverageStatisticsVO.desc ==null or doctorAverageStatisticsVO.desc.size == 0)">
+            order by
+            <foreach collection="doctorAverageStatisticsVO.asc" item="item" open=" " close=" " separator=",">
+                <choose>
+                    <when test='item=="doctorName"'>t1.doctorName</when>
+                    <when test='item=="deptId"'>t1.deptId</when>
+                    <when test='item=="deptName"'>t1.deptName</when>
+                    <when test='item=="averageValue"'>t1.averageValue</when>
+                    <when test='item=="firstLevelStrNum"'>t1.firstLevelStrNum</when>
+                    <when test='item=="secondLevelStrNum"'>t1.secondLevelStrNum</when>
+                    <when test='item=="thirdLevelStrNum"'>t1.thirdLevelStrNum</when>
+                    <when test='item=="entryNum"'>t2.entryNum</when>
+                    <otherwise>t1.doctorId</otherwise>
+                </choose>
+            </foreach>
+            asc
+        </if>
+        <if test="(doctorAverageStatisticsVO.asc ==null or doctorAverageStatisticsVO.asc.size == 0) and doctorAverageStatisticsVO.desc !=null and doctorAverageStatisticsVO.desc.size > 0">
+            order by
+            <foreach collection="doctorAverageStatisticsVO.desc" item="item" open=" " close=" " separator=",">
+                <choose>
+                    <when test='item=="doctorName"'>t1.doctorName</when>
+                    <when test='item=="deptId"'>t1.deptId</when>
+                    <when test='item=="deptName"'>t1.deptName</when>
+                    <when test='item=="averageValue"'>t1.averageValue</when>
+                    <when test='item=="firstLevelStrNum"'>t1.firstLevelStrNum</when>
+                    <when test='item=="secondLevelStrNum"'>t1.secondLevelStrNum</when>
+                    <when test='item=="thirdLevelStrNum"'>t1.thirdLevelStrNum</when>
+                    <when test='item=="entryNum"'>t2.entryNum</when>
+                    <otherwise>t1.doctorId</otherwise>
+                </choose>
+            </foreach>
+            desc
+        </if>
     </select>
 <!--    医生质控平均分-患者列表(等级)-->
     <select id="doctorAverageLevelPage" resultType="com.diagbot.dto.DoctorAverageLevelDTO">