Example #1
0
        /// <summary>
        /// DB格納用リストを生成
        /// </summary>
        /// <param name="healthDataList"></param>
        /// <returns></returns>
        public List <HealthRecord> ShapeHealthRecord(string height, List <HealthData> healthDataList)
        {
            var healthRecordList = new List <HealthRecord>();

            foreach (var health in healthDataList)
            {
                //測定日時(UTC)
                var assayDate = health.DateTime.TryJstDateTimeStringParseToUtc();

                var record = new HealthRecord
                {
                    Id                = health.DateTime,
                    AssayDate         = assayDate,
                    BasalMetabolism   = health.BasalMetabolism.ToDoubleOrNull(),
                    BodyAge           = health.BodyAge,
                    BodyFatPerf       = health.BodyFatPerf.ToDoubleOrNull(),
                    BoneQuantity      = health.BoneQuantity.ToDoubleOrNull(),
                    MuscleMass        = health.MuscleMass.ToDoubleOrNull(),
                    MuscleScore       = health.MuscleScore,
                    VisceralFatLevel  = health.VisceralFatLevel.ToLongOrNull(),
                    VisceralFatLevel2 = health.VisceralFatLevel2.ToDoubleOrNull(),
                    Height            = height.ToDoubleOrNull(),
                    Weight            = health.Weight.ToDoubleOrNull(),
                    Type              = "HealthData"
                };

                healthRecordList.Add(record);
            }

            return(healthRecordList);
        }
Example #2
0
 public void Init()
 {
     EventDateViewModel.ClearDict();
     h      = session.Load <HealthRecord>(IntToGuid <HealthRecord>(1));
     emptyH = session.Load <HealthRecord>(IntToGuid <HealthRecord>(71));
     vm     = EventDateViewModel.FromHr(h);
 }
        public JsonResult getHealthRecordById(int id)
        {
            HealthRecord item = HealthRecordDTO.Instant.GetHealthRecordById(id);

            if (item == null)
            {
                return(Json(item, JsonRequestBehavior.AllowGet));
            }
            else
            {
                HealthRecordTemp tmp = new HealthRecordTemp();
                tmp.IdHealthRecord    = item.IdHealthRecord;
                tmp.CreateAt          = item.CreateAt;
                tmp.CreateByUser      = item.CreateByUser;
                tmp.CreateByUser_Name = AccountDTO.Instant.GetAccountNameById(tmp.CreateByUser);
                tmp.ExaminationFee    = item.ExaminationFee;
                tmp.IsReExamination   = item.IsReExamination;
                tmp.UpdateByUser      = item.UpdateByUser;
                tmp.UpdateByUser_Name = AccountDTO.Instant.GetAccountNameById(tmp.UpdateByUser);
                tmp.IdPatient         = item.IdPatient;
                tmp.Patient_Name      = PatientDTO.Instant.GetPatientNameById(tmp.IdPatient);
                tmp.Symptom           = item.Symptom;
                tmp.Diagnosis         = item.Diagnosis;
                tmp.IndexOfDay        = item.IndexOfDay;
                tmp.missCall          = item.missCall;
                tmp.Status            = item.Status;
                tmp.ReExaminationAt   = ReExaminationDTO.Instant.GetReExaminationAtByIdHealthRecord(tmp.IdHealthRecord);
                return(Json(tmp, JsonRequestBehavior.AllowGet));
            }
        }
Example #4
0
 public void HrEditorTestInit()
 {
     e     = new HrEditorViewModel(session);
     hr    = session.Get <HealthRecord>(IntToGuid <HealthRecord>(1));
     hr2   = session.Get <HealthRecord>(IntToGuid <HealthRecord>(2));
     word3 = session.Get <Word>(IntToGuid <Word>(3));
 }
Example #5
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
            }
        }
Example #6
0
        private void FillHr(HealthRecord hr, DataTransfer.HrData.HrInfo hrInfo)
        {
            hrInfo.Chios.SyncAfterPaste(session);

            if (hrInfo.CategoryId != null)
            {
                using (var tr = session.BeginTransaction())
                {
                    hr.Category = session.Get <HrCategory>(hrInfo.CategoryId.Value);
                }
            }
            hr.FromDate.FillDateAndNowFrom(hrInfo.From);
            hr.ToDate.FillDateAndNowFrom(hrInfo.To);

            var unit = hrInfo.Unit;

            // если вставляем к пациенту без возраста
            if (hr.GetPatient().BirthYear == null && hrInfo.Unit == HealthRecordUnit.ByAge)
            {
                unit = HealthRecordUnit.NotSet;
            }

            hr.Unit = unit;
            hr.SetItems(hrInfo.Chios);
        }
Example #7
0
        public HealthRecordViewModel(HealthRecord hr)
        {
            Contract.Requires(hr != null);
            this.healthRecord = hr;

            DateEditor = new DateEditorViewModel(hr);
        }
Example #8
0
        private void OpenHr(HealthRecord hr)
        {
            Contract.Ensures(HrList.holder == hr.Holder.Actual);

            OpenHolder(hr.Holder, false);
            HrList.SelectHealthRecord(hr);
        }
Example #9
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            var selectedRows = (sender as DataGridView)?.SelectedRows;

            selectedHealthRecord = new HealthRecord();

            var patientService = new PatientService();
            var doctorService  = new DoctorService();

            if (selectedRows != null && selectedRows.Count > 0)
            {
                var selected = selectedRows[0];

                selectedHealthRecord.Id = selected.Cells["RecordId"].Value.ToString();
                selectedHealthRecord.CountDayWithoutWork = Convert.ToInt32(selected.Cells["CWithoutWork"].Value);
                selectedHealthRecord.Notes             = selected.Cells["CNotes"].Value.ToString();
                selectedHealthRecord.IsAmbulance       = Convert.ToBoolean(selected.Cells["CAmbulance"].Value);
                selectedHealthRecord.IsCanContinueWork = Convert.ToBoolean(selected.Cells["CCanWork"].Value);
                selectedHealthRecord.Diagnosis         = selected.Cells["CDiagnose"].Value.ToString();
                selectedHealthRecord.IsDispencary      = Convert.ToBoolean(selected.Cells["CDispancer"].Value);
                selectedHealthRecord.Patient           =
                    patientService.GetByFullNameAndId(selected.Cells["CPFullName"].Value.ToString());

                selectedHealthRecord.Doctor =
                    doctorService.GetByFullNameAndId(selected.Cells["CDFullName"].Value.ToString());
            }
        }
Example #10
0
        public async Task <IActionResult> Edit(int id, [Bind("HealthRecordID,Title,RecordData,MimeType")] HealthRecord healthRecord)
        {
            if (id != healthRecord.HealthRecordID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(healthRecord);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HealthRecordExists(healthRecord.HealthRecordID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(healthRecord));
        }
Example #11
0
        public void SaveHealthRecord(HealthRecord hr)
        {
            if (hr.GetPatient() == savingPatient)
            {
                return;
            }

            logger.DebugFormat("saving hr {0}", hr);
            Debug.Assert(session.IsOpen);

            session.SaveOrUpdate(hr);
            using (var t = session.BeginTransaction())
            {
                try
                {
                    t.Commit();
                }
                catch (System.Exception e)
                {
                    t.Rollback();
                    logger.Error(e);
#if DEBUG
                    throw;
#endif
                }
            }
        }
Example #12
0
        private void FinishCurrentHr()
        {
            Contract.Requires(HealthRecord == null || !HealthRecord.healthRecord.IsTransient);

            if (HealthRecord != null)
            {
                // завершаем теги
                Autocomplete.CompleteTypings();

                var hr = HealthRecord.healthRecord;
                HealthRecord.Dispose();

                hr.PropertyChanged -= hr_PropertyChanged;
                (hr as IEditableObject).EndEdit();

                var addQuery = Autocomplete.AddQueryToSuggestions;

                Autocomplete.Dispose();
                _autocomplete = null;

                // сохраняем запись
                OnUnloaded(hr);

                // сохраняем настройки редактора
                AuthorityController.CurrentDoctor.Settings.AddQueryToSuggestions = addQuery;
                session.DoSave(AuthorityController.CurrentDoctor);
            }
        }
        public string Schedule => "*/1 * * * *";  // every 1 minute

        public async Task Invoke(CancellationToken cancellationToken)
        {
            var key           = "identityserver-discovery";
            var currentHealth = await HealthCheckStore.GetHealthAsync(key);

            if (currentHealth == null)
            {
                currentHealth = new HealthRecord()
                {
                    Healty = false,
                    State  = null
                };
                await HealthCheckStore.SetHealthAsync(key, currentHealth);
            }
            var url    = Optons.Value.Discovery;
            var loaded = await RemoteIdentityServerDiscoveryStore.LoadRemoteDataAsync(url);

            if (loaded && !currentHealth.Healty)
            {
                // once loaded we are good
                currentHealth = new HealthRecord()
                {
                    Healty = true,
                    State  = null
                };
                await HealthCheckStore.SetHealthAsync(key, currentHealth);
            }
        }
Example #14
0
        public ActionResult DeleteConfirmed(int id)
        {
            HealthRecord healthRecord = db.HealthRecords.Find(id);

            db.HealthRecords.Remove(healthRecord);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #15
0
 public void AutocompleteTestInit()
 {
     Load <Uom>();
     hr1 = session.Load <HealthRecord>(IntToGuid <HealthRecord>(71));
     w1  = session.Get <Word>(IntToGuid <Word>(1));
     w2  = session.Get <Word>(IntToGuid <Word>(2));
     w3  = session.Get <Word>(IntToGuid <Word>(3));
 }
Example #16
0
        /// <summary>
        /// BMI値算出
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        private static double CalcBmi(HealthRecord record)
        {
            var cm = (double)record.Height / 100;

            var bmi = Math.Round(((double)record.Weight / Math.Pow(cm, 2)), 2);

            return(bmi);
        }
Example #17
0
        private ShortHealthRecordViewModel CreateViewModel(HealthRecord hr)
        {
            hr.PropertyChanged += hr_PropertyChanged;
            var vm = new ShortHealthRecordViewModel(hr);

            vm.PropertyChanged += onHrVmPropChanged;
            return(vm);
        }
Example #18
0
 static Mocks()
 {
     hr = new HealthRecord(course, doc)
     {
         Category = cats[0],
     };
     hr.FromDate.Month = 5;
     hr.AddItems(new IHrItemObject[] { word, word2, new Comment("без осложнений") });
 }
        public string SetTheOrderById(int id)
        {
            HealthRecord healthRecord = DataProvider.Instant.DB.HealthRecords.Where(x => x.IdHealthRecord == id).SingleOrDefault();

            healthRecord.missCall = !healthRecord.missCall;
            DataProvider.Instant.DB.SaveChanges();

            return("success");
        }
Example #20
0
        protected virtual void OnClosed(HealthRecord hr)
        {
            var h = Closed;

            if (h != null)
            {
                h(this, new HealthRecordEventArgs(hr));
            }
        }
Example #21
0
        private static void OnHrRemoved(HealthRecord item)
        {
            EventDateViewModel res;

            if (dict.TryGetValue(item, out res))
            {
                dict.Remove(item);
                res.Dispose();
            }
        }
Example #22
0
        internal void Select(HealthRecord hr, IHrsHolder holder)
        {
            var @switch = new Dictionary <Type, Action> {
                { typeof(Patient), () => OnHrOpened <Patient>(patMap, holder as Patient, hr) },
                { typeof(Course), () => OnHrOpened <Course>(courseMap, holder as Course, hr) },
                { typeof(Appointment), () => OnHrOpened <Appointment>(appMap, holder as Appointment, hr) }
            };

            @switch[holder.GetType()]();
        }
Example #23
0
        /// <summary>
        /// Открывает запись и редактор для записи и начинает редактирование слов.
        /// </summary>
        public void StartEditHr(HealthRecord hr, bool addToSelected = true)
        {
            Contract.Requires(hr != null);
            Contract.Assume(hr.Holder == HrList.holder);

            //logger.DebugFormat("StartEditHr {0}", hr);
            HrList.SelectHealthRecord(hr, addToSelected);
            HrEditor.Load(hr);
            HrEditor.Autocomplete.StartEdit();
        }
Example #24
0
        private void btnAddRecord_Click(object sender, EventArgs e)
        {
            HealthRecordService service = new HealthRecordService();

            if (!string.IsNullOrEmpty(txtDiagnose.Text) &&
                healthDoctorRecord != null && healthPatientRecord != null)
            {
                HealthRecord record = new HealthRecord()
                {
                    Patient      = healthPatientRecord,
                    Doctor       = healthDoctorRecord,
                    Diagnosis    = txtDiagnose.Text,
                    IsAmbulance  = chAmbulance.CheckState == CheckState.Checked,
                    IsDispencary = chDispancer.CheckState == CheckState.Checked,
                    Notes        = txtNotes.Text,
                    Id           = Guid.NewGuid().ToString()
                };

                if (chCanWork.CheckState == CheckState.Checked)
                {
                    record.IsCanContinueWork = true;
                    if (!string.IsNullOrEmpty(txtDiagnose.Text))
                    {
                        record.CountDayWithoutWork = 0;
                    }
                }
                else
                {
                    record.IsCanContinueWork   = false;
                    record.CountDayWithoutWork = Convert.ToInt32(txtWithoutWork.Text);
                }


                service.AddRecord(record);


                var records = service.GetAll();
                dataGridView1.Rows.Clear();

                if (records != null)
                {
                    foreach (var p in records)
                    {
                        dataGridView1.Rows.Add(p.Patient.GetFullName, p.Doctor.GetFullName, p.Diagnosis, p.IsAmbulance,
                                               p.IsCanContinueWork, p.CountDayWithoutWork,
                                               p.IsDispencary, p.Notes, p.Id);
                    }
                }
            }
            else
            {
                lbError.Text = "Filed can't be empty";
            }
        }
Example #25
0
 public ActionResult Edit([Bind(Include = "HealthRecordId,UserId,Age,Weight,Height,BMR,BMI,KCAL,TargetBMI")] HealthRecord healthRecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(healthRecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId = new SelectList(db.Users, "UserId", "FirstName", healthRecord.UserId);
     return(View(healthRecord));
 }
Example #26
0
        public void UpdateRecord(HealthRecord record, int id)
        {
            var currentRecord = this.GetById(id).FirstOrDefault();

            currentRecord.Coat = record.Coat == null ? currentRecord.Coat : record.Coat;
            currentRecord.FurColor = record.FurColor == null ? currentRecord.FurColor : record.FurColor;
            currentRecord.Height = record.Height == 0 ? currentRecord.Height : record.Height;
            currentRecord.Weight = record.Weight == 0 ? currentRecord.Weight : record.Weight;

            this.records.Update(currentRecord);
            this.records.SaveChanges();
        }
 public JsonResult createHealthRecord(HealthRecord data)
 {
     if (HttpContext.Request.HttpMethod == HttpMethod.Get.Method)
     {
         Response.Redirect("/page_not_found");
         return(Json("Deny Get Request", JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(HealthRecordDTO.Instant.createHealthRecord(data), JsonRequestBehavior.AllowGet));
     }
 }
        public string SetHealthRecord(HealthRecord data)
        {
            HealthRecord item = HealthRecordDTO.Instant.GetHealthRecordById(data.IdHealthRecord);

            item.Symptom      = data.Symptom;
            item.Diagnosis    = data.Diagnosis;
            item.UpdateByUser = data.UpdateByUser;
            item.Status       = false;

            DataProvider.Instant.DB.SaveChanges();

            return("success");
        }
Example #29
0
        public void UseWordRemoveVoc()
        {
            // при удалении остаются использованные слова
            l.LoadOrUpdateVocs(voc[1]);

            var hr = new HealthRecord(a[1], d1);
            var w  = voc[1].Words.First();

            hr.SetItems(new[] { w });
            session.SaveOrUpdate(hr);

            l.DeleteVocs(voc[1]);
            Assert.IsTrue(GetWordTitles().Contains(w.Title));
        }
Example #30
0
        // GET: HealthRecords/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HealthRecord healthRecord = db.HealthRecords.Find(id);

            if (healthRecord == null)
            {
                return(HttpNotFound());
            }
            return(View(healthRecord));
        }
Example #31
0
        // GET: HealthRecords/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HealthRecord healthRecord = db.HealthRecords.Find(id);

            if (healthRecord == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId = new SelectList(db.Users, "UserId", "FirstName", healthRecord.UserId);
            return(View(healthRecord));
        }
Example #32
0
 public void Add(HealthRecord record)
 {
     this.records.Add(record);
     this.records.SaveChanges();
 }