コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the PatientExams EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPatientExams(PatientExam patientExam)
 {
     base.AddObject("PatientExams", patientExam);
 }
コード例 #2
0
ファイル: QuestionManage.cs プロジェクト: rexjohnson/GuruPre
        public static string SavePatienthx_Detail(string hxConcerns, string duplicateDental, string duplicateENT, string duplicateSleep, 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();
            long? ExamId = _etc.PatientExams.Where(d => d.DoctorId == DoctorId && d.PatientId == ParentId).OrderByDescending(d => d.ExamId).Select(d => d.ExamId).FirstOrDefault();
            if (ExamId == 0)
            {
                PatientExam _newexam = new PatientExam();
                _newexam.PatientId = ParentId;
                _newexam.DoctorId = DoctorId;
                _newexam.Date = DateTime.Now;
                _etc.AddToPatientExams(_newexam);
                _etc.SaveChanges();
                ExamId = _newexam.ExamId;
            }
            PatientResultQuestion _Presult = _etc.PatientResultQuestions.Where(p => p.DoctorId == DoctorId && p.PatientId == ParentId).FirstOrDefault();
            if (_Presult != null)
            {
                //Duplicate Dental items

                string dentalCheckedItems = string.Empty;
                string[] findingitems = duplicateDental.Split('|');
                string[] MatchArray = { "16", "12", "17", "19", "5" };
                foreach (var finding in findingitems)
                {

                    if (finding == "15") { dentalCheckedItems += "16|"; }
                    if (finding == "16") { dentalCheckedItems += "12|"; }
                    if (finding == "36") { dentalCheckedItems += "17|"; }
                    if (finding == "18") { dentalCheckedItems += "19|"; }
                    if (finding == "19") { dentalCheckedItems += "19|"; }
                    if (finding == "20") { dentalCheckedItems += "5|"; }
                }
                IEnumerable<string> intersectDental;
                string[] alreadyitems = (!string.IsNullOrEmpty(_Presult.hx_dental)) ? _Presult.hx_dental.Split('|') : null;
                if (alreadyitems != null)
                {
                  //  string[] arry1 = alreadyitems.Except(MatchArray).ToArray();
                  //  string[] arry2 = MatchArray.Except(alreadyitems).ToArray();

                    //Removes duplicate values
                    intersectDental = alreadyitems.Concat(MatchArray);
                }
                else
                    intersectDental = MatchArray;

                dentalCheckedItems = string.Join("|", intersectDental);

                //Duplicate ENT items

                string entCheckedItems = string.Empty;
                string[] entfindingitems = duplicateENT.Split('|');
                string[] entMatchArray = { "2", "4", "1", "5", "8" };
                foreach (var finding in entfindingitems)
                {

                    if (finding == "27") { entCheckedItems += "2|"; }
                    if (finding == "28") { entCheckedItems += "4|"; }
                    if (finding == "29") { entCheckedItems += "1|"; }
                    if (finding == "30") { entCheckedItems += "5|"; }
                    if (finding == "45") { entCheckedItems += "8|"; }

                }

                IEnumerable<string> intersectENT;
                string[] entitems = (!string.IsNullOrEmpty(_Presult.hx_medical_ent)) ? _Presult.hx_medical_ent.Split('|') : null;
                if (entitems != null)
                {
                   // string[] arry1 = entitems.Except(entMatchArray).ToArray();
                   // string[] arry2 = entMatchArray.Except(entitems).ToArray();

                    //Removes duplicate values
                    intersectENT = entitems.Union(entMatchArray);
                }
                else
                    intersectENT = entMatchArray;

                entCheckedItems = string.Join("|", intersectENT);

                //Duplicate Sleep items

                string SleepCheckedItems = string.Empty;
                string[] Sleepfindingitems = duplicateSleep.Split('|');
                string[] SleepMatchArray = { "4", "4.1", "1", "2" };
                foreach (var finding in Sleepfindingitems)
                {

                    if (finding == "44") { SleepCheckedItems += "4|4.1|"; }
                    if (finding == "45") { SleepCheckedItems += "1|"; }
                    if (finding == "46") { SleepCheckedItems += "2|"; }

                }

                IEnumerable<string> intersectSleep;
                string[] sleepitems = (!string.IsNullOrEmpty(_Presult.hx_medical_sleep)) ? _Presult.hx_medical_sleep.Split('|') : null;
                if (sleepitems != null)
                {
                  //  string[] arry1 = sleepitems.Except(SleepMatchArray).ToArray();
                  //  string[] arry2 = SleepMatchArray.Except(sleepitems).ToArray();

                    //Removes duplicate values
                    intersectSleep = sleepitems.Concat(SleepMatchArray);
                }

                else
                    intersectSleep = SleepMatchArray;

                SleepCheckedItems = string.Join("|", intersectSleep);

                _Presult.hx_medical_sleep = SleepCheckedItems;
                _Presult.hx_medical_ent = entCheckedItems;
                _Presult.hx_dental = dentalCheckedItems;
                _Presult.patient_concerns = hxConcerns;
                _etc.SaveChanges();
                if (!string.IsNullOrEmpty(_Presult.hx_medications) && !string.IsNullOrEmpty(_Presult.hx_allergies))
                    return _Presult.hx_medications + "|" + _Presult.hx_allergies;
                else if (!string.IsNullOrEmpty(_Presult.hx_medications) && string.IsNullOrEmpty(_Presult.hx_allergies))
                    return _Presult.hx_medications;
                else
                    return _Presult.hx_allergies;

            }
            else
            {
                PatientResultQuestion _addPResult = new PatientResultQuestion();
                _addPResult.PatientId = ParentId;
                _addPResult.DoctorId = DoctorId;
                _addPResult.ExamId = ExamId;                 //Change it dynamically for testing its taking 1
                _addPResult.patient_concerns = hxConcerns;
                _addPResult.hx_dental = duplicateDental;
                _addPResult.hx_medical_ent = duplicateENT;
                _addPResult.hx_medical_sleep = duplicateSleep;
                _etc.AddToPatientResultQuestions(_addPResult);
                _etc.SaveChanges();
                return string.Empty;
            }
        }
コード例 #3
0
 /// <summary>
 /// Create a new PatientExam object.
 /// </summary>
 /// <param name="examId">Initial value of the ExamId property.</param>
 public static PatientExam CreatePatientExam(global::System.Int64 examId)
 {
     PatientExam patientExam = new PatientExam();
     patientExam.ExamId = examId;
     return patientExam;
 }