# Examen Medico (1) - [obtain]

## 🧾 Descripción

*Este servicio permite **consultar los resultados del examen EMO** (Evaluación Médica Ocupacional) de un empleado utilizando su **DNI (passport\_number)**.*

*El servicio valida que el DNI haya sido enviado, busca la información correspondiente mediante el método interno `getExamenEmo()` y retorna los resultados si existen.*

*Es un servicio de consulta rápida y directa.*

---

## 🚀 Endpoint

### **POST /obtain**

---

## 📥 Request Body

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22passport_number%22%3A"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"passport_number"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"12345678"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### Campos:

<div class="_tableContainer_1rjym_1" id="bkmrk-campo-tipo-obligator"><div class="group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse" tabindex="-1"><table class="w-fit min-w-(--thread-content-width)" data-end="922" data-start="750"><thead data-end="794" data-start="750"><tr data-end="794" data-start="750"><th data-col-size="sm" data-end="758" data-start="750">Campo</th><th data-col-size="sm" data-end="765" data-start="758">Tipo</th><th data-col-size="sm" data-end="779" data-start="765">Obligatorio</th><th data-col-size="md" data-end="794" data-start="779">Descripción</th></tr></thead><tbody data-end="922" data-start="841"><tr data-end="922" data-start="841"><td data-col-size="sm" data-end="859" data-start="841">passport\_number</td><td data-col-size="sm" data-end="868" data-start="859">string</td><td data-col-size="sm" data-end="873" data-start="868">✔️</td><td data-col-size="md" data-end="922" data-start="873">DNI del empleado para consultar su examen EMO</td></tr></tbody></table>

</div></div>---

## 🔐 Seguridad

Este servicio **no requiere autenticación externa**, pero su funcionamiento depende de un método interno:

- `getExamenEmo(passport_number)` → Consulta la información del examen EMO.

---

## 🧠 Flujo del Servicio (Explicación)

1. **Validación inicial del DNI**
    
    
    - Si el parámetro `passport_number` no está presente, el servicio responde con error.
2. **Consulta del examen EMO**
    
    
    - Se llama al método interno `getExamenEmo($passport_number)`.
3. **Validación del resultado**
    
    
    - Si el método no retorna datos, se responde con un mensaje indicando que no se encontraron resultados.
4. **Respuesta exitosa**
    
    
    - Si sí existen resultados, se retorna el contenido del examen EMO.

---

## 📤 Response 200 – Ejemplos

### ✔️ Caso exitoso

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-true%2C-%22ms"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Se encontraron resultados"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"data"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span>    <span class="hljs-attr">"resultado"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Apto"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"fecha"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"2025-01-12"</span><span class="hljs-punctuation">,</span>    <span class="hljs-attr">"observaciones"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Ninguna"</span>  <span class="hljs-punctuation">}</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

### ❗ Error: DNI no enviado

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"El dni del empelado es obligatorio"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

### ❗ Error: Sin resultados EMO

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-1"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"No se encontraron resultados"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## ❗ Posibles Errores

<div class="_tableContainer_1rjym_1" id="bkmrk-c%C3%B3digo-motivo-descri"><div class="group _tableWrapper_1rjym_13 flex w-fit flex-col-reverse" tabindex="-1"><table class="w-fit min-w-(--thread-content-width)" data-end="2374" data-start="2117"><thead data-end="2150" data-start="2117"><tr data-end="2150" data-start="2117"><th data-col-size="sm" data-end="2126" data-start="2117">Código</th><th data-col-size="sm" data-end="2135" data-start="2126">Motivo</th><th data-col-size="md" data-end="2150" data-start="2135">Descripción</th></tr></thead><tbody data-end="2374" data-start="2185"><tr data-end="2242" data-start="2185"><td data-col-size="sm" data-end="2191" data-start="2185">400</td><td data-col-size="sm" data-end="2206" data-start="2191">DNI faltante</td><td data-col-size="md" data-end="2242" data-start="2206">No se envió el `passport_number`</td></tr><tr data-end="2312" data-start="2243"><td data-col-size="sm" data-end="2249" data-start="2243">404</td><td data-col-size="sm" data-end="2266" data-start="2249">Sin resultados</td><td data-col-size="md" data-end="2312" data-start="2266">El empleado no tiene examen EMO registrado</td></tr><tr data-end="2374" data-start="2313"><td data-col-size="sm" data-end="2319" data-start="2313">500</td><td data-col-size="sm" data-end="2345" data-start="2319">Error en método interno</td><td data-col-size="md" data-end="2374" data-start="2345">Fallo en `getExamenEmo()`</td></tr></tbody></table>

</div></div>---

## 📚 Schemas

### **Request Schema**

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22passport_number%22%3A-1"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"passport_number"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"string"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### **Response Schema (éxito)**

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-true%2C-%22ms-1"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">true</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Se encontraron resultados"</span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"data"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span> ...examen_emo <span class="hljs-punctuation">}</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>### **Response Schema (error)**

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-%7B-%22valor%22%3A-false%2C-%22m-2"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-punctuation">{</span>  <span class="hljs-attr">"valor"</span><span class="hljs-punctuation">:</span> <span class="hljs-literal"><span class="hljs-keyword">false</span></span><span class="hljs-punctuation">,</span>  <span class="hljs-attr">"msn"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"Descripción del error"</span><span class="hljs-punctuation">}</span>`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>---

## 🗃 Lógica en pseudocódigo

<div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary" id="bkmrk-if-%21passport_number%3A"><div class="sticky top-9"><div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"><div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"><table border="1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>`<span class="hljs-keyword">if</span> !passport_number:    <span class="hljs-keyword">return</span> error(<span class="hljs-string">"El dni del empleado es obligatorio"</span>)examen = getExamenEmo(passport_number)<span class="hljs-keyword">if</span> !examen:    <span class="hljs-keyword">return</span> error(<span class="hljs-string">"No se encontraron resultados"</span>)<span class="hljs-keyword">return</span> success(examen)`</td></tr></tbody></table>

</div></div></div><div class="overflow-y-auto p-4" dir="ltr"></div></div>