fix(mp): 修复 72 个 TypeScript 类型错误 — noImplicitAny 全量通过
- 移除 28 个文件中不再需要的 import React (jsx: react-jsx) - 修复 catch(err: any) → catch(err: unknown) 类型收窄 - 修复 __wxConfig / CanvasRenderingContext2D 全局类型声明 - 修复 DTO 类型不匹配 (UpdateDialysisRecordReq, notificationService) - 移除 52 个未使用的 import/变量/常量 - 修复 services 类型 (auth.ts tenant_id, actionInbox boolean, device-sync)
This commit is contained in:
@@ -3,6 +3,10 @@ import { Canvas, View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import './index.scss';
|
||||
|
||||
/** Canvas 2D 上下文类型 — 微信小程序 Canvas 2d 接口 */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type CanvasRenderingContext2D = any;
|
||||
|
||||
interface TrendChartProps {
|
||||
data: { date: string; value: number }[];
|
||||
referenceMin?: number;
|
||||
@@ -181,7 +185,6 @@ export default React.memo(function TrendChart({
|
||||
if (!node) return;
|
||||
canvasRef.current = node;
|
||||
const sysInfo = Taro.getSystemInfoSync();
|
||||
const canvasW = (sysInfo.windowWidth * 750) / sysInfo.windowWidth;
|
||||
node.width = sysInfo.windowWidth * getDPR();
|
||||
node.height = ((height / 750) * sysInfo.windowWidth) * getDPR();
|
||||
draw();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import './index.scss';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, RichText } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, ScrollView } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback, useMemo } from 'react';
|
||||
import { useState, useCallback, useMemo } from 'react';
|
||||
import { View, Text, Input } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { listDoctors, createAppointment, calendarView } from '../../../services/appointment';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { getAppointment, cancelAppointment } from '../../../services/appointment';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
@@ -38,7 +38,7 @@ export default function AppointmentList() {
|
||||
const fetchData = useCallback(async (pageNum: number, isRefresh = false) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await listAppointments(pageNum);
|
||||
const res = await listAppointments(undefined, pageNum);
|
||||
const list = res.data || [];
|
||||
if (isRefresh) {
|
||||
setAppointments(list);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, RichText } from '@tarojs/components';
|
||||
import Taro, { useRouter, useShareAppMessage } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -34,8 +34,8 @@ interface ArticleCategory {
|
||||
export default function ArticleList() {
|
||||
const modeClass = useElderClass();
|
||||
const [articles, setArticles] = useState<ArticleItem[]>([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [, setPage] = useState(1);
|
||||
const [, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const [categories, setCategories] = useState<ArticleCategory[]>([]);
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function ConsultationCreate() {
|
||||
const typeLabels = CONSULTATION_TYPES.map((t) => TYPE_LABELS[t] || t);
|
||||
|
||||
return (
|
||||
<PageShell title='发起咨询' scroll={false}>
|
||||
<PageShell scroll={false}>
|
||||
<View className={`consult-create ${modeClass}`}>
|
||||
<View className='consult-create__section'>
|
||||
<Text className='consult-create__label'>咨询类型</Text>
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function Health() {
|
||||
const currentPatient = useAuthStore((s) => s.currentPatient);
|
||||
const modeClass = useElderClass();
|
||||
const {
|
||||
user, todaySummary, loading, error, activeTab, trendData, trendLoading,
|
||||
user, todaySummary: _todaySummary, loading: _loading, error, activeTab, trendData, trendLoading,
|
||||
aiSuggestions, thresholds, handleTabChange, loadTrend, refreshToday, fetchData,
|
||||
} = useHealthData();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState, useRef } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useHealthStore } from '@/stores/health';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
import { getTrend, getHealthThresholds, DEFAULT_THRESHOLDS, type HealthThreshold } from '@/services/health';
|
||||
import { getHealthThresholds, DEFAULT_THRESHOLDS, type HealthThreshold } from '@/services/health';
|
||||
import { listPendingSuggestions, type AiSuggestionItem } from '@/services/ai-analysis';
|
||||
|
||||
export type VitalType = 'blood_pressure' | 'heart_rate' | 'blood_sugar' | 'weight';
|
||||
|
||||
@@ -6,14 +6,14 @@ import { useAuthStore } from '../../stores/auth';
|
||||
import { useUIStore } from '../../stores/ui';
|
||||
import { navigateToLogin } from '../../utils/navigate';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
import { useThrottledDidShow } from '@/hooks/useThrottledDidShow';
|
||||
// useThrottledDidShow removed — unused import
|
||||
import { api } from '@/services/request';
|
||||
import type { Article } from '@/services/article';
|
||||
import ProgressRing from '@/components/ui/ProgressRing';
|
||||
import Loading from '../../components/Loading';
|
||||
import PageShell from '@/components/ui/PageShell';
|
||||
import ContentCard from '@/components/ui/ContentCard';
|
||||
import { useHomeData, type ReminderItem } from './useHomeData';
|
||||
import { useHomeData } from './useHomeData';
|
||||
import './index.scss';
|
||||
|
||||
interface PublicBanner {
|
||||
@@ -27,9 +27,9 @@ interface PublicBanner {
|
||||
}
|
||||
|
||||
const FALLBACK_SLIDES = [
|
||||
{ id: 'slide-1', title: '专业血透中心', desc: '三甲级医护团队全程守护', image_url: '' },
|
||||
{ id: 'slide-2', title: '智慧健康管理', desc: 'AI 驱动个性化健康方案', image_url: '' },
|
||||
{ id: 'slide-3', title: '温馨就医环境', desc: '舒适安全的治疗体验', image_url: '' },
|
||||
{ id: 'slide-1', title: '专业血透中心', subtitle: '', desc: '三甲级医护团队全程守护', image_url: '' },
|
||||
{ id: 'slide-2', title: '智慧健康管理', subtitle: '', desc: 'AI 驱动个性化健康方案', image_url: '' },
|
||||
{ id: 'slide-3', title: '温馨就医环境', subtitle: '', desc: '舒适安全的治疗体验', image_url: '' },
|
||||
];
|
||||
|
||||
// ─── 访客首页 ───
|
||||
|
||||
@@ -83,7 +83,7 @@ export function useHomeData() {
|
||||
]);
|
||||
|
||||
if (suggestRes.status === 'fulfilled') {
|
||||
for (const s of suggestRes.value.data.slice(0, 1)) {
|
||||
for (const s of suggestRes.value.slice(0, 1)) {
|
||||
items.push({ id: s.id, text: buildSuggestionText(s), type: 'ai', tag: 'AI 建议' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ import { safeNavigateTo } from '@/utils/navigate';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import './index.scss';
|
||||
|
||||
declare const __wxConfig: Record<string, unknown> | undefined;
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV !== 'production';
|
||||
const IS_SIMULATOR = typeof __wxConfig !== 'undefined' && (__wxConfig as any).envVersion === 'develop';
|
||||
const IS_SIMULATOR = typeof __wxConfig !== 'undefined' && (__wxConfig as Record<string, unknown>)?.envVersion === 'develop';
|
||||
|
||||
export default function Login() {
|
||||
const [username, setUsername] = useState('');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { useState, useRef } from 'react';
|
||||
import { View, Text, Input, ScrollView } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
getDialysisRecord, reviewDialysisRecord,
|
||||
updateDialysisRecord, deleteDialysisRecord,
|
||||
type DialysisRecord,
|
||||
type UpdateDialysisRecordReq,
|
||||
} from '@/services/doctor/dialysis';
|
||||
import Loading from '@/components/Loading';
|
||||
import PageShell from '@/components/ui/PageShell';
|
||||
@@ -59,7 +60,8 @@ export default function DialysisDetail() {
|
||||
if (!record) return;
|
||||
setSubmitting(true);
|
||||
try {
|
||||
const updated = await updateDialysisRecord(id, { status: 'completed' }, record.version);
|
||||
const req = { status: 'completed' } as UpdateDialysisRecordReq;
|
||||
const updated = await updateDialysisRecord(id, req, record.version);
|
||||
setRecord(updated);
|
||||
Taro.showToast({ title: '已标记完成', icon: 'success' });
|
||||
} catch (err) {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useState } from 'react';
|
||||
import { View, Text, Input, Textarea, Picker } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { createDialysisPrescription } from '@/services/doctor/dialysis';
|
||||
import Loading from '@/components/Loading';
|
||||
import PageShell from '@/components/ui/PageShell';
|
||||
import ContentCard from '@/components/ui/ContentCard';
|
||||
import { useDoctorClass } from '@/hooks/useDoctorClass';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback, useRef } from 'react';
|
||||
import { useState, useCallback, useRef } from 'react';
|
||||
import { View, Text, ScrollView } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
@@ -33,7 +33,7 @@ export default function PatientAlerts() {
|
||||
const currentPatient = useAuthStore((s) => s.currentPatient);
|
||||
const [alerts, setAlerts] = useState<Alert[]>([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
const [_page, setPage] = useState(1);
|
||||
const [status, setStatus] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
@@ -76,7 +76,7 @@ export default function PatientAlerts() {
|
||||
try {
|
||||
const tmplId = process.env.TARO_APP_WX_TEMPLATE_CRITICAL_ALERT || '';
|
||||
if (tmplId) {
|
||||
await Taro.requestSubscribeMessage({ tmplIds: [tmplId] });
|
||||
await (Taro.requestSubscribeMessage as (option: { tmplIds: string[] }) => Promise<unknown>)({ tmplIds: [tmplId] });
|
||||
}
|
||||
} catch {
|
||||
// 用户拒绝或已订阅,不阻塞页面
|
||||
|
||||
@@ -15,7 +15,7 @@ import ContentCard from '@/components/ui/ContentCard';
|
||||
import {
|
||||
BP_RANGE, WEIGHT_RANGE, SUGAR_RANGE, VOLUME_RANGE,
|
||||
checkAbnormal, formatDate, FIELD_LABELS,
|
||||
type SectionKey, type AbnormalResult,
|
||||
type SectionKey,
|
||||
} from './constants';
|
||||
import './index.scss';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, ScrollView } from '@tarojs/components';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import * as pointsApi from '@/services/points';
|
||||
import Loading from '@/components/Loading';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { View, Text, Input, Picker } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { createPatient, updatePatient, Patient } from '../../../services/patient';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, Textarea } from '@tarojs/components';
|
||||
import Taro, { useRouter } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text, Input, Picker } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useReachBottom } from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { safeNavigateTo } from '@/utils/navigate';
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface LoginResp {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
expires_in: number;
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; avatar_url?: string };
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; avatar_url?: string; tenant_id?: string };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,19 +19,12 @@ const RACP_CHARACTERISTIC = '00002A52-0000-1000-8000-00805F9B34FB';
|
||||
|
||||
// RACP 操作码
|
||||
const RACP_OPCODE_REPORT_STORED_RECORDS = 0x01;
|
||||
const RACP_OPCODE_DELETE_STORED_RECORDS = 0x02;
|
||||
const RACP_OPCODE_ABORT_OPERATION = 0x03;
|
||||
const RACP_OPCODE_REPORT_NUMBER_OF_RECORDS = 0x04;
|
||||
const RACP_OPCODE_NUMBER_OF_STORED_RECORDS_RESPONSE = 0x05;
|
||||
const RACP_OPCODE_RESPONSE_CODE = 0x06;
|
||||
|
||||
// RACP 操作符
|
||||
const RACP_OPERATOR_ALL = 0x01;
|
||||
const RACP_OPERATOR_LESS_THAN = 0x04;
|
||||
const RACP_OPERATOR_GREATER_THAN = 0x05;
|
||||
|
||||
// RACP 过滤器类型
|
||||
const RACP_FILTER_TYPE_TIME = 0x01;
|
||||
|
||||
/** 解析心率测量值(Heart Rate Measurement 格式) */
|
||||
function parseHeartRate(data: ArrayBuffer): number | null {
|
||||
@@ -118,14 +111,11 @@ export const XiaomiBandAdapter: DeviceAdapter = {
|
||||
const opcode = view.getUint8(0);
|
||||
|
||||
if (opcode === RACP_OPCODE_NUMBER_OF_STORED_RECORDS_RESPONSE) {
|
||||
const count = view.getUint16(2, true);
|
||||
// 不返回 reading,仅用于日志/调试
|
||||
return [];
|
||||
}
|
||||
|
||||
if (opcode === RACP_OPCODE_RESPONSE_CODE) {
|
||||
const reqOpcode = view.getUint8(1);
|
||||
const status = view.getUint8(2);
|
||||
// status: 0x01=成功, 0x02=不支持的操作码, 等
|
||||
// 不返回 reading,仅用于日志
|
||||
return [];
|
||||
@@ -162,7 +152,7 @@ export function buildRACPReportAll(): ArrayBuffer {
|
||||
export function buildRACPReportCount(): ArrayBuffer {
|
||||
const buffer = new ArrayBuffer(2);
|
||||
const view = new DataView(buffer);
|
||||
view.setUint8(0, RACP_OPCODE_REPORT_NUMBER_OF_STORED_RECORDS);
|
||||
view.setUint8(0, RACP_OPCODE_REPORT_NUMBER_OF_RECORDS);
|
||||
view.setUint8(1, RACP_OPERATOR_ALL);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ interface BatchReadingRequest {
|
||||
device_model?: string;
|
||||
readings: {
|
||||
device_type: string;
|
||||
values: Record<string, number>;
|
||||
values: Record<string, number | string>;
|
||||
measured_at: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
@@ -40,10 +40,13 @@ export async function listActionItems(params?: {
|
||||
assigned_to_me?: boolean;
|
||||
patient_id?: string;
|
||||
}) {
|
||||
return api.get<PaginatedData>(
|
||||
'/health/action-inbox',
|
||||
params as Record<string, string | number | boolean | undefined>,
|
||||
);
|
||||
const query: Record<string, string | number | undefined> = {};
|
||||
if (params) {
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
if (v !== undefined) query[k] = typeof v === 'boolean' ? String(v) : v;
|
||||
}
|
||||
}
|
||||
return api.get<PaginatedData>('/health/action-inbox', query);
|
||||
}
|
||||
|
||||
export async function getActionThread(sourceRef: string) {
|
||||
@@ -55,7 +58,7 @@ export async function getActionThread(sourceRef: string) {
|
||||
export async function getWorkbenchStats(assignedToMe?: boolean) {
|
||||
return api.get<WorkbenchStats>(
|
||||
'/health/action-inbox/stats',
|
||||
assignedToMe !== undefined ? { assigned_to_me: assignedToMe } : undefined,
|
||||
assignedToMe !== undefined ? { assigned_to_me: String(assignedToMe) } as Record<string, string | number | undefined> : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ export interface CreateDialysisRecordReq {
|
||||
complication_notes?: string;
|
||||
}
|
||||
|
||||
export type UpdateDialysisRecordReq = Omit<CreateDialysisRecordReq, 'patient_id'>;
|
||||
export type UpdateDialysisRecordReq = Omit<CreateDialysisRecordReq, 'patient_id'> & {
|
||||
status?: string;
|
||||
};
|
||||
|
||||
export interface CreateDialysisPrescriptionReq {
|
||||
patient_id: string;
|
||||
@@ -52,7 +54,9 @@ export interface CreateDialysisPrescriptionReq {
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export type UpdateDialysisPrescriptionReq = Omit<CreateDialysisPrescriptionReq, 'patient_id'>;
|
||||
export type UpdateDialysisPrescriptionReq = Omit<CreateDialysisPrescriptionReq, 'patient_id'> & {
|
||||
status?: string;
|
||||
};
|
||||
|
||||
export interface DialysisStatistics {
|
||||
total_records: number;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { api } from './request';
|
||||
|
||||
export const notificationService = {
|
||||
list: (params?: { page?: number; page_size?: number }) =>
|
||||
api.get('/messages', params as Record<string, string | number | undefined>),
|
||||
list: <T = unknown>(params?: { page?: number; page_size?: number }) =>
|
||||
api.get<T>('/messages', params as Record<string, string | number | undefined>),
|
||||
markRead: (id: string) =>
|
||||
api.put(`/messages/${id}/read`),
|
||||
markAllRead: () =>
|
||||
|
||||
@@ -18,13 +18,6 @@ let cachedRolesObj: string[] = [];
|
||||
let cachedPatientJson = '';
|
||||
let cachedPatientObj: authApi.PatientInfo | null = null;
|
||||
|
||||
interface BindPhoneResp {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
expires_in?: number;
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; tenant_id?: string };
|
||||
}
|
||||
|
||||
interface AuthState {
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; tenant_id?: string } | null;
|
||||
roles: string[];
|
||||
@@ -221,7 +214,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
clearLoggingOut();
|
||||
get().loadPatients();
|
||||
return true;
|
||||
} catch (err: any) {
|
||||
} catch (err: unknown) {
|
||||
secureRemove('wechat_openid');
|
||||
set({ loading: false });
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user