@integraciones_doc24/sdk 1.16.37 → 1.16.38
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 +225 -206
- package/lib/baseSdk/diagnostica.d.ts +54 -54
- package/lib/baseSdk/diagnostica.js +82 -82
- package/lib/baseSdk/external.d.ts +177 -177
- package/lib/baseSdk/external.js +96 -96
- package/lib/baseSdk/index.d.ts +2 -2
- package/lib/baseSdk/index.js +76 -77
- package/lib/baseSdk/user.d.ts +112 -112
- package/lib/baseSdk/user.js +136 -136
- package/lib/index.d.ts +400 -400
- package/lib/index.js +22 -22
- package/lib/request/index.d.ts +4 -4
- package/lib/request/index.js +32 -32
- package/lib/request/token.d.ts +2 -2
- package/lib/request/token.js +34 -34
- package/lib/request/validation.d.ts +10 -10
- package/lib/request/validation.js +28 -28
- package/lib/schemas.d.ts +2482 -2703
- package/lib/schemas.js +540 -573
- package/lib/types.d.ts +170 -174
- package/lib/types.js +2 -2
- package/lib/userSdk/binah.d.ts +21 -21
- package/lib/userSdk/binah.js +20 -20
- package/lib/userSdk/chat.d.ts +57 -57
- package/lib/userSdk/chat.js +98 -98
- package/lib/userSdk/external.d.ts +34 -34
- package/lib/userSdk/external.js +72 -72
- package/lib/userSdk/index.d.ts +2 -2
- package/lib/userSdk/index.js +33 -33
- package/lib/userSdk/patients.d.ts +58 -58
- package/lib/userSdk/patients.js +89 -89
- package/lib/userSdk/schedule.d.ts +58 -59
- package/lib/userSdk/schedule.js +89 -90
- package/lib/userSdk/specialties.d.ts +19 -19
- package/lib/userSdk/specialties.js +48 -48
- package/lib/userSdk/videoVisit.d.ts +175 -225
- package/lib/userSdk/videoVisit.js +242 -283
- package/lib/utils.d.ts +3 -4
- package/lib/utils.js +43 -68
- package/lib/webhook/index.d.ts +2 -2
- package/lib/webhook/index.js +67 -67
- package/lib/webhook/responses.d.ts +35 -35
- package/lib/webhook/responses.js +42 -42
- package/lib/webhook/token.d.ts +2 -2
- package/lib/webhook/token.js +23 -23
- package/package.json +37 -37
|
@@ -1,283 +1,242 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getVideoVisitMethods = void 0;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
const validation_1 = require("../request/validation");
|
|
9
|
-
const schemas_1 = require("../schemas");
|
|
10
|
-
const utils_1 = require("../utils");
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
13
|
-
const getVideoVisitMethods = (makeRequest) => {
|
|
14
|
-
const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
|
|
15
|
-
const specificParams = params.type === 'appointment'
|
|
16
|
-
? {
|
|
17
|
-
type: 'P',
|
|
18
|
-
appointment_id: params.appointmentId,
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
: { type: 'E' };
|
|
22
|
-
const mappedParams = {
|
|
23
|
-
...specificParams,
|
|
24
|
-
patient_id: params.patientId,
|
|
25
|
-
specialty_id: params.specialtyId,
|
|
26
|
-
language: params.language.toUpperCase(),
|
|
27
|
-
details: params.details,
|
|
28
|
-
extra_info:
|
|
29
|
-
};
|
|
30
|
-
const response = await makeRequest('POST', '/video-visit', mappedParams);
|
|
31
|
-
return response.data.vc_token;
|
|
32
|
-
});
|
|
33
|
-
const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
|
|
34
|
-
const path = `/video-visit/${vcToken}`;
|
|
35
|
-
await makeRequest('DELETE', path);
|
|
36
|
-
});
|
|
37
|
-
const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
|
|
38
|
-
const path = `/video-visit/${vcToken}/${patientId}`;
|
|
39
|
-
const response = await makeRequest('GET', path);
|
|
40
|
-
return mapVideoVisit(response.data);
|
|
41
|
-
});
|
|
42
|
-
const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
|
|
43
|
-
const path = `/video-visit-history/${patientId}`;
|
|
44
|
-
const response = await makeRequest('GET', path);
|
|
45
|
-
return response.data.map((raw) => mapHistoricalVideoVisit(raw));
|
|
46
|
-
});
|
|
47
|
-
const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
utils_1.parseDateTime(response.data.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
? response.data.
|
|
181
|
-
: undefined,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
vcToken: raw.vc_token,
|
|
244
|
-
appointment: raw.appointment_id
|
|
245
|
-
? {
|
|
246
|
-
id: raw.appointment_id,
|
|
247
|
-
date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
|
|
248
|
-
}
|
|
249
|
-
: undefined,
|
|
250
|
-
videoVisit: raw.video_visit_id
|
|
251
|
-
? { id: raw.video_visit_id, status: raw.video_visit_status }
|
|
252
|
-
: undefined,
|
|
253
|
-
paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
|
|
254
|
-
atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
|
|
255
|
-
waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
|
|
256
|
-
address: (_d = raw.direccion) !== null && _d !== void 0 ? _d : undefined,
|
|
257
|
-
city: (_e = raw.localidad) !== null && _e !== void 0 ? _e : undefined,
|
|
258
|
-
province: (_f = raw.provincia) !== null && _f !== void 0 ? _f : undefined,
|
|
259
|
-
modality: (_g = raw.modalidad) !== null && _g !== void 0 ? _g : undefined,
|
|
260
|
-
attachedFiles: mapAttachedFiles(raw.attached_files),
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
|
-
// `upload_date` is Argentina time without offset: parse with the default -03,
|
|
264
|
-
// never with the brand's `time_zone` (that one is a correction, not the zone).
|
|
265
|
-
const mapAttachedFiles = (raw) => (raw !== null && raw !== void 0 ? raw : []).map((f) => {
|
|
266
|
-
var _a;
|
|
267
|
-
return ({
|
|
268
|
-
fileId: Number(f.file_id),
|
|
269
|
-
fileName: (_a = f.file_name) !== null && _a !== void 0 ? _a : null,
|
|
270
|
-
fileUrl: f.file_url,
|
|
271
|
-
fileType: f.file_type,
|
|
272
|
-
uploadDate: utils_1.parseDateTime(f.upload_date),
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
const mapHistoricalVideoVisit = (raw) => {
|
|
276
|
-
return {
|
|
277
|
-
...mapVideoVisit(raw),
|
|
278
|
-
professional: raw.professional,
|
|
279
|
-
specialty: raw.specialty,
|
|
280
|
-
medications: raw.medications != null ? Boolean(raw.medications) : undefined,
|
|
281
|
-
practices: raw.practices != null ? Boolean(raw.practices) : undefined,
|
|
282
|
-
};
|
|
283
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getVideoVisitMethods = void 0;
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const validation_1 = require("../request/validation");
|
|
9
|
+
const schemas_1 = require("../schemas");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const fs_1 = __importDefault(require("fs"));
|
|
12
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
13
|
+
const getVideoVisitMethods = (makeRequest) => {
|
|
14
|
+
const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
|
|
15
|
+
const specificParams = params.type === 'appointment'
|
|
16
|
+
? {
|
|
17
|
+
type: 'P',
|
|
18
|
+
appointment_id: params.appointmentId,
|
|
19
|
+
modaility: params.modality || 'A',
|
|
20
|
+
}
|
|
21
|
+
: { type: 'E' };
|
|
22
|
+
const mappedParams = {
|
|
23
|
+
...specificParams,
|
|
24
|
+
patient_id: params.patientId,
|
|
25
|
+
specialty_id: params.specialtyId,
|
|
26
|
+
language: params.language.toUpperCase(),
|
|
27
|
+
details: params.details,
|
|
28
|
+
extra_info: params.extraInfo,
|
|
29
|
+
};
|
|
30
|
+
const response = await makeRequest('POST', '/video-visit', mappedParams);
|
|
31
|
+
return response.data.vc_token;
|
|
32
|
+
});
|
|
33
|
+
const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
|
|
34
|
+
const path = `/video-visit/${vcToken}`;
|
|
35
|
+
await makeRequest('DELETE', path);
|
|
36
|
+
});
|
|
37
|
+
const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
|
|
38
|
+
const path = `/video-visit/${vcToken}/${patientId}`;
|
|
39
|
+
const response = await makeRequest('GET', path);
|
|
40
|
+
return mapVideoVisit(response.data);
|
|
41
|
+
});
|
|
42
|
+
const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
|
|
43
|
+
const path = `/video-visit-history/${patientId}`;
|
|
44
|
+
const response = await makeRequest('GET', path);
|
|
45
|
+
return response.data.map((raw) => mapHistoricalVideoVisit(raw));
|
|
46
|
+
});
|
|
47
|
+
const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
|
|
48
|
+
const path = `/video-visit-records/${vcId}`;
|
|
49
|
+
const response = await makeRequest('GET', path);
|
|
50
|
+
return {
|
|
51
|
+
id: response.data.consultation_id,
|
|
52
|
+
status: response.data.status,
|
|
53
|
+
paymentStatus: response.data.payment_status,
|
|
54
|
+
professional: response.data.professional_id
|
|
55
|
+
? {
|
|
56
|
+
id: response.data.professional_id,
|
|
57
|
+
fullName: response.data.professional,
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
60
|
+
patient: {
|
|
61
|
+
fullName: response.data.patient,
|
|
62
|
+
firstAccessDate: response.data.patient_first_access_date &&
|
|
63
|
+
utils_1.parseDateTime(response.data.patient_first_access_date),
|
|
64
|
+
lastAccessDate: response.data.patient_last_access_date &&
|
|
65
|
+
utils_1.parseDateTime(response.data.patient_last_access_date),
|
|
66
|
+
},
|
|
67
|
+
finishDate: response.data.finish_date &&
|
|
68
|
+
utils_1.parseDateTime(response.data.finish_date),
|
|
69
|
+
retries: response.data.retries,
|
|
70
|
+
language: response.data.language,
|
|
71
|
+
appointment: response.data.appointment_id
|
|
72
|
+
? {
|
|
73
|
+
id: response.data.appointment_id,
|
|
74
|
+
date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
|
|
75
|
+
}
|
|
76
|
+
: null,
|
|
77
|
+
report: {
|
|
78
|
+
motive: response.data.motive,
|
|
79
|
+
actualDesease: response.data.actual_desease,
|
|
80
|
+
indications: response.data.indications,
|
|
81
|
+
alertSigns: response.data.alert_signs,
|
|
82
|
+
extendedMotive: response.data.extended_motive,
|
|
83
|
+
diagnose: response.data.diagnose.map((d) => ({
|
|
84
|
+
description: d.diagnostico,
|
|
85
|
+
code: d.codificacion,
|
|
86
|
+
})),
|
|
87
|
+
},
|
|
88
|
+
pdf: {
|
|
89
|
+
atention: response.data.pdf_atention
|
|
90
|
+
? response.data.pdf_atention
|
|
91
|
+
: undefined,
|
|
92
|
+
medication: response.data.pdf_medication,
|
|
93
|
+
images: response.data.pdf_images
|
|
94
|
+
? response.data.pdf_images
|
|
95
|
+
: undefined,
|
|
96
|
+
otherExams: response.data.pdf_other_exams
|
|
97
|
+
? response.data.pdf_other_exams
|
|
98
|
+
: undefined,
|
|
99
|
+
labs: response.data.pdf_labs ? response.data.pdf_labs : undefined,
|
|
100
|
+
},
|
|
101
|
+
files: response.data.files.map((f) => ({
|
|
102
|
+
name: f.nombre_file,
|
|
103
|
+
url: f.file,
|
|
104
|
+
})),
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
|
|
108
|
+
const path = '/active-video-visits';
|
|
109
|
+
const response = await makeRequest('GET', path);
|
|
110
|
+
const consultations = response.data['active-consultations'];
|
|
111
|
+
return consultations.map((s) => ({
|
|
112
|
+
patientId: s.patient_id,
|
|
113
|
+
consultationId: s.consultation_id,
|
|
114
|
+
vcToken: s.vc_token,
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
117
|
+
const getVideoVisitLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), zod_1.string().nullable(), async (vcToken, patientId) => {
|
|
118
|
+
const path = `/video-visit-link/${vcToken}/${patientId}`;
|
|
119
|
+
const response = await makeRequest('GET', path);
|
|
120
|
+
return response.data.link;
|
|
121
|
+
});
|
|
122
|
+
const getCompleteVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.completeVideoVisitDetails, async (vcToken) => {
|
|
123
|
+
const path = `/consultation/${vcToken}`;
|
|
124
|
+
const response = await makeRequest('GET', path);
|
|
125
|
+
return {
|
|
126
|
+
id: response.data.id_consulta,
|
|
127
|
+
status: response.data.estado,
|
|
128
|
+
paymentStatus: response.data.estado_pago,
|
|
129
|
+
professional: response.data.id_profesional
|
|
130
|
+
? {
|
|
131
|
+
id: response.data.id_profesional,
|
|
132
|
+
fullName: response.data.profesional,
|
|
133
|
+
specialtyId: response.data.id_especialidad,
|
|
134
|
+
specialty: response.data.especialidad,
|
|
135
|
+
}
|
|
136
|
+
: undefined,
|
|
137
|
+
finishDate: response.data.fecha_fin && utils_1.parseDateTime(response.data.fecha_fin),
|
|
138
|
+
retries: response.data.intentos_conexion,
|
|
139
|
+
language: response.data.tag_idioma,
|
|
140
|
+
report: {
|
|
141
|
+
motive: response.data.motivo,
|
|
142
|
+
actualDesease: response.data.enfermedad_actual,
|
|
143
|
+
indications: response.data.conducta_terapeutica,
|
|
144
|
+
alertSigns: response.data.signos_alerta,
|
|
145
|
+
extendedMotive: response.data.motivo_extendido_consulta,
|
|
146
|
+
diagnose: response.data.diagnostico.map((d) => ({
|
|
147
|
+
description: d.diagnostico,
|
|
148
|
+
code: d.codificacion,
|
|
149
|
+
})),
|
|
150
|
+
medication: response.data.medicacion.map((m) => ({
|
|
151
|
+
description: m.detalle_producto,
|
|
152
|
+
quantity: m.cantidad,
|
|
153
|
+
dose: m.dosificacion,
|
|
154
|
+
farmalinkId: m.id_prescripcion_farmalink,
|
|
155
|
+
})),
|
|
156
|
+
prescription: {
|
|
157
|
+
link: response.data.link_receta,
|
|
158
|
+
codigo: response.data.codigo_verificacion_receta,
|
|
159
|
+
},
|
|
160
|
+
inPersonRequired: response.data.presencial_requerida,
|
|
161
|
+
referral: {
|
|
162
|
+
status: response.data.derivada,
|
|
163
|
+
specialtyId: response.data.derivada_id_especialidad,
|
|
164
|
+
inPersonRequired: response.data.derivada_presencial_obligatoria,
|
|
165
|
+
comments: response.data.derivada_comentarios,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
pdf: {
|
|
169
|
+
atention: response.data.pdf_atencion
|
|
170
|
+
? response.data.pdf_atencion
|
|
171
|
+
: undefined,
|
|
172
|
+
medication: response.data.pdf_medicacion,
|
|
173
|
+
images: response.data.pdf_imagenes
|
|
174
|
+
? response.data.pdf_imagenes
|
|
175
|
+
: undefined,
|
|
176
|
+
otherExams: response.data.pdf_otras
|
|
177
|
+
? response.data.pdf_otras
|
|
178
|
+
: undefined,
|
|
179
|
+
labs: response.data.pdf_laboratorios
|
|
180
|
+
? response.data.pdf_laboratorios
|
|
181
|
+
: undefined,
|
|
182
|
+
certificate: response.data.pdf_certificado
|
|
183
|
+
? response.data.pdf_certificado
|
|
184
|
+
: undefined,
|
|
185
|
+
},
|
|
186
|
+
files: response.data.files_atencion.map((f) => ({
|
|
187
|
+
name: f.nombre_file,
|
|
188
|
+
url: f.file,
|
|
189
|
+
})),
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), zod_1.any(), async (params) => {
|
|
193
|
+
const form = new form_data_1.default();
|
|
194
|
+
form.append('vc_token', params.vcToken);
|
|
195
|
+
form.append('attached_file', fs_1.default.createReadStream(params.attachedFile));
|
|
196
|
+
if (params.fileName)
|
|
197
|
+
form.append('file_name', params.fileName);
|
|
198
|
+
const response = await makeRequest('POST', '/upload-file-consultation', form);
|
|
199
|
+
return response.data;
|
|
200
|
+
});
|
|
201
|
+
return {
|
|
202
|
+
scheduleVideoVisit,
|
|
203
|
+
cancelVideoVisit,
|
|
204
|
+
getVideoVisit,
|
|
205
|
+
getPatientVideoVisitHistory,
|
|
206
|
+
getVideoVisitDetails,
|
|
207
|
+
getVideoVisitLink,
|
|
208
|
+
getActiveVideoVisits,
|
|
209
|
+
getCompleteVideoVisitDetails,
|
|
210
|
+
uploadFileConsultation,
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
exports.getVideoVisitMethods = getVideoVisitMethods;
|
|
214
|
+
const mapVideoVisit = (raw) => {
|
|
215
|
+
var _a, _b, _c;
|
|
216
|
+
return {
|
|
217
|
+
id: raw.vc_id,
|
|
218
|
+
creationDate: utils_1.parseDateTime(raw.creation_date),
|
|
219
|
+
patientId: raw.patient_id,
|
|
220
|
+
user: { id: raw.user_id, email: raw.email, phone: raw.phone },
|
|
221
|
+
vcToken: raw.vc_token,
|
|
222
|
+
appointment: raw.appointment_id
|
|
223
|
+
? {
|
|
224
|
+
id: raw.appointment_id,
|
|
225
|
+
date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
|
|
226
|
+
}
|
|
227
|
+
: undefined,
|
|
228
|
+
videoVisit: raw.video_visit_id
|
|
229
|
+
? { id: raw.video_visit_id, status: raw.video_visit_status }
|
|
230
|
+
: undefined,
|
|
231
|
+
paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
|
|
232
|
+
atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
|
|
233
|
+
waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
const mapHistoricalVideoVisit = (raw) => {
|
|
237
|
+
return {
|
|
238
|
+
...mapVideoVisit(raw),
|
|
239
|
+
professional: raw.professional,
|
|
240
|
+
specialty: raw.specialty,
|
|
241
|
+
};
|
|
242
|
+
};
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
|
|
2
|
-
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;
|
|
1
|
+
export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
|
|
2
|
+
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
3
|
+
export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;
|