@integraciones_doc24/sdk 1.16.41 → 1.16.43
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 +246 -225
- 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 +80 -80
- package/lib/baseSdk/integrationError.d.ts +16 -16
- package/lib/baseSdk/integrationError.js +33 -33
- package/lib/baseSdk/user.d.ts +115 -115
- package/lib/baseSdk/user.js +136 -136
- package/lib/index.d.ts +416 -416
- 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 +2813 -2825
- package/lib/schemas.js +601 -604
- package/lib/types.d.ts +178 -178
- 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 +62 -62
- package/lib/userSdk/patients.js +93 -93
- package/lib/userSdk/schedule.d.ts +59 -59
- package/lib/userSdk/schedule.js +90 -90
- package/lib/userSdk/specialties.d.ts +19 -19
- package/lib/userSdk/specialties.js +48 -48
- package/lib/userSdk/videoVisit.d.ts +225 -229
- package/lib/userSdk/videoVisit.js +283 -288
- package/lib/utils.d.ts +4 -4
- package/lib/utils.js +68 -68
- 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/README.md
CHANGED
|
@@ -1,225 +1,246 @@
|
|
|
1
|
-
# @integraciones_doc24/sdk
|
|
2
|
-
|
|
3
|
-
Node.JS library for accessing doc24 api
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
`npm i @integraciones_doc24/sdk`
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import {doc24Sdk} from '@integraciones_doc24/sdk';
|
|
13
|
-
|
|
14
|
-
const getBaseSdk = () =>
|
|
15
|
-
doc24Sdk({
|
|
16
|
-
url: 'https://tapi.doc24.com.ar/ws/sdk',
|
|
17
|
-
credentials: {
|
|
18
|
-
iss: 'myissuer',
|
|
19
|
-
key: 'mysecret',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const getSpecialities = async (user) => {
|
|
24
|
-
const baseSdk = await getBaseSdk();
|
|
25
|
-
|
|
26
|
-
const userSdk = await baseSdk.getUserInstance(user);
|
|
27
|
-
|
|
28
|
-
return await userSdk.getSpecialties('instant', 'ES');
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const getRequestHandler = async () => {
|
|
32
|
-
const baseSdk = await getBaseSdk();
|
|
33
|
-
return baseSdk.getRequestHandler({
|
|
34
|
-
credentials: {
|
|
35
|
-
iss: 'doc24issuer',
|
|
36
|
-
key: 'doc24secret',
|
|
37
|
-
},
|
|
38
|
-
baseAddress: 'http://myaddress.com/route/to/webhook',
|
|
39
|
-
eventHandlers: {
|
|
40
|
-
onAppointmentStatusChange: ({id, status, changeDate}) => {
|
|
41
|
-
console.log({id, status, changeDate});
|
|
42
|
-
},
|
|
43
|
-
onConsultationStatusChange: ({
|
|
44
|
-
id,
|
|
45
|
-
invitationId,
|
|
46
|
-
status,
|
|
47
|
-
changeDate,
|
|
48
|
-
vcToken,
|
|
49
|
-
}) => {
|
|
50
|
-
console.log({id, invitationId, status, changeDate, vcToken});
|
|
51
|
-
},
|
|
52
|
-
onInvitationStatusChange: ({id, status, changeDate}) => {
|
|
53
|
-
console.log({id, status, changeDate});
|
|
54
|
-
},
|
|
55
|
-
onChatUpdate: ({id, status, patientId, professionalId, date}) => {
|
|
56
|
-
console.log({id, status, patientId, professionalId, date});
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The library exports the function `doc24Sdk`. It takes one parameters of type `SdkParams`, and returns a `BaseSdk`.
|
|
64
|
-
It also returns an extra `getRequestHandler` function that takes a `RequestHandlerParams`
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
type SdkCredentials = {
|
|
68
|
-
iss: string;
|
|
69
|
-
key: string;
|
|
70
|
-
};
|
|
71
|
-
type SdkParams = {
|
|
72
|
-
url: string;
|
|
73
|
-
credentials: SdkCredentials;
|
|
74
|
-
};
|
|
75
|
-
export type BaseSdk = {
|
|
76
|
-
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
77
|
-
getUserId: (user: User) => Promise<number>;
|
|
78
|
-
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
79
|
-
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
80
|
-
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
81
|
-
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
82
|
-
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
83
|
-
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
84
|
-
getDiagnosticaHistory: (
|
|
85
|
-
patient: DiagnosticaPatientFilter,
|
|
86
|
-
from: Date,
|
|
87
|
-
to: Date,
|
|
88
|
-
) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
89
|
-
getDiagnosticaDeepLink: (
|
|
90
|
-
kiosk: string,
|
|
91
|
-
user: DiagnosticaUser,
|
|
92
|
-
patient: DiagnosticaPatient,
|
|
93
|
-
) => Promise<DiagnosticaDeepLinkResponse>;
|
|
94
|
-
getDiagnosticaAccess: (
|
|
95
|
-
kiosk: string,
|
|
96
|
-
user: DiagnosticaUser,
|
|
97
|
-
patient: DiagnosticaPatient,
|
|
98
|
-
) => Promise<void>;
|
|
99
|
-
externalLogin: (
|
|
100
|
-
params: ExternalLoginParams,
|
|
101
|
-
) => Promise<ExternalLoginResponse>;
|
|
102
|
-
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
103
|
-
externalEnrollment: (
|
|
104
|
-
params: ExternalEnrollmentParams,
|
|
105
|
-
) => Promise<ExternalLoginResponse>;
|
|
106
|
-
sendExternalVerificationCode: (
|
|
107
|
-
params: SendExternalVerificationCodeParams,
|
|
108
|
-
) => Promise<void>;
|
|
109
|
-
verifyExternalVerificationCode: (
|
|
110
|
-
params: VerifyExternalVerificationCodeParams,
|
|
111
|
-
) => Promise<any>;
|
|
112
|
-
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
113
|
-
getExternalStudiesHistoryLink: (
|
|
114
|
-
patient: ExternalPatient,
|
|
115
|
-
) => Promise<string | null>;
|
|
116
|
-
getExternalAppointmentsLink: (
|
|
117
|
-
identificationValue: string,
|
|
118
|
-
birthdate: Date,
|
|
119
|
-
) => Promise<string | null>;
|
|
120
|
-
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
121
|
-
cancelExternalAppointment: (
|
|
122
|
-
appointmentId: ExternalAppointment,
|
|
123
|
-
) => Promise<void>;
|
|
124
|
-
reportIntegrationError: (
|
|
125
|
-
params: ReportIntegrationErrorParams,
|
|
126
|
-
) => Promise<ReportIntegrationErrorResponse>;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
type ReportIntegrationErrorParams = {
|
|
130
|
-
integration: string;
|
|
131
|
-
operation?: string;
|
|
132
|
-
severity?: 'INFO' | 'WARNING' | 'ERROR' | 'CRITICAL';
|
|
133
|
-
errorCode?: string;
|
|
134
|
-
httpStatus?: number;
|
|
135
|
-
// Payload of the request sent to the third party that ended in error
|
|
136
|
-
params: Record<string, unknown>;
|
|
137
|
-
occurredAt: Date;
|
|
138
|
-
// Idempotency key: reporting the same externalId again returns the same errorId
|
|
139
|
-
externalId?: string;
|
|
140
|
-
// Up to 64 KB once serialized. Never include credentials or tokens.
|
|
141
|
-
details?: Record<string, unknown>;
|
|
142
|
-
};
|
|
143
|
-
type ReportIntegrationErrorResponse = {errorId: number};
|
|
144
|
-
|
|
145
|
-
type RequestHandlerParams = {
|
|
146
|
-
// Credentials that doc24 should use when singing the jwt
|
|
147
|
-
credentials: SdkCredentials;
|
|
148
|
-
eventHandlers: Webhook.Events;
|
|
149
|
-
// Address in which doc24 should send the requests
|
|
150
|
-
baseAddress: string;
|
|
151
|
-
};
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
`getRequestHandler` should be called only once, and takes care of managing the webhook that receives events from doc24.
|
|
155
|
-
|
|
156
|
-
### Express example
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
const handler = await getRequestHandler();
|
|
160
|
-
app.all('/doc24', async (req, res) => {
|
|
161
|
-
const response = await handler({
|
|
162
|
-
headers: req.headers,
|
|
163
|
-
body: req.body,
|
|
164
|
-
query: req.query,
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
res.status(response.status.code).json(response.data);
|
|
168
|
-
});
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### UserSdk
|
|
172
|
-
|
|
173
|
-
Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
export type UserSdk = {
|
|
177
|
-
declarePatient: (
|
|
178
|
-
params: DeclarePatientParams,
|
|
179
|
-
) => Promise<DeclarePatientResponse>;
|
|
180
|
-
getPatientId: (patient: PatientSearch) => Promise<number>;
|
|
181
|
-
deletePatient: (patientId: number) => Promise<void>;
|
|
182
|
-
getSpecialties: (
|
|
183
|
-
mode: SpecialtyMode,
|
|
184
|
-
language: string,
|
|
185
|
-
) => Promise<Specialty[]>;
|
|
186
|
-
getScheduleDates: (
|
|
187
|
-
patientId: number,
|
|
188
|
-
filter?: ScheduleAvailabilityFilter,
|
|
189
|
-
) => Promise<Date[]>;
|
|
190
|
-
getSchedule: (
|
|
191
|
-
patientId: number,
|
|
192
|
-
specialtyId: number,
|
|
193
|
-
filter?: ScheduleFilter,
|
|
194
|
-
) => Promise<AvailableAppointment[]>;
|
|
195
|
-
getAppointment: (appointmentId: number) => Promise<Appointment>;
|
|
196
|
-
getAppointmentByVcToken: (vcToken: string) => Promise<Appointment>;
|
|
197
|
-
scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
|
|
198
|
-
cancelVideoVisit: (vcToken: string) => Promise<void>;
|
|
199
|
-
getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
|
|
200
|
-
getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
|
|
201
|
-
getCompleteVideoVisitDetails: (
|
|
202
|
-
vcId: number,
|
|
203
|
-
) => Promise<CompleteVideoVisitDetails>;
|
|
204
|
-
getVideoVisitLink: (
|
|
205
|
-
vcToken: string,
|
|
206
|
-
patientId: number,
|
|
207
|
-
) => Promise<string | null>;
|
|
208
|
-
getPatientVideoVisitHistory: (
|
|
209
|
-
patientId: number,
|
|
210
|
-
) => Promise<HistoricalVideoVisit[]>;
|
|
211
|
-
getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
|
|
212
|
-
getAvailableChatrooms: (
|
|
213
|
-
patientId: number,
|
|
214
|
-
specialtyId: number,
|
|
215
|
-
filter: ChatroomAvailabilityFilter,
|
|
216
|
-
) => Promise<AvailableChatroom[]>;
|
|
217
|
-
createNewChat: (chatParameters: ChatParameters) => Promise<number>;
|
|
218
|
-
getPatientChats: (patientId: number) => Promise<ChatDetails[]>;
|
|
219
|
-
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
220
|
-
cancelChat: (chatId: number) => Promise<void>;
|
|
221
|
-
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
222
|
-
getPatientPHR: (patientId: number) => Promise<string>;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
1
|
+
# @integraciones_doc24/sdk
|
|
2
|
+
|
|
3
|
+
Node.JS library for accessing doc24 api
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`npm i @integraciones_doc24/sdk`
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {doc24Sdk} from '@integraciones_doc24/sdk';
|
|
13
|
+
|
|
14
|
+
const getBaseSdk = () =>
|
|
15
|
+
doc24Sdk({
|
|
16
|
+
url: 'https://tapi.doc24.com.ar/ws/sdk',
|
|
17
|
+
credentials: {
|
|
18
|
+
iss: 'myissuer',
|
|
19
|
+
key: 'mysecret',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const getSpecialities = async (user) => {
|
|
24
|
+
const baseSdk = await getBaseSdk();
|
|
25
|
+
|
|
26
|
+
const userSdk = await baseSdk.getUserInstance(user);
|
|
27
|
+
|
|
28
|
+
return await userSdk.getSpecialties('instant', 'ES');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getRequestHandler = async () => {
|
|
32
|
+
const baseSdk = await getBaseSdk();
|
|
33
|
+
return baseSdk.getRequestHandler({
|
|
34
|
+
credentials: {
|
|
35
|
+
iss: 'doc24issuer',
|
|
36
|
+
key: 'doc24secret',
|
|
37
|
+
},
|
|
38
|
+
baseAddress: 'http://myaddress.com/route/to/webhook',
|
|
39
|
+
eventHandlers: {
|
|
40
|
+
onAppointmentStatusChange: ({id, status, changeDate}) => {
|
|
41
|
+
console.log({id, status, changeDate});
|
|
42
|
+
},
|
|
43
|
+
onConsultationStatusChange: ({
|
|
44
|
+
id,
|
|
45
|
+
invitationId,
|
|
46
|
+
status,
|
|
47
|
+
changeDate,
|
|
48
|
+
vcToken,
|
|
49
|
+
}) => {
|
|
50
|
+
console.log({id, invitationId, status, changeDate, vcToken});
|
|
51
|
+
},
|
|
52
|
+
onInvitationStatusChange: ({id, status, changeDate}) => {
|
|
53
|
+
console.log({id, status, changeDate});
|
|
54
|
+
},
|
|
55
|
+
onChatUpdate: ({id, status, patientId, professionalId, date}) => {
|
|
56
|
+
console.log({id, status, patientId, professionalId, date});
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The library exports the function `doc24Sdk`. It takes one parameters of type `SdkParams`, and returns a `BaseSdk`.
|
|
64
|
+
It also returns an extra `getRequestHandler` function that takes a `RequestHandlerParams`
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
type SdkCredentials = {
|
|
68
|
+
iss: string;
|
|
69
|
+
key: string;
|
|
70
|
+
};
|
|
71
|
+
type SdkParams = {
|
|
72
|
+
url: string;
|
|
73
|
+
credentials: SdkCredentials;
|
|
74
|
+
};
|
|
75
|
+
export type BaseSdk = {
|
|
76
|
+
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
77
|
+
getUserId: (user: User) => Promise<number>;
|
|
78
|
+
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
79
|
+
getProfessional: (professionalId: number) => Promise<Professional>;
|
|
80
|
+
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
81
|
+
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
82
|
+
getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
|
|
83
|
+
sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
|
|
84
|
+
getDiagnosticaHistory: (
|
|
85
|
+
patient: DiagnosticaPatientFilter,
|
|
86
|
+
from: Date,
|
|
87
|
+
to: Date,
|
|
88
|
+
) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
89
|
+
getDiagnosticaDeepLink: (
|
|
90
|
+
kiosk: string,
|
|
91
|
+
user: DiagnosticaUser,
|
|
92
|
+
patient: DiagnosticaPatient,
|
|
93
|
+
) => Promise<DiagnosticaDeepLinkResponse>;
|
|
94
|
+
getDiagnosticaAccess: (
|
|
95
|
+
kiosk: string,
|
|
96
|
+
user: DiagnosticaUser,
|
|
97
|
+
patient: DiagnosticaPatient,
|
|
98
|
+
) => Promise<void>;
|
|
99
|
+
externalLogin: (
|
|
100
|
+
params: ExternalLoginParams,
|
|
101
|
+
) => Promise<ExternalLoginResponse>;
|
|
102
|
+
preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
103
|
+
externalEnrollment: (
|
|
104
|
+
params: ExternalEnrollmentParams,
|
|
105
|
+
) => Promise<ExternalLoginResponse>;
|
|
106
|
+
sendExternalVerificationCode: (
|
|
107
|
+
params: SendExternalVerificationCodeParams,
|
|
108
|
+
) => Promise<void>;
|
|
109
|
+
verifyExternalVerificationCode: (
|
|
110
|
+
params: VerifyExternalVerificationCodeParams,
|
|
111
|
+
) => Promise<any>;
|
|
112
|
+
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
113
|
+
getExternalStudiesHistoryLink: (
|
|
114
|
+
patient: ExternalPatient,
|
|
115
|
+
) => Promise<string | null>;
|
|
116
|
+
getExternalAppointmentsLink: (
|
|
117
|
+
identificationValue: string,
|
|
118
|
+
birthdate: Date,
|
|
119
|
+
) => Promise<string | null>;
|
|
120
|
+
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
121
|
+
cancelExternalAppointment: (
|
|
122
|
+
appointmentId: ExternalAppointment,
|
|
123
|
+
) => Promise<void>;
|
|
124
|
+
reportIntegrationError: (
|
|
125
|
+
params: ReportIntegrationErrorParams,
|
|
126
|
+
) => Promise<ReportIntegrationErrorResponse>;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
type ReportIntegrationErrorParams = {
|
|
130
|
+
integration: string;
|
|
131
|
+
operation?: string;
|
|
132
|
+
severity?: 'INFO' | 'WARNING' | 'ERROR' | 'CRITICAL';
|
|
133
|
+
errorCode?: string;
|
|
134
|
+
httpStatus?: number;
|
|
135
|
+
// Payload of the request sent to the third party that ended in error
|
|
136
|
+
params: Record<string, unknown>;
|
|
137
|
+
occurredAt: Date;
|
|
138
|
+
// Idempotency key: reporting the same externalId again returns the same errorId
|
|
139
|
+
externalId?: string;
|
|
140
|
+
// Up to 64 KB once serialized. Never include credentials or tokens.
|
|
141
|
+
details?: Record<string, unknown>;
|
|
142
|
+
};
|
|
143
|
+
type ReportIntegrationErrorResponse = {errorId: number};
|
|
144
|
+
|
|
145
|
+
type RequestHandlerParams = {
|
|
146
|
+
// Credentials that doc24 should use when singing the jwt
|
|
147
|
+
credentials: SdkCredentials;
|
|
148
|
+
eventHandlers: Webhook.Events;
|
|
149
|
+
// Address in which doc24 should send the requests
|
|
150
|
+
baseAddress: string;
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`getRequestHandler` should be called only once, and takes care of managing the webhook that receives events from doc24.
|
|
155
|
+
|
|
156
|
+
### Express example
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
const handler = await getRequestHandler();
|
|
160
|
+
app.all('/doc24', async (req, res) => {
|
|
161
|
+
const response = await handler({
|
|
162
|
+
headers: req.headers,
|
|
163
|
+
body: req.body,
|
|
164
|
+
query: req.query,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
res.status(response.status.code).json(response.data);
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### UserSdk
|
|
172
|
+
|
|
173
|
+
Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
export type UserSdk = {
|
|
177
|
+
declarePatient: (
|
|
178
|
+
params: DeclarePatientParams,
|
|
179
|
+
) => Promise<DeclarePatientResponse>;
|
|
180
|
+
getPatientId: (patient: PatientSearch) => Promise<number>;
|
|
181
|
+
deletePatient: (patientId: number) => Promise<void>;
|
|
182
|
+
getSpecialties: (
|
|
183
|
+
mode: SpecialtyMode,
|
|
184
|
+
language: string,
|
|
185
|
+
) => Promise<Specialty[]>;
|
|
186
|
+
getScheduleDates: (
|
|
187
|
+
patientId: number,
|
|
188
|
+
filter?: ScheduleAvailabilityFilter,
|
|
189
|
+
) => Promise<Date[]>;
|
|
190
|
+
getSchedule: (
|
|
191
|
+
patientId: number,
|
|
192
|
+
specialtyId: number,
|
|
193
|
+
filter?: ScheduleFilter,
|
|
194
|
+
) => Promise<AvailableAppointment[]>;
|
|
195
|
+
getAppointment: (appointmentId: number) => Promise<Appointment>;
|
|
196
|
+
getAppointmentByVcToken: (vcToken: string) => Promise<Appointment>;
|
|
197
|
+
scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
|
|
198
|
+
cancelVideoVisit: (vcToken: string) => Promise<void>;
|
|
199
|
+
getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
|
|
200
|
+
getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
|
|
201
|
+
getCompleteVideoVisitDetails: (
|
|
202
|
+
vcId: number,
|
|
203
|
+
) => Promise<CompleteVideoVisitDetails>;
|
|
204
|
+
getVideoVisitLink: (
|
|
205
|
+
vcToken: string,
|
|
206
|
+
patientId: number,
|
|
207
|
+
) => Promise<string | null>;
|
|
208
|
+
getPatientVideoVisitHistory: (
|
|
209
|
+
patientId: number,
|
|
210
|
+
) => Promise<HistoricalVideoVisit[]>;
|
|
211
|
+
getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
|
|
212
|
+
getAvailableChatrooms: (
|
|
213
|
+
patientId: number,
|
|
214
|
+
specialtyId: number,
|
|
215
|
+
filter: ChatroomAvailabilityFilter,
|
|
216
|
+
) => Promise<AvailableChatroom[]>;
|
|
217
|
+
createNewChat: (chatParameters: ChatParameters) => Promise<number>;
|
|
218
|
+
getPatientChats: (patientId: number) => Promise<ChatDetails[]>;
|
|
219
|
+
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
220
|
+
cancelChat: (chatId: number) => Promise<void>;
|
|
221
|
+
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
222
|
+
getPatientPHR: (patientId: number) => Promise<string>;
|
|
223
|
+
checkEligibility: (params: EligibilityParams) => Promise<EligibilityResponse>;
|
|
224
|
+
userId: number;
|
|
225
|
+
};
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Eligibility (InSSSeP)
|
|
229
|
+
|
|
230
|
+
`checkEligibility` calls `POST /eligibility`. Doc24 queries InSSSeP and, when it accepts (code `100`), stores the result and updates the patient's document.
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
const result = await userSdk.checkEligibility({
|
|
234
|
+
patientId: 12345,
|
|
235
|
+
identificationType: '3', // '3' = DNI, '8' = Credencial
|
|
236
|
+
identificationValue: '30111222',
|
|
237
|
+
// Optional, always together:
|
|
238
|
+
// credentialToken: '123',
|
|
239
|
+
// credential: '354495',
|
|
240
|
+
});
|
|
241
|
+
// { eligible, code, message, affiliate: {...} | null, notices, timestamp }
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
- The response signature is verified with the integrator key. If it doesn't match, a `ResponseSignatureError` is thrown.
|
|
245
|
+
- `eligible: false` is a normal response: `code` and `message` carry InSSSeP's answer.
|
|
246
|
+
- Errors are thrown by axios with `error.response.data.mensaje`: `INVALID PARAMS` (400), `INVALID PATIENT`, `SERVICE DISABLED` or `INSSSEP_UNAVAILABLE` (409).
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { RequestMaker } from '../request';
|
|
2
|
-
export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
3
|
-
getDiagnosticaHistory: (patient: {
|
|
4
|
-
gender?: "m" | "f" | "o" | undefined;
|
|
5
|
-
identificationType: "DNI";
|
|
6
|
-
identificationValue: string;
|
|
7
|
-
}, from: Date, to: Date) => Promise<{
|
|
8
|
-
date: Date;
|
|
9
|
-
location: string;
|
|
10
|
-
exams: string[];
|
|
11
|
-
deepLink: string;
|
|
12
|
-
}[]>;
|
|
13
|
-
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
-
gender?: "m" | "f" | "o" | undefined;
|
|
15
|
-
firstName: string;
|
|
16
|
-
lastName: string;
|
|
17
|
-
identificationType: "DNI";
|
|
18
|
-
identificationValue: string;
|
|
19
|
-
email: string;
|
|
20
|
-
phone: string;
|
|
21
|
-
language: string;
|
|
22
|
-
birthday: Date;
|
|
23
|
-
}, patient: {
|
|
24
|
-
gender?: "m" | "f" | "o" | undefined;
|
|
25
|
-
firstName: string;
|
|
26
|
-
lastName: string;
|
|
27
|
-
identificationType: "DNI";
|
|
28
|
-
identificationValue: string;
|
|
29
|
-
birthday: Date;
|
|
30
|
-
}) => Promise<{
|
|
31
|
-
forwardingRequired: true;
|
|
32
|
-
deepLink: string;
|
|
33
|
-
} | {
|
|
34
|
-
forwardingRequired: false;
|
|
35
|
-
}>;
|
|
36
|
-
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
-
gender?: "m" | "f" | "o" | undefined;
|
|
38
|
-
firstName: string;
|
|
39
|
-
lastName: string;
|
|
40
|
-
identificationType: "DNI";
|
|
41
|
-
identificationValue: string;
|
|
42
|
-
email: string;
|
|
43
|
-
phone: string;
|
|
44
|
-
language: string;
|
|
45
|
-
birthday: Date;
|
|
46
|
-
}, patient: {
|
|
47
|
-
gender?: "m" | "f" | "o" | undefined;
|
|
48
|
-
firstName: string;
|
|
49
|
-
lastName: string;
|
|
50
|
-
identificationType: "DNI";
|
|
51
|
-
identificationValue: string;
|
|
52
|
-
birthday: Date;
|
|
53
|
-
}) => Promise<void>;
|
|
54
|
-
};
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getDiagnosticaHistory: (patient: {
|
|
4
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
5
|
+
identificationType: "DNI";
|
|
6
|
+
identificationValue: string;
|
|
7
|
+
}, from: Date, to: Date) => Promise<{
|
|
8
|
+
date: Date;
|
|
9
|
+
location: string;
|
|
10
|
+
exams: string[];
|
|
11
|
+
deepLink: string;
|
|
12
|
+
}[]>;
|
|
13
|
+
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
identificationType: "DNI";
|
|
18
|
+
identificationValue: string;
|
|
19
|
+
email: string;
|
|
20
|
+
phone: string;
|
|
21
|
+
language: string;
|
|
22
|
+
birthday: Date;
|
|
23
|
+
}, patient: {
|
|
24
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
identificationType: "DNI";
|
|
28
|
+
identificationValue: string;
|
|
29
|
+
birthday: Date;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
forwardingRequired: true;
|
|
32
|
+
deepLink: string;
|
|
33
|
+
} | {
|
|
34
|
+
forwardingRequired: false;
|
|
35
|
+
}>;
|
|
36
|
+
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
38
|
+
firstName: string;
|
|
39
|
+
lastName: string;
|
|
40
|
+
identificationType: "DNI";
|
|
41
|
+
identificationValue: string;
|
|
42
|
+
email: string;
|
|
43
|
+
phone: string;
|
|
44
|
+
language: string;
|
|
45
|
+
birthday: Date;
|
|
46
|
+
}, patient: {
|
|
47
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
48
|
+
firstName: string;
|
|
49
|
+
lastName: string;
|
|
50
|
+
identificationType: "DNI";
|
|
51
|
+
identificationValue: string;
|
|
52
|
+
birthday: Date;
|
|
53
|
+
}) => Promise<void>;
|
|
54
|
+
};
|