562 [门诊医生工作站-待写病历]数据加载时间超过2秒一直加载
561 [门诊医生站-医嘱] 医嘱录入后,总量单位显示异常,显示为“null”而非诊疗目录配置值 544 【智能分诊】排队队列列表无法显示“完诊”状态患者且缺失历史队列查询功能 505 【业务逻辑缺陷】药品医嘱已由药房发药,护士仍能在“医嘱校对”模块执行“退回”操作
This commit is contained in:
@@ -63,17 +63,21 @@ public interface IDoctorStationEmrAppService {
|
|||||||
* 获取待写病历列表
|
* 获取待写病历列表
|
||||||
*
|
*
|
||||||
* @param doctorId 医生ID
|
* @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 doctorId 医生ID
|
||||||
|
* @param patientName 患者姓名(可选)
|
||||||
* @return 待写病历数量
|
* @return 待写病历数量
|
||||||
*/
|
*/
|
||||||
R<?> getPendingEmrCount(Long doctorId);
|
R<?> getPendingEmrCount(Long doctorId, String patientName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查患者是否需要写病历
|
* 检查患者是否需要写病历
|
||||||
|
|||||||
@@ -2205,6 +2205,10 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
// 收费状态
|
// 收费状态
|
||||||
requestBaseDto.setChargeStatus_enumText(
|
requestBaseDto.setChargeStatus_enumText(
|
||||||
EnumUtils.getInfoByValue(ChargeItemStatus.class, requestBaseDto.getChargeStatus()));
|
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);
|
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.appservice.IDoctorStationEmrAppService;
|
||||||
import com.openhis.web.doctorstation.dto.EmrTemplateDto;
|
import com.openhis.web.doctorstation.dto.EmrTemplateDto;
|
||||||
import com.openhis.web.doctorstation.dto.PatientEmrDto;
|
import com.openhis.web.doctorstation.dto.PatientEmrDto;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* 医生站-电子病历 应用实现类
|
* 医生站-电子病历 应用实现类
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService {
|
public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService {
|
||||||
|
|
||||||
@@ -60,13 +62,7 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
|||||||
IDocRecordService docRecordService;
|
IDocRecordService docRecordService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EncounterMapper encounterMapper;
|
private com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper doctorStationEmrAppMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private PatientMapper patientMapper;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private com.openhis.administration.mapper.EncounterParticipantMapper encounterParticipantMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加病人病历信息
|
* 添加病人病历信息
|
||||||
@@ -223,52 +219,35 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
|||||||
* @return 待写病历列表
|
* @return 待写病历列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> getPendingEmrList(Long doctorId) {
|
public R<?> getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName) {
|
||||||
// 由于Encounter实体中没有jzPractitionerUserId字段,我们需要通过关联查询来获取相关信息
|
List<Map<String, Object>> allRows = doctorStationEmrAppMapper.getPendingEmrList(doctorId, patientName);
|
||||||
// 使用医生工作站的mapper来查询相关数据
|
int total = allRows.size();
|
||||||
// 这里我们直接使用医生工作站的查询逻辑
|
|
||||||
|
|
||||||
// 查询当前医生负责的、状态为"就诊中"但还没有写病历的患者
|
// 分页截取
|
||||||
// 需要通过EncounterParticipant表来关联医生信息
|
int fromIndex = (pageNo - 1) * pageSize;
|
||||||
List<Encounter> encounters = encounterMapper.selectList(
|
int toIndex = Math.min(fromIndex + pageSize, total);
|
||||||
new LambdaQueryWrapper<Encounter>()
|
List<Map<String, Object>> pageRows;
|
||||||
.eq(Encounter::getStatusEnum, EncounterStatus.IN_PROGRESS.getValue())
|
if (fromIndex >= total) {
|
||||||
);
|
pageRows = new ArrayList<>();
|
||||||
|
} else {
|
||||||
// 过滤出由指定医生负责且还没有写病历的就诊记录
|
pageRows = allRows.subList(fromIndex, toIndex);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 待写病历数量
|
* @return 待写病历数量
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> getPendingEmrCount(Long doctorId) {
|
public R<?> getPendingEmrCount(Long doctorId, String patientName) {
|
||||||
// 获取待写病历列表,然后返回数量
|
Long count = doctorStationEmrAppMapper.getPendingEmrCount(doctorId, patientName);
|
||||||
R<?> result = getPendingEmrList(doctorId);
|
return R.ok(count != null ? count.intValue() : 0);
|
||||||
if (result.getCode() == 200) {
|
|
||||||
List<?> pendingEmrs = (List<?>) result.getData();
|
|
||||||
return R.ok(pendingEmrs.size());
|
|
||||||
}
|
|
||||||
return R.ok(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -306,24 +280,6 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
|||||||
return R.ok(needWrite);
|
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
|
* @param doctorId 医生ID
|
||||||
* @return 待写病历列表
|
* @param pageNo 当前页码
|
||||||
|
* @param pageSize 每页条数
|
||||||
|
* @param patientName 患者姓名(可选)
|
||||||
|
* @return 待写病历分页数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pending-list")
|
@GetMapping("/pending-list")
|
||||||
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId) {
|
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId,
|
||||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(required = false) String patientName) {
|
||||||
if (doctorId == null) {
|
if (doctorId == null) {
|
||||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
}
|
}
|
||||||
|
return iDoctorStationEmrAppService.getPendingEmrList(doctorId, pageNum, pageSize, patientName);
|
||||||
// 调用服务获取待写病历列表
|
|
||||||
return iDoctorStationEmrAppService.getPendingEmrList(doctorId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取待写病历数量
|
* 获取待写病历数量
|
||||||
*
|
*
|
||||||
* @param doctorId 医生ID
|
* @param doctorId 医生ID
|
||||||
|
* @param patientName 患者姓名(可选)
|
||||||
* @return 待写病历数量
|
* @return 待写病历数量
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pending-count")
|
@GetMapping("/pending-count")
|
||||||
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId) {
|
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId,
|
||||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
@RequestParam(required = false) String patientName) {
|
||||||
if (doctorId == null) {
|
if (doctorId == null) {
|
||||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
}
|
}
|
||||||
|
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId, patientName);
|
||||||
// 调用服务获取待写病历数量
|
|
||||||
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,11 +1,20 @@
|
|||||||
package com.openhis.web.doctorstation.mapper;
|
package com.openhis.web.doctorstation.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 医生站-电子病历 应用Mapper
|
* 医生站-电子病历 应用Mapper
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface DoctorStationEmrAppMapper {
|
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);
|
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()) {
|
if (!medRequestList.isEmpty()) {
|
||||||
List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public class HomeController {
|
|||||||
HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics();
|
HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics();
|
||||||
|
|
||||||
// 获取待写病历数量
|
// 获取待写病历数量
|
||||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId);
|
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(practitionerId, null);
|
||||||
|
|
||||||
// 将待写病历数量添加到统计数据中
|
// 将待写病历数量添加到统计数据中
|
||||||
statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData());
|
statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData());
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ public class TriageQueueAppServiceImpl implements TriageQueueAppService {
|
|||||||
.eq(TriageQueueItem::getTenantId, tenantId)
|
.eq(TriageQueueItem::getTenantId, tenantId)
|
||||||
.eq(TriageQueueItem::getQueueDate, qd)
|
.eq(TriageQueueItem::getQueueDate, qd)
|
||||||
.eq(TriageQueueItem::getDeleteFlag, "0")
|
.eq(TriageQueueItem::getDeleteFlag, "0")
|
||||||
.ne(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue())
|
|
||||||
.orderByAsc(TriageQueueItem::getQueueOrder);
|
.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);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,38 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper">
|
<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)
|
const response = await listPendingEmr(queryParams)
|
||||||
// 根据后端返回的数据结构调整
|
// 根据后端返回的数据结构调整
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
emrList.value = response.data || []
|
const data = response.data
|
||||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
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 {
|
} else {
|
||||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||||
emrList.value = []
|
emrList.value = []
|
||||||
|
|||||||
@@ -113,10 +113,17 @@ const getList = async () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const response = await listPendingEmr(queryParams)
|
const response = await listPendingEmr(queryParams)
|
||||||
// 根据后端返回的数据结构调整
|
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
emrList.value = response.data || []
|
const data = response.data
|
||||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
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 {
|
} else {
|
||||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||||
emrList.value = []
|
emrList.value = []
|
||||||
|
|||||||
@@ -88,16 +88,16 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="candidate-actions">
|
<div class="candidate-actions">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="selectedCandidates.length === 0"
|
:disabled="selectedCandidates.length === 0 || isQueryingHistory"
|
||||||
@click="handleAddToQueue"
|
@click="handleAddToQueue"
|
||||||
>
|
>
|
||||||
加入队列 >>
|
加入队列 >>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
:disabled="filteredCandidatePoolList.length === 0"
|
:disabled="filteredCandidatePoolList.length === 0 || isQueryingHistory"
|
||||||
@click="handleAddAllToQueue"
|
@click="handleAddAllToQueue"
|
||||||
>
|
>
|
||||||
一键加入队列
|
一键加入队列
|
||||||
@@ -109,6 +109,19 @@
|
|||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<span class="panel-title">② 智能队列 (全科)</span>
|
<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>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table
|
<el-table
|
||||||
@@ -173,25 +186,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="display-options">
|
<div class="display-options">
|
||||||
<div class="queue-actions-left">
|
<div class="queue-actions-left">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
:disabled="!selectedQueueRow"
|
:disabled="!selectedQueueRow || isQueryingHistory"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleRemoveFromQueue"
|
@click="handleRemoveFromQueue"
|
||||||
>
|
>
|
||||||
<< 移出队列
|
<< 移出队列
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
:disabled="!selectedQueueRow || !canMoveUp"
|
:disabled="!selectedQueueRow || !canMoveUp || isQueryingHistory"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleMoveUp"
|
@click="handleMoveUp"
|
||||||
>
|
>
|
||||||
↑
|
↑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
:disabled="!selectedQueueRow || !canMoveDown"
|
:disabled="!selectedQueueRow || !canMoveDown || isQueryingHistory"
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleMoveDown"
|
@click="handleMoveDown"
|
||||||
>
|
>
|
||||||
@@ -259,30 +272,35 @@
|
|||||||
<div class="control-buttons">
|
<div class="control-buttons">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:disabled="isQueryingHistory"
|
||||||
@click="handleSelectCall"
|
@click="handleSelectCall"
|
||||||
>
|
>
|
||||||
选呼
|
选呼
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
:disabled="isQueryingHistory"
|
||||||
@click="handleNextPatient"
|
@click="handleNextPatient"
|
||||||
>
|
>
|
||||||
下一患者
|
下一患者
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
:disabled="isQueryingHistory"
|
||||||
@click="handleSkip"
|
@click="handleSkip"
|
||||||
>
|
>
|
||||||
跳过
|
跳过
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
:disabled="isQueryingHistory"
|
||||||
@click="handleComplete"
|
@click="handleComplete"
|
||||||
>
|
>
|
||||||
完成
|
完成
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
|
:disabled="isQueryingHistory"
|
||||||
@click="handleRequeue"
|
@click="handleRequeue"
|
||||||
>
|
>
|
||||||
过号重排
|
过号重排
|
||||||
@@ -682,6 +700,14 @@ const showOnlyWaiting = ref(false)
|
|||||||
// Bug #411:诊室过滤,替代原来的科室下拉框(selectedDept/departmentList 已移除)
|
// Bug #411:诊室过滤,替代原来的科室下拉框(selectedDept/departmentList 已移除)
|
||||||
const selectedRoom = ref('all')
|
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】:动态获取当前科室名称
|
// 修复【#397】:动态获取当前科室名称
|
||||||
const currentDeptName = computed(() => {
|
const currentDeptName = computed(() => {
|
||||||
return userStore.deptName || userStore.orgName || '心内科'
|
return userStore.deptName || userStore.orgName || '心内科'
|
||||||
@@ -901,14 +927,12 @@ const mapFrontendStatusToBackend = (status) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 从数据库加载队列
|
// 从数据库加载队列
|
||||||
const loadQueueFromDb = async () => {
|
const loadQueueFromDb = async (dateStr) => {
|
||||||
try {
|
try {
|
||||||
// Bug #411:不再按科室选筛加载,后端默认按当前登录人科室查询
|
// Bug #411:不再按科室选筛加载,后端默认按当前登录人科室查询
|
||||||
const organizationId = undefined
|
const organizationId = undefined
|
||||||
// 只查询今天的患者
|
const queryDateStr = dateStr || queryDate.value
|
||||||
const today = new Date()
|
const res = await getTriageQueueList({ organizationId, date: queryDateStr }).catch((err) => {
|
||||||
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) => {
|
|
||||||
console.error('【心内科】loadQueueFromDb 请求异常:', err)
|
console.error('【心内科】loadQueueFromDb 请求异常:', err)
|
||||||
return { code: 500, msg: err?.message || '请求失败', data: null }
|
return { code: 500, msg: err?.message || '请求失败', data: null }
|
||||||
})
|
})
|
||||||
@@ -931,10 +955,6 @@ const loadQueueFromDb = async () => {
|
|||||||
originalQueueList.value = list
|
originalQueueList.value = list
|
||||||
.map((it) => {
|
.map((it) => {
|
||||||
const frontendStatus = mapBackendStatusToFrontend(it.status)
|
const frontendStatus = mapBackendStatusToFrontend(it.status)
|
||||||
// 调试日志:检查状态映射
|
|
||||||
if (list.length <= 5) {
|
|
||||||
console.log('【心内科】状态映射:后端状态=', it.status, '-> 前端状态=', frontendStatus, '患者=', it.patientName)
|
|
||||||
}
|
|
||||||
// 计算等待时间:基于创建时间(createTime)
|
// 计算等待时间:基于创建时间(createTime)
|
||||||
let waitingTime = '00:00'
|
let waitingTime = '00:00'
|
||||||
if (it.createTime) {
|
if (it.createTime) {
|
||||||
@@ -972,15 +992,7 @@ const loadQueueFromDb = async () => {
|
|||||||
organizationId: it.organizationId
|
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 callingCount = originalQueueList.value.filter(i => i.status === '叫号中').length
|
||||||
const waitingCount = 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(() => {
|
const filteredQueueList = computed(() => {
|
||||||
let filtered = originalQueueList.value
|
let filtered = originalQueueList.value
|
||||||
|
|
||||||
// 先过滤掉"已完成"状态的患者(无论什么情况都不显示)
|
|
||||||
filtered = filtered.filter(item => item.status !== '已完成')
|
|
||||||
|
|
||||||
// 再按诊室过滤
|
// 再按诊室过滤
|
||||||
if (selectedRoom.value !== 'all') {
|
if (selectedRoom.value !== 'all') {
|
||||||
filtered = filtered.filter(item => item.room === selectedRoom.value)
|
filtered = filtered.filter(item => item.room === selectedRoom.value)
|
||||||
@@ -1627,6 +1636,26 @@ const handleRefresh = async () => {
|
|||||||
ElMessage.success('已刷新(已从数据库恢复队列)')
|
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 = () => {
|
const handleExit = () => {
|
||||||
ElMessage.info('退出功能待实现')
|
ElMessage.info('退出功能待实现')
|
||||||
@@ -2165,12 +2194,21 @@ onUnmounted(() => {
|
|||||||
padding: 15px 20px;
|
padding: 15px 20px;
|
||||||
border-bottom: 2px solid #409eff;
|
border-bottom: 2px solid #409eff;
|
||||||
background-color: #f8f9fa;
|
background-color: #f8f9fa;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.panel-title {
|
.panel-title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.history-query {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
|
|||||||
Reference in New Issue
Block a user