Inheritance: MonoBehaviour
コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,GlucoseDateTime,GlucoseValue")] Glucose glucose)
        {
            if (id != glucose.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(glucose);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GlucoseExists(glucose.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(glucose));
        }
コード例 #2
0
        public BloodResult GenerateOne()
        {
            BloodResult result = new BloodResult();

            result.Name = NamesGen.NextName;

            //        Общий белок 65-84 г/л 65-85 г/л
            result.Total_protein = Total_protein.Next(this.myRandom);
            //Белковые фракции:
            //                    - альбумины 34-44 г/л 21-35 г/л
            result.Albumin = Albumin.Next(this.myRandom);
            //                    - глобулины 35-45 г/л 21-34,9 г/л
            result.Globulin = Globulin.Next(this.myRandom);
            //                    Гемоглобин 130-150 г/л 120-140 г/л
            result.Hemoglobin = Hemoglobin.Next(this.myRandom);
            //                    Мочевина 2,5-8,2 ммоль/л 2,4-8,2 ммоль/л
            result.Urea = Urea.Next(this.myRandom);
            //                    Мочевая кислота 0,12-0,42 ммоль/л 0,24-0,54 ммоль/л
            result.Uric_acid = Uric_acid.Next(this.myRandom);
            //                    Глюкоза 3,3-5,5 ммоль/л 3,2-5,5 ммоль/л
            result.Glucose = Glucose.Next(this.myRandom);
            //                    Креатинин 61-114 мкмоль/л 52-96 мкмоль/л
            result.Creatinine = Creatinine.Next(this.myRandom);
            //                    Холестерин общий 3,4-6,4 ммоль/л 3,4-6,4 ммоль/л
            result.Total_cholesterol = Total_cholesterol.Next(this.myRandom);
            //                    ЛПНП До 3 ммоль/л До 3 ммоль/л
            result.LDL = LDL.Next(this.myRandom);
            //                    ЛПВП 1 ммоль/л 0-1,2 ммоль/л
            result.HDL = HDL.Next(this.myRandom);
            //                    Триглицериды До 1,6 ммоль/л До 1,7 ммоль/л
            result.Trigliceride = Trigliceride.Next(this.myRandom);
            //                    Билирубин(общий) 5-20 мкмоль/л 5-20 мкмоль/л
            result.Total_bilirubin = Total_bilirubin.Next(this.myRandom);
            //                    Билирубин прямой 2,2-5,0 мкмоль/л 2,2-5,0 мкмоль/л
            result.Direct_bilirubin = Direct_bilirubin.Next(this.myRandom);
            //                    АЛТ(аланинаминотрансфераза) Не более 45 ед/л Не более 30 ед/л
            result.ALT = ALT.Next(this.myRandom);
            //                    АСТ(аспартатаминотрансфераза) До 45 ед/л До 30 ед/л
            result.AST = AST.Next(this.myRandom);
            //                    Щелочная фосфатаза До 260 ед/л До 250 ед/л
            result.Alcaline_phospharase = Alcaline_phospharase.Next(this.myRandom);
            //                    ГГТ(гамма-глутамилтрансфераза) До 33 ед/л До 47 ед/л
            result.GGT = GGT.Next(this.myRandom);
            //                    Липаза 0-187 ед/л 0-187 ед/л
            result.Lipase = Lipase.Next(this.myRandom);
            //                    Панкреатическая амилаза 0-50 ед/л 0-50 ед/л
            result.Pancreatic_amylase = Pancreatic_amylase.Next(this.myRandom);
            //                    Креатинкиназа(КК) До 180 ед/л До 180 ед/л
            result.Creatine_Kinase = Creatine_Kinase.Next(this.myRandom);
            //                    Натрий 130-150 ммоль/л 130-150 ммоль/л
            result.Sodium = Sodium.Next(this.myRandom);
            //                    Калий 3,3-5,3 ммоль/л 3,35-5,3 ммоль/л
            result.Potassium = Potassium.Next(this.myRandom);
            //                    Альфа-амилаза 27-99 ед/л 28-100 ед/л
            result.Alpha_amilase = Alpha_amilase.Next(this.myRandom);


            return(result);
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,GlucoseDateTime,GlucoseValue")] Glucose glucose)
        {
            if (ModelState.IsValid)
            {
                if (HttpContext.User.Identity.Name == null)
                {
                    //TODO: TU TRZEBA ZAŁAĆ DZIURĘ I ZROBIĆ TAK, ŻEBY TO NIE BYŁO WIDOCZNE JAK SIĘNIE JEST ZALOGOWANYM
                }
                else
                {
                    glucose.Id_patient = HttpContext.User.Identity.Name;
                }

                _context.Add(glucose);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(glucose));
        }
コード例 #4
0
        public Indicators IndicatorByPacient(string patientId)
        {
            try
            {
                var serviceData = (from E in ctx.Person
                                   join A in ctx.Service on E.v_PersonId equals A.v_PersonId into A_join
                                   from A in A_join.DefaultIfEmpty()
                                   //join F in ctx.OrganizationPerson on E.v_PersonId equals F.v_PersonId
                                   //join G in ctx.Organization on F.v_OrganizationId equals G.v_OrganizationId
                                   where E.v_PersonId == patientId && A.i_IsDeleted == 0
                                   select new
                {
                    FullName = E.v_FirstName + " " + E.v_FirstLastName + " " + E.v_SecondLastName,
                    Puesto = E.v_CurrentOccupation,
                    Empresa = "",
                    FechaServicio = A.d_ServiceDate
                }).ToList();

                if (serviceData.Count == 0)
                {
                    return(null);
                }

                var serviceDataTemp = (from a in serviceData
                                       select new
                {
                    FullName = a.FullName,
                    Puesto = a.Puesto,
                    Empresa = a.Empresa,
                    FechaServicio = a.FechaServicio.Value.Date
                }).ToList();

                serviceDataTemp = serviceDataTemp.GroupBy(g => g.FechaServicio).Select(s => s.First()).ToList();


                var serviceComponentFieldValues = (from A in ctx.Service
                                                   join B in ctx.ServiceComponent on A.v_ServiceId equals B.v_ServiceId
                                                   join C in ctx.ServiceComponentFields on B.v_ServiceComponentId equals C.v_ServiceComponentId
                                                   join D in ctx.ServiceComponentFieldValues on C.v_ServiceComponentFieldsId equals D.v_ServiceComponentFieldsId
                                                   where A.v_PersonId == patientId &&
                                                   (C.v_ComponentFieldId == Constants.COLESTEROL_TOTAL_Colesterol_Total_Id || C.v_ComponentFieldId == Constants.PERFIL_LIPIDICO_Colesterol_Total_Id || C.v_ComponentFieldId == Constants.GLUCOSA_Glucosa_Id || C.v_ComponentFieldId == Constants.HEMOGLOBINA_Hemoglobina_Id || C.v_ComponentFieldId == Constants.HEMOGRAMA_Hemoglobina_Id || C.v_ComponentFieldId == Constants.FUNCIONES_VITALES_Presion_Sistolica_Id || C.v_ComponentFieldId == Constants.FUNCIONES_VITALES_Presion_Distolica_Id || C.v_ComponentFieldId == Constants.ANTROPOMETRIA_Imc_Id || C.v_ComponentFieldId == Constants.ESPIROMETRIA_Cvf_Id) &&
                                                   B.i_IsDeleted == 0 &&
                                                   C.i_IsDeleted == 0

                                                   select new
                {
                    ServiceDate = A.d_ServiceDate,
                    ComponentFieldId = C.v_ComponentFieldId,
                    ServiceComponentFieldsId = C.v_ServiceComponentFieldsId,
                    Value1 = D.v_Value1,
                }).ToList();

                var serviceComponentFieldValuesTemp = (from a in serviceComponentFieldValues
                                                       select new
                {
                    ServiceDate = a.ServiceDate.Value.Date,
                    ComponentFieldId = a.ComponentFieldId,
                    ServiceComponentFieldsId = a.ServiceComponentFieldsId,
                    Value1 = a.Value1
                }).ToList();

                serviceComponentFieldValuesTemp = serviceComponentFieldValuesTemp.GroupBy(g => new { g.ServiceDate, g.ComponentFieldId }).Select(s => s.First()).ToList();

                Indicators oIndicators = new Indicators();
                oIndicators.PersonId = patientId;

                #region Data
                List <DataPatient> Data = new List <DataPatient>();
                var oDataPatient        = new DataPatient();
                oDataPatient.Name    = serviceDataTemp[0].FullName;
                oDataPatient.Empresa = serviceDataTemp[0].Empresa;
                oDataPatient.Puesto  = serviceDataTemp[0].Puesto;
                Data.Add(oDataPatient);
                oIndicators.DataPatient = Data;
                #endregion

                #region IMC
                List <Weight> Weights         = new List <Weight>();
                var           ListWeights     = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.ANTROPOMETRIA_Imc_Id).ToList();
                var           ListWeightsSort = ListWeights.OrderByDescending(o1 => o1.ServiceDate).ToList();
                foreach (var item in ListWeightsSort)
                {
                    var oWeight = new Weight();
                    oWeight.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oWeight.y    = item.Value1;

                    Weights.Add(oWeight);
                }
                oIndicators.Weights = Weights;
                #endregion

                #region BloodPressureSis
                var BloodPressureSis     = new List <BloodPressureSis>();
                var ListBloodPressureSis = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.FUNCIONES_VITALES_Presion_Sistolica_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListBloodPressureSis)
                {
                    var oBloodPressureSis = new BloodPressureSis();
                    oBloodPressureSis.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oBloodPressureSis.y    = item.Value1;

                    BloodPressureSis.Add(oBloodPressureSis);
                }
                oIndicators.BloodPressureSis = BloodPressureSis;
                #endregion

                #region BloodPressureDia
                var BloodPressureDia     = new List <BloodPressureDia>();
                var ListBloodPressureDia = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.FUNCIONES_VITALES_Presion_Distolica_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListBloodPressureDia)
                {
                    var oBloodPressureDia = new BloodPressureDia();
                    oBloodPressureDia.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oBloodPressureDia.y    = item.Value1;

                    BloodPressureDia.Add(oBloodPressureDia);
                }
                oIndicators.BloodPressureDia = BloodPressureDia;
                #endregion

                #region Cholesterol
                var Cholesterol     = new List <Cholesterol>();
                var ListCholesterol = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.COLESTEROL_TOTAL_Colesterol_Total_Id || p.ComponentFieldId == Constants.PERFIL_LIPIDICO_Colesterol_Total_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListCholesterol)
                {
                    var oCholesterol = new Cholesterol();
                    oCholesterol.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oCholesterol.y    = item.Value1;

                    Cholesterol.Add(oCholesterol);
                }
                oIndicators.Cholesterols = Cholesterol;
                #endregion

                #region Glucoses
                var Glucoses     = new List <Glucose>();
                var ListGlucoses = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.GLUCOSA_Glucosa_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListGlucoses)
                {
                    var oGlucoses = new Glucose();
                    oGlucoses.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oGlucoses.y    = item.Value1;

                    Glucoses.Add(oGlucoses);
                }
                oIndicators.Glucoses = Glucoses;
                #endregion

                #region Haemoglobin
                var Haemoglobins     = new List <Haemoglobin>();
                var ListHaemoglobins = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.HEMOGLOBINA_Hemoglobina_Id || p.ComponentFieldId == Constants.HEMOGRAMA_Hemoglobina_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListHaemoglobins)
                {
                    var oHaemoglobin = new Haemoglobin();
                    oHaemoglobin.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oHaemoglobin.y    = item.Value1;

                    Haemoglobins.Add(oHaemoglobin);
                }
                oIndicators.Haemoglobins = Haemoglobins;
                #endregion

                #region Espiro

                var Espiros     = new List <Espiro>();
                var ListEspiros = serviceComponentFieldValuesTemp.FindAll(p => p.ComponentFieldId == Constants.ESPIROMETRIA_Cvf_Id).OrderBy(p => p.ServiceDate);
                foreach (var item in ListEspiros)
                {
                    var oEspiro = new Espiro();
                    oEspiro.Date = item.ServiceDate.ToString("dd-MM-yyyy");
                    oEspiro.y    = item.Value1;

                    Espiros.Add(oEspiro);
                }
                oIndicators.Espiros = Espiros;
                #endregion



                return(oIndicators);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #5
0
        //UPDATE
        public static string GetUpdateQuery(Glucose item)
        {
            string query = String.Format(UpdateQuery, item.getValue(), "FROM_UNIXTIME(" + item.getTimestamp() + "*0.001)", item.getId());

            return(query);
        }
コード例 #6
0
        //DELETE
        public static string GetDeleteQuery(Glucose item)
        {
            string query = DeleteQuery + Id + "=" + item.getId();

            return(query);
        }
コード例 #7
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (EventType != null)
                {
                    hash = hash * 59 + EventType.GetHashCode();
                }

                if (CreatedAt != null)
                {
                    hash = hash * 59 + CreatedAt.GetHashCode();
                }

                if (Glucose != null)
                {
                    hash = hash * 59 + Glucose.GetHashCode();
                }

                if (GlucoseType != null)
                {
                    hash = hash * 59 + GlucoseType.GetHashCode();
                }

                if (Carbs != null)
                {
                    hash = hash * 59 + Carbs.GetHashCode();
                }

                if (Insulin != null)
                {
                    hash = hash * 59 + Insulin.GetHashCode();
                }

                if (Units != null)
                {
                    hash = hash * 59 + Units.GetHashCode();
                }

                if (Notes != null)
                {
                    hash = hash * 59 + Notes.GetHashCode();
                }

                if (EnteredBy != null)
                {
                    hash = hash * 59 + EnteredBy.GetHashCode();
                }

                return(hash);
            }
        }
コード例 #8
0
        /// <summary>
        /// Returns true if Treatment instances are equal
        /// </summary>
        /// <param name="other">Instance of Treatment to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Treatment other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     EventType == other.EventType ||
                     EventType != null &&
                     EventType.Equals(other.EventType)
                 ) &&
                 (
                     CreatedAt == other.CreatedAt ||
                     CreatedAt != null &&
                     CreatedAt.Equals(other.CreatedAt)
                 ) &&
                 (
                     Glucose == other.Glucose ||
                     Glucose != null &&
                     Glucose.Equals(other.Glucose)
                 ) &&
                 (
                     GlucoseType == other.GlucoseType ||
                     GlucoseType != null &&
                     GlucoseType.Equals(other.GlucoseType)
                 ) &&
                 (
                     Carbs == other.Carbs ||
                     Carbs != null &&
                     Carbs.Equals(other.Carbs)
                 ) &&
                 (
                     Insulin == other.Insulin ||
                     Insulin != null &&
                     Insulin.Equals(other.Insulin)
                 ) &&
                 (
                     Units == other.Units ||
                     Units != null &&
                     Units.Equals(other.Units)
                 ) &&
                 (
                     Notes == other.Notes ||
                     Notes != null &&
                     Notes.Equals(other.Notes)
                 ) &&
                 (
                     EnteredBy == other.EnteredBy ||
                     EnteredBy != null &&
                     EnteredBy.Equals(other.EnteredBy)
                 ));
        }