Commit f2b6120b authored by 鲁鸿波's avatar 鲁鸿波

事故详情统计开发

parent 547c69c6
......@@ -497,3 +497,59 @@ COMMENT ON COLUMN t_hazard_work_plan_expired_log.before_expiration IS '关闭前
COMMENT ON COLUMN t_hazard_work_plan_expired_log.hazard_license_pass_time IS '安全许可申请通过时间';
COMMENT ON COLUMN t_hazard_work_plan_expired_log.actual_duration_hours IS '实际持续小时数';
COMMENT ON COLUMN t_hazard_work_plan_expired_log.plan_create_date IS '作业创建时间';
#20260130上线需求
#事故上报增加字段: 事故统计详情表新增字段: 事故等级(国家)、人员追责问责情况、损失工作日、涉及集团八大类风险、涉及危险作业类型、受伤部位(非必填)
ALTER TABLE t_accident_report ADD accident_level_country varchar(50);
COMMENT ON COLUMN t_accident_report.accident_level_country IS '事故等级(国家)(字典:accident_level_country)';
ALTER TABLE t_accident_report ADD personnel_accountability_status varchar(500);
COMMENT ON COLUMN t_accident_report.personnel_accountability_status IS '人员追责问责情况';
ALTER TABLE t_accident_report ADD lost_working_days varchar(50);
COMMENT ON COLUMN t_accident_report.lost_working_days IS '损失工作日';
ALTER TABLE t_accident_report ADD group_risk varchar(50);
COMMENT ON COLUMN t_accident_report.group_risk IS '涉及集团八大类风险(字典:group_risk)';
ALTER TABLE t_accident_report ADD dangerous_homework_category varchar(50);
COMMENT ON COLUMN t_accident_report.dangerous_homework_category IS '涉及危险作业类型(字典:dangerous_homework_category)';
ALTER TABLE t_accident_report ADD injured_area varchar(50);
COMMENT ON COLUMN t_accident_report.injured_area IS '受伤部位(字典:injured_area)';
INSERT INTO "t_sys_dict_type" ("dict_id", "dict_name", "dict_type", "is_sys", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids", "tree_sort", "cascaded") VALUES ('2', '事故等级(国家)', 'accident_level_country', '1', '0', NULL, '2026-01-09 15:01:16', NULL, '2026-01-09 15:01:16', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('5', '2', '1', '轻伤', '1', '0', NULL, '2026-01-09 15:01:47', NULL, '2026-01-09 15:01:47', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('6', '2', '2', '重伤', '2', '0', NULL, '2026-01-09 15:01:47', NULL, '2026-01-09 15:01:47', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('7', '2', '3', '死亡', '3', '0', NULL, '2026-01-09 15:01:47', NULL, '2026-01-09 15:01:47', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_type" ("dict_id", "dict_name", "dict_type", "is_sys", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids", "tree_sort", "cascaded") VALUES ('3', '涉及集团八大类风险', 'group_risk', '1', '0', NULL, '2026-01-09 15:03:37', NULL, '2026-01-09 15:03:37', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('8', '3', '1', '液氨', '1', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('9', '3', '2', '酒精', '2', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('10', '3', '3', '正己烷', '3', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('11', '3', '4', '有限空间', '4', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('12', '3', '5', '火灾', '5', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('13', '3', '6', '粉尘爆炸', '6', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('14', '3', '7', '危险化学品', '7', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('15', '3', '8', '在建项目(危大工程)', '8', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('16', '3', '9', '不涉及', '9', '0', NULL, '2026-01-09 15:04:29', NULL, '2026-01-09 15:04:29', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_type" ("dict_id", "dict_name", "dict_type", "is_sys", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids", "tree_sort", "cascaded") VALUES ('4', '事故涉及危险作业类型', 'dangerous_homework_category', '1', '0', NULL, '2026-01-09 15:06:57', NULL, '2026-01-09 15:06:57', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('17', '4', '1', '动火', '1', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('18', '4', '2', '临时用电', '2', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('19', '4', '3', '有限空间', '3', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('20', '4', '4', '进出仓', '4', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('21', '4', '5', '高处', '5', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('22', '4', '6', '加放氨', '6', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('23', '4', '7', '动土', '7', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('24', '4', '8', '盲板抽堵', '8', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('25', '4', '9', '检维修', '9', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('26', '4', '10', '断路', '10', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('27', '4', '11', '不涉及', '11', '0', NULL, '2026-01-09 15:07:41', NULL, '2026-01-09 15:07:41', NULL, NULL, NULL);
INSERT INTO "t_sys_dict_type" ("dict_id", "dict_name", "dict_type", "is_sys", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids", "tree_sort", "cascaded") VALUES ('5', '事故受伤部位', 'injured_area', NULL, NULL, NULL, '2026-01-09 15:10:48', NULL, '2026-01-09 15:10:48', NULL, NULL, NULL, NULL, NULL);
INSERT INTO "t_sys_dict_data" ("dict_data_id", "dict_id", "dict_key", "dict_value", "tree_sort", "status", "create_by", "create_date", "update_by", "update_date", "remarks", "parent_id", "parent_ids") VALUES ('28', '5', '1', '手臂', '1', '0', NULL, '2026-01-09 15:11:09', NULL, '2026-01-09 15:11:09', NULL, NULL, NULL);
......@@ -14,10 +14,16 @@ import com.testor.common.model.UpdateProcessStatusReq;
import com.testor.common.util.EnumUtil;
import com.testor.module.accident.model.domain.AccidentReport;
import com.testor.module.accident.model.dto.AccidentReportDelParam;
import com.testor.module.accident.model.dto.AccidentReportDetail;
import com.testor.module.accident.model.req.*;
import com.testor.module.accident.model.resp.*;
import com.testor.module.accident.model.vo.AccidentReportVO;
import com.testor.module.accident.service.AccidentReportService;
import com.testor.module.hazard.model.dto.ReportDetailParam;
import com.testor.module.hazard.model.dto.THazardWorkPlanCheckParam;
import com.testor.module.hazard.model.dto.THazardWorkPlanDTO;
import com.testor.module.hazard.model.dto.THazardWorkPlanParam;
import com.testor.module.hazard.model.vo.HazardWorkPlanCheckProblemCountStatisticsVO;
import com.tongtech.tfw.backend.common.biz.constants.BizConstants;
import com.tongtech.tfw.backend.common.biz.models.BaseResponse;
import com.tongtech.tfw.backend.common.biz.models.BaseResponseList;
......@@ -291,4 +297,19 @@ public class AccidentReportController extends SuperController {
baseResponse.setData(pieByTypeList);
return baseResponse;
}
@ApiOperation(value = "查询事故信息详情")
@GetMapping(value = "/selectAccidentReportDetail")
public BaseResponse<BaseResponseList<AccidentReportDetail>> AccidentReportDetail(ReportDetailParam reportDetailParam){
BaseResponse<BaseResponseList<AccidentReportDetail>>baseResponse=new BaseResponse<>();
reportDetailParam.setUserId(getUserId());
Page<AccidentReportDetail> resultList= accidentReportService.selectAccidentReportDetail(reportDetailParam);
BaseResponseList<AccidentReportDetail> baseResponseList=new BaseResponseList<>();
baseResponseList.setData(resultList.getRecords());
baseResponseList.setTotal(resultList.getTotal());
baseResponse.setData(baseResponseList);
return baseResponse;
}
}
package com.testor.module.accident.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.module.accident.model.domain.AccidentReport;
import com.testor.module.accident.model.dto.AccidentReportDetail;
import com.testor.module.accident.model.req.AccidentReportExportReq;
import com.testor.module.hazard.model.dto.ReportDetailParam;
import com.tongtech.tfw.backend.common.models.supers.SuperDao;
import org.apache.ibatis.annotations.Param;
......@@ -27,4 +31,12 @@ public interface AccidentReportDao extends SuperDao<AccidentReport> {
* @date 4/11/23 5:02 PM
*/
List<AccidentReport> findExportlist(@Param("qwe") AccidentReportExportReq accidentReportQueryReq);
/**
* 查询事故信息详情
* @param page
* @param param
* @return
*/
Page<AccidentReportDetail> selectAccidentReportDetail(@Param("page") IPage page,@Param("param") ReportDetailParam param);
}
......@@ -189,6 +189,48 @@ public class AccidentReport extends SuperModel {
@TableField("reject_opinion")
private String rejectOpinion;
/**
* 事故等级(国家)(字典:accident_level_country)
*/
@ApiModelProperty(value = "事故等级(国家)(字典:accident_level_country)")
@TableField("t_accident_report")
private String tAccidentReport;
/**
* 事人员追责问责情况
*/
@ApiModelProperty(value = "人员追责问责情况")
@TableField("personnel_accountability_status")
private String personnelAccountabilityStatus;
/**
* 损失工作日
*/
@ApiModelProperty(value = "损失工作日")
@TableField("lost_working_days")
private String lostWorkingDays;
/**
* 涉及集团八大类风险(字典:group_risk)
*/
@ApiModelProperty(value = "涉及集团八大类风险(字典:group_risk)")
@TableField("group_risk")
private String groupRisk;
/**
* 涉及危险作业类型(字典:dangerous_homework_category)
*/
@ApiModelProperty(value = "涉及危险作业类型(字典:dangerous_homework_category)")
@TableField("dangerous_homework_category")
private String dangerousHomeworkCategory;
/**
* 受伤部位(字典:injured_area)
*/
@ApiModelProperty(value = "受伤部位(字典:injured_area)")
@TableField("injured_area")
private String injuredArea;
/**
* 创建人部门id
*/
......
package com.testor.module.accident.model.dto;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.testor.module.accident.model.domain.AccidentPersonnel;
import com.testor.module.accident.model.domain.AccidentReport;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 事故统计详情表
*/
@Data
public class AccidentReportDetail {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "当前机构名称")
private String currentOrgName;
@ApiModelProperty(value = "经营部名称")
private String businessDeptName;
@ApiModelProperty(value = "大区名称")
private String regionName;
/**
* 事故发生时间
*/
@ApiModelProperty(value = "事故发生时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date accidentTime;
/**
* 事故等级(国家)(字典:accident_level_country)
*/
@ApiModelProperty(value = "事故等级(国家)(字典:accident_level_country)")
private String accidentLevelCountry;
@ApiModelProperty(value = "事故等级(集团)")
private String accidentLevel;
@ApiModelProperty(value = "受伤人数")
private Integer reportCount;
/**
* 直接经济损失
*/
@ApiModelProperty(value = "直接经济损失")
private BigDecimal directEconomicLoss;
/**
* 损失工作日
*/
@ApiModelProperty(value = "损失工作日")
@TableField("lost_working_days")
private String lostWorkingDays;
/**
* 人员信息
*/
@ApiModelProperty(value = "人员信息")
private List<AccidentPersonnel> accidentPersonnelList;
@ApiModelProperty(value = "事故类型")
private String accidentType;
/**
* 涉及集团八大类风险(多选 字典:group_risk)
*/
@ApiModelProperty(value = "多选 涉及集团八大类风险(字典:group_risk)")
private String groupRiskDetail;
/**
* 涉及危险作业类型(多选 字典:dangerous_homework_category)
*/
@ApiModelProperty(value = "多选 涉及危险作业类型(字典:dangerous_homework_category)")
private String dangerousHomeworkCategoryDetail;
/**
* 受伤部位(多选 字典:injured_area)
*/
@ApiModelProperty(value = "多选 受伤部位(字典:injured_area)")
private String injuredAreaDetail;
/**
* 事故详细经过
*/
@ApiModelProperty(value = "事故详细经过")
private String accidentPassed;
/**
* 事故直接原因和间接原因
*/
@ApiModelProperty(value = "事故直接原因和间接原因")
private String accidentCause;
/**
* 改善措施
*/
@ApiModelProperty(value = "改善措施")
private String improvements;
/**
* 事故人员追责问责情况
*/
@ApiModelProperty(value = "人员追责问责情况")
private String personnelAccountabilityStatus;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remarks;
}
......@@ -2,8 +2,11 @@ package com.testor.module.accident.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.common.model.UpdateProcessStatusReq;
import com.testor.module.accident.model.domain.AccidentReport;
import com.testor.module.accident.model.dto.AccidentReportDetail;
import com.testor.module.accident.model.excel.AccidentExport;
import com.testor.module.accident.model.req.*;
import com.testor.module.accident.model.resp.AccidentReportEditResp;
......@@ -11,7 +14,9 @@ import com.testor.module.accident.model.resp.AccidentReportInsResp;
import com.testor.module.accident.model.resp.AccidentStatisticsResp;
import com.testor.module.accident.model.resp.ReportUnitResp;
import com.testor.module.accident.model.vo.AccidentReportVO;
import com.testor.module.hazard.model.dto.ReportDetailParam;
import com.tongtech.tfw.backend.common.models.supers.SuperService;
import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -126,4 +131,17 @@ public interface AccidentReportService extends SuperService<AccidentReport> {
* @date 4/11/23 9:48 AM
*/
void exports(HttpServletResponse response, HttpServletRequest request, AccidentReportExportReq accidentReportExportReq);
@Override
default <E extends IPage<AccidentReport>> E page(E page) {
return SuperService.super.page(page);
}
/**
* 查询事故信息详情
* @param param
* @return
*/
Page<AccidentReportDetail> selectAccidentReportDetail(ReportDetailParam param);
}
......@@ -6,6 +6,8 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.testor.biz.rule.service.SysRuleService;
import com.testor.biz.sys.dict.data.model.domain.SysDictData;
import com.testor.biz.sys.dict.data.service.SysDictDataService;
......@@ -25,6 +27,7 @@ import com.testor.module.accident.dao.AccidentReportDao;
import com.testor.module.accident.manager.AccidentPersonnelManager;
import com.testor.module.accident.model.domain.AccidentPersonnel;
import com.testor.module.accident.model.domain.AccidentReport;
import com.testor.module.accident.model.dto.AccidentReportDetail;
import com.testor.module.accident.model.excel.AccidentExport;
import com.testor.module.accident.model.excel.AccidentExportVO;
import com.testor.module.accident.model.req.*;
......@@ -32,6 +35,8 @@ import com.testor.module.accident.model.resp.*;
import com.testor.module.accident.model.vo.AccidentPersonnelVO;
import com.testor.module.accident.model.vo.AccidentReportVO;
import com.testor.module.accident.service.AccidentReportService;
import com.testor.module.hazard.model.domain.THazardWorkPlan;
import com.testor.module.hazard.model.dto.ReportDetailParam;
import com.testor.module.video.util.AutoHeadColumnWidthStyleStrategy;
import com.testor.module.video.util.Beans;
import com.tongtech.tfw.backend.common.biz.constants.BizConstants;
......@@ -887,6 +892,31 @@ public class AccidentReportServiceImpl extends SuperServiceImpl<AccidentReportDa
}
@Override
public Page<AccidentReportDetail> selectAccidentReportDetail(ReportDetailParam param) {
Long page =
StringHelper.isEmpty(param.getPage()) ? BizConstants.PAGE : Long.valueOf(param.getPage());
Long limit =
StringHelper.isEmpty(param.getLimit()) ? BizConstants.LIMIT : Long.valueOf(param.getLimit());
Page<THazardWorkPlan> resultPage = new Page<>(page, limit);
if(StringUtils.isEmpty(param.getOrgId())){
SysUser user = sysUserService.getById(param.getUserId());
if(user != null){
param.setOrgId(user.getOrgId());
}
}
Page<AccidentReportDetail> accidentReportDetailPage = accidentReportDao.selectAccidentReportDetail(resultPage, param);
accidentReportDetailPage.getRecords().forEach(c->{
if(c.getReportCount()>0){
c.setAccidentPersonnelList(accidentPersonnelManager.list(new QueryWrapper<AccidentPersonnel>().eq(AccidentPersonnel.REF_ID, c.getId())));
}
});
return accidentReportDetailPage;
}
/**
* 列表查询条件及查询参数
*/
......
package com.testor.module.hazard.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.annotations.Param;
@Data
@ApiModel(value = "ReportDetailParam 事故详情参数")
public class ReportDetailParam {
@ApiModelProperty(value = "每页数量")
private String limit;
@ApiModelProperty(value = "当前页数")
private String page;
@ApiModelProperty(value = "组织id")
private String orgId;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "用户id")
private String userId;
}
......@@ -21,6 +21,12 @@
<id column="accident_cause" property="accidentCause"/>
<id column="improvements" property="improvements"/>
<id column="attachment" property="attachment"/>
<id column="t_accident_report" property="tAccidentReport"/>
<id column="personnel_accountability_status" property="personnelAccountabilityStatus"/>
<id column="lost_working_days" property="lostWorkingDays"/>
<id column="group_risk" property="groupRisk"/>
<id column="dangerous_homework_category" property="dangerousHomeworkCategory"/>
<id column="injured_area" property="injuredArea"/>
</resultMap>
<!--<select id="getCountByAccidentTime" parameterType="com.testor.module.accident.model.domain.AccidentReport" resultType="string">-->
......@@ -147,7 +153,112 @@
</if>
and status='0'
</where>
</select>
<select id="selectAccidentReportDetail" resultType="com.testor.module.accident.model.dto.AccidentReportDetail">
SELECT
CASE
WHEN tar.accident_type IS NULL OR tar.accident_type = '' THEN NULL
ELSE (
SELECT STRING_AGG(type_dict.dict_value, ',')
FROM (
SELECT DISTINCT UNNEST(STRING_TO_ARRAY(tar.accident_type, ',')) as type_key
) AS types
LEFT JOIN t_sys_dict_data type_dict
ON type_dict.dict_key = types.type_key
AND type_dict.dict_id = '45f23cfa2ff1415ea45d857aa249f66c'
)
END as accidentType,
sdd2.dict_value as accidentLevel,
CASE
WHEN tar.accident_cause IS NULL OR tar.accident_cause = '' THEN NULL
ELSE (
SELECT STRING_AGG(cause_dict.dict_value, ',')
FROM (
SELECT DISTINCT UNNEST(STRING_TO_ARRAY(tar.accident_cause, ',')) as cause_key
) AS causes
LEFT JOIN t_sys_dict_data cause_dict
ON cause_dict.dict_key = causes.cause_key
AND cause_dict.dict_id = '5ed4476803994013b0ee319f479f199f'
)
END as accidentCauseDetail,
CASE
WHEN tar.dangerous_homework_category IS NULL OR tar.dangerous_homework_category = '' THEN NULL
ELSE (
SELECT STRING_AGG(dangerous_dict.dict_value, ',')
FROM (
SELECT DISTINCT UNNEST(STRING_TO_ARRAY(tar.dangerous_homework_category, ',')) as dangerous_key
) AS dangerous_categories
LEFT JOIN t_sys_dict_data dangerous_dict
ON dangerous_dict.dict_key = dangerous_categories.dangerous_key
AND dangerous_dict.dict_id = '4'
)
END as dangerousHomeworkCategoryDetail,
CASE
WHEN tar.group_risk IS NULL OR tar.group_risk = '' THEN NULL
ELSE (
SELECT STRING_AGG(risk_dict.dict_value, ',')
FROM (
SELECT DISTINCT UNNEST(STRING_TO_ARRAY(tar.group_risk, ',')) as risk_key
) AS risks
LEFT JOIN t_sys_dict_data risk_dict
ON risk_dict.dict_key = risks.risk_key
AND risk_dict.dict_id = '3'
)
END as groupRiskDetail,
CASE
WHEN tar.injured_area IS NULL OR tar.injured_area = '' THEN NULL
ELSE (
SELECT STRING_AGG(area_dict.dict_value, ',')
FROM (
SELECT DISTINCT UNNEST(STRING_TO_ARRAY(tar.injured_area, ',')) as area_key
) AS areas
LEFT JOIN t_sys_dict_data area_dict
ON area_dict.dict_key = areas.area_key
AND area_dict.dict_id = '5'
)
END as injuredArea,
sdd_country.dict_value as accidentLevelCountryDetail,
so.org_name as currentOrgName,
bd.org_name as businessDeptName,
rg.org_name as regionName,
regionalCompany.org_name as regionalCompanyName,
COALESCE(
(SELECT COUNT(1) FROM t_accident_personnel WHERE ref_id = tar.id AND status = '0'),
0
) as reportCount,
tar.*
FROM t_accident_report tar
LEFT JOIN t_sys_dict_data sdd2 ON tar.accident_level = sdd2.dict_key
AND sdd2.dict_id = 'cd94e04e8ddd4a078dfaf2b5d784c798'
LEFT JOIN t_sys_dict_data sdd_country ON tar.accident_level_country = sdd_country.dict_key
AND sdd_country.dict_id = '2'
LEFT JOIN t_sys_org so ON tar.basic_unit_id = so.org_id
LEFT JOIN t_sys_org bd ON so.parent_id = bd.org_id
LEFT JOIN t_sys_org bd2 ON so.parent_id = bd2.org_id
LEFT JOIN t_sys_org rg ON bd2.parent_id = rg.org_id
LEFT JOIN t_sys_org regionalCompany ON regionalCompany.org_id = tar.regional_company_id
WHERE tar.status = '0'
<if test="param.startTime != null and param.startTime != '' and param.endTime != null and param.endTime != ''">
AND tar.accident_time BETWEEN #{param.startTime} AND #{param.endTime}
</if>
<if test="param.orgId != null and param.orgId != ''">
AND (
tar.org_id = #{param.orgId}
OR so.parent_ids LIKE concat('%', #{param.orgId}, '%')
)
</if>
ORDER BY bd2.org_id, bd.org_id, so.org_id
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment