@phenyxhealth/sdk 1.1.3 → 1.1.4

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.
@@ -158,7 +158,8 @@ await api.createResource({ name, author?, typeId, agenda }): Promise<void>
158
158
  api.getSendingDepartmentIdByName(name: string): string // throws si no existe
159
159
  api.getCie10IdByName(name: string): string // throws si no existe
160
160
  api.getCie10ByCode(code: string): GlobalInfoElement // throws si no existe
161
- api.getCie10CodeExists(name: string): boolean
161
+ api.getCie10IdByCode(code: string): string | null // null si no existe o no se facilita codigo
162
+ api.getCie10CodeExists(code: string): boolean
162
163
  api.getElementIdByName(type: string, name: string): string | null
163
164
  ```
164
165
 
@@ -470,6 +471,7 @@ for (const status of [
470
471
  - `login()` inicializa automaticamente: `globalInfo`, `activeTables`, `doctors`, `defaultDuration`, `defaultCompatibleLinacs`, y `oars`
471
472
  - Los metodos `get*ByName` buscan en los datos ya cargados en memoria (no hacen llamadas HTTP)
472
473
  - Los metodos `getSendingDepartmentIdByName`, `getCie10IdByName`, `getCie10ByCode` lanzan Error si no encuentran el elemento
474
+ - `getCie10IdByCode` retorna `null` si no existe el codigo o no se facilita
473
475
  - `getContrastingColor()` y `newId()` son metodos estaticos - se usan sin instancia: `PhenyxSDK.newId()`
474
476
  - **IDs en GlobalInfo**: Al hacer `push` de un elemento nuevo a `globalInfo.elements`, debes enviar un `id` (el servidor da error si no lo envias), pero el servidor lo ignora y asigna su propio ID. Siempre haz `getGlobalInfo()` despues de `updateGlobalInfo()` si necesitas referenciar los elementos creados
475
477
  - Las funciones de validacion (`beSureDoctorExists`, `beSureLinacsExists`, `checkGlobals`) crean automaticamente los recursos que no existan
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phenyxhealth/sdk",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
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
@@ -456,6 +456,12 @@ class PhenyxApi {
456
456
  return cie10;
457
457
  }
458
458
 
459
+ getCie10IdByCode = (code) => {
460
+ if (!code) return null;
461
+ const cie10 = this.getGlobalInfoElement(this.globalTypes.cie10, 'code', code);
462
+ return cie10?.id || null;
463
+ }
464
+
459
465
  getCie10CodeExists = (code) => {
460
466
  return !!this.getGlobalInfoElement(this.globalTypes.cie10, 'code', code);
461
467
  }
package/types/index.d.ts CHANGED
@@ -424,6 +424,13 @@ declare module "@phenyxhealth/sdk" {
424
424
  */
425
425
  getCie10ByCode(code: string): GlobalInfoElement;
426
426
 
427
+ /**
428
+ * Obtiene el ID de un CIE10 por su código
429
+ * @param code Código CIE10 (ej: 'C78.9')
430
+ * @returns ID del CIE10 o null si no existe o no se facilita código
431
+ */
432
+ getCie10IdByCode(code: string): string | null;
433
+
427
434
  /**
428
435
  * Obtiene el estado de peer review formateado
429
436
  * @param status Estado a formatear