示例#1
0
        public HealthRecords GetEvaluationInfo(int feeNo)
        {
            var response = new HealthRecords();
            var hea      = from n in unitOfWork.GetRepository <LTC_REGQUESTION>().dbSet.Where(m => m.FEENO == feeNo && m.ORGID == SecurityHelper.CurrentPrincipal.OrgId && (m.QUESTIONID == (int)QuestionCode.ADL || m.QUESTIONID == (int)QuestionCode.MMSE || m.QUESTIONID == (int)QuestionCode.IADL || m.QUESTIONID == (int)QuestionCode.SORE || m.QUESTIONID == (int)QuestionCode.FALL))
                           join e in unitOfWork.GetRepository <LTC_EMPFILE>().dbSet on n.EVALUATEBY equals e.EMPNO into res
                           join q in unitOfWork.GetRepository <LTC_QUESTION>().dbSet.Where(m => m.ORGID == SecurityHelper.CurrentPrincipal.OrgId) on n.QUESTIONID equals q.QUESTIONID into ques
                           from re in res.DefaultIfEmpty()
                           from question in ques.DefaultIfEmpty()
                           orderby n.EVALDATE descending
                           select new
            {
                OutValue = n,
                EmpName  = re.EMPNAME,
                QuesName = question.QUESTIONNAME
            };

            response.TotalRecordsNum = hea.Count();
            if (response.TotalRecordsNum != 0)
            {
                response.GeneralDescriptionInfo = hea.FirstOrDefault().QuesName + "评估结果:" + hea.FirstOrDefault().OutValue.ENVRESULTS;

                response.ADLEvaluation  = GetEvaluation((int)QuestionCode.ADL, feeNo);
                response.MMSEEvaluation = GetEvaluation((int)QuestionCode.MMSE, feeNo);
                response.IADLEvaluation = GetEvaluation((int)QuestionCode.IADL, feeNo);
                response.SoreEvaluation = GetEvaluation((int)QuestionCode.SORE, feeNo);
                response.FallEvaluation = GetEvaluation((int)QuestionCode.FALL, feeNo);
            }
            else
            {
                response.GeneralDescriptionInfo = "无评估记录数据";
            }
            return(response);
        }
示例#2
0
        /// <summary>
        /// Делает запись текущей выделенной.
        /// </summary>
        /// <param name="healthRecord"></param>
        /// <param name="addToSelected">Не снимать выделение с других выделенных.</param>
        internal void SelectHealthRecord(HealthRecord healthRecord, bool addToSelected = false)
        {
            var toSelect = HealthRecords.FirstOrDefault(vm => vm.healthRecord == healthRecord);

            if (!addToSelected) // смена выделенного
            {
                using (doNotNotifyLastSelectedChanged.Enter())
                {
                    hrManager.UnselectExcept(toSelect);
                }
                SelectedHealthRecord = toSelect;
            }
            else if (toSelect != null) // добавление к выделенным, выделяем последнюю
            {
                using (unselectPrev.Enter())
                {
                    using (doNotNotifySelectedChanged.Enter()) // без этого addToSelected: false - выделяется одна, после выхода из редактора снова можно вернуть веделение с шифтом
                    {
                        SelectedHealthRecord = toSelect;
                    }
                }
            }
            else
            {
                // записи нет в списке, не меняем SelectedHealthRecord
            }
        }
示例#3
0
        public IHttpActionResult Get(int feeNo, int type)
        {
            var response = new HealthRecords();

            if (type == 1)
            {
                response = service.GetMeasurementInfo(feeNo);
            }
            if (type == 2)
            {
                response = service.GetMedicationInfo(feeNo);
            }
            if (type == 3)
            {
                response = service.GetBiochemistryInfo(feeNo);
            }
            if (type == 4)
            {
                response = service.GetEvaluationInfo(feeNo);
            }
            if (type == 5)
            {
                response = service.GetDrugInfo(feeNo);
            }
            return(Ok(response));
        }
示例#4
0
        private IEnumerable <ShortHealthRecordViewModel> Paste(HrData hrData, int insertViewIndex)
        {
            var pasted    = new List <HealthRecord>();
            var pastedVms = new List <ShortHealthRecordViewModel>();

            foreach (var hrInfo in hrData.Hrs)
            {
                if (hrInfo == null)
                {
                    continue;
                }

                var newHr = holder.AddHealthRecord(AuthorityController.CurrentDoctor);
                // vm уже добавлена
                var newVm = HealthRecords.FirstOrDefault(vm => vm.healthRecord == newHr);
                Debug.Assert(newVm != null);

                FillHr(newHr, hrInfo);

                pastedVms.Add(newVm);
                pasted.Add(newHr);
            }

            hrManager.Reorder(pastedVms, view.Cast <ShortHealthRecordViewModel>().ToList(), insertViewIndex);
            return(pastedVms);
        }
示例#5
0
        public HealthRecords GetBiochemistryInfo(int feeNo)
        {
            var response = new HealthRecords();
            var month    = DateTime.Now.Month;
            var year     = DateTime.Now.Year;
            List <LTC_CHECKREC> regQuestion = unitOfWork.GetRepository <LTC_CHECKREC>().dbSet.Where(m => m.FEENO == feeNo && ((DateTime)m.CHECKDATE).Year == year && ((DateTime)m.CHECKDATE).Month == month).OrderByDescending(m => m.CHECKDATE).ToList();

            response.TotalRecordsNum = regQuestion.Count;
            if (response.TotalRecordsNum != 0)
            {
                if (string.IsNullOrEmpty(regQuestion[0].DISEASEDESC))
                {
                    response.GeneralDescriptionInfo = "病况:无";
                }
                else
                {
                    response.GeneralDescriptionInfo = "病况:" + regQuestion[0].DISEASEDESC;
                }
            }
            else
            {
                response.GeneralDescriptionInfo = "无体检记录";
            }

            return(response);
        }
示例#6
0
        public HealthRecords GetMeasurementInfo(int feeNo)
        {
            var response = new HealthRecords();

            response.MeasurementList = new List <Measurement>();
            var month = DateTime.Now.Month;
            var year  = DateTime.Now.Year;

            response.TotalRecordsNum = (from o in unitOfWork.GetRepository <LTC_MEASUREDRECORD>().dbSet
                                        where o.MEASURETIME.HasValue &&
                                        ((DateTime)o.MEASURETIME).Year == year && ((DateTime)o.MEASURETIME).Month == month && o.FEENO == feeNo
                                        select 0).Count();
            if (response.TotalRecordsNum > 0)
            {
                response.MeasurementList.Add(GetMeasurement("001", "体温", feeNo));
                response.MeasurementList.Add(GetMeasurement("002", "脉搏", feeNo));
                response.MeasurementList.Add(GetMeasurement("003", "呼吸", feeNo));
                response.MeasurementList.Add(GetMeasurement("004", "收缩压", feeNo));
                response.MeasurementList.Add(GetMeasurement("005", "舒张压", feeNo));
            }

            var weight = GetWeight("体重", feeNo);

            if (weight.ID != 0)
            {
                response.TotalRecordsNum += weight.TotalRecordNum;
                response.MeasurementList.Add(weight);
            }
            else
            {
                response.MeasurementList.Add(null);
            }

            response.MeasurementList.Add(GetBloodSugar("血糖", feeNo));

            if (response.MeasurementList != null && response.MeasurementList.Count > 0)
            {
                foreach (var item in response.MeasurementList)
                {
                    if (item != null)
                    {
                        if (item.Description != "正常")
                        {
                            response.GeneralDescriptionInfo = item.RecordName + item.Description;
                        }
                    }
                }
                if (string.IsNullOrEmpty(response.GeneralDescriptionInfo))
                {
                    response.GeneralDescriptionInfo = "各项量测数据均正常";
                }
            }
            else
            {
                response.GeneralDescriptionInfo = "未查询到有效数据";
            }

            return(response);
        }
示例#7
0
文件: Word.cs 项目: sm-g/diagnosis
 /// <summary>
 /// Вызвать перед удалением слова.
 /// </summary>
 public virtual void OnDelete()
 {
     Vocabularies.ForEach(x => x.RemoveWord(this));
     HealthRecords
     .Select(x => x.Doctor)
     .Distinct()
     .ForEach(x => x.RemoveWordFromCache(this));
 }
示例#8
0
 private void Holder_HealthRecordsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
     {
         var hr = e.OldItems[0] as HealthRecord;
         HealthRecords.Remove(hr);
         FoundHealthRecords.Remove(hr);
     }
 }
示例#9
0
        /// <summary>
        /// Устанавливает выделение на записях, последняя — текущая выделенная.
        /// </summary>
        /// <param name="hrs"></param>
        internal void SelectHealthRecords(IEnumerable <HealthRecord> hrs)
        {
            var toSelect = HealthRecords.Where(vm => hrs.Contains(vm.healthRecord)).ToList();

            hrManager.UnselectExcept(toSelect);
            toSelect.ForAll(vm => vm.IsSelected = true);

            SelectHealthRecord(hrs.LastOrDefault(), true);
        }
示例#10
0
        public async Task <HealthRecord> GetHealthAsync(string key)
        {
            HealthRecord value;

            if (!HealthRecords.TryGetValue(key, out value))
            {
                return(null);
            }
            return(value);
        }
示例#11
0
        internal void SaveHrs()
        {
            Contract.Assume(HealthRecords.IsStrongOrdered(x => x.Ord));

            var hrs = HealthRecords
                      .Select(vm => vm.healthRecord)
                      .ToArray();

            session.DoSave(hrs);

            OnHrsSaved();
        }
示例#12
0
        public HrListViewModel(IHrsHolder holder, ISession session, HrViewColumn sorting = HrViewColumn.Ord, HrViewColumn grouping = HrViewColumn.Category)
        {
            Contract.Requires(holder != null);
            Contract.Requires(session != null);
            this.session = session;
            this.holder  = holder;

            HolderVm = new HolderViewModel(holder);

            doNotNotifyLastSelectedChanged = new FlagActionWrapper(() =>
            {
                OnPropertyChanged(() => LastSelected);
                logger.DebugFormat("(bulk) selected in order\n{0}", string.Join("\n", selectedOrder));
            });

            preserveSelected = new FlagActionWrapper <IList <ShortHealthRecordViewModel> >((hrs) =>
            {
                hrs.ForEach(vm => vm.IsSelected = true);
                // fix new selected item appears in listbox after movement hrs from diff categories in grouped by category
                // TODO fix when diff createdAt
                HealthRecords.Except(hrs).ForEach(x => x.IsSelected = false);
            });

            handler = this.Subscribe(Event.NewSession, (e) =>
            {
                var s = e.GetValue <ISession>(MessageKeys.Session);
                ReplaceSession(s);
            });

            hrManager = new HealthRecordManager(holder, OnHrVmPropChanged);
            hrManager.DeletedHealthRecords.CollectionChangedWrapper += DeletedHrsCollectionChanged;
            hrManager.HealthRecords.CollectionChangedWrapper        += HrsCollectionChanged;

            view = (ListCollectionView)CollectionViewSource.GetDefaultView(HealthRecords);

            DropHandler = new DropTargetHandler(this);
            DragHandler = new DragSourceHandler();

            IsDragSourceEnabled = true;
            IsDropTargetEnabled = true;
            IsRectSelectEnabled = true;

            Grouping = grouping;
            Sorting  = sorting;
            SetHrExtra(HealthRecords);
        }
示例#13
0
        public HealthRecords GetDrugInfo(int feeNo)
        {
            var response = new HealthRecords();
            var month    = DateTime.Now.Month;
            var year     = DateTime.Now.Year;
            var list     = unitOfWork.GetRepository <LTC_DRUGRECORD>().dbSet.Where(w => w.STATUS != 8 && w.NSID == SecurityHelper.CurrentPrincipal.OrgId && w.FEENO == feeNo && w.TAKETIME.Year == year && w.TAKETIME.Month == month && w.ISDELETE != true).ToList();

            list = list.OrderByDescending(m => m.TAKETIME).ToList();
            response.TotalRecordsNum = list.Count();
            if (list != null && list.Count > 0)
            {
                response.GeneralDescriptionInfo = "服用" + list.FirstOrDefault().CNNAME;
            }
            else
            {
                response.GeneralDescriptionInfo = "无用药记录";
            }
            return(response);
        }
示例#14
0
        private void hr_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var hr = sender as HealthRecord;

            if (e.PropertyName == "IsDeleted")
            {
                if (hr.IsDeleted)
                {
                    var vm = HealthRecords.Where(x => x.healthRecord == hr).First();
                    deletedHealthRecords.Add(vm);
                    healthRecords.Remove(vm);
                    var undoDoActions = new Action[] {
                        () => hr.IsDeleted = false,
                        () => {
                            holder.RemoveHealthRecord(hr);
                            deletedHealthRecords.Remove(vm);
                        }
                    };
                    this.Send(Event.ShowUndoOverlay, new object[] { undoDoActions, typeof(HealthRecord) }.AsParams(MessageKeys.UndoDoActions, MessageKeys.Type));
                }
                else
                {
                    var vm = DeletedHealthRecords.Where(x => x.healthRecord == hr).FirstOrDefault();
                    if (vm != null)
                    {
                        deletedHealthRecords.Remove(vm);

                        // после первого видимого выше в списке
                        var notDelAt = inner.IndexOf(vm) - 1;
                        while (notDelAt >= 0 && inner[notDelAt].IsDeleted)
                        {
                            notDelAt--;
                        }
                        var dest = notDelAt < 0 ? 0 : healthRecords.IndexOf(inner[notDelAt]) + 1;
                        healthRecords.Insert(dest, vm);
                    }
                }
            }
        }
示例#15
0
文件: Patient.cs 项目: sm-g/diagnosis
 public virtual bool IsEmpty()
 {
     return(!Courses.Any() &&
            HealthRecords.All(h => h.IsEmpty()));
 }
示例#16
0
 public List <HealthRecord> GetSelectedHrs()
 {
     return(HealthRecords.Where(hr => hr.IsChecked)
            .Select(vm => vm.healthRecord).ToList());
 }
示例#17
0
文件: Word.cs 项目: sm-g/diagnosis
        // for refresh state of many-2-many relations

        public virtual bool IsEmpty()
        {
            return(!HealthRecords.Any() &&
                   !Crits.Any());
        }
示例#18
0
        public HealthRecords GetMedicationInfo(int feeNo)
        {
            var response = new HealthRecords();
            var month    = DateTime.Now.Month;
            var year     = DateTime.Now.Year;

            var q = from it in unitOfWork.GetRepository <LTC_VISITPRESCRIPTION>().dbSet
                    join n in unitOfWork.GetRepository <LTC_VISITDOCRECORDS>().dbSet on it.SEQNO equals n.SEQNO into nns
                    from nn in nns.DefaultIfEmpty()
                    join m in unitOfWork.GetRepository <LTC_MEDICINE>().dbSet on it.MEDID equals m.MEDID into mms
                    from mm in mms.DefaultIfEmpty()
                    join e2 in unitOfWork.GetRepository <LTC_VISITHOSPITAL>().dbSet on nn.VISITHOSP equals e2.HOSPNO into vr_e2
                    from vr_emp2 in vr_e2.DefaultIfEmpty()
                    join e3 in unitOfWork.GetRepository <LTC_VISITDEPT>().dbSet on nn.VISITDEPT equals e3.DEPTNO into vr_e3
                    from vr_emp3 in vr_e3.DefaultIfEmpty()
                    join e4 in unitOfWork.GetRepository <LTC_VISITDOCTOR>().dbSet on nn.VISITDOCTOR equals e4.DEPTNO into vr_e4
                    from vr_emp4 in vr_e4.DefaultIfEmpty()
                    select new VisitPrescription
            {
                PId             = it.PID,
                SeqNo           = it.SEQNO,
                MedId           = it.MEDID,
                TakeQty         = it.TAKEQTY,
                Qty             = it.QTY,
                Freq            = it.FREQ,
                Freqday         = it.FREQDAY,
                Freqqty         = it.FREQQTY,
                TakeWay         = it.TAKEWAY,
                Freqtime        = it.FREQTIME,
                LongFlag        = it.LONGFLAG,
                UseFlag         = it.USEFLAG,
                StartDate       = it.STARTDATE,
                EndDate         = it.ENDDATE,
                Description     = it.DESCRIPTION,
                OrgId           = it.ORGID,
                EngName         = mm.ENGNAME,
                CnName          = it.CNNAME,
                MedKind         = mm.MEDKIND,
                FeeNo           = nn.FEENO,
                TakeTime        = it.TAKETIME,
                VisitDoctorName = vr_emp4.DOCNAME,
                VisitHospName   = vr_emp2.HOSPNAME,
                VisitDeptName   = vr_emp3.DEPTNAME,
                VisitType       = nn.VISITTYPE,
                TakeDays        = nn.TAKEDAYS
            };

            q = q.Where(m => ((DateTime)m.StartDate).Year == year && ((DateTime)m.StartDate).Month == month && ((DateTime)m.EndDate).Year == year && ((DateTime)m.EndDate).Month == month && m.FeeNo == feeNo && m.UseFlag != false);
            q = q.OrderByDescending(m => m.TakeTime);
            response.TotalRecordsNum = q.Count();
            if (response.TotalRecordsNum != 0)
            {
                response.GeneralDescriptionInfo = q.FirstOrDefault().CnName;
                var medRecord = string.Empty;
                if (q.FirstOrDefault().Freqday.HasValue&& q.FirstOrDefault().Freqqty.HasValue)
                {
                    if (q.FirstOrDefault().Freqday == 0)
                    {
                        response.GeneralDescriptionInfo += ",1天/";
                    }
                    else
                    {
                        response.GeneralDescriptionInfo += "," + q.FirstOrDefault().Freqday + "天/";
                    }
                    if (q.FirstOrDefault().Freqqty == 0)
                    {
                        response.GeneralDescriptionInfo += "1次";
                    }
                    else
                    {
                        response.GeneralDescriptionInfo += q.FirstOrDefault().Freqqty + "次";
                    }
                }
            }
            else
            {
                response.GeneralDescriptionInfo = "无用药记录";
            }
            return(response);
        }