@integraciones_doc24/sdk 0.39.4 → 0.39.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @integraciones_doc24/sdk
2
2
 
3
- Node.JS library for accessing doc24 api
3
+ Node.JS library for accessing doc24 api
4
4
 
5
5
  ## Installation
6
6
 
@@ -9,48 +9,55 @@
9
9
  ## Usage
10
10
 
11
11
  ```ts
12
- import {doc24Sdk} from '@integraciones_doc24/sdk'
12
+ import {doc24Sdk} from '@integraciones_doc24/sdk';
13
13
 
14
- const getBaseSdk = () => doc24Sdk({
15
- url: 'https://tapi.doc24.com.ar/ws/sdk',
16
- credentials: {
17
- iss: 'myissuer',
18
- key: 'mysecret',
19
- },
20
- });
21
-
22
- const getSpecialities = async (user) => {
23
- const baseSdk = await getBaseSdk()
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();
24
25
 
25
- const userSdk = await baseSdk.getUserInstance(user)
26
+ const userSdk = await baseSdk.getUserInstance(user);
26
27
 
27
- return await userSdk.getSpecialties('instant', 'ES');
28
- }
28
+ return await userSdk.getSpecialties('instant', 'ES');
29
+ };
29
30
 
30
31
  const getRequestHandler = async () => {
31
- const baseSdk = await getBaseSdk()
32
- return baseSdk.getRequestHandler({
33
- credentials: {
34
- iss: 'doc24issuer',
35
- key: 'doc24secret',
36
- },
37
- baseAddress: 'http://myaddress.com/route/to/webhook',
38
- eventHandlers: {
39
- onAppointmentStatusChange: ({id, status, changeDate}) => {
40
- console.log({id, status, changeDate});
41
- },
42
- onConsultationStatusChange: ({id, invitationId, status, changeDate, vcToken}) => {
43
- console.log({id, invitationId, status, changeDate, vcToken});
44
- },
45
- onInvitationStatusChange: ({id, status, changeDate}) => {
46
- console.log({id, status, changeDate});
47
- },
48
- onChatUpdate: ({id, status, patientId, professionalId, date}) => {
49
- console.log({id, status, patientId, professionalId, date});
50
- }
51
- },
52
- });
53
- }
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
+ };
54
61
  ```
55
62
 
56
63
  The library exports the function `doc24Sdk`. It takes one parameters of type `SdkParams`, and returns a `BaseSdk`.
@@ -58,69 +65,72 @@ It also returns an extra `getRequestHandler` function that takes a `RequestHandl
58
65
 
59
66
  ```ts
60
67
  type SdkCredentials = {
61
- iss: string;
62
- key: string;
63
- }
68
+ iss: string;
69
+ key: string;
70
+ };
64
71
  type SdkParams = {
65
- url: string;
66
- credentials: SdkCredentials;
72
+ url: string;
73
+ credentials: SdkCredentials;
67
74
  };
68
75
  type BaseSdk = {
69
- getUserInstance: (user: User) => Promise<UserSdk>;
70
- getProfessional: (professionalId: number) => Promise<Professional>;
71
- getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>
72
- }
76
+ getUserInstance: (user: User) => Promise<UserSdk>;
77
+ getProfessional: (professionalId: number) => Promise<Professional>;
78
+ getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
79
+ getConsultation: (consultationId: number) => Promise<Consultation | null>;
80
+ };
73
81
 
74
82
  type RequestHandlerParams = {
75
- // Credentials that doc24 should use when singing the jwt
76
- credentials: SdkCredentials;
77
- eventHandlers: Webhook.Events;
78
- // Address in which doc24 should send the requests
79
- baseAddress: string;
80
- }
83
+ // Credentials that doc24 should use when singing the jwt
84
+ credentials: SdkCredentials;
85
+ eventHandlers: Webhook.Events;
86
+ // Address in which doc24 should send the requests
87
+ baseAddress: string;
88
+ };
81
89
  ```
82
90
 
83
91
  `getRequestHandler` should be called only once, and takes care of managing the webhook that receives events from doc24.
84
92
 
85
93
  ### Express example
94
+
86
95
  ```ts
87
- const handler = await getRequestHandler()
96
+ const handler = await getRequestHandler();
88
97
  app.all('/doc24', async (req, res) => {
89
- const response = await handler({
90
- headers: req.headers,
91
- body: req.body,
92
- query: req.query,
93
- });
98
+ const response = await handler({
99
+ headers: req.headers,
100
+ body: req.body,
101
+ query: req.query,
102
+ });
94
103
 
95
- res.status(response.status.code).json(response.data);
104
+ res.status(response.status.code).json(response.data);
96
105
  });
97
106
  ```
98
107
 
99
108
  ### UserSdk
109
+
100
110
  Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
101
111
 
102
112
  ```ts
103
113
  type UserSdk = {
104
- declarePatient: (patient: Patient) => Promise<number>;
105
- getSpecialties: (
106
- mode: SpecialtyMode,
107
- language: string,
108
- ) => Promise<Specialty[]>;
109
- getScheduleDates: (
110
- patientId: number,
111
- filter?: ScheduleAvailabilityFilter,
112
- ) => Promise<Date[]>;
113
- getSchedule: (
114
- patientId: number,
115
- specialtyId: number,
116
- filter?: ScheduleFilter,
117
- ) => Promise<AvailableAppointment[]>;
118
- getAppointment: (appointmentId: number) => Promise<Appointment>;
119
- scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
120
- cancelVideoVisit: (vcToken: string) => Promise<void>;
121
- getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
122
- getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
123
- getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
124
- userId: number;
125
- }
126
- ```
114
+ declarePatient: (patient: Patient) => Promise<number>;
115
+ getSpecialties: (
116
+ mode: SpecialtyMode,
117
+ language: string,
118
+ ) => Promise<Specialty[]>;
119
+ getScheduleDates: (
120
+ patientId: number,
121
+ filter?: ScheduleAvailabilityFilter,
122
+ ) => Promise<Date[]>;
123
+ getSchedule: (
124
+ patientId: number,
125
+ specialtyId: number,
126
+ filter?: ScheduleFilter,
127
+ ) => Promise<AvailableAppointment[]>;
128
+ getAppointment: (appointmentId: number) => Promise<Appointment>;
129
+ scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
130
+ cancelVideoVisit: (vcToken: string) => Promise<void>;
131
+ getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
132
+ getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
133
+ getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
134
+ userId: number;
135
+ };
136
+ ```
@@ -0,0 +1,99 @@
1
+ import { Doc24 } from '../types';
2
+ export declare const getConsultationMethods: (url: string, credentials: Doc24.SdkCredentials) => {
3
+ getConsultation: (consultationId: number) => Promise<{
4
+ pdf_laboratorios?: any;
5
+ pdf_otras?: any;
6
+ pdf_imagenes?: any;
7
+ snapshot_paciente?: any;
8
+ snapshot_profesional?: any;
9
+ custom_1?: any;
10
+ custom_2?: any;
11
+ custom_3?: any;
12
+ custom_4?: any;
13
+ custom_5?: any;
14
+ tag_idioma: string;
15
+ id_consulta: number;
16
+ tipo_consulta: string;
17
+ estado: string;
18
+ tipo_usuario_cancelacion: string | null;
19
+ fecha_cancelacion: string | null;
20
+ estado_pago: string;
21
+ referencia_mercadopago: string | null;
22
+ id_atencion: number;
23
+ id_profesional: number;
24
+ profesional: string;
25
+ modalidad_paciente_turno: string | null;
26
+ provincia_consultorio: string | null;
27
+ localidad_consultorio: string | null;
28
+ domicilio_consultorio: string | null;
29
+ marketplace: string;
30
+ profesional_matriculas: any[];
31
+ info_paciente: {
32
+ email?: string | null | undefined;
33
+ apellido?: string | null | undefined;
34
+ nombre?: string | null | undefined;
35
+ genero?: string | null | undefined;
36
+ valor_identificacion?: string | null | undefined;
37
+ telefono?: string | null | undefined;
38
+ id_pais?: string | null | undefined;
39
+ provincia?: string | null | undefined;
40
+ localidad?: string | null | undefined;
41
+ domicilio?: string | null | undefined;
42
+ fecha_de_nacimiento?: string | null | undefined;
43
+ tag_idioma?: number | null | undefined;
44
+ estado_paciente?: number | null | undefined;
45
+ fecha_suspension?: string | null | undefined;
46
+ fecha_activacion?: string | null | undefined;
47
+ fecha_modificacion?: string | null | undefined;
48
+ fecha_baja?: string | null | undefined;
49
+ id_paciente: number;
50
+ id_tipo_de_identificacion: number;
51
+ };
52
+ fecha_primer_llamado_profesional: string;
53
+ fecha_inicio: string;
54
+ fecha_primer_acceso_paciente: string;
55
+ fecha_ultimo_acceso_paciente: string;
56
+ fecha_corte_medico: string;
57
+ fecha_fin: string;
58
+ intentos_conexion: number;
59
+ id_turno: number | null;
60
+ fecha_turno_invitacion: string | null;
61
+ hora_turno_invitacion: string | null;
62
+ firma_profesional: string | null;
63
+ id_especialidad: number;
64
+ especialidad: string;
65
+ motivo: string;
66
+ enfermedad_actual: string;
67
+ conducta_terapeutica: string;
68
+ signos_alerta: string;
69
+ motivo_extendido_consulta: string;
70
+ presencial_requerida: string;
71
+ derivada: string;
72
+ derivada_id_especialidad: string;
73
+ derivada_presencial_obligatoria: string;
74
+ derivada_comentarios: string | null;
75
+ diagnostico: any[];
76
+ practicas: any[];
77
+ link_medicacion: any[];
78
+ medicacion: any[];
79
+ link_receta: string | null;
80
+ link_compra: string | null;
81
+ identificador_receta: string | null;
82
+ codigo_verificacion_receta: string | null;
83
+ financiador: string;
84
+ registro_custom: any[];
85
+ pdf_medicacion: any[];
86
+ uploads: any[];
87
+ files_atencion: any[];
88
+ motivo_cancelacion: string | null;
89
+ detalle_cancelacion: string | null;
90
+ documentos: string;
91
+ id_consultorio: number;
92
+ token: string;
93
+ tipo_protocolo_seguimiento: string | null;
94
+ form_data: {};
95
+ ubicacion: string;
96
+ link_full: string;
97
+ timestamp: string;
98
+ } | null>;
99
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getConsultationMethods = void 0;
4
+ const zod_1 = require("zod");
5
+ const schemas_1 = require("../schemas");
6
+ const request_1 = require("../request");
7
+ const validation_1 = require("../request/validation");
8
+ const getConsultationMethods = (url, credentials) => {
9
+ const getConsultation = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.consultation, async (consultationId) => {
10
+ // Replace /sdk with /api/v2 in the base URL
11
+ const apiUrl = url.replace('/sdk', '/api/v2');
12
+ const apiRequest = await request_1.getRequestFactory(apiUrl, credentials);
13
+ const path = `/consulta/${consultationId}`;
14
+ const response = await apiRequest('GET', path);
15
+ // Remove pdf_atencion and pdf_certificado from the response
16
+ const { pdf_atencion, pdf_certificado, ...attention } = response === null || response === void 0 ? void 0 : response.data;
17
+ return attention;
18
+ });
19
+ return {
20
+ getConsultation,
21
+ };
22
+ };
23
+ exports.getConsultationMethods = getConsultationMethods;
@@ -8,13 +8,16 @@ const schemas_1 = require("../schemas");
8
8
  const utils_1 = require("../utils");
9
9
  const diagnostica_1 = require("./diagnostica");
10
10
  const user_1 = require("./user");
11
+ const consultation_1 = require("./consultation");
11
12
  const getBaseSdk = async (url, credentials) => {
12
13
  const makeRequest = await request_1.getRequestFactory(url, credentials);
13
14
  const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
14
15
  const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
16
+ const consultationMethods = consultation_1.getConsultationMethods(url, credentials);
15
17
  const baseSdk = {
16
18
  ...diagnosticaMethods,
17
19
  ...userMethods,
20
+ ...consultationMethods,
18
21
  getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
19
22
  const path = `/professional/${professionalId}`;
20
23
  const response = await makeRequest('GET', path);
package/lib/index.d.ts CHANGED
@@ -104,6 +104,102 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
104
104
  authorizationCode: string | null;
105
105
  authorizationCodeExpiration: Date | null;
106
106
  } | null>;
107
+ getConsultation: (consultationId: number) => Promise<{
108
+ pdf_laboratorios?: any;
109
+ pdf_otras?: any;
110
+ pdf_imagenes?: any;
111
+ snapshot_paciente?: any;
112
+ snapshot_profesional?: any;
113
+ custom_1?: any;
114
+ custom_2?: any;
115
+ custom_3?: any;
116
+ custom_4?: any;
117
+ custom_5?: any;
118
+ tag_idioma: string;
119
+ id_consulta: number;
120
+ tipo_consulta: string;
121
+ estado: string;
122
+ tipo_usuario_cancelacion: string | null;
123
+ fecha_cancelacion: string | null;
124
+ estado_pago: string;
125
+ referencia_mercadopago: string | null;
126
+ id_atencion: number;
127
+ id_profesional: number;
128
+ profesional: string;
129
+ modalidad_paciente_turno: string | null;
130
+ provincia_consultorio: string | null;
131
+ localidad_consultorio: string | null;
132
+ domicilio_consultorio: string | null;
133
+ marketplace: string;
134
+ profesional_matriculas: any[];
135
+ info_paciente: {
136
+ email?: string | null | undefined;
137
+ apellido?: string | null | undefined;
138
+ nombre?: string | null | undefined;
139
+ genero?: string | null | undefined;
140
+ valor_identificacion?: string | null | undefined;
141
+ telefono?: string | null | undefined;
142
+ id_pais?: string | null | undefined;
143
+ provincia?: string | null | undefined;
144
+ localidad?: string | null | undefined;
145
+ domicilio?: string | null | undefined;
146
+ fecha_de_nacimiento?: string | null | undefined;
147
+ tag_idioma?: number | null | undefined;
148
+ estado_paciente?: number | null | undefined;
149
+ fecha_suspension?: string | null | undefined;
150
+ fecha_activacion?: string | null | undefined;
151
+ fecha_modificacion?: string | null | undefined;
152
+ fecha_baja?: string | null | undefined;
153
+ id_paciente: number;
154
+ id_tipo_de_identificacion: number;
155
+ };
156
+ fecha_primer_llamado_profesional: string;
157
+ fecha_inicio: string;
158
+ fecha_primer_acceso_paciente: string;
159
+ fecha_ultimo_acceso_paciente: string;
160
+ fecha_corte_medico: string;
161
+ fecha_fin: string;
162
+ intentos_conexion: number;
163
+ id_turno: number | null;
164
+ fecha_turno_invitacion: string | null;
165
+ hora_turno_invitacion: string | null;
166
+ firma_profesional: string | null;
167
+ id_especialidad: number;
168
+ especialidad: string;
169
+ motivo: string;
170
+ enfermedad_actual: string;
171
+ conducta_terapeutica: string;
172
+ signos_alerta: string;
173
+ motivo_extendido_consulta: string;
174
+ presencial_requerida: string;
175
+ derivada: string;
176
+ derivada_id_especialidad: string;
177
+ derivada_presencial_obligatoria: string;
178
+ derivada_comentarios: string | null;
179
+ diagnostico: any[];
180
+ practicas: any[];
181
+ link_medicacion: any[];
182
+ medicacion: any[];
183
+ link_receta: string | null;
184
+ link_compra: string | null;
185
+ identificador_receta: string | null;
186
+ codigo_verificacion_receta: string | null;
187
+ financiador: string;
188
+ registro_custom: any[];
189
+ pdf_medicacion: any[];
190
+ uploads: any[];
191
+ files_atencion: any[];
192
+ motivo_cancelacion: string | null;
193
+ detalle_cancelacion: string | null;
194
+ documentos: string;
195
+ id_consultorio: number;
196
+ token: string;
197
+ tipo_protocolo_seguimiento: string | null;
198
+ form_data: {};
199
+ ubicacion: string;
200
+ link_full: string;
201
+ timestamp: string;
202
+ } | null>;
107
203
  getDiagnosticaHistory: (patient: {
108
204
  identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
109
205
  identificationValue: string;
package/lib/schemas.d.ts CHANGED
@@ -629,6 +629,332 @@ export declare const doc24Schemas: {
629
629
  vcToken: string;
630
630
  consultationId: number;
631
631
  }>;
632
+ consultation: import("zod").ZodObject<{
633
+ id_consulta: import("zod").ZodNumber;
634
+ tipo_consulta: import("zod").ZodString;
635
+ estado: import("zod").ZodString;
636
+ tipo_usuario_cancelacion: import("zod").ZodNullable<import("zod").ZodString>;
637
+ fecha_cancelacion: import("zod").ZodNullable<import("zod").ZodString>;
638
+ estado_pago: import("zod").ZodString;
639
+ referencia_mercadopago: import("zod").ZodNullable<import("zod").ZodString>;
640
+ id_atencion: import("zod").ZodNumber;
641
+ id_profesional: import("zod").ZodNumber;
642
+ profesional: import("zod").ZodString;
643
+ modalidad_paciente_turno: import("zod").ZodNullable<import("zod").ZodString>;
644
+ provincia_consultorio: import("zod").ZodNullable<import("zod").ZodString>;
645
+ localidad_consultorio: import("zod").ZodNullable<import("zod").ZodString>;
646
+ domicilio_consultorio: import("zod").ZodNullable<import("zod").ZodString>;
647
+ marketplace: import("zod").ZodString;
648
+ profesional_matriculas: import("zod").ZodArray<import("zod").ZodAny, "many">;
649
+ info_paciente: import("zod").ZodObject<{
650
+ id_paciente: import("zod").ZodNumber;
651
+ apellido: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
652
+ nombre: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
653
+ genero: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
654
+ id_tipo_de_identificacion: import("zod").ZodNumber;
655
+ valor_identificacion: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
656
+ email: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
657
+ telefono: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
658
+ id_pais: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
659
+ provincia: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
660
+ localidad: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
661
+ domicilio: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
662
+ fecha_de_nacimiento: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
663
+ tag_idioma: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
664
+ estado_paciente: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodNumber>>;
665
+ fecha_suspension: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
666
+ fecha_activacion: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
667
+ fecha_modificacion: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
668
+ fecha_baja: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
669
+ }, "strip", import("zod").ZodTypeAny, {
670
+ email?: string | null | undefined;
671
+ apellido?: string | null | undefined;
672
+ nombre?: string | null | undefined;
673
+ genero?: string | null | undefined;
674
+ valor_identificacion?: string | null | undefined;
675
+ telefono?: string | null | undefined;
676
+ id_pais?: string | null | undefined;
677
+ provincia?: string | null | undefined;
678
+ localidad?: string | null | undefined;
679
+ domicilio?: string | null | undefined;
680
+ fecha_de_nacimiento?: string | null | undefined;
681
+ tag_idioma?: number | null | undefined;
682
+ estado_paciente?: number | null | undefined;
683
+ fecha_suspension?: string | null | undefined;
684
+ fecha_activacion?: string | null | undefined;
685
+ fecha_modificacion?: string | null | undefined;
686
+ fecha_baja?: string | null | undefined;
687
+ id_paciente: number;
688
+ id_tipo_de_identificacion: number;
689
+ }, {
690
+ email?: string | null | undefined;
691
+ apellido?: string | null | undefined;
692
+ nombre?: string | null | undefined;
693
+ genero?: string | null | undefined;
694
+ valor_identificacion?: string | null | undefined;
695
+ telefono?: string | null | undefined;
696
+ id_pais?: string | null | undefined;
697
+ provincia?: string | null | undefined;
698
+ localidad?: string | null | undefined;
699
+ domicilio?: string | null | undefined;
700
+ fecha_de_nacimiento?: string | null | undefined;
701
+ tag_idioma?: number | null | undefined;
702
+ estado_paciente?: number | null | undefined;
703
+ fecha_suspension?: string | null | undefined;
704
+ fecha_activacion?: string | null | undefined;
705
+ fecha_modificacion?: string | null | undefined;
706
+ fecha_baja?: string | null | undefined;
707
+ id_paciente: number;
708
+ id_tipo_de_identificacion: number;
709
+ }>;
710
+ fecha_primer_llamado_profesional: import("zod").ZodString;
711
+ fecha_inicio: import("zod").ZodString;
712
+ fecha_primer_acceso_paciente: import("zod").ZodString;
713
+ fecha_ultimo_acceso_paciente: import("zod").ZodString;
714
+ fecha_corte_medico: import("zod").ZodString;
715
+ fecha_fin: import("zod").ZodString;
716
+ intentos_conexion: import("zod").ZodNumber;
717
+ tag_idioma: import("zod").ZodString;
718
+ id_turno: import("zod").ZodNullable<import("zod").ZodNumber>;
719
+ fecha_turno_invitacion: import("zod").ZodNullable<import("zod").ZodString>;
720
+ hora_turno_invitacion: import("zod").ZodNullable<import("zod").ZodString>;
721
+ firma_profesional: import("zod").ZodNullable<import("zod").ZodString>;
722
+ id_especialidad: import("zod").ZodNumber;
723
+ especialidad: import("zod").ZodString;
724
+ motivo: import("zod").ZodString;
725
+ enfermedad_actual: import("zod").ZodString;
726
+ conducta_terapeutica: import("zod").ZodString;
727
+ signos_alerta: import("zod").ZodString;
728
+ motivo_extendido_consulta: import("zod").ZodString;
729
+ presencial_requerida: import("zod").ZodString;
730
+ derivada: import("zod").ZodString;
731
+ derivada_id_especialidad: import("zod").ZodString;
732
+ derivada_presencial_obligatoria: import("zod").ZodString;
733
+ derivada_comentarios: import("zod").ZodNullable<import("zod").ZodString>;
734
+ diagnostico: import("zod").ZodArray<import("zod").ZodAny, "many">;
735
+ practicas: import("zod").ZodArray<import("zod").ZodAny, "many">;
736
+ link_medicacion: import("zod").ZodArray<import("zod").ZodAny, "many">;
737
+ medicacion: import("zod").ZodArray<import("zod").ZodAny, "many">;
738
+ link_receta: import("zod").ZodNullable<import("zod").ZodString>;
739
+ link_compra: import("zod").ZodNullable<import("zod").ZodString>;
740
+ identificador_receta: import("zod").ZodNullable<import("zod").ZodString>;
741
+ codigo_verificacion_receta: import("zod").ZodNullable<import("zod").ZodString>;
742
+ financiador: import("zod").ZodString;
743
+ registro_custom: import("zod").ZodArray<import("zod").ZodAny, "many">;
744
+ pdf_medicacion: import("zod").ZodArray<import("zod").ZodAny, "many">;
745
+ pdf_laboratorios: import("zod").ZodAny;
746
+ pdf_otras: import("zod").ZodAny;
747
+ pdf_imagenes: import("zod").ZodAny;
748
+ uploads: import("zod").ZodArray<import("zod").ZodAny, "many">;
749
+ files_atencion: import("zod").ZodArray<import("zod").ZodAny, "many">;
750
+ motivo_cancelacion: import("zod").ZodNullable<import("zod").ZodString>;
751
+ detalle_cancelacion: import("zod").ZodNullable<import("zod").ZodString>;
752
+ documentos: import("zod").ZodString;
753
+ snapshot_paciente: import("zod").ZodNullable<import("zod").ZodAny>;
754
+ snapshot_profesional: import("zod").ZodNullable<import("zod").ZodAny>;
755
+ id_consultorio: import("zod").ZodNumber;
756
+ token: import("zod").ZodString;
757
+ tipo_protocolo_seguimiento: import("zod").ZodNullable<import("zod").ZodString>;
758
+ custom_1: import("zod").ZodNullable<import("zod").ZodAny>;
759
+ custom_2: import("zod").ZodNullable<import("zod").ZodAny>;
760
+ custom_3: import("zod").ZodNullable<import("zod").ZodAny>;
761
+ custom_4: import("zod").ZodNullable<import("zod").ZodAny>;
762
+ custom_5: import("zod").ZodNullable<import("zod").ZodAny>;
763
+ form_data: import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>;
764
+ ubicacion: import("zod").ZodString;
765
+ link_full: import("zod").ZodString;
766
+ timestamp: import("zod").ZodString;
767
+ }, "strip", import("zod").ZodTypeAny, {
768
+ pdf_laboratorios?: any;
769
+ pdf_otras?: any;
770
+ pdf_imagenes?: any;
771
+ snapshot_paciente?: any;
772
+ snapshot_profesional?: any;
773
+ custom_1?: any;
774
+ custom_2?: any;
775
+ custom_3?: any;
776
+ custom_4?: any;
777
+ custom_5?: any;
778
+ tag_idioma: string;
779
+ id_consulta: number;
780
+ tipo_consulta: string;
781
+ estado: string;
782
+ tipo_usuario_cancelacion: string | null;
783
+ fecha_cancelacion: string | null;
784
+ estado_pago: string;
785
+ referencia_mercadopago: string | null;
786
+ id_atencion: number;
787
+ id_profesional: number;
788
+ profesional: string;
789
+ modalidad_paciente_turno: string | null;
790
+ provincia_consultorio: string | null;
791
+ localidad_consultorio: string | null;
792
+ domicilio_consultorio: string | null;
793
+ marketplace: string;
794
+ profesional_matriculas: any[];
795
+ info_paciente: {
796
+ email?: string | null | undefined;
797
+ apellido?: string | null | undefined;
798
+ nombre?: string | null | undefined;
799
+ genero?: string | null | undefined;
800
+ valor_identificacion?: string | null | undefined;
801
+ telefono?: string | null | undefined;
802
+ id_pais?: string | null | undefined;
803
+ provincia?: string | null | undefined;
804
+ localidad?: string | null | undefined;
805
+ domicilio?: string | null | undefined;
806
+ fecha_de_nacimiento?: string | null | undefined;
807
+ tag_idioma?: number | null | undefined;
808
+ estado_paciente?: number | null | undefined;
809
+ fecha_suspension?: string | null | undefined;
810
+ fecha_activacion?: string | null | undefined;
811
+ fecha_modificacion?: string | null | undefined;
812
+ fecha_baja?: string | null | undefined;
813
+ id_paciente: number;
814
+ id_tipo_de_identificacion: number;
815
+ };
816
+ fecha_primer_llamado_profesional: string;
817
+ fecha_inicio: string;
818
+ fecha_primer_acceso_paciente: string;
819
+ fecha_ultimo_acceso_paciente: string;
820
+ fecha_corte_medico: string;
821
+ fecha_fin: string;
822
+ intentos_conexion: number;
823
+ id_turno: number | null;
824
+ fecha_turno_invitacion: string | null;
825
+ hora_turno_invitacion: string | null;
826
+ firma_profesional: string | null;
827
+ id_especialidad: number;
828
+ especialidad: string;
829
+ motivo: string;
830
+ enfermedad_actual: string;
831
+ conducta_terapeutica: string;
832
+ signos_alerta: string;
833
+ motivo_extendido_consulta: string;
834
+ presencial_requerida: string;
835
+ derivada: string;
836
+ derivada_id_especialidad: string;
837
+ derivada_presencial_obligatoria: string;
838
+ derivada_comentarios: string | null;
839
+ diagnostico: any[];
840
+ practicas: any[];
841
+ link_medicacion: any[];
842
+ medicacion: any[];
843
+ link_receta: string | null;
844
+ link_compra: string | null;
845
+ identificador_receta: string | null;
846
+ codigo_verificacion_receta: string | null;
847
+ financiador: string;
848
+ registro_custom: any[];
849
+ pdf_medicacion: any[];
850
+ uploads: any[];
851
+ files_atencion: any[];
852
+ motivo_cancelacion: string | null;
853
+ detalle_cancelacion: string | null;
854
+ documentos: string;
855
+ id_consultorio: number;
856
+ token: string;
857
+ tipo_protocolo_seguimiento: string | null;
858
+ form_data: {};
859
+ ubicacion: string;
860
+ link_full: string;
861
+ timestamp: string;
862
+ }, {
863
+ pdf_laboratorios?: any;
864
+ pdf_otras?: any;
865
+ pdf_imagenes?: any;
866
+ snapshot_paciente?: any;
867
+ snapshot_profesional?: any;
868
+ custom_1?: any;
869
+ custom_2?: any;
870
+ custom_3?: any;
871
+ custom_4?: any;
872
+ custom_5?: any;
873
+ tag_idioma: string;
874
+ id_consulta: number;
875
+ tipo_consulta: string;
876
+ estado: string;
877
+ tipo_usuario_cancelacion: string | null;
878
+ fecha_cancelacion: string | null;
879
+ estado_pago: string;
880
+ referencia_mercadopago: string | null;
881
+ id_atencion: number;
882
+ id_profesional: number;
883
+ profesional: string;
884
+ modalidad_paciente_turno: string | null;
885
+ provincia_consultorio: string | null;
886
+ localidad_consultorio: string | null;
887
+ domicilio_consultorio: string | null;
888
+ marketplace: string;
889
+ profesional_matriculas: any[];
890
+ info_paciente: {
891
+ email?: string | null | undefined;
892
+ apellido?: string | null | undefined;
893
+ nombre?: string | null | undefined;
894
+ genero?: string | null | undefined;
895
+ valor_identificacion?: string | null | undefined;
896
+ telefono?: string | null | undefined;
897
+ id_pais?: string | null | undefined;
898
+ provincia?: string | null | undefined;
899
+ localidad?: string | null | undefined;
900
+ domicilio?: string | null | undefined;
901
+ fecha_de_nacimiento?: string | null | undefined;
902
+ tag_idioma?: number | null | undefined;
903
+ estado_paciente?: number | null | undefined;
904
+ fecha_suspension?: string | null | undefined;
905
+ fecha_activacion?: string | null | undefined;
906
+ fecha_modificacion?: string | null | undefined;
907
+ fecha_baja?: string | null | undefined;
908
+ id_paciente: number;
909
+ id_tipo_de_identificacion: number;
910
+ };
911
+ fecha_primer_llamado_profesional: string;
912
+ fecha_inicio: string;
913
+ fecha_primer_acceso_paciente: string;
914
+ fecha_ultimo_acceso_paciente: string;
915
+ fecha_corte_medico: string;
916
+ fecha_fin: string;
917
+ intentos_conexion: number;
918
+ id_turno: number | null;
919
+ fecha_turno_invitacion: string | null;
920
+ hora_turno_invitacion: string | null;
921
+ firma_profesional: string | null;
922
+ id_especialidad: number;
923
+ especialidad: string;
924
+ motivo: string;
925
+ enfermedad_actual: string;
926
+ conducta_terapeutica: string;
927
+ signos_alerta: string;
928
+ motivo_extendido_consulta: string;
929
+ presencial_requerida: string;
930
+ derivada: string;
931
+ derivada_id_especialidad: string;
932
+ derivada_presencial_obligatoria: string;
933
+ derivada_comentarios: string | null;
934
+ diagnostico: any[];
935
+ practicas: any[];
936
+ link_medicacion: any[];
937
+ medicacion: any[];
938
+ link_receta: string | null;
939
+ link_compra: string | null;
940
+ identificador_receta: string | null;
941
+ codigo_verificacion_receta: string | null;
942
+ financiador: string;
943
+ registro_custom: any[];
944
+ pdf_medicacion: any[];
945
+ uploads: any[];
946
+ files_atencion: any[];
947
+ motivo_cancelacion: string | null;
948
+ detalle_cancelacion: string | null;
949
+ documentos: string;
950
+ id_consultorio: number;
951
+ token: string;
952
+ tipo_protocolo_seguimiento: string | null;
953
+ form_data: {};
954
+ ubicacion: string;
955
+ link_full: string;
956
+ timestamp: string;
957
+ }>;
632
958
  professional: import("zod").ZodObject<{
633
959
  id: import("zod").ZodNumber;
634
960
  firstName: import("zod").ZodString;
package/lib/schemas.js CHANGED
@@ -184,6 +184,102 @@ const oldIdentificaiton = zod_1.object({
184
184
  identificationType,
185
185
  identificationValue: zod_1.string(),
186
186
  });
187
+ const consultation = zod_1.object({
188
+ id_consulta: zod_1.number(),
189
+ tipo_consulta: zod_1.string(),
190
+ estado: zod_1.string(),
191
+ tipo_usuario_cancelacion: zod_1.string().nullable(),
192
+ fecha_cancelacion: zod_1.string().nullable(),
193
+ estado_pago: zod_1.string(),
194
+ referencia_mercadopago: zod_1.string().nullable(),
195
+ id_atencion: zod_1.number(),
196
+ id_profesional: zod_1.number(),
197
+ profesional: zod_1.string(),
198
+ modalidad_paciente_turno: zod_1.string().nullable(),
199
+ provincia_consultorio: zod_1.string().nullable(),
200
+ localidad_consultorio: zod_1.string().nullable(),
201
+ domicilio_consultorio: zod_1.string().nullable(),
202
+ marketplace: zod_1.string(),
203
+ profesional_matriculas: zod_1.array(zod_1.any()),
204
+ info_paciente: zod_1.object({
205
+ id_paciente: zod_1.number(),
206
+ apellido: zod_1.string().optional().nullable(),
207
+ nombre: zod_1.string().optional().nullable(),
208
+ genero: zod_1.string().optional().nullable(),
209
+ id_tipo_de_identificacion: zod_1.number(),
210
+ valor_identificacion: zod_1.string().optional().nullable(),
211
+ email: zod_1.string().optional().nullable(),
212
+ telefono: zod_1.string().optional().nullable(),
213
+ id_pais: zod_1.string().optional().nullable(),
214
+ provincia: zod_1.string().optional().nullable(),
215
+ localidad: zod_1.string().optional().nullable(),
216
+ domicilio: zod_1.string().optional().nullable(),
217
+ fecha_de_nacimiento: zod_1.string().optional().nullable(),
218
+ tag_idioma: zod_1.number().optional().nullable(),
219
+ estado_paciente: zod_1.number().optional().nullable(),
220
+ fecha_suspension: zod_1.string().optional().nullable(),
221
+ fecha_activacion: zod_1.string().optional().nullable(),
222
+ fecha_modificacion: zod_1.string().optional().nullable(),
223
+ fecha_baja: zod_1.string().optional().nullable(),
224
+ }),
225
+ fecha_primer_llamado_profesional: zod_1.string(),
226
+ fecha_inicio: zod_1.string(),
227
+ fecha_primer_acceso_paciente: zod_1.string(),
228
+ fecha_ultimo_acceso_paciente: zod_1.string(),
229
+ fecha_corte_medico: zod_1.string(),
230
+ fecha_fin: zod_1.string(),
231
+ intentos_conexion: zod_1.number(),
232
+ tag_idioma: zod_1.string(),
233
+ id_turno: zod_1.number().nullable(),
234
+ fecha_turno_invitacion: zod_1.string().nullable(),
235
+ hora_turno_invitacion: zod_1.string().nullable(),
236
+ firma_profesional: zod_1.string().nullable(),
237
+ id_especialidad: zod_1.number(),
238
+ especialidad: zod_1.string(),
239
+ motivo: zod_1.string(),
240
+ enfermedad_actual: zod_1.string(),
241
+ conducta_terapeutica: zod_1.string(),
242
+ signos_alerta: zod_1.string(),
243
+ motivo_extendido_consulta: zod_1.string(),
244
+ presencial_requerida: zod_1.string(),
245
+ derivada: zod_1.string(),
246
+ derivada_id_especialidad: zod_1.string(),
247
+ derivada_presencial_obligatoria: zod_1.string(),
248
+ derivada_comentarios: zod_1.string().nullable(),
249
+ diagnostico: zod_1.array(zod_1.any()),
250
+ practicas: zod_1.array(zod_1.any()),
251
+ link_medicacion: zod_1.array(zod_1.any()),
252
+ medicacion: zod_1.array(zod_1.any()),
253
+ link_receta: zod_1.string().nullable(),
254
+ link_compra: zod_1.string().nullable(),
255
+ identificador_receta: zod_1.string().nullable(),
256
+ codigo_verificacion_receta: zod_1.string().nullable(),
257
+ financiador: zod_1.string(),
258
+ registro_custom: zod_1.array(zod_1.any()),
259
+ pdf_medicacion: zod_1.array(zod_1.any()),
260
+ pdf_laboratorios: zod_1.any(),
261
+ pdf_otras: zod_1.any(),
262
+ pdf_imagenes: zod_1.any(),
263
+ uploads: zod_1.array(zod_1.any()),
264
+ files_atencion: zod_1.array(zod_1.any()),
265
+ motivo_cancelacion: zod_1.string().nullable(),
266
+ detalle_cancelacion: zod_1.string().nullable(),
267
+ documentos: zod_1.string(),
268
+ snapshot_paciente: zod_1.any().nullable(),
269
+ snapshot_profesional: zod_1.any().nullable(),
270
+ id_consultorio: zod_1.number(),
271
+ token: zod_1.string(),
272
+ tipo_protocolo_seguimiento: zod_1.string().nullable(),
273
+ custom_1: zod_1.any().nullable(),
274
+ custom_2: zod_1.any().nullable(),
275
+ custom_3: zod_1.any().nullable(),
276
+ custom_4: zod_1.any().nullable(),
277
+ custom_5: zod_1.any().nullable(),
278
+ form_data: zod_1.object({}),
279
+ ubicacion: zod_1.string(),
280
+ link_full: zod_1.string(),
281
+ timestamp: zod_1.string(),
282
+ });
187
283
  exports.doc24Schemas = {
188
284
  identificationType,
189
285
  sdkCredentials,
@@ -268,6 +364,7 @@ exports.doc24Schemas = {
268
364
  patientId: zod_1.number(),
269
365
  vcToken: zod_1.string(),
270
366
  }),
367
+ consultation,
271
368
  professional: zod_1.object({
272
369
  id: zod_1.number(),
273
370
  firstName: zod_1.string(),
package/lib/types.d.ts CHANGED
@@ -25,6 +25,7 @@ export declare namespace Doc24 {
25
25
  type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
26
26
  type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
27
27
  type CoverageInfo = TypeOf<typeof doc24Schemas.coverageInfo>;
28
+ type Consultation = TypeOf<typeof doc24Schemas.consultation>;
28
29
  type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
29
30
  type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
30
31
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
@@ -38,6 +39,7 @@ export declare namespace Doc24 {
38
39
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
39
40
  enroll: (params: EnrollmentParams) => Promise<void>;
40
41
  getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
42
+ getConsultation: (consultationId: number) => Promise<Consultation | null>;
41
43
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
42
44
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
43
45
  getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.39.4",
3
+ "version": "0.39.6",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },
@@ -1,177 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
- externalLogin: (params: {
4
- user: string;
5
- password: string;
6
- }) => Promise<{
7
- firstName: string;
8
- lastName: string;
9
- countryId: string;
10
- gender: "m" | "f" | "o";
11
- phone: string;
12
- email: string;
13
- birthday: Date;
14
- identificationNumber: string;
15
- }>;
16
- preExternalEnrollment: (params: ({
17
- birthdate: Date;
18
- identificationNumber: string;
19
- } & {
20
- phone: string;
21
- email: string;
22
- }) | ({
23
- birthdate: Date;
24
- identificationNumber: string;
25
- } & {
26
- phone?: undefined;
27
- email: string;
28
- }) | ({
29
- birthdate: Date;
30
- identificationNumber: string;
31
- } & {
32
- email?: undefined;
33
- phone: string;
34
- })) => Promise<void>;
35
- externalEnrollment: (params: ({
36
- birthdate: Date;
37
- identificationNumber: string;
38
- } & {
39
- phone: string;
40
- email: string;
41
- } & {
42
- password: string;
43
- } & {
44
- emailCode: string;
45
- phoneCode: string;
46
- }) | ({
47
- birthdate: Date;
48
- identificationNumber: string;
49
- } & {
50
- phone: string;
51
- email: string;
52
- } & {
53
- password: string;
54
- } & {
55
- phoneCode?: undefined;
56
- emailCode: string;
57
- }) | ({
58
- birthdate: Date;
59
- identificationNumber: string;
60
- } & {
61
- phone: string;
62
- email: string;
63
- } & {
64
- password: string;
65
- } & {
66
- emailCode?: undefined;
67
- phoneCode: string;
68
- }) | ({
69
- birthdate: Date;
70
- identificationNumber: string;
71
- } & {
72
- phone?: undefined;
73
- email: string;
74
- } & {
75
- password: string;
76
- } & {
77
- emailCode: string;
78
- phoneCode: string;
79
- }) | ({
80
- birthdate: Date;
81
- identificationNumber: string;
82
- } & {
83
- phone?: undefined;
84
- email: string;
85
- } & {
86
- password: string;
87
- } & {
88
- phoneCode?: undefined;
89
- emailCode: string;
90
- }) | ({
91
- birthdate: Date;
92
- identificationNumber: string;
93
- } & {
94
- phone?: undefined;
95
- email: string;
96
- } & {
97
- password: string;
98
- } & {
99
- emailCode?: undefined;
100
- phoneCode: string;
101
- }) | ({
102
- birthdate: Date;
103
- identificationNumber: string;
104
- } & {
105
- email?: undefined;
106
- phone: string;
107
- } & {
108
- password: string;
109
- } & {
110
- emailCode: string;
111
- phoneCode: string;
112
- }) | ({
113
- birthdate: Date;
114
- identificationNumber: string;
115
- } & {
116
- email?: undefined;
117
- phone: string;
118
- } & {
119
- password: string;
120
- } & {
121
- phoneCode?: undefined;
122
- emailCode: string;
123
- }) | ({
124
- birthdate: Date;
125
- identificationNumber: string;
126
- } & {
127
- email?: undefined;
128
- phone: string;
129
- } & {
130
- password: string;
131
- } & {
132
- emailCode?: undefined;
133
- phoneCode: string;
134
- })) => Promise<{
135
- firstName: string;
136
- lastName: string;
137
- countryId: string;
138
- gender: "m" | "f" | "o";
139
- phone: string;
140
- email: string;
141
- birthday: Date;
142
- identificationNumber: string;
143
- }>;
144
- sendExternalVerificationCode: (params: {
145
- birthdate: Date;
146
- channel: "1" | "2";
147
- identificationNumber: string;
148
- }) => Promise<void>;
149
- verifyExternalVerificationCode: (params: {
150
- code: string;
151
- birthdate: Date;
152
- channel: "1" | "2";
153
- identificationNumber: string;
154
- }) => Promise<any>;
155
- externalResetPassword: (params: ({
156
- birthdate: Date;
157
- password: string;
158
- identificationNumber: string;
159
- } & {
160
- emailCode: string;
161
- phoneCode: string;
162
- }) | ({
163
- birthdate: Date;
164
- password: string;
165
- identificationNumber: string;
166
- } & {
167
- phoneCode?: undefined;
168
- emailCode: string;
169
- }) | ({
170
- birthdate: Date;
171
- password: string;
172
- identificationNumber: string;
173
- } & {
174
- emailCode?: undefined;
175
- phoneCode: string;
176
- })) => Promise<any>;
177
- };
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExternalMethods = 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 getExternalMethods = (makeRequest) => {
9
- const externalLogin = async ({ user, password, }) => {
10
- const path = '/external-login';
11
- const response = await makeRequest('POST', path, { user, password });
12
- const info = response.data.login_info;
13
- return {
14
- firstName: info.firstname,
15
- lastName: info.lastname,
16
- countryId: info.country_id,
17
- birthday: new Date(Date.parse(info.birthdate)),
18
- identificationNumber: info.identification_number,
19
- gender: info.gender.toLowerCase(),
20
- email: info.email,
21
- phone: info.telephone,
22
- };
23
- };
24
- const preExternalEnrollment = async (params) => {
25
- const path = '/pre-external-enrollment';
26
- await makeRequest('POST', path, {
27
- identification_number: params.identificationNumber,
28
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
29
- email: params.email,
30
- telephone: params.phone,
31
- });
32
- return;
33
- };
34
- const externalEnrollment = async (params) => {
35
- const path = '/external-enrollment';
36
- const response = await makeRequest('POST', path, {
37
- identification_number: params.identificationNumber,
38
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
39
- email: params.email,
40
- telephone: params.phone,
41
- password: params.password,
42
- email_code: params.emailCode,
43
- telephone_code: params.phoneCode,
44
- });
45
- const info = response.data.info;
46
- return {
47
- firstName: info.firstname,
48
- lastName: info.lastname,
49
- countryId: info.country_id,
50
- birthday: new Date(Date.parse(info.birthdate)),
51
- identificationNumber: info.identification_number,
52
- gender: info.gender.toLowerCase(),
53
- email: info.email,
54
- phone: info.telephone,
55
- };
56
- };
57
- const sendExternalVerificationCode = async (params) => {
58
- const path = '/send-external-verification-code';
59
- await makeRequest('POST', path, {
60
- identification_number: params.identificationNumber,
61
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
62
- channel: params.channel,
63
- });
64
- return;
65
- };
66
- const verifyExternalVerificationCode = async (params) => {
67
- const path = '/verify-external-verification-code';
68
- const response = await makeRequest('POST', path, {
69
- identification_number: params.identificationNumber,
70
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
71
- channel: params.channel,
72
- code: params.code,
73
- });
74
- return response.data;
75
- };
76
- const externalResetPassword = async (params) => {
77
- const path = '/external-reset';
78
- const response = await makeRequest('POST', path, {
79
- identification_number: params.identificationNumber,
80
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
81
- password: params.password,
82
- email_code: params.emailCode,
83
- telephone_code: params.phoneCode,
84
- });
85
- return response.data;
86
- };
87
- return {
88
- externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
89
- preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
90
- externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
91
- sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
92
- verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
93
- externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
94
- };
95
- };
96
- exports.getExternalMethods = getExternalMethods;
@@ -1,34 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
- getExternalStudiesHistoryLink: (patient: {
4
- identificationType: "DNI";
5
- identificationValue: string;
6
- birthdate: Date;
7
- gender: "m" | "f" | "o";
8
- }) => Promise<string | null>;
9
- getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
10
- getExternalAppointments: () => Promise<{
11
- patientIdentification?: string | undefined;
12
- date: Date;
13
- birthdate: Date;
14
- appointment: string;
15
- id: number;
16
- specialty: string;
17
- patientName: string;
18
- clinic: string;
19
- professionalName: string;
20
- modality: string;
21
- }[]>;
22
- cancelExternalAppointment: (appointmentId: {
23
- patientIdentification?: string | undefined;
24
- date: Date;
25
- birthdate: Date;
26
- appointment: string;
27
- id: number;
28
- specialty: string;
29
- patientName: string;
30
- clinic: string;
31
- professionalName: string;
32
- modality: string;
33
- }) => Promise<void>;
34
- };
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExternalMethods = void 0;
4
- const date_fns_1 = require("date-fns");
5
- const zod_1 = require("zod");
6
- const validation_1 = require("../request/validation");
7
- const schemas_1 = require("../schemas");
8
- const utils_1 = require("../utils");
9
- const getExternalMethods = (makeRequest) => {
10
- const getExternalStudiesHistoryLink = async (patient) => {
11
- var _a, _b;
12
- const path = '/history-external-studies';
13
- const response = await makeRequest('POST', path, {
14
- patient: mapPatientData(patient),
15
- });
16
- return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
17
- };
18
- const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
19
- const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
20
- const response = await makeRequest('GET', path);
21
- return response.data.link;
22
- };
23
- const getExternalAppointments = async () => {
24
- const path = '/external-appointments';
25
- const response = await makeRequest('GET', path);
26
- return response.data.appointments.map((a) => ({
27
- id: a.appointment_id,
28
- patientIdentification: a.patient_id,
29
- patientName: a.patient_name,
30
- birthdate: utils_1.parseDate(a.birthdate),
31
- appointment: a.appointment,
32
- clinic: a.clinic,
33
- professionalName: a.professional,
34
- date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
35
- specialty: a.specialty,
36
- modality: a.modality,
37
- }));
38
- };
39
- const cancelExternalAppointment = async (appointment) => {
40
- const path = `/cancel-external-appointment`;
41
- await makeRequest('POST', path, {
42
- appointment_id: appointment.id,
43
- patient_id: appointment.patientIdentification,
44
- patient_name: appointment.patientName,
45
- birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
46
- appointment: appointment.appointment,
47
- clinic: appointment.clinic,
48
- professional: appointment.professionalName,
49
- day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
50
- hour: date_fns_1.format(appointment.date, 'HH:mm'),
51
- specialty: appointment.specialty,
52
- modality: appointment.modality,
53
- });
54
- return;
55
- };
56
- return {
57
- getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
58
- getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
59
- getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
60
- cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
61
- };
62
- };
63
- exports.getExternalMethods = getExternalMethods;
64
- const mapPatientData = (patient) => {
65
- return {
66
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
67
- id_type: 'dni',
68
- id_value: patient.identificationValue,
69
- gender: patient.gender.toLocaleUpperCase(),
70
- };
71
- };