Akira-Kurusu commited on
Commit
595deff
·
verified ·
1 Parent(s): 409c0a6

Update web/index.html

Browse files
Files changed (1) hide show
  1. web/index.html +25 -7
web/index.html CHANGED
@@ -223,7 +223,7 @@
223
  <div class="col-4 text-center">
224
  <p class="text-muted mb-1">Total</p>
225
  <h6 class="mb-1" id="totalPatientsAge">-</h6>
226
- <p class="text-muted mb-0">consultas</p>
227
  </div>
228
  </div>
229
  </div>
@@ -1535,15 +1535,33 @@
1535
  }
1536
 
1537
  function loadAgeRangesData() {
1538
- console.log('Cargando datos de rangos de edad...');
1539
-
1540
- api.getPatients('').then(function(response) {
1541
- if (!response || !response.success || !response.patients.length) {
 
 
 
 
1542
  showEmptyAgeChart();
1543
  return;
1544
  }
1545
 
1546
- const patients = response.patients.filter(p => p.birthDate);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1547
  if (!patients.length) { showEmptyAgeChart(); return; }
1548
 
1549
  // Calcular rangos de edad
@@ -1663,7 +1681,7 @@
1663
  },
1664
  total: {
1665
  show: true,
1666
- label: 'Total Pacientes',
1667
  fontSize: '12px',
1668
  color: '#9aa0ac',
1669
  formatter: function(w) {
 
223
  <div class="col-4 text-center">
224
  <p class="text-muted mb-1">Total</p>
225
  <h6 class="mb-1" id="totalPatientsAge">-</h6>
226
+ <p class="text-muted mb-0">con RD</p>
227
  </div>
228
  </div>
229
  </div>
 
1535
  }
1536
 
1537
  function loadAgeRangesData() {
1538
+ console.log('Cargando datos de rangos de edad con Retinopatía Diabética...');
1539
+
1540
+ // Obtener pacientes y consultas en paralelo
1541
+ Promise.all([
1542
+ api.getPatients(''),
1543
+ api.getConsultations(1, 1000)
1544
+ ]).then(function([patientsResp, consultationsResp]) {
1545
+ if (!patientsResp || !patientsResp.success || !patientsResp.patients.length) {
1546
  showEmptyAgeChart();
1547
  return;
1548
  }
1549
 
1550
+ // Obtener IDs de pacientes con al menos un diagnóstico positivo de RD
1551
+ const positivePatientIds = new Set();
1552
+ if (consultationsResp && consultationsResp.success && consultationsResp.consultations) {
1553
+ consultationsResp.consultations.forEach(c => {
1554
+ if (c.diabeticRetinopathy && c.patientID) {
1555
+ positivePatientIds.add(c.patientID);
1556
+ }
1557
+ });
1558
+ }
1559
+
1560
+ // Filtrar solo pacientes con RD y con fecha de nacimiento
1561
+ const patients = patientsResp.patients.filter(p =>
1562
+ p.birthDate && positivePatientIds.has(p.patientID)
1563
+ );
1564
+
1565
  if (!patients.length) { showEmptyAgeChart(); return; }
1566
 
1567
  // Calcular rangos de edad
 
1681
  },
1682
  total: {
1683
  show: true,
1684
+ label: 'Con Retinopatía',
1685
  fontSize: '12px',
1686
  color: '#9aa0ac',
1687
  formatter: function(w) {