Jelajahi Sumber

Merge branch 'master' of https://172.16.32.165/lighter/web-server

xiaochan 2 tahun lalu
induk
melakukan
0247fe864f

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

@@ -42,6 +42,11 @@ public class TargetManagementController {
         return service.selectTargetDict(dto);
     }
 
+    @PostMapping("/selectTargetDictById")
+    public ResultVo<ZbZdBaseInfo> selectTargetDictById(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetDictById(dto);
+    }
+
     @PostMapping("/saveTargetDict")
     public ResultVo<Map<String, Object>> saveTargetDict(@RequestBody @Validated ZbZdBaseInfo dto){
         return service.saveTargetDict(dto);
@@ -62,8 +67,24 @@ public class TargetManagementController {
         return service.targetSqlExecute(dto);
     }
 
+    @PostMapping("/targetSqlExecuteById")
+    public ResultVo<Map<String, Object>> targetSqlExecuteById(@RequestBody @Validated TargetManagement dto){
+        return service.targetSqlExecuteById(dto);
+    }
+
     @PostMapping("/targetSqlSave")
     public ResultVo<Map<String, Object>> targetSqlSave(@RequestBody @Validated TargetManagement dto){
         return service.targetSqlSave(dto);
     }
+
+    @PostMapping("/selectTargetSql")
+    public ResultVo<Map<String, Object>> selectTargetSql(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetSql(dto);
+    }
+
+    @PostMapping("/selectTargetSqlDetail")
+    public ResultVo<Map<String, Object>> selectTargetSqlDetail(@RequestBody @Validated TargetManagement dto){
+        return service.selectTargetSqlDetail(dto);
+    }
+
 }

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/inpatient/casefrontsheet/CaseFrontSheetDao.java

@@ -545,6 +545,9 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     Integer selectFileStatus(@Param("bah") String bah,
                              @Param("admissTimes") Integer admissTimes);
 
+    @Select("select role_id from dj_user_role where user_code=#{code}")
+    List<Integer> getUserRoles(@Param("code") String code);
+
     @Select("select rtrim(dept_code) from a_employee_mi where code=#{code}")
     String selectUserDept(@Param("code") String code);
 

+ 26 - 12
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/TargetManagementDao.java

@@ -1,10 +1,10 @@
 package thyyxxk.webserver.dao.his.targetmanagement;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Insert;
 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.ReportBaseInfo;
 
 /**
@@ -18,16 +18,30 @@ public interface TargetManagementDao extends BaseMapper<ReportBaseInfo> {
     @Select("<script> ${sql} </script>")
     String targetSqlExecute(@Param("sql") String sql);
 
-    @Insert({"<script>" +
-            "insert into report_base_info " +
-            "(report_id, report_name, report_type, unit, level, " +
-            "gather_sql, base_sql, display_type, flag, menu_id, sort, " +
-            "report_sort, is_cw, is_yj, calc_child, calc_mom) values " +
-            "(#{reportId},#{reportName},#{reportType},#{unit},#{level}, " +
-            "#{gatherSql},#{baseSql},#{displayType},#{flag},#{menuId},#{sort}, " +
-            "#{reportSort},#{isCw},#{isYj},'${calcChild}','${calcMom}' " +
-            ") " +
-            "</script>"})
-    int targetSqlSave(ReportBaseInfo report);
+    @Update(" delete from report_base_info where report_id = #{reportId} ")
+    void deleteReportBaseInfoById(@Param("reportId") String reportId);
+
+    @Select("<script> " +
+            " select * from report_base_info where flag = 'Y' and report_type = 'zb' " +
+            " <if test=\"id != null and id != '' \"> " +
+            " and report_id = #{id} " +
+            " </if> " +
+            " <if test=\"pid != null and pid != '' \"> " +
+            " and level = #{pid} " +
+            " </if> " +
+            "</script> ")
+    ReportBaseInfo selectReportBaseInfoById(@Param("id") String id, @Param("pid") String pid);
+
+    /**
+     * @description: 根据指标字典配置的指标报表id查询指标报表详情
+     * @author: hsh
+     * @date: 2023/7/5 10:38
+     * @param: [calcId]
+     * @return: ReportBaseInfo
+     **/
+    @Select("<script> " +
+            " select * from report_base_info where flag = 'Y' and report_type = 'zb' and report_id = #{calcId} " +
+            "</script> ")
+    ReportBaseInfo selectReportBaseInfoByCalcId(@Param("calcId") String calcId);
 
 }

+ 16 - 8
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/ZbZdBaseInfoDao.java

@@ -20,10 +20,7 @@ import java.util.List;
 public interface ZbZdBaseInfoDao {
 
     @Select("<script> " +
-            "select rt.calc_child, rt.calc_mom, zb.* " +
-            "from zb_zd_base_info zb " +
-            "left join report_base_info rt " +
-            "on rt.flag = 'Y' and zb.id = rt.report_id and zb.pid = rt.level " +
+            "select zb.* from zb_zd_base_info zb " +
             "where zb.state = 'Y' " +
             "<if test='id != null'> " +
             " and zb.id = #{id} " +
@@ -35,10 +32,7 @@ public interface ZbZdBaseInfoDao {
     List<ZbZdBaseInfo> selectZbZdBaseInfo(TargetManagement dto);
 
     @Select("<script> " +
-            "select rt.calc_child, rt.calc_mom, zb.* " +
-            "from zb_zd_base_info zb " +
-            "left join report_base_info rt " +
-            "on rt.flag = 'Y' and zb.id = rt.report_id and zb.pid = rt.level " +
+            "select zb.* from zb_zd_base_info zb " +
             "where zb.state = 'Y' " +
             " and zb.id = #{id} " +
             " and zb.pid = #{pid} " +
@@ -134,4 +128,18 @@ public interface ZbZdBaseInfoDao {
             "</script>")
     int deleteTargetDictById(@Param("id") String id, @Param("pid") String pid);
 
+
+    @Update("<script> " +
+            " update zb_zd_base_info " +
+            "<trim prefix=\"set\" suffixOverrides=\",\">" +
+            "<if test=\"childId != null\">" +
+            "child_id = #{childId}, " +
+            "</if>" +
+            "<if test=\"momId != null \">" +
+            "mom_id = #{momId}, " +
+            "</if>" +
+            "</trim>" +
+            " where id = #{id} and pid = #{pid} and state = 'Y' " +
+            "</script>")
+    void updateZbZdBaseInfoCalcId(@Param("id") String id, @Param("pid") String pid, @Param("childId") String calcId, @Param("momId") String momId);
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/entity/highreport/HighReportDto.java

@@ -28,6 +28,14 @@ public class HighReportDto {
      * 诊断
      **/
     private String diagn;
+    /**
+     * 住院号
+     **/
+    private String zyh;
+    /**
+     * 姓名
+     **/
+    private String xm;
     /**
      * 页面层级:1,2,3,4。。。与table_display_info表sort对应
      **/

+ 14 - 0
src/main/java/thyyxxk/webserver/entity/targetmanagement/TargetManagement.java

@@ -21,7 +21,21 @@ public class TargetManagement {
     private String dept;
     private String source;
     private String isLeaf;
+    // 指标分子sql
     private String calcChild;
+    // 指标分母sql
     private String calcMom;
+    // 指标分子id
+    private String childId;
+    // 指标分母id
+    private String momId;
+    // 指标分子名称
+    private String childName;
+    // 指标分母名称
+    private String momName;
+    // 指标分子聚合函数
+    private String childGather;
+    // 指标分母聚合函数
+    private String momGather;
 
 }

+ 8 - 0
src/main/java/thyyxxk/webserver/entity/targetmanagement/ZbZdBaseInfo.java

@@ -86,6 +86,14 @@ public class ZbZdBaseInfo {
      * 是否是叶子节点(即最后节点 0:否,1:是)
      **/
     private String isLeaf;
+    /**
+     * 计算分子sql的指标id
+     **/
+    private String childId;
+    /**
+     * 计算分母sql的指标id
+     **/
+    private String momId;
     /**
      * 计算分子sql
      **/

+ 5 - 3
src/main/java/thyyxxk/webserver/service/inpatient/casefrontsheet/CaseFrontSheetMainService.java

@@ -687,9 +687,11 @@ public class CaseFrontSheetMainService {
         CaseFrontsheetMain sheet = param.getSheet();
         Integer status = dao.selectFileStatus(sheet.getBah(), sheet.getAdmissTimes());
         if (null != status && status == 1) {
-            String userCode = TokenUtil.getTokenUserId();
-            String userDept = dao.selectUserDept(userCode);
-            if (!userDept.equals("2100000") && !userCode.equals("01897")) {
+            List<Integer> roles = dao.getUserRoles(param.getStaffId());
+            if (roles.contains(60)) {
+                return ResultVoUtil.success();
+            }
+            if (!roles.contains(7)) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "已最终归档病案首页无法打印!");
             }
         }

+ 178 - 23
src/main/java/thyyxxk/webserver/service/targetmanagement/TargetManagementService.java

@@ -8,6 +8,7 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.targetmanagement.TargetManagementDao;
 import thyyxxk.webserver.dao.his.targetmanagement.ZbZdBaseInfoDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.highreport.HighReportDto;
 import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 import thyyxxk.webserver.entity.targetmanagement.TargetDictTree;
 import thyyxxk.webserver.entity.targetmanagement.TargetManagement;
@@ -55,6 +56,18 @@ public class TargetManagementService {
         return ResultVoUtil.success(list);
     }
 
+    /**
+     * @description: 根据id查询指标字典基本信息
+     * @author: hsh
+     * @date: 2023/7/5 10:58
+     * @param: [dto]
+     * @return: ResultVo<ZbZdBaseInfo>
+     **/
+    public ResultVo<ZbZdBaseInfo> selectTargetDictById(TargetManagement dto) {
+        ZbZdBaseInfo info = zbZdDao.selectZbZdBaseInfoById(dto);
+        return ResultVoUtil.success(info);
+    }
+
     /**
      * @description: 查询指标树
      * @author: hsh
@@ -178,13 +191,15 @@ public class TargetManagementService {
                 message = "指标计分细则不存在,请检查!";
             }
             if(StringUtil.notBlank(sqlChild)){
-                if(sqlChild.contains("drop") || sqlChild.contains("truncate") || sqlChild.contains("delete")  || sqlChild.contains("update")){
+                if(sqlChild.contains("drop") || sqlChild.contains("truncate") || sqlChild.contains("delete")  || sqlChild.contains("update")
+                    || sqlChild.contains("DROP") || sqlChild.contains("TRUNCATE") || sqlChild.contains("DELETE")  || sqlChild.contains("UPDATE")){
                     log.info("保存指标字典失败,分子sql语句存在非查询语句关键字,请检查!");
                     message = "保存指标字典失败,分子sql语句存在非查询语句关键字,请检查!";
                 }
             }
             if(StringUtil.notBlank(sqlMom)){
-                if(sqlMom.contains("drop") || sqlMom.contains("truncate") || sqlMom.contains("delete")  || sqlMom.contains("update")){
+                if(sqlMom.contains("drop") || sqlMom.contains("truncate") || sqlMom.contains("delete")  || sqlMom.contains("update")
+                    || sqlMom.contains("DROP") || sqlMom.contains("TRUNCATE") || sqlMom.contains("DELETE")  || sqlMom.contains("UPDATE")){
                     log.info("保存指标字典失败,分母sql语句存在非查询语句关键字,请检查!");
                     message = "保存指标字典失败,分母sql语句存在非查询语句关键字,请检查!";
                 }
@@ -193,6 +208,13 @@ public class TargetManagementService {
         return message;
     }
 
+    /**
+     * @description: 查询分子分母指标报表结果
+     * @author: hsh
+     * @date: 2023/7/6 9:31
+     * @param: [dto]
+     * @return: ResultVo<Map<String,Object>>
+     **/
     public ResultVo<Map<String, Object>> targetSqlExecute(TargetManagement dto) {
         String sqlChild = dto.getCalcChild();
         String sqlMom = dto.getCalcMom();
@@ -212,12 +234,75 @@ public class TargetManagementService {
         }
 
         // 转换sql的查询条件
-        ReportUtil.callSqlFormatTarget(dto);
+        Map<String, ReportBaseInfo> map = ReportUtil.assertReportForTarget(dto);
+        ReportBaseInfo r1 = map.get("calcChild");
+        ReportBaseInfo r2 = map.get("calcMom");
+
+        // 转换查询dto
+        HighReportDto d = ReportUtil.TargetManagementConvertHighReportDto(dto);
+
+        // 计算结果
+        Map<String, Object> resultMap = new HashMap<>();
+        String child = null;
+        String mom = null;
+        if(r1 != null){
+            String childSql = ReportUtil.callSqlFormat(d, r1.getBaseSql(), r1.getGatherSql(), null, null, null);
+            child = dao.targetSqlExecute(childSql);
+        }
+        if(r2 != null){
+            String momSql = ReportUtil.callSqlFormat(d, r2.getBaseSql(), r2.getGatherSql(), null, null, null);
+            mom = dao.targetSqlExecute(momSql);
+        }
+
+        if (StringUtil.notBlank(child)) {
+            resultMap.put("r1", child);
+        } else {
+            resultMap.put("r1", "无");
+        }
+        if (StringUtil.notBlank(mom)) {
+            resultMap.put("r2", mom);
+            resultMap.put("r3", DecimalUtil.divide(new BigDecimal(child), new BigDecimal(mom), 2));
+        } else {
+            resultMap.put("r2", "无");
+            if (StringUtil.notBlank(child)) {
+                resultMap.put("r3", child);
+            } else {
+                resultMap.put("r3", "无");
+            }
+        }
+        return ResultVoUtil.success(resultMap);
+    }
+
+    /**
+     * @description: 根据id查询分子分母指标报表结果
+     * @author: hsh
+     * @date: 2023/7/6 9:30
+     * @param: [dto]
+     * @return: ResultVo<Map<String,Object>>
+     **/
+    public ResultVo<Map<String, Object>> targetSqlExecuteById(TargetManagement dto) {
+        ReportBaseInfo reportChild = dao.selectReportBaseInfoByCalcId(dto.getChildId());
+        ReportBaseInfo reportMom = dao.selectReportBaseInfoByCalcId(dto.getMomId());
+
+        if(null ==  reportChild && null == reportMom){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, dto.getName() + "计算-分子或分母指标都不存在,请联系管理员!");
+        }
+
+        HighReportDto d = ReportUtil.TargetManagementConvertHighReportDto(dto);
 
         // 计算结果
         Map<String, Object> resultMap = new HashMap<>();
-        String child = dao.targetSqlExecute(dto.getCalcChild());
-        String mom = dao.targetSqlExecute(dto.getCalcMom());
+        String child = null;
+        String mom = null;
+        if(reportChild != null){
+            String childSql = ReportUtil.callSqlFormat(d, reportChild.getBaseSql(), reportChild.getGatherSql(), null, null, null);
+            child = dao.targetSqlExecute(childSql);
+        }
+        if(reportMom != null){
+            String momSql = ReportUtil.callSqlFormat(d, reportMom.getBaseSql(), reportMom.getGatherSql(), null, null, null);
+            mom = dao.targetSqlExecute(momSql);
+        }
+
         if (StringUtil.notBlank(child)) {
             resultMap.put("r1", child);
         } else {
@@ -240,35 +325,58 @@ public class TargetManagementService {
     public ResultVo<Map<String, Object>> targetSqlSave(TargetManagement dto) {
         String sqlChild = dto.getCalcChild();
         String sqlMom = dto.getCalcMom();
-        if(StringUtil.isBlank(sqlChild)){
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "计算-分子sql不存在,请检查!");
-        } else {
-            if(sqlChild.contains("drop") || sqlChild.contains("truncate") || sqlChild.contains("delete")  || sqlChild.contains("update")){
+        if(StringUtil.notBlank(sqlChild)) {
+            if (!sqlChild.contains("/") && !(sqlChild.contains("select") || sqlChild.contains("SELECT"))) {
+                log.info("分子sql语句不合法,请检查!");
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "分子sql语句不合法,请检查!");
+            }
+            if (sqlChild.contains("drop") || sqlChild.contains("truncate") || sqlChild.contains("delete") || sqlChild.contains("update")
+                    || sqlChild.contains("DROP") || sqlChild.contains("TRUNCATE") || sqlChild.contains("DELETE")  || sqlChild.contains("UPDATE")) {
                 log.info("分子sql语句存在非查询语句关键字,请检查!");
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "分子sql语句存在非查询语句关键字,请检查!");
             }
         }
         if(StringUtil.notBlank(sqlMom)){
-            if(sqlMom.contains("drop") || sqlMom.contains("truncate") || sqlMom.contains("delete")  || sqlMom.contains("update")){
+            if (!sqlMom.contains("/") && !(sqlMom.contains("select") || sqlMom.contains("SELECT"))) {
+                log.info("分母sql语句不合法,请检查!");
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "分母sql语句不合法,请检查!");
+            }
+            if(sqlMom.contains("drop") || sqlMom.contains("truncate") || sqlMom.contains("delete")  || sqlMom.contains("update")
+                    || sqlMom.contains("DROP") || sqlMom.contains("TRUNCATE") || sqlMom.contains("DELETE")  || sqlMom.contains("UPDATE")){
                 log.info("分母sql语句存在非查询语句关键字,请检查!");
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "分母sql语句存在非查询语句关键字,请检查!");
             }
         }
-
-        ReportBaseInfo report = new ReportBaseInfo();
-        report.setReportId(dto.getId());
-        report.setReportName(dto.getName());
-        report.setLevel(dto.getPid());
-        report.setCalcChild(dto.getCalcChild());
-        report.setCalcMom(dto.getCalcMom());
-        report.setReportSort(dto.getSort());
-        report.setReportType("zb");
-        report.setBaseSql("/");
-        report.setFlag("Y");
-        report.setDisplayType("fbt,mx");
         try {
+            int num = 0;
+            // 获取指标字典sql信息
+            Map<String, ReportBaseInfo> map = ReportUtil.assertReportForTarget(dto);
+
+            // 查询指标字典是否以及存在分子分母的sql指标报表信息
+            ZbZdBaseInfo info = zbZdDao.selectZbZdBaseInfoById(dto);
+            if(null != map.get("calcChild")){
+                // 已经配置分子sql指标报表信息
+                ReportBaseInfo r1 = map.get("calcChild");
+                // 更新分子指标报表的sql信息
+                if(StringUtil.notBlank(info.getChildId())){
+                    dao.deleteReportBaseInfoById(r1.getReportId());
+                } else {
+                    // 保存分子指标报表的id
+                    zbZdDao.updateZbZdBaseInfoCalcId(dto.getId(), dto.getPid() ,r1.getReportId(), null);
+                }
+                num += dao.insert(r1);
+            }
+            if(null != map.get("calcMom")){
+                ReportBaseInfo r2 = map.get("calcMom");
+                if(StringUtil.notBlank(info.getMomId())){
+                    dao.deleteReportBaseInfoById(r2.getReportId());
+                } else {
+                    // 保存分母指标报表的id
+                    zbZdDao.updateZbZdBaseInfoCalcId(dto.getId(), dto.getPid(), null, r2.getReportId());
+                }
+                num += dao.insert(r2);
+            }
             Map<String, Object> resultMap = new HashMap<>();
-            int num = dao.insert(report);
             if(num == 0){
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存指标sql以及报表失败!");
             }
@@ -303,4 +411,51 @@ public class TargetManagementService {
         resultMap.put("cg", "删除指标字典成功!");
         return ResultVoUtil.success(resultMap);
     }
+
+    /**
+     * @description: 查询指标字典的分子分母sql
+     * @author: hsh
+     * @date: 2023/6/30 15:19
+     * @param: [dto]
+     * @return: ResultVo<Map<String,Object>>
+     **/
+    public ResultVo<Map<String, Object>> selectTargetSql(TargetManagement dto) {
+        if (StringUtil.isBlank(dto.getId())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "id不存在,请检查!");
+        }
+        if (StringUtil.isBlank(dto.getPid())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "父id不存在,请检查!");
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+        ReportBaseInfo reportChild = dao.selectReportBaseInfoByCalcId(dto.getChildId());
+        ReportBaseInfo reportMom = dao.selectReportBaseInfoByCalcId(dto.getMomId());
+        resultMap.put("reportChild", reportChild);
+        resultMap.put("reportMom", reportMom);
+        return ResultVoUtil.success(resultMap);
+    }
+
+    /**
+     * @description: 查询指标字典的分子分母sql的详细内容
+     * @author: hsh
+     * @date: 2023/6/30 15:20
+     * @param: [dto]
+     * @return: ResultVo<Map<String,Object>>
+     **/
+    public ResultVo<Map<String, Object>> selectTargetSqlDetail(TargetManagement dto) {
+        if (StringUtil.isBlank(dto.getId())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "id不存在,请检查!");
+        }
+        if (StringUtil.isBlank(dto.getPid())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "父id不存在,请检查!");
+        }
+        Map<String, Object> resultMap = new HashMap<>();
+
+        ReportBaseInfo reportBaseInfo = dao.selectReportBaseInfoById(dto.getId(), dto.getPid());
+        if (reportBaseInfo == null) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询指标不存在!");
+        }
+        resultMap.put("report", reportBaseInfo);
+        return ResultVoUtil.success(resultMap);
+    }
+
 }

+ 74 - 8
src/main/java/thyyxxk/webserver/utils/ReportUtil.java

@@ -6,6 +6,10 @@ import thyyxxk.webserver.entity.highreport.ReportBaseInfo;
 import thyyxxk.webserver.entity.highreport.TableGroupInfo;
 import thyyxxk.webserver.entity.targetmanagement.TargetManagement;
 
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @Description: 报表相关的工具类
  * @Author: hsh
@@ -31,7 +35,17 @@ public class ReportUtil {
     /**
      * 诊断(模糊查询使用)
      **/
-    private static final String DIAGN = "_diagn";
+    private static final String DIAGN = "diagn";
+
+    /**
+     * 住院号
+     **/
+    private static final String ZYH = "zyh";
+
+    /**
+     * 姓名(模糊查询使用)
+     **/
+    private static final String XM = "xm";
 
     private static final String OTHER_PARAM = "其他";
 
@@ -48,14 +62,14 @@ public class ReportUtil {
             if(StringUtil.notBlank(dto.getStartTime())){
                 baseSql = baseSql.replaceAll(START_TIME, "'" + dto.getStartTime() + "'");
             } else {
-                baseSql = baseSql.replaceAll(START_TIME, "'2012-01-01 00:00:00'");
+                baseSql = baseSql.replaceAll(START_TIME, DateUtil.getDayStartTime(new Date()));
             }
         }
         if(baseSql.contains(END_TIME)){
             if(StringUtil.notBlank(dto.getEndTime())){
                 baseSql = baseSql.replaceAll(END_TIME, "'" + dto.getEndTime() + "'");
             } else {
-                baseSql = baseSql.replaceAll(END_TIME, "'2112-01-01 00:00:00'");
+                baseSql = baseSql.replaceAll(END_TIME, DateUtil.getDayEndTime(new Date()));
             }
         }
         // 查询非必填字段(一般是下拉选险种,模糊查询科室、诊断等sql用_拼接的字符)
@@ -71,7 +85,13 @@ public class ReportUtil {
             sql.append(" and t.insurName = '").append(dto.getInsurName()).append("' ");
         }
         if(baseSql.contains(DIAGN) && StringUtil.notBlank(dto.getDiagn())){
-            sql.append(" and t._diagn like '%").append(dto.getDiagn()).append("%' ");
+            sql.append(" and t.diagn like '%").append(dto.getDiagn()).append("%' ");
+        }
+        if(baseSql.contains(ZYH) && StringUtil.notBlank(dto.getZyh())){
+            sql.append(" and t.zyh = '").append(dto.getZyh()).append("' ");
+        }
+        if(baseSql.contains(XM) && StringUtil.notBlank(dto.getXm())){
+            sql.append(" and t.xm like '%").append(dto.getXm()).append("%' ");
         }
         // 存在钻取,需要添加钻取条件
         if(StringUtil.notBlank(dropSql)){
@@ -182,14 +202,14 @@ public class ReportUtil {
             if(StringUtil.notBlank(dto.getStartTime())){
                 sqlChild = sqlChild.replaceAll(START_TIME, "'" + dto.getStartTime() + "'");
             } else {
-                sqlChild = sqlChild.replaceAll(START_TIME, "'2012-01-01 00:00:00'");
+                sqlChild = sqlChild.replaceAll(START_TIME, DateUtil.getDayStartTime(new Date()));
             }
         }
         if(sqlChild.contains(END_TIME)){
             if(StringUtil.notBlank(dto.getEndTime())){
                 sqlChild = sqlChild.replaceAll(END_TIME, "'" + dto.getEndTime() + "'");
             } else {
-                sqlChild = sqlChild.replaceAll(END_TIME, "'2112-01-01 00:00:00'");
+                sqlChild = sqlChild.replaceAll(END_TIME, DateUtil.getDayEndTime(new Date()));
             }
         }
 
@@ -198,14 +218,14 @@ public class ReportUtil {
                 if(StringUtil.notBlank(dto.getStartTime())){
                     sqlMom = sqlMom.replaceAll(START_TIME, "'" + dto.getStartTime() + "'");
                 } else {
-                    sqlMom = sqlMom.replaceAll(START_TIME, "'2012-01-01 00:00:00'");
+                    sqlMom = sqlMom.replaceAll(START_TIME, DateUtil.getDayStartTime(new Date()));
                 }
             }
             if(sqlMom.contains(END_TIME)){
                 if(StringUtil.notBlank(dto.getEndTime())){
                     sqlMom = sqlMom.replaceAll(END_TIME, "'" + dto.getEndTime() + "'");
                 } else {
-                    sqlMom = sqlMom.replaceAll(END_TIME, "'2112-01-01 00:00:00'");
+                    sqlMom = sqlMom.replaceAll(END_TIME, DateUtil.getDayEndTime(new Date()));
                 }
             }
         }
@@ -215,4 +235,50 @@ public class ReportUtil {
 
     }
 
+    /**
+     * @description: 根据指标字典sql信息组装指标报表信息
+     * @author: hsh
+     * @date: 2023/7/3 14:44
+     * @param: [dto]
+     * @return: Map<String,List<ReportBaseInfo>>
+     **/
+    public static Map<String, ReportBaseInfo> assertReportForTarget(TargetManagement dto){
+        Map<String, ReportBaseInfo> map = new HashMap<>();
+        ReportBaseInfo report = new ReportBaseInfo();
+        if(StringUtil.notBlank(dto.getCalcChild()) && !dto.getCalcChild().contains("/")){
+            report.setReportId(dto.getChildId());
+            report.setReportName(dto.getChildName());
+            report.setBaseSql(dto.getCalcChild());
+            report.setGatherSql(dto.getChildGather());
+            report.setLevel("group_zb");
+            report.setMenuId("777");
+            report.setReportType("zb");
+            report.setFlag("Y");
+            report.setDisplayType("mx");
+            map.put("calcChild", report);
+        }
+        if(StringUtil.notBlank(dto.getCalcMom()) && !dto.getCalcMom().contains("/")){
+            report = new ReportBaseInfo();
+            report.setReportId(dto.getMomId());
+            report.setReportName(dto.getMomName());
+            report.setBaseSql(dto.getCalcMom());
+            report.setGatherSql(dto.getMomGather());
+            report.setLevel("group_zb");
+            report.setMenuId("777");
+            report.setReportType("zb");
+            report.setFlag("Y");
+            report.setDisplayType("mx");
+            map.put("calcMom", report);
+        }
+        return map;
+    }
+
+
+    public static HighReportDto TargetManagementConvertHighReportDto(TargetManagement dto){
+        HighReportDto d = new HighReportDto();
+        d.setStartTime(dto.getStartTime());
+        d.setEndTime(dto.getEndTime());
+        return d;
+    }
+
 }