Browse Source

指标报表配置优化

hsh 1 year ago
parent
commit
3041c0c579

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

@@ -6,10 +6,12 @@ import org.springframework.web.bind.annotation.GetMapping;
 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.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.highreport.HighReportDto;
 import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
+import thyyxxk.webserver.entity.highreport.TableDisplayInfo;
 import thyyxxk.webserver.entity.highreport.TableGroupInfo;
 import thyyxxk.webserver.entity.highreport.ZbReportResult;
 import thyyxxk.webserver.entity.highreport.ZdReportType;
@@ -149,4 +151,26 @@ public class TargetManagementController {
         return service.selectReportLevelDict();
     }
 
+    @GetMapping("/selectTargetZbReportId")
+    public ResultVo<List<Map<String, Object>>> selectTargetZbReportId(@RequestParam("reportType") String reportType) {
+        return service.selectTargetZbReportId(reportType);
+    }
+
+    @PostMapping("/selectTableDisplay")
+    public ResultVo<List<TableDisplayInfo>> selectTableDisplay(@RequestBody @Validated ReportBaseInfo info){
+        return service.selectTableDisplay(info);
+    }
+
+    @PostMapping("/saveTableDisplay")
+    public ResultVo<Map<String, Object>> saveTableDisplay(@RequestBody @Validated TableDisplayInfo info){
+        return service.saveTableDisplay(info);
+    }
+
+    @GetMapping("/delTableDisplayByProp")
+    public ResultVo<Map<String, Object>> delTableDisplayByCode(@RequestParam("reportId") String reportId,
+                                                               @RequestParam("levelId") String levelId,
+                                                               @RequestParam("prop") String prop){
+        return service.delTableDisplayByProp(reportId, levelId, prop);
+    }
+
 }

+ 82 - 0
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/TableDisplayInfoDao.java

@@ -0,0 +1,82 @@
+package thyyxxk.webserver.dao.his.targetmanagement;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.highreport.TableDisplayInfo;
+
+import java.util.List;
+
+/**
+ * @ClassName TableDisplayInfoDao
+ * @Author hsh
+ * @Date 2024/4/3 15:03
+ * @Version 1.0
+ * @Description 报表详情页面配置
+ **/
+@Mapper
+public interface TableDisplayInfoDao extends BaseMapper<TableDisplayInfo> {
+
+    @Select(" select * from table_display_info where flag = 'Y' and report_id = #{reportId} and level_id = #{levelId} order by sort ")
+    List<TableDisplayInfo> selectTableDisplayByReportId(@Param("reportId") String reportId, @Param("levelId") String levelId);
+
+    @Select(" select * from table_display_info where flag = 'Y' and report_id = #{reportId} and level_id = #{levelId} and prop = #{prop} ")
+    TableDisplayInfo selectTableDisplayByProp(@Param("reportId") String reportId, @Param("levelId") String levelId, @Param("prop") String prop);
+
+    @Update("<script>" +
+            "update table_display_info " +
+            "<trim prefix=\"set\" suffixOverrides=\",\">" +
+            "<if test=\"reportId != null and reportId != '' \">" +
+            "report_id = #{reportId}, " +
+            "</if>" +
+            "<if test=\"levelId != null and levelId != '' \">" +
+            "level_id = #{levelId}, " +
+            "</if>" +
+            "<if test=\"levelName != null and levelName != '' \">" +
+            "level_name = #{levelName}, " +
+            "</if>" +
+            "<if test=\"title != null and title != '' \">" +
+            "title = #{title}, " +
+            "</if>" +
+            "<if test=\"prop != null and prop != '' \">" +
+            "prop = #{prop}, " +
+            "</if>" +
+            "<if test=\"label != null and label != '' \">" +
+            "label = #{label}, " +
+            "</if>" +
+            "<if test=\"align != null and align != '' \">" +
+            "align = #{align}, " +
+            "</if>" +
+            "<if test=\"width != null and width != '' \">" +
+            "width = #{width}, " +
+            "</if>" +
+            "<if test=\"sortable != null and sortable != '' \">" +
+            "sortable = #{sortable}, " +
+            "</if>" +
+            "<if test=\"flag != null and flag != '' \">" +
+            "flag = #{flag}, " +
+            "</if>" +
+            "<if test=\"isShow != null and isShow != '' \">" +
+            "is_show = #{isShow}, " +
+            "</if>" +
+            "<if test=\"sort != null and sort != '' \">" +
+            "sort = #{sort}, " +
+            "</if>" +
+            "<if test=\"id != null and id != '' \">" +
+            "id = #{id}, " +
+            "</if>" +
+            "<if test=\"pid != null and pid != '' \">" +
+            "pid = #{pid}, " +
+            "</if>" +
+            "</trim>" +
+            "where report_id = #{reportId} and level_id = #{levelId} and prop = #{prop} " +
+            "</script>")
+    int updateTableDisplayByProp(TableDisplayInfo info);
+
+    @Delete(" delete from table_display_info where report_id = #{reportId} and level_id = #{levelId} and prop = #{prop} ")
+    int delTableDisplayByProp(@Param("reportId") String reportId, @Param("levelId") String levelId, @Param("prop") String prop);
+
+}

+ 13 - 0
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/TargetManagementDao.java

@@ -7,6 +7,9 @@ import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * @description: 指标管理
  * @author: hsh
@@ -44,4 +47,14 @@ public interface TargetManagementDao extends BaseMapper<ReportBaseInfo> {
             "</script> ")
     ReportBaseInfo selectReportBaseInfoByCalcId(@Param("calcId") String calcId);
 
+    /**
+     * @Description 查询指标报表的所有id以及名称
+     * @Author hsh
+     * @param reportType 报表类型
+     * @return list
+     * @Date 2024/4/1 16:49
+     */
+    @Select(" select report_name as name, report_id as 'code' from report_base_info where flag = 'Y' and report_type = #{reportType} ")
+    List<Map<String, Object>> selectTargetZbReportId(@Param("reportType") String reportType);
+
 }

+ 5 - 9
src/main/java/thyyxxk/webserver/entity/highreport/ReportType.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.entity.highreport;
 
+import lombok.Getter;
 import org.jetbrains.annotations.Nullable;
 import thyyxxk.webserver.utils.StringUtil;
 
@@ -11,6 +12,7 @@ import java.util.List;
  * @author: hsh
  * @date: 2022/11/2 10:56
  **/
+@Getter
 public enum ReportType {
     ONE("1", "单个菜单"),
 
@@ -36,7 +38,9 @@ public enum ReportType {
 
     GROUP_ZB("group_zb", "指标"),
 
-    GROUP_KS("group_ks", "科室");
+    GROUP_KS("group_ks", "科室"),
+
+    DISPLAY_ZB("comm_report", "公共指标");
 
     private final String code;
     private final String name;
@@ -46,14 +50,6 @@ public enum ReportType {
         this.name = name;
     }
 
-    public String getCode() {
-        return code;
-    }
-
-    public String getName() {
-        return name;
-    }
-
     public static @Nullable String find(String code) {
         if (StringUtil.isBlank(code)) {
             return null;

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/highreport/TableDisplayInfo.java

@@ -29,6 +29,7 @@ public class TableDisplayInfo {
     private String width;
     private String sortable;
     private String flag;
+    private String isShow;
     private Integer sort;
     /**
      * 表格行id

+ 92 - 1
src/main/java/thyyxxk/webserver/service/targetmanagement/TargetManagementService.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.highreport.HighReportDao;
+import thyyxxk.webserver.dao.his.targetmanagement.TableDisplayInfoDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TableGroupInfoDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TargetManagementDao;
 import thyyxxk.webserver.dao.his.targetmanagement.ZbZdBaseInfoDao;
@@ -13,6 +14,7 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.highreport.HighReportDto;
 import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 import thyyxxk.webserver.entity.highreport.ReportType;
+import thyyxxk.webserver.entity.highreport.TableDisplayInfo;
 import thyyxxk.webserver.entity.highreport.TableGroupInfo;
 import thyyxxk.webserver.entity.highreport.ZbReportResult;
 import thyyxxk.webserver.entity.highreport.ZdReportType;
@@ -57,13 +59,17 @@ public class TargetManagementService {
 
     private final TableGroupInfoDao tableDao;
 
+    private final TableDisplayInfoDao displayDao;
+
     @Autowired
-    public TargetManagementService(TargetManagementDao dao, ZbZdBaseInfoDao zbZdDao, HighReportDao reportDao, RedisLikeService redis, TableGroupInfoDao tableDao) {
+    public TargetManagementService(TargetManagementDao dao, ZbZdBaseInfoDao zbZdDao, HighReportDao reportDao,
+                                   RedisLikeService redis, TableGroupInfoDao tableDao, TableDisplayInfoDao displayDao) {
         this.dao = dao;
         this.zbZdDao = zbZdDao;
         this.reportDao = reportDao;
         this.redis = redis;
         this.tableDao = tableDao;
+        this.displayDao = displayDao;
     }
 
     /**
@@ -800,4 +806,89 @@ public class TargetManagementService {
         List<Map<String, Object>> list = tableDao.selectReportLevelDict();
         return ResultVoUtil.success(list);
     }
+
+    /**
+     * @Description 查询指标报表的所有id以及名称
+     * @Author hsh
+     * @param reportType 指标报表类型
+     * @return list
+     * @Date 2024/4/8 10:15
+     */
+    public ResultVo<List<Map<String, Object>>> selectTargetZbReportId(String reportType) {
+        List<Map<String, Object>> list = dao.selectTargetZbReportId(reportType);
+        return ResultVoUtil.success(list);
+    }
+
+    /**
+     * @Description 查询指标报表详情配置
+     * @Author hsh
+     * @param info 指标报表信息
+     * @return list
+     * @Date 2024/4/8 10:16
+     */
+    public ResultVo<List<TableDisplayInfo>> selectTableDisplay(ReportBaseInfo info) {
+        return ResultVoUtil.success(displayDao.selectTableDisplayByReportId(info.getReportId(), "patient"));
+    }
+
+    /**
+     * @Description 更新指标报表详情配置信息
+     * @Author hsh
+     * @param info 指标报表详情配置信息
+     * @return map
+     * @Date 2024/4/8 10:16
+     */
+    public ResultVo<Map<String, Object>> saveTableDisplay(TableDisplayInfo info){
+
+        if(null == info || info.getReportId() == null || info.getLevelId() == null || info.getProp() == null){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标报表详情配置信息不存在,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        String reportId = info.getReportId();
+        String levelId = info.getLevelId();
+        String prop = info.getProp();
+        TableDisplayInfo displayInfo = displayDao.selectTableDisplayByProp(reportId, levelId, prop);
+
+        int num;
+        try{
+            if(null != displayInfo){
+                num = displayDao.updateTableDisplayByProp(info);
+            } else {
+                num = displayDao.insert(info);
+            }
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存指标报表详情配置失败!");
+            }
+            resultMap.put("cg", "保存指标报表详情配置成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存指标报表详情配置失败!");
+        }
+    }
+
+    /**
+     * @Description 根据指标报表详情配置prop删除指标报表详情配置信息
+     * @Author hsh
+     * @param reportId,levelId,prop 报表id,报表等级id,报表配置prop属性
+     * @return map
+     * @Date 2024/4/8 10:17
+     */
+    public ResultVo<Map<String, Object>> delTableDisplayByProp(String reportId, String levelId, String prop) {
+        if(reportId == null || levelId == null || prop == null){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标报表详情配置信息不存在,请检查!");
+        }
+
+        Map<String, Object> resultMap = new HashMap<>();
+        try{
+            int num = displayDao.delTableDisplayByProp(reportId, levelId, prop);
+            if(num == 0){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除指标报表详情配置信息失败!");
+            }
+            resultMap.put("cg", "删除指标报表详情配置信息成功!");
+            return ResultVoUtil.success(resultMap);
+        } catch(Exception e){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除指标报表详情配置信息失败!");
+        }
+    }
+
 }