+
详情
+
+
+ 修改
+
+
+ 删除
+
+
+
+
+
+
+
+ 撤回
+
+
+
+
+
+ 打印
+
+
+
+ 打印
+ 看报告
+
+
+
+ 打印
+ 看报告
+
+
@@ -169,6 +209,60 @@
关闭
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 申请项目
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 保存
+
+
+
+
+
+
+
+
+
+ 关闭
+
+
@@ -176,7 +270,7 @@
import {computed, getCurrentInstance, ref, watch} from 'vue';
import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js';
-import {getCheck} from './api';
+import {getCheck, deleteRequestForm, withdrawRequestForm, getTestResult} from './api';
import {getOrgList} from '@/views/doctorstation/components/api.js';
const { proxy } = getCurrentInstance();
@@ -188,6 +282,16 @@ const currentDetail = ref(null);
const descJsonData = ref(null);
const orgOptions = ref([]);
+// 修改申请单相关
+const editDialogVisible = ref(false);
+const editDetail = ref(null);
+const editForm = ref({});
+const saveLoading = ref(false);
+
+// 报告查看相关
+const reportDialogVisible = ref(false);
+const reportUrl = ref('');
+
// 筛选表单数据
const getDefaultDateRange = () => {
const now = new Date();
@@ -364,6 +468,217 @@ const handleViewDetail = (row) => {
detailDialogVisible.value = true;
};
+/**
+ * 修改申请单
+ */
+const handleEdit = (row) => {
+ editDetail.value = row;
+ // 解析 descJson 为表单数据
+ const form = { name: row.name || '' };
+ if (row.descJson) {
+ try {
+ const desc = JSON.parse(row.descJson);
+ form.clinicalDiagnosis = desc.clinicalDiagnosis || '';
+ form.attention = desc.attention || '';
+ form.symptom = desc.symptom || '';
+ form.sign = desc.sign || '';
+ } catch (e) {
+ console.error('解析 descJson 失败:', e);
+ }
+ }
+ editForm.value = form;
+ editDialogVisible.value = true;
+};
+
+/**
+ * 保存修改
+ */
+const handleSaveEdit = async () => {
+ if (!editDetail.value?.requestFormId) {
+ proxy.$modal?.msgWarning?.('申请单ID不存在');
+ return;
+ }
+ saveLoading.value = true;
+ try {
+ // 复用 save-check 接口进行更新(传入 requestFormId 即为编辑场景)
+ const res = await proxy.$http?.post?.('/reg-doctorstation/request-form/save-check', {
+ requestFormId: editDetail.value.requestFormId,
+ encounterId: editDetail.value.encounterId,
+ patientId: editDetail.value.patientId,
+ name: editForm.value.name,
+ organizationId: editDetail.value.inHospitalOrgId || patientInfo.value?.inHospitalOrgId,
+ descJson: JSON.stringify({
+ clinicalDiagnosis: editForm.value.clinicalDiagnosis,
+ attention: editForm.value.attention,
+ symptom: editForm.value.symptom,
+ sign: editForm.value.sign,
+ }),
+ activityList: [], // 修改场景仅更新描述信息,不修改项目
+ });
+ if (res?.code === 200) {
+ proxy.$modal?.msgSuccess?.('修改成功');
+ editDialogVisible.value = false;
+ await fetchData();
+ } else {
+ proxy.$modal?.msgError?.(res?.msg || '修改失败');
+ }
+ } catch (e) {
+ console.warn('修改申请单失败:', e.message);
+ proxy.$modal?.msgError?.('修改失败: ' + (e.message || '网络异常'));
+ } finally {
+ saveLoading.value = false;
+ }
+};
+
+/**
+ * 删除申请单(仅待签发状态可删除)
+ */
+const handleDelete = async (row) => {
+ if (!row.requestFormId) {
+ proxy.$modal?.msgWarning?.('申请单ID不存在');
+ return;
+ }
+ try {
+ const res = await deleteRequestForm({ requestFormId: row.requestFormId });
+ if (res?.code === 200) {
+ proxy.$modal?.msgSuccess?.('删除成功');
+ await fetchData();
+ } else {
+ proxy.$modal?.msgError?.(res?.msg || '删除失败');
+ }
+ } catch (e) {
+ console.warn('删除申请单失败:', e.message);
+ proxy.$modal?.msgError?.('删除失败: ' + (e.message || '网络异常'));
+ }
+};
+
+/**
+ * 撤回申请单(已签发状态撤回至待签发)
+ */
+const handleWithdraw = async (row) => {
+ if (!row.requestFormId) {
+ proxy.$modal?.msgWarning?.('申请单ID不存在');
+ return;
+ }
+ try {
+ const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
+ if (res?.code === 200) {
+ proxy.$modal?.msgSuccess?.('撤回成功');
+ await fetchData();
+ } else {
+ proxy.$modal?.msgError?.(res?.msg || '撤回失败');
+ }
+ } catch (e) {
+ console.warn('撤回申请单失败:', e.message);
+ proxy.$modal?.msgError?.('撤回失败: ' + (e.message || '网络异常'));
+ }
+};
+
+/**
+ * 打印申请单
+ */
+const handlePrint = (row) => {
+ // 打开新窗口进行打印
+ const printWindow = window.open('', '_blank');
+ if (!printWindow) {
+ proxy.$modal?.msgWarning?.('请允许浏览器弹出窗口以进行打印');
+ return;
+ }
+ const content = buildPrintContent(row);
+ printWindow.document.write(`
+
+
+
+
+ 检查申请单打印
+
+
+
+ ${content}
+
+
+
+
+
+
+ `);
+ printWindow.document.close();
+};
+
+/**
+ * 构建打印内容
+ */
+const buildPrintContent = (row) => {
+ let descHtml = '';
+ if (row.descJson) {
+ try {
+ const desc = JSON.parse(row.descJson);
+ descHtml = Object.entries(labelMap)
+ .filter(([key]) => desc[key])
+ .map(([key, label]) => `${label}:${desc[key]}
`)
+ .join('');
+ } catch (e) {
+ console.error('解析 descJson 失败:', e);
+ }
+ }
+ let itemsHtml = '';
+ if (row.requestFormDetailList && row.requestFormDetailList.length) {
+ itemsHtml = `
+ 申请项目
+
+ | 序号 | 医嘱名称 | 数量 | 单位 | 总价 |
+ ${row.requestFormDetailList.map((item, i) => `
+
+ | ${i + 1} |
+ ${item.adviceName || '-'} |
+ ${item.quantity || '-'} |
+ ${item.unitCode_dictText || '-'} |
+ ${item.totalPrice || '-'} |
+
+ `).join('')}
+
+ `;
+ }
+ return `
+ 检查申请单
+ 患者姓名:${row.patientName || '-'}
+ 申请单名称:${row.name || '-'}
+ 创建时间:${row.createTime || '-'}
+ 处方号:${row.prescriptionNo || '-'}
+ 申请者:${row.requesterId_dictText || '-'}
+ 申请单状态:${parseStatus(row.status)}
+ ${descHtml ? `申请单描述
${descHtml}` : ''}
+ ${itemsHtml}
+ `;
+};
+
+/**
+ * 查看报告
+ */
+const handleViewReport = async (row) => {
+ reportUrl.value = '';
+ reportDialogVisible.value = true;
+ try {
+ const res = await getTestResult({ encounterId: row.encounterId, requestFormId: row.requestFormId });
+ if (res?.code === 200 && res?.data) {
+ reportUrl.value = res.data;
+ } else {
+ console.warn('获取检查报告失败:', res?.msg || '无数据');
+ }
+ } catch (e) {
+ console.warn('获取检查报告异常:', e.message);
+ }
+};
+
watch(
() => patientInfo.value?.encounterId,
(val) => {