gengx
This commit is contained in:
+1
-149
@@ -1,150 +1,2 @@
|
||||
"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);
|
||||
"use strict";const e=require("../../common/vendor.js");Array||e.resolveComponent("uni-icons")();const C=()=>"../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";Math||C();const u={__name:"Card",setup(g){const{proxy:l}=e.getCurrentInstance(),d=e.ref([]),o=e.ref(!1);e.onMounted(()=>{r()}),e.onShow(()=>{r()});const r=async()=>{var t;o.value=!0;try{if(!e.index.getStorageSync("token")){e.index.showToast({title:"请先登录",icon:"none"});return}const n=e.index.getStorageSync("userData"),a=(t=n==null?void 0:n.diagnosis)==null?void 0:t.patient_id;if(!a)return;const s=await l.apiUrl({url:"/api/tcm/getCardList",method:"GET",data:{patient_id:a}});s.code===1?d.value=s.data||[]:e.index.showToast({title:s.msg||"获取失败",icon:"none"})}catch(i){e.index.__f__("error","at pages/Card/Card.vue:139","加载就诊卡列表失败:",i)}finally{o.value=!1}},c=t=>{e.index.navigateTo({url:`/pages/Card/edit_card?id=${t.id}`})},p=t=>{const i=`/tongji/pages/index?diagnosis_id=${t.id}&patient_id=${t.patient_id||""}&patient_name=${encodeURIComponent(t.patient_name||"")}&age=${t.age||""}&gender=${t.gender||""}`;e.index.navigateTo({url:i})},m=()=>{if(!e.index.getStorageSync("token")){e.index.showToast({title:"请先登录",icon:"none"});return}e.index.navigateTo({url:"/pages/Card/edit_card?add=1"})},f=t=>t===1?"启用":"禁用",y=t=>t===1?"status-confirmed":"status-pending",v={first_visit:"初诊",follow_up:"复诊",consultation:"会诊"},x={qi_deficiency:"气虚",blood_deficiency:"血虚",yin_deficiency:"阴虚",yang_deficiency:"阳虚",qi_stagnation:"气滞",blood_stasis:"血瘀",phlegm_dampness:"痰湿",damp_heat:"湿热",cold_dampness:"寒湿",wind_cold:"风寒",wind_heat:"风热"},h=t=>v[t]||t||"-",S=t=>x[t]||t||"-",w=t=>{if(!t)return"-";const i=new Date(t*1e3),n=i.getFullYear(),a=String(i.getMonth()+1).padStart(2,"0"),s=String(i.getDate()).padStart(2,"0");return`${n}-${a}-${s}`};return(t,i)=>e.e({a:e.f(d.value,(n,a,s)=>({a:e.t(n.id),b:e.t(n.status_desc||f(n.status)),c:e.n(y(n.status)),d:e.t(n.patient_name||"-"),e:e.t(n.gender_desc||"-"),f:e.t(n.age),g:e.t(h(n.diagnosis_type)),h:e.t(S(n.syndrome_type)),i:e.t(n.diagnosis_date_text||w(n.diagnosis_date)),j:e.t(n.create_time||"-"),k:e.o(_=>p(n),n.id),l:e.o(_=>c(n),n.id),m:n.id,n:e.o(_=>c(n),n.id)})),b:!o.value&&d.value.length===0},!o.value&&d.value.length===0?{c:e.p({type:"wallet",size:"80",color:"#1890ff"}),d:e.o(m,"df")}:{},{e:o.value},o.value?{}:{})}},T=e._export_sfc(u,[["__scopeId","data-v-f80331d8"]]);u.__runtimeHooks=2;wx.createPage(T);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Card/Card.js.map
|
||||
|
||||
Reference in New Issue
Block a user