Esempio n. 1
0
        public JsonResult SaveContact(
            int? id,
            int? Surv,
            bool? SInusual,
            bool? Brote,
            string LName1,
            string LName2,
            string FName1,
            string FName2,
            int DocumentType,
            string NoExpediente,
            string NationalId,
            DateTime? DOB,
            int? Age,
            AMeasure? AMeasure,
            Gender Gender,
            DateTime HospitalDate,
            DateTime RegDate,
            int HospitalId,
            int? nativepeople,
            int? nationality,
            DateTime DateFeverDummy
            )
        {
            FluCase flucase;
            var DateDummyRange1 = DateFeverDummy.Date.AddDays(1);
            var DateDummyRange2 = DateFeverDummy.Date.AddDays(-10);

                if (!id.HasValue)
            {
                var flucases = db.FluCases.Where(f => f.NoExpediente == NoExpediente.ToUpper() && (f.FeverDate < DateDummyRange1 && f.FeverDate >= DateDummyRange2)).ToList();

                if (flucases.Any())
                {
                    //id = flucases.First().ID;
                    //flucase = db.FluCases.Find(id);
                    //db.Entry(flucase).State = EntityState.Modified;
                    flucase = db.FluCases.Find(id);
                    return Json("El registro ya existe por favor verifique. Último registro: " + flucases.First().ID.ToString() );

                }
                else
                {
                    flucase = new FluCase();
                    flucase.HospitalID = HospitalId;
                    db.Entry(flucase).State = EntityState.Added;
                }
            }
            else
            {
                flucase = db.FluCases.Find(id);
                db.Entry(flucase).State = EntityState.Modified;
            }
            flucase.Surv = Surv;
            flucase.SurvInusual = SInusual;
            flucase.Brote = Brote;
            flucase.LName1 = LName1 ?? "";
            flucase.LName2 = LName2 ?? "";
            flucase.FName1 = FName1 ?? "";
            flucase.FName2 = FName2 ?? "";
            flucase.DocumentType = DocumentType;
            flucase.NoExpediente = NoExpediente ?? "";
            flucase.NationalId = NationalId ?? "";
            flucase.DOB = DOB;
            flucase.Age = Age;
            flucase.AMeasure = AMeasure;
            flucase.Gender = Gender;
            flucase.HospitalDate = HospitalDate;
            flucase.RegDate = RegDate;
            flucase.nativepeople = nativepeople;
            flucase.nationality = nationality;
            flucase.InsertDate = DateTime.Now;
            //flucase.UserID = User.Identity.Name;
            db.SaveChanges();

            // Grabar en la bitacora

            if (!id.HasValue)
            {
                HistoryRecord(flucase.ID, 1);
            }
            else
            {
                HistoryRecord(id, 2);
            }

            return Json(flucase.ID);
        }
Esempio n. 2
0
        public JsonResult SaveRisk(
                int Id,
                Vaccin? Vaccin,
                bool? HDisease,
                bool? Diabetes,
                bool? Neuro,
                bool? Asthma,
                bool? Pulmonary,
                bool? Liver,
                bool? Renal,
                bool? Immunsupp,
                bool? ParaCerebral, 
                bool? Indigena, 
                bool? TrabSalud, 
                bool? Desnutricion, 
                bool? Prematuridad,
                bool? BajoPesoNacer,
                bool? AusLacMat,
                Pregnant? Pregnant,
                bool? Pperium,
                Trimester? Trimester,
                int? PregnantWeek,
                bool? Smoking,
                bool? Alcohol,
                bool? DownSyn,
                Obesity? Obesity,
                string OtherRisk,
                int? VacInfluenza,
                DateTime? VacInfluenzaDateFirst,
                DateTime? VacInfluenzaDateSecond,
                int? VacBcg,
                DateTime? VacBcgDate,
                int? VacBcgDosis,
                int? VacNeumococo,
                DateTime? VacNeumococoDate,
                int? VacNeumococoDosis,
                int? VacTosFerina,
                DateTime? VacTosFerinaDate,
                int? VacTosFerinaDosis,
                int? VacHaemophilus,
                DateTime? VacHaemophilusDate,
                int? VaccinFuente,
                int? AntiViral,
                DateTime? AntiViralDate,
                DateTime? AntiViralDateEnd,
                int? AntiViralType,
                int? OseltaDose,
                string AntiViralDose,
                int? RiskFactors
            )
        {
            FluCase flucase;

            flucase = db.FluCases.Find(Id);
            if (flucase == null)
            {
                flucase = new FluCase();
                db.Entry(flucase).State = EntityState.Added;
            }
            else
            {
                db.Entry(flucase).State = EntityState.Modified;
            }
            flucase.Vaccin = Vaccin;
            flucase.HDisease = HDisease;
            flucase.Diabetes = Diabetes;
            flucase.Neuro = Neuro;
            flucase.Asthma = Asthma;
            flucase.Pulmonary = Pulmonary;
            flucase.Liver = Liver;
            flucase.Renal = Renal;
            flucase.Immunsupp = Immunsupp;

            flucase.ParaCerebral = ParaCerebral;
            flucase.Indigena = Indigena;
            flucase.TrabSalud = TrabSalud;
            flucase.Desnutricion = Desnutricion;
            flucase.Prematuridad = Prematuridad;
            flucase.BajoPesoNacer = BajoPesoNacer;
            flucase.AusLacMat = AusLacMat;

            flucase.Pregnant = Pregnant;
            flucase.Pperium = Pperium;
            flucase.Trimester = Trimester;
            flucase.PregnantWeek = PregnantWeek;
            flucase.Smoking = Smoking;
            flucase.Alcohol = Alcohol;
            flucase.DownSyn = DownSyn;
            flucase.Obesity = Obesity;
            flucase.OtherRisk = OtherRisk;
            flucase.InsertDate = DateTime.Now;
            //flucase.UserID = User.Identity.Name;

            //flucase.VacInfluenza = (VacInfluenza.ToString() == null) ? VacInfluenza : (VaccineOptions)Enum.Parse(typeof(VaccineOptions), VacInfluenza.ToString());
            flucase.VacInfluenza = VacInfluenza;
            flucase.VacInfluenzaDateFirst = VacInfluenzaDateFirst;
            flucase.VacInfluenzaDateSecond = VacInfluenzaDateSecond;
            if (VacBcg != null) flucase.VacBcg = (VaccineOptions)Enum.Parse(typeof(VaccineOptions), VacBcg.ToString());
            flucase.VacBcgDate = VacBcgDate;
            flucase.VacBcgDosis = VacBcgDosis;
            if (VacNeumococo != null) flucase.VacNeumococo = (VaccineOptions)Enum.Parse(typeof(VaccineOptions), VacNeumococo.ToString());
            flucase.VacNeumococoDate = VacNeumococoDate;
            flucase.VacNeumococoDosis = VacNeumococoDosis;
            if (VacTosFerina != null) flucase.VacTosFerina = (VaccineOptions)Enum.Parse(typeof(VaccineOptions), VacTosFerina.ToString());
            flucase.VacTosFerinaDate = VacTosFerinaDate;
            flucase.VacTosFerinaDosis = VacTosFerinaDosis;
            if (VacHaemophilus != null) flucase.VacHaemophilus = (VaccineOptions)Enum.Parse(typeof(VaccineOptions), VacHaemophilus.ToString());
            flucase.VacHaemophilusDate = VacHaemophilusDate;
            flucase.VaccinFuente = VaccinFuente;
            if (AntiViral != null)  flucase.AntiViral = (VaccineOptions)Enum.Parse(typeof(VaccineOptions), AntiViral.ToString());
            flucase.AntiViralDate = AntiViralDate;
            flucase.AntiViralDateEnd = AntiViralDateEnd;
            flucase.AntiViralType = AntiViralType;
            flucase.OseltaDose = OseltaDose;
            flucase.AntiViralDose = AntiViralDose;
            if (AntiViral != null)  flucase.RiskFactors = (RiskFactor)Enum.Parse(typeof(RiskFactor), RiskFactors.ToString());

            db.SaveChanges();

            return Json("Success");
        }
Esempio n. 3
0
        public JsonResult SaveHospital(
                int id,
                string CHNum,
                DateTime? FeverDate,
                int? FeverEW,
                DateTime? DiagDate,
                int? DiagEW,
                string Antiviral,
                DateTime? AStartDate,
                DateTime? HospAmDate,
                int? HospEW,
                DateTime? HospExDate,
                int? ICU,
                DateTime? ICUAmDate,
                int? ICUEW,
                DateTime? ICUExDate,
                string Destin,
                bool? IsSample,
                DateTime? SampleDate,
                string SampleType,
                DateTime? ShipDate,
                int? LabId,
                DateTime? SampleDate2,
                string SampleType2,
                DateTime? ShipDate2,
                int? LabId2,
                DateTime? SampleDate3,
                string SampleType3,
                DateTime? ShipDate3,
                int? LabId3,
                bool? Adenopatia,
                bool? AntecedentesFiebre,
                bool? Rinorrea,
                bool? Malestar,
                bool? Nauseas,
                bool? DolorMuscular,
                bool? Disnea,
                bool? DolorCabeza,
                bool? Estridor,
                bool? Tos,
                bool? DifResp,
                bool? MedSatOxig,
                int? SatOxigPor,
                int? SalonVal,
                int? DiagPrinAdmVal,
                string DiagOtroAdm,
                string DestinICU,
                DateTime? FalleDate,
                string InstReferName,
                bool? HallRadio,
                bool? MecVent,
                bool? MecVentNoInv,
                bool? ECMO,
                bool? VAFO,
                int? DiagEgVal,
                bool? Tiraje,
                bool? Odinofagia,
                int? CaseStatus,
                DateTime? CloseDate,
                string ObservationCase
            )
        {
            FluCase flucase;

            flucase = db.FluCases.Find(id);
            if (flucase == null)
            {
                flucase = new FluCase();
                db.Entry(flucase).State = EntityState.Added;
            }
            else
            {
                db.Entry(flucase).State = EntityState.Modified;
            }
            flucase.CHNum = CHNum;
            flucase.FeverDate = FeverDate;
            flucase.FeverEW = FeverEW;
            flucase.DiagDate = DiagDate;
            flucase.DiagEW = DiagEW;
            flucase.Antiviral = Antiviral;
            flucase.AStartDate = AStartDate;
            flucase.HospAmDate = HospAmDate;
            flucase.HospEW = HospEW;
            flucase.HospExDate = HospExDate;
            flucase.ICU = ICU;
            flucase.ICUAmDate = ICUAmDate;
            flucase.ICUEW = ICUEW;
            flucase.ICUExDate = ICUExDate;
            flucase.Destin = Destin;
            flucase.FalleDate = FalleDate;
            flucase.IsSample = IsSample;
            flucase.SampleDate = SampleDate;
            flucase.SampleType = SampleType;
            flucase.ShipDate = ShipDate;
            flucase.LabID = LabId;
            flucase.SampleDate2 = SampleDate2;
            flucase.SampleType2 = SampleType2;
            flucase.ShipDate2 = ShipDate2;
            flucase.LabID2 = LabId2;
            flucase.SampleDate3 = SampleDate3;
            flucase.SampleType3 = SampleType3;
            flucase.ShipDate3 = ShipDate3;
            flucase.LabID3 = LabId3;
            flucase.InsertDate = DateTime.Now;
            //flucase.UserID = User.Identity.Name;
            flucase.Adenopatia = Adenopatia;
            flucase.AntecedentesFiebre = AntecedentesFiebre;
            flucase.Rinorrea = Rinorrea;
            flucase.Malestar = Malestar;
            flucase.Nauseas = Nauseas;
            flucase.DolorMuscular = DolorMuscular;
            flucase.Disnea = Disnea;
            flucase.DolorCabeza = DolorCabeza;
            flucase.Estridor = Estridor;
            flucase.Tos = Tos;
            flucase.DifResp = DifResp;
            flucase.MedSatOxig = MedSatOxig;
            flucase.SatOxigPor = SatOxigPor;
            flucase.Salon = SalonVal;
            flucase.DiagAdm = DiagPrinAdmVal;
            flucase.DiagOtroAdm = DiagOtroAdm;
            flucase.DestinICU = DestinICU;
            flucase.HallRadio = HallRadio;
            flucase.MecVent = MecVent;
            flucase.MecVentNoInv = MecVentNoInv;
            flucase.ECMO = ECMO;
            flucase.VAFO = VAFO;
            flucase.DiagEg = DiagEgVal;
            flucase.Tiraje = Tiraje;
            flucase.Odinofagia = Odinofagia;
            flucase.CaseStatus = CaseStatus;
            flucase.CloseDate = CloseDate;
            flucase.ObservationCase = ObservationCase;
            db.SaveChanges();

            return Json("Success");
        }
Esempio n. 4
0
        public JsonResult SaveLab(
                int id,
                DateTime? RecDate,
                bool? Processed,
                DateTime? RecDate2,
                bool? Processed2,
                DateTime? RecDate3,
                bool? Processed3,
                DateTime? EndLabDate,
                string FResult,
                string NoProRen,
                string NoProRen2,
                string NoProRen3,
                string Comments,
                string FinalResult,
                int? FinalResultVirusTypeID,
                int? FinalResultVirusSubTypeID,
                int? FinalResultVirusLineageID,
                List<LabTestViewModel> LabTests
            )
        {
            FluCase flucase;

            flucase = db.FluCases.Find(id);

            if (flucase == null) {
                flucase = new FluCase();
                db.Entry(flucase).State = EntityState.Added;
            } else {
                db.Entry(flucase).State = EntityState.Modified;
            }

            flucase.RecDate = RecDate;
            flucase.Processed = Processed;
            flucase.RecDate2 = RecDate2;
            flucase.Processed2 = Processed2;
            flucase.RecDate3 = RecDate3;
            flucase.Processed3 = Processed3;
            flucase.EndLabDate = EndLabDate;
            flucase.FResult = FResult;
            flucase.NoProRen = NoProRen;
            flucase.Comments = Comments;
            flucase.FinalResult = FinalResult;
            flucase.FinalResultVirusTypeID = FinalResultVirusTypeID;
            flucase.FinalResultVirusSubTypeID = FinalResultVirusSubTypeID;
            flucase.FinalResultVirusLineageID = FinalResultVirusLineageID;

            db.CaseLabTests.RemoveRange(flucase.CaseLabTests);
            flucase.CaseLabTests = new List<CaseLabTest>();
            if (LabTests != null) {
                foreach (LabTestViewModel labTestViewModel in LabTests.OrderBy(x=>x.SampleNumber).ThenBy(y=>y.LabID).ThenBy(z => z.TestDate)) {
                    flucase.CaseLabTests.Add(
                        new CaseLabTest {

                            LabID = labTestViewModel.LabID,
                            Processed = labTestViewModel.Processed,
                            SampleNumber = labTestViewModel.SampleNumber,
                            TestDate = labTestViewModel.TestDate,
                            TestResultID = labTestViewModel.TestResultID,
                            TestEndDate = labTestViewModel.TestEndDate,
                            TestType = (TestType)labTestViewModel.TestType,
                            VirusTypeID = labTestViewModel.VirusTypeID,
                            CTVirusType = labTestViewModel.CTVirusType,
                            OtherVirusTypeID = labTestViewModel.OtherVirusTypeID,
                            CTOtherVirusType = labTestViewModel.CTOtherVirusType,
                            InfA = labTestViewModel.InfA,
                            VirusSubTypeID = labTestViewModel.VirusSubTypeID,
                            CTSubType = labTestViewModel.CTSubType,
                            InfB = labTestViewModel.InfB,
                            VirusLineageID = labTestViewModel.VirusLineageID,
                            CTLineage = labTestViewModel.CTLineage,
                            ParaInfI = labTestViewModel.ParaInfI,
                            ParaInfII = labTestViewModel.ParaInfII,
                            ParaInfIII = labTestViewModel.ParaInfIII,
                            RNP = labTestViewModel.RNP,
                            RSV = labTestViewModel.RSV,
                            Adenovirus = labTestViewModel.Adenovirus,
                            Metapneumovirus = labTestViewModel.Metapneumovirus,
                            FluCaseID = flucase.ID
                        }
                    );
                }
            }

            flucase.InsertDate = DateTime.Now;
            //flucase.UserID = User.Identity.Name;

            var result = SaveChanges();

            var tests = flucase.CaseLabTests.ToList();
            if (tests.Count <= 0) return result;

            if (tests.Count >= 1) flucase.MuestraID1 = tests[0].ID;
            if (tests.Count >= 2) flucase.MuestraID2 = tests[1].ID;
            if (tests.Count >= 3) flucase.MuestraID3 = tests[2].ID;
            if (tests.Count >= 4) flucase.MuestraID4 = tests[3].ID;
            if (tests.Count >= 5) flucase.MuestraID5 = tests[4].ID;
            if (tests.Count >= 6) flucase.MuestraID6 = tests[5].ID;

            if (tests.Count >= 7) flucase.MuestraID7 = tests[6].ID;
            if (tests.Count >= 8) flucase.MuestraID8 = tests[7].ID;
            if (tests.Count >= 9) flucase.MuestraID9 = tests[8].ID;
            if (tests.Count >= 10) flucase.MuestraID10 = tests[9].ID;
            if (tests.Count >= 11) flucase.MuestraID11 = tests[10].ID;
            if (tests.Count >= 12) flucase.MuestraID12 = tests[11].ID;
            if (tests.Count >= 13) flucase.MuestraID13 = tests[12].ID;
            if (tests.Count >= 14) flucase.MuestraID14 = tests[13].ID;
            if (tests.Count >= 15) flucase.MuestraID15 = tests[14].ID;

            result = SaveChanges();

            //Bitacora
            HistoryRecord(flucase.ID, 4);

            return result;
        }
Esempio n. 5
0
        public JsonResult SaveGEO(
                int id,
                int? CountryId,
                int? AreaId,
                int? StateId,
                int? LocalId,
                int? NeighborhoodId,
                UrbanRural UrbanRural,
                string Address,
                int? CountryOrigin,
                string PhoneNumber,
                string Latitude,
                string Longitude
            )
        {
            FluCase flucase;

            flucase = db.FluCases.Find(id);
            if (flucase == null)
            {
                flucase = new FluCase();
                db.Entry(flucase).State = EntityState.Added;
            }
            else
            {
                db.Entry(flucase).State = EntityState.Modified;
            }
            flucase.CountryID = CountryId;
            flucase.AreaID = AreaId;
            flucase.StateID = StateId;
            flucase.LocalID = LocalId;
            flucase.NeighborhoodID = NeighborhoodId;
            flucase.UrbanRural = UrbanRural;
            flucase.Address = Address;
            flucase.PhoneNumber = PhoneNumber;
            flucase.Latitude = Latitude;
            flucase.Longitude = Longitude;
            flucase.CountryOrigin = CountryOrigin;
            flucase.InsertDate = DateTime.Now;
            //flucase.UserID = User.Identity.Name;

            db.SaveChanges();

            return Json("Success");
        }