From d9e1a1327d2d75e138f12e61c5faa155752be955 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期五, 13 九月 2024 18:13:14 +0800
Subject: [PATCH] 作业统计 完成
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java | 8 ++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java | 11 +++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java | 9 ++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordStatisticVO.java | 38 +++++++++++++++++++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java | 8 +++
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordStatisticDO.java | 22 +++++++++++
6 files changed, 94 insertions(+), 2 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
index 2830e19..e4a17eb 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/JobRecordController.java
@@ -1,6 +1,7 @@
package cn.lihu.jh.module.ecg.controller.admin.jobrecord;
import cn.lihu.jh.framework.security.core.util.SecurityFrameworkUtils;
+import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordStatisticDO;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -105,4 +106,12 @@
BeanUtils.toBean(list, JobRecordRespVO.class));
}
-}
\ No newline at end of file
+ @GetMapping("/job-statistic")
+ @Operation(summary = "宸ヤ綔閲忕粺璁�")
+ @PreAuthorize("@ss.hasPermission('ecg:job-record:statistic')")
+ public CommonResult<List<JobRecordStatisticVO>> getJobStatistic(@Valid JobRecordPageReqVO pageReqVO) {
+ List<JobRecordStatisticDO> statisticDOList = jobRecordService.getJobStatistic(pageReqVO.getJobTime()[0], pageReqVO.getJobTime()[1]);
+ return success(BeanUtils.toBean(statisticDOList, JobRecordStatisticVO.class));
+ }
+}
+
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordStatisticVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordStatisticVO.java
new file mode 100644
index 0000000..f56f48a
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/jobrecord/vo/JobRecordStatisticVO.java
@@ -0,0 +1,38 @@
+package cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "绠$悊鍚庡彴 - 宸ヤ綔缁熻 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class JobRecordStatisticVO {
+
+ @Schema(description = "浣滀笟绫诲瀷", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+ @ExcelProperty("浣滀笟绫诲瀷")
+ private Integer jobType;
+
+ @Schema(description = "鍖荤敓缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "24197")
+ @ExcelProperty("鍖荤敓缂栧彿")
+ private Long docId;
+
+ @Schema(description = "鍖荤敓鍚嶇О", example = "璧靛叚")
+ @ExcelProperty("鍖荤敓鍚嶇О")
+ private String docName;
+
+ @Schema(description = "鍚堣", example = "9")
+ @ExcelProperty("鏁伴噺")
+ private Integer jobCount;
+
+ @Schema(description = "骞村害", example = "2024")
+ @ExcelProperty("骞村害")
+ private Integer year;
+
+ @Schema(description = "鏈堜唤", example = "9")
+ @ExcelProperty("鏈堜唤")
+ private Integer month;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordStatisticDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordStatisticDO.java
new file mode 100644
index 0000000..dcb5efc
--- /dev/null
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/jobrecord/JobRecordStatisticDO.java
@@ -0,0 +1,22 @@
+package cn.lihu.jh.module.ecg.dal.dataobject.jobrecord;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class JobRecordStatisticDO {
+
+ private Integer jobType;
+
+ private Long docId;
+
+ private String docName;
+
+ private Integer jobCount;
+
+ private Integer year;
+
+ private Integer month;
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
index 26afeeb..0536dff 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/jobrecord/JobRecordMapper.java
@@ -7,6 +7,7 @@
import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
+import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordStatisticDO;
import org.apache.ibatis.annotations.Mapper;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import org.apache.ibatis.annotations.Param;
@@ -42,4 +43,9 @@
@Select("SELECT count(1) FROM lihu.job_record where pat_id=#{patId} and TO_DAYS(job_time)=TO_DAYS(#{jobTime}) and job_type=#{jobType} ")
Integer getPatientJobNum(@Param("patId") String patId, @Param("jobTime") LocalDateTime jobTime, @Param("jobType") Integer jobType );
-}
\ No newline at end of file
+
+ @Select("select year(job_time) as year, month(job_time) as month, doc_id, doc_name, job_type, count(1) as job_count from lihu.job_record " +
+ "where job_time >= #{jobTimeFrom} and job_time < #{jobTimeTo} \n" +
+ "group by year(job_time), month(job_time), doc_id, job_type;")
+ List<JobRecordStatisticDO> getJobStatistic(@Param("jobTimeFrom") LocalDateTime jobTimeFrom, @Param("jobTimeTo") LocalDateTime jobTimeTo);
+}
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
index 95ea801..55af757 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordService.java
@@ -1,10 +1,12 @@
package cn.lihu.jh.module.ecg.service.jobrecord;
+import java.time.LocalDateTime;
import java.util.*;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.pojo.PageParam;
+import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordStatisticDO;
import javax.validation.Valid;
@@ -53,4 +55,11 @@
*/
PageResult<JobRecordDO> getJobRecordPage(JobRecordPageReqVO pageReqVO);
+ /**
+ * 浣滀笟缁熻
+ * @param jobTimeFrom
+ * @param jobTimeTo
+ * @return
+ */
+ List<JobRecordStatisticDO> getJobStatistic(LocalDateTime jobTimeFrom, LocalDateTime jobTimeTo);
}
\ No newline at end of file
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
index 5da1ab8..a04aeb5 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/jobrecord/JobRecordServiceImpl.java
@@ -1,9 +1,11 @@
package cn.lihu.jh.module.ecg.service.jobrecord;
+import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordStatisticDO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDateTime;
import java.util.*;
import cn.lihu.jh.module.ecg.controller.admin.jobrecord.vo.*;
import cn.lihu.jh.module.ecg.dal.dataobject.jobrecord.JobRecordDO;
@@ -72,4 +74,10 @@
return jobRecordMapper.selectPage(pageReqVO);
}
+ @Override
+ public List<JobRecordStatisticDO> getJobStatistic(LocalDateTime jobTimeFrom, LocalDateTime jobTimeTo) {
+
+ return jobRecordMapper.getJobStatistic(jobTimeFrom, jobTimeTo);
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3