web-core-tcm 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/package.json +38 -21
  2. package/quasar.config.ts +28 -15
  3. package/src/api/algorithm/comprehensiveAlgorithm.ts +1 -1
  4. package/src/api/algorithm/index.ts +7 -7
  5. package/src/api/algorithm/inquiriesAlgorithm.ts +4 -7
  6. package/src/api/algorithm/inspectionsAlgorithm.ts +1 -1
  7. package/src/api/algorithm/lisemsAlgorithm.ts +3 -3
  8. package/src/api/algorithm/pulsationsAlgorithm.ts +2 -3
  9. package/src/api/authorization/alova/apiDefinitions.ts +2 -2
  10. package/src/api/authorization/alova/createApis.ts +22 -7
  11. package/src/api/authorization/alova/globals.d.ts +35 -14
  12. package/src/api/authorization/alova/implement/authorization.ts +11 -9
  13. package/src/api/authorization/alova/implement/index.ts +1 -1
  14. package/src/api/authorization/alova/index.ts +4 -5
  15. package/src/api/authorization/authorization.ts +6 -6
  16. package/src/api/authorization/index.ts +1 -1
  17. package/src/api/check/alova/apiDefinitions.ts +2 -2
  18. package/src/api/check/alova/createApis.ts +22 -7
  19. package/src/api/check/alova/globals.d.ts +29 -20
  20. package/src/api/check/alova/implement/check.ts +145 -99
  21. package/src/api/check/alova/implement/index.ts +1 -1
  22. package/src/api/check/alova/index.ts +4 -5
  23. package/src/api/check/check.ts +116 -63
  24. package/src/api/check/index.ts +1 -1
  25. package/src/api/config/alova/index.ts +26 -27
  26. package/src/api/config/index.ts +59 -57
  27. package/src/api/doctor/alova/apiDefinitions.ts +2 -2
  28. package/src/api/doctor/alova/createApis.ts +22 -7
  29. package/src/api/doctor/alova/globals.d.ts +27 -18
  30. package/src/api/doctor/alova/implement/doctor.ts +38 -24
  31. package/src/api/doctor/alova/implement/index.ts +1 -1
  32. package/src/api/doctor/alova/index.ts +4 -4
  33. package/src/api/doctor/doctor.ts +18 -18
  34. package/src/api/doctor/index.ts +1 -1
  35. package/src/api/index.ts +12 -15
  36. package/src/api/metric/implement/index.ts +1 -1
  37. package/src/api/metric/implement/metric.ts +44 -34
  38. package/src/api/metric/index.ts +1 -1
  39. package/src/api/metric/metric.ts +36 -36
  40. package/src/api/oauth/alova/apiDefinitions.ts +2 -2
  41. package/src/api/oauth/alova/createApis.ts +22 -7
  42. package/src/api/oauth/alova/globals.d.ts +25 -16
  43. package/src/api/oauth/alova/implement/index.ts +1 -1
  44. package/src/api/oauth/alova/implement/oauth.ts +20 -15
  45. package/src/api/oauth/alova/index.ts +4 -5
  46. package/src/api/oauth/index.ts +1 -1
  47. package/src/api/oauth/oauth.ts +9 -5
  48. package/src/api/outpatient/alova/apiDefinitions.ts +2 -2
  49. package/src/api/outpatient/alova/createApis.ts +22 -7
  50. package/src/api/outpatient/alova/globals.d.ts +25 -16
  51. package/src/api/outpatient/alova/implement/index.ts +1 -1
  52. package/src/api/outpatient/alova/implement/outpatient.ts +76 -51
  53. package/src/api/outpatient/alova/index.ts +4 -5
  54. package/src/api/outpatient/index.ts +1 -1
  55. package/src/api/outpatient/outpatient.ts +29 -24
  56. package/src/api/patient/alova/apiDefinitions.ts +2 -2
  57. package/src/api/patient/alova/createApis.ts +22 -7
  58. package/src/api/patient/alova/globals.d.ts +56 -43
  59. package/src/api/patient/alova/implement/index.ts +1 -1
  60. package/src/api/patient/alova/implement/meta.ts +253 -224
  61. package/src/api/patient/alova/implement/patient.ts +79 -57
  62. package/src/api/patient/alova/index.ts +3 -5
  63. package/src/api/patient/core.ts +51 -49
  64. package/src/api/patient/index.ts +1 -1
  65. package/src/api/patient/meta.ts +244 -140
  66. package/src/api/patient/patient.ts +25 -25
  67. package/src/api/prescription/alova/apiDefinitions.ts +2 -2
  68. package/src/api/prescription/alova/createApis.ts +22 -7
  69. package/src/api/prescription/alova/globals.d.ts +32 -23
  70. package/src/api/prescription/alova/implement/herbal.ts +59 -39
  71. package/src/api/prescription/alova/implement/index.ts +1 -1
  72. package/src/api/prescription/alova/implement/prescription.ts +50 -33
  73. package/src/api/prescription/alova/index.ts +4 -5
  74. package/src/api/prescription/herbal.ts +17 -10
  75. package/src/api/prescription/index.ts +1 -1
  76. package/src/api/prescription/prescription.ts +35 -27
  77. package/src/api/scientist/alova/apiDefinitions.ts +2 -2
  78. package/src/api/scientist/alova/createApis.ts +22 -7
  79. package/src/api/scientist/alova/globals.d.ts +25 -16
  80. package/src/api/scientist/alova/implement/index.ts +1 -1
  81. package/src/api/scientist/alova/implement/scientist.ts +31 -20
  82. package/src/api/scientist/alova/index.ts +5 -4
  83. package/src/api/scientist/index.ts +1 -1
  84. package/src/api/scientist/scientist.ts +20 -20
  85. package/src/index.ts +3 -4
  86. package/src/layouts/UserLayout.vue +9 -7
  87. package/src/pages/LoginPage.vue +2 -5
  88. package/src/proto/types/Images_pb.ts +13 -13
  89. package/src/proto/types/WaveMap_pb.ts +13 -13
  90. package/src/router/routes.ts +2 -2
  91. package/src/util/export.ts +4 -4
  92. package/src/util/helper.ts +6 -6
  93. package/src/util/image.ts +1 -1
  94. package/src/util/number.ts +4 -4
  95. package/src/util/s256.js +1 -4
  96. package/src/util/secret.ts +1 -1
  97. package/src/util/string.ts +18 -18
  98. package/tsconfig.json +5 -1
@@ -1,4 +1,4 @@
1
- import type { MetaState } from '@core/api/patient/alova/globals';
1
+ import type { MetaState } from 'src/api/patient/alova/globals';
2
2
  import {
3
3
  AppendixMeta,
4
4
  ComplaintMeta,
@@ -12,14 +12,14 @@ import {
12
12
  PulsationMeta,
13
13
  SceneMeta,
14
14
  TongueMeta,
15
- } from '@core/api/patient/meta';
16
- import type { Page} from '@core/api/patient/core';
17
- import { Annotation, Tag } from '@core/api/patient/core';
18
- import { faceAnalyze, tongueAnalyze } from '@core/api/algorithm/inspectionsAlgorithm';
19
- import { base64ToArrayBuffer } from '@core/util/image';
20
- import { pulsationAnalysis, pulsationPreprocessing } from '@core/api/algorithm/pulsationsAlgorithm';
21
- import { analysisLisems } from '@core/api/algorithm/lisemsAlgorithm';
22
- import type { Patient } from '@core/api/patient/patient';
15
+ } from 'src/api/patient/meta';
16
+ import type { Page } from 'src/api/patient/core';
17
+ import { Annotation, Tag } from 'src/api/patient/core';
18
+ import { faceAnalyze, tongueAnalyze } from 'src/api/algorithm/inspectionsAlgorithm';
19
+ import { base64ToArrayBuffer } from 'src/util/image';
20
+ import { pulsationAnalysis, pulsationPreprocessing } from 'src/api/algorithm/pulsationsAlgorithm';
21
+ import { analysisLisems } from 'src/api/algorithm/lisemsAlgorithm';
22
+ import type { Patient } from 'src/api/patient/patient';
23
23
 
24
24
  export class AlovaMeta extends Meta {
25
25
  override deserialize(): Promise<this> {
@@ -32,7 +32,7 @@ export class AlovaMeta extends Meta {
32
32
  return new ArrayBuffer(0);
33
33
  }
34
34
  override getObject(): Promise<string> {
35
- return Promise.resolve('')
35
+ return Promise.resolve('');
36
36
  }
37
37
  override async get(): Promise<this> {
38
38
  return this.of(await getState(this.id));
@@ -50,9 +50,23 @@ export class AlovaMeta extends Meta {
50
50
  override analyze(): Promise<this> {
51
51
  throw new Error('Method not implemented.');
52
52
  }
53
- static override queryMetaWithPatient(page: number, pageSize: number, owner?: Patient, type?: string, startTime?: string, endTime?: string, sort?: string, patientName?: string, patientPhoneNumber?: string, patientStartBirthdate?: string, patientEndBirthdate?: string, patientGender?: string, tags?: Tag[]): Promise<Page<Meta>> {
54
- const tagsState = tags?.map(tag => tag.state())
55
- const ownerState = owner?.state()
53
+ static override queryMetaWithPatient(
54
+ page: number,
55
+ pageSize: number,
56
+ owner?: Patient,
57
+ type?: string,
58
+ startTime?: string,
59
+ endTime?: string,
60
+ sort?: string,
61
+ patientName?: string,
62
+ patientPhoneNumber?: string,
63
+ patientStartBirthdate?: string,
64
+ patientEndBirthdate?: string,
65
+ patientGender?: string,
66
+ tags?: Tag[],
67
+ ): Promise<Page<Meta>> {
68
+ const tagsState = tags?.map((tag) => tag.state());
69
+ const ownerState = owner?.state();
56
70
  return patientApi.metaStateRestful
57
71
  .queryMetaAndPatientState({
58
72
  data: {
@@ -72,16 +86,16 @@ export class AlovaMeta extends Meta {
72
86
  },
73
87
  async transform(json) {
74
88
  const data = [] as Meta[];
75
- for (const item of json.content!) {
89
+ for (const item of json.content) {
76
90
  data.push(await AlovaMetas.map(item));
77
91
  }
78
92
  return {
79
93
  data: data,
80
- total: json.totalElements!,
81
- page: json.number!,
82
- pageSize: json.size!,
83
- pageCount: json.totalPages!,
84
- isLastPage: json.last!,
94
+ total: json.totalElements,
95
+ page: json.number,
96
+ pageSize: json.size,
97
+ pageCount: json.totalPages,
98
+ isLastPage: json.last,
85
99
  } as Page<Meta>;
86
100
  },
87
101
  })
@@ -96,7 +110,7 @@ export class AlovaMeta extends Meta {
96
110
  endTime?: string,
97
111
  sort?: string,
98
112
  ): Promise<Page<Meta>> {
99
- const ownerState = owner?.state()
113
+ const ownerState = owner?.state();
100
114
  return patientApi.metaStateRestful
101
115
  .queryMetaState({
102
116
  data: {
@@ -110,16 +124,16 @@ export class AlovaMeta extends Meta {
110
124
  },
111
125
  async transform(json) {
112
126
  const data = [];
113
- for (const item of json.content!) {
127
+ for (const item of json.content) {
114
128
  data.push(await AlovaMetas.map(item));
115
129
  }
116
130
  return {
117
131
  data: data,
118
- total: json.totalElements!,
119
- page: json.number!,
120
- pageSize: json.size!,
121
- pageCount: json.totalPages!,
122
- isLastPage: json.last!,
132
+ total: json.totalElements,
133
+ page: json.number,
134
+ pageSize: json.size,
135
+ pageCount: json.totalPages,
136
+ isLastPage: json.last,
123
137
  };
124
138
  },
125
139
  })
@@ -135,7 +149,7 @@ export class AlovaMeta extends Meta {
135
149
  endTime?: string,
136
150
  sort?: string,
137
151
  ): Promise<Page<Meta>> {
138
- const ownerState = owner?.map(item => item.state())
152
+ const ownerState = owner?.map((item) => item.state());
139
153
  return patientApi.metaStateRestful
140
154
  .queryMetaStateByExactMatch({
141
155
  data: {
@@ -150,302 +164,315 @@ export class AlovaMeta extends Meta {
150
164
  },
151
165
  async transform(json) {
152
166
  const data = [];
153
- for (const item of json.content!) {
167
+ for (const item of json.content) {
154
168
  data.push(await AlovaMetas.map(item));
155
169
  }
156
170
  return {
157
171
  data: data,
158
- total: json.totalElements!,
159
- page: json.number!,
160
- pageSize: json.size!,
161
- pageCount: json.totalPages!,
162
- isLastPage: json.last!,
172
+ total: json.totalElements,
173
+ page: json.number,
174
+ pageSize: json.size,
175
+ pageCount: json.totalPages,
176
+ isLastPage: json.last,
163
177
  };
164
178
  },
165
179
  })
166
180
  .send();
167
181
  }
168
182
  }
169
- const postState = (id: string,type: string, buffer: ArrayBuffer): Promise<MetaState> => {
170
- return patientApi.metaStateRestful.postMetaState({
171
- params: {
172
- ownerId: id,
173
- type: type
174
- },
175
- headers: {
176
- 'Content-Type': 'application/octet-stream'
177
- },
178
- duplex: 'half',
179
- data: new Blob([buffer])
180
- }).send()
181
- }
182
- const putState = (id: string,type: string, state: MetaState): Promise<MetaState> => {
183
- return patientApi.metaStateRestful.putMetaState({
184
- pathParams: {
185
- id: id,
186
- type: type
187
- },
188
- data: state
189
- }).send()
190
- }
183
+ const postState = (id: string, type: string, buffer: ArrayBuffer): Promise<MetaState> => {
184
+ return patientApi.metaStateRestful
185
+ .postMetaState({
186
+ params: {
187
+ ownerId: id,
188
+ type: type,
189
+ },
190
+ headers: {
191
+ 'Content-Type': 'application/octet-stream',
192
+ },
193
+ duplex: 'half',
194
+ data: new Blob([buffer]),
195
+ })
196
+ .send();
197
+ };
198
+ const putState = (id: string, type: string, state: MetaState): Promise<MetaState> => {
199
+ return patientApi.metaStateRestful
200
+ .putMetaState({
201
+ pathParams: {
202
+ id: id,
203
+ type: type,
204
+ },
205
+ data: state,
206
+ })
207
+ .send();
208
+ };
191
209
  const deleteState = (id: string): Promise<void> => {
192
- void patientApi.metaStateRestful.deleteMetaState({
193
- pathParams: {
194
- id: id
195
- }
196
- }).send()
197
- return Promise.resolve()
198
- }
210
+ void patientApi.metaStateRestful
211
+ .deleteMetaState({
212
+ pathParams: {
213
+ id: id,
214
+ },
215
+ })
216
+ .send();
217
+ return Promise.resolve();
218
+ };
199
219
  const getState = (id: string): Promise<MetaState> => {
200
- return patientApi.metaStateRestful.getMetaState({
201
- pathParams: {
202
- id: id
203
- }
204
- }).send()
205
- }
220
+ return patientApi.metaStateRestful
221
+ .getMetaState({
222
+ pathParams: {
223
+ id: id,
224
+ },
225
+ })
226
+ .send();
227
+ };
206
228
  const getMetaObject = async (id: string): Promise<ArrayBuffer> => {
207
- return patientApi.metaStateRestful.getMetaObject({
208
- pathParams: {
209
- id: id
210
- },
211
- priority: 'low',
212
- transform(data: unknown) {
213
- return (data as Response).arrayBuffer();
214
- },
215
- }).send()
216
- }
217
- const convertTags = (features: JSON,actor: string): Tag[] => {
229
+ return patientApi.metaStateRestful
230
+ .getMetaObject({
231
+ pathParams: {
232
+ id: id,
233
+ },
234
+ priority: 'low',
235
+ transform(data: unknown) {
236
+ return (data as Response).arrayBuffer();
237
+ },
238
+ })
239
+ .send();
240
+ };
241
+ const convertTags = (features: JSON, actor: string): Tag[] => {
218
242
  //上传照片
219
243
  const tags = [] as Tag[];
220
244
  const timestamp = Date.now().toString();
221
245
  Object.entries(features as object).forEach(([key, value]) => {
222
246
  tags.push(
223
- Tag.builder().key(key).annotations([Annotation.builder().value(value).actor(actor).timestamp(timestamp).build()]).build()
247
+ Tag.builder()
248
+ .key(key)
249
+ .annotations([Annotation.builder().value(value).actor(actor).timestamp(timestamp).build()])
250
+ .build(),
224
251
  );
225
252
  });
226
- return tags
227
- }
253
+ return tags;
254
+ };
228
255
  export class AlovaTongueMeta extends TongueMeta {
229
- override async getObject(){
230
- if(this.base64Image)return Promise.resolve(this.base64Image)
231
- return this.deserialize(await getMetaObject(this.id))
256
+ override async getObject() {
257
+ if (this.base64Image) return Promise.resolve(this.base64Image);
258
+ return this.deserialize(await getMetaObject(this.id));
232
259
  }
233
- override async get():Promise<this>{
234
- return this.of(await getState(this.id))
260
+ override async get(): Promise<this> {
261
+ return this.of(await getState(this.id));
235
262
  }
236
- override async put():Promise<this>{
237
- return this.of(await putState(this.id,this.type,this.state()))
263
+ override async put(): Promise<this> {
264
+ return this.of(await putState(this.id, this.type, this.state()));
238
265
  }
239
- override async post():Promise<this>{
240
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
266
+ override async post(): Promise<this> {
267
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
241
268
  }
242
- override async delete():Promise<this>{
243
- await deleteState(this.id)
269
+ override async delete(): Promise<this> {
270
+ await deleteState(this.id);
244
271
  return this;
245
272
  }
246
- override async analyze(overwrite=false):Promise<this>{
247
- if(overwrite)this.tags = []
273
+ override async analyze(overwrite = false): Promise<this> {
274
+ if (overwrite) this.tags = [];
248
275
  const formData = new FormData();
249
276
  formData.append('files', new Blob([base64ToArrayBuffer(this.base64Image)]));
250
- this.tags.push(...convertTags((await tongueAnalyze(formData).send()),'算法'))
251
- return Promise.resolve(this)
277
+ this.tags.push(...convertTags(await tongueAnalyze(formData).send(), '算法'));
278
+ return Promise.resolve(this);
252
279
  }
253
280
  }
254
281
  export class AlovaFaceMeta extends FaceMeta {
255
282
  override async getObject() {
256
- if(this.base64Image)return Promise.resolve(this.base64Image)
257
- return this.deserialize(await getMetaObject(this.id))
283
+ if (this.base64Image) return Promise.resolve(this.base64Image);
284
+ return this.deserialize(await getMetaObject(this.id));
258
285
  }
259
- override async post(){
260
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
286
+ override async post() {
287
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
261
288
  }
262
- override async get(){
263
- return this.of(await getState(this.id))
289
+ override async get() {
290
+ return this.of(await getState(this.id));
264
291
  }
265
- override async put(){
266
- return this.of(await putState(this.id,this.type,this.state()))
292
+ override async put() {
293
+ return this.of(await putState(this.id, this.type, this.state()));
267
294
  }
268
- override async delete(){
269
- await deleteState(this.id)
295
+ override async delete() {
296
+ await deleteState(this.id);
270
297
  return this;
271
298
  }
272
- override async analyze(overwrite=false):Promise<this>{
273
- if(overwrite)this.tags = []
299
+ override async analyze(overwrite = false): Promise<this> {
300
+ if (overwrite) this.tags = [];
274
301
  const formData = new FormData();
275
302
  formData.append('files', new Blob([base64ToArrayBuffer(this.base64Image)]));
276
- this.tags.push(...convertTags((await faceAnalyze(formData).send()),'算法'))
277
- return Promise.resolve(this)
303
+ this.tags.push(...convertTags(await faceAnalyze(formData).send(), '算法'));
304
+ return Promise.resolve(this);
278
305
  }
279
306
  }
280
- export class AlovaSceneMeta extends SceneMeta{
307
+ export class AlovaSceneMeta extends SceneMeta {
281
308
  override async getObject() {
282
- if(this.base64Image)return Promise.resolve(this.base64Image)
283
- return this.deserialize(await getMetaObject(this.id))
309
+ if (this.base64Image) return Promise.resolve(this.base64Image);
310
+ return this.deserialize(await getMetaObject(this.id));
284
311
  }
285
- override async post(){
286
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
312
+ override async post() {
313
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
287
314
  }
288
- override async get(){
289
- return this.of(await getState(this.id))
315
+ override async get() {
316
+ return this.of(await getState(this.id));
290
317
  }
291
- override async put(){
292
- return this.of(await putState(this.id,this.type,this.state()))
318
+ override async put() {
319
+ return this.of(await putState(this.id, this.type, this.state()));
293
320
  }
294
- override async delete(){
295
- await deleteState(this.id)
321
+ override async delete() {
322
+ await deleteState(this.id);
296
323
  return this;
297
324
  }
298
325
 
299
- override async analyze(overwrite=false):Promise<this>{
300
- if(overwrite)this.tags = []
301
- return Promise.resolve(this)
326
+ override async analyze(overwrite = false): Promise<this> {
327
+ if (overwrite) this.tags = [];
328
+ return Promise.resolve(this);
302
329
  }
303
330
  }
304
331
  export class AlovaPulsationMeta extends PulsationMeta {
305
332
  override async getObject() {
306
- if(this.waves)return Promise.resolve(this.waves)
307
- return this.deserialize(await getMetaObject(this.id))
333
+ if (this.waves) return Promise.resolve(this.waves);
334
+ return this.deserialize(await getMetaObject(this.id));
308
335
  }
309
- override async post(){
310
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
336
+ override async post() {
337
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
311
338
  }
312
- override async get(){
313
- return this.of(await getState(this.id))
339
+ override async get() {
340
+ return this.of(await getState(this.id));
314
341
  }
315
- override async put(){
316
- return this.of(await putState(this.id,this.type,this.state()))
342
+ override async put() {
343
+ return this.of(await putState(this.id, this.type, this.state()));
317
344
  }
318
- override async delete(){
319
- await deleteState(this.id)
345
+ override async delete() {
346
+ await deleteState(this.id);
320
347
  return this;
321
348
  }
322
- override async analyze(overwrite=false) : Promise<this>{
323
- if(overwrite)this.tags = []
324
- const pulsation = {} as {[key: string]:number[]}
325
- for (const key in this.waves?.origin){
326
- pulsation[key] = this.waves.origin[key]!.values
349
+ override async analyze(overwrite = false): Promise<this> {
350
+ if (overwrite) this.tags = [];
351
+ const pulsation = {} as { [key: string]: number[] };
352
+ for (const key in this.waves?.origin) {
353
+ pulsation[key] = this.waves.origin[key].values;
327
354
  }
328
- this.tags.push(...convertTags((await pulsationAnalysis(pulsation).send()),'算法'))
329
- return Promise.resolve(this)
355
+ this.tags.push(...convertTags(await pulsationAnalysis(pulsation).send(), '算法'));
356
+ return Promise.resolve(this);
330
357
  }
331
358
  override preprocess(origins: { [key: string]: number[] }): Promise<{ [key: string]: number[] }> {
332
- return pulsationPreprocessing(origins)
359
+ return pulsationPreprocessing(origins);
333
360
  }
334
361
  }
335
362
  export class AlovaPPGMeta extends PPGMeta {
336
363
  override async getObject() {
337
- if(this.waves)return Promise.resolve(this.waves)
338
- return this.deserialize(await getMetaObject(this.id))
364
+ if (this.waves) return Promise.resolve(this.waves);
365
+ return this.deserialize(await getMetaObject(this.id));
339
366
  }
340
- override async post(){
341
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
367
+ override async post() {
368
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
342
369
  }
343
- override async get(){
344
- return this.of(await getState(this.id))
370
+ override async get() {
371
+ return this.of(await getState(this.id));
345
372
  }
346
- override async put(){
347
- return this.of(await putState(this.id,this.type,this.state()))
373
+ override async put() {
374
+ return this.of(await putState(this.id, this.type, this.state()));
348
375
  }
349
- override async delete(){
350
- await deleteState(this.id)
376
+ override async delete() {
377
+ await deleteState(this.id);
351
378
  return this;
352
379
  }
353
- override async analyze(overwrite=false):Promise<this>{
354
- if(overwrite)this.tags = []
355
- const waves = {} as {[key: string]:number[]}
356
- for (const key in this.waves?.origin){
357
- waves[key] = this.waves.origin[key]!.values
380
+ override async analyze(overwrite = false): Promise<this> {
381
+ if (overwrite) this.tags = [];
382
+ const waves = {} as { [key: string]: number[] };
383
+ for (const key in this.waves?.origin) {
384
+ waves[key] = this.waves.origin[key].values;
358
385
  }
359
- this.tags.push(...convertTags((await analysisLisems(waves).send()),'算法'))
360
- return Promise.resolve(this)
386
+ this.tags.push(...convertTags(await analysisLisems(waves).send(), '算法'));
387
+ return Promise.resolve(this);
361
388
  }
362
389
  override preprocess(origins: { [key: string]: number[] }): Promise<{ [key: string]: number[] }> {
363
- return Promise.resolve(origins)
390
+ return Promise.resolve(origins);
364
391
  }
365
392
  }
366
393
  export class AlovaPCGMeta extends PCGMeta {
367
394
  override async getObject() {
368
- if(this.waves)return Promise.resolve(this.waves)
369
- return this.deserialize(await getMetaObject(this.id))
395
+ if (this.waves) return Promise.resolve(this.waves);
396
+ return this.deserialize(await getMetaObject(this.id));
370
397
  }
371
- override async post(){
372
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
398
+ override async post() {
399
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
373
400
  }
374
- override async get(){
375
- return this.of(await getState(this.id))
401
+ override async get() {
402
+ return this.of(await getState(this.id));
376
403
  }
377
- override async put(){
378
- return this.of(await putState(this.id,this.type,this.state()))
404
+ override async put() {
405
+ return this.of(await putState(this.id, this.type, this.state()));
379
406
  }
380
- override async delete(){
381
- await deleteState(this.id)
407
+ override async delete() {
408
+ await deleteState(this.id);
382
409
  return this;
383
410
  }
384
- override async analyze(overwrite=false):Promise<this>{
385
- if(overwrite)this.tags = []
386
- const waves = {} as {[key: string]:number[]}
387
- for (const key in this.waves?.origin){
388
- waves[key] = this.waves.origin[key]!.values
411
+ override async analyze(overwrite = false): Promise<this> {
412
+ if (overwrite) this.tags = [];
413
+ const waves = {} as { [key: string]: number[] };
414
+ for (const key in this.waves?.origin) {
415
+ waves[key] = this.waves.origin[key].values;
389
416
  }
390
- this.tags.push(...convertTags((await analysisLisems(waves).send()),'算法'))
391
- return Promise.resolve(this)
417
+ this.tags.push(...convertTags(await analysisLisems(waves).send(), '算法'));
418
+ return Promise.resolve(this);
392
419
  }
393
420
  override preprocess(origins: { [key: string]: number[] }): Promise<{ [key: string]: number[] }> {
394
- return Promise.resolve(origins)
421
+ return Promise.resolve(origins);
395
422
  }
396
423
  }
397
424
  export class AlovaECGMeta extends ECGMeta {
398
425
  override async getObject() {
399
- if(this.waves)return Promise.resolve(this.waves)
400
- return this.deserialize(await getMetaObject(this.id))
426
+ if (this.waves) return Promise.resolve(this.waves);
427
+ return this.deserialize(await getMetaObject(this.id));
401
428
  }
402
- override async post(){
403
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
429
+ override async post() {
430
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
404
431
  }
405
- override async get(){
406
- return this.of(await getState(this.id))
432
+ override async get() {
433
+ return this.of(await getState(this.id));
407
434
  }
408
- override async put(){
409
- return this.of(await putState(this.id,this.type,this.state()))
435
+ override async put() {
436
+ return this.of(await putState(this.id, this.type, this.state()));
410
437
  }
411
- override async delete(){
412
- await deleteState(this.id)
438
+ override async delete() {
439
+ await deleteState(this.id);
413
440
  return this;
414
441
  }
415
- override async analyze(overwrite=false):Promise<this>{
416
- if(overwrite)this.tags = []
417
- const waves = {} as {[key: string]:number[]}
418
- for (const key in this.waves?.origin){
419
- waves[key] = this.waves.origin[key]!.values
442
+ override async analyze(overwrite = false): Promise<this> {
443
+ if (overwrite) this.tags = [];
444
+ const waves = {} as { [key: string]: number[] };
445
+ for (const key in this.waves?.origin) {
446
+ waves[key] = this.waves.origin[key].values;
420
447
  }
421
- this.tags.push(...convertTags((await analysisLisems(waves).send()),'算法'))
422
- return Promise.resolve(this)
448
+ this.tags.push(...convertTags(await analysisLisems(waves).send(), '算法'));
449
+ return Promise.resolve(this);
423
450
  }
424
451
  override preprocess(origins: { [key: string]: number[] }): Promise<{ [key: string]: number[] }> {
425
- return Promise.resolve(origins)
452
+ return Promise.resolve(origins);
426
453
  }
427
454
  }
428
455
  export class AlovaAppendixMeta extends AppendixMeta {
429
456
  override async getObject() {
430
- if(this.base64Images.length)return Promise.resolve(this.base64Images)
431
- return this.deserialize(await getMetaObject(this.id))
457
+ if (this.base64Images.length) return Promise.resolve(this.base64Images);
458
+ return this.deserialize(await getMetaObject(this.id));
432
459
  }
433
- override async post(){
434
- return this.of(await postState(this.owner.id,this.type,this.serialize()))
460
+ override async post() {
461
+ return this.of(await postState(this.owner.id, this.type, this.serialize()));
435
462
  }
436
- override async get(){
437
- return this.of(await getState(this.id))
463
+ override async get() {
464
+ return this.of(await getState(this.id));
438
465
  }
439
- override async put(){
440
- return this.of(await putState(this.id,this.type,this.state()))
466
+ override async put() {
467
+ return this.of(await putState(this.id, this.type, this.state()));
441
468
  }
442
- override async delete(){
443
- await deleteState(this.id)
469
+ override async delete() {
470
+ await deleteState(this.id);
444
471
  return this;
445
472
  }
446
- override async analyze(overwrite=false):Promise<this>{
447
- if(overwrite)this.tags = []
448
- return Promise.resolve(this)
473
+ override async analyze(overwrite = false): Promise<this> {
474
+ if (overwrite) this.tags = [];
475
+ return Promise.resolve(this);
449
476
  }
450
477
  }
451
478
  export class AlovaComplaintMeta extends ComplaintMeta {
@@ -466,23 +493,25 @@ export class AlovaComplaintMeta extends ComplaintMeta {
466
493
  await deleteState(this.id);
467
494
  return this;
468
495
  }
469
- override async analyze(overwrite=false):Promise<this>{
470
- if(overwrite)this.tags = []
471
- return Promise.resolve(this)
496
+ override async analyze(overwrite = false): Promise<this> {
497
+ if (overwrite) this.tags = [];
498
+ return Promise.resolve(this);
472
499
  }
473
500
  }
474
- export class AlovaMetas extends Metas{
501
+ export class AlovaMetas extends Metas {
475
502
  static override map(meta: MetaState) {
476
- if (meta.type == MetaType.Pulsation)return new AlovaPulsationMeta().of(meta);
477
- else if(meta.type == MetaType.Tongue)return new AlovaTongueMeta().of(meta);
478
- else if(meta.type == MetaType.Complaint)return new AlovaComplaintMeta().of(meta);
479
- else if(meta.type == MetaType.Face)return new AlovaFaceMeta().of(meta);
480
- else if(meta.type == MetaType.Appendix)return new AlovaAppendixMeta().of(meta);
481
- else if(meta.type == MetaType.ECG)return new AlovaECGMeta().of(meta);
482
- else if(meta.type == MetaType.PCG)return new AlovaPCGMeta().of(meta);
483
- else if(meta.type == MetaType.Scene)return new AlovaSceneMeta().of(meta);
484
- else if(meta.type == MetaType.PPG)return new AlovaPPGMeta().of(meta);
485
- else if(meta.type == MetaType.Meta)return new AlovaMeta().of(meta);
503
+ //将string转Type
504
+ const type = MetaType[meta.type]
505
+ if (type == MetaType.Pulsation) return new AlovaPulsationMeta().of(meta);
506
+ else if (type == MetaType.Tongue) return new AlovaTongueMeta().of(meta);
507
+ else if (type == MetaType.Complaint) return new AlovaComplaintMeta().of(meta);
508
+ else if (type == MetaType.Face) return new AlovaFaceMeta().of(meta);
509
+ else if (type == MetaType.Appendix) return new AlovaAppendixMeta().of(meta);
510
+ else if (type == MetaType.ECG) return new AlovaECGMeta().of(meta);
511
+ else if (type == MetaType.PCG) return new AlovaPCGMeta().of(meta);
512
+ else if (type == MetaType.Scene) return new AlovaSceneMeta().of(meta);
513
+ else if (type == MetaType.PPG) return new AlovaPPGMeta().of(meta);
514
+ else if (type == MetaType.Meta) return new AlovaMeta().of(meta);
486
515
  else throw new Error('未知的Meta类型');
487
516
  }
488
517
  }