Quellcode durchsuchen

新增指标得分汇总

hsh vor 10 Monaten
Ursprung
Commit
c122f71a4b

+ 10 - 0
src/main/java/thyyxxk/webserver/controller/targetmanagement/TargetManagementController.java

@@ -227,4 +227,14 @@ public class TargetManagementController {
         return service.selectTargetReportMonthScore(dto);
     }
 
+    @PostMapping("/selectTargetYearScoreSummary")
+    public ResultVo<List<Map<String, Object>>> selectTargetYearScoreSummary(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetYearScoreSummary(dto);
+    }
+
+    @PostMapping("/selectTargetMonthScoreSummary")
+    public ResultVo<List<ZbReportMonthScore>> selectTargetMonthScoreSummary(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetMonthScoreSummary(dto);
+    }
+
 }

+ 54 - 2
src/main/java/thyyxxk/webserver/dao/his/highreport/HighReportDao.java

@@ -14,6 +14,7 @@ import thyyxxk.webserver.entity.highreport.XYBean;
 import thyyxxk.webserver.entity.highreport.ZbReportMonthScore;
 import thyyxxk.webserver.entity.highreport.ZbReportResult;
 import thyyxxk.webserver.entity.highreport.ZdReportType;
+import thyyxxk.webserver.entity.targetmanagement.TargetManagement;
 
 import java.util.List;
 import java.util.Map;
@@ -125,9 +126,9 @@ public interface HighReportDao {
 
     @Insert("<script>" +
     " insert into zb_report_result " +
-    " (id, pid, year, data_type, child_result, mom_result, calc_result, op, op_id, op_time) values " +
+    " (id, pid, year, data_type, child_result, mom_result, calc_result, op, op_id, op_time, report_cycle) values " +
     " (#{id},#{pid},#{year},#{dataType},#{childResult}, " +
-    " #{momResult},#{calcResult},#{op},#{opId},#{opTime} " +
+    " #{momResult},#{calcResult},#{op},#{opId},#{opTime},#{reportCycle}  " +
     " ) " +
     "</script>")
     int saveTargetReportResult(ZbReportResult result);
@@ -214,4 +215,55 @@ public interface HighReportDao {
             "</script>")
     int saveTargetReportMonthResult(ZbReportMonthScore score);
 
+    @Select("<script>" +
+            "select info.id, info.pid, info.name, info.dept, info.dept_code, info.op, info.op_id, info.op, info.op_id as opId, " +
+            " f.report_cycle as reportCycle, f.report_score as reportScore, f. criterion_score as criterionScore, " +
+            " f.year_range as yearRange, f.remark " +
+            "from zb_zd_base_info info " +
+            "left join (select score.*, cycle.year_range, cycle.remark " +
+            " from zb_report_cycle_score score, zb_report_cycle cycle " +
+            " where score.report_cycle = cycle.report_cycle and cycle.report_cycle = #{reportCycle}) f on info.id = f.id " +
+            "where info.state = 'Y' and info.is_leaf = '1' " +
+            " <if test=\"dept != null and dept != '' \"> " +
+            " and info.dept_code = #{dept} " +
+            " </if> " +
+            " <if test=\"id != null and id != '' \"> " +
+            " and info.id = #{id} " +
+            " </if> " +
+            " order by len(case when charindex('-', info.sort) = 0 then info.sort else substring(info.sort,1,charindex('-',info.sort)-1) end) " +
+            "</script>")
+    List<Map<String, Object>> selectTargetCycleScore(TargetManagement dto);
+
+    @Select("<script>" +
+            "select r.* from zb_report_result r " +
+            " where r.report_cycle = #{reportCycle} " +
+            " <if test=\"id != null and id != '' \"> " +
+            " and r.id = #{id} " +
+            " </if> " +
+            " <if test=\"pid != null and pid != '' \"> " +
+            " and r.pid = #{id} " +
+            " </if> " +
+            "</script>")
+    List<ZbReportResult> selectTargetReportResultByCycle(@Param("reportCycle") String reportCycle, @Param("id") String id, @Param("pid") String pid);
+
+    @Select("<script>" +
+            " select zb.* from zb_report_month_score zb " +
+            " where 1 = 1" +
+            " <if test=\"id != null and id != '' \"> " +
+            " and zb.id = #{id} " +
+            " </if> " +
+            " <if test=\"pid != null and pid != '' \"> " +
+            " and zb.pid = #{pid} " +
+            " </if> " +
+            " <if test=\"dept != null and dept != '' \"> " +
+            " and zb.dept_id = #{dept} " +
+            " </if> " +
+            " <if test=\"startTime != null and startTime != '' \"> " +
+            " and zb.month &gt;= #{startTime} " +
+            " </if> " +
+            " <if test=\"endTime != null and endTime != '' \"> " +
+            " and zb.month &lt;= #{endTime} " +
+            " </if> " +
+            "</script>")
+    List<ZbReportMonthScore> selectTargetMonthScoreSummary(TargetManagement dto);
 }

+ 5 - 0
src/main/java/thyyxxk/webserver/entity/highreport/ZbReportResult.java

@@ -1,5 +1,7 @@
 package thyyxxk.webserver.entity.highreport;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -13,6 +15,7 @@ import lombok.Data;
 @TableName("zb_report_result")
 public class ZbReportResult {
 
+    @TableId(value = "id", type = IdType.NONE)
     private String id;
     private String pid;
     private String year;
@@ -26,5 +29,7 @@ public class ZbReportResult {
     private String op;
     private String opId;
     private String opTime;
+    // 年度周期
+    private String reportCycle;
 
 }

+ 2 - 1
src/main/java/thyyxxk/webserver/entity/targetmanagement/TargetManagement.java

@@ -41,5 +41,6 @@ public class TargetManagement {
     private String gatherSql;
     // 报表基础sql
     private String baseSql;
-
+    // 指标年度周期
+    private String reportCycle;
 }

+ 34 - 0
src/main/java/thyyxxk/webserver/service/targetmanagement/TargetManagementService.java

@@ -1248,4 +1248,38 @@ public class TargetManagementService {
         return ResultVoUtil.success(score);
     }
 
+    /**
+     * @Description 查询指标周期年度得分汇总情况
+     * @Author hsh
+     * @param dto 指标参数
+     * @return list
+     * @Date 2024/11/26 14:56
+     */
+    public ResultVo<List<Map<String, Object>>> selectTargetYearScoreSummary(TargetManagement dto) {
+        List<Map<String, Object>> list = reportDao.selectTargetCycleScore(dto);
+        List<ZbReportResult> resultList = reportDao.selectTargetReportResultByCycle(dto.getReportCycle(), dto.getId(), dto.getPid());
+        if(null != list && null != resultList && !list.isEmpty() && !resultList.isEmpty()){
+            Map<String, List<ZbReportResult>> resultMap = resultList.stream().collect(Collectors.groupingBy(ZbReportResult::getId));
+            for(Map<String, Object> map : list){
+                String id = String.valueOf(map.get("id"));
+                List<ZbReportResult> results = resultMap.get(id);
+                if(null != results && !results.isEmpty()){
+                    map.put("results", results);
+                }
+            }
+        }
+        return ResultVoUtil.success(list);
+    }
+
+    /**
+     * @Description 查询指标周期月度得分汇总情况
+     * @Author hsh
+     * @param dto 指标参数
+     * @return list
+     * @Date 2024/11/27 16:51
+     */
+    public ResultVo<List<ZbReportMonthScore>> selectTargetMonthScoreSummary(TargetManagement dto) {
+        return ResultVoUtil.success(reportDao.selectTargetMonthScoreSummary(dto));
+    }
+
 }