@integraciones_doc24/sdk 1.16.29 → 1.16.30
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 +206 -206
- package/lib/baseSdk/consultation.d.ts +99 -0
- package/lib/baseSdk/consultation.js +23 -0
- 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 +77 -76
- 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 +2518 -2518
- package/lib/schemas.js +548 -548
- package/lib/types.d.ts +170 -170
- 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 -58
- package/lib/userSdk/schedule.js +89 -89
- package/lib/userSdk/specialties.d.ts +19 -19
- package/lib/userSdk/specialties.js +48 -48
- package/lib/userSdk/videoVisit.d.ts +187 -187
- package/lib/userSdk/videoVisit.js +250 -250
- package/lib/utils.d.ts +3 -3
- package/lib/utils.js +43 -43
- 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
package/lib/userSdk/patients.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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
|
-
emergency_contact: patient.emergencyContact,
|
|
21
|
-
emergency_contact_phone: patient.emergencyContactPhone,
|
|
22
|
-
credential: patient.credential,
|
|
23
|
-
plan: patient.plan,
|
|
24
|
-
affiliation_status: patient.affiliationStatus,
|
|
25
|
-
localidad: patient.localidad,
|
|
26
|
-
cod_postal: patient.codPostal,
|
|
27
|
-
};
|
|
28
|
-
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
29
|
-
const response = await makeRequest('POST', path, {
|
|
30
|
-
user_data: mappedPatient,
|
|
31
|
-
channel: parsedChannel,
|
|
32
|
-
code,
|
|
33
|
-
});
|
|
34
|
-
const data = response.data;
|
|
35
|
-
if (data.ask_code)
|
|
36
|
-
return {
|
|
37
|
-
userInfo: {
|
|
38
|
-
firstName: data.user_info.firstname,
|
|
39
|
-
lastName: data.user_info.lastname,
|
|
40
|
-
phone: data.user_info.phone,
|
|
41
|
-
email: data.user_info.email,
|
|
42
|
-
},
|
|
43
|
-
askCode: true,
|
|
44
|
-
};
|
|
45
|
-
return { askCode: false, patientId: data.patient_id };
|
|
46
|
-
};
|
|
47
|
-
const getPatientId = async (patient) => {
|
|
48
|
-
var _a;
|
|
49
|
-
const path = '/search-patient';
|
|
50
|
-
const mappedPatient = {
|
|
51
|
-
lastname: patient.lastName,
|
|
52
|
-
firstname: patient.firstName,
|
|
53
|
-
identification_type: patient.identificationType,
|
|
54
|
-
identification_value: patient.identificationValue,
|
|
55
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
56
|
-
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
57
|
-
country_id: patient.countryId,
|
|
58
|
-
};
|
|
59
|
-
const response = await makeRequest('POST', path, {
|
|
60
|
-
user_data: mappedPatient,
|
|
61
|
-
});
|
|
62
|
-
return response.data.patient_id;
|
|
63
|
-
};
|
|
64
|
-
const deletePatient = async (patientId) => {
|
|
65
|
-
const path = `/patient/${patientId}`;
|
|
66
|
-
await makeRequest('DELETE', path);
|
|
67
|
-
};
|
|
68
|
-
const getPatientPHR = async (patientId) => {
|
|
69
|
-
const path = `/view-phr/${patientId}`;
|
|
70
|
-
const response = await makeRequest('GET', path);
|
|
71
|
-
return response.data.url_acceso_paciente;
|
|
72
|
-
};
|
|
73
|
-
const submitHealthQuiz = async ({ patientId, quiz, origen, }) => {
|
|
74
|
-
const path = '/health-quiz-external';
|
|
75
|
-
await makeRequest('POST', path, {
|
|
76
|
-
id_persona: patientId,
|
|
77
|
-
quiz,
|
|
78
|
-
origen,
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
83
|
-
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
84
|
-
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
85
|
-
getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
|
|
86
|
-
submitHealthQuiz: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.healthQuizParams]), zod_1.void(), submitHealthQuiz),
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
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
|
+
emergency_contact: patient.emergencyContact,
|
|
21
|
+
emergency_contact_phone: patient.emergencyContactPhone,
|
|
22
|
+
credential: patient.credential,
|
|
23
|
+
plan: patient.plan,
|
|
24
|
+
affiliation_status: patient.affiliationStatus,
|
|
25
|
+
localidad: patient.localidad,
|
|
26
|
+
cod_postal: patient.codPostal,
|
|
27
|
+
};
|
|
28
|
+
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
29
|
+
const response = await makeRequest('POST', path, {
|
|
30
|
+
user_data: mappedPatient,
|
|
31
|
+
channel: parsedChannel,
|
|
32
|
+
code,
|
|
33
|
+
});
|
|
34
|
+
const data = response.data;
|
|
35
|
+
if (data.ask_code)
|
|
36
|
+
return {
|
|
37
|
+
userInfo: {
|
|
38
|
+
firstName: data.user_info.firstname,
|
|
39
|
+
lastName: data.user_info.lastname,
|
|
40
|
+
phone: data.user_info.phone,
|
|
41
|
+
email: data.user_info.email,
|
|
42
|
+
},
|
|
43
|
+
askCode: true,
|
|
44
|
+
};
|
|
45
|
+
return { askCode: false, patientId: data.patient_id };
|
|
46
|
+
};
|
|
47
|
+
const getPatientId = async (patient) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const path = '/search-patient';
|
|
50
|
+
const mappedPatient = {
|
|
51
|
+
lastname: patient.lastName,
|
|
52
|
+
firstname: patient.firstName,
|
|
53
|
+
identification_type: patient.identificationType,
|
|
54
|
+
identification_value: patient.identificationValue,
|
|
55
|
+
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
56
|
+
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
|
|
57
|
+
country_id: patient.countryId,
|
|
58
|
+
};
|
|
59
|
+
const response = await makeRequest('POST', path, {
|
|
60
|
+
user_data: mappedPatient,
|
|
61
|
+
});
|
|
62
|
+
return response.data.patient_id;
|
|
63
|
+
};
|
|
64
|
+
const deletePatient = async (patientId) => {
|
|
65
|
+
const path = `/patient/${patientId}`;
|
|
66
|
+
await makeRequest('DELETE', path);
|
|
67
|
+
};
|
|
68
|
+
const getPatientPHR = async (patientId) => {
|
|
69
|
+
const path = `/view-phr/${patientId}`;
|
|
70
|
+
const response = await makeRequest('GET', path);
|
|
71
|
+
return response.data.url_acceso_paciente;
|
|
72
|
+
};
|
|
73
|
+
const submitHealthQuiz = async ({ patientId, quiz, origen, }) => {
|
|
74
|
+
const path = '/health-quiz-external';
|
|
75
|
+
await makeRequest('POST', path, {
|
|
76
|
+
id_persona: patientId,
|
|
77
|
+
quiz,
|
|
78
|
+
origen,
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
83
|
+
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
84
|
+
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
85
|
+
getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
|
|
86
|
+
submitHealthQuiz: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.healthQuizParams]), zod_1.void(), submitHealthQuiz),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.getPatientMethods = getPatientMethods;
|
|
@@ -1,58 +1,58 @@
|
|
|
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
|
-
showAppointmentConfiguration?: boolean | undefined;
|
|
14
|
-
} | undefined) => Promise<{
|
|
15
|
-
length?: number | null | undefined;
|
|
16
|
-
address?: string | null | undefined;
|
|
17
|
-
city?: string | null | undefined;
|
|
18
|
-
province?: string | null | undefined;
|
|
19
|
-
ranking?: unknown;
|
|
20
|
-
consultation_value?: string | null | undefined;
|
|
21
|
-
inPerson?: boolean | null | undefined;
|
|
22
|
-
virtual?: boolean | null | undefined;
|
|
23
|
-
date: Date;
|
|
24
|
-
type: "appointment" | "chat" | "instant";
|
|
25
|
-
id: string | number;
|
|
26
|
-
professional: {
|
|
27
|
-
logoUrl?: string | null | undefined;
|
|
28
|
-
id: number;
|
|
29
|
-
fullName: string;
|
|
30
|
-
};
|
|
31
|
-
specialty: {
|
|
32
|
-
start_age?: string | number | null | undefined;
|
|
33
|
-
end_age?: string | number | null | undefined;
|
|
34
|
-
authorization_code?: string | null | undefined;
|
|
35
|
-
id: number;
|
|
36
|
-
description: string;
|
|
37
|
-
};
|
|
38
|
-
clinicId: number;
|
|
39
|
-
cost: string;
|
|
40
|
-
atentions: number;
|
|
41
|
-
}[]>;
|
|
42
|
-
getScheduleDates: (patientId: number, filter?: {
|
|
43
|
-
specialtyId?: number | undefined;
|
|
44
|
-
language?: string | undefined;
|
|
45
|
-
professionalId?: number | undefined;
|
|
46
|
-
userTimeZone?: string | undefined;
|
|
47
|
-
} | undefined) => Promise<Date[]>;
|
|
48
|
-
getAppointment: (appointmentId: number) => Promise<{
|
|
49
|
-
date: Date;
|
|
50
|
-
id: number;
|
|
51
|
-
professionalId: number;
|
|
52
|
-
}>;
|
|
53
|
-
getAppointmentByVcToken: (vcToken: string) => Promise<{
|
|
54
|
-
date: Date;
|
|
55
|
-
id: number;
|
|
56
|
-
professionalId: number;
|
|
57
|
-
}>;
|
|
58
|
-
};
|
|
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
|
+
showAppointmentConfiguration?: boolean | undefined;
|
|
14
|
+
} | undefined) => Promise<{
|
|
15
|
+
length?: number | null | undefined;
|
|
16
|
+
address?: string | null | undefined;
|
|
17
|
+
city?: string | null | undefined;
|
|
18
|
+
province?: string | null | undefined;
|
|
19
|
+
ranking?: unknown;
|
|
20
|
+
consultation_value?: string | null | undefined;
|
|
21
|
+
inPerson?: boolean | null | undefined;
|
|
22
|
+
virtual?: boolean | null | undefined;
|
|
23
|
+
date: Date;
|
|
24
|
+
type: "appointment" | "chat" | "instant";
|
|
25
|
+
id: string | number;
|
|
26
|
+
professional: {
|
|
27
|
+
logoUrl?: string | null | undefined;
|
|
28
|
+
id: number;
|
|
29
|
+
fullName: string;
|
|
30
|
+
};
|
|
31
|
+
specialty: {
|
|
32
|
+
start_age?: string | number | null | undefined;
|
|
33
|
+
end_age?: string | number | null | undefined;
|
|
34
|
+
authorization_code?: string | null | undefined;
|
|
35
|
+
id: number;
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
clinicId: number;
|
|
39
|
+
cost: string;
|
|
40
|
+
atentions: number;
|
|
41
|
+
}[]>;
|
|
42
|
+
getScheduleDates: (patientId: number, filter?: {
|
|
43
|
+
specialtyId?: number | undefined;
|
|
44
|
+
language?: string | undefined;
|
|
45
|
+
professionalId?: number | undefined;
|
|
46
|
+
userTimeZone?: string | undefined;
|
|
47
|
+
} | undefined) => Promise<Date[]>;
|
|
48
|
+
getAppointment: (appointmentId: number) => Promise<{
|
|
49
|
+
date: Date;
|
|
50
|
+
id: number;
|
|
51
|
+
professionalId: number;
|
|
52
|
+
}>;
|
|
53
|
+
getAppointmentByVcToken: (vcToken: string) => Promise<{
|
|
54
|
+
date: Date;
|
|
55
|
+
id: number;
|
|
56
|
+
professionalId: number;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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
|
-
show_appointment_configuration: filter.showAppointmentConfiguration ? 1 : null,
|
|
35
|
-
};
|
|
36
|
-
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
37
|
-
const response = await makeRequest('GET', path);
|
|
38
|
-
return response.data.available_appointments.map((a) => ({
|
|
39
|
-
id: a.id,
|
|
40
|
-
date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
|
|
41
|
-
clinicId: a.clinic,
|
|
42
|
-
professional: {
|
|
43
|
-
id: a.professional_id,
|
|
44
|
-
fullName: a.professional,
|
|
45
|
-
logoUrl: a.logo,
|
|
46
|
-
},
|
|
47
|
-
cost: a.cost,
|
|
48
|
-
specialty: {
|
|
49
|
-
id: a.specialty_id,
|
|
50
|
-
description: a.specialty,
|
|
51
|
-
},
|
|
52
|
-
type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
|
|
53
|
-
atentions: a.atentions,
|
|
54
|
-
ranking: a.ranking,
|
|
55
|
-
length: a.length,
|
|
56
|
-
consultation_value: a.consultation_value,
|
|
57
|
-
inPerson: a.in_person,
|
|
58
|
-
virtual: a.virtual,
|
|
59
|
-
province: a.province,
|
|
60
|
-
city: a.city,
|
|
61
|
-
address: a.address,
|
|
62
|
-
}));
|
|
63
|
-
};
|
|
64
|
-
const getAppointment = async (appointmentId) => {
|
|
65
|
-
const path = `/appointment/${appointmentId}`;
|
|
66
|
-
const response = await makeRequest('GET', path);
|
|
67
|
-
return {
|
|
68
|
-
id: response.data.id,
|
|
69
|
-
professionalId: response.data.professional_id,
|
|
70
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const getAppointmentByVcToken = async (vcToken) => {
|
|
74
|
-
const path = `/appointmentByToken/${vcToken}`;
|
|
75
|
-
const response = await makeRequest('GET', path);
|
|
76
|
-
return {
|
|
77
|
-
id: response.data.id,
|
|
78
|
-
professionalId: response.data.professional_id,
|
|
79
|
-
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
return {
|
|
83
|
-
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),
|
|
84
|
-
getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
|
|
85
|
-
getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
|
|
86
|
-
getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
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
|
+
show_appointment_configuration: filter.showAppointmentConfiguration ? 1 : null,
|
|
35
|
+
};
|
|
36
|
+
const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
|
|
37
|
+
const response = await makeRequest('GET', path);
|
|
38
|
+
return response.data.available_appointments.map((a) => ({
|
|
39
|
+
id: a.id,
|
|
40
|
+
date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
|
|
41
|
+
clinicId: a.clinic,
|
|
42
|
+
professional: {
|
|
43
|
+
id: a.professional_id,
|
|
44
|
+
fullName: a.professional,
|
|
45
|
+
logoUrl: a.logo,
|
|
46
|
+
},
|
|
47
|
+
cost: a.cost,
|
|
48
|
+
specialty: {
|
|
49
|
+
id: a.specialty_id,
|
|
50
|
+
description: a.specialty,
|
|
51
|
+
},
|
|
52
|
+
type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
|
|
53
|
+
atentions: a.atentions,
|
|
54
|
+
ranking: a.ranking,
|
|
55
|
+
length: a.length,
|
|
56
|
+
consultation_value: a.consultation_value,
|
|
57
|
+
inPerson: a.in_person,
|
|
58
|
+
virtual: a.virtual,
|
|
59
|
+
province: a.province,
|
|
60
|
+
city: a.city,
|
|
61
|
+
address: a.address,
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
const getAppointment = async (appointmentId) => {
|
|
65
|
+
const path = `/appointment/${appointmentId}`;
|
|
66
|
+
const response = await makeRequest('GET', path);
|
|
67
|
+
return {
|
|
68
|
+
id: response.data.id,
|
|
69
|
+
professionalId: response.data.professional_id,
|
|
70
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const getAppointmentByVcToken = async (vcToken) => {
|
|
74
|
+
const path = `/appointmentByToken/${vcToken}`;
|
|
75
|
+
const response = await makeRequest('GET', path);
|
|
76
|
+
return {
|
|
77
|
+
id: response.data.id,
|
|
78
|
+
professionalId: response.data.professional_id,
|
|
79
|
+
date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
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),
|
|
84
|
+
getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
|
|
85
|
+
getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
|
|
86
|
+
getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
exports.getScheduleMethods = getScheduleMethods;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
|
|
4
|
-
start_age?: string | number | null | undefined;
|
|
5
|
-
end_age?: string | number | null | undefined;
|
|
6
|
-
authorization_code?: string | null | undefined;
|
|
7
|
-
id: number;
|
|
8
|
-
description: string;
|
|
9
|
-
}[]>;
|
|
10
|
-
getProfessionalsBySpecialty: (...params: any) => Promise<{
|
|
11
|
-
logoUrl?: string | null | undefined;
|
|
12
|
-
brief?: string | null | undefined;
|
|
13
|
-
consultation_value?: string | number | null | undefined;
|
|
14
|
-
degree?: string | undefined;
|
|
15
|
-
primer_turno?: string | undefined;
|
|
16
|
-
id: number;
|
|
17
|
-
fullName: string;
|
|
18
|
-
}[]>;
|
|
19
|
-
};
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
|
|
4
|
+
start_age?: string | number | null | undefined;
|
|
5
|
+
end_age?: string | number | null | undefined;
|
|
6
|
+
authorization_code?: string | null | undefined;
|
|
7
|
+
id: number;
|
|
8
|
+
description: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
getProfessionalsBySpecialty: (...params: any) => Promise<{
|
|
11
|
+
logoUrl?: string | null | undefined;
|
|
12
|
+
brief?: string | null | undefined;
|
|
13
|
+
consultation_value?: string | number | null | undefined;
|
|
14
|
+
degree?: string | undefined;
|
|
15
|
+
primer_turno?: string | undefined;
|
|
16
|
+
id: number;
|
|
17
|
+
fullName: string;
|
|
18
|
+
}[]>;
|
|
19
|
+
};
|
|
@@ -1,48 +1,48 @@
|
|
|
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
|
-
start_age: s.start_age,
|
|
16
|
-
end_age: s.end_age,
|
|
17
|
-
authorization_code: s.authorization_code,
|
|
18
|
-
}));
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
getSpecialties,
|
|
22
|
-
getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const mappedBody = {
|
|
25
|
-
specialty_id: body.specialtyId,
|
|
26
|
-
professional_id: body.professionalId,
|
|
27
|
-
offset: body.offset,
|
|
28
|
-
limit: body.limit,
|
|
29
|
-
language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
30
|
-
};
|
|
31
|
-
const path = `/professionals-by-specialty`;
|
|
32
|
-
const response = await makeRequest('POST', path, mappedBody);
|
|
33
|
-
const mapProfessionalResponse = (rawItem) => {
|
|
34
|
-
return {
|
|
35
|
-
id: rawItem.id_profesional,
|
|
36
|
-
fullName: rawItem.denominacion,
|
|
37
|
-
consultation_value: rawItem.consultation_value,
|
|
38
|
-
logoUrl: rawItem.logo,
|
|
39
|
-
primer_turno: rawItem.primer_turno,
|
|
40
|
-
brief: rawItem.mini_cv,
|
|
41
|
-
degree: rawItem.degree,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
return response.data.profesionales.map((o) => mapProfessionalResponse(o));
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
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
|
+
start_age: s.start_age,
|
|
16
|
+
end_age: s.end_age,
|
|
17
|
+
authorization_code: s.authorization_code,
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
getSpecialties,
|
|
22
|
+
getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const mappedBody = {
|
|
25
|
+
specialty_id: body.specialtyId,
|
|
26
|
+
professional_id: body.professionalId,
|
|
27
|
+
offset: body.offset,
|
|
28
|
+
limit: body.limit,
|
|
29
|
+
language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
|
|
30
|
+
};
|
|
31
|
+
const path = `/professionals-by-specialty`;
|
|
32
|
+
const response = await makeRequest('POST', path, mappedBody);
|
|
33
|
+
const mapProfessionalResponse = (rawItem) => {
|
|
34
|
+
return {
|
|
35
|
+
id: rawItem.id_profesional,
|
|
36
|
+
fullName: rawItem.denominacion,
|
|
37
|
+
consultation_value: rawItem.consultation_value,
|
|
38
|
+
logoUrl: rawItem.logo,
|
|
39
|
+
primer_turno: rawItem.primer_turno,
|
|
40
|
+
brief: rawItem.mini_cv,
|
|
41
|
+
degree: rawItem.degree,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
return response.data.profesionales.map((o) => mapProfessionalResponse(o));
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.getSpecialtiesMethods = getSpecialtiesMethods;
|