Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/app/modules/rup/components/core/_rup.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import "../variables";

rup {
display: block;
width: 100%;
}

$rotate: -90deg;

.rup-card {
Expand Down Expand Up @@ -770,4 +775,10 @@ plex-layout [type="invert"] {
.readonly span {
color: white;
}
}

.hr-grueso {
border: none;
height: 1px;
background-color: #4a4a4a;
}
27 changes: 22 additions & 5 deletions src/app/modules/rup/components/core/rup.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Auth } from '@andes/auth';
import { Plex, PlexVisualizadorService } from '@andes/plex';
import { calcularEdad } from '@andes/shared';
import { AfterViewInit, Component, ComponentFactoryResolver, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Optional, Output, QueryList, SimpleChanges, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation } from '@angular/core';
import { AfterViewInit, Component, ComponentFactoryResolver, ComponentRef, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Optional, Output, QueryList, SimpleChanges, ViewChild, ViewChildren, ViewContainerRef, ViewEncapsulation } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { Engine } from 'json-rules-engine';
Expand Down Expand Up @@ -41,11 +41,20 @@ import { InternacionResumenHTTP } from '../../../../apps/rup/mapa-camas/services
@Component({
selector: 'rup',
encapsulation: ViewEncapsulation.None,
template: ''
template: `
<ng-container *ngIf="mostrarTituloSubmolecula">
<div class="rup-submolecula-titulo mb-2" style="margin-top: 10px;">
<span class="text-bold text-capitalize" style="font-size: 1.0rem;color:#00a8e0">{{ params?.titulo || registro?.nombre || elementoRUP?.conceptos[0]?.term }}</span>
</div>
</ng-container>
<ng-container #componentContainer></ng-container>
<hr *ngIf="mostrarTituloSubmolecula" class="hr-grueso" style="margin-top: 27px;">
`
})
export class RUPComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges {
@ViewChildren(RUPComponent) rupElements: QueryList<RUPComponent>;
@ViewChildren(RUPComponent) rupElements!: QueryList<RUPComponent>;
@ViewChild('form', { static: false }) formulario: any;
@ViewChild('componentContainer', { read: ViewContainerRef, static: true }) componentContainer!: ViewContainerRef;

// Propiedades
@Input() elementoRUP: IElementoRUP;
Expand All @@ -65,6 +74,7 @@ export class RUPComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges
private rulesEngine: Engine;
private rulesEvent = new Subject<{ type: string; params: any }>();
private rulesEvent$ = this.rulesEvent.asObservable();
@Input() public mostrarTituloSubmolecula = null;

/**
* Determina si un elemento RUP es valido. Se setea apartir de reglas.
Expand Down Expand Up @@ -96,9 +106,12 @@ export class RUPComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges
}

// Cargamos el componente
const component = ElementosRUPRegister.get(this.elementoRUP.componente).component;
const component = ElementosRUPRegister.get(this.elementoRUP!.componente)?.component;
if (!component) {
return;
}
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component as any);
const componentReference = this.viewContainerRef.createComponent(componentFactory);
const componentReference: ComponentRef<any> = this.componentContainer.createComponent(componentFactory);

// Copia todas las propiedades
componentReference.instance['prestacion'] = this.prestacion;
Expand Down Expand Up @@ -173,8 +186,12 @@ export class RUPComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges

ngOnInit() {
this.loadComponent();
if (this.mostrarTituloSubmolecula === null) {
this.mostrarTituloSubmolecula = !!this.params?.mostrarTituloSubmolecula;
}
}


ngOnDestroy() {
this.onDestroy();
this.onDestroy$.next(null);
Expand Down
17 changes: 14 additions & 3 deletions src/app/modules/rup/components/core/rup.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,29 @@
</div>
</div>

<div *ngIf="mostrarTituloSubmolecula" class="rup-submolecula-titulo mb-2 w-100"
style="border-bottom: 4px solid #4a4a4a;">
<span class="text-bold text-capitalize" style="font-size: 1.0rem;color:#00a8e0">{{ params?.titulo ||
registro?.nombre || elementoRUP?.conceptos[0]?.term }}</span>
</div>

<ng-container #componentContainer></ng-container>

<!-- Moléculas -->
<ng-container *ngIf="contentLoaded && elementoRUP.requeridos && elementoRUP.requeridos.length">
<!-- Moléculas (Fallback para cuando no hay componente específico o para renderizado recursivo) -->
<ng-container *ngIf="!rupInstance && contentLoaded && elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of requeridos; let i = index">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP"
class="col-{{ item.style.columns }} mr-{{ item.style?.offset ? item.style.offset : '0' }}">
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }} mr-{{ item.style?.offset ? item.style.offset : '0' }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="soloValores"
[style]="item.style" (change)="emitChange($event)" [conceptosAsociados]="conceptosAsociados">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<div *ngIf="(ultimaConsulta?.updatedAt || ultimaConsulta?.createdAt) && validacion === false" class="row bg-faded"
class="d-flex justify-content-start">
<div class="col m-0 p-0 bg-registro-anterior">
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{ ultimaConsulta.createdBy
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{
ultimaConsulta.createdBy
| nombre }})</span>
</div>
</div>
<hr>

<!-- Se muestran campos de la consulta ACTUAL en pantalla EJECUCION (cuando no se encuentran registros anteriores) -->
<ng-container
*ngIf="!registrosVacios && ultimaConsulta?.registros?.length && soloValores === false && validacion === false">
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -29,12 +34,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -45,12 +55,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="ultimaConsulta.registros[i]" [soloValores]="true"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<div *ngIf="(ultimaConsulta?.updatedAt || ultimaConsulta?.createdAt) && validacion === false" class="row bg-faded"
class="d-flex justify-content-start">
<div class="col m-0 p-0 bg-registro-anterior">
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{ ultimaConsulta.createdBy
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{
ultimaConsulta.createdBy
| nombre }})</span>
</div>
</div>
<hr>

<!-- Se muestran campos de la consulta ACTUAL en pantalla EJECUCION (cuando no se encuentran registros anteriores) -->
<ng-container
*ngIf="!registrosVacios && ultimaConsulta?.registros?.length && soloValores === false && validacion === false">
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -29,12 +34,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -45,12 +55,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="ultimaConsulta.registros[i]" [soloValores]="true"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<div *ngIf="ultimaConsulta && (ultimaConsulta?.updatedAt || ultimaConsulta?.createdAt) && validacion === false"
class="row bg-faded" class="d-flex justify-content-start">
<div class="col m-0 p-0 bg-registro-anterior">
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{ ultimaConsulta.createdBy
<span>Registros tomados el {{ (ultimaConsulta.updatedAt || ultimaConsulta.createdAt) | fecha }}, por {{
ultimaConsulta.createdBy
| nombre }}</span>
</div>
</div>
<hr>

<!-- Se muestran campos de la consulta ACTUAL en pantalla EJECUCION (cuando no se encuentran registros anteriores) -->
<ng-container
*ngIf="!registrosVacios && ultimaConsulta?.registros?.length && soloValores === false && validacion === false">
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -29,12 +34,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP && ultimaConsulta?.registros[i]"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="false"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand All @@ -45,12 +55,17 @@
<ng-container *ngIf="elementoRUP.requeridos && elementoRUP.requeridos.length">
<div class="row" [ngClass]="{'d-flex justify-content-start': soloValores}">
<ng-container *ngFor="let item of elementoRUP.requeridos; let i = index">
<div *ngIf="item.elementoRUP" class="col-{{ item.style.columns }}">
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
<div *ngIf="item.elementoRUP"
class="col-{{ (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length) ? 12 : item.style.columns }}">
<rup [elementoRUP]="item.elementoRUP" [paciente]="paciente" [params]="item.params"
[prestacion]="prestacion" [registro]="registro.registros[i]" [soloValores]="true"
(change)="emitChange()">
</rup>
</div>
<div *ngIf="item.elementoRUP && (item.params?.mostrarTituloSubmolecula || item.elementoRUP?.requeridos?.length)"
class="w-100"></div>
</ng-container>
</div>
</ng-container>
Expand Down
Loading
Loading