更新
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
_easycom_uni_icons2();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_icons();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "Card",
|
||||
setup(__props) {
|
||||
const { proxy } = common_vendor.getCurrentInstance();
|
||||
const cardList = common_vendor.ref([]);
|
||||
const loading = common_vendor.ref(false);
|
||||
common_vendor.onMounted(() => {
|
||||
loadCardList();
|
||||
});
|
||||
common_vendor.onShow(() => {
|
||||
loadCardList();
|
||||
});
|
||||
const loadCardList = async () => {
|
||||
var _a;
|
||||
loading.value = true;
|
||||
try {
|
||||
const token = common_vendor.index.getStorageSync("token");
|
||||
if (!token) {
|
||||
common_vendor.index.showToast({ title: "请先登录", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const userData = common_vendor.index.getStorageSync("userData");
|
||||
const patientId = (_a = userData == null ? void 0 : userData.diagnosis) == null ? void 0 : _a.patient_id;
|
||||
if (!patientId) {
|
||||
return;
|
||||
}
|
||||
const res = await proxy.apiUrl({
|
||||
url: "/api/tcm/getCardList",
|
||||
method: "GET",
|
||||
data: {
|
||||
patient_id: patientId
|
||||
}
|
||||
});
|
||||
if (res.code === 1) {
|
||||
cardList.value = res.data || [];
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "获取失败", icon: "none" });
|
||||
}
|
||||
} catch (err) {
|
||||
common_vendor.index.__f__("error", "at pages/Card/Card.vue:139", "加载就诊卡列表失败:", err);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const viewCardDetail = (card) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/Card/edit_card?id=${card.id}`
|
||||
});
|
||||
};
|
||||
const viewDailyRecord = (card) => {
|
||||
const url = `/tongji/pages/index?diagnosis_id=${card.id}&patient_id=${card.patient_id || ""}&patient_name=${encodeURIComponent(card.patient_name || "")}&age=${card.age || ""}&gender=${card.gender || ""}`;
|
||||
common_vendor.index.navigateTo({ url });
|
||||
};
|
||||
const createCard = () => {
|
||||
const token = common_vendor.index.getStorageSync("token");
|
||||
if (!token) {
|
||||
common_vendor.index.showToast({ title: "请先登录", icon: "none" });
|
||||
return;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/Card/edit_card?add=1"
|
||||
});
|
||||
};
|
||||
const getStatusText = (status) => {
|
||||
return status === 1 ? "启用" : "禁用";
|
||||
};
|
||||
const getStatusClass = (status) => {
|
||||
return status === 1 ? "status-confirmed" : "status-pending";
|
||||
};
|
||||
const diagnosisTypeMap = {
|
||||
"first_visit": "初诊",
|
||||
"follow_up": "复诊",
|
||||
"consultation": "会诊"
|
||||
};
|
||||
const syndromeTypeMap = {
|
||||
"qi_deficiency": "气虚",
|
||||
"blood_deficiency": "血虚",
|
||||
"yin_deficiency": "阴虚",
|
||||
"yang_deficiency": "阳虚",
|
||||
"qi_stagnation": "气滞",
|
||||
"blood_stasis": "血瘀",
|
||||
"phlegm_dampness": "痰湿",
|
||||
"damp_heat": "湿热",
|
||||
"cold_dampness": "寒湿",
|
||||
"wind_cold": "风寒",
|
||||
"wind_heat": "风热"
|
||||
};
|
||||
const getDiagnosisTypeName = (type) => {
|
||||
return diagnosisTypeMap[type] || type || "-";
|
||||
};
|
||||
const getSyndromeTypeName = (type) => {
|
||||
return syndromeTypeMap[type] || type || "-";
|
||||
};
|
||||
const formatDate = (timestamp) => {
|
||||
if (!timestamp)
|
||||
return "-";
|
||||
const date = new Date(timestamp * 1e3);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.f(cardList.value, (card, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(card.id),
|
||||
b: common_vendor.t(card.status_desc || getStatusText(card.status)),
|
||||
c: common_vendor.n(getStatusClass(card.status)),
|
||||
d: common_vendor.t(card.patient_name || "-"),
|
||||
e: common_vendor.t(card.gender_desc || "-"),
|
||||
f: common_vendor.t(card.age),
|
||||
g: common_vendor.t(getDiagnosisTypeName(card.diagnosis_type)),
|
||||
h: common_vendor.t(getSyndromeTypeName(card.syndrome_type)),
|
||||
i: common_vendor.t(card.diagnosis_date_text || formatDate(card.diagnosis_date)),
|
||||
j: common_vendor.t(card.create_time || "-"),
|
||||
k: common_vendor.o(($event) => viewDailyRecord(card), card.id),
|
||||
l: common_vendor.o(($event) => viewCardDetail(card), card.id),
|
||||
m: card.id,
|
||||
n: common_vendor.o(($event) => viewCardDetail(card), card.id)
|
||||
};
|
||||
}),
|
||||
b: !loading.value && cardList.value.length === 0
|
||||
}, !loading.value && cardList.value.length === 0 ? {
|
||||
c: common_vendor.p({
|
||||
type: "wallet",
|
||||
size: "80",
|
||||
color: "#1890ff"
|
||||
}),
|
||||
d: common_vendor.o(createCard, "df")
|
||||
} : {}, {
|
||||
e: loading.value
|
||||
}, loading.value ? {} : {});
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f80331d8"]]);
|
||||
_sfc_main.__runtimeHooks = 2;
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Card/Card.js.map
|
||||
Reference in New Issue
Block a user