Explorar el Código

平均住院天数/平均住院费用统计

zhaops hace 5 años
padre
commit
25a17cedaf

+ 3 - 4
src/main/java/com/diagbot/aggregate/MrStatisticsAggregate.java

@@ -118,7 +118,7 @@ public class MrStatisticsAggregate {
         BeanUtil.copyProperties(filterVO, qcresultFilterVO);
 
         int totleNum = qcresultInfoFacade.resultCount(qcresultFilterVO);
-        if (totleNum == 0){
+        if (totleNum == 0) {
             return retList;
         }
         qcresultFilterVO.setLevel("甲");
@@ -155,9 +155,8 @@ public class MrStatisticsAggregate {
         thirdLevelNumDTO.setName("丙级病历");
         thirdLevelNumDTO.setNum(thirdLevelNum);
         thirdLevelNumDTO.setTotleNum(totleNum);
-        Double thirdPercent = BigDecimal.valueOf(1)
-                .subtract(BigDecimal.valueOf(firstPercent))
-                .subtract(BigDecimal.valueOf(secondPercent))
+        Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
+                .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
         thirdLevelNumDTO.setPercent(thirdPercent);

+ 5 - 3
src/main/java/com/diagbot/aggregate/ResultStatisticsAggregate.java

@@ -183,8 +183,8 @@ public class ResultStatisticsAggregate {
                         otherNumDTO.setName("其他");
                         otherNumDTO.setNum(num);
                         otherNumDTO.setTotleNum(totle);
-                        Double percent = BigDecimal.valueOf(1)
-                                .subtract(BigDecimal.valueOf(sumPercent))
+                        Double percent = BigDecimal.valueOf(num)
+                                .divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
                                 .doubleValue();
                         otherNumDTO.setPercent(percent);
                         String percentStr
@@ -241,7 +241,9 @@ public class ResultStatisticsAggregate {
                 NumDTO otherNumDTO = new NumDTO();
                 otherNumDTO.setName("其他");
                 otherNumDTO.setNum(num);
-                otherNumDTO.setPercent(BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(rate)).doubleValue());
+                otherNumDTO.setPercent(BigDecimal.valueOf(num)
+                        .divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
+                        .doubleValue());
                 retList.add(otherNumDTO);
             }
             retList.forEach(result -> {

+ 6 - 8
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -5,7 +5,6 @@ import com.diagbot.dto.DeptBaseDTO;
 import com.diagbot.dto.DeptNumDTO;
 import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.NumDTO;
-import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EntityUtil;
@@ -209,9 +208,8 @@ public class ConsoleByDeptFacade {
             thirdLevelNumDTO.setName("丙级病历");
             thirdLevelNumDTO.setNum(thirdLevelNum);
             thirdLevelNumDTO.setTotleNum(totleNum);
-            Double thirdPercent = BigDecimal.valueOf(1)
-                    .subtract(BigDecimal.valueOf(firstPercent))
-                    .subtract(BigDecimal.valueOf(secondPercent))
+            Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
+                    .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
                     .doubleValue();
             String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
             thirdLevelNumDTO.setPercent(thirdPercent);
@@ -411,8 +409,8 @@ public class ConsoleByDeptFacade {
                             otherNumDTO.setName("其他");
                             otherNumDTO.setNum(num);
                             otherNumDTO.setTotleNum(totle);
-                            Double percent = BigDecimal.valueOf(1)
-                                    .subtract(BigDecimal.valueOf(sumPercent))
+                            Double percent = BigDecimal.valueOf(num)
+                                    .divide(BigDecimal.valueOf(totle), 4, RoundingMode.HALF_UP)
                                     .doubleValue();
                             otherNumDTO.setPercent(percent);
                             String percentStr
@@ -691,8 +689,8 @@ public class ConsoleByDeptFacade {
         String firstLevelPercentStr
                 = df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
         Integer secondLevelNum = mrNum - firstLevelNum;
-        Double secondLevelPercent = BigDecimal.valueOf(1)
-                .subtract(BigDecimal.valueOf(firstLevelPercent))
+        Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
+                .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String secondLevelPercentStr
                 = df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";

+ 2 - 2
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -561,8 +561,8 @@ public class ConsoleFacade {
         String firstLevelPercentStr
                 = df.format(BigDecimal.valueOf(firstLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";
         Integer secondLevelNum = mrNum - firstLevelNum;
-        Double secondLevelPercent = BigDecimal.valueOf(1)
-                .subtract(BigDecimal.valueOf(firstLevelPercent))
+        Double secondLevelPercent = BigDecimal.valueOf(secondLevelNum)
+                .divide(BigDecimal.valueOf(mrNum), 4, RoundingMode.HALF_UP)
                 .doubleValue();
         String secondLevelPercentStr
                 = df.format(BigDecimal.valueOf(secondLevelPercent).multiply(BigDecimal.valueOf(100))) + "%";

+ 3 - 1
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.List;
 import java.util.Map;
@@ -115,7 +116,7 @@ public class ConsoleByDeptController {
     @ApiOperation(value = "条目缺陷占比-科室(分页)-内页[by:zhaops]",
             notes = "type: 统计维度 1-本月,2-本年(必填)<br>" +
                     "name: 缺陷名称<br>" +
-                    "deptName: 科室名称(必填)<br>"+
+                    "deptName: 科室名称(必填)<br>" +
                     "casesId: 模块id:243=病案首页 <br>")
     @PostMapping("/entryCountGroupByEntryAndDeptPage")
     @SysLogger("entryCountGroupByEntryAndDeptPage")
@@ -131,6 +132,7 @@ public class ConsoleByDeptController {
                     "doctorName: 医生名称(必填)<br>")
     @PostMapping("/resultStatisticsByDeptAndDoctorPage")
     @SysLogger("resultStatisticsByDeptAndDoctorPage")
+    @ApiIgnore
     public RespDTO<IPage<DeptNumDTO>> resultStatisticsByDeptAndDoctorPage(@RequestBody FilterPageByDeptVO filterPageByDeptVO) {
         IPage<DeptNumDTO> data = consoleByDeptFacade.resultStatisticsByDeptAndDoctorPage(filterPageByDeptVO);
         return RespDTO.onSuc(data);

+ 12 - 2
src/main/resources/mapper/HomePageMapper.xml

@@ -225,7 +225,12 @@
         WHERE
         a.is_deleted = 'N'
         AND a.station = '住院'
-        AND a.hospital_id = 1
+        <if test="filterPageByAverageVO.hospitalId != null and filterPageByAverageVO.hospitalId != ''">
+            AND a.hospital_id = #{filterPageByAverageVO.hospitalId}
+        </if>
+        <if test="filterPageByAverageVO.name != null and filterPageByAverageVO.name != ''">
+            AND a.dept_name like CONCAT('%', #{filterPageByAverageVO.name},'%')
+        </if>
         ) dept
         LEFT JOIN (
         SELECT
@@ -358,7 +363,12 @@
         WHERE
         a.is_deleted = 'N'
         AND a.station = '住院'
-        AND a.hospital_id = 1
+        <if test="filterPageByAverageVO.hospitalId != null and filterPageByAverageVO.hospitalId != ''">
+            AND a.hospital_id = #{filterPageByAverageVO.hospitalId}
+        </if>
+        <if test="filterPageByAverageVO.name != null and filterPageByAverageVO.name != ''">
+            AND a.dept_name like CONCAT('%', #{filterPageByAverageVO.name},'%')
+        </if>
         ) dept
         LEFT JOIN (
         SELECT