|
|
@@ -199,10 +199,10 @@
|
|
|
│ └── 四种艾灸模式接口
|
|
|
│
|
|
|
└── 4. 专家端(小程序/公众号)
|
|
|
- ├── 专家登录
|
|
|
- ├── 方案创建(使用系统模板)
|
|
|
- ├── 工艺语言生成
|
|
|
- └── 方案发布(指定用户/公开)
|
|
|
+├── 专家登录
|
|
|
+├── 方案创建(使用系统模板)
|
|
|
+├── 工艺语言生成
|
|
|
+└── 方案发布(指定用户/公开)
|
|
|
|
|
|
### 3.5 专家方案模板设计
|
|
|
|
|
|
@@ -251,19 +251,19 @@
|
|
|
|
|
|
```typescript
|
|
|
interface TemplateValidation {
|
|
|
- // 基本信息验证
|
|
|
- name: { required: true; maxLength: 50 };
|
|
|
- efficacyType: { required: true; options: ['驱寒','祛湿','祛风','化瘀','活血','化痰','养颜','扶阳'] };
|
|
|
- symptoms: { required: true; minSelect: 1 };
|
|
|
- targetGender: { required: true; options: ['all','male','female'] };
|
|
|
- ageRange: { required: true; min: 1; max: 120 };
|
|
|
-
|
|
|
- // 步骤验证
|
|
|
- minSteps: 1;
|
|
|
- maxSteps: 10;
|
|
|
- temperature: { min: 35; max: 50; unit: '°C' };
|
|
|
- duration: { min: 1; max: 30; unit: '分钟' };
|
|
|
- totalDurationLimit: 60; // 总时长限制(分钟)
|
|
|
+ // 基本信息验证
|
|
|
+ name: { required: true; maxLength: 50 };
|
|
|
+ efficacyType: { required: true; options: ['驱寒','祛湿','祛风','化瘀','活血','化痰','养颜','扶阳'] };
|
|
|
+ symptoms: { required: true; minSelect: 1 };
|
|
|
+ targetGender: { required: true; options: ['all','male','female'] };
|
|
|
+ ageRange: { required: true; min: 1; max: 120 };
|
|
|
+
|
|
|
+ // 步骤验证
|
|
|
+ minSteps: 1;
|
|
|
+ maxSteps: 10;
|
|
|
+ temperature: { min: 35; max: 50; unit: '°C' };
|
|
|
+ duration: { min: 1; max: 30; unit: '分钟' };
|
|
|
+ totalDurationLimit: 60; // 总时长限制(分钟)
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -309,36 +309,36 @@ interface TemplateValidation {
|
|
|
```typescript
|
|
|
// 延年圣手模式 - 用户级存储
|
|
|
interface ExpertModeStorage {
|
|
|
- userId: string;
|
|
|
- schemes: ExpertScheme[]; // 用户接收的专家方案列表(可超过8个)
|
|
|
- syncedSchemes: SyncedScheme[]; // 同步到设备的最新8个方案
|
|
|
- updatedAt: Date;
|
|
|
+ userId: string;
|
|
|
+ schemes: ExpertScheme[]; // 用户接收的专家方案列表(可超过8个)
|
|
|
+ syncedSchemes: SyncedScheme[]; // 同步到设备的最新8个方案
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 同步到设备的方案(最新8个)
|
|
|
interface SyncedScheme {
|
|
|
- slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; // 快捷键槽位(1-8)
|
|
|
- schemeId: string;
|
|
|
- schemeName: string;
|
|
|
- processId: string; // 对应工艺语言ID
|
|
|
- syncedAt: Date;
|
|
|
+ slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; // 快捷键槽位(1-8)
|
|
|
+ schemeId: string;
|
|
|
+ schemeName: string;
|
|
|
+ processId: string; // 对应工艺语言ID
|
|
|
+ syncedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 设备快捷键映射
|
|
|
interface DeviceHotkeyMap {
|
|
|
- userId: string;
|
|
|
- deviceId: string;
|
|
|
- hotkeys: {
|
|
|
- '1': { schemeId: string; schemeName: string }; // 快捷键1
|
|
|
- '2': { schemeId: string; schemeName: string }; // 快捷键2
|
|
|
- '3': { schemeId: string; schemeName: string }; // 快捷键3
|
|
|
- '4': { schemeId: string; schemeName: string }; // 快捷键4
|
|
|
- '5': { schemeId: string; schemeName: string }; // 快捷键5
|
|
|
- '6': { schemeId: string; schemeName: string }; // 快捷键6
|
|
|
- '7': { schemeId: string; schemeName: string }; // 快捷键7
|
|
|
- '8': { schemeId: string; schemeName: string }; // 快捷键8
|
|
|
- };
|
|
|
- updatedAt: Date;
|
|
|
+ userId: string;
|
|
|
+ deviceId: string;
|
|
|
+ hotkeys: {
|
|
|
+ '1': { schemeId: string; schemeName: string }; // 快捷键1
|
|
|
+ '2': { schemeId: string; schemeName: string }; // 快捷键2
|
|
|
+ '3': { schemeId: string; schemeName: string }; // 快捷键3
|
|
|
+ '4': { schemeId: string; schemeName: string }; // 快捷键4
|
|
|
+ '5': { schemeId: string; schemeName: string }; // 快捷键5
|
|
|
+ '6': { schemeId: string; schemeName: string }; // 快捷键6
|
|
|
+ '7': { schemeId: string; schemeName: string }; // 快捷键7
|
|
|
+ '8': { schemeId: string; schemeName: string }; // 快捷键8
|
|
|
+ };
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -455,26 +455,26 @@ interface DeviceHotkeyMap {
|
|
|
```typescript
|
|
|
// 专家端方案推送格式
|
|
|
interface ExpertSchemePush {
|
|
|
- expertId: string; // 专家ID(由专家端系统分配)
|
|
|
- expertName: string; // 专家名称
|
|
|
- schemeName: string; // 方案名称
|
|
|
- efficacyType: string; // 功效类型
|
|
|
- symptoms: string[]; // 适用症状
|
|
|
- targetGender: 'male' | 'female' | 'all';
|
|
|
- ageRange: { min: number; max: number };
|
|
|
- steps: ExpertStep[]; // 治疗步骤
|
|
|
- publishType: 'public' | 'private';
|
|
|
- targetUserIds?: string[]; // 指定用户(私有发布时)
|
|
|
+ expertId: string; // 专家ID(由专家端系统分配)
|
|
|
+ expertName: string; // 专家名称
|
|
|
+ schemeName: string; // 方案名称
|
|
|
+ efficacyType: string; // 功效类型
|
|
|
+ symptoms: string[]; // 适用症状
|
|
|
+ targetGender: 'male' | 'female' | 'all';
|
|
|
+ ageRange: { min: number; max: number };
|
|
|
+ steps: ExpertStep[]; // 治疗步骤
|
|
|
+ publishType: 'public' | 'private';
|
|
|
+ targetUserIds?: string[]; // 指定用户(私有发布时)
|
|
|
}
|
|
|
|
|
|
// 专家端治疗步骤
|
|
|
interface ExpertStep {
|
|
|
- stepOrder: number;
|
|
|
- acupointName: string; // 穴位名称
|
|
|
- temperature: number; // 温度
|
|
|
- duration: number; // 时间(分钟)
|
|
|
- techniqueName: string; // 手法名称
|
|
|
- side: 'single' | 'both' | 'left' | 'right';
|
|
|
+ stepOrder: number;
|
|
|
+ acupointName: string; // 穴位名称
|
|
|
+ temperature: number; // 温度
|
|
|
+ duration: number; // 时间(分钟)
|
|
|
+ techniqueName: string; // 手法名称
|
|
|
+ side: 'single' | 'both' | 'left' | 'right';
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -551,46 +551,46 @@ interface ExpertStep {
|
|
|
|
|
|
```typescript
|
|
|
function estimateFingerWidth(
|
|
|
- shoulderWidth: number,
|
|
|
- bodyLength: number,
|
|
|
- gender: 'male' | 'female'
|
|
|
+ shoulderWidth: number,
|
|
|
+ bodyLength: number,
|
|
|
+ gender: 'male' | 'female'
|
|
|
): FingerWidth {
|
|
|
- const STANDARD = {
|
|
|
- male: {
|
|
|
- shoulderWidth: 42, // 男性平均肩宽(厘米)
|
|
|
- bodyLength: 85, // 男性平均坐高(厘米)
|
|
|
- cun1: 2.2, // 男性一寸约2.2cm
|
|
|
- cun1_5: 3.3, // 男性1.5寸约3.3cm
|
|
|
- cun3: 6.5, // 男性三寸约6.5cm
|
|
|
- shoulderWeight: 0.6, // 肩宽权重
|
|
|
- lengthWeight: 0.4 // 身长权重
|
|
|
- },
|
|
|
- female: {
|
|
|
- shoulderWidth: 36, // 女性平均肩宽(厘米)
|
|
|
- bodyLength: 78, // 女性平均坐高(厘米)
|
|
|
- cun1: 1.9, // 女性一寸约1.9cm
|
|
|
- cun1_5: 2.8, // 女性1.5寸约2.8cm
|
|
|
- cun3: 5.6, // 女性三寸约5.6cm
|
|
|
- shoulderWeight: 0.4, // 肩宽权重
|
|
|
- lengthWeight: 0.6 // 身长权重
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const ref = STANDARD[gender];
|
|
|
- const widthScale = shoulderWidth / ref.shoulderWidth;
|
|
|
- const lengthScale = bodyLength / ref.bodyLength;
|
|
|
-
|
|
|
- const weightedScale =
|
|
|
- widthScale * ref.shoulderWeight +
|
|
|
- lengthScale * ref.lengthWeight;
|
|
|
-
|
|
|
- const estimatedCun1 = ref.cun1 * weightedScale;
|
|
|
-
|
|
|
- return {
|
|
|
- cun1: estimatedCun1,
|
|
|
- cun1_5: estimatedCun1 * 1.5,
|
|
|
- cun3: estimatedCun1 * 3
|
|
|
- };
|
|
|
+ const STANDARD = {
|
|
|
+ male: {
|
|
|
+ shoulderWidth: 42, // 男性平均肩宽(厘米)
|
|
|
+ bodyLength: 85, // 男性平均坐高(厘米)
|
|
|
+ cun1: 2.2, // 男性一寸约2.2cm
|
|
|
+ cun1_5: 3.3, // 男性1.5寸约3.3cm
|
|
|
+ cun3: 6.5, // 男性三寸约6.5cm
|
|
|
+ shoulderWeight: 0.6, // 肩宽权重
|
|
|
+ lengthWeight: 0.4 // 身长权重
|
|
|
+ },
|
|
|
+ female: {
|
|
|
+ shoulderWidth: 36, // 女性平均肩宽(厘米)
|
|
|
+ bodyLength: 78, // 女性平均坐高(厘米)
|
|
|
+ cun1: 1.9, // 女性一寸约1.9cm
|
|
|
+ cun1_5: 2.8, // 女性1.5寸约2.8cm
|
|
|
+ cun3: 5.6, // 女性三寸约5.6cm
|
|
|
+ shoulderWeight: 0.4, // 肩宽权重
|
|
|
+ lengthWeight: 0.6 // 身长权重
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const ref = STANDARD[gender];
|
|
|
+ const widthScale = shoulderWidth / ref.shoulderWidth;
|
|
|
+ const lengthScale = bodyLength / ref.bodyLength;
|
|
|
+
|
|
|
+ const weightedScale =
|
|
|
+ widthScale * ref.shoulderWeight +
|
|
|
+ lengthScale * ref.lengthWeight;
|
|
|
+
|
|
|
+ const estimatedCun1 = ref.cun1 * weightedScale;
|
|
|
+
|
|
|
+ return {
|
|
|
+ cun1: estimatedCun1,
|
|
|
+ cun1_5: estimatedCun1 * 1.5,
|
|
|
+ cun3: estimatedCun1 * 3
|
|
|
+ };
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -598,45 +598,45 @@ function estimateFingerWidth(
|
|
|
|
|
|
```typescript
|
|
|
function generateAcupointReferenceTable(
|
|
|
- bodyData: UserBodyData,
|
|
|
- gender: 'male' | 'female'
|
|
|
+ bodyData: UserBodyData,
|
|
|
+ gender: 'male' | 'female'
|
|
|
): AcupointReferenceTable {
|
|
|
- const { shoulderWidth, bodyLength, fingerWidth } = bodyData;
|
|
|
-
|
|
|
- // 获取或估算指寸
|
|
|
- const cun: FingerWidth = fingerWidth
|
|
|
- ? fingerWidth
|
|
|
- : estimateFingerWidth(shoulderWidth, bodyLength, gender);
|
|
|
-
|
|
|
- // 计算各穴位位置
|
|
|
- const acupoints: CalculatedAcupoint[] = ACUPOINT_OFFSETS.map(ap => {
|
|
|
- // Y方向偏移:指寸数 × 对应指寸值
|
|
|
- const distanceY = ap.cun * cun[ap.cunType];
|
|
|
-
|
|
|
- // X方向偏移:横向指寸 × 一寸值
|
|
|
- const distanceX = ap.side === 'center'
|
|
|
- ? 0
|
|
|
- : (ap.side === 'left' ? -1 : 1) * (ap.lateralOffset || 0) * cun.cun1;
|
|
|
+ const { shoulderWidth, bodyLength, fingerWidth } = bodyData;
|
|
|
+
|
|
|
+ // 获取或估算指寸
|
|
|
+ const cun: FingerWidth = fingerWidth
|
|
|
+ ? fingerWidth
|
|
|
+ : estimateFingerWidth(shoulderWidth, bodyLength, gender);
|
|
|
+
|
|
|
+ // 计算各穴位位置
|
|
|
+ const acupoints: CalculatedAcupoint[] = ACUPOINT_OFFSETS.map(ap => {
|
|
|
+ // Y方向偏移:指寸数 × 对应指寸值
|
|
|
+ const distanceY = ap.cun * cun[ap.cunType];
|
|
|
+
|
|
|
+ // X方向偏移:横向指寸 × 一寸值
|
|
|
+ const distanceX = ap.side === 'center'
|
|
|
+ ? 0
|
|
|
+ : (ap.side === 'left' ? -1 : 1) * (ap.lateralOffset || 0) * cun.cun1;
|
|
|
+
|
|
|
+ return {
|
|
|
+ id: ap.id + (ap.side !== 'center' ? '_' + ap.side : ''),
|
|
|
+ name: ap.name,
|
|
|
+ side: ap.side,
|
|
|
+ offsetFromDazhui: {
|
|
|
+ x: distanceX,
|
|
|
+ y: -distanceY // 负值表示向下
|
|
|
+ },
|
|
|
+ offsetInCun: ap.cun,
|
|
|
+ cunType: ap.cunType
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
return {
|
|
|
- id: ap.id + (ap.side !== 'center' ? '_' + ap.side : ''),
|
|
|
- name: ap.name,
|
|
|
- side: ap.side,
|
|
|
- offsetFromDazhui: {
|
|
|
- x: distanceX,
|
|
|
- y: -distanceY // 负值表示向下
|
|
|
- },
|
|
|
- offsetInCun: ap.cun,
|
|
|
- cunType: ap.cunType
|
|
|
+ bodyData,
|
|
|
+ fingerWidthUsed: cun,
|
|
|
+ acupoints,
|
|
|
+ createdAt: new Date()
|
|
|
};
|
|
|
- });
|
|
|
-
|
|
|
- return {
|
|
|
- bodyData,
|
|
|
- fingerWidthUsed: cun,
|
|
|
- acupoints,
|
|
|
- createdAt: new Date()
|
|
|
- };
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -689,66 +689,66 @@ function generateAcupointReferenceTable(
|
|
|
*/
|
|
|
|
|
|
interface DeviceCoordinate {
|
|
|
- x: number; // 横向偏移(mm)
|
|
|
- y: number; // 纵向偏移(mm)
|
|
|
- z: number; // 深度偏移(mm)
|
|
|
+ x: number; // 横向偏移(mm)
|
|
|
+ y: number; // 纵向偏移(mm)
|
|
|
+ z: number; // 深度偏移(mm)
|
|
|
}
|
|
|
|
|
|
interface AcupointOffset {
|
|
|
- x: number; // 相对大椎穴横向偏移(cm)
|
|
|
- y: number; // 相对大椎穴纵向偏移(cm)
|
|
|
+ x: number; // 相对大椎穴横向偏移(cm)
|
|
|
+ y: number; // 相对大椎穴纵向偏移(cm)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 将穴位相对偏移转换为设备坐标
|
|
|
* 注意:此算法在设备端执行
|
|
|
- *
|
|
|
+ *
|
|
|
* @param dazhuiPosition 设备传感器检测的大椎穴位置(设备坐标系,mm)
|
|
|
* @param acupointOffset 穴位相对偏移(相对大椎穴,cm)
|
|
|
* @param userBodyData 用户体型数据(用于精度修正)
|
|
|
* @returns 穴位在设备坐标系中的位置(mm)
|
|
|
*/
|
|
|
function convertToDeviceCoordinate(
|
|
|
- dazhuiPosition: DeviceCoordinate,
|
|
|
- acupointOffset: AcupointOffset,
|
|
|
- userBodyData: UserBodyData
|
|
|
+ dazhuiPosition: DeviceCoordinate,
|
|
|
+ acupointOffset: AcupointOffset,
|
|
|
+ userBodyData: UserBodyData
|
|
|
): DeviceCoordinate {
|
|
|
- // 将厘米转换为毫米
|
|
|
- const offsetXmm = acupointOffset.x * 10;
|
|
|
- const offsetYmm = acupointOffset.y * 10;
|
|
|
-
|
|
|
- // 坐标转换
|
|
|
- // 注意:人体坐标系Y轴向下为负,设备坐标系Y轴向下为正
|
|
|
- return {
|
|
|
- x: dazhuiPosition.x + offsetXmm,
|
|
|
- y: dazhuiPosition.y - offsetYmm, // 转换方向
|
|
|
- z: dazhuiPosition.z // 深度通常不变
|
|
|
- };
|
|
|
+ // 将厘米转换为毫米
|
|
|
+ const offsetXmm = acupointOffset.x * 10;
|
|
|
+ const offsetYmm = acupointOffset.y * 10;
|
|
|
+
|
|
|
+ // 坐标转换
|
|
|
+ // 注意:人体坐标系Y轴向下为负,设备坐标系Y轴向下为正
|
|
|
+ return {
|
|
|
+ x: dazhuiPosition.x + offsetXmm,
|
|
|
+ y: dazhuiPosition.y - offsetYmm, // 转换方向
|
|
|
+ z: dazhuiPosition.z // 深度通常不变
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 批量转换所有穴位坐标
|
|
|
- *
|
|
|
+ *
|
|
|
* @param dazhuiPosition 设备传感器检测的大椎穴位置
|
|
|
* @param acupointTable 用户穴位对照表(相对偏移)
|
|
|
* @returns 所有穴位在设备坐标系中的位置
|
|
|
*/
|
|
|
function convertAllAcupoints(
|
|
|
- dazhuiPosition: DeviceCoordinate,
|
|
|
- acupointTable: AcupointReferenceTable
|
|
|
+ dazhuiPosition: DeviceCoordinate,
|
|
|
+ acupointTable: AcupointReferenceTable
|
|
|
): Map<string, DeviceCoordinate> {
|
|
|
- const positions = new Map<string, DeviceCoordinate>();
|
|
|
-
|
|
|
- for (const acupoint of acupointTable.acupoints) {
|
|
|
- const deviceCoord = convertToDeviceCoordinate(
|
|
|
- dazhuiPosition,
|
|
|
- acupoint.offsetFromDazhui,
|
|
|
- acupointTable.bodyData
|
|
|
- );
|
|
|
- positions.set(acupoint.id, deviceCoord);
|
|
|
- }
|
|
|
-
|
|
|
- return positions;
|
|
|
+ const positions = new Map<string, DeviceCoordinate>();
|
|
|
+
|
|
|
+ for (const acupoint of acupointTable.acupoints) {
|
|
|
+ const deviceCoord = convertToDeviceCoordinate(
|
|
|
+ dazhuiPosition,
|
|
|
+ acupoint.offsetFromDazhui,
|
|
|
+ acupointTable.bodyData
|
|
|
+ );
|
|
|
+ positions.set(acupoint.id, deviceCoord);
|
|
|
+ }
|
|
|
+
|
|
|
+ return positions;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -806,54 +806,54 @@ function convertAllAcupoints(
|
|
|
|
|
|
```typescript
|
|
|
interface UserProfile {
|
|
|
- id: string;
|
|
|
- name: string;
|
|
|
- gender: 'male' | 'female';
|
|
|
- age: number;
|
|
|
- phone: string;
|
|
|
- bodyData: {
|
|
|
- shoulderWidth: number; // 肩宽(厘米)
|
|
|
- bodyLength: number; // 身长(厘米)
|
|
|
- fingerWidth?: {
|
|
|
- cun1: number; // 一寸
|
|
|
- cun1_5: number; // 1.5寸
|
|
|
- cun3: number; // 三寸
|
|
|
+ id: string;
|
|
|
+ name: string;
|
|
|
+ gender: 'male' | 'female';
|
|
|
+ age: number;
|
|
|
+ phone: string;
|
|
|
+ bodyData: {
|
|
|
+ shoulderWidth: number; // 肩宽(厘米)
|
|
|
+ bodyLength: number; // 身长(厘米)
|
|
|
+ fingerWidth?: {
|
|
|
+ cun1: number; // 一寸
|
|
|
+ cun1_5: number; // 1.5寸
|
|
|
+ cun3: number; // 三寸
|
|
|
+ };
|
|
|
};
|
|
|
- };
|
|
|
- fingerprints: string[]; // 指纹ID列表
|
|
|
- devices: DeviceBinding[]; // 关联的设备列表(多对多)
|
|
|
- createdAt: Date;
|
|
|
- updatedAt: Date;
|
|
|
+ fingerprints: string[]; // 指纹ID列表
|
|
|
+ devices: DeviceBinding[]; // 关联的设备列表(多对多)
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 用户-设备绑定关系
|
|
|
interface DeviceBinding {
|
|
|
- deviceId: string; // 设备编号(主键)
|
|
|
- deviceName: string; // 设备名称
|
|
|
- boundAt: Date; // 绑定时间
|
|
|
- isPrimary: boolean; // 是否为主设备
|
|
|
+ deviceId: string; // 设备编号(主键)
|
|
|
+ deviceName: string; // 设备名称
|
|
|
+ boundAt: Date; // 绑定时间
|
|
|
+ isPrimary: boolean; // 是否为主设备
|
|
|
}
|
|
|
|
|
|
// 设备信息
|
|
|
interface Device {
|
|
|
- deviceId: string; // 设备编号(主键,如:AJY001)
|
|
|
- deviceName: string; // 设备名称
|
|
|
- model: string; // 设备型号
|
|
|
- serialNumber: string; // 设备序列号(唯一标识)
|
|
|
- firmwareVersion: string; // 固件版本
|
|
|
- status: 'online' | 'offline'; // 在线状态
|
|
|
- users: UserBinding[]; // 关联的用户列表(多对多)
|
|
|
- lastOnlineAt: Date; // 最后在线时间
|
|
|
- createdAt: Date;
|
|
|
- updatedAt: Date;
|
|
|
+ deviceId: string; // 设备编号(主键,如:AJY001)
|
|
|
+ deviceName: string; // 设备名称
|
|
|
+ model: string; // 设备型号
|
|
|
+ serialNumber: string; // 设备序列号(唯一标识)
|
|
|
+ firmwareVersion: string; // 固件版本
|
|
|
+ status: 'online' | 'offline'; // 在线状态
|
|
|
+ users: UserBinding[]; // 关联的用户列表(多对多)
|
|
|
+ lastOnlineAt: Date; // 最后在线时间
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 设备-用户绑定关系
|
|
|
interface UserBinding {
|
|
|
- userId: string; // 用户ID
|
|
|
- userName: string; // 用户姓名
|
|
|
- boundAt: Date; // 绑定时间
|
|
|
- isPrimary: boolean; // 是否为主用户
|
|
|
+ userId: string; // 用户ID
|
|
|
+ userName: string; // 用户姓名
|
|
|
+ boundAt: Date; // 绑定时间
|
|
|
+ isPrimary: boolean; // 是否为主用户
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -862,41 +862,41 @@ interface UserBinding {
|
|
|
```typescript
|
|
|
// 穴位基础信息
|
|
|
interface Acupoint {
|
|
|
- id: string;
|
|
|
- name: string;
|
|
|
- meridian: string; // 所属经络
|
|
|
- efficacy: string[]; // 功效列表
|
|
|
- positioning: 'relative' | 'absolute'; // 定位方式
|
|
|
- offset?: { // 相对定位偏移
|
|
|
- cun: number;
|
|
|
- cunType: 'cun1' | 'cun1_5' | 'cun3';
|
|
|
- side: 'center' | 'left' | 'right';
|
|
|
- lateralOffset?: number;
|
|
|
- };
|
|
|
- absolutePosition?: { // 绝对定位坐标
|
|
|
- x: number;
|
|
|
- y: number;
|
|
|
- z: number;
|
|
|
- };
|
|
|
- status: 'active' | 'pending'; // 状态
|
|
|
- source: 'preset' | 'expert'; // 数据来源
|
|
|
- createdAt: Date;
|
|
|
- updatedAt: Date;
|
|
|
+ id: string;
|
|
|
+ name: string;
|
|
|
+ meridian: string; // 所属经络
|
|
|
+ efficacy: string[]; // 功效列表
|
|
|
+ positioning: 'relative' | 'absolute'; // 定位方式
|
|
|
+ offset?: { // 相对定位偏移
|
|
|
+ cun: number;
|
|
|
+ cunType: 'cun1' | 'cun1_5' | 'cun3';
|
|
|
+ side: 'center' | 'left' | 'right';
|
|
|
+ lateralOffset?: number;
|
|
|
+ };
|
|
|
+ absolutePosition?: { // 绝对定位坐标
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ z: number;
|
|
|
+ };
|
|
|
+ status: 'active' | 'pending'; // 状态
|
|
|
+ source: 'preset' | 'expert'; // 数据来源
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 艾灸手法
|
|
|
interface MoxaTechnique {
|
|
|
- id: string;
|
|
|
- name: string; // 手法名称(一键艾灸[默认]、温和灸、雀啄灸、回旋灸)
|
|
|
- isDefault: boolean; // 是否为默认手法(一键艾灸为默认)
|
|
|
- description: string; // 手法描述
|
|
|
- parameters: {
|
|
|
- temperatureRange: { min: number; max: number }; // 温度范围
|
|
|
- durationRange: { min: number; max: number }; // 时间范围(秒)
|
|
|
- movementPattern: 'fixed' | 'vertical' | 'circular' | 'oneclick'; // 运动模式
|
|
|
- };
|
|
|
- createdAt: Date;
|
|
|
- updatedAt: Date;
|
|
|
+ id: string;
|
|
|
+ name: string; // 手法名称(一键艾灸[默认]、温和灸、雀啄灸、回旋灸)
|
|
|
+ isDefault: boolean; // 是否为默认手法(一键艾灸为默认)
|
|
|
+ description: string; // 手法描述
|
|
|
+ parameters: {
|
|
|
+ temperatureRange: { min: number; max: number }; // 温度范围
|
|
|
+ durationRange: { min: number; max: number }; // 时间范围(秒)
|
|
|
+ movementPattern: 'fixed' | 'vertical' | 'circular' | 'oneclick'; // 运动模式
|
|
|
+ };
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -904,23 +904,23 @@ interface MoxaTechnique {
|
|
|
|
|
|
```typescript
|
|
|
interface AcupointReferenceTable {
|
|
|
- userId: string;
|
|
|
- bodyData: UserBodyData;
|
|
|
- fingerWidthUsed: FingerWidth;
|
|
|
- acupoints: CalculatedAcupoint[];
|
|
|
- createdAt: Date;
|
|
|
+ userId: string;
|
|
|
+ bodyData: UserBodyData;
|
|
|
+ fingerWidthUsed: FingerWidth;
|
|
|
+ acupoints: CalculatedAcupoint[];
|
|
|
+ createdAt: Date;
|
|
|
}
|
|
|
|
|
|
interface CalculatedAcupoint {
|
|
|
- id: string;
|
|
|
- name: string;
|
|
|
- side: 'center' | 'left' | 'right';
|
|
|
- offsetFromDazhui: {
|
|
|
- x: number; // 相对大椎穴的横向偏移(厘米)
|
|
|
- y: number; // 相对大椎穴的纵向偏移(厘米)
|
|
|
- };
|
|
|
- offsetInCun: number;
|
|
|
- cunType: 'cun1' | 'cun1_5' | 'cun3';
|
|
|
+ id: string;
|
|
|
+ name: string;
|
|
|
+ side: 'center' | 'left' | 'right';
|
|
|
+ offsetFromDazhui: {
|
|
|
+ x: number; // 相对大椎穴的横向偏移(厘米)
|
|
|
+ y: number; // 相对大椎穴的纵向偏移(厘米)
|
|
|
+ };
|
|
|
+ offsetInCun: number;
|
|
|
+ cunType: 'cun1' | 'cun1_5' | 'cun3';
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -929,112 +929,112 @@ interface CalculatedAcupoint {
|
|
|
```typescript
|
|
|
// 方案模式枚举
|
|
|
enum SchemeMode {
|
|
|
- ONE_CLICK = '一键艾灸',
|
|
|
- PROFESSIONAL = '专业模式',
|
|
|
- CUSTOM = '自定义模式',
|
|
|
- EXPERT = '延年圣手模式'
|
|
|
+ ONE_CLICK = '一键艾灸',
|
|
|
+ PROFESSIONAL = '专业模式',
|
|
|
+ CUSTOM = '自定义模式',
|
|
|
+ EXPERT = '延年圣手模式'
|
|
|
}
|
|
|
|
|
|
// 用户模式存储(每个用户独立存储四种模式数据)
|
|
|
interface UserModeStorage {
|
|
|
- userId: string;
|
|
|
- oneClickMode: OneClickScheme; // 一键艾灸(默认工艺)
|
|
|
- professionalMode: ProfessionalScheme[]; // 专业模式(8种功效)
|
|
|
- customMode: CustomScheme[]; // 自定义模式
|
|
|
- expertMode: ExpertModeStorage; // 延年圣手模式(含8个同步方案)
|
|
|
- updatedAt: Date;
|
|
|
+ userId: string;
|
|
|
+ oneClickMode: OneClickScheme; // 一键艾灸(默认工艺)
|
|
|
+ professionalMode: ProfessionalScheme[]; // 专业模式(8种功效)
|
|
|
+ customMode: CustomScheme[]; // 自定义模式
|
|
|
+ expertMode: ExpertModeStorage; // 延年圣手模式(含8个同步方案)
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 方案基础结构
|
|
|
interface Scheme {
|
|
|
- id: string;
|
|
|
- schemeName: string;
|
|
|
- mode: SchemeMode;
|
|
|
- creatorType: 'admin' | 'user' | 'expert'; // 创作人类型
|
|
|
- creatorId: string; // 创作人ID(ADMIN/用户ID/专家ID)
|
|
|
- creatorName: string; // 创作人显示名称(ADMIN/用户姓名/专家姓名)
|
|
|
- symptoms: string[]; // 适用症状
|
|
|
- targetGender: 'male' | 'female' | 'all';
|
|
|
- ageRange: { min: number; max: number };
|
|
|
- steps: SchemeStep[];
|
|
|
- status: 'draft' | 'published' | 'archived';
|
|
|
- createdAt: Date;
|
|
|
- updatedAt: Date;
|
|
|
+ id: string;
|
|
|
+ schemeName: string;
|
|
|
+ mode: SchemeMode;
|
|
|
+ creatorType: 'admin' | 'user' | 'expert'; // 创作人类型
|
|
|
+ creatorId: string; // 创作人ID(ADMIN/用户ID/专家ID)
|
|
|
+ creatorName: string; // 创作人显示名称(ADMIN/用户姓名/专家姓名)
|
|
|
+ symptoms: string[]; // 适用症状
|
|
|
+ targetGender: 'male' | 'female' | 'all';
|
|
|
+ ageRange: { min: number; max: number };
|
|
|
+ steps: SchemeStep[];
|
|
|
+ status: 'draft' | 'published' | 'archived';
|
|
|
+ createdAt: Date;
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 一键艾灸方案(默认艾灸工艺)
|
|
|
interface OneClickScheme extends Scheme {
|
|
|
- mode: SchemeMode.ONE_CLICK;
|
|
|
- isDefault: true; // 始终为true,是默认工艺
|
|
|
- processId: string; // 关联的工艺语言ID
|
|
|
+ mode: SchemeMode.ONE_CLICK;
|
|
|
+ isDefault: true; // 始终为true,是默认工艺
|
|
|
+ processId: string; // 关联的工艺语言ID
|
|
|
}
|
|
|
|
|
|
// 专业模式方案
|
|
|
interface ProfessionalScheme extends Scheme {
|
|
|
- mode: SchemeMode.PROFESSIONAL;
|
|
|
- efficacyType: '驱寒' | '祛湿' | '祛风' | '化瘀' | '活血' | '化痰' | '养颜' | '扶阳';
|
|
|
+ mode: SchemeMode.PROFESSIONAL;
|
|
|
+ efficacyType: '驱寒' | '祛湿' | '祛风' | '化瘀' | '活血' | '化痰' | '养颜' | '扶阳';
|
|
|
}
|
|
|
|
|
|
// 自定义模式方案
|
|
|
interface CustomScheme extends Scheme {
|
|
|
- mode: SchemeMode.CUSTOM;
|
|
|
- userId: string; // 用户ID
|
|
|
- isPersonal: boolean; // 是否个人方案
|
|
|
+ mode: SchemeMode.CUSTOM;
|
|
|
+ userId: string; // 用户ID
|
|
|
+ isPersonal: boolean; // 是否个人方案
|
|
|
}
|
|
|
|
|
|
// 延年圣手模式方案(专家)
|
|
|
interface ExpertScheme extends Scheme {
|
|
|
- mode: SchemeMode.EXPERT;
|
|
|
- expertId: string; // 专家ID(来自专家端系统)
|
|
|
- expertName: string; // 专家名称
|
|
|
- publishType: 'public' | 'private'; // 公开/指定
|
|
|
- targetUsers?: string[]; // 指定用户ID列表
|
|
|
+ mode: SchemeMode.EXPERT;
|
|
|
+ expertId: string; // 专家ID(来自专家端系统)
|
|
|
+ expertName: string; // 专家名称
|
|
|
+ publishType: 'public' | 'private'; // 公开/指定
|
|
|
+ targetUsers?: string[]; // 指定用户ID列表
|
|
|
}
|
|
|
|
|
|
// 延年圣手模式存储(含8个同步方案到设备)
|
|
|
interface ExpertModeStorage {
|
|
|
- userId: string;
|
|
|
- schemes: ExpertScheme[]; // 用户接收的所有专家方案
|
|
|
- syncedSchemes: SyncedScheme[]; // 同步到设备的最新8个方案
|
|
|
- updatedAt: Date;
|
|
|
+ userId: string;
|
|
|
+ schemes: ExpertScheme[]; // 用户接收的所有专家方案
|
|
|
+ syncedSchemes: SyncedScheme[]; // 同步到设备的最新8个方案
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 同步到设备的方案(最新8个,对应设备快捷键1-8)
|
|
|
interface SyncedScheme {
|
|
|
- slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; // 快捷键槽位(1-8)
|
|
|
- schemeId: string; // 方案ID
|
|
|
- schemeName: string; // 方案名称
|
|
|
- processId: string; // 关联工艺语言ID
|
|
|
- syncedAt: Date; // 同步时间
|
|
|
+ slot: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; // 快捷键槽位(1-8)
|
|
|
+ schemeId: string; // 方案ID
|
|
|
+ schemeName: string; // 方案名称
|
|
|
+ processId: string; // 关联工艺语言ID
|
|
|
+ syncedAt: Date; // 同步时间
|
|
|
}
|
|
|
|
|
|
// 设备快捷键映射(推送到设备的数据结构)
|
|
|
interface DeviceHotkeyMap {
|
|
|
- userId: string;
|
|
|
- deviceId: string;
|
|
|
- hotkeys: {
|
|
|
- '1': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '2': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '3': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '4': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '5': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '6': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '7': { schemeId: string; schemeName: string; processId: string };
|
|
|
- '8': { schemeId: string; schemeName: string; processId: string };
|
|
|
- };
|
|
|
- updatedAt: Date;
|
|
|
+ userId: string;
|
|
|
+ deviceId: string;
|
|
|
+ hotkeys: {
|
|
|
+ '1': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '2': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '3': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '4': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '5': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '6': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '7': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ '8': { schemeId: string; schemeName: string; processId: string };
|
|
|
+ };
|
|
|
+ updatedAt: Date;
|
|
|
}
|
|
|
|
|
|
// 方案步骤
|
|
|
interface SchemeStep {
|
|
|
- stepOrder: number;
|
|
|
- acupointId: string;
|
|
|
- acupointName: string;
|
|
|
- sides?: ('left' | 'right')[]; // 双侧穴位
|
|
|
- temperature: number;
|
|
|
- duration: number; // 秒
|
|
|
- techniqueId: string; // 艾灸手法ID(含 oneclick)
|
|
|
- techniqueName: string; // 手法名称(一键艾灸、温和灸、雀啄灸、回旋灸)
|
|
|
+ stepOrder: number;
|
|
|
+ acupointId: string;
|
|
|
+ acupointName: string;
|
|
|
+ sides?: ('left' | 'right')[]; // 双侧穴位
|
|
|
+ temperature: number;
|
|
|
+ duration: number; // 秒
|
|
|
+ techniqueId: string; // 艾灸手法ID(含 oneclick)
|
|
|
+ techniqueName: string; // 手法名称(一键艾灸、温和灸、雀啄灸、回旋灸)
|
|
|
}
|
|
|
```
|
|
|
|
|
|
@@ -1250,6 +1250,122 @@ interface SchemeStep {
|
|
|
|
|
|
---
|
|
|
|
|
|
+#### 用户穴位表(数据库层)
|
|
|
+
|
|
|
+**功能说明**:用户穴位表根据穴位管理中维护的穴位信息,自动按照每个用户生成对应的穴位坐标数据。穴位坐标通过核心算法计算而来。
|
|
|
+
|
|
|
+**数据生成规则**:
|
|
|
+- 当用户档案首次创建时,根据用户体型数据(肩宽、身长、指寸)自动生成穴位对照表
|
|
|
+- 当用户体型数据更新时,自动重新计算穴位坐标
|
|
|
+- 当穴位管理中新增穴位时,自动为所有用户重新计算并新增穴位坐标
|
|
|
+
|
|
|
+**触发自动更新场景**:
|
|
|
+| 触发条件 | 自动执行操作 |
|
|
|
+|----------|--------------|
|
|
|
+| 创建用户档案 | 根据体型数据生成穴位对照表 |
|
|
|
+| 更新用户体型数据(肩宽/身长/指寸) | 重新计算所有穴位坐标 |
|
|
|
+| 穴位管理新增穴位 | 为所有用户新增该穴位坐标 |
|
|
|
+
|
|
|
+**数据库表结构**(仅存储,不展示在后台管理界面):
|
|
|
+
|
|
|
+```typescript
|
|
|
+interface UserAcupointTable {
|
|
|
+ id: string; // 主键
|
|
|
+ userId: string; // 用户ID
|
|
|
+ acupointId: string; // 穴位ID(关联穴位管理)
|
|
|
+ acupointName: string; // 穴位名称
|
|
|
+ acupointSide: string; // 侧别(center/left/right/both)
|
|
|
+ cunValue: number; // 相对大椎穴偏移值(寸)
|
|
|
+ cunType: string; // 寸类型(1寸/1.5寸/3寸)
|
|
|
+ coordinateX: number; // 计算后的X坐标(mm,相对大椎穴)
|
|
|
+ coordinateY: number; // 计算后的Y坐标(mm,相对大椎穴)
|
|
|
+ createdAt: Date; // 首次生成时间
|
|
|
+ updatedAt: Date; // 最后更新时间
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+**算法调用说明**:
|
|
|
+- 核心算法模块提供穴位坐标计算服务
|
|
|
+- 后台调用算法接口生成用户专属穴位坐标
|
|
|
+- 计算公式参考"四、核心算法设计"章节
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+#### 用户方案表(独立页面)
|
|
|
+
|
|
|
+**功能说明**:用户方案表记录该用户下所有的艾灸方案。方案通过算法计算后,生成专属该用户的工艺参数和穴位坐标。每个用户的一键艾灸、专业模式、自定义模式、延年圣手模式中的所有订阅方案都经过算法处理后保存到此表中。
|
|
|
+
|
|
|
+**方案来源**:
|
|
|
+| 模式类型 | 方案来源 | 算法处理 |
|
|
|
+|----------|----------|----------|
|
|
|
+| 一键艾灸 | 系统默认工艺 | 根据用户穴位坐标生成专属工艺参数 |
|
|
|
+| 专业模式 | 8种功效方案 | 根据用户穴位坐标生成专属穴位组合 |
|
|
|
+| 自定义模式 | 用户自选方案 | 根据用户选择生成工艺参数 |
|
|
|
+| 延年圣手 | 专家方案订阅 | 根据用户穴位坐标生成专属工艺参数 |
|
|
|
+
|
|
|
+**使用次数更新规则**:
|
|
|
+- 用户在APP或设备上执行方案时,使用次数+1
|
|
|
+- 每次治疗会话开始时更新
|
|
|
+
|
|
|
+**方案列表**:
|
|
|
+
|
|
|
+| 序号 | 时间 | 模式类型 | 方案名称 | 方案编码 | 创作人 | 步骤 | 使用次数 | 操作 |
|
|
|
+|------|------|----------|----------|----------|--------|------|----------|------|
|
|
|
+| 1 | 2026-03-15 10:30 | 一键艾灸 | 一键艾灸(默认) | S001 | ADMIN | 5 | 15 | 查看详情 |
|
|
|
+| 2 | 2026-03-16 14:20 | 专业模式 | 春季祛湿方案 | S002 | ADMIN | 4 | 8 | 查看详情 |
|
|
|
+| 3 | 2026-03-18 09:00 | 自定义模式 | 个人调理方案 | S003 | 张三 | 3 | 3 | 查看详情 |
|
|
|
+| 4 | 2026-03-20 16:45 | 延年圣手 | 张专家驱寒方案 | S004 | 张专家 | 5 | 2 | 查看详情 |
|
|
|
+
|
|
|
+**列表字段说明**:
|
|
|
+| 字段 | 说明 |
|
|
|
+|------|------|
|
|
|
+| 时间 | 一键艾灸和专业模式按用户创建时间;自定义模式和延年圣手按方案订阅时间 |
|
|
|
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
|
|
|
+| 方案名称 | 方案的具体名称 |
|
|
|
+| 方案编码 | 方案的唯一标识符 |
|
|
|
+| 创作人 | ADMIN / 管理员账号名 / 用户姓名 / 专家姓名 |
|
|
|
+| 步骤 | 方案包含的治疗步骤数量 |
|
|
|
+| 使用次数 | 用户实际使用该方案的次数 |
|
|
|
+| 操作 | 查看工艺详情按钮 |
|
|
|
+
|
|
|
+**操作按钮**:
|
|
|
+| 按钮 | 功能说明 |
|
|
|
+|------|----------|
|
|
|
+| 查看详情 | 打开方案详情弹窗/页面 |
|
|
|
+| 返回 | 返回用户列表 |
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+#### 方案详情界面
|
|
|
+
|
|
|
+**显示内容**:
|
|
|
+| 字段 | 说明 |
|
|
|
+|------|------|
|
|
|
+| 方案名称 | 方案的具体名称 |
|
|
|
+| 方案编码 | 方案的唯一标识符 |
|
|
|
+| 模式类型 | 一键艾灸 / 专业模式 / 自定义模式 / 延年圣手 |
|
|
|
+| 创作人 | 方案创建者 |
|
|
|
+| 创建时间 | 方案生成时间 |
|
|
|
+| 使用次数 | 用户使用该方案的次数 |
|
|
|
+| 工艺详情 | 包含步骤序列、温度、时间、手法等 |
|
|
|
+
|
|
|
+**工艺详情结构**:
|
|
|
+
|
|
|
+| 步骤序号 | 穴位名称 | 侧别 | 温度(°C) | 时间(分钟) | 艾灸手法 |
|
|
|
+|----------|----------|------|----------|------------|----------|
|
|
|
+| 1 | 大椎穴 | 中心 | 43 | 5 | 一键艾灸 |
|
|
|
+| 2 | 身柱穴 | 中心 | 43 | 5 | 一键艾灸 |
|
|
|
+| 3 | 肺俞穴 | 左侧 | 42 | 5 | 温和灸 |
|
|
|
+| 4 | 肺俞穴 | 右侧 | 42 | 5 | 温和灸 |
|
|
|
+| 5 | 脾俞穴 | 雙側 | 45 | 10 | 回旋灸 |
|
|
|
+
|
|
|
+**操作按钮**:
|
|
|
+| 按钮 | 功能说明 |
|
|
|
+|------|----------|
|
|
|
+| 关闭 | 关闭详情弹窗/页面 |
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
### 7.2 穴位管理
|
|
|
|
|
|
#### 功能说明
|