562 [门诊医生工作站-待写病历]数据加载时间超过2秒一直加载
561 [门诊医生站-医嘱] 医嘱录入后,总量单位显示异常,显示为“null”而非诊疗目录配置值 544 【智能分诊】排队队列列表无法显示“完诊”状态患者且缺失历史队列查询功能 505 【业务逻辑缺陷】药品医嘱已由药房发药,护士仍能在“医嘱校对”模块执行“退回”操作
This commit is contained in:
@@ -63,17 +63,21 @@ public interface IDoctorStationEmrAppService {
|
||||
* 获取待写病历列表
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @return 待写病历列表
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历分页数据
|
||||
*/
|
||||
R<?> getPendingEmrList(Long doctorId);
|
||||
R<?> getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName);
|
||||
|
||||
/**
|
||||
* 获取待写病历数量
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
R<?> getPendingEmrCount(Long doctorId);
|
||||
R<?> getPendingEmrCount(Long doctorId, String patientName);
|
||||
|
||||
/**
|
||||
* 检查患者是否需要写病历
|
||||
|
||||
@@ -2205,6 +2205,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
||||
// 收费状态
|
||||
requestBaseDto.setChargeStatus_enumText(
|
||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
|
||||
// 单位字典翻译失败时回退使用原始值(如手术申请硬编码了中文单位名)
|
||||
if (StringUtils.isNotBlank(requestBaseDto.getUnitCode()) && StringUtils.isBlank(requestBaseDto.getUnitCode_dictText())) {
|
||||
requestBaseDto.setUnitCode_dictText(requestBaseDto.getUnitCode());
|
||||
}
|
||||
}
|
||||
return R.ok(requestBaseInfo);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.openhis.document.service.IEmrTemplateService;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService;
|
||||
import com.openhis.web.doctorstation.dto.EmrTemplateDto;
|
||||
import com.openhis.web.doctorstation.dto.PatientEmrDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -41,6 +42,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 医生站-电子病历 应用实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService {
|
||||
|
||||
@@ -60,13 +62,7 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
IDocRecordService docRecordService;
|
||||
|
||||
@Resource
|
||||
private EncounterMapper encounterMapper;
|
||||
|
||||
@Resource
|
||||
private PatientMapper patientMapper;
|
||||
|
||||
@Resource
|
||||
private com.openhis.administration.mapper.EncounterParticipantMapper encounterParticipantMapper;
|
||||
private com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper doctorStationEmrAppMapper;
|
||||
|
||||
/**
|
||||
* 添加病人病历信息
|
||||
@@ -223,52 +219,35 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
* @return 待写病历列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPendingEmrList(Long doctorId) {
|
||||
// 由于Encounter实体中没有jzPractitionerUserId字段,我们需要通过关联查询来获取相关信息
|
||||
// 使用医生工作站的mapper来查询相关数据
|
||||
// 这里我们直接使用医生工作站的查询逻辑
|
||||
public R<?> getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName) {
|
||||
List<Map<String, Object>> allRows = doctorStationEmrAppMapper.getPendingEmrList(doctorId, patientName);
|
||||
int total = allRows.size();
|
||||
|
||||
// 查询当前医生负责的、状态为"就诊中"但还没有写病历的患者
|
||||
// 需要通过EncounterParticipant表来关联医生信息
|
||||
List<Encounter> encounters = encounterMapper.selectList(
|
||||
new LambdaQueryWrapper<Encounter>()
|
||||
.eq(Encounter::getStatusEnum, EncounterStatus.IN_PROGRESS.getValue())
|
||||
);
|
||||
|
||||
// 过滤出由指定医生负责且还没有写病历的就诊记录
|
||||
List<Map<String, Object>> pendingEmrs = new ArrayList<>();
|
||||
for (Encounter encounter : encounters) {
|
||||
// 检查该就诊记录是否已经有病历
|
||||
Emr existingEmr = emrService.getOne(
|
||||
new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounter.getId())
|
||||
);
|
||||
|
||||
// 检查该就诊是否由指定医生负责
|
||||
boolean isAssignedToDoctor = isEncounterAssignedToDoctor(encounter.getId(), doctorId);
|
||||
|
||||
if (existingEmr == null && isAssignedToDoctor) {
|
||||
// 如果没有病历且由该医生负责,则添加到待写病历列表
|
||||
Map<String, Object> pendingEmr = new java.util.HashMap<>();
|
||||
|
||||
// 获取患者信息
|
||||
Patient patient = patientMapper.selectById(encounter.getPatientId());
|
||||
|
||||
pendingEmr.put("encounterId", encounter.getId());
|
||||
pendingEmr.put("patientId", encounter.getPatientId());
|
||||
pendingEmr.put("patientName", patient != null ? patient.getName() : "未知");
|
||||
pendingEmr.put("gender", patient != null ? patient.getGenderEnum() : null);
|
||||
// 使用出生日期计算年龄
|
||||
pendingEmr.put("age", patient != null && patient.getBirthDate() != null ?
|
||||
calculateAge(patient.getBirthDate()) : null);
|
||||
// 使用创建时间作为挂号时间
|
||||
pendingEmr.put("registerTime", encounter.getCreateTime());
|
||||
pendingEmr.put("busNo", encounter.getBusNo()); // 病历号
|
||||
|
||||
pendingEmrs.add(pendingEmr);
|
||||
}
|
||||
// 分页截取
|
||||
int fromIndex = (pageNo - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, total);
|
||||
List<Map<String, Object>> pageRows;
|
||||
if (fromIndex >= total) {
|
||||
pageRows = new ArrayList<>();
|
||||
} else {
|
||||
pageRows = allRows.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
return R.ok(pendingEmrs);
|
||||
// 计算年龄列
|
||||
for (Map<String, Object> row : pageRows) {
|
||||
Object birthDate = row.get("birthDate");
|
||||
if (birthDate instanceof Date) {
|
||||
row.put("age", calculateAge((Date) birthDate));
|
||||
} else {
|
||||
row.put("age", null);
|
||||
}
|
||||
row.remove("birthDate");
|
||||
}
|
||||
|
||||
Map<String, Object> result = new java.util.HashMap<>();
|
||||
result.put("rows", pageRows);
|
||||
result.put("total", total);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,14 +257,9 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPendingEmrCount(Long doctorId) {
|
||||
// 获取待写病历列表,然后返回数量
|
||||
R<?> result = getPendingEmrList(doctorId);
|
||||
if (result.getCode() == 200) {
|
||||
List<?> pendingEmrs = (List<?>) result.getData();
|
||||
return R.ok(pendingEmrs.size());
|
||||
}
|
||||
return R.ok(0);
|
||||
public R<?> getPendingEmrCount(Long doctorId, String patientName) {
|
||||
Long count = doctorStationEmrAppMapper.getPendingEmrCount(doctorId, patientName);
|
||||
return R.ok(count != null ? count.intValue() : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,24 +280,6 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
return R.ok(needWrite);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查就诊是否分配给指定医生
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param doctorId 医生ID
|
||||
* @return 是否分配给指定医生
|
||||
*/
|
||||
private boolean isEncounterAssignedToDoctor(Long encounterId, Long doctorId) {
|
||||
// 查询就诊参与者表,检查是否有指定医生的接诊记录
|
||||
com.openhis.administration.domain.EncounterParticipant participant =
|
||||
encounterParticipantMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.openhis.administration.domain.EncounterParticipant>()
|
||||
.eq(com.openhis.administration.domain.EncounterParticipant::getEncounterId, encounterId)
|
||||
.eq(com.openhis.administration.domain.EncounterParticipant::getPractitionerId, doctorId)
|
||||
);
|
||||
|
||||
return participant != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据出生日期计算年龄
|
||||
|
||||
@@ -26,34 +26,36 @@ public class PendingEmrController {
|
||||
* 获取待写病历列表
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @return 待写病历列表
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历分页数据
|
||||
*/
|
||||
@GetMapping("/pending-list")
|
||||
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId) {
|
||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
||||
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String patientName) {
|
||||
if (doctorId == null) {
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||
}
|
||||
|
||||
// 调用服务获取待写病历列表
|
||||
return iDoctorStationEmrAppService.getPendingEmrList(doctorId);
|
||||
return iDoctorStationEmrAppService.getPendingEmrList(doctorId, pageNum, pageSize, patientName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待写病历数量
|
||||
*
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
@GetMapping("/pending-count")
|
||||
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId) {
|
||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
||||
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId,
|
||||
@RequestParam(required = false) String patientName) {
|
||||
if (doctorId == null) {
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||
}
|
||||
|
||||
// 调用服务获取待写病历数量
|
||||
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId);
|
||||
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId, patientName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.openhis.web.doctorstation.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 医生站-电子病历 应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface DoctorStationEmrAppMapper {
|
||||
|
||||
List<Map<String, Object>> getPendingEmrList(@Param("doctorId") Long doctorId,
|
||||
@Param("patientName") String patientName);
|
||||
|
||||
Long getPendingEmrCount(@Param("doctorId") Long doctorId,
|
||||
@Param("patientName") String patientName);
|
||||
}
|
||||
|
||||
@@ -359,6 +359,24 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
||||
medRequestList.add(item);
|
||||
}
|
||||
}
|
||||
// 校验医嘱是否已执行,已执行的医嘱需要先取消执行后才能退回
|
||||
List<Long> allRequestIds = performInfoList.stream().map(PerformInfoDto::getRequestId).toList();
|
||||
List<Procedure> allProcedures = procedureService.list(
|
||||
new LambdaQueryWrapper<Procedure>()
|
||||
.in(Procedure::getRequestId, allRequestIds)
|
||||
.eq(Procedure::getDeleteFlag, "0"));
|
||||
Set<Long> executedIds = allProcedures.stream()
|
||||
.filter(p -> EventStatus.COMPLETED.getValue().equals(p.getStatusEnum()))
|
||||
.map(Procedure::getId)
|
||||
.collect(Collectors.toSet());
|
||||
Set<Long> cancelledRefundIds = allProcedures.stream()
|
||||
.filter(p -> EventStatus.CANCEL.getValue().equals(p.getStatusEnum()) && p.getRefundId() != null)
|
||||
.map(Procedure::getRefundId)
|
||||
.collect(Collectors.toSet());
|
||||
executedIds.removeAll(cancelledRefundIds);
|
||||
if (!executedIds.isEmpty()) {
|
||||
return R.fail("该医嘱已执行,请先取消执行后再退回");
|
||||
}
|
||||
// 校验药品医嘱是否已发药,已发药的医嘱不允许退回
|
||||
if (!medRequestList.isEmpty()) {
|
||||
List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
||||
|
||||
@@ -31,8 +31,8 @@ public class HomeController {
|
||||
HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics();
|
||||
|
||||
// 获取待写病历数量
|
||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId);
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(practitionerId, null);
|
||||
|
||||
// 将待写病历数量添加到统计数据中
|
||||
statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData());
|
||||
|
||||
@@ -74,7 +74,6 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
|
||||
.eq(TriageQueueItem::getTenantId, tenantId)
|
||||
.eq(TriageQueueItem::getQueueDate, qd)
|
||||
.eq(TriageQueueItem::getDeleteFlag, "0")
|
||||
.ne(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue())
|
||||
.orderByAsc(TriageQueueItem::getQueueOrder);
|
||||
|
||||
// 如果指定了科室,按科室过滤;否则查询所有科室(全科模式)
|
||||
@@ -92,14 +91,6 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 双重保险:再次过滤掉 COMPLETED 状态的患者(防止数据库中有异常数据)
|
||||
if (list != null && !list.isEmpty()) {
|
||||
int beforeSize = list.size();
|
||||
list = list.stream()
|
||||
.filter(item -> !TriageQueueStatus.COMPLETED.getValue().equals(item.getStatus()))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,4 +4,38 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper">
|
||||
|
||||
</mapper>
|
||||
<select id="getPendingEmrList" resultType="java.util.HashMap">
|
||||
SELECT e.id AS "encounterId",
|
||||
e.patient_id AS "patientId",
|
||||
p.name AS "patientName",
|
||||
p.gender_enum AS "gender",
|
||||
p.birth_date AS "birthDate",
|
||||
e.create_time AS "registerTime",
|
||||
e.bus_no AS "busNo"
|
||||
FROM adm_encounter e
|
||||
INNER JOIN adm_encounter_participant ep ON e.id = ep.encounter_id AND ep.practitioner_id = #{doctorId}
|
||||
LEFT JOIN adm_patient p ON e.patient_id = p.id
|
||||
LEFT JOIN doc_emr emr ON e.id = emr.encounter_id
|
||||
WHERE e.status_enum = 2
|
||||
AND emr.id IS NULL
|
||||
<if test="patientName != null and patientName != ''">
|
||||
AND p.name LIKE CONCAT('%', #{patientName}, '%')
|
||||
</if>
|
||||
ORDER BY e.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getPendingEmrCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM adm_encounter e
|
||||
INNER JOIN adm_encounter_participant ep ON e.id = ep.encounter_id AND ep.practitioner_id = #{doctorId}
|
||||
LEFT JOIN doc_emr emr ON e.id = emr.encounter_id
|
||||
WHERE e.status_enum = 2
|
||||
AND emr.id IS NULL
|
||||
<if test="patientName != null and patientName != ''">
|
||||
AND e.patient_id IN (
|
||||
SELECT id FROM adm_patient WHERE name LIKE CONCAT('%', #{patientName}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -89,8 +89,14 @@ const getList = async () => {
|
||||
const response = await listPendingEmr(queryParams)
|
||||
// 根据后端返回的数据结构调整
|
||||
if (response.code === 200) {
|
||||
emrList.value = response.data || []
|
||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
||||
const data = response.data
|
||||
if (data && data.rows !== undefined) {
|
||||
emrList.value = data.rows || []
|
||||
total.value = data.total || 0
|
||||
} else {
|
||||
emrList.value = Array.isArray(data) ? data : []
|
||||
total.value = emrList.value.length
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||
emrList.value = []
|
||||
|
||||
@@ -113,10 +113,17 @@ const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await listPendingEmr(queryParams)
|
||||
// 根据后端返回的数据结构调整
|
||||
if (response.code === 200) {
|
||||
emrList.value = response.data || []
|
||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
||||
const data = response.data
|
||||
if (data && data.rows !== undefined) {
|
||||
// 新分页格式 {rows, total}
|
||||
emrList.value = data.rows || []
|
||||
total.value = data.total || 0
|
||||
} else {
|
||||
// 兼容旧格式(数组)
|
||||
emrList.value = Array.isArray(data) ? data : []
|
||||
total.value = emrList.value.length
|
||||
}
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||
emrList.value = []
|
||||
|
||||
@@ -88,16 +88,16 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="candidate-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectedCandidates.length === 0"
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectedCandidates.length === 0 || isQueryingHistory"
|
||||
@click="handleAddToQueue"
|
||||
>
|
||||
加入队列 >>
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="filteredCandidatePoolList.length === 0"
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="filteredCandidatePoolList.length === 0 || isQueryingHistory"
|
||||
@click="handleAddAllToQueue"
|
||||
>
|
||||
一键加入队列
|
||||
@@ -109,6 +109,19 @@
|
||||
<div class="right-panel">
|
||||
<div class="panel-header">
|
||||
<span class="panel-title">② 智能队列 (全科)</span>
|
||||
<div class="history-query">
|
||||
<el-date-picker
|
||||
v-model="queryDate"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
size="small"
|
||||
style="width: 150px"
|
||||
/>
|
||||
<el-button type="primary" size="small" @click="handleHistoryQuery">查询</el-button>
|
||||
<el-button size="small" @click="handleTodayQuery">今天</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-container">
|
||||
<el-table
|
||||
@@ -173,25 +186,25 @@
|
||||
</div>
|
||||
<div class="display-options">
|
||||
<div class="queue-actions-left">
|
||||
<el-button
|
||||
type="danger"
|
||||
:disabled="!selectedQueueRow"
|
||||
<el-button
|
||||
type="danger"
|
||||
:disabled="!selectedQueueRow || isQueryingHistory"
|
||||
size="small"
|
||||
@click="handleRemoveFromQueue"
|
||||
>
|
||||
<< 移出队列
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveUp"
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveUp || isQueryingHistory"
|
||||
size="small"
|
||||
@click="handleMoveUp"
|
||||
>
|
||||
↑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveDown"
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveDown || isQueryingHistory"
|
||||
size="small"
|
||||
@click="handleMoveDown"
|
||||
>
|
||||
@@ -259,30 +272,35 @@
|
||||
<div class="control-buttons">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="isQueryingHistory"
|
||||
@click="handleSelectCall"
|
||||
>
|
||||
选呼
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
:disabled="isQueryingHistory"
|
||||
@click="handleNextPatient"
|
||||
>
|
||||
下一患者
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
:disabled="isQueryingHistory"
|
||||
@click="handleSkip"
|
||||
>
|
||||
跳过
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="isQueryingHistory"
|
||||
@click="handleComplete"
|
||||
>
|
||||
完成
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="isQueryingHistory"
|
||||
@click="handleRequeue"
|
||||
>
|
||||
过号重排
|
||||
@@ -682,6 +700,14 @@ const showOnlyWaiting = ref(false)
|
||||
// Bug #411:诊室过滤,替代原来的科室下拉框(selectedDept/departmentList 已移除)
|
||||
const selectedRoom = ref('all')
|
||||
|
||||
// 历史队列查询日期 (默认当天)
|
||||
const getTodayStr = () => {
|
||||
const now = new Date()
|
||||
return `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
|
||||
}
|
||||
const queryDate = ref(getTodayStr())
|
||||
const isQueryingHistory = computed(() => queryDate.value !== getTodayStr())
|
||||
|
||||
// 修复【#397】:动态获取当前科室名称
|
||||
const currentDeptName = computed(() => {
|
||||
return userStore.deptName || userStore.orgName || '心内科'
|
||||
@@ -901,14 +927,12 @@ const mapFrontendStatusToBackend = (status) => {
|
||||
}
|
||||
|
||||
// 从数据库加载队列
|
||||
const loadQueueFromDb = async () => {
|
||||
const loadQueueFromDb = async (dateStr) => {
|
||||
try {
|
||||
// Bug #411:不再按科室选筛加载,后端默认按当前登录人科室查询
|
||||
const organizationId = undefined
|
||||
// 只查询今天的患者
|
||||
const today = new Date()
|
||||
const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`
|
||||
const res = await getTriageQueueList({ organizationId, date: todayStr }).catch((err) => {
|
||||
const queryDateStr = dateStr || queryDate.value
|
||||
const res = await getTriageQueueList({ organizationId, date: queryDateStr }).catch((err) => {
|
||||
console.error('【心内科】loadQueueFromDb 请求异常:', err)
|
||||
return { code: 500, msg: err?.message || '请求失败', data: null }
|
||||
})
|
||||
@@ -931,10 +955,6 @@ const loadQueueFromDb = async () => {
|
||||
originalQueueList.value = list
|
||||
.map((it) => {
|
||||
const frontendStatus = mapBackendStatusToFrontend(it.status)
|
||||
// 调试日志:检查状态映射
|
||||
if (list.length <= 5) {
|
||||
console.log('【心内科】状态映射:后端状态=', it.status, '-> 前端状态=', frontendStatus, '患者=', it.patientName)
|
||||
}
|
||||
// 计算等待时间:基于创建时间(createTime)
|
||||
let waitingTime = '00:00'
|
||||
if (it.createTime) {
|
||||
@@ -972,15 +992,7 @@ const loadQueueFromDb = async () => {
|
||||
organizationId: it.organizationId
|
||||
}
|
||||
})
|
||||
.filter((item) => {
|
||||
// 过滤掉"已完成"状态的患者,不显示在队列中
|
||||
if (item.status === '已完成') {
|
||||
console.log('【心内科】过滤掉已完成状态的患者:', item.patientName)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
|
||||
// 调试日志:检查查找结果
|
||||
const callingCount = originalQueueList.value.filter(i => i.status === '叫号中').length
|
||||
const waitingCount = originalQueueList.value.filter(i => i.status === '等待').length
|
||||
@@ -1196,9 +1208,6 @@ const formatSecondsToMmSs = (totalSeconds) => {
|
||||
const filteredQueueList = computed(() => {
|
||||
let filtered = originalQueueList.value
|
||||
|
||||
// 先过滤掉"已完成"状态的患者(无论什么情况都不显示)
|
||||
filtered = filtered.filter(item => item.status !== '已完成')
|
||||
|
||||
// 再按诊室过滤
|
||||
if (selectedRoom.value !== 'all') {
|
||||
filtered = filtered.filter(item => item.room === selectedRoom.value)
|
||||
@@ -1627,6 +1636,26 @@ const handleRefresh = async () => {
|
||||
ElMessage.success('已刷新(已从数据库恢复队列)')
|
||||
}
|
||||
|
||||
// 历史队列查询
|
||||
const handleHistoryQuery = async () => {
|
||||
if (!queryDate.value) {
|
||||
ElMessage.warning('请选择查询日期')
|
||||
return
|
||||
}
|
||||
console.log('【心内科】历史队列查询:', queryDate.value)
|
||||
await loadQueueFromDb(queryDate.value)
|
||||
if (isQueryingHistory.value) {
|
||||
ElMessage.success(`已加载 ${queryDate.value} 的队列数据`)
|
||||
}
|
||||
}
|
||||
|
||||
// 回到今天
|
||||
const handleTodayQuery = async () => {
|
||||
queryDate.value = getTodayStr()
|
||||
await loadQueueFromDb(getTodayStr())
|
||||
ElMessage.success('已切换到今天队列')
|
||||
}
|
||||
|
||||
// 退出
|
||||
const handleExit = () => {
|
||||
ElMessage.info('退出功能待实现')
|
||||
@@ -2165,12 +2194,21 @@ onUnmounted(() => {
|
||||
padding: 15px 20px;
|
||||
border-bottom: 2px solid #409eff;
|
||||
background-color: #f8f9fa;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.panel-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.history-query {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.table-container {
|
||||
|
||||
Reference in New Issue
Block a user