住院护士站-》医嘱执行页面:勾选医嘱后点击“执行选中”按钮无反应,无法完成执行操作.

疾病报告管理-》报告卡管理:审核报卡界面内容与门诊医生站登记界面不一致
This commit is contained in:
2026-04-30 13:33:03 +08:00
parent b536eadd92
commit 82ef66794b
5 changed files with 328 additions and 83 deletions

View File

@@ -55,6 +55,7 @@ import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -67,6 +68,10 @@ import java.util.stream.Collectors;
@Service @Service
public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService { public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
private static final List<DateTimeFormatter> EXECUTE_TIME_FORMATTERS = List.of(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"),
DateTimeFormatter.ofPattern("yyyy-MM-dd H:mm:ss"));
@Resource @Resource
AssignSeqUtil assignSeqUtil; AssignSeqUtil assignSeqUtil;
@@ -669,11 +674,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
for (AdviceExecuteDetailParam adviceExecuteDetailParam : adviceExecuteDetailList) { for (AdviceExecuteDetailParam adviceExecuteDetailParam : adviceExecuteDetailList) {
for (String executeTime : adviceExecuteDetailParam.getExecuteTimes()) { for (String executeTime : adviceExecuteDetailParam.getExecuteTimes()) {
// 生成执行记录 // 生成执行记录
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); Date exeDate = parseExecuteTime(executeTime);
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
// 转换为 Date
Date exeDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
// 根据执行记录新增不执行记录 // 根据执行记录新增不执行记录
procedureService.addProcedureRecord(adviceExecuteDetailParam.getEncounterId(), procedureService.addProcedureRecord(adviceExecuteDetailParam.getEncounterId(),
adviceExecuteDetailParam.getPatientId(), adviceExecuteDetailParam.getRequestId(), adviceExecuteDetailParam.getPatientId(), adviceExecuteDetailParam.getRequestId(),
@@ -701,16 +702,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
List<Long> medicationDefinitionIdList List<Long> medicationDefinitionIdList
= medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList()); = medUseExeList.stream().map(MedicationRequestUseExe::getMedicationId).collect(Collectors.toList());
// 医嘱详细信息 // 医嘱详细信息
Long orgId = SecurityUtils.getLoginUser().getOrgId();
List<AdviceBaseDto> medicationInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> medicationInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
medicationDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(1), null, null).getRecords(); medicationDefinitionIdList, orgId, 1, 500, Whether.NO.getValue(), List.of(1), null, null).getRecords();
// 当前时间 // 当前时间
Date curDate = new Date(); Date curDate = new Date();
// 参与者id // 参与者id
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
// 长期 // 长期
MedicationRequest longMedicationRequest; MedicationRequest longMedicationRequest;
ChargeItem chargeItem; ChargeItem chargeItem;
@@ -737,11 +736,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
String minUnitCode = advice.getMinUnitCode(); String minUnitCode = advice.getMinUnitCode();
// 生成执行记录 // 生成执行记录
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); Date expectedDate = parseExecuteTime(executeTime);
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
// 转换为 Date
Date expectedDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
// 执行记录id // 执行记录id
Long procedureId = procedureService.addProcedureRecord(longMedicationRequest.getEncounterId(), Long procedureId = procedureService.addProcedureRecord(longMedicationRequest.getEncounterId(),
longMedicationRequest.getPatientId(), longMedicationRequest.getId(), longMedicationRequest.getPatientId(), longMedicationRequest.getId(),
@@ -809,14 +804,24 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
chargeItemService.saveOrUpdate(chargeItem); chargeItemService.saveOrUpdate(chargeItem);
} else { } else {
// 批次售卖情况 // 批次售卖情况
throw new RuntimeException("[住院]批次售卖的情况暂未处理"); // 需要的药品数量(小单位)
/* // 需要的药品数量(小单位)
BigDecimal minUnitQuantity = medicationRequestUseExe.getMinUnitQuantity(); BigDecimal minUnitQuantity = medicationRequestUseExe.getMinUnitQuantity();
if (minUnitQuantity == null || minUnitQuantity.compareTo(BigDecimal.ZERO) <= 0) {
throw new RuntimeException("药品执行数量异常medicationId: "
+ finalLongMedicationRequest.getMedicationId());
}
// 库存集合 // 库存集合
List<AdviceInventoryDto> inventoryList = advice.getInventoryList(); List<AdviceInventoryDto> inventoryList = advice.getInventoryList();
if (inventoryList == null || inventoryList.isEmpty()) {
throw new RuntimeException("药品库存不足medicationId: "
+ finalLongMedicationRequest.getMedicationId());
}
// 价格集合 // 价格集合
List<AdvicePriceDto> priceList = advice.getPriceList(); List<AdvicePriceDto> priceList = advice.getPriceList();
if (priceList == null || priceList.isEmpty()) {
throw new RuntimeException("未找到药品匹配的定价信息: "
+ finalLongMedicationRequest.getMedicationId());
}
// 剩余需要分配的数量 // 剩余需要分配的数量
BigDecimal remainingQuantity = minUnitQuantity; BigDecimal remainingQuantity = minUnitQuantity;
@@ -840,48 +845,52 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
} }
// 批次号 // 批次号
String lotNumber = inventory.getLotNumber(); String lotNumber = inventory.getLotNumber();
if (lotNumber == null) {
continue;
}
// 根据批次库存量,生成发放 // 根据批次库存量,生成发放
longMedicationRequest.setQuantity(actualQuantity);// 小单位的数量 MedicationRequest batchMedicationRequest = new MedicationRequest();
longMedicationRequest.setUnitCode(minUnitCode); // 小单位 BeanUtils.copyProperties(longMedicationRequest, batchMedicationRequest);
longMedicationRequest.setLotNumber(lotNumber); batchMedicationRequest.setQuantity(actualQuantity);// 小单位的数量
batchMedicationRequest.setUnitCode(minUnitCode); // 小单位
batchMedicationRequest.setLotNumber(lotNumber);
// 生成药品发放 // 生成药品发放
Long dispenseId = medicationDispenseService.generateMedicationDispense(longMedicationRequest, medicationDispenseService.generateMedicationDispense(batchMedicationRequest,
procedureId, exeDate); procedureId, expectedDate);
// 生成账单 // 生成账单
chargeItem = new ChargeItem(); chargeItem = new ChargeItem();
chargeItem.setStatusEnum(ChargeItemStatus.BILLABLE.getValue()); // 收费状态 chargeItem.setStatusEnum(ChargeItemStatus.BILLABLE.getValue()); // 收费状态
chargeItem.setBusNo( chargeItem.setBusNo(
AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(longMedicationRequest.getBusNo())); AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(batchMedicationRequest.getBusNo()));
chargeItem.setGenerateSourceEnum(GenerateSource.ORDER_EXECUTE.getValue()); // 生成来源 chargeItem.setGenerateSourceEnum(GenerateSource.ORDER_EXECUTE.getValue()); // 生成来源
chargeItem.setPrescriptionNo(longMedicationRequest.getPrescriptionNo()); // 处方号 chargeItem.setPrescriptionNo(batchMedicationRequest.getPrescriptionNo()); // 处方号
chargeItem.setPatientId(longMedicationRequest.getPatientId()); // 患者 chargeItem.setPatientId(batchMedicationRequest.getPatientId()); // 患者
chargeItem.setContextEnum(ChargeItemContext.MEDICATION.getValue()); // 类型 chargeItem.setContextEnum(ChargeItemContext.MEDICATION.getValue()); // 类型
chargeItem.setEncounterId(longMedicationRequest.getEncounterId()); // 就诊id chargeItem.setEncounterId(batchMedicationRequest.getEncounterId()); // 就诊id
chargeItem.setEntererId(practitionerId);// 开立人ID chargeItem.setEntererId(practitionerId);// 开立人ID
chargeItem.setRequestingOrgId(orgId); // 开立科室 chargeItem.setRequestingOrgId(orgId); // 开立科室
chargeItem.setEnteredDate(curDate); // 开立时间 chargeItem.setEnteredDate(curDate); // 开立时间
chargeItem.setServiceTable(CommonConstants.TableName.MED_MEDICATION_REQUEST);// 医疗服务类型 chargeItem.setServiceTable(CommonConstants.TableName.MED_MEDICATION_REQUEST);// 医疗服务类型
chargeItem.setServiceId(longMedicationRequest.getId()); // 医疗服务ID chargeItem.setServiceId(batchMedicationRequest.getId()); // 医疗服务ID
chargeItem.setProductTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);// 产品所在表 chargeItem.setProductTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);// 产品所在表
chargeItem.setProductId(longMedicationRequest.getMedicationId());// 收费项id chargeItem.setProductId(batchMedicationRequest.getMedicationId());// 收费项id
chargeItem.setAccountId(medicationRequestUseExe.getAccountId());// 关联账户ID chargeItem.setAccountId(medicationRequestUseExe.getAccountId());// 关联账户ID
chargeItem.setConditionId(longMedicationRequest.getConditionId()); // 诊断id chargeItem.setConditionId(batchMedicationRequest.getConditionId()); // 诊断id
chargeItem.setEncounterDiagnosisId(longMedicationRequest.getEncounterDiagnosisId()); // 就诊诊断id chargeItem.setEncounterDiagnosisId(batchMedicationRequest.getEncounterDiagnosisId()); // 就诊诊断id
chargeItem.setProcedureId(procedureId); // 执行id chargeItem.setProcedureId(procedureId); // 执行id
chargeItem.setDispenseTable(CommonConstants.TableName.MED_MEDICATION_DISPENSE); // 发放表名 chargeItem.setDispenseTable(CommonConstants.TableName.MED_MEDICATION_DISPENSE); // 发放表名
// chargeItem.setDispenseId(dispenseId); // 发放ID
// ------------------------------ 匹配定价信息 // ------------------------------ 匹配定价信息
// 在 priceList 中查找匹配的定价信息 // 在 priceList 中查找匹配的定价信息
Optional<AdvicePriceDto> matchedPrice = Optional<AdvicePriceDto> matchedPrice =
priceList.stream().filter(p -> lotNumber.equals(p.getConditionValue())).findFirst(); priceList.stream().filter(p -> lotNumber.equals(p.getConditionValue())).findFirst();
if (matchedPrice.isEmpty()) { AdvicePriceDto priceDto = matchedPrice.orElseGet(() -> priceList.stream().findFirst().orElse(null));
if (priceDto == null) {
throw new RuntimeException( throw new RuntimeException(
"未找到匹配的定价信息lotNumber: " + finalLongMedicationRequest.getLotNumber()); "未找到匹配的定价信息lotNumber: " + lotNumber);
} }
AdvicePriceDto priceDto = matchedPrice.get();
// 单价(大单位) // 单价(大单位)
BigDecimal price = priceDto.getPrice(); BigDecimal price = priceDto.getPrice();
// 单价(小单位) // 单价(小单位)
@@ -919,7 +928,11 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
chargeItemService.saveOrUpdate(chargeItem); chargeItemService.saveOrUpdate(chargeItem);
}*/ }
if (remainingQuantity.compareTo(BigDecimal.ZERO) > 0) {
throw new RuntimeException("药品库存不足medicationId: "
+ finalLongMedicationRequest.getMedicationId());
}
} }
} }
} }
@@ -932,11 +945,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
BeanUtils.copyProperties(medicationRequestUseExe, tempMedicationRequest); BeanUtils.copyProperties(medicationRequestUseExe, tempMedicationRequest);
// 生成执行记录 // 生成执行记录
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); Date expectedDate = parseExecuteTime(executeTime);
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
// 转换为 Date
Date expectedDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
// 执行记录id // 执行记录id
Long procedureId = procedureService.addProcedureRecord(tempMedicationRequest.getEncounterId(), Long procedureId = procedureService.addProcedureRecord(tempMedicationRequest.getEncounterId(),
tempMedicationRequest.getPatientId(), tempMedicationRequest.getId(), tempMedicationRequest.getPatientId(), tempMedicationRequest.getId(),
@@ -978,16 +987,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
List<Long> activityDefinitionIdList List<Long> activityDefinitionIdList
= actUseExeList.stream().map(ServiceRequestUseExe::getActivityId).collect(Collectors.toList()); = actUseExeList.stream().map(ServiceRequestUseExe::getActivityId).collect(Collectors.toList());
// 医嘱详细信息 // 医嘱详细信息
Long orgId = SecurityUtils.getLoginUser().getOrgId();
List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null, List<AdviceBaseDto> activityInfos = doctorStationAdviceAppService.getAdviceBaseInfo(null, null, null,
activityDefinitionIdList, 0L, 1, 500, Whether.NO.getValue(), List.of(3), null, null).getRecords(); activityDefinitionIdList, orgId, 1, 500, Whether.NO.getValue(), List.of(3), null, null).getRecords();
// 当前时间 // 当前时间
Date curDate = new Date(); Date curDate = new Date();
// 参与者id // 参与者id
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
// 当前登录账号的科室id
Long orgId = SecurityUtils.getLoginUser().getOrgId();
Date clickDate = new Date(); Date clickDate = new Date();
// 长期 // 长期
@@ -1002,11 +1009,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
BeanUtils.copyProperties(serviceRequestUseExe, longServiceRequest); BeanUtils.copyProperties(serviceRequestUseExe, longServiceRequest);
// 生成执行记录 // 生成执行记录
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); Date expectedDate = parseExecuteTime(executeTime);
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
// 转换为 Date
Date expectedDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
// 执行记录id // 执行记录id
Long procedureId = procedureService.addProcedureRecord(longServiceRequest.getEncounterId(), Long procedureId = procedureService.addProcedureRecord(longServiceRequest.getEncounterId(),
longServiceRequest.getPatientId(), longServiceRequest.getId(), longServiceRequest.getPatientId(), longServiceRequest.getId(),
@@ -1077,11 +1080,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
BeanUtils.copyProperties(serviceRequestUseExe, tempServiceRequest); BeanUtils.copyProperties(serviceRequestUseExe, tempServiceRequest);
// 生成执行记录 // 生成执行记录
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); Date expectedDate = parseExecuteTime(executeTime);
// 转换为 LocalDateTime
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
// 转换为 Date
Date expectedDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
// 执行记录id // 执行记录id
Long procedureId = procedureService.addProcedureRecord(tempServiceRequest.getEncounterId(), Long procedureId = procedureService.addProcedureRecord(tempServiceRequest.getEncounterId(),
tempServiceRequest.getPatientId(), tempServiceRequest.getId(), tempServiceRequest.getPatientId(), tempServiceRequest.getId(),
@@ -1146,7 +1145,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
// 耗材医嘱详细信息 // 耗材医嘱详细信息
List<AdviceBaseDto> deviceInfos = doctorStationAdviceAppService List<AdviceBaseDto> deviceInfos = doctorStationAdviceAppService
.getAdviceBaseInfo(null, null, null, deviceIds, 0L, 1, 500, Whether.NO.getValue(), List.of(2), null, null) .getAdviceBaseInfo(null, null, null, deviceIds, orgId, 1, 500, Whether.NO.getValue(), List.of(2),
null, null)
.getRecords(); .getRecords();
DeviceRequest deviceRequest; DeviceRequest deviceRequest;
@@ -1405,6 +1405,18 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
return actUseExeList; return actUseExeList;
} }
private Date parseExecuteTime(String executeTime) {
for (DateTimeFormatter formatter : EXECUTE_TIME_FORMATTERS) {
try {
LocalDateTime localDateTime = LocalDateTime.parse(executeTime, formatter);
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
} catch (DateTimeParseException ignored) {
// try next formatter
}
}
throw new RuntimeException("无法解析执行时间: " + executeTime);
}
/** /**
* 生成退药单 * 生成退药单
* *

View File

@@ -69,11 +69,12 @@ export function getAdjustPriceSwitchState(params) {
/** /**
* 批次号匹配 * 批次号匹配
*/ */
export function lotNumberMatch(params) { export function lotNumberMatch(params, config = {}) {
return request({ return request({
url: '/app-common/lot-number-match', url: '/app-common/lot-number-match',
method: 'get', method: 'get',
params: params, params: params,
...config
}); });
} }

View File

@@ -511,6 +511,86 @@
</template> </template>
</el-drawer> </el-drawer>
<InfectiousDiseaseReportDialog
ref="reportDialogRef"
:title="drawerMode === 'audit' ? '审核报卡' : '查看报卡'"
read-only
@close="handleDrawerClose"
>
<template #append>
<!-- 审核记录 -->
<div class="audit-records-section" v-if="auditRecords.length > 0">
<h3 class="section-title">审核记录</h3>
<el-timeline>
<el-timeline-item
v-for="record in auditRecords"
:key="record.auditId"
:timestamp="record.auditTime"
placement="top"
:type="getAuditType(record.auditStatusTo)"
>
<el-card>
<div class="record-content">
<div class="record-header">
<span class="auditor">{{ record.auditorName }}</span>
<el-tag size="small" :type="getAuditType(record.auditStatusTo)">
{{ getAuditTypeName(record.auditType) }}
</el-tag>
</div>
<div class="record-detail">
<span v-if="record.auditOpinion">审核意见{{ record.auditOpinion }}</span>
<span v-if="record.reasonForReturn">退回原因{{ record.reasonForReturn }}</span>
</div>
<div class="record-status">
{{ getStatusName(record.auditStatusFrom) }} {{ getStatusName(record.auditStatusTo) }}
</div>
</div>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
<!-- 审核操作区域 -->
<div class="audit-action-section" v-if="drawerMode === 'audit'">
<h3 class="section-title">审核操作</h3>
<el-form :model="auditForm" label-width="100px">
<el-form-item label="审核意见" required>
<el-input
v-model="auditForm.auditOpinion"
type="textarea"
:rows="3"
placeholder="请填写审核意见"
/>
</el-form-item>
<el-form-item label="退回原因">
<el-input
v-model="auditForm.returnReason"
type="textarea"
:rows="3"
placeholder="如需退回,请填写退回原因"
maxlength="50"
show-word-limit
/>
</el-form-item>
</el-form>
</div>
</template>
<template #footer="{ close }">
<div class="drawer-footer">
<el-button @click="close">关闭</el-button>
<template v-if="drawerMode === 'audit'">
<el-button type="warning" @click="handleReturnCard" :disabled="!auditForm.returnReason">
退回修改
</el-button>
<el-button type="success" @click="handlePassCard" :disabled="!auditForm.auditOpinion">
审核通过
</el-button>
</template>
</div>
</template>
</InfectiousDiseaseReportDialog>
<!-- 批量审核弹窗 --> <!-- 批量审核弹窗 -->
<el-dialog <el-dialog
v-model="batchAuditDialogVisible" v-model="batchAuditDialogVisible"
@@ -568,6 +648,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
import { Clock, CircleClose, CircleCheck, Document, Search, Refresh, DocumentChecked, RefreshLeft, Download } from '@element-plus/icons-vue'; import { Clock, CircleClose, CircleCheck, Document, Search, Refresh, DocumentChecked, RefreshLeft, Download } from '@element-plus/icons-vue';
import { useDict } from '@/utils/dict'; import { useDict } from '@/utils/dict';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import InfectiousDiseaseReportDialog from '@/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue';
import { import {
listInfectiousCards, listInfectiousCards,
getInfectiousCard, getInfectiousCard,
@@ -623,6 +704,7 @@ const selectedRows = ref([]);
const drawerVisible = ref(false); const drawerVisible = ref(false);
const drawerMode = ref('view'); // view | audit const drawerMode = ref('view'); // view | audit
const drawerLoading = ref(false); const drawerLoading = ref(false);
const reportDialogRef = ref(null);
const currentCard = ref({}); const currentCard = ref({});
const auditRecords = ref([]); const auditRecords = ref([]);
const auditForm = ref({ const auditForm = ref({
@@ -823,14 +905,12 @@ function handleSelectionChange(rows) {
// 审核 // 审核
function handleAudit(row) { function handleAudit(row) {
drawerMode.value = 'audit'; drawerMode.value = 'audit';
drawerVisible.value = true;
loadCardDetail(row.cardNo); loadCardDetail(row.cardNo);
} }
// 查看 // 查看
function handleView(row) { function handleView(row) {
drawerMode.value = 'view'; drawerMode.value = 'view';
drawerVisible.value = true;
loadCardDetail(row.cardNo); loadCardDetail(row.cardNo);
} }
@@ -884,6 +964,7 @@ async function loadCardDetail(cardNo) {
}; };
// 如果没有单独的审核记录 API尝试从详情数据中获取 // 如果没有单独的审核记录 API尝试从详情数据中获取
auditRecords.value = res.data.auditRecords || res.auditRecords || []; auditRecords.value = res.data.auditRecords || res.auditRecords || [];
reportDialogRef.value?.showReport(currentCard.value);
} else { } else {
ElMessage.error('获取卡片详情失败'); ElMessage.error('获取卡片详情失败');
} }
@@ -920,7 +1001,7 @@ async function handlePassCard() {
if (res.code === 200) { if (res.code === 200) {
ElMessage.success('审核通过'); ElMessage.success('审核通过');
handleDrawerClose(); reportDialogRef.value?.close?.();
loadTableData(); loadTableData();
loadStats(); loadStats();
} else { } else {
@@ -954,7 +1035,7 @@ async function handleReturnCard() {
if (res.code === 200) { if (res.code === 200) {
ElMessage.success('已退回修改'); ElMessage.success('已退回修改');
handleDrawerClose(); reportDialogRef.value?.close?.();
loadTableData(); loadTableData();
loadStats(); loadStats();
} else { } else {

View File

@@ -9,7 +9,7 @@
> >
<template #header> <template #header>
<el-card class="report-header" shadow="never"> <el-card class="report-header" shadow="never">
<h1 class="report-title">中华人民共和国传染病报告卡</h1> <h1 class="report-title">{{ title }}</h1>
<el-space align="center" class="card-number-row"> <el-space align="center" class="card-number-row">
<span class="card-number-label">卡片编号</span> <span class="card-number-label">卡片编号</span>
<el-input <el-input
@@ -17,13 +17,14 @@
class="card-number-input" class="card-number-input"
placeholder="单位自编,与网络直报一致" placeholder="单位自编,与网络直报一致"
maxlength="12" maxlength="12"
:disabled="readOnly"
/> />
</el-space> </el-space>
</el-card> </el-card>
</template> </template>
<el-card class="report-form" shadow="never"> <el-card class="report-form" shadow="never">
<el-form ref="formRef" :model="form" :rules="rules" label-position="top"> <el-form ref="formRef" :model="form" :rules="rules" label-position="top" :disabled="readOnly">
<!-- 患者姓名家长姓名身份证号 --> <!-- 患者姓名家长姓名身份证号 -->
<el-row :gutter="16" class="form-row"> <el-row :gutter="16" class="form-row">
<el-col :span="8" class="form-item"> <el-col :span="8" class="form-item">
@@ -503,14 +504,17 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<slot name="append" :form="form" />
</el-card> </el-card>
<template #footer> <template #footer>
<slot name="footer" :close="handleClose" :submit-loading="submitLoading">
<el-space :size="16" justify="center" class="dialog-footer-space" style="display: flex; justify-content: center; width: 100%;"> <el-space :size="16" justify="center" class="dialog-footer-space" style="display: flex; justify-content: center; width: 100%;">
<el-button type="primary" @click="handleSubmit" :loading="submitLoading" class="blue-button">保 存</el-button> <el-button v-if="!readOnly" type="primary" @click="handleSubmit" :loading="submitLoading" class="blue-button">保 存</el-button>
<el-button type="info" @click="handleClose">关 闭</el-button> <el-button type="info" @click="handleClose">关 闭</el-button>
<el-button type="danger" @click="handleReset"> </el-button> <el-button v-if="!readOnly" type="danger" @click="handleReset"> </el-button>
</el-space> </el-space>
</slot>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@@ -545,6 +549,14 @@ const formRef = ref(null);
const submitLoading = ref(false); const submitLoading = ref(false);
const props = defineProps({ const props = defineProps({
title: {
type: String,
default: '中华人民共和国传染病报告卡',
},
readOnly: {
type: Boolean,
default: false,
},
patientInfo: { patientInfo: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
@@ -1010,6 +1022,117 @@ function parseBirthDate(birthDate) {
}; };
} }
function normalizeDate(value) {
if (!value) return '';
return String(value).split(/[T ]/)[0];
}
function normalizeSex(value) {
if (value === '1' || value === 1 || value === '男') return '男';
if (value === '2' || value === 2 || value === '女') return '女';
return '未知';
}
function normalizeAgeUnit(value) {
const ageUnitMap = {
1: '岁',
2: '月',
3: '天',
'1': '岁',
'2': '月',
'3': '天',
'岁': '岁',
'月': '月',
'天': '天',
};
return ageUnitMap[value] || '岁';
}
function getDiseaseSelection(diseaseCode) {
const code = diseaseCode ? String(diseaseCode) : '';
return {
selectedClassA: code.startsWith('01') ? code : '',
selectedClassB: code.startsWith('02') ? code : '',
selectedClassC: code.startsWith('03') ? code : '',
};
}
function resetAddressSelector() {
provinceCode.value = '';
cityCode.value = '';
countyCode.value = '';
townCode.value = '';
cityOptions.value = [];
countyOptions.value = [];
townOptions.value = [];
}
/**
* 以只读详情方式打开报卡弹窗,供报卡管理等页面复用医生站报卡样式。
* @param {Object} reportData - 报卡详情数据
*/
function showReport(reportData = {}) {
dialogVisible.value = true;
resetAddressSelector();
initProvinceOptions();
const birthInfo = parseBirthDate(reportData.birthday || reportData.birthDate);
const diseaseCode = reportData.diseaseCode ? String(reportData.diseaseCode) : '';
const diseaseSelection = getDiseaseSelection(diseaseCode);
form.value = {
cardNo: reportData.cardNo || '',
patName: reportData.patName || reportData.patientName || '',
parentName: reportData.parentName || '',
idNo: reportData.idNo || '',
sex: normalizeSex(reportData.sex),
birthYear: birthInfo.year,
birthMonth: birthInfo.month,
birthDay: birthInfo.day,
age: reportData.age != null ? String(reportData.age) : '',
ageUnit: normalizeAgeUnit(reportData.ageUnit),
workplace: reportData.workplace || '',
phone: reportData.phone || '',
contactPhone: reportData.contactPhone || '',
addressProv: reportData.addressProv || '',
addressCity: reportData.addressCity || '',
addressCounty: reportData.addressCounty || '',
addressTown: reportData.addressTown || '',
addressVillage: reportData.addressVillage || '',
addressHouse: reportData.addressHouse || '',
patientBelong: reportData.patientBelong || 1,
occupation: reportData.occupation || '',
caseClass: reportData.caseClass != null ? String(reportData.caseClass) : '',
onsetDate: normalizeDate(reportData.onsetDate),
diagDate: normalizeDate(reportData.diagDate),
deathDate: normalizeDate(reportData.deathDate),
selectedDiseases: diseaseCode && diseaseCode !== 'OTHER' ? [diseaseCode] : [],
selectedClassA: diseaseSelection.selectedClassA,
selectedClassB: diseaseSelection.selectedClassB,
selectedClassC: diseaseSelection.selectedClassC,
otherDisease: reportData.otherDisease || (diseaseCode === 'OTHER' ? reportData.diseaseName || '' : ''),
diseaseType: reportData.diseaseType || '',
reportOrg: reportData.reportOrg || '',
reportOrgPhone: reportData.reportOrgPhone || '',
reportDoc: reportData.reportDoc || '',
reportDate: normalizeDate(reportData.reportDate || reportData.createdAt),
correctName: reportData.correctName || '',
withdrawReason: reportData.withdrawReason || '',
remark: reportData.remark || '',
encounterId: reportData.encounterId || reportData.visitId || '',
patientId: reportData.patientId || reportData.patId || '',
diagnosisId: reportData.diagnosisId || reportData.diagId || '',
};
initAddressByName(
form.value.addressProv,
form.value.addressCity,
form.value.addressCounty,
form.value.addressTown
);
}
/** /**
* 从身份证号自动解析出生日期和性别 * 从身份证号自动解析出生日期和性别
* @param {string} idNo - 身份证号码15位或18位 * @param {string} idNo - 身份证号码15位或18位
@@ -1118,13 +1241,7 @@ function show(diagnosisData) {
dialogVisible.value = true; dialogVisible.value = true;
// 重置地址选择器状态 // 重置地址选择器状态
provinceCode.value = ''; resetAddressSelector();
cityCode.value = '';
countyCode.value = '';
townCode.value = '';
cityOptions.value = [];
countyOptions.value = [];
townOptions.value = [];
// 初始化省级地址选项 // 初始化省级地址选项
initProvinceOptions(); initProvinceOptions();
@@ -1502,7 +1619,7 @@ function handleClose() {
emit('close'); emit('close');
} }
defineExpose({ show }); defineExpose({ show, showReport, close: handleClose });
</script> </script>
<style scoped> <style scoped>

View File

@@ -14,8 +14,8 @@
<el-date-picker <el-date-picker
v-model="deadline" v-model="deadline"
type="datetime" type="datetime"
format="YYYY/MM/DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
:clearable="false" :clearable="false"
@change="handleGetPrescription" @change="handleGetPrescription"
/> />
@@ -33,8 +33,8 @@
<el-date-picker <el-date-picker
v-model="exeDate" v-model="exeDate"
type="datetime" type="datetime"
format="YYYY/MM/DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
:clearable="false" :clearable="false"
@change="handleGetPrescription" @change="handleGetPrescription"
/> />
@@ -254,6 +254,20 @@ function handleRadioChange() {
handleGetPrescription(); handleGetPrescription();
} }
/** 频次时间规整为 HH:mm与 formatDateStr 得到的时分一致,避免 8:00 vs 08:00 对不上) */
function normalizeDayTimeHm(part) {
if (part == null || String(part).trim() === '') {
return '00:00';
}
const s = String(part).trim();
const [hRaw, mRaw = '0'] = s.split(':').map((x) => String(x).trim());
const hNum = Number.parseInt(hRaw || '0', 10);
const mNum = Number.parseInt(mRaw || '0', 10);
const h = Number.isNaN(hNum) ? '00' : String(hNum).padStart(2, '0');
const m = Number.isNaN(mNum) ? '00' : String(mNum).padStart(2, '0');
return `${h}:${m}`;
}
function handleGetPrescription() { function handleGetPrescription() {
if (patientInfoList.value.length > 0) { if (patientInfoList.value.length > 0) {
loading.value = true; loading.value = true;
@@ -273,8 +287,12 @@ function handleGetPrescription() {
let rate; let rate;
let times; let times;
if (prescription.therapyEnum == 1) { if (prescription.therapyEnum == 1) {
// 长期医嘱 后台返回执行时间点字符串,直接拆分取时间点 // 长期医嘱dayTimes 可能为「8:00,12:00」未补零需与后端 occurrenceTime 格式化后对齐
rate = prescription.dayTimes?.split(','); rate = prescription.dayTimes
?.split(',')
.map((x) => x.trim())
.filter((x) => x !== '')
.map((x) => normalizeDayTimeHm(x));
// 用截止时间和医嘱签发时间算出全部执行日期 // 用截止时间和医嘱签发时间算出全部执行日期
times = getDateRange(prescription.requestTime, deadline.value); times = getDateRange(prescription.requestTime, deadline.value);
} else { } else {
@@ -390,6 +408,11 @@ function handleGetPrescription() {
} }
}); });
} }
// 「待执行」tab 下医嘱所有时间点都已执行/不执行时,跳过该医嘱
// (后端待执行查询未做该过滤,需要前端补充;其他 tab 后端已按记录列表过滤,不再处理)
if (props.exeStatus === 1 && (!prescription.times || prescription.times.length === 0)) {
return groups;
}
// 把相同encounterId的医嘱放在同一个数组中 // 把相同encounterId的医嘱放在同一个数组中
const encounterId = prescription.encounterId; const encounterId = prescription.encounterId;
if (!groups[encounterId]) { if (!groups[encounterId]) {
@@ -435,8 +458,13 @@ function handleExecute() {
console.log(list, 'list'); console.log(list, 'list');
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => { adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '医嘱执行成功');
handleGetPrescription(); handleGetPrescription();
lotNumberMatch({ encounterIdList: encounterIds }); lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => {
console.warn('lotNumberMatch failed after adviceExecute:', error);
});
} else {
proxy.$modal.msgError(res.msg || '医嘱执行失败');
} }
}); });
} }
@@ -456,7 +484,10 @@ function handleNoExecute() {
console.log(list, 'list'); console.log(list, 'list');
adviceNoExecute({ adviceExecuteDetailList: list }).then((res) => { adviceNoExecute({ adviceExecuteDetailList: list }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '操作成功');
handleGetPrescription(); handleGetPrescription();
} else {
proxy.$modal.msgError(res.msg || '操作失败');
} }
}); });
} }
@@ -477,7 +508,10 @@ function handleCancel() {
}); });
adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => { adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '取消执行成功');
handleGetPrescription(); handleGetPrescription();
} else {
proxy.$modal.msgError(res.msg || '取消执行失败');
} }
}); });
} }