diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/cardmanagement/appservice/impl/CardManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/cardmanagement/appservice/impl/CardManageAppServiceImpl.java index 6c22aef9..80ea0864 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/cardmanagement/appservice/impl/CardManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/cardmanagement/appservice/impl/CardManageAppServiceImpl.java @@ -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) { diff --git a/openhis-ui-vue3/src/views/doctorstation/mycardmanagement/index.vue b/openhis-ui-vue3/src/views/doctorstation/mycardmanagement/index.vue index ca54f4ff..33c77644 100644 --- a/openhis-ui-vue3/src/views/doctorstation/mycardmanagement/index.vue +++ b/openhis-ui-vue3/src/views/doctorstation/mycardmanagement/index.vue @@ -245,8 +245,8 @@ - - + + @@ -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,