@blackcode_sa/metaestetics-api 1.7.47 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.d.mts +999 -959
- package/dist/admin/index.d.ts +999 -959
- package/dist/admin/index.js +69 -69
- package/dist/admin/index.mjs +67 -69
- package/dist/index.d.mts +14675 -13040
- package/dist/index.d.ts +14675 -13040
- package/dist/index.js +12224 -14615
- package/dist/index.mjs +12452 -14968
- package/package.json +5 -5
- package/src/admin/index.ts +8 -1
- 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 +14 -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.mts
CHANGED
|
@@ -2,253 +2,11 @@ import { Timestamp, FieldValue } from 'firebase/firestore';
|
|
|
2
2
|
import * as admin from 'firebase-admin';
|
|
3
3
|
import { Timestamp as Timestamp$1 } from 'firebase-admin/firestore';
|
|
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"
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Zahtevi sertifikacije za izvođenje procedura
|
|
246
|
-
*/
|
|
247
|
-
interface CertificationRequirement {
|
|
248
|
-
/** Minimalni nivo sertifikacije potreban za proceduru */
|
|
249
|
-
minimumLevel: CertificationLevel;
|
|
250
|
-
/** Dodatne specijalizacije potrebne za proceduru */
|
|
251
|
-
requiredSpecialties?: CertificationSpecialty[];
|
|
5
|
+
declare enum UserRole {
|
|
6
|
+
PATIENT = "patient",
|
|
7
|
+
PRACTITIONER = "practitioner",
|
|
8
|
+
APP_ADMIN = "app_admin",
|
|
9
|
+
CLINIC_ADMIN = "clinic_admin"
|
|
252
10
|
}
|
|
253
11
|
|
|
254
12
|
/**
|
|
@@ -562,10 +320,46 @@ declare enum TreatmentBenefit {
|
|
|
562
320
|
}
|
|
563
321
|
|
|
564
322
|
/**
|
|
565
|
-
*
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
323
|
+
* Nivoi sertifikacije medicinskog osoblja, poređani od najnižeg do najvišeg
|
|
324
|
+
*/
|
|
325
|
+
declare enum CertificationLevel {
|
|
326
|
+
AESTHETICIAN = "aesthetician",// Osnovni estetičar
|
|
327
|
+
NURSE_ASSISTANT = "nurse_assistant",// Medicinski tehničar
|
|
328
|
+
NURSE = "nurse",// Medicinska sestra
|
|
329
|
+
NURSE_PRACTITIONER = "nurse_practitioner",// Viša medicinska sestra
|
|
330
|
+
PHYSICIAN_ASSISTANT = "physician_assistant",// Lekar asistent
|
|
331
|
+
DOCTOR = "doctor",// Doktor medicine
|
|
332
|
+
SPECIALIST = "specialist",// Specijalista
|
|
333
|
+
PLASTIC_SURGEON = "plastic_surgeon"
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Dodatne specijalizacije potrebne za određene procedure
|
|
337
|
+
*/
|
|
338
|
+
declare enum CertificationSpecialty {
|
|
339
|
+
LASER = "laser",// Sertifikat za laserske tretmane
|
|
340
|
+
INJECTABLES = "injectables",// Sertifikat za injekcione tretmane
|
|
341
|
+
CHEMICAL_PEELS = "chemical_peels",// Sertifikat za hemijske pilinge
|
|
342
|
+
MICRODERMABRASION = "microdermabrasion",// Sertifikat za mikrodermoabraziju
|
|
343
|
+
BODY_CONTOURING = "body_contouring",// Sertifikat za konturiranje tela
|
|
344
|
+
SKIN_CARE = "skin_care",// Sertifikat za negu kože
|
|
345
|
+
WOUND_CARE = "wound_care",// Sertifikat za tretman rana
|
|
346
|
+
ANESTHESIA = "anesthesia"
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Zahtevi sertifikacije za izvođenje procedura
|
|
350
|
+
*/
|
|
351
|
+
interface CertificationRequirement {
|
|
352
|
+
/** Minimalni nivo sertifikacije potreban za proceduru */
|
|
353
|
+
minimumLevel: CertificationLevel;
|
|
354
|
+
/** Dodatne specijalizacije potrebne za proceduru */
|
|
355
|
+
requiredSpecialties?: CertificationSpecialty[];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Reference to a documentation template with metadata
|
|
360
|
+
* @property templateId - ID of the documentation template
|
|
361
|
+
* @property isUserForm - Whether this template is filled by users
|
|
362
|
+
* @property isRequired - Whether this template is required
|
|
569
363
|
* @property sortingOrder - The display order of this template
|
|
570
364
|
*/
|
|
571
365
|
interface TechnologyDocumentationTemplate {
|
|
@@ -765,70 +559,310 @@ interface ProcedureSummaryInfo {
|
|
|
765
559
|
}
|
|
766
560
|
|
|
767
561
|
/**
|
|
768
|
-
*
|
|
562
|
+
* Enum for all possible clinic tags
|
|
769
563
|
*/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
564
|
+
declare enum ClinicTag {
|
|
565
|
+
PARKING = "parking",
|
|
566
|
+
WIFI = "wifi",
|
|
567
|
+
WHEELCHAIR_ACCESS = "wheelchair_access",
|
|
568
|
+
CAFE = "cafe",
|
|
569
|
+
PHARMACY = "pharmacy",
|
|
570
|
+
WAITING_ROOM = "waiting_room",
|
|
571
|
+
CARD_PAYMENT = "card_payment",
|
|
572
|
+
INSURANCE = "insurance",
|
|
573
|
+
CHILDREN_AREA = "children_area",
|
|
574
|
+
TV = "tv",
|
|
575
|
+
AIR_CONDITIONING = "air_conditioning",
|
|
576
|
+
WATER_DISPENSER = "water_dispenser",
|
|
577
|
+
VENDING_MACHINE = "vending_machine",
|
|
578
|
+
ELEVATOR = "elevator",
|
|
579
|
+
RAMP = "ramp",
|
|
580
|
+
HANDICAP_PARKING = "handicap_parking",
|
|
581
|
+
BRAILLE = "braille",
|
|
582
|
+
SIGN_LANGUAGE = "sign_language",
|
|
583
|
+
EMERGENCY_SERVICE = "emergency_service",
|
|
584
|
+
LAB = "lab",
|
|
585
|
+
XRAY = "xray",
|
|
586
|
+
ULTRASOUND = "ultrasound",
|
|
587
|
+
DENTAL = "dental",
|
|
588
|
+
PEDIATRIC = "pediatric",
|
|
589
|
+
GYNECOLOGY = "gynecology",
|
|
590
|
+
CARDIOLOGY = "cardiology",
|
|
591
|
+
DERMATOLOGY = "dermatology",
|
|
592
|
+
ORTHOPEDIC = "orthopedic",
|
|
593
|
+
OPHTHALMOLOGY = "ophthalmology",
|
|
594
|
+
TELEMEDICINE = "telemedicine",
|
|
595
|
+
HOME_VISITS = "home_visits",
|
|
596
|
+
ONLINE_BOOKING = "online_booking",
|
|
597
|
+
MOBILE_APP = "mobile_app",
|
|
598
|
+
SMS_NOTIFICATIONS = "sms_notifications",
|
|
599
|
+
EMAIL_NOTIFICATIONS = "email_notifications",
|
|
600
|
+
ENGLISH = "english",
|
|
601
|
+
SERBIAN = "serbian",
|
|
602
|
+
GERMAN = "german",
|
|
603
|
+
RUSSIAN = "russian",
|
|
604
|
+
CHINESE = "chinese",
|
|
605
|
+
SPANISH = "spanish",
|
|
606
|
+
FRENCH = "french",
|
|
607
|
+
OPEN_24_7 = "open_24_7",
|
|
608
|
+
WEEKEND_HOURS = "weekend_hours",
|
|
609
|
+
NIGHT_SHIFT = "night_shift",
|
|
610
|
+
HOLIDAY_HOURS = "holiday_hours"
|
|
781
611
|
}
|
|
612
|
+
|
|
782
613
|
/**
|
|
783
|
-
*
|
|
614
|
+
* Enum for practitioner invite status
|
|
784
615
|
*/
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
issueDate: Timestamp | Date;
|
|
791
|
-
expiryDate?: Timestamp | Date | null;
|
|
792
|
-
verificationStatus: "pending" | "verified" | "rejected";
|
|
616
|
+
declare enum PractitionerInviteStatus {
|
|
617
|
+
PENDING = "pending",
|
|
618
|
+
ACCEPTED = "accepted",
|
|
619
|
+
REJECTED = "rejected",
|
|
620
|
+
CANCELLED = "cancelled"
|
|
793
621
|
}
|
|
794
622
|
/**
|
|
795
|
-
*
|
|
623
|
+
* Interface for proposed working hours in practitioner invite
|
|
796
624
|
*/
|
|
797
|
-
interface
|
|
625
|
+
interface ProposedWorkingHours {
|
|
626
|
+
monday: {
|
|
627
|
+
start: string;
|
|
628
|
+
end: string;
|
|
629
|
+
} | null;
|
|
630
|
+
tuesday: {
|
|
631
|
+
start: string;
|
|
632
|
+
end: string;
|
|
633
|
+
} | null;
|
|
634
|
+
wednesday: {
|
|
635
|
+
start: string;
|
|
636
|
+
end: string;
|
|
637
|
+
} | null;
|
|
638
|
+
thursday: {
|
|
639
|
+
start: string;
|
|
640
|
+
end: string;
|
|
641
|
+
} | null;
|
|
642
|
+
friday: {
|
|
643
|
+
start: string;
|
|
644
|
+
end: string;
|
|
645
|
+
} | null;
|
|
646
|
+
saturday: {
|
|
647
|
+
start: string;
|
|
648
|
+
end: string;
|
|
649
|
+
} | null;
|
|
650
|
+
sunday: {
|
|
651
|
+
start: string;
|
|
652
|
+
end: string;
|
|
653
|
+
} | null;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Main interface for practitioner invite
|
|
657
|
+
*/
|
|
658
|
+
interface PractitionerInvite {
|
|
659
|
+
id: string;
|
|
660
|
+
practitionerId: string;
|
|
798
661
|
clinicId: string;
|
|
799
|
-
|
|
800
|
-
|
|
662
|
+
practitionerInfo: PractitionerProfileInfo;
|
|
663
|
+
clinicInfo: ClinicInfo;
|
|
664
|
+
proposedWorkingHours: ProposedWorkingHours;
|
|
665
|
+
status: PractitionerInviteStatus;
|
|
666
|
+
invitedBy: string;
|
|
667
|
+
message?: string | null;
|
|
668
|
+
rejectionReason?: string | null;
|
|
669
|
+
cancelReason?: string | null;
|
|
670
|
+
createdAt: Timestamp;
|
|
671
|
+
updatedAt: Timestamp;
|
|
672
|
+
acceptedAt?: Timestamp | null;
|
|
673
|
+
rejectedAt?: Timestamp | null;
|
|
674
|
+
cancelledAt?: Timestamp | null;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Interface for clinic contact information
|
|
679
|
+
*/
|
|
680
|
+
interface ClinicContactInfo {
|
|
681
|
+
email: string;
|
|
682
|
+
phoneNumber: string;
|
|
683
|
+
alternativePhoneNumber?: string | null;
|
|
684
|
+
website?: string | null;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Interface for clinic location
|
|
688
|
+
*/
|
|
689
|
+
interface ClinicLocation {
|
|
690
|
+
address: string;
|
|
691
|
+
city: string;
|
|
692
|
+
country: string;
|
|
693
|
+
postalCode: string;
|
|
694
|
+
latitude: number;
|
|
695
|
+
longitude: number;
|
|
696
|
+
geohash?: string | null;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Interface for working hours
|
|
700
|
+
*/
|
|
701
|
+
interface WorkingHours {
|
|
702
|
+
monday: {
|
|
703
|
+
open: string;
|
|
704
|
+
close: string;
|
|
705
|
+
breaks?: {
|
|
801
706
|
start: string;
|
|
802
707
|
end: string;
|
|
803
|
-
}
|
|
804
|
-
|
|
708
|
+
}[];
|
|
709
|
+
} | null;
|
|
710
|
+
tuesday: {
|
|
711
|
+
open: string;
|
|
712
|
+
close: string;
|
|
713
|
+
breaks?: {
|
|
805
714
|
start: string;
|
|
806
715
|
end: string;
|
|
807
|
-
}
|
|
808
|
-
|
|
716
|
+
}[];
|
|
717
|
+
} | null;
|
|
718
|
+
wednesday: {
|
|
719
|
+
open: string;
|
|
720
|
+
close: string;
|
|
721
|
+
breaks?: {
|
|
809
722
|
start: string;
|
|
810
723
|
end: string;
|
|
811
|
-
}
|
|
812
|
-
|
|
724
|
+
}[];
|
|
725
|
+
} | null;
|
|
726
|
+
thursday: {
|
|
727
|
+
open: string;
|
|
728
|
+
close: string;
|
|
729
|
+
breaks?: {
|
|
813
730
|
start: string;
|
|
814
731
|
end: string;
|
|
815
|
-
}
|
|
816
|
-
|
|
732
|
+
}[];
|
|
733
|
+
} | null;
|
|
734
|
+
friday: {
|
|
735
|
+
open: string;
|
|
736
|
+
close: string;
|
|
737
|
+
breaks?: {
|
|
817
738
|
start: string;
|
|
818
739
|
end: string;
|
|
819
|
-
}
|
|
820
|
-
|
|
740
|
+
}[];
|
|
741
|
+
} | null;
|
|
742
|
+
saturday: {
|
|
743
|
+
open: string;
|
|
744
|
+
close: string;
|
|
745
|
+
breaks?: {
|
|
821
746
|
start: string;
|
|
822
747
|
end: string;
|
|
823
|
-
}
|
|
824
|
-
|
|
748
|
+
}[];
|
|
749
|
+
} | null;
|
|
750
|
+
sunday: {
|
|
751
|
+
open: string;
|
|
752
|
+
close: string;
|
|
753
|
+
breaks?: {
|
|
825
754
|
start: string;
|
|
826
755
|
end: string;
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
756
|
+
}[];
|
|
757
|
+
} | null;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Interface for doctor information
|
|
761
|
+
*/
|
|
762
|
+
interface DoctorInfo {
|
|
763
|
+
id: string;
|
|
764
|
+
name: string;
|
|
765
|
+
description?: string;
|
|
766
|
+
photo: string | null;
|
|
767
|
+
rating: number;
|
|
768
|
+
services: string[];
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Interface for clinic
|
|
772
|
+
*/
|
|
773
|
+
interface Clinic {
|
|
774
|
+
id: string;
|
|
775
|
+
clinicGroupId: string;
|
|
776
|
+
name: string;
|
|
777
|
+
description?: string;
|
|
778
|
+
location: ClinicLocation;
|
|
779
|
+
contactInfo: ClinicContactInfo;
|
|
780
|
+
workingHours: WorkingHours;
|
|
781
|
+
tags: ClinicTag[];
|
|
782
|
+
featuredPhotos: MediaResource[];
|
|
783
|
+
coverPhoto: MediaResource | null;
|
|
784
|
+
photosWithTags?: {
|
|
785
|
+
url: MediaResource;
|
|
786
|
+
tag: string;
|
|
787
|
+
}[];
|
|
788
|
+
doctors: string[];
|
|
789
|
+
doctorsInfo: DoctorInfo[];
|
|
790
|
+
procedures: string[];
|
|
791
|
+
proceduresInfo: ProcedureSummaryInfo[];
|
|
792
|
+
reviewInfo: ClinicReviewInfo;
|
|
793
|
+
admins: string[];
|
|
794
|
+
createdAt: Timestamp;
|
|
795
|
+
updatedAt: Timestamp;
|
|
796
|
+
isActive: boolean;
|
|
797
|
+
isVerified: boolean;
|
|
798
|
+
logo?: MediaResource | null;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Osnovne informacije o zdravstvenom radniku
|
|
803
|
+
*/
|
|
804
|
+
interface PractitionerBasicInfo {
|
|
805
|
+
firstName: string;
|
|
806
|
+
lastName: string;
|
|
807
|
+
title: string;
|
|
808
|
+
email: string;
|
|
809
|
+
phoneNumber: string | null;
|
|
810
|
+
dateOfBirth: Timestamp | Date | null;
|
|
811
|
+
gender: "male" | "female" | "other";
|
|
812
|
+
profileImageUrl?: MediaResource | null;
|
|
813
|
+
bio?: string;
|
|
814
|
+
languages: string[];
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Sertifikacija zdravstvenog radnika
|
|
818
|
+
*/
|
|
819
|
+
interface PractitionerCertification {
|
|
820
|
+
level: CertificationLevel;
|
|
821
|
+
specialties: CertificationSpecialty[];
|
|
822
|
+
licenseNumber: string;
|
|
823
|
+
issuingAuthority: string;
|
|
824
|
+
issueDate: Timestamp | Date;
|
|
825
|
+
expiryDate?: Timestamp | Date | null;
|
|
826
|
+
verificationStatus: "pending" | "verified" | "rejected";
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Interfejs za radno vreme zdravstvenog radnika u klinici
|
|
830
|
+
*/
|
|
831
|
+
interface PractitionerClinicWorkingHours {
|
|
832
|
+
clinicId: string;
|
|
833
|
+
workingHours: {
|
|
834
|
+
monday: {
|
|
835
|
+
start: string;
|
|
836
|
+
end: string;
|
|
837
|
+
} | null;
|
|
838
|
+
tuesday: {
|
|
839
|
+
start: string;
|
|
840
|
+
end: string;
|
|
841
|
+
} | null;
|
|
842
|
+
wednesday: {
|
|
843
|
+
start: string;
|
|
844
|
+
end: string;
|
|
845
|
+
} | null;
|
|
846
|
+
thursday: {
|
|
847
|
+
start: string;
|
|
848
|
+
end: string;
|
|
849
|
+
} | null;
|
|
850
|
+
friday: {
|
|
851
|
+
start: string;
|
|
852
|
+
end: string;
|
|
853
|
+
} | null;
|
|
854
|
+
saturday: {
|
|
855
|
+
start: string;
|
|
856
|
+
end: string;
|
|
857
|
+
} | null;
|
|
858
|
+
sunday: {
|
|
859
|
+
start: string;
|
|
860
|
+
end: string;
|
|
861
|
+
} | null;
|
|
862
|
+
};
|
|
863
|
+
isActive: boolean;
|
|
864
|
+
createdAt: Timestamp | Date;
|
|
865
|
+
updatedAt: Timestamp | Date;
|
|
832
866
|
}
|
|
833
867
|
/**
|
|
834
868
|
* Status of practitioner profile
|
|
@@ -888,6 +922,8 @@ interface PractitionerToken {
|
|
|
888
922
|
emailErrorAt?: Timestamp;
|
|
889
923
|
}
|
|
890
924
|
|
|
925
|
+
declare const PATIENTS_COLLECTION = "patients";
|
|
926
|
+
declare const PATIENT_SENSITIVE_INFO_COLLECTION = "sensitive-info";
|
|
891
927
|
/**
|
|
892
928
|
* Enumeracija za pol pacijenta
|
|
893
929
|
*/
|
|
@@ -899,6 +935,24 @@ declare enum Gender {
|
|
|
899
935
|
PREFER_NOT_TO_SAY = "prefer_not_to_say",
|
|
900
936
|
OTHER = "other"
|
|
901
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* Interfejs za adresne podatke
|
|
940
|
+
*/
|
|
941
|
+
interface AddressData {
|
|
942
|
+
address: string;
|
|
943
|
+
city: string;
|
|
944
|
+
country: string;
|
|
945
|
+
postalCode: string;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Interfejs za kontakt za hitne slučajeve
|
|
949
|
+
*/
|
|
950
|
+
interface EmergencyContact {
|
|
951
|
+
name: string;
|
|
952
|
+
relationship: string;
|
|
953
|
+
phoneNumber: string;
|
|
954
|
+
isNotifiable: boolean;
|
|
955
|
+
}
|
|
902
956
|
/**
|
|
903
957
|
* Interfejs za gamifikaciju
|
|
904
958
|
*/
|
|
@@ -908,6 +962,25 @@ interface GamificationInfo {
|
|
|
908
962
|
/** Trenutni poeni */
|
|
909
963
|
points: number;
|
|
910
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Interfejs za osetljive informacije pacijenta (subkolekcija)
|
|
967
|
+
*/
|
|
968
|
+
interface PatientSensitiveInfo {
|
|
969
|
+
patientId: string;
|
|
970
|
+
userRef?: string;
|
|
971
|
+
photoUrl?: string | null;
|
|
972
|
+
firstName: string;
|
|
973
|
+
lastName: string;
|
|
974
|
+
dateOfBirth: Timestamp | null;
|
|
975
|
+
gender: Gender;
|
|
976
|
+
email?: string;
|
|
977
|
+
phoneNumber?: string;
|
|
978
|
+
alternativePhoneNumber?: string;
|
|
979
|
+
addressData?: AddressData;
|
|
980
|
+
emergencyContacts?: EmergencyContact[];
|
|
981
|
+
createdAt: Timestamp;
|
|
982
|
+
updatedAt: Timestamp;
|
|
983
|
+
}
|
|
911
984
|
/**
|
|
912
985
|
* Interfejs za doktora pacijenta
|
|
913
986
|
*/
|
|
@@ -933,12 +1006,13 @@ interface PatientClinic {
|
|
|
933
1006
|
*/
|
|
934
1007
|
interface PatientProfile {
|
|
935
1008
|
id: string;
|
|
936
|
-
userRef
|
|
1009
|
+
userRef?: string;
|
|
937
1010
|
displayName: string;
|
|
938
1011
|
gamification: GamificationInfo;
|
|
939
1012
|
expoTokens: string[];
|
|
940
1013
|
isActive: boolean;
|
|
941
1014
|
isVerified: boolean;
|
|
1015
|
+
isManual: boolean;
|
|
942
1016
|
phoneNumber?: string | null;
|
|
943
1017
|
dateOfBirth?: Timestamp | null;
|
|
944
1018
|
doctors: PatientDoctor[];
|
|
@@ -984,244 +1058,539 @@ interface PatientProfileInfo {
|
|
|
984
1058
|
}
|
|
985
1059
|
|
|
986
1060
|
/**
|
|
987
|
-
* Enum for
|
|
1061
|
+
* Enum for element types in documentation templates
|
|
988
1062
|
*/
|
|
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"
|
|
1063
|
+
declare enum DocumentElementType {
|
|
1064
|
+
HEADING = "heading",
|
|
1065
|
+
PARAGRAPH = "paragraph",
|
|
1066
|
+
LIST = "list",
|
|
1067
|
+
DYNAMIC_TEXT = "dynamic_text",
|
|
1068
|
+
BINARY_CHOICE = "binary_choice",
|
|
1069
|
+
MULTIPLE_CHOICE = "multiple_choice",
|
|
1070
|
+
SINGLE_CHOICE = "single_choice",
|
|
1071
|
+
RATING_SCALE = "rating_scale",
|
|
1072
|
+
TEXT_INPUT = "text_input",
|
|
1073
|
+
DATE_PICKER = "date_picker",
|
|
1074
|
+
SIGNATURE = "signature",
|
|
1075
|
+
DITIGAL_SIGNATURE = "digital_signature",
|
|
1076
|
+
FILE_UPLOAD = "file_upload"
|
|
1036
1077
|
}
|
|
1037
|
-
|
|
1038
1078
|
/**
|
|
1039
|
-
* Enum for
|
|
1079
|
+
* Enum for list types
|
|
1040
1080
|
*/
|
|
1041
|
-
declare enum
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
REJECTED = "rejected",
|
|
1045
|
-
CANCELLED = "cancelled"
|
|
1081
|
+
declare enum ListType {
|
|
1082
|
+
ORDERED = "ordered",
|
|
1083
|
+
UNORDERED = "unordered"
|
|
1046
1084
|
}
|
|
1047
1085
|
/**
|
|
1048
|
-
*
|
|
1086
|
+
* Enum for heading levels
|
|
1049
1087
|
*/
|
|
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;
|
|
1088
|
+
declare enum HeadingLevel {
|
|
1089
|
+
H1 = "h1",
|
|
1090
|
+
H2 = "h2",
|
|
1091
|
+
H3 = "h3",
|
|
1092
|
+
H4 = "h4",
|
|
1093
|
+
H5 = "h5",
|
|
1094
|
+
H6 = "h6"
|
|
1079
1095
|
}
|
|
1080
1096
|
/**
|
|
1081
|
-
*
|
|
1097
|
+
* Base interface for all document elements
|
|
1082
1098
|
*/
|
|
1083
|
-
interface
|
|
1099
|
+
interface BaseDocumentElement {
|
|
1084
1100
|
id: string;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1101
|
+
type: DocumentElementType;
|
|
1102
|
+
required?: boolean;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Interface for heading element
|
|
1106
|
+
*/
|
|
1107
|
+
interface HeadingElement extends BaseDocumentElement {
|
|
1108
|
+
type: DocumentElementType.HEADING;
|
|
1109
|
+
text: string;
|
|
1110
|
+
level: HeadingLevel;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Interface for paragraph element
|
|
1114
|
+
*/
|
|
1115
|
+
interface ParagraphElement extends BaseDocumentElement {
|
|
1116
|
+
type: DocumentElementType.PARAGRAPH;
|
|
1117
|
+
text: string;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Interface for list element
|
|
1121
|
+
*/
|
|
1122
|
+
interface ListElement extends BaseDocumentElement {
|
|
1123
|
+
type: DocumentElementType.LIST;
|
|
1124
|
+
items: string[];
|
|
1125
|
+
listType: ListType;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Interface for dynamic text element
|
|
1129
|
+
*/
|
|
1130
|
+
interface DynamicTextElement extends BaseDocumentElement {
|
|
1131
|
+
type: DocumentElementType.DYNAMIC_TEXT;
|
|
1132
|
+
text: string;
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Interface for binary choice element (Yes/No)
|
|
1136
|
+
*/
|
|
1137
|
+
interface BinaryChoiceElement extends BaseDocumentElement {
|
|
1138
|
+
type: DocumentElementType.BINARY_CHOICE;
|
|
1139
|
+
question: string;
|
|
1140
|
+
defaultValue?: boolean;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Interface for multiple choice element
|
|
1144
|
+
*/
|
|
1145
|
+
interface MultipleChoiceElement extends BaseDocumentElement {
|
|
1146
|
+
type: DocumentElementType.MULTIPLE_CHOICE;
|
|
1147
|
+
question: string;
|
|
1148
|
+
options: string[];
|
|
1149
|
+
defaultValues?: string[];
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Interface for single choice element
|
|
1153
|
+
*/
|
|
1154
|
+
interface SingleChoiceElement extends BaseDocumentElement {
|
|
1155
|
+
type: DocumentElementType.SINGLE_CHOICE;
|
|
1156
|
+
question: string;
|
|
1157
|
+
options: string[];
|
|
1158
|
+
defaultValue?: string;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Interface for rating scale element
|
|
1162
|
+
*/
|
|
1163
|
+
interface RatingScaleElement extends BaseDocumentElement {
|
|
1164
|
+
type: DocumentElementType.RATING_SCALE;
|
|
1165
|
+
question: string;
|
|
1166
|
+
min: number;
|
|
1167
|
+
max: number;
|
|
1168
|
+
labels?: {
|
|
1169
|
+
[key: number]: string;
|
|
1170
|
+
};
|
|
1171
|
+
defaultValue?: number;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Interface for text input element
|
|
1175
|
+
*/
|
|
1176
|
+
interface TextInputElement extends BaseDocumentElement {
|
|
1177
|
+
type: DocumentElementType.TEXT_INPUT;
|
|
1178
|
+
label: string;
|
|
1179
|
+
placeholder?: string;
|
|
1180
|
+
multiline?: boolean;
|
|
1181
|
+
defaultValue?: string;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Interface for date picker element
|
|
1185
|
+
*/
|
|
1186
|
+
interface DatePickerElement extends BaseDocumentElement {
|
|
1187
|
+
type: DocumentElementType.DATE_PICKER;
|
|
1188
|
+
label: string;
|
|
1189
|
+
defaultValue?: string;
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Interface for signature element
|
|
1193
|
+
*/
|
|
1194
|
+
interface SignatureElement extends BaseDocumentElement {
|
|
1195
|
+
type: DocumentElementType.SIGNATURE;
|
|
1196
|
+
label: string;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Interface for file upload element
|
|
1200
|
+
*/
|
|
1201
|
+
interface FileUploadElement extends BaseDocumentElement {
|
|
1202
|
+
type: DocumentElementType.FILE_UPLOAD;
|
|
1203
|
+
label: string;
|
|
1204
|
+
allowedFileTypes?: string[];
|
|
1205
|
+
maxFileSizeMB?: number;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Union type for all document elements
|
|
1209
|
+
*/
|
|
1210
|
+
type DocumentElement = HeadingElement | ParagraphElement | ListElement | DynamicTextElement | BinaryChoiceElement | MultipleChoiceElement | SingleChoiceElement | RatingScaleElement | TextInputElement | DatePickerElement | SignatureElement | FileUploadElement;
|
|
1211
|
+
/**
|
|
1212
|
+
* Interface for document template
|
|
1213
|
+
*/
|
|
1214
|
+
interface DocumentTemplate {
|
|
1215
|
+
id: string;
|
|
1216
|
+
title: string;
|
|
1217
|
+
description?: string;
|
|
1218
|
+
createdAt: number;
|
|
1219
|
+
updatedAt: number;
|
|
1220
|
+
createdBy: string;
|
|
1221
|
+
elements: DocumentElement[];
|
|
1222
|
+
tags?: string[];
|
|
1223
|
+
isUserForm?: boolean;
|
|
1224
|
+
isRequired?: boolean;
|
|
1225
|
+
sortingOrder?: number;
|
|
1226
|
+
version: number;
|
|
1227
|
+
isActive: boolean;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Interface for a filled document (completed form)
|
|
1231
|
+
*/
|
|
1232
|
+
interface FilledDocument {
|
|
1233
|
+
id: string;
|
|
1234
|
+
templateId: string;
|
|
1235
|
+
templateVersion: number;
|
|
1236
|
+
isUserForm: boolean;
|
|
1237
|
+
isRequired: boolean;
|
|
1238
|
+
procedureId: string;
|
|
1239
|
+
appointmentId: string;
|
|
1240
|
+
patientId: string;
|
|
1241
|
+
practitionerId: string;
|
|
1242
|
+
clinicId: string;
|
|
1243
|
+
createdAt: number;
|
|
1244
|
+
updatedAt: number;
|
|
1245
|
+
values: {
|
|
1246
|
+
[elementId: string]: any | FilledDocumentFileValue;
|
|
1247
|
+
};
|
|
1248
|
+
status: FilledDocumentStatus;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Enum for filled document status
|
|
1252
|
+
*/
|
|
1253
|
+
declare enum FilledDocumentStatus {
|
|
1254
|
+
DRAFT = "draft",
|
|
1255
|
+
SKIPPED = "skipped",
|
|
1256
|
+
PENDING = "pending",
|
|
1257
|
+
COMPLETED = "completed",// When doctor or patient completes the form
|
|
1258
|
+
SIGNED = "signed",// Only used for user forms
|
|
1259
|
+
REJECTED = "rejected"
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Interface for file upload results to be stored in filled document values
|
|
1263
|
+
*/
|
|
1264
|
+
interface FilledDocumentFileValue {
|
|
1265
|
+
mediaId: string;
|
|
1266
|
+
url: string;
|
|
1267
|
+
name: string;
|
|
1268
|
+
contentType: string;
|
|
1269
|
+
size: number;
|
|
1270
|
+
uploadedAt: number;
|
|
1100
1271
|
}
|
|
1101
1272
|
|
|
1102
1273
|
/**
|
|
1103
|
-
*
|
|
1274
|
+
* Enum defining the possible statuses of an appointment.
|
|
1104
1275
|
*/
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1276
|
+
declare enum AppointmentStatus {
|
|
1277
|
+
PENDING = "pending",// Initial state after booking, before confirmation (if applicable)
|
|
1278
|
+
CONFIRMED = "confirmed",// Confirmed by clinic/practitioner
|
|
1279
|
+
CHECKED_IN = "checked_in",// Patient has arrived
|
|
1280
|
+
IN_PROGRESS = "in_progress",// Procedure has started
|
|
1281
|
+
COMPLETED = "completed",// Procedure finished successfully
|
|
1282
|
+
CANCELED_PATIENT = "canceled_patient",// Canceled by the patient
|
|
1283
|
+
CANCELED_PATIENT_RESCHEDULED = "canceled_patient_rescheduled",// Canceled by the patient and rescheduled by the clinic
|
|
1284
|
+
CANCELED_CLINIC = "canceled_clinic",// Canceled by the clinic/practitioner
|
|
1285
|
+
NO_SHOW = "no_show",// Patient did not attend
|
|
1286
|
+
RESCHEDULED_BY_CLINIC = "rescheduled_by_clinic"
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Enum defining the payment status of an appointment.
|
|
1290
|
+
*/
|
|
1291
|
+
declare enum PaymentStatus {
|
|
1292
|
+
UNPAID = "unpaid",
|
|
1293
|
+
PAID = "paid",
|
|
1294
|
+
PARTIALLY_PAID = "partially_paid",
|
|
1295
|
+
REFUNDED = "refunded",
|
|
1296
|
+
NOT_APPLICABLE = "not_applicable"
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Enum for different types of media that can be attached to an appointment.
|
|
1300
|
+
*/
|
|
1301
|
+
declare enum MediaType {
|
|
1302
|
+
BEFORE_PHOTO = "before_photo",
|
|
1303
|
+
AFTER_PHOTO = "after_photo",
|
|
1304
|
+
CONSENT_SCAN = "consent_scan",
|
|
1305
|
+
OTHER_DOCUMENT = "other_document"
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Interface to describe a media file linked to an appointment.
|
|
1309
|
+
*/
|
|
1310
|
+
interface AppointmentMediaItem {
|
|
1311
|
+
id: string;
|
|
1312
|
+
type: MediaType;
|
|
1313
|
+
url: string;
|
|
1314
|
+
fileName?: string;
|
|
1315
|
+
uploadedAt: Timestamp;
|
|
1316
|
+
uploadedBy: string;
|
|
1317
|
+
description?: string;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Interface for procedure-specific information
|
|
1321
|
+
*/
|
|
1322
|
+
interface ProcedureExtendedInfo {
|
|
1323
|
+
id: string;
|
|
1324
|
+
name: string;
|
|
1325
|
+
description: string;
|
|
1326
|
+
cost: number;
|
|
1327
|
+
duration: number;
|
|
1328
|
+
procedureFamily: ProcedureFamily;
|
|
1329
|
+
procedureCategoryId: string;
|
|
1330
|
+
procedureCategoryName: string;
|
|
1331
|
+
procedureSubCategoryId: string;
|
|
1332
|
+
procedureSubCategoryName: string;
|
|
1333
|
+
procedureTechnologyId: string;
|
|
1334
|
+
procedureTechnologyName: string;
|
|
1335
|
+
procedureProductBrandId: string;
|
|
1336
|
+
procedureProductBrandName: string;
|
|
1337
|
+
procedureProductId: string;
|
|
1338
|
+
procedureProductName: string;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Interface to describe a filled form linked to an appointment.
|
|
1342
|
+
*/
|
|
1343
|
+
interface LinkedFormInfo {
|
|
1344
|
+
formId: string;
|
|
1345
|
+
templateId: string;
|
|
1346
|
+
templateVersion: number;
|
|
1347
|
+
title: string;
|
|
1348
|
+
isUserForm: boolean;
|
|
1349
|
+
isRequired?: boolean;
|
|
1350
|
+
sortingOrder?: number;
|
|
1351
|
+
status: FilledDocumentStatus;
|
|
1352
|
+
path: string;
|
|
1353
|
+
submittedAt?: Timestamp;
|
|
1354
|
+
completedAt?: Timestamp;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Interface for summarized patient review information linked to an appointment.
|
|
1358
|
+
*/
|
|
1359
|
+
interface PatientReviewInfo {
|
|
1360
|
+
reviewId: string;
|
|
1361
|
+
rating: number;
|
|
1362
|
+
comment?: string;
|
|
1363
|
+
reviewedAt: Timestamp;
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Interface for before/after photos and notes per zone
|
|
1367
|
+
*/
|
|
1368
|
+
interface BeforeAfterPerZone {
|
|
1369
|
+
/** URL for before photo or null if not available */
|
|
1370
|
+
before: MediaResource | null;
|
|
1371
|
+
/** URL for after photo or null if not available */
|
|
1372
|
+
after: MediaResource | null;
|
|
1373
|
+
/** Optional note for the zone */
|
|
1374
|
+
note: string | null;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Interface for billing information per zone
|
|
1378
|
+
*/
|
|
1379
|
+
interface BillingPerZone {
|
|
1380
|
+
/** Product name/description */
|
|
1381
|
+
Product: string;
|
|
1382
|
+
/** Product ID */
|
|
1383
|
+
ProductId: string | null;
|
|
1384
|
+
/** Quantity used (can be decimal) */
|
|
1385
|
+
Quantity: number;
|
|
1386
|
+
/** Unit of measurement */
|
|
1387
|
+
UnitOfMeasurement: PricingMeasure;
|
|
1388
|
+
/** Unit price for the product */
|
|
1389
|
+
UnitPrice: number;
|
|
1390
|
+
/** Currency for the unit price */
|
|
1391
|
+
UnitCurency: Currency;
|
|
1392
|
+
/** Calculated subtotal */
|
|
1393
|
+
Subtotal: number;
|
|
1394
|
+
/** Optional billing note */
|
|
1395
|
+
Note: string | null;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Interface for final billing calculations of the appointment
|
|
1399
|
+
*/
|
|
1400
|
+
interface FinalBilling {
|
|
1401
|
+
/** Total of all subtotals from all zones */
|
|
1402
|
+
subtotalAll: number;
|
|
1403
|
+
/** Tax rate as percentage (e.g., 0.20 for 20%) */
|
|
1404
|
+
taxRate: number;
|
|
1405
|
+
/** Calculated tax amount */
|
|
1406
|
+
taxPrice: number;
|
|
1407
|
+
/** Final price including tax */
|
|
1408
|
+
finalPrice: number;
|
|
1409
|
+
/** Total final quantity across all zones */
|
|
1410
|
+
finalQuantity: number;
|
|
1411
|
+
/** Currency for the final billing */
|
|
1412
|
+
currency: Currency;
|
|
1413
|
+
/** Unit of measurement for the final billing */
|
|
1414
|
+
unitOfMeasurement: PricingMeasure;
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Interface for appointment metadata containing zone-specific information
|
|
1418
|
+
*/
|
|
1419
|
+
interface AppointmentMetadata {
|
|
1420
|
+
/** Array of selected zones for the appointment */
|
|
1421
|
+
selectedZones: string[] | null;
|
|
1422
|
+
/** Map of zone photos with before/after images and notes */
|
|
1423
|
+
zonePhotos: Record<string, BeforeAfterPerZone> | null;
|
|
1424
|
+
/** Map of billing information per zone */
|
|
1425
|
+
zoneBilling: Record<string, BillingPerZone> | null;
|
|
1426
|
+
/** Final billing calculations for the appointment */
|
|
1427
|
+
finalbilling: FinalBilling | null;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Represents a booked appointment, aggregating key information and relevant procedure rules.
|
|
1431
|
+
*/
|
|
1432
|
+
interface Appointment {
|
|
1433
|
+
/** Unique identifier for the appointment */
|
|
1434
|
+
id: string;
|
|
1435
|
+
/** Reference to the associated CalendarEvent */
|
|
1436
|
+
calendarEventId: string;
|
|
1437
|
+
/** ID of the clinic branch */
|
|
1438
|
+
clinicBranchId: string;
|
|
1439
|
+
/** Aggregated clinic information (snapshot) */
|
|
1440
|
+
clinicInfo: ClinicInfo;
|
|
1441
|
+
/** ID of the practitioner */
|
|
1442
|
+
practitionerId: string;
|
|
1443
|
+
/** Aggregated practitioner information (snapshot) */
|
|
1444
|
+
practitionerInfo: PractitionerProfileInfo;
|
|
1445
|
+
/** ID of the patient */
|
|
1446
|
+
patientId: string;
|
|
1447
|
+
/** Aggregated patient information (snapshot) */
|
|
1448
|
+
patientInfo: PatientProfileInfo;
|
|
1449
|
+
/** ID of the procedure */
|
|
1450
|
+
procedureId: string;
|
|
1451
|
+
/** Aggregated procedure information including product/brand (snapshot) */
|
|
1452
|
+
procedureInfo: ProcedureSummaryInfo;
|
|
1453
|
+
/** Extended procedure information */
|
|
1454
|
+
procedureExtendedInfo: ProcedureExtendedInfo;
|
|
1455
|
+
/** Status of the appointment */
|
|
1456
|
+
status: AppointmentStatus;
|
|
1457
|
+
/** Timestamps */
|
|
1458
|
+
bookingTime: Timestamp;
|
|
1459
|
+
confirmationTime?: Timestamp | null;
|
|
1460
|
+
cancellationTime?: Timestamp | null;
|
|
1461
|
+
rescheduleTime?: Timestamp | null;
|
|
1462
|
+
appointmentStartTime: Timestamp;
|
|
1463
|
+
appointmentEndTime: Timestamp;
|
|
1464
|
+
procedureActualStartTime?: Timestamp | null;
|
|
1465
|
+
actualDurationMinutes?: number;
|
|
1466
|
+
/** Cancellation Details */
|
|
1467
|
+
cancellationReason?: string | null;
|
|
1468
|
+
canceledBy?: "patient" | "clinic" | "practitioner" | "system";
|
|
1469
|
+
/** Notes */
|
|
1470
|
+
internalNotes?: string | null;
|
|
1471
|
+
patientNotes?: string | null;
|
|
1472
|
+
/** Payment Details */
|
|
1473
|
+
cost: number;
|
|
1474
|
+
currency: Currency;
|
|
1475
|
+
paymentStatus: PaymentStatus;
|
|
1476
|
+
paymentTransactionId?: string | null;
|
|
1477
|
+
/** Procedure-related conditions and requirements */
|
|
1478
|
+
blockingConditions: BlockingCondition[];
|
|
1479
|
+
contraindications: Contraindication[];
|
|
1480
|
+
preProcedureRequirements: Requirement[];
|
|
1481
|
+
postProcedureRequirements: Requirement[];
|
|
1482
|
+
/** Tracking information for requirements completion */
|
|
1483
|
+
completedPreRequirements?: string[];
|
|
1484
|
+
completedPostRequirements?: string[];
|
|
1485
|
+
/** NEW: Linked forms (consent, procedure-specific forms, etc.) */
|
|
1486
|
+
linkedFormIds?: string[];
|
|
1487
|
+
linkedForms?: LinkedFormInfo[];
|
|
1488
|
+
pendingUserFormsIds?: string[];
|
|
1489
|
+
/** NEW: Media items (before/after photos, scanned documents, etc.) */
|
|
1490
|
+
media?: AppointmentMediaItem[];
|
|
1491
|
+
/** NEW: Information about the patient's review for this appointment */
|
|
1492
|
+
reviewInfo?: PatientReviewInfo | null;
|
|
1493
|
+
/** NEW: Details about the finalization of the appointment by the practitioner */
|
|
1494
|
+
finalizedDetails?: {
|
|
1495
|
+
by: string;
|
|
1496
|
+
at: Timestamp;
|
|
1497
|
+
notes?: string;
|
|
1498
|
+
};
|
|
1499
|
+
/** Timestamps for record creation and updates */
|
|
1500
|
+
createdAt: Timestamp;
|
|
1501
|
+
updatedAt: Timestamp;
|
|
1502
|
+
/** Recurring appointment information */
|
|
1503
|
+
isRecurring?: boolean;
|
|
1504
|
+
recurringAppointmentId?: string | null;
|
|
1505
|
+
/** NEW: Flag for soft deletion or archiving */
|
|
1506
|
+
isArchived?: boolean;
|
|
1507
|
+
/** NEW: Metadata for the appointment - used for area selection and photos */
|
|
1508
|
+
metadata?: AppointmentMetadata;
|
|
1110
1509
|
}
|
|
1111
1510
|
/**
|
|
1112
|
-
*
|
|
1511
|
+
* Data needed to create a new Appointment
|
|
1113
1512
|
*/
|
|
1114
|
-
interface
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1513
|
+
interface CreateAppointmentData {
|
|
1514
|
+
clinicBranchId: string;
|
|
1515
|
+
practitionerId: string;
|
|
1516
|
+
patientId: string;
|
|
1517
|
+
procedureId: string;
|
|
1518
|
+
appointmentStartTime: Timestamp;
|
|
1519
|
+
appointmentEndTime: Timestamp;
|
|
1520
|
+
cost: number;
|
|
1521
|
+
currency: Currency;
|
|
1522
|
+
patientNotes?: string | null;
|
|
1523
|
+
initialStatus: AppointmentStatus;
|
|
1524
|
+
initialPaymentStatus?: PaymentStatus;
|
|
1122
1525
|
}
|
|
1123
1526
|
/**
|
|
1124
|
-
*
|
|
1527
|
+
* Data needed to create a new Appointment via CreateAppointmentHttp method
|
|
1125
1528
|
*/
|
|
1126
|
-
interface
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
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;
|
|
1529
|
+
interface CreateAppointmentHttpData {
|
|
1530
|
+
patientId: string;
|
|
1531
|
+
procedureId: string;
|
|
1532
|
+
appointmentStartTime: Timestamp;
|
|
1533
|
+
appointmentEndTime: Timestamp;
|
|
1534
|
+
patientNotes?: string | null;
|
|
1183
1535
|
}
|
|
1184
1536
|
/**
|
|
1185
|
-
*
|
|
1537
|
+
* Data allowed for updating an Appointment
|
|
1186
1538
|
*/
|
|
1187
|
-
interface
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1539
|
+
interface UpdateAppointmentData {
|
|
1540
|
+
status?: AppointmentStatus;
|
|
1541
|
+
confirmationTime?: Timestamp | FieldValue | null;
|
|
1542
|
+
cancellationTime?: Timestamp | FieldValue | null;
|
|
1543
|
+
rescheduleTime?: Timestamp | FieldValue | null;
|
|
1544
|
+
procedureActualStartTime?: Timestamp | FieldValue | null;
|
|
1545
|
+
actualDurationMinutes?: number;
|
|
1546
|
+
cancellationReason?: string | null;
|
|
1547
|
+
canceledBy?: "patient" | "clinic" | "practitioner" | "system";
|
|
1548
|
+
internalNotes?: string | null;
|
|
1549
|
+
patientNotes?: string | FieldValue | null;
|
|
1550
|
+
paymentStatus?: PaymentStatus;
|
|
1551
|
+
paymentTransactionId?: string | FieldValue | null;
|
|
1552
|
+
completedPreRequirements?: string[] | FieldValue;
|
|
1553
|
+
completedPostRequirements?: string[] | FieldValue;
|
|
1554
|
+
appointmentStartTime?: Timestamp;
|
|
1555
|
+
appointmentEndTime?: Timestamp;
|
|
1556
|
+
calendarEventId?: string;
|
|
1557
|
+
cost?: number;
|
|
1558
|
+
clinicBranchId?: string;
|
|
1559
|
+
practitionerId?: string;
|
|
1560
|
+
/** NEW: For updating linked forms - typically managed by dedicated methods */
|
|
1561
|
+
linkedFormIds?: string[] | FieldValue;
|
|
1562
|
+
linkedForms?: LinkedFormInfo[] | FieldValue;
|
|
1563
|
+
/** NEW: For updating media items - typically managed by dedicated methods */
|
|
1564
|
+
media?: AppointmentMediaItem[] | FieldValue;
|
|
1565
|
+
/** NEW: For adding/updating review information */
|
|
1566
|
+
reviewInfo?: PatientReviewInfo | FieldValue | null;
|
|
1567
|
+
/** NEW: For setting practitioner finalization details */
|
|
1568
|
+
finalizedDetails?: {
|
|
1569
|
+
by: string;
|
|
1570
|
+
at: Timestamp;
|
|
1571
|
+
notes?: string;
|
|
1572
|
+
} | FieldValue;
|
|
1573
|
+
/** NEW: For archiving/unarchiving */
|
|
1574
|
+
isArchived?: boolean;
|
|
1575
|
+
updatedAt?: FieldValue;
|
|
1576
|
+
/** NEW: For updating metadata */
|
|
1577
|
+
metadata?: AppointmentMetadata;
|
|
1194
1578
|
}
|
|
1195
1579
|
/**
|
|
1196
|
-
*
|
|
1580
|
+
* Parameters for searching appointments
|
|
1197
1581
|
*/
|
|
1198
|
-
interface
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
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;
|
|
1582
|
+
interface SearchAppointmentsParams {
|
|
1583
|
+
patientId?: string;
|
|
1584
|
+
practitionerId?: string;
|
|
1585
|
+
clinicBranchId?: string;
|
|
1586
|
+
startDate?: Date;
|
|
1587
|
+
endDate?: Date;
|
|
1588
|
+
status?: AppointmentStatus | AppointmentStatus[];
|
|
1589
|
+
limit?: number;
|
|
1590
|
+
startAfter?: any;
|
|
1224
1591
|
}
|
|
1592
|
+
/** Firestore collection name */
|
|
1593
|
+
declare const APPOINTMENTS_COLLECTION = "appointments";
|
|
1225
1594
|
|
|
1226
1595
|
/**
|
|
1227
1596
|
* Enum for synced calendar provider
|
|
@@ -1290,36 +1659,91 @@ interface SyncedCalendarEvent {
|
|
|
1290
1659
|
/**
|
|
1291
1660
|
* Interface for calendar event
|
|
1292
1661
|
*/
|
|
1293
|
-
interface CalendarEvent {
|
|
1662
|
+
interface CalendarEvent {
|
|
1663
|
+
id: string;
|
|
1664
|
+
clinicBranchId?: string | null;
|
|
1665
|
+
clinicBranchInfo?: ClinicInfo | null;
|
|
1666
|
+
practitionerProfileId?: string | null;
|
|
1667
|
+
practitionerProfileInfo?: PractitionerProfileInfo | null;
|
|
1668
|
+
patientProfileId?: string | null;
|
|
1669
|
+
patientProfileInfo?: PatientProfileInfo | null;
|
|
1670
|
+
procedureId?: string | null;
|
|
1671
|
+
procedureInfo?: ProcedureInfo | null;
|
|
1672
|
+
procedureCategorization?: ProcedureCategorization | null;
|
|
1673
|
+
appointmentId?: string | null;
|
|
1674
|
+
syncedCalendarEventId?: SyncedCalendarEvent[] | null;
|
|
1675
|
+
eventName: string;
|
|
1676
|
+
eventLocation?: ClinicLocation;
|
|
1677
|
+
eventTime: CalendarEventTime;
|
|
1678
|
+
description?: string;
|
|
1679
|
+
status: CalendarEventStatus;
|
|
1680
|
+
syncStatus: CalendarSyncStatus;
|
|
1681
|
+
eventType: CalendarEventType;
|
|
1682
|
+
createdAt: Timestamp;
|
|
1683
|
+
updatedAt: Timestamp;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Defines the status of a specific instruction within a PatientRequirementInstance.
|
|
1688
|
+
* This helps track each actionable item for the patient.
|
|
1689
|
+
*/
|
|
1690
|
+
declare enum PatientInstructionStatus {
|
|
1691
|
+
PENDING_NOTIFICATION = "pendingNotification",// Notification is scheduled but not yet due/sent
|
|
1692
|
+
ACTION_DUE = "actionDue",// The time for this instruction/notification has arrived
|
|
1693
|
+
ACTION_TAKEN = "actionTaken",// Patient has acknowledged or completed this specific instruction
|
|
1694
|
+
MISSED = "missed",// The due time for this instruction passed without action
|
|
1695
|
+
CANCELLED = "cancelled",// This specific instruction was cancelled (e.g., requirement changed)
|
|
1696
|
+
SKIPPED = "skipped"
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Represents a single, timed instruction or notification point derived from a Requirement's timeframe.
|
|
1700
|
+
*/
|
|
1701
|
+
interface PatientRequirementInstruction {
|
|
1702
|
+
instructionId: string;
|
|
1703
|
+
instructionText: string;
|
|
1704
|
+
dueTime: Timestamp;
|
|
1705
|
+
actionableWindow: number;
|
|
1706
|
+
status: PatientInstructionStatus;
|
|
1707
|
+
originalNotifyAtValue: number;
|
|
1708
|
+
originalTimeframeUnit: TimeFrame["unit"];
|
|
1709
|
+
notificationId?: string;
|
|
1710
|
+
actionTakenAt?: Timestamp;
|
|
1711
|
+
updatedAt: Timestamp;
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Defines the overall status of a PatientRequirementInstance.
|
|
1715
|
+
*/
|
|
1716
|
+
declare enum PatientRequirementOverallStatus {
|
|
1717
|
+
ACTIVE = "active",// Requirement instance is active, instructions are pending or due.
|
|
1718
|
+
ALL_INSTRUCTIONS_MET = "allInstructionsMet",// All instructions actioned/completed by the patient.
|
|
1719
|
+
PARTIALLY_COMPLETED = "partiallyCompleted",// Some instructions met, some missed or pending.
|
|
1720
|
+
FAILED = "failed",// The patient failed to complete the requirement on time and above treashold of 60%
|
|
1721
|
+
CANCELLED_APPOINTMENT = "cancelledAppointment",// Entire requirement instance cancelled due to appointment cancellation.
|
|
1722
|
+
SUPERSEDED_RESCHEDULE = "supersededReschedule",// This instance was replaced by a new one due to appointment reschedule.
|
|
1723
|
+
FAILED_TO_PROCESS = "failedToProcess"
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Represents an instance of a backoffice Requirement, tailored to a specific patient and appointment.
|
|
1727
|
+
* This document lives in the patient's subcollection: `patients/{patientId}/patientRequirements/{instanceId}`.
|
|
1728
|
+
*/
|
|
1729
|
+
interface PatientRequirementInstance {
|
|
1294
1730
|
id: string;
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
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;
|
|
1731
|
+
patientId: string;
|
|
1732
|
+
appointmentId: string;
|
|
1733
|
+
originalRequirementId: string;
|
|
1734
|
+
requirementType: RequirementType;
|
|
1735
|
+
requirementName: string;
|
|
1736
|
+
requirementDescription: string;
|
|
1737
|
+
requirementImportance: RequirementImportance;
|
|
1738
|
+
overallStatus: PatientRequirementOverallStatus;
|
|
1739
|
+
instructions: PatientRequirementInstruction[];
|
|
1313
1740
|
createdAt: Timestamp;
|
|
1314
1741
|
updatedAt: Timestamp;
|
|
1315
1742
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
APP_ADMIN = "app_admin",
|
|
1321
|
-
CLINIC_ADMIN = "clinic_admin"
|
|
1322
|
-
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Firestore subcollection name for patient requirement instances.
|
|
1745
|
+
*/
|
|
1746
|
+
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
1323
1747
|
|
|
1324
1748
|
/**
|
|
1325
1749
|
* Enumeracija koja definiše sve moguće tipove notifikacija
|
|
@@ -1460,388 +1884,66 @@ interface AppointmentRescheduledProposalNotification extends BaseNotification {
|
|
|
1460
1884
|
appointmentId: string;
|
|
1461
1885
|
newProposedStartTime: Timestamp;
|
|
1462
1886
|
newProposedEndTime: Timestamp;
|
|
1463
|
-
procedureName?: string;
|
|
1464
|
-
}
|
|
1465
|
-
/**
|
|
1466
|
-
* Notification informing about a cancelled appointment.
|
|
1467
|
-
* Example: "Your appointment for [Procedure Name] on [Date] has been cancelled."
|
|
1468
|
-
*/
|
|
1469
|
-
interface AppointmentCancelledNotification extends BaseNotification {
|
|
1470
|
-
notificationType: NotificationType.APPOINTMENT_CANCELLED;
|
|
1471
|
-
appointmentId: string;
|
|
1472
|
-
reason?: string;
|
|
1473
|
-
cancelledByRole?: UserRole;
|
|
1474
|
-
procedureName?: string;
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Notification reminding a user to fill a specific form.
|
|
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
|
|
1572
|
-
*/
|
|
1573
|
-
interface ProcedureExtendedInfo {
|
|
1574
|
-
id: string;
|
|
1575
|
-
name: string;
|
|
1576
|
-
description: string;
|
|
1577
|
-
cost: number;
|
|
1578
|
-
duration: number;
|
|
1579
|
-
procedureFamily: ProcedureFamily;
|
|
1580
|
-
procedureCategoryId: string;
|
|
1581
|
-
procedureCategoryName: string;
|
|
1582
|
-
procedureSubCategoryId: string;
|
|
1583
|
-
procedureSubCategoryName: string;
|
|
1584
|
-
procedureTechnologyId: string;
|
|
1585
|
-
procedureTechnologyName: string;
|
|
1586
|
-
procedureProductBrandId: string;
|
|
1587
|
-
procedureProductBrandName: string;
|
|
1588
|
-
procedureProductId: string;
|
|
1589
|
-
procedureProductName: string;
|
|
1590
|
-
}
|
|
1591
|
-
/**
|
|
1592
|
-
* Interface to describe a filled form linked to an appointment.
|
|
1593
|
-
*/
|
|
1594
|
-
interface LinkedFormInfo {
|
|
1595
|
-
formId: string;
|
|
1596
|
-
templateId: string;
|
|
1597
|
-
templateVersion: number;
|
|
1598
|
-
title: string;
|
|
1599
|
-
isUserForm: boolean;
|
|
1600
|
-
isRequired?: boolean;
|
|
1601
|
-
sortingOrder?: number;
|
|
1602
|
-
status: FilledDocumentStatus;
|
|
1603
|
-
path: string;
|
|
1604
|
-
submittedAt?: Timestamp;
|
|
1605
|
-
completedAt?: Timestamp;
|
|
1606
|
-
}
|
|
1607
|
-
/**
|
|
1608
|
-
* Interface for summarized patient review information linked to an appointment.
|
|
1609
|
-
*/
|
|
1610
|
-
interface PatientReviewInfo {
|
|
1611
|
-
reviewId: string;
|
|
1612
|
-
rating: number;
|
|
1613
|
-
comment?: string;
|
|
1614
|
-
reviewedAt: Timestamp;
|
|
1615
|
-
}
|
|
1616
|
-
/**
|
|
1617
|
-
* Interface for before/after photos and notes per zone
|
|
1618
|
-
*/
|
|
1619
|
-
interface BeforeAfterPerZone {
|
|
1620
|
-
/** URL for before photo or null if not available */
|
|
1621
|
-
before: MediaResource | null;
|
|
1622
|
-
/** URL for after photo or null if not available */
|
|
1623
|
-
after: MediaResource | null;
|
|
1624
|
-
/** Optional note for the zone */
|
|
1625
|
-
note: string | null;
|
|
1626
|
-
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Interface for billing information per zone
|
|
1629
|
-
*/
|
|
1630
|
-
interface BillingPerZone {
|
|
1631
|
-
/** Product name/description */
|
|
1632
|
-
Product: string;
|
|
1633
|
-
/** Product ID */
|
|
1634
|
-
ProductId: string | null;
|
|
1635
|
-
/** Quantity used (can be decimal) */
|
|
1636
|
-
Quantity: number;
|
|
1637
|
-
/** Unit of measurement */
|
|
1638
|
-
UnitOfMeasurement: PricingMeasure;
|
|
1639
|
-
/** Unit price for the product */
|
|
1640
|
-
UnitPrice: number;
|
|
1641
|
-
/** Currency for the unit price */
|
|
1642
|
-
UnitCurency: Currency;
|
|
1643
|
-
/** Calculated subtotal */
|
|
1644
|
-
Subtotal: number;
|
|
1645
|
-
/** Optional billing note */
|
|
1646
|
-
Note: string | null;
|
|
1647
|
-
}
|
|
1648
|
-
/**
|
|
1649
|
-
* Interface for final billing calculations of the appointment
|
|
1650
|
-
*/
|
|
1651
|
-
interface FinalBilling {
|
|
1652
|
-
/** Total of all subtotals from all zones */
|
|
1653
|
-
subtotalAll: number;
|
|
1654
|
-
/** Tax rate as percentage (e.g., 0.20 for 20%) */
|
|
1655
|
-
taxRate: number;
|
|
1656
|
-
/** Calculated tax amount */
|
|
1657
|
-
taxPrice: number;
|
|
1658
|
-
/** Final price including tax */
|
|
1659
|
-
finalPrice: number;
|
|
1660
|
-
/** Total final quantity across all zones */
|
|
1661
|
-
finalQuantity: number;
|
|
1662
|
-
/** Currency for the final billing */
|
|
1663
|
-
currency: Currency;
|
|
1664
|
-
/** Unit of measurement for the final billing */
|
|
1665
|
-
unitOfMeasurement: PricingMeasure;
|
|
1666
|
-
}
|
|
1667
|
-
/**
|
|
1668
|
-
* Interface for appointment metadata containing zone-specific information
|
|
1669
|
-
*/
|
|
1670
|
-
interface AppointmentMetadata {
|
|
1671
|
-
/** Array of selected zones for the appointment */
|
|
1672
|
-
selectedZones: string[] | null;
|
|
1673
|
-
/** Map of zone photos with before/after images and notes */
|
|
1674
|
-
zonePhotos: Record<string, BeforeAfterPerZone> | null;
|
|
1675
|
-
/** Map of billing information per zone */
|
|
1676
|
-
zoneBilling: Record<string, BillingPerZone> | null;
|
|
1677
|
-
/** Final billing calculations for the appointment */
|
|
1678
|
-
finalbilling: FinalBilling | null;
|
|
1887
|
+
procedureName?: string;
|
|
1679
1888
|
}
|
|
1680
1889
|
/**
|
|
1681
|
-
*
|
|
1890
|
+
* Notification informing about a cancelled appointment.
|
|
1891
|
+
* Example: "Your appointment for [Procedure Name] on [Date] has been cancelled."
|
|
1682
1892
|
*/
|
|
1683
|
-
interface
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
clinicBranchId: string;
|
|
1690
|
-
/** Aggregated clinic information (snapshot) */
|
|
1691
|
-
clinicInfo: ClinicInfo;
|
|
1692
|
-
/** ID of the practitioner */
|
|
1693
|
-
practitionerId: string;
|
|
1694
|
-
/** Aggregated practitioner information (snapshot) */
|
|
1695
|
-
practitionerInfo: PractitionerProfileInfo;
|
|
1696
|
-
/** ID of the patient */
|
|
1697
|
-
patientId: string;
|
|
1698
|
-
/** Aggregated patient information (snapshot) */
|
|
1699
|
-
patientInfo: PatientProfileInfo;
|
|
1700
|
-
/** ID of the procedure */
|
|
1701
|
-
procedureId: string;
|
|
1702
|
-
/** Aggregated procedure information including product/brand (snapshot) */
|
|
1703
|
-
procedureInfo: ProcedureSummaryInfo;
|
|
1704
|
-
/** Extended procedure information */
|
|
1705
|
-
procedureExtendedInfo: ProcedureExtendedInfo;
|
|
1706
|
-
/** Status of the appointment */
|
|
1707
|
-
status: AppointmentStatus;
|
|
1708
|
-
/** Timestamps */
|
|
1709
|
-
bookingTime: Timestamp;
|
|
1710
|
-
confirmationTime?: Timestamp | null;
|
|
1711
|
-
cancellationTime?: Timestamp | null;
|
|
1712
|
-
rescheduleTime?: Timestamp | null;
|
|
1713
|
-
appointmentStartTime: Timestamp;
|
|
1714
|
-
appointmentEndTime: Timestamp;
|
|
1715
|
-
procedureActualStartTime?: Timestamp | null;
|
|
1716
|
-
actualDurationMinutes?: number;
|
|
1717
|
-
/** Cancellation Details */
|
|
1718
|
-
cancellationReason?: string | null;
|
|
1719
|
-
canceledBy?: "patient" | "clinic" | "practitioner" | "system";
|
|
1720
|
-
/** Notes */
|
|
1721
|
-
internalNotes?: string | null;
|
|
1722
|
-
patientNotes?: string | null;
|
|
1723
|
-
/** Payment Details */
|
|
1724
|
-
cost: number;
|
|
1725
|
-
currency: Currency;
|
|
1726
|
-
paymentStatus: PaymentStatus;
|
|
1727
|
-
paymentTransactionId?: string | null;
|
|
1728
|
-
/** Procedure-related conditions and requirements */
|
|
1729
|
-
blockingConditions: BlockingCondition[];
|
|
1730
|
-
contraindications: Contraindication[];
|
|
1731
|
-
preProcedureRequirements: Requirement[];
|
|
1732
|
-
postProcedureRequirements: Requirement[];
|
|
1733
|
-
/** Tracking information for requirements completion */
|
|
1734
|
-
completedPreRequirements?: string[];
|
|
1735
|
-
completedPostRequirements?: string[];
|
|
1736
|
-
/** NEW: Linked forms (consent, procedure-specific forms, etc.) */
|
|
1737
|
-
linkedFormIds?: string[];
|
|
1738
|
-
linkedForms?: LinkedFormInfo[];
|
|
1739
|
-
pendingUserFormsIds?: string[];
|
|
1740
|
-
/** NEW: Media items (before/after photos, scanned documents, etc.) */
|
|
1741
|
-
media?: AppointmentMediaItem[];
|
|
1742
|
-
/** NEW: Information about the patient's review for this appointment */
|
|
1743
|
-
reviewInfo?: PatientReviewInfo | null;
|
|
1744
|
-
/** NEW: Details about the finalization of the appointment by the practitioner */
|
|
1745
|
-
finalizedDetails?: {
|
|
1746
|
-
by: string;
|
|
1747
|
-
at: Timestamp;
|
|
1748
|
-
notes?: string;
|
|
1749
|
-
};
|
|
1750
|
-
/** Timestamps for record creation and updates */
|
|
1751
|
-
createdAt: Timestamp;
|
|
1752
|
-
updatedAt: Timestamp;
|
|
1753
|
-
/** Recurring appointment information */
|
|
1754
|
-
isRecurring?: boolean;
|
|
1755
|
-
recurringAppointmentId?: string | null;
|
|
1756
|
-
/** NEW: Flag for soft deletion or archiving */
|
|
1757
|
-
isArchived?: boolean;
|
|
1758
|
-
/** NEW: Metadata for the appointment - used for area selection and photos */
|
|
1759
|
-
metadata?: AppointmentMetadata;
|
|
1893
|
+
interface AppointmentCancelledNotification extends BaseNotification {
|
|
1894
|
+
notificationType: NotificationType.APPOINTMENT_CANCELLED;
|
|
1895
|
+
appointmentId: string;
|
|
1896
|
+
reason?: string;
|
|
1897
|
+
cancelledByRole?: UserRole;
|
|
1898
|
+
procedureName?: string;
|
|
1760
1899
|
}
|
|
1761
1900
|
/**
|
|
1762
|
-
*
|
|
1901
|
+
* Notification reminding a user to fill a specific form.
|
|
1902
|
+
* Example: "Reminder: Please complete the '[Form Name]' form for your upcoming appointment."
|
|
1763
1903
|
*/
|
|
1764
|
-
interface
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
appointmentEndTime: Timestamp;
|
|
1771
|
-
cost: number;
|
|
1772
|
-
currency: Currency;
|
|
1773
|
-
patientNotes?: string | null;
|
|
1774
|
-
initialStatus: AppointmentStatus;
|
|
1775
|
-
initialPaymentStatus?: PaymentStatus;
|
|
1904
|
+
interface FormReminderNotification extends BaseNotification {
|
|
1905
|
+
notificationType: NotificationType.FORM_REMINDER;
|
|
1906
|
+
appointmentId: string;
|
|
1907
|
+
formId: string;
|
|
1908
|
+
formName: string;
|
|
1909
|
+
formDeadline?: Timestamp;
|
|
1776
1910
|
}
|
|
1777
1911
|
/**
|
|
1778
|
-
*
|
|
1912
|
+
* Notification confirming a form submission.
|
|
1913
|
+
* Example: "Thank you! Your '[Form Name]' form has been submitted successfully."
|
|
1779
1914
|
*/
|
|
1780
|
-
interface
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
patientNotes?: string | null;
|
|
1915
|
+
interface FormSubmissionConfirmationNotification extends BaseNotification {
|
|
1916
|
+
notificationType: NotificationType.FORM_SUBMISSION_CONFIRMATION;
|
|
1917
|
+
appointmentId?: string;
|
|
1918
|
+
formId: string;
|
|
1919
|
+
formName: string;
|
|
1786
1920
|
}
|
|
1787
1921
|
/**
|
|
1788
|
-
*
|
|
1922
|
+
* Notification requesting a patient to leave a review after an appointment.
|
|
1923
|
+
* Example: "Hope you had a great experience! Would you like to share your feedback for your visit on [Date]?"
|
|
1789
1924
|
*/
|
|
1790
|
-
interface
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
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;
|
|
1925
|
+
interface ReviewRequestNotification extends BaseNotification {
|
|
1926
|
+
notificationType: NotificationType.REVIEW_REQUEST;
|
|
1927
|
+
appointmentId: string;
|
|
1928
|
+
practitionerName?: string;
|
|
1929
|
+
procedureName?: string;
|
|
1829
1930
|
}
|
|
1830
1931
|
/**
|
|
1831
|
-
*
|
|
1932
|
+
* Generic notification for direct messages or announcements.
|
|
1832
1933
|
*/
|
|
1833
|
-
interface
|
|
1834
|
-
|
|
1835
|
-
practitionerId?: string;
|
|
1836
|
-
clinicBranchId?: string;
|
|
1837
|
-
startDate?: Date;
|
|
1838
|
-
endDate?: Date;
|
|
1839
|
-
status?: AppointmentStatus | AppointmentStatus[];
|
|
1840
|
-
limit?: number;
|
|
1841
|
-
startAfter?: any;
|
|
1934
|
+
interface GeneralMessageNotification extends BaseNotification {
|
|
1935
|
+
notificationType: NotificationType.GENERAL_MESSAGE;
|
|
1842
1936
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1937
|
+
interface PaymentConfirmationNotification extends BaseNotification {
|
|
1938
|
+
notificationType: NotificationType.PAYMENT_CONFIRMATION;
|
|
1939
|
+
transactionId: string;
|
|
1940
|
+
appointmentId?: string;
|
|
1941
|
+
amount: string;
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Unija svih tipova notifikacija
|
|
1945
|
+
*/
|
|
1946
|
+
type Notification = PreRequirementNotification | PostRequirementNotification | RequirementInstructionDueNotification | AppointmentReminderNotification | AppointmentStatusChangeNotification | AppointmentRescheduledProposalNotification | AppointmentCancelledNotification | FormReminderNotification | FormSubmissionConfirmationNotification | ReviewRequestNotification | GeneralMessageNotification | PaymentConfirmationNotification;
|
|
1845
1947
|
|
|
1846
1948
|
declare class NotificationsAdmin {
|
|
1847
1949
|
private expo;
|
|
@@ -2880,68 +2982,6 @@ declare class BookingAdmin {
|
|
|
2880
2982
|
private _generateProcedureExtendedInfo;
|
|
2881
2983
|
}
|
|
2882
2984
|
|
|
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;
|
|
2939
|
-
}
|
|
2940
|
-
/**
|
|
2941
|
-
* Firestore subcollection name for patient requirement instances.
|
|
2942
|
-
*/
|
|
2943
|
-
declare const PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME = "patientRequirements";
|
|
2944
|
-
|
|
2945
2985
|
/**
|
|
2946
2986
|
* @class PatientRequirementsAdminService
|
|
2947
2987
|
* @description Handles administrative tasks for patient requirement instances, primarily managing associated notifications.
|
|
@@ -3319,4 +3359,4 @@ declare class AppointmentMailingService extends BaseMailingService {
|
|
|
3319
3359
|
*/
|
|
3320
3360
|
declare function freeConsultationInfrastructure(db?: admin.firestore.Firestore): Promise<boolean>;
|
|
3321
3361
|
|
|
3322
|
-
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, type BeforeAfterPerZone, type BillingPerZone, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type FinalBilling, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, type Notification, NotificationStatus, NotificationType, NotificationsAdmin, type OrchestrateAppointmentCreationData, PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME, type PatientProfile as Patient, PatientAggregationService, PatientInstructionStatus, type PatientRequirementInstance, type PatientRequirementInstruction, PatientRequirementOverallStatus, PatientRequirementsAdminService, type PatientReviewInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole, freeConsultationInfrastructure };
|
|
3362
|
+
export { APPOINTMENTS_COLLECTION, type Appointment, AppointmentAggregationService, type AppointmentCancellationEmailData, type AppointmentConfirmationEmailData, type AppointmentEmailDataBase, AppointmentMailingService, type AppointmentMediaItem, type AppointmentMetadata, type AppointmentReminderNotification, type AppointmentRequestedEmailData, type AppointmentRescheduledProposalEmailData, AppointmentStatus, type AvailableSlot, BaseMailingService, type BaseNotification, type BeforeAfterPerZone, type BillingPerZone, BookingAdmin, BookingAvailabilityCalculator, type BookingAvailabilityRequest, type BookingAvailabilityResponse, CalendarAdminService, type Clinic, type ClinicAdminNotificationData, ClinicAggregationService, type ClinicInfo, type ClinicLocation, type CreateAppointmentData, type CreateAppointmentHttpData, type DoctorInfo, DocumentManagerAdminService, type ExistingPractitionerInviteEmailData, ExistingPractitionerInviteMailingService, type FilledDocument, FilledFormsAggregationService, type FinalBilling, type InitializeAppointmentFormsResult, type LinkedFormInfo, Logger, MediaType, NOTIFICATIONS_COLLECTION, 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 PatientReviewInfo, type PatientSensitiveInfo, PaymentStatus, type PostRequirementNotification, type Practitioner, PractitionerAggregationService, type PractitionerInvite, PractitionerInviteAggregationService, PractitionerInviteMailingService, PractitionerInviteStatus, type PractitionerToken, PractitionerTokenStatus, type PreRequirementNotification, type Procedure, ProcedureAggregationService, type ProcedureExtendedInfo, type ProcedureSummaryInfo, type Review, type ReviewAddedEmailData, type ReviewRequestEmailData, ReviewsAggregationService, type SearchAppointmentsParams, type TimeInterval, type UpdateAppointmentData, UserRole, freeConsultationInfrastructure };
|