diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/appservice/impl/InfectiousCardAppServiceImpl.java.backup b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/appservice/impl/InfectiousCardAppServiceImpl.java.backup deleted file mode 100644 index a156c0ad..00000000 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/appservice/impl/InfectiousCardAppServiceImpl.java.backup +++ /dev/null @@ -1,455 +0,0 @@ -package com.openhis.web.reportManagement.appservice.impl; - -import com.alibaba.fastjson2.JSONObject; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.core.common.core.domain.R; -import com.openhis.administration.domain.Organization; -import com.openhis.administration.service.IOrganizationService; -import com.openhis.web.reportManagement.appservice.IInfectiousCardAppService; -import com.openhis.web.reportManagement.dto.InfectiousCardDto; -import com.openhis.web.reportManagement.dto.InfectiousCardParam; -import com.openhis.web.reportManagement.mapper.ReportManageCardMapper; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.servlet.http.HttpServletResponse; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -/** - * 传染病报卡 AppService 实现 - * - * @author system - * @date 2026-03-17 - */ -@Service -@Slf4j -public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService { - - @Autowired - private ReportManageCardMapper reportManageCardMapper; - - @Autowired - private IOrganizationService organizationService; - - /** - * 分页查询传染病报卡列表 - * @param param 查询参数 - * @param pageNo 页码 - * @param pageSize 每页条数 - * @return 报卡列表 - */ - @Override - public R listPage(InfectiousCardParam param, Integer pageNo, Integer pageSize) { - try { - Page page = new Page<>(pageNo, pageSize); - IPage resultPage = reportManageCardMapper.selectCardPage(page, param); - - JSONObject result = new JSONObject(); - result.put("rows", resultPage.getRecords()); - result.put("total", resultPage.getTotal()); - - return R.ok(result); - } catch (Exception e) { - log.error("查询传染病报卡列表失败", e); - return R.fail("查询失败:" + e.getMessage()); - } - } - - /** - * 根据 ID 查询传染病报卡详情 - * @param id 报卡 ID(实际为 cardNo) - * @return 报卡详情 - */ - @Override - public R getById(Long id) { - try { - // 注:id 参数实际是 cardNo,需要转换为 String - InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(String.valueOf(id)); - if (dto == null) { - return R.fail("报卡不存在"); - } - return R.ok(dto); - } catch (Exception e) { - log.error("根据 ID 查询传染病报卡失败", e); - return R.fail("查询失败:" + e.getMessage()); - } - } - - /** - * 根据卡号查询传染病报卡详情 - * @param cardNo 卡号 - * @return 报卡详情 - */ - @Override - public R getByCardNo(String cardNo) { - try { - InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo); - if (dto == null) { - return R.fail("报卡不存在"); - } - return R.ok(dto); - } catch (Exception e) { - log.error("根据卡号查询传染病报卡失败", e); - return R.fail("查询失败:" + e.getMessage()); - } - } - - /** - * 审核传染病报卡 - * @param cardNo 卡号 - * @param auditOpinion 审核意见 - * @param status 审核状态 - * @return 审核结果 - */ - @Override - public R audit(String cardNo, String auditOpinion, String status) { - try { - InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo); - if (dto == null) { - return R.fail("报卡不存在"); - } - - int rows = reportManageCardMapper.auditCard(cardNo, Integer.parseInt(status)); - if (rows > 0) { - return R.ok("审核成功"); - } else { - return R.fail("审核失败:未更新任何记录"); - } - } catch (Exception e) { - log.error("审核传染病报卡失败", e); - return R.fail("审核失败:" + e.getMessage()); - } - } - - /** - * 退回传染病报卡 - * @param cardNo 卡号 - * @param returnReason 退回原因 - * @param status 退回状态 - * @return 退回结果 - */ - @Override - public R returnCard(String cardNo, String returnReason, String status) { - try { - InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo); - if (dto == null) { - return R.fail("报卡不存在"); - } - - int rows = reportManageCardMapper.returnCard(cardNo, Integer.parseInt(status), returnReason); - if (rows > 0) { - return R.ok("退回成功"); - } else { - return R.fail("退回失败:未更新任何记录"); - } - } catch (Exception e) { - log.error("退回传染病报卡失败", e); - return R.fail("退回失败:" + e.getMessage()); - } - } - - /** - * 批量审核传染病报卡 - * @param cardNos 卡号列表 - * @param auditOpinion 审核意见 - * @param status 审核状态 - * @return 批量审核结果 - */ - @Override - public R batchAudit(List cardNos, String auditOpinion, String status) { - try { - int successCount = 0; - int failCount = 0; - for (String cardNo : cardNos) { - try { - int rows = reportManageCardMapper.auditCard(cardNo, Integer.parseInt(status)); - if (rows > 0) { - successCount++; - } else { - failCount++; - } - } catch (Exception e) { - log.error("批量审核卡号 {} 失败", cardNo, e); - failCount++; - } - } - return R.ok(String.format("批量审核完成:成功 %d 条,失败 %d 条", successCount, failCount)); - } catch (Exception e) { - log.error("批量审核传染病报卡失败", e); - return R.fail("批量审核失败:" + e.getMessage()); - } - } - - /** - * 批量退回传染病报卡 - * @param cardNos 卡号列表 - * @param returnReason 退回原因 - * @param status 退回状态 - * @return 批量退回结果 - */ - @Override - public R batchReturn(List cardNos, String returnReason, String status) { - try { - int successCount = 0; - int failCount = 0; - for (String cardNo : cardNos) { - try { - int rows = reportManageCardMapper.returnCard(cardNo, Integer.parseInt(status), returnReason); - if (rows > 0) { - successCount++; - } else { - failCount++; - } - } catch (Exception e) { - log.error("批量退回卡号 {} 失败", cardNo, e); - failCount++; - } - } - return R.ok(String.format("批量退回完成:成功 %d 条,失败 %d 条", successCount, failCount)); - } catch (Exception e) { - log.error("批量退回传染病报卡失败", e); - return R.fail("批量退回失败:" + e.getMessage()); - } - } - - /** - * 导出传染病报卡数据 - * @param param 查询参数 - * @param response HTTP 响应对象 - */ - @Override - public void export(InfectiousCardParam param, HttpServletResponse response) { - try { - // 查询所有符合条件的数据 - List list = reportManageCardMapper.selectAllCards(param); - - // 设置响应头 - response.setContentType("text/csv;charset=UTF-8"); - response.setHeader("Content-Disposition", - "attachment; filename=infectious_cards_" + System.currentTimeMillis() + ".csv"); - - // 写入 CSV 内容 - java.io.PrintWriter writer = response.getWriter(); - - // 写入 BOM,防止中文乱码 - writer.print('\uFEFF'); - - // 写入表头 - writer.println("报卡编号,报卡名称,病种名称,患者姓名,性别,年龄,上报科室,登记来源,上报时间,审核状态," + - "身份证号,联系电话,现住地址,职业,病例分类,发病日期,诊断日期,报告单位,报告医生,填卡日期,备注"); - - // 写入数据 - for (InfectiousCardDto dto : list) { - writer.println(String.format("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s", - escapeCsv(dto.getCardNo()), - escapeCsv(dto.getCardName()), - escapeCsv(dto.getDiseaseName()), - escapeCsv(dto.getPatientName()), - "1".equals(dto.getSex()) ? "男" : "2".equals(dto.getSex()) ? "女" : "未知", - dto.getAge() + getAgeUnit(dto.getAgeUnit()), - escapeCsv(dto.getDeptName()), - getRegistrationSourceName(dto.getRegistrationSource()), - dto.getReportDate(), - getStatusName(dto.getStatus()), - escapeCsv(dto.getIdNo()), - escapeCsv(dto.getPhone()), - escapeCsv(getFullAddress(dto)), - escapeCsv(dto.getOccupation()), - getCaseClassName(dto.getCaseClass()), - dto.getOnsetDate(), - dto.getDiagDate() != null ? dto.getDiagDate().toString().substring(0, 10) : "", - escapeCsv(dto.getReportOrg()), - escapeCsv(dto.getReportDoc()), - dto.getReportDate(), - escapeCsv(dto.getRemark() != null ? dto.getRemark() : "") - )); - } - - writer.flush(); - log.info("导出传染病报卡数据成功,共 {} 条", list.size()); - } catch (Exception e) { - log.error("导出传染病报卡数据失败", e); - throw new RuntimeException("导出失败:" + e.getMessage()); - } - } - - /** - * CSV 字段转义 - */ - private String escapeCsv(String value) { - if (value == null) { - return ""; - } - if (value.contains(",") || value.contains("\"") || value.contains("\n")) { - return "\"" + value.replace("\"", "\"\"") + "\""; - } - return value; - } - - /** - * 获取年龄单位 - */ - private String getAgeUnit(String unit) { - if (unit == null) return "岁"; - switch (unit) { - case "1": return "岁"; - case "2": return "月"; - case "3": return "天"; - default: return "岁"; - } - } - - /** - * 获取登记来源名称 - */ - private String getRegistrationSourceName(Integer source) { - if (source == null) return "未知"; - switch (source) { - case 1: return "门诊"; - case 2: return "住院"; - case 3: return "急诊"; - case 4: return "体检"; - default: return "未知"; - } - } - - /** - * 获取状态名称 - */ - private String getStatusName(Integer status) { - if (status == null) return "未知"; - switch (status) { - case 0: return "草稿"; - case 1: return "待审核"; - case 2: return "审核通过"; - case 3: return "已上报"; - case 4: return "已撤回"; - case 5: return "审核失败"; - default: return "未知"; - } - } - - /** - * 获取病例分类名称 - */ - private String getCaseClassName(Integer caseClass) { - if (caseClass == null) return "未知"; - switch (caseClass) { - case 1: return "疑似病例"; - case 2: return "临床诊断病例"; - case 3: return "确诊病例"; - case 4: return "病原携带者"; - case 5: return "阳性检测结果"; - default: return "未知"; - } - } - - /** - * 获取完整地址 - */ - private String getFullAddress(InfectiousCardDto dto) { - StringBuilder sb = new StringBuilder(); - if (dto.getAddressProv() != null) sb.append(dto.getAddressProv()); - if (dto.getAddressCity() != null) sb.append(dto.getAddressCity()); - if (dto.getAddressCounty() != null) sb.append(dto.getAddressCounty()); - if (dto.getAddressTown() != null) sb.append(dto.getAddressTown()); - if (dto.getAddressVillage() != null) sb.append(dto.getAddressVillage()); - if (dto.getAddressHouse() != null) sb.append(dto.getAddressHouse()); - return sb.toString(); - } - - /** - * 获取科室树 - * @return 科室树数据 - */ - @Override - /** - * 撤销审核传染病报卡 - * - * @param cardNo 报卡编号 - * @param status 撤销后的状态 - * @return 结果 - */ - @Override - public R revokeAudit(String cardNo, String status) { - try { - // 验证参数 - if (cardNo == null || cardNo.trim().isEmpty()) { - return R.fail("报卡编号不能为空"); - } - if (status == null || status.trim().isEmpty()) { - return R.fail("撤销后的状态不能为空"); - } - - // 执行撤销审核操作 - int rows = reportManageCardMapper.revokeAuditCard(cardNo, Integer.parseInt(status)); - - if (rows > 0) { - return R.ok("撤销审核成功"); - } else { - return R.fail("撤销审核失败:未找到对应的报卡"); - } - } catch (Exception e) { - log.error("撤销审核传染病报卡失败", e); - return R.fail("撤销审核失败:" + e.getMessage()); - } - } - - /** - * 撤销审核传染病报卡 - * - * @param cardNo 报卡编号 - * @param status 撤销后的状态 - * @return 结果 - */ - @Override - } - } - - public R getDeptTree() { - try { - // 查询所有启用的机构/科室 - List organizations = organizationService.list(); - List tree = buildTree(organizations); - return R.ok(tree); - } catch (Exception e) { - log.error("获取科室树失败", e); - return R.fail("获取科室树失败:" + e.getMessage()); - } - } - - /** - * 构建树形结构 - */ - private List buildTree(List list) { - List tree = new ArrayList<>(); - for (Organization org : list) { - TreeNode node = new TreeNode(); - node.value = org.getId(); - node.label = org.getName(); - node.children = new ArrayList<>(); - tree.add(node); - } - return tree; - } - - /** - * 树形节点 DTO - */ - private static class TreeNode { - private Long value; - private String label; - private List children; - - public Long getValue() { return value; } - public void setValue(Long value) { this.value = value; } - public String getLabel() { return label; } - public void setLabel(String label) { this.label = label; } - public List getChildren() { return children; } - public void setChildren(List children) { this.children = children; } - } -} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/controller/reportManagementController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/controller/reportManagementController.java index eb5f0f0f..9ee78a40 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/controller/reportManagementController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportManagement/controller/reportManagementController.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -// import java.util.List; // 批量操作功能暂未实现 /** * 传染病报卡管理 Controller @@ -32,11 +31,6 @@ public class reportManagementController { /** * 分页查询传染病报卡列表 - * - * @param param 查询参数 - * @param pageNo 当前页码 - * @param pageSize 每页数量 - * @return 传染病报卡列表 */ @GetMapping("/list-page") public R listPage(InfectiousCardParam param, @@ -47,9 +41,6 @@ public class reportManagementController { /** * 根据 ID 查询传染病报卡详情 - * - * @param id 报卡 ID - * @return 传染病报卡详情 */ @GetMapping("/{id}") public R getById(@PathVariable Long id) { @@ -58,9 +49,6 @@ public class reportManagementController { /** * 根据卡号查询传染病报卡详情 - * - * @param cardNo 报卡编号 - * @return 传染病报卡详情 */ @GetMapping("/detail/{cardNo}") public R getByCardNo(@PathVariable String cardNo) { @@ -69,9 +57,6 @@ public class reportManagementController { /** * 审核传染病报卡 - * - * @param request 审核请求 - * @return 结果 */ @PostMapping("/audit") public R audit(@RequestBody AuditInfectiousCardRequest request) { @@ -80,9 +65,6 @@ public class reportManagementController { /** * 退回传染病报卡 - * - * @param request 退回请求 - * @return 结果 */ @PostMapping("/return") public R returnCard(@Valid @RequestBody ReturnInfectiousCardRequest request) { @@ -91,9 +73,6 @@ public class reportManagementController { /** * 批量审核传染病报卡 - * - * @param request 批量审核请求 - * @return 结果 */ @PostMapping("/batchAudit") public R batchAudit(@RequestBody BatchAuditInfectiousCardRequest request) { @@ -102,19 +81,14 @@ public class reportManagementController { /** * 批量退回传染病报卡 - * - * @param request 批量退回请求 - * @return 结果 */ @PostMapping("/batchReturn") public R batchReturn(@Valid @RequestBody BatchReturnInfectiousCardRequest request) { return infectiousCardAppService.batchReturn(request.getCardNos(), request.getReturnReason(), request.getStatus()); } + /** - * 撤销审核传染病报卡 - * - /** - * 撤销审核传染病报卡 + * 撤销审核传染病报卡(Bug #395) * * @param request 撤销审核请求 * @return 结果 @@ -124,34 +98,16 @@ public class reportManagementController { return infectiousCardAppService.revokeAudit(request.getCardNo(), request.getStatus()); } - /** * 导出传染病报卡 - * - * @param param 查询参数 - * @param response 响应对象 */ @GetMapping("/export") - /** - * 撤销审核传染病报卡 - * - * @param cardNo 报卡编号 - * @param status 撤销后的状态 - * @return 结果 - */ - @PostMapping("/revokeAudit") - public R revokeAudit(@RequestParam String cardNo, @RequestParam String status) { - return infectiousCardAppService.revokeAudit(cardNo, status); - } - public void export(InfectiousCardParam param, HttpServletResponse response) { infectiousCardAppService.export(param, response); } /** * 获取科室树 - * - * @return 科室树数据 */ @GetMapping("/dept-tree") public R getDeptTree() { diff --git a/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml b/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml index 72f19721..9a2e73ec 100644 --- a/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml +++ b/openhis-server-new/openhis-domain/src/main/resources/mapper/administration/ScheduleSlotMapper.xml @@ -298,8 +298,14 @@ AND o.phone LIKE CONCAT('%', #{query.phone}, '%') - - AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW())) + + AND ( + ( = 0 AND (p.schedule_date > CURRENT_DATE OR (p.schedule_date = CURRENT_DATE AND (CAST(p.schedule_date AS TIMESTAMP) + CAST(s.expect_time AS TIME)) >= NOW()))) + OR = 1 + OR = 3 + OR = 5 + OR = 4 + ) diff --git a/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/api.js b/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/api.js index ffce5931..273049dc 100644 --- a/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/api.js +++ b/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/api.js @@ -89,6 +89,20 @@ export function auditInfectiousCard(data) { * @param {string} data.returnReason - 退回原因 * @param {string} data.status - 审核状态(5:审核失败) */ +/** + * 撤销审核传染病报卡 + * @param {Object} data + * @param {string} data.cardNo + * @param {string} data.status + */ +export function revokeAuditCard(data) { + return request({ + url: '/report-manage/infectiousDiseaseReport/revokeAudit', + method: 'post', + data, + }); +} + export function returnInfectiousCard(data) { return request({ url: '/report-manage/infectiousDiseaseReport/return', diff --git a/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/index.vue b/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/index.vue index ff4200de..f734f1ab 100644 --- a/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/index.vue +++ b/openhis-ui-vue3/src/views/diseaseReportManagement/ReportManagement/index.vue @@ -573,6 +573,7 @@ import { getInfectiousCard, auditInfectiousCard, returnInfectiousCard, + revokeAuditCard, batchAuditCards, batchReturnCards, getDeptTree, @@ -833,11 +834,11 @@ function handleView(row) { loadCardDetail(row.cardNo); } -// 撤销审核 +// 撤销审核(Bug #395 修复) async function handleRevokeAudit(row) { try { await ElMessageBox.confirm( - '确定要撤销此报卡的审核吗?', + `确定要撤销【${row.patientName}】的报卡审核吗?撤销后状态将变为"待审核"。`, '确认撤销', { confirmButtonText: '确定', @@ -845,12 +846,12 @@ async function handleRevokeAudit(row) { type: 'warning', } ); - - const res = await returnInfectiousCard({ + + const res = await revokeAuditCard({ cardNo: row.cardNo, - returnReason: '撤销审核' + status: '1' // 撤销后状态变更为待审核 }); - + if (res.code === 200) { ElMessage.success('撤销审核成功'); loadTableData(); @@ -860,7 +861,6 @@ async function handleRevokeAudit(row) { } } catch (err) { if (err !== 'cancel') { - ElMessage.error('撤销审核失败'); console.error(err); } }