web-core-tcm 0.0.20 → 0.0.22
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 +4 -4
- package/quasar.config.ts +9 -6
- package/src/api/algorithm/comprehensiveAlgorithm.ts +1 -1
- package/src/api/algorithm/index.ts +2 -2
- package/src/api/algorithm/inquiriesAlgorithm.ts +1 -1
- package/src/api/algorithm/inspectionsAlgorithm.ts +1 -1
- package/src/api/algorithm/lisemsAlgorithm.ts +1 -1
- package/src/api/algorithm/pulsationsAlgorithm.ts +1 -1
- package/src/api/authorization/alova/implement/authorization.ts +1 -1
- package/src/api/authorization/alova/index.ts +2 -2
- package/src/api/authorization/authorization.ts +1 -1
- package/src/api/check/alova/implement/check.ts +1 -1
- package/src/api/check/alova/index.ts +3 -6
- package/src/api/check/check.ts +12 -12
- package/src/api/config/alova/index.ts +1 -1
- package/src/api/doctor/alova/implement/doctor.ts +1 -1
- package/src/api/doctor/alova/index.ts +2 -2
- package/src/api/doctor/doctor.ts +2 -2
- package/src/api/metric/implement/metric.ts +3 -3
- package/src/api/metric/metric.ts +3 -3
- package/src/api/oauth/alova/implement/oauth.ts +2 -2
- package/src/api/oauth/alova/index.ts +2 -2
- package/src/api/outpatient/alova/implement/outpatient.ts +2 -2
- package/src/api/outpatient/alova/index.ts +2 -2
- package/src/api/outpatient/outpatient.ts +5 -5
- package/src/api/patient/alova/implement/meta.ts +9 -9
- package/src/api/patient/alova/implement/patient.ts +2 -2
- package/src/api/patient/alova/index.ts +3 -6
- package/src/api/patient/core.ts +1 -1
- package/src/api/patient/meta.ts +10 -10
- package/src/api/patient/patient.ts +6 -6
- package/src/api/prescription/alova/implement/herbal.ts +2 -2
- package/src/api/prescription/alova/implement/prescription.ts +2 -2
- package/src/api/prescription/alova/index.ts +3 -6
- package/src/api/prescription/herbal.ts +4 -4
- package/src/api/prescription/prescription.ts +5 -5
- package/src/api/scientist/alova/implement/scientist.ts +1 -1
- package/src/api/scientist/alova/index.ts +3 -6
- package/src/api/scientist/scientist.ts +3 -3
- package/src/index.ts +2 -0
- package/src/util/helper.ts +159 -0
- package/src/util/helper.js +0 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-core-tcm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Core",
|
|
5
5
|
"productName": "Core",
|
|
6
6
|
"author": "wywywywywywywywywy <qa123456_0714@qq.com>",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"quasar": "^2.16.0",
|
|
19
19
|
"vue": "^3.5.22",
|
|
20
20
|
"vue-router": "^4.0.12",
|
|
21
|
+
"@bufbuild/protobuf": "^2.9.0",
|
|
22
|
+
"@bufbuild/protoc-gen-es": "^2.9.0",
|
|
21
23
|
"@alova/adapter-axios": "^1.2.6",
|
|
22
24
|
"@alova/mock": "^1.5.1",
|
|
23
25
|
"@alova/scene-vue": "^1.6.2",
|
|
@@ -48,9 +50,7 @@
|
|
|
48
50
|
"@types/node": "^20.5.9",
|
|
49
51
|
"@quasar/app-vite": "^2.1.0",
|
|
50
52
|
"autoprefixer": "^10.4.2",
|
|
51
|
-
"typescript": "^5.9.2"
|
|
52
|
-
"@bufbuild/buf": "^1.57.2",
|
|
53
|
-
"@bufbuild/protoc-gen-es": "^2.9.0"
|
|
53
|
+
"typescript": "^5.9.2"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": "^28 || ^26 || ^24 || ^22 || ^20",
|
package/quasar.config.ts
CHANGED
|
@@ -40,7 +40,12 @@ export default defineConfig((/* ctx */) => {
|
|
|
40
40
|
typescript: {
|
|
41
41
|
strict: true,
|
|
42
42
|
vueShim: true,
|
|
43
|
-
|
|
43
|
+
extendTsConfig (tsConfig) {
|
|
44
|
+
tsConfig.compilerOptions!.paths['@core'] = [...tsConfig.compilerOptions!.paths['src']]
|
|
45
|
+
tsConfig.compilerOptions!.paths['@core/*'] = [...tsConfig.compilerOptions!.paths['src/*']]
|
|
46
|
+
delete tsConfig.compilerOptions!.paths['src'];
|
|
47
|
+
delete tsConfig.compilerOptions!.paths['src/*'];
|
|
48
|
+
}
|
|
44
49
|
},
|
|
45
50
|
|
|
46
51
|
vueRouterMode: 'hash', // available values: 'hash', 'history'
|
|
@@ -58,8 +63,6 @@ export default defineConfig((/* ctx */) => {
|
|
|
58
63
|
// minify: false,
|
|
59
64
|
// polyfillModulePreload: true,
|
|
60
65
|
// distDir
|
|
61
|
-
|
|
62
|
-
// extendViteConf (viteConf) {},
|
|
63
66
|
// viteVuePluginOptions: {},
|
|
64
67
|
|
|
65
68
|
vitePlugins: [
|
|
@@ -107,9 +110,9 @@ export default defineConfig((/* ctx */) => {
|
|
|
107
110
|
|
|
108
111
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-file#sourcefiles
|
|
109
112
|
// sourceFiles: {
|
|
110
|
-
// rootComponent: '
|
|
111
|
-
// router: '
|
|
112
|
-
// store: '
|
|
113
|
+
// rootComponent: '@core/App.vue',
|
|
114
|
+
// router: '@core/router/index',
|
|
115
|
+
// store: '@core/store/index',
|
|
113
116
|
// pwaRegisterServiceWorker: 'src-pwa/register-service-worker',
|
|
114
117
|
// pwaServiceWorker: 'src-pwa/custom-service-worker',
|
|
115
118
|
// pwaManifestFile: 'src-pwa/manifest.json',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/api/comprehensiveAlgorithm.ts
|
|
2
|
-
import { comprehensiveAlgorithmService } from '
|
|
2
|
+
import { comprehensiveAlgorithmService } from '@core/api/algorithm';
|
|
3
3
|
|
|
4
4
|
export const comprehensiveQwenAlgorithm = (data: object) =>
|
|
5
5
|
comprehensiveAlgorithmService.Post<Response>('/千问大模型分析', data, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import adapterFetch from 'alova/fetch';
|
|
3
|
-
import { responded } from '
|
|
4
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
3
|
+
import { responded } from '@core/api/config/alova';
|
|
4
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
5
5
|
|
|
6
6
|
export const inspectionAlgorithmService = createAlova({
|
|
7
7
|
baseURL: getServiceEndpoint(ServiceType.InspectionsAlgorithm),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pulsationsAlgorithmService } from '
|
|
1
|
+
import { pulsationsAlgorithmService } from '@core/api/algorithm';
|
|
2
2
|
|
|
3
3
|
export const pulsationPreprocessing = (pulsation: object) =>
|
|
4
4
|
pulsationsAlgorithmService.Post<{ [key: string]: number[] }>('/预处理', pulsation, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Authorization } from '
|
|
1
|
+
import { Authorization } from '@core/api/authorization/authorization';
|
|
2
2
|
export class AlovaAuthorization extends Authorization{
|
|
3
3
|
static override getToken(type?: string, uid?: string, token?: string) {
|
|
4
4
|
return authorizeApi.oAuthRestful.getToken({
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Authorization),
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Check),
|
|
@@ -20,7 +20,4 @@ mountApis(Apis);
|
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
export * from './createApis';
|
|
25
|
-
export * from './globals.d';
|
|
26
|
-
export * from './implement/index';
|
|
23
|
+
|
package/src/api/check/check.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Patient } from '
|
|
2
|
-
import type { Page} from '
|
|
3
|
-
import { Tag } from '
|
|
4
|
-
import { NetworkObject, Sequence } from '
|
|
5
|
-
import type { CheckState, PaymentState } from '
|
|
6
|
-
import { Metas } from '
|
|
7
|
-
import { Prescription } from '
|
|
8
|
-
import { AlovaPrescription } from '
|
|
9
|
-
import type { PrescriptionState } from '
|
|
10
|
-
import { extractPlainText } from '
|
|
11
|
-
import { Doctor } from '
|
|
12
|
-
import { Herbal } from '
|
|
1
|
+
import { Patient } from '@core/api/patient/patient';
|
|
2
|
+
import type { Page} from '@core/api/patient/core';
|
|
3
|
+
import { Tag } from '@core/api/patient/core';
|
|
4
|
+
import { NetworkObject, Sequence } from '@core/api/patient/core';
|
|
5
|
+
import type { CheckState, PaymentState } from '@core/api/check/alova/globals';
|
|
6
|
+
import { Metas } from '@core/api/patient/meta';
|
|
7
|
+
import { Prescription } from '@core/api/prescription/prescription';
|
|
8
|
+
import { AlovaPrescription } from '@core/api/prescription/alova/implement/prescription';
|
|
9
|
+
import type { PrescriptionState } from '@core/api/prescription/alova/globals';
|
|
10
|
+
import { extractPlainText } from '@core/util/RichTextUtil';
|
|
11
|
+
import { Doctor } from '@core/api/doctor/doctor';
|
|
12
|
+
import { Herbal } from '@core/api/prescription';
|
|
13
13
|
import type { IBuilder } from 'builder-pattern';
|
|
14
14
|
import { Builder } from 'builder-pattern';
|
|
15
15
|
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Doctor),
|
package/src/api/doctor/doctor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NetworkObject } from '
|
|
2
|
-
import type { DoctorState } from '
|
|
1
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
2
|
+
import type { DoctorState } from '@core/api/doctor/alova/globals';
|
|
3
3
|
import type { IBuilder } from 'builder-pattern';
|
|
4
4
|
import { Builder } from 'builder-pattern';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MetaType } from '
|
|
2
|
-
import { Metric } from '
|
|
3
|
-
import type { AgeDistribute, DateDistribute, GenderDistribute } from '
|
|
1
|
+
import type { MetaType } from '@core/api/patient/meta';
|
|
2
|
+
import { Metric } from '@core/api/metric/metric';
|
|
3
|
+
import type { AgeDistribute, DateDistribute, GenderDistribute } from '@core/api/patient/alova/globals';
|
|
4
4
|
|
|
5
5
|
export class AlovaMetric extends Metric {
|
|
6
6
|
// 科研相关统计
|
package/src/api/metric/metric.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { MetaType } from '
|
|
1
|
+
import type { MetaType } from '@core/api/patient/meta';
|
|
2
2
|
import type { IBuilder } from 'builder-pattern';
|
|
3
3
|
import { Builder } from 'builder-pattern';
|
|
4
|
-
import type { DateDistribute } from '
|
|
5
|
-
import type { AgeDistribute, GenderDistribute } from '
|
|
4
|
+
import type { DateDistribute } from '@core/api/patient/alova/globals';
|
|
5
|
+
import type { AgeDistribute, GenderDistribute } from '@core/api/check/alova/globals';
|
|
6
6
|
|
|
7
7
|
export class Metric {
|
|
8
8
|
static _default: typeof Metric
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OAuth } from '
|
|
2
|
-
import { alovaInstance } from '
|
|
1
|
+
import { OAuth } from '@core/api/oauth/oauth';
|
|
2
|
+
import { alovaInstance } from '@core/api/oauth/alova';
|
|
3
3
|
|
|
4
4
|
export class AlovaOAuth extends OAuth{
|
|
5
5
|
static override async getYincToken(code: string, redirect_uri: string,client_id: string,code_verifier: string) {
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.OAuth),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Queuer } from '
|
|
2
|
-
import type { Page } from '
|
|
1
|
+
import { Queuer } from '@core/api/outpatient/outpatient';
|
|
2
|
+
import type { Page } from '@core/api/patient/core';
|
|
3
3
|
|
|
4
4
|
export class AlovaQueuer extends Queuer {
|
|
5
5
|
override async get() {
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Outpatient),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Page} from '
|
|
2
|
-
import { NetworkObject } from '
|
|
3
|
-
import type { QueuerState } from '
|
|
1
|
+
import type { Page} from '@core/api/patient/core';
|
|
2
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
3
|
+
import type { QueuerState } from '@core/api/outpatient/alova/globals';
|
|
4
4
|
import type { IBuilder } from 'builder-pattern';
|
|
5
5
|
import { Builder } from 'builder-pattern';
|
|
6
|
-
import { Patient } from '
|
|
7
|
-
import { Doctor } from '
|
|
6
|
+
import { Patient } from '@core/api/patient/patient';
|
|
7
|
+
import { Doctor } from '@core/api/doctor/doctor';
|
|
8
8
|
|
|
9
9
|
export enum QueuerStatus {
|
|
10
10
|
Waiting = 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MetaState } from '
|
|
1
|
+
import type { MetaState } from '@core/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 '
|
|
16
|
-
import type { Page} from '
|
|
17
|
-
import { Annotation, Tag } from '
|
|
18
|
-
import { faceAnalyze, tongueAnalyze } from '
|
|
19
|
-
import { base64ToArrayBuffer } from '
|
|
20
|
-
import { pulsationAnalysis, pulsationPreprocessing } from '
|
|
21
|
-
import { analysisLisems } from '
|
|
22
|
-
import type { Patient } from '
|
|
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';
|
|
23
23
|
|
|
24
24
|
export class AlovaMeta extends Meta {
|
|
25
25
|
override deserialize(): Promise<this> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Patient } from '
|
|
2
|
-
import type { Page } from '
|
|
1
|
+
import { Patient } from '@core/api/patient/patient';
|
|
2
|
+
import type { Page } from '@core/api/patient/core';
|
|
3
3
|
|
|
4
4
|
export class AlovaPatient extends Patient{
|
|
5
5
|
override async get() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createAlova } from 'alova';
|
|
2
2
|
import fetchAdapter from 'alova/fetch';
|
|
3
3
|
import { createApis, mountApis, withConfigType } from './createApis';
|
|
4
|
-
import { onAuthRequired, responded } from '
|
|
5
|
-
import { getServiceEndpoint, ServiceType } from '
|
|
4
|
+
import { onAuthRequired, responded } from '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Patient),
|
|
@@ -20,8 +20,5 @@ mountApis(Apis);
|
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
export * from './createApis';
|
|
25
|
-
export * from './globals.d';
|
|
26
|
-
export * from './implement/index';
|
|
23
|
+
|
|
27
24
|
|
package/src/api/patient/core.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnnotationState, TagState } from '
|
|
1
|
+
import type { AnnotationState, TagState } from '@core/api/patient/alova/globals';
|
|
2
2
|
import type { IBuilder } from 'builder-pattern';
|
|
3
3
|
import { Builder } from 'builder-pattern';
|
|
4
4
|
export class Page<T>{
|
package/src/api/patient/meta.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Page} from '
|
|
2
|
-
import { Sequence, Tag } from '
|
|
3
|
-
import { NetworkObject } from '
|
|
4
|
-
import { arrayBufferToImageBase64 } from '
|
|
5
|
-
import type { WaveMap} from '
|
|
6
|
-
import { WaveMapSchema, WaveSchema } from '
|
|
1
|
+
import type { Page} from '@core/api/patient/core';
|
|
2
|
+
import { Sequence, Tag } from '@core/api/patient/core';
|
|
3
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
4
|
+
import { arrayBufferToImageBase64 } from '@core/util/image';
|
|
5
|
+
import type { WaveMap} from '@core/proto/types/WaveMap_pb';
|
|
6
|
+
import { WaveMapSchema, WaveSchema } from '@core/proto/types/WaveMap_pb';
|
|
7
7
|
import { create, fromBinary, toBinary } from '@bufbuild/protobuf';
|
|
8
|
-
import type { MetaState } from '
|
|
9
|
-
import type { Image,Images} from '
|
|
10
|
-
import { ImageSchema,ImagesSchema } from '
|
|
11
|
-
import { Patient } from '
|
|
8
|
+
import type { MetaState } from '@core/api/patient/alova/globals';
|
|
9
|
+
import type { Image,Images} from '@core/proto/types/Images_pb';
|
|
10
|
+
import { ImageSchema,ImagesSchema } from '@core/proto/types/Images_pb';
|
|
11
|
+
import { Patient } from '@core/api/patient/patient';
|
|
12
12
|
import type { IBuilder } from 'builder-pattern';
|
|
13
13
|
import { Builder } from 'builder-pattern';
|
|
14
14
|
//Enum Type
|
|
@@ -1,11 +1,11 @@
|
|
|
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 '@core/api/patient/core';
|
|
2
|
+
import { Tag } from '@core/api/patient/core';
|
|
3
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
4
|
+
import type { PatientState } from '@core/api/patient/alova/globals';
|
|
5
|
+
import { Metas } from '@core/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 '@core/util/string';
|
|
9
9
|
|
|
10
10
|
export abstract class Patient extends NetworkObject {
|
|
11
11
|
static override builder(): IBuilder<Patient>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Herbal } from '
|
|
2
|
-
import type { Doctor } from '
|
|
1
|
+
import { Herbal } from '@core/api/prescription/herbal';
|
|
2
|
+
import type { Doctor } from '@core/api/doctor/doctor';
|
|
3
3
|
|
|
4
4
|
export class AlovaHerbal extends Herbal{
|
|
5
5
|
static override query(page: number = 0, pageSize: number = 9999999, owner?: Doctor, name?: string, price?: number) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Prescription } from '
|
|
2
|
-
import type { Doctor } from '
|
|
1
|
+
import { Prescription } from '@core/api/prescription/prescription';
|
|
2
|
+
import type { Doctor } from '@core/api/doctor/doctor';
|
|
3
3
|
|
|
4
4
|
export class AlovaPrescription extends Prescription{
|
|
5
5
|
static override query(page: number = 0, pageSize: number = 9999999,owner?: Doctor, name?: string) {
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Prescription),
|
|
@@ -20,7 +20,4 @@ mountApis(Apis);
|
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
export * from './createApis';
|
|
25
|
-
export * from './globals.d';
|
|
26
|
-
export * from './implement/index';
|
|
23
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Page} from '
|
|
2
|
-
import { NetworkObject } from '
|
|
3
|
-
import type { HerbalState } from '
|
|
1
|
+
import type { Page} from '@core/api/patient/core';
|
|
2
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
3
|
+
import type { HerbalState } from '@core/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 '@core/api/doctor/doctor';
|
|
7
7
|
|
|
8
8
|
export abstract class Herbal extends NetworkObject {
|
|
9
9
|
static override builder(): IBuilder<Herbal>{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Herbal } from '
|
|
2
|
-
import type { PrescriptionState } from '
|
|
3
|
-
import type { Page } from '
|
|
4
|
-
import { NetworkObject } from '
|
|
1
|
+
import { Herbal } from '@core/api/prescription/herbal';
|
|
2
|
+
import type { PrescriptionState } from '@core/api/prescription/alova/globals';
|
|
3
|
+
import type { Page } from '@core/api/patient/core';
|
|
4
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
5
5
|
import type { IBuilder } from 'builder-pattern';
|
|
6
6
|
import { Builder } from 'builder-pattern';
|
|
7
|
-
import { Doctor } from '
|
|
7
|
+
import { Doctor } from '@core/api/doctor/doctor';
|
|
8
8
|
|
|
9
9
|
export abstract class Prescription extends NetworkObject{
|
|
10
10
|
static override builder(): IBuilder<Prescription>{
|
|
@@ -1,8 +1,8 @@
|
|
|
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 '@core/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from '@core/api/config';
|
|
6
6
|
|
|
7
7
|
export const alovaInstance = createAlova({
|
|
8
8
|
baseURL: getServiceEndpoint(ServiceType.Scientist),
|
|
@@ -20,7 +20,4 @@ mountApis(Apis);
|
|
|
20
20
|
|
|
21
21
|
export default Apis;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
export * from './createApis';
|
|
25
|
-
export * from './globals.d';
|
|
26
|
-
export * from './implement/index';
|
|
23
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NetworkObject } from '
|
|
1
|
+
import { NetworkObject } from '@core/api/patient/core';
|
|
2
2
|
import type { IBuilder } from 'builder-pattern';
|
|
3
3
|
import { Builder } from 'builder-pattern';
|
|
4
|
-
import type { ScientistState } from '
|
|
5
|
-
import { getName } from '
|
|
4
|
+
import type { ScientistState } from '@core/api/scientist/alova/globals';
|
|
5
|
+
import { getName } from '@core/util/string';
|
|
6
6
|
|
|
7
7
|
export abstract class Scientist extends NetworkObject{
|
|
8
8
|
static override builder(): IBuilder<Scientist>{
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/** 平台类型 */
|
|
2
|
+
type Platform = 'electron' | 'web';
|
|
3
|
+
|
|
4
|
+
/** 存储操作结果接口 */
|
|
5
|
+
interface StorageResult {
|
|
6
|
+
success: boolean;
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Token 操作助手对象 */
|
|
11
|
+
export const tokenHelper = {
|
|
12
|
+
/** 设置 token */
|
|
13
|
+
set: (val: string): StorageResult => {
|
|
14
|
+
try {
|
|
15
|
+
if (getPlatform() === 'electron') {
|
|
16
|
+
window.electronAPI!.setStoreItem('token', val);
|
|
17
|
+
} else {
|
|
18
|
+
window.localStorage.setItem('token', val);
|
|
19
|
+
}
|
|
20
|
+
return { success: true };
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('设置 token 失败:', error);
|
|
23
|
+
return { success: false, error: error as Error };
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
/** 获取 token */
|
|
28
|
+
get: (): string | null => {
|
|
29
|
+
try {
|
|
30
|
+
if (getPlatform() === 'electron') {
|
|
31
|
+
return window.electronAPI!.getStoreItem('token');
|
|
32
|
+
} else {
|
|
33
|
+
return window.localStorage.getItem('token');
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('获取 token 失败:', error);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/** 移除 token */
|
|
42
|
+
remove: (): StorageResult => {
|
|
43
|
+
try {
|
|
44
|
+
if (getPlatform() === 'electron') {
|
|
45
|
+
window.electronAPI!.setStoreItem('token', '');
|
|
46
|
+
} else {
|
|
47
|
+
window.localStorage.removeItem('token');
|
|
48
|
+
}
|
|
49
|
+
return { success: true };
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error('移除 token 失败:', error);
|
|
52
|
+
return { success: false, error: error as Error };
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/** 检查是否存在 token */
|
|
57
|
+
exists: (): boolean => {
|
|
58
|
+
const token = tokenHelper.get();
|
|
59
|
+
return !!token && token !== '';
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** 通用存储操作助手对象 */
|
|
64
|
+
export const storageHelper = {
|
|
65
|
+
/** 设置存储项 */
|
|
66
|
+
setItem: (key: string, val: string): StorageResult => {
|
|
67
|
+
try {
|
|
68
|
+
if (getPlatform() === 'electron') {
|
|
69
|
+
window.electronAPI!.setStoreItem(key, val);
|
|
70
|
+
} else {
|
|
71
|
+
window.localStorage.setItem(key, val);
|
|
72
|
+
}
|
|
73
|
+
return { success: true };
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(`设置存储项 ${key} 失败:`, error);
|
|
76
|
+
return { success: false, error: error as Error };
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/** 获取存储项 */
|
|
81
|
+
getItem: (key: string): string | null => {
|
|
82
|
+
try {
|
|
83
|
+
if (getPlatform() === 'electron') {
|
|
84
|
+
return window.electronAPI!.getStoreItem(key);
|
|
85
|
+
} else {
|
|
86
|
+
return window.localStorage.getItem(key);
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error(`获取存储项 ${key} 失败:`, error);
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/** 移除存储项 */
|
|
95
|
+
removeItem: (key: string): StorageResult => {
|
|
96
|
+
try {
|
|
97
|
+
if (getPlatform() === 'electron') {
|
|
98
|
+
window.electronAPI!.removeStoreItem(key);
|
|
99
|
+
} else {
|
|
100
|
+
window.localStorage.removeItem(key);
|
|
101
|
+
}
|
|
102
|
+
return { success: true };
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(`移除存储项 ${key} 失败:`, error);
|
|
105
|
+
return { success: false, error: error as Error };
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/** 清空所有存储 */
|
|
110
|
+
clear: (): StorageResult => {
|
|
111
|
+
try {
|
|
112
|
+
if (getPlatform() === 'electron') {
|
|
113
|
+
// 如果是 electron,可能需要实现清空逻辑
|
|
114
|
+
window.localStorage.clear();
|
|
115
|
+
} else {
|
|
116
|
+
window.localStorage.clear();
|
|
117
|
+
}
|
|
118
|
+
return { success: true };
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error('清空存储失败:', error);
|
|
121
|
+
return { success: false, error: error as Error };
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** 获取当前平台类型 */
|
|
127
|
+
export const getPlatform = (): Platform => {
|
|
128
|
+
// 检查是否在 Electron 环境中
|
|
129
|
+
if (typeof window !== 'undefined' && window.electronAPI?.available) {
|
|
130
|
+
try {
|
|
131
|
+
if (window.electronAPI.available()) {
|
|
132
|
+
return 'electron';
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
// 忽略错误,继续检查其他环境
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 默认返回 web 环境
|
|
140
|
+
return 'web';
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// 扩展 Window 接口,添加 electronAPI 的类型定义
|
|
144
|
+
declare global {
|
|
145
|
+
interface Window {
|
|
146
|
+
electronAPI?: {
|
|
147
|
+
available: () => boolean;
|
|
148
|
+
setStoreItem: (key: string, value: string) => void;
|
|
149
|
+
getStoreItem: (key: string) => string | null;
|
|
150
|
+
removeStoreItem: (key: string) => void;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default {
|
|
156
|
+
tokenHelper,
|
|
157
|
+
storageHelper,
|
|
158
|
+
getPlatform,
|
|
159
|
+
};
|
package/src/util/helper.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** token操作助手对象 */
|
|
2
|
-
export const tokenHelper = {
|
|
3
|
-
set: (val) => {
|
|
4
|
-
//判断是electron还算web
|
|
5
|
-
if (getPlatform() === 'electron') {
|
|
6
|
-
window.electronAPI.setStoreItem('token', val);
|
|
7
|
-
} else {
|
|
8
|
-
window.localStorage.setItem('token', val);
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
get: () => {
|
|
12
|
-
if (getPlatform() === 'electron') {
|
|
13
|
-
return window.electronAPI.getStoreItem('token');
|
|
14
|
-
} else {
|
|
15
|
-
return window.localStorage.getItem('token') ;
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
remove: () => {
|
|
19
|
-
//判断是不是electron
|
|
20
|
-
if (getPlatform() === 'electron') {
|
|
21
|
-
window.electronAPI.setStoreItem('token', '');
|
|
22
|
-
} else {
|
|
23
|
-
window.localStorage.removeItem('token');
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
export const storageHelper = {
|
|
28
|
-
setItem: (key, val) => {
|
|
29
|
-
//判断是electron还是spa,目前都是spa,electron也是spa的分离模式,所以第一个判断不会生效,留作后续。
|
|
30
|
-
if (getPlatform() === 'electron') {
|
|
31
|
-
window.electronAPI.setStoreItem(key, val);
|
|
32
|
-
} else {
|
|
33
|
-
window.localStorage.setItem(key, val);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
getItem: (key) => {
|
|
37
|
-
if (getPlatform() === 'electron') {
|
|
38
|
-
return window.electronAPI.getStoreItem(key);
|
|
39
|
-
} else {
|
|
40
|
-
return window.localStorage.getItem(key);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
removeItem: (key) => {
|
|
44
|
-
if (getPlatform() === 'electron') {
|
|
45
|
-
return window.electronAPI.removeStoreItem(key);
|
|
46
|
-
} else {
|
|
47
|
-
return window.localStorage.removeItem(key);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
export const getPlatform = () => {
|
|
52
|
-
try {
|
|
53
|
-
if (window.electronAPI.available()) return 'electron';
|
|
54
|
-
// if(window.electronAPI.available()) return process.env.MODE
|
|
55
|
-
} catch {
|
|
56
|
-
return process.env.MODE;
|
|
57
|
-
}
|
|
58
|
-
};
|