Skip to content

Commit

Permalink
Merge pull request #5 from SALUD-AR/Iteracion-5
Browse files Browse the repository at this point in the history
Iteracion 5
  • Loading branch information
Miguel Amorese authored Dec 19, 2019
2 parents 182d171 + 110a9e1 commit 8312f85
Show file tree
Hide file tree
Showing 25 changed files with 732 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,22 @@ public EvolucionHistoViewModel GetEvolucionesHisto(int pacienteId)

return model;
}

public IEnumerable<ViewModel.Vacunas.VacunaAplicacionGridItemViewModel> GetVacunasAplicacion(int pacienteId, bool soloNoAplicadas = true)
{
var model = new List<ViewModel.Vacunas.VacunaAplicacionGridItemViewModel>();
var vacunas = CurrentContext.DataContext.EvolucionVacunaAplicaciones
.Include(p => p.Evolucion.Paciente)
.Where(x=>x.Evolucion.PacienteId == pacienteId)
.ToList();

if (!vacunas.Any())
{
return model;
}

model = Mapper.Map<List<ViewModel.Vacunas.VacunaAplicacionGridItemViewModel>>(vacunas);
return model;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public EvolucionProfile()
CreateMap<Entities.Evoluciones.EvolucionDiagnosticoCie10, ViewModel.Evoluciones.EvolucionDiagnosticoCie10ViewModel>();
CreateMap<Entities.Evoluciones.EvolucionMedicamento, ViewModel.Evoluciones.EvolucionMedicamentoViewModel>();
CreateMap<Entities.Evoluciones.EvolucionVacunaAplicacion, ViewModel.Evoluciones.EvolucionVacunaAplicacionViewModel>();

CreateMap<Entities.Evoluciones.EvolucionVacunaAplicacion, ViewModel.Vacunas.VacunaAplicacionGridItemViewModel>()
.ForMember(dest => dest.SctConceptId, orig => orig.MapFrom(x => x.SctConceptId.HasValue ? x.SctConceptId.ToString() : ""));

///////////////////////////////////////////////////////////////////////////////////////////////////////

//VIEWMODEL TO ENTITIES
Expand Down
1 change: 1 addition & 0 deletions Msn.InteropDemo.AppServices/IEvolucionAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public interface IEvolucionAppService : Core.IGenericService<Entities.Evolucione
IEnumerable<ViewModel.Snomed.SnomedItem> SearchSnowstormByExpressionTerm(string expression, string term);
ViewModel.Evoluciones.EvolucionViewModel GetById(int evolucionId);
List<ViewModel.Evoluciones.EvolucionHistoItemViewModel> GetEvolucionHistoDates(int pacienteId);
IEnumerable<ViewModel.Vacunas.VacunaAplicacionGridItemViewModel> GetVacunasAplicacion(int pacienteId, bool soloNoAplicadas = true);
}
}
65 changes: 46 additions & 19 deletions Msn.InteropDemo.Data/DataInitialization/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ private async Task GeneratePacienteSoundex()
item.PrimerNombreSoundex = Common.Utils.Helpers.StringHelper.Soundex(item.PrimerNombre);
}

var t = await _dataContext.SaveChangesAsync();
var t = await _dataContext.SaveChangesAsync();
_logger.LogInformation($"Se han actualizado {t.ToString()} pacientes a Soundex.");
}

private async Task SeedPacientesPrueba()
{
await InsertPacientePrueba("Matilde", 1111111, "F", 75);
await InsertPacientePrueba("Juan", 1111112, "M", 50);
await InsertPacientePrueba("Mateo", 1111113, "M", 17);
await InsertPacientePrueba("Matilde", 1111111, "F", 75);
await InsertPacientePrueba("Juan", 1111112, "M", 50);
await InsertPacientePrueba("Mateo", 1111113, "M", 17);
await InsertPacientePrueba("Valentina", 1111114, "F", 3);
}

Expand Down Expand Up @@ -119,7 +119,7 @@ private async Task SeedRoles()

private async Task SeedDefaultAdminUser()
{
if (!_dataContext.Users.Any(x => x.NormalizedUserName == "ADMIN"))
if (!_dataContext.Users.Any(x => x.NormalizedUserName == "ADMIN"))
{
_logger.LogInformation("Incializando usuario Admin");

Expand Down Expand Up @@ -174,23 +174,50 @@ private async Task SeedActivityTypeDescriptorsAsync()
{
try
{
if (!_dataContext.ActivityTypeDescriptors.Any())
if (!_dataContext.ActivityTypeDescriptors.Any(x=>x.Id == 1))
{
var lst = new List<Entities.Activity.ActivityTypeDescriptor>
var entity = new ActivityTypeDescriptor { Id = 1, Nombre = "OBTENER PACIENTE: DB LOCAL", Enabled = true, Orden = 1 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 2))
{
new ActivityTypeDescriptor { Id = 1, Nombre = "OBTENER PACIENTE: DB LOCAL", Enabled = true, Orden = 1 },
new ActivityTypeDescriptor { Id = 2, Nombre = "BUSQUEDA PACIENTES COINCIDENTES: DB LOCAL", Enabled = true, Orden = 2 },
new ActivityTypeDescriptor { Id = 3, Nombre = "ALTA PACIENTE: DB LOCAL", Enabled = true, Orden = 3 },
new ActivityTypeDescriptor { Id = 4, Nombre = "OBTENER PACIENTE: BUS BY IDENTIFIER", Enabled = true, Orden = 4 },
new ActivityTypeDescriptor { Id = 5, Nombre = "BUSQUEDA PACIENTES: BUS BY MATCH", Enabled = true, Orden = 5 },
new ActivityTypeDescriptor { Id = 6, Nombre = "FEDERAR PACIENTE: BUS", Enabled = true, Orden = 6 },
new ActivityTypeDescriptor { Id = 7, Nombre = "BUSQUEDA DE CONCEPTOS EN SNOWSTORM", Enabled = true, Orden = 7}
};

await _dataContext.ActivityTypeDescriptors.AddRangeAsync(lst);
await _dataContext.SaveChangesAsync();
_logger.LogInformation("Datos de Tipos de Actividad Inicializados");
var entity = new ActivityTypeDescriptor { Id = 2, Nombre = "BUSQUEDA PACIENTES COINCIDENTES: DB LOCAL", Enabled = true, Orden = 2 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 3))
{
var entity = new ActivityTypeDescriptor { Id = 3, Nombre = "ALTA PACIENTE: DB LOCAL", Enabled = true, Orden = 3 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 4))
{
var entity = new ActivityTypeDescriptor { Id = 4, Nombre = "OBTENER PACIENTE: BUS BY IDENTIFIER", Enabled = true, Orden = 4 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 5))
{
var entity = new ActivityTypeDescriptor { Id = 5, Nombre = "BUSQUEDA PACIENTES: BUS BY MATCH", Enabled = true, Orden = 5 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 6))
{
var entity = new ActivityTypeDescriptor { Id = 6, Nombre = "FEDERAR PACIENTE: BUS", Enabled = true, Orden = 6 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 7))
{
var entity = new ActivityTypeDescriptor { Id = 7, Nombre = "BUSQUEDA DE CONCEPTOS EN SNOWSTORM", Enabled = true, Orden = 7 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}
if (!_dataContext.ActivityTypeDescriptors.Any(x => x.Id == 8))
{
var entity = new ActivityTypeDescriptor { Id = 8, Nombre = "INFORMAR VACUNA A NOMIVAC", Enabled = true, Orden = 8 };
_dataContext.ActivityTypeDescriptors.Add(entity);
}

await _dataContext.SaveChangesAsync();
_logger.LogInformation("Datos de Tipos de Actividad Inicializados");

}
catch (Exception ex)
{
Expand Down
15 changes: 8 additions & 7 deletions Msn.InteropDemo.Entities/Activity/ActivityTypeDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ namespace Msn.InteropDemo.Entities.Activity
{
public enum ActivityType
{
GET_PACIENTE_EN_DB_LOCAL = 1,
SEARCH_PACIENTES_COINCIDENTES_DB_LOCAL,
CREATE_PACIENTE_EN_DB_LOCAL,
GET_PACIENTE_EN_BUS_BY_IDENTIFIER,
GET_PACIENTE_EN_BUS_MATCH,
FEDERAR_PACIENTE_EN_BUS,
SNOWSTORM_FIND_CONCEPTS
GET_PACIENTE_EN_DB_LOCAL = 1,
SEARCH_PACIENTES_COINCIDENTES_DB_LOCAL = 2,
CREATE_PACIENTE_EN_DB_LOCAL = 3,
GET_PACIENTE_EN_BUS_BY_IDENTIFIER = 4,
GET_PACIENTE_EN_BUS_MATCH = 5,
FEDERAR_PACIENTE_EN_BUS = 6,
SNOWSTORM_FIND_CONCEPTS = 7,
IMMUNIZATION_POST_VACUNA_NOMIVAC = 8
}

public class ActivityTypeDescriptor : Core.EntityDescriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Logs\" />
</ItemGroup>

</Project>
59 changes: 38 additions & 21 deletions Msn.InteropDemo.Fhir.ConsoleTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,56 @@ static void Main(string[] args)
catch (Exception ex)
{
Console.WriteLine($"Error al registrar servicios:\n{ex.ToString()}");
Console.WriteLine("\nIngrese una tecla para terminar.");
Console.ReadKey();
return;
}

try
{

//var service = _serviceProvider.GetService<IPatientManager>();
//service.GetPatientsByMatch(17287412,
// "amorese",
// "miguel",
// "angel",
// Common.Constants.Sexo.Masculino,
// new DateTime(1964, 6, 30));

//TestExpression();
//CreatePatient();
//ConfigureLogger();
//var bunble = GetPatient();
//ShowPatients();
//ShowPatient("1982708");
//TestExpressionAppService();

//TestCie10Mapping();

TestAutomataFinito();

TestImmunization();
}
catch (Exception ex)
{
Log.Error(ex, "Test ERROR");

Console.WriteLine(ex.ToString());
Console.WriteLine("\nIngrese una tecla para terminar.");
Console.ReadKey();
}

Log.CloseAndFlush();
DisposeServices();
}


public static void TestImmunization()
{
var service = _serviceProvider.GetService<Fhir.IImmunizationManager>();
var model = new Model.Request.RegistrarInmunizationRequest
{
AplicacionVacunaFecha = DateTime.Today,
CurrentLocationId = "10060492200870",
CurrentLocationName = "Hospital Municipal Hospital Doctor Ángel Pintos",
DNI = 17287412,
FechaNacimiento = new DateTime(1964, 6, 30),
LocalPacienteId = "1",
PrimerApellido = "Amorese",
PrimerNombre = "Miguel",
SctConceptId = "2211000221102",
SctTerm = "vacuna virus influenza A subtipos H1N1, H3 + virus influenza B 1 serotipo",
Sexo = Common.Constants.Sexo.Masculino,
VacunaEsquemaId = "81",
VacunaEsquemaNombre = "Antigripal Esquema Personal de Salud",
VacunaLote = "649718"
};

var response = service.RegistrarAplicacionVacuna(model);

Console.WriteLine($"response.Id={response.Id}");
Console.ReadKey();
}

public static void TestAutomataFinito()
{
string simbolo = " IFA <= 15 years";
Expand Down Expand Up @@ -105,7 +117,12 @@ private static void RegisteServices()
services.AddTransient<Snowstorm.ISnowstormManager, Snowstorm.Implementation.SnowstormManager>();
services.AddTransient<AppServices.IEvolucionAppService, AppServices.Implementation.AppServices.EvolucionAppService>();
services.AddTransient<AppServices.ICie10AppService, AppServices.Implementation.AppServices.Cie10AppService>();
services.AddTransient<IImmunizationManager, Implementacion.ImmunizationManager>();

//*** Set Local DomainName **********************************************
var domainName = configuration.GetValue<string>("DomainName");
Common.Constants.DomainName.LocalDomain.SetValue(domainName);
//***********************************************************************

_serviceProvider = services.BuildServiceProvider();
}
Expand Down
14 changes: 14 additions & 0 deletions Msn.InteropDemo.Fhir.ConsoleTest/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

"AllowedHosts": "*",

"DomainName": "http://www.msal.gov.ar",

"IntegrationServices": {

"Services": [
Expand Down Expand Up @@ -71,6 +73,18 @@
"Url": "https://snowstorm.msal.gov.ar/MAIN/members"
}
]
},
{
"ServiceName": "IMMUNIZATION",

"BaseURL": "http://vacunas.sisa.msal.gov.ar/fhir",
"EndPoints": [
{
"Name": "IMMUNIZATION_POST_NOMIVAC",
"FriendlyURL": "http://vacunas.sisa.msal.gov.ar/fhir",
"Url": "http://vacunas.sisa.msal.gov.ar/fhir"
}
]
}
]
}
Expand Down
Loading

0 comments on commit 8312f85

Please sign in to comment.