refactor(doctorstation): 优化传染病报卡管理功能

- 将前端表单字段 diseaseCategory 统一改为 diseaseType
- 修复统计数据获取失败时的错误处理逻辑
- 完善数据列表查询的错误提示和调试日志
- 优化后端日期时间格式化处理方式
- 增强统计数据返回的安全性检查
- 移除冗余的报卡状态验证代码并修复更新时间格式
This commit is contained in:
2026-03-10 10:28:13 +08:00
parent f515b90c43
commit e46e2be830
2 changed files with 34 additions and 43 deletions

View File

@@ -8,6 +8,7 @@ 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.utils.SecurityUtils;
import com.core.common.core.domain.model.LoginUser;
import com.openhis.infectious.domain.InfectiousAudit;
import com.openhis.infectious.domain.InfectiousCard;
import com.openhis.web.cardmanagement.appservice.ICardManageAppService;
@@ -88,10 +89,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
// 时间范围
if (StringUtils.hasText(queryParams.getStartDate())) {
wrapper.ge(InfectiousCard::getCreateTime, queryParams.getStartDate() + " 00:00:00");
LocalDateTime startDateTime = LocalDateTime.parse(queryParams.getStartDate() + "T00:00:00");
wrapper.ge(InfectiousCard::getCreateTime, startDateTime);
}
if (StringUtils.hasText(queryParams.getEndDate())) {
wrapper.le(InfectiousCard::getCreateTime, queryParams.getEndDate() + " 23:59:59");
LocalDateTime endDateTime = LocalDateTime.parse(queryParams.getEndDate() + "T23:59:59");
wrapper.le(InfectiousCard::getCreateTime, endDateTime);
}
// 按创建时间倒序
@@ -257,10 +260,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
wrapper.eq(InfectiousCard::getDeptId, queryParams.getDeptId());
}
if (StringUtils.hasText(queryParams.getStartDate())) {
wrapper.ge(InfectiousCard::getCreateTime, queryParams.getStartDate() + " 00:00:00");
LocalDateTime startDateTime = LocalDateTime.parse(queryParams.getStartDate() + "T00:00:00");
wrapper.ge(InfectiousCard::getCreateTime, startDateTime);
}
if (StringUtils.hasText(queryParams.getEndDate())) {
wrapper.le(InfectiousCard::getCreateTime, queryParams.getEndDate() + " 23:59:59");
LocalDateTime endDateTime = LocalDateTime.parse(queryParams.getEndDate() + "T23:59:59");
wrapper.le(InfectiousCard::getCreateTime, endDateTime);
}
wrapper.orderByDesc(InfectiousCard::getCreateTime);
@@ -313,9 +318,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
Long doctorId = SecurityUtils.getUserId();
DoctorCardStatisticsDto dto = new DoctorCardStatisticsDto();
dto.setTotalCount(infectiousCardMapper.countByDoctorId(doctorId));
dto.setPendingFailedCount(infectiousCardMapper.countPendingFailedByDoctorId(doctorId));
dto.setReportedCount(infectiousCardMapper.countReportedByDoctorId(doctorId));
Integer totalCount = infectiousCardMapper.countByDoctorId(doctorId);
Integer pendingFailedCount = infectiousCardMapper.countPendingFailedByDoctorId(doctorId);
Integer reportedCount = infectiousCardMapper.countReportedByDoctorId(doctorId);
dto.setTotalCount(totalCount != null ? totalCount : 0);
dto.setPendingFailedCount(pendingFailedCount != null ? pendingFailedCount : 0);
dto.setReportedCount(reportedCount != null ? reportedCount : 0);
return dto;
}
@@ -546,7 +555,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
card.setAddressCity(updateDto.getAddressCity());
card.setAddressCounty(updateDto.getAddressCounty());
card.setAddressHouse(updateDto.getAddressHouse());
card.setUpdateTime(LocalDateTime.now());
card.setUpdateTime(new Date());
card.setUpdateBy(loginUser.getUsername()); // 使用username作为更新者
int rows = infectiousCardMapper.updateById(card);
@@ -555,35 +564,6 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
}
return R.fail("更新失败");
}
// 验证是否当前医生的报卡
// 使用createBy字段验证(通常是创建人),如果使用了其他字段则需调整
if (!currentUserId.equals(card.getCreateBy())) {
return R.fail("只能修改自己的报卡");
}
// 验证状态是否允许修改(只能修改暂存状态的报卡)
if (!"0".equals(card.getStatus())) {
return R.fail("只能修改暂存状态的报卡");
}
// 更新字段
card.setPhone(updateDto.getPhone());
card.setOnsetDate(updateDto.getOnsetDate());
card.setDiagDate(updateDto.getDiagDate());
card.setAddressProv(updateDto.getAddressProv());
card.setAddressCity(updateDto.getAddressCity());
card.setAddressCounty(updateDto.getAddressCounty());
card.setAddressHouse(updateDto.getAddressHouse());
card.setUpdateTime(LocalDateTime.now());
card.setUpdateBy(currentUserId);
int rows = infectiousCardMapper.updateById(card);
if (rows > 0) {
return R.ok("更新成功");
}
return R.fail("更新失败");
}
@Override
public void exportCardToWord(String cardNo, HttpServletResponse response) {