@integraciones_doc24/sdk 1.2.0 → 1.3.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/diagnostica.d.ts +6 -6
- package/lib/baseSdk/index.js +5 -1
- package/lib/baseSdk/user.d.ts +4 -52
- package/lib/baseSdk/user.js +25 -67
- package/lib/index.d.ts +16 -45
- package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/lib/baseSdk/index.d.ts +14 -0
- package/lib/lib/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/lib/lib/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/lib/lib/index.d.ts +58 -0
- package/lib/lib/lib/lib/index.js +22 -0
- package/lib/lib/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/lib/lib/request/index.js +26 -0
- package/lib/lib/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/lib/lib/request/token.js +34 -0
- package/lib/lib/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/lib/lib/request/validation.js +28 -0
- package/lib/lib/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/lib/lib/schemas.js +325 -0
- package/lib/lib/lib/lib/test.d.ts +1 -0
- package/lib/lib/lib/lib/test.js +55 -0
- package/lib/lib/lib/lib/types.d.ts +1 -0
- package/lib/lib/lib/lib/types.js +2 -0
- package/lib/lib/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/lib/lib/userSdk/index.d.ts +24 -0
- package/lib/lib/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/lib/lib/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/lib/lib/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/lib/utils.d.ts +4 -0
- package/lib/lib/lib/lib/utils.js +19 -0
- package/lib/lib/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/lib/lib/webhook/index.js +55 -0
- package/lib/lib/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/lib/lib/webhook/token.js +23 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/src/baseSdk/index.d.ts +51 -0
- package/lib/lib/lib/src/baseSdk/index.js +66 -0
- package/lib/lib/lib/src/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/src/baseSdk/user.js +130 -0
- package/lib/lib/lib/src/index.d.ts +169 -0
- package/lib/lib/lib/src/index.js +22 -0
- package/lib/lib/lib/src/request/index.d.ts +2 -0
- package/lib/lib/lib/src/request/index.js +26 -0
- package/lib/lib/lib/src/request/token.d.ts +2 -0
- package/lib/lib/lib/src/request/token.js +34 -0
- package/lib/lib/lib/src/request/validation.d.ts +10 -0
- package/lib/lib/lib/src/request/validation.js +28 -0
- package/lib/lib/lib/src/schemas.d.ts +1340 -0
- package/lib/lib/lib/src/schemas.js +325 -0
- package/lib/lib/lib/src/types.d.ts +1 -0
- package/lib/lib/lib/src/types.js +2 -0
- package/lib/lib/lib/src/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/src/userSdk/chat.js +98 -0
- package/lib/lib/lib/src/userSdk/index.d.ts +102 -0
- package/lib/lib/lib/src/userSdk/index.js +27 -0
- package/lib/lib/lib/src/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/src/userSdk/patients.js +55 -0
- package/lib/lib/lib/src/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/src/userSdk/schedule.js +76 -0
- package/lib/lib/lib/src/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/src/userSdk/specialties.js +19 -0
- package/lib/lib/lib/src/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/src/utils.d.ts +4 -0
- package/lib/lib/lib/src/utils.js +19 -0
- package/lib/lib/lib/src/webhook/index.d.ts +8 -0
- package/lib/lib/lib/src/webhook/index.js +55 -0
- package/lib/lib/lib/src/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/src/webhook/responses.js +42 -0
- package/lib/lib/lib/src/webhook/token.d.ts +2 -0
- package/lib/lib/lib/src/webhook/token.js +23 -0
- package/lib/schemas.d.ts +30 -236
- package/lib/schemas.js +2 -34
- package/lib/test.js +1 -36
- package/lib/types.d.ts +2 -11
- package/lib/userSdk/chat.d.ts +1 -1
- package/lib/userSdk/patients.d.ts +2 -23
- package/lib/userSdk/patients.js +6 -34
- package/lib/userSdk/videoVisit.d.ts +2 -2
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -3
- package/package.json +1 -1
|
@@ -11,22 +11,22 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
|
11
11
|
deepLink: string;
|
|
12
12
|
}[]>;
|
|
13
13
|
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
+
language: string;
|
|
14
15
|
firstName: string;
|
|
15
16
|
lastName: string;
|
|
17
|
+
birthday: Date;
|
|
16
18
|
identificationType: "dni";
|
|
17
19
|
identificationValue: string;
|
|
18
20
|
gender: "m" | "f";
|
|
19
21
|
phone: string;
|
|
20
22
|
email: string;
|
|
21
|
-
language: string;
|
|
22
|
-
birthday: Date;
|
|
23
23
|
}, patient: {
|
|
24
24
|
firstName: string;
|
|
25
25
|
lastName: string;
|
|
26
|
+
birthday: Date;
|
|
26
27
|
identificationType: "dni";
|
|
27
28
|
identificationValue: string;
|
|
28
29
|
gender: "m" | "f";
|
|
29
|
-
birthday: Date;
|
|
30
30
|
}) => Promise<{
|
|
31
31
|
forwardingRequired: true;
|
|
32
32
|
deepLink: string;
|
|
@@ -34,21 +34,21 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
|
34
34
|
forwardingRequired: false;
|
|
35
35
|
}>;
|
|
36
36
|
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
+
language: string;
|
|
37
38
|
firstName: string;
|
|
38
39
|
lastName: string;
|
|
40
|
+
birthday: Date;
|
|
39
41
|
identificationType: "dni";
|
|
40
42
|
identificationValue: string;
|
|
41
43
|
gender: "m" | "f";
|
|
42
44
|
phone: string;
|
|
43
45
|
email: string;
|
|
44
|
-
language: string;
|
|
45
|
-
birthday: Date;
|
|
46
46
|
}, patient: {
|
|
47
47
|
firstName: string;
|
|
48
48
|
lastName: string;
|
|
49
|
+
birthday: Date;
|
|
49
50
|
identificationType: "dni";
|
|
50
51
|
identificationValue: string;
|
|
51
52
|
gender: "m" | "f";
|
|
52
|
-
birthday: Date;
|
|
53
53
|
}) => Promise<void>;
|
|
54
54
|
};
|
package/lib/baseSdk/index.js
CHANGED
|
@@ -48,9 +48,13 @@ const getBaseSdk = async (url, credentials) => {
|
|
|
48
48
|
id: s.id_especialidad,
|
|
49
49
|
description: s.especialidad,
|
|
50
50
|
});
|
|
51
|
+
const mapSpecialityER = (s) => ({
|
|
52
|
+
id: s.specialty_id,
|
|
53
|
+
description: s.specialty,
|
|
54
|
+
});
|
|
51
55
|
const mapped = {
|
|
52
56
|
specialties: response.data.specialties.map(mapSpeciality),
|
|
53
|
-
specialtiesER: response.data.specialties_er.map(
|
|
57
|
+
specialtiesER: response.data.specialties_er.map(mapSpecialityER),
|
|
54
58
|
professionals: response.data.professionals.map((p) => ({
|
|
55
59
|
id: p.id_profesional,
|
|
56
60
|
fullName: p.denominacion,
|
package/lib/baseSdk/user.d.ts
CHANGED
|
@@ -1,73 +1,25 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
import { Doc24 } from '../types';
|
|
3
3
|
export declare const getUserMethods: (makeRequest: RequestMaker, url: string, credentials: Doc24.SdkCredentials) => {
|
|
4
|
-
declareUser: (
|
|
5
|
-
user: {
|
|
6
|
-
firstName: string;
|
|
7
|
-
lastName: string;
|
|
8
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
9
|
-
identificationValue: string;
|
|
10
|
-
countryId: string;
|
|
11
|
-
birthdate: Date;
|
|
12
|
-
gender: "m" | "f";
|
|
13
|
-
phone: string;
|
|
14
|
-
email: string;
|
|
15
|
-
};
|
|
16
|
-
} & {
|
|
17
|
-
code?: string | undefined;
|
|
18
|
-
channel?: "1" | "2" | undefined;
|
|
19
|
-
}) => Promise<{
|
|
20
|
-
patientId: number | null;
|
|
21
|
-
userInfo: {
|
|
22
|
-
phone: string;
|
|
23
|
-
email: string;
|
|
24
|
-
};
|
|
25
|
-
askCode: boolean;
|
|
26
|
-
userId: number;
|
|
27
|
-
}>;
|
|
28
|
-
getUserId: (user: {
|
|
4
|
+
declareUser: (user: {
|
|
29
5
|
firstName: string;
|
|
30
6
|
lastName: string;
|
|
31
7
|
identificationType: "ndi" | "passport" | "credential";
|
|
32
8
|
identificationValue: string;
|
|
33
|
-
countryId: string;
|
|
34
|
-
birthdate: Date;
|
|
35
9
|
gender: "m" | "f";
|
|
36
10
|
phone: string;
|
|
37
11
|
email: string;
|
|
38
|
-
}) => Promise<number>;
|
|
39
|
-
sendVerificationCode: (params: {
|
|
40
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
41
|
-
identificationValue: string;
|
|
42
|
-
channel: "1" | "2";
|
|
43
|
-
}) => Promise<any>;
|
|
44
|
-
getUserInstance: (user: number | {
|
|
45
|
-
firstName: string;
|
|
46
|
-
lastName: string;
|
|
47
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
48
|
-
identificationValue: string;
|
|
49
12
|
countryId: string;
|
|
50
13
|
birthdate: Date;
|
|
51
|
-
gender: "m" | "f";
|
|
52
|
-
phone: string;
|
|
53
|
-
email: string;
|
|
54
14
|
}) => Promise<any>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
lastName: string;
|
|
58
|
-
birthdate: Date;
|
|
59
|
-
gender: "m" | "f";
|
|
60
|
-
email: string;
|
|
61
|
-
startDate: Date;
|
|
62
|
-
identificationNumber: string;
|
|
63
|
-
plan: string;
|
|
64
|
-
}) => Promise<void>;
|
|
15
|
+
getUserInstance: (...params: any) => Promise<any>;
|
|
16
|
+
enroll: (...params: any) => Promise<void>;
|
|
65
17
|
getConverageInfo: (identificationValue: string) => Promise<{
|
|
66
18
|
firstName: string | null;
|
|
67
19
|
lastName: string | null;
|
|
68
|
-
birthdate: Date;
|
|
69
20
|
gender: "m" | "f";
|
|
70
21
|
email: string | null;
|
|
22
|
+
birthdate: Date;
|
|
71
23
|
identificationNumber: string;
|
|
72
24
|
plan: string | null;
|
|
73
25
|
financerId: number | null;
|
package/lib/baseSdk/user.js
CHANGED
|
@@ -8,39 +8,11 @@ const schemas_1 = require("../schemas");
|
|
|
8
8
|
const userSdk_1 = require("../userSdk");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const getUserMethods = (makeRequest, url, credentials) => {
|
|
11
|
-
const declareUser = async ({ user, channel, code, }) => {
|
|
12
|
-
const path = '/user';
|
|
13
|
-
const mappedUser = {
|
|
14
|
-
lastname: user.lastName,
|
|
15
|
-
firstname: user.firstName,
|
|
16
|
-
identification_type: utils_1.getIdetificationTypeId(user.identificationType),
|
|
17
|
-
identification_value: user.identificationValue,
|
|
18
|
-
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
19
|
-
gender: user.gender.toUpperCase(),
|
|
20
|
-
phone: user.phone,
|
|
21
|
-
email: user.email,
|
|
22
|
-
country_id: user.countryId,
|
|
23
|
-
};
|
|
24
|
-
const parsedChannel = channel ? parseInt(channel) : channel;
|
|
25
|
-
const response = await makeRequest('POST', path, {
|
|
26
|
-
user_data: mappedUser,
|
|
27
|
-
channel: parsedChannel,
|
|
28
|
-
code,
|
|
29
|
-
});
|
|
30
|
-
const mappedResponse = {
|
|
31
|
-
userId: response.data.user_id,
|
|
32
|
-
patientId: response.data.patient_id,
|
|
33
|
-
userInfo: response.data.user_info,
|
|
34
|
-
askCode: response.data.ask_code,
|
|
35
|
-
};
|
|
36
|
-
return mappedResponse;
|
|
37
|
-
};
|
|
38
11
|
const getUserId = async (user) => {
|
|
39
|
-
const path = '/user';
|
|
40
12
|
const mappedUser = {
|
|
41
13
|
lastname: user.lastName,
|
|
42
14
|
firstname: user.firstName,
|
|
43
|
-
identification_type: utils_1.
|
|
15
|
+
identification_type: utils_1.getIndetificationTypeId(user.identificationType),
|
|
44
16
|
identification_value: user.identificationValue,
|
|
45
17
|
birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
|
|
46
18
|
gender: user.gender.toUpperCase(),
|
|
@@ -48,41 +20,12 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
48
20
|
email: user.email,
|
|
49
21
|
country_id: user.countryId,
|
|
50
22
|
};
|
|
51
|
-
const response = await makeRequest('POST',
|
|
23
|
+
const response = await makeRequest('POST', '/user', {
|
|
52
24
|
user_data: mappedUser,
|
|
53
25
|
});
|
|
54
26
|
return response.data.user_id;
|
|
55
27
|
};
|
|
56
|
-
const
|
|
57
|
-
const path = '/send-verification-code';
|
|
58
|
-
const mappedParams = {
|
|
59
|
-
identification_type: utils_1.getIdetificationTypeId(params.identificationType),
|
|
60
|
-
identification_value: params.identificationValue,
|
|
61
|
-
channel: parseInt(params.channel),
|
|
62
|
-
};
|
|
63
|
-
await makeRequest('POST', path, mappedParams);
|
|
64
|
-
};
|
|
65
|
-
const getUserInstance = async (user) => {
|
|
66
|
-
const userId = typeof user === 'number' ? user : await getUserId(user);
|
|
67
|
-
return userSdk_1.userSdk(url, credentials, userId);
|
|
68
|
-
};
|
|
69
|
-
const enroll = async (params) => {
|
|
70
|
-
const path = `/enrollment`;
|
|
71
|
-
const mappedUser = {
|
|
72
|
-
firstname: params.firstName,
|
|
73
|
-
lastname: params.lastName,
|
|
74
|
-
gender: params.gender.toUpperCase(),
|
|
75
|
-
identification_number: params.identificationNumber,
|
|
76
|
-
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
77
|
-
email: params.email,
|
|
78
|
-
plan: params.plan,
|
|
79
|
-
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
80
|
-
};
|
|
81
|
-
await makeRequest('POST', path, {
|
|
82
|
-
user_data: mappedUser,
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const getConverageInfo = async (identificationValue) => {
|
|
28
|
+
const getConverageInfo = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, async (identificationValue) => {
|
|
86
29
|
const path = `/info-coverage/${identificationValue}`;
|
|
87
30
|
const response = await makeRequest('GET', path);
|
|
88
31
|
const raw = response.data.info;
|
|
@@ -115,16 +58,31 @@ const getUserMethods = (makeRequest, url, credentials) => {
|
|
|
115
58
|
: null,
|
|
116
59
|
};
|
|
117
60
|
return mappedCoverageInfo;
|
|
118
|
-
};
|
|
61
|
+
});
|
|
119
62
|
return {
|
|
120
|
-
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.
|
|
121
|
-
getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
122
|
-
sendVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendVerificationCodeParams]), zod_1.void(), sendVerificationCode),
|
|
63
|
+
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
123
64
|
getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
|
|
124
65
|
// TODO: validate?
|
|
125
|
-
zod_1.any(),
|
|
126
|
-
|
|
127
|
-
|
|
66
|
+
zod_1.any(), async (user) => {
|
|
67
|
+
const userId = typeof user === 'number' ? user : await getUserId(user);
|
|
68
|
+
return userSdk_1.userSdk(url, credentials, userId);
|
|
69
|
+
}),
|
|
70
|
+
enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
|
|
71
|
+
const path = `/enrollment`;
|
|
72
|
+
await makeRequest('POST', path, {
|
|
73
|
+
user_data: {
|
|
74
|
+
firstname: params.firstName,
|
|
75
|
+
lastname: params.lastName,
|
|
76
|
+
gender: params.gender.toUpperCase(),
|
|
77
|
+
identification_number: params.identificationNumber,
|
|
78
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
79
|
+
email: params.email,
|
|
80
|
+
plan: params.plan,
|
|
81
|
+
start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}),
|
|
85
|
+
getConverageInfo,
|
|
128
86
|
};
|
|
129
87
|
};
|
|
130
88
|
exports.getUserMethods = getUserMethods;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,61 +5,37 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
5
5
|
eventHandlers: Doc24.Webhook.Events;
|
|
6
6
|
baseAddress: string;
|
|
7
7
|
}) => Promise<Doc24.Webhook.Handler>;
|
|
8
|
-
declareUser: (
|
|
9
|
-
user: {
|
|
10
|
-
firstName: string;
|
|
11
|
-
lastName: string;
|
|
12
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
13
|
-
identificationValue: string;
|
|
14
|
-
countryId: string;
|
|
15
|
-
birthdate: Date;
|
|
16
|
-
gender: "m" | "f";
|
|
17
|
-
phone: string;
|
|
18
|
-
email: string;
|
|
19
|
-
};
|
|
20
|
-
} & {
|
|
21
|
-
code?: string | undefined;
|
|
22
|
-
channel?: "1" | "2" | undefined;
|
|
23
|
-
}) => Promise<{
|
|
24
|
-
patientId: number | null;
|
|
25
|
-
userInfo: {
|
|
26
|
-
phone: string;
|
|
27
|
-
email: string;
|
|
28
|
-
};
|
|
29
|
-
askCode: boolean;
|
|
30
|
-
userId: number;
|
|
31
|
-
}>;
|
|
32
|
-
getUserId: (user: {
|
|
8
|
+
declareUser: (user: {
|
|
33
9
|
firstName: string;
|
|
34
10
|
lastName: string;
|
|
35
11
|
identificationType: "ndi" | "passport" | "credential";
|
|
36
12
|
identificationValue: string;
|
|
37
|
-
countryId: string;
|
|
38
|
-
birthdate: Date;
|
|
39
13
|
gender: "m" | "f";
|
|
40
14
|
phone: string;
|
|
41
15
|
email: string;
|
|
16
|
+
countryId: string;
|
|
17
|
+
birthdate: Date;
|
|
42
18
|
}) => Promise<number>;
|
|
43
19
|
getUserInstance: (user: number | {
|
|
44
20
|
firstName: string;
|
|
45
21
|
lastName: string;
|
|
46
22
|
identificationType: "ndi" | "passport" | "credential";
|
|
47
23
|
identificationValue: string;
|
|
48
|
-
countryId: string;
|
|
49
|
-
birthdate: Date;
|
|
50
24
|
gender: "m" | "f";
|
|
51
25
|
phone: string;
|
|
52
26
|
email: string;
|
|
27
|
+
countryId: string;
|
|
28
|
+
birthdate: Date;
|
|
53
29
|
}) => Promise<Doc24.UserSdk>;
|
|
54
30
|
getProfessional: (professionalId: number) => Promise<{
|
|
31
|
+
id: number;
|
|
32
|
+
logoUrl: string;
|
|
55
33
|
firstName: string;
|
|
56
34
|
lastName: string;
|
|
57
|
-
birthdate: Date;
|
|
58
35
|
gender: "m" | "f";
|
|
59
36
|
phone: string | null;
|
|
60
37
|
email: string;
|
|
61
|
-
|
|
62
|
-
logoUrl: string;
|
|
38
|
+
birthdate: Date;
|
|
63
39
|
specialties: {
|
|
64
40
|
id: number;
|
|
65
41
|
description: string;
|
|
@@ -97,9 +73,9 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
97
73
|
enroll: (params: {
|
|
98
74
|
firstName: string;
|
|
99
75
|
lastName: string;
|
|
100
|
-
birthdate: Date;
|
|
101
76
|
gender: "m" | "f";
|
|
102
77
|
email: string;
|
|
78
|
+
birthdate: Date;
|
|
103
79
|
startDate: Date;
|
|
104
80
|
identificationNumber: string;
|
|
105
81
|
plan: string;
|
|
@@ -107,9 +83,9 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
107
83
|
getConverageInfo: (identificationValue: string) => Promise<{
|
|
108
84
|
firstName: string | null;
|
|
109
85
|
lastName: string | null;
|
|
110
|
-
birthdate: Date;
|
|
111
86
|
gender: "m" | "f";
|
|
112
87
|
email: string | null;
|
|
88
|
+
birthdate: Date;
|
|
113
89
|
identificationNumber: string;
|
|
114
90
|
plan: string | null;
|
|
115
91
|
financerId: number | null;
|
|
@@ -128,11 +104,6 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
128
104
|
authorizationCode: string | null;
|
|
129
105
|
authorizationCodeExpiration: Date | null;
|
|
130
106
|
} | null>;
|
|
131
|
-
sendVerificationCode: (params: {
|
|
132
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
133
|
-
identificationValue: string;
|
|
134
|
-
channel: "1" | "2";
|
|
135
|
-
}) => Promise<any>;
|
|
136
107
|
getDiagnosticaHistory: (patient: {
|
|
137
108
|
identificationType: "ndi" | "passport" | "credential";
|
|
138
109
|
identificationValue: string;
|
|
@@ -144,22 +115,22 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
144
115
|
deepLink: string;
|
|
145
116
|
}[]>;
|
|
146
117
|
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
118
|
+
language: string;
|
|
147
119
|
firstName: string;
|
|
148
120
|
lastName: string;
|
|
121
|
+
birthday: Date;
|
|
149
122
|
identificationType: "dni";
|
|
150
123
|
identificationValue: string;
|
|
151
124
|
gender: "m" | "f";
|
|
152
125
|
phone: string;
|
|
153
126
|
email: string;
|
|
154
|
-
language: string;
|
|
155
|
-
birthday: Date;
|
|
156
127
|
}, patient: {
|
|
157
128
|
firstName: string;
|
|
158
129
|
lastName: string;
|
|
130
|
+
birthday: Date;
|
|
159
131
|
identificationType: "dni";
|
|
160
132
|
identificationValue: string;
|
|
161
133
|
gender: "m" | "f";
|
|
162
|
-
birthday: Date;
|
|
163
134
|
}) => Promise<{
|
|
164
135
|
forwardingRequired: true;
|
|
165
136
|
deepLink: string;
|
|
@@ -167,22 +138,22 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
167
138
|
forwardingRequired: false;
|
|
168
139
|
}>;
|
|
169
140
|
getDiagnosticaAccess: (kiosk: string, user: {
|
|
141
|
+
language: string;
|
|
170
142
|
firstName: string;
|
|
171
143
|
lastName: string;
|
|
144
|
+
birthday: Date;
|
|
172
145
|
identificationType: "dni";
|
|
173
146
|
identificationValue: string;
|
|
174
147
|
gender: "m" | "f";
|
|
175
148
|
phone: string;
|
|
176
149
|
email: string;
|
|
177
|
-
language: string;
|
|
178
|
-
birthday: Date;
|
|
179
150
|
}, patient: {
|
|
180
151
|
firstName: string;
|
|
181
152
|
lastName: string;
|
|
153
|
+
birthday: Date;
|
|
182
154
|
identificationType: "dni";
|
|
183
155
|
identificationValue: string;
|
|
184
156
|
gender: "m" | "f";
|
|
185
|
-
birthday: Date;
|
|
186
157
|
}) => Promise<void>;
|
|
187
158
|
}>;
|
|
188
159
|
export type { Doc24 } from './types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getDiagnosticaMethods(makeRequest: any): {
|
|
3
|
+
getDiagnosticaHistory: (...params: any[]) => Promise<any>;
|
|
4
|
+
getDiagnosticaDeepLink: (...params: any[]) => Promise<any>;
|
|
5
|
+
getDiagnosticaAccess: (...params: any[]) => Promise<any>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getBaseSdk(url: any, credentials: any): Promise<{
|
|
3
|
+
getProfessional: (...params: any[]) => Promise<any>;
|
|
4
|
+
getAvailableScheduleClinics: (...params: any[]) => Promise<any>;
|
|
5
|
+
declareUser: (...params: any[]) => Promise<any>;
|
|
6
|
+
getUserId: (...params: any[]) => Promise<any>;
|
|
7
|
+
sendVerificationCode: (...params: any[]) => Promise<any>;
|
|
8
|
+
getUserInstance: (...params: any[]) => Promise<any>;
|
|
9
|
+
enroll: (...params: any[]) => Promise<any>;
|
|
10
|
+
getConverageInfo: (...params: any[]) => Promise<any>;
|
|
11
|
+
getDiagnosticaHistory: (...params: any[]) => Promise<any>;
|
|
12
|
+
getDiagnosticaDeepLink: (...params: any[]) => Promise<any>;
|
|
13
|
+
getDiagnosticaAccess: (...params: any[]) => Promise<any>;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,66 @@
|
|
|
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;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getUserMethods(makeRequest: any, url: any, credentials: any): {
|
|
3
|
+
declareUser: (...params: any[]) => Promise<any>;
|
|
4
|
+
getUserId: (...params: any[]) => Promise<any>;
|
|
5
|
+
sendVerificationCode: (...params: any[]) => Promise<any>;
|
|
6
|
+
getUserInstance: (...params: any[]) => Promise<any>;
|
|
7
|
+
enroll: (...params: any[]) => Promise<any>;
|
|
8
|
+
getConverageInfo: (...params: any[]) => Promise<any>;
|
|
9
|
+
};
|