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 @@
{{ userInfo?.userName?.charAt(0) || '护' }}
-
{{ userInfo?.userName || '护士' }}
{{ userInfo?.deptName || '护理部' }}
+
{{ userInfo?.nickName || userInfo?.userName || '护士' }}
{{ userInfo?.orgName || '' }}
@@ -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 @@