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")
|
@GetMapping("/getECGStatistics")
|
||||||
@Operation(summary = "获取心电图统计数据")
|
@Operation(summary = "获取心电图统计数据")
|
||||||
@PreAuthorize("@ss.hasPermission('tblist:patientexamlist:query')")
|
public CommonResult<ECGStatisticsRespVO> getECGStatistics() {
|
||||||
public CommonResult<ECGStatisticsRespVO> getECGStatistics(@RequestParam("orgId") String orgId) {
|
|
||||||
ECGStatisticsRespVO statistics = new ECGStatisticsRespVO();
|
ECGStatisticsRespVO statistics = new ECGStatisticsRespVO();
|
||||||
|
AdminUserDO user = userService.getUser(getLoginUserId());
|
||||||
|
String orgId = user.getOrgId();
|
||||||
|
|
||||||
// 构建基础查询条件
|
// 使用一个查询获取所有统计数据
|
||||||
QueryWrapper<PatientexamlistDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<PatientexamlistDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("deviceType", "ECG")
|
queryWrapper.select(
|
||||||
.eq("orgId", orgId);
|
"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);
|
||||||
|
|
||||||
// 获取总数
|
Map<String, Object> counts = patientexamlistMapper.selectMaps(queryWrapper).get(0);
|
||||||
int totalCount = patientexamlistMapper.selectCount(queryWrapper).intValue();
|
|
||||||
statistics.setTotalCount(totalCount);
|
|
||||||
|
|
||||||
// 获取已分析数量(reviewDate不为空)
|
statistics.setTotalCount(((Number) counts.get("totalCount")).intValue());
|
||||||
QueryWrapper<PatientexamlistDO> analyzedWrapper = new QueryWrapper<>();
|
statistics.setAnalyzedCount(((Number) counts.get("analyzedCount")).intValue());
|
||||||
analyzedWrapper.eq("deviceType", "ECG")
|
statistics.setUnanalyzedCount(((Number) counts.get("unanalyzedCount")).intValue());
|
||||||
.eq("orgId", orgId)
|
statistics.setAppliedCount(((Number) counts.get("appliedCount")).intValue());
|
||||||
.isNotNull("reviewDate");
|
statistics.setCriticalCount(((Number) counts.get("criticalCount")).intValue());
|
||||||
int analyzedCount = patientexamlistMapper.selectCount(analyzedWrapper).intValue();
|
|
||||||
statistics.setAnalyzedCount(analyzedCount);
|
|
||||||
|
|
||||||
// 获取未分析数量
|
|
||||||
statistics.setUnanalyzedCount(totalCount - analyzedCount);
|
|
||||||
|
|
||||||
// 获取阳性数量
|
// 获取阳性数量
|
||||||
int positiveCount = 0;
|
int positiveCount = 0;
|
||||||
// 1. 获取所有阳性关键词配置
|
|
||||||
List<Map<String, Object>> positivestatisticsDict = positivestatisticsMapper.selectList_usable(orgId);
|
List<Map<String, Object>> positivestatisticsDict = positivestatisticsMapper.selectList_usable(orgId);
|
||||||
if (positivestatisticsDict != null && !positivestatisticsDict.isEmpty()) {
|
if (positivestatisticsDict != null && !positivestatisticsDict.isEmpty()) {
|
||||||
// 2. 收集所有关键词
|
|
||||||
List<String> allKeywords = new ArrayList<>();
|
List<String> allKeywords = new ArrayList<>();
|
||||||
for (Map<String, Object> dict : positivestatisticsDict) {
|
for (Map<String, Object> dict : positivestatisticsDict) {
|
||||||
if (dict.get("keyWord") != null && dict.get("keyWord").toString().trim().length() > 0) {
|
if (dict.get("keyWord") != null && dict.get("keyWord").toString().trim().length() > 0) {
|
||||||
@ -594,35 +593,17 @@ public class PatientexamlistController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 一次性查询所有符合任意关键词的记录
|
|
||||||
if (!allKeywords.isEmpty()) {
|
if (!allKeywords.isEmpty()) {
|
||||||
positiveCount = ecganalysisparasMapper.selectList_positive(
|
positiveCount = ecganalysisparasMapper.selectList_positive(
|
||||||
orgId, // 机构ID
|
orgId,
|
||||||
null, // 不限制开始时间
|
null,
|
||||||
null, // 不限制结束时间
|
null,
|
||||||
allKeywords.toArray(new String[0])
|
allKeywords.toArray(new String[0])
|
||||||
).size();
|
).size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
statistics.setPositiveCount(positiveCount);
|
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);
|
return success(statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user