@primocaredentgroup/prescriptions-component 0.1.0

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 (120) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -0
  3. package/dist/_internal/client/PrescriptionsComponentClient.d.ts +25 -0
  4. package/dist/_internal/client/PrescriptionsComponentClient.d.ts.map +1 -0
  5. package/dist/_internal/client/PrescriptionsComponentClient.js +61 -0
  6. package/dist/_internal/client/PrescriptionsComponentClient.js.map +1 -0
  7. package/dist/_internal/client/index.d.ts +3 -0
  8. package/dist/_internal/client/index.d.ts.map +1 -0
  9. package/dist/_internal/client/index.js +2 -0
  10. package/dist/_internal/client/index.js.map +1 -0
  11. package/dist/_internal/client/types.d.ts +47 -0
  12. package/dist/_internal/client/types.d.ts.map +1 -0
  13. package/dist/_internal/client/types.js +2 -0
  14. package/dist/_internal/client/types.js.map +1 -0
  15. package/dist/_internal/component/convex.config.d.ts +7 -0
  16. package/dist/_internal/component/convex.config.d.ts.map +1 -0
  17. package/dist/_internal/component/convex.config.js +8 -0
  18. package/dist/_internal/component/convex.config.js.map +1 -0
  19. package/dist/_internal/component/functions.d.ts +9 -0
  20. package/dist/_internal/component/functions.d.ts.map +1 -0
  21. package/dist/_internal/component/functions.js +11 -0
  22. package/dist/_internal/component/functions.js.map +1 -0
  23. package/dist/_internal/component/index.d.ts +18 -0
  24. package/dist/_internal/component/index.d.ts.map +1 -0
  25. package/dist/_internal/component/index.js +20 -0
  26. package/dist/_internal/component/index.js.map +1 -0
  27. package/dist/_internal/component/schema.d.ts +2 -0
  28. package/dist/_internal/component/schema.d.ts.map +1 -0
  29. package/dist/_internal/component/schema.js +2 -0
  30. package/dist/_internal/component/schema.js.map +1 -0
  31. package/dist/_internal/react/PrescriptionsWidget.d.ts +18 -0
  32. package/dist/_internal/react/PrescriptionsWidget.d.ts.map +1 -0
  33. package/dist/_internal/react/PrescriptionsWidget.js +137 -0
  34. package/dist/_internal/react/PrescriptionsWidget.js.map +1 -0
  35. package/dist/_internal/react/index.d.ts +3 -0
  36. package/dist/_internal/react/index.d.ts.map +1 -0
  37. package/dist/_internal/react/index.js +2 -0
  38. package/dist/_internal/react/index.js.map +1 -0
  39. package/dist/client/index.d.ts +1 -0
  40. package/dist/client/index.js +1 -0
  41. package/dist/component/convex.config.d.ts +2 -0
  42. package/dist/component/convex.config.js +2 -0
  43. package/dist/component/index.d.ts +1 -0
  44. package/dist/component/index.js +1 -0
  45. package/dist/convex/lib/auth.d.ts +7 -0
  46. package/dist/convex/lib/auth.d.ts.map +1 -0
  47. package/dist/convex/lib/auth.js +38 -0
  48. package/dist/convex/lib/auth.js.map +1 -0
  49. package/dist/convex/lib/clinicalNormalize.d.ts +13 -0
  50. package/dist/convex/lib/clinicalNormalize.d.ts.map +1 -0
  51. package/dist/convex/lib/clinicalNormalize.js +82 -0
  52. package/dist/convex/lib/clinicalNormalize.js.map +1 -0
  53. package/dist/convex/lib/dental.d.ts +13 -0
  54. package/dist/convex/lib/dental.d.ts.map +1 -0
  55. package/dist/convex/lib/dental.js +79 -0
  56. package/dist/convex/lib/dental.js.map +1 -0
  57. package/dist/convex/lib/dynamicFieldsStrict.d.ts +9 -0
  58. package/dist/convex/lib/dynamicFieldsStrict.d.ts.map +1 -0
  59. package/dist/convex/lib/dynamicFieldsStrict.js +65 -0
  60. package/dist/convex/lib/dynamicFieldsStrict.js.map +1 -0
  61. package/dist/convex/lib/dynamicRules.d.ts +61 -0
  62. package/dist/convex/lib/dynamicRules.d.ts.map +1 -0
  63. package/dist/convex/lib/dynamicRules.js +221 -0
  64. package/dist/convex/lib/dynamicRules.js.map +1 -0
  65. package/dist/convex/lib/storage.d.ts +59 -0
  66. package/dist/convex/lib/storage.d.ts.map +1 -0
  67. package/dist/convex/lib/storage.js +120 -0
  68. package/dist/convex/lib/storage.js.map +1 -0
  69. package/dist/convex/lib/utils.d.ts +61 -0
  70. package/dist/convex/lib/utils.d.ts.map +1 -0
  71. package/dist/convex/lib/utils.js +135 -0
  72. package/dist/convex/lib/utils.js.map +1 -0
  73. package/dist/convex/lib/validation.d.ts +24 -0
  74. package/dist/convex/lib/validation.d.ts.map +1 -0
  75. package/dist/convex/lib/validation.js +333 -0
  76. package/dist/convex/lib/validation.js.map +1 -0
  77. package/dist/convex/mutations/digitalAssets.d.ts +54 -0
  78. package/dist/convex/mutations/digitalAssets.d.ts.map +1 -0
  79. package/dist/convex/mutations/digitalAssets.js +297 -0
  80. package/dist/convex/mutations/digitalAssets.js.map +1 -0
  81. package/dist/convex/mutations/operational.d.ts +38 -0
  82. package/dist/convex/mutations/operational.d.ts.map +1 -0
  83. package/dist/convex/mutations/operational.js +226 -0
  84. package/dist/convex/mutations/operational.js.map +1 -0
  85. package/dist/convex/mutations/phases.d.ts +45 -0
  86. package/dist/convex/mutations/phases.d.ts.map +1 -0
  87. package/dist/convex/mutations/phases.js +334 -0
  88. package/dist/convex/mutations/phases.js.map +1 -0
  89. package/dist/convex/mutations/prescriptions.d.ts +191 -0
  90. package/dist/convex/mutations/prescriptions.d.ts.map +1 -0
  91. package/dist/convex/mutations/prescriptions.js +1263 -0
  92. package/dist/convex/mutations/prescriptions.js.map +1 -0
  93. package/dist/convex/mutations/syncJobs.d.ts +37 -0
  94. package/dist/convex/mutations/syncJobs.d.ts.map +1 -0
  95. package/dist/convex/mutations/syncJobs.js +238 -0
  96. package/dist/convex/mutations/syncJobs.js.map +1 -0
  97. package/dist/convex/prescriptions/fields.d.ts +50 -0
  98. package/dist/convex/prescriptions/fields.d.ts.map +1 -0
  99. package/dist/convex/prescriptions/fields.js +242 -0
  100. package/dist/convex/prescriptions/fields.js.map +1 -0
  101. package/dist/convex/queries/dynamicFields.d.ts +27 -0
  102. package/dist/convex/queries/dynamicFields.d.ts.map +1 -0
  103. package/dist/convex/queries/dynamicFields.js +119 -0
  104. package/dist/convex/queries/dynamicFields.js.map +1 -0
  105. package/dist/convex/queries/prescriptions.d.ts +583 -0
  106. package/dist/convex/queries/prescriptions.d.ts.map +1 -0
  107. package/dist/convex/queries/prescriptions.js +208 -0
  108. package/dist/convex/queries/prescriptions.js.map +1 -0
  109. package/dist/convex/schema.d.ts +962 -0
  110. package/dist/convex/schema.d.ts.map +1 -0
  111. package/dist/convex/schema.js +434 -0
  112. package/dist/convex/schema.js.map +1 -0
  113. package/dist/convex/types.d.ts +267 -0
  114. package/dist/convex/types.d.ts.map +1 -0
  115. package/dist/convex/types.js +2 -0
  116. package/dist/convex/types.js.map +1 -0
  117. package/dist/react/index.d.ts +1 -0
  118. package/dist/react/index.js +1 -0
  119. package/dist/react/styles.css +54 -0
  120. package/package.json +82 -0
@@ -0,0 +1,583 @@
1
+ /**
2
+ * Ottiene una prescrizione per ID con tutti i dati correlati.
3
+ */
4
+ export declare const getById: import("convex/server").RegisteredQuery<"public", {
5
+ prescriptionId: import("convex/values").GenericId<"prescriptions">;
6
+ }, Promise<{
7
+ prescription: {
8
+ _id: import("convex/values").GenericId<"prescriptions">;
9
+ _creationTime: number;
10
+ deleted_at?: number | undefined;
11
+ prescriptionId?: number | undefined;
12
+ latestClinicalRevisionId?: import("convex/values").GenericId<"clinicalRevisions"> | undefined;
13
+ prescriptionType?: "ANALOG" | "DIGITAL" | undefined;
14
+ digitalAssets?: {
15
+ description?: string | undefined;
16
+ storageUrl?: string | undefined;
17
+ assetId: string;
18
+ fileName: string;
19
+ fileSize: number;
20
+ mimeType: string;
21
+ storageProvider: "CONVEX" | "S3";
22
+ storageId: string;
23
+ uploadedAt: number;
24
+ uploadedBy: string;
25
+ }[] | undefined;
26
+ shippedAt?: number | undefined;
27
+ shippedBy?: string | undefined;
28
+ trackingNumber?: string | undefined;
29
+ idempotencyKey?: string | undefined;
30
+ calendarData?: {
31
+ toothNumber?: string | undefined;
32
+ treatmentPlanName?: string | undefined;
33
+ nextAppointmentId?: string | undefined;
34
+ nextAppointmentDate?: number | undefined;
35
+ nextAppointmentPhaseId?: string | undefined;
36
+ nextAppointmentPhaseName?: string | undefined;
37
+ application: string;
38
+ patientFirstName: string;
39
+ patientLastName: string;
40
+ clinicName: string;
41
+ treatmentPlanId: string;
42
+ treatmentId: string;
43
+ treatmentName: string;
44
+ phaseId: string;
45
+ phaseName: string;
46
+ appointmentId: string;
47
+ appointmentDate: number;
48
+ operatorId: string;
49
+ operatorName: string;
50
+ } | undefined;
51
+ valuesByFieldId?: string | undefined;
52
+ rulesetVersionId?: import("convex/values").GenericId<"rulesetVersions"> | undefined;
53
+ pdcItemId: string;
54
+ listinoId: string;
55
+ doctorId: string;
56
+ updatedAt: number;
57
+ flowKey: string;
58
+ status: "DRAFT" | "PENDING_DOCTOR" | "SIGNED" | "SYNCED" | "ERROR" | "CANCELLED" | "SUPERSEDED";
59
+ createdAt: number;
60
+ coreRefs: {
61
+ corePrescriptionId?: string | undefined;
62
+ coreAppointmentIds?: string[] | undefined;
63
+ };
64
+ labRefs: {
65
+ labRequestId?: string | undefined;
66
+ lastLabStatus?: string | undefined;
67
+ };
68
+ clinicId: string;
69
+ patientId: string;
70
+ flowVersion: number;
71
+ createdByUserId: string;
72
+ };
73
+ clinicalRevision: {
74
+ _id: import("convex/values").GenericId<"clinicalRevisions">;
75
+ _creationTime: number;
76
+ deleted_at?: number | undefined;
77
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
78
+ clinicalRevisionId?: number | undefined;
79
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
80
+ clinicalHash: string;
81
+ createdAt: number;
82
+ clinicalData: {
83
+ application?: {
84
+ type: "TOOTH";
85
+ toothNumber: number;
86
+ } | {
87
+ type: "MULTI_TOOTH";
88
+ teeth: number[];
89
+ } | {
90
+ type: "BRIDGE";
91
+ teeth: {
92
+ toothNumber: number;
93
+ role: "abutment" | "pontic";
94
+ }[];
95
+ } | {
96
+ type: "QUADRANT";
97
+ quadrant: number;
98
+ } | {
99
+ type: "SEXTANT";
100
+ sextant: number;
101
+ } | {
102
+ type: "ARCH";
103
+ arch: "UPPER" | "LOWER";
104
+ } | {
105
+ type: "FULL_MOUTH";
106
+ } | undefined;
107
+ shade?: string | undefined;
108
+ notePreparazione?: string | undefined;
109
+ lineaMargine?: string | undefined;
110
+ patient: {
111
+ corePatientId: string;
112
+ };
113
+ clinic: {
114
+ coreClinicId: string;
115
+ };
116
+ doctor: {
117
+ coreDoctorId: string;
118
+ };
119
+ prostheticService: {
120
+ pdcItemId: string;
121
+ listinoId: string;
122
+ serviceCode: string;
123
+ serviceLabel: string;
124
+ };
125
+ };
126
+ revisionNumber: number;
127
+ signature: {
128
+ signedAt: number;
129
+ signedByDoctorId: string;
130
+ signatureType: "weak-digital" | "auto-lab";
131
+ signaturePayload: string;
132
+ clinicalHash: string;
133
+ } | null;
134
+ frozen: boolean;
135
+ } | null;
136
+ allRevisions: {
137
+ _id: import("convex/values").GenericId<"clinicalRevisions">;
138
+ _creationTime: number;
139
+ deleted_at?: number | undefined;
140
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
141
+ clinicalRevisionId?: number | undefined;
142
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
143
+ clinicalHash: string;
144
+ createdAt: number;
145
+ clinicalData: {
146
+ application?: {
147
+ type: "TOOTH";
148
+ toothNumber: number;
149
+ } | {
150
+ type: "MULTI_TOOTH";
151
+ teeth: number[];
152
+ } | {
153
+ type: "BRIDGE";
154
+ teeth: {
155
+ toothNumber: number;
156
+ role: "abutment" | "pontic";
157
+ }[];
158
+ } | {
159
+ type: "QUADRANT";
160
+ quadrant: number;
161
+ } | {
162
+ type: "SEXTANT";
163
+ sextant: number;
164
+ } | {
165
+ type: "ARCH";
166
+ arch: "UPPER" | "LOWER";
167
+ } | {
168
+ type: "FULL_MOUTH";
169
+ } | undefined;
170
+ shade?: string | undefined;
171
+ notePreparazione?: string | undefined;
172
+ lineaMargine?: string | undefined;
173
+ patient: {
174
+ corePatientId: string;
175
+ };
176
+ clinic: {
177
+ coreClinicId: string;
178
+ };
179
+ doctor: {
180
+ coreDoctorId: string;
181
+ };
182
+ prostheticService: {
183
+ pdcItemId: string;
184
+ listinoId: string;
185
+ serviceCode: string;
186
+ serviceLabel: string;
187
+ };
188
+ };
189
+ revisionNumber: number;
190
+ signature: {
191
+ signedAt: number;
192
+ signedByDoctorId: string;
193
+ signatureType: "weak-digital" | "auto-lab";
194
+ signaturePayload: string;
195
+ clinicalHash: string;
196
+ } | null;
197
+ frozen: boolean;
198
+ }[];
199
+ phases: {
200
+ _id: import("convex/values").GenericId<"phaseInstances">;
201
+ _creationTime: number;
202
+ deleted_at?: number | undefined;
203
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
204
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
205
+ phaseInstanceId?: number | undefined;
206
+ appointment?: {
207
+ coreAppointmentId?: string | undefined;
208
+ startAt?: number | undefined;
209
+ endAt?: number | undefined;
210
+ doctorId?: string | undefined;
211
+ } | undefined;
212
+ feedback?: {
213
+ comment?: string | undefined;
214
+ outcome: "OK" | "KO" | null;
215
+ updatedBy: string;
216
+ updatedAt: number;
217
+ } | undefined;
218
+ phaseTypeKey: string;
219
+ updatedAt: number;
220
+ status: "NOT_STARTED" | "SCHEDULED" | "DONE_OK" | "DONE_KO" | "SKIPPED" | "REPEAT";
221
+ createdAt: number;
222
+ ordinal: number;
223
+ iteration: number;
224
+ }[];
225
+ operationalData: {
226
+ _id: import("convex/values").GenericId<"operationalData">;
227
+ _creationTime: number;
228
+ deleted_at?: number | undefined;
229
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
230
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
231
+ operationalDataId?: number | undefined;
232
+ noteInterne?: string | undefined;
233
+ allegati?: {
234
+ fileName: string;
235
+ uploadedAt: number;
236
+ uploadedBy: string;
237
+ fileId: string;
238
+ }[] | undefined;
239
+ uiState?: any;
240
+ } | null;
241
+ syncJobs: {
242
+ _id: import("convex/values").GenericId<"syncJobs">;
243
+ _creationTime: number;
244
+ deleted_at?: number | undefined;
245
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
246
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
247
+ syncJobId?: number | undefined;
248
+ lastError?: string | undefined;
249
+ updatedAt: number;
250
+ status: "OK" | "PENDING" | "RUNNING" | "FAILED";
251
+ createdAt: number;
252
+ idempotencyKey: string;
253
+ target: "PRIMOCORE" | "LAB";
254
+ requestPayload: any;
255
+ attempts: number;
256
+ nextRetryAt: number;
257
+ kind: "POST_CLINICAL" | "UPSERT_APPOINTMENT" | "LAB_REQUEST";
258
+ }[];
259
+ flow: {
260
+ _id: import("convex/values").GenericId<"flows">;
261
+ _creationTime: number;
262
+ flowId?: number | undefined;
263
+ deleted_at?: number | undefined;
264
+ definition: {
265
+ phases: {
266
+ required: boolean;
267
+ phaseTypeKey: string;
268
+ label: string;
269
+ repeatable: boolean;
270
+ requiredFields: string[];
271
+ appointmentRequired: boolean;
272
+ }[];
273
+ validations: {
274
+ fieldPaths?: string[] | undefined;
275
+ rule?: string | undefined;
276
+ type: "requiredFields" | "customRule";
277
+ message: string;
278
+ }[];
279
+ conditions: {
280
+ when: {
281
+ value?: any;
282
+ fieldPath: string;
283
+ op: "eq" | "neq" | "in" | "exists";
284
+ };
285
+ then: {
286
+ setPhaseRequired?: {
287
+ required: boolean;
288
+ phaseTypeKey: string;
289
+ } | undefined;
290
+ setFieldRequired?: {
291
+ required: boolean;
292
+ fieldPath: string;
293
+ } | undefined;
294
+ allowSkipToNext?: boolean | undefined;
295
+ };
296
+ }[];
297
+ };
298
+ flowKey: string;
299
+ version: number;
300
+ status: "ACTIVE" | "DRAFT" | "ARCHIVED";
301
+ createdAt: number;
302
+ } | null;
303
+ } | null>>;
304
+ /**
305
+ * Lista prescrizioni con filtri.
306
+ */
307
+ export declare const list: import("convex/server").RegisteredQuery<"public", {
308
+ doctorId?: string | undefined;
309
+ status?: string | undefined;
310
+ clinicId?: string | undefined;
311
+ patientId?: string | undefined;
312
+ limit?: number | undefined;
313
+ }, Promise<{
314
+ patientSnapshot: {
315
+ _id: import("convex/values").GenericId<"snapshots">;
316
+ _creationTime: number;
317
+ deleted_at?: number | undefined;
318
+ snapshotId?: number | undefined;
319
+ entityType: "PATIENT" | "PDC_ITEM" | "APPOINTMENT" | "DOCTOR" | "CLINIC";
320
+ entityId: string;
321
+ data: any;
322
+ fetchedAt: number;
323
+ } | null;
324
+ doctorSnapshot: {
325
+ _id: import("convex/values").GenericId<"snapshots">;
326
+ _creationTime: number;
327
+ deleted_at?: number | undefined;
328
+ snapshotId?: number | undefined;
329
+ entityType: "PATIENT" | "PDC_ITEM" | "APPOINTMENT" | "DOCTOR" | "CLINIC";
330
+ entityId: string;
331
+ data: any;
332
+ fetchedAt: number;
333
+ } | null;
334
+ _id: import("convex/values").GenericId<"prescriptions">;
335
+ _creationTime: number;
336
+ deleted_at?: number | undefined;
337
+ prescriptionId?: number | undefined;
338
+ latestClinicalRevisionId?: import("convex/values").GenericId<"clinicalRevisions"> | undefined;
339
+ prescriptionType?: "ANALOG" | "DIGITAL" | undefined;
340
+ digitalAssets?: {
341
+ description?: string | undefined;
342
+ storageUrl?: string | undefined;
343
+ assetId: string;
344
+ fileName: string;
345
+ fileSize: number;
346
+ mimeType: string;
347
+ storageProvider: "CONVEX" | "S3";
348
+ storageId: string;
349
+ uploadedAt: number;
350
+ uploadedBy: string;
351
+ }[] | undefined;
352
+ shippedAt?: number | undefined;
353
+ shippedBy?: string | undefined;
354
+ trackingNumber?: string | undefined;
355
+ idempotencyKey?: string | undefined;
356
+ calendarData?: {
357
+ toothNumber?: string | undefined;
358
+ treatmentPlanName?: string | undefined;
359
+ nextAppointmentId?: string | undefined;
360
+ nextAppointmentDate?: number | undefined;
361
+ nextAppointmentPhaseId?: string | undefined;
362
+ nextAppointmentPhaseName?: string | undefined;
363
+ application: string;
364
+ patientFirstName: string;
365
+ patientLastName: string;
366
+ clinicName: string;
367
+ treatmentPlanId: string;
368
+ treatmentId: string;
369
+ treatmentName: string;
370
+ phaseId: string;
371
+ phaseName: string;
372
+ appointmentId: string;
373
+ appointmentDate: number;
374
+ operatorId: string;
375
+ operatorName: string;
376
+ } | undefined;
377
+ valuesByFieldId?: string | undefined;
378
+ rulesetVersionId?: import("convex/values").GenericId<"rulesetVersions"> | undefined;
379
+ pdcItemId: string;
380
+ listinoId: string;
381
+ doctorId: string;
382
+ updatedAt: number;
383
+ flowKey: string;
384
+ status: "DRAFT" | "PENDING_DOCTOR" | "SIGNED" | "SYNCED" | "ERROR" | "CANCELLED" | "SUPERSEDED";
385
+ createdAt: number;
386
+ coreRefs: {
387
+ corePrescriptionId?: string | undefined;
388
+ coreAppointmentIds?: string[] | undefined;
389
+ };
390
+ labRefs: {
391
+ labRequestId?: string | undefined;
392
+ lastLabStatus?: string | undefined;
393
+ };
394
+ clinicId: string;
395
+ patientId: string;
396
+ flowVersion: number;
397
+ createdByUserId: string;
398
+ }[]>>;
399
+ /**
400
+ * Lista tutte le prescrizioni per il Registro Prescrizioni.
401
+ * Include i campi per la gestione spedizioni.
402
+ */
403
+ export declare const listAll: import("convex/server").RegisteredQuery<"public", {}, Promise<{
404
+ _id: import("convex/values").GenericId<"prescriptions">;
405
+ prescriptionId: number | undefined;
406
+ clinicId: string;
407
+ doctorId: string;
408
+ patientId: string;
409
+ status: "DRAFT" | "PENDING_DOCTOR" | "SIGNED" | "SYNCED" | "ERROR" | "CANCELLED" | "SUPERSEDED";
410
+ createdAt: number;
411
+ updatedAt: number;
412
+ prescriptionType: "ANALOG" | "DIGITAL" | undefined;
413
+ calendarData: {
414
+ toothNumber?: string | undefined;
415
+ treatmentPlanName?: string | undefined;
416
+ nextAppointmentId?: string | undefined;
417
+ nextAppointmentDate?: number | undefined;
418
+ nextAppointmentPhaseId?: string | undefined;
419
+ nextAppointmentPhaseName?: string | undefined;
420
+ application: string;
421
+ patientFirstName: string;
422
+ patientLastName: string;
423
+ clinicName: string;
424
+ treatmentPlanId: string;
425
+ treatmentId: string;
426
+ treatmentName: string;
427
+ phaseId: string;
428
+ phaseName: string;
429
+ appointmentId: string;
430
+ appointmentDate: number;
431
+ operatorId: string;
432
+ operatorName: string;
433
+ } | undefined;
434
+ shippedAt: number | undefined;
435
+ shippedBy: string | undefined;
436
+ trackingNumber: string | undefined;
437
+ }[]>>;
438
+ /**
439
+ * Verifica se esiste già una prescrizione attiva per un pdcItemId.
440
+ */
441
+ export declare const getActivePrescriptionForPdcItem: import("convex/server").RegisteredQuery<"public", {
442
+ pdcItemId: string;
443
+ }, Promise<{
444
+ _id: import("convex/values").GenericId<"prescriptions">;
445
+ _creationTime: number;
446
+ deleted_at?: number | undefined;
447
+ prescriptionId?: number | undefined;
448
+ latestClinicalRevisionId?: import("convex/values").GenericId<"clinicalRevisions"> | undefined;
449
+ prescriptionType?: "ANALOG" | "DIGITAL" | undefined;
450
+ digitalAssets?: {
451
+ description?: string | undefined;
452
+ storageUrl?: string | undefined;
453
+ assetId: string;
454
+ fileName: string;
455
+ fileSize: number;
456
+ mimeType: string;
457
+ storageProvider: "CONVEX" | "S3";
458
+ storageId: string;
459
+ uploadedAt: number;
460
+ uploadedBy: string;
461
+ }[] | undefined;
462
+ shippedAt?: number | undefined;
463
+ shippedBy?: string | undefined;
464
+ trackingNumber?: string | undefined;
465
+ idempotencyKey?: string | undefined;
466
+ calendarData?: {
467
+ toothNumber?: string | undefined;
468
+ treatmentPlanName?: string | undefined;
469
+ nextAppointmentId?: string | undefined;
470
+ nextAppointmentDate?: number | undefined;
471
+ nextAppointmentPhaseId?: string | undefined;
472
+ nextAppointmentPhaseName?: string | undefined;
473
+ application: string;
474
+ patientFirstName: string;
475
+ patientLastName: string;
476
+ clinicName: string;
477
+ treatmentPlanId: string;
478
+ treatmentId: string;
479
+ treatmentName: string;
480
+ phaseId: string;
481
+ phaseName: string;
482
+ appointmentId: string;
483
+ appointmentDate: number;
484
+ operatorId: string;
485
+ operatorName: string;
486
+ } | undefined;
487
+ valuesByFieldId?: string | undefined;
488
+ rulesetVersionId?: import("convex/values").GenericId<"rulesetVersions"> | undefined;
489
+ pdcItemId: string;
490
+ listinoId: string;
491
+ doctorId: string;
492
+ updatedAt: number;
493
+ flowKey: string;
494
+ status: "DRAFT" | "PENDING_DOCTOR" | "SIGNED" | "SYNCED" | "ERROR" | "CANCELLED" | "SUPERSEDED";
495
+ createdAt: number;
496
+ coreRefs: {
497
+ corePrescriptionId?: string | undefined;
498
+ coreAppointmentIds?: string[] | undefined;
499
+ };
500
+ labRefs: {
501
+ labRequestId?: string | undefined;
502
+ lastLabStatus?: string | undefined;
503
+ };
504
+ clinicId: string;
505
+ patientId: string;
506
+ flowVersion: number;
507
+ createdByUserId: string;
508
+ } | null>>;
509
+ /**
510
+ * Conta prescrizioni per status (per dashboard).
511
+ */
512
+ export declare const countByStatus: import("convex/server").RegisteredQuery<"public", {
513
+ clinicId: string;
514
+ }, Promise<Record<string, number>>>;
515
+ /**
516
+ * Ottiene la cronologia delle revisioni cliniche.
517
+ */
518
+ export declare const getRevisionHistory: import("convex/server").RegisteredQuery<"public", {
519
+ prescriptionId: import("convex/values").GenericId<"prescriptions">;
520
+ }, Promise<{
521
+ _id: import("convex/values").GenericId<"clinicalRevisions">;
522
+ _creationTime: number;
523
+ deleted_at?: number | undefined;
524
+ prescriptionId?: import("convex/values").GenericId<"prescriptions"> | undefined;
525
+ clinicalRevisionId?: number | undefined;
526
+ prescriptionRef?: import("convex/values").GenericId<"prescriptions"> | undefined;
527
+ clinicalHash: string;
528
+ createdAt: number;
529
+ clinicalData: {
530
+ application?: {
531
+ type: "TOOTH";
532
+ toothNumber: number;
533
+ } | {
534
+ type: "MULTI_TOOTH";
535
+ teeth: number[];
536
+ } | {
537
+ type: "BRIDGE";
538
+ teeth: {
539
+ toothNumber: number;
540
+ role: "abutment" | "pontic";
541
+ }[];
542
+ } | {
543
+ type: "QUADRANT";
544
+ quadrant: number;
545
+ } | {
546
+ type: "SEXTANT";
547
+ sextant: number;
548
+ } | {
549
+ type: "ARCH";
550
+ arch: "UPPER" | "LOWER";
551
+ } | {
552
+ type: "FULL_MOUTH";
553
+ } | undefined;
554
+ shade?: string | undefined;
555
+ notePreparazione?: string | undefined;
556
+ lineaMargine?: string | undefined;
557
+ patient: {
558
+ corePatientId: string;
559
+ };
560
+ clinic: {
561
+ coreClinicId: string;
562
+ };
563
+ doctor: {
564
+ coreDoctorId: string;
565
+ };
566
+ prostheticService: {
567
+ pdcItemId: string;
568
+ listinoId: string;
569
+ serviceCode: string;
570
+ serviceLabel: string;
571
+ };
572
+ };
573
+ revisionNumber: number;
574
+ signature: {
575
+ signedAt: number;
576
+ signedByDoctorId: string;
577
+ signatureType: "weak-digital" | "auto-lab";
578
+ signaturePayload: string;
579
+ clinicalHash: string;
580
+ } | null;
581
+ frozen: boolean;
582
+ }[]>>;
583
+ //# sourceMappingURL=prescriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prescriptions.d.ts","sourceRoot":"","sources":["../../../convex/queries/prescriptions.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8DlB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8Ef,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BlB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAY1C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;mCAwBxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAa7B,CAAC"}