"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const stores_useHomeButton = require("../../stores/useHomeButton.js");
|
const stores_user = require("../../stores/user.js");
|
const utils_useDictMapper = require("../../utils/useDictMapper.js");
|
if (!Array) {
|
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
|
_easycom_u_loading_icon2();
|
}
|
const _easycom_u_loading_icon = () => "../../uni_modules/uview-plus/components/u-loading-icon/u-loading-icon.js";
|
if (!Math) {
|
(common_vendor.unref(attachmentUpload) + _easycom_u_loading_icon)();
|
}
|
const attachmentUpload = () => "../../components/attachment/index.js";
|
const _sfc_main = {
|
__name: "CaseInfo",
|
setup(__props) {
|
const { showHomeButton, checkAutoLogin, goHome } = stores_useHomeButton.useHomeButton();
|
const requiredDictTypes = [
|
"sys_user_sex",
|
"sys_BloodType",
|
"sys_AgeUnit",
|
"sys_IDType",
|
"sys_Nation",
|
"sys_education",
|
"sys_occupation",
|
"sys_Infectious"
|
];
|
const { dictData, loading: dictLoading } = utils_useDictMapper.useDictMapper(requiredDictTypes);
|
const getDictList = (dictType) => {
|
return dictData.value[dictType] || [];
|
};
|
const getDictLabel = (dictType, value) => {
|
if (!value)
|
return "未填写";
|
const dictList = getDictList(dictType);
|
const found = dictList.find(
|
(item) => item.value == value || item.value === value
|
);
|
return found ? found.label : value;
|
};
|
const getInfectiousText = () => {
|
const infectious = caseDetail.value.infectious;
|
if (!infectious)
|
return "无";
|
const values = infectious.split(",").filter((v) => v.trim());
|
if (values.length === 0)
|
return "无";
|
const labels = values.map((v) => getDictLabel("sys_Infectious", v.trim()));
|
const other = caseDetail.value.infectiousOther;
|
return labels.join("、") + (other ? `(${other})` : "");
|
};
|
const caseDetail = common_vendor.ref({});
|
const userStore = stores_user.useUserStore();
|
const loading = common_vendor.ref(false);
|
const approveLoading = common_vendor.ref(false);
|
const activeTab = common_vendor.ref("basic");
|
const caseId = common_vendor.ref(null);
|
const attachments = common_vendor.ref([]);
|
const showApprovePanel = common_vendor.ref(false);
|
const canApprove = common_vendor.computed(() => {
|
var _a;
|
common_vendor.index.__f__("log", "at pagesSub/case/CaseInfo.vue:657", userStore.userInfo.roles);
|
const roles = ((_a = userStore.userInfo) == null ? void 0 : _a.roles) || [];
|
return roles.some((role) => role.roleKey === "admin" || "opoadmin");
|
});
|
const rejectReasons = [
|
{ label: "好转", value: "1" },
|
{ label: "死亡", value: "2" },
|
{ label: "不符合捐献标准", value: "3" },
|
{ label: "家属放弃捐献", value: "4" },
|
{ label: "其他", value: "5" }
|
];
|
const approveForm = common_vendor.ref({
|
id: null,
|
approveResult: "3",
|
confirmResult: "",
|
rejectType: "",
|
isTransport: "1",
|
isDonate: "0"
|
});
|
const tabs = common_vendor.ref([
|
{ id: "basic", label: "基本信息" },
|
{ id: "medical", label: "医疗信息" },
|
{ id: "contact", label: "联系信息" },
|
{ id: "transport", label: "转运信息" }
|
]);
|
const hasTransport = common_vendor.computed(
|
() => caseDetail.value.serviceTransport && caseDetail.value.serviceTransport.length > 0
|
);
|
common_vendor.onShow(() => {
|
if (caseId.value) {
|
loadCaseDetail(caseId.value);
|
}
|
});
|
common_vendor.onLoad(async (options) => {
|
checkAutoLogin(options);
|
if (options.id) {
|
caseId.value = options.id;
|
await loadCaseDetail(options.id);
|
}
|
});
|
const loadCaseDetail = async (id) => {
|
loading.value = true;
|
try {
|
const res = await common_vendor.index.$uapi.get(
|
`/project/donatebaseinforeport/getInfo/${id}`
|
);
|
if (res.data) {
|
caseDetail.value = res.data;
|
if (res.data.annexfilesList) {
|
attachments.value = res.data.annexfilesList.map((item) => ({
|
...item,
|
url: item.path,
|
name: item.fileName
|
}));
|
}
|
} else {
|
throw new Error(res.msg || "数据加载失败");
|
}
|
} catch (error) {
|
common_vendor.index.__f__("error", "at pagesSub/case/CaseInfo.vue:732", "加载案例详情失败:", error);
|
common_vendor.index.showToast({ title: "数据加载失败,请重试", icon: "none" });
|
} finally {
|
loading.value = false;
|
}
|
};
|
const getFullRegisterAddress = () => {
|
const {
|
registerprovincename,
|
registercityname,
|
registertownname,
|
registeraddress
|
} = caseDetail.value;
|
const parts = [
|
registerprovincename,
|
registercityname,
|
registertownname,
|
registeraddress
|
];
|
return parts.filter((p) => p && p.trim()).join("");
|
};
|
const getFullResidenceAddress = () => {
|
const {
|
residenceprovincename,
|
residencecityname,
|
residencetownname,
|
residenceaddress
|
} = caseDetail.value;
|
const parts = [
|
residenceprovincename,
|
residencecityname,
|
residencetownname,
|
residenceaddress
|
];
|
return parts.filter((p) => p && p.trim()).join("");
|
};
|
const getStatusClass = (status) => {
|
const map = { 1: "reported", 2: "read", 3: "agreed", 4: "rejected" };
|
return map[status] || "reported";
|
};
|
const getStatusText = (status) => {
|
const map = { 1: "已上报", 2: "已阅读", 3: "已同意", 4: "已驳回" };
|
return map[status] || "已上报";
|
};
|
const getTransportStatusText = (status) => {
|
const map = {
|
1: "待转运",
|
2: "转运中",
|
3: "转运完成",
|
4: "转运取消",
|
5: "暂存"
|
};
|
return map[status] || "未知";
|
};
|
const getTransportStatusClass = (status) => {
|
const map = {
|
1: "pending",
|
2: "transporting",
|
3: "completed",
|
4: "cancelled",
|
5: "draft"
|
};
|
return map[status] || "pending";
|
};
|
const formatDateTime = (dateTime) => {
|
if (!dateTime)
|
return "";
|
return dateTime.replace("T", " ").substring(0, 16);
|
};
|
const openApprovePanel = () => {
|
approveForm.value = {
|
id: caseDetail.value.id,
|
approveResult: "3",
|
confirmResult: "",
|
rejectType: "",
|
isTransport: caseDetail.value.isTransport || "1",
|
isDonate: "0"
|
};
|
showApprovePanel.value = true;
|
};
|
const closeApprovePanel = () => {
|
showApprovePanel.value = false;
|
};
|
const handleApproveResultChange = (value) => {
|
if (value == "3") {
|
approveForm.value.rejectType = "";
|
approveForm.value.isDonate = "0";
|
} else if (value == "4") {
|
approveForm.value.isTransport = "1";
|
}
|
};
|
const validateApproveForm = () => {
|
if (!approveForm.value.approveResult) {
|
common_vendor.index.showToast({ title: "请选择确认结果", icon: "none" });
|
return false;
|
}
|
if (approveForm.value.approveResult == "3" && !approveForm.value.isTransport) {
|
common_vendor.index.showToast({ title: "请选择是否需要转运", icon: "none" });
|
return false;
|
}
|
if (approveForm.value.approveResult == "4") {
|
if (!approveForm.value.rejectType) {
|
common_vendor.index.showToast({ title: "请选择驳回原因", icon: "none" });
|
return false;
|
}
|
if (!approveForm.value.confirmResult) {
|
common_vendor.index.showToast({ title: "驳回时必须填写驳回意见", icon: "none" });
|
return false;
|
}
|
}
|
return true;
|
};
|
const submitApprove = async () => {
|
var _a, _b;
|
if (!validateApproveForm())
|
return;
|
approveLoading.value = true;
|
try {
|
const approveData = {
|
...caseDetail.value,
|
reportStatus: approveForm.value.approveResult,
|
confirmResult: approveForm.value.confirmResult,
|
approvername: ((_a = userStore.user) == null ? void 0 : _a.name) || "当前用户",
|
approvetime: common_vendor.dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
updateTime: common_vendor.dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
updateBy: ((_b = userStore.user) == null ? void 0 : _b.name) || "当前用户"
|
};
|
if (approveForm.value.approveResult == "3") {
|
approveData.isTransport = approveForm.value.isTransport;
|
if (approveForm.value.isTransport == "1") {
|
approveData.isDonate = "1";
|
} else {
|
approveData.isDonate = "0";
|
}
|
} else if (approveForm.value.approveResult == "4") {
|
approveData.rejectType = approveForm.value.rejectType;
|
approveData.isTransport = "1";
|
approveData.isDonate = "0";
|
}
|
const res = await common_vendor.index.$uapi.post(
|
"/project/donatebaseinforeport/edit",
|
approveData
|
);
|
if (res.code == 200) {
|
common_vendor.index.showToast({ title: "确认成功", icon: "success" });
|
showApprovePanel.value = false;
|
await loadCaseDetail(caseId.value);
|
if (approveForm.value.approveResult == "3" && approveForm.value.isTransport == "2") {
|
common_vendor.index.__f__("log", "at pagesSub/case/CaseInfo.vue:922", caseId.value);
|
setTimeout(() => {
|
common_vendor.index.navigateTo({
|
url: `/pagesSub/case/transferinfo?caseId=${caseId.value}&caseNo=${caseDetail.value.caseNo}&autoCreate=true`
|
});
|
}, 800);
|
}
|
} else {
|
common_vendor.index.showToast({ title: res.msg || "确认失败", icon: "none" });
|
}
|
} catch (error) {
|
common_vendor.index.__f__("error", "at pagesSub/case/CaseInfo.vue:934", "确认失败:", error);
|
common_vendor.index.showToast({ title: "确认失败,请重试", icon: "none" });
|
} finally {
|
approveLoading.value = false;
|
}
|
};
|
const switchTab = (tabId) => {
|
activeTab.value = tabId;
|
};
|
const goBack = () => {
|
if (showHomeButton) {
|
common_vendor.index.switchTab({ url: "/pages/index/index" });
|
} else {
|
common_vendor.index.navigateBack();
|
}
|
};
|
const handleEdit = () => {
|
common_vendor.index.navigateTo({
|
url: `/pagesSub/case/CaseDetails?id=${caseId.value}&edit=true`
|
});
|
};
|
const createTransport = () => {
|
if (caseDetail.value.reportStatus !== "3") {
|
common_vendor.index.showToast({ title: "案例需先审批同意", icon: "none" });
|
return;
|
}
|
common_vendor.index.navigateTo({
|
url: `/pages/transport/create?caseId=${caseId.value}&caseNo=${caseDetail.value.caseNo}`
|
});
|
};
|
const viewTransportDetail = () => {
|
if (hasTransport.value) {
|
const transport = caseDetail.value.serviceTransport[0];
|
common_vendor.index.navigateTo({ url: `/pages/transport/detail?id=${transport.id}` });
|
}
|
};
|
const handlePreview = (file) => {
|
const fullUrl = file.url.startsWith("http") ? file.url : (file.url.startsWith("/") ? "" : "/") + file.url;
|
if (file.type && file.type.includes("image")) {
|
common_vendor.index.previewImage({
|
urls: attachments.value.filter((f) => f.type && f.type.includes("image")).map(
|
(f) => f.url.startsWith("http") ? f.url : (f.url.startsWith("/") ? "" : "/") + f.url
|
),
|
current: fullUrl
|
});
|
} else if (file.type && file.type.includes("pdf")) {
|
common_vendor.index.downloadFile({
|
url: fullUrl,
|
success: (res) => {
|
common_vendor.index.openDocument({
|
filePath: res.tempFilePath,
|
fileType: "pdf",
|
showMenu: true
|
});
|
},
|
fail: () => common_vendor.index.showToast({ title: "打开文件失败", icon: "none" })
|
});
|
} else {
|
common_vendor.index.showToast({ title: "暂不支持此文件类型预览", icon: "none" });
|
}
|
};
|
return (_ctx, _cache) => {
|
return common_vendor.e({
|
a: caseDetail.value.hospitalLogo || "/static/hospital-default.png",
|
b: common_vendor.t(caseDetail.value.treatmenthospitalname || "未填写治疗医院"),
|
c: common_vendor.t(caseDetail.value.donorNo ? "器官捐献案例" : "案例详情"),
|
d: common_vendor.t(getStatusText(caseDetail.value.reportStatus)),
|
e: common_vendor.n(getStatusClass(caseDetail.value.reportStatus)),
|
f: common_vendor.t(caseDetail.value.caseNo || "未生成"),
|
g: common_vendor.t(formatDateTime(caseDetail.value.reporttime)),
|
h: common_vendor.f(tabs.value, (tab, k0, i0) => {
|
return {
|
a: common_vendor.t(tab.label),
|
b: tab.id,
|
c: activeTab.value == tab.id ? 1 : "",
|
d: common_vendor.o(($event) => switchTab(tab.id), tab.id)
|
};
|
}),
|
i: activeTab.value == "basic"
|
}, activeTab.value == "basic" ? {
|
j: common_vendor.t(caseDetail.value.name || "未填写"),
|
k: common_vendor.t(getDictLabel("sys_user_sex", caseDetail.value.sex)),
|
l: common_vendor.t(caseDetail.value.age || "0"),
|
m: common_vendor.t(getDictLabel("sys_AgeUnit", caseDetail.value.ageunit)),
|
n: common_vendor.t(getDictLabel("sys_IDType", caseDetail.value.idcardtype)),
|
o: common_vendor.t(caseDetail.value.idcardno || "未填写"),
|
p: common_vendor.t(getDictLabel("sys_Nation", caseDetail.value.nation)),
|
q: common_vendor.t(caseDetail.value.nationality || "未填写"),
|
r: common_vendor.t(caseDetail.value.nativeplace || "未填写"),
|
s: common_vendor.t(getDictLabel("sys_education", caseDetail.value.education)),
|
t: common_vendor.t(getDictLabel("sys_occupation", caseDetail.value.occupation)),
|
v: common_vendor.t(caseDetail.value.phone || "未填写"),
|
w: common_vendor.t(getFullRegisterAddress() || "未填写"),
|
x: common_vendor.t(getFullResidenceAddress() || "未填写")
|
} : {}, {
|
y: activeTab.value == "medical"
|
}, activeTab.value == "medical" ? {
|
z: common_vendor.t(caseDetail.value.inpatientno || "未填写"),
|
A: common_vendor.t(caseDetail.value.gcsScore || "未评估"),
|
B: common_vendor.t(getDictLabel("sys_BloodType", caseDetail.value.bloodType)),
|
C: common_vendor.t(caseDetail.value.rhYin == "1" ? "是" : "否"),
|
D: common_vendor.t(getInfectiousText() || "无"),
|
E: common_vendor.t(caseDetail.value.diagnosisname || "未填写"),
|
F: common_vendor.t(caseDetail.value.illnessoverview || "未填写"),
|
G: common_vendor.t(caseDetail.value.patientstate || "未填写")
|
} : {}, {
|
H: activeTab.value == "contact"
|
}, activeTab.value == "contact" ? {
|
I: common_vendor.t(caseDetail.value.treatmenthospitalname || "未填写"),
|
J: common_vendor.t(caseDetail.value.treatmentdeptname || "未填写"),
|
K: common_vendor.t(caseDetail.value.toHospital || "未填写"),
|
L: common_vendor.t(caseDetail.value.infoName || "未填写"),
|
M: common_vendor.t(caseDetail.value.infoNo || "未填写"),
|
N: common_vendor.t(caseDetail.value.coordinatorName || "未填写"),
|
O: common_vendor.t(caseDetail.value.coordinatorNo || "未填写")
|
} : {}, {
|
P: activeTab.value == "transport"
|
}, activeTab.value == "transport" ? common_vendor.e({
|
Q: caseDetail.value.reportStatus == "3"
|
}, caseDetail.value.reportStatus == "3" ? common_vendor.e({
|
R: caseDetail.value.isTransport == "2" && !hasTransport.value
|
}, caseDetail.value.isTransport == "2" && !hasTransport.value ? {
|
S: common_vendor.o(createTransport)
|
} : {}, {
|
T: hasTransport.value
|
}, hasTransport.value ? {
|
U: common_vendor.o(viewTransportDetail)
|
} : {}) : {}, {
|
V: common_vendor.t(caseDetail.value.isTransport == "2" ? "需要" : "不需要"),
|
W: hasTransport.value && caseDetail.value.serviceTransport
|
}, hasTransport.value && caseDetail.value.serviceTransport ? {
|
X: common_vendor.f(caseDetail.value.serviceTransport, (transport, k0, i0) => {
|
return common_vendor.e({
|
a: common_vendor.t(transport.reportId || transport.id),
|
b: common_vendor.t(getTransportStatusText(transport.transitStatus)),
|
c: common_vendor.n(getTransportStatusClass(transport.transitStatus)),
|
d: common_vendor.t(transport.transportStartPlace || "未填写"),
|
e: common_vendor.t(formatDateTime(transport.transportStartTime)),
|
f: common_vendor.t(transport.contactPerson || "未填写"),
|
g: transport.doctor
|
}, transport.doctor ? {
|
h: common_vendor.t(transport.doctor)
|
} : {}, {
|
i: transport.nurse
|
}, transport.nurse ? {
|
j: common_vendor.t(transport.nurse)
|
} : {}, {
|
k: transport.driver
|
}, transport.driver ? {
|
l: common_vendor.t(transport.driver)
|
} : {}, {
|
m: transport.icuDoctor
|
}, transport.icuDoctor ? {
|
n: common_vendor.t(transport.icuDoctor)
|
} : {}, {
|
o: transport.id
|
});
|
})
|
} : caseDetail.value.isTransport == "2" ? common_vendor.e({
|
Z: caseDetail.value.reportStatus !== "3"
|
}, caseDetail.value.reportStatus !== "3" ? {} : {}) : {}, {
|
Y: caseDetail.value.isTransport == "2"
|
}) : {}, {
|
aa: common_vendor.sr("attachment", "7700b214-0"),
|
ab: common_vendor.o(handlePreview),
|
ac: common_vendor.p({
|
files: attachments.value,
|
readonly: true,
|
maxCount: 5
|
}),
|
ad: common_vendor.o(goBack),
|
ae: canApprove.value && caseDetail.value.delFlag == 0
|
}, canApprove.value && caseDetail.value.delFlag == 0 ? {
|
af: common_vendor.o(openApprovePanel)
|
} : {}, {
|
ag: caseDetail.value.reportStatus == "1" || caseDetail.value.reportStatus == "2"
|
}, caseDetail.value.reportStatus == "1" || caseDetail.value.reportStatus == "2" ? {
|
ah: common_vendor.o(handleEdit)
|
} : {}, {
|
ai: showApprovePanel.value
|
}, showApprovePanel.value ? {
|
aj: common_vendor.o(closeApprovePanel)
|
} : {}, {
|
ak: common_vendor.o(closeApprovePanel),
|
al: common_vendor.t(caseDetail.value.caseNo),
|
am: common_vendor.t(caseDetail.value.name),
|
an: common_vendor.t(caseDetail.value.diagnosisname),
|
ao: common_vendor.t(caseDetail.value.treatmenthospitalname),
|
ap: approveForm.value.approveResult == "3" ? 1 : "",
|
aq: approveForm.value.approveResult == "3" ? 1 : "",
|
ar: common_vendor.o(($event) => {
|
approveForm.value.approveResult = "3";
|
handleApproveResultChange("3");
|
}),
|
as: approveForm.value.approveResult == "4" ? 1 : "",
|
at: approveForm.value.approveResult == "4" ? 1 : "",
|
av: common_vendor.o(($event) => {
|
approveForm.value.approveResult = "4";
|
handleApproveResultChange("4");
|
}),
|
aw: approveForm.value.approveResult == "3"
|
}, approveForm.value.approveResult == "3" ? {
|
ax: approveForm.value.isTransport == "1" ? 1 : "",
|
ay: approveForm.value.isTransport == "1" ? 1 : "",
|
az: common_vendor.o(($event) => approveForm.value.isTransport = "1"),
|
aA: approveForm.value.isTransport == "2" ? 1 : "",
|
aB: approveForm.value.isTransport == "2" ? 1 : "",
|
aC: common_vendor.o(($event) => approveForm.value.isTransport = "2")
|
} : {}, {
|
aD: approveForm.value.approveResult == "4"
|
}, approveForm.value.approveResult == "4" ? {
|
aE: common_vendor.f(rejectReasons, (reason, k0, i0) => {
|
return {
|
a: approveForm.value.rejectType == reason.value ? 1 : "",
|
b: common_vendor.t(reason.label),
|
c: reason.value,
|
d: approveForm.value.rejectType == reason.value ? 1 : "",
|
e: common_vendor.o(($event) => approveForm.value.rejectType = reason.value, reason.value)
|
};
|
})
|
} : {}, {
|
aF: common_vendor.t(approveForm.value.approveResult == "4" ? "驳回意见" : "确认意见"),
|
aG: approveForm.value.approveResult == "4"
|
}, approveForm.value.approveResult == "4" ? {} : {}, {
|
aH: approveForm.value.approveResult == "4" ? "请输入详细的驳回意见" : "请输入确认意见",
|
aI: approveForm.value.confirmResult,
|
aJ: common_vendor.o(($event) => approveForm.value.confirmResult = $event.detail.value),
|
aK: common_vendor.t(approveForm.value.confirmResult.length),
|
aL: common_vendor.o(closeApprovePanel),
|
aM: common_vendor.o(submitApprove),
|
aN: approveLoading.value,
|
aO: showApprovePanel.value ? 1 : "",
|
aP: loading.value
|
}, loading.value ? {
|
aQ: common_vendor.p({
|
show: loading.value,
|
text: "加载中..."
|
})
|
} : {}, {
|
aR: common_vendor.gei(_ctx, "")
|
});
|
};
|
}
|
};
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7700b214"]]);
|
wx.createPage(MiniProgramPage);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pagesSub/case/CaseInfo.js.map
|