Esempio n. 1
0
        public static GeneralNutr SavePatientMedicationInfo(string hxMedication, string hxCategories, Guid _pkey)
        {
            GuruETCEntities       _etc     = new GuruETCEntities();
            long?                 ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault();
            long?                 DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault();
            GeneralNutr           _gNutri  = new GeneralNutr();
            PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault();

            if (_Presult != null)
            {
                string[] medAlegy      = hxMedication.Split('|');
                string[] catMedAlegy   = hxCategories.Split('|');
                string   AllMedication = string.Empty;
                string   AllAllergy    = string.Empty;
                int      index         = 0;
                foreach (var item in catMedAlegy)
                {
                    if (item == "Medications")
                    {
                        AllMedication += medAlegy[index] + "|";
                    }
                    else
                    {
                        AllAllergy += medAlegy[index] + "|";
                    }

                    index++;
                }

                if (AllMedication.Length > 1)
                {
                    AllMedication = AllMedication.Substring(0, AllMedication.Length - 1);
                }

                if (AllAllergy.Length > 1)
                {
                    AllAllergy = AllAllergy.Substring(0, AllAllergy.Length - 1);
                }

                _Presult.hx_medications = AllMedication;
                _Presult.hx_allergies   = AllAllergy;
                _etc.SaveChanges();
                string Result = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", _Presult.Weight, _Presult.Height, _Presult.feet, _Presult.Packs, _Presult.Cans, _Presult.FormerSmoker, _Presult.FormerChewer, _Presult.dietrating);
                _gNutri.GHealth = _Presult.hx_general;
                _gNutri.Nutri   = _Presult.hx_nutrition_activity;
                _gNutri.Tbc     = _Presult.hx_tobacco_alcohol;
                _gNutri.Vital   = _Presult.hx_vitals_labs;
                _gNutri.Extra   = Result;
            }
            return(_gNutri);
        }
Esempio n. 2
0
        public static GeneralNutr SavePatientMedicationInfo(string hxMedication, string hxCategories, Guid _pkey)
        {
            GuruETCEntities _etc = new GuruETCEntities();
            long? ParentId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.Id).FirstOrDefault();
            long? DoctorId = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).Select(d => d.DoctorId).FirstOrDefault();
            GeneralNutr _gNutri = new GeneralNutr();
            PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault();
            if (_Presult != null)
            {
                string[] medAlegy = hxMedication.Split('|');
                string[] catMedAlegy = hxCategories.Split('|');
                string AllMedication = string.Empty;
                string AllAllergy = string.Empty;
                int index = 0;
                foreach (var item in catMedAlegy)
                {
                    if (item == "Medications")
                        AllMedication += medAlegy[index] + "|";
                    else
                        AllAllergy += medAlegy[index] + "|";

                    index++;

                }

                if (AllMedication.Length > 1)
                    AllMedication = AllMedication.Substring(0, AllMedication.Length - 1);

                if (AllAllergy.Length > 1)
                    AllAllergy = AllAllergy.Substring(0, AllAllergy.Length - 1);

                _Presult.hx_medications = AllMedication;
                _Presult.hx_allergies = AllAllergy;
                _etc.SaveChanges();
                string Result = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", _Presult.Weight, _Presult.Height, _Presult.feet, _Presult.Packs, _Presult.Cans, _Presult.FormerSmoker, _Presult.FormerChewer, _Presult.dietrating);
                _gNutri.GHealth = _Presult.hx_general;
                _gNutri.Nutri = _Presult.hx_nutrition_activity;
                _gNutri.Tbc = _Presult.hx_tobacco_alcohol;
                _gNutri.Vital = _Presult.hx_vitals_labs;
                _gNutri.Extra = Result;

            }
            return _gNutri;
        }