"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const common_assets = require("../../common/assets.js");
|
const pageSize = 10;
|
const _sfc_main = {
|
__name: "reports",
|
setup(__props) {
|
const searchKey = common_vendor.ref("");
|
const currentType = common_vendor.ref("all");
|
const reportTypes = [
|
{ label: "全部", value: "all" },
|
{ label: "检验", value: "lab" },
|
{ label: "检查", value: "exam" },
|
{ label: "影像", value: "image" }
|
];
|
const currentPage = common_vendor.ref(1);
|
const hasMore = common_vendor.ref(true);
|
const refreshing = common_vendor.ref(false);
|
const reports = common_vendor.ref([
|
{
|
id: 1,
|
name: "心电图检查",
|
time: "2024-03-25 10:00",
|
status: "completed",
|
statusText: "已完成",
|
hospitalName: "青岛镜湖医院",
|
hospitalLogo: "/static/hospital/kiang-wu.jpg",
|
departmentName: "心内科",
|
result: "窦性心律,心率75次/分,电轴正常...",
|
doctorName: "张医生",
|
type: "exam"
|
},
|
{
|
id: 2,
|
name: "血常规检查",
|
time: "2024-03-25 10:30",
|
status: "processing",
|
statusText: "检验中",
|
hospitalName: "青岛镜湖医院",
|
hospitalLogo: "/static/hospital/kiang-wu.jpg",
|
departmentName: "检验科",
|
doctorName: "李医生",
|
type: "lab"
|
},
|
{
|
id: 3,
|
name: "胸部CT",
|
time: "2024-03-25 11:00",
|
status: "completed",
|
statusText: "已完成",
|
hospitalName: "青岛镜湖医院",
|
hospitalLogo: "/static/hospital/kiang-wu.jpg",
|
departmentName: "放射科",
|
result: "未见明显异常",
|
doctorName: "王医生",
|
type: "image"
|
}
|
]);
|
const filteredReports = common_vendor.computed(() => {
|
let result = reports.value;
|
if (searchKey.value) {
|
const key = searchKey.value.toLowerCase();
|
result = result.filter(
|
(report) => report.name.toLowerCase().includes(key) || report.hospitalName.toLowerCase().includes(key) || report.departmentName.toLowerCase().includes(key)
|
);
|
}
|
if (currentType.value !== "all") {
|
result = result.filter((report) => report.type === currentType.value);
|
}
|
const start = 0;
|
const end = currentPage.value * pageSize;
|
result = result.slice(start, end);
|
return result;
|
});
|
const selectType = (type) => {
|
currentType.value = type;
|
resetList();
|
};
|
const resetList = () => {
|
currentPage.value = 1;
|
hasMore.value = true;
|
refreshing.value = false;
|
};
|
const onRefresh = () => {
|
refreshing.value = true;
|
resetList();
|
setTimeout(() => {
|
refreshing.value = false;
|
}, 1e3);
|
};
|
const onLoadMore = () => {
|
if (!hasMore.value)
|
return;
|
currentPage.value++;
|
const totalCount = reports.value.length;
|
const currentCount = currentPage.value * pageSize;
|
if (currentCount >= totalCount) {
|
hasMore.value = false;
|
}
|
};
|
const viewReport = (report) => {
|
if (report.status === "completed") {
|
common_vendor.index.navigateTo({
|
url: `/pages/records/report?id=${report.id}`
|
});
|
}
|
};
|
return (_ctx, _cache) => {
|
return common_vendor.e({
|
a: searchKey.value,
|
b: common_vendor.o(($event) => searchKey.value = $event.detail.value),
|
c: common_vendor.f(reportTypes, (type, index, i0) => {
|
return {
|
a: common_vendor.t(type.label),
|
b: index,
|
c: currentType.value === type.value ? 1 : "",
|
d: common_vendor.o(($event) => selectType(type.value), index)
|
};
|
}),
|
d: common_vendor.f(filteredReports.value, (report, index, i0) => {
|
return common_vendor.e({
|
a: common_vendor.t(report.name),
|
b: common_vendor.t(report.time),
|
c: common_vendor.t(report.statusText),
|
d: common_vendor.n(report.status),
|
e: report.hospitalLogo,
|
f: common_vendor.t(report.hospitalName),
|
g: common_vendor.t(report.departmentName),
|
h: report.status === "completed"
|
}, report.status === "completed" ? {
|
i: common_vendor.t(report.result)
|
} : {}, {
|
j: common_vendor.t(report.doctorName),
|
k: report.status === "completed"
|
}, report.status === "completed" ? {} : {}, {
|
l: index,
|
m: common_vendor.o(($event) => viewReport(report), index)
|
});
|
}),
|
e: hasMore.value
|
}, hasMore.value ? {} : {}, {
|
f: !hasMore.value && filteredReports.value.length > 0
|
}, !hasMore.value && filteredReports.value.length > 0 ? {} : {}, {
|
g: filteredReports.value.length === 0
|
}, filteredReports.value.length === 0 ? {
|
h: common_assets._imports_0$5
|
} : {}, {
|
i: refreshing.value,
|
j: common_vendor.o(onRefresh),
|
k: common_vendor.o(onLoadMore),
|
l: common_vendor.gei(_ctx, "")
|
});
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/records/reports.js.map
|