@blackcode_sa/metaestetics-api 1.7.47 → 1.8.1
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/dist/admin/index.d.mts +1815 -1667
- package/dist/admin/index.d.ts +1815 -1667
- package/dist/admin/index.js +6993 -6535
- package/dist/admin/index.mjs +6991 -6532
- package/dist/backoffice/index.d.mts +1418 -1418
- package/dist/backoffice/index.d.ts +1418 -1418
- package/dist/backoffice/index.js +1464 -1454
- package/dist/backoffice/index.mjs +1509 -1499
- package/dist/index.d.mts +16217 -14582
- package/dist/index.d.ts +16217 -14582
- package/dist/index.js +11419 -13806
- package/dist/index.mjs +12081 -14593
- package/package.json +5 -5
- package/src/admin/aggregation/appointment/index.ts +1 -0
- package/src/admin/aggregation/clinic/index.ts +1 -0
- package/src/admin/aggregation/forms/index.ts +1 -0
- package/src/admin/aggregation/index.ts +8 -0
- package/src/admin/aggregation/patient/index.ts +1 -0
- package/src/admin/aggregation/practitioner/index.ts +1 -0
- package/src/admin/aggregation/practitioner-invite/index.ts +1 -0
- package/src/admin/aggregation/procedure/index.ts +1 -0
- package/src/admin/aggregation/reviews/index.ts +1 -0
- package/src/admin/booking/index.ts +1 -1
- package/src/admin/calendar/index.ts +1 -0
- package/src/admin/documentation-templates/index.ts +1 -0
- package/src/admin/free-consultation/index.ts +1 -0
- package/src/admin/index.ts +23 -118
- package/src/admin/mailing/appointment/index.ts +1 -0
- package/src/admin/mailing/index.ts +1 -2
- package/src/admin/mailing/practitionerInvite/index.ts +1 -0
- package/src/admin/notifications/index.ts +1 -0
- package/src/admin/requirements/index.ts +1 -0
- package/src/admin/users/index.ts +1 -0
- package/src/admin/users/user-profile.admin.ts +1 -0
- package/src/backoffice/constants/index.ts +1 -0
- package/src/backoffice/errors/index.ts +1 -0
- package/src/backoffice/index.ts +5 -14
- package/src/backoffice/services/index.ts +7 -0
- package/src/backoffice/validations/index.ts +1 -0
- package/src/index.backup.ts +407 -0
- package/src/index.ts +5 -406
- package/src/services/PATIENTAUTH.MD +197 -0
- package/src/services/__tests__/auth/auth.setup.ts +2 -2
- package/src/services/__tests__/auth.service.test.ts +1 -1
- package/src/services/__tests__/user.service.test.ts +1 -1
- package/src/services/appointment/index.ts +1 -2
- package/src/services/{auth.service.ts → auth/auth.service.ts} +36 -22
- package/src/services/{auth.v2.service.ts → auth/auth.v2.service.ts} +17 -17
- package/src/services/auth/index.ts +2 -16
- package/src/services/calendar/calendar-refactored.service.ts +1 -1
- package/src/services/calendar/index.ts +5 -0
- package/src/services/clinic/index.ts +4 -0
- package/src/services/index.ts +12 -0
- package/src/services/media/index.ts +1 -0
- package/src/services/notifications/index.ts +1 -0
- package/src/services/patient/README.md +48 -0
- package/src/services/patient/To-Do.md +43 -0
- package/src/services/patient/index.ts +2 -0
- package/src/services/patient/patient.service.ts +289 -34
- package/src/services/patient/utils/index.ts +9 -0
- package/src/services/patient/utils/medical.utils.ts +114 -157
- package/src/services/patient/utils/profile.utils.ts +9 -0
- package/src/services/patient/utils/sensitive.utils.ts +79 -14
- package/src/services/patient/utils/token.utils.ts +211 -0
- package/src/services/practitioner/index.ts +1 -0
- package/src/services/procedure/index.ts +1 -0
- package/src/services/reviews/index.ts +1 -0
- package/src/services/user/index.ts +1 -0
- package/src/services/{user.service.ts → user/user.service.ts} +61 -12
- package/src/services/{user.v2.service.ts → user/user.v2.service.ts} +12 -12
- package/src/types/index.ts +42 -42
- package/src/types/patient/index.ts +33 -6
- package/src/types/patient/token.types.ts +61 -0
- package/src/types/user/index.ts +38 -0
- package/src/utils/index.ts +1 -0
- package/src/validations/calendar.schema.ts +6 -45
- package/src/validations/documentation-templates/index.ts +1 -0
- package/src/validations/documentation-templates.schema.ts +1 -1
- package/src/validations/index.ts +20 -0
- package/src/validations/patient/token.schema.ts +29 -0
- package/src/validations/patient.schema.ts +23 -6
- package/src/validations/profile-info.schema.ts +1 -1
- package/src/validations/schemas.ts +24 -24
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,254 +1,24 @@
|
|
|
1
|
-
import { Timestamp
|
|
2
|
-
import * as admin from 'firebase-admin';
|
|
1
|
+
import { Timestamp } from 'firebase/firestore';
|
|
3
2
|
import { Timestamp as Timestamp$1 } from 'firebase-admin/firestore';
|
|
3
|
+
import * as admin from 'firebase-admin';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
PARAGRAPH = "paragraph",
|
|
11
|
-
LIST = "list",
|
|
12
|
-
DYNAMIC_TEXT = "dynamic_text",
|
|
13
|
-
BINARY_CHOICE = "binary_choice",
|
|
14
|
-
MULTIPLE_CHOICE = "multiple_choice",
|
|
15
|
-
SINGLE_CHOICE = "single_choice",
|
|
16
|
-
RATING_SCALE = "rating_scale",
|
|
17
|
-
TEXT_INPUT = "text_input",
|
|
18
|
-
DATE_PICKER = "date_picker",
|
|
19
|
-
SIGNATURE = "signature",
|
|
20
|
-
DITIGAL_SIGNATURE = "digital_signature",
|
|
21
|
-
FILE_UPLOAD = "file_upload"
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Enum for list types
|
|
25
|
-
*/
|
|
26
|
-
declare enum ListType {
|
|
27
|
-
ORDERED = "ordered",
|
|
28
|
-
UNORDERED = "unordered"
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Enum for heading levels
|
|
32
|
-
*/
|
|
33
|
-
declare enum HeadingLevel {
|
|
34
|
-
H1 = "h1",
|
|
35
|
-
H2 = "h2",
|
|
36
|
-
H3 = "h3",
|
|
37
|
-
H4 = "h4",
|
|
38
|
-
H5 = "h5",
|
|
39
|
-
H6 = "h6"
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Base interface for all document elements
|
|
43
|
-
*/
|
|
44
|
-
interface BaseDocumentElement {
|
|
45
|
-
id: string;
|
|
46
|
-
type: DocumentElementType;
|
|
47
|
-
required?: boolean;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Interface for heading element
|
|
51
|
-
*/
|
|
52
|
-
interface HeadingElement extends BaseDocumentElement {
|
|
53
|
-
type: DocumentElementType.HEADING;
|
|
54
|
-
text: string;
|
|
55
|
-
level: HeadingLevel;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Interface for paragraph element
|
|
59
|
-
*/
|
|
60
|
-
interface ParagraphElement extends BaseDocumentElement {
|
|
61
|
-
type: DocumentElementType.PARAGRAPH;
|
|
62
|
-
text: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Interface for list element
|
|
66
|
-
*/
|
|
67
|
-
interface ListElement extends BaseDocumentElement {
|
|
68
|
-
type: DocumentElementType.LIST;
|
|
69
|
-
items: string[];
|
|
70
|
-
listType: ListType;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Interface for dynamic text element
|
|
74
|
-
*/
|
|
75
|
-
interface DynamicTextElement extends BaseDocumentElement {
|
|
76
|
-
type: DocumentElementType.DYNAMIC_TEXT;
|
|
77
|
-
text: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Interface for binary choice element (Yes/No)
|
|
81
|
-
*/
|
|
82
|
-
interface BinaryChoiceElement extends BaseDocumentElement {
|
|
83
|
-
type: DocumentElementType.BINARY_CHOICE;
|
|
84
|
-
question: string;
|
|
85
|
-
defaultValue?: boolean;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Interface for multiple choice element
|
|
89
|
-
*/
|
|
90
|
-
interface MultipleChoiceElement extends BaseDocumentElement {
|
|
91
|
-
type: DocumentElementType.MULTIPLE_CHOICE;
|
|
92
|
-
question: string;
|
|
93
|
-
options: string[];
|
|
94
|
-
defaultValues?: string[];
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Interface for single choice element
|
|
98
|
-
*/
|
|
99
|
-
interface SingleChoiceElement extends BaseDocumentElement {
|
|
100
|
-
type: DocumentElementType.SINGLE_CHOICE;
|
|
101
|
-
question: string;
|
|
102
|
-
options: string[];
|
|
103
|
-
defaultValue?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Interface for rating scale element
|
|
107
|
-
*/
|
|
108
|
-
interface RatingScaleElement extends BaseDocumentElement {
|
|
109
|
-
type: DocumentElementType.RATING_SCALE;
|
|
110
|
-
question: string;
|
|
111
|
-
min: number;
|
|
112
|
-
max: number;
|
|
113
|
-
labels?: {
|
|
114
|
-
[key: number]: string;
|
|
115
|
-
};
|
|
116
|
-
defaultValue?: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Interface for text input element
|
|
120
|
-
*/
|
|
121
|
-
interface TextInputElement extends BaseDocumentElement {
|
|
122
|
-
type: DocumentElementType.TEXT_INPUT;
|
|
123
|
-
label: string;
|
|
124
|
-
placeholder?: string;
|
|
125
|
-
multiline?: boolean;
|
|
126
|
-
defaultValue?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Interface for date picker element
|
|
130
|
-
*/
|
|
131
|
-
interface DatePickerElement extends BaseDocumentElement {
|
|
132
|
-
type: DocumentElementType.DATE_PICKER;
|
|
133
|
-
label: string;
|
|
134
|
-
defaultValue?: string;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Interface for signature element
|
|
138
|
-
*/
|
|
139
|
-
interface SignatureElement extends BaseDocumentElement {
|
|
140
|
-
type: DocumentElementType.SIGNATURE;
|
|
141
|
-
label: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Interface for file upload element
|
|
145
|
-
*/
|
|
146
|
-
interface FileUploadElement extends BaseDocumentElement {
|
|
147
|
-
type: DocumentElementType.FILE_UPLOAD;
|
|
148
|
-
label: string;
|
|
149
|
-
allowedFileTypes?: string[];
|
|
150
|
-
maxFileSizeMB?: number;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Union type for all document elements
|
|
154
|
-
*/
|
|
155
|
-
type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
|
|
156
|
-
/**
|
|
157
|
-
* Interface for document template
|
|
158
|
-
*/
|
|
159
|
-
interface DocumentTemplate {
|
|
160
|
-
id: string;
|
|
161
|
-
title: string;
|
|
162
|
-
description?: string;
|
|
163
|
-
createdAt: number;
|
|
164
|
-
updatedAt: number;
|
|
165
|
-
createdBy: string;
|
|
166
|
-
elements: DocumentElement[];
|
|
167
|
-
tags?: string[];
|
|
168
|
-
isUserForm?: boolean;
|
|
169
|
-
isRequired?: boolean;
|
|
170
|
-
sortingOrder?: number;
|
|
171
|
-
version: number;
|
|
172
|
-
isActive: boolean;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Interface for a filled document (completed form)
|
|
176
|
-
*/
|
|
177
|
-
interface FilledDocument {
|
|
178
|
-
id: string;
|
|
179
|
-
templateId: string;
|
|
180
|
-
templateVersion: number;
|
|
181
|
-
isUserForm: boolean;
|
|
182
|
-
isRequired: boolean;
|
|
183
|
-
procedureId: string;
|
|
184
|
-
appointmentId: string;
|
|
185
|
-
patientId: string;
|
|
186
|
-
practitionerId: string;
|
|
187
|
-
clinicId: string;
|
|
188
|
-
createdAt: number;
|
|
189
|
-
updatedAt: number;
|
|
190
|
-
values: {
|
|
191
|
-
[elementId: string]: any | FilledDocumentFileValue;
|
|
192
|
-
};
|
|
193
|
-
status: FilledDocumentStatus;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Enum for filled document status
|
|
197
|
-
*/
|
|
198
|
-
declare enum FilledDocumentStatus {
|
|
199
|
-
DRAFT = "draft",
|
|
200
|
-
SKIPPED = "skipped",
|
|
201
|
-
PENDING = "pending",
|
|
202
|
-
COMPLETED = "completed",// When doctor or patient completes the form
|
|
203
|
-
SIGNED = "signed",// Only used for user forms
|
|
204
|
-
REJECTED = "rejected"
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Interface for file upload results to be stored in filled document values
|
|
208
|
-
*/
|
|
209
|
-
interface FilledDocumentFileValue {
|
|
210
|
-
mediaId: string;
|
|
211
|
-
url: string;
|
|
212
|
-
name: string;
|
|
213
|
-
contentType: string;
|
|
214
|
-
size: number;
|
|
215
|
-
uploadedAt: number;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Nivoi sertifikacije medicinskog osoblja, poređani od najnižeg do najvišeg
|
|
220
|
-
*/
|
|
221
|
-
declare enum CertificationLevel {
|
|
222
|
-
AESTHETICIAN = "aesthetician",// Osnovni estetičar
|
|
223
|
-
NURSE_ASSISTANT = "nurse_assistant",// Medicinski tehničar
|
|
224
|
-
NURSE = "nurse",// Medicinska sestra
|
|
225
|
-
NURSE_PRACTITIONER = "nurse_practitioner",// Viša medicinska sestra
|
|
226
|
-
PHYSICIAN_ASSISTANT = "physician_assistant",// Lekar asistent
|
|
227
|
-
DOCTOR = "doctor",// Doktor medicine
|
|
228
|
-
SPECIALIST = "specialist",// Specijalista
|
|
229
|
-
PLASTIC_SURGEON = "plastic_surgeon"
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Dodatne specijalizacije potrebne za određene procedure
|
|
233
|
-
*/
|
|
234
|
-
declare enum CertificationSpecialty {
|
|
235
|
-
LASER = "laser",// Sertifikat za laserske tretmane
|
|
236
|
-
INJECTABLES = "injectables",// Sertifikat za injekcione tretmane
|
|
237
|
-
CHEMICAL_PEELS = "chemical_peels",// Sertifikat za hemijske pilinge
|
|
238
|
-
MICRODERMABRASION = "microdermabrasion",// Sertifikat za mikrodermoabraziju
|
|
239
|
-
BODY_CONTOURING = "body_contouring",// Sertifikat za konturiranje tela
|
|
240
|
-
SKIN_CARE = "skin_care",// Sertifikat za negu kože
|
|
241
|
-
WOUND_CARE = "wound_care",// Sertifikat za tretman rana
|
|
242
|
-
ANESTHESIA = "anesthesia"
|
|
5
|
+
declare enum UserRole {
|
|
6
|
+
PATIENT = "patient",
|
|
7
|
+
PRACTITIONER = "practitioner",
|
|
8
|
+
APP_ADMIN = "app_admin",
|
|
9
|
+
CLINIC_ADMIN = "clinic_admin"
|
|
243
10
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
11
|
+
interface User {
|
|
12
|
+
uid: string;
|
|
13
|
+
email: string | null;
|
|
14
|
+
roles: UserRole[];
|
|
15
|
+
isAnonymous: boolean;
|
|
16
|
+
createdAt: any;
|
|
17
|
+
updatedAt: any;
|
|
18
|
+
lastLoginAt: any;
|
|
19
|
+
patientProfile?: string;
|
|
20
|
+
practitionerProfile?: string;
|
|
21
|
+
adminProfile?: string;
|
|
252
22
|
}
|
|
253
23
|
|
|
254
24
|
/**
|
|
@@ -562,9 +332,45 @@ declare enum TreatmentBenefit {
|
|
|
562
332
|
}
|
|
563
333
|
|
|
564
334
|
/**
|
|
565
|
-
*
|
|
566
|
-
|
|
567
|
-
|
|
335
|
+
* Nivoi sertifikacije medicinskog osoblja, poređani od najnižeg do najvišeg
|
|
336
|
+
*/
|
|
337
|
+
declare enum CertificationLevel {
|
|
338
|
+
AESTHETICIAN = "aesthetician",// Osnovni estetičar
|
|
339
|
+
NURSE_ASSISTANT = "nurse_assistant",// Medicinski tehničar
|
|
340
|
+
NURSE = "nurse",// Medicinska sestra
|
|
341
|
+
NURSE_PRACTITIONER = "nurse_practitioner",// Viša medicinska sestra
|
|
342
|
+
PHYSICIAN_ASSISTANT = "physician_assistant",// Lekar asistent
|
|
343
|
+
DOCTOR = "doctor",// Doktor medicine
|
|
344
|
+
SPECIALIST = "specialist",// Specijalista
|
|
345
|
+
PLASTIC_SURGEON = "plastic_surgeon"
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Dodatne specijalizacije potrebne za određene procedure
|
|
349
|
+
*/
|
|
350
|
+
declare enum CertificationSpecialty {
|
|
351
|
+
LASER = "laser",// Sertifikat za laserske tretmane
|
|
352
|
+
INJECTABLES = "injectables",// Sertifikat za injekcione tretmane
|
|
353
|
+
CHEMICAL_PEELS = "chemical_peels",// Sertifikat za hemijske pilinge
|
|
354
|
+
MICRODERMABRASION = "microdermabrasion",// Sertifikat za mikrodermoabraziju
|
|
355
|
+
BODY_CONTOURING = "body_contouring",// Sertifikat za konturiranje tela
|
|
356
|
+
SKIN_CARE = "skin_care",// Sertifikat za negu kože
|
|
357
|
+
WOUND_CARE = "wound_care",// Sertifikat za tretman rana
|
|
358
|
+
ANESTHESIA = "anesthesia"
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Zahtevi sertifikacije za izvođenje procedura
|
|
362
|
+
*/
|
|
363
|
+
interface CertificationRequirement {
|
|
364
|
+
/** Minimalni nivo sertifikacije potreban za proceduru */
|
|
365
|
+
minimumLevel: CertificationLevel;
|
|
366
|
+
/** Dodatne specijalizacije potrebne za proceduru */
|
|
367
|
+
requiredSpecialties?: CertificationSpecialty[];
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Reference to a documentation template with metadata
|
|
372
|
+
* @property templateId - ID of the documentation template
|
|
373
|
+
* @property isUserForm - Whether this template is filled by users
|
|
568
374
|
* @property isRequired - Whether this template is required
|
|
569
375
|
* @property sortingOrder - The display order of this template
|
|
570
376
|
*/
|
|
@@ -765,73 +571,313 @@ interface ProcedureSummaryInfo {
|
|
|
765
571
|
}
|
|
766
572
|
|
|
767
573
|
/**
|
|
768
|
-
*
|
|
574
|
+
* Enum for all possible clinic tags
|
|
769
575
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
576
|
+
declare enum ClinicTag {
|
|
577
|
+
PARKING = "parking",
|
|
578
|
+
WIFI = "wifi",
|
|
579
|
+
WHEELCHAIR_ACCESS = "wheelchair_access",
|
|
580
|
+
CAFE = "cafe",
|
|
581
|
+
PHARMACY = "pharmacy",
|
|
582
|
+
WAITING_ROOM = "waiting_room",
|
|
583
|
+
CARD_PAYMENT = "card_payment",
|
|
584
|
+
INSURANCE = "insurance",
|
|
585
|
+
CHILDREN_AREA = "children_area",
|
|
586
|
+
TV = "tv",
|
|
587
|
+
AIR_CONDITIONING = "air_conditioning",
|
|
588
|
+
WATER_DISPENSER = "water_dispenser",
|
|
589
|
+
VENDING_MACHINE = "vending_machine",
|
|
590
|
+
ELEVATOR = "elevator",
|
|
591
|
+
RAMP = "ramp",
|
|
592
|
+
HANDICAP_PARKING = "handicap_parking",
|
|
593
|
+
BRAILLE = "braille",
|
|
594
|
+
SIGN_LANGUAGE = "sign_language",
|
|
595
|
+
EMERGENCY_SERVICE = "emergency_service",
|
|
596
|
+
LAB = "lab",
|
|
597
|
+
XRAY = "xray",
|
|
598
|
+
ULTRASOUND = "ultrasound",
|
|
599
|
+
DENTAL = "dental",
|
|
600
|
+
PEDIATRIC = "pediatric",
|
|
601
|
+
GYNECOLOGY = "gynecology",
|
|
602
|
+
CARDIOLOGY = "cardiology",
|
|
603
|
+
DERMATOLOGY = "dermatology",
|
|
604
|
+
ORTHOPEDIC = "orthopedic",
|
|
605
|
+
OPHTHALMOLOGY = "ophthalmology",
|
|
606
|
+
TELEMEDICINE = "telemedicine",
|
|
607
|
+
HOME_VISITS = "home_visits",
|
|
608
|
+
ONLINE_BOOKING = "online_booking",
|
|
609
|
+
MOBILE_APP = "mobile_app",
|
|
610
|
+
SMS_NOTIFICATIONS = "sms_notifications",
|
|
611
|
+
EMAIL_NOTIFICATIONS = "email_notifications",
|
|
612
|
+
ENGLISH = "english",
|
|
613
|
+
SERBIAN = "serbian",
|
|
614
|
+
GERMAN = "german",
|
|
615
|
+
RUSSIAN = "russian",
|
|
616
|
+
CHINESE = "chinese",
|
|
617
|
+
SPANISH = "spanish",
|
|
618
|
+
FRENCH = "french",
|
|
619
|
+
OPEN_24_7 = "open_24_7",
|
|
620
|
+
WEEKEND_HOURS = "weekend_hours",
|
|
621
|
+
NIGHT_SHIFT = "night_shift",
|
|
622
|
+
HOLIDAY_HOURS = "holiday_hours"
|
|
781
623
|
}
|
|
624
|
+
|
|
782
625
|
/**
|
|
783
|
-
*
|
|
626
|
+
* Enum for practitioner invite status
|
|
784
627
|
*/
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
issueDate: Timestamp | Date;
|
|
791
|
-
expiryDate?: Timestamp | Date | null;
|
|
792
|
-
verificationStatus: "pending" | "verified" | "rejected";
|
|
628
|
+
declare enum PractitionerInviteStatus {
|
|
629
|
+
PENDING = "pending",
|
|
630
|
+
ACCEPTED = "accepted",
|
|
631
|
+
REJECTED = "rejected",
|
|
632
|
+
CANCELLED = "cancelled"
|
|
793
633
|
}
|
|
794
634
|
/**
|
|
795
|
-
*
|
|
635
|
+
* Interface for proposed working hours in practitioner invite
|
|
796
636
|
*/
|
|
797
|
-
interface
|
|
637
|
+
interface ProposedWorkingHours {
|
|
638
|
+
monday: {
|
|
639
|
+
start: string;
|
|
640
|
+
end: string;
|
|
641
|
+
} | null;
|
|
642
|
+
tuesday: {
|
|
643
|
+
start: string;
|
|
644
|
+
end: string;
|
|
645
|
+
} | null;
|
|
646
|
+
wednesday: {
|
|
647
|
+
start: string;
|
|
648
|
+
end: string;
|
|
649
|
+
} | null;
|
|
650
|
+
thursday: {
|
|
651
|
+
start: string;
|
|
652
|
+
end: string;
|
|
653
|
+
} | null;
|
|
654
|
+
friday: {
|
|
655
|
+
start: string;
|
|
656
|
+
end: string;
|
|
657
|
+
} | null;
|
|
658
|
+
saturday: {
|
|
659
|
+
start: string;
|
|
660
|
+
end: string;
|
|
661
|
+
} | null;
|
|
662
|
+
sunday: {
|
|
663
|
+
start: string;
|
|
664
|
+
end: string;
|
|
665
|
+
} | null;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Main interface for practitioner invite
|
|
669
|
+
*/
|
|
670
|
+
interface PractitionerInvite {
|
|
671
|
+
id: string;
|
|
672
|
+
practitionerId: string;
|
|
798
673
|
clinicId: string;
|
|
799
|
-
|
|
800
|
-
|
|
674
|
+
practitionerInfo: PractitionerProfileInfo;
|
|
675
|
+
clinicInfo: ClinicInfo;
|
|
676
|
+
proposedWorkingHours: ProposedWorkingHours;
|
|
677
|
+
status: PractitionerInviteStatus;
|
|
678
|
+
invitedBy: string;
|
|
679
|
+
message?: string | null;
|
|
680
|
+
rejectionReason?: string | null;
|
|
681
|
+
cancelReason?: string | null;
|
|
682
|
+
createdAt: Timestamp;
|
|
683
|
+
updatedAt: Timestamp;
|
|
684
|
+
acceptedAt?: Timestamp | null;
|
|
685
|
+
rejectedAt?: Timestamp | null;
|
|
686
|
+
cancelledAt?: Timestamp | null;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Interface for clinic contact information
|
|
691
|
+
*/
|
|
692
|
+
interface ClinicContactInfo {
|
|
693
|
+
email: string;
|
|
694
|
+
phoneNumber: string;
|
|
695
|
+
alternativePhoneNumber?: string | null;
|
|
696
|
+
website?: string | null;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Interface for clinic location
|
|
700
|
+
*/
|
|
701
|
+
interface ClinicLocation {
|
|
702
|
+
address: string;
|
|
703
|
+
city: string;
|
|
704
|
+
country: string;
|
|
705
|
+
postalCode: string;
|
|
706
|
+
latitude: number;
|
|
707
|
+
longitude: number;
|
|
708
|
+
geohash?: string | null;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Interface for working hours
|
|
712
|
+
*/
|
|
713
|
+
interface WorkingHours {
|
|
714
|
+
monday: {
|
|
715
|
+
open: string;
|
|
716
|
+
close: string;
|
|
717
|
+
breaks?: {
|
|
801
718
|
start: string;
|
|
802
719
|
end: string;
|
|
803
|
-
}
|
|
804
|
-
|
|
720
|
+
}[];
|
|
721
|
+
} | null;
|
|
722
|
+
tuesday: {
|
|
723
|
+
open: string;
|
|
724
|
+
close: string;
|
|
725
|
+
breaks?: {
|
|
805
726
|
start: string;
|
|
806
727
|
end: string;
|
|
807
|
-
}
|
|
808
|
-
|
|
728
|
+
}[];
|
|
729
|
+
} | null;
|
|
730
|
+
wednesday: {
|
|
731
|
+
open: string;
|
|
732
|
+
close: string;
|
|
733
|
+
breaks?: {
|
|
809
734
|
start: string;
|
|
810
735
|
end: string;
|
|
811
|
-
}
|
|
812
|
-
|
|
736
|
+
}[];
|
|
737
|
+
} | null;
|
|
738
|
+
thursday: {
|
|
739
|
+
open: string;
|
|
740
|
+
close: string;
|
|
741
|
+
breaks?: {
|
|
813
742
|
start: string;
|
|
814
743
|
end: string;
|
|
815
|
-
}
|
|
816
|
-
|
|
744
|
+
}[];
|
|
745
|
+
} | null;
|
|
746
|
+
friday: {
|
|
747
|
+
open: string;
|
|
748
|
+
close: string;
|
|
749
|
+
breaks?: {
|
|
817
750
|
start: string;
|
|
818
751
|
end: string;
|
|
819
|
-
}
|
|
820
|
-
|
|
752
|
+
}[];
|
|
753
|
+
} | null;
|
|
754
|
+
saturday: {
|
|
755
|
+
open: string;
|
|
756
|
+
close: string;
|
|
757
|
+
breaks?: {
|
|
821
758
|
start: string;
|
|
822
759
|
end: string;
|
|
823
|
-
}
|
|
824
|
-
|
|
760
|
+
}[];
|
|
761
|
+
} | null;
|
|
762
|
+
sunday: {
|
|
763
|
+
open: string;
|
|
764
|
+
close: string;
|
|
765
|
+
breaks?: {
|
|
825
766
|
start: string;
|
|
826
767
|
end: string;
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
isActive: boolean;
|
|
830
|
-
createdAt: Timestamp | Date;
|
|
831
|
-
updatedAt: Timestamp | Date;
|
|
768
|
+
}[];
|
|
769
|
+
} | null;
|
|
832
770
|
}
|
|
833
771
|
/**
|
|
834
|
-
*
|
|
772
|
+
* Interface for doctor information
|
|
773
|
+
*/
|
|
774
|
+
interface DoctorInfo {
|
|
775
|
+
id: string;
|
|
776
|
+
name: string;
|
|
777
|
+
description?: string;
|
|
778
|
+
photo: string | null;
|
|
779
|
+
rating: number;
|
|
780
|
+
services: string[];
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Interface for clinic
|
|
784
|
+
*/
|
|
785
|
+
interface Clinic {
|
|
786
|
+
id: string;
|
|
787
|
+
clinicGroupId: string;
|
|
788
|
+
name: string;
|
|
789
|
+
description?: string;
|
|
790
|
+
location: ClinicLocation;
|
|
791
|
+
contactInfo: ClinicContactInfo;
|
|
792
|
+
workingHours: WorkingHours;
|
|
793
|
+
tags: ClinicTag[];
|
|
794
|
+
featuredPhotos: MediaResource[];
|
|
795
|
+
coverPhoto: MediaResource | null;
|
|
796
|
+
photosWithTags?: {
|
|
797
|
+
url: MediaResource;
|
|
798
|
+
tag: string;
|
|
799
|
+
}[];
|
|
800
|
+
doctors: string[];
|
|
801
|
+
doctorsInfo: DoctorInfo[];
|
|
802
|
+
procedures: string[];
|
|
803
|
+
proceduresInfo: ProcedureSummaryInfo[];
|
|
804
|
+
reviewInfo: ClinicReviewInfo;
|
|
805
|
+
admins: string[];
|
|
806
|
+
createdAt: Timestamp;
|
|
807
|
+
updatedAt: Timestamp;
|
|
808
|
+
isActive: boolean;
|
|
809
|
+
isVerified: boolean;
|
|
810
|
+
logo?: MediaResource | null;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Osnovne informacije o zdravstvenom radniku
|
|
815
|
+
*/
|
|
816
|
+
interface PractitionerBasicInfo {
|
|
817
|
+
firstName: string;
|
|
818
|
+
lastName: string;
|
|
819
|
+
title: string;
|
|
820
|
+
email: string;
|
|
821
|
+
phoneNumber: string | null;
|
|
822
|
+
dateOfBirth: Timestamp | Date | null;
|
|
823
|
+
gender: "male" | "female" | "other";
|
|
824
|
+
profileImageUrl?: MediaResource | null;
|
|
825
|
+
bio?: string;
|
|
826
|
+
languages: string[];
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Sertifikacija zdravstvenog radnika
|
|
830
|
+
*/
|
|
831
|
+
interface PractitionerCertification {
|
|
832
|
+
level: CertificationLevel;
|
|
833
|
+
specialties: CertificationSpecialty[];
|
|
834
|
+
licenseNumber: string;
|
|
835
|
+
issuingAuthority: string;
|
|
836
|
+
issueDate: Timestamp | Date;
|
|
837
|
+
expiryDate?: Timestamp | Date | null;
|
|
838
|
+
verificationStatus: "pending" | "verified" | "rejected";
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Interfejs za radno vreme zdravstvenog radnika u klinici
|
|
842
|
+
*/
|
|
843
|
+
interface PractitionerClinicWorkingHours {
|
|
844
|
+
clinicId: string;
|
|
845
|
+
workingHours: {
|
|
846
|
+
monday: {
|
|
847
|
+
start: string;
|
|
848
|
+
end: string;
|
|
849
|
+
} | null;
|
|
850
|
+
tuesday: {
|
|
851
|
+
start: string;
|
|
852
|
+
end: string;
|
|
853
|
+
} | null;
|
|
854
|
+
wednesday: {
|
|
855
|
+
start: string;
|
|
856
|
+
end: string;
|
|
857
|
+
} | null;
|
|
858
|
+
thursday: {
|
|
859
|
+
start: string;
|
|
860
|
+
end: string;
|
|
861
|
+
} | null;
|
|
862
|
+
friday: {
|
|
863
|
+
start: string;
|
|
864
|
+
end: string;
|
|
865
|
+
} | null;
|
|
866
|
+
saturday: {
|
|
867
|
+
start: string;
|
|
868
|
+
end: string;
|
|
869
|
+
} | null;
|
|
870
|
+
sunday: {
|
|
871
|
+
start: string;
|
|
872
|
+
end: string;
|
|
873
|
+
} | null;
|
|
874
|
+
};
|
|
875
|
+
isActive: boolean;
|
|
876
|
+
createdAt: Timestamp | Date;
|
|
877
|
+
updatedAt: Timestamp | Date;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Status of practitioner profile
|
|
835
881
|
*/
|
|
836
882
|
declare enum PractitionerStatus {
|
|
837
883
|
DRAFT = "draft",
|
|
@@ -888,6 +934,103 @@ interface PractitionerToken {
|
|
|
888
934
|
emailErrorAt?: Timestamp;
|
|
889
935
|
}
|
|
890
936
|
|
|
937
|
+
declare enum AllergyType {
|
|
938
|
+
MEDICATION = "medication",
|
|
939
|
+
FOOD = "food",
|
|
940
|
+
ENVIRONMENTAL = "environmental",
|
|
941
|
+
LATEX = "latex",
|
|
942
|
+
COSMETIC = "cosmetic",
|
|
943
|
+
OTHER = "other"
|
|
944
|
+
}
|
|
945
|
+
declare enum MedicationAllergySubtype {
|
|
946
|
+
ANTIBIOTICS = "antibiotics",
|
|
947
|
+
NSAIDS = "nsaids",
|
|
948
|
+
OPIOIDS = "opioids",
|
|
949
|
+
ANESTHETICS = "anesthetics",
|
|
950
|
+
VACCINES = "vaccines",
|
|
951
|
+
OTHER = "other"
|
|
952
|
+
}
|
|
953
|
+
declare enum FoodAllergySubtype {
|
|
954
|
+
NUTS = "nuts",
|
|
955
|
+
SHELLFISH = "shellfish",
|
|
956
|
+
DAIRY = "dairy",
|
|
957
|
+
EGGS = "eggs",
|
|
958
|
+
WHEAT = "wheat",
|
|
959
|
+
SOY = "soy",
|
|
960
|
+
FISH = "fish",
|
|
961
|
+
FRUITS = "fruits",
|
|
962
|
+
OTHER = "other"
|
|
963
|
+
}
|
|
964
|
+
declare enum EnvironmentalAllergySubtype {
|
|
965
|
+
POLLEN = "pollen",
|
|
966
|
+
DUST = "dust",
|
|
967
|
+
MOLD = "mold",
|
|
968
|
+
PET_DANDER = "pet_dander",
|
|
969
|
+
INSECTS = "insects",
|
|
970
|
+
OTHER = "other"
|
|
971
|
+
}
|
|
972
|
+
declare enum CosmeticAllergySubtype {
|
|
973
|
+
FRAGRANCES = "fragrances",
|
|
974
|
+
PRESERVATIVES = "preservatives",
|
|
975
|
+
DYES = "dyes",
|
|
976
|
+
METALS = "metals",
|
|
977
|
+
OTHER = "other"
|
|
978
|
+
}
|
|
979
|
+
type AllergySubtype = MedicationAllergySubtype | FoodAllergySubtype | EnvironmentalAllergySubtype | CosmeticAllergySubtype | "other";
|
|
980
|
+
|
|
981
|
+
interface Allergy {
|
|
982
|
+
type: AllergyType;
|
|
983
|
+
subtype: AllergySubtype;
|
|
984
|
+
name?: string | null;
|
|
985
|
+
severity?: "mild" | "moderate" | "severe" | null;
|
|
986
|
+
reaction?: string | null;
|
|
987
|
+
diagnosed?: Timestamp | null;
|
|
988
|
+
notes?: string | null;
|
|
989
|
+
}
|
|
990
|
+
interface VitalStats {
|
|
991
|
+
height?: number;
|
|
992
|
+
weight?: number;
|
|
993
|
+
bloodType?: "A+" | "A-" | "B+" | "B-" | "AB+" | "AB-" | "O+" | "O-";
|
|
994
|
+
bloodPressure?: {
|
|
995
|
+
systolic: number;
|
|
996
|
+
diastolic: number;
|
|
997
|
+
lastMeasured: Timestamp;
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
interface PatientMedicalInfo {
|
|
1001
|
+
patientId: string;
|
|
1002
|
+
vitalStats: VitalStats;
|
|
1003
|
+
blockingConditions: {
|
|
1004
|
+
condition: BlockingCondition;
|
|
1005
|
+
diagnosedAt: Timestamp;
|
|
1006
|
+
isActive: boolean;
|
|
1007
|
+
notes?: string | null;
|
|
1008
|
+
}[];
|
|
1009
|
+
contraindications: {
|
|
1010
|
+
condition: Contraindication;
|
|
1011
|
+
lastOccurrence: Timestamp;
|
|
1012
|
+
frequency: "rare" | "occasional" | "frequent";
|
|
1013
|
+
isActive: boolean;
|
|
1014
|
+
notes?: string | null;
|
|
1015
|
+
}[];
|
|
1016
|
+
allergies: Allergy[];
|
|
1017
|
+
currentMedications: {
|
|
1018
|
+
name: string;
|
|
1019
|
+
dosage: string;
|
|
1020
|
+
frequency: string;
|
|
1021
|
+
startDate?: Timestamp | null;
|
|
1022
|
+
endDate?: Timestamp | null;
|
|
1023
|
+
prescribedBy?: string | null;
|
|
1024
|
+
}[];
|
|
1025
|
+
emergencyNotes?: string;
|
|
1026
|
+
lastUpdated: Timestamp;
|
|
1027
|
+
updatedBy: string;
|
|
1028
|
+
verifiedBy?: string;
|
|
1029
|
+
verifiedAt?: Timestamp;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
declare const PATIENTS_COLLECTION = "patients";
|
|
1033
|
+
declare const PATIENT_SENSITIVE_INFO_COLLECTION = "sensitive-info";
|
|
891
1034
|
/**
|
|
892
1035
|
* Enumeracija za pol pacijenta
|
|
893
1036
|
*/
|
|
@@ -899,6 +1042,24 @@ declare enum Gender {
|
|
|
899
1042
|
PREFER_NOT_TO_SAY = "prefer_not_to_say",
|
|
900
1043
|
OTHER = "other"
|
|
901
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Interfejs za adresne podatke
|
|
1047
|
+
*/
|
|
1048
|
+
interface AddressData {
|
|
1049
|
+
address: string;
|
|
1050
|
+
city: string;
|
|
1051
|
+
country: string;
|
|
1052
|
+
postalCode: string;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Interfejs za kontakt za hitne slučajeve
|
|
1056
|
+
*/
|
|
1057
|
+
interface EmergencyContact {
|
|
1058
|
+
name: string;
|
|
1059
|
+
relationship: string;
|
|
1060
|
+
phoneNumber: string;
|
|
1061
|
+
isNotifiable: boolean;
|
|
1062
|
+
}
|
|
902
1063
|
/**
|
|
903
1064
|
* Interfejs za gamifikaciju
|
|
904
1065
|
*/
|
|
@@ -908,6 +1069,42 @@ interface GamificationInfo {
|
|
|
908
1069
|
/** Trenutni poeni */
|
|
909
1070
|
points: number;
|
|
910
1071
|
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Interfejs za osetljive informacije pacijenta (subkolekcija)
|
|
1074
|
+
*/
|
|
1075
|
+
interface PatientSensitiveInfo {
|
|
1076
|
+
patientId: string;
|
|
1077
|
+
userRef?: string;
|
|
1078
|
+
photoUrl?: string | null;
|
|
1079
|
+
firstName: string;
|
|
1080
|
+
lastName: string;
|
|
1081
|
+
dateOfBirth: Timestamp | null;
|
|
1082
|
+
gender: Gender;
|
|
1083
|
+
email?: string;
|
|
1084
|
+
phoneNumber?: string;
|
|
1085
|
+
alternativePhoneNumber?: string;
|
|
1086
|
+
addressData?: AddressData;
|
|
1087
|
+
emergencyContacts?: EmergencyContact[];
|
|
1088
|
+
createdAt: Timestamp;
|
|
1089
|
+
updatedAt: Timestamp;
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Tip za kreiranje osetljivih informacija
|
|
1093
|
+
*/
|
|
1094
|
+
interface CreatePatientSensitiveInfoData {
|
|
1095
|
+
patientId: string;
|
|
1096
|
+
userRef?: string;
|
|
1097
|
+
photoUrl?: MediaResource | null;
|
|
1098
|
+
firstName: string;
|
|
1099
|
+
lastName: string;
|
|
1100
|
+
dateOfBirth: Timestamp | null;
|
|
1101
|
+
gender: Gender;
|
|
1102
|
+
email?: string;
|
|
1103
|
+
phoneNumber?: string;
|
|
1104
|
+
alternativePhoneNumber?: string;
|
|
1105
|
+
addressData?: AddressData;
|
|
1106
|
+
emergencyContacts?: EmergencyContact[];
|
|
1107
|
+
}
|
|
911
1108
|
/**
|
|
912
1109
|
* Interfejs za doktora pacijenta
|
|
913
1110
|
*/
|
|
@@ -933,12 +1130,13 @@ interface PatientClinic {
|
|
|
933
1130
|
*/
|
|
934
1131
|
interface PatientProfile {
|
|
935
1132
|
id: string;
|
|
936
|
-
userRef
|
|
1133
|
+
userRef?: string;
|
|
937
1134
|
displayName: string;
|
|
938
1135
|
gamification: GamificationInfo;
|
|
939
1136
|
expoTokens: string[];
|
|
940
1137
|
isActive: boolean;
|
|
941
1138
|
isVerified: boolean;
|
|
1139
|
+
isManual: boolean;
|
|
942
1140
|
phoneNumber?: string | null;
|
|
943
1141
|
dateOfBirth?: Timestamp | null;
|
|
944
1142
|
doctors: PatientDoctor[];
|
|
@@ -948,6 +1146,22 @@ interface PatientProfile {
|
|
|
948
1146
|
createdAt: Timestamp;
|
|
949
1147
|
updatedAt: Timestamp;
|
|
950
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Tip za kreiranje novog Patient profila
|
|
1151
|
+
*/
|
|
1152
|
+
interface CreatePatientProfileData {
|
|
1153
|
+
userRef?: string;
|
|
1154
|
+
displayName: string;
|
|
1155
|
+
expoTokens: string[];
|
|
1156
|
+
gamification?: GamificationInfo;
|
|
1157
|
+
isActive: boolean;
|
|
1158
|
+
isVerified: boolean;
|
|
1159
|
+
isManual: boolean;
|
|
1160
|
+
doctors?: PatientDoctor[];
|
|
1161
|
+
clinics?: PatientClinic[];
|
|
1162
|
+
doctorIds?: string[];
|
|
1163
|
+
clinicIds?: string[];
|
|
1164
|
+
}
|
|
951
1165
|
|
|
952
1166
|
/**
|
|
953
1167
|
* Interface for clinic profile information
|
|
@@ -984,591 +1198,266 @@ interface PatientProfileInfo {
|
|
|
984
1198
|
}
|
|
985
1199
|
|
|
986
1200
|
/**
|
|
987
|
-
* Enum for
|
|
1201
|
+
* Enum for element types in documentation templates
|
|
988
1202
|
*/
|
|
989
|
-
declare enum
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
ELEVATOR = "elevator",
|
|
1004
|
-
RAMP = "ramp",
|
|
1005
|
-
HANDICAP_PARKING = "handicap_parking",
|
|
1006
|
-
BRAILLE = "braille",
|
|
1007
|
-
SIGN_LANGUAGE = "sign_language",
|
|
1008
|
-
EMERGENCY_SERVICE = "emergency_service",
|
|
1009
|
-
LAB = "lab",
|
|
1010
|
-
XRAY = "xray",
|
|
1011
|
-
ULTRASOUND = "ultrasound",
|
|
1012
|
-
DENTAL = "dental",
|
|
1013
|
-
PEDIATRIC = "pediatric",
|
|
1014
|
-
GYNECOLOGY = "gynecology",
|
|
1015
|
-
CARDIOLOGY = "cardiology",
|
|
1016
|
-
DERMATOLOGY = "dermatology",
|
|
1017
|
-
ORTHOPEDIC = "orthopedic",
|
|
1018
|
-
OPHTHALMOLOGY = "ophthalmology",
|
|
1019
|
-
TELEMEDICINE = "telemedicine",
|
|
1020
|
-
HOME_VISITS = "home_visits",
|
|
1021
|
-
ONLINE_BOOKING = "online_booking",
|
|
1022
|
-
MOBILE_APP = "mobile_app",
|
|
1023
|
-
SMS_NOTIFICATIONS = "sms_notifications",
|
|
1024
|
-
EMAIL_NOTIFICATIONS = "email_notifications",
|
|
1025
|
-
ENGLISH = "english",
|
|
1026
|
-
SERBIAN = "serbian",
|
|
1027
|
-
GERMAN = "german",
|
|
1028
|
-
RUSSIAN = "russian",
|
|
1029
|
-
CHINESE = "chinese",
|
|
1030
|
-
SPANISH = "spanish",
|
|
1031
|
-
FRENCH = "french",
|
|
1032
|
-
OPEN_24_7 = "open_24_7",
|
|
1033
|
-
WEEKEND_HOURS = "weekend_hours",
|
|
1034
|
-
NIGHT_SHIFT = "night_shift",
|
|
1035
|
-
HOLIDAY_HOURS = "holiday_hours"
|
|
1203
|
+
declare enum DocumentElementType {
|
|
1204
|
+
HEADING = "heading",
|
|
1205
|
+
PARAGRAPH = "paragraph",
|
|
1206
|
+
LIST = "list",
|
|
1207
|
+
DYNAMIC_TEXT = "dynamic_text",
|
|
1208
|
+
BINARY_CHOICE = "binary_choice",
|
|
1209
|
+
MULTIPLE_CHOICE = "multiple_choice",
|
|
1210
|
+
SINGLE_CHOICE = "single_choice",
|
|
1211
|
+
RATING_SCALE = "rating_scale",
|
|
1212
|
+
TEXT_INPUT = "text_input",
|
|
1213
|
+
DATE_PICKER = "date_picker",
|
|
1214
|
+
SIGNATURE = "signature",
|
|
1215
|
+
DITIGAL_SIGNATURE = "digital_signature",
|
|
1216
|
+
FILE_UPLOAD = "file_upload"
|
|
1036
1217
|
}
|
|
1037
|
-
|
|
1038
1218
|
/**
|
|
1039
|
-
* Enum for
|
|
1219
|
+
* Enum for list types
|
|
1040
1220
|
*/
|
|
1041
|
-
declare enum
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
REJECTED = "rejected",
|
|
1045
|
-
CANCELLED = "cancelled"
|
|
1221
|
+
declare enum ListType {
|
|
1222
|
+
ORDERED = "ordered",
|
|
1223
|
+
UNORDERED = "unordered"
|
|
1046
1224
|
}
|
|
1047
1225
|
/**
|
|
1048
|
-
*
|
|
1226
|
+
* Enum for heading levels
|
|
1049
1227
|
*/
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
end: string;
|
|
1058
|
-
} | null;
|
|
1059
|
-
wednesday: {
|
|
1060
|
-
start: string;
|
|
1061
|
-
end: string;
|
|
1062
|
-
} | null;
|
|
1063
|
-
thursday: {
|
|
1064
|
-
start: string;
|
|
1065
|
-
end: string;
|
|
1066
|
-
} | null;
|
|
1067
|
-
friday: {
|
|
1068
|
-
start: string;
|
|
1069
|
-
end: string;
|
|
1070
|
-
} | null;
|
|
1071
|
-
saturday: {
|
|
1072
|
-
start: string;
|
|
1073
|
-
end: string;
|
|
1074
|
-
} | null;
|
|
1075
|
-
sunday: {
|
|
1076
|
-
start: string;
|
|
1077
|
-
end: string;
|
|
1078
|
-
} | null;
|
|
1228
|
+
declare enum HeadingLevel {
|
|
1229
|
+
H1 = "h1",
|
|
1230
|
+
H2 = "h2",
|
|
1231
|
+
H3 = "h3",
|
|
1232
|
+
H4 = "h4",
|
|
1233
|
+
H5 = "h5",
|
|
1234
|
+
H6 = "h6"
|
|
1079
1235
|
}
|
|
1080
1236
|
/**
|
|
1081
|
-
*
|
|
1237
|
+
* Base interface for all document elements
|
|
1082
1238
|
*/
|
|
1083
|
-
interface
|
|
1239
|
+
interface BaseDocumentElement {
|
|
1084
1240
|
id: string;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
practitionerInfo: PractitionerProfileInfo;
|
|
1088
|
-
clinicInfo: ClinicInfo;
|
|
1089
|
-
proposedWorkingHours: ProposedWorkingHours;
|
|
1090
|
-
status: PractitionerInviteStatus;
|
|
1091
|
-
invitedBy: string;
|
|
1092
|
-
message?: string | null;
|
|
1093
|
-
rejectionReason?: string | null;
|
|
1094
|
-
cancelReason?: string | null;
|
|
1095
|
-
createdAt: Timestamp;
|
|
1096
|
-
updatedAt: Timestamp;
|
|
1097
|
-
acceptedAt?: Timestamp | null;
|
|
1098
|
-
rejectedAt?: Timestamp | null;
|
|
1099
|
-
cancelledAt?: Timestamp | null;
|
|
1241
|
+
type: DocumentElementType;
|
|
1242
|
+
required?: boolean;
|
|
1100
1243
|
}
|
|
1101
|
-
|
|
1102
1244
|
/**
|
|
1103
|
-
* Interface for
|
|
1245
|
+
* Interface for heading element
|
|
1104
1246
|
*/
|
|
1105
|
-
interface
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
website?: string | null;
|
|
1247
|
+
interface HeadingElement extends BaseDocumentElement {
|
|
1248
|
+
type: DocumentElementType.HEADING;
|
|
1249
|
+
text: string;
|
|
1250
|
+
level: HeadingLevel;
|
|
1110
1251
|
}
|
|
1111
1252
|
/**
|
|
1112
|
-
* Interface for
|
|
1253
|
+
* Interface for paragraph element
|
|
1113
1254
|
*/
|
|
1114
|
-
interface
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
country: string;
|
|
1118
|
-
postalCode: string;
|
|
1119
|
-
latitude: number;
|
|
1120
|
-
longitude: number;
|
|
1121
|
-
geohash?: string | null;
|
|
1255
|
+
interface ParagraphElement extends BaseDocumentElement {
|
|
1256
|
+
type: DocumentElementType.PARAGRAPH;
|
|
1257
|
+
text: string;
|
|
1122
1258
|
}
|
|
1123
1259
|
/**
|
|
1124
|
-
* Interface for
|
|
1260
|
+
* Interface for list element
|
|
1125
1261
|
*/
|
|
1126
|
-
interface
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
breaks?: {
|
|
1131
|
-
start: string;
|
|
1132
|
-
end: string;
|
|
1133
|
-
}[];
|
|
1134
|
-
} | null;
|
|
1135
|
-
tuesday: {
|
|
1136
|
-
open: string;
|
|
1137
|
-
close: string;
|
|
1138
|
-
breaks?: {
|
|
1139
|
-
start: string;
|
|
1140
|
-
end: string;
|
|
1141
|
-
}[];
|
|
1142
|
-
} | null;
|
|
1143
|
-
wednesday: {
|
|
1144
|
-
open: string;
|
|
1145
|
-
close: string;
|
|
1146
|
-
breaks?: {
|
|
1147
|
-
start: string;
|
|
1148
|
-
end: string;
|
|
1149
|
-
}[];
|
|
1150
|
-
} | null;
|
|
1151
|
-
thursday: {
|
|
1152
|
-
open: string;
|
|
1153
|
-
close: string;
|
|
1154
|
-
breaks?: {
|
|
1155
|
-
start: string;
|
|
1156
|
-
end: string;
|
|
1157
|
-
}[];
|
|
1158
|
-
} | null;
|
|
1159
|
-
friday: {
|
|
1160
|
-
open: string;
|
|
1161
|
-
close: string;
|
|
1162
|
-
breaks?: {
|
|
1163
|
-
start: string;
|
|
1164
|
-
end: string;
|
|
1165
|
-
}[];
|
|
1166
|
-
} | null;
|
|
1167
|
-
saturday: {
|
|
1168
|
-
open: string;
|
|
1169
|
-
close: string;
|
|
1170
|
-
breaks?: {
|
|
1171
|
-
start: string;
|
|
1172
|
-
end: string;
|
|
1173
|
-
}[];
|
|
1174
|
-
} | null;
|
|
1175
|
-
sunday: {
|
|
1176
|
-
open: string;
|
|
1177
|
-
close: string;
|
|
1178
|
-
breaks?: {
|
|
1179
|
-
start: string;
|
|
1180
|
-
end: string;
|
|
1181
|
-
}[];
|
|
1182
|
-
} | null;
|
|
1262
|
+
interface ListElement extends BaseDocumentElement {
|
|
1263
|
+
type: DocumentElementType.LIST;
|
|
1264
|
+
items: string[];
|
|
1265
|
+
listType: ListType;
|
|
1183
1266
|
}
|
|
1184
1267
|
/**
|
|
1185
|
-
* Interface for
|
|
1268
|
+
* Interface for dynamic text element
|
|
1186
1269
|
*/
|
|
1187
|
-
interface
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
description?: string;
|
|
1191
|
-
photo: string | null;
|
|
1192
|
-
rating: number;
|
|
1193
|
-
services: string[];
|
|
1270
|
+
interface DynamicTextElement extends BaseDocumentElement {
|
|
1271
|
+
type: DocumentElementType.DYNAMIC_TEXT;
|
|
1272
|
+
text: string;
|
|
1194
1273
|
}
|
|
1195
1274
|
/**
|
|
1196
|
-
* Interface for
|
|
1275
|
+
* Interface for binary choice element (Yes/No)
|
|
1197
1276
|
*/
|
|
1198
|
-
interface
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
description?: string;
|
|
1203
|
-
location: ClinicLocation;
|
|
1204
|
-
contactInfo: ClinicContactInfo;
|
|
1205
|
-
workingHours: WorkingHours;
|
|
1206
|
-
tags: ClinicTag[];
|
|
1207
|
-
featuredPhotos: MediaResource[];
|
|
1208
|
-
coverPhoto: MediaResource | null;
|
|
1209
|
-
photosWithTags?: {
|
|
1210
|
-
url: MediaResource;
|
|
1211
|
-
tag: string;
|
|
1212
|
-
}[];
|
|
1213
|
-
doctors: string[];
|
|
1214
|
-
doctorsInfo: DoctorInfo[];
|
|
1215
|
-
procedures: string[];
|
|
1216
|
-
proceduresInfo: ProcedureSummaryInfo[];
|
|
1217
|
-
reviewInfo: ClinicReviewInfo;
|
|
1218
|
-
admins: string[];
|
|
1219
|
-
createdAt: Timestamp;
|
|
1220
|
-
updatedAt: Timestamp;
|
|
1221
|
-
isActive: boolean;
|
|
1222
|
-
isVerified: boolean;
|
|
1223
|
-
logo?: MediaResource | null;
|
|
1277
|
+
interface BinaryChoiceElement extends BaseDocumentElement {
|
|
1278
|
+
type: DocumentElementType.BINARY_CHOICE;
|
|
1279
|
+
question: string;
|
|
1280
|
+
defaultValue?: boolean;
|
|
1224
1281
|
}
|
|
1225
|
-
|
|
1226
1282
|
/**
|
|
1227
|
-
*
|
|
1283
|
+
* Interface for multiple choice element
|
|
1228
1284
|
*/
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1285
|
+
interface MultipleChoiceElement extends BaseDocumentElement {
|
|
1286
|
+
type: DocumentElementType.MULTIPLE_CHOICE;
|
|
1287
|
+
question: string;
|
|
1288
|
+
options: string[];
|
|
1289
|
+
defaultValues?: string[];
|
|
1233
1290
|
}
|
|
1234
|
-
|
|
1235
1291
|
/**
|
|
1236
|
-
*
|
|
1292
|
+
* Interface for single choice element
|
|
1237
1293
|
*/
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
|
|
1244
|
-
COMPLETED = "completed",// When event is completed
|
|
1245
|
-
NO_SHOW = "no_show"
|
|
1294
|
+
interface SingleChoiceElement extends BaseDocumentElement {
|
|
1295
|
+
type: DocumentElementType.SINGLE_CHOICE;
|
|
1296
|
+
question: string;
|
|
1297
|
+
options: string[];
|
|
1298
|
+
defaultValue?: string;
|
|
1246
1299
|
}
|
|
1247
1300
|
/**
|
|
1248
|
-
*
|
|
1301
|
+
* Interface for rating scale element
|
|
1249
1302
|
*/
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1303
|
+
interface RatingScaleElement extends BaseDocumentElement {
|
|
1304
|
+
type: DocumentElementType.RATING_SCALE;
|
|
1305
|
+
question: string;
|
|
1306
|
+
min: number;
|
|
1307
|
+
max: number;
|
|
1308
|
+
labels?: {
|
|
1309
|
+
[key: number]: string;
|
|
1310
|
+
};
|
|
1311
|
+
defaultValue?: number;
|
|
1253
1312
|
}
|
|
1254
1313
|
/**
|
|
1255
|
-
*
|
|
1314
|
+
* Interface for text input element
|
|
1256
1315
|
*/
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1316
|
+
interface TextInputElement extends BaseDocumentElement {
|
|
1317
|
+
type: DocumentElementType.TEXT_INPUT;
|
|
1318
|
+
label: string;
|
|
1319
|
+
placeholder?: string;
|
|
1320
|
+
multiline?: boolean;
|
|
1321
|
+
defaultValue?: string;
|
|
1263
1322
|
}
|
|
1264
1323
|
/**
|
|
1265
|
-
* Interface for
|
|
1324
|
+
* Interface for date picker element
|
|
1266
1325
|
*/
|
|
1267
|
-
interface
|
|
1268
|
-
|
|
1269
|
-
|
|
1326
|
+
interface DatePickerElement extends BaseDocumentElement {
|
|
1327
|
+
type: DocumentElementType.DATE_PICKER;
|
|
1328
|
+
label: string;
|
|
1329
|
+
defaultValue?: string;
|
|
1270
1330
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
}
|
|
1278
|
-
interface ProcedureCategorization {
|
|
1279
|
-
procedureFamily: ProcedureFamily;
|
|
1280
|
-
procedureCategory: Category;
|
|
1281
|
-
procedureSubcategory: Subcategory;
|
|
1282
|
-
procedureTechnology: Technology;
|
|
1283
|
-
procedureProduct: Product;
|
|
1284
|
-
}
|
|
1285
|
-
interface SyncedCalendarEvent {
|
|
1286
|
-
eventId: string;
|
|
1287
|
-
syncedCalendarProvider: SyncedCalendarProvider;
|
|
1288
|
-
syncedAt: Timestamp;
|
|
1331
|
+
/**
|
|
1332
|
+
* Interface for signature element
|
|
1333
|
+
*/
|
|
1334
|
+
interface SignatureElement extends BaseDocumentElement {
|
|
1335
|
+
type: DocumentElementType.SIGNATURE;
|
|
1336
|
+
label: string;
|
|
1289
1337
|
}
|
|
1290
1338
|
/**
|
|
1291
|
-
* Interface for
|
|
1339
|
+
* Interface for file upload element
|
|
1292
1340
|
*/
|
|
1293
|
-
interface
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
practitionerProfileInfo?: PractitionerProfileInfo | null;
|
|
1299
|
-
patientProfileId?: string | null;
|
|
1300
|
-
patientProfileInfo?: PatientProfileInfo | null;
|
|
1301
|
-
procedureId?: string | null;
|
|
1302
|
-
procedureInfo?: ProcedureInfo | null;
|
|
1303
|
-
procedureCategorization?: ProcedureCategorization | null;
|
|
1304
|
-
appointmentId?: string | null;
|
|
1305
|
-
syncedCalendarEventId?: SyncedCalendarEvent[] | null;
|
|
1306
|
-
eventName: string;
|
|
1307
|
-
eventLocation?: ClinicLocation;
|
|
1308
|
-
eventTime: CalendarEventTime;
|
|
1309
|
-
description?: string;
|
|
1310
|
-
status: CalendarEventStatus;
|
|
1311
|
-
syncStatus: CalendarSyncStatus;
|
|
1312
|
-
eventType: CalendarEventType;
|
|
1313
|
-
createdAt: Timestamp;
|
|
1314
|
-
updatedAt: Timestamp;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
declare enum UserRole {
|
|
1318
|
-
PATIENT = "patient",
|
|
1319
|
-
PRACTITIONER = "practitioner",
|
|
1320
|
-
APP_ADMIN = "app_admin",
|
|
1321
|
-
CLINIC_ADMIN = "clinic_admin"
|
|
1341
|
+
interface FileUploadElement extends BaseDocumentElement {
|
|
1342
|
+
type: DocumentElementType.FILE_UPLOAD;
|
|
1343
|
+
label: string;
|
|
1344
|
+
allowedFileTypes?: string[];
|
|
1345
|
+
maxFileSizeMB?: number;
|
|
1322
1346
|
}
|
|
1323
|
-
|
|
1324
1347
|
/**
|
|
1325
|
-
*
|
|
1348
|
+
* Union type for all document elements
|
|
1326
1349
|
*/
|
|
1327
|
-
|
|
1328
|
-
APPOINTMENT_REMINDER = "appointmentReminder",// For upcoming appointments
|
|
1329
|
-
APPOINTMENT_STATUS_CHANGE = "appointmentStatusChange",// Generic for status changes like confirmed, checked-in etc.
|
|
1330
|
-
APPOINTMENT_RESCHEDULED_PROPOSAL = "appointmentRescheduledProposal",// When clinic proposes a new time
|
|
1331
|
-
APPOINTMENT_CANCELLED = "appointmentCancelled",// When an appointment is cancelled
|
|
1332
|
-
PRE_REQUIREMENT_INSTRUCTION_DUE = "preRequirementInstructionDue",
|
|
1333
|
-
POST_REQUIREMENT_INSTRUCTION_DUE = "postRequirementInstructionDue",
|
|
1334
|
-
REQUIREMENT_INSTRUCTION_DUE = "requirementInstructionDue",// For specific pre/post care instructions
|
|
1335
|
-
FORM_REMINDER = "formReminder",// Reminds user to fill a specific form
|
|
1336
|
-
FORM_SUBMISSION_CONFIRMATION = "formSubmissionConfirmation",// Confirms form was submitted
|
|
1337
|
-
REVIEW_REQUEST = "reviewRequest",// Request for patient review post-appointment
|
|
1338
|
-
PAYMENT_DUE = "paymentDue",
|
|
1339
|
-
PAYMENT_CONFIRMATION = "paymentConfirmation",
|
|
1340
|
-
PAYMENT_FAILED = "paymentFailed",
|
|
1341
|
-
GENERAL_MESSAGE = "generalMessage",// For general announcements or direct messages
|
|
1342
|
-
ACCOUNT_NOTIFICATION = "accountNotification"
|
|
1343
|
-
}
|
|
1344
|
-
declare const NOTIFICATIONS_COLLECTION = "notifications";
|
|
1350
|
+
type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
|
|
1345
1351
|
/**
|
|
1346
|
-
*
|
|
1352
|
+
* Interface for document template
|
|
1347
1353
|
*/
|
|
1348
|
-
interface
|
|
1349
|
-
/** Jedinstveni identifikator notifikacije */
|
|
1354
|
+
interface DocumentTemplate {
|
|
1350
1355
|
id: string;
|
|
1351
|
-
/** ID korisnika kome je namenjena notifikacija */
|
|
1352
|
-
userId: string;
|
|
1353
|
-
/** Vreme kada notifikacija treba da bude poslata */
|
|
1354
|
-
notificationTime: Timestamp;
|
|
1355
|
-
/** Tip notifikacije */
|
|
1356
|
-
notificationType: NotificationType;
|
|
1357
|
-
/** Tokeni uređaja na koje treba poslati notifikaciju */
|
|
1358
|
-
notificationTokens: string[];
|
|
1359
|
-
/** Status notifikacije */
|
|
1360
|
-
status: NotificationStatus;
|
|
1361
|
-
/** Vreme kreiranja */
|
|
1362
|
-
createdAt: Timestamp;
|
|
1363
|
-
/** Vreme poslednjeg ažuriranja */
|
|
1364
|
-
updatedAt: Timestamp;
|
|
1365
|
-
/** Vreme kada je notifikacija poslata */
|
|
1366
|
-
sentAt?: Timestamp;
|
|
1367
|
-
/** Detalji o grešci ako postoje */
|
|
1368
|
-
error?: string;
|
|
1369
|
-
/** Naslov notifikacije */
|
|
1370
1356
|
title: string;
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
transactionId?: string;
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Status notifikacije
|
|
1386
|
-
*/
|
|
1387
|
-
declare enum NotificationStatus {
|
|
1388
|
-
PENDING = "pending",
|
|
1389
|
-
PROCESSING = "processing",
|
|
1390
|
-
SENT = "sent",
|
|
1391
|
-
FAILED = "failed",
|
|
1392
|
-
DELIVERED = "delivered",
|
|
1393
|
-
CANCELLED = "cancelled",
|
|
1394
|
-
PARTIAL_SUCCESS = "partialSuccess"
|
|
1357
|
+
description?: string;
|
|
1358
|
+
createdAt: number;
|
|
1359
|
+
updatedAt: number;
|
|
1360
|
+
createdBy: string;
|
|
1361
|
+
elements: DocumentElement[];
|
|
1362
|
+
tags?: string[];
|
|
1363
|
+
isUserForm?: boolean;
|
|
1364
|
+
isRequired?: boolean;
|
|
1365
|
+
sortingOrder?: number;
|
|
1366
|
+
version: number;
|
|
1367
|
+
isActive: boolean;
|
|
1395
1368
|
}
|
|
1396
1369
|
/**
|
|
1397
|
-
*
|
|
1370
|
+
* Interface for a filled document (completed form)
|
|
1398
1371
|
*/
|
|
1399
|
-
interface
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1372
|
+
interface FilledDocument {
|
|
1373
|
+
id: string;
|
|
1374
|
+
templateId: string;
|
|
1375
|
+
templateVersion: number;
|
|
1376
|
+
isUserForm: boolean;
|
|
1377
|
+
isRequired: boolean;
|
|
1378
|
+
procedureId: string;
|
|
1379
|
+
appointmentId: string;
|
|
1380
|
+
patientId: string;
|
|
1381
|
+
practitionerId: string;
|
|
1382
|
+
clinicId: string;
|
|
1383
|
+
createdAt: number;
|
|
1384
|
+
updatedAt: number;
|
|
1385
|
+
values: {
|
|
1386
|
+
[elementId: string]: any | FilledDocumentFileValue;
|
|
1387
|
+
};
|
|
1388
|
+
status: FilledDocumentStatus;
|
|
1407
1389
|
}
|
|
1408
1390
|
/**
|
|
1409
|
-
*
|
|
1391
|
+
* Enum for filled document status
|
|
1410
1392
|
*/
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
deadline: Timestamp;
|
|
1393
|
+
declare enum FilledDocumentStatus {
|
|
1394
|
+
DRAFT = "draft",
|
|
1395
|
+
SKIPPED = "skipped",
|
|
1396
|
+
PENDING = "pending",
|
|
1397
|
+
COMPLETED = "completed",// When doctor or patient completes the form
|
|
1398
|
+
SIGNED = "signed",// Only used for user forms
|
|
1399
|
+
REJECTED = "rejected"
|
|
1419
1400
|
}
|
|
1420
1401
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
* Example: "Do not eat 2 hours before your [Procedure Name] appointment."
|
|
1402
|
+
* Interface for file upload results to be stored in filled document values
|
|
1423
1403
|
*/
|
|
1424
|
-
interface
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1404
|
+
interface FilledDocumentFileValue {
|
|
1405
|
+
mediaId: string;
|
|
1406
|
+
url: string;
|
|
1407
|
+
name: string;
|
|
1408
|
+
contentType: string;
|
|
1409
|
+
size: number;
|
|
1410
|
+
uploadedAt: number;
|
|
1429
1411
|
}
|
|
1412
|
+
|
|
1430
1413
|
/**
|
|
1431
|
-
*
|
|
1432
|
-
* Example: "Reminder: Your appointment for [Procedure Name] is at [Time] today."
|
|
1414
|
+
* Enum defining the possible statuses of an appointment.
|
|
1433
1415
|
*/
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1416
|
+
declare enum AppointmentStatus {
|
|
1417
|
+
PENDING = "pending",// Initial state after booking, before confirmation (if applicable)
|
|
1418
|
+
CONFIRMED = "confirmed",// Confirmed by clinic/practitioner
|
|
1419
|
+
CHECKED_IN = "checked_in",// Patient has arrived
|
|
1420
|
+
IN_PROGRESS = "in_progress",// Procedure has started
|
|
1421
|
+
COMPLETED = "completed",// Procedure finished successfully
|
|
1422
|
+
CANCELED_PATIENT = "canceled_patient",// Canceled by the patient
|
|
1423
|
+
CANCELED_PATIENT_RESCHEDULED = "canceled_patient_rescheduled",// Canceled by the patient and rescheduled by the clinic
|
|
1424
|
+
CANCELED_CLINIC = "canceled_clinic",// Canceled by the clinic/practitioner
|
|
1425
|
+
NO_SHOW = "no_show",// Patient did not attend
|
|
1426
|
+
RESCHEDULED_BY_CLINIC = "rescheduled_by_clinic"
|
|
1441
1427
|
}
|
|
1442
1428
|
/**
|
|
1443
|
-
*
|
|
1444
|
-
* Excludes cancellations and reschedule proposals, which have their own types.
|
|
1445
|
-
* Example: "Your appointment for [Procedure Name] has been Confirmed."
|
|
1429
|
+
* Enum defining the payment status of an appointment.
|
|
1446
1430
|
*/
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1431
|
+
declare enum PaymentStatus {
|
|
1432
|
+
UNPAID = "unpaid",
|
|
1433
|
+
PAID = "paid",
|
|
1434
|
+
PARTIALLY_PAID = "partially_paid",
|
|
1435
|
+
REFUNDED = "refunded",
|
|
1436
|
+
NOT_APPLICABLE = "not_applicable"
|
|
1453
1437
|
}
|
|
1454
1438
|
/**
|
|
1455
|
-
*
|
|
1456
|
-
* Example: "Action Required: [Clinic Name] has proposed a new time for your [Procedure Name] appointment."
|
|
1439
|
+
* Enum for different types of media that can be attached to an appointment.
|
|
1457
1440
|
*/
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
procedureName?: string;
|
|
1441
|
+
declare enum MediaType {
|
|
1442
|
+
BEFORE_PHOTO = "before_photo",
|
|
1443
|
+
AFTER_PHOTO = "after_photo",
|
|
1444
|
+
CONSENT_SCAN = "consent_scan",
|
|
1445
|
+
OTHER_DOCUMENT = "other_document"
|
|
1464
1446
|
}
|
|
1465
1447
|
/**
|
|
1466
|
-
*
|
|
1467
|
-
* Example: "Your appointment for [Procedure Name] on [Date] has been cancelled."
|
|
1448
|
+
* Interface to describe a media file linked to an appointment.
|
|
1468
1449
|
*/
|
|
1469
|
-
interface
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1450
|
+
interface AppointmentMediaItem {
|
|
1451
|
+
id: string;
|
|
1452
|
+
type: MediaType;
|
|
1453
|
+
url: string;
|
|
1454
|
+
fileName?: string;
|
|
1455
|
+
uploadedAt: Timestamp;
|
|
1456
|
+
uploadedBy: string;
|
|
1457
|
+
description?: string;
|
|
1475
1458
|
}
|
|
1476
1459
|
/**
|
|
1477
|
-
*
|
|
1478
|
-
* Example: "Reminder: Please complete the '[Form Name]' form for your upcoming appointment."
|
|
1479
|
-
*/
|
|
1480
|
-
interface FormReminderNotification extends BaseNotification {
|
|
1481
|
-
notificationType: NotificationType.FORM_REMINDER;
|
|
1482
|
-
appointmentId: string;
|
|
1483
|
-
formId: string;
|
|
1484
|
-
formName: string;
|
|
1485
|
-
formDeadline?: Timestamp;
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* Notification confirming a form submission.
|
|
1489
|
-
* Example: "Thank you! Your '[Form Name]' form has been submitted successfully."
|
|
1490
|
-
*/
|
|
1491
|
-
interface FormSubmissionConfirmationNotification extends BaseNotification {
|
|
1492
|
-
notificationType: NotificationType.FORM_SUBMISSION_CONFIRMATION;
|
|
1493
|
-
appointmentId?: string;
|
|
1494
|
-
formId: string;
|
|
1495
|
-
formName: string;
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Notification requesting a patient to leave a review after an appointment.
|
|
1499
|
-
* Example: "Hope you had a great experience! Would you like to share your feedback for your visit on [Date]?"
|
|
1500
|
-
*/
|
|
1501
|
-
interface ReviewRequestNotification extends BaseNotification {
|
|
1502
|
-
notificationType: NotificationType.REVIEW_REQUEST;
|
|
1503
|
-
appointmentId: string;
|
|
1504
|
-
practitionerName?: string;
|
|
1505
|
-
procedureName?: string;
|
|
1506
|
-
}
|
|
1507
|
-
/**
|
|
1508
|
-
* Generic notification for direct messages or announcements.
|
|
1509
|
-
*/
|
|
1510
|
-
interface GeneralMessageNotification extends BaseNotification {
|
|
1511
|
-
notificationType: NotificationType.GENERAL_MESSAGE;
|
|
1512
|
-
}
|
|
1513
|
-
interface PaymentConfirmationNotification extends BaseNotification {
|
|
1514
|
-
notificationType: NotificationType.PAYMENT_CONFIRMATION;
|
|
1515
|
-
transactionId: string;
|
|
1516
|
-
appointmentId?: string;
|
|
1517
|
-
amount: string;
|
|
1518
|
-
}
|
|
1519
|
-
/**
|
|
1520
|
-
* Unija svih tipova notifikacija
|
|
1521
|
-
*/
|
|
1522
|
-
type Notification = PreRequirementNotification | PostRequirementNotification | RequirementInstructionDueNotification | AppointmentReminderNotification | AppointmentStatusChangeNotification | AppointmentRescheduledProposalNotification | AppointmentCancelledNotification | FormReminderNotification | FormSubmissionConfirmationNotification | ReviewRequestNotification | GeneralMessageNotification | PaymentConfirmationNotification;
|
|
1523
|
-
|
|
1524
|
-
/**
|
|
1525
|
-
* Enum defining the possible statuses of an appointment.
|
|
1526
|
-
*/
|
|
1527
|
-
declare enum AppointmentStatus {
|
|
1528
|
-
PENDING = "pending",// Initial state after booking, before confirmation (if applicable)
|
|
1529
|
-
CONFIRMED = "confirmed",// Confirmed by clinic/practitioner
|
|
1530
|
-
CHECKED_IN = "checked_in",// Patient has arrived
|
|
1531
|
-
IN_PROGRESS = "in_progress",// Procedure has started
|
|
1532
|
-
COMPLETED = "completed",// Procedure finished successfully
|
|
1533
|
-
CANCELED_PATIENT = "canceled_patient",// Canceled by the patient
|
|
1534
|
-
CANCELED_PATIENT_RESCHEDULED = "canceled_patient_rescheduled",// Canceled by the patient and rescheduled by the clinic
|
|
1535
|
-
CANCELED_CLINIC = "canceled_clinic",// Canceled by the clinic/practitioner
|
|
1536
|
-
NO_SHOW = "no_show",// Patient did not attend
|
|
1537
|
-
RESCHEDULED_BY_CLINIC = "rescheduled_by_clinic"
|
|
1538
|
-
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Enum defining the payment status of an appointment.
|
|
1541
|
-
*/
|
|
1542
|
-
declare enum PaymentStatus {
|
|
1543
|
-
UNPAID = "unpaid",
|
|
1544
|
-
PAID = "paid",
|
|
1545
|
-
PARTIALLY_PAID = "partially_paid",
|
|
1546
|
-
REFUNDED = "refunded",
|
|
1547
|
-
NOT_APPLICABLE = "not_applicable"
|
|
1548
|
-
}
|
|
1549
|
-
/**
|
|
1550
|
-
* Enum for different types of media that can be attached to an appointment.
|
|
1551
|
-
*/
|
|
1552
|
-
declare enum MediaType {
|
|
1553
|
-
BEFORE_PHOTO = "before_photo",
|
|
1554
|
-
AFTER_PHOTO = "after_photo",
|
|
1555
|
-
CONSENT_SCAN = "consent_scan",
|
|
1556
|
-
OTHER_DOCUMENT = "other_document"
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Interface to describe a media file linked to an appointment.
|
|
1560
|
-
*/
|
|
1561
|
-
interface AppointmentMediaItem {
|
|
1562
|
-
id: string;
|
|
1563
|
-
type: MediaType;
|
|
1564
|
-
url: string;
|
|
1565
|
-
fileName?: string;
|
|
1566
|
-
uploadedAt: Timestamp;
|
|
1567
|
-
uploadedBy: string;
|
|
1568
|
-
description?: string;
|
|
1569
|
-
}
|
|
1570
|
-
/**
|
|
1571
|
-
* Interface for procedure-specific information
|
|
1460
|
+
* Interface for procedure-specific information
|
|
1572
1461
|
*/
|
|
1573
1462
|
interface ProcedureExtendedInfo {
|
|
1574
1463
|
id: string;
|
|
@@ -1758,298 +1647,359 @@ interface Appointment {
|
|
|
1758
1647
|
/** NEW: Metadata for the appointment - used for area selection and photos */
|
|
1759
1648
|
metadata?: AppointmentMetadata;
|
|
1760
1649
|
}
|
|
1650
|
+
|
|
1761
1651
|
/**
|
|
1762
|
-
*
|
|
1652
|
+
* Enum for synced calendar provider
|
|
1763
1653
|
*/
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
procedureId: string;
|
|
1769
|
-
appointmentStartTime: Timestamp;
|
|
1770
|
-
appointmentEndTime: Timestamp;
|
|
1771
|
-
cost: number;
|
|
1772
|
-
currency: Currency;
|
|
1773
|
-
patientNotes?: string | null;
|
|
1774
|
-
initialStatus: AppointmentStatus;
|
|
1775
|
-
initialPaymentStatus?: PaymentStatus;
|
|
1654
|
+
declare enum SyncedCalendarProvider {
|
|
1655
|
+
GOOGLE = "google",
|
|
1656
|
+
OUTLOOK = "outlook",
|
|
1657
|
+
APPLE = "apple"
|
|
1776
1658
|
}
|
|
1659
|
+
|
|
1777
1660
|
/**
|
|
1778
|
-
*
|
|
1661
|
+
* Enum for calendar event status
|
|
1779
1662
|
*/
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1663
|
+
declare enum CalendarEventStatus {
|
|
1664
|
+
PENDING = "pending",// When event is created, but not confirmed
|
|
1665
|
+
CONFIRMED = "confirmed",// When event is confirmed and ready to be used
|
|
1666
|
+
REJECTED = "rejected",// When event is rejected by the clinic administrator or patient
|
|
1667
|
+
CANCELED = "canceled",// When event is canceled by the patient
|
|
1668
|
+
RESCHEDULED = "rescheduled",// When event is rescheduled by the clinic administrator
|
|
1669
|
+
COMPLETED = "completed",// When event is completed
|
|
1670
|
+
NO_SHOW = "no_show"
|
|
1786
1671
|
}
|
|
1787
1672
|
/**
|
|
1788
|
-
*
|
|
1673
|
+
* Enum for calendar event sync status
|
|
1789
1674
|
*/
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
cancellationTime?: Timestamp | FieldValue | null;
|
|
1794
|
-
rescheduleTime?: Timestamp | FieldValue | null;
|
|
1795
|
-
procedureActualStartTime?: Timestamp | FieldValue | null;
|
|
1796
|
-
actualDurationMinutes?: number;
|
|
1797
|
-
cancellationReason?: string | null;
|
|
1798
|
-
canceledBy?: "patient" | "clinic" | "practitioner" | "system";
|
|
1799
|
-
internalNotes?: string | null;
|
|
1800
|
-
patientNotes?: string | FieldValue | null;
|
|
1801
|
-
paymentStatus?: PaymentStatus;
|
|
1802
|
-
paymentTransactionId?: string | FieldValue | null;
|
|
1803
|
-
completedPreRequirements?: string[] | FieldValue;
|
|
1804
|
-
completedPostRequirements?: string[] | FieldValue;
|
|
1805
|
-
appointmentStartTime?: Timestamp;
|
|
1806
|
-
appointmentEndTime?: Timestamp;
|
|
1807
|
-
calendarEventId?: string;
|
|
1808
|
-
cost?: number;
|
|
1809
|
-
clinicBranchId?: string;
|
|
1810
|
-
practitionerId?: string;
|
|
1811
|
-
/** NEW: For updating linked forms - typically managed by dedicated methods */
|
|
1812
|
-
linkedFormIds?: string[] | FieldValue;
|
|
1813
|
-
linkedForms?: LinkedFormInfo[] | FieldValue;
|
|
1814
|
-
/** NEW: For updating media items - typically managed by dedicated methods */
|
|
1815
|
-
media?: AppointmentMediaItem[] | FieldValue;
|
|
1816
|
-
/** NEW: For adding/updating review information */
|
|
1817
|
-
reviewInfo?: PatientReviewInfo | FieldValue | null;
|
|
1818
|
-
/** NEW: For setting practitioner finalization details */
|
|
1819
|
-
finalizedDetails?: {
|
|
1820
|
-
by: string;
|
|
1821
|
-
at: Timestamp;
|
|
1822
|
-
notes?: string;
|
|
1823
|
-
} | FieldValue;
|
|
1824
|
-
/** NEW: For archiving/unarchiving */
|
|
1825
|
-
isArchived?: boolean;
|
|
1826
|
-
updatedAt?: FieldValue;
|
|
1827
|
-
/** NEW: For updating metadata */
|
|
1828
|
-
metadata?: AppointmentMetadata;
|
|
1675
|
+
declare enum CalendarSyncStatus {
|
|
1676
|
+
INTERNAL = "internal",
|
|
1677
|
+
EXTERNAL = "external"
|
|
1829
1678
|
}
|
|
1830
1679
|
/**
|
|
1831
|
-
*
|
|
1680
|
+
* Enum for calendar event types
|
|
1832
1681
|
*/
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
status?: AppointmentStatus | AppointmentStatus[];
|
|
1840
|
-
limit?: number;
|
|
1841
|
-
startAfter?: any;
|
|
1682
|
+
declare enum CalendarEventType {
|
|
1683
|
+
APPOINTMENT = "appointment",
|
|
1684
|
+
BLOCKING = "blocking",
|
|
1685
|
+
BREAK = "break",
|
|
1686
|
+
FREE_DAY = "free_day",
|
|
1687
|
+
OTHER = "other"
|
|
1842
1688
|
}
|
|
1843
|
-
/**
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1689
|
+
/**
|
|
1690
|
+
* Interface for calendar event time
|
|
1691
|
+
*/
|
|
1692
|
+
interface CalendarEventTime {
|
|
1693
|
+
start: Timestamp;
|
|
1694
|
+
end: Timestamp;
|
|
1695
|
+
}
|
|
1696
|
+
interface ProcedureInfo {
|
|
1697
|
+
name: string;
|
|
1698
|
+
description: string;
|
|
1699
|
+
duration: number;
|
|
1700
|
+
price: number;
|
|
1701
|
+
currency: Currency;
|
|
1702
|
+
}
|
|
1703
|
+
interface ProcedureCategorization {
|
|
1704
|
+
procedureFamily: ProcedureFamily;
|
|
1705
|
+
procedureCategory: Category;
|
|
1706
|
+
procedureSubcategory: Subcategory;
|
|
1707
|
+
procedureTechnology: Technology;
|
|
1708
|
+
procedureProduct: Product;
|
|
1709
|
+
}
|
|
1710
|
+
interface SyncedCalendarEvent {
|
|
1711
|
+
eventId: string;
|
|
1712
|
+
syncedCalendarProvider: SyncedCalendarProvider;
|
|
1713
|
+
syncedAt: Timestamp;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Interface for calendar event
|
|
1717
|
+
*/
|
|
1718
|
+
interface CalendarEvent {
|
|
1719
|
+
id: string;
|
|
1720
|
+
clinicBranchId?: string | null;
|
|
1721
|
+
clinicBranchInfo?: ClinicInfo | null;
|
|
1722
|
+
practitionerProfileId?: string | null;
|
|
1723
|
+
practitionerProfileInfo?: PractitionerProfileInfo | null;
|
|
1724
|
+
patientProfileId?: string | null;
|
|
1725
|
+
patientProfileInfo?: PatientProfileInfo | null;
|
|
1726
|
+
procedureId?: string | null;
|
|
1727
|
+
procedureInfo?: ProcedureInfo | null;
|
|
1728
|
+
procedureCategorization?: ProcedureCategorization | null;
|
|
1729
|
+
appointmentId?: string | null;
|
|
1730
|
+
syncedCalendarEventId?: SyncedCalendarEvent[] | null;
|
|
1731
|
+
eventName: string;
|
|
1732
|
+
eventLocation?: ClinicLocation;
|
|
1733
|
+
eventTime: CalendarEventTime;
|
|
1734
|
+
description?: string;
|
|
1735
|
+
status: CalendarEventStatus;
|
|
1736
|
+
syncStatus: CalendarSyncStatus;
|
|
1737
|
+
eventType: CalendarEventType;
|
|
1738
|
+
createdAt: Timestamp;
|
|
1739
|
+
updatedAt: Timestamp;
|
|
1891
1740
|
}
|
|
1892
1741
|
|
|
1893
1742
|
/**
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
1897
|
-
* triggered by changes in the clinics collection.
|
|
1743
|
+
* Defines the status of a specific instruction within a PatientRequirementInstance.
|
|
1744
|
+
* This helps track each actionable item for the patient.
|
|
1898
1745
|
*/
|
|
1899
|
-
declare
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
*/
|
|
1934
|
-
updateClinicInfoInClinicGroup(clinicGroupId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
1935
|
-
/**
|
|
1936
|
-
* Updates relevant clinic information within Patient documents.
|
|
1937
|
-
* NOTE: PatientProfile stores an array of PatientClinic objects, which only contain
|
|
1938
|
-
* clinicId, assignedAt, assignedBy, isActive, notes. It does *not* store aggregated
|
|
1939
|
-
* ClinicInfo (like name, photo). Therefore, this method currently has limited use
|
|
1940
|
-
* for general clinic info updates. It might be relevant if Clinic.isActive status changes.
|
|
1941
|
-
*
|
|
1942
|
-
* @param patientIds IDs of patients associated with the clinic (e.g., from PatientProfile.clinicIds).
|
|
1943
|
-
* @param clinicInfo The updated ClinicInfo object (primarily for logging/context).
|
|
1944
|
-
* @param clinicIsActive The current active status of the updated clinic.
|
|
1945
|
-
*/
|
|
1946
|
-
updateClinicInfoInPatients(patientIds: string[], clinicInfo: ClinicInfo, clinicIsActive: boolean): Promise<void>;
|
|
1947
|
-
/**
|
|
1948
|
-
* Updates the eventLocation for upcoming calendar events associated with a specific clinic.
|
|
1949
|
-
* Uses a collection group query to find relevant events across all potential parent collections.
|
|
1950
|
-
*
|
|
1951
|
-
* @param clinicId The ID of the clinic whose location might have changed.
|
|
1952
|
-
* @param newLocation The new ClinicLocation object.
|
|
1953
|
-
*/
|
|
1954
|
-
updateClinicLocationInCalendarEvents(clinicId: string, newLocation: ClinicLocation): Promise<void>;
|
|
1955
|
-
/**
|
|
1956
|
-
* Updates clinic info in all upcoming calendar events associated with a specific clinic.
|
|
1957
|
-
* @param clinicId The ID of the clinic whose info has been updated.
|
|
1958
|
-
* @param clinicInfo The updated ClinicInfo object.
|
|
1959
|
-
*/
|
|
1960
|
-
updateClinicInfoInCalendarEvents(clinicId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
1961
|
-
/**
|
|
1962
|
-
* Removes clinic from practitioners when a clinic is deleted.
|
|
1963
|
-
* @param practitionerIds IDs of practitioners associated with the clinic.
|
|
1964
|
-
* @param clinicId The ID of the deleted clinic.
|
|
1965
|
-
*/
|
|
1966
|
-
removeClinicFromPractitioners(practitionerIds: string[], clinicId: string): Promise<void>;
|
|
1967
|
-
/**
|
|
1968
|
-
* Inactivates all procedures associated with a deleted clinic
|
|
1969
|
-
* @param procedureIds IDs of procedures associated with the clinic
|
|
1970
|
-
*/
|
|
1971
|
-
inactivateProceduresForClinic(procedureIds: string[]): Promise<void>;
|
|
1972
|
-
/**
|
|
1973
|
-
* Removes clinic from clinic group when a clinic is deleted
|
|
1974
|
-
* @param clinicGroupId ID of the parent clinic group
|
|
1975
|
-
* @param clinicId ID of the deleted clinic
|
|
1976
|
-
*/
|
|
1977
|
-
removeClinicFromClinicGroup(clinicGroupId: string, clinicId: string): Promise<void>;
|
|
1978
|
-
/**
|
|
1979
|
-
* Removes clinic from patients when a clinic is deleted
|
|
1980
|
-
* @param patientIds IDs of patients associated with the clinic
|
|
1981
|
-
* @param clinicId ID of the deleted clinic
|
|
1982
|
-
*/
|
|
1983
|
-
removeClinicFromPatients(patientIds: string[], clinicId: string): Promise<void>;
|
|
1984
|
-
/**
|
|
1985
|
-
* Cancels all upcoming calendar events associated with a deleted clinic
|
|
1986
|
-
* @param clinicId ID of the deleted clinic
|
|
1987
|
-
*/
|
|
1988
|
-
cancelUpcomingCalendarEventsForClinic(clinicId: string): Promise<void>;
|
|
1746
|
+
declare enum PatientInstructionStatus {
|
|
1747
|
+
PENDING_NOTIFICATION = "pendingNotification",// Notification is scheduled but not yet due/sent
|
|
1748
|
+
ACTION_DUE = "actionDue",// The time for this instruction/notification has arrived
|
|
1749
|
+
ACTION_TAKEN = "actionTaken",// Patient has acknowledged or completed this specific instruction
|
|
1750
|
+
MISSED = "missed",// The due time for this instruction passed without action
|
|
1751
|
+
CANCELLED = "cancelled",// This specific instruction was cancelled (e.g., requirement changed)
|
|
1752
|
+
SKIPPED = "skipped"
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Represents a single, timed instruction or notification point derived from a Requirement's timeframe.
|
|
1756
|
+
*/
|
|
1757
|
+
interface PatientRequirementInstruction {
|
|
1758
|
+
instructionId: string;
|
|
1759
|
+
instructionText: string;
|
|
1760
|
+
dueTime: Timestamp;
|
|
1761
|
+
actionableWindow: number;
|
|
1762
|
+
status: PatientInstructionStatus;
|
|
1763
|
+
originalNotifyAtValue: number;
|
|
1764
|
+
originalTimeframeUnit: TimeFrame["unit"];
|
|
1765
|
+
notificationId?: string;
|
|
1766
|
+
actionTakenAt?: Timestamp;
|
|
1767
|
+
updatedAt: Timestamp;
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Defines the overall status of a PatientRequirementInstance.
|
|
1771
|
+
*/
|
|
1772
|
+
declare enum PatientRequirementOverallStatus {
|
|
1773
|
+
ACTIVE = "active",// Requirement instance is active, instructions are pending or due.
|
|
1774
|
+
ALL_INSTRUCTIONS_MET = "allInstructionsMet",// All instructions actioned/completed by the patient.
|
|
1775
|
+
PARTIALLY_COMPLETED = "partiallyCompleted",// Some instructions met, some missed or pending.
|
|
1776
|
+
FAILED = "failed",// The patient failed to complete the requirement on time and above treashold of 60%
|
|
1777
|
+
CANCELLED_APPOINTMENT = "cancelledAppointment",// Entire requirement instance cancelled due to appointment cancellation.
|
|
1778
|
+
SUPERSEDED_RESCHEDULE = "supersededReschedule",// This instance was replaced by a new one due to appointment reschedule.
|
|
1779
|
+
FAILED_TO_PROCESS = "failedToProcess"
|
|
1989
1780
|
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Represents an instance of a backoffice Requirement, tailored to a specific patient and appointment.
|
|
1783
|
+
* This document lives in the patient's subcollection: `patients/{patientId}/patientRequirements/{instanceId}`.
|
|
1784
|
+
*/
|
|
1785
|
+
interface PatientRequirementInstance {
|
|
1786
|
+
id: string;
|
|
1787
|
+
patientId: string;
|
|
1788
|
+
appointmentId: string;
|
|
1789
|
+
originalRequirementId: string;
|
|
1790
|
+
requirementType: RequirementType;
|
|
1791
|
+
requirementName: string;
|
|
1792
|
+
requirementDescription: string;
|
|
1793
|
+
requirementImportance: RequirementImportance;
|
|
1794
|
+
overallStatus: PatientRequirementOverallStatus;
|
|
1795
|
+
instructions: PatientRequirementInstruction[];
|
|
1796
|
+
createdAt: Timestamp;
|
|
1797
|
+
updatedAt: Timestamp;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Firestore subcollection name for patient requirement instances.
|
|
1801
|
+
*/
|
|
1802
|
+
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
1990
1803
|
|
|
1991
1804
|
/**
|
|
1992
|
-
*
|
|
1993
|
-
* @description Handles aggregation tasks related to practitioner data updates/deletions.
|
|
1805
|
+
* Enumeracija koja definiše sve moguće tipove notifikacija
|
|
1994
1806
|
*/
|
|
1995
|
-
declare
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
/**
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
/**
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
/**
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
1807
|
+
declare enum NotificationType {
|
|
1808
|
+
APPOINTMENT_REMINDER = "appointmentReminder",// For upcoming appointments
|
|
1809
|
+
APPOINTMENT_STATUS_CHANGE = "appointmentStatusChange",// Generic for status changes like confirmed, checked-in etc.
|
|
1810
|
+
APPOINTMENT_RESCHEDULED_PROPOSAL = "appointmentRescheduledProposal",// When clinic proposes a new time
|
|
1811
|
+
APPOINTMENT_CANCELLED = "appointmentCancelled",// When an appointment is cancelled
|
|
1812
|
+
PRE_REQUIREMENT_INSTRUCTION_DUE = "preRequirementInstructionDue",
|
|
1813
|
+
POST_REQUIREMENT_INSTRUCTION_DUE = "postRequirementInstructionDue",
|
|
1814
|
+
REQUIREMENT_INSTRUCTION_DUE = "requirementInstructionDue",// For specific pre/post care instructions
|
|
1815
|
+
FORM_REMINDER = "formReminder",// Reminds user to fill a specific form
|
|
1816
|
+
FORM_SUBMISSION_CONFIRMATION = "formSubmissionConfirmation",// Confirms form was submitted
|
|
1817
|
+
REVIEW_REQUEST = "reviewRequest",// Request for patient review post-appointment
|
|
1818
|
+
PAYMENT_DUE = "paymentDue",
|
|
1819
|
+
PAYMENT_CONFIRMATION = "paymentConfirmation",
|
|
1820
|
+
PAYMENT_FAILED = "paymentFailed",
|
|
1821
|
+
GENERAL_MESSAGE = "generalMessage",// For general announcements or direct messages
|
|
1822
|
+
ACCOUNT_NOTIFICATION = "accountNotification"
|
|
1823
|
+
}
|
|
1824
|
+
declare const NOTIFICATIONS_COLLECTION = "notifications";
|
|
1825
|
+
/**
|
|
1826
|
+
* Bazni interfejs za sve notifikacije
|
|
1827
|
+
*/
|
|
1828
|
+
interface BaseNotification {
|
|
1829
|
+
/** Jedinstveni identifikator notifikacije */
|
|
1830
|
+
id: string;
|
|
1831
|
+
/** ID korisnika kome je namenjena notifikacija */
|
|
1832
|
+
userId: string;
|
|
1833
|
+
/** Vreme kada notifikacija treba da bude poslata */
|
|
1834
|
+
notificationTime: Timestamp;
|
|
1835
|
+
/** Tip notifikacije */
|
|
1836
|
+
notificationType: NotificationType;
|
|
1837
|
+
/** Tokeni uređaja na koje treba poslati notifikaciju */
|
|
1838
|
+
notificationTokens: string[];
|
|
1839
|
+
/** Status notifikacije */
|
|
1840
|
+
status: NotificationStatus;
|
|
1841
|
+
/** Vreme kreiranja */
|
|
1842
|
+
createdAt: Timestamp;
|
|
1843
|
+
/** Vreme poslednjeg ažuriranja */
|
|
1844
|
+
updatedAt: Timestamp;
|
|
1845
|
+
/** Vreme kada je notifikacija poslata */
|
|
1846
|
+
sentAt?: Timestamp;
|
|
1847
|
+
/** Detalji o grešci ako postoje */
|
|
1848
|
+
error?: string;
|
|
1849
|
+
/** Naslov notifikacije */
|
|
1850
|
+
title: string;
|
|
1851
|
+
/** Tekst notifikacije */
|
|
1852
|
+
body: string;
|
|
1853
|
+
/** Da li je notifikacija pročitana */
|
|
1854
|
+
isRead: boolean;
|
|
1855
|
+
/** Uloga korisnika kome je namenjena notifikacija */
|
|
1856
|
+
userRole: UserRole;
|
|
1857
|
+
appointmentId?: string;
|
|
1858
|
+
patientRequirementInstanceId?: string;
|
|
1859
|
+
instructionId?: string;
|
|
1860
|
+
formId?: string;
|
|
1861
|
+
originalRequirementId?: string;
|
|
1862
|
+
transactionId?: string;
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Status notifikacije
|
|
1866
|
+
*/
|
|
1867
|
+
declare enum NotificationStatus {
|
|
1868
|
+
PENDING = "pending",
|
|
1869
|
+
PROCESSING = "processing",
|
|
1870
|
+
SENT = "sent",
|
|
1871
|
+
FAILED = "failed",
|
|
1872
|
+
DELIVERED = "delivered",
|
|
1873
|
+
CANCELLED = "cancelled",
|
|
1874
|
+
PARTIAL_SUCCESS = "partialSuccess"
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Notifikacija za pre-requirement
|
|
1878
|
+
*/
|
|
1879
|
+
interface PreRequirementNotification extends BaseNotification {
|
|
1880
|
+
notificationType: NotificationType.PRE_REQUIREMENT_INSTRUCTION_DUE;
|
|
1881
|
+
/** ID tretmana za koji je vezan pre-requirement */
|
|
1882
|
+
treatmentId: string;
|
|
1883
|
+
/** Lista pre-requirements koji treba da se ispune */
|
|
1884
|
+
requirements: string[];
|
|
1885
|
+
/** Rok za ispunjavanje requirements-a */
|
|
1886
|
+
deadline: Timestamp;
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Notifikacija za post-requirement
|
|
1890
|
+
*/
|
|
1891
|
+
interface PostRequirementNotification extends BaseNotification {
|
|
1892
|
+
notificationType: NotificationType.POST_REQUIREMENT_INSTRUCTION_DUE;
|
|
1893
|
+
/** ID tretmana za koji je vezan post-requirement */
|
|
1894
|
+
treatmentId: string;
|
|
1895
|
+
/** Lista post-requirements koji treba da se ispune */
|
|
1896
|
+
requirements: string[];
|
|
1897
|
+
/** Rok za ispunjavanje requirements-a */
|
|
1898
|
+
deadline: Timestamp;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Notification for a specific instruction from a PatientRequirementInstance.
|
|
1902
|
+
* Example: "Do not eat 2 hours before your [Procedure Name] appointment."
|
|
1903
|
+
*/
|
|
1904
|
+
interface RequirementInstructionDueNotification extends BaseNotification {
|
|
1905
|
+
notificationType: NotificationType.REQUIREMENT_INSTRUCTION_DUE;
|
|
1906
|
+
appointmentId: string;
|
|
1907
|
+
patientRequirementInstanceId: string;
|
|
1908
|
+
instructionId: string;
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Notification reminding about an upcoming appointment.
|
|
1912
|
+
* Example: "Reminder: Your appointment for [Procedure Name] is at [Time] today."
|
|
1913
|
+
*/
|
|
1914
|
+
interface AppointmentReminderNotification extends BaseNotification {
|
|
1915
|
+
notificationType: NotificationType.APPOINTMENT_REMINDER;
|
|
1916
|
+
appointmentId: string;
|
|
1917
|
+
appointmentTime: Timestamp;
|
|
1918
|
+
procedureName?: string;
|
|
1919
|
+
practitionerName?: string;
|
|
1920
|
+
clinicName?: string;
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Notification about a change in appointment status (e.g., confirmed, checked-in).
|
|
1924
|
+
* Excludes cancellations and reschedule proposals, which have their own types.
|
|
1925
|
+
* Example: "Your appointment for [Procedure Name] has been Confirmed."
|
|
1926
|
+
*/
|
|
1927
|
+
interface AppointmentStatusChangeNotification extends BaseNotification {
|
|
1928
|
+
notificationType: NotificationType.APPOINTMENT_STATUS_CHANGE;
|
|
1929
|
+
appointmentId: string;
|
|
1930
|
+
newStatus: string;
|
|
1931
|
+
previousStatus?: string;
|
|
1932
|
+
procedureName?: string;
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* Notification informing the patient that the clinic has proposed a new time for their appointment.
|
|
1936
|
+
* Example: "Action Required: [Clinic Name] has proposed a new time for your [Procedure Name] appointment."
|
|
1937
|
+
*/
|
|
1938
|
+
interface AppointmentRescheduledProposalNotification extends BaseNotification {
|
|
1939
|
+
notificationType: NotificationType.APPOINTMENT_RESCHEDULED_PROPOSAL;
|
|
1940
|
+
appointmentId: string;
|
|
1941
|
+
newProposedStartTime: Timestamp;
|
|
1942
|
+
newProposedEndTime: Timestamp;
|
|
1943
|
+
procedureName?: string;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Notification informing about a cancelled appointment.
|
|
1947
|
+
* Example: "Your appointment for [Procedure Name] on [Date] has been cancelled."
|
|
1948
|
+
*/
|
|
1949
|
+
interface AppointmentCancelledNotification extends BaseNotification {
|
|
1950
|
+
notificationType: NotificationType.APPOINTMENT_CANCELLED;
|
|
1951
|
+
appointmentId: string;
|
|
1952
|
+
reason?: string;
|
|
1953
|
+
cancelledByRole?: UserRole;
|
|
1954
|
+
procedureName?: string;
|
|
2052
1955
|
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Notification reminding a user to fill a specific form.
|
|
1958
|
+
* Example: "Reminder: Please complete the '[Form Name]' form for your upcoming appointment."
|
|
1959
|
+
*/
|
|
1960
|
+
interface FormReminderNotification extends BaseNotification {
|
|
1961
|
+
notificationType: NotificationType.FORM_REMINDER;
|
|
1962
|
+
appointmentId: string;
|
|
1963
|
+
formId: string;
|
|
1964
|
+
formName: string;
|
|
1965
|
+
formDeadline?: Timestamp;
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Notification confirming a form submission.
|
|
1969
|
+
* Example: "Thank you! Your '[Form Name]' form has been submitted successfully."
|
|
1970
|
+
*/
|
|
1971
|
+
interface FormSubmissionConfirmationNotification extends BaseNotification {
|
|
1972
|
+
notificationType: NotificationType.FORM_SUBMISSION_CONFIRMATION;
|
|
1973
|
+
appointmentId?: string;
|
|
1974
|
+
formId: string;
|
|
1975
|
+
formName: string;
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Notification requesting a patient to leave a review after an appointment.
|
|
1979
|
+
* Example: "Hope you had a great experience! Would you like to share your feedback for your visit on [Date]?"
|
|
1980
|
+
*/
|
|
1981
|
+
interface ReviewRequestNotification extends BaseNotification {
|
|
1982
|
+
notificationType: NotificationType.REVIEW_REQUEST;
|
|
1983
|
+
appointmentId: string;
|
|
1984
|
+
practitionerName?: string;
|
|
1985
|
+
procedureName?: string;
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* Generic notification for direct messages or announcements.
|
|
1989
|
+
*/
|
|
1990
|
+
interface GeneralMessageNotification extends BaseNotification {
|
|
1991
|
+
notificationType: NotificationType.GENERAL_MESSAGE;
|
|
1992
|
+
}
|
|
1993
|
+
interface PaymentConfirmationNotification extends BaseNotification {
|
|
1994
|
+
notificationType: NotificationType.PAYMENT_CONFIRMATION;
|
|
1995
|
+
transactionId: string;
|
|
1996
|
+
appointmentId?: string;
|
|
1997
|
+
amount: string;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Unija svih tipova notifikacija
|
|
2001
|
+
*/
|
|
2002
|
+
type Notification = PreRequirementNotification | PostRequirementNotification | RequirementInstructionDueNotification | AppointmentReminderNotification | AppointmentStatusChangeNotification | AppointmentRescheduledProposalNotification | AppointmentCancelledNotification | FormReminderNotification | FormSubmissionConfirmationNotification | ReviewRequestNotification | GeneralMessageNotification | PaymentConfirmationNotification;
|
|
2053
2003
|
|
|
2054
2004
|
/**
|
|
2055
2005
|
* Minimal interface for the new mailgun.js client's messages API
|
|
@@ -2089,25 +2039,98 @@ declare class BaseMailingService {
|
|
|
2089
2039
|
* @param success Whether the email was sent successfully
|
|
2090
2040
|
* @param error Error object if the email failed to send
|
|
2091
2041
|
*/
|
|
2092
|
-
protected logEmailAttempt(emailData: {
|
|
2093
|
-
to: string;
|
|
2094
|
-
subject: string;
|
|
2095
|
-
templateName?: string;
|
|
2096
|
-
}, success: boolean, error?: any): Promise<void>;
|
|
2042
|
+
protected logEmailAttempt(emailData: {
|
|
2043
|
+
to: string;
|
|
2044
|
+
subject: string;
|
|
2045
|
+
templateName?: string;
|
|
2046
|
+
}, success: boolean, error?: any): Promise<void>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Renders a simple HTML email template with variables
|
|
2049
|
+
* @param template HTML template string
|
|
2050
|
+
* @param variables Key-value pairs to replace in the template
|
|
2051
|
+
* @returns Rendered HTML string
|
|
2052
|
+
*/
|
|
2053
|
+
protected renderTemplate(template: string, variables: Record<string, string>): string;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
interface NewMailgunMessagesAPI$1 {
|
|
2057
|
+
create(domain: string, data: any): Promise<any>;
|
|
2058
|
+
}
|
|
2059
|
+
interface NewMailgunClient$1 {
|
|
2060
|
+
messages: NewMailgunMessagesAPI$1;
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Interface for the data required to send a practitioner invitation email
|
|
2064
|
+
*/
|
|
2065
|
+
interface PractitionerInviteEmailData {
|
|
2066
|
+
/** The token object from the practitioner service */
|
|
2067
|
+
token: {
|
|
2068
|
+
id: string;
|
|
2069
|
+
token: string;
|
|
2070
|
+
practitionerId: string;
|
|
2071
|
+
email: string;
|
|
2072
|
+
clinicId: string;
|
|
2073
|
+
expiresAt: admin.firestore.Timestamp;
|
|
2074
|
+
};
|
|
2075
|
+
/** Practitioner basic info */
|
|
2076
|
+
practitioner: {
|
|
2077
|
+
firstName: string;
|
|
2078
|
+
lastName: string;
|
|
2079
|
+
};
|
|
2080
|
+
/** Clinic info */
|
|
2081
|
+
clinic: {
|
|
2082
|
+
name: string;
|
|
2083
|
+
contactEmail: string;
|
|
2084
|
+
contactName?: string;
|
|
2085
|
+
};
|
|
2086
|
+
/** Config options */
|
|
2087
|
+
options?: {
|
|
2088
|
+
registrationUrl?: string;
|
|
2089
|
+
customSubject?: string;
|
|
2090
|
+
fromAddress?: string;
|
|
2091
|
+
mailgunDomain?: string;
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
/**
|
|
2095
|
+
* Service for sending practitioner invitation emails, updated for mailgun.js v10+
|
|
2096
|
+
*/
|
|
2097
|
+
declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
2098
|
+
private readonly DEFAULT_REGISTRATION_URL;
|
|
2099
|
+
private readonly DEFAULT_SUBJECT;
|
|
2100
|
+
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2101
|
+
/**
|
|
2102
|
+
* Constructor for PractitionerInviteMailingService
|
|
2103
|
+
* @param firestore Firestore instance provided by the caller
|
|
2104
|
+
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2105
|
+
*/
|
|
2106
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient$1);
|
|
2107
|
+
/**
|
|
2108
|
+
* Sends a practitioner invitation email
|
|
2109
|
+
* @param data The practitioner invitation data
|
|
2110
|
+
* @returns Promise resolved when email is sent
|
|
2111
|
+
*/
|
|
2112
|
+
sendInvitationEmail(data: PractitionerInviteEmailData): Promise<any>;
|
|
2097
2113
|
/**
|
|
2098
|
-
*
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
* @
|
|
2114
|
+
* Handles the practitioner token creation event from Cloud Functions
|
|
2115
|
+
* Fetches necessary data using defined types and collection constants,
|
|
2116
|
+
* and sends the invitation email.
|
|
2117
|
+
* @param tokenData The fully typed token object including its id
|
|
2118
|
+
* @param fromAddress The 'from' email address to use, obtained from config
|
|
2119
|
+
* @param mailgunDomain The mailgun domain to use for sending
|
|
2120
|
+
* @returns Promise resolved when the email is sent
|
|
2102
2121
|
*/
|
|
2103
|
-
|
|
2122
|
+
handleTokenCreationEvent(tokenData: PractitionerToken, mailgunConfig: {
|
|
2123
|
+
fromAddress: string;
|
|
2124
|
+
domain: string;
|
|
2125
|
+
registrationUrl?: string;
|
|
2126
|
+
}): Promise<void>;
|
|
2104
2127
|
}
|
|
2105
2128
|
|
|
2106
|
-
interface NewMailgunMessagesAPI
|
|
2129
|
+
interface NewMailgunMessagesAPI {
|
|
2107
2130
|
create(domain: string, data: any): Promise<any>;
|
|
2108
2131
|
}
|
|
2109
|
-
interface NewMailgunClient
|
|
2110
|
-
messages: NewMailgunMessagesAPI
|
|
2132
|
+
interface NewMailgunClient {
|
|
2133
|
+
messages: NewMailgunMessagesAPI;
|
|
2111
2134
|
}
|
|
2112
2135
|
/**
|
|
2113
2136
|
* Interface for sending practitioner invitation email data
|
|
@@ -2193,7 +2216,7 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
2193
2216
|
* @param firestore Firestore instance provided by the caller
|
|
2194
2217
|
* @param mailgunClient Mailgun client instance (mailgun.js v10+) provided by the caller
|
|
2195
2218
|
*/
|
|
2196
|
-
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient
|
|
2219
|
+
constructor(firestore: FirebaseFirestore.Firestore, mailgunClient: NewMailgunClient);
|
|
2197
2220
|
/**
|
|
2198
2221
|
* Sends an invitation email to an existing practitioner
|
|
2199
2222
|
* @param data The invitation email data
|
|
@@ -2227,260 +2250,28 @@ declare class ExistingPractitionerInviteMailingService extends BaseMailingServic
|
|
|
2227
2250
|
}): Promise<void>;
|
|
2228
2251
|
/**
|
|
2229
2252
|
* Formats working hours for display in emails
|
|
2230
|
-
* @param workingHours The working hours object
|
|
2231
|
-
* @returns Formatted string representation
|
|
2232
|
-
*/
|
|
2233
|
-
private formatWorkingHours;
|
|
2234
|
-
/**
|
|
2235
|
-
* Formats clinic address for display
|
|
2236
|
-
* @param location The clinic location object
|
|
2237
|
-
* @returns Formatted address string
|
|
2238
|
-
*/
|
|
2239
|
-
private formatClinicAddress;
|
|
2240
|
-
/**
|
|
2241
|
-
* Fetches a practitioner by ID
|
|
2242
|
-
* @param practitionerId The practitioner ID
|
|
2243
|
-
* @returns The practitioner or null if not found
|
|
2244
|
-
*/
|
|
2245
|
-
private fetchPractitionerById;
|
|
2246
|
-
/**
|
|
2247
|
-
* Fetches a clinic by ID
|
|
2248
|
-
* @param clinicId The clinic ID
|
|
2249
|
-
* @returns The clinic or null if not found
|
|
2250
|
-
*/
|
|
2251
|
-
private fetchClinicById;
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
/**
|
|
2255
|
-
* @class PractitionerInviteAggregationService
|
|
2256
|
-
* @description Handles aggregation tasks and side effects related to practitioner invite lifecycle events.
|
|
2257
|
-
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2258
|
-
* triggered by changes in the practitioner-invites collection.
|
|
2259
|
-
*/
|
|
2260
|
-
declare class PractitionerInviteAggregationService {
|
|
2261
|
-
private db;
|
|
2262
|
-
private mailingService?;
|
|
2263
|
-
/**
|
|
2264
|
-
* Constructor for PractitionerInviteAggregationService.
|
|
2265
|
-
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2266
|
-
* @param mailingService Optional mailing service for sending emails
|
|
2267
|
-
*/
|
|
2268
|
-
constructor(firestore?: admin.firestore.Firestore, mailingService?: ExistingPractitionerInviteMailingService);
|
|
2269
|
-
/**
|
|
2270
|
-
* Handles side effects when a practitioner invite is first created.
|
|
2271
|
-
* This function would typically be called by a Firestore onCreate trigger.
|
|
2272
|
-
* @param {PractitionerInvite} invite - The newly created PractitionerInvite object.
|
|
2273
|
-
* @param {object} emailConfig - Optional email configuration for sending invite emails
|
|
2274
|
-
* @returns {Promise<void>}
|
|
2275
|
-
*/
|
|
2276
|
-
handleInviteCreate(invite: PractitionerInvite, emailConfig?: {
|
|
2277
|
-
fromAddress: string;
|
|
2278
|
-
domain: string;
|
|
2279
|
-
acceptUrl: string;
|
|
2280
|
-
rejectUrl: string;
|
|
2281
|
-
}): Promise<void>;
|
|
2282
|
-
/**
|
|
2283
|
-
* Handles side effects when a practitioner invite is updated.
|
|
2284
|
-
* This function would typically be called by a Firestore onUpdate trigger.
|
|
2285
|
-
* @param {PractitionerInvite} before - The PractitionerInvite object before the update.
|
|
2286
|
-
* @param {PractitionerInvite} after - The PractitionerInvite object after the update.
|
|
2287
|
-
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2288
|
-
* @returns {Promise<void>}
|
|
2289
|
-
*/
|
|
2290
|
-
handleInviteUpdate(before: PractitionerInvite, after: PractitionerInvite, emailConfig?: {
|
|
2291
|
-
fromAddress: string;
|
|
2292
|
-
domain: string;
|
|
2293
|
-
clinicDashboardUrl: string;
|
|
2294
|
-
practitionerProfileUrl?: string;
|
|
2295
|
-
findPractitionersUrl?: string;
|
|
2296
|
-
}): Promise<void>;
|
|
2297
|
-
/**
|
|
2298
|
-
* Handles side effects when a practitioner invite is deleted.
|
|
2299
|
-
* @param deletedInvite - The PractitionerInvite object that was deleted.
|
|
2300
|
-
* @returns {Promise<void>}
|
|
2301
|
-
*/
|
|
2302
|
-
handleInviteDelete(deletedInvite: PractitionerInvite): Promise<void>;
|
|
2303
|
-
/**
|
|
2304
|
-
* Handles the business logic when a practitioner accepts an invite.
|
|
2305
|
-
* This includes adding the practitioner to the clinic and the clinic to the practitioner.
|
|
2306
|
-
* @param {PractitionerInvite} invite - The accepted invite
|
|
2307
|
-
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2308
|
-
* @returns {Promise<void>}
|
|
2309
|
-
*/
|
|
2310
|
-
private handleInviteAccepted;
|
|
2311
|
-
/**
|
|
2312
|
-
* Handles the business logic when a practitioner rejects an invite.
|
|
2313
|
-
* @param {PractitionerInvite} invite - The rejected invite
|
|
2314
|
-
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2315
|
-
* @returns {Promise<void>}
|
|
2316
|
-
*/
|
|
2317
|
-
private handleInviteRejected;
|
|
2318
|
-
/**
|
|
2319
|
-
* Handles the business logic when an invite is cancelled by admin.
|
|
2320
|
-
* @param {PractitionerInvite} invite - The cancelled invite
|
|
2321
|
-
* @returns {Promise<void>}
|
|
2322
|
-
*/
|
|
2323
|
-
private handleInviteCancelled;
|
|
2324
|
-
/**
|
|
2325
|
-
* Adds practitioner information to a clinic when an invite is accepted.
|
|
2326
|
-
* @param clinicId - ID of the clinic to update
|
|
2327
|
-
* @param doctorInfo - Doctor information to add to the clinic
|
|
2328
|
-
* @returns {Promise<void>}
|
|
2329
|
-
*/
|
|
2330
|
-
private addPractitionerToClinic;
|
|
2331
|
-
/**
|
|
2332
|
-
* Updates practitioner information in a clinic.
|
|
2333
|
-
* @param clinicId - ID of the clinic to update
|
|
2334
|
-
* @param doctorInfo - Updated doctor information
|
|
2335
|
-
* @returns {Promise<void>}
|
|
2336
|
-
*/
|
|
2337
|
-
private updatePractitionerInfoInClinic;
|
|
2338
|
-
/**
|
|
2339
|
-
* Adds a clinic to a practitioner's profile with working hours from the invite.
|
|
2340
|
-
* @param {string} practitionerId - The practitioner ID
|
|
2341
|
-
* @param {ClinicInfo} clinicInfo - The clinic information
|
|
2342
|
-
* @param {PractitionerInvite} invite - The accepted invite containing working hours
|
|
2343
|
-
* @returns {Promise<void>}
|
|
2344
|
-
*/
|
|
2345
|
-
private addClinicToPractitioner;
|
|
2346
|
-
/**
|
|
2347
|
-
* Updates the working hours for an existing practitioner-clinic relationship.
|
|
2348
|
-
* @param {string} practitionerId - The practitioner ID
|
|
2349
|
-
* @param {PractitionerInvite} invite - The accepted invite containing new working hours
|
|
2350
|
-
* @returns {Promise<void>}
|
|
2351
|
-
*/
|
|
2352
|
-
private updatePractitionerWorkingHours;
|
|
2353
|
-
/**
|
|
2354
|
-
* Fetches a clinic admin by ID
|
|
2355
|
-
* @param adminId The clinic admin ID
|
|
2356
|
-
* @returns The clinic admin or null if not found
|
|
2357
|
-
*/
|
|
2358
|
-
private fetchClinicAdminById;
|
|
2359
|
-
/**
|
|
2360
|
-
* Fetches a practitioner by ID.
|
|
2361
|
-
* @param practitionerId The practitioner ID.
|
|
2362
|
-
* @returns {Promise<Practitioner | null>} The practitioner or null if not found.
|
|
2363
|
-
*/
|
|
2364
|
-
private fetchPractitionerById;
|
|
2365
|
-
/**
|
|
2366
|
-
* Fetches a clinic by ID.
|
|
2367
|
-
* @param clinicId The clinic ID.
|
|
2368
|
-
* @returns {Promise<Clinic | null>} The clinic or null if not found.
|
|
2369
|
-
*/
|
|
2370
|
-
private fetchClinicById;
|
|
2371
|
-
/**
|
|
2372
|
-
* Sends acceptance notification email to clinic admin
|
|
2373
|
-
* @param invite The accepted invite
|
|
2374
|
-
* @param practitioner The practitioner who accepted
|
|
2375
|
-
* @param clinic The clinic that sent the invite
|
|
2376
|
-
* @param emailConfig Email configuration
|
|
2377
|
-
*/
|
|
2378
|
-
private sendAcceptanceNotificationEmail;
|
|
2379
|
-
/**
|
|
2380
|
-
* Sends rejection notification email to clinic admin
|
|
2381
|
-
* @param invite The rejected invite
|
|
2382
|
-
* @param practitioner The practitioner who rejected
|
|
2383
|
-
* @param clinic The clinic that sent the invite
|
|
2384
|
-
* @param emailConfig Email configuration
|
|
2385
|
-
*/
|
|
2386
|
-
private sendRejectionNotificationEmail;
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
/**
|
|
2390
|
-
* @class ProcedureAggregationService
|
|
2391
|
-
* @description Handles aggregation tasks related to procedure data updates/deletions.
|
|
2392
|
-
*/
|
|
2393
|
-
declare class ProcedureAggregationService {
|
|
2394
|
-
private db;
|
|
2395
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2396
|
-
/**
|
|
2397
|
-
* Adds procedure information to a practitioner when a new procedure is created
|
|
2398
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2399
|
-
* @param procedureSummary - Summary information about the procedure
|
|
2400
|
-
* @returns {Promise<void>}
|
|
2401
|
-
*/
|
|
2402
|
-
addProcedureToPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2403
|
-
/**
|
|
2404
|
-
* Adds procedure information to a clinic when a new procedure is created
|
|
2405
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2406
|
-
* @param procedureSummary - Summary information about the procedure
|
|
2407
|
-
* @returns {Promise<void>}
|
|
2408
|
-
*/
|
|
2409
|
-
addProcedureToClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2410
|
-
/**
|
|
2411
|
-
* Updates procedure information in a practitioner document
|
|
2412
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2413
|
-
* @param procedureSummary - Updated summary information about the procedure
|
|
2414
|
-
* @returns {Promise<void>}
|
|
2415
|
-
*/
|
|
2416
|
-
updateProcedureInfoInPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2417
|
-
/**
|
|
2418
|
-
* Updates procedure information in a clinic document
|
|
2419
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2420
|
-
* @param procedureSummary - Updated summary information about the procedure
|
|
2421
|
-
* @returns {Promise<void>}
|
|
2422
|
-
*/
|
|
2423
|
-
updateProcedureInfoInClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2424
|
-
/**
|
|
2425
|
-
* Updates procedure information in calendar events
|
|
2426
|
-
* @param procedureId - ID of the procedure
|
|
2427
|
-
* @param procedureInfo - Updated procedure information
|
|
2428
|
-
* @returns {Promise<void>}
|
|
2429
|
-
*/
|
|
2430
|
-
updateProcedureInfoInCalendarEvents(procedureId: string, procedureInfo: any): Promise<void>;
|
|
2431
|
-
/**
|
|
2432
|
-
* Cancels all upcoming calendar events for a procedure
|
|
2433
|
-
* @param procedureId - ID of the procedure
|
|
2434
|
-
* @returns {Promise<void>}
|
|
2435
|
-
*/
|
|
2436
|
-
cancelUpcomingCalendarEventsForProcedure(procedureId: string): Promise<void>;
|
|
2437
|
-
/**
|
|
2438
|
-
* Removes procedure from a practitioner when a procedure is deleted or inactivated
|
|
2439
|
-
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2440
|
-
* @param procedureId - ID of the procedure
|
|
2441
|
-
* @param clinicId - Optional clinic ID for free consultation removal
|
|
2442
|
-
* @returns {Promise<void>}
|
|
2443
|
-
*/
|
|
2444
|
-
removeProcedureFromPractitioner(practitionerId: string, procedureId: string, clinicId?: string): Promise<void>;
|
|
2445
|
-
/**
|
|
2446
|
-
* Removes procedure from a clinic when a procedure is deleted or inactivated
|
|
2447
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2448
|
-
* @param procedureId - ID of the procedure
|
|
2449
|
-
* @returns {Promise<void>}
|
|
2253
|
+
* @param workingHours The working hours object
|
|
2254
|
+
* @returns Formatted string representation
|
|
2450
2255
|
*/
|
|
2451
|
-
|
|
2256
|
+
private formatWorkingHours;
|
|
2452
2257
|
/**
|
|
2453
|
-
*
|
|
2454
|
-
* @param
|
|
2455
|
-
* @
|
|
2456
|
-
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2457
|
-
* @param isActive - New active status of the procedure
|
|
2458
|
-
* @param technologyName - Technology name of the procedure (to check if it's a free consultation)
|
|
2459
|
-
* @returns {Promise<void>}
|
|
2258
|
+
* Formats clinic address for display
|
|
2259
|
+
* @param location The clinic location object
|
|
2260
|
+
* @returns Formatted address string
|
|
2460
2261
|
*/
|
|
2461
|
-
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
|
-
/**
|
|
2465
|
-
* @class PatientAggregationService
|
|
2466
|
-
* @description Handles aggregation tasks related to patient data updates/deletions.
|
|
2467
|
-
*/
|
|
2468
|
-
declare class PatientAggregationService {
|
|
2469
|
-
private db;
|
|
2470
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2262
|
+
private formatClinicAddress;
|
|
2471
2263
|
/**
|
|
2472
|
-
*
|
|
2473
|
-
* @param
|
|
2474
|
-
* @
|
|
2475
|
-
* @returns {Promise<void>}
|
|
2264
|
+
* Fetches a practitioner by ID
|
|
2265
|
+
* @param practitionerId The practitioner ID
|
|
2266
|
+
* @returns The practitioner or null if not found
|
|
2476
2267
|
*/
|
|
2477
|
-
|
|
2268
|
+
private fetchPractitionerById;
|
|
2478
2269
|
/**
|
|
2479
|
-
*
|
|
2480
|
-
* @param
|
|
2481
|
-
* @returns
|
|
2270
|
+
* Fetches a clinic by ID
|
|
2271
|
+
* @param clinicId The clinic ID
|
|
2272
|
+
* @returns The clinic or null if not found
|
|
2482
2273
|
*/
|
|
2483
|
-
|
|
2274
|
+
private fetchClinicById;
|
|
2484
2275
|
}
|
|
2485
2276
|
|
|
2486
2277
|
/**
|
|
@@ -2581,414 +2372,532 @@ declare class AppointmentAggregationService {
|
|
|
2581
2372
|
* @param {string} clinicId - The clinic ID to remove
|
|
2582
2373
|
* @returns {Promise<void>} A promise that resolves when the operation is complete.
|
|
2583
2374
|
*/
|
|
2584
|
-
private removePatientLinksIfNoActiveAppointments;
|
|
2375
|
+
private removePatientLinksIfNoActiveAppointments;
|
|
2376
|
+
/**
|
|
2377
|
+
* Checks if there are active appointments between a patient and another entity (practitioner or clinic).
|
|
2378
|
+
*
|
|
2379
|
+
* @param {string} patientId - The patient ID.
|
|
2380
|
+
* @param {"practitionerId" | "clinicBranchId"} entityField - The field to check for the entity ID.
|
|
2381
|
+
* @param {string} entityId - The entity ID (practitioner or clinic).
|
|
2382
|
+
* @returns {Promise<number>} The number of active appointments found.
|
|
2383
|
+
*/
|
|
2384
|
+
private checkActiveAppointments;
|
|
2385
|
+
private fetchPatientProfile;
|
|
2386
|
+
/**
|
|
2387
|
+
* Fetches the sensitive information for a given patient ID.
|
|
2388
|
+
* @param patientId The ID of the patient to fetch sensitive information for.
|
|
2389
|
+
* @returns {Promise<PatientSensitiveInfo | null>} The patient sensitive information or null if not found or an error occurs.
|
|
2390
|
+
*/
|
|
2391
|
+
private fetchPatientSensitiveInfo;
|
|
2392
|
+
/**
|
|
2393
|
+
* Fetches the profile for a given practitioner ID.
|
|
2394
|
+
* @param practitionerId The ID of the practitioner to fetch.
|
|
2395
|
+
* @returns {Promise<Practitioner | null>} The practitioner profile or null if not found or an error occurs.
|
|
2396
|
+
*/
|
|
2397
|
+
private fetchPractitionerProfile;
|
|
2398
|
+
/**
|
|
2399
|
+
* Fetches the information for a given clinic ID.
|
|
2400
|
+
* @param clinicId The ID of the clinic to fetch.
|
|
2401
|
+
* @returns {Promise<Clinic | null>} The clinic information or null if not found or an error occurs.
|
|
2402
|
+
*/
|
|
2403
|
+
private fetchClinicInfo;
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
/**
|
|
2407
|
+
* @class ClinicAggregationService
|
|
2408
|
+
* @description Handles aggregation tasks related to clinic data updates.
|
|
2409
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2410
|
+
* triggered by changes in the clinics collection.
|
|
2411
|
+
*/
|
|
2412
|
+
declare class ClinicAggregationService {
|
|
2413
|
+
private db;
|
|
2414
|
+
/**
|
|
2415
|
+
* Constructor for ClinicAggregationService.
|
|
2416
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2417
|
+
*/
|
|
2418
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2419
|
+
/**
|
|
2420
|
+
* Adds clinic information to a clinic group when a new clinic is created
|
|
2421
|
+
* @param clinicGroupId - ID of the parent clinic group
|
|
2422
|
+
* @param clinicInfo - The clinic information to add to the group
|
|
2423
|
+
* @returns {Promise<void>}
|
|
2424
|
+
* @throws Will throw an error if the batch write fails
|
|
2425
|
+
*/
|
|
2426
|
+
addClinicToClinicGroup(clinicGroupId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2427
|
+
/**
|
|
2428
|
+
* Updates the ClinicInfo within the clinicsInfo array for multiple practitioners.
|
|
2429
|
+
* This method is designed to be called when a clinic's core information changes.
|
|
2430
|
+
* @param practitionerIds - IDs of practitioners associated with the clinic.
|
|
2431
|
+
* @param clinicInfo - The updated ClinicInfo object to aggregate.
|
|
2432
|
+
* @returns {Promise<void>}
|
|
2433
|
+
* @throws Will throw an error if the batch write fails.
|
|
2434
|
+
*/
|
|
2435
|
+
updateClinicInfoInPractitioners(practitionerIds: string[], clinicInfo: ClinicInfo): Promise<void>;
|
|
2436
|
+
/**
|
|
2437
|
+
* Updates the aggregated clinicInfo field within relevant Procedure documents.
|
|
2438
|
+
* @param procedureIds IDs of procedures performed at the clinic.
|
|
2439
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2440
|
+
*/
|
|
2441
|
+
updateClinicInfoInProcedures(procedureIds: string[], clinicInfo: ClinicInfo): Promise<void>;
|
|
2442
|
+
/**
|
|
2443
|
+
* Updates the aggregated clinicsInfo array within the parent ClinicGroup document.
|
|
2444
|
+
* @param clinicGroupId The ID of the parent clinic group.
|
|
2445
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2446
|
+
*/
|
|
2447
|
+
updateClinicInfoInClinicGroup(clinicGroupId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2448
|
+
/**
|
|
2449
|
+
* Updates relevant clinic information within Patient documents.
|
|
2450
|
+
* NOTE: PatientProfile stores an array of PatientClinic objects, which only contain
|
|
2451
|
+
* clinicId, assignedAt, assignedBy, isActive, notes. It does *not* store aggregated
|
|
2452
|
+
* ClinicInfo (like name, photo). Therefore, this method currently has limited use
|
|
2453
|
+
* for general clinic info updates. It might be relevant if Clinic.isActive status changes.
|
|
2454
|
+
*
|
|
2455
|
+
* @param patientIds IDs of patients associated with the clinic (e.g., from PatientProfile.clinicIds).
|
|
2456
|
+
* @param clinicInfo The updated ClinicInfo object (primarily for logging/context).
|
|
2457
|
+
* @param clinicIsActive The current active status of the updated clinic.
|
|
2458
|
+
*/
|
|
2459
|
+
updateClinicInfoInPatients(patientIds: string[], clinicInfo: ClinicInfo, clinicIsActive: boolean): Promise<void>;
|
|
2460
|
+
/**
|
|
2461
|
+
* Updates the eventLocation for upcoming calendar events associated with a specific clinic.
|
|
2462
|
+
* Uses a collection group query to find relevant events across all potential parent collections.
|
|
2463
|
+
*
|
|
2464
|
+
* @param clinicId The ID of the clinic whose location might have changed.
|
|
2465
|
+
* @param newLocation The new ClinicLocation object.
|
|
2466
|
+
*/
|
|
2467
|
+
updateClinicLocationInCalendarEvents(clinicId: string, newLocation: ClinicLocation): Promise<void>;
|
|
2468
|
+
/**
|
|
2469
|
+
* Updates clinic info in all upcoming calendar events associated with a specific clinic.
|
|
2470
|
+
* @param clinicId The ID of the clinic whose info has been updated.
|
|
2471
|
+
* @param clinicInfo The updated ClinicInfo object.
|
|
2472
|
+
*/
|
|
2473
|
+
updateClinicInfoInCalendarEvents(clinicId: string, clinicInfo: ClinicInfo): Promise<void>;
|
|
2474
|
+
/**
|
|
2475
|
+
* Removes clinic from practitioners when a clinic is deleted.
|
|
2476
|
+
* @param practitionerIds IDs of practitioners associated with the clinic.
|
|
2477
|
+
* @param clinicId The ID of the deleted clinic.
|
|
2478
|
+
*/
|
|
2479
|
+
removeClinicFromPractitioners(practitionerIds: string[], clinicId: string): Promise<void>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Inactivates all procedures associated with a deleted clinic
|
|
2482
|
+
* @param procedureIds IDs of procedures associated with the clinic
|
|
2483
|
+
*/
|
|
2484
|
+
inactivateProceduresForClinic(procedureIds: string[]): Promise<void>;
|
|
2485
|
+
/**
|
|
2486
|
+
* Removes clinic from clinic group when a clinic is deleted
|
|
2487
|
+
* @param clinicGroupId ID of the parent clinic group
|
|
2488
|
+
* @param clinicId ID of the deleted clinic
|
|
2489
|
+
*/
|
|
2490
|
+
removeClinicFromClinicGroup(clinicGroupId: string, clinicId: string): Promise<void>;
|
|
2491
|
+
/**
|
|
2492
|
+
* Removes clinic from patients when a clinic is deleted
|
|
2493
|
+
* @param patientIds IDs of patients associated with the clinic
|
|
2494
|
+
* @param clinicId ID of the deleted clinic
|
|
2495
|
+
*/
|
|
2496
|
+
removeClinicFromPatients(patientIds: string[], clinicId: string): Promise<void>;
|
|
2497
|
+
/**
|
|
2498
|
+
* Cancels all upcoming calendar events associated with a deleted clinic
|
|
2499
|
+
* @param clinicId ID of the deleted clinic
|
|
2500
|
+
*/
|
|
2501
|
+
cancelUpcomingCalendarEventsForClinic(clinicId: string): Promise<void>;
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* @class FilledFormsAggregationService
|
|
2506
|
+
* @description Handles aggregation tasks related to filled forms data updates.
|
|
2507
|
+
* Updates appointment documents with LinkedFormInfo when forms are created, updated, or deleted.
|
|
2508
|
+
*/
|
|
2509
|
+
declare class FilledFormsAggregationService {
|
|
2510
|
+
private db;
|
|
2511
|
+
/**
|
|
2512
|
+
* Constructor for FilledFormsAggregationService.
|
|
2513
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2514
|
+
*/
|
|
2515
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2516
|
+
/**
|
|
2517
|
+
* Handles side effects when a filled form is created or updated.
|
|
2518
|
+
* This function would typically be called by a Firestore onCreate or onUpdate trigger.
|
|
2519
|
+
* @param filledDocument The filled document that was created or updated.
|
|
2520
|
+
* @returns {Promise<void>}
|
|
2521
|
+
*/
|
|
2522
|
+
handleFilledFormCreateOrUpdate(filledDocument: FilledDocument): Promise<void>;
|
|
2523
|
+
/**
|
|
2524
|
+
* Handles side effects when a filled form is deleted.
|
|
2525
|
+
* This function would typically be called by a Firestore onDelete trigger.
|
|
2526
|
+
* @param filledDocument The filled document that was deleted.
|
|
2527
|
+
* @returns {Promise<void>}
|
|
2528
|
+
*/
|
|
2529
|
+
handleFilledFormDelete(filledDocument: FilledDocument): Promise<void>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Updates the appointment's pendingUserFormsIds for a new required user form.
|
|
2532
|
+
* This should be called when a required user form is first created.
|
|
2533
|
+
* @param filledDocument The newly created filled document.
|
|
2534
|
+
* @returns {Promise<void>}
|
|
2535
|
+
*/
|
|
2536
|
+
handleRequiredUserFormCreate(filledDocument: FilledDocument): Promise<void>;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* @class PatientAggregationService
|
|
2541
|
+
* @description Handles aggregation tasks related to patient data updates/deletions.
|
|
2542
|
+
*/
|
|
2543
|
+
declare class PatientAggregationService {
|
|
2544
|
+
private db;
|
|
2545
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2546
|
+
/**
|
|
2547
|
+
* Updates patient information in calendar events
|
|
2548
|
+
* @param patientId - ID of the patient
|
|
2549
|
+
* @param patientInfo - Updated patient information
|
|
2550
|
+
* @returns {Promise<void>}
|
|
2551
|
+
*/
|
|
2552
|
+
updatePatientInfoInCalendarEvents(patientId: string, patientInfo: any): Promise<void>;
|
|
2553
|
+
/**
|
|
2554
|
+
* Cancels all upcoming calendar events associated with a deleted patient
|
|
2555
|
+
* @param patientId - ID of the deleted patient
|
|
2556
|
+
* @returns {Promise<void>}
|
|
2557
|
+
*/
|
|
2558
|
+
cancelUpcomingCalendarEventsForPatient(patientId: string): Promise<void>;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* @class PractitionerAggregationService
|
|
2563
|
+
* @description Handles aggregation tasks related to practitioner data updates/deletions.
|
|
2564
|
+
*/
|
|
2565
|
+
declare class PractitionerAggregationService {
|
|
2566
|
+
private db;
|
|
2567
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2568
|
+
/**
|
|
2569
|
+
* Adds practitioner information to a clinic when a new practitioner is created
|
|
2570
|
+
* @param clinicId - ID of the clinic to update
|
|
2571
|
+
* @param doctorInfo - Doctor information to add to the clinic
|
|
2572
|
+
* @returns {Promise<void>}
|
|
2573
|
+
*/
|
|
2574
|
+
addPractitionerToClinic(clinicId: string, doctorInfo: DoctorInfo): Promise<void>;
|
|
2575
|
+
/**
|
|
2576
|
+
* Updates practitioner information in associated clinics
|
|
2577
|
+
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2578
|
+
* @param doctorInfo - Updated doctor information
|
|
2579
|
+
* @returns {Promise<void>}
|
|
2580
|
+
*/
|
|
2581
|
+
updatePractitionerInfoInClinics(clinicIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Updates practitioner information in associated procedures
|
|
2584
|
+
* @param procedureIds - IDs of procedures associated with the practitioner
|
|
2585
|
+
* @param doctorInfo - Updated doctor information
|
|
2586
|
+
* @returns {Promise<void>}
|
|
2587
|
+
*/
|
|
2588
|
+
updatePractitionerInfoInProcedures(procedureIds: string[], doctorInfo: DoctorInfo): Promise<void>;
|
|
2589
|
+
/**
|
|
2590
|
+
* Updates practitioner information in calendar events
|
|
2591
|
+
* @param practitionerId - ID of the practitioner
|
|
2592
|
+
* @param practitionerInfo - Updated practitioner information
|
|
2593
|
+
* @returns {Promise<void>}
|
|
2594
|
+
*/
|
|
2595
|
+
updatePractitionerInfoInCalendarEvents(practitionerId: string, practitionerInfo: DoctorInfo): Promise<void>;
|
|
2585
2596
|
/**
|
|
2586
|
-
*
|
|
2587
|
-
*
|
|
2588
|
-
* @param
|
|
2589
|
-
* @
|
|
2590
|
-
* @param {string} entityId - The entity ID (practitioner or clinic).
|
|
2591
|
-
* @returns {Promise<number>} The number of active appointments found.
|
|
2597
|
+
* Removes practitioner from clinics when a practitioner is deleted
|
|
2598
|
+
* @param clinicIds - IDs of clinics associated with the practitioner
|
|
2599
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2600
|
+
* @returns {Promise<void>}
|
|
2592
2601
|
*/
|
|
2593
|
-
|
|
2594
|
-
private fetchPatientProfile;
|
|
2602
|
+
removePractitionerFromClinics(clinicIds: string[], practitionerId: string): Promise<void>;
|
|
2595
2603
|
/**
|
|
2596
|
-
*
|
|
2597
|
-
* @param
|
|
2598
|
-
* @returns {Promise<
|
|
2604
|
+
* Cancels all upcoming calendar events for a deleted practitioner
|
|
2605
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2606
|
+
* @returns {Promise<void>}
|
|
2599
2607
|
*/
|
|
2600
|
-
|
|
2608
|
+
cancelUpcomingCalendarEventsForPractitioner(practitionerId: string): Promise<void>;
|
|
2601
2609
|
/**
|
|
2602
|
-
*
|
|
2603
|
-
* @param
|
|
2604
|
-
* @
|
|
2610
|
+
* Removes practitioner from patients when a practitioner is deleted
|
|
2611
|
+
* @param patientIds - IDs of patients associated with the practitioner
|
|
2612
|
+
* @param practitionerId - ID of the deleted practitioner
|
|
2613
|
+
* @returns {Promise<void>}
|
|
2605
2614
|
*/
|
|
2606
|
-
|
|
2615
|
+
removePractitionerFromPatients(patientIds: string[], practitionerId: string): Promise<void>;
|
|
2607
2616
|
/**
|
|
2608
|
-
*
|
|
2609
|
-
* @param
|
|
2610
|
-
* @returns {Promise<
|
|
2617
|
+
* Inactivates all procedures associated with a deleted practitioner
|
|
2618
|
+
* @param procedureIds - IDs of procedures provided by the practitioner
|
|
2619
|
+
* @returns {Promise<void>}
|
|
2611
2620
|
*/
|
|
2612
|
-
|
|
2621
|
+
inactivateProceduresForPractitioner(procedureIds: string[]): Promise<void>;
|
|
2613
2622
|
}
|
|
2614
2623
|
|
|
2615
2624
|
/**
|
|
2616
|
-
* @class
|
|
2617
|
-
* @description Handles aggregation tasks related to
|
|
2618
|
-
*
|
|
2625
|
+
* @class PractitionerInviteAggregationService
|
|
2626
|
+
* @description Handles aggregation tasks and side effects related to practitioner invite lifecycle events.
|
|
2627
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2628
|
+
* triggered by changes in the practitioner-invites collection.
|
|
2619
2629
|
*/
|
|
2620
|
-
declare class
|
|
2630
|
+
declare class PractitionerInviteAggregationService {
|
|
2621
2631
|
private db;
|
|
2632
|
+
private mailingService?;
|
|
2622
2633
|
/**
|
|
2623
|
-
* Constructor for
|
|
2634
|
+
* Constructor for PractitionerInviteAggregationService.
|
|
2624
2635
|
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2636
|
+
* @param mailingService Optional mailing service for sending emails
|
|
2625
2637
|
*/
|
|
2626
|
-
constructor(firestore?: admin.firestore.Firestore);
|
|
2638
|
+
constructor(firestore?: admin.firestore.Firestore, mailingService?: ExistingPractitionerInviteMailingService);
|
|
2627
2639
|
/**
|
|
2628
|
-
* Handles side effects when a
|
|
2629
|
-
* This function would typically be called by a Firestore onCreate
|
|
2630
|
-
* @param
|
|
2640
|
+
* Handles side effects when a practitioner invite is first created.
|
|
2641
|
+
* This function would typically be called by a Firestore onCreate trigger.
|
|
2642
|
+
* @param {PractitionerInvite} invite - The newly created PractitionerInvite object.
|
|
2643
|
+
* @param {object} emailConfig - Optional email configuration for sending invite emails
|
|
2631
2644
|
* @returns {Promise<void>}
|
|
2632
2645
|
*/
|
|
2633
|
-
|
|
2646
|
+
handleInviteCreate(invite: PractitionerInvite, emailConfig?: {
|
|
2647
|
+
fromAddress: string;
|
|
2648
|
+
domain: string;
|
|
2649
|
+
acceptUrl: string;
|
|
2650
|
+
rejectUrl: string;
|
|
2651
|
+
}): Promise<void>;
|
|
2634
2652
|
/**
|
|
2635
|
-
* Handles side effects when a
|
|
2636
|
-
* This function would typically be called by a Firestore
|
|
2637
|
-
* @param
|
|
2653
|
+
* Handles side effects when a practitioner invite is updated.
|
|
2654
|
+
* This function would typically be called by a Firestore onUpdate trigger.
|
|
2655
|
+
* @param {PractitionerInvite} before - The PractitionerInvite object before the update.
|
|
2656
|
+
* @param {PractitionerInvite} after - The PractitionerInvite object after the update.
|
|
2657
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2638
2658
|
* @returns {Promise<void>}
|
|
2639
2659
|
*/
|
|
2640
|
-
|
|
2660
|
+
handleInviteUpdate(before: PractitionerInvite, after: PractitionerInvite, emailConfig?: {
|
|
2661
|
+
fromAddress: string;
|
|
2662
|
+
domain: string;
|
|
2663
|
+
clinicDashboardUrl: string;
|
|
2664
|
+
practitionerProfileUrl?: string;
|
|
2665
|
+
findPractitionersUrl?: string;
|
|
2666
|
+
}): Promise<void>;
|
|
2641
2667
|
/**
|
|
2642
|
-
*
|
|
2643
|
-
*
|
|
2644
|
-
* @param filledDocument The newly created filled document.
|
|
2668
|
+
* Handles side effects when a practitioner invite is deleted.
|
|
2669
|
+
* @param deletedInvite - The PractitionerInvite object that was deleted.
|
|
2645
2670
|
* @returns {Promise<void>}
|
|
2646
2671
|
*/
|
|
2647
|
-
|
|
2648
|
-
}
|
|
2649
|
-
|
|
2650
|
-
/**
|
|
2651
|
-
* @class ReviewsAggregationService
|
|
2652
|
-
* @description Handles aggregation tasks related to review data updates.
|
|
2653
|
-
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2654
|
-
* triggered by changes in the reviews collection.
|
|
2655
|
-
*/
|
|
2656
|
-
declare class ReviewsAggregationService {
|
|
2657
|
-
private db;
|
|
2672
|
+
handleInviteDelete(deletedInvite: PractitionerInvite): Promise<void>;
|
|
2658
2673
|
/**
|
|
2659
|
-
*
|
|
2660
|
-
*
|
|
2674
|
+
* Handles the business logic when a practitioner accepts an invite.
|
|
2675
|
+
* This includes adding the practitioner to the clinic and the clinic to the practitioner.
|
|
2676
|
+
* @param {PractitionerInvite} invite - The accepted invite
|
|
2677
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2678
|
+
* @returns {Promise<void>}
|
|
2661
2679
|
*/
|
|
2662
|
-
|
|
2680
|
+
private handleInviteAccepted;
|
|
2663
2681
|
/**
|
|
2664
|
-
*
|
|
2665
|
-
* @param
|
|
2666
|
-
* @
|
|
2682
|
+
* Handles the business logic when a practitioner rejects an invite.
|
|
2683
|
+
* @param {PractitionerInvite} invite - The rejected invite
|
|
2684
|
+
* @param {object} emailConfig - Optional email configuration for sending notification emails
|
|
2685
|
+
* @returns {Promise<void>}
|
|
2667
2686
|
*/
|
|
2668
|
-
|
|
2687
|
+
private handleInviteRejected;
|
|
2669
2688
|
/**
|
|
2670
|
-
*
|
|
2671
|
-
* @param
|
|
2672
|
-
* @returns Promise
|
|
2689
|
+
* Handles the business logic when an invite is cancelled by admin.
|
|
2690
|
+
* @param {PractitionerInvite} invite - The cancelled invite
|
|
2691
|
+
* @returns {Promise<void>}
|
|
2673
2692
|
*/
|
|
2674
|
-
|
|
2693
|
+
private handleInviteCancelled;
|
|
2675
2694
|
/**
|
|
2676
|
-
*
|
|
2677
|
-
* @param clinicId
|
|
2678
|
-
* @param
|
|
2679
|
-
* @
|
|
2680
|
-
* @returns The updated clinic review info
|
|
2695
|
+
* Adds practitioner information to a clinic when an invite is accepted.
|
|
2696
|
+
* @param clinicId - ID of the clinic to update
|
|
2697
|
+
* @param doctorInfo - Doctor information to add to the clinic
|
|
2698
|
+
* @returns {Promise<void>}
|
|
2681
2699
|
*/
|
|
2682
|
-
|
|
2700
|
+
private addPractitionerToClinic;
|
|
2683
2701
|
/**
|
|
2684
|
-
* Updates
|
|
2685
|
-
* @param
|
|
2686
|
-
* @param
|
|
2687
|
-
* @
|
|
2688
|
-
* @returns The updated practitioner review info
|
|
2702
|
+
* Updates practitioner information in a clinic.
|
|
2703
|
+
* @param clinicId - ID of the clinic to update
|
|
2704
|
+
* @param doctorInfo - Updated doctor information
|
|
2705
|
+
* @returns {Promise<void>}
|
|
2689
2706
|
*/
|
|
2690
|
-
|
|
2707
|
+
private updatePractitionerInfoInClinic;
|
|
2691
2708
|
/**
|
|
2692
|
-
*
|
|
2693
|
-
* @param
|
|
2694
|
-
* @param
|
|
2695
|
-
* @param
|
|
2696
|
-
* @returns
|
|
2709
|
+
* Adds a clinic to a practitioner's profile with working hours from the invite.
|
|
2710
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2711
|
+
* @param {ClinicInfo} clinicInfo - The clinic information
|
|
2712
|
+
* @param {PractitionerInvite} invite - The accepted invite containing working hours
|
|
2713
|
+
* @returns {Promise<void>}
|
|
2697
2714
|
*/
|
|
2698
|
-
|
|
2715
|
+
private addClinicToPractitioner;
|
|
2699
2716
|
/**
|
|
2700
|
-
* Updates
|
|
2701
|
-
* @param practitionerId The ID
|
|
2702
|
-
* @param
|
|
2717
|
+
* Updates the working hours for an existing practitioner-clinic relationship.
|
|
2718
|
+
* @param {string} practitionerId - The practitioner ID
|
|
2719
|
+
* @param {PractitionerInvite} invite - The accepted invite containing new working hours
|
|
2720
|
+
* @returns {Promise<void>}
|
|
2703
2721
|
*/
|
|
2704
|
-
private
|
|
2722
|
+
private updatePractitionerWorkingHours;
|
|
2705
2723
|
/**
|
|
2706
|
-
*
|
|
2707
|
-
* @param
|
|
2724
|
+
* Fetches a clinic admin by ID
|
|
2725
|
+
* @param adminId The clinic admin ID
|
|
2726
|
+
* @returns The clinic admin or null if not found
|
|
2708
2727
|
*/
|
|
2709
|
-
|
|
2728
|
+
private fetchClinicAdminById;
|
|
2710
2729
|
/**
|
|
2711
|
-
*
|
|
2712
|
-
* @param
|
|
2713
|
-
* @
|
|
2714
|
-
* @returns Promise that resolves to the calculated review info
|
|
2730
|
+
* Fetches a practitioner by ID.
|
|
2731
|
+
* @param practitionerId The practitioner ID.
|
|
2732
|
+
* @returns {Promise<Practitioner | null>} The practitioner or null if not found.
|
|
2715
2733
|
*/
|
|
2716
|
-
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
interface NewMailgunMessagesAPI {
|
|
2720
|
-
create(domain: string, data: any): Promise<any>;
|
|
2721
|
-
}
|
|
2722
|
-
interface NewMailgunClient {
|
|
2723
|
-
messages: NewMailgunMessagesAPI;
|
|
2724
|
-
}
|
|
2725
|
-
/**
|
|
2726
|
-
* Interface for the data required to send a practitioner invitation email
|
|
2727
|
-
*/
|
|
2728
|
-
interface PractitionerInviteEmailData {
|
|
2729
|
-
/** The token object from the practitioner service */
|
|
2730
|
-
token: {
|
|
2731
|
-
id: string;
|
|
2732
|
-
token: string;
|
|
2733
|
-
practitionerId: string;
|
|
2734
|
-
email: string;
|
|
2735
|
-
clinicId: string;
|
|
2736
|
-
expiresAt: admin.firestore.Timestamp;
|
|
2737
|
-
};
|
|
2738
|
-
/** Practitioner basic info */
|
|
2739
|
-
practitioner: {
|
|
2740
|
-
firstName: string;
|
|
2741
|
-
lastName: string;
|
|
2742
|
-
};
|
|
2743
|
-
/** Clinic info */
|
|
2744
|
-
clinic: {
|
|
2745
|
-
name: string;
|
|
2746
|
-
contactEmail: string;
|
|
2747
|
-
contactName?: string;
|
|
2748
|
-
};
|
|
2749
|
-
/** Config options */
|
|
2750
|
-
options?: {
|
|
2751
|
-
registrationUrl?: string;
|
|
2752
|
-
customSubject?: string;
|
|
2753
|
-
fromAddress?: string;
|
|
2754
|
-
mailgunDomain?: string;
|
|
2755
|
-
};
|
|
2756
|
-
}
|
|
2757
|
-
/**
|
|
2758
|
-
* Service for sending practitioner invitation emails, updated for mailgun.js v10+
|
|
2759
|
-
*/
|
|
2760
|
-
declare class PractitionerInviteMailingService extends BaseMailingService {
|
|
2761
|
-
private readonly DEFAULT_REGISTRATION_URL;
|
|
2762
|
-
private readonly DEFAULT_SUBJECT;
|
|
2763
|
-
private readonly DEFAULT_MAILGUN_DOMAIN;
|
|
2734
|
+
private fetchPractitionerById;
|
|
2764
2735
|
/**
|
|
2765
|
-
*
|
|
2766
|
-
* @param
|
|
2767
|
-
* @
|
|
2736
|
+
* Fetches a clinic by ID.
|
|
2737
|
+
* @param clinicId The clinic ID.
|
|
2738
|
+
* @returns {Promise<Clinic | null>} The clinic or null if not found.
|
|
2768
2739
|
*/
|
|
2769
|
-
|
|
2740
|
+
private fetchClinicById;
|
|
2770
2741
|
/**
|
|
2771
|
-
* Sends
|
|
2772
|
-
* @param
|
|
2773
|
-
* @
|
|
2742
|
+
* Sends acceptance notification email to clinic admin
|
|
2743
|
+
* @param invite The accepted invite
|
|
2744
|
+
* @param practitioner The practitioner who accepted
|
|
2745
|
+
* @param clinic The clinic that sent the invite
|
|
2746
|
+
* @param emailConfig Email configuration
|
|
2774
2747
|
*/
|
|
2775
|
-
|
|
2748
|
+
private sendAcceptanceNotificationEmail;
|
|
2776
2749
|
/**
|
|
2777
|
-
*
|
|
2778
|
-
*
|
|
2779
|
-
*
|
|
2780
|
-
* @param
|
|
2781
|
-
* @param
|
|
2782
|
-
* @param mailgunDomain The mailgun domain to use for sending
|
|
2783
|
-
* @returns Promise resolved when the email is sent
|
|
2750
|
+
* Sends rejection notification email to clinic admin
|
|
2751
|
+
* @param invite The rejected invite
|
|
2752
|
+
* @param practitioner The practitioner who rejected
|
|
2753
|
+
* @param clinic The clinic that sent the invite
|
|
2754
|
+
* @param emailConfig Email configuration
|
|
2784
2755
|
*/
|
|
2785
|
-
|
|
2786
|
-
fromAddress: string;
|
|
2787
|
-
domain: string;
|
|
2788
|
-
registrationUrl?: string;
|
|
2789
|
-
}): Promise<void>;
|
|
2756
|
+
private sendRejectionNotificationEmail;
|
|
2790
2757
|
}
|
|
2791
2758
|
|
|
2792
2759
|
/**
|
|
2793
|
-
*
|
|
2794
|
-
|
|
2795
|
-
interface OrchestrateAppointmentCreationData {
|
|
2796
|
-
patientId: string;
|
|
2797
|
-
procedureId: string;
|
|
2798
|
-
appointmentStartTime: admin.firestore.Timestamp;
|
|
2799
|
-
appointmentEndTime: admin.firestore.Timestamp;
|
|
2800
|
-
patientNotes?: string | null;
|
|
2801
|
-
}
|
|
2802
|
-
/**
|
|
2803
|
-
* Admin service for handling booking-related operations.
|
|
2804
|
-
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
2760
|
+
* @class ProcedureAggregationService
|
|
2761
|
+
* @description Handles aggregation tasks related to procedure data updates/deletions.
|
|
2805
2762
|
*/
|
|
2806
|
-
declare class
|
|
2763
|
+
declare class ProcedureAggregationService {
|
|
2807
2764
|
private db;
|
|
2808
|
-
|
|
2765
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
2809
2766
|
/**
|
|
2810
|
-
*
|
|
2811
|
-
* @param
|
|
2767
|
+
* Adds procedure information to a practitioner when a new procedure is created
|
|
2768
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2769
|
+
* @param procedureSummary - Summary information about the procedure
|
|
2770
|
+
* @returns {Promise<void>}
|
|
2812
2771
|
*/
|
|
2813
|
-
|
|
2772
|
+
addProcedureToPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2814
2773
|
/**
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
* @param
|
|
2818
|
-
* @
|
|
2819
|
-
* @param procedureId - ID of the procedure
|
|
2820
|
-
* @param timeframe - Time range to check for availability
|
|
2821
|
-
* @returns Promise resolving to an array of available booking slots
|
|
2774
|
+
* Adds procedure information to a clinic when a new procedure is created
|
|
2775
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2776
|
+
* @param procedureSummary - Summary information about the procedure
|
|
2777
|
+
* @returns {Promise<void>}
|
|
2822
2778
|
*/
|
|
2823
|
-
|
|
2824
|
-
start: Date | admin.firestore.Timestamp;
|
|
2825
|
-
end: Date | admin.firestore.Timestamp;
|
|
2826
|
-
}): Promise<{
|
|
2827
|
-
availableSlots: {
|
|
2828
|
-
start: admin.firestore.Timestamp;
|
|
2829
|
-
}[];
|
|
2830
|
-
}>;
|
|
2779
|
+
addProcedureToClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2831
2780
|
/**
|
|
2832
|
-
*
|
|
2781
|
+
* Updates procedure information in a practitioner document
|
|
2782
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2783
|
+
* @param procedureSummary - Updated summary information about the procedure
|
|
2784
|
+
* @returns {Promise<void>}
|
|
2833
2785
|
*/
|
|
2834
|
-
|
|
2786
|
+
updateProcedureInfoInPractitioner(practitionerId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2835
2787
|
/**
|
|
2836
|
-
*
|
|
2788
|
+
* Updates procedure information in a clinic document
|
|
2789
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2790
|
+
* @param procedureSummary - Updated summary information about the procedure
|
|
2791
|
+
* @returns {Promise<void>}
|
|
2837
2792
|
*/
|
|
2838
|
-
|
|
2793
|
+
updateProcedureInfoInClinic(clinicId: string, procedureSummary: ProcedureSummaryInfo): Promise<void>;
|
|
2839
2794
|
/**
|
|
2840
|
-
*
|
|
2841
|
-
*
|
|
2842
|
-
* @param
|
|
2843
|
-
* @
|
|
2844
|
-
* @param end - End time of the range
|
|
2845
|
-
* @returns Promise resolving to an array of calendar events
|
|
2795
|
+
* Updates procedure information in calendar events
|
|
2796
|
+
* @param procedureId - ID of the procedure
|
|
2797
|
+
* @param procedureInfo - Updated procedure information
|
|
2798
|
+
* @returns {Promise<void>}
|
|
2846
2799
|
*/
|
|
2847
|
-
|
|
2800
|
+
updateProcedureInfoInCalendarEvents(procedureId: string, procedureInfo: any): Promise<void>;
|
|
2848
2801
|
/**
|
|
2849
|
-
*
|
|
2850
|
-
*
|
|
2851
|
-
* @
|
|
2852
|
-
* @param start - Start time of the range
|
|
2853
|
-
* @param end - End time of the range
|
|
2854
|
-
* @returns Promise resolving to an array of calendar events
|
|
2802
|
+
* Cancels all upcoming calendar events for a procedure
|
|
2803
|
+
* @param procedureId - ID of the procedure
|
|
2804
|
+
* @returns {Promise<void>}
|
|
2855
2805
|
*/
|
|
2856
|
-
|
|
2806
|
+
cancelUpcomingCalendarEventsForProcedure(procedureId: string): Promise<void>;
|
|
2857
2807
|
/**
|
|
2858
|
-
*
|
|
2859
|
-
* @param
|
|
2860
|
-
* @
|
|
2808
|
+
* Removes procedure from a practitioner when a procedure is deleted or inactivated
|
|
2809
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2810
|
+
* @param procedureId - ID of the procedure
|
|
2811
|
+
* @param clinicId - Optional clinic ID for free consultation removal
|
|
2812
|
+
* @returns {Promise<void>}
|
|
2861
2813
|
*/
|
|
2862
|
-
|
|
2863
|
-
private _generateCalendarProcedureInfo;
|
|
2814
|
+
removeProcedureFromPractitioner(practitionerId: string, procedureId: string, clinicId?: string): Promise<void>;
|
|
2864
2815
|
/**
|
|
2865
|
-
*
|
|
2866
|
-
*
|
|
2867
|
-
*
|
|
2868
|
-
* @
|
|
2869
|
-
* @param authenticatedUserId - The ID of the user making the request (for auditing, and usually is the patientId).
|
|
2870
|
-
* @returns Promise resolving to an object indicating success, and appointmentId or an error message.
|
|
2816
|
+
* Removes procedure from a clinic when a procedure is deleted or inactivated
|
|
2817
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2818
|
+
* @param procedureId - ID of the procedure
|
|
2819
|
+
* @returns {Promise<void>}
|
|
2871
2820
|
*/
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
/**
|
|
2884
|
-
* Defines the status of a specific instruction within a PatientRequirementInstance.
|
|
2885
|
-
* This helps track each actionable item for the patient.
|
|
2886
|
-
*/
|
|
2887
|
-
declare enum PatientInstructionStatus {
|
|
2888
|
-
PENDING_NOTIFICATION = "pendingNotification",// Notification is scheduled but not yet due/sent
|
|
2889
|
-
ACTION_DUE = "actionDue",// The time for this instruction/notification has arrived
|
|
2890
|
-
ACTION_TAKEN = "actionTaken",// Patient has acknowledged or completed this specific instruction
|
|
2891
|
-
MISSED = "missed",// The due time for this instruction passed without action
|
|
2892
|
-
CANCELLED = "cancelled",// This specific instruction was cancelled (e.g., requirement changed)
|
|
2893
|
-
SKIPPED = "skipped"
|
|
2894
|
-
}
|
|
2895
|
-
/**
|
|
2896
|
-
* Represents a single, timed instruction or notification point derived from a Requirement's timeframe.
|
|
2897
|
-
*/
|
|
2898
|
-
interface PatientRequirementInstruction {
|
|
2899
|
-
instructionId: string;
|
|
2900
|
-
instructionText: string;
|
|
2901
|
-
dueTime: Timestamp;
|
|
2902
|
-
actionableWindow: number;
|
|
2903
|
-
status: PatientInstructionStatus;
|
|
2904
|
-
originalNotifyAtValue: number;
|
|
2905
|
-
originalTimeframeUnit: TimeFrame["unit"];
|
|
2906
|
-
notificationId?: string;
|
|
2907
|
-
actionTakenAt?: Timestamp;
|
|
2908
|
-
updatedAt: Timestamp;
|
|
2909
|
-
}
|
|
2910
|
-
/**
|
|
2911
|
-
* Defines the overall status of a PatientRequirementInstance.
|
|
2912
|
-
*/
|
|
2913
|
-
declare enum PatientRequirementOverallStatus {
|
|
2914
|
-
ACTIVE = "active",// Requirement instance is active, instructions are pending or due.
|
|
2915
|
-
ALL_INSTRUCTIONS_MET = "allInstructionsMet",// All instructions actioned/completed by the patient.
|
|
2916
|
-
PARTIALLY_COMPLETED = "partiallyCompleted",// Some instructions met, some missed or pending.
|
|
2917
|
-
FAILED = "failed",// The patient failed to complete the requirement on time and above treashold of 60%
|
|
2918
|
-
CANCELLED_APPOINTMENT = "cancelledAppointment",// Entire requirement instance cancelled due to appointment cancellation.
|
|
2919
|
-
SUPERSEDED_RESCHEDULE = "supersededReschedule",// This instance was replaced by a new one due to appointment reschedule.
|
|
2920
|
-
FAILED_TO_PROCESS = "failedToProcess"
|
|
2921
|
-
}
|
|
2922
|
-
/**
|
|
2923
|
-
* Represents an instance of a backoffice Requirement, tailored to a specific patient and appointment.
|
|
2924
|
-
* This document lives in the patient's subcollection: `patients/{patientId}/patientRequirements/{instanceId}`.
|
|
2925
|
-
*/
|
|
2926
|
-
interface PatientRequirementInstance {
|
|
2927
|
-
id: string;
|
|
2928
|
-
patientId: string;
|
|
2929
|
-
appointmentId: string;
|
|
2930
|
-
originalRequirementId: string;
|
|
2931
|
-
requirementType: RequirementType;
|
|
2932
|
-
requirementName: string;
|
|
2933
|
-
requirementDescription: string;
|
|
2934
|
-
requirementImportance: RequirementImportance;
|
|
2935
|
-
overallStatus: PatientRequirementOverallStatus;
|
|
2936
|
-
instructions: PatientRequirementInstruction[];
|
|
2937
|
-
createdAt: Timestamp;
|
|
2938
|
-
updatedAt: Timestamp;
|
|
2821
|
+
removeProcedureFromClinic(clinicId: string, procedureId: string): Promise<void>;
|
|
2822
|
+
/**
|
|
2823
|
+
* Handles procedure status changes (activation/deactivation) specifically for free consultations
|
|
2824
|
+
* @param practitionerId - ID of the practitioner who performs the procedure
|
|
2825
|
+
* @param procedureId - ID of the procedure
|
|
2826
|
+
* @param clinicId - ID of the clinic where the procedure is performed
|
|
2827
|
+
* @param isActive - New active status of the procedure
|
|
2828
|
+
* @param technologyName - Technology name of the procedure (to check if it's a free consultation)
|
|
2829
|
+
* @returns {Promise<void>}
|
|
2830
|
+
*/
|
|
2831
|
+
handleFreeConsultationStatusChange(practitionerId: string, procedureId: string, clinicId: string, isActive: boolean, technologyName: string): Promise<void>;
|
|
2939
2832
|
}
|
|
2940
|
-
/**
|
|
2941
|
-
* Firestore subcollection name for patient requirement instances.
|
|
2942
|
-
*/
|
|
2943
|
-
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
2944
2833
|
|
|
2945
2834
|
/**
|
|
2946
|
-
* @class
|
|
2947
|
-
* @description Handles
|
|
2948
|
-
* This service is intended to be used by
|
|
2835
|
+
* @class ReviewsAggregationService
|
|
2836
|
+
* @description Handles aggregation tasks related to review data updates.
|
|
2837
|
+
* This service is intended to be used primarily by background functions (e.g., Cloud Functions)
|
|
2838
|
+
* triggered by changes in the reviews collection.
|
|
2949
2839
|
*/
|
|
2950
|
-
declare class
|
|
2840
|
+
declare class ReviewsAggregationService {
|
|
2951
2841
|
private db;
|
|
2952
|
-
|
|
2842
|
+
/**
|
|
2843
|
+
* Constructor for ReviewsAggregationService.
|
|
2844
|
+
* @param firestore Optional Firestore instance. If not provided, it uses the default admin SDK instance.
|
|
2845
|
+
*/
|
|
2953
2846
|
constructor(firestore?: admin.firestore.Firestore);
|
|
2954
2847
|
/**
|
|
2955
|
-
*
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
*
|
|
2962
|
-
* @
|
|
2848
|
+
* Process a newly created review and update all related entities
|
|
2849
|
+
* @param review The newly created review
|
|
2850
|
+
* @returns Promise resolving when all updates are complete
|
|
2851
|
+
*/
|
|
2852
|
+
processNewReview(review: Review): Promise<void>;
|
|
2853
|
+
/**
|
|
2854
|
+
* Process a deleted review and update all related entities
|
|
2855
|
+
* @param review The deleted review
|
|
2856
|
+
* @returns Promise resolving when all updates are complete
|
|
2857
|
+
*/
|
|
2858
|
+
processDeletedReview(review: Review): Promise<void>;
|
|
2859
|
+
/**
|
|
2860
|
+
* Updates the review info for a clinic
|
|
2861
|
+
* @param clinicId The ID of the clinic to update
|
|
2862
|
+
* @param removedReview Optional review being removed
|
|
2863
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2864
|
+
* @returns The updated clinic review info
|
|
2865
|
+
*/
|
|
2866
|
+
updateClinicReviewInfo(clinicId: string, removedReview?: ClinicReview, isRemoval?: boolean): Promise<ClinicReviewInfo>;
|
|
2867
|
+
/**
|
|
2868
|
+
* Updates the review info for a practitioner
|
|
2869
|
+
* @param practitionerId The ID of the practitioner to update
|
|
2870
|
+
* @param removedReview Optional review being removed
|
|
2871
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2872
|
+
* @returns The updated practitioner review info
|
|
2873
|
+
*/
|
|
2874
|
+
updatePractitionerReviewInfo(practitionerId: string, removedReview?: PractitionerReview, isRemoval?: boolean): Promise<PractitionerReviewInfo>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Updates the review info for a procedure
|
|
2877
|
+
* @param procedureId The ID of the procedure to update
|
|
2878
|
+
* @param removedReview Optional review being removed
|
|
2879
|
+
* @param isRemoval Whether this update is for a review removal
|
|
2880
|
+
* @returns The updated procedure review info
|
|
2963
2881
|
*/
|
|
2964
|
-
|
|
2882
|
+
updateProcedureReviewInfo(procedureId: string, removedReview?: ProcedureReview, isRemoval?: boolean): Promise<ProcedureReviewInfo>;
|
|
2965
2883
|
/**
|
|
2966
|
-
*
|
|
2967
|
-
*
|
|
2968
|
-
*
|
|
2969
|
-
* @param instance - The PatientRequirementInstance.
|
|
2970
|
-
* @returns {Promise<void>}
|
|
2884
|
+
* Updates doctorInfo rating in all procedures for a practitioner
|
|
2885
|
+
* @param practitionerId The ID of the practitioner
|
|
2886
|
+
* @param rating The new rating to set
|
|
2971
2887
|
*/
|
|
2972
|
-
|
|
2888
|
+
private updateDoctorInfoInProcedures;
|
|
2973
2889
|
/**
|
|
2974
|
-
*
|
|
2975
|
-
*
|
|
2976
|
-
* This would typically be called by a scheduled Cloud Function.
|
|
2977
|
-
*
|
|
2978
|
-
* @param patientId - The ID of the patient.
|
|
2979
|
-
* @param instanceId - The ID of the PatientRequirementInstance.
|
|
2980
|
-
* @returns {Promise<void>}
|
|
2890
|
+
* Verifies a review as checked by admin/staff
|
|
2891
|
+
* @param reviewId The ID of the review to verify
|
|
2981
2892
|
*/
|
|
2982
|
-
|
|
2893
|
+
verifyReview(reviewId: string): Promise<void>;
|
|
2983
2894
|
/**
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
2986
|
-
*
|
|
2987
|
-
* @
|
|
2988
|
-
* @param instanceId - The ID of the PatientRequirementInstance to update.
|
|
2989
|
-
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
2895
|
+
* Calculate the average of all reviews for an entity
|
|
2896
|
+
* @param entityId The entity ID
|
|
2897
|
+
* @param entityType The type of entity ('clinic', 'practitioner', or 'procedure')
|
|
2898
|
+
* @returns Promise that resolves to the calculated review info
|
|
2990
2899
|
*/
|
|
2991
|
-
|
|
2900
|
+
calculateEntityReviewInfo(entityId: string, entityType: "clinic" | "practitioner" | "procedure"): Promise<ClinicReviewInfo | PractitionerReviewInfo | ProcedureReviewInfo>;
|
|
2992
2901
|
}
|
|
2993
2902
|
|
|
2994
2903
|
/**
|
|
@@ -3145,6 +3054,97 @@ declare class BookingAvailabilityCalculator {
|
|
|
3145
3054
|
private static mergeOverlappingIntervals;
|
|
3146
3055
|
}
|
|
3147
3056
|
|
|
3057
|
+
/**
|
|
3058
|
+
* Interface for the data required by orchestrateAppointmentCreation
|
|
3059
|
+
*/
|
|
3060
|
+
interface OrchestrateAppointmentCreationData {
|
|
3061
|
+
patientId: string;
|
|
3062
|
+
procedureId: string;
|
|
3063
|
+
appointmentStartTime: admin.firestore.Timestamp;
|
|
3064
|
+
appointmentEndTime: admin.firestore.Timestamp;
|
|
3065
|
+
patientNotes?: string | null;
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Admin service for handling booking-related operations.
|
|
3069
|
+
* This is the cloud-based implementation that will be used in Cloud Functions.
|
|
3070
|
+
*/
|
|
3071
|
+
declare class BookingAdmin {
|
|
3072
|
+
private db;
|
|
3073
|
+
private documentManagerAdmin;
|
|
3074
|
+
/**
|
|
3075
|
+
* Creates a new BookingAdmin instance
|
|
3076
|
+
* @param firestore - Firestore instance provided by the caller
|
|
3077
|
+
*/
|
|
3078
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3079
|
+
/**
|
|
3080
|
+
* Gets available booking time slots for a specific clinic, practitioner, and procedure
|
|
3081
|
+
*
|
|
3082
|
+
* @param clinicId - ID of the clinic
|
|
3083
|
+
* @param practitionerId - ID of the practitioner
|
|
3084
|
+
* @param procedureId - ID of the procedure
|
|
3085
|
+
* @param timeframe - Time range to check for availability
|
|
3086
|
+
* @returns Promise resolving to an array of available booking slots
|
|
3087
|
+
*/
|
|
3088
|
+
getAvailableBookingSlots(clinicId: string, practitionerId: string, procedureId: string, timeframe: {
|
|
3089
|
+
start: Date | admin.firestore.Timestamp;
|
|
3090
|
+
end: Date | admin.firestore.Timestamp;
|
|
3091
|
+
}): Promise<{
|
|
3092
|
+
availableSlots: {
|
|
3093
|
+
start: admin.firestore.Timestamp;
|
|
3094
|
+
}[];
|
|
3095
|
+
}>;
|
|
3096
|
+
/**
|
|
3097
|
+
* Converts an admin Firestore Timestamp to a client Firestore Timestamp
|
|
3098
|
+
*/
|
|
3099
|
+
private adminTimestampToClientTimestamp;
|
|
3100
|
+
/**
|
|
3101
|
+
* Converts timestamps in calendar events from admin Firestore Timestamps to client Firestore Timestamps
|
|
3102
|
+
*/
|
|
3103
|
+
private convertEventsTimestamps;
|
|
3104
|
+
/**
|
|
3105
|
+
* Fetches clinic calendar events for a specific time range
|
|
3106
|
+
*
|
|
3107
|
+
* @param clinicId - ID of the clinic
|
|
3108
|
+
* @param start - Start time of the range
|
|
3109
|
+
* @param end - End time of the range
|
|
3110
|
+
* @returns Promise resolving to an array of calendar events
|
|
3111
|
+
*/
|
|
3112
|
+
private getClinicCalendarEvents;
|
|
3113
|
+
/**
|
|
3114
|
+
* Fetches practitioner calendar events for a specific time range
|
|
3115
|
+
*
|
|
3116
|
+
* @param practitionerId - ID of the practitioner
|
|
3117
|
+
* @param start - Start time of the range
|
|
3118
|
+
* @param end - End time of the range
|
|
3119
|
+
* @returns Promise resolving to an array of calendar events
|
|
3120
|
+
*/
|
|
3121
|
+
private getPractitionerCalendarEvents;
|
|
3122
|
+
/**
|
|
3123
|
+
* Summarizes event types for logging purposes
|
|
3124
|
+
* @param events Array of calendar events
|
|
3125
|
+
* @returns Object with counts of each event type
|
|
3126
|
+
*/
|
|
3127
|
+
private summarizeEventTypes;
|
|
3128
|
+
private _generateCalendarProcedureInfo;
|
|
3129
|
+
/**
|
|
3130
|
+
* Orchestrates the creation of a new appointment, including data aggregation.
|
|
3131
|
+
* This method is intended to be called from a trusted backend environment (e.g., an Express route handler in a Cloud Function).
|
|
3132
|
+
*
|
|
3133
|
+
* @param data - Data required to create the appointment.
|
|
3134
|
+
* @param authenticatedUserId - The ID of the user making the request (for auditing, and usually is the patientId).
|
|
3135
|
+
* @returns Promise resolving to an object indicating success, and appointmentId or an error message.
|
|
3136
|
+
*/
|
|
3137
|
+
orchestrateAppointmentCreation(data: OrchestrateAppointmentCreationData, authenticatedUserId: string): Promise<{
|
|
3138
|
+
success: boolean;
|
|
3139
|
+
appointmentId?: string;
|
|
3140
|
+
appointmentData?: Appointment;
|
|
3141
|
+
calendarEventId?: string;
|
|
3142
|
+
error?: string;
|
|
3143
|
+
}>;
|
|
3144
|
+
private _generateProcedureSummaryInfo;
|
|
3145
|
+
private _generateProcedureExtendedInfo;
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
3148
|
/**
|
|
3149
3149
|
* @class CalendarAdminService
|
|
3150
3150
|
* @description Handles administrative tasks for calendar events linked to appointments,
|
|
@@ -3224,6 +3224,14 @@ declare class DocumentManagerAdminService {
|
|
|
3224
3224
|
batchInitializeAppointmentFormsFromTechnologyTemplates(dbBatch: admin.firestore.WriteBatch, appointmentId: string, procedureIdForForms: string, technologyTemplates: TechnologyDocumentationTemplate[], patientId: string, practitionerId: string, clinicId: string, nowMillis: number): Promise<InitializeAppointmentFormsResult>;
|
|
3225
3225
|
}
|
|
3226
3226
|
|
|
3227
|
+
/**
|
|
3228
|
+
* Ensures that the free consultation infrastructure exists in the database
|
|
3229
|
+
* Creates category, subcategory, and technology if they don't exist
|
|
3230
|
+
* @param db - Firestore database instance (optional, defaults to admin.firestore())
|
|
3231
|
+
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
3232
|
+
*/
|
|
3233
|
+
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
3234
|
+
|
|
3227
3235
|
/**
|
|
3228
3236
|
* Cloud Functions-compatible logger with fallback for other environments
|
|
3229
3237
|
*
|
|
@@ -3311,12 +3319,152 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
3311
3319
|
sendReviewAddedEmail(data: ReviewAddedEmailData): Promise<any>;
|
|
3312
3320
|
}
|
|
3313
3321
|
|
|
3322
|
+
declare class NotificationsAdmin {
|
|
3323
|
+
private expo;
|
|
3324
|
+
private db;
|
|
3325
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3326
|
+
/**
|
|
3327
|
+
* Dohvata notifikaciju po ID-u
|
|
3328
|
+
*/
|
|
3329
|
+
getNotification(id: string): Promise<Notification | null>;
|
|
3330
|
+
/**
|
|
3331
|
+
* Kreira novu notifikaciju
|
|
3332
|
+
*/
|
|
3333
|
+
createNotification(notification: Omit<Notification, "id">): Promise<string>;
|
|
3334
|
+
/**
|
|
3335
|
+
* Priprema Expo poruku za slanje
|
|
3336
|
+
*/
|
|
3337
|
+
private prepareExpoMessage;
|
|
3338
|
+
/**
|
|
3339
|
+
* Ažurira status notifikacije
|
|
3340
|
+
*/
|
|
3341
|
+
updateNotificationStatus(notificationId: string, status: NotificationStatus, error?: string): Promise<void>;
|
|
3342
|
+
/**
|
|
3343
|
+
* Šalje notifikaciju kroz Expo servis sa boljim error handlingom
|
|
3344
|
+
*/
|
|
3345
|
+
sendPushNotification(notification: Notification): Promise<boolean>;
|
|
3346
|
+
/**
|
|
3347
|
+
* Procesira notifikacije koje čekaju na slanje sa batch limitom
|
|
3348
|
+
*/
|
|
3349
|
+
processPendingNotifications(batchSize?: number): Promise<void>;
|
|
3350
|
+
/**
|
|
3351
|
+
* Briše stare notifikacije sa batch procesiranjem
|
|
3352
|
+
*/
|
|
3353
|
+
cleanupOldNotifications(daysOld?: number, batchSize?: number): Promise<void>;
|
|
3354
|
+
/**
|
|
3355
|
+
* Creates and potentially sends a push notification for a confirmed appointment.
|
|
3356
|
+
* @param appointment The confirmed appointment object.
|
|
3357
|
+
* @param recipientUserId The ID of the user receiving the notification.
|
|
3358
|
+
* @param recipientExpoTokens Array of Expo push tokens for the recipient.
|
|
3359
|
+
* @param recipientRole The role of the recipient (e.g., PATIENT, PRACTITIONER).
|
|
3360
|
+
*/
|
|
3361
|
+
sendAppointmentConfirmedPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3362
|
+
sendAppointmentCancelledPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3363
|
+
sendAppointmentRescheduledProposalPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3364
|
+
sendPaymentUpdatePush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3365
|
+
sendReviewRequestPush(appointment: Appointment, patientUserId: string, patientExpoTokens: string[]): Promise<string | null>;
|
|
3366
|
+
sendReviewAddedPush(appointment: Appointment, recipientUserId: string, recipientExpoTokens: string[], recipientRole: UserRole): Promise<string | null>;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3314
3369
|
/**
|
|
3315
|
-
*
|
|
3316
|
-
*
|
|
3317
|
-
*
|
|
3318
|
-
* @returns Promise<boolean> - Always returns true after ensuring infrastructure exists
|
|
3370
|
+
* @class PatientRequirementsAdminService
|
|
3371
|
+
* @description Handles administrative tasks for patient requirement instances, primarily managing associated notifications.
|
|
3372
|
+
* This service is intended to be used by Cloud Functions triggered by changes to PatientRequirementInstance documents.
|
|
3319
3373
|
*/
|
|
3320
|
-
declare
|
|
3374
|
+
declare class PatientRequirementsAdminService {
|
|
3375
|
+
private db;
|
|
3376
|
+
private notificationsAdmin;
|
|
3377
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3378
|
+
/**
|
|
3379
|
+
* Processes a newly created or updated PatientRequirementInstance to schedule notifications for its instructions.
|
|
3380
|
+
* It will also cancel pre-existing notifications if due times have changed significantly.
|
|
3381
|
+
*
|
|
3382
|
+
* @param patientId - The ID of the patient.
|
|
3383
|
+
* @param instance - The PatientRequirementInstance data (either new or updated).
|
|
3384
|
+
* @param previousInstanceData - Optional. The previous state of the instance data if it's an update.
|
|
3385
|
+
* Used to determine if notifications need to be cancelled/rescheduled.
|
|
3386
|
+
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
3387
|
+
*/
|
|
3388
|
+
processRequirementInstanceAndScheduleNotifications(patientId: string, instance: PatientRequirementInstance, previousInstanceData?: PatientRequirementInstance): Promise<void>;
|
|
3389
|
+
/**
|
|
3390
|
+
* Cancels all PENDING notifications associated with a specific PatientRequirementInstance.
|
|
3391
|
+
* Typically called when the instance itself is deleted or its overall status becomes CANCELLED.
|
|
3392
|
+
*
|
|
3393
|
+
* @param instance - The PatientRequirementInstance.
|
|
3394
|
+
* @returns {Promise<void>}
|
|
3395
|
+
*/
|
|
3396
|
+
cancelAllNotificationsForInstance(instance: PatientRequirementInstance): Promise<void>;
|
|
3397
|
+
/**
|
|
3398
|
+
* (Optional - For a cron job)
|
|
3399
|
+
* Scans for instructions that are past their due time but not yet actioned, and updates their status to MISSED.
|
|
3400
|
+
* This would typically be called by a scheduled Cloud Function.
|
|
3401
|
+
*
|
|
3402
|
+
* @param patientId - The ID of the patient.
|
|
3403
|
+
* @param instanceId - The ID of the PatientRequirementInstance.
|
|
3404
|
+
* @returns {Promise<void>}
|
|
3405
|
+
*/
|
|
3406
|
+
updateMissedInstructions(patientId: string, instanceId: string): Promise<void>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Calculates and updates the overallStatus of a PatientRequirementInstance
|
|
3409
|
+
* based on the statuses of its individual instructions.
|
|
3410
|
+
*
|
|
3411
|
+
* @param patientId - The ID of the patient.
|
|
3412
|
+
* @param instanceId - The ID of the PatientRequirementInstance to update.
|
|
3413
|
+
* @returns {Promise<void>} A promise that resolves when processing is complete.
|
|
3414
|
+
*/
|
|
3415
|
+
updateOverallInstanceStatus(patientId: string, instanceId: string): Promise<void>;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
/**
|
|
3419
|
+
* @class UserProfileAdminService
|
|
3420
|
+
* @description Handles user profile management operations for admin tasks
|
|
3421
|
+
*/
|
|
3422
|
+
declare class UserProfileAdminService {
|
|
3423
|
+
private db;
|
|
3424
|
+
/**
|
|
3425
|
+
* Constructor for UserProfileAdminService
|
|
3426
|
+
* @param firestore Optional Firestore instance. If not provided, uses the default admin SDK instance.
|
|
3427
|
+
*/
|
|
3428
|
+
constructor(firestore?: admin.firestore.Firestore);
|
|
3429
|
+
/**
|
|
3430
|
+
* Creates a blank user profile with minimal information
|
|
3431
|
+
* @param authUserData Basic user data from Firebase Auth
|
|
3432
|
+
* @returns The created user document
|
|
3433
|
+
*/
|
|
3434
|
+
createBlankUserProfile(authUserData: {
|
|
3435
|
+
uid: string;
|
|
3436
|
+
email: string | null;
|
|
3437
|
+
isAnonymous: boolean;
|
|
3438
|
+
}): Promise<User>;
|
|
3439
|
+
/**
|
|
3440
|
+
* Initializes patient role for a user and creates all required patient documents
|
|
3441
|
+
* Creates patient profile, sensitive info, and medical info in one operation
|
|
3442
|
+
*
|
|
3443
|
+
* @param userId The user ID to initialize with patient role
|
|
3444
|
+
* @param options Optional data for different aspects of patient initialization
|
|
3445
|
+
* @returns Object containing the updated user and all created patient documents
|
|
3446
|
+
*/
|
|
3447
|
+
initializePatientRole(userId: string, options?: {
|
|
3448
|
+
profileData?: Partial<CreatePatientProfileData>;
|
|
3449
|
+
sensitiveData?: Partial<CreatePatientSensitiveInfoData>;
|
|
3450
|
+
}): Promise<{
|
|
3451
|
+
user: User;
|
|
3452
|
+
patientProfile: PatientProfile;
|
|
3453
|
+
patientSensitiveInfo: PatientSensitiveInfo;
|
|
3454
|
+
patientMedicalInfo: PatientMedicalInfo;
|
|
3455
|
+
}>;
|
|
3456
|
+
/**
|
|
3457
|
+
* Initializes clinic admin role for a user
|
|
3458
|
+
* @param userId The user ID to initialize with clinic admin role
|
|
3459
|
+
* @returns The updated user document
|
|
3460
|
+
*/
|
|
3461
|
+
initializeClinicAdminRole(userId: string): Promise<User>;
|
|
3462
|
+
/**
|
|
3463
|
+
* Initializes practitioner role for a user
|
|
3464
|
+
* @param userId The user ID to initialize with practitioner role
|
|
3465
|
+
* @returns The updated user document
|
|
3466
|
+
*/
|
|
3467
|
+
initializePractitionerRole(userId: string): Promise<User>;
|
|
3468
|
+
}
|
|
3321
3469
|
|
|
3322
|
-
export {
|
|
3470
|
+
export { type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type InitializeAppointmentFormsResult, Logger, NOTIFICATIONS_COLLECTION, type NewMailgunClient$2 as NewMailgunClient, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENTS_COLLECTION, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, PATIENT_SENSITIVE_INFO_COLLECTION, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientProfile, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientSensitiveInfo, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, type PractitionerInviteEmailData, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type TimeInterval, UserProfileAdminService, UserRole, freeConsultationInfrastructure };
|