@integraciones_doc24/sdk 1.16.2 → 1.16.5
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
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
scheduleVideoVisit: (params: {
|
|
4
|
-
extraInfo?: any;
|
|
5
|
-
type: "appointment";
|
|
6
|
-
patientId: number;
|
|
7
|
-
specialtyId: number;
|
|
8
|
-
language: string;
|
|
9
|
-
details: string;
|
|
10
|
-
appointmentId: string | number;
|
|
11
|
-
} | {
|
|
12
|
-
extraInfo?: any;
|
|
13
|
-
type: "instant";
|
|
14
|
-
patientId: number;
|
|
15
|
-
specialtyId: number;
|
|
16
|
-
language: string;
|
|
17
|
-
details: string;
|
|
18
|
-
}) => Promise<string>;
|
|
19
|
-
cancelVideoVisit: (vcToken: string) => Promise<void>;
|
|
20
|
-
getVideoVisit: (vcToken: string, patientId: number) => Promise<{
|
|
21
|
-
appointment?: {
|
|
22
|
-
date: Date;
|
|
23
|
-
id: number;
|
|
24
|
-
} | undefined;
|
|
25
|
-
videoVisit?: {
|
|
26
|
-
id: number;
|
|
27
|
-
status: string;
|
|
28
|
-
} | undefined;
|
|
29
|
-
paymentStatus?: string | undefined;
|
|
30
|
-
atentionId?: number | undefined;
|
|
31
|
-
waitingTime?: string | undefined;
|
|
32
|
-
id: number | null;
|
|
33
|
-
patientId: number;
|
|
34
|
-
creationDate: Date;
|
|
35
|
-
user: {
|
|
36
|
-
phone: string | null;
|
|
37
|
-
email: string | null;
|
|
38
|
-
id: number;
|
|
39
|
-
};
|
|
40
|
-
vcToken: string;
|
|
41
|
-
}>;
|
|
42
|
-
getPatientVideoVisitHistory: (patientId: number) => Promise<{
|
|
43
|
-
appointment?: {
|
|
44
|
-
date: Date;
|
|
45
|
-
id: number;
|
|
46
|
-
} | undefined;
|
|
47
|
-
videoVisit?: {
|
|
48
|
-
id: number;
|
|
49
|
-
status: string;
|
|
50
|
-
} | undefined;
|
|
51
|
-
paymentStatus?: string | undefined;
|
|
52
|
-
atentionId?: number | undefined;
|
|
53
|
-
waitingTime?: string | undefined;
|
|
54
|
-
id: number | null;
|
|
55
|
-
patientId: number;
|
|
56
|
-
professional: string;
|
|
57
|
-
creationDate: Date;
|
|
58
|
-
user: {
|
|
59
|
-
phone: string | null;
|
|
60
|
-
email: string | null;
|
|
61
|
-
id: number;
|
|
62
|
-
};
|
|
63
|
-
vcToken: string;
|
|
64
|
-
specialty: string;
|
|
65
|
-
}[]>;
|
|
66
|
-
getVideoVisitDetails: (vcId: number) => Promise<{
|
|
67
|
-
professional?: {
|
|
68
|
-
id: number;
|
|
69
|
-
fullName: string;
|
|
70
|
-
} | undefined;
|
|
71
|
-
appointment: {
|
|
72
|
-
date: Date;
|
|
73
|
-
id: number;
|
|
74
|
-
} | null;
|
|
75
|
-
id: number;
|
|
76
|
-
language: string;
|
|
77
|
-
patient: {
|
|
78
|
-
fullName: string;
|
|
79
|
-
firstAccessDate: Date;
|
|
80
|
-
lastAccessDate: Date;
|
|
81
|
-
};
|
|
82
|
-
status: string;
|
|
83
|
-
paymentStatus: string;
|
|
84
|
-
finishDate: Date | null;
|
|
85
|
-
retries: number;
|
|
86
|
-
report: {
|
|
87
|
-
motive: string | null;
|
|
88
|
-
actualDesease: string | null;
|
|
89
|
-
indications: string | null;
|
|
90
|
-
alertSigns: string | null;
|
|
91
|
-
extendedMotive: string | null;
|
|
92
|
-
diagnose: {
|
|
93
|
-
code: string;
|
|
94
|
-
description: string;
|
|
95
|
-
}[];
|
|
96
|
-
};
|
|
97
|
-
pdf: {
|
|
98
|
-
atention?: string | undefined;
|
|
99
|
-
labs?: string | undefined;
|
|
100
|
-
otherExams?: string | undefined;
|
|
101
|
-
images?: string | undefined;
|
|
102
|
-
medication: any[];
|
|
103
|
-
};
|
|
104
|
-
files: {
|
|
105
|
-
name: string;
|
|
106
|
-
url: string;
|
|
107
|
-
}[];
|
|
108
|
-
}>;
|
|
109
|
-
getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
|
|
110
|
-
getActiveVideoVisits: () => Promise<{
|
|
111
|
-
patientId: number;
|
|
112
|
-
vcToken: string;
|
|
113
|
-
consultationId: number;
|
|
114
|
-
}[]>;
|
|
115
|
-
};
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
scheduleVideoVisit: (params: {
|
|
4
|
+
extraInfo?: any;
|
|
5
|
+
type: "appointment";
|
|
6
|
+
patientId: number;
|
|
7
|
+
specialtyId: number;
|
|
8
|
+
language: string;
|
|
9
|
+
details: string;
|
|
10
|
+
appointmentId: string | number;
|
|
11
|
+
} | {
|
|
12
|
+
extraInfo?: any;
|
|
13
|
+
type: "instant";
|
|
14
|
+
patientId: number;
|
|
15
|
+
specialtyId: number;
|
|
16
|
+
language: string;
|
|
17
|
+
details: string;
|
|
18
|
+
}) => Promise<string>;
|
|
19
|
+
cancelVideoVisit: (vcToken: string) => Promise<void>;
|
|
20
|
+
getVideoVisit: (vcToken: string, patientId: number) => Promise<{
|
|
21
|
+
appointment?: {
|
|
22
|
+
date: Date;
|
|
23
|
+
id: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
videoVisit?: {
|
|
26
|
+
id: number;
|
|
27
|
+
status: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
paymentStatus?: string | undefined;
|
|
30
|
+
atentionId?: number | undefined;
|
|
31
|
+
waitingTime?: string | undefined;
|
|
32
|
+
id: number | null;
|
|
33
|
+
patientId: number;
|
|
34
|
+
creationDate: Date;
|
|
35
|
+
user: {
|
|
36
|
+
phone: string | null;
|
|
37
|
+
email: string | null;
|
|
38
|
+
id: number;
|
|
39
|
+
};
|
|
40
|
+
vcToken: string;
|
|
41
|
+
}>;
|
|
42
|
+
getPatientVideoVisitHistory: (patientId: number) => Promise<{
|
|
43
|
+
appointment?: {
|
|
44
|
+
date: Date;
|
|
45
|
+
id: number;
|
|
46
|
+
} | undefined;
|
|
47
|
+
videoVisit?: {
|
|
48
|
+
id: number;
|
|
49
|
+
status: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
paymentStatus?: string | undefined;
|
|
52
|
+
atentionId?: number | undefined;
|
|
53
|
+
waitingTime?: string | undefined;
|
|
54
|
+
id: number | null;
|
|
55
|
+
patientId: number;
|
|
56
|
+
professional: string;
|
|
57
|
+
creationDate: Date;
|
|
58
|
+
user: {
|
|
59
|
+
phone: string | null;
|
|
60
|
+
email: string | null;
|
|
61
|
+
id: number;
|
|
62
|
+
};
|
|
63
|
+
vcToken: string;
|
|
64
|
+
specialty: string;
|
|
65
|
+
}[]>;
|
|
66
|
+
getVideoVisitDetails: (vcId: number) => Promise<{
|
|
67
|
+
professional?: {
|
|
68
|
+
id: number;
|
|
69
|
+
fullName: string;
|
|
70
|
+
} | undefined;
|
|
71
|
+
appointment: {
|
|
72
|
+
date: Date;
|
|
73
|
+
id: number;
|
|
74
|
+
} | null;
|
|
75
|
+
id: number;
|
|
76
|
+
language: string;
|
|
77
|
+
patient: {
|
|
78
|
+
fullName: string;
|
|
79
|
+
firstAccessDate: Date;
|
|
80
|
+
lastAccessDate: Date;
|
|
81
|
+
};
|
|
82
|
+
status: string;
|
|
83
|
+
paymentStatus: string;
|
|
84
|
+
finishDate: Date | null;
|
|
85
|
+
retries: number;
|
|
86
|
+
report: {
|
|
87
|
+
motive: string | null;
|
|
88
|
+
actualDesease: string | null;
|
|
89
|
+
indications: string | null;
|
|
90
|
+
alertSigns: string | null;
|
|
91
|
+
extendedMotive: string | null;
|
|
92
|
+
diagnose: {
|
|
93
|
+
code: string;
|
|
94
|
+
description: string;
|
|
95
|
+
}[];
|
|
96
|
+
};
|
|
97
|
+
pdf: {
|
|
98
|
+
atention?: string | undefined;
|
|
99
|
+
labs?: string | undefined;
|
|
100
|
+
otherExams?: string | undefined;
|
|
101
|
+
images?: string | undefined;
|
|
102
|
+
medication: any[];
|
|
103
|
+
};
|
|
104
|
+
files: {
|
|
105
|
+
name: string;
|
|
106
|
+
url: string;
|
|
107
|
+
}[];
|
|
108
|
+
}>;
|
|
109
|
+
getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
|
|
110
|
+
getActiveVideoVisits: () => Promise<{
|
|
111
|
+
patientId: number;
|
|
112
|
+
vcToken: string;
|
|
113
|
+
consultationId: number;
|
|
114
|
+
}[]>;
|
|
115
|
+
};
|
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVideoVisitMethods = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const validation_1 = require("../request/validation");
|
|
6
|
-
const schemas_1 = require("../schemas");
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const getVideoVisitMethods = (makeRequest) => {
|
|
9
|
-
const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
|
|
10
|
-
const specificParams = params.type === 'appointment'
|
|
11
|
-
? {
|
|
12
|
-
type: 'P',
|
|
13
|
-
appointment_id: params.appointmentId,
|
|
14
|
-
}
|
|
15
|
-
: { type: 'E' };
|
|
16
|
-
const mappedParams = {
|
|
17
|
-
...specificParams,
|
|
18
|
-
patient_id: params.patientId,
|
|
19
|
-
specialty_id: params.specialtyId,
|
|
20
|
-
language: params.language.toUpperCase(),
|
|
21
|
-
details: params.details,
|
|
22
|
-
extra_info: params.extraInfo,
|
|
23
|
-
};
|
|
24
|
-
const response = await makeRequest('POST', '/video-visit', mappedParams);
|
|
25
|
-
return response.data.vc_token;
|
|
26
|
-
});
|
|
27
|
-
const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
|
|
28
|
-
const path = `/video-visit/${vcToken}`;
|
|
29
|
-
await makeRequest('DELETE', path);
|
|
30
|
-
});
|
|
31
|
-
const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
|
|
32
|
-
const path = `/video-visit/${vcToken}/${patientId}`;
|
|
33
|
-
const response = await makeRequest('GET', path);
|
|
34
|
-
return mapVideoVisit(response.data);
|
|
35
|
-
});
|
|
36
|
-
const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
|
|
37
|
-
const path = `/video-visit-history/${patientId}`;
|
|
38
|
-
const response = await makeRequest('GET', path);
|
|
39
|
-
return response.data.map((raw) => mapHistoricalVideoVisit(raw));
|
|
40
|
-
});
|
|
41
|
-
const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
|
|
42
|
-
const path = `/video-visit-records/${vcId}`;
|
|
43
|
-
const response = await makeRequest('GET', path);
|
|
44
|
-
return {
|
|
45
|
-
id: response.data.consultation_id,
|
|
46
|
-
status: response.data.status,
|
|
47
|
-
paymentStatus: response.data.payment_status,
|
|
48
|
-
professional: response.data.professional_id
|
|
49
|
-
? {
|
|
50
|
-
id: response.data.professional_id,
|
|
51
|
-
fullName: response.data.professional,
|
|
52
|
-
}
|
|
53
|
-
: undefined,
|
|
54
|
-
patient: {
|
|
55
|
-
fullName: response.data.patient,
|
|
56
|
-
firstAccessDate: response.data.patient_first_access_date &&
|
|
57
|
-
utils_1.parseDateTime(response.data.patient_first_access_date),
|
|
58
|
-
lastAccessDate: response.data.patient_last_access_date &&
|
|
59
|
-
utils_1.parseDateTime(response.data.patient_last_access_date),
|
|
60
|
-
},
|
|
61
|
-
finishDate: response.data.finish_date &&
|
|
62
|
-
utils_1.parseDateTime(response.data.finish_date),
|
|
63
|
-
retries: response.data.retries,
|
|
64
|
-
language: response.data.language,
|
|
65
|
-
appointment: response.data.appointment_id
|
|
66
|
-
? {
|
|
67
|
-
id: response.data.appointment_id,
|
|
68
|
-
date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
|
|
69
|
-
}
|
|
70
|
-
: null,
|
|
71
|
-
report: {
|
|
72
|
-
motive: response.data.motive,
|
|
73
|
-
actualDesease: response.data.actual_desease,
|
|
74
|
-
indications: response.data.indications,
|
|
75
|
-
alertSigns: response.data.alert_signs,
|
|
76
|
-
extendedMotive: response.data.extended_motive,
|
|
77
|
-
diagnose: response.data.diagnose.map((d) => ({
|
|
78
|
-
description: d.diagnostico,
|
|
79
|
-
code: d.codificacion,
|
|
80
|
-
})),
|
|
81
|
-
},
|
|
82
|
-
pdf: {
|
|
83
|
-
atention: response.data.pdf_atention
|
|
84
|
-
? response.data.pdf_atention
|
|
85
|
-
: undefined,
|
|
86
|
-
medication: response.data.pdf_medication,
|
|
87
|
-
images: response.data.pdf_images
|
|
88
|
-
? response.data.pdf_images
|
|
89
|
-
: undefined,
|
|
90
|
-
otherExams: response.data.pdf_other_exams
|
|
91
|
-
? response.data.pdf_other_exams
|
|
92
|
-
: undefined,
|
|
93
|
-
labs: response.data.pdf_labs ? response.data.pdf_labs : undefined,
|
|
94
|
-
},
|
|
95
|
-
files: response.data.files.map((f) => ({
|
|
96
|
-
name: f.nombre_file,
|
|
97
|
-
url: f.file,
|
|
98
|
-
})),
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
|
|
102
|
-
const path = '/active-video-visits';
|
|
103
|
-
const response = await makeRequest('GET', path);
|
|
104
|
-
const consultations = response.data['active-consultations'];
|
|
105
|
-
return consultations.map((s) => ({
|
|
106
|
-
patientId: s.patient_id,
|
|
107
|
-
consultationId: s.consultation_id,
|
|
108
|
-
vcToken: s.vc_token,
|
|
109
|
-
}));
|
|
110
|
-
});
|
|
111
|
-
const getVideoVisitLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), zod_1.string().nullable(), async (vcToken, patientId) => {
|
|
112
|
-
const path = `/video-visit-link/${vcToken}/${patientId}`;
|
|
113
|
-
const response = await makeRequest('GET', path);
|
|
114
|
-
return response.data.link;
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
scheduleVideoVisit,
|
|
118
|
-
cancelVideoVisit,
|
|
119
|
-
getVideoVisit,
|
|
120
|
-
getPatientVideoVisitHistory,
|
|
121
|
-
getVideoVisitDetails,
|
|
122
|
-
getVideoVisitLink,
|
|
123
|
-
getActiveVideoVisits,
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
exports.getVideoVisitMethods = getVideoVisitMethods;
|
|
127
|
-
const mapVideoVisit = (raw) => {
|
|
128
|
-
var _a, _b, _c;
|
|
129
|
-
return {
|
|
130
|
-
id: raw.vc_id,
|
|
131
|
-
creationDate: utils_1.parseDateTime(raw.creation_date),
|
|
132
|
-
patientId: raw.patient_id,
|
|
133
|
-
user: { id: raw.user_id, email: raw.email, phone: raw.phone },
|
|
134
|
-
vcToken: raw.vc_token,
|
|
135
|
-
appointment: raw.appointment_id
|
|
136
|
-
? {
|
|
137
|
-
id: raw.appointment_id,
|
|
138
|
-
date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
|
|
139
|
-
}
|
|
140
|
-
: undefined,
|
|
141
|
-
videoVisit: raw.video_visit_id
|
|
142
|
-
? { id: raw.video_visit_id, status: raw.video_visit_status }
|
|
143
|
-
: undefined,
|
|
144
|
-
paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
|
|
145
|
-
atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
|
|
146
|
-
waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
const mapHistoricalVideoVisit = (raw) => {
|
|
150
|
-
return {
|
|
151
|
-
...mapVideoVisit(raw),
|
|
152
|
-
professional: raw.professional,
|
|
153
|
-
specialty: raw.specialty,
|
|
154
|
-
};
|
|
155
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVideoVisitMethods = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const validation_1 = require("../request/validation");
|
|
6
|
+
const schemas_1 = require("../schemas");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const getVideoVisitMethods = (makeRequest) => {
|
|
9
|
+
const scheduleVideoVisit = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.scheduleParameters]), zod_1.string(), async (params) => {
|
|
10
|
+
const specificParams = params.type === 'appointment'
|
|
11
|
+
? {
|
|
12
|
+
type: 'P',
|
|
13
|
+
appointment_id: params.appointmentId,
|
|
14
|
+
}
|
|
15
|
+
: { type: 'E' };
|
|
16
|
+
const mappedParams = {
|
|
17
|
+
...specificParams,
|
|
18
|
+
patient_id: params.patientId,
|
|
19
|
+
specialty_id: params.specialtyId,
|
|
20
|
+
language: params.language.toUpperCase(),
|
|
21
|
+
details: params.details,
|
|
22
|
+
extra_info: params.extraInfo,
|
|
23
|
+
};
|
|
24
|
+
const response = await makeRequest('POST', '/video-visit', mappedParams);
|
|
25
|
+
return response.data.vc_token;
|
|
26
|
+
});
|
|
27
|
+
const cancelVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), zod_1.undefined(), async (vcToken) => {
|
|
28
|
+
const path = `/video-visit/${vcToken}`;
|
|
29
|
+
await makeRequest('DELETE', path);
|
|
30
|
+
});
|
|
31
|
+
const getVideoVisit = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), schemas_1.doc24Schemas.videoVisit, async (vcToken, patientId) => {
|
|
32
|
+
const path = `/video-visit/${vcToken}/${patientId}`;
|
|
33
|
+
const response = await makeRequest('GET', path);
|
|
34
|
+
return mapVideoVisit(response.data);
|
|
35
|
+
});
|
|
36
|
+
const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
|
|
37
|
+
const path = `/video-visit-history/${patientId}`;
|
|
38
|
+
const response = await makeRequest('GET', path);
|
|
39
|
+
return response.data.map((raw) => mapHistoricalVideoVisit(raw));
|
|
40
|
+
});
|
|
41
|
+
const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
|
|
42
|
+
const path = `/video-visit-records/${vcId}`;
|
|
43
|
+
const response = await makeRequest('GET', path);
|
|
44
|
+
return {
|
|
45
|
+
id: response.data.consultation_id,
|
|
46
|
+
status: response.data.status,
|
|
47
|
+
paymentStatus: response.data.payment_status,
|
|
48
|
+
professional: response.data.professional_id
|
|
49
|
+
? {
|
|
50
|
+
id: response.data.professional_id,
|
|
51
|
+
fullName: response.data.professional,
|
|
52
|
+
}
|
|
53
|
+
: undefined,
|
|
54
|
+
patient: {
|
|
55
|
+
fullName: response.data.patient,
|
|
56
|
+
firstAccessDate: response.data.patient_first_access_date &&
|
|
57
|
+
utils_1.parseDateTime(response.data.patient_first_access_date),
|
|
58
|
+
lastAccessDate: response.data.patient_last_access_date &&
|
|
59
|
+
utils_1.parseDateTime(response.data.patient_last_access_date),
|
|
60
|
+
},
|
|
61
|
+
finishDate: response.data.finish_date &&
|
|
62
|
+
utils_1.parseDateTime(response.data.finish_date),
|
|
63
|
+
retries: response.data.retries,
|
|
64
|
+
language: response.data.language,
|
|
65
|
+
appointment: response.data.appointment_id
|
|
66
|
+
? {
|
|
67
|
+
id: response.data.appointment_id,
|
|
68
|
+
date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
|
|
69
|
+
}
|
|
70
|
+
: null,
|
|
71
|
+
report: {
|
|
72
|
+
motive: response.data.motive,
|
|
73
|
+
actualDesease: response.data.actual_desease,
|
|
74
|
+
indications: response.data.indications,
|
|
75
|
+
alertSigns: response.data.alert_signs,
|
|
76
|
+
extendedMotive: response.data.extended_motive,
|
|
77
|
+
diagnose: response.data.diagnose.map((d) => ({
|
|
78
|
+
description: d.diagnostico,
|
|
79
|
+
code: d.codificacion,
|
|
80
|
+
})),
|
|
81
|
+
},
|
|
82
|
+
pdf: {
|
|
83
|
+
atention: response.data.pdf_atention
|
|
84
|
+
? response.data.pdf_atention
|
|
85
|
+
: undefined,
|
|
86
|
+
medication: response.data.pdf_medication,
|
|
87
|
+
images: response.data.pdf_images
|
|
88
|
+
? response.data.pdf_images
|
|
89
|
+
: undefined,
|
|
90
|
+
otherExams: response.data.pdf_other_exams
|
|
91
|
+
? response.data.pdf_other_exams
|
|
92
|
+
: undefined,
|
|
93
|
+
labs: response.data.pdf_labs ? response.data.pdf_labs : undefined,
|
|
94
|
+
},
|
|
95
|
+
files: response.data.files.map((f) => ({
|
|
96
|
+
name: f.nombre_file,
|
|
97
|
+
url: f.file,
|
|
98
|
+
})),
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
const getActiveVideoVisits = validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.activeVideoVisitData), async () => {
|
|
102
|
+
const path = '/active-video-visits';
|
|
103
|
+
const response = await makeRequest('GET', path);
|
|
104
|
+
const consultations = response.data['active-consultations'];
|
|
105
|
+
return consultations.map((s) => ({
|
|
106
|
+
patientId: s.patient_id,
|
|
107
|
+
consultationId: s.consultation_id,
|
|
108
|
+
vcToken: s.vc_token,
|
|
109
|
+
}));
|
|
110
|
+
});
|
|
111
|
+
const getVideoVisitLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.number()]), zod_1.string().nullable(), async (vcToken, patientId) => {
|
|
112
|
+
const path = `/video-visit-link/${vcToken}/${patientId}`;
|
|
113
|
+
const response = await makeRequest('GET', path);
|
|
114
|
+
return response.data.link;
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
scheduleVideoVisit,
|
|
118
|
+
cancelVideoVisit,
|
|
119
|
+
getVideoVisit,
|
|
120
|
+
getPatientVideoVisitHistory,
|
|
121
|
+
getVideoVisitDetails,
|
|
122
|
+
getVideoVisitLink,
|
|
123
|
+
getActiveVideoVisits,
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
exports.getVideoVisitMethods = getVideoVisitMethods;
|
|
127
|
+
const mapVideoVisit = (raw) => {
|
|
128
|
+
var _a, _b, _c;
|
|
129
|
+
return {
|
|
130
|
+
id: raw.vc_id,
|
|
131
|
+
creationDate: utils_1.parseDateTime(raw.creation_date),
|
|
132
|
+
patientId: raw.patient_id,
|
|
133
|
+
user: { id: raw.user_id, email: raw.email, phone: raw.phone },
|
|
134
|
+
vcToken: raw.vc_token,
|
|
135
|
+
appointment: raw.appointment_id
|
|
136
|
+
? {
|
|
137
|
+
id: raw.appointment_id,
|
|
138
|
+
date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
|
|
139
|
+
}
|
|
140
|
+
: undefined,
|
|
141
|
+
videoVisit: raw.video_visit_id
|
|
142
|
+
? { id: raw.video_visit_id, status: raw.video_visit_status }
|
|
143
|
+
: undefined,
|
|
144
|
+
paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
|
|
145
|
+
atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
|
|
146
|
+
waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
const mapHistoricalVideoVisit = (raw) => {
|
|
150
|
+
return {
|
|
151
|
+
...mapVideoVisit(raw),
|
|
152
|
+
professional: raw.professional,
|
|
153
|
+
specialty: raw.specialty,
|
|
154
|
+
};
|
|
155
|
+
};
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
|
|
2
|
-
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
1
|
+
export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
|
|
2
|
+
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
package/lib/utils.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDateTime = exports.parseDate = void 0;
|
|
4
|
-
const date_fns_1 = require("date-fns");
|
|
5
|
-
// import {Doc24} from '.';
|
|
6
|
-
const defaultTimeZone = '-03';
|
|
7
|
-
const parseDate = (str, timeZone) => exports.parseDateTime(`${str} 00:00:00`, timeZone);
|
|
8
|
-
exports.parseDate = parseDate;
|
|
9
|
-
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone !== null && timeZone !== void 0 ? timeZone : defaultTimeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
10
|
-
exports.parseDateTime = parseDateTime;
|
|
11
|
-
// export const getIdetificationTypeId = (type: Doc24.IdentificationType) => {
|
|
12
|
-
// if (type === 'ndi') return 6;
|
|
13
|
-
// if (type === 'passport') return 5;
|
|
14
|
-
// if (type === 'credential') return 999;
|
|
15
|
-
// throw new Error('Invalid identificationType');
|
|
16
|
-
// };
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDateTime = exports.parseDate = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
// import {Doc24} from '.';
|
|
6
|
+
const defaultTimeZone = '-03';
|
|
7
|
+
const parseDate = (str, timeZone) => exports.parseDateTime(`${str} 00:00:00`, timeZone);
|
|
8
|
+
exports.parseDate = parseDate;
|
|
9
|
+
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone !== null && timeZone !== void 0 ? timeZone : defaultTimeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
10
|
+
exports.parseDateTime = parseDateTime;
|
|
11
|
+
// export const getIdetificationTypeId = (type: Doc24.IdentificationType) => {
|
|
12
|
+
// if (type === 'ndi') return 6;
|
|
13
|
+
// if (type === 'passport') return 5;
|
|
14
|
+
// if (type === 'credential') return 999;
|
|
15
|
+
// throw new Error('Invalid identificationType');
|
|
16
|
+
// };
|
package/lib/webhook/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Doc24 } from '../types';
|
|
2
|
-
export declare const getRequestHandler: (credentials: Doc24.SdkCredentials, baseSdk: Doc24.BaseSdk, eventHandlers: Doc24.Webhook.Events) => Doc24.Webhook.Handler;
|
|
1
|
+
import { Doc24 } from '../types';
|
|
2
|
+
export declare const getRequestHandler: (credentials: Doc24.SdkCredentials, baseSdk: Doc24.BaseSdk, eventHandlers: Doc24.Webhook.Events) => Doc24.Webhook.Handler;
|