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.
- package/package.json +38 -21
- package/quasar.config.ts +28 -15
- package/src/api/algorithm/comprehensiveAlgorithm.ts +1 -1
- package/src/api/algorithm/index.ts +7 -7
- package/src/api/algorithm/inquiriesAlgorithm.ts +4 -7
- package/src/api/algorithm/inspectionsAlgorithm.ts +1 -1
- package/src/api/algorithm/lisemsAlgorithm.ts +3 -3
- package/src/api/algorithm/pulsationsAlgorithm.ts +2 -3
- package/src/api/authorization/alova/apiDefinitions.ts +2 -2
- package/src/api/authorization/alova/createApis.ts +22 -7
- package/src/api/authorization/alova/globals.d.ts +35 -14
- package/src/api/authorization/alova/implement/authorization.ts +11 -9
- package/src/api/authorization/alova/implement/index.ts +1 -1
- package/src/api/authorization/alova/index.ts +4 -5
- package/src/api/authorization/authorization.ts +6 -6
- package/src/api/authorization/index.ts +1 -1
- package/src/api/check/alova/apiDefinitions.ts +2 -2
- package/src/api/check/alova/createApis.ts +22 -7
- package/src/api/check/alova/globals.d.ts +29 -20
- package/src/api/check/alova/implement/check.ts +145 -99
- package/src/api/check/alova/implement/index.ts +1 -1
- package/src/api/check/alova/index.ts +4 -5
- package/src/api/check/check.ts +116 -63
- package/src/api/check/index.ts +1 -1
- package/src/api/config/alova/index.ts +26 -27
- package/src/api/config/index.ts +59 -57
- package/src/api/doctor/alova/apiDefinitions.ts +2 -2
- package/src/api/doctor/alova/createApis.ts +22 -7
- package/src/api/doctor/alova/globals.d.ts +27 -18
- package/src/api/doctor/alova/implement/doctor.ts +38 -24
- package/src/api/doctor/alova/implement/index.ts +1 -1
- package/src/api/doctor/alova/index.ts +4 -4
- package/src/api/doctor/doctor.ts +18 -18
- package/src/api/doctor/index.ts +1 -1
- package/src/api/index.ts +12 -15
- package/src/api/metric/implement/index.ts +1 -1
- package/src/api/metric/implement/metric.ts +44 -34
- package/src/api/metric/index.ts +1 -1
- package/src/api/metric/metric.ts +36 -36
- package/src/api/oauth/alova/apiDefinitions.ts +2 -2
- package/src/api/oauth/alova/createApis.ts +22 -7
- package/src/api/oauth/alova/globals.d.ts +25 -16
- package/src/api/oauth/alova/implement/index.ts +1 -1
- package/src/api/oauth/alova/implement/oauth.ts +20 -15
- package/src/api/oauth/alova/index.ts +4 -5
- package/src/api/oauth/index.ts +1 -1
- package/src/api/oauth/oauth.ts +9 -5
- package/src/api/outpatient/alova/apiDefinitions.ts +2 -2
- package/src/api/outpatient/alova/createApis.ts +22 -7
- package/src/api/outpatient/alova/globals.d.ts +25 -16
- package/src/api/outpatient/alova/implement/index.ts +1 -1
- package/src/api/outpatient/alova/implement/outpatient.ts +76 -51
- package/src/api/outpatient/alova/index.ts +4 -5
- package/src/api/outpatient/index.ts +1 -1
- package/src/api/outpatient/outpatient.ts +29 -24
- package/src/api/patient/alova/apiDefinitions.ts +2 -2
- package/src/api/patient/alova/createApis.ts +22 -7
- package/src/api/patient/alova/globals.d.ts +56 -43
- package/src/api/patient/alova/implement/index.ts +1 -1
- package/src/api/patient/alova/implement/meta.ts +253 -224
- package/src/api/patient/alova/implement/patient.ts +79 -57
- package/src/api/patient/alova/index.ts +3 -5
- package/src/api/patient/core.ts +51 -49
- package/src/api/patient/index.ts +1 -1
- package/src/api/patient/meta.ts +244 -140
- package/src/api/patient/patient.ts +25 -25
- package/src/api/prescription/alova/apiDefinitions.ts +2 -2
- package/src/api/prescription/alova/createApis.ts +22 -7
- package/src/api/prescription/alova/globals.d.ts +32 -23
- package/src/api/prescription/alova/implement/herbal.ts +59 -39
- package/src/api/prescription/alova/implement/index.ts +1 -1
- package/src/api/prescription/alova/implement/prescription.ts +50 -33
- package/src/api/prescription/alova/index.ts +4 -5
- package/src/api/prescription/herbal.ts +17 -10
- package/src/api/prescription/index.ts +1 -1
- package/src/api/prescription/prescription.ts +35 -27
- package/src/api/scientist/alova/apiDefinitions.ts +2 -2
- package/src/api/scientist/alova/createApis.ts +22 -7
- package/src/api/scientist/alova/globals.d.ts +25 -16
- package/src/api/scientist/alova/implement/index.ts +1 -1
- package/src/api/scientist/alova/implement/scientist.ts +31 -20
- package/src/api/scientist/alova/index.ts +5 -4
- package/src/api/scientist/index.ts +1 -1
- package/src/api/scientist/scientist.ts +20 -20
- package/src/index.ts +3 -4
- package/src/layouts/UserLayout.vue +9 -7
- package/src/pages/LoginPage.vue +2 -5
- package/src/proto/types/Images_pb.ts +13 -13
- package/src/proto/types/WaveMap_pb.ts +13 -13
- package/src/router/routes.ts +2 -2
- package/src/util/export.ts +4 -4
- package/src/util/helper.ts +6 -6
- package/src/util/image.ts +1 -1
- package/src/util/number.ts +4 -4
- package/src/util/s256.js +1 -4
- package/src/util/secret.ts +1 -1
- package/src/util/string.ts +18 -18
- package/tsconfig.json +5 -1
|
@@ -19,7 +19,11 @@ import { Method } from 'alova';
|
|
|
19
19
|
import apiDefinitions from './apiDefinitions';
|
|
20
20
|
|
|
21
21
|
const cache = Object.create(null);
|
|
22
|
-
const createFunctionalProxy = (
|
|
22
|
+
const createFunctionalProxy = (
|
|
23
|
+
array: (string | symbol)[],
|
|
24
|
+
alovaInstance: Alova<AlovaGenerics>,
|
|
25
|
+
configMap: any,
|
|
26
|
+
) => {
|
|
23
27
|
const apiPathKey = array.join('.') as keyof typeof apiDefinitions;
|
|
24
28
|
if (cache[apiPathKey]) {
|
|
25
29
|
return cache[apiPathKey];
|
|
@@ -39,7 +43,7 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
39
43
|
}
|
|
40
44
|
const mergedConfig = {
|
|
41
45
|
...configMap[apiPathKey],
|
|
42
|
-
...config
|
|
46
|
+
...config,
|
|
43
47
|
};
|
|
44
48
|
const [method, url] = apiItem;
|
|
45
49
|
const pathParams = mergedConfig.pathParams;
|
|
@@ -49,7 +53,10 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
49
53
|
});
|
|
50
54
|
delete mergedConfig.pathParams;
|
|
51
55
|
let data = mergedConfig.data;
|
|
52
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
Object.prototype.toString.call(data) === '[object Object]' &&
|
|
58
|
+
typeof FormData !== 'undefined'
|
|
59
|
+
) {
|
|
53
60
|
let hasBlobData = false;
|
|
54
61
|
const formData = new FormData();
|
|
55
62
|
for (const key in data) {
|
|
@@ -60,8 +67,14 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
60
67
|
}
|
|
61
68
|
data = hasBlobData ? formData : data;
|
|
62
69
|
}
|
|
63
|
-
return new Method(
|
|
64
|
-
|
|
70
|
+
return new Method(
|
|
71
|
+
method!.toUpperCase() as MethodType,
|
|
72
|
+
alovaInstance,
|
|
73
|
+
urlReplaced,
|
|
74
|
+
mergedConfig,
|
|
75
|
+
data,
|
|
76
|
+
);
|
|
77
|
+
},
|
|
65
78
|
});
|
|
66
79
|
cache[apiPathKey] = proxy;
|
|
67
80
|
return proxy;
|
|
@@ -71,7 +84,7 @@ export const createApis = (alovaInstance: Alova<AlovaGenerics>, configMap: any)
|
|
|
71
84
|
const Apis = new Proxy({} as oauthApi, {
|
|
72
85
|
get(_, property) {
|
|
73
86
|
return createFunctionalProxy([property], alovaInstance, configMap);
|
|
74
|
-
}
|
|
87
|
+
},
|
|
75
88
|
});
|
|
76
89
|
return Apis;
|
|
77
90
|
};
|
|
@@ -93,7 +106,9 @@ type APISofParameters<Tag extends string, Url extends string> = Tag extends keyo
|
|
|
93
106
|
: any;
|
|
94
107
|
type MethodsConfigMap = {
|
|
95
108
|
[P in keyof typeof import('./apiDefinitions').default]?: MethodConfig<
|
|
96
|
-
P extends `${infer Tag}.${infer Url}`
|
|
109
|
+
P extends `${infer Tag}.${infer Url}`
|
|
110
|
+
? Parameters<NonNullable<APISofParameters<Tag, Url>[0]>['transform']>[0]
|
|
111
|
+
: any
|
|
97
112
|
>;
|
|
98
113
|
};
|
|
99
114
|
export const withConfigType = <Config extends MethodsConfigMap>(config: Config) => config;
|
|
@@ -36,7 +36,16 @@ type Alova2MethodConfig<Responded> =
|
|
|
36
36
|
>
|
|
37
37
|
? Omit<
|
|
38
38
|
AlovaMethodCreateConfig<
|
|
39
|
-
AlovaGenerics<
|
|
39
|
+
AlovaGenerics<
|
|
40
|
+
Responded,
|
|
41
|
+
any,
|
|
42
|
+
RequestConfig,
|
|
43
|
+
Response,
|
|
44
|
+
ResponseHeader,
|
|
45
|
+
L1Cache,
|
|
46
|
+
L2Cache,
|
|
47
|
+
SE
|
|
48
|
+
>,
|
|
40
49
|
any,
|
|
41
50
|
Responded
|
|
42
51
|
>,
|
|
@@ -47,7 +56,7 @@ type Alova2MethodConfig<Responded> =
|
|
|
47
56
|
// Extract the return type of transform function that define in $$userConfigMap, if it not exists, use the default type.
|
|
48
57
|
type ExtractUserDefinedTransformed<
|
|
49
58
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
50
|
-
Default
|
|
59
|
+
Default,
|
|
51
60
|
> = DefinitionKey extends keyof UserMethodConfigMap
|
|
52
61
|
? UserMethodConfigMap[DefinitionKey]['transform'] extends (...args: any[]) => any
|
|
53
62
|
? Awaited<ReturnType<UserMethodConfigMap[DefinitionKey]['transform']>>
|
|
@@ -56,7 +65,7 @@ type ExtractUserDefinedTransformed<
|
|
|
56
65
|
type Alova2Method<
|
|
57
66
|
Responded,
|
|
58
67
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
59
|
-
CurrentConfig extends Alova2MethodConfig<any
|
|
68
|
+
CurrentConfig extends Alova2MethodConfig<any>,
|
|
60
69
|
> =
|
|
61
70
|
CollapsedAlova extends Alova<
|
|
62
71
|
AlovaGenerics<
|
|
@@ -182,7 +191,7 @@ declare global {
|
|
|
182
191
|
* ```
|
|
183
192
|
*/
|
|
184
193
|
getUserState<Config extends Alova2MethodConfig<UserGetResponse>>(
|
|
185
|
-
config?: Config
|
|
194
|
+
config?: Config,
|
|
186
195
|
): Alova2Method<UserGetResponse, 'userStateRestful.getUserState', Config>;
|
|
187
196
|
/**
|
|
188
197
|
* ---
|
|
@@ -227,9 +236,9 @@ declare global {
|
|
|
227
236
|
putUserState<
|
|
228
237
|
Config extends Alova2MethodConfig<UserPutResponse> & {
|
|
229
238
|
data: UserState;
|
|
230
|
-
}
|
|
239
|
+
},
|
|
231
240
|
>(
|
|
232
|
-
config: Config
|
|
241
|
+
config: Config,
|
|
233
242
|
): Alova2Method<UserPutResponse, 'userStateRestful.putUserState', Config>;
|
|
234
243
|
};
|
|
235
244
|
phoneVerifyRestful: {
|
|
@@ -276,9 +285,9 @@ declare global {
|
|
|
276
285
|
verifySMSCode<
|
|
277
286
|
Config extends Alova2MethodConfig<PhoneVerifyResponse> & {
|
|
278
287
|
data: PhoneVerifyRequest;
|
|
279
|
-
}
|
|
288
|
+
},
|
|
280
289
|
>(
|
|
281
|
-
config: Config
|
|
290
|
+
config: Config,
|
|
282
291
|
): Alova2Method<PhoneVerifyResponse, 'phoneVerifyRestful.verifySMSCode', Config>;
|
|
283
292
|
/**
|
|
284
293
|
* ---
|
|
@@ -323,9 +332,9 @@ declare global {
|
|
|
323
332
|
params: {
|
|
324
333
|
phoneNumber: string;
|
|
325
334
|
};
|
|
326
|
-
}
|
|
335
|
+
},
|
|
327
336
|
>(
|
|
328
|
-
config: Config
|
|
337
|
+
config: Config,
|
|
329
338
|
): Alova2Method<SendSmsVerifyCodeResponse, 'phoneVerifyRestful.sendSMSCode', Config>;
|
|
330
339
|
/**
|
|
331
340
|
* ---
|
|
@@ -367,9 +376,9 @@ declare global {
|
|
|
367
376
|
params: {
|
|
368
377
|
bizType: number;
|
|
369
378
|
};
|
|
370
|
-
}
|
|
379
|
+
},
|
|
371
380
|
>(
|
|
372
|
-
config: Config
|
|
381
|
+
config: Config,
|
|
373
382
|
): Alova2Method<GetAuthTokenResponse, 'phoneVerifyRestful.authToken', Config>;
|
|
374
383
|
};
|
|
375
384
|
authorizationRestful: {
|
|
@@ -405,9 +414,9 @@ declare global {
|
|
|
405
414
|
scope: string;
|
|
406
415
|
state: string;
|
|
407
416
|
};
|
|
408
|
-
}
|
|
417
|
+
},
|
|
409
418
|
>(
|
|
410
|
-
config: Config
|
|
419
|
+
config: Config,
|
|
411
420
|
): Alova2Method<string, 'authorizationRestful.consent', Config>;
|
|
412
421
|
/**
|
|
413
422
|
* ---
|
|
@@ -440,9 +449,9 @@ declare global {
|
|
|
440
449
|
params: {
|
|
441
450
|
client_id: string;
|
|
442
451
|
};
|
|
443
|
-
}
|
|
452
|
+
},
|
|
444
453
|
>(
|
|
445
|
-
config: Config
|
|
454
|
+
config: Config,
|
|
446
455
|
): Alova2Method<GetClientResponse, 'authorizationRestful.getClientDescription', Config>;
|
|
447
456
|
};
|
|
448
457
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './oauth';
|
|
1
|
+
export * from './oauth';
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { OAuth } from '
|
|
2
|
-
import { alovaInstance } from '
|
|
1
|
+
import { OAuth } from 'src/api/oauth/oauth';
|
|
2
|
+
import { alovaInstance } from 'src/api/oauth/alova';
|
|
3
3
|
|
|
4
|
-
export class AlovaOAuth extends OAuth{
|
|
5
|
-
static override async getYincToken(
|
|
4
|
+
export class AlovaOAuth extends OAuth {
|
|
5
|
+
static override async getYincToken(
|
|
6
|
+
code: string,
|
|
7
|
+
redirect_uri: string,
|
|
8
|
+
client_id: string,
|
|
9
|
+
code_verifier: string,
|
|
10
|
+
) {
|
|
6
11
|
const formData = new FormData();
|
|
7
|
-
formData.append('code', code)
|
|
8
|
-
formData.append('grant_type', 'authorization_code')
|
|
9
|
-
formData.append('redirect_uri', redirect_uri)
|
|
10
|
-
formData.append('client_id', client_id)
|
|
11
|
-
formData.append('code_verifier', code_verifier)
|
|
12
|
-
const method = alovaInstance.Post<string>('/互联/服务/互联/令牌',formData,{
|
|
13
|
-
transform(data){
|
|
14
|
-
return (data as { access_token: string }).access_token
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
return method.send()
|
|
12
|
+
formData.append('code', code);
|
|
13
|
+
formData.append('grant_type', 'authorization_code');
|
|
14
|
+
formData.append('redirect_uri', redirect_uri);
|
|
15
|
+
formData.append('client_id', client_id);
|
|
16
|
+
formData.append('code_verifier', code_verifier);
|
|
17
|
+
const method = alovaInstance.Post<string>('/互联/服务/互联/令牌', formData, {
|
|
18
|
+
transform(data) {
|
|
19
|
+
return (data as { access_token: string }).access_token;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return method.send();
|
|
18
23
|
}
|
|
19
24
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import fetchAdapter from 'alova/fetch';
|
|
3
3
|
import { createApis, withConfigType, mountApis } from './createApis';
|
|
4
|
-
import { responded } from '
|
|
5
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
4
|
+
import { responded } from 'src/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from 'src/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.OAuth),
|
|
9
9
|
requestAdapter: fetchAdapter(),
|
|
10
10
|
cacheFor: null,
|
|
11
|
-
responded: responded
|
|
11
|
+
responded: responded,
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
export const $$userConfigMap = withConfigType({});
|
|
@@ -18,5 +18,4 @@ const Apis = createApis(alovaInstance, $$userConfigMap);
|
|
|
18
18
|
mountApis(Apis);
|
|
19
19
|
|
|
20
20
|
export default Apis;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
export * from './implement';
|
package/src/api/oauth/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './oauth';
|
|
2
|
-
export * from './alova
|
|
2
|
+
export * from './alova';
|
package/src/api/oauth/oauth.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import type { IBuilder } from 'builder-pattern';
|
|
2
2
|
import { Builder } from 'builder-pattern';
|
|
3
3
|
export abstract class OAuth {
|
|
4
|
-
static _default: typeof OAuth
|
|
5
|
-
static builder(): IBuilder<OAuth>{
|
|
4
|
+
static _default: typeof OAuth;
|
|
5
|
+
static builder(): IBuilder<OAuth> {
|
|
6
6
|
return Builder(this._default) as unknown as IBuilder<OAuth>;
|
|
7
7
|
}
|
|
8
8
|
static default(): typeof OAuth {
|
|
9
9
|
return this._default as unknown as typeof OAuth;
|
|
10
10
|
}
|
|
11
|
-
static getYincToken(
|
|
12
|
-
|
|
11
|
+
static getYincToken(
|
|
12
|
+
code: string,
|
|
13
|
+
redirect_uri: string,
|
|
14
|
+
client_id: string,
|
|
15
|
+
code_verifier: string,
|
|
16
|
+
): Promise<string> {
|
|
17
|
+
return OAuth.default().getYincToken(code, redirect_uri, client_id, code_verifier);
|
|
13
18
|
}
|
|
14
19
|
}
|
|
15
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types='./globals.d.ts' />
|
|
2
2
|
/* tslint:disable */
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* OpenAPI definition - version v0
|
|
6
6
|
*
|
|
@@ -23,5 +23,5 @@ export default {
|
|
|
23
23
|
'queuerRestful.postQueuerState': ['POST', '/门诊/服务/排队'],
|
|
24
24
|
'metricRestful.datesOfQueuerState': ['GET', '/门诊/服务/统计/排队/日期'],
|
|
25
25
|
'metricRestful.totalOfQueuerState': ['GET', '/门诊/服务/统计/排队/总数'],
|
|
26
|
-
'metricRestful.totalOfQueuerTodayState': ['GET', '/门诊/服务/统计/排队/今日']
|
|
26
|
+
'metricRestful.totalOfQueuerTodayState': ['GET', '/门诊/服务/统计/排队/今日'],
|
|
27
27
|
};
|
|
@@ -19,7 +19,11 @@ import { Method } from 'alova';
|
|
|
19
19
|
import apiDefinitions from './apiDefinitions';
|
|
20
20
|
|
|
21
21
|
const cache = Object.create(null);
|
|
22
|
-
const createFunctionalProxy = (
|
|
22
|
+
const createFunctionalProxy = (
|
|
23
|
+
array: (string | symbol)[],
|
|
24
|
+
alovaInstance: Alova<AlovaGenerics>,
|
|
25
|
+
configMap: any,
|
|
26
|
+
) => {
|
|
23
27
|
const apiPathKey = array.join('.') as keyof typeof apiDefinitions;
|
|
24
28
|
if (cache[apiPathKey]) {
|
|
25
29
|
return cache[apiPathKey];
|
|
@@ -39,7 +43,7 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
39
43
|
}
|
|
40
44
|
const mergedConfig = {
|
|
41
45
|
...configMap[apiPathKey],
|
|
42
|
-
...config
|
|
46
|
+
...config,
|
|
43
47
|
};
|
|
44
48
|
const [method, url] = apiItem;
|
|
45
49
|
const pathParams = mergedConfig.pathParams;
|
|
@@ -49,7 +53,10 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
49
53
|
});
|
|
50
54
|
delete mergedConfig.pathParams;
|
|
51
55
|
let data = mergedConfig.data;
|
|
52
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
Object.prototype.toString.call(data) === '[object Object]' &&
|
|
58
|
+
typeof FormData !== 'undefined'
|
|
59
|
+
) {
|
|
53
60
|
let hasBlobData = false;
|
|
54
61
|
const formData = new FormData();
|
|
55
62
|
for (const key in data) {
|
|
@@ -60,8 +67,14 @@ const createFunctionalProxy = (array: (string | symbol)[], alovaInstance: Alova<
|
|
|
60
67
|
}
|
|
61
68
|
data = hasBlobData ? formData : data;
|
|
62
69
|
}
|
|
63
|
-
return new Method(
|
|
64
|
-
|
|
70
|
+
return new Method(
|
|
71
|
+
method!.toUpperCase() as MethodType,
|
|
72
|
+
alovaInstance,
|
|
73
|
+
urlReplaced,
|
|
74
|
+
mergedConfig,
|
|
75
|
+
data,
|
|
76
|
+
);
|
|
77
|
+
},
|
|
65
78
|
});
|
|
66
79
|
cache[apiPathKey] = proxy;
|
|
67
80
|
return proxy;
|
|
@@ -71,7 +84,7 @@ export const createApis = (alovaInstance: Alova<AlovaGenerics>, configMap: any)
|
|
|
71
84
|
const Apis = new Proxy({} as outpatientApi, {
|
|
72
85
|
get(_, property) {
|
|
73
86
|
return createFunctionalProxy([property], alovaInstance, configMap);
|
|
74
|
-
}
|
|
87
|
+
},
|
|
75
88
|
});
|
|
76
89
|
return Apis;
|
|
77
90
|
};
|
|
@@ -93,7 +106,9 @@ type APISofParameters<Tag extends string, Url extends string> = Tag extends keyo
|
|
|
93
106
|
: any;
|
|
94
107
|
type MethodsConfigMap = {
|
|
95
108
|
[P in keyof typeof import('./apiDefinitions').default]?: MethodConfig<
|
|
96
|
-
P extends `${infer Tag}.${infer Url}`
|
|
109
|
+
P extends `${infer Tag}.${infer Url}`
|
|
110
|
+
? Parameters<NonNullable<APISofParameters<Tag, Url>[0]>['transform']>[0]
|
|
111
|
+
: any
|
|
97
112
|
>;
|
|
98
113
|
};
|
|
99
114
|
export const withConfigType = <Config extends MethodsConfigMap>(config: Config) => config;
|
|
@@ -36,7 +36,16 @@ type Alova2MethodConfig<Responded> =
|
|
|
36
36
|
>
|
|
37
37
|
? Omit<
|
|
38
38
|
AlovaMethodCreateConfig<
|
|
39
|
-
AlovaGenerics<
|
|
39
|
+
AlovaGenerics<
|
|
40
|
+
Responded,
|
|
41
|
+
any,
|
|
42
|
+
RequestConfig,
|
|
43
|
+
Response,
|
|
44
|
+
ResponseHeader,
|
|
45
|
+
L1Cache,
|
|
46
|
+
L2Cache,
|
|
47
|
+
SE
|
|
48
|
+
>,
|
|
40
49
|
any,
|
|
41
50
|
Responded
|
|
42
51
|
>,
|
|
@@ -47,7 +56,7 @@ type Alova2MethodConfig<Responded> =
|
|
|
47
56
|
// Extract the return type of transform function that define in $$userConfigMap, if it not exists, use the default type.
|
|
48
57
|
type ExtractUserDefinedTransformed<
|
|
49
58
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
50
|
-
Default
|
|
59
|
+
Default,
|
|
51
60
|
> = DefinitionKey extends keyof UserMethodConfigMap
|
|
52
61
|
? UserMethodConfigMap[DefinitionKey]['transform'] extends (...args: any[]) => any
|
|
53
62
|
? Awaited<ReturnType<UserMethodConfigMap[DefinitionKey]['transform']>>
|
|
@@ -56,7 +65,7 @@ type ExtractUserDefinedTransformed<
|
|
|
56
65
|
type Alova2Method<
|
|
57
66
|
Responded,
|
|
58
67
|
DefinitionKey extends keyof typeof apiDefinitions,
|
|
59
|
-
CurrentConfig extends Alova2MethodConfig<any
|
|
68
|
+
CurrentConfig extends Alova2MethodConfig<any>,
|
|
60
69
|
> =
|
|
61
70
|
CollapsedAlova extends Alova<
|
|
62
71
|
AlovaGenerics<
|
|
@@ -232,9 +241,9 @@ declare global {
|
|
|
232
241
|
pathParams: {
|
|
233
242
|
id: string;
|
|
234
243
|
};
|
|
235
|
-
}
|
|
244
|
+
},
|
|
236
245
|
>(
|
|
237
|
-
config: Config
|
|
246
|
+
config: Config,
|
|
238
247
|
): Alova2Method<QueuerState, 'queuerRestful.getQueuerState', Config>;
|
|
239
248
|
/**
|
|
240
249
|
* ---
|
|
@@ -356,9 +365,9 @@ declare global {
|
|
|
356
365
|
id: string;
|
|
357
366
|
};
|
|
358
367
|
data: QueuerState;
|
|
359
|
-
}
|
|
368
|
+
},
|
|
360
369
|
>(
|
|
361
|
-
config: Config
|
|
370
|
+
config: Config,
|
|
362
371
|
): Alova2Method<QueuerState, 'queuerRestful.putQueuerState', Config>;
|
|
363
372
|
/**
|
|
364
373
|
* ---
|
|
@@ -388,9 +397,9 @@ declare global {
|
|
|
388
397
|
pathParams: {
|
|
389
398
|
id: string;
|
|
390
399
|
};
|
|
391
|
-
}
|
|
400
|
+
},
|
|
392
401
|
>(
|
|
393
|
-
config: Config
|
|
402
|
+
config: Config,
|
|
394
403
|
): Alova2Method<null, 'queuerRestful.deleteQueuerState', Config>;
|
|
395
404
|
/**
|
|
396
405
|
* ---
|
|
@@ -497,9 +506,9 @@ declare global {
|
|
|
497
506
|
page: number;
|
|
498
507
|
pageSize: number;
|
|
499
508
|
};
|
|
500
|
-
}
|
|
509
|
+
},
|
|
501
510
|
>(
|
|
502
|
-
config: Config
|
|
511
|
+
config: Config,
|
|
503
512
|
): Alova2Method<PageQueuerState, 'queuerRestful.queryQueuerState', Config>;
|
|
504
513
|
/**
|
|
505
514
|
* ---
|
|
@@ -609,9 +618,9 @@ declare global {
|
|
|
609
618
|
postQueuerState<
|
|
610
619
|
Config extends Alova2MethodConfig<QueuerState> & {
|
|
611
620
|
data: QueuerState;
|
|
612
|
-
}
|
|
621
|
+
},
|
|
613
622
|
>(
|
|
614
|
-
config: Config
|
|
623
|
+
config: Config,
|
|
615
624
|
): Alova2Method<QueuerState, 'queuerRestful.postQueuerState', Config>;
|
|
616
625
|
};
|
|
617
626
|
metricRestful: {
|
|
@@ -633,7 +642,7 @@ declare global {
|
|
|
633
642
|
* ```
|
|
634
643
|
*/
|
|
635
644
|
datesOfQueuerState<Config extends Alova2MethodConfig<DateDistribute[]>>(
|
|
636
|
-
config?: Config
|
|
645
|
+
config?: Config,
|
|
637
646
|
): Alova2Method<DateDistribute[], 'metricRestful.datesOfQueuerState', Config>;
|
|
638
647
|
/**
|
|
639
648
|
* ---
|
|
@@ -650,7 +659,7 @@ declare global {
|
|
|
650
659
|
* ```
|
|
651
660
|
*/
|
|
652
661
|
totalOfQueuerState<Config extends Alova2MethodConfig<number>>(
|
|
653
|
-
config?: Config
|
|
662
|
+
config?: Config,
|
|
654
663
|
): Alova2Method<number, 'metricRestful.totalOfQueuerState', Config>;
|
|
655
664
|
/**
|
|
656
665
|
* ---
|
|
@@ -667,7 +676,7 @@ declare global {
|
|
|
667
676
|
* ```
|
|
668
677
|
*/
|
|
669
678
|
totalOfQueuerTodayState<Config extends Alova2MethodConfig<number>>(
|
|
670
|
-
config?: Config
|
|
679
|
+
config?: Config,
|
|
671
680
|
): Alova2Method<number, 'metricRestful.totalOfQueuerTodayState', Config>;
|
|
672
681
|
};
|
|
673
682
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './outpatient';
|
|
1
|
+
export * from './outpatient';
|
|
@@ -1,66 +1,91 @@
|
|
|
1
|
-
import { Queuer } from '
|
|
2
|
-
import type { Page } from '
|
|
1
|
+
import { Queuer } from 'src/api/outpatient/outpatient';
|
|
2
|
+
import type { Page } from 'src/api/patient/core';
|
|
3
3
|
|
|
4
4
|
export class AlovaQueuer extends Queuer {
|
|
5
5
|
override async get() {
|
|
6
|
-
return this.of(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
return this.of(
|
|
7
|
+
await outpatientApi.queuerRestful
|
|
8
|
+
.getQueuerState({
|
|
9
|
+
pathParams: {
|
|
10
|
+
id: this.id,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
.send(),
|
|
14
|
+
);
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
override async put() {
|
|
14
|
-
return this.of(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
return this.of(
|
|
19
|
+
await outpatientApi.queuerRestful
|
|
20
|
+
.putQueuerState({
|
|
21
|
+
pathParams: {
|
|
22
|
+
id: this.id,
|
|
23
|
+
},
|
|
24
|
+
data: this.state(),
|
|
25
|
+
})
|
|
26
|
+
.send(true),
|
|
27
|
+
);
|
|
20
28
|
}
|
|
21
|
-
override async delete(){
|
|
22
|
-
await outpatientApi.queuerRestful
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
override async delete() {
|
|
30
|
+
await outpatientApi.queuerRestful
|
|
31
|
+
.deleteQueuerState({
|
|
32
|
+
pathParams: {
|
|
33
|
+
id: this.id,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
.send();
|
|
27
37
|
return Promise.resolve(this);
|
|
28
38
|
}
|
|
29
39
|
override async post() {
|
|
30
|
-
return this.of(
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
return this.of(
|
|
41
|
+
await outpatientApi.queuerRestful
|
|
42
|
+
.postQueuerState({
|
|
43
|
+
data: this.state(),
|
|
44
|
+
})
|
|
45
|
+
.send(true),
|
|
46
|
+
);
|
|
33
47
|
}
|
|
34
48
|
|
|
35
|
-
override async putStatus(status?: number){
|
|
36
|
-
if(status)this.status = status
|
|
37
|
-
return this.of(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
override async putStatus(status?: number) {
|
|
50
|
+
if (status) this.status = status;
|
|
51
|
+
return this.of(
|
|
52
|
+
await outpatientApi.queuerRestful
|
|
53
|
+
.putQueuerState({
|
|
54
|
+
pathParams: {
|
|
55
|
+
id: this.id,
|
|
56
|
+
},
|
|
57
|
+
data: {
|
|
58
|
+
status: this.status,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
.send(true),
|
|
62
|
+
);
|
|
45
63
|
}
|
|
46
|
-
static override query(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
static override query(
|
|
65
|
+
page: number,
|
|
66
|
+
pageSize: number,
|
|
67
|
+
doctorId?: string,
|
|
68
|
+
patientId?: string,
|
|
69
|
+
): Promise<Page<Queuer>> {
|
|
70
|
+
return outpatientApi.queuerRestful
|
|
71
|
+
.queryQueuerState({
|
|
72
|
+
params: {
|
|
73
|
+
...(doctorId && { doctorId }),
|
|
74
|
+
...(patientId && { patientId }),
|
|
75
|
+
page: page,
|
|
76
|
+
pageSize,
|
|
77
|
+
},
|
|
78
|
+
async transform(json) {
|
|
79
|
+
return {
|
|
80
|
+
data: await Promise.all(json.content.map((item) => new AlovaQueuer().of(item))),
|
|
81
|
+
total: json.totalElements,
|
|
82
|
+
page: json.number,
|
|
83
|
+
pageSize: json.size,
|
|
84
|
+
pageCount: json.totalPages,
|
|
85
|
+
isLastPage: json.last,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
.send();
|
|
65
90
|
}
|
|
66
91
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import fetchAdapter from 'alova/fetch';
|
|
3
3
|
import { createApis, withConfigType, mountApis } from './createApis';
|
|
4
|
-
import { onAuthRequired, responded } from '
|
|
5
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
4
|
+
import { onAuthRequired, responded } from 'src/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from 'src/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Outpatient),
|
|
9
9
|
requestAdapter: fetchAdapter(),
|
|
10
10
|
beforeRequest: onAuthRequired(() => {}),
|
|
11
11
|
cacheFor: null,
|
|
12
|
-
responded: responded
|
|
12
|
+
responded: responded,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const $$userConfigMap = withConfigType({});
|
|
@@ -19,5 +19,4 @@ const Apis = createApis(alovaInstance, $$userConfigMap);
|
|
|
19
19
|
mountApis(Apis);
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export * from './implement';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './outpatient';
|
|
2
|
-
export * from './alova
|
|
2
|
+
export * from './alova';
|