-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from SALUD-AR/Renaper-FirmaDigital
Renaper firma digital
- Loading branch information
Showing
49 changed files
with
2,793 additions
and
117 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
Msn.InteropDemo.AppServices.Implementation/AppServices/Cie10AppService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Msn.InteropDemo.AppServices.Core; | ||
using Msn.InteropDemo.Snowstorm; | ||
using Msn.InteropDemo.ViewModel.Snomed; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Msn.InteropDemo.AppServices.Implementation.AppServices | ||
{ | ||
public class Cie10AppService : Core.GenericServiceReadOnly<Entities.Codificacion.Cie10>, ICie10AppService | ||
{ | ||
private readonly ISnowstormManager _snowstormManager; | ||
|
||
public Cie10AppService(ICurrentContext currentContext, | ||
ILogger<Cie10AppService> logger, | ||
Snowstorm.ISnowstormManager snowstormManager) : | ||
base(currentContext, logger) | ||
{ | ||
_snowstormManager = snowstormManager; | ||
} | ||
|
||
public IEnumerable<Cie10MapResultViewModel> GetCie10MappedItems(string conceptId) | ||
{ | ||
var lst = new List<Cie10MapResultViewModel>(); | ||
|
||
var cie10lst = _snowstormManager.RunQueryCie10MapRefset(conceptId); | ||
|
||
//se seleccionan solo aquellos que tienen un MapTarget, es decir, un Mapeo Esistente. | ||
cie10lst.Items = cie10lst.Items.Where(x => !string.IsNullOrWhiteSpace(x.additionalFields.mapTarget)).ToList(); | ||
|
||
//Customization para el formato de la codificacion de la DEIS | ||
foreach (var item in cie10lst.Items) | ||
{ | ||
if(item.additionalFields.mapTarget.Length == 3) | ||
{ | ||
item.additionalFields.mapTarget += "X"; | ||
} | ||
} | ||
|
||
//Mapeo a nuestros ViewModels | ||
var cie10Maplst = Mapper.Map<List<Cie10MapResultViewModel>>(cie10lst.Items); | ||
|
||
//Se seleccionadn los distintos MApTargue para is a buscar en la DB | ||
var cie102search = cie10Maplst.Select(x => x.MapTarget).Distinct(); | ||
|
||
//obtenidos de la DB | ||
var cie10FromDbItems = CurrentContext.DataContext.Cie10.Where(x => cie102search.Contains(x.SubcategoriaId)); | ||
|
||
//por cada uno encontrado se le setea el texto de la SubcategoriaNombre y CategoriaNombre de la CIE10 esn Español | ||
foreach (var item in cie10Maplst) | ||
{ | ||
var dbitem = cie10FromDbItems.FirstOrDefault(x => x.SubcategoriaId == item.MapTarget); | ||
if(dbitem != null) | ||
{ | ||
item.SubcategoriaNombre = dbitem.SubcategoriaNombre; | ||
item.CategoriaNombre = dbitem.CategoriaNombre; | ||
} | ||
} | ||
|
||
return cie10Maplst; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Msn.InteropDemo.AppServices.Implementation/Mapping/Profiles/SnowstormProfile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Msn.InteropDemo.ViewModel.Snomed; | ||
|
||
namespace Msn.InteropDemo.AppServices.Implementation.Mapping.Profiles | ||
{ | ||
public class SnowstormProfile : AutoMapper.Profile | ||
{ | ||
public SnowstormProfile() | ||
{ | ||
CreateMap<Snowstorm.Model.Components.Item, ViewModel.Snomed.SnomedItem>() | ||
.ForMember(dest => dest.ConceptId, orig => orig.MapFrom(x => x.ConceptId)) | ||
.ForMember(dest => dest.Description, orig => orig.MapFrom(x => x.pt.Term)) | ||
.ForMember(dest => dest.FSN, orig => orig.MapFrom(x => x.fsn.Term)) | ||
.ForMember(dest => dest.Language, orig => orig.MapFrom(x => x.pt.Lang)); | ||
|
||
CreateMap<Snowstorm.Model.Components.RefsetItem, ViewModel.Snomed.SnomedItem>() | ||
.ForMember(dest => dest.ConceptId, orig => orig.MapFrom(x => x.referencedComponent.conceptId)) | ||
.ForMember(dest => dest.Description, orig => orig.MapFrom(x => x.referencedComponent.pt.Term)) | ||
.ForMember(dest => dest.FSN, orig => orig.MapFrom(x => x.referencedComponent.fsn.Term)) | ||
.ForMember(dest => dest.Language, orig => orig.MapFrom(x => x.referencedComponent.pt.Lang)); | ||
|
||
CreateMap<Snowstorm.Model.Components.RefsetCie10MapItem, Cie10MapResultViewModel>() | ||
.ForMember(dest => dest.ConceptId, orig => orig.MapFrom(x => x.referencedComponent.conceptId)) | ||
.ForMember(dest => dest.Description, orig => orig.MapFrom(x => x.referencedComponent.pt.Term)) | ||
.ForMember(dest => dest.FSN, orig => orig.MapFrom(x => x.referencedComponent.fsn.Term)) | ||
.ForMember(dest => dest.Language, orig => orig.MapFrom(x => x.referencedComponent.pt.Lang)) | ||
.ForMember(dest => dest.MapGroup, orig => orig.MapFrom(x => x.additionalFields.mapGroup)) | ||
.ForMember(dest => dest.MapPriority, orig => orig.MapFrom(x => x.additionalFields.mapPriority)) | ||
.ForMember(dest => dest.MapRule, orig => orig.MapFrom(x => x.additionalFields.mapRule)) | ||
.ForMember(dest => dest.MapAdvice, orig => orig.MapFrom(x => x.additionalFields.mapAdvice)) | ||
.ForMember(dest => dest.MapTarget, orig => orig.MapFrom(x => x.additionalFields.mapTarget.Replace(".", ""))) | ||
.ForMember(dest => dest.SubcategoriaId, orig => orig.MapFrom(x => x.additionalFields.mapTarget.Replace(".", ""))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Msn.InteropDemo.AppServices | ||
{ | ||
public interface ICie10AppService : Core.IGenericServiceReadOnly<Entities.Codificacion.Cie10> | ||
{ | ||
System.Collections.Generic.IEnumerable<ViewModel.Snomed.Cie10MapResultViewModel> GetCie10MappedItems(string conceptId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Msn.InteropDemo.Common.Utils.Helpers | ||
{ | ||
public static class Cuit | ||
{ | ||
public static bool Validate(string cuit) | ||
{ | ||
if (string.IsNullOrWhiteSpace(cuit)) | ||
{ | ||
return false; | ||
} | ||
|
||
cuit = cuit.Trim(); | ||
if (cuit.Length > 13) //no puede ser mayor que 13 con los guiones incluidos. | ||
{ | ||
return false; | ||
} | ||
|
||
cuit = cuit.Replace("-", ""); // Le quito el guión | ||
if (cuit.Length != 11) | ||
{ | ||
return false; | ||
} | ||
|
||
var rg = new Regex("[A-Z_a-z]"); // Expresión regular para caracteres no válidos | ||
if (rg.IsMatch(cuit)) | ||
{ | ||
// Tiene caracteres no válidos | ||
return false; | ||
} | ||
|
||
var calculado = GetCuitVerificationDigit(cuit); | ||
var digito = int.Parse(cuit.Substring(10)); | ||
return calculado == digito; | ||
} | ||
|
||
public static int GetCuitVerificationDigit(string cuit) | ||
{ | ||
var mult = new[] { 5, 4, 3, 2, 7, 6, 5, 4, 3, 2 }; | ||
var nums = cuit.ToCharArray(); | ||
var total = 0; | ||
for (var i = 0; i < mult.Length; i++) | ||
{ | ||
total += int.Parse(nums[i].ToString()) * mult[i]; | ||
} | ||
var resto = total % 11; | ||
return resto == 0 ? 0 : resto == 1 ? 9 : 11 - resto; | ||
} | ||
|
||
public static string ToCleanFormat(string cuit) | ||
{ | ||
if (cuit != null) | ||
{ | ||
cuit = cuit.Trim(); //quito espacios | ||
cuit = cuit.Replace("-", ""); // Le quito el guión | ||
} | ||
return cuit; | ||
} | ||
|
||
public static string ToUIFormat(long? cuit, bool mustValidate = false) | ||
{ | ||
if(!cuit.HasValue) | ||
{ | ||
return string.Empty; | ||
} | ||
if(cuit.Value == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
return ToUIFormat(cuit.ToString(), mustValidate); | ||
} | ||
|
||
public static string ToUIFormat(string cuit, bool mustValidate = false) | ||
{ | ||
if (mustValidate && !Validate(cuit)) | ||
{ | ||
throw new ArgumentException("Número de CUIT incorrecto"); | ||
} | ||
|
||
cuit = cuit.Trim(); //quito espacios | ||
cuit = cuit.Replace("-", ""); // Le quito el guión si lo hubiera, posiblemente tenga solo uno. | ||
|
||
//cuit = 20172874127 | ||
|
||
if (cuit.Length != 11) | ||
{ | ||
return cuit; | ||
} | ||
|
||
var preCuit = cuit.Substring(0, 2) + "-"; | ||
//preCuit = 20- | ||
|
||
preCuit += cuit.Substring(2, cuit.Length - 3) + "-"; | ||
//preCuit = 20-17287412- | ||
|
||
preCuit += cuit.Substring(cuit.Length - 1); | ||
//preCuit = 20-17287412-7 | ||
|
||
cuit = preCuit; | ||
|
||
return cuit; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
Msn.InteropDemo.Data/EntitiesConfiguration/Codificacion/Cie10Configuration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Msn.InteropDemo.Entities.Codificacion; | ||
|
||
namespace Msn.InteropDemo.Data.EntitiesConfiguration.Codificacion | ||
{ | ||
public class Cie10Configuration : IEntityTypeConfiguration<Entities.Codificacion.Cie10> | ||
{ | ||
public void Configure(EntityTypeBuilder<Cie10> builder) | ||
{ | ||
builder.HasKey(x => x.SubcategoriaId); | ||
|
||
builder.Property(x => x.SubcategoriaId) | ||
.ValueGeneratedNever() | ||
.HasMaxLength(4) | ||
.HasColumnType("char(4)") | ||
.IsRequired(true) | ||
.IsUnicode(false); | ||
|
||
builder.Property(x => x.SubcategoriaNombre) | ||
.HasMaxLength(300) | ||
.IsRequired() | ||
.IsUnicode(); | ||
|
||
builder.Property(x => x.CategoriaNombre) | ||
.HasMaxLength(300) | ||
.IsRequired() | ||
.IsUnicode(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
aa03532
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se realiza el Merge para la incorporación de cambios específicos.