web-core-tcm 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/package.json +41 -21
  2. package/.editorconfig +0 -7
  3. package/.github/workflows/test.yml +0 -29
  4. package/.prettierrc.json +0 -5
  5. package/.vscode/extensions.json +0 -15
  6. package/.vscode/settings.json +0 -9
  7. package/eslint.config.js +0 -83
  8. package/index.html +0 -24
  9. package/postcss.config.js +0 -29
  10. package/public/favicon.ico +0 -0
  11. package/public/icons/favicon-128x128.png +0 -0
  12. package/public/icons/favicon-16x16.png +0 -0
  13. package/public/icons/favicon-32x32.png +0 -0
  14. package/public/icons/favicon-96x96.png +0 -0
  15. package/quasar.config.ts +0 -220
  16. package/src/App.vue +0 -7
  17. package/src/api/algorithm/comprehensiveAlgorithm.ts +0 -20
  18. package/src/api/algorithm/index.ts +0 -50
  19. package/src/api/algorithm/inquiriesAlgorithm.ts +0 -19
  20. package/src/api/algorithm/inspectionsAlgorithm.ts +0 -11
  21. package/src/api/algorithm/lisemsAlgorithm.ts +0 -16
  22. package/src/api/algorithm/pulsationsAlgorithm.ts +0 -9
  23. package/src/api/authorization/alova/apiDefinitions.ts +0 -23
  24. package/src/api/authorization/alova/createApis.ts +0 -99
  25. package/src/api/authorization/alova/globals.d.ts +0 -373
  26. package/src/api/authorization/alova/implement/authorization.ts +0 -12
  27. package/src/api/authorization/alova/implement/index.ts +0 -1
  28. package/src/api/authorization/alova/index.ts +0 -23
  29. package/src/api/authorization/authorization.ts +0 -16
  30. package/src/api/authorization/index.ts +0 -2
  31. package/src/api/check/alova/apiDefinitions.ts +0 -30
  32. package/src/api/check/alova/createApis.ts +0 -99
  33. package/src/api/check/alova/globals.d.ts +0 -1248
  34. package/src/api/check/alova/implement/check.ts +0 -119
  35. package/src/api/check/alova/implement/index.ts +0 -1
  36. package/src/api/check/alova/index.ts +0 -23
  37. package/src/api/check/check.ts +0 -164
  38. package/src/api/check/index.ts +0 -2
  39. package/src/api/config/alova/index.ts +0 -72
  40. package/src/api/config/index.ts +0 -130
  41. package/src/api/device/device.js +0 -58
  42. package/src/api/doctor/alova/apiDefinitions.ts +0 -28
  43. package/src/api/doctor/alova/createApis.ts +0 -99
  44. package/src/api/doctor/alova/globals.d.ts +0 -550
  45. package/src/api/doctor/alova/implement/doctor.ts +0 -37
  46. package/src/api/doctor/alova/implement/index.ts +0 -1
  47. package/src/api/doctor/alova/index.ts +0 -23
  48. package/src/api/doctor/doctor.ts +0 -53
  49. package/src/api/doctor/index.ts +0 -2
  50. package/src/api/index.ts +0 -15
  51. package/src/api/metric/implement/index.ts +0 -1
  52. package/src/api/metric/implement/metric.ts +0 -98
  53. package/src/api/metric/index.ts +0 -2
  54. package/src/api/metric/metric.ts +0 -114
  55. package/src/api/oauth/alova/apiDefinitions.ts +0 -26
  56. package/src/api/oauth/alova/createApis.ts +0 -99
  57. package/src/api/oauth/alova/globals.d.ts +0 -451
  58. package/src/api/oauth/alova/implement/index.ts +0 -1
  59. package/src/api/oauth/alova/implement/oauth.ts +0 -19
  60. package/src/api/oauth/alova/index.ts +0 -22
  61. package/src/api/oauth/index.ts +0 -2
  62. package/src/api/oauth/oauth.ts +0 -15
  63. package/src/api/outpatient/alova/apiDefinitions.ts +0 -27
  64. package/src/api/outpatient/alova/createApis.ts +0 -99
  65. package/src/api/outpatient/alova/globals.d.ts +0 -676
  66. package/src/api/outpatient/alova/implement/index.ts +0 -1
  67. package/src/api/outpatient/alova/implement/outpatient.ts +0 -66
  68. package/src/api/outpatient/alova/index.ts +0 -23
  69. package/src/api/outpatient/index.ts +0 -2
  70. package/src/api/outpatient/outpatient.ts +0 -62
  71. package/src/api/patient/alova/apiDefinitions.ts +0 -41
  72. package/src/api/patient/alova/createApis.ts +0 -99
  73. package/src/api/patient/alova/globals.d.ts +0 -1677
  74. package/src/api/patient/alova/implement/index.ts +0 -2
  75. package/src/api/patient/alova/implement/meta.ts +0 -488
  76. package/src/api/patient/alova/implement/patient.ts +0 -77
  77. package/src/api/patient/alova/index.ts +0 -24
  78. package/src/api/patient/core.ts +0 -131
  79. package/src/api/patient/index.ts +0 -4
  80. package/src/api/patient/meta.ts +0 -466
  81. package/src/api/patient/patient.ts +0 -98
  82. package/src/api/prescription/alova/apiDefinitions.ts +0 -29
  83. package/src/api/prescription/alova/createApis.ts +0 -99
  84. package/src/api/prescription/alova/globals.d.ts +0 -959
  85. package/src/api/prescription/alova/implement/herbal.ts +0 -48
  86. package/src/api/prescription/alova/implement/index.ts +0 -2
  87. package/src/api/prescription/alova/implement/prescription.ts +0 -45
  88. package/src/api/prescription/alova/index.ts +0 -23
  89. package/src/api/prescription/herbal.ts +0 -44
  90. package/src/api/prescription/index.ts +0 -3
  91. package/src/api/prescription/prescription.ts +0 -68
  92. package/src/api/scientist/alova/apiDefinitions.ts +0 -27
  93. package/src/api/scientist/alova/createApis.ts +0 -99
  94. package/src/api/scientist/alova/globals.d.ts +0 -438
  95. package/src/api/scientist/alova/implement/index.ts +0 -1
  96. package/src/api/scientist/alova/implement/scientist.ts +0 -29
  97. package/src/api/scientist/alova/index.ts +0 -23
  98. package/src/api/scientist/index.ts +0 -2
  99. package/src/api/scientist/scientist.ts +0 -49
  100. package/src/assets/quasar-logo-vertical.svg +0 -15
  101. package/src/boot/.gitkeep +0 -0
  102. package/src/components/ExampleComponent.vue +0 -37
  103. package/src/components/models.ts +0 -8
  104. package/src/css/app.scss +0 -1
  105. package/src/css/quasar.variables.scss +0 -25
  106. package/src/env.d.ts +0 -7
  107. package/src/index.ts +0 -4
  108. package/src/layouts/UserLayout.vue +0 -106
  109. package/src/pages/LoginPage.vue +0 -32
  110. package/src/proto/Images.proto +0 -7
  111. package/src/proto/WaveMap.proto +0 -10
  112. package/src/proto/index.ts +0 -2
  113. package/src/proto/types/Images_pb.ts +0 -48
  114. package/src/proto/types/WaveMap_pb.ts +0 -59
  115. package/src/router/index.ts +0 -37
  116. package/src/router/routes.ts +0 -14
  117. package/src/util/RichTextUtil.ts +0 -5
  118. package/src/util/datetime.ts +0 -43
  119. package/src/util/export.ts +0 -46
  120. package/src/util/helper.ts +0 -159
  121. package/src/util/image.ts +0 -28
  122. package/src/util/number.ts +0 -146
  123. package/src/util/s256.js +0 -30
  124. package/src/util/secret.ts +0 -60
  125. package/src/util/string.ts +0 -121
  126. package/tsconfig.json +0 -3
@@ -1,131 +0,0 @@
1
- import type { AnnotationState, TagState } from '@core/api/patient/alova/globals';
2
- import type { IBuilder } from 'builder-pattern';
3
- import { Builder } from 'builder-pattern';
4
- export class Page<T>{
5
- data: T[] = [];
6
- total: number = 0;
7
- page: number = 0;
8
- pageSize: number = 0;
9
- pageCount: number = 0;
10
- isLastPage: boolean = false;
11
- }
12
- abstract class NetworkObject {
13
- static _default: typeof NetworkObject = NetworkObject;
14
- static builder(): IBuilder<unknown>{
15
- return Builder(this._default)
16
- }
17
- static default(): typeof NetworkObject{
18
- return NetworkObject
19
- }
20
- abstract of(json: unknown): Promise<this>
21
- abstract state(): unknown
22
- }
23
-
24
- class Annotation extends NetworkObject{
25
- value: string = '';
26
- actor: string = '';
27
- timestamp: string = '';
28
- static override builder(): IBuilder<Annotation>{
29
- return Builder(Annotation) as unknown as IBuilder<Annotation>
30
- }
31
- constructor(value: string = '', actor: string = '', timestamp: string = '') {
32
- super();
33
- this.value = value;
34
- this.actor = actor;
35
- this.timestamp = timestamp;
36
- }
37
- override of(json: AnnotationState) {
38
- this.value = json.value!;
39
- this.actor = json.actor!;
40
- this.timestamp = json.timestamp!;
41
- return Promise.resolve(this)
42
- }
43
- override state(): AnnotationState {
44
- return {
45
- value: this.value,
46
- actor: this.actor,
47
- timestamp: this.timestamp,
48
- }
49
- }
50
- }
51
-
52
- class Tag extends NetworkObject{
53
- static override builder(): IBuilder<Tag>{
54
- return Builder(Tag) as unknown as IBuilder<Tag>
55
- }
56
- static override default(): typeof Tag{
57
- return Tag
58
- }
59
- key: string = '';
60
- annotations: Annotation[] = [];
61
- constructor(key: string = '',annotations: Annotation[] = []) {
62
- super();
63
- this.key = key;
64
- this.annotations = annotations;
65
- }
66
- override async of(json: TagState): Promise<this> {
67
- this.key = json.key!;
68
- for(const item of json.annotationsState!){
69
- this.annotations.push(await new Annotation().of(item))
70
- }
71
- return this
72
- }
73
- override state(): TagState {
74
- return {
75
- key: this.key,
76
- annotationsState: this.annotations.map(item => item.state()),
77
- }
78
- }
79
- getLastValue(): string{
80
- return this.getLastAnnotation().value
81
- }
82
- getLastAnnotation(): Annotation {
83
- return this.annotations[this.annotations.length - 1]!;
84
- }
85
- static getValueTagSet(tags: Tag[]): Tag[]{
86
- const filterTag = [] as Tag[]
87
- tags.forEach(tag => {
88
- const key = tag.key
89
- const value = tag.getLastAnnotation().value.slice(0,10)
90
- if(filterTag.find(tag => tag.key == key && tag.getLastAnnotation().value.slice(0,10) == value))return
91
- filterTag.push(tag)
92
- })
93
- return filterTag
94
- }
95
- assign(tag: Tag) {
96
- this.key = tag.key;
97
- this.annotations = tag.annotations;
98
- return this
99
- }
100
- }
101
-
102
- class Sequence<T> {
103
- data: T[] = [];
104
- current: T = {} as T;
105
- showed: boolean = false;
106
- constructor(
107
- data: T[] = [],
108
- current: T = {} as T,
109
- ) {
110
- this.data = data;
111
- this.current = current;
112
- }
113
- delete(item: T): T {
114
- this.data.splice(this.data.indexOf(item), 1);
115
- return item
116
- }
117
- choose(item: T): T {
118
- this.current = item;
119
- return item
120
- }
121
- clear(): this {
122
- this.data.length = 0;
123
- this.current = {} as T;
124
- return this
125
- }
126
- show(): Sequence<T>{
127
- this.showed = true
128
- return this
129
- }
130
- }
131
- export { NetworkObject, Tag, Sequence, Annotation }
@@ -1,4 +0,0 @@
1
- export * from './core';
2
- export * from './meta';
3
- export * from './patient';
4
- export * from './alova/index';
@@ -1,466 +0,0 @@
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
- import { create, fromBinary, toBinary } from '@bufbuild/protobuf';
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
- import type { IBuilder } from 'builder-pattern';
13
- import { Builder } from 'builder-pattern';
14
- //Enum Type
15
- export enum MetaType{
16
- Pulsation = 'pulsation',
17
- Tongue = 'tongue',
18
- Appendix = 'appendix',
19
- PPG = 'ppg',
20
- PCG = 'pcg',
21
- ECG = 'ecg',
22
- Scene = 'scene',
23
- Face = 'face',
24
- Complaint = 'complaint',
25
- Meta = 'meta'
26
- }
27
- export abstract class Meta extends NetworkObject{
28
- static override builder(): IBuilder<unknown>{
29
- return Builder(this._default) as unknown as IBuilder<Meta>;
30
- }
31
- static override default(): typeof Meta {
32
- return this._default as unknown as typeof Meta;
33
- }
34
- id: string = '';
35
- owner: Patient = Patient.builder().build();
36
- type: MetaType = MetaType.Face;
37
- tags: Tag[] = [] as Tag[];
38
- createdTimestamp: string = '0';
39
- updatedTimestamp: string = '0';
40
-
41
- isSelected: boolean = false;
42
- override async of(json: MetaState): Promise<this>{
43
- if(json.id != undefined)this.id = json.id;
44
- if(json.ownerState != undefined)this.owner = await Patient.builder().build().of(json.ownerState);
45
- if(json.tagsState != undefined)this.tags = await Promise.all(json.tagsState.map(tag => Tag.builder().build().of(tag)));
46
- if(json.createdTimestamp != undefined)this.createdTimestamp = json.createdTimestamp;
47
- if(json.updatedTimestamp != undefined)this.updatedTimestamp = json.updatedTimestamp;
48
- if(json.type != undefined)this.type = json.type as MetaType;
49
- return Promise.resolve(this);
50
- }
51
- override state(): MetaState{
52
- return {
53
- id: this.id,
54
- ownerState: this.owner.state(),
55
- type: this.type,
56
- tagsState: this.tags.map(tag => tag.state()),
57
- createdTimestamp: this.createdTimestamp,
58
- updatedTimestamp: this.updatedTimestamp,
59
- }
60
- }
61
- getTagValue(key: string): string|undefined {
62
- const annotation = this.tags.find((tag) => tag.key == key)?.getLastAnnotation()
63
- return annotation?annotation.value: '';
64
- }
65
- putTags() {
66
- return patientApi.metaStateRestful.putMetaState({
67
- pathParams: {
68
- id: this.id,
69
- },
70
- data: {
71
- id: this.id,
72
- tagsState: this.tags.map(tag => tag.state()),
73
- }
74
- })
75
- }
76
- addTag(tag: Tag){
77
- this.tags.push(tag)
78
- return this.putTags()
79
- }
80
- removeTag(tag: Tag){
81
- this.tags.splice(this.tags.indexOf(tag), 1);
82
- return this.putTags()
83
- }
84
- abstract analyze(): Promise<this>;
85
- abstract getObject():Promise<unknown>
86
- abstract get():Promise<this>
87
- abstract put():Promise<this>
88
- abstract post():Promise<this>
89
- abstract delete():Promise<this>
90
- abstract serialize(object: unknown):ArrayBuffer
91
- abstract deserialize(buffer: ArrayBuffer): unknown
92
- abstract inject(object: unknown): Promise<this>
93
- static queryMetaWithPatient(page: number, pageSize: number, owner?: Patient, type?: string, startTime?: string, endTime?: string, sort?: string, patientName?: string, patientPhoneNumber?: string, patientStartBirthdate?: string, patientEndBirthdate?: string, patientGender?: string, tags?: Tag[]): Promise<Page<Meta>>{
94
- return this.default().queryMetaWithPatient(page, pageSize,owner, type, startTime, endTime,sort, patientName, patientPhoneNumber, patientStartBirthdate, patientEndBirthdate, patientGender, tags)
95
- }
96
- static query(page: number, pageSize: number,owner?: Patient, type?: string, startTime?: string, endTime?: string,sort="createdTimestamp:asc"): Promise<Page<Meta>>{
97
- return this.default().query(page, pageSize,owner, type, startTime, endTime,sort)
98
- }
99
- static queryMetaStateByExactMatch(id?: string[], owner?: Patient[], type?: string[], pageSize?: number, page?: number, startTime?: string, endTime?: string, sort?: string): Promise<Page<Meta>>{
100
- return this.default().queryMetaStateByExactMatch(id, owner, type, pageSize, page, startTime, endTime, sort)
101
- }
102
- }
103
- export abstract class ImageMeta extends Meta {
104
- image?: Image;
105
- base64Image: string = '';
106
- // 测试序列化往返
107
-
108
- override serialize(): ArrayBuffer {
109
- if (!this.image)throw new Error("not found")
110
- return toBinary(ImageSchema, this.image).buffer
111
- }
112
- override deserialize(buffer: ArrayBuffer): string {
113
- this.image = fromBinary(ImageSchema, new Uint8Array(buffer))
114
- this.base64Image = arrayBufferToImageBase64(this.image.bytes);
115
- return this.base64Image
116
- }
117
- override inject(buffer: ArrayBuffer): Promise<this> {
118
- if (buffer) {
119
- this.image = create(ImageSchema, {
120
- bytes: new Uint8Array(buffer)
121
- });
122
- this.base64Image = arrayBufferToImageBase64(new Uint8Array(buffer));
123
- }
124
- return Promise.resolve(this)
125
- }
126
- abstract override getObject():Promise<string>
127
- }
128
- export abstract class ImagesMeta extends Meta{
129
- images?: Images;
130
- base64Images: string[] = [];
131
- override serialize(): ArrayBuffer {
132
- if (!this.images)throw new Error("not found")
133
- return toBinary(ImagesSchema, this.images).buffer
134
- }
135
- override deserialize(buffer: ArrayBuffer): string[] {
136
- this.images = fromBinary(ImagesSchema, new Uint8Array(buffer));
137
- this.base64Images = this.images.images.map(item=> arrayBufferToImageBase64(item.bytes))
138
- return this.base64Images
139
- }
140
- override inject(buffers?: ArrayBuffer[]): Promise<this> {
141
- if (buffers) {
142
- this.images = create(ImagesSchema, {
143
- images: buffers.map(buffer => {
144
- return create(ImageSchema, {
145
- bytes: new Uint8Array(buffer)
146
- });
147
- })
148
- });
149
- this.base64Images = buffers.map(buffer => {
150
- return arrayBufferToImageBase64(new Uint8Array(buffer));
151
- });
152
- }
153
- return Promise.resolve(this)
154
- }
155
- abstract override getObject():Promise<string[]>
156
- }
157
- export abstract class TextMeta extends Meta {
158
- text: string = '';
159
- constructor() {
160
- super();
161
- }
162
- override serialize(): ArrayBuffer {
163
- return new TextEncoder().encode(this.text).buffer
164
- }
165
- override deserialize(buffer: ArrayBuffer): string {
166
- this.text = new TextDecoder().decode(buffer);
167
- return this.text
168
- }
169
- override inject(text?: string): Promise<this> {
170
- if (text) {
171
- this.text = text;
172
- }
173
- return Promise.resolve(this)
174
- }
175
- abstract override getObject():Promise<string>
176
- }
177
- export abstract class WavesMeta extends Meta{
178
- waves: WaveMap|undefined;
179
- override serialize(): ArrayBuffer {
180
- console.log('serialize',this.waves)
181
- if(this.waves){
182
- console.log('seruia')
183
- console.log(toBinary(WaveMapSchema, this.waves),toBinary(WaveMapSchema, this.waves).buffer)
184
- console.log('sss')
185
- }
186
- if(!this.waves)throw new Error("not found")
187
- return toBinary(WaveMapSchema, this.waves).buffer
188
- }
189
- override deserialize(buffer: ArrayBuffer): WaveMap {
190
- this.waves = fromBinary(WaveMapSchema, new Uint8Array(buffer));
191
- return this.waves
192
- }
193
- abstract preprocess(origins: { [key: string]: number[] }): Promise<{ [key: string]: number[] }>
194
- override async inject(origins?: { [key: string]: number[] },smooths?: { [key: string]: number[] }): Promise<this> {
195
- if(!smooths && origins){
196
- smooths = await this.preprocess(origins)
197
- }
198
- console.log(origins,smooths)
199
- if (origins && smooths){
200
- console.log(this.waves)
201
- this.waves = create(WaveMapSchema, {
202
- origin: Object.fromEntries(
203
- Object.entries(origins).map(([key, value]) => [
204
- key,
205
- create(WaveSchema, {
206
- values: value,
207
- }),
208
- ])
209
- ),
210
- smooth: Object.fromEntries(
211
- Object.entries(smooths).map(([key, value]) => [
212
- key,
213
- create(WaveSchema, {
214
- values: value,
215
- }),
216
- ])
217
- ),
218
- });
219
- console.log(this.waves)
220
- }
221
- return Promise.resolve(this)
222
- }
223
- abstract override getObject():Promise<WaveMap>
224
- }
225
- export abstract class TongueMeta extends ImageMeta {
226
- static override builder(): IBuilder<TongueMeta>{
227
- return Builder(this._default) as unknown as IBuilder<TongueMeta>;
228
- }
229
- static override default(): typeof TongueMeta {
230
- return this._default as unknown as typeof TongueMeta;
231
- }
232
- constructor(){
233
- super();
234
- this.type = MetaType.Tongue;
235
- }
236
- }
237
- export abstract class FaceMeta extends ImageMeta {
238
- static override builder(): IBuilder<FaceMeta>{
239
- return Builder(this._default) as unknown as IBuilder<FaceMeta>;
240
- }
241
- static override default(): typeof FaceMeta {
242
- return this._default as unknown as typeof FaceMeta;
243
- }
244
- constructor() {
245
- super();
246
- this.type = MetaType.Face;
247
- }
248
- }
249
- export abstract class SceneMeta extends ImageMeta {
250
- static override builder(): IBuilder<SceneMeta>{
251
- return Builder(this._default) as unknown as IBuilder<SceneMeta>;
252
- }
253
- static override default(): typeof SceneMeta {
254
- return this._default as unknown as typeof SceneMeta;
255
- }
256
- constructor() {
257
- super();
258
- this.type = MetaType.Scene;
259
- }
260
- }
261
- export abstract class PulsationMeta extends WavesMeta {
262
- static override builder(): IBuilder<PulsationMeta>{
263
- return Builder(this._default) as unknown as IBuilder<PulsationMeta>;
264
- }
265
- static override default(): typeof PulsationMeta {
266
- return this._default as unknown as typeof PulsationMeta;
267
- }
268
- constructor() {
269
- super();
270
- this.type = MetaType.Pulsation;
271
- }
272
- }
273
- export abstract class PPGMeta extends WavesMeta {
274
- static override builder(): IBuilder<PPGMeta>{
275
- return Builder(this._default) as unknown as IBuilder<PPGMeta>;
276
- }
277
- static override default(): typeof PPGMeta {
278
- return this._default as unknown as typeof PPGMeta;
279
- }
280
- constructor() {
281
- super();
282
- this.type = MetaType.PPG;
283
- }
284
- }
285
- export abstract class PCGMeta extends WavesMeta {
286
- static override builder(): IBuilder<PCGMeta>{
287
- return Builder(this._default) as unknown as IBuilder<PCGMeta>;
288
- }
289
- static override default(): typeof PCGMeta {
290
- return this._default as unknown as typeof PCGMeta;
291
- }
292
- constructor() {
293
- super();
294
- this.type = MetaType.PCG;
295
- }
296
- }
297
- export abstract class ECGMeta extends WavesMeta {
298
- static override builder(): IBuilder<ECGMeta>{
299
- return Builder(this._default) as unknown as IBuilder<ECGMeta>;
300
- }
301
- static override default(): typeof ECGMeta {
302
- return this._default as unknown as typeof ECGMeta;
303
- }
304
- constructor() {
305
- super();
306
- this.type = MetaType.ECG;
307
- }
308
- }
309
- export abstract class AppendixMeta extends ImagesMeta {
310
- static override builder(): IBuilder<AppendixMeta>{
311
- return Builder(this._default) as unknown as IBuilder<AppendixMeta>;
312
- }
313
- static override default(): typeof AppendixMeta {
314
- return this._default as unknown as typeof AppendixMeta;
315
- }
316
- constructor() {
317
- super();
318
- this.type = MetaType.Appendix;
319
- }
320
- }
321
- export abstract class ComplaintMeta extends TextMeta {
322
- static override builder(): IBuilder<ComplaintMeta>{
323
- return Builder(this._default) as unknown as IBuilder<ComplaintMeta>;
324
- }
325
- static override default(): typeof ComplaintMeta {
326
- return this._default as unknown as typeof ComplaintMeta;
327
- }
328
- constructor() {
329
- super();
330
- this.type = MetaType.Complaint;
331
- }
332
- }
333
-
334
- export class MetaSequence<T extends Meta> extends Sequence<T> {
335
- type: MetaType;
336
- owner?: Patient;
337
- expand: boolean = false;
338
- constructor(type: MetaType, owner?: Patient) {
339
- super();
340
- this.type = type;
341
- if (owner) this.owner = owner;
342
- }
343
- init(owner: Patient){
344
- this.clear();
345
- this.owner = Patient.builder().id(owner.id).build();
346
- }
347
- async query(
348
- page: number,
349
- pageSize: number,
350
- startTime?: string,
351
- endTime?: string,
352
- sort?: string,
353
- ): Promise<Page<Meta>> {
354
- this.clear();
355
- return this.append(page, pageSize, startTime, endTime, sort);
356
- }
357
- async append(
358
- page: number,
359
- pageSize: number,
360
- startTime?: string,
361
- endTime?: string,
362
- sort?: string,
363
- ): Promise<Page<Meta>> {
364
- const pageable = (await Meta.query(page, pageSize, this.owner, this.type, startTime, endTime, sort))
365
- this.data.unshift(...pageable.data.reverse() as T[]);
366
- return pageable
367
- }
368
- async appendMetaWithPatient(page: number, pageSize: number, type?: string, startTime?: string, endTime?: string,sort?: string, name?: string, phoneNumber?: string, startBirthdate?: string, endBirthdate?: string, gender?: string, tags?: Tag[]): Promise<Page<Meta>> {
369
- const pageable = (await Meta.queryMetaWithPatient(page, pageSize,this.owner, type, startTime, endTime,sort, name, phoneNumber, startBirthdate, endBirthdate, gender,tags))
370
- this.data.unshift(...pageable.data.reverse() as T[]);
371
- return pageable
372
- }
373
- }
374
- export const MetaTypeConfig = {
375
- [MetaType.Face]: { type: FaceMeta, name: '面象', icon: 'face', color: '#FF6B6B' },
376
- [MetaType.Tongue]: { type: TongueMeta, name: '舌象', icon: 'face', color: '#4ECDC4' },
377
- [MetaType.Complaint]: { type: ComplaintMeta, name: '主诉', icon: 'message', color: '#FFD166' },
378
- [MetaType.Pulsation]: { type: PulsationMeta, name: '脉象', icon: 'ssid_chart', color: '#06D6A0' },
379
- [MetaType.ECG]: { type: ECGMeta, name: '心电', icon: 'ssid_chart', color: '#118AB2' },
380
- [MetaType.PCG]: { type: PCGMeta, name: '心音', icon: 'ssid_chart', color: '#073B4C' },
381
- [MetaType.PPG]: { type: PPGMeta, name: '心光', icon: 'ssid_chart', color: '#7209B7' },
382
- [MetaType.Scene]: { type: SceneMeta, name: '场景', icon: 'house', color: '#F72585' },
383
- [MetaType.Appendix]: { type: AppendixMeta, name: '附件', icon: 'folder_open', color: '#3A86FF' },
384
- [MetaType.Meta]: { type: Meta, name: '元', icon: 'tag', color: '#8338EC' }
385
- };
386
- export abstract class Metas{
387
- static _default: typeof Metas
388
- static builder(): IBuilder<Metas>{
389
- return Builder(this._default) as unknown as IBuilder<Metas>;
390
- }
391
- static default(): typeof Metas {
392
- return this._default as unknown as typeof Metas;
393
- }
394
-
395
- [MetaType.Face] = new MetaSequence<FaceMeta>(MetaType.Face);
396
- [MetaType.Tongue] = new MetaSequence<TongueMeta>(MetaType.Tongue);
397
- [MetaType.Complaint] = new MetaSequence<ComplaintMeta>(MetaType.Complaint);
398
- [MetaType.Pulsation] = new MetaSequence<PulsationMeta>(MetaType.Pulsation);
399
- [MetaType.ECG] = new MetaSequence<ECGMeta>(MetaType.ECG);
400
- [MetaType.PCG] = new MetaSequence<PCGMeta>(MetaType.PCG);
401
- [MetaType.PPG] = new MetaSequence<PPGMeta>(MetaType.PPG);
402
- [MetaType.Scene] = new MetaSequence<SceneMeta>(MetaType.Scene);
403
- [MetaType.Appendix] = new MetaSequence<AppendixMeta>(MetaType.Appendix);
404
- [MetaType.Meta] = new MetaSequence<Meta>(MetaType.Meta);
405
- faces = this[MetaType.Face];
406
- tongues = this[MetaType.Tongue];
407
- complaints = this[MetaType.Complaint];
408
- pulsations = this[MetaType.Pulsation];
409
- ecgs = this[MetaType.ECG];
410
- pcgs = this[MetaType.PCG];
411
- ppgs = this[MetaType.PPG];
412
- scenes = this[MetaType.Scene];
413
- appendixes = this[MetaType.Appendix];
414
- metas = this[MetaType.Meta];
415
- constructor(metas?: Meta[]) {
416
- if(metas)this.addMetas(metas)
417
- }
418
- init(owner: Patient): this{
419
- for (const type of Object.values(MetaType)) {
420
- this[type].init(owner);
421
- }
422
- return this
423
- }
424
- async query(
425
- page: number,
426
- pageSize: number,
427
- startTime?: string,
428
- endTime?: string,
429
- sort?: string,
430
- ): Promise<this> {
431
- for (const type of Object.values(MetaType)) {
432
- //print
433
- const metas = await this[type].query(page, pageSize, startTime, endTime, sort);
434
- for(const meta of metas.data){
435
- (this[type].data as Meta[]).push(meta);
436
- }
437
- }
438
- return this
439
- }
440
- addMetas(metas: Meta[]){
441
- for(const meta of metas){
442
- this.addMeta(meta)
443
- }
444
- return this
445
- }
446
- addMeta(meta: Meta){
447
- const exist = this[meta.type].data.find(item => item.id == meta.id)
448
- if(!exist)(this[meta.type].data as Meta[]).unshift(meta)
449
- else void exist.of(meta)
450
- return this
451
- }
452
- clear(){
453
- for (const type of Object.values(MetaType)) {
454
- this[type].clear();
455
- }
456
- }
457
- static map(meta: MetaState): Promise<Meta> {
458
- return Metas.default().map(meta)
459
- }
460
- static mapText(type: MetaType){
461
- return MetaTypeConfig[type].name
462
- }
463
- static standards(): MetaType[]{
464
- return [MetaType.Face, MetaType.Tongue, MetaType.Complaint, MetaType.Pulsation, MetaType.ECG, MetaType.PCG, MetaType.PPG, MetaType.Scene, MetaType.Appendix]
465
- }
466
- }
@@ -1,98 +0,0 @@
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
- import type { IBuilder } from 'builder-pattern';
7
- import { Builder } from 'builder-pattern';
8
- import { getName } from '@core/util/string';
9
-
10
- export abstract class Patient extends NetworkObject {
11
- static override builder(): IBuilder<Patient>{
12
- return Builder(this._default) as unknown as IBuilder<Patient>;
13
- }
14
- static override default(): typeof Patient {
15
- return this._default as unknown as typeof Patient;
16
- }
17
- id = '';
18
- name = '';
19
- gender = '';
20
- phoneNumber = '';
21
- birthdate = '';
22
- identity = '';
23
- age = 0;
24
- tags: Tag[] = [];
25
- remarks: string[] = [];
26
- doctorId = '';
27
- createdTimestamp = '';
28
- updatedTimestamp = '';
29
- mainSymptom = '';
30
- metas: Metas = Metas.builder().build();
31
- init(id?: string, metas?: Metas) {
32
- if(id)this.id = id;
33
- if(metas)this.metas = metas;
34
- this.metas.init(this)
35
- }
36
-
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){
43
- this.birthdate = json.birthdate;
44
- //计算年龄
45
- this.age = new Date().getFullYear() - new Date(json.birthdate).getFullYear();
46
- }
47
- if(json.identity != undefined)this.identity = json.identity;
48
- if(json.tagsState != undefined)this.tags = await Promise.all(json.tagsState.map(tag => Tag.builder().build().of(tag)));
49
- if(json.remarks != undefined){
50
-
51
- this.remarks = json.remarks;
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)
58
- return this;
59
- }
60
-
61
- override state() {
62
- const state = {} as PatientState;
63
- if (this.id) state.id = this.id;
64
- if (this.name) state.name = this.name;
65
- if (this.gender) state.gender = this.gender;
66
- if (this.phoneNumber) state.phoneNumber = this.phoneNumber;
67
- if (this.birthdate) state.birthdate = this.birthdate;
68
- if (this.identity) state.identity = this.identity;
69
- if (this.tags.length > 0) state.tagsState = this.tags.map(item => item.state());
70
- if (this.doctorId) state.doctorId = this.doctorId;
71
- if (this.createdTimestamp) state.createdTimestamp = this.createdTimestamp;
72
- if (this.updatedTimestamp) state.updatedTimestamp = this.updatedTimestamp;
73
- if (this.mainSymptom) state.mainSymptom = this.mainSymptom;
74
- if (this.remarks.length > 0) state.remarks = this.remarks;
75
- return state;
76
- }
77
-
78
- abstract get(): Promise<this>;
79
- abstract put(): Promise<this>;
80
- abstract post(): Promise<this>;
81
- abstract delete(): Promise<this>;
82
- abstract putRemarks(): Promise<this>;
83
- static query(params: {
84
- id?: string;
85
- doctorId?: string;
86
- name?: string;
87
- gender?: string;
88
- identity?: string;
89
- pageSize: number;
90
- page: number;
91
- phoneNumber?: string;
92
- startTime?: string;
93
- endTime?: string;
94
- sort?: string;
95
- }): Promise<Page<Patient>> {
96
- return this.default().query(params);
97
- }
98
- }