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
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Page} from '
|
|
2
|
-
import { Tag } from '
|
|
3
|
-
import { NetworkObject } from '
|
|
4
|
-
import type { PatientState } from '
|
|
5
|
-
import { Metas } from '
|
|
1
|
+
import type { Page } from 'src/api/patient/core';
|
|
2
|
+
import { Tag } from 'src/api/patient/core';
|
|
3
|
+
import { NetworkObject } from 'src/api/patient/core';
|
|
4
|
+
import type { PatientState } from 'src/api/patient/alova/globals';
|
|
5
|
+
import { Metas } from 'src/api/patient/meta';
|
|
6
6
|
import type { IBuilder } from 'builder-pattern';
|
|
7
7
|
import { Builder } from 'builder-pattern';
|
|
8
|
-
import { getName } from '
|
|
8
|
+
import { getName } from 'src/util/string';
|
|
9
9
|
|
|
10
10
|
export abstract class Patient extends NetworkObject {
|
|
11
|
-
static override builder(): IBuilder<Patient>{
|
|
11
|
+
static override builder(): IBuilder<Patient> {
|
|
12
12
|
return Builder(this._default) as unknown as IBuilder<Patient>;
|
|
13
13
|
}
|
|
14
14
|
static override default(): typeof Patient {
|
|
@@ -29,32 +29,32 @@ export abstract class Patient extends NetworkObject {
|
|
|
29
29
|
mainSymptom = '';
|
|
30
30
|
metas: Metas = Metas.builder().build();
|
|
31
31
|
init(id?: string, metas?: Metas) {
|
|
32
|
-
if(id)this.id = id;
|
|
33
|
-
if(metas)this.metas = metas;
|
|
34
|
-
this.metas.init(this)
|
|
32
|
+
if (id) this.id = id;
|
|
33
|
+
if (metas) this.metas = metas;
|
|
34
|
+
this.metas.init(this);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
override async of(json: PatientState) {
|
|
38
|
-
if(json.id != undefined)this.id = json.id;
|
|
39
|
-
if(json.name != undefined)this.name = getName(json.name);
|
|
40
|
-
if(json.gender != undefined)this.gender = json.gender;
|
|
41
|
-
if(json.phoneNumber != undefined)this.phoneNumber = json.phoneNumber;
|
|
42
|
-
if(json.birthdate != undefined){
|
|
38
|
+
if (json.id != undefined) this.id = json.id;
|
|
39
|
+
if (json.name != undefined) this.name = getName(json.name);
|
|
40
|
+
if (json.gender != undefined) this.gender = json.gender;
|
|
41
|
+
if (json.phoneNumber != undefined) this.phoneNumber = json.phoneNumber;
|
|
42
|
+
if (json.birthdate != undefined) {
|
|
43
43
|
this.birthdate = json.birthdate;
|
|
44
44
|
//计算年龄
|
|
45
45
|
this.age = new Date().getFullYear() - new Date(json.birthdate).getFullYear();
|
|
46
46
|
}
|
|
47
|
-
if(json.identity != undefined)this.identity = json.identity;
|
|
48
|
-
if(json.tagsState != undefined)
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (json.identity != undefined) this.identity = json.identity;
|
|
48
|
+
if (json.tagsState != undefined)
|
|
49
|
+
this.tags = await Promise.all(json.tagsState.map((tag) => Tag.builder().build().of(tag)));
|
|
50
|
+
if (json.remarks != undefined) {
|
|
51
51
|
this.remarks = json.remarks;
|
|
52
52
|
}
|
|
53
|
-
if(json.doctorId != undefined)this.doctorId = json.doctorId;
|
|
54
|
-
if(json.createdTimestamp != undefined)this.createdTimestamp = json.createdTimestamp;
|
|
55
|
-
if(json.updatedTimestamp != undefined)this.updatedTimestamp = json.updatedTimestamp;
|
|
56
|
-
if(json.mainSymptom != undefined)this.mainSymptom = json.mainSymptom;
|
|
57
|
-
this.metas = this.metas.init(this)
|
|
53
|
+
if (json.doctorId != undefined) this.doctorId = json.doctorId;
|
|
54
|
+
if (json.createdTimestamp != undefined) this.createdTimestamp = json.createdTimestamp;
|
|
55
|
+
if (json.updatedTimestamp != undefined) this.updatedTimestamp = json.updatedTimestamp;
|
|
56
|
+
if (json.mainSymptom != undefined) this.mainSymptom = json.mainSymptom;
|
|
57
|
+
this.metas = this.metas.init(this);
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -66,7 +66,7 @@ export abstract class Patient extends NetworkObject {
|
|
|
66
66
|
if (this.phoneNumber) state.phoneNumber = this.phoneNumber;
|
|
67
67
|
if (this.birthdate) state.birthdate = this.birthdate;
|
|
68
68
|
if (this.identity) state.identity = this.identity;
|
|
69
|
-
if (this.tags.length > 0) state.tagsState = this.tags.map(item => item.state());
|
|
69
|
+
if (this.tags.length > 0) state.tagsState = this.tags.map((item) => item.state());
|
|
70
70
|
if (this.doctorId) state.doctorId = this.doctorId;
|
|
71
71
|
if (this.createdTimestamp) state.createdTimestamp = this.createdTimestamp;
|
|
72
72
|
if (this.updatedTimestamp) state.updatedTimestamp = this.updatedTimestamp;
|
|
@@ -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
|
*
|
|
@@ -25,5 +25,5 @@ export default {
|
|
|
25
25
|
'herbalRestful.postHerbalState': ['POST', '/药材/服务'],
|
|
26
26
|
'prescriptionRestful.postPrescriptionState': ['POST', '/药材/服务/药方'],
|
|
27
27
|
'prescriptionRestful.queryPrescriptionState': ['POST', '/药材/服务/药方/条件查询'],
|
|
28
|
-
'herbalRestful.queryHerbalState': ['POST', '/药材/服务/条件查询']
|
|
28
|
+
'herbalRestful.queryHerbalState': ['POST', '/药材/服务/条件查询'],
|
|
29
29
|
};
|
|
@@ -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 prescriptionApi, {
|
|
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<
|
|
@@ -248,9 +257,9 @@ declare global {
|
|
|
248
257
|
pathParams: {
|
|
249
258
|
id: string;
|
|
250
259
|
};
|
|
251
|
-
}
|
|
260
|
+
},
|
|
252
261
|
>(
|
|
253
|
-
config: Config
|
|
262
|
+
config: Config,
|
|
254
263
|
): Alova2Method<PrescriptionState, 'prescriptionRestful.getPrescriptionState', Config>;
|
|
255
264
|
/**
|
|
256
265
|
* ---
|
|
@@ -376,9 +385,9 @@ declare global {
|
|
|
376
385
|
id: string;
|
|
377
386
|
};
|
|
378
387
|
data: PrescriptionState;
|
|
379
|
-
}
|
|
388
|
+
},
|
|
380
389
|
>(
|
|
381
|
-
config: Config
|
|
390
|
+
config: Config,
|
|
382
391
|
): Alova2Method<PrescriptionState, 'prescriptionRestful.putPrescriptionState', Config>;
|
|
383
392
|
/**
|
|
384
393
|
* ---
|
|
@@ -408,9 +417,9 @@ declare global {
|
|
|
408
417
|
pathParams: {
|
|
409
418
|
id: string;
|
|
410
419
|
};
|
|
411
|
-
}
|
|
420
|
+
},
|
|
412
421
|
>(
|
|
413
|
-
config: Config
|
|
422
|
+
config: Config,
|
|
414
423
|
): Alova2Method<null, 'prescriptionRestful.deletePrescriptionState', Config>;
|
|
415
424
|
/**
|
|
416
425
|
* ---
|
|
@@ -524,9 +533,9 @@ declare global {
|
|
|
524
533
|
postPrescriptionState<
|
|
525
534
|
Config extends Alova2MethodConfig<PrescriptionState> & {
|
|
526
535
|
data: PrescriptionState;
|
|
527
|
-
}
|
|
536
|
+
},
|
|
528
537
|
>(
|
|
529
|
-
config: Config
|
|
538
|
+
config: Config,
|
|
530
539
|
): Alova2Method<PrescriptionState, 'prescriptionRestful.postPrescriptionState', Config>;
|
|
531
540
|
/**
|
|
532
541
|
* ---
|
|
@@ -641,9 +650,9 @@ declare global {
|
|
|
641
650
|
queryPrescriptionState<
|
|
642
651
|
Config extends Alova2MethodConfig<PagePrescriptionState> & {
|
|
643
652
|
data: QueryPrescriptionRequest;
|
|
644
|
-
}
|
|
653
|
+
},
|
|
645
654
|
>(
|
|
646
|
-
config: Config
|
|
655
|
+
config: Config,
|
|
647
656
|
): Alova2Method<PagePrescriptionState, 'prescriptionRestful.queryPrescriptionState', Config>;
|
|
648
657
|
};
|
|
649
658
|
herbalRestful: {
|
|
@@ -692,9 +701,9 @@ declare global {
|
|
|
692
701
|
pathParams: {
|
|
693
702
|
id: string;
|
|
694
703
|
};
|
|
695
|
-
}
|
|
704
|
+
},
|
|
696
705
|
>(
|
|
697
|
-
config: Config
|
|
706
|
+
config: Config,
|
|
698
707
|
): Alova2Method<HerbalState, 'herbalRestful.getHerbalState', Config>;
|
|
699
708
|
/**
|
|
700
709
|
* ---
|
|
@@ -766,9 +775,9 @@ declare global {
|
|
|
766
775
|
id: string;
|
|
767
776
|
};
|
|
768
777
|
data: HerbalState;
|
|
769
|
-
}
|
|
778
|
+
},
|
|
770
779
|
>(
|
|
771
|
-
config: Config
|
|
780
|
+
config: Config,
|
|
772
781
|
): Alova2Method<HerbalState, 'herbalRestful.putHerbalState', Config>;
|
|
773
782
|
/**
|
|
774
783
|
* ---
|
|
@@ -798,9 +807,9 @@ declare global {
|
|
|
798
807
|
pathParams: {
|
|
799
808
|
id: string;
|
|
800
809
|
};
|
|
801
|
-
}
|
|
810
|
+
},
|
|
802
811
|
>(
|
|
803
|
-
config: Config
|
|
812
|
+
config: Config,
|
|
804
813
|
): Alova2Method<null, 'herbalRestful.deleteHerbalState', Config>;
|
|
805
814
|
/**
|
|
806
815
|
* ---
|
|
@@ -860,9 +869,9 @@ declare global {
|
|
|
860
869
|
postHerbalState<
|
|
861
870
|
Config extends Alova2MethodConfig<HerbalState> & {
|
|
862
871
|
data: HerbalState;
|
|
863
|
-
}
|
|
872
|
+
},
|
|
864
873
|
>(
|
|
865
|
-
config: Config
|
|
874
|
+
config: Config,
|
|
866
875
|
): Alova2Method<HerbalState, 'herbalRestful.postHerbalState', Config>;
|
|
867
876
|
/**
|
|
868
877
|
* ---
|
|
@@ -948,9 +957,9 @@ declare global {
|
|
|
948
957
|
queryHerbalState<
|
|
949
958
|
Config extends Alova2MethodConfig<PageHerbalState> & {
|
|
950
959
|
data: QueryHerbalRequest;
|
|
951
|
-
}
|
|
960
|
+
},
|
|
952
961
|
>(
|
|
953
|
-
config: Config
|
|
962
|
+
config: Config,
|
|
954
963
|
): Alova2Method<PageHerbalState, 'herbalRestful.queryHerbalState', Config>;
|
|
955
964
|
};
|
|
956
965
|
}
|
|
@@ -1,48 +1,68 @@
|
|
|
1
|
-
import { Herbal } from '
|
|
2
|
-
import type { Doctor } from '
|
|
1
|
+
import { Herbal } from 'src/api/prescription/herbal';
|
|
2
|
+
import type { Doctor } from 'src/api/doctor/doctor';
|
|
3
3
|
|
|
4
|
-
export class AlovaHerbal extends Herbal{
|
|
5
|
-
static override query(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
page:
|
|
20
|
-
pageSize
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
export class AlovaHerbal extends Herbal {
|
|
5
|
+
static override query(
|
|
6
|
+
page: number = 0,
|
|
7
|
+
pageSize: number = 9999999,
|
|
8
|
+
owner?: Doctor,
|
|
9
|
+
name?: string,
|
|
10
|
+
price?: number,
|
|
11
|
+
) {
|
|
12
|
+
const ownerState = owner?.state();
|
|
13
|
+
return prescriptionApi.herbalRestful
|
|
14
|
+
.queryHerbalState({
|
|
15
|
+
data: {
|
|
16
|
+
...(ownerState && { ownerState }),
|
|
17
|
+
...(name && { name }),
|
|
18
|
+
...(price !== undefined && { price }),
|
|
19
|
+
page: page,
|
|
20
|
+
pageSize,
|
|
21
|
+
},
|
|
22
|
+
async transform(res) {
|
|
23
|
+
return {
|
|
24
|
+
data: (await Promise.all(
|
|
25
|
+
res.content.map((item) => new AlovaHerbal().of(item)),
|
|
26
|
+
)) as Herbal[],
|
|
27
|
+
total: res.totalElements,
|
|
28
|
+
page: res.number,
|
|
29
|
+
pageSize: res.size,
|
|
30
|
+
pageCount: res.totalPages,
|
|
31
|
+
isLastPage: res.last,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
.send();
|
|
26
36
|
}
|
|
27
37
|
async put() {
|
|
28
|
-
return this.of(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
return this.of(
|
|
39
|
+
await prescriptionApi.herbalRestful
|
|
40
|
+
.putHerbalState({
|
|
41
|
+
pathParams: {
|
|
42
|
+
id: this.id,
|
|
43
|
+
},
|
|
44
|
+
data: this.state(),
|
|
45
|
+
})
|
|
46
|
+
.send(true),
|
|
47
|
+
);
|
|
34
48
|
}
|
|
35
49
|
async post() {
|
|
36
|
-
return this.of(
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
return this.of(
|
|
51
|
+
await prescriptionApi.herbalRestful
|
|
52
|
+
.postHerbalState({
|
|
53
|
+
data: this.state(),
|
|
54
|
+
})
|
|
55
|
+
.send(true),
|
|
56
|
+
);
|
|
39
57
|
}
|
|
40
58
|
async delete() {
|
|
41
|
-
void prescriptionApi.herbalRestful
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
void prescriptionApi.herbalRestful
|
|
60
|
+
.deleteHerbalState({
|
|
61
|
+
pathParams: {
|
|
62
|
+
id: this.id,
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
.send();
|
|
66
|
+
return Promise.resolve();
|
|
47
67
|
}
|
|
48
68
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './herbal';
|
|
2
|
-
export * from './prescription';
|
|
2
|
+
export * from './prescription';
|
|
@@ -1,45 +1,62 @@
|
|
|
1
|
-
import { Prescription } from '
|
|
2
|
-
import type { Doctor } from '
|
|
1
|
+
import { Prescription } from 'src/api/prescription/prescription';
|
|
2
|
+
import type { Doctor } from 'src/api/doctor/doctor';
|
|
3
3
|
|
|
4
|
-
export class AlovaPrescription extends Prescription{
|
|
5
|
-
static override query(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
export class AlovaPrescription extends Prescription {
|
|
5
|
+
static override query(
|
|
6
|
+
page: number = 0,
|
|
7
|
+
pageSize: number = 9999999,
|
|
8
|
+
owner?: Doctor,
|
|
9
|
+
name?: string,
|
|
10
|
+
) {
|
|
11
|
+
const ownerState = owner?.state();
|
|
12
|
+
return prescriptionApi.prescriptionRestful
|
|
13
|
+
.queryPrescriptionState({
|
|
14
|
+
data: {
|
|
15
|
+
...(ownerState && { ownerState }),
|
|
16
|
+
...(name && { name }),
|
|
17
|
+
page: page,
|
|
18
|
+
pageSize,
|
|
19
|
+
},
|
|
20
|
+
async transform(res) {
|
|
21
|
+
return {
|
|
22
|
+
data: await Promise.all(res.content.map((item) => new AlovaPrescription().of(item))),
|
|
23
|
+
total: res.totalElements,
|
|
24
|
+
page: res.number,
|
|
25
|
+
pageSize: res.size,
|
|
26
|
+
pageCount: res.totalPages,
|
|
27
|
+
isLastPage: res.last,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.send();
|
|
25
32
|
}
|
|
26
33
|
//put
|
|
27
34
|
override async put() {
|
|
28
|
-
return this.of(
|
|
35
|
+
return this.of(
|
|
36
|
+
await prescriptionApi.prescriptionRestful
|
|
37
|
+
.putPrescriptionState({ pathParams: { id: this.id }, data: this.state() })
|
|
38
|
+
.send(),
|
|
39
|
+
);
|
|
29
40
|
}
|
|
30
41
|
//post
|
|
31
42
|
override async post() {
|
|
32
|
-
return this.of(
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
return this.of(
|
|
44
|
+
await prescriptionApi.prescriptionRestful
|
|
45
|
+
.postPrescriptionState({
|
|
46
|
+
data: this.state(),
|
|
47
|
+
})
|
|
48
|
+
.send(),
|
|
49
|
+
);
|
|
35
50
|
}
|
|
36
51
|
//delete
|
|
37
52
|
override async delete() {
|
|
38
|
-
await prescriptionApi.prescriptionRestful
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
await prescriptionApi.prescriptionRestful
|
|
54
|
+
.deletePrescriptionState({
|
|
55
|
+
pathParams: {
|
|
56
|
+
id: this.id,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.send();
|
|
60
|
+
return this;
|
|
44
61
|
}
|
|
45
62
|
}
|
|
@@ -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.Prescription),
|
|
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,12 +1,12 @@
|
|
|
1
|
-
import type { Page} from '
|
|
2
|
-
import { NetworkObject } from '
|
|
3
|
-
import type { HerbalState } from '
|
|
1
|
+
import type { Page } from 'src/api/patient/core';
|
|
2
|
+
import { NetworkObject } from 'src/api/patient/core';
|
|
3
|
+
import type { HerbalState } from 'src/api/prescription/alova/globals';
|
|
4
4
|
import type { IBuilder } from 'builder-pattern';
|
|
5
5
|
import { Builder } from 'builder-pattern';
|
|
6
|
-
import { Doctor } from '
|
|
6
|
+
import { Doctor } from 'src/api/doctor/doctor';
|
|
7
7
|
|
|
8
8
|
export abstract class Herbal extends NetworkObject {
|
|
9
|
-
static override builder(): IBuilder<Herbal>{
|
|
9
|
+
static override builder(): IBuilder<Herbal> {
|
|
10
10
|
return Builder(this._default) as unknown as IBuilder<Herbal>;
|
|
11
11
|
}
|
|
12
12
|
static override default(): typeof Herbal {
|
|
@@ -23,8 +23,9 @@ export abstract class Herbal extends NetworkObject {
|
|
|
23
23
|
if (json.name != undefined) this.name = json.name;
|
|
24
24
|
if (json.price != undefined) this.price = json.price;
|
|
25
25
|
if (json.weight != undefined) this.weight = json.weight;
|
|
26
|
-
if (json.ownerState != undefined)
|
|
27
|
-
|
|
26
|
+
if (json.ownerState != undefined)
|
|
27
|
+
this.owner = await Doctor.builder().build().of(json.ownerState);
|
|
28
|
+
return this;
|
|
28
29
|
}
|
|
29
30
|
override state() {
|
|
30
31
|
return {
|
|
@@ -33,10 +34,16 @@ export abstract class Herbal extends NetworkObject {
|
|
|
33
34
|
price: this.price,
|
|
34
35
|
weight: this.weight,
|
|
35
36
|
ownerState: this.owner.state(),
|
|
36
|
-
} as HerbalState
|
|
37
|
+
} as HerbalState;
|
|
37
38
|
}
|
|
38
|
-
static query(
|
|
39
|
-
|
|
39
|
+
static query(
|
|
40
|
+
page: number = 0,
|
|
41
|
+
pageSize: number = 9999999,
|
|
42
|
+
owner?: Doctor,
|
|
43
|
+
name?: string,
|
|
44
|
+
price?: number,
|
|
45
|
+
): Promise<Page<Herbal>> {
|
|
46
|
+
return Herbal.default().query(page, pageSize, owner, name, price);
|
|
40
47
|
}
|
|
41
48
|
abstract put(): Promise<this>;
|
|
42
49
|
abstract post(): Promise<this>;
|