feat(infection): 院感病例自动筛查

This commit is contained in:
2026-06-18 10:41:56 +08:00
parent e40695224c
commit 7ef676fa75
5 changed files with 360 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
package com.healthlink.his.web.infection.appservice;
import com.healthlink.his.infection.domain.HirInfectionCase;
import java.util.List;
import java.util.Map;
public interface IInfectionScreeningAppService {
Map<String, Object> screenInfectionCases(Map<String, Object> params);
List<HirInfectionCase> getScreeningResults(Map<String, Object> params);
}

View File

@@ -0,0 +1,126 @@
package com.healthlink.his.web.infection.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.healthlink.his.infection.domain.HirInfectionCase;
import com.healthlink.his.infection.service.IHirInfectionCaseService;
import com.healthlink.his.web.infection.appservice.IInfectionScreeningAppService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@AllArgsConstructor
public class InfectionScreeningAppServiceImpl implements IInfectionScreeningAppService {
private final IHirInfectionCaseService infectionCaseService;
@Override
public Map<String, Object> screenInfectionCases(Map<String, Object> params) {
log.info("开始院感病例自动筛查, 参数: {}", params);
Map<String, Object> result = new HashMap<>();
int screenedCount = 0;
int suspectedCount = 0;
String startDate = params.get("startDate") != null ? params.get("startDate").toString() : null;
String endDate = params.get("endDate") != null ? params.get("endDate").toString() : null;
String departmentName = params.get("departmentName") != null ? params.get("departmentName").toString() : null;
String infectionType = params.get("infectionType") != null ? params.get("infectionType").toString() : null;
LambdaQueryWrapper<HirInfectionCase> wrapper = new LambdaQueryWrapper<>();
if (startDate != null && !startDate.isEmpty()) {
wrapper.ge(HirInfectionCase::getReportTime, startDate);
}
if (endDate != null && !endDate.isEmpty()) {
wrapper.le(HirInfectionCase::getReportTime, endDate + " 23:59:59");
}
if (infectionType != null && !infectionType.isEmpty()) {
wrapper.eq(HirInfectionCase::getInfectionType, infectionType);
}
wrapper.eq(HirInfectionCase::getDeleteFlag, "0");
wrapper.orderByDesc(HirInfectionCase::getReportTime);
List<HirInfectionCase> cases = infectionCaseService.list(wrapper);
screenedCount = cases.size();
List<HirInfectionCase> suspectedCases = new ArrayList<>();
for (HirInfectionCase c : cases) {
if (isSuspectedInfection(c, params)) {
suspectedCases.add(c);
}
}
suspectedCount = suspectedCases.size();
result.put("screenedCount", screenedCount);
result.put("suspectedCount", suspectedCount);
result.put("suspectedCases", suspectedCases);
result.put("screenTime", new Date());
result.put("rules", getScreeningRules(params));
log.info("筛查完成: 共筛查{}例, 疑似{}例", screenedCount, suspectedCount);
return result;
}
@Override
public List<HirInfectionCase> getScreeningResults(Map<String, Object> params) {
String startDate = params.get("startDate") != null ? params.get("startDate").toString() : null;
String endDate = params.get("endDate") != null ? params.get("endDate").toString() : null;
String status = params.get("status") != null ? params.get("status").toString() : null;
LambdaQueryWrapper<HirInfectionCase> wrapper = new LambdaQueryWrapper<>();
if (startDate != null && !startDate.isEmpty()) {
wrapper.ge(HirInfectionCase::getReportTime, startDate);
}
if (endDate != null && !endDate.isEmpty()) {
wrapper.le(HirInfectionCase::getReportTime, endDate + " 23:59:59");
}
if (status != null && !status.isEmpty()) {
wrapper.eq(HirInfectionCase::getStatus, status);
}
wrapper.eq(HirInfectionCase::getDeleteFlag, "0");
wrapper.orderByDesc(HirInfectionCase::getReportTime);
return infectionCaseService.list(wrapper);
}
private boolean isSuspectedInfection(HirInfectionCase c, Map<String, Object> params) {
if (c.getInfectionType() != null && c.getInfectionType().contains("医院感染")) {
return true;
}
if (c.getPathogen() != null && !c.getPathogen().isEmpty()) {
return true;
}
if (c.getInfectionSite() != null) {
String site = c.getInfectionSite().toLowerCase();
if (site.contains("血流") || site.contains("尿路") || site.contains("肺部") || site.contains("手术部位")) {
return true;
}
}
if (params.get("minDays") != null) {
try {
int minDays = Integer.parseInt(params.get("minDays").toString());
if (c.getDiagnosisDate() != null) {
long days = (new Date().getTime() - c.getDiagnosisDate().getTime()) / (1000 * 60 * 60 * 24);
if (days >= minDays) {
return true;
}
}
} catch (NumberFormatException ignored) {}
}
return false;
}
private List<String> getScreeningRules(Map<String, Object> params) {
List<String> rules = new ArrayList<>();
rules.add("感染类型为'医院感染'");
rules.add("已检出病原体");
rules.add("感染部位为血流/尿路/肺部/手术部位");
if (params.get("minDays") != null) {
rules.add("住院天数超过" + params.get("minDays") + "");
}
return rules;
}
}

View File

@@ -0,0 +1,44 @@
package com.healthlink.his.web.infection.controller;
import com.core.common.core.domain.R;
import com.healthlink.his.web.infection.appservice.IInfectionScreeningAppService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Tag(name = "院感病例自动筛查")
@RestController
@RequestMapping("/infection/screening")
@Slf4j
@AllArgsConstructor
public class InfectionScreeningController {
private final IInfectionScreeningAppService screeningAppService;
@Operation(summary = "执行院感病例自动筛查")
@PreAuthorize("@ss.hasPermi('infection:infection:edit')")
@PostMapping("/run")
public R<?> runScreening(@RequestBody Map<String, Object> params) {
log.info("触发院感病例自动筛查");
return R.ok(screeningAppService.screenInfectionCases(params));
}
@Operation(summary = "查询筛查结果")
@PreAuthorize("@ss.hasPermi('infection:infection:list')")
@GetMapping("/results")
public R<?> getScreeningResults(
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "status", required = false) String status) {
Map<String, Object> params = new java.util.HashMap<>();
params.put("startDate", startDate);
params.put("endDate", endDate);
params.put("status", status);
return R.ok(screeningAppService.getScreeningResults(params));
}
}

View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'
export function runScreening(params) {
return request({ url: '/infection/screening/run', method: 'post', data: params })
}
export function getScreeningResults(params) {
return request({ url: '/infection/screening/results', method: 'get', params })
}

View File

@@ -0,0 +1,171 @@
<template>
<div class="screening-container">
<div class="page-header">
<span class="tab-title">院感病例自动筛查</span>
</div>
<el-card shadow="never" style="margin-bottom: 16px">
<template #header>
<span>筛查规则配置</span>
</template>
<el-form :model="screeningParams" inline>
<el-form-item label="开始日期">
<el-date-picker
v-model="screeningParams.startDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择开始日期"
/>
</el-form-item>
<el-form-item label="结束日期">
<el-date-picker
v-model="screeningParams.endDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择结束日期"
/>
</el-form-item>
<el-form-item label="感染类型">
<el-select v-model="screeningParams.infectionType" clearable placeholder="全部">
<el-option label="医院感染" value="医院感染" />
<el-option label="社区感染" value="社区感染" />
</el-select>
</el-form-item>
<el-form-item label="住院天数阈值">
<el-input-number v-model="screeningParams.minDays" :min="0" :max="365" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleScreening" :loading="screening">
执行筛查
</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card v-if="screeningResult" shadow="never" style="margin-bottom: 16px">
<template #header>
<span>筛查结果概览</span>
</template>
<div style="display: flex; gap: 40px; text-align: center">
<div>
<div style="font-size: 28px; font-weight: bold; color: #409eff">
{{ screeningResult.screenedCount || 0 }}
</div>
<div>筛查病例数</div>
</div>
<div>
<div style="font-size: 28px; font-weight: bold; color: #e6a23c">
{{ screeningResult.suspectedCount || 0 }}
</div>
<div>疑似病例数</div>
</div>
<div>
<div style="font-size: 28px; font-weight: bold; color: #67c23a">
{{ screeningResult.screenTime || '-' }}
</div>
<div>筛查时间</div>
</div>
</div>
<div style="margin-top: 12px">
<el-tag v-for="(rule, index) in screeningResult.rules" :key="index" style="margin-right: 8px">
{{ rule }}
</el-tag>
</div>
</el-card>
<el-card shadow="never">
<template #header>
<div style="display: flex; justify-content: space-between; align-items: center">
<span>筛查结果列表</span>
<el-button type="primary" link @click="loadResults">刷新</el-button>
</div>
</template>
<el-table :data="results" v-loading="loading" border stripe style="width: 100%">
<el-table-column prop="patientName" label="患者姓名" width="100" />
<el-table-column prop="infectionType" label="感染类型" width="100" />
<el-table-column prop="infectionSite" label="感染部位" width="120" />
<el-table-column prop="pathogen" label="病原体" width="120" />
<el-table-column prop="diagnosisDate" label="诊断日期" width="120" />
<el-table-column prop="reportTime" label="上报时间" width="170" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusText(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="reviewResult" label="审核结果" width="100">
<template #default="{ row }">
<el-tag v-if="row.reviewResult" :type="row.reviewResult === 'CONFIRMED' ? 'success' : 'danger'" size="small">
{{ row.reviewResult === 'CONFIRMED' ? '确认' : '驳回' }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { runScreening, getScreeningResults } from '@/api/infection/screening'
const screeningParams = reactive({
startDate: '',
endDate: '',
infectionType: '',
minDays: 3
})
const screening = ref(false)
const loading = ref(false)
const screeningResult = ref(null)
const results = ref([])
const statusText = (status) => {
const map = { 'REPORTED': '已上报', 'REVIEWED': '已审核', 'CONFIRMED': '已确认', 'REJECTED': '已驳回' }
return map[status] || status
}
const statusTagType = (status) => {
const map = { 'REPORTED': 'warning', 'REVIEWED': 'info', 'CONFIRMED': 'success', 'REJECTED': 'danger' }
return map[status] || ''
}
const handleScreening = async () => {
screening.value = true
try {
const res = await runScreening(screeningParams)
screeningResult.value = res.data
results.value = res.data?.suspectedCases || []
ElMessage.success('筛查完成')
} catch (e) {
ElMessage.error('筛查失败: ' + (e.message || '未知错误'))
} finally {
screening.value = false
}
}
const loadResults = async () => {
loading.value = true
try {
const res = await getScreeningResults({
startDate: screeningParams.startDate,
endDate: screeningParams.endDate
})
results.value = res.data || []
} finally {
loading.value = false
}
}
onMounted(() => loadResults())
</script>
<style scoped>
.screening-container { padding: 16px; }
.page-header { margin-bottom: 16px; }
.tab-title { font-size: 18px; font-weight: bold; }
</style>