@integraciones_doc24/sdk 1.14.4 → 1.15.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/README.md +7 -3
- package/lib/baseSdk/diagnostica.d.ts +11 -11
- package/lib/baseSdk/diagnostica.js +20 -18
- package/lib/baseSdk/external.d.ts +0 -29
- package/lib/baseSdk/external.js +0 -57
- package/lib/baseSdk/index.js +3 -0
- package/lib/baseSdk/user.d.ts +56 -6
- package/lib/baseSdk/user.js +70 -25
- package/lib/index.d.ts +230 -25
- package/lib/schemas.d.ts +738 -56
- package/lib/schemas.js +149 -37
- package/lib/test.js +7 -15
- package/lib/types.d.ts +34 -7
- package/lib/userSdk/chat.d.ts +2 -2
- package/lib/userSdk/external.d.ts +32 -0
- package/lib/userSdk/external.js +69 -0
- package/lib/userSdk/index.js +3 -0
- package/lib/userSdk/patients.d.ts +28 -14
- package/lib/userSdk/patients.js +31 -12
- package/lib/userSdk/schedule.d.ts +4 -2
- package/lib/userSdk/schedule.js +20 -16
- package/lib/userSdk/videoVisit.d.ts +4 -2
- package/lib/userSdk/videoVisit.js +11 -4
- package/lib/utils.d.ts +2 -4
- package/lib/utils.js +11 -18
- package/package.json +1 -1
package/lib/schemas.js
CHANGED
|
@@ -3,23 +3,19 @@ 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
|
-
const identificationType =
|
|
7
|
-
'dni',
|
|
8
|
-
'ndi',
|
|
9
|
-
'passport',
|
|
10
|
-
'credential',
|
|
11
|
-
'nn',
|
|
12
|
-
]);
|
|
6
|
+
// const identificationType = zEnum(['ndi', 'passport', 'credential']);
|
|
13
7
|
const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
|
|
14
8
|
const basePersonData = zod_1.object({
|
|
15
9
|
firstName: zod_1.string(),
|
|
16
10
|
lastName: zod_1.string(),
|
|
17
|
-
identificationType,
|
|
11
|
+
identificationType: zod_1.number(),
|
|
18
12
|
identificationValue: zod_1.string(),
|
|
19
13
|
countryId: zod_1.string(),
|
|
20
14
|
birthdate: zod_1.date(),
|
|
21
15
|
gender,
|
|
22
16
|
});
|
|
17
|
+
const patient = basePersonData;
|
|
18
|
+
const user = basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() });
|
|
23
19
|
const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
|
|
24
20
|
const specialty = zod_1.object({
|
|
25
21
|
id: zod_1.number(),
|
|
@@ -28,6 +24,7 @@ const specialty = zod_1.object({
|
|
|
28
24
|
const scheduleAvailabilityFilter = zod_1.object({
|
|
29
25
|
specialtyId: zod_1.number().optional(),
|
|
30
26
|
professionalId: zod_1.number().optional(),
|
|
27
|
+
language: zod_1.string().optional(),
|
|
31
28
|
});
|
|
32
29
|
const availableAppointment = zod_1.object({
|
|
33
30
|
id: zod_1.number().or(zod_1.string()),
|
|
@@ -141,7 +138,7 @@ const diagnosticaPatient = zod_1.object({
|
|
|
141
138
|
firstName: zod_1.string(),
|
|
142
139
|
lastName: zod_1.string(),
|
|
143
140
|
birthday: zod_1.date(),
|
|
144
|
-
identificationType: zod_1.literal('
|
|
141
|
+
identificationType: zod_1.literal('DNI'),
|
|
145
142
|
identificationValue: zod_1.string(),
|
|
146
143
|
gender: gender,
|
|
147
144
|
});
|
|
@@ -154,6 +151,31 @@ const diagnosticaDeepLinkResponse = zod_1.object({
|
|
|
154
151
|
forwardingRequired: zod_1.literal(true),
|
|
155
152
|
deepLink: zod_1.string().url(),
|
|
156
153
|
}).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
|
+
});
|
|
157
179
|
const coverageInfo = zod_1.object({
|
|
158
180
|
financerId: zod_1.number().nullable(),
|
|
159
181
|
defaultAffiliationId: zod_1.number().nullable(),
|
|
@@ -178,16 +200,108 @@ const coverageInfo = zod_1.object({
|
|
|
178
200
|
authorizationCode: zod_1.string().nullable(),
|
|
179
201
|
authorizationCodeExpiration: zod_1.date().nullable(),
|
|
180
202
|
}).nullable();
|
|
181
|
-
const
|
|
182
|
-
identificationType,
|
|
203
|
+
const sendVerificationCodeParams = zod_1.object({
|
|
204
|
+
identificationType: zod_1.number(),
|
|
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
286
|
identificationValue: zod_1.string(),
|
|
287
|
+
gender: gender,
|
|
288
|
+
});
|
|
289
|
+
const externalAppointment = zod_1.object({
|
|
290
|
+
id: zod_1.number(),
|
|
291
|
+
patientName: zod_1.string(),
|
|
292
|
+
birthdate: zod_1.date(),
|
|
293
|
+
appointment: zod_1.string(),
|
|
294
|
+
clinic: zod_1.string(),
|
|
295
|
+
professionalName: zod_1.string(),
|
|
296
|
+
date: zod_1.date(),
|
|
297
|
+
specialty: zod_1.string(),
|
|
298
|
+
modality: zod_1.string(),
|
|
184
299
|
});
|
|
185
300
|
exports.doc24Schemas = {
|
|
186
|
-
identificationType,
|
|
187
301
|
sdkCredentials,
|
|
188
302
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
189
|
-
user
|
|
190
|
-
patient
|
|
303
|
+
user,
|
|
304
|
+
patient,
|
|
191
305
|
specialtyMode,
|
|
192
306
|
specialty,
|
|
193
307
|
scheduleAvailabilityFilter,
|
|
@@ -201,32 +315,14 @@ exports.doc24Schemas = {
|
|
|
201
315
|
date: zod_1.date().optional(),
|
|
202
316
|
startHour: zod_1.string().optional(),
|
|
203
317
|
finishHour: zod_1.string().optional(),
|
|
318
|
+
language: zod_1.string().optional(),
|
|
204
319
|
}),
|
|
205
320
|
scheduleParameters: zod_1.union([
|
|
206
321
|
appointmentScheduleParameters,
|
|
207
322
|
instantScheduleParameters,
|
|
208
323
|
]),
|
|
209
|
-
videoVisit
|
|
210
|
-
|
|
211
|
-
creationDate: zod_1.date(),
|
|
212
|
-
patientId: zod_1.number(),
|
|
213
|
-
user: zod_1.object({
|
|
214
|
-
id: zod_1.number(),
|
|
215
|
-
email: zod_1.string().nullable(),
|
|
216
|
-
phone: zod_1.string().nullable(),
|
|
217
|
-
}),
|
|
218
|
-
vcToken: zod_1.string(),
|
|
219
|
-
appointment: zod_1.object({
|
|
220
|
-
id: zod_1.number(),
|
|
221
|
-
date: zod_1.date(),
|
|
222
|
-
}).optional(),
|
|
223
|
-
videoVisit: zod_1.object({
|
|
224
|
-
id: zod_1.number(),
|
|
225
|
-
status: zod_1.string(),
|
|
226
|
-
}).optional(),
|
|
227
|
-
paymentStatus: zod_1.string().optional(),
|
|
228
|
-
atentionId: zod_1.number().optional(),
|
|
229
|
-
}),
|
|
324
|
+
videoVisit,
|
|
325
|
+
historicalVideoVisit,
|
|
230
326
|
videoVisitDetails: zod_1.object({
|
|
231
327
|
id: zod_1.number(),
|
|
232
328
|
status: zod_1.string(),
|
|
@@ -293,7 +389,7 @@ exports.doc24Schemas = {
|
|
|
293
389
|
enrollmentParams,
|
|
294
390
|
diagnosticaPatientFilter: zod_1.object({
|
|
295
391
|
gender,
|
|
296
|
-
identificationType,
|
|
392
|
+
identificationType: zod_1.literal('DNI'),
|
|
297
393
|
identificationValue: zod_1.string(),
|
|
298
394
|
}),
|
|
299
395
|
diagnosticaHistoryAppointment,
|
|
@@ -301,5 +397,21 @@ exports.doc24Schemas = {
|
|
|
301
397
|
diagnosticaPatient,
|
|
302
398
|
diagnosticaDeepLinkResponse,
|
|
303
399
|
coverageInfo,
|
|
304
|
-
|
|
400
|
+
sendVerificationCodeParams,
|
|
401
|
+
declareUserParams,
|
|
402
|
+
declareUserResponse,
|
|
403
|
+
declarePatientParams,
|
|
404
|
+
declarePatientResponse,
|
|
405
|
+
verificationCodeParams,
|
|
406
|
+
externalLoginParams,
|
|
407
|
+
externalLoginResponse,
|
|
408
|
+
preExternalEnrollmentParams,
|
|
409
|
+
externalEnrollmentParams,
|
|
410
|
+
sendExternalVerificationCodeParams,
|
|
411
|
+
verifyExternalVerificationCodeParams,
|
|
412
|
+
externalResetPasswordParams,
|
|
413
|
+
externalPatient,
|
|
414
|
+
externalAppointment,
|
|
415
|
+
emailOrPhone,
|
|
416
|
+
emailOrPhoneCode,
|
|
305
417
|
};
|
package/lib/test.js
CHANGED
|
@@ -6,23 +6,15 @@ const test = async () => {
|
|
|
6
6
|
const baseSdk = await _1.doc24Sdk({
|
|
7
7
|
url: 'https://tapi.doc24.com.ar/ws/sdk',
|
|
8
8
|
credentials: {
|
|
9
|
-
iss: 'Diagnostica',
|
|
10
|
-
key: 'gS2J78V0Zw8XiZJPGC9RS8TlECgqM2TmVtOzNAZbqputgmtc',
|
|
9
|
+
// iss: 'Diagnostica',
|
|
10
|
+
// key: 'gS2J78V0Zw8XiZJPGC9RS8TlECgqM2TmVtOzNAZbqputgmtc',
|
|
11
|
+
iss: 'wehealthy',
|
|
12
|
+
key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
identificationType: 'nn',
|
|
17
|
-
identificationValue: 'jhYuPe9wu8WmSUroB4tLq8',
|
|
18
|
-
// identificationValue: '6511a9d659bbdfce7385dfda',
|
|
19
|
-
countryId: 'AR',
|
|
20
|
-
birthdate: new Date('2023-09-25'),
|
|
21
|
-
gender: 'm',
|
|
22
|
-
phone: '',
|
|
23
|
-
email: 'nomail@diagnostica.com.ar',
|
|
24
|
-
});
|
|
25
|
-
console.log(userId.userId);
|
|
15
|
+
const userSdk = await baseSdk.getUserInstance(14735);
|
|
16
|
+
const spe = await userSdk.getSpecialties('instant', 'ES');
|
|
17
|
+
console.log(spe);
|
|
26
18
|
// const userSdk = await baseSdk.getUserInstance(20892);
|
|
27
19
|
// const res = await userSdk.updatePatient(
|
|
28
20
|
// {
|
package/lib/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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>;
|
|
5
4
|
type SdkCredentials = TypeOf<typeof doc24Schemas.sdkCredentials>;
|
|
6
5
|
type SdkParams = TypeOf<typeof doc24Schemas.sdkParams>;
|
|
7
6
|
type User = TypeOf<typeof doc24Schemas.user>;
|
|
@@ -13,6 +12,7 @@ export declare namespace Doc24 {
|
|
|
13
12
|
type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
|
|
14
13
|
type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
|
|
15
14
|
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,21 +30,44 @@ 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
|
|
33
|
+
type SendVerificationCodeParams = TypeOf<typeof doc24Schemas.sendVerificationCodeParams>;
|
|
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>;
|
|
34
48
|
type BaseSdk = {
|
|
35
|
-
declareUser: (
|
|
49
|
+
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
50
|
+
getUserId: (user: User) => Promise<number>;
|
|
36
51
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
37
52
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
38
53
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
39
54
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
40
|
-
|
|
55
|
+
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
56
|
+
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
41
57
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
42
58
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
43
59
|
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>;
|
|
44
66
|
};
|
|
45
67
|
type UserSdk = {
|
|
46
|
-
declarePatient: (
|
|
47
|
-
|
|
68
|
+
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
|
69
|
+
getPatientId: (patient: Patient) => Promise<number>;
|
|
70
|
+
deletePatient: (patientId: number) => Promise<void>;
|
|
48
71
|
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
49
72
|
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
50
73
|
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
|
@@ -55,7 +78,7 @@ export declare namespace Doc24 {
|
|
|
55
78
|
getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
|
|
56
79
|
getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
|
|
57
80
|
getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
|
|
58
|
-
getPatientVideoVisitHistory: (patientId: number) => Promise<
|
|
81
|
+
getPatientVideoVisitHistory: (patientId: number) => Promise<HistoricalVideoVisit[]>;
|
|
59
82
|
getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
|
|
60
83
|
getAvailableChatrooms: (patientId: number, specialtyId: number, filter: ChatroomAvailabilityFilter) => Promise<AvailableChatroom[]>;
|
|
61
84
|
createNewChat: (chatParameters: ChatParameters) => Promise<number>;
|
|
@@ -63,6 +86,10 @@ export declare namespace Doc24 {
|
|
|
63
86
|
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
64
87
|
cancelChat: (chatId: number) => Promise<void>;
|
|
65
88
|
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>;
|
|
66
93
|
userId: number;
|
|
67
94
|
};
|
|
68
95
|
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;
|
|
28
27
|
firstName: string;
|
|
29
28
|
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;
|
|
37
38
|
specialty: {
|
|
38
39
|
id: number;
|
|
39
40
|
description: string;
|
|
40
41
|
};
|
|
41
|
-
paymentStatus: string;
|
|
42
42
|
chatRoomId: number;
|
|
43
43
|
startDate: Date;
|
|
44
44
|
lastEventDate: Date;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getExternalStudiesHistoryLink: (patient: {
|
|
4
|
+
identificationType: "DNI";
|
|
5
|
+
identificationValue: string;
|
|
6
|
+
birthdate: Date;
|
|
7
|
+
gender: "m" | "f";
|
|
8
|
+
}) => Promise<string | null>;
|
|
9
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
|
|
10
|
+
getExternalAppointments: () => Promise<{
|
|
11
|
+
date: Date;
|
|
12
|
+
birthdate: Date;
|
|
13
|
+
appointment: string;
|
|
14
|
+
id: number;
|
|
15
|
+
specialty: string;
|
|
16
|
+
patientName: string;
|
|
17
|
+
clinic: string;
|
|
18
|
+
professionalName: string;
|
|
19
|
+
modality: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
cancelExternalAppointment: (appointmentId: {
|
|
22
|
+
date: Date;
|
|
23
|
+
birthdate: Date;
|
|
24
|
+
appointment: string;
|
|
25
|
+
id: number;
|
|
26
|
+
specialty: string;
|
|
27
|
+
patientName: string;
|
|
28
|
+
clinic: string;
|
|
29
|
+
professionalName: string;
|
|
30
|
+
modality: string;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExternalMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const getExternalMethods = (makeRequest) => {
|
|
10
|
+
const getExternalStudiesHistoryLink = async (patient) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const path = '/history-external-studies';
|
|
13
|
+
const response = await makeRequest('POST', path, {
|
|
14
|
+
patient: mapPatientData(patient),
|
|
15
|
+
});
|
|
16
|
+
return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
|
|
17
|
+
};
|
|
18
|
+
const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
|
|
19
|
+
const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
|
|
20
|
+
const response = await makeRequest('GET', path);
|
|
21
|
+
return response.data.link;
|
|
22
|
+
};
|
|
23
|
+
const getExternalAppointments = async () => {
|
|
24
|
+
const path = '/external-appointments';
|
|
25
|
+
const response = await makeRequest('GET', path);
|
|
26
|
+
return response.data.appointments.map((a) => ({
|
|
27
|
+
id: a.appointment_id,
|
|
28
|
+
patientName: a.patient_name,
|
|
29
|
+
birthdate: utils_1.parseDate(a.birthdate),
|
|
30
|
+
appointment: a.appointment,
|
|
31
|
+
clinic: a.clinic,
|
|
32
|
+
professionalName: a.professional,
|
|
33
|
+
date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
|
|
34
|
+
specialty: a.specialty,
|
|
35
|
+
modality: a.modality,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
const cancelExternalAppointment = async (appointment) => {
|
|
39
|
+
const path = `/cancel-external-appointment`;
|
|
40
|
+
await makeRequest('POST', path, {
|
|
41
|
+
appointment_id: appointment.id,
|
|
42
|
+
patient_name: appointment.patientName,
|
|
43
|
+
birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
|
|
44
|
+
appointment: appointment.appointment,
|
|
45
|
+
clinic: appointment.clinic,
|
|
46
|
+
professional: appointment.professionalName,
|
|
47
|
+
day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
|
|
48
|
+
hour: date_fns_1.format(appointment.date, 'HH:mm'),
|
|
49
|
+
specialty: appointment.specialty,
|
|
50
|
+
modality: appointment.modality,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
|
|
56
|
+
getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
|
|
57
|
+
getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
|
|
58
|
+
cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.getExternalMethods = getExternalMethods;
|
|
62
|
+
const mapPatientData = (patient) => {
|
|
63
|
+
return {
|
|
64
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
65
|
+
id_type: 'dni',
|
|
66
|
+
id_value: patient.identificationValue,
|
|
67
|
+
gender: patient.gender.toLocaleUpperCase(),
|
|
68
|
+
};
|
|
69
|
+
};
|
package/lib/userSdk/index.js
CHANGED
|
@@ -3,6 +3,7 @@ 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");
|
|
6
7
|
const patients_1 = require("./patients");
|
|
7
8
|
const schedule_1 = require("./schedule");
|
|
8
9
|
const specialties_1 = require("./specialties");
|
|
@@ -14,12 +15,14 @@ const userSdk = async (url, credentials, userId) => {
|
|
|
14
15
|
const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
|
|
15
16
|
const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
|
|
16
17
|
const chatMethods = chat_1.getChatMethods(makeRequest);
|
|
18
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
17
19
|
const sdk = {
|
|
18
20
|
...patientMethods,
|
|
19
21
|
...specialtyMethods,
|
|
20
22
|
...scheduleMethods,
|
|
21
23
|
...videoVisitMethods,
|
|
22
24
|
...chatMethods,
|
|
25
|
+
...externalMethods,
|
|
23
26
|
userId,
|
|
24
27
|
};
|
|
25
28
|
return sdk;
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
export declare const getPatientMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
declarePatient: (
|
|
3
|
+
declarePatient: (params: {
|
|
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: {
|
|
4
29
|
firstName: string;
|
|
5
30
|
lastName: string;
|
|
6
|
-
identificationType:
|
|
31
|
+
identificationType: number;
|
|
7
32
|
identificationValue: string;
|
|
8
|
-
gender: "m" | "f";
|
|
9
33
|
countryId: string;
|
|
10
34
|
birthdate: Date;
|
|
11
|
-
}) => Promise<number>;
|
|
12
|
-
updatePatient: (oldIdentification: {
|
|
13
|
-
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
|
|
14
|
-
identificationValue: string;
|
|
15
|
-
}, patient: {
|
|
16
|
-
firstName: string;
|
|
17
|
-
lastName: string;
|
|
18
|
-
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn";
|
|
19
|
-
identificationValue: string;
|
|
20
35
|
gender: "m" | "f";
|
|
21
|
-
countryId: string;
|
|
22
|
-
birthdate: Date;
|
|
23
36
|
}) => Promise<number>;
|
|
37
|
+
deletePatient: (patientId: number) => Promise<void>;
|
|
24
38
|
};
|
package/lib/userSdk/patients.js
CHANGED
|
@@ -5,42 +5,61 @@ 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");
|
|
9
8
|
const getPatientMethods = (makeRequest) => {
|
|
10
|
-
const declarePatient = async (patient) => {
|
|
9
|
+
const declarePatient = async ({ patient, channel, code, }) => {
|
|
10
|
+
const path = '/patient';
|
|
11
11
|
const mappedPatient = {
|
|
12
12
|
lastname: patient.lastName,
|
|
13
13
|
firstname: patient.firstName,
|
|
14
|
-
identification_type:
|
|
14
|
+
identification_type: 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
|
|
20
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
21
|
+
const response = await makeRequest('POST', path, {
|
|
21
22
|
user_data: mappedPatient,
|
|
23
|
+
channel: parsedChannel,
|
|
24
|
+
code,
|
|
22
25
|
});
|
|
23
|
-
|
|
26
|
+
const data = response.data;
|
|
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 };
|
|
24
38
|
};
|
|
25
|
-
const
|
|
39
|
+
const getPatientId = async (patient) => {
|
|
40
|
+
const path = '/search-patient';
|
|
26
41
|
const mappedPatient = {
|
|
27
42
|
lastname: patient.lastName,
|
|
28
43
|
firstname: patient.firstName,
|
|
29
|
-
identification_type:
|
|
44
|
+
identification_type: patient.identificationType,
|
|
30
45
|
identification_value: patient.identificationValue,
|
|
31
46
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
32
47
|
gender: patient.gender.toUpperCase(),
|
|
48
|
+
country_id: patient.countryId,
|
|
33
49
|
};
|
|
34
|
-
const response = await makeRequest('POST',
|
|
35
|
-
old_identification_type: utils_1.getIndetificationTypeId(oldIdentificaiton.identificationType),
|
|
36
|
-
old_identification_value: oldIdentificaiton.identificationValue,
|
|
50
|
+
const response = await makeRequest('POST', path, {
|
|
37
51
|
user_data: mappedPatient,
|
|
38
52
|
});
|
|
39
53
|
return response.data.patient_id;
|
|
40
54
|
};
|
|
55
|
+
const deletePatient = async (patientId) => {
|
|
56
|
+
const path = `/patient/${patientId}`;
|
|
57
|
+
await makeRequest('DELETE', path);
|
|
58
|
+
};
|
|
41
59
|
return {
|
|
42
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.
|
|
43
|
-
|
|
60
|
+
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
61
|
+
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
62
|
+
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
44
63
|
};
|
|
45
64
|
};
|
|
46
65
|
exports.getPatientMethods = getPatientMethods;
|