web-core-tcm 0.0.24 → 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/.editorconfig +7 -0
- package/.github/workflows/test.yml +29 -0
- package/.prettierrc.json +5 -0
- package/.vscode/extensions.json +15 -0
- package/.vscode/settings.json +9 -0
- package/eslint.config.js +83 -0
- package/index.html +24 -0
- package/package.json +1 -4
- package/postcss.config.js +29 -0
- package/public/favicon.ico +0 -0
- package/public/icons/favicon-128x128.png +0 -0
- package/public/icons/favicon-16x16.png +0 -0
- package/public/icons/favicon-32x32.png +0 -0
- package/public/icons/favicon-96x96.png +0 -0
- package/quasar.config.ts +233 -0
- package/src/App.vue +7 -0
- package/src/api/algorithm/comprehensiveAlgorithm.ts +20 -0
- package/src/api/algorithm/index.ts +50 -0
- package/src/api/algorithm/inquiriesAlgorithm.ts +16 -0
- package/src/api/algorithm/inspectionsAlgorithm.ts +11 -0
- package/src/api/algorithm/lisemsAlgorithm.ts +16 -0
- package/src/api/algorithm/pulsationsAlgorithm.ts +8 -0
- package/src/api/authorization/alova/apiDefinitions.ts +23 -0
- package/src/api/authorization/alova/createApis.ts +114 -0
- package/src/api/authorization/alova/globals.d.ts +394 -0
- package/src/api/authorization/alova/implement/authorization.ts +14 -0
- package/src/api/authorization/alova/implement/index.ts +1 -0
- package/src/api/authorization/alova/index.ts +22 -0
- package/src/api/authorization/authorization.ts +16 -0
- package/src/api/authorization/index.ts +2 -0
- package/src/api/check/alova/apiDefinitions.ts +30 -0
- package/src/api/check/alova/createApis.ts +114 -0
- package/src/api/check/alova/globals.d.ts +1257 -0
- package/src/api/check/alova/implement/check.ts +165 -0
- package/src/api/check/alova/implement/index.ts +1 -0
- package/src/api/check/alova/index.ts +22 -0
- package/src/api/check/check.ts +217 -0
- package/src/api/check/index.ts +2 -0
- package/src/api/config/alova/index.ts +71 -0
- package/src/api/config/index.ts +132 -0
- package/src/api/device/device.js +58 -0
- package/src/api/doctor/alova/apiDefinitions.ts +28 -0
- package/src/api/doctor/alova/createApis.ts +114 -0
- package/src/api/doctor/alova/globals.d.ts +559 -0
- package/src/api/doctor/alova/implement/doctor.ts +51 -0
- package/src/api/doctor/alova/implement/index.ts +1 -0
- package/src/api/doctor/alova/index.ts +23 -0
- package/src/api/doctor/doctor.ts +53 -0
- package/src/api/doctor/index.ts +2 -0
- package/src/api/index.ts +12 -0
- package/src/api/metric/implement/index.ts +1 -0
- package/src/api/metric/implement/metric.ts +108 -0
- package/src/api/metric/index.ts +2 -0
- package/src/api/metric/metric.ts +114 -0
- package/src/api/oauth/alova/apiDefinitions.ts +26 -0
- package/src/api/oauth/alova/createApis.ts +114 -0
- package/src/api/oauth/alova/globals.d.ts +460 -0
- package/src/api/oauth/alova/implement/index.ts +1 -0
- package/src/api/oauth/alova/implement/oauth.ts +24 -0
- package/src/api/oauth/alova/index.ts +21 -0
- package/src/api/oauth/index.ts +2 -0
- package/src/api/oauth/oauth.ts +19 -0
- package/src/api/outpatient/alova/apiDefinitions.ts +27 -0
- package/src/api/outpatient/alova/createApis.ts +114 -0
- package/src/api/outpatient/alova/globals.d.ts +685 -0
- package/src/api/outpatient/alova/implement/index.ts +1 -0
- package/src/api/outpatient/alova/implement/outpatient.ts +91 -0
- package/src/api/outpatient/alova/index.ts +22 -0
- package/src/api/outpatient/index.ts +2 -0
- package/src/api/outpatient/outpatient.ts +67 -0
- package/src/api/patient/alova/apiDefinitions.ts +41 -0
- package/src/api/patient/alova/createApis.ts +114 -0
- package/src/api/patient/alova/globals.d.ts +1690 -0
- package/src/api/patient/alova/implement/index.ts +2 -0
- package/src/api/patient/alova/implement/meta.ts +517 -0
- package/src/api/patient/alova/implement/patient.ts +99 -0
- package/src/api/patient/alova/index.ts +22 -0
- package/src/api/patient/core.ts +133 -0
- package/src/api/patient/index.ts +4 -0
- package/src/api/patient/meta.ts +570 -0
- package/src/api/patient/patient.ts +98 -0
- package/src/api/prescription/alova/apiDefinitions.ts +29 -0
- package/src/api/prescription/alova/createApis.ts +114 -0
- package/src/api/prescription/alova/globals.d.ts +968 -0
- package/src/api/prescription/alova/implement/herbal.ts +68 -0
- package/src/api/prescription/alova/implement/index.ts +2 -0
- package/src/api/prescription/alova/implement/prescription.ts +62 -0
- package/src/api/prescription/alova/index.ts +22 -0
- package/src/api/prescription/herbal.ts +51 -0
- package/src/api/prescription/index.ts +3 -0
- package/src/api/prescription/prescription.ts +76 -0
- package/src/api/scientist/alova/apiDefinitions.ts +27 -0
- package/src/api/scientist/alova/createApis.ts +114 -0
- package/src/api/scientist/alova/globals.d.ts +447 -0
- package/src/api/scientist/alova/implement/index.ts +1 -0
- package/src/api/scientist/alova/implement/scientist.ts +40 -0
- package/src/api/scientist/alova/index.ts +24 -0
- package/src/api/scientist/index.ts +2 -0
- package/src/api/scientist/scientist.ts +49 -0
- package/src/assets/quasar-logo-vertical.svg +15 -0
- package/src/boot/.gitkeep +0 -0
- package/src/components/ExampleComponent.vue +37 -0
- package/src/components/models.ts +8 -0
- package/src/css/app.scss +1 -0
- package/src/css/quasar.variables.scss +25 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +3 -0
- package/src/layouts/UserLayout.vue +108 -0
- package/src/pages/LoginPage.vue +29 -0
- package/src/proto/Images.proto +7 -0
- package/src/proto/WaveMap.proto +10 -0
- package/src/proto/index.ts +2 -0
- package/src/proto/types/Images_pb.ts +48 -0
- package/src/proto/types/WaveMap_pb.ts +59 -0
- package/src/router/index.ts +37 -0
- package/src/router/routes.ts +14 -0
- package/src/util/RichTextUtil.ts +5 -0
- package/src/util/datetime.ts +43 -0
- package/src/util/export.ts +46 -0
- package/src/util/helper.ts +159 -0
- package/src/util/image.ts +28 -0
- package/src/util/number.ts +146 -0
- package/src/util/s256.js +27 -0
- package/src/util/secret.ts +60 -0
- package/src/util/string.ts +121 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Check, Payment } from 'src/api/check/check';
|
|
2
|
+
|
|
3
|
+
export class AlovaCheck extends Check {
|
|
4
|
+
override async get() {
|
|
5
|
+
return this.of(
|
|
6
|
+
await checkApi.checkStateRestful
|
|
7
|
+
.getCheckState({
|
|
8
|
+
pathParams: {
|
|
9
|
+
id: this.id,
|
|
10
|
+
},
|
|
11
|
+
async transform(res) {
|
|
12
|
+
return new AlovaCheck().of(res);
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
.send(),
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override async put() {
|
|
20
|
+
return this.of(
|
|
21
|
+
await checkApi.checkStateRestful
|
|
22
|
+
.putCheckState({
|
|
23
|
+
pathParams: {
|
|
24
|
+
id: this.id,
|
|
25
|
+
},
|
|
26
|
+
data: this.state(),
|
|
27
|
+
})
|
|
28
|
+
.send(true),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override async post() {
|
|
33
|
+
return this.of(
|
|
34
|
+
await checkApi.checkStateRestful
|
|
35
|
+
.postCheckState({
|
|
36
|
+
data: this.state(),
|
|
37
|
+
})
|
|
38
|
+
.send(true),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
override delete() {
|
|
42
|
+
void checkApi.checkStateRestful
|
|
43
|
+
.deleteCheckState({
|
|
44
|
+
pathParams: {
|
|
45
|
+
id: this.id,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
.send();
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
static override query(
|
|
52
|
+
page: number,
|
|
53
|
+
pageSize: number,
|
|
54
|
+
sort: string,
|
|
55
|
+
patientId?: string,
|
|
56
|
+
doctorId?: string,
|
|
57
|
+
startTime?: string,
|
|
58
|
+
endTime?: string,
|
|
59
|
+
patientName?: string,
|
|
60
|
+
patientGender?: string,
|
|
61
|
+
patientPhoneNumber?: string,
|
|
62
|
+
) {
|
|
63
|
+
return checkApi.checkStateRestful
|
|
64
|
+
.queryCheckState({
|
|
65
|
+
params: {
|
|
66
|
+
...{ ...(patientId && { patientId }) },
|
|
67
|
+
...{ ...(doctorId && { doctorId }) },
|
|
68
|
+
...{ ...(startTime && { startTime }) },
|
|
69
|
+
...{ ...(endTime && { endTime }) },
|
|
70
|
+
...{ ...(patientName && { patientName }) },
|
|
71
|
+
...{ ...(patientGender && { patientGender }) },
|
|
72
|
+
...{ ...(patientPhoneNumber && { patientPhoneNumber }) },
|
|
73
|
+
pageSize,
|
|
74
|
+
page,
|
|
75
|
+
sort,
|
|
76
|
+
},
|
|
77
|
+
async transform(res) {
|
|
78
|
+
const data = await Promise.all(
|
|
79
|
+
res.content.map((item) => {
|
|
80
|
+
return new AlovaCheck().of(item);
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
return {
|
|
84
|
+
data: data,
|
|
85
|
+
total: res.totalElements,
|
|
86
|
+
page: res.number,
|
|
87
|
+
pageSize: res.size,
|
|
88
|
+
pageCount: res.totalPages,
|
|
89
|
+
isLastPage: res.last,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
.send();
|
|
94
|
+
}
|
|
95
|
+
static override queryPayment(
|
|
96
|
+
page: number,
|
|
97
|
+
pageSize: number,
|
|
98
|
+
doctorId?: string,
|
|
99
|
+
patientId?: string,
|
|
100
|
+
patientName?: string,
|
|
101
|
+
patientPhone?: string,
|
|
102
|
+
prescriptionPaymentStatus?: number,
|
|
103
|
+
outboundStatus?: number,
|
|
104
|
+
) {
|
|
105
|
+
return checkApi.checkStateRestful
|
|
106
|
+
.queryPaymentState({
|
|
107
|
+
params: {
|
|
108
|
+
...{ ...(doctorId && { doctorId }) },
|
|
109
|
+
...{ ...(patientId && { patientId }) },
|
|
110
|
+
...{ ...(patientName && { patientName }) },
|
|
111
|
+
...{ ...(patientPhone && { patientPhone }) },
|
|
112
|
+
...{ ...(prescriptionPaymentStatus && { prescriptionPaymentStatus }) },
|
|
113
|
+
...{ ...(outboundStatus && { outboundStatus }) },
|
|
114
|
+
pageSize: pageSize,
|
|
115
|
+
page: page,
|
|
116
|
+
},
|
|
117
|
+
async transform(res) {
|
|
118
|
+
const data = await Promise.all(
|
|
119
|
+
res.content.map((item) => {
|
|
120
|
+
return new AlovaPayment().of(item);
|
|
121
|
+
}),
|
|
122
|
+
);
|
|
123
|
+
return {
|
|
124
|
+
data: data,
|
|
125
|
+
total: res.totalElements,
|
|
126
|
+
page: res.number,
|
|
127
|
+
pageSize: res.size,
|
|
128
|
+
pageCount: res.totalPages,
|
|
129
|
+
isLastPage: res.last,
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
.send();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
export class AlovaPayment extends Payment {
|
|
137
|
+
override async putOutboundStatus(status: number) {
|
|
138
|
+
this.outboundStatus = status;
|
|
139
|
+
await checkApi.checkStateRestful
|
|
140
|
+
.putCheckState({
|
|
141
|
+
pathParams: {
|
|
142
|
+
id: this.id,
|
|
143
|
+
},
|
|
144
|
+
data: {
|
|
145
|
+
outboundStatus: status,
|
|
146
|
+
},
|
|
147
|
+
})
|
|
148
|
+
.send(true);
|
|
149
|
+
return Promise.resolve(this);
|
|
150
|
+
}
|
|
151
|
+
override async putPrescriptionPaymentStatus(status: number) {
|
|
152
|
+
this.prescriptionPaymentStatus = status;
|
|
153
|
+
await checkApi.checkStateRestful
|
|
154
|
+
.putCheckState({
|
|
155
|
+
pathParams: {
|
|
156
|
+
id: this.id,
|
|
157
|
+
},
|
|
158
|
+
data: {
|
|
159
|
+
prescriptionPaymentStatus: status,
|
|
160
|
+
},
|
|
161
|
+
})
|
|
162
|
+
.send(true);
|
|
163
|
+
return Promise.resolve(this);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './check';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createAlova } from 'alova';
|
|
2
|
+
import fetchAdapter from 'alova/fetch';
|
|
3
|
+
import { createApis, withConfigType, mountApis } from './createApis';
|
|
4
|
+
import { onAuthRequired, responded } from 'src/api/config/alova';
|
|
5
|
+
import { getServiceEndpoint, ServiceType } from 'src/api/config';
|
|
6
|
+
|
|
7
|
+
export const alovaInstance = createAlova({
|
|
8
|
+
baseURL: getServiceEndpoint(ServiceType.Check),
|
|
9
|
+
requestAdapter: fetchAdapter(),
|
|
10
|
+
beforeRequest: onAuthRequired(),
|
|
11
|
+
cacheFor: null,
|
|
12
|
+
responded: responded,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const $$userConfigMap = withConfigType({});
|
|
16
|
+
|
|
17
|
+
const Apis = createApis(alovaInstance, $$userConfigMap);
|
|
18
|
+
|
|
19
|
+
mountApis(Apis);
|
|
20
|
+
|
|
21
|
+
export default Apis;
|
|
22
|
+
export * from './implement';
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Patient } from 'src/api/patient/patient';
|
|
2
|
+
import type { Page } from 'src/api/patient/core';
|
|
3
|
+
import { Tag } from 'src/api/patient/core';
|
|
4
|
+
import { NetworkObject, Sequence } from 'src/api/patient/core';
|
|
5
|
+
import type { CheckState, PaymentState } from 'src/api/check/alova/globals';
|
|
6
|
+
import { Metas } from 'src/api/patient/meta';
|
|
7
|
+
import { Prescription } from 'src/api/prescription/prescription';
|
|
8
|
+
import { AlovaPrescription } from 'src/api/prescription/alova/implement/prescription';
|
|
9
|
+
import type { PrescriptionState } from 'src/api/prescription/alova/globals';
|
|
10
|
+
import { extractPlainText } from 'src/util/RichTextUtil';
|
|
11
|
+
import { Doctor } from 'src/api/doctor/doctor';
|
|
12
|
+
import { Herbal } from 'src/api/prescription';
|
|
13
|
+
import type { IBuilder } from 'builder-pattern';
|
|
14
|
+
import { Builder } from 'builder-pattern';
|
|
15
|
+
|
|
16
|
+
export abstract class Check extends NetworkObject {
|
|
17
|
+
static override builder(): IBuilder<Check> {
|
|
18
|
+
return Builder(this._default) as unknown as IBuilder<Check>;
|
|
19
|
+
}
|
|
20
|
+
static override default(): typeof Check {
|
|
21
|
+
return this._default as unknown as typeof Check;
|
|
22
|
+
}
|
|
23
|
+
id: string = '';
|
|
24
|
+
doctor: Doctor = Doctor.builder().build();
|
|
25
|
+
patient: Patient = Patient.builder().build();
|
|
26
|
+
diagnosis: string = '';
|
|
27
|
+
tags: Tag[] = [] as Tag[];
|
|
28
|
+
prescriptions: Sequence<Prescription> = new Sequence<Prescription>();
|
|
29
|
+
createdTimestamp: string = Date.now().toString();
|
|
30
|
+
updatedTimestamp: string = Date.now().toString();
|
|
31
|
+
prescriptionPaymentStatus: number = 0;
|
|
32
|
+
outboundStatus: number = 0;
|
|
33
|
+
//购买类型
|
|
34
|
+
paymentType: string = '医保';
|
|
35
|
+
//就诊方式
|
|
36
|
+
outpatientType: string = '预约';
|
|
37
|
+
draft: boolean = false;
|
|
38
|
+
isEditing: boolean = false;
|
|
39
|
+
metas: Metas = Metas.builder().build();
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
const prescription = Prescription.builder().build();
|
|
43
|
+
prescription.herbals.push(Herbal.builder().build());
|
|
44
|
+
this.prescriptions.data.push(prescription);
|
|
45
|
+
}
|
|
46
|
+
async of(json: CheckState) {
|
|
47
|
+
if (json.tagsState != undefined)
|
|
48
|
+
this.tags = await Promise.all(
|
|
49
|
+
json.tagsState.map((item) => {
|
|
50
|
+
const clTag = new Tag();
|
|
51
|
+
return clTag.of(item);
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
if (json.id != undefined) this.id = json.id;
|
|
55
|
+
if (json.prescriptionsState != undefined) {
|
|
56
|
+
this.prescriptions = new Sequence<AlovaPrescription>();
|
|
57
|
+
const prescriptionStates = JSON.parse(json.prescriptionsState) as PrescriptionState[];
|
|
58
|
+
const prescription = await Promise.all(
|
|
59
|
+
prescriptionStates.map(async (item) => {
|
|
60
|
+
return new AlovaPrescription().of(item);
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
this.prescriptions.data.push(...prescription);
|
|
64
|
+
}
|
|
65
|
+
if (this.prescriptions.data.length === 0)
|
|
66
|
+
this.prescriptions.data.push(Prescription.builder().build());
|
|
67
|
+
if (json.diagnosis != undefined) {
|
|
68
|
+
if (json.diagnosis.indexOf('脉证') !== 0 && json.diagnosis.indexOf('\n脉证') === -1) {
|
|
69
|
+
json.diagnosis = json.diagnosis.replaceAll('脉证', '\n脉证');
|
|
70
|
+
}
|
|
71
|
+
if (json.diagnosis.indexOf('\n方证') === -1) {
|
|
72
|
+
json.diagnosis = json.diagnosis.replaceAll('方证', '\n方证');
|
|
73
|
+
}
|
|
74
|
+
this.diagnosis = extractPlainText(json.diagnosis);
|
|
75
|
+
}
|
|
76
|
+
if (json.doctorState != undefined) this.doctor = await this.doctor.of(json.doctorState);
|
|
77
|
+
if (json.patientState != undefined) this.patient = await this.patient.of(json.patientState);
|
|
78
|
+
if (json.createdTimestamp != undefined) this.createdTimestamp = json.createdTimestamp!;
|
|
79
|
+
if (json.updatedTimestamp != undefined) this.updatedTimestamp = json.updatedTimestamp!;
|
|
80
|
+
if (json.prescriptionPaymentStatus != undefined)
|
|
81
|
+
this.prescriptionPaymentStatus = json.prescriptionPaymentStatus!;
|
|
82
|
+
if (json.outboundStatus != undefined) this.outboundStatus = json.outboundStatus!;
|
|
83
|
+
if (json.paymentType != undefined) this.paymentType = json.paymentType!;
|
|
84
|
+
if (json.outpatientType != undefined) this.outpatientType = json.outpatientType!;
|
|
85
|
+
if (json.metasState != undefined) {
|
|
86
|
+
this.metas.addMetas(await Promise.all(json.metasState.map((item) => Metas.map(item))));
|
|
87
|
+
}
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
state() {
|
|
92
|
+
console.log(this);
|
|
93
|
+
const state = {} as CheckState;
|
|
94
|
+
state.id = this.id;
|
|
95
|
+
state.doctorState = this.doctor.state();
|
|
96
|
+
state.patientState = this.patient.state();
|
|
97
|
+
state.outpatientType = this.outpatientType;
|
|
98
|
+
state.paymentType = this.paymentType;
|
|
99
|
+
// Note: We can't populate metaIds here as it would create a circular dependency
|
|
100
|
+
// The metaIds should be populated by the caller if needed
|
|
101
|
+
state.diagnosis = extractPlainText(this.diagnosis.replace('</div>', '\n<div>'));
|
|
102
|
+
state.createdTimestamp = this.createdTimestamp;
|
|
103
|
+
// Note: We'll leave prescriptions handling for the caller due to complexity
|
|
104
|
+
state.diagnosis = this.diagnosis;
|
|
105
|
+
state.tagsState = this.tags.map((item) => item.state());
|
|
106
|
+
state.createdTimestamp = this.createdTimestamp;
|
|
107
|
+
state.updatedTimestamp = this.updatedTimestamp;
|
|
108
|
+
state.prescriptionsState = JSON.stringify(this.prescriptions.data.map((item) => item.state()));
|
|
109
|
+
state.metasState = Metas.standards().flatMap((type) =>
|
|
110
|
+
this.metas[type].data.map((item) => item.state()),
|
|
111
|
+
);
|
|
112
|
+
return state;
|
|
113
|
+
}
|
|
114
|
+
abstract get(): Promise<this>;
|
|
115
|
+
abstract put(): Promise<this>;
|
|
116
|
+
abstract post(): Promise<this>;
|
|
117
|
+
abstract delete(): Promise<void>;
|
|
118
|
+
|
|
119
|
+
static query(
|
|
120
|
+
page: number,
|
|
121
|
+
pageSize: number,
|
|
122
|
+
sort: string,
|
|
123
|
+
patientId?: string,
|
|
124
|
+
doctorId?: string,
|
|
125
|
+
startTime?: string,
|
|
126
|
+
endTime?: string,
|
|
127
|
+
patientName?: string,
|
|
128
|
+
patientGender?: string,
|
|
129
|
+
patientPhoneNumber?: string,
|
|
130
|
+
): Promise<Page<Check>> {
|
|
131
|
+
return Check.default().query(
|
|
132
|
+
page,
|
|
133
|
+
pageSize,
|
|
134
|
+
sort,
|
|
135
|
+
patientId,
|
|
136
|
+
doctorId,
|
|
137
|
+
startTime,
|
|
138
|
+
endTime,
|
|
139
|
+
patientName,
|
|
140
|
+
patientGender,
|
|
141
|
+
patientPhoneNumber,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
static queryPayment(
|
|
145
|
+
page: number,
|
|
146
|
+
pageSize: number,
|
|
147
|
+
doctorId?: string,
|
|
148
|
+
patientId?: string,
|
|
149
|
+
patientName?: string,
|
|
150
|
+
patientPhone?: string,
|
|
151
|
+
prescriptionPaymentStatus?: number,
|
|
152
|
+
outboundStatus?: number,
|
|
153
|
+
): Promise<Page<Payment>> {
|
|
154
|
+
return Check.default().queryPayment(
|
|
155
|
+
page,
|
|
156
|
+
pageSize,
|
|
157
|
+
doctorId,
|
|
158
|
+
patientId,
|
|
159
|
+
patientName,
|
|
160
|
+
patientPhone,
|
|
161
|
+
prescriptionPaymentStatus,
|
|
162
|
+
outboundStatus,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export abstract class Payment extends NetworkObject {
|
|
167
|
+
static override builder(): IBuilder<Payment> {
|
|
168
|
+
return Builder(this._default) as unknown as IBuilder<Payment>;
|
|
169
|
+
}
|
|
170
|
+
static override default(): typeof Payment {
|
|
171
|
+
return this._default as unknown as typeof Payment;
|
|
172
|
+
}
|
|
173
|
+
id: string = '';
|
|
174
|
+
prescription: string = '';
|
|
175
|
+
doctorId: string = '';
|
|
176
|
+
patientId: string = '';
|
|
177
|
+
patientName: string = '';
|
|
178
|
+
patientPhone: string = '';
|
|
179
|
+
patientGender: string = '';
|
|
180
|
+
createdTimestamp: number = 0;
|
|
181
|
+
updatedTimestamp: number = 0;
|
|
182
|
+
prescriptionPaymentStatus: number = 0;
|
|
183
|
+
outboundStatus: number = 0;
|
|
184
|
+
async of(json: PaymentState) {
|
|
185
|
+
this.id = json.id!;
|
|
186
|
+
this.prescription = json.prescription ? json.prescription : '';
|
|
187
|
+
this.doctorId = json.doctorId!;
|
|
188
|
+
this.patientId = json.patientId!;
|
|
189
|
+
this.patientName = json.patientName ? json.patientName : '';
|
|
190
|
+
this.patientPhone = json.patientPhone ? json.patientPhone : '';
|
|
191
|
+
this.patientGender = json.patientGender ? json.patientGender : '';
|
|
192
|
+
this.createdTimestamp = json.createdTimestamp ? json.createdTimestamp : 0;
|
|
193
|
+
this.updatedTimestamp = json.updatedTimestamp ? json.updatedTimestamp : 0;
|
|
194
|
+
this.prescriptionPaymentStatus = json.prescriptionPaymentStatus
|
|
195
|
+
? json.prescriptionPaymentStatus
|
|
196
|
+
: 0;
|
|
197
|
+
this.outboundStatus = json.outboundStatus ? json.outboundStatus : 0;
|
|
198
|
+
return Promise.resolve(this);
|
|
199
|
+
}
|
|
200
|
+
state(): PaymentState {
|
|
201
|
+
return {
|
|
202
|
+
id: this.id,
|
|
203
|
+
prescription: this.prescription,
|
|
204
|
+
doctorId: this.doctorId,
|
|
205
|
+
patientId: this.patientId,
|
|
206
|
+
patientName: this.patientName,
|
|
207
|
+
patientPhone: this.patientPhone,
|
|
208
|
+
patientGender: this.patientGender,
|
|
209
|
+
createdTimestamp: this.createdTimestamp,
|
|
210
|
+
updatedTimestamp: this.updatedTimestamp,
|
|
211
|
+
prescriptionPaymentStatus: this.prescriptionPaymentStatus,
|
|
212
|
+
outboundStatus: this.outboundStatus,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
abstract putOutboundStatus(status: number): Promise<this>;
|
|
216
|
+
abstract putPrescriptionPaymentStatus(status: number): Promise<this>;
|
|
217
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createClientTokenAuthentication } from 'alova/client';
|
|
2
|
+
import { storageHelper } from 'src/util/helper';
|
|
3
|
+
import { jwtDecode } from 'jwt-decode';
|
|
4
|
+
import type { Method } from 'alova';
|
|
5
|
+
|
|
6
|
+
export const { onAuthRequired } = createClientTokenAuthentication({
|
|
7
|
+
assignToken: (method) => {
|
|
8
|
+
if (!storageHelper.getItem('token')) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
method.config.headers.Authorization = 'Bearer ' + storageHelper.getItem('token');
|
|
12
|
+
},
|
|
13
|
+
visitorMeta: {
|
|
14
|
+
isVisitor: true,
|
|
15
|
+
},
|
|
16
|
+
login: {
|
|
17
|
+
metaMatches: {
|
|
18
|
+
login: true,
|
|
19
|
+
},
|
|
20
|
+
handler: async (response: Response) => {
|
|
21
|
+
if (response.status != 200) throw new Error('登录失败' + (await response.text()));
|
|
22
|
+
await response.json().then((data) => {
|
|
23
|
+
storageHelper.setItem('token', data.token);
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
refreshToken: {
|
|
28
|
+
// 在请求前触发,将接收到method参数,并返回boolean表示token是否过期
|
|
29
|
+
isExpired: () => {
|
|
30
|
+
if (!storageHelper.getItem('token')) return false;
|
|
31
|
+
const decoded = jwtDecode(storageHelper.getItem('token'));
|
|
32
|
+
// 如果没有 exp 声明,默认永不过期
|
|
33
|
+
if (decoded.exp === undefined) return false;
|
|
34
|
+
|
|
35
|
+
// 获取当前时间(秒)
|
|
36
|
+
const currentTime = Date.now() / 1000;
|
|
37
|
+
|
|
38
|
+
// 检查是否过期
|
|
39
|
+
return decoded.exp < currentTime;
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// 当token过期时触发,在此函数中触发刷新token
|
|
43
|
+
handler: async () => {
|
|
44
|
+
// token刷新失败,跳转回登录页
|
|
45
|
+
storageHelper.removeItem('token');
|
|
46
|
+
window.location.href = '登录';
|
|
47
|
+
return await Promise.resolve();
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
export const responded = {
|
|
52
|
+
onSuccess: async (response: Response, method: Method) => {
|
|
53
|
+
if (response.status == 401) {
|
|
54
|
+
if (method.meta['Login']) {
|
|
55
|
+
throw new Error(response.status.toString());
|
|
56
|
+
}
|
|
57
|
+
console.log('未登录');
|
|
58
|
+
storageHelper.removeItem('token');
|
|
59
|
+
window.location.href = process.env.APP_URL!;
|
|
60
|
+
}
|
|
61
|
+
if ('application/octet-stream' == response.headers.get('Content-Type')) return response;
|
|
62
|
+
if (response.status == 200 || response.status == 201 || response.status == 204) {
|
|
63
|
+
const raw = await response.text();
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(raw);
|
|
66
|
+
} catch {
|
|
67
|
+
return raw;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import punycode from 'punycode';
|
|
2
|
+
//设置服务类型有哪些
|
|
3
|
+
export enum ServiceType {
|
|
4
|
+
OAuth = 'OAuth',
|
|
5
|
+
OAuthRedirect = 'OAuthRedirect',
|
|
6
|
+
Doctor = 'Doctor',
|
|
7
|
+
Patient = 'Patient',
|
|
8
|
+
Scientist = 'Scientist',
|
|
9
|
+
Outpatient = 'Outpatient',
|
|
10
|
+
Check = 'Check',
|
|
11
|
+
Prescription = 'Prescription',
|
|
12
|
+
Authorization = 'Authorization',
|
|
13
|
+
InspectionsAlgorithm = 'InspectionsAlgorithm',
|
|
14
|
+
PulsationsAlgorithm = 'PulsationsAlgorithm',
|
|
15
|
+
InquiriesAlgorithm = 'InquiriesAlgorithm',
|
|
16
|
+
LisemsAlgorithm = 'LisemsAlgorithm',
|
|
17
|
+
ComprehensiveAlgorithm = 'ComprehensiveAlgorithm',
|
|
18
|
+
}
|
|
19
|
+
//设置服务类型有哪些
|
|
20
|
+
export enum EnvironmentType {
|
|
21
|
+
Dev = 'Dev',
|
|
22
|
+
Prod = 'Prod',
|
|
23
|
+
Local = 'Local',
|
|
24
|
+
}
|
|
25
|
+
export const getServiceEndpoint = (serviceType: ServiceType, env?: EnvironmentType) => {
|
|
26
|
+
if (env == undefined) {
|
|
27
|
+
if (punycode.toUnicode(window.location.hostname).includes('测试')) env = EnvironmentType.Dev;
|
|
28
|
+
else if (
|
|
29
|
+
window.location.hostname.includes('localhost') ||
|
|
30
|
+
window.location.hostname.includes('127.0.0.1')
|
|
31
|
+
)
|
|
32
|
+
env = EnvironmentType.Prod;
|
|
33
|
+
else env = EnvironmentType.Prod;
|
|
34
|
+
}
|
|
35
|
+
if (env == EnvironmentType.Prod) {
|
|
36
|
+
switch (serviceType) {
|
|
37
|
+
case ServiceType.OAuth:
|
|
38
|
+
return 'https://用户.仪联中.中国';
|
|
39
|
+
case ServiceType.OAuthRedirect:
|
|
40
|
+
return 'https://用户.仪联中.中国/互联/服务/互联/授权?response_type=code&state=1223&client_id=tcm&scope=profile';
|
|
41
|
+
case ServiceType.Doctor:
|
|
42
|
+
return 'https://中医.仪联中.中国';
|
|
43
|
+
case ServiceType.Patient:
|
|
44
|
+
return 'https://中医.仪联中.中国';
|
|
45
|
+
case ServiceType.Scientist:
|
|
46
|
+
return 'https://中医.仪联中.中国';
|
|
47
|
+
case ServiceType.Outpatient:
|
|
48
|
+
return 'https://中医.仪联中.中国';
|
|
49
|
+
case ServiceType.Check:
|
|
50
|
+
return 'https://中医.仪联中.中国';
|
|
51
|
+
case ServiceType.Prescription:
|
|
52
|
+
return 'https://中医.仪联中.中国';
|
|
53
|
+
case ServiceType.Authorization:
|
|
54
|
+
return 'https://中医.仪联中.中国';
|
|
55
|
+
case ServiceType.InspectionsAlgorithm:
|
|
56
|
+
return 'https://中医.仪联中.中国/望诊/算法';
|
|
57
|
+
case ServiceType.PulsationsAlgorithm:
|
|
58
|
+
return 'https://中医.仪联中.中国/切诊/算法';
|
|
59
|
+
case ServiceType.InquiriesAlgorithm:
|
|
60
|
+
return 'https://中医.仪联中.中国/问诊/算法';
|
|
61
|
+
case ServiceType.LisemsAlgorithm:
|
|
62
|
+
return 'https://中医.仪联中.中国/闻诊/算法';
|
|
63
|
+
case ServiceType.ComprehensiveAlgorithm:
|
|
64
|
+
return 'https://中医.仪联中.中国/四诊合参/算法';
|
|
65
|
+
}
|
|
66
|
+
} else if (env == EnvironmentType.Dev) {
|
|
67
|
+
switch (serviceType) {
|
|
68
|
+
case ServiceType.OAuth:
|
|
69
|
+
return 'https://用户测试.仪联中.中国';
|
|
70
|
+
case ServiceType.OAuthRedirect:
|
|
71
|
+
return 'https://用户测试.仪联中.中国/互联/服务/互联/授权?response_type=code&state=1223&client_id=tcm&scope=profile';
|
|
72
|
+
case ServiceType.Doctor:
|
|
73
|
+
return 'https://中医测试.仪联中.中国';
|
|
74
|
+
case ServiceType.Patient:
|
|
75
|
+
return 'https://中医测试.仪联中.中国';
|
|
76
|
+
case ServiceType.Scientist:
|
|
77
|
+
return 'https://中医测试.仪联中.中国';
|
|
78
|
+
case ServiceType.Outpatient:
|
|
79
|
+
return 'https://中医测试.仪联中.中国';
|
|
80
|
+
case ServiceType.Check:
|
|
81
|
+
return 'https://中医测试.仪联中.中国';
|
|
82
|
+
case ServiceType.Prescription:
|
|
83
|
+
return 'https://中医测试.仪联中.中国';
|
|
84
|
+
case ServiceType.Authorization:
|
|
85
|
+
return 'https://中医测试.仪联中.中国';
|
|
86
|
+
case ServiceType.InspectionsAlgorithm:
|
|
87
|
+
return 'https://中医测试.仪联中.中国/望诊/算法';
|
|
88
|
+
case ServiceType.PulsationsAlgorithm:
|
|
89
|
+
return 'https://中医测试.仪联中.中国/切诊/算法';
|
|
90
|
+
case ServiceType.InquiriesAlgorithm:
|
|
91
|
+
return 'https://中医测试.仪联中.中国/问诊/算法';
|
|
92
|
+
case ServiceType.LisemsAlgorithm:
|
|
93
|
+
return 'https://中医测试.仪联中.中国/闻诊/算法';
|
|
94
|
+
case ServiceType.ComprehensiveAlgorithm:
|
|
95
|
+
return 'https://中医测试.仪联中.中国/四诊合参/算法';
|
|
96
|
+
}
|
|
97
|
+
} else if (env == EnvironmentType.Local) {
|
|
98
|
+
switch (serviceType) {
|
|
99
|
+
case ServiceType.OAuth:
|
|
100
|
+
return 'http://localhost:8080';
|
|
101
|
+
case ServiceType.OAuthRedirect:
|
|
102
|
+
return 'https://用户.仪联中.中国/互联/服务/互联/授权?response_type=code&state=1223&client_id=tcm&scope=profile';
|
|
103
|
+
case ServiceType.Doctor:
|
|
104
|
+
return 'http://localhost:8080';
|
|
105
|
+
case ServiceType.Patient:
|
|
106
|
+
return 'http://localhost:8080';
|
|
107
|
+
case ServiceType.Scientist:
|
|
108
|
+
return 'http://localhost:8080';
|
|
109
|
+
case ServiceType.Outpatient:
|
|
110
|
+
return 'http://localhost:8080';
|
|
111
|
+
case ServiceType.Check:
|
|
112
|
+
return 'http://localhost:8080';
|
|
113
|
+
case ServiceType.Prescription:
|
|
114
|
+
return 'http://localhost:8080';
|
|
115
|
+
case ServiceType.Authorization:
|
|
116
|
+
return 'http://localhost:8080';
|
|
117
|
+
case ServiceType.InspectionsAlgorithm:
|
|
118
|
+
return 'http://localhost:8080';
|
|
119
|
+
case ServiceType.PulsationsAlgorithm:
|
|
120
|
+
return 'http://localhost:8080';
|
|
121
|
+
case ServiceType.InquiriesAlgorithm:
|
|
122
|
+
return 'http://localhost:8080';
|
|
123
|
+
case ServiceType.LisemsAlgorithm:
|
|
124
|
+
return 'http://localhost:8080';
|
|
125
|
+
case ServiceType.ComprehensiveAlgorithm:
|
|
126
|
+
return 'http://localhost:8080';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
throw new Error('环境错误');
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export * from './alova';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { useQuasar } from 'quasar';
|
|
3
|
+
|
|
4
|
+
const $q = useQuasar();
|
|
5
|
+
export const port = ref();
|
|
6
|
+
|
|
7
|
+
export async function connectToSerialPort() {
|
|
8
|
+
try {
|
|
9
|
+
const SerialOptions = {
|
|
10
|
+
baudRate: 115200,
|
|
11
|
+
dataBits: 8,
|
|
12
|
+
stopBits: 1,
|
|
13
|
+
bufferSize: 1024,
|
|
14
|
+
};
|
|
15
|
+
port.value = await navigator.serial.requestPort();
|
|
16
|
+
if (!port.value) {
|
|
17
|
+
$q.dialog({
|
|
18
|
+
title: '错误',
|
|
19
|
+
message: '未选择串口',
|
|
20
|
+
});
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
await port.value.open(SerialOptions);
|
|
24
|
+
console.log('port', port.value.getInfo());
|
|
25
|
+
return true;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Error connecting to serial port:', error);
|
|
28
|
+
$q.dialog({
|
|
29
|
+
title: '错误',
|
|
30
|
+
message: '连接串口失败',
|
|
31
|
+
});
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function getPortInfo() {
|
|
36
|
+
return port.value?.getInfo();
|
|
37
|
+
}
|
|
38
|
+
export async function disconnectToSerialPort() {
|
|
39
|
+
if (!port.value) {
|
|
40
|
+
console.error('Serial port not available');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await port.value.close();
|
|
44
|
+
port.value = null;
|
|
45
|
+
console.log('Serial port disconnected');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function sendText(text) {
|
|
49
|
+
if (port.value) {
|
|
50
|
+
const writer = port.value.writable.getWriter();
|
|
51
|
+
console.log('text', text);
|
|
52
|
+
|
|
53
|
+
await writer.write(new TextEncoder().encode(text));
|
|
54
|
+
await writer.close();
|
|
55
|
+
} else {
|
|
56
|
+
console.error('Serial port not available');
|
|
57
|
+
}
|
|
58
|
+
}
|