@phenyxhealth/sdk 1.0.4 → 1.0.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 CHANGED
@@ -238,6 +238,19 @@ import { getContrastingColor } from "@phenyxhealth/sdk";
238
238
  const color = getContrastingColor(); // '244, 67, 54' (formato RGB)
239
239
  ```
240
240
 
241
+ ### Obtener IDs de Elementos Globales
242
+
243
+ ```javascript
244
+ // Obtener ID de departamento emisor
245
+ const deptId = api.getSendingDepartmentIdByName("Oncología");
246
+
247
+ // Obtener ID de código CEI9
248
+ const cei9Id = api.getCei9IdByName("C78.9");
249
+
250
+ // Obtener ID de código CEI10
251
+ const cei10Id = api.getCei10IdByName("C78.9");
252
+ ```
253
+
241
254
  ## Funciones de Validación
242
255
 
243
256
  ### Validar Médicos
@@ -342,6 +355,7 @@ const processPatient = async () => {
342
355
  birthDate: "1980-01-15",
343
356
  sendingDepartmentId: api.getSendingDepartmentIdByName("Oncología"),
344
357
  cei9Id: api.getCei9IdByName("C78.9"),
358
+ cei10Id: api.getCei10IdByName("C78.9"),
345
359
  });
346
360
 
347
361
  // Cambiar estado del paciente
@@ -372,6 +386,13 @@ try {
372
386
  } catch (error) {
373
387
  console.error("Departamento no encontrado:", error.message);
374
388
  }
389
+
390
+ try {
391
+ const cei9Id = api.getCei9IdByName("C00.0");
392
+ const cei10Id = api.getCei10IdByName("C00.0");
393
+ } catch (error) {
394
+ console.error("Código CEI no encontrado:", error.message);
395
+ }
375
396
  ```
376
397
 
377
398
  ## TypeScript Support
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phenyxhealth/sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "SDK oficial para PhenyxHealth - Sistema integral de gestión de radioterapia. Incluye gestión de pacientes, recursos humanos, equipos médicos y configuración global.",
6
6
  "main": "./src/index.js",
package/src/PhenyxApi.js CHANGED
@@ -435,6 +435,22 @@ class PhenyxApi {
435
435
  return cei9.id;
436
436
  }
437
437
 
438
+ /**
439
+ * Obtiene el ID de un CEI10 por nombre
440
+ * @param {string} name - Nombre del CEI10
441
+ * @returns {string} ID del CEI10
442
+ * @throws {Error} Si no se encuentra el CEI10
443
+ * @example
444
+ * const cei10Id = api.getCei10IdByName('C78.9');
445
+ */
446
+ getCei10IdByName = (name) => {
447
+ const cei10 = this.getGlobalInfoElement(this.globalTypes.cei10, name);
448
+ if (!cei10) {
449
+ throw new Error(`CEI10 ${name} not found`);
450
+ }
451
+ return cei10.id;
452
+ }
453
+
438
454
  /**
439
455
  * Crea un nuevo paciente
440
456
  * @param {Object} data - Datos del paciente
package/types/index.d.ts CHANGED
@@ -127,6 +127,7 @@ declare module "@phenyxhealth/sdk" {
127
127
  birthDate: string;
128
128
  sendingDepartmentId?: string;
129
129
  cei9Id?: string;
130
+ cei10Id?: string;
130
131
  [key: string]: any;
131
132
  }
132
133
 
@@ -219,6 +220,8 @@ declare module "@phenyxhealth/sdk" {
219
220
  humanResources: GlobalType;
220
221
  sendingDepartment: GlobalType;
221
222
  cei9: GlobalType;
223
+ cei10: GlobalType;
224
+ cei10: GlobalType;
222
225
  treatmentClass: GlobalType;
223
226
  treatmentSubClass: GlobalType;
224
227
  treatmentTechnique: GlobalType;
@@ -413,6 +416,14 @@ declare module "@phenyxhealth/sdk" {
413
416
  */
414
417
  getCei9IdByName(name: string): string;
415
418
 
419
+ /**
420
+ * Obtiene el ID de un CEI10 por nombre
421
+ * @param name Nombre del CEI10
422
+ * @returns ID del CEI10
423
+ * @throws Error si no se encuentra el CEI10
424
+ */
425
+ getCei10IdByName(name: string): string;
426
+
416
427
  /**
417
428
  * Obtiene el estado de peer review formateado
418
429
  * @param status Estado a formatear