Merge remote-tracking branch '公司/master'
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
commit
2415356c6b
@ -556,36 +556,35 @@ public class PatientexamlistController {
|
||||
|
||||
@GetMapping("/getECGStatistics")
|
||||
@Operation(summary = "获取心电图统计数据")
|
||||
@PreAuthorize("@ss.hasPermission('tblist:patientexamlist:query')")
|
||||
public CommonResult<ECGStatisticsRespVO> getECGStatistics(@RequestParam("orgId") String orgId) {
|
||||
public CommonResult<ECGStatisticsRespVO> getECGStatistics() {
|
||||
ECGStatisticsRespVO statistics = new ECGStatisticsRespVO();
|
||||
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||
String orgId = user.getOrgId();
|
||||
|
||||
// 构建基础查询条件
|
||||
// 使用一个查询获取所有统计数据
|
||||
QueryWrapper<PatientexamlistDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("deviceType", "ECG")
|
||||
.eq("orgId", orgId);
|
||||
queryWrapper.select(
|
||||
"COUNT(*) as totalCount",
|
||||
"SUM(CASE WHEN reviewDate IS NOT NULL THEN 1 ELSE 0 END) as analyzedCount",
|
||||
"SUM(CASE WHEN reviewDate IS NULL THEN 1 ELSE 0 END) as unanalyzedCount",
|
||||
"SUM(CASE WHEN applicationDate IS NOT NULL THEN 1 ELSE 0 END) as appliedCount",
|
||||
"SUM(CASE WHEN warning = '1' THEN 1 ELSE 0 END) as criticalCount"
|
||||
)
|
||||
.eq("deviceType", "ECG")
|
||||
.eq("orgId", orgId);
|
||||
|
||||
// 获取总数
|
||||
int totalCount = patientexamlistMapper.selectCount(queryWrapper).intValue();
|
||||
statistics.setTotalCount(totalCount);
|
||||
Map<String, Object> counts = patientexamlistMapper.selectMaps(queryWrapper).get(0);
|
||||
|
||||
// 获取已分析数量(reviewDate不为空)
|
||||
QueryWrapper<PatientexamlistDO> analyzedWrapper = new QueryWrapper<>();
|
||||
analyzedWrapper.eq("deviceType", "ECG")
|
||||
.eq("orgId", orgId)
|
||||
.isNotNull("reviewDate");
|
||||
int analyzedCount = patientexamlistMapper.selectCount(analyzedWrapper).intValue();
|
||||
statistics.setAnalyzedCount(analyzedCount);
|
||||
|
||||
// 获取未分析数量
|
||||
statistics.setUnanalyzedCount(totalCount - analyzedCount);
|
||||
statistics.setTotalCount(((Number) counts.get("totalCount")).intValue());
|
||||
statistics.setAnalyzedCount(((Number) counts.get("analyzedCount")).intValue());
|
||||
statistics.setUnanalyzedCount(((Number) counts.get("unanalyzedCount")).intValue());
|
||||
statistics.setAppliedCount(((Number) counts.get("appliedCount")).intValue());
|
||||
statistics.setCriticalCount(((Number) counts.get("criticalCount")).intValue());
|
||||
|
||||
// 获取阳性数量
|
||||
int positiveCount = 0;
|
||||
// 1. 获取所有阳性关键词配置
|
||||
List<Map<String, Object>> positivestatisticsDict = positivestatisticsMapper.selectList_usable(orgId);
|
||||
if (positivestatisticsDict != null && !positivestatisticsDict.isEmpty()) {
|
||||
// 2. 收集所有关键词
|
||||
List<String> allKeywords = new ArrayList<>();
|
||||
for (Map<String, Object> dict : positivestatisticsDict) {
|
||||
if (dict.get("keyWord") != null && dict.get("keyWord").toString().trim().length() > 0) {
|
||||
@ -594,35 +593,17 @@ public class PatientexamlistController {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 一次性查询所有符合任意关键词的记录
|
||||
if (!allKeywords.isEmpty()) {
|
||||
positiveCount = ecganalysisparasMapper.selectList_positive(
|
||||
orgId, // 机构ID
|
||||
null, // 不限制开始时间
|
||||
null, // 不限制结束时间
|
||||
orgId,
|
||||
null,
|
||||
null,
|
||||
allKeywords.toArray(new String[0])
|
||||
).size();
|
||||
}
|
||||
}
|
||||
|
||||
statistics.setPositiveCount(positiveCount);
|
||||
|
||||
// 获取上级申请数量(applicationDate不为空)
|
||||
QueryWrapper<PatientexamlistDO> appliedWrapper = new QueryWrapper<>();
|
||||
appliedWrapper.eq("deviceType", "ECG")
|
||||
.eq("orgId", orgId)
|
||||
.isNotNull("applicationDate");
|
||||
int appliedCount = patientexamlistMapper.selectCount(appliedWrapper).intValue();
|
||||
statistics.setAppliedCount(appliedCount);
|
||||
|
||||
// 获取危急值数量(warning = 1)
|
||||
QueryWrapper<PatientexamlistDO> criticalWrapper = new QueryWrapper<>();
|
||||
criticalWrapper.eq("deviceType", "ECG")
|
||||
.eq("orgId", orgId)
|
||||
.eq("warning", "1");
|
||||
int criticalCount = patientexamlistMapper.selectCount(criticalWrapper).intValue();
|
||||
statistics.setCriticalCount(criticalCount);
|
||||
|
||||
return success(statistics);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user