@integraciones_doc24/sdk 1.9.1 → 1.10.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/lib/baseSdk/external.d.ts +29 -0
- package/lib/baseSdk/external.js +56 -0
- package/lib/index.d.ts +29 -0
- package/lib/schemas.d.ts +121 -0
- package/lib/schemas.js +21 -0
- package/lib/types.d.ts +6 -0
- package/package.json +1 -1
- package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
- package/lib/lib/baseSdk/diagnostica.js +0 -79
- package/lib/lib/baseSdk/index.d.ts +0 -161
- package/lib/lib/baseSdk/index.js +0 -66
- package/lib/lib/baseSdk/user.d.ts +0 -41
- package/lib/lib/baseSdk/user.js +0 -130
- package/lib/lib/index.d.ts +0 -182
- package/lib/lib/index.js +0 -22
- package/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
- package/lib/lib/lib/baseSdk/diagnostica.js +0 -79
- package/lib/lib/lib/baseSdk/index.d.ts +0 -51
- package/lib/lib/lib/baseSdk/index.js +0 -66
- package/lib/lib/lib/baseSdk/user.d.ts +0 -9
- package/lib/lib/lib/baseSdk/user.js +0 -130
- package/lib/lib/lib/index.d.ts +0 -168
- package/lib/lib/lib/index.js +0 -22
- package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
- package/lib/lib/lib/lib/baseSdk/diagnostica.js +0 -79
- package/lib/lib/lib/lib/baseSdk/index.d.ts +0 -14
- package/lib/lib/lib/lib/baseSdk/index.js +0 -66
- package/lib/lib/lib/lib/baseSdk/user.d.ts +0 -9
- package/lib/lib/lib/lib/baseSdk/user.js +0 -130
- package/lib/lib/lib/lib/index.d.ts +0 -58
- package/lib/lib/lib/lib/index.js +0 -22
- package/lib/lib/lib/lib/request/index.d.ts +0 -2
- package/lib/lib/lib/lib/request/index.js +0 -26
- package/lib/lib/lib/lib/request/token.d.ts +0 -2
- package/lib/lib/lib/lib/request/token.js +0 -34
- package/lib/lib/lib/lib/request/validation.d.ts +0 -10
- package/lib/lib/lib/lib/request/validation.js +0 -28
- package/lib/lib/lib/lib/schemas.d.ts +0 -1334
- package/lib/lib/lib/lib/schemas.js +0 -325
- package/lib/lib/lib/lib/test.d.ts +0 -1
- package/lib/lib/lib/lib/test.js +0 -55
- package/lib/lib/lib/lib/types.d.ts +0 -1
- package/lib/lib/lib/lib/types.js +0 -2
- package/lib/lib/lib/lib/userSdk/chat.d.ts +0 -9
- package/lib/lib/lib/lib/userSdk/chat.js +0 -98
- package/lib/lib/lib/lib/userSdk/index.d.ts +0 -24
- package/lib/lib/lib/lib/userSdk/index.js +0 -27
- package/lib/lib/lib/lib/userSdk/patients.d.ts +0 -5
- package/lib/lib/lib/lib/userSdk/patients.js +0 -55
- package/lib/lib/lib/lib/userSdk/schedule.d.ts +0 -7
- package/lib/lib/lib/lib/userSdk/schedule.js +0 -76
- package/lib/lib/lib/lib/userSdk/specialties.d.ts +0 -4
- package/lib/lib/lib/lib/userSdk/specialties.js +0 -19
- package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
- package/lib/lib/lib/lib/userSdk/videoVisit.js +0 -147
- package/lib/lib/lib/lib/utils.d.ts +0 -4
- package/lib/lib/lib/lib/utils.js +0 -19
- package/lib/lib/lib/lib/webhook/index.d.ts +0 -8
- package/lib/lib/lib/lib/webhook/index.js +0 -55
- package/lib/lib/lib/lib/webhook/responses.d.ts +0 -36
- package/lib/lib/lib/lib/webhook/responses.js +0 -42
- package/lib/lib/lib/lib/webhook/token.d.ts +0 -2
- package/lib/lib/lib/lib/webhook/token.js +0 -23
- package/lib/lib/lib/request/index.d.ts +0 -2
- package/lib/lib/lib/request/index.js +0 -26
- package/lib/lib/lib/request/token.d.ts +0 -2
- package/lib/lib/lib/request/token.js +0 -34
- package/lib/lib/lib/request/validation.d.ts +0 -10
- package/lib/lib/lib/request/validation.js +0 -28
- package/lib/lib/lib/schemas.d.ts +0 -1334
- package/lib/lib/lib/schemas.js +0 -325
- package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +0 -6
- package/lib/lib/lib/src/baseSdk/diagnostica.js +0 -79
- package/lib/lib/lib/src/baseSdk/index.d.ts +0 -51
- package/lib/lib/lib/src/baseSdk/index.js +0 -66
- package/lib/lib/lib/src/baseSdk/user.d.ts +0 -9
- package/lib/lib/lib/src/baseSdk/user.js +0 -130
- package/lib/lib/lib/src/index.d.ts +0 -169
- package/lib/lib/lib/src/index.js +0 -22
- package/lib/lib/lib/src/request/index.d.ts +0 -2
- package/lib/lib/lib/src/request/index.js +0 -26
- package/lib/lib/lib/src/request/token.d.ts +0 -2
- package/lib/lib/lib/src/request/token.js +0 -34
- package/lib/lib/lib/src/request/validation.d.ts +0 -10
- package/lib/lib/lib/src/request/validation.js +0 -28
- package/lib/lib/lib/src/schemas.d.ts +0 -1340
- package/lib/lib/lib/src/schemas.js +0 -325
- package/lib/lib/lib/src/types.d.ts +0 -1
- package/lib/lib/lib/src/types.js +0 -2
- package/lib/lib/lib/src/userSdk/chat.d.ts +0 -9
- package/lib/lib/lib/src/userSdk/chat.js +0 -98
- package/lib/lib/lib/src/userSdk/index.d.ts +0 -102
- package/lib/lib/lib/src/userSdk/index.js +0 -27
- package/lib/lib/lib/src/userSdk/patients.d.ts +0 -5
- package/lib/lib/lib/src/userSdk/patients.js +0 -55
- package/lib/lib/lib/src/userSdk/schedule.d.ts +0 -7
- package/lib/lib/lib/src/userSdk/schedule.js +0 -76
- package/lib/lib/lib/src/userSdk/specialties.d.ts +0 -4
- package/lib/lib/lib/src/userSdk/specialties.js +0 -19
- package/lib/lib/lib/src/userSdk/videoVisit.d.ts +0 -10
- package/lib/lib/lib/src/userSdk/videoVisit.js +0 -147
- package/lib/lib/lib/src/utils.d.ts +0 -4
- package/lib/lib/lib/src/utils.js +0 -19
- package/lib/lib/lib/src/webhook/index.d.ts +0 -8
- package/lib/lib/lib/src/webhook/index.js +0 -55
- package/lib/lib/lib/src/webhook/responses.d.ts +0 -36
- package/lib/lib/lib/src/webhook/responses.js +0 -42
- package/lib/lib/lib/src/webhook/token.d.ts +0 -2
- package/lib/lib/lib/src/webhook/token.js +0 -23
- package/lib/lib/lib/test.d.ts +0 -1
- package/lib/lib/lib/test.js +0 -55
- package/lib/lib/lib/types.d.ts +0 -1
- package/lib/lib/lib/types.js +0 -2
- package/lib/lib/lib/userSdk/chat.d.ts +0 -9
- package/lib/lib/lib/userSdk/chat.js +0 -98
- package/lib/lib/lib/userSdk/index.d.ts +0 -102
- package/lib/lib/lib/userSdk/index.js +0 -27
- package/lib/lib/lib/userSdk/patients.d.ts +0 -5
- package/lib/lib/lib/userSdk/patients.js +0 -55
- package/lib/lib/lib/userSdk/schedule.d.ts +0 -7
- package/lib/lib/lib/userSdk/schedule.js +0 -76
- package/lib/lib/lib/userSdk/specialties.d.ts +0 -4
- package/lib/lib/lib/userSdk/specialties.js +0 -19
- package/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
- package/lib/lib/lib/userSdk/videoVisit.js +0 -147
- package/lib/lib/lib/utils.d.ts +0 -4
- package/lib/lib/lib/utils.js +0 -19
- package/lib/lib/lib/webhook/index.d.ts +0 -8
- package/lib/lib/lib/webhook/index.js +0 -55
- package/lib/lib/lib/webhook/responses.d.ts +0 -36
- package/lib/lib/lib/webhook/responses.js +0 -42
- package/lib/lib/lib/webhook/token.d.ts +0 -2
- package/lib/lib/lib/webhook/token.js +0 -23
- package/lib/lib/request/index.d.ts +0 -2
- package/lib/lib/request/index.js +0 -26
- package/lib/lib/request/token.d.ts +0 -2
- package/lib/lib/request/token.js +0 -34
- package/lib/lib/request/validation.d.ts +0 -10
- package/lib/lib/request/validation.js +0 -28
- package/lib/lib/schemas.d.ts +0 -1334
- package/lib/lib/schemas.js +0 -325
- package/lib/lib/src/baseSdk/diagnostica.d.ts +0 -11
- package/lib/lib/src/baseSdk/diagnostica.js +0 -79
- package/lib/lib/src/baseSdk/index.d.ts +0 -162
- package/lib/lib/src/baseSdk/index.js +0 -66
- package/lib/lib/src/baseSdk/user.d.ts +0 -41
- package/lib/lib/src/baseSdk/user.js +0 -130
- package/lib/lib/src/index.d.ts +0 -183
- package/lib/lib/src/index.js +0 -22
- package/lib/lib/src/request/index.d.ts +0 -2
- package/lib/lib/src/request/index.js +0 -26
- package/lib/lib/src/request/token.d.ts +0 -2
- package/lib/lib/src/request/token.js +0 -34
- package/lib/lib/src/request/validation.d.ts +0 -10
- package/lib/lib/src/request/validation.js +0 -28
- package/lib/lib/src/schemas.d.ts +0 -1340
- package/lib/lib/src/schemas.js +0 -325
- package/lib/lib/src/types.d.ts +0 -1
- package/lib/lib/src/types.js +0 -2
- package/lib/lib/src/userSdk/chat.d.ts +0 -9
- package/lib/lib/src/userSdk/chat.js +0 -98
- package/lib/lib/src/userSdk/index.d.ts +0 -241
- package/lib/lib/src/userSdk/index.js +0 -27
- package/lib/lib/src/userSdk/patients.d.ts +0 -13
- package/lib/lib/src/userSdk/patients.js +0 -55
- package/lib/lib/src/userSdk/schedule.d.ts +0 -15
- package/lib/lib/src/userSdk/schedule.js +0 -76
- package/lib/lib/src/userSdk/specialties.d.ts +0 -4
- package/lib/lib/src/userSdk/specialties.js +0 -19
- package/lib/lib/src/userSdk/videoVisit.d.ts +0 -72
- package/lib/lib/src/userSdk/videoVisit.js +0 -147
- package/lib/lib/src/utils.d.ts +0 -4
- package/lib/lib/src/utils.js +0 -19
- package/lib/lib/src/webhook/index.d.ts +0 -8
- package/lib/lib/src/webhook/index.js +0 -55
- package/lib/lib/src/webhook/responses.d.ts +0 -36
- package/lib/lib/src/webhook/responses.js +0 -42
- package/lib/lib/src/webhook/token.d.ts +0 -2
- package/lib/lib/src/webhook/token.js +0 -23
- package/lib/lib/test.d.ts +0 -1
- package/lib/lib/test.js +0 -55
- package/lib/lib/types.d.ts +0 -1
- package/lib/lib/types.js +0 -2
- package/lib/lib/userSdk/chat.d.ts +0 -9
- package/lib/lib/userSdk/chat.js +0 -98
- package/lib/lib/userSdk/index.d.ts +0 -240
- package/lib/lib/userSdk/index.js +0 -27
- package/lib/lib/userSdk/patients.d.ts +0 -13
- package/lib/lib/userSdk/patients.js +0 -55
- package/lib/lib/userSdk/schedule.d.ts +0 -15
- package/lib/lib/userSdk/schedule.js +0 -76
- package/lib/lib/userSdk/specialties.d.ts +0 -4
- package/lib/lib/userSdk/specialties.js +0 -19
- package/lib/lib/userSdk/videoVisit.d.ts +0 -72
- package/lib/lib/userSdk/videoVisit.js +0 -147
- package/lib/lib/utils.d.ts +0 -4
- package/lib/lib/utils.js +0 -19
- package/lib/lib/webhook/index.d.ts +0 -8
- package/lib/lib/webhook/index.js +0 -55
- package/lib/lib/webhook/responses.d.ts +0 -36
- package/lib/lib/webhook/responses.js +0 -42
- package/lib/lib/webhook/token.d.ts +0 -2
- package/lib/lib/webhook/token.js +0 -23
- package/lib/src/baseSdk/diagnostica.d.ts +0 -54
- package/lib/src/baseSdk/diagnostica.js +0 -79
- package/lib/src/baseSdk/index.d.ts +0 -2
- package/lib/src/baseSdk/index.js +0 -66
- package/lib/src/baseSdk/user.d.ts +0 -89
- package/lib/src/baseSdk/user.js +0 -130
- package/lib/src/index.d.ts +0 -188
- package/lib/src/index.js +0 -22
- package/lib/src/request/index.d.ts +0 -3
- package/lib/src/request/index.js +0 -26
- package/lib/src/request/token.d.ts +0 -2
- package/lib/src/request/token.js +0 -34
- package/lib/src/request/validation.d.ts +0 -10
- package/lib/src/request/validation.js +0 -28
- package/lib/src/schemas.d.ts +0 -1311
- package/lib/src/schemas.js +0 -325
- package/lib/src/types.d.ts +0 -124
- package/lib/src/types.js +0 -2
- package/lib/src/userSdk/chat.d.ts +0 -57
- package/lib/src/userSdk/chat.js +0 -98
- package/lib/src/userSdk/index.d.ts +0 -2
- package/lib/src/userSdk/index.js +0 -27
- package/lib/src/userSdk/patients.d.ts +0 -33
- package/lib/src/userSdk/patients.js +0 -55
- package/lib/src/userSdk/schedule.d.ts +0 -44
- package/lib/src/userSdk/schedule.js +0 -76
- package/lib/src/userSdk/specialties.d.ts +0 -7
- package/lib/src/userSdk/specialties.js +0 -19
- package/lib/src/userSdk/videoVisit.d.ts +0 -111
- package/lib/src/userSdk/videoVisit.js +0 -147
- package/lib/src/utils.d.ts +0 -4
- package/lib/src/utils.js +0 -19
- package/lib/src/webhook/index.d.ts +0 -2
- package/lib/src/webhook/index.js +0 -55
- package/lib/src/webhook/responses.d.ts +0 -35
- package/lib/src/webhook/responses.js +0 -42
- package/lib/src/webhook/token.d.ts +0 -2
- package/lib/src/webhook/token.js +0 -23
- package/lib/test.d.ts +0 -1
- package/lib/test.js +0 -21
|
@@ -174,4 +174,33 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
174
174
|
emailCode?: undefined;
|
|
175
175
|
phoneCode: string;
|
|
176
176
|
})) => Promise<any>;
|
|
177
|
+
getExternalStudiesHistoryLink: (patient: {
|
|
178
|
+
identificationType: "DNI";
|
|
179
|
+
identificationValue: string;
|
|
180
|
+
birthdate: Date;
|
|
181
|
+
gender: "m" | "f";
|
|
182
|
+
}) => Promise<string>;
|
|
183
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
|
|
184
|
+
getExternalAppointments: () => Promise<{
|
|
185
|
+
date: Date;
|
|
186
|
+
birthdate: Date;
|
|
187
|
+
appointment: string;
|
|
188
|
+
id: number;
|
|
189
|
+
specialty: string;
|
|
190
|
+
patientName: string;
|
|
191
|
+
clinic: string;
|
|
192
|
+
professionalName: string;
|
|
193
|
+
modality: string;
|
|
194
|
+
}[]>;
|
|
195
|
+
cancelExternalAppointment: (appointmentId: {
|
|
196
|
+
date: Date;
|
|
197
|
+
birthdate: Date;
|
|
198
|
+
appointment: string;
|
|
199
|
+
id: number;
|
|
200
|
+
specialty: string;
|
|
201
|
+
patientName: string;
|
|
202
|
+
clinic: string;
|
|
203
|
+
professionalName: string;
|
|
204
|
+
modality: string;
|
|
205
|
+
}) => Promise<void>;
|
|
177
206
|
};
|
package/lib/baseSdk/external.js
CHANGED
|
@@ -5,6 +5,7 @@ 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 getExternalMethods = (makeRequest) => {
|
|
9
10
|
const externalLogin = async ({ user, password, }) => {
|
|
10
11
|
const path = '/external-login';
|
|
@@ -84,6 +85,49 @@ const getExternalMethods = (makeRequest) => {
|
|
|
84
85
|
});
|
|
85
86
|
return response.data;
|
|
86
87
|
};
|
|
88
|
+
const getExternalStudiesHistoryLink = async (patient) => {
|
|
89
|
+
const path = '/history-external-studies';
|
|
90
|
+
const response = await makeRequest('POST', path, {
|
|
91
|
+
patient: mapPatientData(patient),
|
|
92
|
+
});
|
|
93
|
+
return response.data.info.link;
|
|
94
|
+
};
|
|
95
|
+
const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
|
|
96
|
+
const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
|
|
97
|
+
const response = await makeRequest('GET', path);
|
|
98
|
+
return response.data.link;
|
|
99
|
+
};
|
|
100
|
+
const getExternalAppointments = async () => {
|
|
101
|
+
const path = '/external-appointments';
|
|
102
|
+
const response = await makeRequest('GET', path);
|
|
103
|
+
return response.data.appointments.map((a) => ({
|
|
104
|
+
id: a.appointment_id,
|
|
105
|
+
patientName: a.patient_name,
|
|
106
|
+
birthdate: utils_1.parseDate(a.birthdate),
|
|
107
|
+
appointment: a.appointment,
|
|
108
|
+
clinic: a.clinic,
|
|
109
|
+
professionalName: a.professional,
|
|
110
|
+
date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
|
|
111
|
+
specialty: a.specialty,
|
|
112
|
+
modality: a.modality,
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
const cancelExternalAppointment = async (appointment) => {
|
|
116
|
+
const path = `/cancel-external-appointment`;
|
|
117
|
+
await makeRequest('POST', path, {
|
|
118
|
+
appointment_id: appointment.id,
|
|
119
|
+
patient_name: appointment.patientName,
|
|
120
|
+
birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
|
|
121
|
+
appointment: appointment.appointment,
|
|
122
|
+
clinic: appointment.clinic,
|
|
123
|
+
professional: appointment.professionalName,
|
|
124
|
+
day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
|
|
125
|
+
hour: date_fns_1.format(appointment.date, 'HH:mm'),
|
|
126
|
+
specialty: appointment.specialty,
|
|
127
|
+
modality: appointment.modality,
|
|
128
|
+
});
|
|
129
|
+
return;
|
|
130
|
+
};
|
|
87
131
|
return {
|
|
88
132
|
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
89
133
|
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
@@ -91,6 +135,18 @@ const getExternalMethods = (makeRequest) => {
|
|
|
91
135
|
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
|
|
92
136
|
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
93
137
|
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
138
|
+
getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string(), getExternalStudiesHistoryLink),
|
|
139
|
+
getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string(), getExternalAppointmentsLink),
|
|
140
|
+
getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
|
|
141
|
+
cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
|
|
94
142
|
};
|
|
95
143
|
};
|
|
96
144
|
exports.getExternalMethods = getExternalMethods;
|
|
145
|
+
const mapPatientData = (patient) => {
|
|
146
|
+
return {
|
|
147
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
148
|
+
id_type: 'dni',
|
|
149
|
+
id_value: patient.identificationValue,
|
|
150
|
+
gender: patient.gender.toLocaleUpperCase(),
|
|
151
|
+
};
|
|
152
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -360,5 +360,34 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
360
360
|
emailCode?: undefined;
|
|
361
361
|
phoneCode: string;
|
|
362
362
|
})) => Promise<any>;
|
|
363
|
+
getExternalStudiesHistoryLink: (patient: {
|
|
364
|
+
identificationType: "DNI";
|
|
365
|
+
identificationValue: string;
|
|
366
|
+
birthdate: Date;
|
|
367
|
+
gender: "m" | "f";
|
|
368
|
+
}) => Promise<string>;
|
|
369
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
|
|
370
|
+
getExternalAppointments: () => Promise<{
|
|
371
|
+
date: Date;
|
|
372
|
+
birthdate: Date;
|
|
373
|
+
appointment: string;
|
|
374
|
+
id: number;
|
|
375
|
+
specialty: string;
|
|
376
|
+
patientName: string;
|
|
377
|
+
clinic: string;
|
|
378
|
+
professionalName: string;
|
|
379
|
+
modality: string;
|
|
380
|
+
}[]>;
|
|
381
|
+
cancelExternalAppointment: (appointmentId: {
|
|
382
|
+
date: Date;
|
|
383
|
+
birthdate: Date;
|
|
384
|
+
appointment: string;
|
|
385
|
+
id: number;
|
|
386
|
+
specialty: string;
|
|
387
|
+
patientName: string;
|
|
388
|
+
clinic: string;
|
|
389
|
+
professionalName: string;
|
|
390
|
+
modality: string;
|
|
391
|
+
}) => Promise<void>;
|
|
363
392
|
}>;
|
|
364
393
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -1595,4 +1595,125 @@ export declare const doc24Schemas: {
|
|
|
1595
1595
|
emailCode?: undefined;
|
|
1596
1596
|
phoneCode: string;
|
|
1597
1597
|
}>>;
|
|
1598
|
+
externalPatient: import("zod").ZodObject<{
|
|
1599
|
+
birthdate: import("zod").ZodDate;
|
|
1600
|
+
identificationType: import("zod").ZodLiteral<"DNI">;
|
|
1601
|
+
identificationValue: import("zod").ZodString;
|
|
1602
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1603
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1604
|
+
identificationType: "DNI";
|
|
1605
|
+
identificationValue: string;
|
|
1606
|
+
birthdate: Date;
|
|
1607
|
+
gender: "m" | "f";
|
|
1608
|
+
}, {
|
|
1609
|
+
identificationType: "DNI";
|
|
1610
|
+
identificationValue: string;
|
|
1611
|
+
birthdate: Date;
|
|
1612
|
+
gender: "m" | "f";
|
|
1613
|
+
}>;
|
|
1614
|
+
externalAppointment: import("zod").ZodObject<{
|
|
1615
|
+
id: import("zod").ZodNumber;
|
|
1616
|
+
patientName: import("zod").ZodString;
|
|
1617
|
+
birthdate: import("zod").ZodDate;
|
|
1618
|
+
appointment: import("zod").ZodString;
|
|
1619
|
+
clinic: import("zod").ZodString;
|
|
1620
|
+
professionalName: import("zod").ZodString;
|
|
1621
|
+
date: import("zod").ZodDate;
|
|
1622
|
+
specialty: import("zod").ZodString;
|
|
1623
|
+
modality: import("zod").ZodString;
|
|
1624
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1625
|
+
date: Date;
|
|
1626
|
+
birthdate: Date;
|
|
1627
|
+
appointment: string;
|
|
1628
|
+
id: number;
|
|
1629
|
+
specialty: string;
|
|
1630
|
+
patientName: string;
|
|
1631
|
+
clinic: string;
|
|
1632
|
+
professionalName: string;
|
|
1633
|
+
modality: string;
|
|
1634
|
+
}, {
|
|
1635
|
+
date: Date;
|
|
1636
|
+
birthdate: Date;
|
|
1637
|
+
appointment: string;
|
|
1638
|
+
id: number;
|
|
1639
|
+
specialty: string;
|
|
1640
|
+
patientName: string;
|
|
1641
|
+
clinic: string;
|
|
1642
|
+
professionalName: string;
|
|
1643
|
+
modality: string;
|
|
1644
|
+
}>;
|
|
1645
|
+
emailOrPhone: import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1646
|
+
email: import("zod").ZodString;
|
|
1647
|
+
phone: import("zod").ZodString;
|
|
1648
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1649
|
+
phone: string;
|
|
1650
|
+
email: string;
|
|
1651
|
+
}, {
|
|
1652
|
+
phone: string;
|
|
1653
|
+
email: string;
|
|
1654
|
+
}>, import("zod").ZodObject<{
|
|
1655
|
+
email: import("zod").ZodString;
|
|
1656
|
+
phone: import("zod").ZodUndefined;
|
|
1657
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1658
|
+
phone?: undefined;
|
|
1659
|
+
email: string;
|
|
1660
|
+
}, {
|
|
1661
|
+
phone?: undefined;
|
|
1662
|
+
email: string;
|
|
1663
|
+
}>, import("zod").ZodObject<{
|
|
1664
|
+
email: import("zod").ZodUndefined;
|
|
1665
|
+
phone: import("zod").ZodString;
|
|
1666
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1667
|
+
email?: undefined;
|
|
1668
|
+
phone: string;
|
|
1669
|
+
}, {
|
|
1670
|
+
email?: undefined;
|
|
1671
|
+
phone: string;
|
|
1672
|
+
}>]>, {
|
|
1673
|
+
phone: string;
|
|
1674
|
+
email: string;
|
|
1675
|
+
} | {
|
|
1676
|
+
phone?: undefined;
|
|
1677
|
+
email: string;
|
|
1678
|
+
} | {
|
|
1679
|
+
email?: undefined;
|
|
1680
|
+
phone: string;
|
|
1681
|
+
}>;
|
|
1682
|
+
emailOrPhoneCode: import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1683
|
+
emailCode: import("zod").ZodString;
|
|
1684
|
+
phoneCode: import("zod").ZodString;
|
|
1685
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1686
|
+
emailCode: string;
|
|
1687
|
+
phoneCode: string;
|
|
1688
|
+
}, {
|
|
1689
|
+
emailCode: string;
|
|
1690
|
+
phoneCode: string;
|
|
1691
|
+
}>, import("zod").ZodObject<{
|
|
1692
|
+
emailCode: import("zod").ZodString;
|
|
1693
|
+
phoneCode: import("zod").ZodUndefined;
|
|
1694
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1695
|
+
phoneCode?: undefined;
|
|
1696
|
+
emailCode: string;
|
|
1697
|
+
}, {
|
|
1698
|
+
phoneCode?: undefined;
|
|
1699
|
+
emailCode: string;
|
|
1700
|
+
}>, import("zod").ZodObject<{
|
|
1701
|
+
emailCode: import("zod").ZodUndefined;
|
|
1702
|
+
phoneCode: import("zod").ZodString;
|
|
1703
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1704
|
+
emailCode?: undefined;
|
|
1705
|
+
phoneCode: string;
|
|
1706
|
+
}, {
|
|
1707
|
+
emailCode?: undefined;
|
|
1708
|
+
phoneCode: string;
|
|
1709
|
+
}>]>, {
|
|
1710
|
+
emailCode: string;
|
|
1711
|
+
phoneCode: string;
|
|
1712
|
+
} | {
|
|
1713
|
+
phoneCode?: undefined;
|
|
1714
|
+
emailCode: string;
|
|
1715
|
+
} | {
|
|
1716
|
+
emailCode?: undefined;
|
|
1717
|
+
phoneCode: string;
|
|
1718
|
+
}>;
|
|
1598
1719
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -255,6 +255,23 @@ const externalResetPasswordParams = zod_1.object({
|
|
|
255
255
|
birthdate: zod_1.date(),
|
|
256
256
|
password: zod_1.string(),
|
|
257
257
|
}).and(emailOrPhoneCode);
|
|
258
|
+
const externalPatient = zod_1.object({
|
|
259
|
+
birthdate: zod_1.date(),
|
|
260
|
+
identificationType: zod_1.literal('DNI'),
|
|
261
|
+
identificationValue: zod_1.string(),
|
|
262
|
+
gender: gender,
|
|
263
|
+
});
|
|
264
|
+
const externalAppointment = zod_1.object({
|
|
265
|
+
id: zod_1.number(),
|
|
266
|
+
patientName: zod_1.string(),
|
|
267
|
+
birthdate: zod_1.date(),
|
|
268
|
+
appointment: zod_1.string(),
|
|
269
|
+
clinic: zod_1.string(),
|
|
270
|
+
professionalName: zod_1.string(),
|
|
271
|
+
date: zod_1.date(),
|
|
272
|
+
specialty: zod_1.string(),
|
|
273
|
+
modality: zod_1.string(),
|
|
274
|
+
});
|
|
258
275
|
exports.doc24Schemas = {
|
|
259
276
|
sdkCredentials,
|
|
260
277
|
sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
|
|
@@ -387,4 +404,8 @@ exports.doc24Schemas = {
|
|
|
387
404
|
sendExternalVerificationCodeParams,
|
|
388
405
|
verifyExternalVerificationCodeParams,
|
|
389
406
|
externalResetPasswordParams,
|
|
407
|
+
externalPatient,
|
|
408
|
+
externalAppointment,
|
|
409
|
+
emailOrPhone,
|
|
410
|
+
emailOrPhoneCode,
|
|
390
411
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export declare namespace Doc24 {
|
|
|
42
42
|
type SendExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.sendExternalVerificationCodeParams>;
|
|
43
43
|
type VerifyExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.verifyExternalVerificationCodeParams>;
|
|
44
44
|
type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
|
|
45
|
+
type ExternalPatient = TypeOf<typeof doc24Schemas.externalPatient>;
|
|
46
|
+
type ExternalAppointment = TypeOf<typeof doc24Schemas.externalAppointment>;
|
|
45
47
|
type BaseSdk = {
|
|
46
48
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
47
49
|
getUserId: (user: User) => Promise<number>;
|
|
@@ -60,6 +62,10 @@ export declare namespace Doc24 {
|
|
|
60
62
|
sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
|
|
61
63
|
verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
|
|
62
64
|
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
65
|
+
getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string>;
|
|
66
|
+
getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
|
|
67
|
+
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
68
|
+
cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
|
|
63
69
|
};
|
|
64
70
|
type UserSdk = {
|
|
65
71
|
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export var __esModule: boolean;
|
|
2
|
-
export function getDiagnosticaMethods(makeRequest: any): {
|
|
3
|
-
getDiagnosticaHistory: (...params: any) => Promise<any>;
|
|
4
|
-
getDiagnosticaDeepLink: (...params: any) => Promise<{
|
|
5
|
-
forwardingRequired: true;
|
|
6
|
-
deepLink: string;
|
|
7
|
-
} | {
|
|
8
|
-
forwardingRequired: false;
|
|
9
|
-
}>;
|
|
10
|
-
getDiagnosticaAccess: (...params: any) => Promise<void>;
|
|
11
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDiagnosticaMethods = 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 getDiagnosticaMethods = (makeRequest) => {
|
|
9
|
-
const getDiagnosticaHistory = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), async (patient, from, to) => {
|
|
10
|
-
const path = '/history-diagnostica';
|
|
11
|
-
const response = await makeRequest('POST', path, {
|
|
12
|
-
patient: {
|
|
13
|
-
gender: patient.gender,
|
|
14
|
-
id_type: patient.identificationType === 'ndi'
|
|
15
|
-
? 'DNI'
|
|
16
|
-
: patient.identificationType,
|
|
17
|
-
id_value: patient.identificationValue,
|
|
18
|
-
},
|
|
19
|
-
dateFrom: from.toISOString(),
|
|
20
|
-
dateTo: to.toISOString(),
|
|
21
|
-
});
|
|
22
|
-
const list = response.data.info;
|
|
23
|
-
return list.map((i) => ({
|
|
24
|
-
date: new Date(Date.parse(i.date)),
|
|
25
|
-
location: i.location,
|
|
26
|
-
exams: i.exams,
|
|
27
|
-
deepLink: i.deeplink,
|
|
28
|
-
}));
|
|
29
|
-
});
|
|
30
|
-
const getDiagnosticaDeepLink = validation_1.validateFunction(zod_1.tuple([
|
|
31
|
-
zod_1.string(),
|
|
32
|
-
schemas_1.doc24Schemas.diagnosticaUser,
|
|
33
|
-
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
34
|
-
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
|
|
35
|
-
const path = '/deeplink-diagnostica';
|
|
36
|
-
const response = await makeRequest('POST', path, {
|
|
37
|
-
kiosk,
|
|
38
|
-
user: mapUserData(user),
|
|
39
|
-
patient: mapPatientData(patient),
|
|
40
|
-
});
|
|
41
|
-
const data = response.data.info.data;
|
|
42
|
-
if (data.forwarding_required)
|
|
43
|
-
return { forwardingRequired: true, deepLink: data.deeplink };
|
|
44
|
-
return { forwardingRequired: false };
|
|
45
|
-
});
|
|
46
|
-
const getDiagnosticaAccess = validation_1.validateFunction(zod_1.tuple([
|
|
47
|
-
zod_1.string(),
|
|
48
|
-
schemas_1.doc24Schemas.diagnosticaUser,
|
|
49
|
-
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
50
|
-
]), zod_1.void(), async (kiosk, user, patient) => {
|
|
51
|
-
const path = '/access-diagnostica';
|
|
52
|
-
await makeRequest('POST', path, {
|
|
53
|
-
kiosk,
|
|
54
|
-
user: mapUserData(user),
|
|
55
|
-
patient: mapPatientData(patient),
|
|
56
|
-
});
|
|
57
|
-
return;
|
|
58
|
-
});
|
|
59
|
-
return { getDiagnosticaHistory, getDiagnosticaDeepLink, getDiagnosticaAccess };
|
|
60
|
-
};
|
|
61
|
-
exports.getDiagnosticaMethods = getDiagnosticaMethods;
|
|
62
|
-
const mapPatientData = (patient) => {
|
|
63
|
-
return {
|
|
64
|
-
name: patient.firstName,
|
|
65
|
-
surname: patient.lastName,
|
|
66
|
-
birthday: date_fns_1.format(patient.birthday, 'yyyy-MM-dd'),
|
|
67
|
-
id_type: 'DNI',
|
|
68
|
-
id_value: patient.identificationValue,
|
|
69
|
-
gender: patient.gender.toLocaleUpperCase(),
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
const mapUserData = (user) => {
|
|
73
|
-
return {
|
|
74
|
-
...mapPatientData(user),
|
|
75
|
-
phone: user.phone,
|
|
76
|
-
email: user.email,
|
|
77
|
-
language: user.language,
|
|
78
|
-
};
|
|
79
|
-
};
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
export var __esModule: boolean;
|
|
2
|
-
export function getBaseSdk(url: any, credentials: any): Promise<{
|
|
3
|
-
getProfessional: (...params: any) => Promise<{
|
|
4
|
-
id: any;
|
|
5
|
-
firstName: any;
|
|
6
|
-
lastName: any;
|
|
7
|
-
birthdate: Date;
|
|
8
|
-
gender: any;
|
|
9
|
-
email: any;
|
|
10
|
-
phone: any;
|
|
11
|
-
logoUrl: any;
|
|
12
|
-
matriculation: any;
|
|
13
|
-
specialties: any;
|
|
14
|
-
degree: any;
|
|
15
|
-
languages: any;
|
|
16
|
-
resume: {
|
|
17
|
-
link: any;
|
|
18
|
-
brief: any;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
getAvailableScheduleClinics: () => Promise<{
|
|
22
|
-
specialties: any;
|
|
23
|
-
specialtiesER: any;
|
|
24
|
-
professionals: any;
|
|
25
|
-
}>;
|
|
26
|
-
declareUser: (params: {
|
|
27
|
-
code?: string | undefined;
|
|
28
|
-
channel?: "1" | "2" | undefined;
|
|
29
|
-
user: {
|
|
30
|
-
firstName: string;
|
|
31
|
-
lastName: string;
|
|
32
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
33
|
-
identificationValue: string;
|
|
34
|
-
countryId: string;
|
|
35
|
-
birthdate: Date;
|
|
36
|
-
gender: "m" | "f";
|
|
37
|
-
phone: string;
|
|
38
|
-
email: string;
|
|
39
|
-
};
|
|
40
|
-
}) => Promise<{
|
|
41
|
-
patientId: number | null;
|
|
42
|
-
userInfo: {
|
|
43
|
-
phone: string;
|
|
44
|
-
email: string;
|
|
45
|
-
};
|
|
46
|
-
askCode: boolean;
|
|
47
|
-
userId: number;
|
|
48
|
-
}>;
|
|
49
|
-
getUserId: (user: {
|
|
50
|
-
firstName: string;
|
|
51
|
-
lastName: string;
|
|
52
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
53
|
-
identificationValue: string;
|
|
54
|
-
countryId: string;
|
|
55
|
-
birthdate: Date;
|
|
56
|
-
gender: "m" | "f";
|
|
57
|
-
phone: string;
|
|
58
|
-
email: string;
|
|
59
|
-
}) => Promise<number>;
|
|
60
|
-
sendVerificationCode: (params: {
|
|
61
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
62
|
-
identificationValue: string;
|
|
63
|
-
channel: "1" | "2";
|
|
64
|
-
}) => Promise<any>;
|
|
65
|
-
getUserInstance: (user: number | {
|
|
66
|
-
firstName: string;
|
|
67
|
-
lastName: string;
|
|
68
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
69
|
-
identificationValue: string;
|
|
70
|
-
countryId: string;
|
|
71
|
-
birthdate: Date;
|
|
72
|
-
gender: "m" | "f";
|
|
73
|
-
phone: string;
|
|
74
|
-
email: string;
|
|
75
|
-
}) => Promise<any>;
|
|
76
|
-
enroll: (params: {
|
|
77
|
-
firstName: string;
|
|
78
|
-
lastName: string;
|
|
79
|
-
birthdate: Date;
|
|
80
|
-
gender: "m" | "f";
|
|
81
|
-
email: string;
|
|
82
|
-
startDate: Date;
|
|
83
|
-
identificationNumber: string;
|
|
84
|
-
plan: string;
|
|
85
|
-
}) => Promise<void>;
|
|
86
|
-
getConverageInfo: (identificationValue: string) => Promise<{
|
|
87
|
-
firstName: string | null;
|
|
88
|
-
lastName: string | null;
|
|
89
|
-
birthdate: Date;
|
|
90
|
-
gender: "m" | "f";
|
|
91
|
-
email: string | null;
|
|
92
|
-
identificationNumber: string;
|
|
93
|
-
plan: string | null;
|
|
94
|
-
financerId: number | null;
|
|
95
|
-
defaultAffiliationId: number | null;
|
|
96
|
-
credentialNumber: string | null;
|
|
97
|
-
financerPlanId: number | null;
|
|
98
|
-
brand: number | null;
|
|
99
|
-
holderIdentificationNumber: string | null;
|
|
100
|
-
copaymentValue: number | null;
|
|
101
|
-
mobilePhone: string | null;
|
|
102
|
-
company: string | null;
|
|
103
|
-
dischargeDate: Date | null;
|
|
104
|
-
leavingDate: Date | null;
|
|
105
|
-
identificacion_tributaria: string | null;
|
|
106
|
-
deregistrationDate: Date | null;
|
|
107
|
-
authorizationCode: string | null;
|
|
108
|
-
authorizationCodeExpiration: Date | null;
|
|
109
|
-
} | null>;
|
|
110
|
-
getDiagnosticaHistory: (patient: {
|
|
111
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
112
|
-
identificationValue: string;
|
|
113
|
-
gender: "m" | "f";
|
|
114
|
-
}, from: Date, to: Date) => Promise<{
|
|
115
|
-
date: Date;
|
|
116
|
-
location: string;
|
|
117
|
-
exams: string[];
|
|
118
|
-
deepLink: string;
|
|
119
|
-
}[]>;
|
|
120
|
-
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
121
|
-
firstName: string;
|
|
122
|
-
lastName: string;
|
|
123
|
-
identificationType: "dni";
|
|
124
|
-
identificationValue: string;
|
|
125
|
-
gender: "m" | "f";
|
|
126
|
-
phone: string;
|
|
127
|
-
email: string;
|
|
128
|
-
language: string;
|
|
129
|
-
birthday: Date;
|
|
130
|
-
}, patient: {
|
|
131
|
-
firstName: string;
|
|
132
|
-
lastName: string;
|
|
133
|
-
identificationType: "dni";
|
|
134
|
-
identificationValue: string;
|
|
135
|
-
gender: "m" | "f";
|
|
136
|
-
birthday: Date;
|
|
137
|
-
}) => Promise<{
|
|
138
|
-
forwardingRequired: true;
|
|
139
|
-
deepLink: string;
|
|
140
|
-
} | {
|
|
141
|
-
forwardingRequired: false;
|
|
142
|
-
}>;
|
|
143
|
-
getDiagnosticaAccess: (kiosk: string, user: {
|
|
144
|
-
firstName: string;
|
|
145
|
-
lastName: string;
|
|
146
|
-
identificationType: "dni";
|
|
147
|
-
identificationValue: string;
|
|
148
|
-
gender: "m" | "f";
|
|
149
|
-
phone: string;
|
|
150
|
-
email: string;
|
|
151
|
-
language: string;
|
|
152
|
-
birthday: Date;
|
|
153
|
-
}, patient: {
|
|
154
|
-
firstName: string;
|
|
155
|
-
lastName: string;
|
|
156
|
-
identificationType: "dni";
|
|
157
|
-
identificationValue: string;
|
|
158
|
-
gender: "m" | "f";
|
|
159
|
-
birthday: Date;
|
|
160
|
-
}) => Promise<void>;
|
|
161
|
-
}>;
|
package/lib/lib/baseSdk/index.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBaseSdk = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const request_1 = require("../request");
|
|
6
|
-
const validation_1 = require("../request/validation");
|
|
7
|
-
const schemas_1 = require("../schemas");
|
|
8
|
-
const utils_1 = require("../utils");
|
|
9
|
-
const diagnostica_1 = require("./diagnostica");
|
|
10
|
-
const user_1 = require("./user");
|
|
11
|
-
const getBaseSdk = async (url, credentials) => {
|
|
12
|
-
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
13
|
-
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
14
|
-
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
15
|
-
const baseSdk = {
|
|
16
|
-
...diagnosticaMethods,
|
|
17
|
-
...userMethods,
|
|
18
|
-
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
19
|
-
const path = `/professional/${professionalId}`;
|
|
20
|
-
const response = await makeRequest('GET', path);
|
|
21
|
-
const raw = response.data;
|
|
22
|
-
return {
|
|
23
|
-
id: raw.professional_id,
|
|
24
|
-
firstName: raw.name,
|
|
25
|
-
lastName: raw.lastname,
|
|
26
|
-
birthdate: utils_1.parseDate(raw.birthdate),
|
|
27
|
-
gender: raw.gender.toLowerCase(),
|
|
28
|
-
email: raw.email,
|
|
29
|
-
phone: raw.phone,
|
|
30
|
-
logoUrl: raw.image,
|
|
31
|
-
matriculation: raw.matriculation,
|
|
32
|
-
specialties: raw.specialties.map((s) => ({
|
|
33
|
-
id: s.specialty_id,
|
|
34
|
-
description: s.specialty,
|
|
35
|
-
})),
|
|
36
|
-
degree: raw.degree,
|
|
37
|
-
languages: raw.languages.map((l) => l.languages),
|
|
38
|
-
resume: {
|
|
39
|
-
link: raw.resume_link,
|
|
40
|
-
brief: raw.resume_brief,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}),
|
|
44
|
-
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
45
|
-
const path = `/schedule/clinics`;
|
|
46
|
-
const response = await makeRequest('GET', path);
|
|
47
|
-
const mapSpeciality = (s) => ({
|
|
48
|
-
id: s.id_especialidad,
|
|
49
|
-
description: s.especialidad,
|
|
50
|
-
});
|
|
51
|
-
const mapped = {
|
|
52
|
-
specialties: response.data.specialties.map(mapSpeciality),
|
|
53
|
-
specialtiesER: response.data.specialties_er.map(mapSpeciality),
|
|
54
|
-
professionals: response.data.professionals.map((p) => ({
|
|
55
|
-
id: p.id_profesional,
|
|
56
|
-
fullName: p.denominacion,
|
|
57
|
-
clinicId: p.id_consultorio,
|
|
58
|
-
specialties: p.especialidades.map(mapSpeciality),
|
|
59
|
-
})),
|
|
60
|
-
};
|
|
61
|
-
return mapped;
|
|
62
|
-
}),
|
|
63
|
-
};
|
|
64
|
-
return baseSdk;
|
|
65
|
-
};
|
|
66
|
-
exports.getBaseSdk = getBaseSdk;
|