Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3310a1de9e | |||
| bbeddc3077 | |||
|
|
3f4ada958c | ||
| 377bd55c03 | |||
| 30526ee4fc | |||
| fa0cd2b41d | |||
| 1f7aed4a8e | |||
| 9f0e69177c | |||
|
|
e5b85c733d | ||
| 75970f07b1 | |||
| 103121d832 | |||
| c39f0175bb | |||
| 1767710754 | |||
| ca8b547062 | |||
| 7fa4871977 | |||
| a7b09a0248 |
@@ -25,3 +25,11 @@
|
||||
1. `initData()`: Add `formData.executeTime = formatDateTime(new Date())` after line 899
|
||||
2. `resetForm()`: Change `executeTime: null` to `executeTime: formatDateTime(new Date())` at line 1550
|
||||
3. `loadApplicationToForm()`: Fix `isPackage` logic at line 2000
|
||||
|
||||
修复结果:✅ 成功,5行改动
|
||||
|
||||
### 修改内容
|
||||
1. `initData()` (line ~898): 新增 `formData.executeTime = formatDateTime(new Date())` — 新增检验申请单时执行时间自动填充当前时间
|
||||
2. `resetForm()` (line ~1552): `executeTime: null` → `executeTime: formatDateTime(new Date())` — 重置表单/新增时执行时间默认当前时间
|
||||
3. `loadApplicationToForm()` (line ~2002): `isPackage` 判定从 `item.feePackageId != null || item.itemName?.includes('套餐')` 改为 `item.feePackageId != null && item.feePackageId !== '' && item.feePackageId !== 'null' && item.packageName` — 与 `loadCategoryItems()` 保持一致,只有真正的套餐项目才显示"套餐"标签
|
||||
|
||||
|
||||
36
bug556-analysis.md
Normal file
36
bug556-analysis.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Bug #556 分析报告
|
||||
|
||||
## Bug 描述
|
||||
【门诊医生站-检验】新增检验申请单时就诊卡号/执行时间未自动回显,且项目列表冗余显示"套餐"文字
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 问题1:就诊卡号字段为空
|
||||
**根因**:`formData.medicalrecordNumber` 绑定到前端"就诊卡号"字段,但数据来源映射错误。
|
||||
- `initData()` 第886行:`formData.medicalrecordNumber = props.patientInfo.identifierNo || ''`
|
||||
- `resetForm()` 第1526行:`medicalrecordNumber: props.patientInfo.identifierNo || ''`
|
||||
|
||||
`identifierNo` 是身份证号/标识号字段,通常为空。实际的就诊卡号/业务编号是 `props.patientInfo.busNo`。代码中 `formData.visitNo` 已经正确映射了 `busNo`,但 `medicalrecordNumber` 映射到了错误的字段。
|
||||
|
||||
### 问题2:执行时间未自动填充
|
||||
**根因**:`formData.executeTime` 初始值为 `null`(第978行),且 `initData()` 和 `resetForm()` 中均未赋予默认值。
|
||||
- 对比:`applyTime` 有 `startApplyTimeTimer()` 实时更新定时器(第1489行),但 `executeTime` 没有类似初始化。
|
||||
- 用户期望:新增申请单时执行时间应默认填充当前系统时间。
|
||||
|
||||
### 问题3:项目列表冗余显示"套餐"文字
|
||||
**根因**:`loadApplicationToForm()` 第2000行的 `isPackage` 判断条件过于宽松。
|
||||
- 第2000行:`const isPackage = item.feePackageId != null || item.itemName?.includes('套餐')`
|
||||
- 对比:`loadCategoryItems()` 第1190行已经做了正确修复:`item.feePackageId != null && ... && item.packageName`
|
||||
- 差异:第2000行只用 `feePackageId != null` 判断,缺少 `packageName` 联合判断。如果后端返回的非套餐项目 `feePackageId` 有值但 `packageName` 为空,仍会被误标为套餐。
|
||||
|
||||
## 修复方案
|
||||
|
||||
### 修复1:就诊卡号映射
|
||||
将 `medicalrecordNumber` 的数据源从 `props.patientInfo.identifierNo` 改为 `props.patientInfo.busNo`。
|
||||
涉及位置:`initData()` 第886行、`resetForm()` 第1526行
|
||||
|
||||
### 修复2:执行时间默认值
|
||||
在 `initData()` 和 `resetForm()` 中,将 `executeTime` 设置为当前时间。使用 `formatDateTime(new Date())` 格式化为 `YYYY-MM-DD HH:mm:ss`。
|
||||
|
||||
### 修复3:套餐标识判断
|
||||
将 `loadApplicationToForm()` 第2000行的 `isPackage` 判断条件与 `loadCategoryItems()` 第1190行保持一致,增加 `item.packageName` 联合判断。
|
||||
@@ -63,21 +63,17 @@ public interface IDoctorStationEmrAppService {
|
||||
* 获取待写病历列表
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历分页数据
|
||||
* @return 待写病历列表
|
||||
*/
|
||||
R<?> getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName);
|
||||
R<?> getPendingEmrList(Long doctorId);
|
||||
|
||||
/**
|
||||
* 获取待写病历数量
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
R<?> getPendingEmrCount(Long doctorId, String patientName);
|
||||
R<?> getPendingEmrCount(Long doctorId);
|
||||
|
||||
/**
|
||||
* 检查患者是否需要写病历
|
||||
|
||||
@@ -2205,10 +2205,6 @@ 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,7 +29,6 @@ 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;
|
||||
|
||||
@@ -42,7 +41,6 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 医生站-电子病历 应用实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppService {
|
||||
|
||||
@@ -62,7 +60,13 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
IDocRecordService docRecordService;
|
||||
|
||||
@Resource
|
||||
private com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper doctorStationEmrAppMapper;
|
||||
private EncounterMapper encounterMapper;
|
||||
|
||||
@Resource
|
||||
private PatientMapper patientMapper;
|
||||
|
||||
@Resource
|
||||
private com.openhis.administration.mapper.EncounterParticipantMapper encounterParticipantMapper;
|
||||
|
||||
/**
|
||||
* 添加病人病历信息
|
||||
@@ -219,35 +223,52 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
* @return 待写病历列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPendingEmrList(Long doctorId, Integer pageNo, Integer pageSize, String patientName) {
|
||||
List<Map<String, Object>> allRows = doctorStationEmrAppMapper.getPendingEmrList(doctorId, patientName);
|
||||
int total = allRows.size();
|
||||
public R<?> getPendingEmrList(Long doctorId) {
|
||||
// 由于Encounter实体中没有jzPractitionerUserId字段,我们需要通过关联查询来获取相关信息
|
||||
// 使用医生工作站的mapper来查询相关数据
|
||||
// 这里我们直接使用医生工作站的查询逻辑
|
||||
|
||||
// 分页截取
|
||||
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);
|
||||
// 查询当前医生负责的、状态为"就诊中"但还没有写病历的患者
|
||||
// 需要通过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);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算年龄列
|
||||
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);
|
||||
return R.ok(pendingEmrs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,9 +278,14 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPendingEmrCount(Long doctorId, String patientName) {
|
||||
Long count = doctorStationEmrAppMapper.getPendingEmrCount(doctorId, patientName);
|
||||
return R.ok(count != null ? count.intValue() : 0);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,6 +306,24 @@ 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,36 +26,34 @@ public class PendingEmrController {
|
||||
* 获取待写病历列表
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 每页条数
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历分页数据
|
||||
* @return 待写病历列表
|
||||
*/
|
||||
@GetMapping("/pending-list")
|
||||
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false) String patientName) {
|
||||
public R<?> getPendingEmrList(@RequestParam(required = false) Long doctorId) {
|
||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
||||
if (doctorId == null) {
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
||||
}
|
||||
return iDoctorStationEmrAppService.getPendingEmrList(doctorId, pageNum, pageSize, patientName);
|
||||
|
||||
// 调用服务获取待写病历列表
|
||||
return iDoctorStationEmrAppService.getPendingEmrList(doctorId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待写病历数量
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param patientName 患者姓名(可选)
|
||||
* @return 待写病历数量
|
||||
*/
|
||||
@GetMapping("/pending-count")
|
||||
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId,
|
||||
@RequestParam(required = false) String patientName) {
|
||||
public R<?> getPendingEmrCount(@RequestParam(required = false) Long doctorId) {
|
||||
// 如果没有传递医生ID,则使用当前登录用户ID
|
||||
if (doctorId == null) {
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getPractitionerId();
|
||||
doctorId = com.core.common.utils.SecurityUtils.getLoginUser().getUserId();
|
||||
}
|
||||
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId, patientName);
|
||||
|
||||
// 调用服务获取待写病历数量
|
||||
return iDoctorStationEmrAppService.getPendingEmrCount(doctorId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
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,24 +359,6 @@ 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();
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
@@ -18,8 +17,6 @@ import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.document.domain.RequestForm;
|
||||
import com.openhis.document.service.IRequestFormService;
|
||||
import com.openhis.lab.domain.Specimen;
|
||||
import com.openhis.lab.service.ISpecimenService;
|
||||
import com.openhis.web.doctorstation.dto.ActivityChildrenJsonParams;
|
||||
import com.openhis.web.doctorstation.utils.AdviceUtils;
|
||||
import com.openhis.web.regdoctorstation.appservice.IRequestFormManageAppService;
|
||||
@@ -70,39 +67,6 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
@Resource
|
||||
IActivityDefinitionService iActivityDefinitionService;
|
||||
|
||||
@Resource
|
||||
ISpecimenService iSpecimenService;
|
||||
|
||||
/**
|
||||
* 校验当前用户是否有权操作该申请单(申请者本人或管理员)
|
||||
*/
|
||||
private R<?> validateRequestFormPermission(RequestForm requestForm) {
|
||||
if (SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
|
||||
return null;
|
||||
}
|
||||
Long currentPractitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
Long requesterId = requestForm.getRequesterId();
|
||||
if (currentPractitionerId == null || requesterId == null
|
||||
|| !currentPractitionerId.equals(requesterId)) {
|
||||
return R.fail("无操作权限,仅申请开立者或管理员可操作");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验关联医嘱是否已采证(存在已采集/已接收标本则不可撤回)
|
||||
*/
|
||||
private boolean hasCollectedSpecimen(List<Long> serviceRequestIds) {
|
||||
if (serviceRequestIds == null || serviceRequestIds.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
long count = iSpecimenService.count(
|
||||
new LambdaQueryWrapper<Specimen>()
|
||||
.in(Specimen::getServiceId, serviceRequestIds)
|
||||
.ge(Specimen::getCollectionStatusEnum, SpecCollectStatus.COLLECTED.getValue()));
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存申请单
|
||||
*
|
||||
@@ -564,17 +528,12 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
if (requestForm == null) {
|
||||
return R.fail("申请单不存在");
|
||||
}
|
||||
R<?> permissionResult = validateRequestFormPermission(requestForm);
|
||||
if (permissionResult != null) {
|
||||
return permissionResult;
|
||||
}
|
||||
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||
|
||||
// 查询该申请单下所有 ServiceRequest(含子项)
|
||||
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
|
||||
new LambdaQueryWrapper<ServiceRequest>()
|
||||
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo)
|
||||
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||
if (serviceRequests == null || serviceRequests.isEmpty()) {
|
||||
return R.fail("未找到关联的诊疗医嘱");
|
||||
}
|
||||
@@ -604,7 +563,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
// 4. 删除申请单
|
||||
iRequestFormService.removeById(requestFormId);
|
||||
|
||||
log.info("检验申请单删除成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||
log.info("检查申请单删除成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||
return R.ok("删除成功");
|
||||
}
|
||||
|
||||
@@ -617,43 +576,32 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
if (requestForm == null) {
|
||||
return R.fail("申请单不存在");
|
||||
}
|
||||
R<?> permissionResult = validateRequestFormPermission(requestForm);
|
||||
if (permissionResult != null) {
|
||||
return permissionResult;
|
||||
}
|
||||
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||
|
||||
// 查询该申请单下所有 ServiceRequest
|
||||
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
|
||||
new LambdaQueryWrapper<ServiceRequest>()
|
||||
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo)
|
||||
.eq(ServiceRequest::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||
if (serviceRequests == null || serviceRequests.isEmpty()) {
|
||||
return R.fail("未找到关联的诊疗医嘱");
|
||||
}
|
||||
|
||||
List<Long> serviceRequestIds = serviceRequests.stream()
|
||||
.map(ServiceRequest::getId).collect(Collectors.toList());
|
||||
|
||||
// 校验:标本已采集则不可撤回
|
||||
if (hasCollectedSpecimen(serviceRequestIds)) {
|
||||
return R.fail("标本已采集,无法撤回");
|
||||
}
|
||||
|
||||
// 校验:只有已签发(status=2)的申请单可撤回
|
||||
boolean allActive = serviceRequests.stream()
|
||||
.allMatch(sr -> RequestStatus.ACTIVE.getValue().equals(sr.getStatusEnum()));
|
||||
if (!allActive) {
|
||||
return R.fail("只有已签发且未采证的申请单可撤回");
|
||||
return R.fail("只有已签发状态的申请单可撤回");
|
||||
}
|
||||
|
||||
// 将所有 ServiceRequest 状态改回待签发,与申请单展示状态同步
|
||||
// 将所有 ServiceRequest 状态改回待签发(DRAFT=0)
|
||||
List<Long> serviceRequestIds = serviceRequests.stream()
|
||||
.map(ServiceRequest::getId).collect(Collectors.toList());
|
||||
iServiceRequestService.update(
|
||||
new ServiceRequest().setStatusEnum(RequestStatus.DRAFT.getValue()),
|
||||
new LambdaUpdateWrapper<ServiceRequest>()
|
||||
.in(ServiceRequest::getId, serviceRequestIds));
|
||||
|
||||
log.info("检验申请单撤回成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||
log.info("检查申请单撤回成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||
return R.ok("撤回成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public class HomeController {
|
||||
HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics();
|
||||
|
||||
// 获取待写病历数量
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(practitionerId, null);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId);
|
||||
|
||||
// 将待写病历数量添加到统计数据中
|
||||
statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData());
|
||||
|
||||
@@ -74,6 +74,7 @@ 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);
|
||||
|
||||
// 如果指定了科室,按科室过滤;否则查询所有科室(全科模式)
|
||||
@@ -91,6 +92,14 @@ 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,38 +4,4 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.doctorstation.mapper.DoctorStationEmrAppMapper">
|
||||
|
||||
<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>
|
||||
@@ -35,27 +35,21 @@
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 8
|
||||
) THEN 6
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 5
|
||||
) THEN 7
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 3
|
||||
) THEN 5
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
INNER JOIN lab_specimen ls ON ls.service_id = ws.id
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ls.collection_status_enum >= 1
|
||||
) THEN 4
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 2
|
||||
) THEN 1
|
||||
WHEN EXISTS (
|
||||
SELECT 1 FROM wor_service_request ws
|
||||
WHERE ws.prescription_no = drf.prescription_no AND ws.delete_flag = '0'
|
||||
AND ws.status_enum = 5
|
||||
) THEN 7
|
||||
ELSE 0
|
||||
END AS computed_status
|
||||
FROM doc_request_form AS drf
|
||||
|
||||
@@ -749,26 +749,22 @@ function handleInfectiousDiseaseReport() {
|
||||
'手足口病': '0311',
|
||||
};
|
||||
|
||||
// 获取所有命中传染病映射的诊断,但跳过已有已提交报卡的诊断
|
||||
const infectiousDiagnoses = form.value.diagnosisList
|
||||
.map(d => ({
|
||||
diagnosis: d,
|
||||
diseaseCode: d.name && d.hasInfectiousReport !== 1 ? diseaseNameToCode[d.name] : null
|
||||
}))
|
||||
.filter(item => item.diseaseCode);
|
||||
|
||||
const allSelectedDiseases = infectiousDiagnoses.map(item => item.diseaseCode);
|
||||
// 获取所有诊断名称对应的报卡编码,但跳过已有已提交报卡的诊断
|
||||
const allSelectedDiseases = form.value.diagnosisList
|
||||
.filter(d => d.name && d.hasInfectiousReport !== 1)
|
||||
.map(d => diseaseNameToCode[d.name] || null)
|
||||
.filter(code => code);
|
||||
|
||||
if (allSelectedDiseases.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 优先使用命中传染病映射的主诊断,否则使用第一条命中的传染病诊断
|
||||
const mainInfectiousDiagnosis = infectiousDiagnoses.find(item => item.diagnosis.maindiseFlag === 1)?.diagnosis;
|
||||
const firstInfectiousDiagnosis = infectiousDiagnoses[0].diagnosis;
|
||||
// 优先使用主诊断(同样跳过已有报卡的)
|
||||
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1 && d.hasInfectiousReport !== 1);
|
||||
const firstDiagnosis = form.value.diagnosisList.find(d => d.hasInfectiousReport !== 1) || form.value.diagnosisList[0];
|
||||
|
||||
const diagnosisToShow = {
|
||||
...(mainInfectiousDiagnosis || firstInfectiousDiagnosis),
|
||||
...(mainDiagnosis || firstDiagnosis),
|
||||
selectedDiseases: allSelectedDiseases
|
||||
};
|
||||
|
||||
|
||||
@@ -1442,7 +1442,7 @@ async function buildSubmitData() {
|
||||
const submitData = {
|
||||
cardNo: formData.cardNo,
|
||||
visitId: props.patientInfo?.encounterId || formData.encounterId || null,
|
||||
diagId: formData.diagnosisId || null,
|
||||
diagId: formData.diagnosisId ? Number(formData.diagnosisId) : null,
|
||||
patId: formData.patientId || null,
|
||||
idType: 1, // 默认身份证
|
||||
idNo: formData.idNo,
|
||||
|
||||
@@ -883,7 +883,7 @@ const initData = async () => {
|
||||
formData.visitNo = props.patientInfo.busNo || ''
|
||||
formData.patientId = props.patientInfo.patientId || ''
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.identifierNo || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.visitNo || props.patientInfo.busNo || ''
|
||||
formData.applyDepartment = props.patientInfo.organizationName || ''
|
||||
formData.applyDocName = userNickName.value || userName.value || ''
|
||||
formData.applyDocCode = userId.value || ''
|
||||
@@ -895,6 +895,8 @@ const initData = async () => {
|
||||
|
||||
// 申请单号在保存时由后端生成,此处显示"自动生成"
|
||||
formData.applyNo = '自动生成'
|
||||
// 执行时间默认填充当前系统时间
|
||||
formData.executeTime = formatDateTime(new Date())
|
||||
// 申请日期实时更新(启动定时器)
|
||||
startApplyTimeTimer()
|
||||
|
||||
@@ -1526,7 +1528,7 @@ const resetForm = async () => {
|
||||
applicationId: null,
|
||||
applyOrganizationId: props.patientInfo.orgId || '',
|
||||
patientName: props.patientInfo.patientName || '',
|
||||
medicalrecordNumber: props.patientInfo.identifierNo || '',
|
||||
medicalrecordNumber: props.patientInfo.visitNo || props.patientInfo.busNo || '',
|
||||
natureofCost: 'self',
|
||||
applyTime: '', // 申请日期由定时器实时更新
|
||||
applyDepartment: props.patientInfo.organizationName || '',
|
||||
@@ -1550,7 +1552,7 @@ const resetForm = async () => {
|
||||
visitNo: '',
|
||||
specimenName: '血液',
|
||||
encounterId: props.patientInfo.encounterId || '',
|
||||
executeTime: null,
|
||||
executeTime: formatDateTime(new Date()),
|
||||
applicationType: 0,
|
||||
})
|
||||
selectedInspectionItems.value = []
|
||||
@@ -1600,7 +1602,7 @@ const handleSave = () => {
|
||||
// 修复【#406】:保存前尝试从 props 同步患者信息,避免因加载时序导致信息缺失
|
||||
if ((!formData.patientName?.trim() || !formData.medicalrecordNumber?.trim()) && props.patientInfo && props.patientInfo.encounterId) {
|
||||
formData.patientName = props.patientInfo.patientName || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.identifierNo || ''
|
||||
formData.medicalrecordNumber = props.patientInfo.visitNo || props.patientInfo.busNo || ''
|
||||
formData.encounterId = props.patientInfo.encounterId || ''
|
||||
formData.visitNo = props.patientInfo.busNo || ''
|
||||
formData.patientId = props.patientInfo.patientId || ''
|
||||
@@ -2000,7 +2002,7 @@ const loadApplicationToForm = async (row) => {
|
||||
// Bug #387修复: 套餐项目默认展开,并自动加载明细
|
||||
selectedInspectionItems.value = detail.labApplyItemList.map(item => {
|
||||
const itemId = item.activityId || item.itemId || item.id || Math.random().toString(36).substring(2, 11)
|
||||
const isPackage = item.feePackageId != null || item.itemName?.includes('套餐')
|
||||
const isPackage = item.feePackageId != null && item.feePackageId !== '' && item.feePackageId !== 'null' && item.packageName
|
||||
|
||||
return {
|
||||
itemId: itemId,
|
||||
|
||||
@@ -89,14 +89,8 @@ const getList = async () => {
|
||||
const response = await listPendingEmr(queryParams)
|
||||
// 根据后端返回的数据结构调整
|
||||
if (response.code === 200) {
|
||||
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
|
||||
}
|
||||
emrList.value = response.data || []
|
||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||
emrList.value = []
|
||||
|
||||
@@ -113,17 +113,10 @@ const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await listPendingEmr(queryParams)
|
||||
// 根据后端返回的数据结构调整
|
||||
if (response.code === 200) {
|
||||
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
|
||||
}
|
||||
emrList.value = response.data || []
|
||||
total.value = Array.isArray(response.data) ? response.data.length : 0
|
||||
} else {
|
||||
ElMessage.error(response.msg || '获取待写病历列表失败')
|
||||
emrList.value = []
|
||||
|
||||
@@ -115,20 +115,20 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||
<el-table-column label="操作" align="center" fixed="right" width="280">
|
||||
<el-table-column label="操作" align="center" fixed="right" width="220">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
||||
<template v-if="canManageRow(scope.row)">
|
||||
<!-- 待签发:可修改、删除 -->
|
||||
<template v-if="isPendingStatus(scope.row)">
|
||||
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
|
||||
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
<template v-else-if="isWithdrawableStatus(scope.row)">
|
||||
<!-- 已签发:可撤回 -->
|
||||
<template v-else-if="isIssuedStatus(scope.row)">
|
||||
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="isReportStatus(scope.row)">
|
||||
<el-button link type="success" @click="handleViewReport(scope.row)">查看报告</el-button>
|
||||
<!-- 已采证、已送检、报告已出、已作废:仅查看详情 -->
|
||||
<template v-else>
|
||||
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -228,10 +228,7 @@ import {patientInfo} from '../../store/patient.js';
|
||||
import {getInspection, deleteRequestForm, withdrawRequestForm, getProofResult} from './api';
|
||||
import {getDepartmentList} from '@/api/public.js';
|
||||
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import auth from '@/plugins/auth';
|
||||
|
||||
const userStore = useUserStore();
|
||||
import {saveInspection} from '../order/applicationForm/api.js';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@@ -381,25 +378,10 @@ const isPendingStatus = (row) => {
|
||||
return status === undefined || status === null || status === '' || String(status) === '0';
|
||||
};
|
||||
|
||||
const isWithdrawableStatus = (row) => String(getBillStatus(row)) === '1';
|
||||
const isIssuedStatus = (row) => String(getBillStatus(row)) === '1';
|
||||
|
||||
const isReportStatus = (row) => ['6', '8'].includes(String(getBillStatus(row)));
|
||||
|
||||
/**
|
||||
* 是否可管理该申请单:申请者本人或管理员
|
||||
*/
|
||||
const canManageRow = (row) => {
|
||||
if (auth.hasRole('admin')) {
|
||||
return true;
|
||||
}
|
||||
const currentPractitionerId = userStore.practitionerId;
|
||||
const requesterId = row?.requesterId;
|
||||
if (!currentPractitionerId || !requesterId) {
|
||||
return false;
|
||||
}
|
||||
return String(currentPractitionerId) === String(requesterId);
|
||||
};
|
||||
|
||||
const sortByCreateTimeDesc = (a, b) => {
|
||||
const aTime = a?.createTime ? new Date(a.createTime).getTime() : 0;
|
||||
const bTime = b?.createTime ? new Date(b.createTime).getTime() : 0;
|
||||
@@ -604,9 +586,9 @@ const submitEditForm = () => {
|
||||
*/
|
||||
const handleDelete = async (row) => {
|
||||
try {
|
||||
await proxy.$modal?.confirm?.('确认作废该申请单吗?作废后不可撤销');
|
||||
await proxy.$modal?.confirm?.(`确定要删除申请单 "${row.prescriptionNo}" 吗?此操作不可恢复。`);
|
||||
} catch {
|
||||
return;
|
||||
return; // 用户取消
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -623,15 +605,13 @@ const handleDelete = async (row) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 撤回检验申请单(已签发且未采证状态可撤回)
|
||||
* 撤回检验申请单(已签发状态撤回至待签发)
|
||||
*/
|
||||
const handleWithdraw = async (row) => {
|
||||
try {
|
||||
await proxy.$modal?.confirm?.(
|
||||
'确认撤回该申请单吗?撤回后申请单及关联医嘱将恢复为待签发状态,护士站将同步更新。'
|
||||
);
|
||||
await proxy.$modal?.confirm?.(`确定要撤回申请单 "${row.prescriptionNo}" 吗?撤回后将恢复为待签发状态。`);
|
||||
} catch {
|
||||
return;
|
||||
return; // 用户取消
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -760,10 +740,6 @@ defineExpose({
|
||||
|
||||
.report-status-tag {
|
||||
cursor: pointer;
|
||||
background-color: #f0f9eb !important;
|
||||
border-color: #67c23a !important;
|
||||
color: #529b2e !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@keyframes rotating {
|
||||
|
||||
@@ -1671,6 +1671,13 @@ function handleSaveGroup(orderGroupList) {
|
||||
if (newRows.length > 0) {
|
||||
prescriptionList.value.splice(originalLength); // 移除循环中追加到末尾的临时行
|
||||
prescriptionList.value.unshift(...newRows);
|
||||
// 排序:确保没有 requestTime 的新行始终排在最前面
|
||||
prescriptionList.value.sort((a, b) => {
|
||||
if (!a.requestTime && !b.requestTime) return 0;
|
||||
if (!a.requestTime) return -1;
|
||||
if (!b.requestTime) return 1;
|
||||
return new Date(b.requestTime) - new Date(a.requestTime);
|
||||
});
|
||||
proxy.$modal.msgSuccess(`成功添加 ${successCount} 个医嘱项`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,14 +90,14 @@
|
||||
<div class="candidate-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectedCandidates.length === 0 || isQueryingHistory"
|
||||
:disabled="selectedCandidates.length === 0"
|
||||
@click="handleAddToQueue"
|
||||
>
|
||||
加入队列 >>
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="filteredCandidatePoolList.length === 0 || isQueryingHistory"
|
||||
:disabled="filteredCandidatePoolList.length === 0"
|
||||
@click="handleAddAllToQueue"
|
||||
>
|
||||
一键加入队列
|
||||
@@ -109,19 +109,6 @@
|
||||
<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
|
||||
@@ -188,7 +175,7 @@
|
||||
<div class="queue-actions-left">
|
||||
<el-button
|
||||
type="danger"
|
||||
:disabled="!selectedQueueRow || isQueryingHistory"
|
||||
:disabled="!selectedQueueRow"
|
||||
size="small"
|
||||
@click="handleRemoveFromQueue"
|
||||
>
|
||||
@@ -196,7 +183,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveUp || isQueryingHistory"
|
||||
:disabled="!selectedQueueRow || !canMoveUp"
|
||||
size="small"
|
||||
@click="handleMoveUp"
|
||||
>
|
||||
@@ -204,7 +191,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
type="info"
|
||||
:disabled="!selectedQueueRow || !canMoveDown || isQueryingHistory"
|
||||
:disabled="!selectedQueueRow || !canMoveDown"
|
||||
size="small"
|
||||
@click="handleMoveDown"
|
||||
>
|
||||
@@ -272,35 +259,30 @@
|
||||
<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"
|
||||
>
|
||||
过号重排
|
||||
@@ -700,14 +682,6 @@ 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 || '心内科'
|
||||
@@ -927,12 +901,14 @@ const mapFrontendStatusToBackend = (status) => {
|
||||
}
|
||||
|
||||
// 从数据库加载队列
|
||||
const loadQueueFromDb = async (dateStr) => {
|
||||
const loadQueueFromDb = async () => {
|
||||
try {
|
||||
// Bug #411:不再按科室选筛加载,后端默认按当前登录人科室查询
|
||||
const organizationId = undefined
|
||||
const queryDateStr = dateStr || queryDate.value
|
||||
const res = await getTriageQueueList({ organizationId, date: queryDateStr }).catch((err) => {
|
||||
// 只查询今天的患者
|
||||
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) => {
|
||||
console.error('【心内科】loadQueueFromDb 请求异常:', err)
|
||||
return { code: 500, msg: err?.message || '请求失败', data: null }
|
||||
})
|
||||
@@ -955,6 +931,10 @@ const loadQueueFromDb = async (dateStr) => {
|
||||
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) {
|
||||
@@ -992,6 +972,14 @@ const loadQueueFromDb = async (dateStr) => {
|
||||
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
|
||||
@@ -1208,6 +1196,9 @@ 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)
|
||||
@@ -1636,26 +1627,6 @@ 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('退出功能待实现')
|
||||
@@ -2194,21 +2165,12 @@ 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