refactor(doctorstation): 优化传染病报卡管理功能
- 将前端表单字段 diseaseCategory 统一改为 diseaseType - 修复统计数据获取失败时的错误处理逻辑 - 完善数据列表查询的错误提示和调试日志 - 优化后端日期时间格式化处理方式 - 增强统计数据返回的安全性检查 - 移除冗余的报卡状态验证代码并修复更新时间格式
This commit is contained in:
@@ -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);
|
||||
@@ -556,35 +565,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) {
|
||||
InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo);
|
||||
|
||||
@@ -245,8 +245,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="传染病类别" prop="diseaseCategory">
|
||||
<el-select v-model="editForm.diseaseCategory" placeholder="请选择传染病类别" style="width: 100%">
|
||||
<el-form-item label="传染病类别" prop="diseaseType">
|
||||
<el-select v-model="editForm.diseaseType" placeholder="请选择传染病类别" style="width: 100%">
|
||||
<el-option label="甲类传染病" value="A" />
|
||||
<el-option label="乙类传染病" value="B" />
|
||||
<el-option label="丙类传染病" value="C" />
|
||||
@@ -392,11 +392,16 @@ function getAgeUnit(unit) {
|
||||
async function getStatistics() {
|
||||
try {
|
||||
const res = await getDoctorCardStatistics();
|
||||
console.log('统计数据响应:', res);
|
||||
if (res.code === 200) {
|
||||
statistics.value = res.data || {};
|
||||
statistics.value = res.data || { totalCount: 0, pendingFailedCount: 0, reportedCount: 0 };
|
||||
} else {
|
||||
console.error('获取统计数据失败:', res.msg);
|
||||
ElMessage.error(res.msg || '获取统计数据失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取统计数据失败:', error);
|
||||
console.error('获取统计数据异常:', error);
|
||||
ElMessage.error('获取统计数据失败');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,13 +415,19 @@ async function getList() {
|
||||
}
|
||||
delete params.dateRange;
|
||||
|
||||
console.log('查询参数:', params);
|
||||
const res = await getDoctorCardList(params);
|
||||
console.log('列表数据响应:', res);
|
||||
if (res.code === 200) {
|
||||
cardList.value = res.data?.list || [];
|
||||
total.value = res.data?.total || 0;
|
||||
console.log('列表数据:', cardList.value, '总数:', total.value);
|
||||
} else {
|
||||
console.error('获取列表失败:', res.msg);
|
||||
ElMessage.error(res.msg || '获取数据失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取列表失败:', error);
|
||||
console.error('获取列表异常:', error);
|
||||
ElMessage.error('获取数据失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@@ -491,7 +502,7 @@ async function handleSaveEdit() {
|
||||
phone: editForm.phone,
|
||||
onsetDate: editForm.onsetDate,
|
||||
diagDate: editForm.diagDate,
|
||||
diseaseCategory: editForm.diseaseCategory,
|
||||
diseaseType: editForm.diseaseType,
|
||||
addressProv: editForm.addressProv,
|
||||
addressCity: editForm.addressCity,
|
||||
addressCounty: editForm.addressCounty,
|
||||
|
||||
Reference in New Issue
Block a user