Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Prossima revisione | Revisione precedente | ||
docuneo:programma_npt [2025/07/29 17:47] – creata - modifica esterna 127.0.0.1 | 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 165: | Linea 173: | ||
} | } | ||
- | .phase-transition | + | .phase-transizione |
background-color: | background-color: | ||
color: #856404; | color: #856404; | ||
} | } | ||
- | .phase-stabilization | + | .phase-stabilizzazione |
background-color: | background-color: | ||
color: #0c5460; | color: #0c5460; | ||
} | } | ||
- | .phase-growth | + | .phase-crescita |
background-color: | background-color: | ||
color: #155724; | color: #155724; | ||
Linea 213: | Linea 221: | ||
} | } | ||
- | /* CSS TAB ORIZZONTALI | + | /* CSS TAB ORIZZONTALI |
.tabs { | .tabs { | ||
display: flex; | display: flex; | ||
Linea 222: | Linea 230: | ||
.tab { | .tab { | ||
- | padding: | + | padding: |
background-color: | background-color: | ||
border: 1px solid #ddd; | border: 1px solid #ddd; | ||
Linea 230: | 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 336: | Linea 345: | ||
background-color: | background-color: | ||
text-align: left !important; | text-align: left !important; | ||
+ | } | ||
+ | |||
+ | /* SEZIONE NUOVA PER TAB 5 CONFIGURAZIONE AVANZATA */ | ||
+ | .config-advanced { | ||
+ | background-color: | ||
+ | border: 2px solid #17a2b8; | ||
+ | border-radius: | ||
+ | padding: 20px; | ||
+ | margin: 20px 0; | ||
+ | } | ||
+ | |||
+ | .config-advanced h3 { | ||
+ | color: #0c5460; | ||
+ | margin-top: 0; | ||
+ | border-bottom: | ||
+ | padding-bottom: | ||
+ | } | ||
+ | |||
+ | .monitoring-table { | ||
+ | width: 100%; | ||
+ | border-collapse: | ||
+ | margin: 15px 0; | ||
+ | font-size: 12px; | ||
+ | } | ||
+ | |||
+ | .monitoring-table th, .monitoring-table td { | ||
+ | border: 1px solid #17a2b8; | ||
+ | padding: 8px; | ||
+ | text-align: left; | ||
+ | } | ||
+ | |||
+ | .monitoring-table th { | ||
+ | background-color: | ||
+ | color: white; | ||
+ | } | ||
+ | |||
+ | .alert-critical { | ||
+ | background-color: | ||
+ | color: white; | ||
+ | padding: 15px; | ||
+ | border-radius: | ||
+ | margin: 15px 0; | ||
+ | font-weight: | ||
+ | } | ||
+ | |||
+ | /* REPORT SECTION */ | ||
+ | .report-output { | ||
+ | border: 2px solid #3498db; | ||
+ | border-radius: | ||
+ | padding: 30px; | ||
+ | margin-top: 30px; | ||
+ | background-color: | ||
+ | font-family: | ||
+ | line-height: | ||
+ | } | ||
+ | |||
+ | .medical-header { | ||
+ | text-align: center; | ||
+ | border-bottom: | ||
+ | padding-bottom: | ||
+ | margin-bottom: | ||
+ | } | ||
+ | |||
+ | .medical-header h1 { | ||
+ | font-size: 24px; | ||
+ | color: #2c3e50; | ||
+ | margin: 5px 0; | ||
+ | } | ||
+ | |||
+ | .medical-header h2 { | ||
+ | font-size: 18px; | ||
+ | color: #34495e; | ||
+ | margin: 3px 0; | ||
+ | } | ||
+ | |||
+ | .medical-header p { | ||
+ | font-size: 14px; | ||
+ | color: #7f8c8d; | ||
+ | margin: 2px 0; | ||
+ | } | ||
+ | |||
+ | .no-print { | ||
+ | display: block; | ||
+ | } | ||
+ | |||
+ | @media print { | ||
+ | .no-print { | ||
+ | display: none !important; | ||
+ | } | ||
+ | body { | ||
+ | background: white; | ||
+ | } | ||
+ | .container { | ||
+ | box-shadow: none; | ||
+ | } | ||
} | } | ||
</ | </ | ||
Linea 342: | Linea 446: | ||
<div class=" | <div class=" | ||
- | < | + | < |
+ | <div class=" | ||
+ | < | ||
+ | </div> | ||
| | ||
<!-- TAB ORIZZONTALI CORRETTI --> | <!-- TAB ORIZZONTALI CORRETTI --> | ||
<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 369: | Linea 481: | ||
< | < | ||
</ | </ | ||
+ | <div class=" | ||
+ | < | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <select id=" | ||
+ | <!-- Popolato dinamicamente --> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | <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=" | ||
<div class=" | <div class=" | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | </ | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
Linea 402: | Linea 544: | ||
<label for=" | <label for=" | ||
<input type=" | <input type=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
</ | </ | ||
<div class=" | <div class=" | ||
Linea 413: | Linea 559: | ||
< | < | ||
< | < | ||
+ | < | ||
< | < | ||
</ | </ | ||
Linea 427: | Linea 574: | ||
</ | </ | ||
- | <!-- TAB 2: NUTRIZIONE ENTERALE --> | + | <!-- TAB 2: NUTRIZIONE ENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 517: | Linea 664: | ||
</ | </ | ||
- | <button id=" | + | <button id=" |
</ | </ | ||
Linea 526: | Linea 673: | ||
</ | </ | ||
- | <!-- TAB 3: CALCOLO FABBISOGNI --> | + | <!-- TAB 3: CALCOLO FABBISOGNI |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 566: | Linea 713: | ||
</ | </ | ||
<div class=" | <div class=" | ||
- | <label for=" | + | |
+ | <select id=" | ||
+ | <option value=" | ||
+ | <option value=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | | ||
<input type=" | <input type=" | ||
</ | </ | ||
Linea 576: | Linea 730: | ||
<div class=" | <div class=" | ||
<div class=" | <div class=" | ||
- | <label for=" | + | <label for=" |
<input type=" | <input type=" | ||
</ | </ | ||
Linea 584: | Linea 738: | ||
</ | </ | ||
<div class=" | <div class=" | ||
- | <label for=" | + | <label for=" |
- | <input type=" | + | <input type=" |
</ | </ | ||
<div class=" | <div class=" | ||
<label for=" | <label for=" | ||
<input type=" | <input type=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <select id=" | ||
+ | <option value=" | ||
+ | <option value=" | ||
+ | </ | ||
+ | </ | ||
+ | <div id=" | ||
+ | <!-- Popolato dinamicamente --> | ||
</ | </ | ||
<div class=" | <div class=" | ||
Linea 600: | Linea 764: | ||
<div class=" | <div class=" | ||
<div class=" | <div class=" | ||
- | < | + | < |
<div class=" | <div class=" | ||
- | <label for=" | + | <label for=" |
<input type=" | <input type=" | ||
</ | </ | ||
<div class=" | <div class=" | ||
- | <label for=" | + | <label for=" |
<input type=" | <input type=" | ||
</ | </ | ||
<div class=" | <div class=" | ||
- | <label for=" | + | <label for=" |
<input type=" | <input type=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
</ | </ | ||
</ | </ | ||
Linea 617: | Linea 785: | ||
<div class=" | <div class=" | ||
< | < | ||
- | < | + | < |
< | < | ||
- | < | + | < |
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
</ | </ | ||
</ | </ | ||
Linea 631: | Linea 803: | ||
</ | </ | ||
- | <!-- TAB 4: NUTRIZIONE PARENTERALE --> | + | <!-- TAB 4: NUTRIZIONE PARENTERALE |
<div id=" | <div id=" | ||
<div class=" | <div class=" | ||
Linea 667: | Linea 839: | ||
<div id=" | <div id=" | ||
- | <h3>Composizione NPT Finale</h3> | + | <h3>Prescrizione parenterale</h3> |
<div id=" | <div id=" | ||
+ | | ||
+ | <h3 style=" | ||
+ | <div id=" | ||
+ | | ||
+ | <div style=" | ||
+ | <button class=" | ||
+ | <button class=" | ||
+ | </ | ||
</ | </ | ||
</ | </ | ||
- | <!-- TAB 5: CONFIGURAZIONE --> | + | <!-- TAB 5: REPORT FINALE (SPOSTATO DA TAB 6) --> |
+ | <div id=" | ||
+ | <div class=" | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | <div class=" | ||
+ | < | ||
+ | <button class=" | ||
+ | <button class=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | |||
+ | <div id=" | ||
+ | </ | ||
+ | |||
+ | <!-- TAB 6: CONFIGURAZIONE | ||
<div id=" | <div id=" | ||
<div class=" | <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=" | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
| | ||
Linea 709: | Linea 926: | ||
<div class=" | <div class=" | ||
<button class=" | <button class=" | ||
- | </ | ||
- | </ | ||
- | | ||
- | <!-- Form per aggiungere nuova formula enterale --> | ||
- | <div id=" | ||
- | < | ||
- | <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=" | ||
- | <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=" | ||
- | <div class=" | ||
- | <button class=" | ||
- | <button class=" | ||
- | </ | ||
</ | </ | ||
</ | </ | ||
Linea 859: | Linea 1015: | ||
<div class=" | <div class=" | ||
- | <h2>Vitamine e Oligoelementi</h2> | + | <h2>Lista Medici Prescrittori</h2> |
+ | <div class=" | ||
+ | < | ||
+ | Gestisci la lista dei medici prescrittori. Le modifiche si applicano automaticamente alla dropdown del TAB 1. | ||
+ | </div> | ||
<div style=" | <div style=" | ||
<table class=" | <table class=" | ||
< | < | ||
<tr> | <tr> | ||
- | <th style=" | + | <th style=" |
- | <th>Dose Pediatrica</ | + | < |
- | <th>Dose Max</ | + | < |
- | <th>Contenuto Acqua</ | + | < |
- | <th style=" | + | <th> |
+ | </ | ||
+ | </ | ||
+ | <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=" | ||
+ | < | ||
+ | </ | ||
+ | <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> | ||
</ | </ | ||
< | < | ||
<tr> | <tr> | ||
- | < | + | < |
- | | + | <td>Ogni 6-8h</ |
- | <td>10 ml/die</ | + | <td>70-110 mg/dL</ |
- | <td>9 ml H₂O/10ml</ | + | <td>Aggiustare velocità glucosio</td> |
- | < | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | < |
- | | + | <td>Ogni 24-48h</ |
- | <td>5 ml/die</ | + | <td>Na: 135-145, K: 3.5-5.0</ |
- | <td>4.75 ml H₂O/5ml</ | + | <td>Modificare apporti NPT</td> |
- | < | + | |
</tr> | </tr> | ||
<tr> | <tr> | ||
- | < | + | <td>< |
- | <td>1 ml/kg/die</ | + | <td>Ogni 48h</td> |
- | <td>10 ml/die</ | + | < |
- | <td>0.99 ml H₂O/ml</ | + | <td>Aggiustare proteine< |
- | < | + | </ |
+ | < | ||
+ | < | ||
+ | <td>2 volte/settimana</ | ||
+ | <td>< 150 mg/ | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
</tr> | </tr> | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
- | </ | ||
- | | + | |
- | <h2>Gestione Configurazioni</h2> | + | <h2>⚠️ ALERT AUTOMATICI</ |
- | <div class=" | + | <div class=" |
- | <div class=" | + | <strong>INTERRUZIONE IMMEDIATA NPT SE:</strong>< |
- | <button class=" | + | |
- | <p style=" | + | • Trigliceridi > 400 mg/dL<br> |
+ | • AST/ALT > 3x valore normale< | ||
+ | • Segni di sepsi cateter-correlata< | ||
+ | • Edema importante con bilancio positivo > 20 ml/kg/die | ||
</ | </ | ||
- | <div class=" | + | |
- | <input type=" | + | |
- | | + | <strong> |
- | <p style=" | + | |
+ | | ||
+ | • BUN < 5 mg/dL → Aumentare proteine< | ||
+ | • Trigliceridi 200-400 mg/dL → Ridurre/ | ||
+ | • Ipernatremia → Ridurre sodio, aumentare liquidi liberi | ||
</ | </ | ||
</ | </ | ||
- | | + | |
- | <div class=" | + | <div class=" |
- | <button | + | < |
- | <p style=" | + | |
- | </ | + | <div class=" |
- | <div class=" | + | <div class=" |
- | < | + | <label for=" |
- | <strong>💾 Salvataggio Automatico Attivo</strong><br> | + | <input type=" |
- | | + | </ |
+ | <div class="input-group"> | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | | ||
+ | </ | ||
+ | <div class=" | ||
+ | < | ||
+ | <label for="autoSave"> | ||
+ | <select id=" | ||
+ | <option value=" | ||
+ | <option value=" | ||
+ | </ | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <select id=" | ||
+ | <option value=" | ||
+ | | ||
+ | <option value=" | ||
+ | </select> | ||
+ | | ||
</ | </ | ||
</ | </ | ||
+ | <button class=" | ||
+ | <button class=" | ||
</ | </ | ||
</ | </ | ||
<div id=" | <div id=" | ||
- | < | + | < |
<div id=" | <div id=" | ||
</ | </ | ||
Linea 933: | Linea 1206: | ||
< | < | ||
- | // DATI NUTRIZIONALI COMPLETI | + | // DATI NUTRIZIONALI COMPLETI |
const formulaData = { | const formulaData = { | ||
maternal: { name: "Latte Materno", | maternal: { name: "Latte Materno", | ||
Linea 946: | Linea 1219: | ||
}; | }; | ||
- | // CONFIGURAZIONI PARENTERALI COMPLETE | + | // CONFIGURAZIONI PARENTERALI COMPLETE |
const parenteralConfig = { | const parenteralConfig = { | ||
trophamine: { | trophamine: { | ||
Linea 961: | Linea 1234: | ||
description: | description: | ||
notes: " | notes: " | ||
- | }, | ||
- | glucose10: { | ||
- | name: " | ||
- | protein: 0, carbs: 10.0, lipids: 0, sodium: 0, potassium: 0, | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, energy: 40, water: 90, | ||
- | description: | ||
- | notes: " | ||
- | }, | ||
- | glucose20: { | ||
- | name: " | ||
- | protein: 0, carbs: 20.0, lipids: 0, sodium: 0, potassium: 0, | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, energy: 80, water: 80, | ||
- | description: | ||
- | notes: " | ||
- | }, | ||
- | glucose33: { | ||
- | name: " | ||
- | protein: 0, carbs: 33.0, lipids: 0, sodium: 0, potassium: 0, | ||
- | calcium: 0, phosphorus: 0, magnesium: 0, energy: 132, water: 67, | ||
- | description: | ||
- | notes: " | ||
}, | }, | ||
glucose50: { | glucose50: { | ||
Linea 1017: | Linea 1269: | ||
description: | description: | ||
notes: "10 mEq Na/ml. Prima scelta per supplementazione sodio" | notes: "10 mEq Na/ml. Prima scelta per supplementazione sodio" | ||
+ | }, | ||
+ | sodium_acetate: | ||
+ | name: "Sodio Acetato (2 mEq/ | ||
+ | protein: 0, carbs: 0, lipids: 0, sodium: 667, potassium: 0, | ||
+ | calcium: 0, phosphorus: 0, magnesium: 0, energy: 0, water: 99, | ||
+ | description: | ||
+ | notes: "6.67 mEq Na/ml. Per acidosi: pH < 7.25 o BE < -4" | ||
}, | }, | ||
kcl: { | kcl: { | ||
Linea 1024: | Linea 1283: | ||
description: | description: | ||
notes: "10 mEq K/ml. Max velocità infusione: 0.5 mEq/ | 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/ | ||
} | } | ||
}; | }; | ||
Linea 1035: | Linea 1302: | ||
dose: " | dose: " | ||
} | } | ||
+ | }; | ||
+ | |||
+ | // Database medici dinamico | ||
+ | let doctorsData = { | ||
+ | dr_bellu: { name: " | ||
+ | dr_condo: { name: " | ||
+ | dr_maccioni: | ||
+ | dr_meroni: { name: " | ||
+ | dr_calzatini: | ||
+ | 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 1042: | Linea 1330: | ||
let currentRequirements = null; | let currentRequirements = null; | ||
- | // FUNZIONI DI SALVATAGGIO PERSISTENTE | + | // CONFIGURAZIONE CLINICA AVANZATA |
- | function saveToStorage() { | + | let clinicalConfig |
- | const configData | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | localStorage.setItem(' | + | |
- | | + | |
- | | + | }; |
- | console.error(' | + | |
- | | + | |
- | } | + | |
- | function | + | // FUNZIONE RESET PULSANTE FABBISOGNI |
- | | + | function |
- | | + | const nutritionBtn |
- | if (savedData) { | + | if (nutritionBtn) { |
- | const configData | + | |
- | + | nutritionBtn.innerHTML = ' | |
- | // Aggiorna | + | |
- | if (configData.formulaData) { | + | // Nascondi |
- | Object.assign(formulaData, | + | const nutritionResults = document.getElementById(' |
- | } | + | if (nutritionResults) { |
- | | + | |
- | Object.assign(parenteralConfig, | + | |
- | | + | |
- | if (configData.fortifierData) { | + | |
- | Object.assign(fortifierData, | + | |
- | } | + | |
- | + | ||
- | console.log('Configurazione caricata dal localStorage: | + | |
- | return true; | + | |
} | } | ||
- | } catch (error) { | + | |
- | | + | // Reset anche il pulsante NPT perché i fabbisogni sono cambiati |
+ | | ||
} | } | ||
- | return false; | ||
} | } | ||
- | function | + | // FUNZIONE RESET PULSANTE PARENTERALE |
- | if (confirm('Sei sicuro di voler ripristinare tutti i valori di default? Tutte le modifiche verranno perse.' | + | function |
- | | + | const parenteralBtn = document.getElementById(' |
- | | + | if (parenteralBtn) { |
+ | parenteralBtn.className = 'button'; | ||
+ | parenteralBtn.innerHTML = ' | ||
+ | |||
+ | // Reset anche i campi visualizzati | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | | ||
+ | | ||
+ | |||
+ | // Nascondi i risultati precedenti | ||
+ | const parenteralResults = document.getElementById(' | ||
+ | if (parenteralResults) { | ||
+ | parenteralResults.classList.add(' | ||
+ | } | ||
} | } | ||
- | } | ||
- | |||
- | // FUNZIONE CALCOLO ELETTROLITI AGGIUNTIVI | ||
- | function calculateElectrolyteAdditions(calciumNeeded, | ||
- | const additions = { | ||
- | ca_gluconato: | ||
- | esafosfina: 0, | ||
- | mg_sulfate: 0, | ||
- | nacl: 0, | ||
- | kcl: 0, | ||
- | totalVolume: | ||
- | providedCalcium: | ||
- | providedPhosphorus: | ||
- | providedMagnesium: | ||
- | providedSodium: | ||
- | providedPotassium: | ||
- | }; | ||
- | | ||
- | // Calcola fabbisogni totali per paziente | ||
- | const totalCalciumNeeded = calciumNeeded * currentWeightKg; | ||
- | const totalPhosphorusNeeded = phosphorusNeeded * currentWeightKg; | ||
- | const totalMagnesiumNeeded = magnesiumNeeded * currentWeightKg; | ||
- | const totalSodiumNeeded = sodiumNeeded * currentWeightKg; | ||
- | const totalPotassiumNeeded = potassiumNeeded * currentWeightKg; | ||
- | | ||
- | // Calcio Gluconato 10% (840 mg Ca/100ml) | ||
- | if (totalCalciumNeeded > 0) { | ||
- | additions.ca_gluconato = totalCalciumNeeded / (parenteralConfig.ca_gluconato.calcium / 100); | ||
- | additions.providedCalcium = totalCalciumNeeded; | ||
- | } | ||
- | | ||
- | // Esafosfina (1600 mg P/100ml + 130 mEq Na/100ml) | ||
- | if (totalPhosphorusNeeded > 0) { | ||
- | additions.esafosfina = totalPhosphorusNeeded / (parenteralConfig.esafosfina.phosphorus / 100); | ||
- | additions.providedPhosphorus = totalPhosphorusNeeded; | ||
- | // Esafosfina fornisce anche sodio | ||
- | 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 (dopo quello da Esafosfina) | ||
- | const remainingSodium = Math.max(0, totalSodiumNeeded - additions.providedSodium); | ||
- | if (remainingSodium > 0) { | ||
- | additions.nacl = remainingSodium / (parenteralConfig.nacl.sodium / 100); | ||
- | additions.providedSodium += remainingSodium; | ||
- | } | ||
- | | ||
- | // Potassio Cloruro (1000 mEq K/100ml) | ||
- | if (totalPotassiumNeeded > 0) { | ||
- | 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.kcl; | ||
- | | ||
- | return additions; | ||
} | } | ||
Linea 1177: | Linea 1406: | ||
} | } | ||
| | ||
- | // Popola le tabelle di configurazione quando si apre il TAB 5 | + | // Popola le tabelle di configurazione quando si apre il TAB 6 (ora config) |
if (tabId === ' | if (tabId === ' | ||
setTimeout(() => { | setTimeout(() => { | ||
populateEnteralConfigTable(); | populateEnteralConfigTable(); | ||
populateParenteralConfigTable(); | populateParenteralConfigTable(); | ||
- | | + | |
}, 100); | }, 100); | ||
} | } | ||
} | } | ||
- | // FUNZIONE CALCOLO FASE NUTRIZIONALE | + | // FUNZIONE GESTIONE CARTELLA CLINICA |
+ | function setupMedicalRecordField() { | ||
+ | const medicalRecordInput = document.getElementById(' | ||
+ | const currentYear = new Date().getFullYear().toString(); | ||
+ | |||
+ | // Imposta il valore iniziale con l'anno corrente | ||
+ | if (!medicalRecordInput.value) { | ||
+ | medicalRecordInput.value = currentYear; | ||
+ | } | ||
+ | |||
+ | // Gestisce l' | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | let value = e.target.value.replace(/ | ||
+ | |||
+ | // Se l' | ||
+ | if (value.length < 4 || !value.startsWith(currentYear)) { | ||
+ | value = currentYear + value.slice(4); | ||
+ | } | ||
+ | |||
+ | // Limita a 10 cifre totali | ||
+ | if (value.length > 10) { | ||
+ | value = value.slice(0, | ||
+ | } | ||
+ | |||
+ | e.target.value = value; | ||
+ | }); | ||
+ | |||
+ | // Quando il campo ottiene il focus, posiziona il cursore dopo l' | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | if (e.target.value === currentYear) { | ||
+ | // Posiziona il cursore alla fine | ||
+ | setTimeout(() => { | ||
+ | e.target.setSelectionRange(4, | ||
+ | }, 0); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | // Suggerimento visivo | ||
+ | medicalRecordInput.addEventListener(' | ||
+ | if (e.target.value === currentYear) { | ||
+ | e.target.placeholder = currentYear + ' | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function updateDoctorsDropdown() { | ||
+ | const prescribingDoctorSelect = document.getElementById(' | ||
+ | if (!prescribingDoctorSelect) return; | ||
+ | |||
+ | const currentValue = prescribingDoctorSelect.value; | ||
+ | prescribingDoctorSelect.innerHTML = '< | ||
+ | |||
+ | Object.keys(doctorsData).forEach(function(key) { | ||
+ | const doctor = doctorsData[key]; | ||
+ | const option = document.createElement(' | ||
+ | option.value = key; | ||
+ | option.textContent = doctor.fullName; | ||
+ | prescribingDoctorSelect.appendChild(option); | ||
+ | }); | ||
+ | |||
+ | // Ripristina il valore precedente se esiste ancora | ||
+ | if (currentValue && doctorsData[currentValue]) { | ||
+ | prescribingDoctorSelect.value = currentValue; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // FUNZIONE CALCOLO FASE NUTRIZIONALE | ||
function calculatePhase() { | function calculatePhase() { | ||
- | const birthWeight | + | const medicalRecord = document.getElementById(' |
- | const currentWeight | + | const phaseBirthWeight |
+ | const phaseCurrentWeight | ||
const daysOfLife = parseInt(document.getElementById(' | const daysOfLife = parseInt(document.getElementById(' | ||
const bun = document.getElementById(' | const bun = document.getElementById(' | ||
Linea 1196: | Linea 1492: | ||
const sodium = document.getElementById(' | const sodium = document.getElementById(' | ||
const ph = document.getElementById(' | const ph = document.getElementById(' | ||
+ | const baseExcess = document.getElementById(' | ||
const diuresis = document.getElementById(' | const diuresis = document.getElementById(' | ||
+ | const prescriptionDate = document.getElementById(' | ||
+ | const prescribingDoctorValue = document.getElementById(' | ||
+ | | ||
+ | // Trova il nome completo del medico | ||
+ | const doctorFullName = prescribingDoctorValue && doctorsData[prescribingDoctorValue] ? | ||
+ | doctorsData[prescribingDoctorValue].fullName : ''; | ||
| | ||
patientData = { | patientData = { | ||
- | | + | |
- | currentWeight: | + | |
+ | currentWeight: | ||
daysOfLife: daysOfLife, | daysOfLife: daysOfLife, | ||
bun: bun, | bun: bun, | ||
Linea 1206: | Linea 1510: | ||
sodium: sodium, | sodium: sodium, | ||
ph: ph, | ph: ph, | ||
- | diuresis: diuresis | + | |
+ | | ||
+ | prescriptionDate: | ||
+ | prescribingDoctor: | ||
+ | prescribingDoctorName: | ||
}; | }; | ||
| | ||
Linea 1258: | Linea 1566: | ||
} else if (phValue > 7.45) { | } else if (phValue > 7.45) { | ||
otherWarnings.push(' | 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(' | ||
} | } | ||
} | } | ||
Linea 1274: | Linea 1600: | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
- | phaseInfoHtml += '< | + | |
+ | phaseInfoHtml += '< | ||
+ | } | ||
+ | | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
Linea 1294: | Linea 1623: | ||
const phStatus = parseFloat(patientData.ph) >= 7.35 && parseFloat(patientData.ph) <= 7.45 ? ' | const phStatus = parseFloat(patientData.ph) >= 7.35 && parseFloat(patientData.ph) <= 7.45 ? ' | ||
phaseInfoHtml += '< | phaseInfoHtml += '< | ||
+ | } | ||
+ | if (patientData.baseExcess) { | ||
+ | const beStatus = parseFloat(patientData.baseExcess) >= -4 && parseFloat(patientData.baseExcess) <= 2 ? ' | ||
+ | phaseInfoHtml += '< | ||
} | } | ||
if (patientData.diuresis) { | if (patientData.diuresis) { | ||
Linea 1317: | Linea 1650: | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
- | } | + | |
- | + | // Aggiorna il suggerimento sodio se il TAB 3 è già stato visitato | |
- | // FUNZIONE AGGIORNAMENTO DISPLAY CONCENTRAZIONE | + | |
- | function updateConcentrationDisplay() { | + | |
- | | + | // RESET anche il pulsante NPT |
- | | + | resetParenteralButton(); |
} | } | ||
Linea 1347: | Linea 1680: | ||
} | } | ||
- | // FUNZIONE CALCOLO NUTRIZIONE ENTERALE | + | // FUNZIONE AGGIORNAMENTO DISPLAY CONCENTRAZIONE |
+ | function updateConcentrationDisplay() { | ||
+ | const concentration = document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | |||
+ | // FUNZIONE CALCOLO NUTRIZIONE ENTERALE | ||
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 1357: | Linea 1706: | ||
const dailyVolume = parseFloat(document.getElementById(' | const dailyVolume = parseFloat(document.getElementById(' | ||
const additionalFluids = parseFloat(document.getElementById(' | const additionalFluids = parseFloat(document.getElementById(' | ||
- | const fortifierType = document.getElementById(' | ||
- | const fortifierConcentration = parseFloat(document.getElementById(' | ||
| | ||
const currentWeight = patientData.currentWeight; | const currentWeight = patientData.currentWeight; | ||
Linea 1386: | Linea 1733: | ||
const formula = formulaData[formulaType]; | const formula = formulaData[formulaType]; | ||
const volumePerKg = (dailyVolume / currentWeight) * 1000; | const volumePerKg = (dailyVolume / currentWeight) * 1000; | ||
- | | ||
- | // Calcoli base della formula | ||
- | let totalProtein = formula.protein; | ||
- | let totalCarbs = formula.carbs; | ||
- | let totalLipids = formula.lipids; | ||
- | let totalSodium = formula.sodium; | ||
- | let totalPotassium = formula.potassium; | ||
- | let totalCalcium = formula.calcium; | ||
- | let totalPhosphorus = formula.phosphorus; | ||
- | let totalMagnesium = formula.magnesium; | ||
- | let totalEnergy = formula.energy; | ||
- | | ||
- | let fortifierInfo = ''; | ||
- | | ||
- | // Aggiunta fortificante se selezionato | ||
- | if (formulaType === ' | ||
- | const fortifier = fortifierData[fortifierType]; | ||
- | const fortifierGramsPer100ml = fortifierConcentration; | ||
- | | ||
- | const fortifierProteinPer100ml = (fortifier.protein * fortifierGramsPer100ml) / 100; | ||
- | const fortifierCarbsPer100ml = (fortifier.carbs * fortifierGramsPer100ml) / 100; | ||
- | const fortifierLipidsPer100ml = (fortifier.lipids * fortifierGramsPer100ml) / 100; | ||
- | const fortifierSodiumPer100ml = (fortifier.sodium * fortifierGramsPer100ml) / 100; | ||
- | const fortifierPotassiumPer100ml = (fortifier.potassium * fortifierGramsPer100ml) / 100; | ||
- | const fortifierCalciumPer100ml = (fortifier.calcium * fortifierGramsPer100ml) / 100; | ||
- | const fortifierPhosphorusPer100ml = (fortifier.phosphorus * fortifierGramsPer100ml) / 100; | ||
- | const fortifierMagnesiumPer100ml = (fortifier.magnesium * fortifierGramsPer100ml) / 100; | ||
- | const fortifierEnergyPer100ml = (fortifier.energy * fortifierGramsPer100ml) / 100; | ||
- | | ||
- | totalProtein += fortifierProteinPer100ml; | ||
- | totalCarbs += fortifierCarbsPer100ml; | ||
- | totalLipids += fortifierLipidsPer100ml; | ||
- | totalSodium += fortifierSodiumPer100ml; | ||
- | totalPotassium += fortifierPotassiumPer100ml; | ||
- | totalCalcium += fortifierCalciumPer100ml; | ||
- | totalPhosphorus += fortifierPhosphorusPer100ml; | ||
- | totalMagnesium += fortifierMagnesiumPer100ml; | ||
- | totalEnergy += fortifierEnergyPer100ml; | ||
- | | ||
- | fortifierInfo = '< | ||
- | } | ||
| | ||
// Calcoli finali per kg di peso | // Calcoli finali per kg di peso | ||
Linea 1433: | Linea 1739: | ||
additionalFluids: | additionalFluids: | ||
totalFluids: | totalFluids: | ||
- | protein: (dailyVolume * totalProtein | + | protein: (dailyVolume * formula.protein |
- | carbs: (dailyVolume * totalCarbs | + | carbs: (dailyVolume * formula.carbs |
- | lipids: (dailyVolume * totalLipids | + | lipids: (dailyVolume * formula.lipids |
- | energy: (dailyVolume * totalEnergy | + | energy: (dailyVolume * formula.energy |
- | sodium: (dailyVolume * totalSodium | + | sodium: (dailyVolume * formula.sodium |
- | potassium: (dailyVolume * totalPotassium | + | potassium: (dailyVolume * formula.potassium |
- | calcium: (dailyVolume * totalCalcium | + | calcium: (dailyVolume * formula.calcium |
- | phosphorus: (dailyVolume * totalPhosphorus | + | phosphorus: (dailyVolume * formula.phosphorus |
- | magnesium: (dailyVolume * totalMagnesium | + | magnesium: (dailyVolume * formula.magnesium |
}; | }; | ||
| | ||
let tableHtml = '< | let tableHtml = '< | ||
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '< | tableHtml += '< | ||
if (additionalFluids > 0) { | if (additionalFluids > 0) { | ||
Linea 1457: | Linea 1763: | ||
tableHtml += '< | tableHtml += '< | ||
tableHtml += '< | tableHtml += '< | ||
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '</ | tableHtml += '</ | ||
- | | ||
- | if (fortifierType !== ' | ||
- | tableHtml += '< | ||
- | tableHtml += '< | ||
- | tableHtml += '• < | ||
- | tableHtml += '• < | ||
- | tableHtml += '• < | ||
- | tableHtml += '• < | ||
- | tableHtml += '</ | ||
- | } | ||
| | ||
document.getElementById(' | document.getElementById(' | ||
Linea 1484: | Linea 1780: | ||
enteralBtn.innerHTML = ' | enteralBtn.innerHTML = ' | ||
} | } | ||
+ | | ||
+ | // RESET del pulsante Fabbisogni quando si modificano gli apporti enterali | ||
+ | resetNutritionButton(); | ||
} | } | ||
- | // FUNZIONE CARICAMENTO VALORI STANDARD | + | // FUNZIONE CARICAMENTO VALORI STANDARD |
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 1523: | 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(' | ||
| | ||
- | | + | |
- | | + | |
- | document.getElementById(' | + | |
- | | + | const ph = patientData.ph ? parseFloat(patientData.ph) : null; |
- | } | + | const be = patientData.baseExcess ? parseFloat(patientData.baseExcess) : null; |
- | + | ||
- | // FUNZIONE AGGIORNAMENTO VITAMINE | + | // Auto-seleziona Sodio Acetato se acidosi |
- | function updateVitaminsAndTrace() { | + | if ((ph && ph < 7.30) || (be && be < -4)) { |
- | | + | sodiumSelect.value = ' |
- | | + | } else { |
+ | sodiumSelect.value = ' | ||
+ | } | ||
} | } | ||
| | ||
- | | + | |
- | | + | |
- | const enteralVolumePerKg = enteralData ? (enteralData.totalFluids / currentWeight * 1000) : 0; | + | |
| | ||
- | | + | |
- | | + | |
- | | + | |
| | ||
- | if (targetDay >= 4) { | + | if (targetDay >= 3 && |
- | if (enteralVolumePerKg < 100) { | + | |
- | | + | |
- | | + | |
- | | + | } 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(' | + | document.getElementById(' |
- | | + | document.getElementById(' |
- | | + | |
- | document.getElementById(' | + | |
- | | + | resetNutritionButton(); |
- | if (document.getElementById('reqPeditrace').value == 0) { | + | } |
- | | + | |
+ | // FUNZIONE AGGIORNAMENTO UNITÀ CARBOIDRATI | ||
+ | function updateCarbUnit() { | ||
+ | const unit = document.getElementById(' | ||
+ | const carbLabel | ||
+ | const carbInput = document.getElementById(' | ||
+ | |||
+ | if (unit === ' | ||
+ | carbLabel.textContent = ' | ||
+ | carbInput.setAttribute(' | ||
+ | carbInput.setAttribute(' | ||
+ | } else { | ||
+ | | ||
+ | carbInput.setAttribute(' | ||
+ | carbInput.setAttribute(' | ||
} | } | ||
| | ||
- | | + | |
- | | + | |
- | soluvit: parseFloat(document.getElementById(' | + | |
- | peditrace: parseFloat(document.getElementById(' | + | |
- | enteralVolumePerKg: | + | |
- | }; | + | |
} | } | ||
// FUNZIONE AGGIORNAMENTO CATEGORIA PESO | // FUNZIONE AGGIORNAMENTO CATEGORIA PESO | ||
function updateWeightCategory() { | function updateWeightCategory() { | ||
- | | + | |
- | | + | |
} | } | ||
- | // FUNZIONE CALCOLO FABBISOGNI NUTRIZIONALI | + | // FUNZIONE AGGIORNAMENTO TIPO SODIO |
+ | function updateSodiumChoice() { | ||
+ | // 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 NUTRIZIONALI | ||
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 1593: | Linea 1998: | ||
protein: parseFloat(document.getElementById(' | protein: parseFloat(document.getElementById(' | ||
carbs: parseFloat(document.getElementById(' | carbs: parseFloat(document.getElementById(' | ||
+ | carbUnit: document.getElementById(' | ||
lipids: parseFloat(document.getElementById(' | lipids: parseFloat(document.getElementById(' | ||
calcium: parseFloat(document.getElementById(' | calcium: parseFloat(document.getElementById(' | ||
Linea 1599: | Linea 2005: | ||
sodium: parseFloat(document.getElementById(' | sodium: parseFloat(document.getElementById(' | ||
potassium: parseFloat(document.getElementById(' | potassium: parseFloat(document.getElementById(' | ||
- | vitalipid: parseFloat(document.getElementById(' | + | vitalipid: parseFloat(document.getElementById(' |
- | soluvit: parseFloat(document.getElementById(' | + | soluvit: parseFloat(document.getElementById(' |
- | peditrace: parseFloat(document.getElementById(' | + | peditrace: parseFloat(document.getElementById(' |
+ | carnitine: parseFloat(document.getElementById(' | ||
}; | }; | ||
| | ||
- | | + | |
- | requirements.vitalipid | + | |
- | | + | (requirements.carbs * 1440 / 1000) : requirements.carbs; |
- | | + | |
+ | const patientCurrentWeight | ||
+ | | ||
| | ||
const enteralProtein = enteralData ? enteralData.protein : 0; | const enteralProtein = enteralData ? enteralData.protein : 0; | ||
Linea 1615: | Linea 2024: | ||
| | ||
const residualProtein = Math.max(0, requirements.protein - enteralProtein); | const residualProtein = Math.max(0, requirements.protein - enteralProtein); | ||
- | const residualCarbs = Math.max(0, | + | const residualCarbs = Math.max(0, |
const residualLipids = Math.max(0, requirements.lipids - enteralLipids); | const residualLipids = Math.max(0, requirements.lipids - enteralLipids); | ||
- | const totalEnergyRequirement = (requirements.protein * 4) + (requirements.carbs | + | const totalEnergyRequirement = (requirements.protein * 4) + (carbsGPerKgDay |
const residualEnergy = Math.max(0, totalEnergyRequirement - enteralEnergy); | const residualEnergy = Math.max(0, totalEnergyRequirement - enteralEnergy); | ||
| | ||
Linea 1633: | Linea 2042: | ||
const residualSodium = Math.max(0, requirements.sodium - enteralSodium); | const residualSodium = Math.max(0, requirements.sodium - enteralSodium); | ||
const residualPotassium = Math.max(0, requirements.potassium - enteralPotassium); | const residualPotassium = Math.max(0, requirements.potassium - enteralPotassium); | ||
- | | ||
- | let bunNote = ''; | ||
- | if (patientData.bun && patientData.bun !== '' | ||
- | const bunValue = parseFloat(patientData.bun); | ||
- | if (bunValue < 9) { | ||
- | bunNote = '< | ||
- | } else if (bunValue > 14) { | ||
- | bunNote = '< | ||
- | } | ||
- | } | ||
- | | ||
- | let vitaminsNote = ''; | ||
- | if (vitaminsInfo.enteralVolumePerKg >= 100) { | ||
- | vitaminsNote = '< | ||
- | } else if (patientData.daysOfLife >= 4 && requirements.vitalipid > 0) { | ||
- | vitaminsNote = '< | ||
- | } else if (patientData.daysOfLife < 4) { | ||
- | vitaminsNote = '< | ||
- | } | ||
| | ||
window.residualNeeds = { | window.residualNeeds = { | ||
Linea 1666: | Linea 2056: | ||
soluvit: requirements.soluvit, | soluvit: requirements.soluvit, | ||
peditrace: requirements.peditrace, | peditrace: requirements.peditrace, | ||
+ | carnitine: requirements.carnitine, | ||
energy: residualEnergy, | energy: residualEnergy, | ||
totalEnergyRequirement: | totalEnergyRequirement: | ||
}; | }; | ||
+ | | ||
+ | // Calcola mg/kg/min per la tabella | ||
+ | const carbsMgPerKgMin = (carbsGPerKgDay * 1000) / 1440; | ||
+ | const enteralCarbsMgPerKgMin = (enteralCarbs * 1000) / 1440; | ||
+ | const residualCarbsMgPerKgMin = (residualCarbs * 1000) / 1440; | ||
| | ||
let tableHtml = '< | let tableHtml = '< | ||
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '< | tableHtml += '< | ||
tableHtml += '< | tableHtml += '< | ||
- | tableHtml += '< | + | tableHtml += '< |
+ | tableHtml += '< | ||
tableHtml += '< | tableHtml += '< | ||
- | | + | tableHtml += '< |
- | | + | |
tableHtml += '< | tableHtml += '< | ||
- | tableHtml += '< | + | tableHtml += '< |
tableHtml += '< | tableHtml += '< | ||
tableHtml += '< | tableHtml += '< | ||
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
- | tableHtml += '< | + | tableHtml += '< |
+ | tableHtml += '< | ||
tableHtml += '</ | tableHtml += '</ | ||
- | | ||
- | tableHtml += vitaminsNote; | ||
- | tableHtml += bunNote; | ||
| | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
- | document.getElementById(' | + | document.getElementById(' |
+ | |||
+ | // RESET del pulsante NPT quando si modificano i fabbisogni | ||
+ | resetParenteralButton(); | ||
+ | } | ||
+ | |||
+ | // FUNZIONE CALCOLO ELETTROLITI AGGIUNTIVI (DA VERSIONE 17) | ||
+ | function calculateElectrolyteAdditions(calciumNeeded, | ||
+ | const additions = { | ||
+ | ca_gluconato: | ||
+ | esafosfina: 0, | ||
+ | mg_sulfate: 0, | ||
+ | nacl: 0, | ||
+ | sodium_acetate: | ||
+ | kcl: 0, | ||
+ | totalVolume: | ||
+ | sodiumSource: | ||
+ | }; | ||
+ | |||
+ | // Determina il tipo di sodio da utilizzare | ||
+ | const sodiumTypeSelect = document.getElementById(' | ||
+ | const selectedSodiumType = sodiumTypeSelect ? sodiumTypeSelect.value : ' | ||
+ | additions.sodiumSource = selectedSodiumType; | ||
+ | |||
+ | // Calcola fabbisogni totali per paziente | ||
+ | const totalCalciumNeeded = calciumNeeded * currentWeightKg; | ||
+ | const totalPhosphorusNeeded = phosphorusNeeded * currentWeightKg; | ||
+ | const totalMagnesiumNeeded = magnesiumNeeded * currentWeightKg; | ||
+ | const totalSodiumNeeded = sodiumNeeded * currentWeightKg; | ||
+ | const totalPotassiumNeeded = potassiumNeeded * currentWeightKg; | ||
+ | |||
+ | // Calcio Gluconato 10% (840 mg Ca/100ml) | ||
+ | if (totalCalciumNeeded > 0) { | ||
+ | additions.ca_gluconato = totalCalciumNeeded / (parenteralConfig.ca_gluconato.calcium / 100); | ||
+ | } | ||
+ | |||
+ | // Esafosfina (1600 mg P/100ml + 130 mEq Na/100ml) | ||
+ | let sodiumFromEsafosfina = 0; | ||
+ | if (totalPhosphorusNeeded > 0) { | ||
+ | additions.esafosfina = totalPhosphorusNeeded / (parenteralConfig.esafosfina.phosphorus / 100); | ||
+ | sodiumFromEsafosfina = (additions.esafosfina * parenteralConfig.esafosfina.sodium / 100); | ||
+ | } | ||
+ | |||
+ | // Magnesio Solfato (800 mEq Mg/100ml) | ||
+ | if (totalMagnesiumNeeded > 0) { | ||
+ | additions.mg_sulfate = totalMagnesiumNeeded / (parenteralConfig.mg_sulfate.magnesium / 100); | ||
+ | } | ||
+ | |||
+ | // Sodio rimanente (dopo quello da Esafosfina) | ||
+ | const remainingSodium = Math.max(0, totalSodiumNeeded - sodiumFromEsafosfina); | ||
+ | |||
+ | if (remainingSodium > 0) { | ||
+ | if (selectedSodiumType === ' | ||
+ | const concentrationSodiumAcetate = parenteralConfig.sodium_acetate.sodium / 100; | ||
+ | additions.sodium_acetate = remainingSodium / concentrationSodiumAcetate; | ||
+ | } else { | ||
+ | const concentrationNaCl = parenteralConfig.nacl.sodium / 100; | ||
+ | additions.nacl = remainingSodium / concentrationNaCl; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Potassio Cloruro (1000 mEq K/100ml) | ||
+ | if (totalPotassiumNeeded > 0) { | ||
+ | additions.kcl = totalPotassiumNeeded / (parenteralConfig.kcl.potassium / 100); | ||
+ | } | ||
+ | |||
+ | // Volume totale degli elettroliti | ||
+ | additions.totalVolume = additions.ca_gluconato + additions.esafosfina + additions.mg_sulfate + additions.nacl + additions.sodium_acetate + additions.kcl; | ||
+ | |||
+ | return additions; | ||
} | } | ||
- | // FUNZIONE CALCOLO NPT PARENTERALE | + | // FUNZIONE CALCOLO NPT PARENTERALE |
function calculateParenteral() { | function calculateParenteral() { | ||
if (!window.residualNeeds) { | if (!window.residualNeeds) { | ||
Linea 1704: | 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 | // Volume totale residuo richiesto | ||
const totalVolume = Math.round(residualNeeds.liquids * currentWeightKg); | const totalVolume = Math.round(residualNeeds.liquids * currentWeightKg); | ||
| | ||
- | // Calcola elettroliti aggiuntivi necessari | + | // CALCOLA ELETTROLITI AGGIUNTIVI |
const electrolyteAdditions = calculateElectrolyteAdditions( | const electrolyteAdditions = calculateElectrolyteAdditions( | ||
residualNeeds.calcium, | residualNeeds.calcium, | ||
Linea 1727: | Linea 2204: | ||
const lipidVolume = Math.round((residualNeeds.lipids * currentWeightKg * 100) / 20); | const lipidVolume = Math.round((residualNeeds.lipids * currentWeightKg * 100) / 20); | ||
| | ||
- | // Volume vitamine/ | + | // Volume vitamine/ |
- | const vitaminsVolume = residualNeeds.vitalipid + residualNeeds.soluvit + residualNeeds.peditrace; | + | const vitaminsVolume = (residualNeeds.vitalipid |
+ | const carnitineVolume = residualNeeds.carnitine > 0 ? (residualNeeds.carnitine * currentWeightKg) / 100 : 0; | ||
| | ||
- | // Volume utilizzato da proteine, lipidi, elettroliti e vitamine | + | // CALCOLO CON GLUCOSIO 50% + ACQUA BIDISTILLATA |
- | const usedVolume | + | const neededGlucose |
+ | const glucose50Volume = (neededGlucose * 100) / 50; // ml di glucosio 50% necessari | ||
| | ||
- | // Volume | + | // Volume |
- | const glucoseVolume | + | const usedVolume |
| | ||
- | // Calcolo concentrazione glucosio necessaria | + | // Volume rimanente = Acqua Bidistillata |
- | const neededGlucose | + | const waterVolume |
- | + | ||
- | let glucoseConc = 10; | + | |
- | let glucoseMessage = ''; | + | |
- | + | ||
- | if (glucoseVolume <= 0) { | + | |
- | glucoseMessage = '< | + | |
- | '• Volume totale richiesto: ' + totalVolume | + | |
- | '• Volume proteine + lipidi: ' + (proteinVolume + lipidVolume) + ' ml< | + | |
- | '• Volume elettroliti: | + | |
- | '• Volume vitamine: ' + vitaminsVolume + ' ml< | + | |
- | '• Volume glucosio risultante: ' + glucoseVolume + ' ml (NEGATIVO!)< | + | |
- | '< | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | + | ||
- | document.getElementById(' | + | |
- | document.getElementById(' | + | |
- | return; | + | |
- | } | + | |
- | + | ||
- | if (neededGlucose <= 0) { | + | |
- | glucoseMessage = '< | + | |
- | '• Tutto il glucosio necessario (' + (residualNeeds.carbs * currentWeightKg).toFixed(1) + 'g) proviene dall\' | + | |
- | '• Apporto enterale: ' + (enteralData ? enteralData.carbs.toFixed(1) : 0) + ' g/ | + | |
- | '• Non necessario glucosio in NPT</ | + | |
- | + | ||
- | glucoseConc = 0; | + | |
- | document.getElementById(' | + | |
- | } else { | + | |
- | const requiredConcentration = (neededGlucose * 100) / glucoseVolume; | + | |
- | + | ||
- | if (requiredConcentration <= 12) { | + | |
- | glucoseConc = 10; | + | |
- | } else if (requiredConcentration <= 25) { | + | |
- | glucoseConc = 20; | + | |
- | } else if (requiredConcentration <= 40) { | + | |
- | glucoseConc = 33; | + | |
- | } else { | + | |
- | glucoseConc = 50; | + | |
- | } | + | |
- | + | ||
- | glucoseMessage = '< | + | |
- | '• Glucosio necessario: ' + neededGlucose.toFixed(1) + ' | + | |
- | '• Volume disponibile: | + | |
- | '• Concentrazione richiesta: ' + requiredConcentration.toFixed(1) + ' | + | |
- | '• Concentrazione selezionata: | + | |
- | + | ||
- | document.getElementById(' | + | |
- | } | + | |
- | + | ||
- | // Calcoli finali | + | |
- | const actualGlucose = (glucoseVolume * glucoseConc) / 100; | + | |
- | const actualProtein = (proteinVolume * 6) / 100; | + | |
- | const actualLipids = (lipidVolume * 20) / 100; | + | |
- | + | ||
- | const glucosePerKg = actualGlucose / currentWeightKg; | + | |
- | const proteinPerKg = actualProtein / currentWeightKg; | + | |
- | const lipidsPerKg = actualLipids / currentWeightKg; | + | |
- | const totalKcal = (glucosePerKg * 4) + (proteinPerKg * 4) + (lipidsPerKg * 9); | + | |
- | const glucoseRate = (glucosePerKg * 1000) / (24 * 60); | + | |
| | ||
document.getElementById(' | document.getElementById(' | ||
+ | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
| | ||
- | let resultHtml | + | let resultHtml = '< |
- | + | resultHtml += '< | |
- | resultHtml += '< | + | resultHtml += '< |
- | resultHtml += '< | + | resultHtml += '< |
resultHtml += '< | resultHtml += '< | ||
if (enteralData && enteralData.additionalFluids > 0) { | if (enteralData && enteralData.additionalFluids > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
- | } | ||
- | resultHtml += '< | ||
- | if (patientData.bun) { | ||
- | const bunVal = parseFloat(patientData.bun); | ||
- | if (bunVal < 9) { | ||
- | resultHtml += ' | ||
- | } else if (bunVal > 14) { | ||
- | resultHtml += ' | ||
- | } else { | ||
- | resultHtml += ' | ||
- | } | ||
} | } | ||
resultHtml += '</ | resultHtml += '</ | ||
+ | | ||
+ | // MOSTRA ALERT CLINICI SE PRESENTI | ||
+ | if (alerts.length > 0) { | ||
+ | resultHtml += '< | ||
+ | } | ||
| | ||
resultHtml += '< | resultHtml += '< | ||
resultHtml += '< | resultHtml += '< | ||
| | ||
- | if (glucoseConc | + | if (neededGlucose |
- | resultHtml += '< | + | resultHtml += '< |
- | } else { | + | |
- | resultHtml += '< | + | |
} | } | ||
| | ||
- | resultHtml += '< | + | resultHtml += '< |
- | resultHtml += '< | + | resultHtml += '< |
| | ||
- | // Elettroliti aggiuntivi | + | // ELETTROLITI AGGIUNTIVI |
if (electrolyteAdditions.ca_gluconato > 0) { | if (electrolyteAdditions.ca_gluconato > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
Linea 1851: | Linea 2260: | ||
if (electrolyteAdditions.nacl > 0) { | if (electrolyteAdditions.nacl > 0) { | ||
resultHtml += '< | resultHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.sodium_acetate > 0) { | ||
+ | resultHtml += '< | ||
} | } | ||
if (electrolyteAdditions.kcl > 0) { | if (electrolyteAdditions.kcl > 0) { | ||
Linea 1856: | Linea 2268: | ||
} | } | ||
| | ||
+ | // VITAMINE | ||
if (residualNeeds.vitalipid > 0) { | if (residualNeeds.vitalipid > 0) { | ||
- | resultHtml += '< | + | |
+ | | ||
} | } | ||
if (residualNeeds.soluvit > 0) { | if (residualNeeds.soluvit > 0) { | ||
- | resultHtml += '< | + | |
+ | | ||
} | } | ||
if (residualNeeds.peditrace > 0) { | if (residualNeeds.peditrace > 0) { | ||
- | resultHtml += '< | + | |
+ | | ||
} | } | ||
| | ||
- | resultHtml += '< | + | |
+ | if (residualNeeds.carnitine > 0) { | ||
+ | resultHtml += '< | ||
+ | } | ||
+ | |||
+ | // ACQUA BIDISTILLATA | ||
+ | if (waterVolume > 0) { | ||
+ | resultHtml += '< | ||
+ | } | ||
+ | |||
+ | | ||
resultHtml += '</ | resultHtml += '</ | ||
| | ||
document.getElementById(' | document.getElementById(' | ||
- | document.getElementById(' | ||
| | ||
- | // Aggiorna il pulsante a verde | + | // CREAZIONE RICETTA PER PREPARAZIONE |
- | const parenteralBtn | + | const deflectorVolume |
- | | + | |
- | | + | const ratio = totalVolumeWithDeflector / totalVolume; |
- | | + | |
+ | let preparationHtml = '< | ||
+ | preparationHtml += '< | ||
+ | | ||
+ | preparationHtml += '• < | ||
+ | preparationHtml += '• < | ||
+ | preparationHtml += '</ | ||
+ | |||
+ | preparationHtml += '< | ||
+ | preparationHtml += '< | ||
+ | |||
+ | if (neededGlucose > 0) { | ||
+ | | ||
} | } | ||
+ | | ||
+ | preparationHtml += '< | ||
+ | preparationHtml += '< | ||
+ | | ||
+ | if (electrolyteAdditions.ca_gluconato > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.esafosfina > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.mg_sulfate > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.nacl > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.sodium_acetate > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (electrolyteAdditions.kcl > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | | ||
+ | // VITAMINE con denominazioni complete | ||
+ | if (residualNeeds.vitalipid > 0) { | ||
+ | const vitalipidVolume = residualNeeds.vitalipid * currentWeightKg; | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (residualNeeds.soluvit > 0) { | ||
+ | const soluvitVolume = residualNeeds.soluvit * currentWeightKg; | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | if (residualNeeds.peditrace > 0) { | ||
+ | const peditraceVolume = residualNeeds.peditrace * currentWeightKg; | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | | ||
+ | // CARNITINA con denominazione completa | ||
+ | if (residualNeeds.carnitine > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | | ||
+ | if (waterVolume > 0) { | ||
+ | preparationHtml += '< | ||
+ | } | ||
+ | | ||
+ | preparationHtml += '< | ||
+ | preparationHtml += '</ | ||
+ | | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | | ||
+ | // Salva i dati per il report | ||
+ | window.nptCalculation = { | ||
+ | totalVolume: | ||
+ | waterVolume: | ||
+ | glucose50Volume: | ||
+ | proteinVolume: | ||
+ | lipidVolume: | ||
+ | gir: gir, | ||
+ | neededGlucose: | ||
+ | electrolyteAdditions: | ||
+ | vitaminsVolume: | ||
+ | carnitineVolume: | ||
+ | deflectorVolume: | ||
+ | }; | ||
} | } | ||
- | // FUNZIONI CONFIGURAZIONE | + | // FUNZIONI CONFIGURAZIONE |
function populateEnteralConfigTable() { | function populateEnteralConfigTable() { | ||
const tbody = document.getElementById(' | const tbody = document.getElementById(' | ||
Linea 1927: | Linea 2433: | ||
} | } | ||
- | function | + | function |
- | const tbody = document.getElementById(' | + | const tbody = document.getElementById(' |
if (!tbody) return; | if (!tbody) return; | ||
| | ||
- | | + | tbody.innerHTML = ''; |
- | const existingRows = tbody.querySelectorAll('tr'); | + | Object.keys(doctorsData).forEach(key |
- | // Rimuovi tutte le righe tranne la prima (Prenidina FM85) | + | const doctor |
- | for (let i = existingRows.length - 1; i > 0; i--) { | + | const row = tbody.insertRow(); |
- | existingRows[i].remove(); | + | row.innerHTML = '< |
- | } | + | '< |
- | + | '< | |
- | // Aggiungi nuovi fortificanti dinamici | + | '<option value="Dr."' |
- | Object.keys(fortifierData).forEach(function(key) { | + | '<option value="Dr.ssa"' |
- | | + | '<option value="Prof."' |
- | | + | '<option value="Prof.ssa"' |
- | const row = tbody.insertRow(); | + | '</select></ |
- | row.innerHTML = '< | + | '< |
- | | + | '< |
- | '< | + | |
- | '< | + | |
- | '<td>< | + | |
- | '<td>< | + | |
- | '<td>< | + | |
- | '<td>< | + | |
- | | + | |
- | '<td>< | + | |
- | '< | + | |
- | '< | + | |
- | } | + | |
}); | }); | ||
} | } | ||
- | // FUNZIONE PER MARCARE LE MODIFICHE NELLA CONFIGURAZIONE | ||
function markConfigChanged(configType) { | function markConfigChanged(configType) { | ||
let buttonId = ''; | let buttonId = ''; | ||
Linea 1976: | Linea 2470: | ||
buttonId = ' | buttonId = ' | ||
buttonText = 'SALVA MODIFICHE FORTIFICANTI'; | buttonText = 'SALVA MODIFICHE FORTIFICANTI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA MODIFICHE MEDICI'; | ||
+ | break; | ||
+ | case ' | ||
+ | buttonId = ' | ||
+ | buttonText = 'SALVA PARAMETRI SISTEMA'; | ||
break; | break; | ||
} | } | ||
Linea 1986: | Linea 2488: | ||
} | } | ||
- | // FUNZIONI CONFIGURAZIONE COMPLETE | ||
function updateEnteralConfig() { | function updateEnteralConfig() { | ||
let changesCount = 0; | let changesCount = 0; | ||
Linea 1993: | Linea 2494: | ||
const oldValues = Object.assign({}, | const oldValues = Object.assign({}, | ||
| | ||
- | | + | |
- | formulaData[key].carbs = parseFloat(document.getElementById(' | + | if (proteinEl) { |
- | formulaData[key].lipids = parseFloat(document.getElementById(' | + | formulaData[key].protein = parseFloat(proteinEl.value); |
- | formulaData[key].sodium = parseFloat(document.getElementById(' | + | formulaData[key].carbs = parseFloat(document.getElementById(' |
- | formulaData[key].potassium = parseFloat(document.getElementById(' | + | formulaData[key].lipids = parseFloat(document.getElementById(' |
- | formulaData[key].calcium = parseFloat(document.getElementById(' | + | formulaData[key].sodium = parseFloat(document.getElementById(' |
- | formulaData[key].phosphorus = parseFloat(document.getElementById(' | + | formulaData[key].potassium = parseFloat(document.getElementById(' |
- | formulaData[key].magnesium = parseFloat(document.getElementById(' | + | formulaData[key].calcium = parseFloat(document.getElementById(' |
- | formulaData[key].energy = parseFloat(document.getElementById(' | + | formulaData[key].phosphorus = parseFloat(document.getElementById(' |
- | + | formulaData[key].magnesium = parseFloat(document.getElementById(' | |
- | if (JSON.stringify(oldValues) !== JSON.stringify(formulaData[key])) { | + | formulaData[key].energy = parseFloat(document.getElementById(' |
- | changesCount++; | + | |
+ | if (JSON.stringify(oldValues) !== JSON.stringify(formulaData[key])) { | ||
+ | changesCount++; | ||
+ | } | ||
} | } | ||
}); | }); | ||
- | | ||
- | // SALVA NEL LOCALSTORAGE | ||
- | saveToStorage(); | ||
| | ||
const button = document.getElementById(' | const button = document.getElementById(' | ||
Linea 2020: | Linea 2521: | ||
}, 3000); | }, 3000); | ||
} | } | ||
- | | ||
- | console.log(' | ||
} | } | ||
Linea 2030: | Linea 2529: | ||
const oldValues = Object.assign({}, | const oldValues = Object.assign({}, | ||
| | ||
- | | + | |
- | parenteralConfig[key].carbs = parseFloat(document.getElementById(' | + | if (proteinEl) { |
- | parenteralConfig[key].lipids = parseFloat(document.getElementById(' | + | parenteralConfig[key].protein = parseFloat(proteinEl.value); |
- | parenteralConfig[key].sodium = parseFloat(document.getElementById(' | + | parenteralConfig[key].carbs = parseFloat(document.getElementById(' |
- | parenteralConfig[key].potassium = parseFloat(document.getElementById(' | + | parenteralConfig[key].lipids = parseFloat(document.getElementById(' |
- | parenteralConfig[key].calcium = parseFloat(document.getElementById(' | + | parenteralConfig[key].sodium = parseFloat(document.getElementById(' |
- | parenteralConfig[key].phosphorus = parseFloat(document.getElementById(' | + | parenteralConfig[key].potassium = parseFloat(document.getElementById(' |
- | parenteralConfig[key].magnesium = parseFloat(document.getElementById(' | + | parenteralConfig[key].calcium = parseFloat(document.getElementById(' |
- | parenteralConfig[key].energy = parseFloat(document.getElementById(' | + | parenteralConfig[key].phosphorus = parseFloat(document.getElementById(' |
- | parenteralConfig[key].water = parseFloat(document.getElementById(' | + | parenteralConfig[key].magnesium = parseFloat(document.getElementById(' |
- | + | parenteralConfig[key].energy = parseFloat(document.getElementById(' | |
- | if (JSON.stringify(oldValues) !== JSON.stringify(parenteralConfig[key])) { | + | parenteralConfig[key].water = parseFloat(document.getElementById(' |
- | changesCount++; | + | |
+ | if (JSON.stringify(oldValues) !== JSON.stringify(parenteralConfig[key])) { | ||
+ | changesCount++; | ||
+ | } | ||
} | } | ||
}); | }); | ||
- | | ||
- | // SALVA NEL LOCALSTORAGE | ||
- | saveToStorage(); | ||
| | ||
const button = document.getElementById(' | const button = document.getElementById(' | ||
Linea 2058: | Linea 2557: | ||
}, 3000); | }, 3000); | ||
} | } | ||
- | | ||
- | console.log(' | ||
} | } | ||
function updateFortifierConfig() { | function updateFortifierConfig() { | ||
// Aggiorna Prenidina FM85 predefinita | // Aggiorna Prenidina FM85 predefinita | ||
- | | + | |
- | fortifierData.prenidina_fm85.carbs = parseFloat(document.getElementById(' | + | if (proteinEl) { |
- | fortifierData.prenidina_fm85.lipids = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.protein = parseFloat(proteinEl.value); |
- | fortifierData.prenidina_fm85.sodium = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.carbs = parseFloat(document.getElementById(' |
- | fortifierData.prenidina_fm85.potassium = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.lipids = parseFloat(document.getElementById(' |
- | fortifierData.prenidina_fm85.calcium = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.sodium = parseFloat(document.getElementById(' |
- | fortifierData.prenidina_fm85.phosphorus = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.potassium = parseFloat(document.getElementById(' |
- | fortifierData.prenidina_fm85.magnesium = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.calcium = parseFloat(document.getElementById(' |
- | fortifierData.prenidina_fm85.energy = parseFloat(document.getElementById(' | + | fortifierData.prenidina_fm85.phosphorus = parseFloat(document.getElementById(' |
+ | fortifierData.prenidina_fm85.magnesium = parseFloat(document.getElementById(' | ||
+ | fortifierData.prenidina_fm85.energy = parseFloat(document.getElementById(' | ||
+ | } | ||
| | ||
- | | + | |
- | let changesCount = 1; // Prenidina sempre aggiornata | + | if (button) { |
- | Object.keys(fortifierData).forEach(function(key) { | + | button.className = ' |
- | | + | button.innerHTML = ' |
- | const proteinEl | + | setTimeout(() => { |
- | if (proteinEl) { | + | button.className = ' |
- | | + | button.innerHTML = 'Aggiorna |
- | | + | }, 3000); |
- | | + | } |
- | | + | } |
- | | + | |
- | | + | function updateDoctorsConfig() { |
- | | + | let changesCount = 0; |
- | | + | |
- | fortifierData[key].energy = parseFloat(document.getElementById(' | + | Object.keys(doctorsData).forEach(key |
+ | | ||
+ | |||
+ | | ||
+ | if (nameEl) { | ||
+ | const newName | ||
+ | const newSurname | ||
+ | const newTitle | ||
+ | |||
+ | doctorsData[key].name = newName; | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | if (JSON.stringify(oldValues) !== JSON.stringify(doctorsData[key])) | ||
changesCount++; | changesCount++; | ||
} | } | ||
Linea 2094: | Linea 2608: | ||
}); | }); | ||
| | ||
- | | + | |
- | | + | |
| | ||
- | const button = document.getElementById(' | + | const button = document.getElementById(' |
if (button) { | if (button) { | ||
button.className = ' | button.className = ' | ||
- | button.innerHTML = 'FORTIFICANTI SALVATE | + | button.innerHTML = 'MEDICI SALVATI |
setTimeout(() => { | setTimeout(() => { | ||
button.className = ' | button.className = ' | ||
- | button.innerHTML = ' | + | button.innerHTML = ' |
+ | }, 3000); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function updateSystemConfig() { | ||
+ | const button = document.getElementById(' | ||
+ | if (button) { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
+ | setTimeout(() => { | ||
+ | button.className = ' | ||
+ | button.innerHTML = ' | ||
}, 3000); | }, 3000); | ||
} | } | ||
| | ||
- | | + | |
} | } | ||
- | function | + | |
+ | // FUNZIONI CONFIGURAZIONE CLINICA AVANZATA (NUOVE) | ||
+ | function | ||
+ | clinicalConfig.calciumReq = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.phosphorusReq = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.magnesiumReq = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxGIR = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxLipids = parseFloat(document.getElementById(' | ||
+ | clinicalConfig.maxProtein = parseFloat(document.getElementById(' | ||
+ | |||
+ | alert(' | ||
+ | '• Calcio standard: ' + clinicalConfig.calciumReq + ' mg/ | ||
+ | '• Fosforo standard: ' + clinicalConfig.phosphorusReq + ' mg/ | ||
+ | '• GIR massimo: ' + clinicalConfig.maxGIR + ' mg/ | ||
+ | '• Lipidi massimi: ' + clinicalConfig.maxLipids + ' g/ | ||
+ | } | ||
+ | |||
+ | function resetConfiguration() { | ||
+ | // Reset configurazione clinica | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | |||
+ | // Reset configurazione sistema | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | |||
+ | // Reset configurazione clinica globale | ||
+ | clinicalConfig = { | ||
+ | calciumReq: 160, | ||
+ | phosphorusReq: | ||
+ | magnesiumReq: | ||
+ | maxGIR: 12.0, | ||
+ | maxLipids: 3.0, | ||
+ | maxProtein: 4.5, | ||
+ | hospitalName: | ||
+ | departmentName: | ||
+ | directorName: | ||
+ | }; | ||
+ | |||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function saveConfiguration() { | ||
const config = { | const config = { | ||
- | | + | |
- | | + | |
- | | + | departmentName: |
- | | + | |
- | | + | |
- | | + | |
+ | | ||
}; | }; | ||
| | ||
- | | + | // Aggiorna configurazione clinica |
- | const dataBlob = new Blob([dataStr], | + | |
- | | + | |
- | const link = document.createElement(' | + | |
- | | + | |
- | | + | |
- | link.click(); | + | |
- | URL.revokeObjectURL(url); | + | |
| | ||
- | | + | |
+ | window.savedConfig = config; | ||
+ | alert(' | ||
} | } | ||
- | function | + | // FUNZIONI REPORT (COMPLETE CON TUTTI GLI ELEMENTI) |
- | | + | function |
- | if (!file) | + | |
+ | alert('Prima completare tutti i calcoli precedenti'); | ||
+ | return; | ||
+ | } | ||
| | ||
- | const reader | + | const currentDate |
- | | + | |
- | | + | const prescriptionPatientWeightKg |
- | const config | + | const calc = window.nptCalculation; |
- | + | ||
- | | + | if (!calc) { |
- | | + | |
- | | + | |
- | } | + | } |
- | + | ||
- | if (config.parenteralComponents) { | + | |
- | | + | birthDate.setDate(birthDate.getDate() - patientData.daysOfLife); |
- | | + | |
- | } | + | const doctorName = patientData.prescribingDoctorName || |
- | + | | |
- | if (config.fortifierData) { | + | |
- | | + | |
- | | + | let html = '< |
- | } | + | |
- | + | // INTESTAZIONE MEDICA ESATTA COME DA PDF | |
- | // SALVA LE MODIFICHE IMPORTATE | + | html += '< |
- | saveToStorage(); | + | |
- | + | // PARTE SINISTRA - INFO OSPEDALE | |
- | | + | html += '< |
- | + | html += '< | |
- | } catch (error) { | + | html += '< |
- | | + | html += '<p style=" |
- | } | + | html += '</ |
- | }; | + | |
- | | + | // PARTE DESTRA - LOGO ASST |
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | html += '</ | ||
+ | |||
+ | // TITOLO DOCUMENTO | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '<p style=" | ||
+ | html += '</ | ||
+ | |||
+ | // DATI PAZIENTE | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | |||
+ | // COMPOSIZIONE NPT COMPLETA (TUTTI GLI ELEMENTI DAL TAB 4) | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | // ACQUA BIDISTILLATA | ||
+ | if (calc.waterVolume > 0) { | ||
+ | html += '< | ||
+ | | ||
+ | |||
+ | // GLUCOSIO | ||
+ | | ||
+ | html += '< | ||
+ | } | ||
+ | |||
+ | // PROTEINE | ||
+ | html += '< | ||
+ | |||
+ | // LIPIDI | ||
+ | html += '< | ||
+ | |||
+ | // ELETTROLITI (SE PRESENTI) | ||
+ | | ||
+ | html += '< | ||
+ | } | ||
+ | if (calc.electrolyteAdditions.esafosfina > 0) { | ||
+ | html += '< | ||
+ | } | ||
+ | if (calc.electrolyteAdditions.mg_sulfate > 0) { | ||
+ | html += '< | ||
+ | } | ||
+ | | ||
+ | html += '< | ||
+ | } | ||
+ | if (calc.electrolyteAdditions.sodium_acetate > 0) { | ||
+ | html += '< | ||
+ | } | ||
+ | if (calc.electrolyteAdditions.kcl > 0) { | ||
+ | | ||
+ | | ||
+ | |||
+ | // VITAMINE | ||
+ | if (window.residualNeeds.vitalipid > 0) { | ||
+ | const vitalipidVolume = window.residualNeeds.vitalipid * prescriptionPatientWeightKg; | ||
+ | html += '< | ||
+ | } | ||
+ | if (window.residualNeeds.soluvit > 0) { | ||
+ | const soluvitVolume = window.residualNeeds.soluvit * prescriptionPatientWeightKg; | ||
+ | html += '< | ||
+ | } | ||
+ | if (window.residualNeeds.peditrace > 0) { | ||
+ | | ||
+ | html += '< | ||
+ | | ||
+ | |||
+ | // CARNITINA (SE PRESENTE) | ||
+ | if (window.residualNeeds.carnitine > 0) { | ||
+ | const carnitineVolume = (window.residualNeeds.carnitine * prescriptionPatientWeightKg) / 100; | ||
+ | html += '< | ||
+ | } | ||
+ | |||
+ | // TOTALE | ||
+ | html += '< | ||
+ | | ||
+ | |||
+ | // PARAMETRI CLINICI | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | // FIRMA | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | |||
+ | document.getElementById(' | ||
} | } | ||
- | function | + | function |
- | const resultsDiv | + | if (!window.residualNeeds || !patientData.currentWeight) { |
- | const configInfo | + | alert(' |
+ | return; | ||
+ | } | ||
+ | | ||
+ | const calc = window.nptCalculation; | ||
+ | if (!calc) { | ||
+ | alert('Prima calcolare la NPT nel TAB 4'); | ||
+ | return; | ||
+ | } | ||
+ | | ||
+ | const currentDate | ||
+ | const currentTime = new Date().toLocaleTimeString(' | ||
+ | const worksheetPatientWeightKg = patientData.currentWeight / 1000; | ||
+ | |||
+ | const birthDate = new Date(); | ||
+ | birthDate.setDate(birthDate.getDate() - patientData.daysOfLife); | ||
+ | |||
+ | const deflectorVolume = calc.deflectorVolume || 30; | ||
+ | const totalVolumeWithDeflector = calc.totalVolume + deflectorVolume; | ||
+ | const ratio = totalVolumeWithDeflector / calc.totalVolume; | ||
+ | |||
+ | let html = '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | html += '< | ||
+ | |||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
| | ||
- | | + | |
- | resultsDiv.className = ' | + | |
- | resultsDiv.classList.remove('hidden'); | + | |
| | ||
- | if (type !== 'error') { | + | if (calc.neededGlucose > 0) { |
- | | + | html += '< |
- | | + | } |
- | }, 8000); | + | |
+ | html += '< | ||
+ | |||
+ | html += '< | ||
+ | |||
+ | html += '< | ||
+ | html += '</ | ||
+ | |||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | |||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '< | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | html += '</ | ||
+ | |||
+ | document.getElementById(' | ||
+ | } | ||
+ | |||
+ | // FUNZIONE GENERAZIONE PDF (DA VERSIONE 17) | ||
+ | function generatePDF(type) { | ||
+ | if (!window.residualNeeds || !patientData.currentWeight) { | ||
+ | alert(' | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | const { jsPDF } = window.jspdf; | ||
+ | const doc = new jsPDF(); | ||
+ | |||
+ | // INTESTAZIONE COMUNE | ||
+ | doc.setFontSize(10); | ||
+ | doc.text(clinicalConfig.departmentName, | ||
+ | doc.text('Direttore: ' + clinicalConfig.directorName, | ||
+ | |||
+ | // Logo ASST (posizionamento approssimativo) | ||
+ | doc.text(clinicalConfig.hospitalName, | ||
+ | |||
+ | const currentDate = new Date().toLocaleDateString(' | ||
+ | doc.text(' | ||
+ | |||
+ | if (type === ' | ||
+ | | ||
+ | } else if (type === ' | ||
+ | generateReportParenteralePDF(doc); | ||
+ | } | ||
+ | |||
+ | // Salva il PDF | ||
+ | const fileName = type === ' | ||
+ | doc.save(fileName); | ||
+ | } | ||
+ | |||
+ | function | ||
+ | // Implementazione semplificata del PDF | ||
+ | let yPos = 50; | ||
+ | |||
+ | doc.setFontSize(12); | ||
+ | doc.text('FOGLIO DI LAVORO NPT', 20, yPos); | ||
+ | yPos += 20; | ||
+ | |||
+ | doc.setFontSize(10); | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | yPos += 20; | ||
+ | |||
+ | const calc = window.nptCalculation; | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | } | ||
+ | |||
+ | function generateReportParenteralePDF(doc) { | ||
+ | // Implementazione semplificata del PDF | ||
+ | let yPos = 50; | ||
+ | |||
+ | doc.setFontSize(12); | ||
+ | doc.text(' | ||
+ | yPos += 20; | ||
+ | |||
+ | doc.setFontSize(10); | ||
+ | doc.text(' | ||
+ | yPos += 10; | ||
+ | doc.text(' | ||
+ | } | ||
+ | |||
+ | // FUNZIONI PLACEHOLDER | ||
+ | function showAddEnteralForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddFortifierForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddParenteralForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function showAddDoctorForm() { | ||
+ | alert(' | ||
+ | } | ||
+ | |||
+ | function removeEnteralFormula(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeParenteralComponent(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeFortifier(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function removeDoctor(key) { | ||
+ | if (confirm(' | ||
+ | alert(' | ||
} | } | ||
} | } | ||
Linea 2184: | Linea 3072: | ||
// INIZIALIZZAZIONE | // INIZIALIZZAZIONE | ||
document.addEventListener(' | document.addEventListener(' | ||
- | console.log(' | + | console.log(' |
| | ||
- | // CARICA CONFIGURAZIONE SALVATA | + | // Imposta la data odierna come default |
- | const configLoaded | + | const today = new Date().toISOString().split('T')[0]; |
- | if (configLoaded) { | + | document.getElementById(' |
- | console.log('✅ Configurazione personalizzata caricata dal localStorage'); | + | |
- | // Aggiorna status | + | // Configura il campo cartella clinica |
- | const statusDiv = document.getElementById(' | + | |
- | if (statusDiv) { | + | |
- | statusDiv.innerHTML | + | |
- | | + | |
- | } | + | |
- | | + | |
- | console.log('📋 Usando configurazione di default' | + | |
- | } | + | |
| | ||
document.getElementById(' | document.getElementById(' | ||
document.getElementById(' | document.getElementById(' | ||
}); | }); | ||
+ | | ||
+ | // Event listeners per resettare Fabbisogni e NPT quando si modificano i valori manualmente | ||
+ | const requirementFields = [ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
+ | | ||
+ | requirementFields.forEach(fieldId => { | ||
+ | const field = document.getElementById(fieldId); | ||
+ | if (field) { | ||
+ | field.addEventListener(' | ||
+ | resetNutritionButton(); | ||
+ | }); | ||
+ | field.addEventListener(' | ||
+ | resetNutritionButton(); | ||
+ | }); | ||
+ | } | ||
+ | }); | ||
+ | | ||
+ | // Event listener per il tipo di sodio | ||
+ | const sodiumTypeSelect = document.getElementById(' | ||
+ | if (sodiumTypeSelect) { | ||
+ | sodiumTypeSelect.addEventListener(' | ||
+ | updateSodiumChoice(); | ||
+ | updateSodiumRecommendation(); | ||
+ | }); | ||
+ | } | ||
+ | | ||
+ | // Event listener per il volume del deflussore | ||
+ | const deflectorVolumeInput = document.getElementById(' | ||
+ | if (deflectorVolumeInput) { | ||
+ | deflectorVolumeInput.addEventListener(' | ||
+ | resetParenteralButton(); | ||
+ | }); | ||
+ | } | ||
+ | | ||
+ | // Inizializza configurazione clinica avanzata | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | document.getElementById(' | ||
| | ||
updateFortifierOptions(); | updateFortifierOptions(); | ||
- | console.log(' | + | |
+ | | ||
}); | }); | ||
</ | </ |