Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Entrambe le parti precedenti la revisioneRevisione precedenteProssima revisione | Revisione precedente | ||
docuneo:programma_npt [2025/07/31 22:21] – neoadmin | docuneo:programma_npt [2025/08/02 21:46] (versione attuale) – neoadmin | ||
---|---|---|---|
Linea 3: | Linea 3: | ||
<meta charset=" | <meta charset=" | ||
<meta name=" | <meta name=" | ||
- | < | + | < |
+ | <script src=" | ||
< | < | ||
body { | body { | ||
Linea 26: | Linea 27: | ||
border-bottom: | border-bottom: | ||
padding-bottom: | padding-bottom: | ||
+ | } | ||
+ | |||
+ | .version-info { | ||
+ | text-align: center; | ||
+ | font-size: 12px; | ||
+ | color: #7f8c8d; | ||
+ | margin-bottom: | ||
} | } | ||
Linea 210: | Linea 218: | ||
.hidden { | .hidden { | ||
- | display: none !important; | + | display: none; |
- | } | + | |
- | + | ||
- | .visible { | + | |
- | display: block !important; | + | |
} | } | ||
- | /* CSS TAB ORIZZONTALI */ | + | /* CSS TAB ORIZZONTALI |
.tabs { | .tabs { | ||
display: flex; | display: flex; | ||
Linea 226: | Linea 230: | ||
.tab { | .tab { | ||
- | padding: | + | padding: |
background-color: | background-color: | ||
border: 1px solid #ddd; | border: 1px solid #ddd; | ||
Linea 234: | Linea 238: | ||
transition: all 0.3s ease; | transition: all 0.3s ease; | ||
text-align: center; | text-align: center; | ||
- | min-width: | + | min-width: |
flex: 1; | flex: 1; | ||
- | max-width: | + | max-width: |
+ | font-size: 12px; | ||
} | } | ||
Linea 311: | Linea 316: | ||
} | } | ||
- | | + | .config-table { |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
font-size: 12px; | font-size: 12px; | ||
- | line-height: | ||
- | max-width: 800px; | ||
- | margin: 0 auto; | ||
- | border: 1px solid #ddd; | ||
} | } | ||
- | .report-header | + | .config-table th, .config-table td { |
- | display: flex; | + | border: |
- | justify-content: | + | padding: |
- | align-items: | + | |
- | border-bottom: 2px solid #333; | + | |
- | padding-bottom: 10px; | + | |
- | | + | |
} | } | ||
- | .report-header-left | + | .config-table th { |
- | | + | |
+ | color: white; | ||
} | } | ||
- | .report-header-right | + | .config-table input { |
- | width: 100px; | + | width: 60px; |
- | height: 60px; | + | |
- | | + | border: 1px solid #ddd; |
- | border: 1px solid #ccc; | + | |
- | | + | |
- | align-items: center; | + | |
- | justify-content: | + | |
- | font-size: 10px; | + | |
- | color: #666; | + | |
} | } | ||
- | .report-title { | + | .component-name { |
- | font-size: 14px; | + | |
font-weight: | font-weight: | ||
- | | + | |
+ | text-align: left !important; | ||
} | } | ||
- | .report-subtitle | + | |
- | | + | |
- | | + | |
- | | + | |
+ | | ||
+ | padding: 20px; | ||
+ | margin: 20px 0; | ||
} | } | ||
- | .report-section | + | .config-advanced h3 { |
- | margin-bottom: | + | color: #0c5460; |
+ | margin-top: 0; | ||
+ | border-bottom: | ||
+ | padding-bottom: | ||
} | } | ||
- | .report-section-title { | + | .monitoring-table { |
- | background-color: | + | |
- | color: white; | + | |
- | padding: 5px 10px; | + | |
- | font-weight: | + | |
- | font-size: 12px; | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-table { | + | |
width: 100%; | width: 100%; | ||
border-collapse: | border-collapse: | ||
- | font-size: | + | |
+ | | ||
} | } | ||
- | .report-table td { | + | .monitoring-table th, .monitoring-table td { |
- | padding: 3px 8px; | + | border: 1px solid #17a2b8; |
- | border-bottom: 1px solid #ddd; | + | padding: 8px; |
- | | + | |
} | } | ||
- | .report-table | + | .monitoring-table |
- | | + | |
- | | + | |
} | } | ||
- | .report-table .value-col | + | .alert-critical |
- | | + | |
+ | color: white; | ||
+ | padding: 15px; | ||
+ | border-radius: | ||
+ | margin: 15px 0; | ||
font-weight: | font-weight: | ||
} | } | ||
- | .composition-table { | + | |
- | | + | |
- | border-collapse: collapse; | + | |
- | | + | border-radius: 10px; |
- | margin-top: | + | |
+ | margin-top: | ||
+ | background-color: | ||
+ | font-family: | ||
+ | line-height: | ||
} | } | ||
- | .composition-table th { | + | .medical-header |
- | background-color: | + | |
- | padding: 5px 8px; | + | |
text-align: center; | text-align: center; | ||
- | | + | |
- | | + | |
+ | margin-bottom: | ||
} | } | ||
- | .composition-table td { | + | .medical-header h1 { |
- | | + | |
- | | + | |
- | | + | |
} | } | ||
- | .composition-table .component-name-col | + | .medical-header h2 { |
- | | + | |
- | | + | color: #34495e; |
+ | | ||
} | } | ||
- | .composition-total { | + | .medical-header p { |
- | | + | |
- | | + | |
+ | | ||
} | } | ||
- | .elements-table { | + | .no-print { |
- | | + | |
- | border-collapse: | + | |
- | font-size: 11px; | + | |
- | margin-top: 0; | + | |
- | } | + | |
- | + | ||
- | .elements-table td { | + | |
- | padding: 3px 8px; | + | |
- | border-bottom: | + | |
- | } | + | |
- | + | ||
- | .elements-table .element-name { | + | |
- | width: 200px; | + | |
- | } | + | |
- | + | ||
- | .elements-table .element-value { | + | |
- | text-align: right; | + | |
- | font-weight: | + | |
- | width: 80px; | + | |
- | } | + | |
- | + | ||
- | .elements-table .element-unit { | + | |
- | text-align: left; | + | |
- | width: 40px; | + | |
- | font-size: 10px; | + | |
- | } | + | |
- | + | ||
- | .report-footer { | + | |
- | margin-top: 30px; | + | |
- | padding-top: | + | |
- | border-top: 1px solid #ddd; | + | |
- | font-size: 10px; | + | |
- | color: #666; | + | |
- | text-align: center; | + | |
} | } | ||
@media print { | @media print { | ||
- | .npt-report | + | .no-print { |
- | | + | |
- | border: none; | + | |
- | margin: 0; | + | |
- | padding: 15px; | + | |
} | } | ||
- | | + | |
- | .button | + | |
- | | + | |
} | } | ||
- | | + | .container |
- | | + | |
- | | + | |
} | } | ||
} | } | ||
Linea 484: | Linea 446: | ||
<div class=" | <div class=" | ||
- | < | + | < |
+ | <div class=" | ||
+ | < | ||
+ | </div> | ||
| | ||
- | <!-- TAB ORIZZONTALI --> | + | <!-- TAB ORIZZONTALI |
<div class=" | <div class=" | ||
<div class=" | <div class=" | ||
- | <span style=" | + | <span style=" |
</ | </ | ||
+ | | ||
+ | <!-- SEZIONE CONFIGURAZIONE COMPONENTI (DA VERSIONE 17) --> | ||
<div class=" | <div class=" | ||
- | <span style=" | + | <span style=" |
</ | </ | ||
<div class=" | <div class=" | ||
- | <span style=" | + | <span style=" |
</ | </ | ||
<div class=" | <div class=" | ||
- | <span style=" | + | <span style=" |
+ | </ | ||
+ | <div class=" | ||
+ | <span style=" | ||
</ | </ | ||
<div class=" | <div class=" | ||
- | <span style=" | + | <span style=" |
</ | </ | ||
</ | </ | ||
- | <!-- TAB 1: DATI PAZIENTE --> | + | <!-- TAB 1: DATI PAZIENTE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 522: | Linea 492: | ||
<label for=" | <label for=" | ||
<select id=" | <select id=" | ||
- | <option value=""> | + | <!-- Popolato dinamicamente --> |
- | <option value=" | + | |
- | <option value=" | + | |
- | <option value=" | + | |
- | <option value=" | + | |
- | <option value=" | + | |
- | <option value=" | + | |
</ | </ | ||
</ | </ | ||
Linea 557: | Linea 521: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
</ | </ | ||
<div class=" | <div class=" | ||
Linea 610: | Linea 574: | ||
</ | </ | ||
- | <!-- TAB 2: NUTRIZIONE ENTERALE --> | + | <!-- TAB 2: NUTRIZIONE ENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 709: | Linea 673: | ||
</ | </ | ||
- | <!-- TAB 3: CALCOLO FABBISOGNI --> | + | <!-- TAB 3: CALCOLO FABBISOGNI |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 839: | Linea 803: | ||
</ | </ | ||
- | <!-- TAB 4: NUTRIZIONE PARENTERALE --> | + | <!-- TAB 4: NUTRIZIONE PARENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 881: | Linea 845: | ||
<div id=" | <div id=" | ||
| | ||
- | <div style=" | + | <div style=" |
- | | + | <button class=" |
- | <p style=" | + | <button class=" |
- | <div style=" | + | |
- | | + | |
- | <button id=" | + | |
- | < | + | |
- | </div> | + | |
</ | </ | ||
- | | ||
- | <div id=" | ||
- | <div id=" | ||
</ | </ | ||
</ | </ | ||
- | <!-- TAB 5: CONFIGURAZIONE | + | <!-- TAB 5: REPORT FINALE (SPOSTATO DA TAB 6) --> |
- | <div id="config" class=" | + | <div id="report" class=" |
<div class=" | <div class=" | ||
- | < | + | < |
- | < | + | < |
</ | </ | ||
| | ||
+ | <div class=" | ||
+ | < | ||
+ | <button class=" | ||
+ | <button class=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | | ||
+ | <div id=" | ||
+ | </ | ||
+ | |||
+ | <!-- TAB 6: CONFIGURAZIONE (SPOSTATO DA TAB 5) --> | ||
+ | <div id=" | ||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | </ | ||
<div class=" | <div class=" | ||
< | < | ||
Linea 909: | Linea 881: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
</ | </ | ||
<div class=" | <div class=" | ||
Linea 923: | Linea 895: | ||
</ | </ | ||
</ | </ | ||
+ | | ||
<div class=" | <div class=" | ||
< | < | ||
<div style=" | <div style=" | ||
- | <table class=" | + | <table class=" |
< | < | ||
<tr> | <tr> | ||
Linea 940: | Linea 912: | ||
< | < | ||
< | < | ||
+ | < | ||
</tr> | </tr> | ||
</ | </ | ||
- | < | + | < |
+ | <!-- Popolato dinamicamente --> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <button id=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | <div style=" | ||
+ | <table class=" | ||
+ | <thead> | ||
<tr> | <tr> | ||
- | <td><strong>Latte Materno</strong></td> | + | <th style=" |
- | <td>1.2</td> | + | < |
- | <td>7.0</td> | + | < |
- | <td>4.0</td> | + | <th>Lipidi< |
- | <td>0.007</td> | + | <th>Sodio< |
- | <td>0.035</td> | + | <th>Potassio< |
- | <td>28.0</td> | + | <th>Calcio< |
- | <td>15.0</td> | + | <th>Fosforo< |
- | <td>3.0</td> | + | <th>Magnesio< |
- | <td>67</td> | + | <th> |
+ | <th style=" | ||
+ | <th>Azioni</th> | ||
</tr> | </tr> | ||
+ | </ | ||
+ | <tbody id=" | ||
<tr> | <tr> | ||
- | <td>< | + | < |
- | <td>2.6</td> | + | < |
- | < | + | < |
- | < | + | < |
- | <td>0.009</td> | + | < |
- | < | + | < |
- | <td>63.0</td> | + | < |
- | < | + | < |
- | <td>4.5</ | + | < |
- | < | + | < |
- | </ | + | < |
- | < | + | < |
- | < | + | |
- | <td>1.3</td> | + | |
- | < | + | |
- | <td>3.5</ | + | |
- | <td>0.024</ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | <td>6.56</td> | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | <td>0.020</td> | + | |
- | < | + | |
- | <td>59.0</td> | + | |
- | < | + | |
- | <td>5.0</td> | + | |
- | < | + | |
- | </ | + | |
- | <tr> | + | |
- | < | + | |
- | <td>1.8</td> | + | |
- | < | + | |
- | <td>3.6</td> | + | |
- | < | + | |
- | <td>0.075</td> | + | |
- | < | + | |
- | <td>36.0</td> | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | <td>1.7</td> | + | |
- | < | + | |
- | <td>3.7</td> | + | |
- | | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | <td>1.9</td> | + | |
- | < | + | |
- | < | + | |
- | <td>0.015</td> | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | <td>101</td> | + | |
</tr> | </tr> | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
- | <div class=" | + | <div class=" |
- | <strong>ℹ️ Informazioni: | + | <div class="form-col"> |
+ | <button id=" | ||
+ | </div> | ||
+ | <div class=" | ||
+ | <button class=" | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Linea 1062: | Linea 981: | ||
< | < | ||
<div style=" | <div style=" | ||
- | <table class=" | + | <table class=" |
< | < | ||
<tr> | <tr> | ||
- | <th style=" | + | <th style=" |
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
< | < | ||
< | < | ||
< | < | ||
- | <th>Sodio<br>(mEq)</ | + | <th>Energia<br>(kcal)</ |
- | <th>Potassio<br>(mEq)</ | + | <th>Acqua<br>(ml)</ |
- | <th style=" | + | <th style=" |
+ | < | ||
</tr> | </tr> | ||
</ | </ | ||
- | < | + | < |
+ | <!-- Popolato dinamicamente --> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <button id=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | <div class=" | ||
+ | < | ||
+ | Gestisci la lista dei medici prescrittori. Le modifiche si applicano automaticamente alla dropdown del TAB 1. | ||
+ | </ | ||
+ | <div style=" | ||
+ | <table class=" | ||
+ | <thead> | ||
<tr> | <tr> | ||
- | <td>< | + | <th style=" |
- | <td>840</td> | + | <th style=" |
- | <td>0</td> | + | <th style=" |
- | <td>0</td> | + | <th style=" |
- | <td>0</ | + | <th>Azioni</th> |
- | < | + | |
- | < | + | |
</tr> | </tr> | ||
+ | </ | ||
+ | <tbody id=" | ||
+ | <!-- Popolato dinamicamente --> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <button id=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <!-- SEZIONE CONFIGURAZIONE CLINICA AVANZATA (NOVITÀ) --> | ||
+ | <div class=" | ||
+ | < | ||
+ | | ||
+ | <div class=" | ||
+ | < | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <span style=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <button class=" | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | <table class=" | ||
+ | < | ||
<tr> | <tr> | ||
- | <td>< | + | <th>Controllo</th> |
- | <td>0</td> | + | <th>Frequenza</th> |
- | <td>1600</td> | + | <th>Range Normale</th> |
- | <td>0</ | + | <th>Azione se Fuori Range</th> |
- | < | + | |
- | < | + | |
- | < | + | |
</tr> | </tr> | ||
+ | </ | ||
+ | < | ||
<tr> | <tr> | ||
- | < | + | < |
- | <td>0</ | + | <td>Ogni 6-8h</ |
- | <td>0</td> | + | <td>70-110 mg/dL</ |
- | < | + | <td>Aggiustare velocità glucosio</td> |
- | <td>0</ | + | |
- | < | + | |
- | < | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | < |
- | <td>0</ | + | <td>Ogni 24-48h</ |
- | < | + | <td>Na: 135-145, K: 3.5-5.0</ |
- | <td>0</ | + | <td>Modificare apporti NPT</td> |
- | < | + | |
- | < | + | |
- | < | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | < |
- | <td>0</ | + | <td>Ogni 48h</ |
- | <td>0</td> | + | <td>BUN: 9-14 mg/dL</ |
- | <td>0</ | + | <td>Aggiustare proteine</td> |
- | <td>667</ | + | |
- | < | + | |
- | <td>2 mEq/mL - Alcalinizzante per acidosi</td> | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | < |
- | <td>0</td> | + | <td>2 volte/settimana</ |
- | <td>0</ | + | <td>< 150 mg/dL</ |
- | <td>0</td> | + | <td>Ridurre lipidi se > 200</td> |
- | <td>0</ | + | |
- | <td>1000</ | + | |
- | <td>2 mEq/mL - Max vel. 0.5 mEq/kg/h</td> | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | < |
- | <td>0</ | + | <td>Settimanale</ |
- | <td>0</td> | + | <td>AST/ALT normali</ |
- | <td>0</ | + | <td>Valutare sospensione NPT</td> |
- | <td>0</ | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
</tr> | </tr> | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
- | | + | |
- | < | + | |
+ | < | ||
+ | <div class="alert-critical"> | ||
+ | < | ||
+ | • Glicemia > 250 mg/dL o < 40 mg/ | ||
+ | • Trigliceridi > 400 mg/ | ||
+ | • AST/ALT > 3x valore normale< | ||
+ | • Segni di sepsi cateter-correlata< | ||
+ | • Edema importante con bilancio positivo > 20 ml/kg/die | ||
+ | | ||
+ | |||
+ | <div class=" | ||
+ | | ||
+ | • GIR > 12 mg/kg/min → Ridurre glucosio< | ||
+ | • BUN > 20 mg/dL → Ridurre proteine< | ||
+ | • BUN < 5 mg/dL → Aumentare proteine< | ||
+ | • Trigliceridi 200-400 mg/dL → Ridurre/ | ||
+ | • Ipernatremia → Ridurre sodio, aumentare liquidi liberi | ||
+ | </ | ||
</ | </ | ||
- | </ | ||
- | | + | |
- | <h2>Lista Medici Prescrittori</ | + | <h2>Impostazioni Ospedale</ |
- | <div class=" | + | <div class=" |
- | <strong>🩺 Database Medici:</strong> Lista dei medici autorizzati alla prescrizione NPT. Questi nomi appaiono nella dropdown del TAB 1. | + | <div class="form-col"> |
- | | + | <div class=" |
- | <div style="overflow-x: auto;"> | + | |
- | <table class="results-table" style=" | + | <input type="text" |
- | <thead> | + | </div> |
- | <tr> | + | <div class=" |
- | <th>Nome</th> | + | <label for=" |
- | <th>Cognome</th> | + | <input type=" |
- | <th>Titolo</th> | + | |
- | <th>Nome Completo (Visualizzato)</ | + | <div class=" |
- | </tr> | + | <label for=" |
- | </thead> | + | <input type=" |
- | <tbody> | + | </div> |
- | <tr><td>Roberto</td><td>Bellù</td>< | + | </div> |
- | | + | <div class=" |
- | <tr><td>Carla</td><td>Maccioni</td>< | + | <div class=" |
- | < | + | |
- | | + | |
- | <tr>< | + | |
- | </tbody> | + | |
- | | + | |
+ | </div> | ||
+ | <div class=" | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </select> | ||
+ | </div> | ||
+ | | ||
+ | | ||
+ | <button class=" | ||
+ | <button class=" | ||
</ | </ | ||
</ | </ | ||
- | <div class=" | + | < |
- | <h2>Informazioni Sistema</h2> | + | <h3>Stato Configurazione v3.0</h3> |
- | < | + | < |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | | + | |
</ | </ | ||
</ | </ | ||
Linea 1198: | Linea 1206: | ||
< | < | ||
- | // DATI NUTRIZIONALI COMPLETI | + | // DATI NUTRIZIONALI COMPLETI |
const formulaData = { | const formulaData = { | ||
maternal: { name: "Latte Materno", | maternal: { name: "Latte Materno", | ||
Linea 1211: | Linea 1219: | ||
}; | }; | ||
- | // CONFIGURAZIONI PARENTERALI COMPLETE | + | // CONFIGURAZIONI PARENTERALI COMPLETE |
const parenteralConfig = { | const parenteralConfig = { | ||
+ | trophamine: { | ||
+ | name: " | ||
+ | protein: 6.0, carbs: 0, lipids: 0, sodium: 0, potassium: 0, | ||
+ | calcium: 0, phosphorus: 0, magnesium: 0, energy: 24, water: 94, | ||
+ | description: | ||
+ | notes: " | ||
+ | }, | ||
+ | intralipid: { | ||
+ | name: " | ||
+ | protein: 0, carbs: 0, lipids: 20.0, sodium: 0, potassium: 0, | ||
+ | calcium: 0, phosphorus: 0, magnesium: 0, energy: 200, water: 80, | ||
+ | description: | ||
+ | notes: " | ||
+ | }, | ||
+ | glucose50: { | ||
+ | name: " | ||
+ | protein: 0, carbs: 50.0, lipids: 0, sodium: 0, potassium: 0, | ||
+ | calcium: 0, phosphorus: 0, magnesium: 0, energy: 200, water: 50, | ||
+ | description: | ||
+ | notes: " | ||
+ | }, | ||
ca_gluconato: | ca_gluconato: | ||
- | name: " | + | name: " |
- | | + | |
- | | + | |
+ | description: | ||
+ | notes: "8.4 mg Ca/ml. Non precipita con fosfati" | ||
}, | }, | ||
esafosfina: { | esafosfina: { | ||
- | name: " | + | name: " |
- | | + | |
- | | + | |
+ | description: | ||
+ | notes: "16 mg P/ml + 1.3 mEq Na/ml. Fosforo organico" | ||
}, | }, | ||
mg_sulfate: { | mg_sulfate: { | ||
- | name: " | + | name: " |
- | | + | |
- | | + | |
+ | description: | ||
+ | notes: "8 mEq Mg/ml. Cofattore enzimatico" | ||
}, | }, | ||
nacl: { | nacl: { | ||
- | name: "Sodio Cloruro", | + | name: "Sodio Cloruro |
- | | + | |
- | | + | |
+ | description: | ||
+ | notes: "10 mEq Na/ml. Prima scelta per supplementazione sodio" | ||
}, | }, | ||
sodium_acetate: | sodium_acetate: | ||
- | name: "Sodio Acetato", | + | name: "Sodio Acetato |
- | | + | |
- | | + | |
+ | description: | ||
+ | notes: "6.67 mEq Na/ml. Per acidosi: pH < 7.25 o BE < -4" | ||
}, | }, | ||
kcl: { | kcl: { | ||
- | name: " | + | name: " |
- | | + | |
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 99 | + | calcium: 0, phosphorus: 0, magnesium: 0, energy: 0, water: 99, |
+ | description: | ||
+ | notes: "10 mEq K/ml. Max velocità infusione: 0.5 mEq/ | ||
+ | }, | ||
+ | carnitene: { | ||
+ | name: " | ||
+ | protein: 0, carbs: 0, lipids: 0, sodium: 0, potassium: 0, | ||
+ | calcium: 0, phosphorus: 0, magnesium: 0, energy: 0, water: 99, | ||
+ | carnitine: 10000, // 100 mg/ml = 10000 mg/100ml | ||
+ | description: | ||
+ | notes: "100 mg/ml. Indicata per NPT > 1 mese. Dose: 5 mg/ | ||
} | } | ||
}; | }; | ||
- | // Database medici | + | // Database fortificanti dinamico |
- | const doctorsData = { | + | let fortifierData = { |
+ | prenidina_fm85: | ||
+ | name: " | ||
+ | protein: 14, carbs: 4, lipids: 2.5, sodium: 2, potassium: 15, | ||
+ | calcium: 3500, phosphorus: 2000, magnesium: 150, energy: 400, | ||
+ | dose: " | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | // Database medici | ||
+ | let doctorsData = { | ||
dr_bellu: { name: " | dr_bellu: { name: " | ||
dr_condo: { name: " | dr_condo: { name: " | ||
Linea 1252: | Linea 1311: | ||
dr_meroni: { name: " | dr_meroni: { name: " | ||
dr_calzatini: | dr_calzatini: | ||
- | dr_ferrari: { name: " | + | dr_ferrari: { name: " |
+ | dr_ferendeles: | ||
+ | dr_fumagalli_l: | ||
+ | dr_fumagalli_m: | ||
+ | dr_corno: { name: " | ||
+ | dr_evasi: { name: " | ||
+ | dr_cereda: { name: " | ||
+ | dr_ceccon: { name: " | ||
+ | dr_nava: { name: " | ||
+ | dr_terenzi: { name: " | ||
+ | dr_raffa: { name: " | ||
+ | dr_aquisti: { name: " | ||
}; | }; | ||
Linea 1258: | Linea 1328: | ||
let patientData = {}; | let patientData = {}; | ||
let enteralData = null; | let enteralData = null; | ||
- | window.currentActiveReport | + | let currentRequirements |
- | // INIZIALIZZAZIONE | + | // CONFIGURAZIONE CLINICA AVANZATA (NUOVO) |
- | document.addEventListener('DOMContentLoaded', function() { | + | let clinicalConfig = { |
- | // Imposta data odierna | + | calciumReq: 160, |
- | const today = new Date().toISOString().split('T')[0]; | + | phosphorusReq: |
- | document.getElementById(' | + | magnesiumReq: |
- | }); | + | maxGIR: 12.0, |
+ | maxLipids: 3.0, | ||
+ | maxProtein: 4.5, | ||
+ | hospitalName: | ||
+ | departmentName: | ||
+ | directorName: | ||
+ | }; | ||
+ | |||
+ | // FUNZIONE RESET PULSANTE FABBISOGNI | ||
+ | function resetNutritionButton() { | ||
+ | const nutritionBtn = document.getElementById('calculateNutritionBtn'); | ||
+ | if (nutritionBtn) { | ||
+ | nutritionBtn.className = ' | ||
+ | nutritionBtn.innerHTML = ' | ||
+ | |||
+ | // Nascondi i risultati precedenti | ||
+ | const nutritionResults = document.getElementById(' | ||
+ | if (nutritionResults) { | ||
+ | nutritionResults.classList.add(' | ||
+ | } | ||
+ | |||
+ | // Reset anche il pulsante NPT perché i fabbisogni sono cambiati | ||
+ | resetParenteralButton(); | ||
+ | | ||
+ | } | ||
+ | |||
+ | // FUNZIONE RESET PULSANTE PARENTERALE | ||
+ | function resetParenteralButton() { | ||
+ | const parenteralBtn | ||
+ | if (parenteralBtn) { | ||
+ | parenteralBtn.className = ' | ||
+ | parenteralBtn.innerHTML = ' | ||
+ | |||
+ | // Reset anche i campi visualizzati | ||
+ | document.getElementById(' | ||
+ | document.getElementById('suggestedGlucose').value = " | ||
+ | document.getElementById(' | ||
+ | | ||
+ | |||
+ | // Nascondi i risultati precedenti | ||
+ | const parenteralResults = document.getElementById(' | ||
+ | if (parenteralResults) { | ||
+ | parenteralResults.classList.add(' | ||
+ | } | ||
+ | } | ||
+ | } | ||
- | // FUNZIONE TAB | + | // FUNZIONE |
function showTab(tabId) { | function showTab(tabId) { | ||
- | // Rimuovi classe active da tutti i contenuti | + | // Nascondi |
document.querySelectorAll(' | document.querySelectorAll(' | ||
content.classList.remove(' | content.classList.remove(' | ||
}); | }); | ||
| | ||
- | // Rimuovi classe active da tutte le tab | + | // Rimuovi classe active da tutti i tab |
document.querySelectorAll(' | document.querySelectorAll(' | ||
tab.classList.remove(' | tab.classList.remove(' | ||
}); | }); | ||
| | ||
- | // Mostra il contenuto selezionato | + | // Mostra il contenuto |
const targetContent = document.getElementById(tabId); | const targetContent = document.getElementById(tabId); | ||
if (targetContent) { | if (targetContent) { | ||
Linea 1285: | Linea 1400: | ||
} | } | ||
| | ||
- | // Attiva la tab cliccata | + | // Trova e attiva il tab cliccato |
- | event.target.closest(' | + | |
+ | if (clickedTab) { | ||
+ | clickedTab.classList.add(' | ||
+ | } | ||
+ | |||
+ | // Popola le tabelle di configurazione quando si apre il TAB 6 (ora config) | ||
+ | if (tabId === ' | ||
+ | setTimeout(() => { | ||
+ | populateEnteralConfigTable(); | ||
+ | populateParenteralConfigTable(); | ||
+ | populateDoctorsConfigTable(); | ||
+ | }, 100); | ||
+ | } | ||
} | } | ||
- | // FUNZIONE CALCOLO FASE | + | // FUNZIONE GESTIONE CARTELLA CLINICA |
+ | function setupMedicalRecordField() { | ||
+ | const medicalRecordInput = document.getElementById(' | ||
+ | const currentYear = new Date().getFullYear().toString(); | ||
+ | |||
+ | // Imposta il valore iniziale con l'anno corrente | ||
+ | if (!medicalRecordInput.value) { | ||
+ | medicalRecordInput.value = currentYear; | ||
+ | } | ||
+ | |||
+ | // Gestisce l' | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | let value = e.target.value.replace(/ | ||
+ | |||
+ | // Se l' | ||
+ | if (value.length < 4 || !value.startsWith(currentYear)) { | ||
+ | value = currentYear + value.slice(4); | ||
+ | } | ||
+ | |||
+ | // Limita a 10 cifre totali | ||
+ | if (value.length > 10) { | ||
+ | value = value.slice(0, | ||
+ | } | ||
+ | |||
+ | e.target.value = value; | ||
+ | }); | ||
+ | |||
+ | // Quando il campo ottiene il focus, posiziona il cursore dopo l' | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | if (e.target.value === currentYear) { | ||
+ | // Posiziona il cursore alla fine | ||
+ | setTimeout(() => { | ||
+ | e.target.setSelectionRange(4, | ||
+ | }, 0); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Suggerimento visivo | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | if (e.target.value === currentYear) { | ||
+ | e.target.placeholder = currentYear + ' | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function updateDoctorsDropdown() { | ||
+ | const prescribingDoctorSelect = document.getElementById(' | ||
+ | if (!prescribingDoctorSelect) return; | ||
+ | |||
+ | const currentValue = prescribingDoctorSelect.value; | ||
+ | prescribingDoctorSelect.innerHTML = '< | ||
+ | |||
+ | Object.keys(doctorsData).forEach(function(key) { | ||
+ | const doctor = doctorsData[key]; | ||
+ | const option = document.createElement(' | ||
+ | option.value = key; | ||
+ | option.textContent = doctor.fullName; | ||
+ | prescribingDoctorSelect.appendChild(option); | ||
+ | }); | ||
+ | |||
+ | // Ripristina il valore precedente se esiste ancora | ||
+ | if (currentValue && doctorsData[currentValue]) { | ||
+ | prescribingDoctorSelect.value = currentValue; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // FUNZIONE CALCOLO FASE NUTRIZIONALE (DA VERSIONE 17) | ||
function calculatePhase() { | function calculatePhase() { | ||
const medicalRecord = document.getElementById(' | const medicalRecord = document.getElementById(' | ||
- | const birthWeight | + | const phaseBirthWeight |
- | const currentWeight | + | const phaseCurrentWeight |
const daysOfLife = parseInt(document.getElementById(' | const daysOfLife = parseInt(document.getElementById(' | ||
const bun = document.getElementById(' | const bun = document.getElementById(' | ||
Linea 1302: | Linea 1495: | ||
const diuresis = document.getElementById(' | const diuresis = document.getElementById(' | ||
const prescriptionDate = document.getElementById(' | const prescriptionDate = document.getElementById(' | ||
- | const prescribingDoctor | + | const prescribingDoctorValue |
+ | |||
+ | // Trova il nome completo del medico | ||
+ | const doctorFullName = prescribingDoctorValue && doctorsData[prescribingDoctorValue] ? | ||
+ | doctorsData[prescribingDoctorValue].fullName : '' | ||
| | ||
patientData = { | patientData = { | ||
medicalRecord: | medicalRecord: | ||
- | birthWeight: | + | birthWeight: |
- | currentWeight: | + | currentWeight: |
daysOfLife: daysOfLife, | daysOfLife: daysOfLife, | ||
bun: bun, | bun: bun, | ||
Linea 1316: | Linea 1513: | ||
diuresis: diuresis, | diuresis: diuresis, | ||
prescriptionDate: | prescriptionDate: | ||
- | prescribingDoctor: | + | prescribingDoctor: |
+ | prescribingDoctorName: | ||
}; | }; | ||
| | ||
Linea 1330: | Linea 1528: | ||
if (bunValue < 9) { | if (bunValue < 9) { | ||
bunStatus = 'Basso - Aumentare proteine'; | bunStatus = 'Basso - Aumentare proteine'; | ||
- | bunWarning = 'BUN basso: considerare aumento | + | bunWarning = 'BUN basso: considerare aumento |
} else if (bunValue > 14) { | } else if (bunValue > 14) { | ||
bunStatus = ' | bunStatus = ' | ||
- | bunWarning = 'BUN elevato: ridurre | + | bunWarning = 'BUN elevato: ridurre |
} else { | } else { | ||
bunStatus = ' | bunStatus = ' | ||
Linea 1339: | Linea 1537: | ||
} else { | } else { | ||
bunStatus = 'Non inserito'; | bunStatus = 'Non inserito'; | ||
+ | } | ||
+ | | ||
+ | // Analisi altri parametri | ||
+ | let otherWarnings = []; | ||
+ | | ||
+ | if (glucose && glucose !== '' | ||
+ | const glucoseValue = parseFloat(glucose); | ||
+ | if (glucoseValue < 70) { | ||
+ | otherWarnings.push(' | ||
+ | } else if (glucoseValue > 150) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | if (sodium && sodium !== '' | ||
+ | const sodiumValue = parseFloat(sodium); | ||
+ | if (sodiumValue < 135) { | ||
+ | otherWarnings.push(' | ||
+ | } else if (sodiumValue > 145) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | if (ph && ph !== '' | ||
+ | const phValue = parseFloat(ph); | ||
+ | if (phValue < 7.35) { | ||
+ | otherWarnings.push(' | ||
+ | } else if (phValue > 7.45) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | if (baseExcess && baseExcess !== '' | ||
+ | const beValue = parseFloat(baseExcess); | ||
+ | if (beValue < -4) { | ||
+ | otherWarnings.push(' | ||
+ | } else if (beValue > 2) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | // Raccomandazione combinata pH + BE per Sodio Acetato | ||
+ | if (ph && baseExcess) { | ||
+ | const phValue = parseFloat(ph); | ||
+ | const beValue = parseFloat(baseExcess); | ||
+ | if (phValue < 7.25 || beValue < -4) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | if (diuresis && diuresis !== '' | ||
+ | const diuresisValue = parseFloat(diuresis); | ||
+ | if (diuresisValue < 1) { | ||
+ | otherWarnings.push(' | ||
+ | } else if (diuresisValue > 3) { | ||
+ | otherWarnings.push(' | ||
+ | } | ||
} | } | ||
| | ||
Linea 1348: | Linea 1603: | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
} | } | ||
- | phaseInfoHtml += '< | + | phaseInfoHtml += '< |
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
Linea 1356: | Linea 1611: | ||
if (patientData.bun) { | if (patientData.bun) { | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.glucose) { | ||
+ | const gluStatus = parseFloat(patientData.glucose) >= 70 && parseFloat(patientData.glucose) <= 110 ? ' | ||
+ | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.sodium) { | ||
+ | const naStatus = parseFloat(patientData.sodium) >= 135 && parseFloat(patientData.sodium) <= 145 ? ' | ||
+ | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.ph) { | ||
+ | const phStatus = parseFloat(patientData.ph) >= 7.35 && parseFloat(patientData.ph) <= 7.45 ? ' | ||
+ | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.baseExcess) { | ||
+ | const beStatus = parseFloat(patientData.baseExcess) >= -4 && parseFloat(patientData.baseExcess) <= 2 ? ' | ||
+ | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.diuresis) { | ||
+ | const diuStatus = parseFloat(patientData.diuresis) >= 1 && parseFloat(patientData.diuresis) <= 3 ? ' | ||
+ | phaseInfoHtml += '< | ||
} | } | ||
phaseInfoHtml += '</ | phaseInfoHtml += '</ | ||
Linea 1362: | Linea 1637: | ||
if (bunWarning) { | if (bunWarning) { | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
+ | } | ||
+ | | ||
+ | if (otherWarnings.length > 0) { | ||
+ | phaseInfoHtml += '< | ||
} | } | ||
| | ||
Linea 1372: | Linea 1651: | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
+ | // Aggiorna il suggerimento sodio se il TAB 3 è già stato visitato | ||
updateSodiumRecommendation(); | updateSodiumRecommendation(); | ||
+ | | ||
+ | // RESET anche il pulsante NPT | ||
+ | resetParenteralButton(); | ||
} | } | ||
- | function updateSodiumRecommendation() { | + | // FUNZIONE |
- | // Implementazione vuota per ora | + | |
- | } | + | |
- | + | ||
- | // FUNZIONE FORTIFICANTE | + | |
function updateFortifierOptions() { | function updateFortifierOptions() { | ||
const formulaType = document.getElementById(' | const formulaType = document.getElementById(' | ||
const fortifierSection = document.getElementById(' | const fortifierSection = document.getElementById(' | ||
+ | const fortifierSelect = document.getElementById(' | ||
| | ||
if (formulaType === ' | if (formulaType === ' | ||
fortifierSection.classList.remove(' | fortifierSection.classList.remove(' | ||
+ | | ||
+ | fortifierSelect.innerHTML = '< | ||
+ | Object.keys(fortifierData).forEach(function(key) { | ||
+ | const option = document.createElement(' | ||
+ | option.value = key; | ||
+ | option.textContent = fortifierData[key].name; | ||
+ | fortifierSelect.appendChild(option); | ||
+ | }); | ||
} else { | } else { | ||
fortifierSection.classList.add(' | fortifierSection.classList.add(' | ||
+ | fortifierSelect.value = ' | ||
} | } | ||
} | } | ||
+ | // FUNZIONE AGGIORNAMENTO DISPLAY CONCENTRAZIONE | ||
function updateConcentrationDisplay() { | function updateConcentrationDisplay() { | ||
const concentration = document.getElementById(' | const concentration = document.getElementById(' | ||
Linea 1396: | Linea 1686: | ||
} | } | ||
- | // FUNZIONE CALCOLO ENTERALE | + | // FUNZIONE CALCOLO |
function calculateEnteral() { | function calculateEnteral() { | ||
- | | + | |
- | alert(' | + | const enteralCurrentWeight = parseInt(document.getElementById(' |
+ | const enteralBirthWeight = parseInt(document.getElementById(' | ||
+ | |||
+ | if (!enteralCurrentWeight || !enteralBirthWeight) { | ||
+ | alert(' | ||
return; | return; | ||
+ | } | ||
+ | | ||
+ | // Aggiorna patientData se non è stato ancora fatto | ||
+ | if (!patientData.currentWeight) { | ||
+ | patientData.currentWeight = enteralCurrentWeight; | ||
+ | patientData.birthWeight = enteralBirthWeight; | ||
} | } | ||
| | ||
Linea 1434: | Linea 1734: | ||
const volumePerKg = (dailyVolume / currentWeight) * 1000; | const volumePerKg = (dailyVolume / currentWeight) * 1000; | ||
| | ||
+ | // Calcoli finali per kg di peso | ||
enteralData = { | enteralData = { | ||
volume: dailyVolume, | volume: dailyVolume, | ||
Linea 1453: | Linea 1754: | ||
tableHtml += '< | tableHtml += '< | ||
if (additionalFluids > 0) { | if (additionalFluids > 0) { | ||
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '< | tableHtml += '< | ||
} else { | } else { | ||
Linea 1473: | Linea 1774: | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
+ | // Aggiorna il pulsante a verde | ||
const enteralBtn = document.getElementById(' | const enteralBtn = document.getElementById(' | ||
if (enteralBtn) { | if (enteralBtn) { | ||
Linea 1478: | Linea 1780: | ||
enteralBtn.innerHTML = ' | enteralBtn.innerHTML = ' | ||
} | } | ||
+ | | ||
+ | // RESET del pulsante Fabbisogni quando si modificano gli apporti enterali | ||
+ | resetNutritionButton(); | ||
} | } | ||
- | // FUNZIONE CARICAMENTO VALORI | + | // FUNZIONE CARICAMENTO VALORI |
function loadNutritionDefaults() { | function loadNutritionDefaults() { | ||
- | | + | |
- | alert(' | + | const defaultsCurrentWeight = parseInt(document.getElementById(' |
+ | const defaultsBirthWeight = parseInt(document.getElementById(' | ||
+ | const defaultsDaysOfLife = parseInt(document.getElementById(' | ||
+ | |||
+ | if (!defaultsCurrentWeight || !defaultsBirthWeight || !defaultsDaysOfLife) { | ||
+ | alert(' | ||
return; | return; | ||
+ | } | ||
+ | | ||
+ | // Aggiorna patientData se non è stato ancora fatto | ||
+ | if (!patientData.currentWeight) { | ||
+ | patientData.currentWeight = defaultsCurrentWeight; | ||
+ | patientData.birthWeight = defaultsBirthWeight; | ||
+ | patientData.daysOfLife = defaultsDaysOfLife; | ||
} | } | ||
| | ||
const targetDay = parseInt(document.getElementById(' | const targetDay = parseInt(document.getElementById(' | ||
- | const birthWeight | + | const patientBirthWeightForCalculation |
| | ||
const weightCategorySelect = document.getElementById(' | const weightCategorySelect = document.getElementById(' | ||
- | let selectedCategory = weightCategorySelect.value || (birthWeight | + | let selectedCategory = weightCategorySelect.value || (patientBirthWeightForCalculation |
weightCategorySelect.value = selectedCategory; | weightCategorySelect.value = selectedCategory; | ||
| | ||
Linea 1517: | Linea 1834: | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | // Usa configurazione clinica per elettroliti |
- | document.getElementById(' | + | |
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
- | // Vitamine/ | + | // Gestione automatica tipo di sodio basata sui parametri clinici |
- | const currentWeight | + | const sodiumSelect = document.getElementById(' |
- | const enteralVolumePerKg = enteralData ? (enteralData.totalFluids / currentWeight | + | if (patientData.ph || patientData.baseExcess) { |
+ | const ph = patientData.ph ? parseFloat(patientData.ph) : null; | ||
+ | const be = patientData.baseExcess ? parseFloat(patientData.baseExcess) : null; | ||
+ | |||
+ | // Auto-seleziona Sodio Acetato se acidosi | ||
+ | if ((ph && ph < 7.30) || (be && be < -4)) { | ||
+ | sodiumSelect.value = ' | ||
+ | } else { | ||
+ | sodiumSelect.value = ' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Aggiorna il suggerimento sodio | ||
+ | updateSodiumRecommendation(); | ||
+ | |||
+ | // Gestione vitamine/ | ||
+ | const patientCurrentWeight | ||
+ | const enteralVolumePerKg = enteralData ? (enteralData.totalFluids / patientCurrentWeight | ||
| | ||
if (targetDay >= 3 && enteralVolumePerKg < 100) { | if (targetDay >= 3 && enteralVolumePerKg < 100) { | ||
Linea 1532: | Linea 1868: | ||
document.getElementById(' | document.getElementById(' | ||
} else { | } else { | ||
+ | // Mantieni i valori a zero se prima del 3° giorno o se enterale ≥100 ml/kg/die | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
Linea 1537: | Linea 1874: | ||
} | } | ||
| | ||
- | document.getElementById(' | + | document.getElementById(' |
| | ||
- | | + | document.getElementById(' |
- | if (loadBtn) { | + | |
- | loadBtn.className = ' | + | |
- | | + | // RESET del pulsante Fabbisogni quando si modificano i valori standard |
- | | + | resetNutritionButton(); |
} | } | ||
+ | // FUNZIONE AGGIORNAMENTO UNITÀ CARBOIDRATI | ||
function updateCarbUnit() { | function updateCarbUnit() { | ||
const unit = document.getElementById(' | const unit = document.getElementById(' | ||
Linea 1560: | Linea 1898: | ||
carbInput.setAttribute(' | carbInput.setAttribute(' | ||
} | } | ||
+ | | ||
+ | // Reset fabbisogni quando si cambia unità | ||
+ | resetNutritionButton(); | ||
} | } | ||
+ | // FUNZIONE AGGIORNAMENTO CATEGORIA PESO | ||
function updateWeightCategory() { | function updateWeightCategory() { | ||
- | // Placeholder | + | // Reset fabbisogni quando si cambia categoria peso |
+ | resetNutritionButton(); | ||
} | } | ||
+ | // FUNZIONE AGGIORNAMENTO TIPO SODIO | ||
function updateSodiumChoice() { | function updateSodiumChoice() { | ||
- | // Placeholder | + | // Resetta i fabbisogni quando si cambia il tipo di sodio |
+ | resetNutritionButton(); | ||
} | } | ||
- | // FUNZIONE CALCOLO FABBISOGNI | + | // FUNZIONE AGGIORNAMENTO SUGGERIMENTO SODIO |
+ | function updateSodiumRecommendation() { | ||
+ | const sodiumSelect = document.getElementById(' | ||
+ | const recommendationDiv = document.getElementById(' | ||
+ | |||
+ | if (!patientData.ph && !patientData.baseExcess) { | ||
+ | // Nessun dato clinico disponibile | ||
+ | recommendationDiv.classList.add(' | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | const ph = patientData.ph ? parseFloat(patientData.ph) : null; | ||
+ | const be = patientData.baseExcess ? parseFloat(patientData.baseExcess) : null; | ||
+ | |||
+ | // Logica di raccomandazione | ||
+ | let needsAcetate = false; | ||
+ | let reason = ''; | ||
+ | |||
+ | if (ph && ph < 7.30) { | ||
+ | needsAcetate = true; | ||
+ | reason = 'pH < 7.30 (acidosi)'; | ||
+ | } else if (be && be < -4) { | ||
+ | needsAcetate = true; | ||
+ | reason = 'BE < -4 mEq/L (acidosi metabolica)'; | ||
+ | } else if (ph && be && (ph < 7.30 || be < -4)) { | ||
+ | needsAcetate = true; | ||
+ | reason = 'pH < 7.30 o BE < -4 (acidosi)'; | ||
+ | } | ||
+ | |||
+ | if (needsAcetate) { | ||
+ | // Suggerisci Sodio Acetato | ||
+ | if (sodiumSelect.value === ' | ||
+ | // L' | ||
+ | recommendationDiv.innerHTML = '< | ||
+ | '< | ||
+ | 'In base ai parametri clinici (' + reason + '), si raccomanda < | ||
+ | '</ | ||
+ | recommendationDiv.classList.remove(' | ||
+ | } else { | ||
+ | // L' | ||
+ | recommendationDiv.innerHTML = '< | ||
+ | '< | ||
+ | 'Sodio Acetato è indicato per i parametri clinici attuali (' + reason + ' | ||
+ | '</ | ||
+ | recommendationDiv.classList.remove(' | ||
+ | } | ||
+ | } else { | ||
+ | // Parametri normali | ||
+ | if (sodiumSelect.value === ' | ||
+ | // L' | ||
+ | recommendationDiv.innerHTML = '< | ||
+ | '< | ||
+ | 'I parametri clinici sono nella norma. Sodio Cloruro potrebbe essere sufficiente, | ||
+ | '</ | ||
+ | recommendationDiv.classList.remove(' | ||
+ | } else { | ||
+ | // Tutto normale | ||
+ | recommendationDiv.classList.add(' | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // FUNZIONE CALCOLO FABBISOGNI | ||
function calculateNutrition() { | function calculateNutrition() { | ||
- | | + | |
- | alert(' | + | const nutritionCurrentWeight = parseInt(document.getElementById(' |
+ | const nutritionBirthWeight = parseInt(document.getElementById(' | ||
+ | |||
+ | if (!nutritionCurrentWeight || !nutritionBirthWeight) { | ||
+ | alert(' | ||
return; | return; | ||
+ | } | ||
+ | | ||
+ | // Aggiorna patientData se non è stato ancora fatto | ||
+ | if (!patientData.currentWeight) { | ||
+ | patientData.currentWeight = nutritionCurrentWeight; | ||
+ | patientData.birthWeight = nutritionBirthWeight; | ||
} | } | ||
| | ||
Linea 1598: | Linea 2015: | ||
(requirements.carbs * 1440 / 1000) : requirements.carbs; | (requirements.carbs * 1440 / 1000) : requirements.carbs; | ||
| | ||
- | const currentWeight | + | const patientCurrentWeight |
+ | const enteralVolumePerKg = enteralData ? (enteralData.totalFluids / patientCurrentWeight * 1000) : 0; | ||
| | ||
const enteralProtein = enteralData ? enteralData.protein : 0; | const enteralProtein = enteralData ? enteralData.protein : 0; | ||
Linea 1671: | Linea 2089: | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
+ | | ||
+ | // RESET del pulsante NPT quando si modificano i fabbisogni | ||
+ | resetParenteralButton(); | ||
} | } | ||
- | // FUNZIONE CALCOLO ELETTROLITI AGGIUNTIVI | + | // FUNZIONE CALCOLO ELETTROLITI AGGIUNTIVI |
function calculateElectrolyteAdditions(calciumNeeded, | function calculateElectrolyteAdditions(calciumNeeded, | ||
const additions = { | const additions = { | ||
Linea 1683: | Linea 2104: | ||
kcl: 0, | kcl: 0, | ||
totalVolume: | totalVolume: | ||
- | providedCalcium: | ||
- | providedPhosphorus: | ||
- | providedMagnesium: | ||
- | providedSodium: | ||
- | providedPotassium: | ||
sodiumSource: | sodiumSource: | ||
}; | }; | ||
| | ||
+ | // Determina il tipo di sodio da utilizzare | ||
const sodiumTypeSelect = document.getElementById(' | const sodiumTypeSelect = document.getElementById(' | ||
const selectedSodiumType = sodiumTypeSelect ? sodiumTypeSelect.value : ' | const selectedSodiumType = sodiumTypeSelect ? sodiumTypeSelect.value : ' | ||
additions.sodiumSource = selectedSodiumType; | additions.sodiumSource = selectedSodiumType; | ||
| | ||
- | const totalCalciumNeeded = calciumNeeded * currentWeightKg; | + | |
- | const totalPhosphorusNeeded = phosphorusNeeded * currentWeightKg; | + | |
- | const totalMagnesiumNeeded = magnesiumNeeded * currentWeightKg; | + | const totalPhosphorusNeeded = phosphorusNeeded * currentWeightKg; |
- | const totalSodiumNeeded = sodiumNeeded * currentWeightKg; | + | const totalMagnesiumNeeded = magnesiumNeeded * currentWeightKg; |
- | const totalPotassiumNeeded = potassiumNeeded * currentWeightKg; | + | const totalSodiumNeeded = sodiumNeeded * currentWeightKg; |
+ | const totalPotassiumNeeded = potassiumNeeded * currentWeightKg; | ||
| | ||
// Calcio Gluconato 10% (840 mg Ca/100ml) | // Calcio Gluconato 10% (840 mg Ca/100ml) | ||
if (totalCalciumNeeded > 0) { | if (totalCalciumNeeded > 0) { | ||
additions.ca_gluconato = totalCalciumNeeded / (parenteralConfig.ca_gluconato.calcium / 100); | additions.ca_gluconato = totalCalciumNeeded / (parenteralConfig.ca_gluconato.calcium / 100); | ||
- | additions.providedCalcium = totalCalciumNeeded; | ||
} | } | ||
| | ||
// Esafosfina (1600 mg P/100ml + 130 mEq Na/100ml) | // Esafosfina (1600 mg P/100ml + 130 mEq Na/100ml) | ||
+ | let sodiumFromEsafosfina = 0; | ||
if (totalPhosphorusNeeded > 0) { | if (totalPhosphorusNeeded > 0) { | ||
additions.esafosfina = totalPhosphorusNeeded / (parenteralConfig.esafosfina.phosphorus / 100); | additions.esafosfina = totalPhosphorusNeeded / (parenteralConfig.esafosfina.phosphorus / 100); | ||
- | | + | |
- | additions.providedSodium += (additions.esafosfina * parenteralConfig.esafosfina.sodium / 100); | + | |
} | } | ||
| | ||
Linea 1717: | Linea 2134: | ||
if (totalMagnesiumNeeded > 0) { | if (totalMagnesiumNeeded > 0) { | ||
additions.mg_sulfate = totalMagnesiumNeeded / (parenteralConfig.mg_sulfate.magnesium / 100); | additions.mg_sulfate = totalMagnesiumNeeded / (parenteralConfig.mg_sulfate.magnesium / 100); | ||
- | additions.providedMagnesium = totalMagnesiumNeeded; | ||
} | } | ||
| | ||
- | // Sodio rimanente | + | // Sodio rimanente |
- | const remainingSodium = Math.max(0, totalSodiumNeeded - additions.providedSodium); | + | const remainingSodium = Math.max(0, totalSodiumNeeded - sodiumFromEsafosfina); |
| | ||
if (remainingSodium > 0) { | if (remainingSodium > 0) { | ||
Linea 1731: | Linea 2147: | ||
additions.nacl = remainingSodium / concentrationNaCl; | additions.nacl = remainingSodium / concentrationNaCl; | ||
} | } | ||
- | additions.providedSodium += remainingSodium; | ||
} | } | ||
| | ||
Linea 1737: | Linea 2152: | ||
if (totalPotassiumNeeded > 0) { | if (totalPotassiumNeeded > 0) { | ||
additions.kcl = totalPotassiumNeeded / (parenteralConfig.kcl.potassium / 100); | additions.kcl = totalPotassiumNeeded / (parenteralConfig.kcl.potassium / 100); | ||
- | additions.providedPotassium = totalPotassiumNeeded; | ||
} | } | ||
| | ||
+ | // Volume totale degli elettroliti | ||
additions.totalVolume = additions.ca_gluconato + additions.esafosfina + additions.mg_sulfate + additions.nacl + additions.sodium_acetate + additions.kcl; | additions.totalVolume = additions.ca_gluconato + additions.esafosfina + additions.mg_sulfate + additions.nacl + additions.sodium_acetate + additions.kcl; | ||
| | ||
Linea 1745: | Linea 2160: | ||
} | } | ||
- | // FUNZIONE CALCOLO NPT PARENTERALE | + | // FUNZIONE CALCOLO NPT PARENTERALE |
function calculateParenteral() { | function calculateParenteral() { | ||
if (!window.residualNeeds) { | if (!window.residualNeeds) { | ||
Linea 1752: | Linea 2167: | ||
} | } | ||
| | ||
- | const currentWeight | + | const parentCurrentWeight |
- | const currentWeightKg = currentWeight | + | const currentWeightKg = parentCurrentWeight |
const residualNeeds = window.residualNeeds; | const residualNeeds = window.residualNeeds; | ||
| | ||
+ | // CONTROLLI DI SICUREZZA BASATI SU CONFIGURAZIONE CLINICA | ||
+ | const gir = (residualNeeds.carbs * 1000) / 1440; // mg/kg/min | ||
+ | let alerts = []; | ||
+ | | ||
+ | if (gir > clinicalConfig.maxGIR) { | ||
+ | alerts.push(' | ||
+ | } | ||
+ | if (residualNeeds.lipids > clinicalConfig.maxLipids) { | ||
+ | alerts.push(' | ||
+ | } | ||
+ | if (residualNeeds.protein > clinicalConfig.maxProtein) { | ||
+ | alerts.push(' | ||
+ | } | ||
+ | | ||
+ | // Volume totale residuo richiesto | ||
const totalVolume = Math.round(residualNeeds.liquids * currentWeightKg); | const totalVolume = Math.round(residualNeeds.liquids * currentWeightKg); | ||
| | ||
+ | // CALCOLA ELETTROLITI AGGIUNTIVI | ||
const electrolyteAdditions = calculateElectrolyteAdditions( | const electrolyteAdditions = calculateElectrolyteAdditions( | ||
residualNeeds.calcium, | residualNeeds.calcium, | ||
Linea 1767: | Linea 2198: | ||
); | ); | ||
| | ||
+ | // Volume proteine (Trophamine 6%) | ||
const proteinVolume = Math.round((residualNeeds.protein * currentWeightKg * 100) / 6); | const proteinVolume = Math.round((residualNeeds.protein * currentWeightKg * 100) / 6); | ||
+ | | ||
+ | // Volume lipidi (Intralipid 20%) | ||
const lipidVolume = Math.round((residualNeeds.lipids * currentWeightKg * 100) / 20); | const lipidVolume = Math.round((residualNeeds.lipids * currentWeightKg * 100) / 20); | ||
| | ||
+ | // Volume vitamine/ | ||
const vitaminsVolume = (residualNeeds.vitalipid * currentWeightKg) + (residualNeeds.soluvit * currentWeightKg) + (residualNeeds.peditrace * currentWeightKg); | const vitaminsVolume = (residualNeeds.vitalipid * currentWeightKg) + (residualNeeds.soluvit * currentWeightKg) + (residualNeeds.peditrace * currentWeightKg); | ||
const carnitineVolume = residualNeeds.carnitine > 0 ? (residualNeeds.carnitine * currentWeightKg) / 100 : 0; | const carnitineVolume = residualNeeds.carnitine > 0 ? (residualNeeds.carnitine * currentWeightKg) / 100 : 0; | ||
| | ||
- | const neededGlucose = residualNeeds.carbs * currentWeightKg; | + | |
- | const glucose50Volume = (neededGlucose * 100) / 50; | + | |
+ | const glucose50Volume = (neededGlucose * 100) / 50; // ml di glucosio 50% necessari | ||
| | ||
+ | // Volume utilizzato | ||
const usedVolume = proteinVolume + lipidVolume + vitaminsVolume + carnitineVolume + glucose50Volume + electrolyteAdditions.totalVolume; | const usedVolume = proteinVolume + lipidVolume + vitaminsVolume + carnitineVolume + glucose50Volume + electrolyteAdditions.totalVolume; | ||
+ | | ||
+ | // Volume rimanente = Acqua Bidistillata | ||
const waterVolume = totalVolume - usedVolume; | const waterVolume = totalVolume - usedVolume; | ||
- | | ||
- | let glucoseMessage = ''; | ||
- | | ||
- | if (waterVolume < 0) { | ||
- | glucoseMessage = '< | ||
- | '• Volume totale richiesto: ' + totalVolume + ' ml< | ||
- | '• Volume utilizzato: ' + usedVolume.toFixed(1) + ' ml< | ||
- | '• Acqua rimanente: ' + waterVolume.toFixed(1) + ' ml (NEGATIVO!)< | ||
- | '< | ||
- | | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | return; | ||
- | } | ||
- | | ||
- | if (neededGlucose <= 0) { | ||
- | glucoseMessage = '< | ||
- | '• Tutto il glucosio necessario proviene dall\' | ||
- | '• Non necessario glucosio in NPT</ | ||
- | | ||
- | document.getElementById(' | ||
- | } else { | ||
- | glucoseMessage = '< | ||
- | '• Glucosio necessario: ' + neededGlucose.toFixed(1) + ' | ||
- | '• Glucosio 50%: ' + glucose50Volume.toFixed(1) + ' | ||
- | '• Acqua bidistillata: | ||
- | '• < | ||
- | | ||
- | document.getElementById(' | ||
- | } | ||
| | ||
document.getElementById(' | document.getElementById(' | ||
+ | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
- | let resultHtml = glucoseMessage; | + | let resultHtml = '< |
+ | resultHtml += '< | ||
+ | resultHtml += '< | ||
+ | resultHtml += '< | ||
+ | resultHtml += '< | ||
+ | if (enteralData && enteralData.additionalFluids > 0) { | ||
+ | resultHtml += '< | ||
+ | } | ||
+ | resultHtml += '</ | ||
| | ||
- | resultHtml += '< | + | |
- | resultHtml += '< | + | if (alerts.length > 0) { |
- | resultHtml += '< | + | |
- | resultHtml += '< | + | } |
- | resultHtml | + | |
| | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1834: | Linea 2246: | ||
| | ||
resultHtml += '< | resultHtml += '< | ||
- | resultHtml += '< | + | resultHtml += '< |
| | ||
+ | // ELETTROLITI AGGIUNTIVI | ||
if (electrolyteAdditions.ca_gluconato > 0) { | if (electrolyteAdditions.ca_gluconato > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1843: | Linea 2256: | ||
} | } | ||
if (electrolyteAdditions.mg_sulfate > 0) { | if (electrolyteAdditions.mg_sulfate > 0) { | ||
- | resultHtml += '< | + | resultHtml += '< |
} | } | ||
if (electrolyteAdditions.nacl > 0) { | if (electrolyteAdditions.nacl > 0) { | ||
Linea 1855: | Linea 2268: | ||
} | } | ||
| | ||
+ | // VITAMINE | ||
if (residualNeeds.vitalipid > 0) { | if (residualNeeds.vitalipid > 0) { | ||
const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | ||
Linea 1868: | Linea 2282: | ||
} | } | ||
| | ||
+ | // CARNITINA | ||
if (residualNeeds.carnitine > 0) { | if (residualNeeds.carnitine > 0) { | ||
- | resultHtml += '< | + | resultHtml += '< |
} | } | ||
| | ||
+ | // ACQUA BIDISTILLATA | ||
if (waterVolume > 0) { | if (waterVolume > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1881: | Linea 2297: | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
- | // PREPARAZIONE | + | // CREAZIONE RICETTA PER PREPARAZIONE |
const deflectorVolume = parseInt(document.getElementById(' | const deflectorVolume = parseInt(document.getElementById(' | ||
const totalVolumeWithDeflector = totalVolume + deflectorVolume; | const totalVolumeWithDeflector = totalVolume + deflectorVolume; | ||
+ | const ratio = totalVolumeWithDeflector / totalVolume; | ||
| | ||
let preparationHtml = '< | let preparationHtml = '< | ||
- | preparationHtml += '< | + | preparationHtml += '< |
preparationHtml += '• < | preparationHtml += '• < | ||
+ | preparationHtml += '• < | ||
preparationHtml += '• < | preparationHtml += '• < | ||
preparationHtml += '</ | preparationHtml += '</ | ||
| | ||
preparationHtml += '< | preparationHtml += '< | ||
- | preparationHtml += '< | + | preparationHtml += '< |
- | + | ||
- | const ratio = totalVolumeWithDeflector / totalVolume; | + | |
| | ||
if (neededGlucose > 0) { | if (neededGlucose > 0) { | ||
Linea 1901: | Linea 2317: | ||
| | ||
preparationHtml += '< | preparationHtml += '< | ||
- | preparationHtml += '< | + | preparationHtml += '< |
| | ||
if (electrolyteAdditions.ca_gluconato > 0) { | if (electrolyteAdditions.ca_gluconato > 0) { | ||
Linea 1910: | Linea 2326: | ||
} | } | ||
if (electrolyteAdditions.mg_sulfate > 0) { | if (electrolyteAdditions.mg_sulfate > 0) { | ||
- | preparationHtml += '< | + | preparationHtml += '< |
} | } | ||
if (electrolyteAdditions.nacl > 0) { | if (electrolyteAdditions.nacl > 0) { | ||
Linea 1922: | Linea 2338: | ||
} | } | ||
| | ||
+ | // VITAMINE con denominazioni complete | ||
if (residualNeeds.vitalipid > 0) { | if (residualNeeds.vitalipid > 0) { | ||
const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | ||
Linea 1935: | Linea 2352: | ||
} | } | ||
| | ||
+ | // CARNITINA con denominazione completa | ||
if (residualNeeds.carnitine > 0) { | if (residualNeeds.carnitine > 0) { | ||
preparationHtml += '< | preparationHtml += '< | ||
Linea 1949: | Linea 2367: | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
- | // Salva i dati per i report | + | |
- | window.nptCalculationData | + | document.getElementById(' |
- | | + | |
- | proteinVolume, | + | |
- | | + | window.nptCalculation |
+ | | ||
+ | waterVolume: | ||
+ | glucose50Volume: | ||
+ | | ||
+ | lipidVolume: | ||
+ | gir: gir, | ||
+ | neededGlucose: | ||
+ | | ||
+ | vitaminsVolume: | ||
+ | carnitineVolume: | ||
+ | deflectorVolume: | ||
}; | }; | ||
+ | } | ||
+ | |||
+ | // FUNZIONI CONFIGURAZIONE (DA VERSIONE 17) | ||
+ | function populateEnteralConfigTable() { | ||
+ | const tbody = document.getElementById(' | ||
+ | if (!tbody) return; | ||
| | ||
- | const parenteralBtn | + | |
- | if (parenteralBtn) { | + | Object.keys(formulaData).forEach(key => { |
- | | + | const formula = formulaData[key]; |
- | | + | const row = tbody.insertRow(); |
+ | row.innerHTML = '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function populateParenteralConfigTable() { | ||
+ | | ||
+ | if (!tbody) return; | ||
+ | |||
+ | tbody.innerHTML = ''; | ||
+ | Object.keys(parenteralConfig).forEach(function(key) { | ||
+ | | ||
+ | const row = tbody.insertRow(); | ||
+ | row.innerHTML = '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function populateDoctorsConfigTable() { | ||
+ | const tbody = document.getElementById(' | ||
+ | if (!tbody) return; | ||
+ | |||
+ | tbody.innerHTML = ''; | ||
+ | Object.keys(doctorsData).forEach(key => { | ||
+ | const doctor = doctorsData[key]; | ||
+ | const row = tbody.insertRow(); | ||
+ | row.innerHTML = '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '</ | ||
+ | '< | ||
+ | '< | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function markConfigChanged(configType) { | ||
+ | let buttonId = ''; | ||
+ | let buttonText = ''; | ||
+ | |||
+ | switch(configType) { | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA MODIFICHE ENTERALI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA MODIFICHE PARENTERALI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA MODIFICHE FORTIFICANTI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA MODIFICHE MEDICI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA PARAMETRI SISTEMA'; | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | const button = document.getElementById(buttonId); | ||
+ | if (button) { | ||
+ | button.className = ' | ||
+ | | ||
} | } | ||
} | } | ||
- | // FUNZIONI REPORT | + | function |
- | function | + | |
- | if (!window.nptCalculationData) { | + | |
- | | + | Object.keys(formulaData).forEach(key => { |
- | | + | const oldValues = Object.assign({}, |
+ | |||
+ | const proteinEl = document.getElementById(' | ||
+ | | ||
+ | formulaData[key].protein = parseFloat(proteinEl.value); | ||
+ | formulaData[key].carbs = parseFloat(document.getElementById(' | ||
+ | formulaData[key].lipids = parseFloat(document.getElementById(' | ||
+ | formulaData[key].sodium = parseFloat(document.getElementById(' | ||
+ | formulaData[key].potassium = parseFloat(document.getElementById(' | ||
+ | formulaData[key].calcium = parseFloat(document.getElementById(' | ||
+ | formulaData[key].phosphorus = parseFloat(document.getElementById(' | ||
+ | formulaData[key].magnesium = parseFloat(document.getElementById(' | ||
+ | formulaData[key].energy = parseFloat(document.getElementById(' | ||
+ | |||
+ | if (JSON.stringify(oldValues) | ||
+ | changesCount++; | ||
+ | } | ||
+ | | ||
+ | }); | ||
+ | |||
+ | const button = document.getElementById('updateEnteralBtn'); | ||
+ | if (button) { | ||
+ | | ||
+ | button.innerHTML = ' | ||
+ | setTimeout(() => { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | }, 3000); | ||
} | } | ||
+ | } | ||
+ | |||
+ | function updateParenteralConfig() { | ||
+ | let changesCount = 0; | ||
| | ||
- | const reportHtml | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | const proteinEl = document.getElementById(' |
- | document.getElementById(' | + | if (proteinEl) { |
- | | + | parenteralConfig[key].protein |
+ | | ||
+ | parenteralConfig[key].lipids = parseFloat(document.getElementById('config_' | ||
+ | | ||
+ | parenteralConfig[key].potassium = parseFloat(document.getElementById('config_' | ||
+ | | ||
+ | parenteralConfig[key].phosphorus = parseFloat(document.getElementById('config_' | ||
+ | | ||
+ | parenteralConfig[key].energy = parseFloat(document.getElementById(' | ||
+ | parenteralConfig[key].water = parseFloat(document.getElementById(' | ||
+ | |||
+ | if (JSON.stringify(oldValues) !== JSON.stringify(parenteralConfig[key])) { | ||
+ | changesCount++; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
| | ||
- | const generateBtn | + | const button |
- | | + | |
- | | + | button.className = ' |
+ | button.innerHTML = 'PARENTERALI SALVATE | ||
+ | | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | }, 3000); | ||
+ | } | ||
} | } | ||
- | function | + | function |
- | if (!window.nptCalculationData) { | + | // Aggiorna Prenidina FM85 predefinita |
- | | + | const proteinEl = document.getElementById(' |
- | | + | if (proteinEl) { |
+ | | ||
+ | fortifierData.prenidina_fm85.carbs = parseFloat(document.getElementById('fortifier_prenidina_fm85_carbs').value); | ||
+ | | ||
+ | fortifierData.prenidina_fm85.sodium = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.potassium = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.calcium = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.phosphorus = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.magnesium = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.energy = parseFloat(document.getElementById(' | ||
} | } | ||
| | ||
- | const reportHtml | + | const button |
- | | + | |
- | | + | button.className = 'button config-update-completed'; |
- | | + | |
- | | + | setTimeout(() => { |
- | | + | button.className = 'button'; |
+ | | ||
+ | }, 3000); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function updateDoctorsConfig() { | ||
+ | | ||
| | ||
- | const generateBtn | + | |
- | | + | const oldValues = Object.assign({}, |
- | | + | |
+ | | ||
+ | if (nameEl) { | ||
+ | const newName = nameEl.value.trim(); | ||
+ | const newSurname | ||
+ | const newTitle = document.getElementById(' | ||
+ | |||
+ | doctorsData[key].name = newName; | ||
+ | doctorsData[key].surname = newSurname; | ||
+ | doctorsData[key].title = newTitle; | ||
+ | doctorsData[key].fullName = newTitle + ' ' + newName + ' ' + newSurname; | ||
+ | |||
+ | if (JSON.stringify(oldValues) !== JSON.stringify(doctorsData[key])) { | ||
+ | changesCount++; | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | |||
+ | updateDoctorsDropdown(); | ||
+ | populateDoctorsConfigTable(); | ||
+ | |||
+ | const button = document.getElementById(' | ||
+ | if (button) { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | setTimeout(() => { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | }, 3000); | ||
+ | } | ||
} | } | ||
- | function | + | function |
- | const data = window.nptCalculationData; | + | const button |
- | const deflectorVolume = parseInt(document.getElementById(' | + | |
- | | + | button.className |
- | const ratio = totalVolumeWithDeflector / data.totalVolume; | + | button.innerHTML = ' |
+ | | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | }, 3000); | ||
+ | } | ||
| | ||
- | | + | |
- | | + | } |
+ | |||
+ | // FUNZIONI CONFIGURAZIONE CLINICA AVANZATA (NUOVE) | ||
+ | function updateClinicalConfig() { | ||
+ | clinicalConfig.calciumReq | ||
+ | | ||
+ | clinicalConfig.magnesiumReq = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxGIR = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxLipids = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxProtein = parseFloat(document.getElementById(' | ||
| | ||
- | | + | |
- | | + | '• Calcio standard: ' + clinicalConfig.calciumReq + ' mg/ |
+ | ' | ||
+ | '• GIR massimo: ' + clinicalConfig.maxGIR + ' | ||
+ | '• Lipidi massimi: ' | ||
+ | } | ||
+ | |||
+ | function resetConfiguration() { | ||
+ | // Reset configurazione clinica | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
| | ||
- | | + | // Reset configurazione sistema |
- | | + | document.getElementById(' |
- | | + | |
+ | | ||
+ | document.getElementById(' | ||
| | ||
- | | + | |
+ | clinicalConfig | ||
+ | calciumReq: 160, | ||
+ | phosphorusReq: | ||
+ | magnesiumReq: | ||
+ | maxGIR: 12.0, | ||
+ | maxLipids: 3.0, | ||
+ | maxProtein: 4.5, | ||
+ | hospitalName: | ||
+ | departmentName: | ||
+ | directorName: | ||
+ | }; | ||
| | ||
- | // Header | + | |
- | html += '< | + | } |
- | html += '< | + | |
- | html += '< | + | function saveConfiguration() { |
- | html += '<div style=" | + | const config = { |
+ | deflectorVolume: | ||
+ | hospitalName: | ||
+ | departmentName: | ||
+ | directorName: | ||
+ | autoSave: document.getElementById(' | ||
+ | decimalPlaces: | ||
+ | clinicalConfig: | ||
+ | }; | ||
+ | |||
+ | | ||
+ | | ||
+ | clinicalConfig.departmentName = config.departmentName; | ||
+ | clinicalConfig.directorName = config.directorName; | ||
+ | |||
+ | // Simula salvataggio configurazione | ||
+ | window.savedConfig = config; | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | // FUNZIONI REPORT (COMPLETE CON TUTTI GLI ELEMENTI) | ||
+ | function generatePrescription() { | ||
+ | if (!window.residualNeeds || !patientData.currentWeight) { | ||
+ | alert(' | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | const currentDate = new Date().toLocaleDateString(' | ||
+ | const currentTime = new Date().toLocaleTimeString(' | ||
+ | const prescriptionPatientWeightKg = patientData.currentWeight / 1000; | ||
+ | const calc = window.nptCalculation; | ||
+ | |||
+ | if (!calc) { | ||
+ | alert(' | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | const birthDate = new Date(); | ||
+ | birthDate.setDate(birthDate.getDate() - patientData.daysOfLife); | ||
+ | |||
+ | const doctorName = patientData.prescribingDoctorName || | ||
+ | (patientData.prescribingDoctor && doctorsData[patientData.prescribingDoctor] ? | ||
+ | | ||
+ | |||
+ | let html = '< | ||
+ | |||
+ | // INTESTAZIONE MEDICA ESATTA COME DA PDF | ||
+ | html += '< | ||
+ | |||
+ | // PARTE SINISTRA - INFO OSPEDALE | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '<h3 style=" | ||
+ | html += '<p style=" | ||
html += '</ | html += '</ | ||
- | html += '< | + | |
+ | // PARTE DESTRA - LOGO ASST | ||
+ | | ||
+ | html += '< | ||
html += '</ | html += '</ | ||
| | ||
- | // Info Paziente | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '</ | ||
html += '</ | html += '</ | ||
| | ||
- | // Composizione | + | // TITOLO DOCUMENTO |
- | html += '< | + | html += '< |
- | html += '<div class="report-section-title">Composizione Parenterale (numero sacche: 1)</div>'; | + | html += '<h2 style="font-size: 18px; font-weight: bold; color: #2c3e50; margin: 10px 0;">CALCOLO NUTRIZIONALE PARENTERALE</h2>'; |
- | html += '<table class="composition-table">'; | + | html += '<p style="font-size: 14px; color: #7f8c8d; margin: 5px 0;">Data: ' + currentDate + '</ |
- | html += '< | + | html += '</div>'; |
| | ||
- | if (data.waterVolume > 0) { | + | |
- | html += '< | + | html += '< |
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | |||
+ | // COMPOSIZIONE NPT COMPLETA (TUTTI GLI ELEMENTI DAL TAB 4) | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | // ACQUA BIDISTILLATA | ||
+ | | ||
+ | html += '< | ||
} | } | ||
- | if (data.glucose50Volume | + | |
- | html += '< | + | // GLUCOSIO |
+ | | ||
+ | html += '< | ||
} | } | ||
- | if (data.electrolyteAdditions.ca_gluconato > 0) { | + | |
- | html += '< | + | // PROTEINE |
+ | html += '< | ||
+ | |||
+ | // LIPIDI | ||
+ | html += '< | ||
+ | |||
+ | // ELETTROLITI (SE PRESENTI) | ||
+ | | ||
+ | html += '< | ||
} | } | ||
- | if (data.electrolyteAdditions.nacl > 0) { | + | if (calc.electrolyteAdditions.esafosfina |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.electrolyteAdditions.sodium_acetate | + | if (calc.electrolyteAdditions.mg_sulfate |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.electrolyteAdditions.kcl > 0) { | + | if (calc.electrolyteAdditions.nacl > 0) { |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.electrolyteAdditions.mg_sulfate | + | if (calc.electrolyteAdditions.sodium_acetate |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.carnitineVolume | + | if (calc.electrolyteAdditions.kcl |
- | html += '< | + | html += '< |
} | } | ||
| | ||
- | html += '< | + | |
- | + | if (window.residualNeeds.vitalipid > 0) { | |
- | if (data.electrolyteAdditions.esafosfina > 0) { | + | const vitalipidVolume = window.residualNeeds.vitalipid * prescriptionPatientWeightKg; |
- | html += '< | + | |
} | } | ||
- | if (data.residualNeeds.peditrace | + | if (window.residualNeeds.soluvit |
- | const peditraceVolume | + | const soluvitVolume |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.residualNeeds.soluvit | + | if (window.residualNeeds.peditrace |
- | const soluvitVolume | + | const peditraceVolume |
- | html += '< | + | html += '< |
} | } | ||
- | if (data.residualNeeds.vitalipid | + | |
- | const vitalipidVolume | + | // CARNITINA (SE PRESENTE) |
- | html += '< | + | |
+ | const carnitineVolume | ||
+ | html += '< | ||
} | } | ||
| | ||
- | html += '< | + | |
+ | | ||
+ | html += '</tbody></ | ||
| | ||
- | // Totali | + | // PARAMETRI CLINICI |
- | html += '<tr class="composition-total">< | + | html += '<div style="background-color: #fff3cd; border: 1px solid #ffc107; border-radius: |
- | html += '<tr>< | + | html += '<h4 style="margin-top: 0; color: #856404;">PARAMETRI CLINICI</h4>'; |
- | html += '<tr>< | + | html += '<p>< |
- | html += '<tr>< | + | html += '<p>< |
- | html += '</ | + | html += '<p>< |
+ | html += '<p>< | ||
html += '</ | html += '</ | ||
| | ||
- | html += '< | + | |
- | html += 'NPT Calculator v2.0 - Foglio di Lavoro generato il ' + new Date().toLocaleString('it-IT'); | + | |
+ | html += '<div style=" | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
html += '</ | html += '</ | ||
- | | ||
html += '</ | html += '</ | ||
| | ||
- | | + | |
} | } | ||
- | function | + | function |
- | | + | |
- | const deflectorVolume = parseInt(document.getElementById('deflectorVolume').value) || 30; | + | alert('Prima completare tutti i calcoli precedenti'); |
- | const totalVolumeWithDeflector = data.totalVolume + deflectorVolume; | + | |
- | | + | |
| | ||
- | const today = new Date(); | + | const calc = window.nptCalculation; |
- | | + | |
+ | alert('Prima calcolare la NPT nel TAB 4'); | ||
+ | return; | ||
+ | } | ||
| | ||
- | const medicalRecord | + | const currentDate |
- | const birthDate | + | const currentTime |
- | | + | const worksheetPatientWeightKg |
- | ' | + | |
- | const doctorName | + | |
- | doctorsData[patientData.prescribingDoctor]? | + | |
| | ||
- | const infusionRate | + | const birthDate |
- | | + | |
- | const estimatedOsmolarity = (finalConcentration * 55 + data.electrolyteAdditions.totalVolume * 10).toFixed(0); | + | |
| | ||
- | | + | |
+ | const totalVolumeWithDeflector | ||
+ | const ratio = totalVolumeWithDeflector / calc.totalVolume; | ||
| | ||
- | | + | |
- | | + | html += '< |
- | html += '< | + | html += '<h1>' + clinicalConfig.hospitalName + '</h1>'; |
- | html += '<div style=" | + | html += '<h2>' + clinicalConfig.departmentName + '</h2>'; |
- | html += '<div style=" | + | html += '<p>Direttore: |
- | html += '</div>'; | + | |
- | html += '<div class=" | + | |
html += '</ | html += '</ | ||
| | ||
- | html += '< | + | html += '< |
- | html += '< | + | |
| | ||
- | | + | html += '< |
- | | + | html += '<h3 style="margin-top: 0; color: #2c3e50;">INFORMAZIONI PAZIENTE</h3>'; |
- | html += '< | + | html += '<p><strong> |
- | html += '<table class="report-table">' | + | html += '<p><strong>Cartella:</strong> ' + (patientData.medicalRecord |
- | html += '< | + | html += '<p><strong>Peso:</strong> ' + patientData.currentWeight |
- | html += '<tr><td class=" | + | html += '<p><strong>Giorni di vita:</strong> ' + patientData.daysOfLife |
- | html += '< | + | |
- | html += '<tr><td class=" | + | |
- | html += '< | + | |
- | html += '<tr><td class=" | + | |
- | html += '<tr><td class=" | + | |
- | html += '</ | + | |
html += '</ | html += '</ | ||
| | ||
- | | + | html += '< |
- | | + | html += '<h4 style=" |
- | html += '< | + | html += '<p><strong>GIR:</strong> ' + calc.gir.toFixed(1) |
- | if (enteralData && enteralData.volume > 0) { | + | html += '<p><strong>Velocità infusione:</ |
- | const formulaName = document.getElementById(' | + | html += '<p><strong>Durata:</strong> 24 ore continue</p>'; |
- | const formulaDisplayName = formulaData[formulaName]? | + | |
- | html += '< | + | |
- | html += '<tr>< | + | |
- | html += '<tr><td class=" | + | |
- | html += '</ | + | |
- | | + | |
- | | + | |
- | html += '<tr><td class=" | + | |
- | html += '<tr><td class=" | + | |
- | html += '</ | + | |
- | } | + | |
html += '</ | html += '</ | ||
| | ||
- | | + | html += '<table style="width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13px;">'; |
- | | + | html += '<thead>< |
- | html += '<div class="report-section-title"> | + | html += '<th style="border: 1px solid #2c3e50; padding: 10px;"> |
- | html += '<table class="composition-table">'; | + | html += '< |
- | html += '<tr>< | + | html += '< |
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</tr></ | ||
| | ||
- | // Componenti con ordine identico al foglio di lavoro | + | |
- | if (data.waterVolume | + | |
- | html += '< | + | if (calc.neededGlucose |
+ | html += '< | ||
} | } | ||
- | if (data.glucose50Volume > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.electrolyteAdditions.ca_gluconato > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.electrolyteAdditions.nacl > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.electrolyteAdditions.kcl > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.electrolyteAdditions.mg_sulfate > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.carnitineVolume > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.proteinVolume > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.electrolyteAdditions.esafosfina > 0) { | ||
- | html += '< | ||
- | } | ||
- | if (data.residualNeeds.peditrace > 0) { | ||
- | const peditraceVolume = data.residualNeeds.peditrace * data.currentWeightKg; | ||
- | html += '< | ||
- | } | ||
- | if (data.residualNeeds.soluvit > 0) { | ||
- | const soluvitVolume = data.residualNeeds.soluvit * data.currentWeightKg; | ||
- | html += '< | ||
- | } | ||
- | if (data.residualNeeds.vitalipid > 0) { | ||
- | const vitalipidVolume = data.residualNeeds.vitalipid * data.currentWeightKg; | ||
- | html += '< | ||
- | } | ||
- | // Gestione valore negativo per Intralipid | ||
- | const displayLipidVolume = data.lipidVolume < 0 ? 0 : data.lipidVolume; | ||
- | html += '< | ||
| | ||
- | | + | html += '< |
- | | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '</ | + | |
- | html += '</ | + | |
| | ||
- | | + | html += '<tr>< |
- | | + | |
- | html += '<div class="report-section-title">Totale Elementi Pro Kilo</div>'; | + | |
- | html += '<table class="elements-table">'; | + | |
| | ||
- | // Calcoli degli elementi totali (enterale + parenterale) | + | |
- | const totalLiquids | + | |
- | | + | |
| | ||
- | | + | |
- | const totalLipids | + | html += '<h4 style="margin-top: 0; color: #856404;">AVVERTENZE</h4>'; |
- | const totalCarbs | + | html += '<ul>'; |
- | const totalCalcium = (enteralData ? enteralData.calcium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.calcium * data.currentWeightKg / 1000); | + | html += '<li>Preparazione sterile in cappa a flusso laminare</li>'; |
- | const totalPhosphorus = (enteralData ? enteralData.phosphorus * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.phosphorus * data.currentWeightKg / 1000); | + | html += '<li>Seguire rigorosamente l\'ordine di aggiunta</li>'; |
- | const totalSodium = (enteralData ? enteralData.sodium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.sodium * data.currentWeightKg / 1000); | + | html += '<li>Intralipid sempre per ultimo</li>'; |
- | const totalPotassium = (enteralData ? enteralData.potassium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.potassium * data.currentWeightKg / 1000); | + | html += '<li>Conservare a 2-8°C, usare entro 24 ore</li>'; |
- | const totalMagnesium = (enteralData ? enteralData.magnesium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.magnesium * data.currentWeightKg / 1000); | + | html += '</ul>'; |
- | const totalCarnitine = data.residualNeeds.carnitine * data.currentWeightKg / 1000; | + | |
- | + | ||
- | const totalEnergy = (enteralData ? enteralData.energy * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.energy * data.currentWeightKg / 1000); | + | |
- | const totalNonProteinEnergy = totalEnergy - (totalProtein * 4); | + | |
- | const glucoseMgKgMin = ((totalCarbs * 1000) / 1440).toFixed(3); | + | |
- | + | ||
- | html += '< | + | |
- | html += '<tr>< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '<tr>< | + | |
- | html += '<tr><td class=" | + | |
- | html += '<tr>< | + | |
- | html += '<tr><td class=" | + | |
- | html += '<tr><td class=" | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '</table>'; | + | |
html += '</ | html += '</ | ||
| | ||
- | html += '< | + | html += '< |
- | html += 'NPT Calculator v2.0 - Report Parenterale generato il ' + new Date().toLocaleString('it-IT'); | + | html += '<div style=" |
+ | html += '<div style=" | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
html += '</ | html += '</ | ||
- | | ||
html += '</ | html += '</ | ||
| | ||
- | | + | |
} | } | ||
- | function | + | // FUNZIONE GENERAZIONE PDF (DA VERSIONE 17) |
- | | + | function |
- | | + | |
- | | + | |
+ | | ||
+ | } | ||
+ | |||
+ | const { jsPDF } = window.jspdf; | ||
+ | const doc = new jsPDF(); | ||
| | ||
- | | + | |
- | ' | + | doc.setFontSize(10); |
+ | | ||
+ | doc.text('Direttore: ' | ||
| | ||
- | | + | |
+ | doc.text(clinicalConfig.hospitalName, | ||
| | ||
- | | + | |
- | < | + | doc.text('CALCOLO NUTRIZIONALE PARENTERALE Data: ' |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | body { margin: 0; padding: 15px; font-family: Arial, sans-serif; } | + | |
- | | + | |
- | </ | + | |
- | </ | + | |
- | < | + | |
- | ${reportContent} | + | |
- | </ | + | |
- | </ | + | |
- | `); | + | |
| | ||
- | | + | |
- | | + | generateFoglioLavoroPDF(doc); |
+ | } else if (type === ' | ||
+ | generateReportParenteralePDF(doc); | ||
+ | } | ||
+ | |||
+ | // Salva il PDF | ||
+ | const fileName = type === ' | ||
+ | | ||
} | } | ||
- | function | + | function |
- | | + | |
- | | + | let yPos = 50; |
- | | + | |
+ | doc.setFontSize(12); | ||
+ | doc.text('FOGLIO DI LAVORO NPT', 20, yPos); | ||
+ | | ||
+ | |||
+ | doc.setFontSize(10); | ||
+ | doc.text('Paziente: | ||
+ | | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text('Giorni di vita: ' | ||
+ | yPos += 20; | ||
| | ||
- | | + | |
- | | + | doc.text('Volume totale NPT: ' |
- | | + | yPos += 10; |
- | | + | doc.text('GIR: ' |
+ | | ||
+ | doc.text(' | ||
} | } | ||
+ | function generateReportParenteralePDF(doc) { | ||
+ | // Implementazione semplificata del PDF | ||
+ | let yPos = 50; | ||
+ | | ||
+ | doc.setFontSize(12); | ||
+ | doc.text(' | ||
+ | yPos += 20; | ||
+ | | ||
+ | doc.setFontSize(10); | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | } | ||
+ | |||
+ | // FUNZIONI PLACEHOLDER | ||
+ | function showAddEnteralForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddFortifierForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddParenteralForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddDoctorForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function removeEnteralFormula(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeParenteralComponent(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeFortifier(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeDoctor(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // INIZIALIZZAZIONE | ||
+ | document.addEventListener(' | ||
+ | console.log(' | ||
+ | | ||
+ | // Imposta la data odierna come default | ||
+ | const today = new Date().toISOString().split(' | ||
+ | document.getElementById(' | ||
+ | | ||
+ | // Configura il campo cartella clinica | ||
+ | setupMedicalRecordField(); | ||
+ | | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | }); | ||
+ | | ||
+ | // Event listeners per resettare Fabbisogni e NPT quando si modificano i valori manualmente | ||
+ | const requirementFields = [ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
+ | | ||
+ | requirementFields.forEach(fieldId => { | ||
+ | const field = document.getElementById(fieldId); | ||
+ | if (field) { | ||
+ | field.addEventListener(' | ||
+ | resetNutritionButton(); | ||
+ | }); | ||
+ | field.addEventListener(' | ||
+ | resetNutritionButton(); | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | | ||
+ | // Event listener per il tipo di sodio | ||
+ | const sodiumTypeSelect = document.getElementById(' | ||
+ | if (sodiumTypeSelect) { | ||
+ | sodiumTypeSelect.addEventListener(' | ||
+ | updateSodiumChoice(); | ||
+ | updateSodiumRecommendation(); | ||
+ | }); | ||
+ | } | ||
+ | | ||
+ | // Event listener per il volume del deflussore | ||
+ | const deflectorVolumeInput = document.getElementById(' | ||
+ | if (deflectorVolumeInput) { | ||
+ | deflectorVolumeInput.addEventListener(' | ||
+ | resetParenteralButton(); | ||
+ | }); | ||
+ | } | ||
+ | | ||
+ | // Inizializza configurazione clinica avanzata | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | | ||
+ | updateFortifierOptions(); | ||
+ | updateDoctorsDropdown(); | ||
+ | console.log(' | ||
+ | }); | ||
</ | </ | ||
+ | |||
</ | </ | ||
</ | </ |