疾病报告管理-》报告卡管理:查看报卡详情页缺失“历史审核记录”展示
This commit is contained in:
@@ -20,12 +20,12 @@ public interface InfectiousAuditMapper extends BaseMapper<InfectiousAudit> {
|
|||||||
/**
|
/**
|
||||||
* 根据报卡编号查询审核记录
|
* 根据报卡编号查询审核记录
|
||||||
*/
|
*/
|
||||||
@Select("SELECT * FROM infectious_audit WHERE card_id = #{cardId} ORDER BY audit_time DESC")
|
@Select("SELECT * FROM infectious_audit WHERE card_id::text = #{cardId} ORDER BY audit_time DESC")
|
||||||
List<InfectiousAudit> selectByCardId(@Param("cardId") String cardId);
|
List<InfectiousAudit> selectByCardId(@Param("cardId") String cardId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取下一个审核序号
|
* 获取下一个审核序号
|
||||||
*/
|
*/
|
||||||
@Select("SELECT COALESCE(MAX(audit_seq), 0) + 1 FROM infectious_audit WHERE card_id = #{cardId}")
|
@Select("SELECT COALESCE(MAX(audit_seq), 0) + 1 FROM infectious_audit WHERE card_id::text = #{cardId}")
|
||||||
Integer getNextAuditSeq(@Param("cardId") String cardId);
|
Integer getNextAuditSeq(@Param("cardId") String cardId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,4 +104,12 @@ public interface IInfectiousCardAppService {
|
|||||||
R<?> revokeAudit(String cardNo, String status);
|
R<?> revokeAudit(String cardNo, String status);
|
||||||
R<?> getDeptTree();
|
R<?> getDeptTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报卡审核记录(留痕追溯)
|
||||||
|
*
|
||||||
|
* @param cardNo 报卡编号
|
||||||
|
* @return 审核记录列表
|
||||||
|
*/
|
||||||
|
R<?> getAuditRecords(String cardNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,20 +4,25 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
import com.openhis.administration.domain.Organization;
|
import com.openhis.administration.domain.Organization;
|
||||||
import com.openhis.administration.service.IOrganizationService;
|
import com.openhis.administration.service.IOrganizationService;
|
||||||
|
import com.openhis.infectious.domain.InfectiousAudit;
|
||||||
import com.openhis.web.reportManagement.appservice.IInfectiousCardAppService;
|
import com.openhis.web.reportManagement.appservice.IInfectiousCardAppService;
|
||||||
import com.openhis.web.reportManagement.dto.InfectiousCardDto;
|
import com.openhis.web.reportManagement.dto.InfectiousCardDto;
|
||||||
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
|
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
|
||||||
|
import com.openhis.web.cardmanagement.mapper.InfectiousAuditMapper;
|
||||||
import com.openhis.web.reportManagement.mapper.ReportManageCardMapper;
|
import com.openhis.web.reportManagement.mapper.ReportManageCardMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传染病报卡 AppService 实现
|
* 传染病报卡 AppService 实现
|
||||||
@@ -35,6 +40,41 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IOrganizationService organizationService;
|
private IOrganizationService organizationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InfectiousAuditMapper infectiousAuditMapper;
|
||||||
|
|
||||||
|
private void createAuditRecord(String cardNo, Integer statusFrom, Integer statusTo, String auditType,
|
||||||
|
String auditOpinion, String reasonForReturn, boolean isBatch, Integer batchSize) {
|
||||||
|
String safeCardNo = cardNo == null ? null : cardNo.trim();
|
||||||
|
Integer nextSeq = infectiousAuditMapper.getNextAuditSeq(safeCardNo);
|
||||||
|
InfectiousAudit audit = new InfectiousAudit();
|
||||||
|
// infectious_audit.card_id 设计上应存报卡 card_no(字符串)
|
||||||
|
audit.setCardId(safeCardNo);
|
||||||
|
audit.setAuditSeq(nextSeq);
|
||||||
|
audit.setAuditType(auditType);
|
||||||
|
audit.setAuditStatusFrom(statusFrom == null ? null : String.valueOf(statusFrom));
|
||||||
|
audit.setAuditStatusTo(statusTo == null ? null : String.valueOf(statusTo));
|
||||||
|
audit.setAuditTime(LocalDateTime.now());
|
||||||
|
audit.setAuditorId(SecurityUtils.getUserId() != null ? SecurityUtils.getUserId().toString() : null);
|
||||||
|
audit.setAuditorName(SecurityUtils.getUsername());
|
||||||
|
audit.setAuditOpinion(auditOpinion);
|
||||||
|
audit.setReasonForReturn(reasonForReturn);
|
||||||
|
audit.setIsBatch(isBatch);
|
||||||
|
audit.setBatchSize(batchSize);
|
||||||
|
// 通用审计字段(数据库字段建议为 create_time/update_time,与 HisBaseEntity 保持一致)
|
||||||
|
audit.setCreateBy(SecurityUtils.getUsernameSafe());
|
||||||
|
audit.setUpdateBy(SecurityUtils.getUsernameSafe());
|
||||||
|
audit.setCreateTime(new java.util.Date());
|
||||||
|
audit.setUpdateTime(new java.util.Date());
|
||||||
|
audit.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
||||||
|
audit.setDeleteFlag("0");
|
||||||
|
|
||||||
|
int inserted = infectiousAuditMapper.insert(audit);
|
||||||
|
if (inserted <= 0) {
|
||||||
|
throw new RuntimeException("写入审核记录失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询传染病报卡列表
|
* 分页查询传染病报卡列表
|
||||||
* @param param 查询参数
|
* @param param 查询参数
|
||||||
@@ -106,15 +146,21 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
* @return 审核结果
|
* @return 审核结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> audit(String cardNo, String auditOpinion, String status) {
|
public R<?> audit(String cardNo, String auditOpinion, String status) {
|
||||||
try {
|
try {
|
||||||
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo);
|
String safeCardNo = cardNo == null ? null : cardNo.trim();
|
||||||
|
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(safeCardNo);
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
return R.fail("报卡不存在");
|
return R.fail("报卡不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
int rows = reportManageCardMapper.auditCard(cardNo, Integer.parseInt(status));
|
Integer fromStatus = dto.getStatus();
|
||||||
|
Integer toStatus = Integer.parseInt(status);
|
||||||
|
int rows = reportManageCardMapper.auditCard(safeCardNo, Integer.parseInt(status));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
|
// 单审核通过:auditType=2
|
||||||
|
createAuditRecord(safeCardNo, fromStatus, toStatus, "2", auditOpinion, null, false, 1);
|
||||||
return R.ok("审核成功");
|
return R.ok("审核成功");
|
||||||
} else {
|
} else {
|
||||||
return R.fail("审核失败:未更新任何记录");
|
return R.fail("审核失败:未更新任何记录");
|
||||||
@@ -133,15 +179,21 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
* @return 退回结果
|
* @return 退回结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> returnCard(String cardNo, String returnReason, String status) {
|
public R<?> returnCard(String cardNo, String returnReason, String status) {
|
||||||
try {
|
try {
|
||||||
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo);
|
String safeCardNo = cardNo == null ? null : cardNo.trim();
|
||||||
|
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(safeCardNo);
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
return R.fail("报卡不存在");
|
return R.fail("报卡不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
int rows = reportManageCardMapper.returnCard(cardNo, Integer.parseInt(status), returnReason);
|
Integer fromStatus = dto.getStatus();
|
||||||
|
Integer toStatus = Integer.parseInt(status);
|
||||||
|
int rows = reportManageCardMapper.returnCard(safeCardNo, Integer.parseInt(status), returnReason);
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
|
// 单退回:auditType=4
|
||||||
|
createAuditRecord(safeCardNo, fromStatus, toStatus, "4", null, returnReason, false, 1);
|
||||||
return R.ok("退回成功");
|
return R.ok("退回成功");
|
||||||
} else {
|
} else {
|
||||||
return R.fail("退回失败:未更新任何记录");
|
return R.fail("退回失败:未更新任何记录");
|
||||||
@@ -160,14 +212,27 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
* @return 批量审核结果
|
* @return 批量审核结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> batchAudit(List<String> cardNos, String auditOpinion, String status) {
|
public R<?> batchAudit(List<String> cardNos, String auditOpinion, String status) {
|
||||||
try {
|
try {
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
int failCount = 0;
|
int failCount = 0;
|
||||||
for (String cardNo : cardNos) {
|
for (String cardNo : cardNos) {
|
||||||
try {
|
try {
|
||||||
|
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo);
|
||||||
int rows = reportManageCardMapper.auditCard(cardNo, Integer.parseInt(status));
|
int rows = reportManageCardMapper.auditCard(cardNo, Integer.parseInt(status));
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
|
// 批量审核:auditType=1
|
||||||
|
createAuditRecord(
|
||||||
|
cardNo,
|
||||||
|
dto != null ? dto.getStatus() : null,
|
||||||
|
Integer.parseInt(status),
|
||||||
|
"1",
|
||||||
|
auditOpinion,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
cardNos.size()
|
||||||
|
);
|
||||||
successCount++;
|
successCount++;
|
||||||
} else {
|
} else {
|
||||||
failCount++;
|
failCount++;
|
||||||
@@ -192,14 +257,27 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
* @return 批量退回结果
|
* @return 批量退回结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> batchReturn(List<String> cardNos, String returnReason, String status) {
|
public R<?> batchReturn(List<String> cardNos, String returnReason, String status) {
|
||||||
try {
|
try {
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
int failCount = 0;
|
int failCount = 0;
|
||||||
for (String cardNo : cardNos) {
|
for (String cardNo : cardNos) {
|
||||||
try {
|
try {
|
||||||
|
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo);
|
||||||
int rows = reportManageCardMapper.returnCard(cardNo, Integer.parseInt(status), returnReason);
|
int rows = reportManageCardMapper.returnCard(cardNo, Integer.parseInt(status), returnReason);
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
|
// 批量退回:auditType=3
|
||||||
|
createAuditRecord(
|
||||||
|
cardNo,
|
||||||
|
dto != null ? dto.getStatus() : null,
|
||||||
|
Integer.parseInt(status),
|
||||||
|
"3",
|
||||||
|
null,
|
||||||
|
returnReason,
|
||||||
|
true,
|
||||||
|
cardNos.size()
|
||||||
|
);
|
||||||
successCount++;
|
successCount++;
|
||||||
} else {
|
} else {
|
||||||
failCount++;
|
failCount++;
|
||||||
@@ -284,20 +362,28 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> revokeAudit(String cardNo, String status) {
|
public R<?> revokeAudit(String cardNo, String status) {
|
||||||
try {
|
try {
|
||||||
// 验证参数
|
// 验证参数
|
||||||
if (cardNo == null || cardNo.trim().isEmpty()) {
|
if (cardNo == null || cardNo.trim().isEmpty()) {
|
||||||
return R.fail("报卡编号不能为空");
|
return R.fail("报卡编号不能为空");
|
||||||
}
|
}
|
||||||
|
String safeCardNo = cardNo.trim();
|
||||||
if (status == null || status.trim().isEmpty()) {
|
if (status == null || status.trim().isEmpty()) {
|
||||||
return R.fail("撤销后的状态不能为空");
|
return R.fail("撤销后的状态不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(safeCardNo);
|
||||||
|
Integer fromStatus = dto != null ? dto.getStatus() : null;
|
||||||
|
Integer toStatus = Integer.parseInt(status);
|
||||||
|
|
||||||
// 执行撤销审核操作
|
// 执行撤销审核操作
|
||||||
int rows = reportManageCardMapper.revokeAuditCard(cardNo, Integer.parseInt(status));
|
int rows = reportManageCardMapper.revokeAuditCard(safeCardNo, Integer.parseInt(status));
|
||||||
|
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
|
// 撤销审核:auditType=5(其他)
|
||||||
|
createAuditRecord(safeCardNo, fromStatus, toStatus, "5", "撤销审核", null, false, 1);
|
||||||
return R.ok("撤销审核成功");
|
return R.ok("撤销审核成功");
|
||||||
} else {
|
} else {
|
||||||
return R.fail("撤销审核失败:未找到对应的报卡");
|
return R.fail("撤销审核失败:未找到对应的报卡");
|
||||||
@@ -411,6 +497,20 @@ public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> getAuditRecords(String cardNo) {
|
||||||
|
try {
|
||||||
|
if (cardNo == null || cardNo.trim().isEmpty()) {
|
||||||
|
return R.fail("报卡编号不能为空");
|
||||||
|
}
|
||||||
|
List<InfectiousAudit> records = infectiousAuditMapper.selectByCardId(cardNo);
|
||||||
|
return R.ok(records);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询审核记录失败, cardNo={}", cardNo, e);
|
||||||
|
return R.fail("查询审核记录失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建树形结构
|
* 构建树形结构
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ public class reportManagementController {
|
|||||||
return infectiousCardAppService.getByCardNo(cardNo);
|
return infectiousCardAppService.getByCardNo(cardNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报卡审核记录(留痕追溯)
|
||||||
|
*/
|
||||||
|
@GetMapping("/auditRecords/{cardNo}")
|
||||||
|
public R<?> getAuditRecords(@PathVariable String cardNo) {
|
||||||
|
return infectiousCardAppService.getAuditRecords(cardNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核传染病报卡
|
* 审核传染病报卡
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -150,6 +150,7 @@
|
|||||||
WHERE t1.delete_flag = '0' AND t1.card_no = #{cardNo}
|
WHERE t1.delete_flag = '0' AND t1.card_no = #{cardNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!-- 审核传染病报卡 -->
|
<!-- 审核传染病报卡 -->
|
||||||
<update id="auditCard">
|
<update id="auditCard">
|
||||||
UPDATE infectious_card
|
UPDATE infectious_card
|
||||||
|
|||||||
@@ -518,13 +518,16 @@
|
|||||||
@close="handleDrawerClose"
|
@close="handleDrawerClose"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<!-- 审核记录 -->
|
<!-- 审核记录:查看/审核都展示,保证留痕可追溯 -->
|
||||||
<div class="audit-records-section" v-if="auditRecords.length > 0">
|
<div
|
||||||
|
class="audit-records-section"
|
||||||
|
v-if="drawerMode === 'view' || (drawerMode === 'audit' && auditRecords.length > 0)"
|
||||||
|
>
|
||||||
<h3 class="section-title">审核记录</h3>
|
<h3 class="section-title">审核记录</h3>
|
||||||
<el-timeline>
|
<el-timeline v-if="auditRecords.length > 0">
|
||||||
<el-timeline-item
|
<el-timeline-item
|
||||||
v-for="record in auditRecords"
|
v-for="(record, idx) in auditRecords"
|
||||||
:key="record.auditId"
|
:key="record.auditId || idx"
|
||||||
:timestamp="record.auditTime"
|
:timestamp="record.auditTime"
|
||||||
placement="top"
|
placement="top"
|
||||||
:type="getAuditType(record.auditStatusTo)"
|
:type="getAuditType(record.auditStatusTo)"
|
||||||
@@ -538,8 +541,8 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="record-detail">
|
<div class="record-detail">
|
||||||
<span v-if="record.auditOpinion">审核意见:{{ record.auditOpinion }}</span>
|
<div v-if="record.auditOpinion">审核意见:{{ record.auditOpinion }}</div>
|
||||||
<span v-if="record.reasonForReturn">退回原因:{{ record.reasonForReturn }}</span>
|
<div v-if="record.reasonForReturn">退回原因:{{ record.reasonForReturn }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="record-status">
|
<div class="record-status">
|
||||||
{{ getStatusName(record.auditStatusFrom) }} → {{ getStatusName(record.auditStatusTo) }}
|
{{ getStatusName(record.auditStatusFrom) }} → {{ getStatusName(record.auditStatusTo) }}
|
||||||
@@ -548,6 +551,7 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</el-timeline-item>
|
</el-timeline-item>
|
||||||
</el-timeline>
|
</el-timeline>
|
||||||
|
<el-empty v-else description="暂无审核记录" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 审核操作区域 -->
|
<!-- 审核操作区域 -->
|
||||||
@@ -652,6 +656,7 @@ import InfectiousDiseaseReportDialog from '@/views/doctorstation/components/diag
|
|||||||
import {
|
import {
|
||||||
listInfectiousCards,
|
listInfectiousCards,
|
||||||
getInfectiousCard,
|
getInfectiousCard,
|
||||||
|
getAuditRecords,
|
||||||
auditInfectiousCard,
|
auditInfectiousCard,
|
||||||
returnInfectiousCard,
|
returnInfectiousCard,
|
||||||
revokeAuditCard,
|
revokeAuditCard,
|
||||||
@@ -706,6 +711,8 @@ const drawerMode = ref('view'); // view | audit
|
|||||||
const drawerLoading = ref(false);
|
const drawerLoading = ref(false);
|
||||||
const reportDialogRef = ref(null);
|
const reportDialogRef = ref(null);
|
||||||
const currentCard = ref({});
|
const currentCard = ref({});
|
||||||
|
// 锁定当前打开的卡号,防止异步/串单导致写错审核记录
|
||||||
|
const activeCardNo = ref('');
|
||||||
const auditRecords = ref([]);
|
const auditRecords = ref([]);
|
||||||
const auditForm = ref({
|
const auditForm = ref({
|
||||||
auditOpinion: '',
|
auditOpinion: '',
|
||||||
@@ -950,6 +957,8 @@ async function handleRevokeAudit(row) {
|
|||||||
async function loadCardDetail(cardNo) {
|
async function loadCardDetail(cardNo) {
|
||||||
drawerLoading.value = true;
|
drawerLoading.value = true;
|
||||||
try {
|
try {
|
||||||
|
activeCardNo.value = String(cardNo || '').trim();
|
||||||
|
auditRecords.value = [];
|
||||||
// 使用详情 API 获取卡片详细信息
|
// 使用详情 API 获取卡片详细信息
|
||||||
const res = await getInfectiousCard(cardNo);
|
const res = await getInfectiousCard(cardNo);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
@@ -962,8 +971,36 @@ async function loadCardDetail(cardNo) {
|
|||||||
deptName: res.data.deptName || res.data.createDeptName,
|
deptName: res.data.deptName || res.data.createDeptName,
|
||||||
diseaseName: res.data.diseaseName || getDiseaseName(res.data.diseaseCode),
|
diseaseName: res.data.diseaseName || getDiseaseName(res.data.diseaseCode),
|
||||||
};
|
};
|
||||||
// 如果没有单独的审核记录 API,尝试从详情数据中获取
|
|
||||||
auditRecords.value = res.data.auditRecords || res.auditRecords || [];
|
const normalizeAuditRecords = (payload) => {
|
||||||
|
if (!payload) return [];
|
||||||
|
if (Array.isArray(payload)) return payload;
|
||||||
|
// 兼容:data 里再包一层
|
||||||
|
if (Array.isArray(payload.data)) return payload.data;
|
||||||
|
// 兼容:分页/列表常见字段
|
||||||
|
if (Array.isArray(payload.records)) return payload.records;
|
||||||
|
if (Array.isArray(payload.rows)) return payload.rows;
|
||||||
|
if (Array.isArray(payload.list)) return payload.list;
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
// 优先使用审核记录 API,确保能看到完整历史;失败再回退到详情内嵌字段
|
||||||
|
try {
|
||||||
|
const recordRes = await getAuditRecords(String(cardNo || '').trim());
|
||||||
|
if (recordRes?.code === 200) {
|
||||||
|
auditRecords.value = normalizeAuditRecords(recordRes.data);
|
||||||
|
} else {
|
||||||
|
auditRecords.value = normalizeAuditRecords(res.data.auditRecords || res.auditRecords);
|
||||||
|
if (auditRecords.value.length === 0) {
|
||||||
|
ElMessage.warning(recordRes?.msg || '获取审核记录失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
auditRecords.value = normalizeAuditRecords(res.data.auditRecords || res.auditRecords);
|
||||||
|
if (auditRecords.value.length === 0) {
|
||||||
|
ElMessage.warning('获取审核记录失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
reportDialogRef.value?.showReport(currentCard.value);
|
reportDialogRef.value?.showReport(currentCard.value);
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error('获取卡片详情失败');
|
ElMessage.error('获取卡片详情失败');
|
||||||
@@ -993,8 +1030,18 @@ async function handlePassCard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const cardNo = String(activeCardNo.value || currentCard.value.cardNo || '').trim();
|
||||||
|
if (!cardNo) {
|
||||||
|
ElMessage.error('未获取到报卡编号,请重新打开后再试');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 防止串单:展示的 currentCard 与锁定卡号不一致时禁止提交
|
||||||
|
if (currentCard.value?.cardNo && String(currentCard.value.cardNo).trim() !== cardNo) {
|
||||||
|
ElMessage.error('报卡编号发生变化,请重新打开报卡后再审核');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const res = await auditInfectiousCard({
|
const res = await auditInfectiousCard({
|
||||||
cardNo: currentCard.value.cardNo,
|
cardNo,
|
||||||
auditOpinion: auditForm.value.auditOpinion,
|
auditOpinion: auditForm.value.auditOpinion,
|
||||||
status: '2'
|
status: '2'
|
||||||
});
|
});
|
||||||
@@ -1027,8 +1074,17 @@ async function handleReturnCard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const cardNo = String(activeCardNo.value || currentCard.value.cardNo || '').trim();
|
||||||
|
if (!cardNo) {
|
||||||
|
ElMessage.error('未获取到报卡编号,请重新打开后再试');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (currentCard.value?.cardNo && String(currentCard.value.cardNo).trim() !== cardNo) {
|
||||||
|
ElMessage.error('报卡编号发生变化,请重新打开报卡后再退回');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const res = await returnInfectiousCard({
|
const res = await returnInfectiousCard({
|
||||||
cardNo: currentCard.value.cardNo,
|
cardNo,
|
||||||
returnReason: auditForm.value.returnReason,
|
returnReason: auditForm.value.returnReason,
|
||||||
status: '5'
|
status: '5'
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user