@integraciones_doc24/sdk 1.16.2 → 1.16.3
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 +203 -203
- 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 -76
- package/lib/baseSdk/user.d.ts +91 -91
- package/lib/baseSdk/user.js +136 -136
- package/lib/index.d.ts +367 -367
- package/lib/index.js +22 -22
- package/lib/request/index.d.ts +3 -3
- package/lib/request/index.js +26 -26
- 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 +1917 -1878
- package/lib/schemas.js +454 -444
- package/lib/types.d.ts +152 -150
- package/lib/types.js +2 -2
- package/lib/userSdk/binah.d.ts +12 -0
- package/lib/userSdk/binah.js +17 -0
- 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 -30
- package/lib/userSdk/patients.d.ts +39 -39
- package/lib/userSdk/patients.js +73 -73
- package/lib/userSdk/schedule.d.ts +49 -49
- package/lib/userSdk/schedule.js +83 -83
- package/lib/userSdk/specialties.d.ts +16 -16
- package/lib/userSdk/specialties.js +45 -45
- package/lib/userSdk/videoVisit.d.ts +115 -115
- package/lib/userSdk/videoVisit.js +155 -155
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +16 -16
- package/lib/webhook/index.d.ts +2 -2
- package/lib/webhook/index.js +56 -56
- 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 +36 -36
package/lib/userSdk/patients.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPatientMethods = 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 getPatientMethods = (makeRequest) => {
|
|
9
|
-
const declarePatient = async ({ patient, channel, code, }) => {
|
|
10
|
-
var _a;
|
|
11
|
-
const path = '/patient';
|
|
12
|
-
const mappedPatient = {
|
|
13
|
-
lastname: patient.lastName,
|
|
14
|
-
firstname: patient.firstName,
|
|
15
|
-
identification_type: patient.identificationType,
|
|
16
|
-
identification_value: patient.identificationValue,
|
|
17
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
18
|
-
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
19
|
-
country_id: patient.countryId,
|
|
20
|
-
};
|
|
21
|
-
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
22
|
-
const response = await makeRequest('POST', path, {
|
|
23
|
-
user_data: mappedPatient,
|
|
24
|
-
channel: parsedChannel,
|
|
25
|
-
code,
|
|
26
|
-
});
|
|
27
|
-
const data = response.data;
|
|
28
|
-
if (data.ask_code)
|
|
29
|
-
return {
|
|
30
|
-
userInfo: {
|
|
31
|
-
firstName: data.user_info.firstname,
|
|
32
|
-
lastName: data.user_info.lastname,
|
|
33
|
-
phone: data.user_info.phone,
|
|
34
|
-
email: data.user_info.email,
|
|
35
|
-
},
|
|
36
|
-
askCode: true,
|
|
37
|
-
};
|
|
38
|
-
return { askCode: false, patientId: data.patient_id };
|
|
39
|
-
};
|
|
40
|
-
const getPatientId = async (patient) => {
|
|
41
|
-
var _a;
|
|
42
|
-
const path = '/search-patient';
|
|
43
|
-
const mappedPatient = {
|
|
44
|
-
lastname: patient.lastName,
|
|
45
|
-
firstname: patient.firstName,
|
|
46
|
-
identification_type: patient.identificationType,
|
|
47
|
-
identification_value: patient.identificationValue,
|
|
48
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
49
|
-
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
50
|
-
country_id: patient.countryId,
|
|
51
|
-
};
|
|
52
|
-
const response = await makeRequest('POST', path, {
|
|
53
|
-
user_data: mappedPatient,
|
|
54
|
-
});
|
|
55
|
-
return response.data.patient_id;
|
|
56
|
-
};
|
|
57
|
-
const deletePatient = async (patientId) => {
|
|
58
|
-
const path = `/patient/${patientId}`;
|
|
59
|
-
await makeRequest('DELETE', path);
|
|
60
|
-
};
|
|
61
|
-
const getPatientPHR = async (patientId) => {
|
|
62
|
-
const path = `/view-phr/${patientId}`;
|
|
63
|
-
const response = await makeRequest('GET', path);
|
|
64
|
-
return response.data.url_acceso_paciente;
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
68
|
-
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
69
|
-
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
70
|
-
getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
exports.getPatientMethods = getPatientMethods;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPatientMethods = 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 getPatientMethods = (makeRequest) => {
|
|
9
|
+
const declarePatient = async ({ patient, channel, code, }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const path = '/patient';
|
|
12
|
+
const mappedPatient = {
|
|
13
|
+
lastname: patient.lastName,
|
|
14
|
+
firstname: patient.firstName,
|
|
15
|
+
identification_type: patient.identificationType,
|
|
16
|
+
identification_value: patient.identificationValue,
|
|
17
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
18
|
+
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
19
|
+
country_id: patient.countryId,
|
|
20
|
+
};
|
|
21
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
22
|
+
const response = await makeRequest('POST', path, {
|
|
23
|
+
user_data: mappedPatient,
|
|
24
|
+
channel: parsedChannel,
|
|
25
|
+
code,
|
|
26
|
+
});
|
|
27
|
+
const data = response.data;
|
|
28
|
+
if (data.ask_code)
|
|
29
|
+
return {
|
|
30
|
+
userInfo: {
|
|
31
|
+
firstName: data.user_info.firstname,
|
|
32
|
+
lastName: data.user_info.lastname,
|
|
33
|
+
phone: data.user_info.phone,
|
|
34
|
+
email: data.user_info.email,
|
|
35
|
+
},
|
|
36
|
+
askCode: true,
|
|
37
|
+
};
|
|
38
|
+
return { askCode: false, patientId: data.patient_id };
|
|
39
|
+
};
|
|
40
|
+
const getPatientId = async (patient) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const path = '/search-patient';
|
|
43
|
+
const mappedPatient = {
|
|
44
|
+
lastname: patient.lastName,
|
|
45
|
+
firstname: patient.firstName,
|
|
46
|
+
identification_type: patient.identificationType,
|
|
47
|
+
identification_value: patient.identificationValue,
|
|
48
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
49
|
+
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
50
|
+
country_id: patient.countryId,
|
|
51
|
+
};
|
|
52
|
+
const response = await makeRequest('POST', path, {
|
|
53
|
+
user_data: mappedPatient,
|
|
54
|
+
});
|
|
55
|
+
return response.data.patient_id;
|
|
56
|
+
};
|
|
57
|
+
const deletePatient = async (patientId) => {
|
|
58
|
+
const path = `/patient/${patientId}`;
|
|
59
|
+
await makeRequest('DELETE', path);
|
|
60
|
+
};
|
|
61
|
+
const getPatientPHR = async (patientId) => {
|
|
62
|
+
const path = `/view-phr/${patientId}`;
|
|
63
|
+
const response = await makeRequest('GET', path);
|
|
64
|
+
return response.data.url_acceso_paciente;
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
68
|
+
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
69
|
+
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
70
|
+
getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
exports.getPatientMethods = getPatientMethods;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getSchedule: (patientId: number, specialtyId: number, filter?: {
|
|
4
|
-
date?: Date | undefined;
|
|
5
|
-
language?: string | undefined;
|
|
6
|
-
professionalId?: number | undefined;
|
|
7
|
-
userTimeZone?: string | undefined;
|
|
8
|
-
offset?: number | undefined;
|
|
9
|
-
limit?: number | undefined;
|
|
10
|
-
weekDay?: number | undefined;
|
|
11
|
-
startHour?: string | undefined;
|
|
12
|
-
finishHour?: string | undefined;
|
|
13
|
-
} | undefined) => Promise<{
|
|
14
|
-
length?: number | null | undefined;
|
|
15
|
-
ranking?: unknown;
|
|
16
|
-
consultation_value?: string | null | undefined;
|
|
17
|
-
date: Date;
|
|
18
|
-
type: "appointment" | "chat" | "instant";
|
|
19
|
-
id: string | number;
|
|
20
|
-
professional: {
|
|
21
|
-
id: number;
|
|
22
|
-
fullName: string;
|
|
23
|
-
logoUrl: string;
|
|
24
|
-
};
|
|
25
|
-
specialty: {
|
|
26
|
-
id: number;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
clinicId: number;
|
|
30
|
-
cost: string;
|
|
31
|
-
atentions: number;
|
|
32
|
-
}[]>;
|
|
33
|
-
getScheduleDates: (patientId: number, filter?: {
|
|
34
|
-
specialtyId?: number | undefined;
|
|
35
|
-
language?: string | undefined;
|
|
36
|
-
professionalId?: number | undefined;
|
|
37
|
-
userTimeZone?: string | undefined;
|
|
38
|
-
} | undefined) => Promise<Date[]>;
|
|
39
|
-
getAppointment: (appointmentId: number) => Promise<{
|
|
40
|
-
date: Date;
|
|
41
|
-
id: number;
|
|
42
|
-
professionalId: number;
|
|
43
|
-
}>;
|
|
44
|
-
getAppointmentByVcToken: (vcToken: string) => Promise<{
|
|
45
|
-
date: Date;
|
|
46
|
-
id: number;
|
|
47
|
-
professionalId: number;
|
|
48
|
-
}>;
|
|
49
|
-
};
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getSchedule: (patientId: number, specialtyId: number, filter?: {
|
|
4
|
+
date?: Date | undefined;
|
|
5
|
+
language?: string | undefined;
|
|
6
|
+
professionalId?: number | undefined;
|
|
7
|
+
userTimeZone?: string | undefined;
|
|
8
|
+
offset?: number | undefined;
|
|
9
|
+
limit?: number | undefined;
|
|
10
|
+
weekDay?: number | undefined;
|
|
11
|
+
startHour?: string | undefined;
|
|
12
|
+
finishHour?: string | undefined;
|
|
13
|
+
} | undefined) => Promise<{
|
|
14
|
+
length?: number | null | undefined;
|
|
15
|
+
ranking?: unknown;
|
|
16
|
+
consultation_value?: string | null | undefined;
|
|
17
|
+
date: Date;
|
|
18
|
+
type: "appointment" | "chat" | "instant";
|
|
19
|
+
id: string | number;
|
|
20
|
+
professional: {
|
|
21
|
+
id: number;
|
|
22
|
+
fullName: string;
|
|
23
|
+
logoUrl: string;
|
|
24
|
+
};
|
|
25
|
+
specialty: {
|
|
26
|
+
id: number;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
clinicId: number;
|
|
30
|
+
cost: string;
|
|
31
|
+
atentions: number;
|
|
32
|
+
}[]>;
|
|
33
|
+
getScheduleDates: (patientId: number, filter?: {
|
|
34
|
+
specialtyId?: number | undefined;
|
|
35
|
+
language?: string | undefined;
|
|
36
|
+
professionalId?: number | undefined;
|
|
37
|
+
userTimeZone?: string | undefined;
|
|
38
|
+
} | undefined) => Promise<Date[]>;
|
|
39
|
+
getAppointment: (appointmentId: number) => Promise<{
|
|
40
|
+
date: Date;
|
|
41
|
+
id: number;
|
|
42
|
+
professionalId: number;
|
|
43
|
+
}>;
|
|
44
|
+
getAppointmentByVcToken: (vcToken: string) => Promise<{
|
|
45
|
+
date: Date;
|
|
46
|
+
id: number;
|
|
47
|
+
professionalId: number;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getScheduleMethods = 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 getScheduleMethods = (makeRequest) => {
|
|
10
|
-
const getScheduleDates = async (patientId, filter = {}) => {
|
|
11
|
-
var _a;
|
|
12
|
-
const mappedFilter = {
|
|
13
|
-
specialty_id: filter.specialtyId,
|
|
14
|
-
professional_id: filter.professionalId,
|
|
15
|
-
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
16
|
-
user_time_zone: filter.userTimeZone,
|
|
17
|
-
};
|
|
18
|
-
const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
|
|
19
|
-
const response = await makeRequest('GET', path);
|
|
20
|
-
return response.data.available_dates.map((o) => utils_1.parseDate(o.date, o.time_zone));
|
|
21
|
-
};
|
|
22
|
-
const getSchedule = async (patientId, specialtyId, filter = {}) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const mappedFilter = {
|
|
25
|
-
id_professional: filter.professionalId,
|
|
26
|
-
offset: filter.offset,
|
|
27
|
-
limit: filter.limit,
|
|
28
|
-
week_day: filter.weekDay,
|
|
29
|
-
date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
|
|
30
|
-
start_hour: filter.startHour,
|
|
31
|
-
finish_hour: filter.finishHour,
|
|
32
|
-
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
33
|
-
user_time_zone: filter.userTimeZone,
|
|
34
|
-
};
|
|
35
|
-
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
36
|
-
const response = await makeRequest('GET', path);
|
|
37
|
-
return response.data.available_appointments.map((a) => ({
|
|
38
|
-
id: a.id,
|
|
39
|
-
date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
|
|
40
|
-
clinicId: a.clinic,
|
|
41
|
-
professional: {
|
|
42
|
-
id: a.professional_id,
|
|
43
|
-
fullName: a.professional,
|
|
44
|
-
logoUrl: a.logo,
|
|
45
|
-
},
|
|
46
|
-
cost: a.cost,
|
|
47
|
-
specialty: {
|
|
48
|
-
id: a.specialty_id,
|
|
49
|
-
description: a.specialty,
|
|
50
|
-
},
|
|
51
|
-
type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
|
|
52
|
-
atentions: a.atentions,
|
|
53
|
-
ranking: a.ranking,
|
|
54
|
-
length: a.length,
|
|
55
|
-
consultation_value: a.consultation_value,
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
|
-
const getAppointment = async (appointmentId) => {
|
|
59
|
-
const path = `/appointment/${appointmentId}`;
|
|
60
|
-
const response = await makeRequest('GET', path);
|
|
61
|
-
return {
|
|
62
|
-
id: response.data.id,
|
|
63
|
-
professionalId: response.data.professional_id,
|
|
64
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
const getAppointmentByVcToken = async (vcToken) => {
|
|
68
|
-
const path = `/appointmentByToken/${vcToken}`;
|
|
69
|
-
const response = await makeRequest('GET', path);
|
|
70
|
-
return {
|
|
71
|
-
id: response.data.id,
|
|
72
|
-
professionalId: response.data.professional_id,
|
|
73
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
getSchedule: validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), getSchedule),
|
|
78
|
-
getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
|
|
79
|
-
getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
|
|
80
|
-
getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
exports.getScheduleMethods = getScheduleMethods;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getScheduleMethods = 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 getScheduleMethods = (makeRequest) => {
|
|
10
|
+
const getScheduleDates = async (patientId, filter = {}) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const mappedFilter = {
|
|
13
|
+
specialty_id: filter.specialtyId,
|
|
14
|
+
professional_id: filter.professionalId,
|
|
15
|
+
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
16
|
+
user_time_zone: filter.userTimeZone,
|
|
17
|
+
};
|
|
18
|
+
const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
|
|
19
|
+
const response = await makeRequest('GET', path);
|
|
20
|
+
return response.data.available_dates.map((o) => utils_1.parseDate(o.date, o.time_zone));
|
|
21
|
+
};
|
|
22
|
+
const getSchedule = async (patientId, specialtyId, filter = {}) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const mappedFilter = {
|
|
25
|
+
id_professional: filter.professionalId,
|
|
26
|
+
offset: filter.offset,
|
|
27
|
+
limit: filter.limit,
|
|
28
|
+
week_day: filter.weekDay,
|
|
29
|
+
date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
|
|
30
|
+
start_hour: filter.startHour,
|
|
31
|
+
finish_hour: filter.finishHour,
|
|
32
|
+
language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
33
|
+
user_time_zone: filter.userTimeZone,
|
|
34
|
+
};
|
|
35
|
+
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
36
|
+
const response = await makeRequest('GET', path);
|
|
37
|
+
return response.data.available_appointments.map((a) => ({
|
|
38
|
+
id: a.id,
|
|
39
|
+
date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
|
|
40
|
+
clinicId: a.clinic,
|
|
41
|
+
professional: {
|
|
42
|
+
id: a.professional_id,
|
|
43
|
+
fullName: a.professional,
|
|
44
|
+
logoUrl: a.logo,
|
|
45
|
+
},
|
|
46
|
+
cost: a.cost,
|
|
47
|
+
specialty: {
|
|
48
|
+
id: a.specialty_id,
|
|
49
|
+
description: a.specialty,
|
|
50
|
+
},
|
|
51
|
+
type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
|
|
52
|
+
atentions: a.atentions,
|
|
53
|
+
ranking: a.ranking,
|
|
54
|
+
length: a.length,
|
|
55
|
+
consultation_value: a.consultation_value,
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
const getAppointment = async (appointmentId) => {
|
|
59
|
+
const path = `/appointment/${appointmentId}`;
|
|
60
|
+
const response = await makeRequest('GET', path);
|
|
61
|
+
return {
|
|
62
|
+
id: response.data.id,
|
|
63
|
+
professionalId: response.data.professional_id,
|
|
64
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const getAppointmentByVcToken = async (vcToken) => {
|
|
68
|
+
const path = `/appointmentByToken/${vcToken}`;
|
|
69
|
+
const response = await makeRequest('GET', path);
|
|
70
|
+
return {
|
|
71
|
+
id: response.data.id,
|
|
72
|
+
professionalId: response.data.professional_id,
|
|
73
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
getSchedule: validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), getSchedule),
|
|
78
|
+
getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
|
|
79
|
+
getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
|
|
80
|
+
getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.getScheduleMethods = getScheduleMethods;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
|
|
4
|
-
id: number;
|
|
5
|
-
description: string;
|
|
6
|
-
}[]>;
|
|
7
|
-
getProfessionalsBySpecialty: (...params: any) => Promise<{
|
|
8
|
-
logoUrl?: string | undefined;
|
|
9
|
-
brief?: string | undefined;
|
|
10
|
-
consultation_value?: string | number | null | undefined;
|
|
11
|
-
degree?: string | undefined;
|
|
12
|
-
primer_turno?: string | undefined;
|
|
13
|
-
id: number;
|
|
14
|
-
fullName: string;
|
|
15
|
-
}[]>;
|
|
16
|
-
};
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
|
|
4
|
+
id: number;
|
|
5
|
+
description: string;
|
|
6
|
+
}[]>;
|
|
7
|
+
getProfessionalsBySpecialty: (...params: any) => Promise<{
|
|
8
|
+
logoUrl?: string | undefined;
|
|
9
|
+
brief?: string | undefined;
|
|
10
|
+
consultation_value?: string | number | null | undefined;
|
|
11
|
+
degree?: string | undefined;
|
|
12
|
+
primer_turno?: string | undefined;
|
|
13
|
+
id: number;
|
|
14
|
+
fullName: string;
|
|
15
|
+
}[]>;
|
|
16
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSpecialtiesMethods = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const validation_1 = require("../request/validation");
|
|
6
|
-
const schemas_1 = require("../schemas");
|
|
7
|
-
const getSpecialtiesMethods = (makeRequest) => {
|
|
8
|
-
const getSpecialties = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.specialtyMode, zod_1.string()]), zod_1.array(schemas_1.doc24Schemas.specialty), async (mode, language) => {
|
|
9
|
-
const type = mode === 'appointment' ? 'P' : mode === 'chat' ? 'T' : 'E';
|
|
10
|
-
const path = `/specialties/${type}/${language.toUpperCase()}`;
|
|
11
|
-
const response = await makeRequest('GET', path);
|
|
12
|
-
return response.data.specialties.map((s) => ({
|
|
13
|
-
id: s.specialty_id,
|
|
14
|
-
description: s.specialty,
|
|
15
|
-
}));
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
getSpecialties,
|
|
19
|
-
getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
|
|
20
|
-
var _a;
|
|
21
|
-
const mappedBody = {
|
|
22
|
-
specialty_id: body.specialtyId,
|
|
23
|
-
professional_id: body.professionalId,
|
|
24
|
-
offset: body.offset,
|
|
25
|
-
limit: body.limit,
|
|
26
|
-
language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
27
|
-
};
|
|
28
|
-
const path = `/professionals-by-specialty`;
|
|
29
|
-
const response = await makeRequest('POST', path, mappedBody);
|
|
30
|
-
const mapProfessionalResponse = (rawItem) => {
|
|
31
|
-
return {
|
|
32
|
-
id: rawItem.id_profesional,
|
|
33
|
-
fullName: rawItem.denominacion,
|
|
34
|
-
consultation_value: rawItem.consultation_value,
|
|
35
|
-
logoUrl: rawItem.logo,
|
|
36
|
-
primer_turno: rawItem.primer_turno,
|
|
37
|
-
brief: rawItem.mini_cv,
|
|
38
|
-
degree: rawItem.degree,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
return response.data.profesionales.map((o) => mapProfessionalResponse(o));
|
|
42
|
-
}),
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
exports.getSpecialtiesMethods = getSpecialtiesMethods;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSpecialtiesMethods = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validation_1 = require("../request/validation");
|
|
6
|
+
const schemas_1 = require("../schemas");
|
|
7
|
+
const getSpecialtiesMethods = (makeRequest) => {
|
|
8
|
+
const getSpecialties = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.specialtyMode, zod_1.string()]), zod_1.array(schemas_1.doc24Schemas.specialty), async (mode, language) => {
|
|
9
|
+
const type = mode === 'appointment' ? 'P' : mode === 'chat' ? 'T' : 'E';
|
|
10
|
+
const path = `/specialties/${type}/${language.toUpperCase()}`;
|
|
11
|
+
const response = await makeRequest('GET', path);
|
|
12
|
+
return response.data.specialties.map((s) => ({
|
|
13
|
+
id: s.specialty_id,
|
|
14
|
+
description: s.specialty,
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
getSpecialties,
|
|
19
|
+
getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
|
|
20
|
+
var _a;
|
|
21
|
+
const mappedBody = {
|
|
22
|
+
specialty_id: body.specialtyId,
|
|
23
|
+
professional_id: body.professionalId,
|
|
24
|
+
offset: body.offset,
|
|
25
|
+
limit: body.limit,
|
|
26
|
+
language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
27
|
+
};
|
|
28
|
+
const path = `/professionals-by-specialty`;
|
|
29
|
+
const response = await makeRequest('POST', path, mappedBody);
|
|
30
|
+
const mapProfessionalResponse = (rawItem) => {
|
|
31
|
+
return {
|
|
32
|
+
id: rawItem.id_profesional,
|
|
33
|
+
fullName: rawItem.denominacion,
|
|
34
|
+
consultation_value: rawItem.consultation_value,
|
|
35
|
+
logoUrl: rawItem.logo,
|
|
36
|
+
primer_turno: rawItem.primer_turno,
|
|
37
|
+
brief: rawItem.mini_cv,
|
|
38
|
+
degree: rawItem.degree,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
return response.data.profesionales.map((o) => mapProfessionalResponse(o));
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.getSpecialtiesMethods = getSpecialtiesMethods;
|