Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristopher Castro committed Jan 24, 2025
1 parent 622d392 commit 8d7308f
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 30 deletions.
29 changes: 16 additions & 13 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fechas } from './functionesM.js'
import { the, inputDate, these, humanDate } from './wetrust.js'
import { appPesoEG } from './app.pesoEG.js'
import { graficoPFEMasMenos } from './graficoPFEMasMenos.js'

var daysES = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"];
Expand Down Expand Up @@ -2935,19 +2936,13 @@ $( document ).ready(function() {
var edadGestacional = the("semanas").value;
if (edadGestacional < 14){ alert("Edad Gestacional inferior a 14 semanas"); return false;}
if (edadGestacional > 41){ alert("Edad Gestacional superior a 40 semanas"); return false;}
//var modal = makeModal();

let _grafico = graficoPFEMasMenos()
//modal.modal = appPesoEG()
var modal = appPesoEG();

var modal = makeModal();
document.getElementsByTagName("body")[0].insertAdjacentHTML( 'beforeend', modal.modal);
the(modal.titulo).innerText = "Evaluación de Peso Fetal Estimado por gráfica de Hadlock 1991 Percentiles 3 a 97";
the(modal.contenido).innerHTML = '<div class="row"><div class="col-3"><form><div class="row"><div class="col-12"><label for="unounouno">Edad Gestacional</label></div><div class="col-6"><div class="form-group"><label for="cuacuacua">Semanas</label><input type="number" class="form-control" id="cuacuacua"></div></div><div class="col-6"><div class="form-group"><label for="papapapa">Dias</label><input type="number" class="form-control" id="papapapa"></div></div></div><div class="row"><div class="col-6"><div class="form-group"><label for="unounouno">Peso en gramos</label><input type="number" class="form-control" id="unounouno"></div></div><div class="col-6"><div class="form-group"><label for="dosdosdos">Percentil de PFE</label><input type="number" class="form-control" id="dosdosdos"></div></div></div><div class="form-group"><label for="sexsexsex">Ajuste Sexo Fetal</label><select class="form-control" id="sexsexsex"><option>Desconocido</option><option>Hombre</option><option>Mujer</option></select></div></div><div class="col-9"><div id="graficoPesoView"></div></div></div>';
document.getElementsByClassName("modal-dialog")[2].classList.remove("modal-lg")
document.getElementsByClassName("modal-dialog")[2].style.cssText = "max-width:1700px;"
document.getElementsByTagName("body")[0].appendChild(modal.modal);
the("sexsexsex").value = the("ecografia.segtrim.sexo").value

$('#'+modal.id).modal("show").on('hidden.bs.modal', function (e) { $(this).remove(); });
let _grafico = graficoPFEMasMenos()

let _highcharts = {
title: {
Expand Down Expand Up @@ -3013,30 +3008,38 @@ $( document ).ready(function() {
data: []
}, {
type: "line",
name: 'PCT de PFE',
name: 'Peso estimado',
dashStyle: "Dot",
marker: {symbol:'circle'},
lineWidth: 0,
data: (function () {
var data = [[0,1]];
data[0][0] = parseInt(the("semanas").value);

if (the("dias").value > 0){
data[0][0] += "." + the("dias").value;
data[0][0] = parseFloat(data[0][0])
}

data[0][1] = parseFloat(the("pfe").value);

return data;
}())
}]
}

_highcharts.series[4].data = _grafico.valores.uno
_highcharts.series[3].data = _grafico.valores.dos
_highcharts.series[2].data = _grafico.valores.tres
_highcharts.series[1].data = _grafico.valores.cuatro
_highcharts.series[0].data = _grafico.valores.cinco
_highcharts.xAxis.categories = _grafico.semanas
_highcharts.title.text = "<small>PFE = " + the("pfe").value + " grs. Percentil de PFE = " +the("pfePctRpt").value + "</small>";
$('#graficoPesoView').highcharts(_highcharts);
_highcharts.title.text = "<small>PFE = " + the("pfe").value + " grs. percentil " +the("pfePctRpt").value + "</small>";

$('#graficoPFEDinamico').highcharts(_highcharts);

$('#'+modal.id).modal("show").on('hidden.bs.modal', function (e) { $(this).remove(); });

});

$( '#graficoPFEOMS' ).on( 'click', function() {
Expand Down
38 changes: 34 additions & 4 deletions app.pesoEG.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { the } from './wetrust.js'
import { the, make } from './wetrust.js'
import { graficoPFEMasMenos } from './graficoPFEMasMenos.js'
import { Highcharts } from './js/highcharts.js'
//import { Highcharts } from './js/highcharts.js'

export function appPesoEG(){

return contenedor()
var modal = make.modal();
modal.modal.children[0].children[0].children[1].appendChild(contenedor());

modal.modal.children[0].classList.remove("modal-lg")
modal.modal.children[0].style.cssText = "max-width:1700px;"
modal.modal.children[0].children[0].children[0].children[0].textContent = "Evaluación de Peso Fetal Estimado por gráfica de Hadlock 1991 Percentiles 3 a 97";

return modal

}

Expand All @@ -15,18 +22,41 @@ function contenedor(){

let _cUno = document.createElement("div")
_cUno.classList.add("col-3")
_cUno.innerHTML = generarDatos()
_c.appendChild(_cUno)

let _cDos = document.createElement("div")

_cDos.classList.add("col-3")
_cDos.appendChild(crearGrafico())
_cDos.id = "graficoPFEDinamico"
//_cDos.appendChild(crearGrafico())
_c.appendChild(_cDos)

return _c

}

function generarDatos(){
let datos = '<div class="row"><div class="col-12"><label for="unounouno">Edad Gestacional</label></div><div class="col-6"><div class="form-group"><label for="cuacuacua">Semanas</label>'

datos += '<input type="number" class="form-control" id="cuacuacua" value="'+the("semanas").value+'">'

datos += '</div></div><div class="col-6"><div class="form-group"><label for="papapapa">Dias</label>'
datos += '<input type="number" class="form-control" id="papapapa" value="'+the("dias").value+'">'

datos += '</div></div></div><div class="row"><div class="col-6"><div class="form-group"><label for="unounouno">Peso en gramos</label>'
datos += '<input type="number" class="form-control" id="unounouno" value="'+the("pfe").value+'">'

datos += '</div></div><div class="col-6"><div class="form-group"><label for="dosdosdos">Percentil de PFE</label>'

datos += '<input type="number" class="form-control" id="dosdosdos"></div></div></div>'

datos += '<div class="form-group"><label for="sexsexsex">Ajuste Sexo Fetal</label><select class="form-control" id="sexsexsex">'
datos += '<option value="no identificado">Desconocido</option><option value="masculino">Hombre</option><option value="femenino">Mujer</option></select></div>'

return datos
}

function crearGrafico(){

let _grafico = graficoPFEMasMenos()
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script type="module" src="guardar.js"></script>
<script type="module" src="app.js"></script>
<script type="module" src="graficoPFEMasMenos.js"></script>
<script type="module" src="app.pesoEG.js"></script>
<script>
$( document ).ready(function() {
$("#id-paciente").rut({
Expand Down
77 changes: 64 additions & 13 deletions wetrust.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,76 @@ export class make{
}

static modal(button){

let id = this.uuidv4();
let titulo = this.uuidv4();
let contenido = this.uuidv4();
let _button = this.uuidv4();
let button_string = "";

let _buttonID = this.uuidv4();
let _button = "";

let _dive = document.createElement("div")
_dive.classList.add("modal", "fade")
_dive.tabindex = "-1"
_dive.role = "dialog"
_dive.id = id

let _divw = document.createElement("div")
_divw.classList.add("modal-dialog", "modal-lg", "modal-dialog-scrollable")
_divw.role = "document"

let _divx = document.createElement("div")
_divx.classList.add("modal-content")
_divx.id = contenido

let _divz = document.createElement("div")
_divz.classList.add("modal-header")
_divz.id = contenido

let _divv = document.createElement("h5")
_divv.classList.add("modal-title")
_divv.innerText = "Modal title"
_divv.id = titulo

_divz.appendChild(_divv)
_divx.appendChild(_divz)

let _divy = document.createElement("div")
_divy.classList.add("modal-body")
_divy.id = contenido

_divx.appendChild(_divy)

let _footer = document.createElement("div")
_footer.classList.add("modal-footer")

if (typeof button !== typeof undefined){
button_string = '<button type="button" class="btn wetrust" id="'+_button+'" data-modal="'+id+'">'+button+'</button>';
_button = document.createElement("button")
_button.classList.add("btn", "wetrust")
_button.type = "button"
_button.dataset.modal = id
_button.id = _buttonID
_button.textContent = button

_footer.appendChild(_button)
}

let resultado ={
id:id,
titulo:titulo,
contenido:contenido,
button:_button,
modal:'<div class="modal fade" tabindex="-1" role="dialog" id="'+id+'"><div class="modal-dialog modal-lg modal-dialog-scrollable" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="'+titulo+'">Modal title</h5></div><div class="modal-body" id="'+contenido+'"></div><div class="modal-footer"><button type="button" class="btn btn-outline-secondary" data-dismiss="modal" data-bs-dismiss="modal">Cancelar</button>'+ button_string+'</div></div></div></div>'
}


_button = document.createElement("button")
_button.classList.add("btn", "btn-outline-secondary")
_button.type = "button"
_button.dataset.dismiss = "modal"
_button.dataset.bsDismiss = "modal"
_button.textContent = "Cancelar"

_footer.appendChild(_button)

_divx.appendChild(_footer)
_divw.appendChild(_divx)
_dive.appendChild(_divw)

let resultado ={ id: id, titulo: titulo, contenido: contenido, button: _button, modal: _dive }

return resultado;

}

static uuidv4() {
Expand Down

0 comments on commit 8d7308f

Please sign in to comment.