diff --git a/pages.json b/pages.json index 34a8be8..6096297 100644 --- a/pages.json +++ b/pages.json @@ -21,7 +21,7 @@ { "path": "pages/home/case-home", "style": { - "navigationBarTitleText": "病例" + "navigationBarTitleText": "病历" } }, { @@ -190,12 +190,6 @@ "navigationBarTitleText": "共享客户" } }, - { - "path": "patient-invite", - "style": { - "navigationBarTitleText": "邀请患者" - } - }, { "path": "patient-create", "style": { @@ -311,7 +305,7 @@ "pagePath": "pages/home/case-home", "iconPath": "static/tabbar/cart.png", "selectedIconPath": "static/tabbar/cart_selected.png", - "text": "病例" + "text": "病历" }, { "pagePath": "pages/home/work-home", diff --git a/pages/case/case.vue b/pages/case/case.vue deleted file mode 100644 index 8613350..0000000 --- a/pages/case/case.vue +++ /dev/null @@ -1,1115 +0,0 @@ - - - - - diff --git a/pages/case/group-manage.vue b/pages/case/group-manage.vue index cdc290e..5af53c5 100644 --- a/pages/case/group-manage.vue +++ b/pages/case/group-manage.vue @@ -1,35 +1,67 @@  diff --git a/pages/home/case-home.vue b/pages/home/case-home.vue index 49472f3..3941d0a 100644 --- a/pages/home/case-home.vue +++ b/pages/home/case-home.vue @@ -75,7 +75,7 @@ {{ patient.gender }}/{{ patient.age }}岁 - + {{ tag }} @@ -163,6 +163,16 @@ const tabs = computed(() => { const isBatchMode = ref(false); const selectedItems = ref([]); // Stores patient phone or unique ID +const groupNameMap = computed(() => { + const map = new Map(); + (Array.isArray(teamGroups.value) ? teamGroups.value : []).forEach((g) => { + const id = g && g._id ? String(g._id) : ''; + const name = g && g.groupName ? String(g.groupName) : ''; + if (id && name) map.set(id, name); + }); + return map; +}); + // Team Members Map const userNameMap = ref({}); @@ -329,6 +339,20 @@ function getSelectId(patient) { return patient?._id || patient?.id || patient?.phone || patient?.mobile || ''; } +function getPatientGroupIds(patient) { + const raw = patient?.groupIds ?? patient?.groupIdList ?? patient?.groupId ?? patient?.groups; + if (Array.isArray(raw)) return raw.map(String).filter(Boolean); + if (typeof raw === 'string' || typeof raw === 'number') return [String(raw)].filter(Boolean); + return []; +} + +function resolveGroupTags(patient) { + const ids = getPatientGroupIds(patient); + if (!ids.length) return []; + const map = groupNameMap.value; + return ids.map((id) => map.get(String(id))).filter(Boolean); +} + function parseCreateTime(value) { if (!value) return null; if (typeof value === 'number') return dayjs(value); @@ -354,6 +378,7 @@ function formatPatient(raw) { const createTime = parseCreateTime(raw?.createTime); const createTimeStr = createTime ? createTime.format('YYYY-MM-DD HH:mm') : ''; + const createTimeTs = createTime ? createTime.valueOf() : 0; // 优先使用后端返回的 tagNames(标签名称数组) const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string' && i.trim()); @@ -392,6 +417,7 @@ function formatPatient(raw) { mobiles, mobile, createTime: createTimeStr, + createTimeTs, creator: raw?.creatorName || raw?.creator || '', hospitalId: raw?.customerNumber || raw?.hospitalId || '', record, @@ -548,16 +574,11 @@ const patientList = computed(() => { // New Patient Filter (Last 7 days) if (currentTab.value.kind === 'new') { - const now = dayjs(); - const sevenDaysAgo = now.subtract(7, 'day').valueOf(); + const sevenDaysAgo = dayjs().subtract(7, 'day').startOf('day').valueOf(); const flatList = all - .map((p) => { - const t = parseCreateTime(p.createTime)?.valueOf(); - return t ? { ...p, _ts: t } : null; - }) - .filter(Boolean) - .filter((p) => p._ts >= sevenDaysAgo) - .sort((a, b) => b._ts - a._ts); + .filter((p) => Number(p?.createTimeTs || 0) >= sevenDaysAgo) + .slice() + .sort((a, b) => Number(b?.createTimeTs || 0) - Number(a?.createTimeTs || 0)); return [{ letter: '最近新增', data: flatList }]; } @@ -717,11 +738,11 @@ const openVerifyEntry = () => { }; const openAddCustomerServiceEntry = () => { - uni.showToast({ title: '添加客服功能待接入', icon: 'none' }); + uni.navigateTo({ url: '/pages/work/service/contact-service' }); }; const openInvitePatientEntry = () => { - uni.navigateTo({ url: '/pages/case/patient-invite' }); + uni.navigateTo({ url: '/pages/work/team/invite/invite-patient' }); }; const openCreatePatientEntry = () => { diff --git a/pages/message/article-list.vue b/pages/message/article-list.vue index 4c68713..e04e432 100644 --- a/pages/message/article-list.vue +++ b/pages/message/article-list.vue @@ -60,9 +60,9 @@ class="send-btn" size="mini" type="primary" - @click.stop="sendArticle(article)" + @click.stop="handlePrimaryAction(article)" > - 发送 + {{ isSelectMode ? '选择' : '发送' }} @@ -125,6 +125,9 @@ const pageParams = ref({ corpId: "", }); +const isSelectMode = ref(false); +const selectEventName = ref(""); + // 搜索关键词 const searchTitle = ref(""); let searchTimer = null; @@ -312,6 +315,20 @@ const closePreview = () => { previewPopup.value?.close(); }; +const selectArticle = (article) => { + if (!selectEventName.value) { + uni.showToast({ title: "缺少 eventName", icon: "none" }); + return; + } + uni.$emit(selectEventName.value, article); + uni.navigateBack(); +}; + +const handlePrimaryAction = (article) => { + if (isSelectMode.value) return selectArticle(article); + return sendArticle(article); +}; + // 发送文章 const sendArticle = async (article) => { try { @@ -355,6 +372,8 @@ const goBack = () => { // 页面加载时接收参数 onLoad((options) => { + isSelectMode.value = String(options?.select || '') === '1'; + selectEventName.value = String(options?.eventName || ''); if (options.groupId) { pageParams.value.groupId = options.groupId; } diff --git a/pages/message/survey-list.vue b/pages/message/survey-list.vue index 03b6ce3..a95be47 100644 --- a/pages/message/survey-list.vue +++ b/pages/message/survey-list.vue @@ -63,9 +63,9 @@ class="send-btn" size="mini" type="primary" - @click="sendSurvey(survey)" + @click="handlePrimaryAction(survey)" > - 发送 + {{ isSelectMode ? '选择' : '发送' }} @@ -119,14 +119,33 @@ const pageSize = 30; const total = ref(0); const emptyText = ref(""); +const isSelectMode = ref(false); +const selectEventName = ref(""); + // 页面加载时接收参数 onLoad((options) => { + isSelectMode.value = String(options?.select || '') === '1'; + selectEventName.value = String(options?.eventName || ''); customerId.value = options?.patientId || ""; customerName.value = options?.customerName || ""; getCategoryList(); loadSurveyList(); }); +const selectSurvey = (survey) => { + if (!selectEventName.value) { + uni.showToast({ title: "缺少 eventName", icon: "none" }); + return; + } + uni.$emit(selectEventName.value, survey); + uni.navigateBack(); +}; + +const handlePrimaryAction = (survey) => { + if (isSelectMode.value) return selectSurvey(survey); + return sendSurvey(survey); +}; + // 获取分类列表 const getCategoryList = async () => { try { diff --git a/routes/index.js b/routes/index.js index 99d70db..9068a4f 100644 --- a/routes/index.js +++ b/routes/index.js @@ -47,7 +47,7 @@ export default [ }, { path: 'pages/home/case-home', - meta: { title: '病例', login: false }, + meta: { title: '病历', login: false }, }, { path: 'pages/case/search', @@ -65,10 +65,6 @@ export default [ path: 'pages/case/batch-share', meta: { title: '共享客户', login: false }, }, - { - path: 'pages/case/patient-invite', - meta: { title: '邀请患者', login: false }, - }, { path: 'pages/case/patient-create', meta: { title: '新增患者', login: false },