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:11] – 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; |
} | } | ||
- | | + | /* CSS TAB ORIZZONTALI |
- | display: block !important; | + | |
- | } | + | |
- | + | ||
- | | + | |
.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 |
- | | + | |
- | | + | |
} | } | ||
} | } | ||
</ | </ | ||
- | <script src=" | ||
- | <script src=" | ||
</ | </ | ||
< | < | ||
<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 524: | 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 559: | Linea 521: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
</ | </ | ||
<div class=" | <div class=" | ||
Linea 612: | Linea 574: | ||
</ | </ | ||
- | <!-- TAB 2: NUTRIZIONE ENTERALE --> | + | <!-- TAB 2: NUTRIZIONE ENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 711: | Linea 673: | ||
</ | </ | ||
- | <!-- TAB 3: CALCOLO FABBISOGNI --> | + | <!-- TAB 3: CALCOLO FABBISOGNI |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 841: | Linea 803: | ||
</ | </ | ||
- | <!-- TAB 4: NUTRIZIONE PARENTERALE --> | + | <!-- TAB 4: NUTRIZIONE PARENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 883: | Linea 845: | ||
<div id=" | <div id=" | ||
| | ||
- | <div style=" | + | <div style=" |
- | | + | <button class=" |
- | <p style=" | + | <button class=" |
- | <div style=" | + | |
- | | + | |
- | <button id=" | + | |
- | < | + | |
- | <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 912: | Linea 881: | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
- | <input type=" | + | <input type=" |
</ | </ | ||
<div class=" | <div class=" | ||
Linea 926: | Linea 895: | ||
</ | </ | ||
</ | </ | ||
+ | | ||
<div class=" | <div class=" | ||
< | < | ||
<div style=" | <div style=" | ||
- | <table class=" | + | <table class=" |
< | < | ||
<tr> | <tr> | ||
Linea 943: | 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>< | + | <th style=" |
- | <td>1.2</ | + | <th>Proteine<br>(g)</th> |
- | | + | <th>Carboidrati<br>(g)</th> |
- | <td>4.0</td> | + | <th>Lipidi<br>(g)</th> |
- | <td>0.007</td> | + | <th>Sodio<br>(mEq)</th> |
- | <td>0.035</td> | + | <th>Potassio<br>(mEq)</th> |
- | <td>28.0</td> | + | <th>Calcio<br>(mg)</th> |
- | <td>15.0</td> | + | <th>Fosforo<br>(mg)</th> |
- | <td>3.0</td> | + | <th>Magnesio<br>(mg)</th> |
- | <td>67</td> | + | <th>Energia<br>(kcal)</th> |
- | | + | <th style=" |
- | <tr> | + | <th>Azioni</th> |
- | <td><strong>Latte Materno + Prenidina FM85</strong></ | + | |
- | <td>2.6</td> | + | |
- | <td>7.4</td> | + | |
- | <td>4.25</td> | + | |
- | < | + | |
- | <td>0.050</ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | | + | |
- | <td>6.5</td> | + | |
- | <td>71</td> | + | |
</tr> | </tr> | ||
+ | </ | ||
+ | <tbody id=" | ||
<tr> | <tr> | ||
- | <td>< | + | < |
- | <td>2.0</ | + | <td><input type=" |
- | <td>8.2</td> | + | < |
- | <td>4.0</ | + | < |
- | <td>0.030</td> | + | < |
- | < | + | < |
- | <td>75.0</td> | + | < |
- | < | + | < |
- | <td>7.5</ | + | < |
- | <td>73</td> | + | < |
- | </ | + | < |
- | <tr> | + | < |
- | < | + | |
- | <td>1.9</td> | + | |
- | < | + | |
- | <td>3.4</td> | + | |
- | <td>0.015</td> | + | |
- | < | + | |
- | <td>52.0</td> | + | |
- | < | + | |
- | <td>5.5</td> | + | |
- | < | + | |
- | </ | + | |
- | <tr> | + | |
- | < | + | |
- | <td>2.6</td> | + | |
- | < | + | |
- | <td>5.4</td> | + | |
- | | + | |
- | < | + | |
- | < | + | |
- | <td>58.0</td> | + | |
- | < | + | |
- | <td>101</td> | + | |
</tr> | </tr> | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
- | <div class=" | + | <div class=" |
- | <strong>ℹ️ Informazioni: | + | <div class="form-col"> |
+ | <button id=" | ||
+ | </div> | ||
+ | <div class=" | ||
+ | <button class=" | ||
+ | | ||
</ | </ | ||
</ | </ | ||
Linea 1065: | 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 1201: | Linea 1206: | ||
< | < | ||
- | // DATI NUTRIZIONALI COMPLETI | + | // DATI NUTRIZIONALI COMPLETI |
const formulaData = { | const formulaData = { | ||
maternal: { name: "Latte Materno", | maternal: { name: "Latte Materno", | ||
Linea 1214: | 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 fortificanti dinamico | ||
+ | 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 | + | // Database medici |
- | const doctorsData = { | + | let doctorsData = { |
dr_bellu: { name: " | dr_bellu: { name: " | ||
dr_condo: { name: " | dr_condo: { name: " | ||
Linea 1255: | 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 1261: | 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 1288: | 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 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 | + | // 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 1305: | 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 1319: | Linea 1513: | ||
diuresis: diuresis, | diuresis: diuresis, | ||
prescriptionDate: | prescriptionDate: | ||
- | prescribingDoctor: | + | prescribingDoctor: |
+ | prescribingDoctorName: | ||
}; | }; | ||
| | ||
Linea 1333: | 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 1342: | 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 1351: | Linea 1603: | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
} | } | ||
- | phaseInfoHtml += '< | + | phaseInfoHtml += '< |
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
Linea 1359: | 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 1365: | Linea 1637: | ||
if (bunWarning) { | if (bunWarning) { | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
+ | } | ||
+ | | ||
+ | if (otherWarnings.length > 0) { | ||
+ | phaseInfoHtml += '< | ||
} | } | ||
| | ||
Linea 1375: | 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 1399: | 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 1437: | 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 1456: | Linea 1754: | ||
tableHtml += '< | tableHtml += '< | ||
if (additionalFluids > 0) { | if (additionalFluids > 0) { | ||
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '< | tableHtml += '< | ||
} else { | } else { | ||
Linea 1476: | Linea 1774: | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
+ | // Aggiorna il pulsante a verde | ||
const enteralBtn = document.getElementById(' | const enteralBtn = document.getElementById(' | ||
if (enteralBtn) { | if (enteralBtn) { | ||
Linea 1481: | 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 1520: | 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 1535: | 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 1540: | 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 1563: | 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 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 | + | // 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 1601: | 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 1674: | 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 1686: | 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 1720: | 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 1734: | Linea 2147: | ||
additions.nacl = remainingSodium / concentrationNaCl; | additions.nacl = remainingSodium / concentrationNaCl; | ||
} | } | ||
- | additions.providedSodium += remainingSodium; | ||
} | } | ||
| | ||
Linea 1740: | 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 1748: | Linea 2160: | ||
} | } | ||
- | // FUNZIONE CALCOLO NPT PARENTERALE | + | // FUNZIONE CALCOLO NPT PARENTERALE |
function calculateParenteral() { | function calculateParenteral() { | ||
if (!window.residualNeeds) { | if (!window.residualNeeds) { | ||
Linea 1755: | 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 1770: | 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 1837: | Linea 2246: | ||
| | ||
resultHtml += '< | resultHtml += '< | ||
- | resultHtml += '< | + | resultHtml += '< |
| | ||
+ | // ELETTROLITI AGGIUNTIVI | ||
if (electrolyteAdditions.ca_gluconato > 0) { | if (electrolyteAdditions.ca_gluconato > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1846: | Linea 2256: | ||
} | } | ||
if (electrolyteAdditions.mg_sulfate > 0) { | if (electrolyteAdditions.mg_sulfate > 0) { | ||
- | resultHtml += '< | + | resultHtml += '< |
} | } | ||
if (electrolyteAdditions.nacl > 0) { | if (electrolyteAdditions.nacl > 0) { | ||
Linea 1858: | Linea 2268: | ||
} | } | ||
| | ||
+ | // VITAMINE | ||
if (residualNeeds.vitalipid > 0) { | if (residualNeeds.vitalipid > 0) { | ||
const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | ||
Linea 1871: | Linea 2282: | ||
} | } | ||
| | ||
+ | // CARNITINA | ||
if (residualNeeds.carnitine > 0) { | if (residualNeeds.carnitine > 0) { | ||
- | resultHtml += '< | + | resultHtml += '< |
} | } | ||
| | ||
+ | // ACQUA BIDISTILLATA | ||
if (waterVolume > 0) { | if (waterVolume > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1884: | 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 1904: | Linea 2317: | ||
| | ||
preparationHtml += '< | preparationHtml += '< | ||
- | preparationHtml += '< | + | preparationHtml += '< |
| | ||
if (electrolyteAdditions.ca_gluconato > 0) { | if (electrolyteAdditions.ca_gluconato > 0) { | ||
Linea 1913: | Linea 2326: | ||
} | } | ||
if (electrolyteAdditions.mg_sulfate > 0) { | if (electrolyteAdditions.mg_sulfate > 0) { | ||
- | preparationHtml += '< | + | preparationHtml += '< |
} | } | ||
if (electrolyteAdditions.nacl > 0) { | if (electrolyteAdditions.nacl > 0) { | ||
Linea 1925: | 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 1938: | Linea 2352: | ||
} | } | ||
| | ||
+ | // CARNITINA con denominazione completa | ||
if (residualNeeds.carnitine > 0) { | if (residualNeeds.carnitine > 0) { | ||
preparationHtml += '< | preparationHtml += '< | ||
Linea 1952: | 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: | ||
}; | }; | ||
- | | ||
- | const parenteralBtn = document.getElementById(' | ||
- | if (parenteralBtn) { | ||
- | parenteralBtn.className = ' | ||
- | parenteralBtn.innerHTML = 'NPT CALCOLATA ✓'; | ||
- | } | ||
} | } | ||
- | // FUNZIONI | + | // FUNZIONI |
- | function | + | function |
- | | + | |
- | alert('Prima calcolare la NPT!'); | + | if (!tbody) |
- | return; | + | |
- | } | + | |
| | ||
- | | + | |
- | | + | |
- | | + | const formula |
- | | + | const row = tbody.insertRow(); |
- | | + | row.innerHTML = '<td class=" |
- | | + | '< |
- | | + | '< |
- | + | '< | |
- | const generateBtn | + | '< |
- | | + | '< |
- | generateBtn.className | + | '< |
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | }); | ||
} | } | ||
- | function | + | function |
- | | + | |
- | alert('Prima calcolare la NPT!'); | + | if (!tbody) |
- | return; | + | |
- | } | + | |
| | ||
- | | + | |
- | | + | |
- | | + | const component |
- | | + | const row = tbody.insertRow(); |
- | | + | row.innerHTML = '<td class=" |
- | | + | '< |
- | | + | '< |
- | + | '< | |
- | const generateBtn | + | '< |
- | | + | '< |
- | | + | '< |
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | '< | ||
+ | }); | ||
} | } | ||
- | function | + | function |
- | const data = window.nptCalculationData; | + | const tbody = document.getElementById(' |
- | const deflectorVolume = parseInt(document.getElementById(' | + | |
- | | + | |
- | const ratio = totalVolumeWithDeflector / data.totalVolume; | + | |
| | ||
- | | + | |
- | | + | |
- | + | const doctor | |
- | | + | const row = tbody.insertRow(); |
- | | + | row.innerHTML |
- | + | '<td><input type="text" | |
- | | + | '< |
- | const finalConcentration = data.neededGlucose > 0 ? (data.neededGlucose * 100) / data.totalVolume : 0; | + | '<option value="Dr."' |
- | const estimatedOsmolarity = (finalConcentration * 55).toFixed(0); | + | '<option value="Dr.ssa"' |
- | + | '<option value="Prof."' | |
- | let html = '<div class=" | + | '<option value="Prof.ssa"' |
- | + | | |
- | // Header | + | '< |
- | html += '<div class="report-header">'; | + | |
- | html += '< | + | |
- | html += '<div style="font-weight: | + | |
- | html += '< | + | |
- | html += '</ | + | |
- | html += '< | + | |
- | html += '</ | + | |
- | + | ||
- | // Info Paziente | + | |
- | html += '<div class=" | + | |
- | html += '<div class="report-section-title">INFO Paziente</ | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '<tr>< | + | |
- | html += '</ | + | |
- | html += '</ | + | |
- | + | ||
- | // Composizione | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | + | ||
- | if (data.waterVolume > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.glucose50Volume > 0) { | + | |
- | html += '<tr>< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.ca_gluconato > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.nacl > 0) { | + | |
- | html += '<tr><td class=" | + | |
- | } | + | |
- | if (data.electrolyteAdditions.sodium_acetate > 0) { | + | |
- | html += '<tr>< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.kcl > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.mg_sulfate > 0) { | + | |
- | html += '<tr><td class=" | + | |
- | } | + | |
- | if (data.carnitineVolume > 0) { | + | |
- | html += '<tr>< | + | |
- | } | + | |
- | + | ||
- | html += '< | + | |
- | + | ||
- | if (data.electrolyteAdditions.esafosfina > 0) { | + | |
- | html += '<tr><td class=" | + | |
- | } | + | |
- | if (data.residualNeeds.peditrace > 0) { | + | |
- | const peditraceVolume = data.residualNeeds.peditrace * data.currentWeightKg; | + | |
- | html += '<tr>< | + | |
- | } | + | |
- | if (data.residualNeeds.soluvit > 0) { | + | |
- | const soluvitVolume | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.residualNeeds.vitalipid > 0) { | + | |
- | const vitalipidVolume = data.residualNeeds.vitalipid * data.currentWeightKg; | + | |
- | html += '<tr><td class=" | + | |
- | } | + | |
- | + | ||
- | html += '<tr>< | + | |
- | + | ||
- | // Totali | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | | + | |
- | html += '</ | + | |
- | + | ||
- | html += '< | + | |
- | html += 'NPT Calculator v2.0 - Foglio di Lavoro generato il ' + new Date().toLocaleString(' | + | |
- | html += '</ | + | |
- | + | ||
- | html += '</ | + | |
- | + | ||
- | return html; | + | |
} | } | ||
- | function | + | function |
- | | + | |
- | | + | |
- | const totalVolumeWithDeflector = data.totalVolume + deflectorVolume; | + | |
- | const ratio = totalVolumeWithDeflector / data.totalVolume; | + | |
| | ||
- | | + | |
- | const dateStr = today.toLocaleDateString(' | + | |
- | + | | |
- | const medicalRecord = patientData.medicalRecord || ' | + | |
- | const birthDate = patientData.prescriptionDate ? | + | break; |
- | | + | |
- | ' | + | |
- | const doctorName | + | |
- | doctorsData[patientData.prescribingDoctor]? | + | break; |
- | + | | |
- | const infusionRate = (data.totalVolume / 24).toFixed(2); | + | |
- | const finalConcentration = data.neededGlucose > 0 ? (data.neededGlucose * 100) / data.totalVolume : 0; | + | |
- | const estimatedOsmolarity = (finalConcentration * 55 + data.electrolyteAdditions.totalVolume * 10).toFixed(0); | + | break; |
- | + | | |
- | let html = '<div class=" | + | |
- | + | | |
- | // INTESTAZIONE | + | break; |
- | html += '< | + | |
- | html += '<div class=" | + | |
- | html += '< | + | |
- | html += '<div style=" | + | break; |
- | html += '</ | + | |
- | html += '< | + | |
- | html += '</ | + | |
- | + | ||
- | html += '< | + | |
- | html += '<div class=" | + | |
- | + | ||
- | // INFO PAZIENTE | + | |
- | html += '<div class=" | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '</ | + | |
- | html += '</ | + | |
- | + | ||
- | // LISTA APPORTI ENTERALI | + | |
- | html += '< | + | |
- | html += '< | + | |
- | if (enteralData && enteralData.volume > 0) { | + | |
- | | + | |
- | const formulaDisplayName | + | |
- | html += '<table class=" | + | |
- | html += '< | + | |
- | | + | |
- | html += '</ | + | |
- | } else { | + | |
- | html += '<table class=" | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '</ | + | |
} | } | ||
- | html += '</ | ||
| | ||
- | | + | |
- | html += '< | + | if (button) { |
- | html += '< | + | |
- | html += '< | + | button.innerHTML = buttonText; |
- | html += '< | + | |
- | + | ||
- | // Componenti con ordine identico al foglio di lavoro | + | |
- | if (data.waterVolume > 0) { | + | |
- | | + | |
} | } | ||
- | 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 += '< | ||
- | | ||
- | // Totali | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '</ | ||
- | html += '</ | ||
- | | ||
- | // TOTALE ELEMENTI PRO KILO | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | | ||
- | // Calcoli degli elementi totali (enterale + parenterale) | ||
- | const totalLiquids = (enteralData ? enteralData.totalFluids : 0) + data.totalVolume; | ||
- | const totalLiquidsPerKg = (totalLiquids / data.currentWeightKg).toFixed(2); | ||
- | | ||
- | const totalProtein = (enteralData ? enteralData.protein * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.protein * data.currentWeightKg / 1000); | ||
- | const totalLipids = (enteralData ? enteralData.lipids * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.lipids * data.currentWeightKg / 1000); | ||
- | const totalCarbs = (enteralData ? enteralData.carbs * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.carbs * data.currentWeightKg / 1000); | ||
- | const totalCalcium = (enteralData ? enteralData.calcium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.calcium * data.currentWeightKg / 1000); | ||
- | const totalPhosphorus = (enteralData ? enteralData.phosphorus * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.phosphorus * data.currentWeightKg / 1000); | ||
- | const totalSodium = (enteralData ? enteralData.sodium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.sodium * data.currentWeightKg / 1000); | ||
- | const totalPotassium = (enteralData ? enteralData.potassium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.potassium * data.currentWeightKg / 1000); | ||
- | const totalMagnesium = (enteralData ? enteralData.magnesium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.magnesium * data.currentWeightKg / 1000); | ||
- | 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 += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '</ | ||
- | html += '</ | ||
- | | ||
- | html += '< | ||
- | html += 'NPT Calculator v2.0 - Report Parenterale generato il ' + new Date().toLocaleString(' | ||
- | html += '</ | ||
- | | ||
- | html += '</ | ||
- | | ||
- | return html; | ||
} | } | ||
- | function | + | function |
- | | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
| | ||
- | | + | |
- | ' | + | const oldValues |
- | + | ||
- | const printWindow = window.open('', | + | |
- | + | ||
- | printWindow.document.write(` | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | body { margin: 0; padding: 15px; font-family: | + | |
- | ${document.querySelector(' | + | |
- | </ | + | |
- | | + | |
- | < | + | |
- | ${reportContent} | + | |
- | </ | + | |
- | </ | + | |
- | `); | + | |
- | + | ||
- | printWindow.document.close(); | + | |
- | printWindow.print(); | + | |
- | } | + | |
- | + | ||
- | function updateSystemConfig() { | + | |
- | | + | |
- | updateBtn.className = ' | + | |
- | updateBtn.innerHTML = ' | + | |
- | + | ||
- | setTimeout(() => { | + | |
- | updateBtn.className = ' | + | |
- | updateBtn.innerHTML = ' | + | |
- | | + | |
- | } | + | |
- | + | ||
- | // FUNZIONE SALVATAGGIO PDF | + | |
- | async function saveReportAsPDF() { | + | |
- | if (!window.currentActiveReport || !window.nptCalculationData) { | + | |
- | alert(' | + | |
- | return; | + | |
- | } | + | |
- | + | ||
- | try { | + | |
- | // Mostra messaggio di caricamento | + | |
- | const savePdfBtn = document.getElementById(' | + | |
- | const originalText = savePdfBtn.innerHTML; | + | |
- | savePdfBtn.innerHTML = '⏳ Generando PDF...'; | + | |
- | savePdfBtn.disabled = true; | + | |
| | ||
- | | + | const proteinEl |
- | | + | |
- | | + | |
- | document.getElementById('nptFinalReport'); | + | |
- | + | | |
- | const reportTitle | + | formulaData[key].sodium = parseFloat(document.getElementById('config_' |
- | 'Foglio_di_Lavoro' | + | |
- | + | | |
- | // Genera il nome file con data e cartella | + | |
- | const today = new Date(); | + | |
- | const dateStr | + | |
- | const medicalRecord | + | |
- | const fileName = `NPT_${reportTitle}_${medicalRecord}_${dateStr}.pdf`; | + | |
- | + | changesCount++; | |
- | // Configurazione html2canvas per qualità migliore | + | |
- | const canvas | + | |
- | scale: 2, // Migliore qualità | + | |
- | useCORS: true, | + | |
- | backgroundColor: | + | |
- | width: reportElement.offsetWidth, | + | |
- | height: reportElement.offsetHeight, | + | |
- | scrollX: 0, | + | |
- | scrollY: 0 | + | |
- | }); | + | |
- | + | ||
- | // Crea PDF con dimensioni A4 | + | |
- | const { jsPDF } = window.jspdf; | + | |
- | const pdf = new jsPDF({ | + | |
- | orientation: | + | |
- | unit: 'mm', | + | |
- | format: ' | + | |
- | }); | + | |
- | + | ||
- | // Calcola dimensioni per adattare alla pagina A4 | + | |
- | const imgWidth = 210; // A4 width in mm | + | |
- | const pageHeight = 297; // A4 height in mm | + | |
- | const imgHeight | + | |
- | + | ||
- | let heightLeft | + | |
- | let position = 0; | + | |
- | + | ||
- | // Aggiungi l' | + | |
- | pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, position, imgWidth, imgHeight); | + | |
- | heightLeft -= pageHeight; | + | |
- | + | ||
- | // Se il contenuto è più lungo di una pagina, aggiungi pagine | + | |
- | while (heightLeft >= 0) { | + | |
- | | + | |
- | | + | |
- | pdf.addImage(canvas.toDataURL(' | + | |
- | | + | |
} | } | ||
- | | + | }); |
- | // Aggiungi metadati al PDF | + | |
- | pdf.setProperties({ | + | const button = document.getElementById('updateEnteralBtn'); |
- | title: `NPT Calculator - ${reportTitle}`, | + | |
- | subject: | + | |
- | author: 'NPT Calculator v2.0', | + | |
- | keywords: 'NPT, Nutrizione Parenterale, | + | |
- | creator: 'NPT Calculator v2.0' | + | |
- | }); | + | |
- | + | ||
- | // Salva il PDF | + | |
- | pdf.save(fileName); | + | |
- | + | ||
- | // Ripristina il pulsante | + | |
- | | + | |
- | | + | |
- | | + | |
setTimeout(() => { | setTimeout(() => { | ||
- | | + | |
- | | + | |
- | savePdfBtn.disabled = false; | + | |
}, 3000); | }, 3000); | ||
- | | ||
- | // Mostra messaggio di conferma | ||
- | const confirmationMsg = document.createElement(' | ||
- | confirmationMsg.innerHTML = ` | ||
- | <div style=" | ||
- | padding: 15px 20px; border-radius: | ||
- | < | ||
- | File: ${fileName}< | ||
- | < | ||
- | </ | ||
- | `; | ||
- | document.body.appendChild(confirmationMsg); | ||
- | | ||
- | setTimeout(() => { | ||
- | document.body.removeChild(confirmationMsg); | ||
- | }, 5000); | ||
- | | ||
- | } catch (error) { | ||
- | console.error(' | ||
- | alert(' | ||
- | | ||
- | // Ripristina il pulsante in caso di errore | ||
- | const savePdfBtn = document.getElementById(' | ||
- | savePdfBtn.innerHTML = '💾 Salva PDF'; | ||
- | savePdfBtn.disabled = false; | ||
} | } | ||
} | } | ||
- | </ | + | function updateParenteralConfig() { |
- | </ | + | |
- | </ | + | |
- | <html lang=" | + | |
- | < | + | |
- | | + | |
- | <meta name=" | + | |
- | | + | |
- | | + | |
- | body { | + | |
- | font-family: | + | |
- | margin: 0; | + | |
- | padding: 20px; | + | |
- | background-color: | + | |
- | } | + | |
- | + | | |
- | | + | |
- | max-width: 1200px; | + | |
- | margin: 0 auto; | + | |
- | background: white; | + | |
- | padding: 20px; | + | |
- | border-radius: | + | |
- | box-shadow: 0 2px 10px rgba(0,0,0,0.1); | + | |
- | } | + | |
- | + | ||
- | h1 { | + | |
- | text-align: center; | + | |
- | color: #2c3e50; | + | |
- | border-bottom: | + | |
- | padding-bottom: | + | |
- | } | + | |
- | + | ||
- | .section | + | |
- | margin: 20px 0; | + | |
- | padding: 15px; | + | |
- | border: 1px solid #ddd; | + | |
- | border-radius: | + | |
- | background-color: | + | |
- | | + | |
- | + | ||
- | .section h2 { | + | |
- | color: #34495e; | + | |
- | margin-top: 0; | + | |
- | border-bottom: | + | |
- | padding-bottom: | + | |
- | } | + | |
- | + | ||
- | .input-group { | + | |
- | margin: 10px 0; | + | |
- | display: flex; | + | |
- | align-items: | + | |
- | } | + | |
- | + | ||
- | .input-group label { | + | |
- | display: inline-block; | + | |
- | width: 220px; | + | |
- | font-weight: | + | |
- | color: #2c3e50; | + | |
- | } | + | |
- | + | ||
- | .input-group input, .input-group select { | + | |
- | padding: 8px; | + | |
- | border: 1px solid #ddd; | + | |
- | border-radius: | + | |
- | width: 150px; | + | |
- | font-size: 14px; | + | |
- | | + | |
- | + | ||
- | .input-group input: | + | |
- | outline: none; | + | |
- | border-color: | + | |
- | box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); | + | |
- | | + | |
- | + | ||
- | .button | + | |
- | | + | |
- | color: white; | + | |
- | padding: 12px 24px; | + | |
- | border: none; | + | |
- | border-radius: | + | |
- | cursor: pointer; | + | |
- | font-size: 16px; | + | |
- | margin: 10px 5px; | + | |
- | transition: background-color 0.3s; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .button.secondary { | + | |
- | | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | margin-top: 20px; | + | |
- | | + | |
- | background-color: | + | |
- | border-left: | + | |
- | border-radius: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | color: #27ae60; | + | |
- | margin-top: 0; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | width: 100%; | + | |
- | border-collapse: | + | |
- | margin: 10px 0; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | border: 1px solid #ddd; | + | |
- | | + | |
- | text-align: left; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: white; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | | + | |
- | padding: 15px; | + | |
- | border-radius: | + | |
- | border-left: | + | |
- | margin: 10px 0; | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: #721c24; | + | |
- | padding: 10px; | + | |
- | border-radius: | + | |
- | border-left: | + | |
- | margin: 10px 0; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: #0c5460; | + | |
- | padding: 10px; | + | |
- | border-radius: | + | |
- | border-left: | + | |
- | margin: 10px 0; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | display: inline-block; | + | |
- | | + | |
- | border-radius: | + | |
- | font-size: 12px; | + | |
- | font-weight: | + | |
- | margin-left: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: #856404; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: #0c5460; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | | + | |
- | } | + | |
- | + | ||
- | | + | |
- | width: 100%; | + | |
- | border-collapse: | + | |
- | margin: 15px 0; | + | |
- | font-size: 13px; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | border: 1px solid #ddd; | + | |
- | | + | |
- | text-align: center; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: white; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | .hidden { | + | |
- | display: none !important; | + | |
- | } | + | |
- | + | ||
- | .visible { | + | |
- | display: block !important; | + | |
- | } | + | |
- | + | ||
- | /* CSS TAB ORIZZONTALI */ | + | |
- | .tabs { | + | |
- | display: flex; | + | |
- | margin-bottom: | + | |
- | border-bottom: | + | |
- | gap: 5px; | + | |
- | } | + | |
- | + | ||
- | .tab { | + | |
- | padding: 10px 20px; | + | |
- | background-color: | + | |
- | border: 1px solid #ddd; | + | |
- | border-bottom: | + | |
- | cursor: pointer; | + | |
- | border-radius: | + | |
- | transition: all 0.3s ease; | + | |
- | text-align: center; | + | |
- | min-width: 120px; | + | |
- | flex: 1; | + | |
- | max-width: 200px; | + | |
- | } | + | |
- | + | ||
- | .tab:hover { | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .tab.active { | + | |
- | background-color: | + | |
- | color: white; | + | |
- | border-color: | + | |
- | border-bottom: | + | |
- | } | + | |
- | + | ||
- | .tab-content { | + | |
- | display: none; | + | |
- | } | + | |
- | + | ||
- | .tab-content.active { | + | |
- | display: block; | + | |
- | } | + | |
- | + | ||
- | .form-row { | + | |
- | display: flex; | + | |
- | flex-wrap: wrap; | + | |
- | gap: 20px; | + | |
- | margin: 15px 0; | + | |
- | } | + | |
- | + | ||
- | .form-col { | + | |
- | flex: 1; | + | |
- | min-width: 300px; | + | |
- | } | + | |
- | + | ||
- | .highlight { | + | |
- | background-color: | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | color: white !important; | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .load-defaults-completed { | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .calculate-nutrition-pending { | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .calculate-nutrition-completed { | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .calculate-phase-pending { | + | |
- | background-color: | + | |
- | } | + | |
- | + | ||
- | .config-update-pending { | + | |
- | background-color: | + | |
- | color: white !important; | + | |
- | } | + | |
- | + | ||
- | .config-update-completed { | + | |
- | background-color: | + | |
- | color: white !important; | + | |
- | } | + | |
- | + | ||
- | /* STILI PER IL REPORT NPT */ | + | |
- | .npt-report { | + | |
- | background: white; | + | |
- | padding: 20px; | + | |
- | font-family: | + | |
- | font-size: 12px; | + | |
- | line-height: | + | |
- | max-width: 800px; | + | |
- | margin: 0 auto; | + | |
- | border: 1px solid #ddd; | + | |
- | } | + | |
- | + | ||
- | .report-header { | + | |
- | display: flex; | + | |
- | justify-content: | + | |
- | align-items: | + | |
- | border-bottom: | + | |
- | padding-bottom: | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-header-left { | + | |
- | flex: 1; | + | |
- | } | + | |
- | + | ||
- | .report-header-right { | + | |
- | width: 100px; | + | |
- | height: 60px; | + | |
- | background-color: | + | |
- | border: 1px solid #ccc; | + | |
- | display: flex; | + | |
- | align-items: | + | |
- | justify-content: | + | |
- | font-size: 10px; | + | |
- | color: #666; | + | |
- | } | + | |
- | + | ||
- | .report-title { | + | |
- | font-size: 14px; | + | |
- | font-weight: | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-subtitle { | + | |
- | font-size: 11px; | + | |
- | color: #666; | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-section { | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-section-title { | + | |
- | background-color: | + | |
- | color: white; | + | |
- | padding: 5px 10px; | + | |
- | font-weight: | + | |
- | font-size: 12px; | + | |
- | margin-bottom: | + | |
- | } | + | |
- | + | ||
- | .report-table { | + | |
- | width: 100%; | + | |
- | border-collapse: | + | |
- | font-size: 11px; | + | |
- | } | + | |
- | + | ||
- | .report-table td { | + | |
- | padding: 3px 8px; | + | |
- | border-bottom: | + | |
- | vertical-align: | + | |
- | } | + | |
- | + | ||
- | .report-table .label-col { | + | |
- | width: 200px; | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | .report-table | + | |
- | text-align: right; | + | |
- | | + | |
- | } | + | |
- | + | ||
- | | + | |
- | width: 100%; | + | |
- | border-collapse: | + | |
- | font-size: 11px; | + | |
- | margin-top: 0; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | background-color: | + | |
- | padding: 5px 8px; | + | |
- | text-align: center; | + | |
- | font-weight: | + | |
- | border: 1px solid #ddd; | + | |
- | } | + | |
- | + | ||
- | .composition-table td { | + | |
- | padding: 3px 8px; | + | |
- | border: 1px solid #ddd; | + | |
- | text-align: right; | + | |
- | } | + | |
- | + | ||
- | .composition-table .component-name-col { | + | |
- | text-align: left !important; | + | |
- | width: 60%; | + | |
- | } | + | |
- | + | ||
- | .composition-total { | + | |
- | background-color: | + | |
- | font-weight: | + | |
- | } | + | |
- | + | ||
- | .elements-table { | + | |
- | width: 100%; | + | |
- | border-collapse: | + | |
- | font-size: 11px; | + | |
- | margin-top: 0; | + | |
- | } | + | |
- | + | ||
- | .elements-table td { | + | |
- | padding: 3px 8px; | + | |
- | border-bottom: | + | |
- | } | + | |
- | + | ||
- | .elements-table .element-name { | + | |
- | width: 200px; | + | |
- | } | + | |
- | + | ||
- | .elements-table | + | |
- | 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 { | + | |
- | .npt-report { | + | |
- | box-shadow: none; | + | |
- | border: none; | + | |
- | margin: 0; | + | |
- | padding: 15px; | + | |
- | } | + | |
- | + | ||
- | .button { | + | |
- | display: none; | + | |
- | } | + | |
| | ||
- | .tabs, .tab-content: | + | |
- | | + | |
} | } | ||
} | } | ||
- | </ | ||
- | <script src=" | ||
- | <script src=" | ||
- | </ | ||
- | < | ||
- | |||
- | <div class=" | ||
- | < | ||
- | | ||
- | <!-- TAB ORIZZONTALI --> | ||
- | <div class=" | ||
- | <div class=" | ||
- | <span style=" | ||
- | </ | ||
- | <div class=" | ||
- | <span style=" | ||
- | </ | ||
- | <div class=" | ||
- | <span style=" | ||
- | </ | ||
- | <div class=" | ||
- | <span style=" | ||
- | </ | ||
- | <div class=" | ||
- | <span style=" | ||
- | </ | ||
- | </ | ||
- | |||
- | <!-- TAB 1: DATI PAZIENTE --> | ||
- | <div id=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=""> | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | < | ||
- | • La data viene impostata automaticamente ad oggi< | ||
- | • Selezionare il medico responsabile della prescrizione< | ||
- | • Questi dati appariranno nel riepilogo finale | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | | ||
- | <button id=" | ||
- | </ | ||
- | |||
- | <div id=" | ||
- | < | ||
- | <div id=" | ||
- | </ | ||
- | </ | ||
- | |||
- | <!-- TAB 2: NUTRIZIONE ENTERALE --> | ||
- | <div id=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | < | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | • Antibiotici in soluzione< | ||
- | • Flebo di mantenimento< | ||
- | • Soluzioni elettrolitiche | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div id=" | ||
- | < | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | <span id=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | <button id=" | ||
- | </ | ||
- | |||
- | <div id=" | ||
- | < | ||
- | <div id=" | ||
- | </ | ||
- | </ | ||
- | |||
- | <!-- TAB 3: CALCOLO FABBISOGNI --> | ||
- | <div id=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <button id=" | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=""> | ||
- | <option value=" | ||
- | <option value="> | ||
- | </ | ||
- | </ | ||
- | <button id=" | ||
- | </ | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <select id=" | ||
- | <option value=" | ||
- | <option value=" | ||
- | </ | ||
- | </ | ||
- | <div id=" | ||
- | <!-- Popolato dinamicamente --> | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | <div id=" | ||
- | < | ||
- | <div id=" | ||
- | </ | ||
- | </ | ||
- | |||
- | <!-- TAB 4: NUTRIZIONE PARENTERALE --> | ||
- | <div id=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | <button id=" | ||
- | </ | ||
- | |||
- | <div id=" | ||
- | < | ||
- | <div id=" | ||
- | | ||
- | <h3 style=" | ||
- | <div id=" | ||
- | | ||
- | <div style=" | ||
- | <h3 style=" | ||
- | <p style=" | ||
- | <div style=" | ||
- | <button id=" | ||
- | <button id=" | ||
- | <button id=" | ||
- | <button id=" | ||
- | </ | ||
- | </ | ||
- | | ||
- | <div id=" | ||
- | <div id=" | ||
- | </ | ||
- | </ | ||
- | |||
- | <!-- TAB 5: CONFIGURAZIONE --> | ||
- | <div id=" | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | </ | ||
- | | ||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | <div class=" | ||
- | <div class=" | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | • Volume perso nel deflussore durante la preparazione< | ||
- | • Viene aggiunto automaticamente alla ricetta di preparazione< | ||
- | • Valore standard: 30 ml (modificabile) | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | <button id=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | <div class=" | ||
- | < | ||
- | <div style=" | ||
- | <table class=" | ||
- | < | ||
- | <tr> | ||
- | <th style=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | </ | ||
- | < | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | <div class=" | ||
- | < | ||
- | <div style=" | ||
- | <table class=" | ||
- | < | ||
- | <tr> | ||
- | <th style=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | <th style=" | ||
- | </tr> | ||
- | </ | ||
- | < | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | <td>2 mEq/mL - Alcalinizzante per acidosi</ | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | <td>2 mEq/mL - Max vel. 0.5 mEq/ | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | <div class=" | ||
- | < | ||
- | </ | ||
- | </ | ||
- | |||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | < | ||
- | </ | ||
- | <div style=" | ||
- | <table class=" | ||
- | < | ||
- | <tr> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </tr> | ||
- | </ | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | <div class=" | ||
- | < | ||
- | <div class=" | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | < | ||
- | // DATI NUTRIZIONALI COMPLETI | ||
- | const formulaData = { | ||
- | maternal: { name: "Latte Materno", | ||
- | maternal_fortified: | ||
- | nan_supreme: | ||
- | humana1: { name: " | ||
- | bbmilk_zero: | ||
- | bbmilk_pdf: { name: " | ||
- | prenan: { name: " | ||
- | alfare: { name: " | ||
- | infatrini: { name: " | ||
- | }; | ||
- | |||
- | // CONFIGURAZIONI PARENTERALI COMPLETE | ||
- | const parenteralConfig = { | ||
- | ca_gluconato: | ||
- | name: " | ||
- | calcium: 840, phosphorus: 0, magnesium: 0, sodium: 0, potassium: 0, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 90 | ||
- | }, | ||
- | esafosfina: { | ||
- | name: " | ||
- | calcium: 0, phosphorus: 1600, magnesium: 0, sodium: 130, potassium: 0, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 98 | ||
- | }, | ||
- | mg_sulfate: { | ||
- | name: " | ||
- | calcium: 0, phosphorus: 0, magnesium: 800, sodium: 0, potassium: 0, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 99 | ||
- | }, | ||
- | nacl: { | ||
- | name: "Sodio Cloruro", | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, sodium: 1000, potassium: 0, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 99 | ||
- | }, | ||
- | sodium_acetate: | ||
- | name: "Sodio Acetato", | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, sodium: 667, potassium: 0, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 99 | ||
- | }, | ||
- | kcl: { | ||
- | name: " | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, sodium: 0, potassium: 1000, | ||
- | protein: 0, carbs: 0, lipids: 0, energy: 0, water: 99 | ||
- | } | ||
- | }; | ||
- | |||
- | // Database medici | ||
- | const doctorsData = { | ||
- | dr_bellu: { name: " | ||
- | dr_condo: { name: " | ||
- | dr_maccioni: | ||
- | dr_meroni: { name: " | ||
- | dr_calzatini: | ||
- | dr_ferrari: { name: " | ||
- | }; | ||
- | |||
- | // VARIABILI GLOBALI | ||
- | let patientData = {}; | ||
- | let enteralData = null; | ||
- | window.currentActiveReport = null; | ||
- | |||
- | // INIZIALIZZAZIONE | ||
- | document.addEventListener(' | ||
- | // Imposta data odierna | ||
- | const today = new Date().toISOString().split(' | ||
- | document.getElementById(' | ||
- | }); | ||
- | |||
- | // FUNZIONE TAB | ||
- | function showTab(tabId) { | ||
- | // Rimuovi classe active da tutti i contenuti | ||
- | document.querySelectorAll(' | ||
- | content.classList.remove(' | ||
}); | }); | ||
| | ||
- | | + | |
- | | + | if (button) |
- | | + | |
- | }); | + | |
- | + | | |
- | // Mostra il contenuto selezionato | + | |
- | const targetContent = document.getElementById(tabId); | + | button.innerHTML = 'Aggiorna Componenti Parenterali'; |
- | | + | }, 3000); |
- | | + | |
} | } | ||
- | | ||
- | // Attiva la tab cliccata | ||
- | event.target.closest(' | ||
} | } | ||
- | // FUNZIONE CALCOLO FASE | + | function |
- | function | + | // Aggiorna Prenidina FM85 predefinita |
- | const medicalRecord | + | const proteinEl |
- | | + | |
- | const currentWeight | + | fortifierData.prenidina_fm85.protein = parseFloat(proteinEl.value); |
- | const daysOfLife | + | |
- | const bun = document.getElementById(' | + | |
- | const glucose | + | |
- | const sodium | + | |
- | const ph = document.getElementById(' | + | |
- | const baseExcess | + | |
- | const diuresis = document.getElementById(' | + | |
- | const prescriptionDate | + | |
- | const prescribingDoctor = document.getElementById(' | + | |
- | + | ||
- | patientData | + | |
- | medicalRecord: | + | |
- | birthWeight: | + | |
- | currentWeight: | + | |
- | daysOfLife: daysOfLife, | + | |
- | bun: bun, | + | |
- | glucose: glucose, | + | |
- | sodium: sodium, | + | |
- | ph: ph, | + | |
- | baseExcess: baseExcess, | + | |
- | diuresis: diuresis, | + | |
- | prescriptionDate: | + | |
- | prescribingDoctor: | + | |
- | }; | + | |
- | + | ||
- | | + | |
- | + | ||
- | let phase = daysOfLife <= 5 ? ' | + | |
- | let bunStatus = ''; | + | |
- | let bunWarning = ''; | + | |
- | + | ||
- | // Analisi BUN | + | |
- | if (bun && bun !== '' | + | |
- | const bunValue = parseFloat(bun); | + | |
- | if (bunValue < 9) { | + | |
- | bunStatus = 'Basso - Aumentare proteine'; | + | |
- | bunWarning = 'BUN basso: considerare aumento proteine'; | + | |
- | } else if (bunValue > 14) { | + | |
- | bunStatus = ' | + | |
- | bunWarning = 'BUN elevato: ridurre proteine'; | + | |
- | } else { | + | |
- | bunStatus = ' | + | |
- | } | + | |
- | } else { | + | |
- | bunStatus = 'Non inserito' | + | |
} | } | ||
| | ||
- | | + | |
- | | + | |
- | | + | button.className |
- | | + | |
- | if (medicalRecord) | + | |
- | | + | |
+ | button.innerHTML = 'Aggiorna Fortificanti'; | ||
+ | }, 3000); | ||
} | } | ||
- | phaseInfoHtml += '< | ||
- | phaseInfoHtml += '< | ||
- | phaseInfoHtml += '< | ||
- | phaseInfoHtml += '</ | ||
- | phaseInfoHtml += '< | ||
- | phaseInfoHtml += '< | ||
- | if (patientData.bun) { | ||
- | phaseInfoHtml += '< | ||
- | } | ||
- | phaseInfoHtml += '</ | ||
- | phaseInfoHtml += '</ | ||
- | | ||
- | if (bunWarning) { | ||
- | phaseInfoHtml += '< | ||
- | } | ||
- | | ||
- | phaseInfoHtml += '< | ||
- | | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | | ||
- | document.getElementById(' | ||
- | document.getElementById(' | ||
- | | ||
- | updateSodiumRecommendation(); | ||
} | } | ||
- | function | + | function |
- | | + | |
- | } | + | |
- | + | ||
- | // FUNZIONE FORTIFICANTE | + | |
- | function updateFortifierOptions() { | + | |
- | const formulaType | + | |
- | const fortifierSection = document.getElementById(' | + | |
| | ||
- | | + | |
- | fortifierSection.classList.remove(' | + | const oldValues |
- | } else { | + | |
- | fortifierSection.classList.add(' | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | function updateConcentrationDisplay() { | + | |
- | const concentration | + | |
- | document.getElementById(' | + | |
- | } | + | |
- | + | ||
- | // FUNZIONE CALCOLO ENTERALE | + | |
- | function calculateEnteral() { | + | |
- | if (!patientData.birthWeight) | + | |
- | | + | |
- | return; | + | |
- | } | + | |
- | + | ||
- | | + | |
- | const dailyVolume = parseFloat(document.getElementById(' | + | |
- | const additionalFluids = parseFloat(document.getElementById(' | + | |
- | + | ||
- | const currentWeight = patientData.currentWeight; | + | |
- | const totalFluids = dailyVolume + additionalFluids; | + | |
- | const totalFluidsPerKg = (totalFluids / currentWeight) * 1000; | + | |
- | + | ||
- | if (formulaType === ' | + | |
- | enteralData = { | + | |
- | volume: dailyVolume, | + | |
- | additionalFluids: | + | |
- | totalFluids: | + | |
- | protein: 0, carbs: 0, lipids: 0, energy: 0, | + | |
- | sodium: 0, potassium: 0, calcium: 0, phosphorus: 0, magnesium: 0 | + | |
- | }; | + | |
| | ||
- | | + | |
- | if (additionalFluids > 0) { | + | if (nameEl) { |
- | | + | |
- | | + | const newSurname = document.getElementById('doctor_' + key + '_surname').value.trim(); |
- | } else { | + | const newTitle = document.getElementById(' |
- | | + | |
+ | doctorsData[key].name | ||
+ | | ||
+ | | ||
+ | doctorsData[key].fullName = newTitle + ' ' | ||
+ | |||
+ | if (JSON.stringify(oldValues) !== JSON.stringify(doctorsData[key])) { | ||
+ | changesCount++; | ||
+ | } | ||
} | } | ||
- | tableHtml += '</ | + | |
- | + | ||
- | document.getElementById(' | + | |
- | | + | |
- | const formula = formulaData[formulaType]; | + | |
- | const volumePerKg = (dailyVolume / currentWeight) * 1000; | + | |
- | + | ||
- | enteralData = { | + | |
- | volume: dailyVolume, | + | |
- | additionalFluids: | + | |
- | totalFluids: | + | |
- | protein: (dailyVolume * formula.protein / 100) / (currentWeight / 1000), | + | |
- | carbs: (dailyVolume * formula.carbs / 100) / (currentWeight / 1000), | + | |
- | lipids: (dailyVolume * formula.lipids / 100) / (currentWeight / 1000), | + | |
- | energy: (dailyVolume * formula.energy / 100) / (currentWeight / 1000), | + | |
- | sodium: (dailyVolume * formula.sodium / 100) / (currentWeight / 1000), | + | |
- | potassium: (dailyVolume * formula.potassium / 100) / (currentWeight / 1000), | + | |
- | calcium: (dailyVolume * formula.calcium / 100) / (currentWeight / 1000), | + | |
- | phosphorus: (dailyVolume * formula.phosphorus / 100) / (currentWeight / 1000), | + | |
- | magnesium: (dailyVolume * formula.magnesium / 100) / (currentWeight / 1000) | + | |
- | }; | + | |
- | + | ||
- | let tableHtml = '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | if (additionalFluids > 0) { | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | } else { | + | |
- | tableHtml += '< | + | |
- | } | + | |
- | tableHtml += '</ | + | |
- | + | ||
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '</ | + | |
- | + | ||
- | document.getElementById(' | + | |
- | } | + | |
| | ||
- | | + | |
+ | populateDoctorsConfigTable(); | ||
| | ||
- | const enteralBtn | + | const button |
- | if (enteralBtn) { | + | if (button) { |
- | | + | |
- | | + | |
+ | setTimeout(() => { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | }, 3000); | ||
} | } | ||
} | } | ||
- | // FUNZIONE CARICAMENTO VALORI DEFAULT | + | function |
- | function | + | const button = document.getElementById(' |
- | if (!patientData.birthWeight) { | + | if (button) { |
- | | + | |
- | | + | button.innerHTML = ' |
+ | setTimeout(() => { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | | ||
} | } | ||
| | ||
- | | + | |
- | const birthWeight = patientData.birthWeight; | + | |
- | + | ||
- | const weightCategorySelect = document.getElementById(' | + | |
- | let selectedCategory = weightCategorySelect.value || (birthWeight <= 1500 ? ' | + | |
- | weightCategorySelect.value = selectedCategory; | + | |
- | + | ||
- | let plan = {}; | + | |
- | if (selectedCategory === ' | + | |
- | plan = targetDay <= 3 ? {liquids: 100, protein: 3.5, carbs: 8.0, lipids: 1.0} : | + | |
- | | + | |
- | } else { | + | |
- | plan = targetDay <= 3 ? {liquids: 120, protein: 3.0, carbs: 8.0, lipids: 2.0} : | + | |
- | | + | |
- | } | + | |
- | + | ||
- | // Aggiustamento BUN | + | |
- | if (patientData.bun && patientData.bun !== '' | + | |
- | const bunValue = parseFloat(patientData.bun); | + | |
- | if (bunValue < 9) { | + | |
- | plan.protein = Math.min(6.0, | + | |
- | } else if (bunValue > 14) { | + | |
- | plan.protein = Math.max(2.0, | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | + | ||
- | // Vitamine/ | + | |
- | const currentWeight = patientData.currentWeight; | + | |
- | const enteralVolumePerKg = enteralData ? (enteralData.totalFluids / currentWeight * 1000) : 0; | + | |
- | + | ||
- | if (targetDay >= 3 && enteralVolumePerKg < 100) { | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | } else { | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | } | + | |
- | + | ||
- | document.getElementById(' | + | |
- | + | ||
- | const loadBtn = document.getElementById(' | + | |
- | if (loadBtn) { | + | |
- | loadBtn.className = ' | + | |
- | loadBtn.innerHTML = ' | + | |
- | } | + | |
} | } | ||
- | function | + | // FUNZIONI CONFIGURAZIONE CLINICA AVANZATA (NUOVE) |
- | | + | function |
- | | + | |
- | | + | |
+ | | ||
+ | clinicalConfig.maxGIR = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxLipids = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxProtein = parseFloat(document.getElementById(' | ||
| | ||
- | | + | |
- | | + | ' |
- | | + | '• Fosforo standard: |
- | | + | '• GIR massimo: |
- | } else { | + | '• Lipidi massimi: |
- | carbLabel.textContent = ' | + | |
- | | + | |
- | carbInput.setAttribute('step', '0.1'); | + | |
- | } | + | |
} | } | ||
- | function | + | function |
- | // Placeholder | + | // Reset configurazione clinica |
- | } | + | |
- | + | | |
- | function updateSodiumChoice() { | + | |
- | | + | |
- | } | + | |
- | + | | |
- | // FUNZIONE CALCOLO FABBISOGNI | + | |
- | function calculateNutrition() { | + | |
- | | + | |
- | alert('Prima inserire i dati del paziente nel TAB 1'); | + | |
- | | + | |
- | | + | |
| | ||
- | | + | |
- | | + | document.getElementById(' |
- | | + | document.getElementById(' |
- | | + | document.getElementById(' |
- | carbUnit: document.getElementById(' | + | document.getElementById(' |
- | | + | |
- | calcium: parseFloat(document.getElementById(' | + | |
- | phosphorus: parseFloat(document.getElementById(' | + | |
- | magnesium: parseFloat(document.getElementById(' | + | |
- | sodium: parseFloat(document.getElementById(' | + | |
- | potassium: parseFloat(document.getElementById(' | + | |
- | vitalipid: parseFloat(document.getElementById(' | + | |
- | soluvit: parseFloat(document.getElementById(' | + | |
- | peditrace: parseFloat(document.getElementById(' | + | |
- | carnitine: parseFloat(document.getElementById(' | + | |
- | }; | + | |
| | ||
- | // Converti carboidrati sempre in g/kg/die per i calcoli | + | // Reset configurazione clinica globale |
- | | + | |
- | | + | |
- | + | | |
- | const currentWeight = patientData.currentWeight; | + | |
- | + | | |
- | const enteralProtein = enteralData ? enteralData.protein | + | |
- | const enteralCarbs = enteralData ? enteralData.carbs | + | |
- | const enteralLipids = enteralData ? enteralData.lipids : 0; | + | |
- | const enteralEnergy = enteralData ? enteralData.energy : 0; | + | |
- | + | | |
- | const residualProtein = Math.max(0, requirements.protein - enteralProtein); | + | |
- | const residualCarbs = Math.max(0, carbsGPerKgDay - enteralCarbs); | + | |
- | const residualLipids = Math.max(0, requirements.lipids - enteralLipids); | + | |
- | const totalEnergyRequirement = (requirements.protein * 4) + (carbsGPerKgDay * 4) + (requirements.lipids * 9); | + | |
- | const residualEnergy = Math.max(0, totalEnergyRequirement - enteralEnergy); | + | |
- | + | ||
- | // Calcoli micronutrienti enterali | + | |
- | const enteralCalcium = enteralData ? enteralData.calcium | + | |
- | const enteralPhosphorus = enteralData ? enteralData.phosphorus : 0; | + | |
- | const enteralMagnesium = enteralData ? enteralData.magnesium : 0; | + | |
- | const enteralSodium = enteralData ? enteralData.sodium : 0; | + | |
- | const enteralPotassium = enteralData ? enteralData.potassium : 0; | + | |
- | + | ||
- | // Calcoli residui micronutrienti | + | |
- | const residualCalcium = Math.max(0, requirements.calcium - enteralCalcium); | + | |
- | const residualPhosphorus = Math.max(0, requirements.phosphorus - enteralPhosphorus); | + | |
- | const residualMagnesium = Math.max(0, requirements.magnesium - enteralMagnesium); | + | |
- | const residualSodium = Math.max(0, requirements.sodium - enteralSodium); | + | |
- | const residualPotassium = Math.max(0, requirements.potassium - enteralPotassium); | + | |
- | + | ||
- | window.residualNeeds = { | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | calcium: residualCalcium, | + | |
- | phosphorus: residualPhosphorus, | + | |
- | magnesium: residualMagnesium, | + | |
- | sodium: residualSodium, | + | |
- | potassium: residualPotassium, | + | |
- | vitalipid: requirements.vitalipid, | + | |
- | soluvit: requirements.soluvit, | + | |
- | | + | |
- | carnitine: requirements.carnitine, | + | |
- | energy: residualEnergy, | + | |
- | totalEnergyRequirement: | + | |
}; | }; | ||
| | ||
- | | + | |
- | const carbsMgPerKgMin = (carbsGPerKgDay * 1000) / 1440; | + | |
- | const enteralCarbsMgPerKgMin = (enteralCarbs * 1000) / 1440; | + | |
- | const residualCarbsMgPerKgMin = (residualCarbs * 1000) / 1440; | + | |
- | + | ||
- | let tableHtml = '<table class=" | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '< | + | |
- | tableHtml += '</ | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
} | } | ||
- | // FUNZIONE CALCOLO ELETTROLITI AGGIUNTIVI | + | function |
- | function | + | const config |
- | const additions | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | providedCalcium: | + | |
- | providedPhosphorus: | + | |
- | providedMagnesium: | + | |
- | providedSodium: | + | |
- | providedPotassium: | + | |
- | sodiumSource: | + | |
}; | }; | ||
| | ||
- | | + | |
- | | + | clinicalConfig.hospitalName |
- | | + | |
+ | | ||
| | ||
- | | + | // Simula salvataggio configurazione |
- | const totalPhosphorusNeeded = phosphorusNeeded * currentWeightKg; | + | |
- | const totalMagnesiumNeeded = magnesiumNeeded * currentWeightKg; | + | |
- | const totalSodiumNeeded = sodiumNeeded * currentWeightKg; | + | |
- | const totalPotassiumNeeded = potassiumNeeded * currentWeightKg; | + | |
- | + | ||
- | | + | |
- | | + | |
- | additions.ca_gluconato | + | |
- | additions.providedCalcium = totalCalciumNeeded; | + | |
- | | + | |
- | + | ||
- | // Esafosfina | + | |
- | if (totalPhosphorusNeeded > 0) { | + | |
- | additions.esafosfina = totalPhosphorusNeeded / (parenteralConfig.esafosfina.phosphorus / 100); | + | |
- | additions.providedPhosphorus = totalPhosphorusNeeded; | + | |
- | additions.providedSodium += (additions.esafosfina * parenteralConfig.esafosfina.sodium / 100); | + | |
- | } | + | |
- | + | ||
- | // Magnesio Solfato (800 mEq Mg/100ml) | + | |
- | if (totalMagnesiumNeeded > 0) { | + | |
- | additions.mg_sulfate = totalMagnesiumNeeded / (parenteralConfig.mg_sulfate.magnesium / 100); | + | |
- | additions.providedMagnesium = totalMagnesiumNeeded; | + | |
- | } | + | |
- | + | ||
- | // Sodio rimanente | + | |
- | const remainingSodium = Math.max(0, totalSodiumNeeded - additions.providedSodium); | + | |
- | + | ||
- | if (remainingSodium > 0) { | + | |
- | if (selectedSodiumType === 'sodium_acetate' | + | |
- | const concentrationSodiumAcetate = parenteralConfig.sodium_acetate.sodium / 100; | + | |
- | additions.sodium_acetate = remainingSodium / concentrationSodiumAcetate; | + | |
- | } else { | + | |
- | const concentrationNaCl = parenteralConfig.nacl.sodium / 100; | + | |
- | additions.nacl = remainingSodium / concentrationNaCl; | + | |
- | } | + | |
- | additions.providedSodium += remainingSodium; | + | |
- | } | + | |
- | + | ||
- | // Potassio Cloruro (1000 mEq K/100ml) | + | |
- | if (totalPotassiumNeeded > 0) { | + | |
- | additions.kcl = totalPotassiumNeeded / (parenteralConfig.kcl.potassium / 100); | + | |
- | additions.providedPotassium = totalPotassiumNeeded; | + | |
- | } | + | |
- | + | ||
- | additions.totalVolume = additions.ca_gluconato + additions.esafosfina + additions.mg_sulfate + additions.nacl + additions.sodium_acetate + additions.kcl; | + | |
- | + | ||
- | return additions; | + | |
} | } | ||
- | // FUNZIONE CALCOLO NPT PARENTERALE | + | // FUNZIONI REPORT (COMPLETE CON TUTTI GLI ELEMENTI) |
- | function | + | function |
- | if (!window.residualNeeds) { | + | if (!window.residualNeeds |
- | alert(' | + | alert(' |
return; | return; | ||
} | } | ||
| | ||
- | const currentWeight | + | const currentDate |
- | const currentWeightKg | + | const currentTime |
- | const residualNeeds | + | const prescriptionPatientWeightKg = patientData.currentWeight / 1000; |
+ | const calc = window.nptCalculation; | ||
| | ||
- | | + | if (!calc) { |
- | + | | |
- | const electrolyteAdditions = calculateElectrolyteAdditions( | + | |
- | residualNeeds.calcium, | + | |
- | residualNeeds.phosphorus, | + | |
- | residualNeeds.magnesium, | + | |
- | residualNeeds.sodium, | + | |
- | residualNeeds.potassium, | + | |
- | currentWeightKg | + | |
- | ); | + | |
- | + | ||
- | const proteinVolume = Math.round((residualNeeds.protein * currentWeightKg * 100) / 6); | + | |
- | const lipidVolume = Math.round((residualNeeds.lipids * currentWeightKg * 100) / 20); | + | |
- | + | ||
- | const vitaminsVolume = (residualNeeds.vitalipid * currentWeightKg) + (residualNeeds.soluvit * currentWeightKg) + (residualNeeds.peditrace * currentWeightKg); | + | |
- | const carnitineVolume = residualNeeds.carnitine > 0 ? (residualNeeds.carnitine * currentWeightKg) / 100 : 0; | + | |
- | + | ||
- | const neededGlucose = residualNeeds.carbs * currentWeightKg; | + | |
- | const glucose50Volume = (neededGlucose * 100) / 50; | + | |
- | + | ||
- | const usedVolume = proteinVolume + lipidVolume + vitaminsVolume + carnitineVolume + glucose50Volume + electrolyteAdditions.totalVolume; | + | |
- | const waterVolume = totalVolume - usedVolume; | + | |
- | + | ||
- | let glucoseMessage = ''; | + | |
- | + | ||
- | | + | |
- | | + | |
- | '• Volume totale richiesto: ' + totalVolume + ' ml< | + | |
- | '• Volume utilizzato: ' + usedVolume.toFixed(1) + ' | + | |
- | '• Acqua rimanente: ' + waterVolume.toFixed(1) + ' ml (NEGATIVO!)< | + | |
- | '< | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
return; | return; | ||
} | } | ||
| | ||
- | | + | |
- | glucoseMessage = '< | + | |
- | '• Tutto il glucosio necessario proviene dall\' | + | |
- | '• Non necessario glucosio in NPT</ | + | |
- | + | ||
- | document.getElementById(' | + | |
- | | + | |
- | glucoseMessage = '< | + | |
- | '• Glucosio necessario: ' + neededGlucose.toFixed(1) + ' | + | |
- | '• Glucosio 50%: ' + glucose50Volume.toFixed(1) + ' | + | |
- | '• Acqua bidistillata: | + | |
- | '• < | + | |
- | + | ||
- | document.getElementById(' | + | |
- | } | + | |
| | ||
- | | + | |
- | | + | |
- | document.getElementById(' | + | doctorsData[patientData.prescribingDoctor].fullName : 'Non specificato'); |
| | ||
- | let resultHtml | + | let html = '< |
| | ||
- | | + | |
- | resultHtml += '< | + | html += '< |
- | resultHtml += '< | + | |
- | resultHtml += '< | + | |
- | resultHtml += '</ | + | |
| | ||
- | | + | |
- | | + | html += '<div style="text-align: left;">'; |
+ | | ||
+ | html += '< | ||
+ | html += '<p style=" | ||
+ | html += '</div>'; | ||
| | ||
- | | + | |
- | | + | |
- | } | + | html += '<h1 style=" |
+ | html += '</div>'; | ||
| | ||
- | | + | |
- | resultHtml += '< | + | |
| | ||
- | | + | // TITOLO DOCUMENTO |
- | resultHtml += '< | + | |
- | | + | |
- | if (electrolyteAdditions.esafosfina > 0) { | + | |
- | resultHtml | + | |
- | | + | |
- | if (electrolyteAdditions.mg_sulfate > 0) { | + | |
- | resultHtml | + | |
- | } | + | |
- | if (electrolyteAdditions.nacl > 0) { | + | |
- | resultHtml += '< | + | |
- | | + | |
- | if (electrolyteAdditions.sodium_acetate > 0) { | + | |
- | resultHtml | + | |
- | | + | |
- | if (electrolyteAdditions.kcl > 0) { | + | |
- | resultHtml | + | |
- | } | + | |
| | ||
- | | + | |
- | const vitalipidVolume | + | html += '< |
- | | + | html += '< |
- | | + | html += '< |
- | if (residualNeeds.soluvit | + | |
- | const soluvitVolume | + | html += '<p>< |
- | | + | html += '<p><strong> |
- | | + | html += '< |
- | if (residualNeeds.peditrace > 0) { | + | |
- | const peditraceVolume = residualNeeds.peditrace * currentWeightKg; | + | html += '< |
- | resultHtml | + | |
- | | + | |
+ | html += '<p><strong> | ||
+ | html += '</div>'; | ||
+ | html += '</div>'; | ||
+ | | ||
| | ||
- | if (residualNeeds.carnitine | + | |
- | | + | html += '< |
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | // ACQUA BIDISTILLATA | ||
+ | | ||
+ | | ||
} | } | ||
| | ||
- | if (waterVolume | + | |
- | | + | |
+ | | ||
} | } | ||
| | ||
- | | + | |
- | resultHtml | + | html += '< |
| | ||
- | | + | |
+ | html += '< | ||
| | ||
- | // PREPARAZIONE CON DEFLUSSORE | + | // ELETTROLITI (SE PRESENTI) |
- | | + | |
- | const totalVolumeWithDeflector = totalVolume | + | |
- | + | ||
- | let preparationHtml | + | |
- | preparationHtml += '< | + | |
- | preparationHtml += '• < | + | |
- | preparationHtml += '• < | + | |
- | preparationHtml += '</ | + | |
- | + | ||
- | preparationHtml += '< | + | |
- | preparationHtml += '<tr>< | + | |
- | + | ||
- | const ratio = totalVolumeWithDeflector / totalVolume; | + | |
- | + | ||
- | if (neededGlucose > 0) { | + | |
- | preparationHtml | + | |
} | } | ||
- | | + | |
- | preparationHtml += '< | + | |
- | | + | |
- | + | ||
- | if (electrolyteAdditions.ca_gluconato | + | |
- | preparationHtml += '< | + | |
} | } | ||
- | if (electrolyteAdditions.esafosfina | + | if (calc.electrolyteAdditions.mg_sulfate |
- | | + | |
} | } | ||
- | if (electrolyteAdditions.mg_sulfate | + | if (calc.electrolyteAdditions.nacl > 0) { |
- | | + | |
} | } | ||
- | if (electrolyteAdditions.nacl > 0) { | + | if (calc.electrolyteAdditions.sodium_acetate |
- | | + | |
} | } | ||
- | if (electrolyteAdditions.sodium_acetate | + | if (calc.electrolyteAdditions.kcl > 0) { |
- | | + | |
- | } | + | |
- | if (electrolyteAdditions.kcl | + | |
- | preparationHtml += '< | + | |
} | } | ||
| | ||
- | if (residualNeeds.vitalipid > 0) { | + | |
- | const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | + | |
- | | + | const vitalipidVolume = window.residualNeeds.vitalipid * prescriptionPatientWeightKg; |
+ | | ||
} | } | ||
- | if (residualNeeds.soluvit > 0) { | + | if (window.residualNeeds.soluvit > 0) { |
- | const soluvitVolume = residualNeeds.soluvit * currentWeightKg; | + | const soluvitVolume = window.residualNeeds.soluvit * prescriptionPatientWeightKg; |
- | | + | |
} | } | ||
- | if (residualNeeds.peditrace > 0) { | + | if (window.residualNeeds.peditrace > 0) { |
- | const peditraceVolume = residualNeeds.peditrace * currentWeightKg; | + | const peditraceVolume = window.residualNeeds.peditrace * prescriptionPatientWeightKg; |
- | | + | |
} | } | ||
| | ||
- | if (residualNeeds.carnitine > 0) { | + | |
- | | + | |
+ | | ||
+ | html += '< | ||
} | } | ||
| | ||
- | | + | |
- | | + | |
- | | + | |
| | ||
- | | + | |
- | | + | html += '<div style="background-color: #fff3cd; border: 1px solid #ffc107; border-radius: |
+ | html += '< | ||
+ | html += '<p>< | ||
+ | html += '<p><strong> | ||
+ | html += '<p><strong>Via di somministrazione: | ||
+ | html += '<p><strong>Durata:</strong> 24 ore continue</p>'; | ||
+ | | ||
| | ||
- | | + | |
- | | + | html += '<div style=" |
+ | html += '< | ||
+ | | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | html += '</ | ||
| | ||
- | | + | document.getElementById(' |
- | window.nptCalculationData = { | + | |
- | currentWeight, | + | |
- | proteinVolume, | + | |
- | glucose50Volume, | + | |
- | }; | + | |
- | + | ||
- | const parenteralBtn = document.getElementById(' | + | |
- | if (parenteralBtn) { | + | |
- | parenteralBtn.className = ' | + | |
- | parenteralBtn.innerHTML = 'NPT CALCOLATA ✓'; | + | |
- | } | + | |
} | } | ||
- | // FUNZIONI REPORT | + | function |
- | function | + | if (!window.residualNeeds || !patientData.currentWeight) { |
- | if (!window.nptCalculationData) { | + | alert(' |
- | alert(' | + | |
return; | return; | ||
} | } | ||
| | ||
- | const reportHtml | + | const calc = window.nptCalculation; |
- | document.getElementById(' | + | if (!calc) { |
- | document.getElementById(' | + | alert(' |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | | + | |
- | + | ||
- | const generateBtn = document.getElementById(' | + | |
- | generateBtn.innerHTML = ' | + | |
- | generateBtn.className = ' | + | |
- | } | + | |
- | + | ||
- | function generateAndShowFinalReport() { | + | |
- | if (!window.nptCalculationData) { | + | |
- | alert(' | + | |
return; | return; | ||
} | } | ||
| | ||
- | const reportHtml | + | const currentDate |
- | document.getElementById('nptFinalReport').innerHTML = reportHtml; | + | |
- | | + | |
- | | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | window.currentActiveReport = ' | + | |
| | ||
- | const generateBtn | + | const birthDate |
- | | + | |
- | generateBtn.className = ' | + | |
- | } | + | |
- | + | ||
- | function generateWorkReportHTML() { | + | |
- | const data = window.nptCalculationData; | + | |
- | const deflectorVolume = parseInt(document.getElementById(' | + | |
- | const totalVolumeWithDeflector = data.totalVolume + deflectorVolume; | + | |
- | const ratio = totalVolumeWithDeflector / data.totalVolume; | + | |
| | ||
- | const today = new Date(); | + | const deflectorVolume |
- | const dateStr | + | const totalVolumeWithDeflector = calc.totalVolume + deflectorVolume; |
+ | const ratio = totalVolumeWithDeflector / calc.totalVolume; | ||
| | ||
- | | + | |
- | | + | html += '< |
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</div>'; | ||
| | ||
- | | + | |
- | const finalConcentration | + | |
- | const estimatedOsmolarity = (finalConcentration * 55).toFixed(0); | + | |
| | ||
- | | + | html += '< |
- | + | html += '<h3 style="margin-top: 0; color: #2c3e50;"> | |
- | // Header | + | html += '<p>< |
- | html += '<div class="report-header">'; | + | html += '<p>< |
- | html += '<div class=" | + | html += '<p>< |
- | html += '<div style=" | + | html += '<p>< |
- | html += '<div style=" | + | |
- | html += '</div>'; | + | |
- | html += '<div class=" | + | |
html += '</ | html += '</ | ||
| | ||
- | | + | html += '< |
- | | + | html += '<h4 style="margin-top: 0; color: #856404;">PARAMETRI NUTRIZIONALI</h4>'; |
- | html += '< | + | html += '<p><strong>GIR:</strong> ' + calc.gir.toFixed(1) |
- | html += '<table class="report-table">' | + | html += '<p><strong>Velocità infusione:</strong> ' + (calc.totalVolume |
- | html += '< | + | html += '<p><strong>Durata:</strong> 24 ore continue</p>'; |
- | html += '<tr><td class=" | + | |
- | html += '<tr><td class=" | + | |
- | html += '< | + | |
- | html += '<tr><td class=" | + | |
- | html += '</table>'; | + | |
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></ | ||
| | ||
- | | + | html += '< |
- | | + | |
- | } | + | if (calc.neededGlucose |
- | if (data.glucose50Volume > 0) { | + | html += '< |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.ca_gluconato > 0) { | + | |
- | html += '< | + | |
- | | + | |
- | if (data.electrolyteAdditions.nacl | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.sodium_acetate > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.kcl > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.electrolyteAdditions.mg_sulfate > 0) { | + | |
- | html += '< | + | |
- | } | + | |
- | if (data.carnitineVolume > 0) { | + | |
- | html += '< | + | |
} | } | ||
| | ||
- | html += '< | + | html += '< |
| | ||
- | | + | html += '< |
- | | + | |
- | } | + | |
- | if (data.residualNeeds.peditrace > 0) { | + | |
- | const peditraceVolume | + | |
- | 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 += '< | + | |
- | } | + | |
| | ||
- | html += '< | + | html += '< |
+ | html += '</ | ||
| | ||
- | | + | html += '<div style="background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 5px; padding: 15px; margin: 20px 0;">'; |
- | | + | html += '<h4 style="margin-top: 0; color: #856404;">AVVERTENZE</h4>'; |
- | html += '<tr>< | + | html += '<ul>'; |
- | html += '<tr><td class=" | + | html += '<li>Preparazione sterile in cappa a flusso laminare</li>'; |
- | html += '<tr><td class=" | + | html += '<li>Seguire rigorosamente l\' |
- | html += '</table>'; | + | html += '<li>Intralipid sempre per ultimo</li>'; |
+ | html += '<li>Conservare a 2-8°C, usare entro 24 ore</li>'; | ||
+ | html += '</ul>'; | ||
html += '</ | html += '</ | ||
| | ||
- | html += '< | + | html += '< |
- | html += 'NPT Calculator v2.0 - Foglio di Lavoro 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 deflectorVolume = parseInt(document.getElementById('deflectorVolume').value) || 30; | + | |
- | const totalVolumeWithDeflector | + | alert('Prima calcolare la NPT completa'); |
- | const ratio = totalVolumeWithDeflector / data.totalVolume; | + | return; |
+ | } | ||
+ | |||
+ | const { jsPDF } = window.jspdf; | ||
+ | const doc = new jsPDF(); | ||
| | ||
- | | + | |
- | | + | doc.setFontSize(10); |
+ | | ||
+ | doc.text('Direttore: | ||
| | ||
- | | + | // Logo ASST (posizionamento approssimativo) |
- | | + | |
- | new Date(new Date(patientData.prescriptionDate).getTime() - (patientData.daysOfLife * 24 * 60 * 60 * 1000)).toLocaleDateString(' | + | |
- | ' | + | |
- | const doctorName = patientData.prescribingDoctor ? | + | |
- | doctorsData[patientData.prescribingDoctor]? | + | |
| | ||
- | const infusionRate | + | const currentDate |
- | | + | |
- | const estimatedOsmolarity = (finalConcentration * 55 + data.electrolyteAdditions.totalVolume * 10).toFixed(0); | + | |
| | ||
- | | + | |
+ | generateFoglioLavoroPDF(doc); | ||
+ | } else if (type === ' | ||
+ | generateReportParenteralePDF(doc); | ||
+ | } | ||
| | ||
- | // INTESTAZIONE | + | // Salva il PDF |
- | | + | |
- | html += '< | + | |
- | html += '<div style=" | + | } |
- | html += '<div style=" | + | |
- | | + | function generateFoglioLavoroPDF(doc) { |
- | | + | // Implementazione semplificata del PDF |
- | | + | |
| | ||
- | | + | |
- | | + | doc.text('FOGLIO DI LAVORO NPT', 20, yPos); |
+ | | ||
| | ||
- | | + | |
- | html += '< | + | |
- | | + | |
- | html += '<table class=" | + | |
- | html += '< | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | html += '< | + | |
- | html += '< | + | |
- | | + | |
- | html += '</ | + | |
| | ||
- | | + | |
- | html += '< | + | |
- | | + | |
- | if (enteralData && enteralData.volume > 0) { | + | doc.text('GIR: ' + calc.gir.toFixed(1) |
- | const formulaName = document.getElementById('formulaType').value; | + | |
- | const formulaDisplayName = formulaData[formulaName]? | + | |
- | | + | } |
- | html += '< | + | |
- | html += '< | + | function generateReportParenteralePDF(doc) { |
- | | + | // Implementazione semplificata del PDF |
- | | + | let yPos = 50; |
- | html += '< | + | |
- | html += '< | + | |
- | html += '< | + | |
- | html += '</table>'; | + | |
- | } | + | |
- | | + | |
| | ||
- | | + | |
- | html += '< | + | |
- | html += '< | + | |
- | | + | |
- | | + | |
| | ||
- | | + | |
- | | + | |
- | | + | |
+ | doc.text('Data: ' + new Date().toLocaleDateString('it-IT' | ||
+ | } | ||
+ | |||
+ | // FUNZIONI PLACEHOLDER | ||
+ | function showAddEnteralForm() { | ||
+ | alert('Aggiungi nuova formula enterale - Implementazione completa nel codice sorgente' | ||
+ | } | ||
+ | |||
+ | function showAddFortifierForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddParenteralForm() { | ||
+ | alert('Aggiungi nuovo componente parenterale - Implementazione completa nel codice sorgente'); | ||
+ | } | ||
+ | |||
+ | function showAddDoctorForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function removeEnteralFormula(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
} | } | ||
- | if (data.glucose50Volume > 0) { | + | } |
- | html += '< | + | |
+ | function removeParenteralComponent(key) { | ||
+ | | ||
+ | alert('Rimozione componente - Implementazione completa nel codice sorgente'); | ||
} | } | ||
- | if (data.electrolyteAdditions.ca_gluconato > 0) { | + | } |
- | html += '< | + | |
+ | function removeFortifier(key) { | ||
+ | | ||
+ | alert('Rimozione fortificante - Implementazione completa nel codice sorgente'); | ||
} | } | ||
- | if (data.electrolyteAdditions.nacl > 0) { | + | } |
- | html += '< | + | |
+ | function removeDoctor(key) { | ||
+ | | ||
+ | alert('Rimozione medico - Implementazione completa nel codice sorgente'); | ||
} | } | ||
- | 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 += '< | ||
- | | ||
- | // Totali | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '</ | ||
- | html += '</ | ||
- | | ||
- | // TOTALE ELEMENTI PRO KILO | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | | ||
- | // Calcoli degli elementi totali (enterale + parenterale) | ||
- | const totalLiquids = (enteralData ? enteralData.totalFluids : 0) + data.totalVolume; | ||
- | const totalLiquidsPerKg = (totalLiquids / data.currentWeightKg).toFixed(2); | ||
- | | ||
- | const totalProtein = (enteralData ? enteralData.protein * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.protein * data.currentWeightKg / 1000); | ||
- | const totalLipids = (enteralData ? enteralData.lipids * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.lipids * data.currentWeightKg / 1000); | ||
- | const totalCarbs = (enteralData ? enteralData.carbs * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.carbs * data.currentWeightKg / 1000); | ||
- | const totalCalcium = (enteralData ? enteralData.calcium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.calcium * data.currentWeightKg / 1000); | ||
- | const totalPhosphorus = (enteralData ? enteralData.phosphorus * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.phosphorus * data.currentWeightKg / 1000); | ||
- | const totalSodium = (enteralData ? enteralData.sodium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.sodium * data.currentWeightKg / 1000); | ||
- | const totalPotassium = (enteralData ? enteralData.potassium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.potassium * data.currentWeightKg / 1000); | ||
- | const totalMagnesium = (enteralData ? enteralData.magnesium * data.currentWeightKg / 1000 : 0) + (data.residualNeeds.magnesium * data.currentWeightKg / 1000); | ||
- | 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 += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '< | ||
- | html += '</ | ||
- | html += '</ | ||
- | | ||
- | html += '< | ||
- | html += 'NPT Calculator v2.0 - Report Parenterale generato il ' + new Date().toLocaleString(' | ||
- | html += '</ | ||
- | | ||
- | html += '</ | ||
- | | ||
- | return html; | ||
} | } | ||
- | function printCurrentReport() { | + | // INIZIALIZZAZIONE |
- | const reportContent = window.currentActiveReport === ' | + | document.addEventListener('DOMContentLoaded', function() { |
- | document.getElementById('nptWorkReport').innerHTML : | + | |
- | | + | |
| | ||
- | const reportTitle | + | |
- | 'Foglio di Lavoro NPT' : ' | + | |
+ | | ||
| | ||
- | | + | |
+ | setupMedicalRecordField(); | ||
| | ||
- | | + | document.getElementById(' |
- | | + | document.getElementById('currentWeight').value = this.value; |
- | < | + | }); |
- | < | + | |
- | < | + | |
- | < | + | |
- | body { margin: 0; padding: 15px; font-family: | + | |
- | ${document.querySelector('style').textContent} | + | |
- | </ | + | |
- | </ | + | |
- | < | + | |
- | ${reportContent} | + | |
- | </ | + | |
- | </ | + | |
- | `); | + | |
| | ||
- | | + | |
- | printWindow.print(); | + | const requirementFields |
- | } | + | |
- | + | 'reqCalcium', ' | |
- | function updateSystemConfig() { | + | 'reqSodium', ' |
- | const updateBtn | + | ]; |
- | | + | |
- | | + | |
| | ||
- | | + | |
- | | + | |
- | | + | |
- | }, 3000); | + | field.addEventListener('input', function() { |
- | } | + | resetNutritionButton(); |
- | + | }); | |
- | // FUNZIONE SALVATAGGIO PDF | + | field.addEventListener(' |
- | async function saveReportAsPDF() { | + | resetNutritionButton(); |
- | if (!window.currentActiveReport || !window.nptCalculationData) { | + | }); |
- | | + | } |
- | | + | }); |
+ | |||
+ | | ||
+ | const sodiumTypeSelect = document.getElementById(' | ||
+ | if (sodiumTypeSelect) { | ||
+ | | ||
+ | updateSodiumChoice(); | ||
+ | updateSodiumRecommendation(); | ||
+ | | ||
} | } | ||
| | ||
- | | + | // Event listener per il volume del deflussore |
- | | + | const deflectorVolumeInput |
- | const savePdfBtn = document.getElementById(' | + | |
- | const originalText = savePdfBtn.innerHTML; | + | |
- | savePdfBtn.innerHTML = '⏳ Generando PDF...'; | + | |
- | savePdfBtn.disabled = true; | + | |
- | + | ||
- | // Seleziona | + | |
- | const reportElement | + | |
- | | + | |
- | document.getElementById(' | + | |
- | + | ||
- | const reportTitle = window.currentActiveReport === ' | + | |
- | ' | + | |
- | + | ||
- | // Genera il nome file con data e cartella | + | |
- | const today = new Date(); | + | |
- | | + | |
- | const medicalRecord = patientData.medicalRecord || ' | + | |
- | const fileName = `NPT_${reportTitle}_${medicalRecord}_${dateStr}.pdf`; | + | |
- | + | ||
- | // Configurazione html2canvas per qualità migliore | + | |
- | const canvas = await html2canvas(reportElement, | + | |
- | scale: 2, // Migliore qualità | + | |
- | useCORS: true, | + | |
- | backgroundColor: | + | |
- | width: reportElement.offsetWidth, | + | |
- | height: reportElement.offsetHeight, | + | |
- | scrollX: 0, | + | |
- | scrollY: 0 | + | |
}); | }); | ||
- | | ||
- | // Crea PDF con dimensioni A4 | ||
- | const { jsPDF } = window.jspdf; | ||
- | const pdf = new jsPDF({ | ||
- | orientation: | ||
- | unit: ' | ||
- | format: ' | ||
- | }); | ||
- | | ||
- | // Calcola dimensioni per adattare alla pagina A4 | ||
- | const imgWidth = 210; // A4 width in mm | ||
- | const pageHeight = 297; // A4 height in mm | ||
- | const imgHeight = (canvas.height * imgWidth) / canvas.width; | ||
- | | ||
- | let heightLeft = imgHeight; | ||
- | let position = 0; | ||
- | | ||
- | // Aggiungi l' | ||
- | pdf.addImage(canvas.toDataURL(' | ||
- | heightLeft -= pageHeight; | ||
- | | ||
- | // Se il contenuto è più lungo di una pagina, aggiungi pagine | ||
- | while (heightLeft >= 0) { | ||
- | position = heightLeft - imgHeight; | ||
- | pdf.addPage(); | ||
- | pdf.addImage(canvas.toDataURL(' | ||
- | heightLeft -= pageHeight; | ||
- | } | ||
- | | ||
- | // Aggiungi metadati al PDF | ||
- | pdf.setProperties({ | ||
- | title: `NPT Calculator - ${reportTitle}`, | ||
- | subject: ' | ||
- | author: 'NPT Calculator v2.0', | ||
- | keywords: 'NPT, Nutrizione Parenterale, | ||
- | creator: 'NPT Calculator v2.0' | ||
- | }); | ||
- | | ||
- | // Salva il PDF | ||
- | pdf.save(fileName); | ||
- | | ||
- | // Ripristina il pulsante | ||
- | savePdfBtn.innerHTML = '✅ PDF Salvato!'; | ||
- | savePdfBtn.style.backgroundColor = '# | ||
- | | ||
- | setTimeout(() => { | ||
- | savePdfBtn.innerHTML = originalText; | ||
- | savePdfBtn.style.backgroundColor = '# | ||
- | savePdfBtn.disabled = false; | ||
- | }, 3000); | ||
- | | ||
- | // Mostra messaggio di conferma | ||
- | const confirmationMsg = document.createElement(' | ||
- | confirmationMsg.innerHTML = ` | ||
- | <div style=" | ||
- | padding: 15px 20px; border-radius: | ||
- | < | ||
- | File: ${fileName}< | ||
- | < | ||
- | </ | ||
- | `; | ||
- | document.body.appendChild(confirmationMsg); | ||
- | | ||
- | setTimeout(() => { | ||
- | document.body.removeChild(confirmationMsg); | ||
- | }, 5000); | ||
- | | ||
- | } catch (error) { | ||
- | console.error(' | ||
- | alert(' | ||
- | | ||
- | // Ripristina il pulsante in caso di errore | ||
- | const savePdfBtn = document.getElementById(' | ||
- | savePdfBtn.innerHTML = '💾 Salva PDF'; | ||
- | savePdfBtn.disabled = false; | ||
} | } | ||
- | } | + | |
+ | // 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(' | ||
+ | }); | ||
</ | </ | ||
+ | |||
</ | </ | ||
</ | </ |