@integraciones_doc24/sdk 0.39.3 → 0.39.4
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/lib/baseSdk/diagnostica.d.ts +11 -11
- package/lib/baseSdk/diagnostica.js +18 -20
- package/lib/baseSdk/external.d.ts +2 -2
- package/lib/baseSdk/index.js +0 -3
- package/lib/baseSdk/user.d.ts +6 -56
- package/lib/baseSdk/user.js +25 -70
- package/lib/index.d.ts +25 -230
- package/lib/schemas.d.ts +56 -741
- package/lib/schemas.js +39 -150
- package/lib/types.d.ts +7 -34
- package/lib/userSdk/chat.d.ts +2 -2
- package/lib/userSdk/external.d.ts +1 -1
- package/lib/userSdk/index.js +0 -3
- package/lib/userSdk/patients.d.ts +14 -28
- package/lib/userSdk/patients.js +12 -31
- package/lib/userSdk/schedule.d.ts +2 -4
- package/lib/userSdk/schedule.js +16 -20
- package/lib/userSdk/videoVisit.d.ts +2 -4
- package/lib/userSdk/videoVisit.js +4 -11
- package/lib/utils.d.ts +4 -2
- package/lib/utils.js +22 -11
- package/package.json +1 -1
package/lib/schemas.js
CHANGED
|
@@ -3,19 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.doc24Schemas = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const gender = zod_1.enum(['m', 'f']);
|
|
6
|
-
|
|
6
|
+
const identificationType = zod_1.enum([
|
|
7
|
+
'dni',
|
|
8
|
+
'ndi',
|
|
9
|
+
'passport',
|
|
10
|
+
'credential',
|
|
11
|
+
'nn',
|
|
12
|
+
'cpf',
|
|
13
|
+
'rg',
|
|
14
|
+
]);
|
|
7
15
|
const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
|
|
8
16
|
const basePersonData = zod_1.object({
|
|
9
17
|
firstName: zod_1.string(),
|
|
10
18
|
lastName: zod_1.string(),
|
|
11
|
-
identificationType
|
|
19
|
+
identificationType,
|
|
12
20
|
identificationValue: zod_1.string(),
|
|
13
21
|
countryId: zod_1.string(),
|
|
14
22
|
birthdate: zod_1.date(),
|
|
15
23
|
gender,
|
|
16
24
|
});
|
|
17
|
-
const patient = basePersonData;
|
|
18
|
-
const user = basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() });
|
|
19
25
|
const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
|
|
20
26
|
const specialty = zod_1.object({
|
|
21
27
|
id: zod_1.number(),
|
|
@@ -24,7 +30,6 @@ const specialty = zod_1.object({
|
|
|
24
30
|
const scheduleAvailabilityFilter = zod_1.object({
|
|
25
31
|
specialtyId: zod_1.number().optional(),
|
|
26
32
|
professionalId: zod_1.number().optional(),
|
|
27
|
-
language: zod_1.string().optional(),
|
|
28
33
|
});
|
|
29
34
|
const availableAppointment = zod_1.object({
|
|
30
35
|
id: zod_1.number().or(zod_1.string()),
|
|
@@ -138,7 +143,7 @@ const diagnosticaPatient = zod_1.object({
|
|
|
138
143
|
firstName: zod_1.string(),
|
|
139
144
|
lastName: zod_1.string(),
|
|
140
145
|
birthday: zod_1.date(),
|
|
141
|
-
identificationType: zod_1.literal('
|
|
146
|
+
identificationType: zod_1.literal('dni'),
|
|
142
147
|
identificationValue: zod_1.string(),
|
|
143
148
|
gender: gender,
|
|
144
149
|
});
|
|
@@ -151,31 +156,6 @@ const diagnosticaDeepLinkResponse = zod_1.object({
|
|
|
151
156
|
forwardingRequired: zod_1.literal(true),
|
|
152
157
|
deepLink: zod_1.string().url(),
|
|
153
158
|
}).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
|
|
154
|
-
const videoVisit = zod_1.object({
|
|
155
|
-
id: zod_1.number().nullable(),
|
|
156
|
-
creationDate: zod_1.date(),
|
|
157
|
-
patientId: zod_1.number(),
|
|
158
|
-
user: zod_1.object({
|
|
159
|
-
id: zod_1.number(),
|
|
160
|
-
email: zod_1.string().nullable(),
|
|
161
|
-
phone: zod_1.string().nullable(),
|
|
162
|
-
}),
|
|
163
|
-
vcToken: zod_1.string(),
|
|
164
|
-
appointment: zod_1.object({
|
|
165
|
-
id: zod_1.number(),
|
|
166
|
-
date: zod_1.date(),
|
|
167
|
-
}).optional(),
|
|
168
|
-
videoVisit: zod_1.object({
|
|
169
|
-
id: zod_1.number(),
|
|
170
|
-
status: zod_1.string(),
|
|
171
|
-
}).optional(),
|
|
172
|
-
paymentStatus: zod_1.string().optional(),
|
|
173
|
-
atentionId: zod_1.number().optional(),
|
|
174
|
-
});
|
|
175
|
-
const historicalVideoVisit = videoVisit.extend({
|
|
176
|
-
specialty: zod_1.string(),
|
|
177
|
-
professional: zod_1.string(),
|
|
178
|
-
});
|
|
179
159
|
const coverageInfo = zod_1.object({
|
|
180
160
|
financerId: zod_1.number().nullable(),
|
|
181
161
|
defaultAffiliationId: zod_1.number().nullable(),
|
|
@@ -200,109 +180,16 @@ const coverageInfo = zod_1.object({
|
|
|
200
180
|
authorizationCode: zod_1.string().nullable(),
|
|
201
181
|
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
202
182
|
}).nullable();
|
|
203
|
-
const
|
|
204
|
-
identificationType
|
|
205
|
-
identificationValue: zod_1.string(),
|
|
206
|
-
channel: zod_1.enum(['1', '2']),
|
|
207
|
-
});
|
|
208
|
-
const verificationCodeParams = zod_1.object({
|
|
209
|
-
channel: zod_1.enum(['1', '2']).optional(),
|
|
210
|
-
code: zod_1.string().optional(),
|
|
211
|
-
});
|
|
212
|
-
const declareUserParams = zod_1.object({
|
|
213
|
-
user,
|
|
214
|
-
}).and(verificationCodeParams);
|
|
215
|
-
const declarePatientParams = zod_1.object({
|
|
216
|
-
patient,
|
|
217
|
-
}).and(verificationCodeParams);
|
|
218
|
-
const declarePatientResponse = zod_1.object({
|
|
219
|
-
userInfo: zod_1.object({
|
|
220
|
-
firstName: zod_1.string(),
|
|
221
|
-
lastName: zod_1.string(),
|
|
222
|
-
email: zod_1.string(),
|
|
223
|
-
phone: zod_1.string(),
|
|
224
|
-
}),
|
|
225
|
-
askCode: zod_1.literal(true),
|
|
226
|
-
}).or(zod_1.object({
|
|
227
|
-
askCode: zod_1.literal(false),
|
|
228
|
-
patientId: zod_1.number().nullable(),
|
|
229
|
-
}));
|
|
230
|
-
const declareUserResponse = zod_1.object({
|
|
231
|
-
userInfo: zod_1.object({
|
|
232
|
-
email: zod_1.string(),
|
|
233
|
-
phone: zod_1.string(),
|
|
234
|
-
}),
|
|
235
|
-
askCode: zod_1.literal(true),
|
|
236
|
-
}).or(zod_1.object({
|
|
237
|
-
askCode: zod_1.literal(false),
|
|
238
|
-
patientId: zod_1.number().nullable(),
|
|
239
|
-
userId: zod_1.number(),
|
|
240
|
-
}));
|
|
241
|
-
const externalLoginParams = zod_1.object({
|
|
242
|
-
user: zod_1.string(),
|
|
243
|
-
password: zod_1.string(),
|
|
244
|
-
});
|
|
245
|
-
const externalLoginResponse = zod_1.object({
|
|
246
|
-
firstName: zod_1.string(),
|
|
247
|
-
lastName: zod_1.string(),
|
|
248
|
-
countryId: zod_1.string(),
|
|
249
|
-
birthday: zod_1.date(),
|
|
250
|
-
identificationNumber: zod_1.string(),
|
|
251
|
-
gender,
|
|
252
|
-
email: zod_1.string().email(),
|
|
253
|
-
phone: zod_1.string(),
|
|
254
|
-
});
|
|
255
|
-
const emailOrPhone = zod_1.union([
|
|
256
|
-
zod_1.object({ email: zod_1.string(), phone: zod_1.string() }),
|
|
257
|
-
zod_1.object({ email: zod_1.string(), phone: zod_1.undefined() }),
|
|
258
|
-
zod_1.object({ email: zod_1.undefined(), phone: zod_1.string() }),
|
|
259
|
-
]).refine((data) => data.email || data.phone, 'Either phone or email is required');
|
|
260
|
-
const preExternalEnrollmentParams = zod_1.object({
|
|
261
|
-
identificationNumber: zod_1.string(),
|
|
262
|
-
birthdate: zod_1.date(),
|
|
263
|
-
}).and(emailOrPhone);
|
|
264
|
-
const emailOrPhoneCode = zod_1.union([
|
|
265
|
-
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.string() }),
|
|
266
|
-
zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.undefined() }),
|
|
267
|
-
zod_1.object({ emailCode: zod_1.undefined(), phoneCode: zod_1.string() }),
|
|
268
|
-
]).refine((data) => data.emailCode || data.phoneCode, 'Either phone code or email code is required');
|
|
269
|
-
const externalEnrollmentParams = preExternalEnrollmentParams
|
|
270
|
-
.and(zod_1.object({ password: zod_1.string() }))
|
|
271
|
-
.and(emailOrPhoneCode);
|
|
272
|
-
const sendExternalVerificationCodeParams = zod_1.object({
|
|
273
|
-
identificationNumber: zod_1.string(),
|
|
274
|
-
birthdate: zod_1.date(),
|
|
275
|
-
channel: zod_1.enum(['1', '2']),
|
|
276
|
-
});
|
|
277
|
-
const verifyExternalVerificationCodeParams = sendExternalVerificationCodeParams.extend({ code: zod_1.string() });
|
|
278
|
-
const externalResetPasswordParams = zod_1.object({
|
|
279
|
-
identificationNumber: zod_1.string(),
|
|
280
|
-
birthdate: zod_1.date(),
|
|
281
|
-
password: zod_1.string(),
|
|
282
|
-
}).and(emailOrPhoneCode);
|
|
283
|
-
const externalPatient = zod_1.object({
|
|
284
|
-
birthdate: zod_1.date(),
|
|
285
|
-
identificationType: zod_1.literal('DNI'),
|
|
183
|
+
const oldIdentificaiton = zod_1.object({
|
|
184
|
+
identificationType,
|
|
286
185
|
identificationValue: zod_1.string(),
|
|
287
|
-
gender: gender,
|
|
288
|
-
});
|
|
289
|
-
const externalAppointment = zod_1.object({
|
|
290
|
-
id: zod_1.number(),
|
|
291
|
-
patientIdentification: zod_1.string().optional(),
|
|
292
|
-
patientName: zod_1.string(),
|
|
293
|
-
birthdate: zod_1.date(),
|
|
294
|
-
appointment: zod_1.string(),
|
|
295
|
-
clinic: zod_1.string(),
|
|
296
|
-
professionalName: zod_1.string(),
|
|
297
|
-
date: zod_1.date(),
|
|
298
|
-
specialty: zod_1.string(),
|
|
299
|
-
modality: zod_1.string(),
|
|
300
186
|
});
|
|
301
187
|
exports.doc24Schemas = {
|
|
188
|
+
identificationType,
|
|
302
189
|
sdkCredentials,
|
|
303
190
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
304
|
-
user,
|
|
305
|
-
patient,
|
|
191
|
+
user: basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() }),
|
|
192
|
+
patient: basePersonData,
|
|
306
193
|
specialtyMode,
|
|
307
194
|
specialty,
|
|
308
195
|
scheduleAvailabilityFilter,
|
|
@@ -316,14 +203,32 @@ exports.doc24Schemas = {
|
|
|
316
203
|
date: zod_1.date().optional(),
|
|
317
204
|
startHour: zod_1.string().optional(),
|
|
318
205
|
finishHour: zod_1.string().optional(),
|
|
319
|
-
language: zod_1.string().optional(),
|
|
320
206
|
}),
|
|
321
207
|
scheduleParameters: zod_1.union([
|
|
322
208
|
appointmentScheduleParameters,
|
|
323
209
|
instantScheduleParameters,
|
|
324
210
|
]),
|
|
325
|
-
videoVisit
|
|
326
|
-
|
|
211
|
+
videoVisit: zod_1.object({
|
|
212
|
+
id: zod_1.number().nullable(),
|
|
213
|
+
creationDate: zod_1.date(),
|
|
214
|
+
patientId: zod_1.number(),
|
|
215
|
+
user: zod_1.object({
|
|
216
|
+
id: zod_1.number(),
|
|
217
|
+
email: zod_1.string().nullable(),
|
|
218
|
+
phone: zod_1.string().nullable(),
|
|
219
|
+
}),
|
|
220
|
+
vcToken: zod_1.string(),
|
|
221
|
+
appointment: zod_1.object({
|
|
222
|
+
id: zod_1.number(),
|
|
223
|
+
date: zod_1.date(),
|
|
224
|
+
}).optional(),
|
|
225
|
+
videoVisit: zod_1.object({
|
|
226
|
+
id: zod_1.number(),
|
|
227
|
+
status: zod_1.string(),
|
|
228
|
+
}).optional(),
|
|
229
|
+
paymentStatus: zod_1.string().optional(),
|
|
230
|
+
atentionId: zod_1.number().optional(),
|
|
231
|
+
}),
|
|
327
232
|
videoVisitDetails: zod_1.object({
|
|
328
233
|
id: zod_1.number(),
|
|
329
234
|
status: zod_1.string(),
|
|
@@ -390,7 +295,7 @@ exports.doc24Schemas = {
|
|
|
390
295
|
enrollmentParams,
|
|
391
296
|
diagnosticaPatientFilter: zod_1.object({
|
|
392
297
|
gender,
|
|
393
|
-
identificationType
|
|
298
|
+
identificationType,
|
|
394
299
|
identificationValue: zod_1.string(),
|
|
395
300
|
}),
|
|
396
301
|
diagnosticaHistoryAppointment,
|
|
@@ -398,21 +303,5 @@ exports.doc24Schemas = {
|
|
|
398
303
|
diagnosticaPatient,
|
|
399
304
|
diagnosticaDeepLinkResponse,
|
|
400
305
|
coverageInfo,
|
|
401
|
-
|
|
402
|
-
declareUserParams,
|
|
403
|
-
declareUserResponse,
|
|
404
|
-
declarePatientParams,
|
|
405
|
-
declarePatientResponse,
|
|
406
|
-
verificationCodeParams,
|
|
407
|
-
externalLoginParams,
|
|
408
|
-
externalLoginResponse,
|
|
409
|
-
preExternalEnrollmentParams,
|
|
410
|
-
externalEnrollmentParams,
|
|
411
|
-
sendExternalVerificationCodeParams,
|
|
412
|
-
verifyExternalVerificationCodeParams,
|
|
413
|
-
externalResetPasswordParams,
|
|
414
|
-
externalPatient,
|
|
415
|
-
externalAppointment,
|
|
416
|
-
emailOrPhone,
|
|
417
|
-
emailOrPhoneCode,
|
|
306
|
+
oldIdentificaiton,
|
|
418
307
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TypeOf } from 'zod';
|
|
2
2
|
import { doc24Schemas } from './schemas';
|
|
3
3
|
export declare namespace Doc24 {
|
|
4
|
+
type IdentificationType = TypeOf<typeof doc24Schemas.identificationType>;
|
|
4
5
|
type SdkCredentials = TypeOf<typeof doc24Schemas.sdkCredentials>;
|
|
5
6
|
type SdkParams = TypeOf<typeof doc24Schemas.sdkParams>;
|
|
6
7
|
type User = TypeOf<typeof doc24Schemas.user>;
|
|
@@ -12,7 +13,6 @@ export declare namespace Doc24 {
|
|
|
12
13
|
type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
|
|
13
14
|
type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
|
|
14
15
|
type VideoVisit = TypeOf<typeof doc24Schemas.videoVisit>;
|
|
15
|
-
type HistoricalVideoVisit = TypeOf<typeof doc24Schemas.historicalVideoVisit>;
|
|
16
16
|
type VideoVisitDetails = TypeOf<typeof doc24Schemas.videoVisitDetails>;
|
|
17
17
|
type ActiveVideoVisitData = TypeOf<typeof doc24Schemas.activeVideoVisitData>;
|
|
18
18
|
type SpecialtyMode = TypeOf<typeof doc24Schemas.specialtyMode>;
|
|
@@ -30,44 +30,21 @@ export declare namespace Doc24 {
|
|
|
30
30
|
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
31
31
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
32
32
|
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
33
|
-
type
|
|
34
|
-
type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
|
|
35
|
-
type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
|
|
36
|
-
type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
|
|
37
|
-
type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
|
|
38
|
-
type VerificationCodeParams = TypeOf<typeof doc24Schemas.verificationCodeParams>;
|
|
39
|
-
type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
|
|
40
|
-
type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
|
|
41
|
-
type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
|
|
42
|
-
type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
|
|
43
|
-
type SendExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.sendExternalVerificationCodeParams>;
|
|
44
|
-
type VerifyExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.verifyExternalVerificationCodeParams>;
|
|
45
|
-
type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
|
|
46
|
-
type ExternalPatient = TypeOf<typeof doc24Schemas.externalPatient>;
|
|
47
|
-
type ExternalAppointment = TypeOf<typeof doc24Schemas.externalAppointment>;
|
|
33
|
+
type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
|
|
48
34
|
type BaseSdk = {
|
|
49
|
-
declareUser: (
|
|
50
|
-
getUserId: (user: User) => Promise<number>;
|
|
35
|
+
declareUser: (user: User) => Promise<number>;
|
|
51
36
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
52
37
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
53
38
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
54
39
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
55
|
-
|
|
56
|
-
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
40
|
+
getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
57
41
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
58
42
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
59
43
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
60
|
-
externalLogin: (params: ExternalLoginParams) => Promise<ExternalLoginResponse>;
|
|
61
|
-
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
62
|
-
externalEnrollment: (params: ExternalEnrollmentParams) => Promise<ExternalLoginResponse>;
|
|
63
|
-
sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
|
|
64
|
-
verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
|
|
65
|
-
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
66
44
|
};
|
|
67
45
|
type UserSdk = {
|
|
68
|
-
declarePatient: (
|
|
69
|
-
|
|
70
|
-
deletePatient: (patientId: number) => Promise<void>;
|
|
46
|
+
declarePatient: (patient: Patient) => Promise<number>;
|
|
47
|
+
updatePatient: (oldIdentification: OldIdentificaiton, patient: Patient) => Promise<number>;
|
|
71
48
|
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
72
49
|
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
73
50
|
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
|
@@ -78,7 +55,7 @@ export declare namespace Doc24 {
|
|
|
78
55
|
getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
|
|
79
56
|
getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
|
|
80
57
|
getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
|
|
81
|
-
getPatientVideoVisitHistory: (patientId: number) => Promise<
|
|
58
|
+
getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
|
|
82
59
|
getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
|
|
83
60
|
getAvailableChatrooms: (patientId: number, specialtyId: number, filter: ChatroomAvailabilityFilter) => Promise<AvailableChatroom[]>;
|
|
84
61
|
createNewChat: (chatParameters: ChatParameters) => Promise<number>;
|
|
@@ -86,10 +63,6 @@ export declare namespace Doc24 {
|
|
|
86
63
|
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
87
64
|
cancelChat: (chatId: number) => Promise<void>;
|
|
88
65
|
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
89
|
-
getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
|
|
90
|
-
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
91
|
-
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
92
|
-
cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
|
|
93
66
|
userId: number;
|
|
94
67
|
};
|
|
95
68
|
namespace Webhook {
|
package/lib/userSdk/chat.d.ts
CHANGED
|
@@ -24,9 +24,9 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
|
|
|
24
24
|
getPatientChats: (patientId: number) => Promise<{
|
|
25
25
|
id: number;
|
|
26
26
|
patient: {
|
|
27
|
+
id: number;
|
|
27
28
|
firstName: string;
|
|
28
29
|
lastName: string;
|
|
29
|
-
id: number;
|
|
30
30
|
};
|
|
31
31
|
professional: {
|
|
32
32
|
id: number;
|
|
@@ -34,11 +34,11 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
|
|
|
34
34
|
logoUrl: string;
|
|
35
35
|
};
|
|
36
36
|
status: string;
|
|
37
|
-
paymentStatus: string;
|
|
38
37
|
specialty: {
|
|
39
38
|
id: number;
|
|
40
39
|
description: string;
|
|
41
40
|
};
|
|
41
|
+
paymentStatus: string;
|
|
42
42
|
chatRoomId: number;
|
|
43
43
|
startDate: Date;
|
|
44
44
|
lastEventDate: Date;
|
|
@@ -4,7 +4,7 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
4
4
|
identificationType: "DNI";
|
|
5
5
|
identificationValue: string;
|
|
6
6
|
birthdate: Date;
|
|
7
|
-
gender: "m" | "f";
|
|
7
|
+
gender: "m" | "f" | "o";
|
|
8
8
|
}) => Promise<string | null>;
|
|
9
9
|
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
10
10
|
getExternalAppointments: () => Promise<{
|
package/lib/userSdk/index.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.userSdk = void 0;
|
|
4
4
|
const request_1 = require("../request");
|
|
5
5
|
const chat_1 = require("./chat");
|
|
6
|
-
const external_1 = require("./external");
|
|
7
6
|
const patients_1 = require("./patients");
|
|
8
7
|
const schedule_1 = require("./schedule");
|
|
9
8
|
const specialties_1 = require("./specialties");
|
|
@@ -15,14 +14,12 @@ const userSdk = async (url, credentials, userId) => {
|
|
|
15
14
|
const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
|
|
16
15
|
const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
|
|
17
16
|
const chatMethods = chat_1.getChatMethods(makeRequest);
|
|
18
|
-
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
19
17
|
const sdk = {
|
|
20
18
|
...patientMethods,
|
|
21
19
|
...specialtyMethods,
|
|
22
20
|
...scheduleMethods,
|
|
23
21
|
...videoVisitMethods,
|
|
24
22
|
...chatMethods,
|
|
25
|
-
...externalMethods,
|
|
26
23
|
userId,
|
|
27
24
|
};
|
|
28
25
|
return sdk;
|
|
@@ -1,38 +1,24 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
export declare const getPatientMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
declarePatient: (
|
|
4
|
-
patient: {
|
|
5
|
-
firstName: string;
|
|
6
|
-
lastName: string;
|
|
7
|
-
identificationType: number;
|
|
8
|
-
identificationValue: string;
|
|
9
|
-
countryId: string;
|
|
10
|
-
birthdate: Date;
|
|
11
|
-
gender: "m" | "f";
|
|
12
|
-
};
|
|
13
|
-
} & {
|
|
14
|
-
code?: string | undefined;
|
|
15
|
-
channel?: "1" | "2" | undefined;
|
|
16
|
-
}) => Promise<{
|
|
17
|
-
askCode: true;
|
|
18
|
-
userInfo: {
|
|
19
|
-
firstName: string;
|
|
20
|
-
lastName: string;
|
|
21
|
-
phone: string;
|
|
22
|
-
email: string;
|
|
23
|
-
};
|
|
24
|
-
} | {
|
|
25
|
-
patientId: number | null;
|
|
26
|
-
askCode: false;
|
|
27
|
-
}>;
|
|
28
|
-
getPatientId: (patient: {
|
|
3
|
+
declarePatient: (patient: {
|
|
29
4
|
firstName: string;
|
|
30
5
|
lastName: string;
|
|
31
|
-
identificationType:
|
|
6
|
+
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
|
|
32
7
|
identificationValue: string;
|
|
8
|
+
gender: "m" | "f";
|
|
33
9
|
countryId: string;
|
|
34
10
|
birthdate: Date;
|
|
11
|
+
}) => Promise<number>;
|
|
12
|
+
updatePatient: (oldIdentification: {
|
|
13
|
+
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
|
|
14
|
+
identificationValue: string;
|
|
15
|
+
}, patient: {
|
|
16
|
+
firstName: string;
|
|
17
|
+
lastName: string;
|
|
18
|
+
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
|
|
19
|
+
identificationValue: string;
|
|
35
20
|
gender: "m" | "f";
|
|
21
|
+
countryId: string;
|
|
22
|
+
birthdate: Date;
|
|
36
23
|
}) => Promise<number>;
|
|
37
|
-
deletePatient: (patientId: number) => Promise<void>;
|
|
38
24
|
};
|
package/lib/userSdk/patients.js
CHANGED
|
@@ -5,61 +5,42 @@ const date_fns_1 = require("date-fns");
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const validation_1 = require("../request/validation");
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
8
9
|
const getPatientMethods = (makeRequest) => {
|
|
9
|
-
const declarePatient = async (
|
|
10
|
-
const path = '/patient';
|
|
10
|
+
const declarePatient = async (patient) => {
|
|
11
11
|
const mappedPatient = {
|
|
12
12
|
lastname: patient.lastName,
|
|
13
13
|
firstname: patient.firstName,
|
|
14
|
-
identification_type: patient.identificationType,
|
|
14
|
+
identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
|
|
15
15
|
identification_value: patient.identificationValue,
|
|
16
16
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
17
17
|
gender: patient.gender.toUpperCase(),
|
|
18
18
|
country_id: patient.countryId,
|
|
19
19
|
};
|
|
20
|
-
const
|
|
21
|
-
const response = await makeRequest('POST', path, {
|
|
20
|
+
const response = await makeRequest('POST', '/patient', {
|
|
22
21
|
user_data: mappedPatient,
|
|
23
|
-
channel: parsedChannel,
|
|
24
|
-
code,
|
|
25
22
|
});
|
|
26
|
-
|
|
27
|
-
if (data.ask_code)
|
|
28
|
-
return {
|
|
29
|
-
userInfo: {
|
|
30
|
-
firstName: data.user_info.firstname,
|
|
31
|
-
lastName: data.user_info.lastname,
|
|
32
|
-
phone: data.user_info.phone,
|
|
33
|
-
email: data.user_info.email,
|
|
34
|
-
},
|
|
35
|
-
askCode: true,
|
|
36
|
-
};
|
|
37
|
-
return { askCode: false, patientId: data.patient_id };
|
|
23
|
+
return response.data.patient_id;
|
|
38
24
|
};
|
|
39
|
-
const
|
|
40
|
-
const path = '/search-patient';
|
|
25
|
+
const updatePatient = async (oldIdentificaiton, patient) => {
|
|
41
26
|
const mappedPatient = {
|
|
42
27
|
lastname: patient.lastName,
|
|
43
28
|
firstname: patient.firstName,
|
|
44
|
-
identification_type: patient.identificationType,
|
|
29
|
+
identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
|
|
45
30
|
identification_value: patient.identificationValue,
|
|
46
31
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
47
32
|
gender: patient.gender.toUpperCase(),
|
|
48
|
-
country_id: patient.countryId,
|
|
49
33
|
};
|
|
50
|
-
const response = await makeRequest('POST',
|
|
34
|
+
const response = await makeRequest('POST', '/update-patient', {
|
|
35
|
+
old_identification_type: utils_1.getIndetificationTypeId(oldIdentificaiton.identificationType),
|
|
36
|
+
old_identification_value: oldIdentificaiton.identificationValue,
|
|
51
37
|
user_data: mappedPatient,
|
|
52
38
|
});
|
|
53
39
|
return response.data.patient_id;
|
|
54
40
|
};
|
|
55
|
-
const deletePatient = async (patientId) => {
|
|
56
|
-
const path = `/patient/${patientId}`;
|
|
57
|
-
await makeRequest('DELETE', path);
|
|
58
|
-
};
|
|
59
41
|
return {
|
|
60
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.
|
|
61
|
-
|
|
62
|
-
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
42
|
+
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), declarePatient),
|
|
43
|
+
updatePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.oldIdentificaiton, schemas_1.doc24Schemas.patient]), zod_1.number(), updatePatient),
|
|
63
44
|
};
|
|
64
45
|
};
|
|
65
46
|
exports.getPatientMethods = getPatientMethods;
|
|
@@ -2,7 +2,6 @@ import { RequestMaker } from '../request';
|
|
|
2
2
|
export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
3
3
|
getSchedule: (patientId: number, specialtyId: number, filter?: {
|
|
4
4
|
date?: Date | undefined;
|
|
5
|
-
language?: string | undefined;
|
|
6
5
|
professionalId?: number | undefined;
|
|
7
6
|
offset?: number | undefined;
|
|
8
7
|
limit?: number | undefined;
|
|
@@ -20,17 +19,16 @@ export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
|
20
19
|
fullName: string;
|
|
21
20
|
logoUrl: string;
|
|
22
21
|
};
|
|
22
|
+
clinicId: number;
|
|
23
|
+
cost: string;
|
|
23
24
|
specialty: {
|
|
24
25
|
id: number;
|
|
25
26
|
description: string;
|
|
26
27
|
};
|
|
27
|
-
clinicId: number;
|
|
28
|
-
cost: string;
|
|
29
28
|
atentions: number;
|
|
30
29
|
}[]>;
|
|
31
30
|
getScheduleDates: (patientId: number, filter?: {
|
|
32
31
|
specialtyId?: number | undefined;
|
|
33
|
-
language?: string | undefined;
|
|
34
32
|
professionalId?: number | undefined;
|
|
35
33
|
} | undefined) => Promise<Date[]>;
|
|
36
34
|
getAppointment: (appointmentId: number) => Promise<{
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -7,19 +7,16 @@ const validation_1 = require("../request/validation");
|
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const getScheduleMethods = (makeRequest) => {
|
|
10
|
-
const getScheduleDates = async (patientId, filter = {}) => {
|
|
11
|
-
var _a;
|
|
10
|
+
const getScheduleDates = validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), async (patientId, filter = {}) => {
|
|
12
11
|
const mappedFilter = {
|
|
13
12
|
specialty_id: filter.specialtyId,
|
|
14
13
|
professional_id: filter.professionalId,
|
|
15
|
-
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
16
14
|
};
|
|
17
15
|
const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
|
|
18
16
|
const response = await makeRequest('GET', path);
|
|
19
|
-
return response.data.available_dates.map((o) => utils_1.parseDate(o.date
|
|
20
|
-
};
|
|
21
|
-
const getSchedule = async (patientId, specialtyId, filter = {}) => {
|
|
22
|
-
var _a;
|
|
17
|
+
return response.data.available_dates.map((o) => utils_1.parseDate(o.date));
|
|
18
|
+
});
|
|
19
|
+
const getSchedule = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), async (patientId, specialtyId, filter = {}) => {
|
|
23
20
|
const mappedFilter = {
|
|
24
21
|
id_professional: filter.professionalId,
|
|
25
22
|
offset: filter.offset,
|
|
@@ -28,13 +25,12 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
28
25
|
date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
|
|
29
26
|
start_hour: filter.startHour,
|
|
30
27
|
finish_hour: filter.finishHour,
|
|
31
|
-
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
32
28
|
};
|
|
33
29
|
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
34
30
|
const response = await makeRequest('GET', path);
|
|
35
31
|
return response.data.available_appointments.map((a) => ({
|
|
36
32
|
id: a.id,
|
|
37
|
-
date: utils_1.parseDateTime(`${a.date} ${a.hour}
|
|
33
|
+
date: utils_1.parseDateTime(`${a.date} ${a.hour}`),
|
|
38
34
|
clinicId: a.clinic,
|
|
39
35
|
professional: {
|
|
40
36
|
id: a.professional_id,
|
|
@@ -51,30 +47,30 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
51
47
|
ranking: a.ranking,
|
|
52
48
|
length: a.length,
|
|
53
49
|
}));
|
|
54
|
-
};
|
|
55
|
-
const getAppointment = async (appointmentId) => {
|
|
50
|
+
});
|
|
51
|
+
const getAppointment = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, async (appointmentId) => {
|
|
56
52
|
const path = `/appointment/${appointmentId}`;
|
|
57
53
|
const response = await makeRequest('GET', path);
|
|
58
54
|
return {
|
|
59
55
|
id: response.data.id,
|
|
60
56
|
professionalId: response.data.professional_id,
|
|
61
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}
|
|
57
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
|
|
62
58
|
};
|
|
63
|
-
};
|
|
64
|
-
const getAppointmentByVcToken = async (vcToken) => {
|
|
59
|
+
});
|
|
60
|
+
const getAppointmentByVcToken = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, async (vcToken) => {
|
|
65
61
|
const path = `/appointmentByToken/${vcToken}`;
|
|
66
62
|
const response = await makeRequest('GET', path);
|
|
67
63
|
return {
|
|
68
64
|
id: response.data.id,
|
|
69
65
|
professionalId: response.data.professional_id,
|
|
70
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}
|
|
66
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
|
|
71
67
|
};
|
|
72
|
-
};
|
|
68
|
+
});
|
|
73
69
|
return {
|
|
74
|
-
getSchedule
|
|
75
|
-
getScheduleDates
|
|
76
|
-
getAppointment
|
|
77
|
-
getAppointmentByVcToken
|
|
70
|
+
getSchedule,
|
|
71
|
+
getScheduleDates,
|
|
72
|
+
getAppointment,
|
|
73
|
+
getAppointmentByVcToken,
|
|
78
74
|
};
|
|
79
75
|
};
|
|
80
76
|
exports.getScheduleMethods = getScheduleMethods;
|
|
@@ -32,9 +32,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
32
32
|
patientId: number;
|
|
33
33
|
creationDate: Date;
|
|
34
34
|
user: {
|
|
35
|
+
id: number;
|
|
35
36
|
phone: string | null;
|
|
36
37
|
email: string | null;
|
|
37
|
-
id: number;
|
|
38
38
|
};
|
|
39
39
|
vcToken: string;
|
|
40
40
|
}>;
|
|
@@ -51,15 +51,13 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
51
51
|
atentionId?: number | undefined;
|
|
52
52
|
id: number | null;
|
|
53
53
|
patientId: number;
|
|
54
|
-
professional: string;
|
|
55
54
|
creationDate: Date;
|
|
56
55
|
user: {
|
|
56
|
+
id: number;
|
|
57
57
|
phone: string | null;
|
|
58
58
|
email: string | null;
|
|
59
|
-
id: number;
|
|
60
59
|
};
|
|
61
60
|
vcToken: string;
|
|
62
|
-
specialty: string;
|
|
63
61
|
}[]>;
|
|
64
62
|
getVideoVisitDetails: (vcId: number) => Promise<{
|
|
65
63
|
professional?: {
|