From 7d9da53cc46f50904f45c935b928512b624c0bcd Mon Sep 17 00:00:00 2001 From: chenqi Date: Fri, 19 Jun 2026 22:37:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20=E4=BF=AE=E5=A4=8D=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AFAPI=E5=AF=B9=E6=8E=A5=20-=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=8E=B0=E6=9C=89=E6=8A=A4=E5=A3=AB=E7=AB=99=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3+=E7=99=BB=E5=BD=95=E8=8E=B7=E5=8F=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- healthlink-his-mobile/src/api/index.js | 24 ++++++++------- healthlink-his-mobile/src/views/Home.vue | 20 +++++++------ healthlink-his-mobile/src/views/Login.vue | 31 +++++++++++++++++--- healthlink-his-mobile/src/views/TaskList.vue | 28 ++++++++++-------- 4 files changed, 66 insertions(+), 37 deletions(-) diff --git a/healthlink-his-mobile/src/api/index.js b/healthlink-his-mobile/src/api/index.js index 0e65ca99d..769ede312 100644 --- a/healthlink-his-mobile/src/api/index.js +++ b/healthlink-his-mobile/src/api/index.js @@ -19,6 +19,7 @@ service.interceptors.response.use( const res = response.data if (res.code === 401) { localStorage.removeItem('Admin-Token') + localStorage.removeItem('userInfo') window.location.href = '/login' return Promise.reject(new Error('登录已过期')) } @@ -27,28 +28,29 @@ service.interceptors.response.use( error => { if (error.response?.status === 401) { localStorage.removeItem('Admin-Token') + localStorage.removeItem('userInfo') window.location.href = '/login' } - ElMessage.error(error.response?.data?.msg || '请求失败') return Promise.reject(error) } ) export const authApi = { login: (data) => service.post('/login', data, { headers: { isToken: false } }), - getTenants: (username) => service.get('/system/tenant/user-bind/' + username, { headers: { isToken: false } }) + getTenants: (username) => service.get('/system/tenant/user-bind/' + username, { headers: { isToken: false } }), + getInfo: () => service.get('/getInfo') } export const nursingApi = { - getTasks: (params) => service.get('/mp/nursing/tasks', { params }), - completeTask: (id, data) => service.post(`/mp/nursing/tasks/${id}/complete`, data), - getPatientInfo: (id) => service.get(`/mp/nursing/patient/${id}`), - getPatientList: (params) => service.get('/mp/nursing/patient/list', { params }), - getOrders: (patientId) => service.get(`/mp/nursing/orders/${patientId}`), - getVitalSigns: (patientId) => service.get(`/mp/nursing/vital-signs/${patientId}`), - submitVitalSign: (data) => service.post('/mp/nursing/vital-sign', data), - getAssessments: (patientId) => service.get(`/mp/nursing/assessments/${patientId}`), - submitAssessment: (data) => service.post('/mp/nursing/assessment', data) + getTasks: (params) => service.get('/nurse-station/advice-process/page', { params }), + completeTask: (id, data) => service.post(`/nurse-station/advice-process/execute`, data), + getPatientInfo: (id) => service.get('/inpatientmanage/inhospitalregister/' + id), + getPatientList: (params) => service.get('/inpatientmanage/inhospitalregister/list', { params }), + getOrders: (encounterId) => service.get('/nurse-station/advice-process/page', { params: { encounterId } }), + getVitalSigns: (patientId) => service.get('/nursing/vital-signs/' + patientId), + submitVitalSign: (data) => service.post('/nursing/vital-sign', data), + getAssessments: (encounterId) => service.get('/nursing/assessment/encounter/' + encounterId), + submitAssessment: (data) => service.post('/nursing/assessment', data) } export default service diff --git a/healthlink-his-mobile/src/views/Home.vue b/healthlink-his-mobile/src/views/Home.vue index 78bf16d8f..c27755a03 100644 --- a/healthlink-his-mobile/src/views/Home.vue +++ b/healthlink-his-mobile/src/views/Home.vue @@ -3,7 +3,7 @@
@@ -24,8 +24,8 @@
待办任务查看全部
-
-
{{ task.patientName }} - {{ task.taskContent }}
{{ task.dueTime }}
+
+
{{ task.adviceName || task.taskContent || '医嘱任务' }}
{{ task.createTime || '' }}
暂无待办任务
@@ -37,7 +37,7 @@ import { ref, onMounted } from 'vue' import { nursingApi } from '../api' const userInfo = ref({}) -const stats = ref([{ label: '待执行医嘱', value: 0 }, { label: '待测体征', value: 0 }, { label: '待评估', value: 0 }, { label: '高风险患者', value: 0 }]) +const stats = ref([{ label: '待执行医嘱', value: 0 }, { label: '今日体征', value: 0 }, { label: '待评估', value: 0 }, { label: '高风险', value: 0 }]) const recentTasks = ref([]) const actions = [ { icon: '📋', label: '任务列表', path: '/mobile/tasks', color: '#1890ff' }, @@ -51,10 +51,13 @@ const actions = [ onMounted(async () => { try { const info = localStorage.getItem('userInfo'); if (info) userInfo.value = JSON.parse(info) } catch {} try { - const res = await nursingApi.getTasks({ status: 'PENDING' }) - if (res.code === 200) { - recentTasks.value = (res.data?.tasks || []).slice(0, 5) - stats.value[0].value = res.data?.summary?.pending || 0 + const nurseId = userInfo.value.practitionerId || userInfo.value.userId + if (nurseId) { + const res = await nursingApi.getTasks({ nurseId: nurseId }) + if (res.code === 200) { + recentTasks.value = (res.data?.records || res.data?.rows || res.data || []).slice(0, 5) + stats.value[0].value = res.data?.total || recentTasks.value.length + } } } catch {} }) @@ -82,7 +85,6 @@ onMounted(async () => { .more { color: #1890ff; font-size: 13px; } .task-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f5f5f5; } .task-dot { width: 8px; height: 8px; border-radius: 50%; background: #fa8c16; } -.task-dot.COMPLETED { background: #52c41a; } .task-name { font-size: 14px; } .task-time { font-size: 12px; color: #999; } .empty { text-align: center; padding: 20px; color: #999; } diff --git a/healthlink-his-mobile/src/views/Login.vue b/healthlink-his-mobile/src/views/Login.vue index 227e58bfc..88eb71966 100644 --- a/healthlink-his-mobile/src/views/Login.vue +++ b/healthlink-his-mobile/src/views/Login.vue @@ -61,10 +61,33 @@ const handleLogin = async () => { if (!form.value.password) { errorMsg.value = '请输入密码'; return } loading.value = true; errorMsg.value = '' try { - const res = await authApi.login({ username: form.value.username, password: form.value.password, tenantId: form.value.tenantId, code: '', uuid: '' }) - if (res.code === 200 && res.token) { localStorage.setItem('Admin-Token', res.token); ElMessage.success('登录成功'); router.push('/mobile/home') } - else { errorMsg.value = res.msg || '登录失败' } - } catch (e) { errorMsg.value = e.response?.data?.msg || '登录失败' } finally { loading.value = false } + const loginRes = await authApi.login({ username: form.value.username, password: form.value.password, tenantId: form.value.tenantId, code: '', uuid: '' }) + if (loginRes.code === 200 && loginRes.token) { + localStorage.setItem('Admin-Token', loginRes.token) + const infoRes = await authApi.getInfo() + if (infoRes.code === 200) { + const user = infoRes.user || {} + localStorage.setItem('userInfo', JSON.stringify({ + userId: user.userId, + userName: user.userName, + nickName: user.nickName, + practitionerId: user.practitionerId, + orgId: user.orgId, + orgName: user.orgName, + roles: user.roles, + permissions: user.permissions + })) + } + ElMessage.success('登录成功') + router.push('/mobile/home') + } else { + errorMsg.value = loginRes.msg || '登录失败' + } + } catch (e) { + errorMsg.value = e.response?.data?.msg || '登录失败,请检查网络' + } finally { + loading.value = false + } } diff --git a/healthlink-his-mobile/src/views/TaskList.vue b/healthlink-his-mobile/src/views/TaskList.vue index 439320d7e..4ca1fa8a0 100644 --- a/healthlink-his-mobile/src/views/TaskList.vue +++ b/healthlink-his-mobile/src/views/TaskList.vue @@ -1,17 +1,16 @@