@integraciones_doc24/sdk 1.1.1 → 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 -51
- package/lib/baseSdk/user.js +25 -67
- package/lib/index.d.ts +16 -44
- package/lib/lib/baseSdk/diagnostica.d.ts +11 -0
- package/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/baseSdk/index.d.ts +161 -0
- package/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/baseSdk/user.d.ts +41 -0
- package/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/index.d.ts +182 -0
- package/lib/lib/index.js +22 -0
- package/lib/lib/lib/baseSdk/diagnostica.d.ts +6 -0
- package/lib/lib/lib/baseSdk/diagnostica.js +79 -0
- package/lib/lib/lib/baseSdk/index.d.ts +51 -0
- package/lib/lib/lib/baseSdk/index.js +66 -0
- package/lib/lib/lib/baseSdk/user.d.ts +9 -0
- package/lib/lib/lib/baseSdk/user.js +130 -0
- package/lib/lib/lib/index.d.ts +168 -0
- package/lib/lib/lib/index.js +22 -0
- 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/request/index.d.ts +2 -0
- package/lib/lib/lib/request/index.js +26 -0
- package/lib/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/lib/request/token.js +34 -0
- package/lib/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/lib/request/validation.js +28 -0
- package/lib/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/lib/schemas.js +325 -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/lib/lib/test.d.ts +1 -0
- package/lib/lib/lib/test.js +55 -0
- package/lib/lib/lib/types.d.ts +1 -0
- package/lib/lib/lib/types.js +2 -0
- package/lib/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/lib/userSdk/index.d.ts +102 -0
- package/lib/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/lib/userSdk/patients.d.ts +5 -0
- package/lib/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/lib/userSdk/schedule.d.ts +7 -0
- package/lib/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/lib/userSdk/videoVisit.d.ts +10 -0
- package/lib/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/lib/utils.d.ts +4 -0
- package/lib/lib/lib/utils.js +19 -0
- package/lib/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/lib/webhook/index.js +55 -0
- package/lib/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/lib/webhook/token.js +23 -0
- package/lib/lib/request/index.d.ts +2 -0
- package/lib/lib/request/index.js +26 -0
- package/lib/lib/request/token.d.ts +2 -0
- package/lib/lib/request/token.js +34 -0
- package/lib/lib/request/validation.d.ts +10 -0
- package/lib/lib/request/validation.js +28 -0
- package/lib/lib/schemas.d.ts +1334 -0
- package/lib/lib/schemas.js +325 -0
- package/lib/lib/src/baseSdk/diagnostica.d.ts +11 -0
- package/lib/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/lib/src/baseSdk/index.d.ts +162 -0
- package/lib/lib/src/baseSdk/index.js +66 -0
- package/lib/lib/src/baseSdk/user.d.ts +41 -0
- package/lib/lib/src/baseSdk/user.js +130 -0
- package/lib/lib/src/index.d.ts +183 -0
- package/lib/lib/src/index.js +22 -0
- package/lib/lib/src/request/index.d.ts +2 -0
- package/lib/lib/src/request/index.js +26 -0
- package/lib/lib/src/request/token.d.ts +2 -0
- package/lib/lib/src/request/token.js +34 -0
- package/lib/lib/src/request/validation.d.ts +10 -0
- package/lib/lib/src/request/validation.js +28 -0
- package/lib/lib/src/schemas.d.ts +1340 -0
- package/lib/lib/src/schemas.js +325 -0
- package/lib/lib/src/types.d.ts +1 -0
- package/lib/lib/src/types.js +2 -0
- package/lib/lib/src/userSdk/chat.d.ts +9 -0
- package/lib/lib/src/userSdk/chat.js +98 -0
- package/lib/lib/src/userSdk/index.d.ts +241 -0
- package/lib/lib/src/userSdk/index.js +27 -0
- package/lib/lib/src/userSdk/patients.d.ts +13 -0
- package/lib/lib/src/userSdk/patients.js +55 -0
- package/lib/lib/src/userSdk/schedule.d.ts +15 -0
- package/lib/lib/src/userSdk/schedule.js +76 -0
- package/lib/lib/src/userSdk/specialties.d.ts +4 -0
- package/lib/lib/src/userSdk/specialties.js +19 -0
- package/lib/lib/src/userSdk/videoVisit.d.ts +72 -0
- package/lib/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/lib/src/utils.d.ts +4 -0
- package/lib/lib/src/utils.js +19 -0
- package/lib/lib/src/webhook/index.d.ts +8 -0
- package/lib/lib/src/webhook/index.js +55 -0
- package/lib/lib/src/webhook/responses.d.ts +36 -0
- package/lib/lib/src/webhook/responses.js +42 -0
- package/lib/lib/src/webhook/token.d.ts +2 -0
- package/lib/lib/src/webhook/token.js +23 -0
- package/lib/lib/test.d.ts +1 -0
- package/lib/lib/test.js +55 -0
- package/lib/lib/types.d.ts +1 -0
- package/lib/lib/types.js +2 -0
- package/lib/lib/userSdk/chat.d.ts +9 -0
- package/lib/lib/userSdk/chat.js +98 -0
- package/lib/lib/userSdk/index.d.ts +240 -0
- package/lib/lib/userSdk/index.js +27 -0
- package/lib/lib/userSdk/patients.d.ts +13 -0
- package/lib/lib/userSdk/patients.js +55 -0
- package/lib/lib/userSdk/schedule.d.ts +15 -0
- package/lib/lib/userSdk/schedule.js +76 -0
- package/lib/lib/userSdk/specialties.d.ts +4 -0
- package/lib/lib/userSdk/specialties.js +19 -0
- package/lib/lib/userSdk/videoVisit.d.ts +72 -0
- package/lib/lib/userSdk/videoVisit.js +147 -0
- package/lib/lib/utils.d.ts +4 -0
- package/lib/lib/utils.js +19 -0
- package/lib/lib/webhook/index.d.ts +8 -0
- package/lib/lib/webhook/index.js +55 -0
- package/lib/lib/webhook/responses.d.ts +36 -0
- package/lib/lib/webhook/responses.js +42 -0
- package/lib/lib/webhook/token.d.ts +2 -0
- package/lib/lib/webhook/token.js +23 -0
- package/lib/schemas.d.ts +30 -220
- package/lib/schemas.js +2 -33
- package/lib/src/baseSdk/diagnostica.d.ts +54 -0
- package/lib/src/baseSdk/diagnostica.js +79 -0
- package/lib/src/baseSdk/index.d.ts +2 -0
- package/lib/src/baseSdk/index.js +66 -0
- package/lib/src/baseSdk/user.d.ts +89 -0
- package/lib/src/baseSdk/user.js +130 -0
- package/lib/src/index.d.ts +188 -0
- package/lib/src/index.js +22 -0
- package/lib/src/request/index.d.ts +3 -0
- package/lib/src/request/index.js +26 -0
- package/lib/src/request/token.d.ts +2 -0
- package/lib/src/request/token.js +34 -0
- package/lib/src/request/validation.d.ts +10 -0
- package/lib/src/request/validation.js +28 -0
- package/lib/src/schemas.d.ts +1311 -0
- package/lib/src/schemas.js +325 -0
- package/lib/src/types.d.ts +124 -0
- package/lib/src/types.js +2 -0
- package/lib/src/userSdk/chat.d.ts +57 -0
- package/lib/src/userSdk/chat.js +98 -0
- package/lib/src/userSdk/index.d.ts +2 -0
- package/lib/src/userSdk/index.js +27 -0
- package/lib/src/userSdk/patients.d.ts +33 -0
- package/lib/src/userSdk/patients.js +55 -0
- package/lib/src/userSdk/schedule.d.ts +44 -0
- package/lib/src/userSdk/schedule.js +76 -0
- package/lib/src/userSdk/specialties.d.ts +7 -0
- package/lib/src/userSdk/specialties.js +19 -0
- package/lib/src/userSdk/videoVisit.d.ts +111 -0
- package/lib/src/userSdk/videoVisit.js +147 -0
- package/lib/src/utils.d.ts +4 -0
- package/lib/src/utils.js +19 -0
- package/lib/src/webhook/index.d.ts +2 -0
- package/lib/src/webhook/index.js +55 -0
- package/lib/src/webhook/responses.d.ts +35 -0
- package/lib/src/webhook/responses.js +42 -0
- package/lib/src/webhook/token.d.ts +2 -0
- package/lib/src/webhook/token.js +23 -0
- package/lib/test.js +1 -36
- package/lib/types.d.ts +2 -10
- package/lib/userSdk/chat.d.ts +1 -1
- package/lib/userSdk/patients.d.ts +2 -22
- 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
package/lib/test.js
CHANGED
|
@@ -10,43 +10,8 @@ const test = async () => {
|
|
|
10
10
|
key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
|
-
const
|
|
14
|
-
let res = await userSdk.declarePatient({
|
|
15
|
-
patient: {
|
|
16
|
-
firstName: 'Rafael Elias',
|
|
17
|
-
lastName: 'Mian',
|
|
18
|
-
identificationType: 'ndi',
|
|
19
|
-
identificationValue: '37970350',
|
|
20
|
-
countryId: 'AR',
|
|
21
|
-
birthdate: new Date('1996-07-03'),
|
|
22
|
-
gender: 'm',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
// let res = await baseSdk.declareUser({
|
|
26
|
-
// user: {
|
|
27
|
-
// firstName: 'Rafael Elias',
|
|
28
|
-
// lastName: 'Mian',
|
|
29
|
-
// identificationType: 'ndi',
|
|
30
|
-
// identificationValue: '37970350',
|
|
31
|
-
// countryId: 'AR',
|
|
32
|
-
// birthdate: new Date('1996-07-03'),
|
|
33
|
-
// gender: 'm',
|
|
34
|
-
// email: 'rafaelmian35@gmail.com',
|
|
35
|
-
// phone: '+5493764203061',
|
|
36
|
-
// },
|
|
37
|
-
// // channel: '1',
|
|
38
|
-
// // code: '370356',
|
|
39
|
-
// });
|
|
13
|
+
const res = await baseSdk.getAvailableScheduleClinics();
|
|
40
14
|
console.log(res);
|
|
41
|
-
// await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
42
|
-
// if (!res.ask_code) return res.userId;
|
|
43
|
-
// await baseSdk.sendVerificationCode({
|
|
44
|
-
// identificationType: 'ndi',
|
|
45
|
-
// identificationValue: '37970350',
|
|
46
|
-
// channel: '1',
|
|
47
|
-
// });
|
|
48
|
-
// console.log(res);
|
|
49
|
-
return;
|
|
50
15
|
}
|
|
51
16
|
catch (e) {
|
|
52
17
|
console.log(e);
|
package/lib/types.d.ts
CHANGED
|
@@ -30,27 +30,19 @@ export declare namespace Doc24 {
|
|
|
30
30
|
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
31
31
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
32
32
|
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
33
|
-
type SendVerificationCodeParams = TypeOf<typeof doc24Schemas.sendVerificationCodeParams>;
|
|
34
|
-
type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
|
|
35
|
-
type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
|
|
36
|
-
type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
|
|
37
|
-
type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
|
|
38
33
|
type BaseSdk = {
|
|
39
|
-
declareUser: (
|
|
40
|
-
getUserId: (user: User) => Promise<number>;
|
|
34
|
+
declareUser: (user: User) => Promise<number>;
|
|
41
35
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
42
36
|
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
43
37
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
44
38
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
45
39
|
getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
46
|
-
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<any>;
|
|
47
40
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
48
41
|
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
49
42
|
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
50
43
|
};
|
|
51
44
|
type UserSdk = {
|
|
52
|
-
declarePatient: (
|
|
53
|
-
getPatientId: (patient: Patient) => Promise<number>;
|
|
45
|
+
declarePatient: (patient: Patient) => Promise<number>;
|
|
54
46
|
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
55
47
|
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
56
48
|
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
package/lib/userSdk/chat.d.ts
CHANGED
|
@@ -24,9 +24,9 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
|
|
|
24
24
|
getPatientChats: (patientId: number) => Promise<{
|
|
25
25
|
id: number;
|
|
26
26
|
patient: {
|
|
27
|
+
id: number;
|
|
27
28
|
firstName: string;
|
|
28
29
|
lastName: string;
|
|
29
|
-
id: number;
|
|
30
30
|
};
|
|
31
31
|
professional: {
|
|
32
32
|
id: number;
|
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
import { RequestMaker } from '../request';
|
|
2
2
|
export declare const getPatientMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
declarePatient: (
|
|
4
|
-
code?: string | undefined;
|
|
5
|
-
channel?: "1" | "2" | undefined;
|
|
6
|
-
patient: {
|
|
7
|
-
firstName: string;
|
|
8
|
-
lastName: string;
|
|
9
|
-
identificationType: "ndi" | "passport" | "credential";
|
|
10
|
-
identificationValue: string;
|
|
11
|
-
countryId: string;
|
|
12
|
-
birthdate: Date;
|
|
13
|
-
gender: "m" | "f";
|
|
14
|
-
};
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
patientId: number | null;
|
|
17
|
-
userInfo: {
|
|
18
|
-
phone: string;
|
|
19
|
-
email: string;
|
|
20
|
-
};
|
|
21
|
-
askCode: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
getPatientId: (patient: {
|
|
3
|
+
declarePatient: (patient: {
|
|
24
4
|
firstName: string;
|
|
25
5
|
lastName: string;
|
|
26
6
|
identificationType: "ndi" | "passport" | "credential";
|
|
27
7
|
identificationValue: string;
|
|
8
|
+
gender: "m" | "f";
|
|
28
9
|
countryId: string;
|
|
29
10
|
birthdate: Date;
|
|
30
|
-
gender: "m" | "f";
|
|
31
11
|
}) => Promise<number>;
|
|
32
12
|
};
|
package/lib/userSdk/patients.js
CHANGED
|
@@ -7,49 +7,21 @@ const validation_1 = require("../request/validation");
|
|
|
7
7
|
const schemas_1 = require("../schemas");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const getPatientMethods = (makeRequest) => {
|
|
10
|
-
const declarePatient =
|
|
11
|
-
const path = '/patient';
|
|
10
|
+
const declarePatient = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), async (patient) => {
|
|
12
11
|
const mappedPatient = {
|
|
13
12
|
lastname: patient.lastName,
|
|
14
13
|
firstname: patient.firstName,
|
|
15
|
-
identification_type: utils_1.
|
|
14
|
+
identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
|
|
16
15
|
identification_value: patient.identificationValue,
|
|
17
16
|
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
18
17
|
gender: patient.gender.toUpperCase(),
|
|
19
18
|
country_id: patient.countryId,
|
|
20
19
|
};
|
|
21
|
-
const
|
|
22
|
-
const response = await makeRequest('POST', path, {
|
|
20
|
+
const response = await makeRequest('POST', '/patient', {
|
|
23
21
|
user_data: mappedPatient,
|
|
24
|
-
channel: parsedChannel,
|
|
25
|
-
code,
|
|
26
22
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
askCode: response.data.ask_code,
|
|
31
|
-
};
|
|
32
|
-
return mappedResponse;
|
|
33
|
-
};
|
|
34
|
-
const getPatientId = async (patient) => {
|
|
35
|
-
const path = '/patient';
|
|
36
|
-
const mappedPatient = {
|
|
37
|
-
lastname: patient.lastName,
|
|
38
|
-
firstname: patient.firstName,
|
|
39
|
-
identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
|
|
40
|
-
identification_value: patient.identificationValue,
|
|
41
|
-
birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
|
|
42
|
-
gender: patient.gender.toUpperCase(),
|
|
43
|
-
country_id: patient.countryId,
|
|
44
|
-
};
|
|
45
|
-
const response = await makeRequest('POST', path, {
|
|
46
|
-
user_data: mappedPatient,
|
|
47
|
-
});
|
|
48
|
-
return response.data.user_id;
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
52
|
-
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
53
|
-
};
|
|
23
|
+
return response.data.patient_id;
|
|
24
|
+
});
|
|
25
|
+
return { declarePatient };
|
|
54
26
|
};
|
|
55
27
|
exports.getPatientMethods = getPatientMethods;
|
|
@@ -32,9 +32,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
32
32
|
patientId: number;
|
|
33
33
|
creationDate: Date;
|
|
34
34
|
user: {
|
|
35
|
+
id: number;
|
|
35
36
|
phone: string | null;
|
|
36
37
|
email: string | null;
|
|
37
|
-
id: number;
|
|
38
38
|
};
|
|
39
39
|
vcToken: string;
|
|
40
40
|
}>;
|
|
@@ -53,9 +53,9 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
53
53
|
patientId: number;
|
|
54
54
|
creationDate: Date;
|
|
55
55
|
user: {
|
|
56
|
+
id: number;
|
|
56
57
|
phone: string | null;
|
|
57
58
|
email: string | null;
|
|
58
|
-
id: number;
|
|
59
59
|
};
|
|
60
60
|
vcToken: string;
|
|
61
61
|
}[]>;
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Doc24 } from '.';
|
|
2
2
|
export declare const parseDate: (str: string) => Date;
|
|
3
3
|
export declare const parseDateTime: (str: string) => Date;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
|
package/lib/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getIndetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
const timeZone = '-03';
|
|
6
6
|
const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`);
|
|
7
7
|
exports.parseDate = parseDate;
|
|
8
8
|
const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
9
|
exports.parseDateTime = parseDateTime;
|
|
10
|
-
const
|
|
10
|
+
const getIndetificationTypeId = (type) => {
|
|
11
11
|
if (type === 'ndi')
|
|
12
12
|
return 6;
|
|
13
13
|
if (type === 'passport')
|
|
@@ -16,4 +16,4 @@ const getIdetificationTypeId = (type) => {
|
|
|
16
16
|
return 999;
|
|
17
17
|
throw new Error('Invalid identificationType');
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
19
|
+
exports.getIndetificationTypeId = getIndetificationTypeId;
|