public ActionResult Edit([Bind()] Models.ViewModels.ObserveRoomInfos.Edit.Edit targetV)
        {
            if (ModelState.IsValid)
            {
                var db = new Models.Domains.Entities.EiSDbContext();

                var target = db.ObserveRoomInfos.Find(targetV.ObserveRoomInfoId);
                if (target == null)
                {
                    return(HttpNotFound());
                }

                targetV.GetReturn(target);

                Models.BusinessModels.TrasenInformationConvertor.FromEmployeeNumberToName(target);

                db.SaveChanges();

                return(RedirectToAction("Details", new { id = targetV.ObserveRoomInfoId }));
            }

            var targetW = new Models.ViewModels.ObserveRoomInfos.Edit.SelectionWorker(targetV);

            ViewBag.BedId = targetW.Beds;
            ViewBag.InObserveRoomWayId  = targetW.InObserveRoomWays;
            ViewBag.DestinationId       = targetW.Destinations;
            ViewBag.DestinationFirstId  = targetW.DestinationFirsts;
            ViewBag.DestinationSecondId = targetW.DestinationSeconds;
            ViewBag.TransferReasonId    = targetW.TransferReasons;

            return(View(targetV));
        }
コード例 #2
0
        public ActionResult Edit([Bind()] Models.ViewModels.RescueRoomConsultations.Edit.Edit targetV)
        {
            if (ModelState.IsValid)
            {
                var db     = new Models.Domains.Entities.EiSDbContext();
                var target = db.RescueRoomConsultations.Find(targetV.RescueRoomConsultationId);

                targetV.GetReturn(target);

                Models.BusinessModels.TrasenInformationConvertor.FromEmployeeNumberToName(target);

                db.SaveChanges();

                //处理返回页面
                if (targetV.GoToGreenPath)
                {
                    var rescueRoomInfo = db.RescueRoomInfos.Find(targetV.RescueRoomInfoId);

                    return(RedirectToAction(rescueRoomInfo.GreenPathActionName, "GreenPaths", new { id = rescueRoomInfo.GreenPathId }));
                }

                return(RedirectToAction("Details", "RescueRoomInfos", new { id = targetV.RescueRoomInfoId }));
            }

            var targetW = new Models.ViewModels.RescueRoomConsultations.Edit.SelectionWorker(targetV);

            ViewBag.ConsultationDepartmentId = targetW.ConsultationDepartments;

            return(View(targetV));
        }
        /// <summary>
        /// 新增4。
        /// </summary>
        /// <param name="JZID">门诊医师接诊记录ID。</param>
        /// <param name="previousRescueRoomInfoId">关联的抢救室病例ID。</param>
        /// <returns>表单。</returns>
        public ActionResult Create4(Guid JZID, Guid?previousRescueRoomInfoId)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            //查找是否已存在相同JZID的记录。若存在,则跳转到Details。
            //**不需查找,已添加索引**
            //var targetDump = db.ObserveRoomInfos.Where(c => c.JZID == JZID).FirstOrDefault();
            //if (targetDump != null)
            //    return RedirectToAction("Details", new { id = targetDump.ObserveRoomInfoId });

            var targetV = new Models.ViewModels.ObserveRoomInfos.Create.Create4(JZID, previousRescueRoomInfoId);

            var target = targetV.GetReturn();

            if (targetV.PreviousRescueRoomInfoId != null)
            {
                var previousRescueRoomInfo = db.RescueRoomInfos.Find(targetV.PreviousRescueRoomInfoId);
                target.PreviousRescueRoomInfo = previousRescueRoomInfo;
            }

            db.ObserveRoomInfos.Add(target);
            db.SaveChanges();

            return(RedirectToAction("Edit", new { id = target.ObserveRoomInfoId }));
        }
コード例 #4
0
        /// <summary>
        /// 编辑。
        /// </summary>
        /// <param name="id">抢救室病例ID。</param>
        public ActionResult Edit(Guid id)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            var target = db.RescueRoomInfos.Find(id);

            if (target == null)
            {
                return(HttpNotFound());
            }

            var targetV = new Models.ViewModels.RescueRoomInfos.Edit.Edit(target);
            var targetW = new Models.ViewModels.RescueRoomInfos.Edit.SelectionWorker(targetV);

            ViewBag.BedId               = targetW.Beds;
            ViewBag.InRescueRoomWayId   = targetW.InRescueRoomWays;
            ViewBag.GreenPathCategoryId = targetW.GreenPathCategories;
            ViewBag.RescueResultId      = targetW.RescueResults;
            ViewBag.DestinationId       = targetW.Destinations;
            ViewBag.CriticalLevelId     = targetW.CriticalLevels;
            ViewBag.DestinationFirstId  = targetW.DestinationFirsts;
            ViewBag.DestinationSecondId = targetW.DestinationSeconds;
            ViewBag.TransferReasonId    = targetW.TransferReasons;

            return(View(targetV));
        }
コード例 #5
0
        /// <summary>
        /// 初始化。
        /// </summary>
        /// <param name="route">导航对象。</param>
        public SelectionWorker(Route route)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            this.GreenPathCategories = new System.Web.Mvc.SelectList(db.GreenPathCategories.OrderBy(c => c.Priority), "GreenPathCategoryId", "GreenPathCategoryName", route.GreenPathCategoryId);
            this.InRescueRoomWays    = new System.Web.Mvc.SelectList(db.InRescueRoomWays.OrderBy(c => c.Priority), "InRescueRoomWayId", "InRescueRoomWayName", route.InRescueRoomWayId);
            this.Destinations        = new System.Web.Mvc.SelectList(db.Destinations.OrderBy(c => c.Priority2), "DestinationId", "DestinationName", route.DestinationId);
            this.IsRescues           = new System.Web.Mvc.SelectList(
                new List <System.Web.Mvc.SelectListItem>
            {
                new System.Web.Mvc.SelectListItem {
                    Text = "是", Value = "True"
                },
                new System.Web.Mvc.SelectListItem {
                    Text = "否", Value = "False"
                }
            }, "Value", "Text");
            this.IsLeaves = new System.Web.Mvc.SelectList(
                new List <System.Web.Mvc.SelectListItem>
            {
                new System.Web.Mvc.SelectListItem {
                    Text = "是", Value = "true"
                },
                new System.Web.Mvc.SelectListItem {
                    Text = "否", Value = "false"
                }
            }, "Value", "Text");
        }
コード例 #6
0
        public StatisticsIndexRescueRoomGeneral(DateTime start, DateTime end, bool?isRescue, Guid?rescueResultId, Guid?inRescueRoomWayId, bool?inRescueRoomWayIsHasAdditionalInfo, string inRescueRoomWayRemarks, Guid?destinationId, bool?destinationIsHasAdditionalInfo, string destinationRemarks, bool?destinationIsTransfer, string transferTarget, bool?destinationIsProfessional, string professionalTarget)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            var query = db.RescueRoomInfos.Where(c => start <= c.OutDepartmentTime && c.OutDepartmentTime < end);

            //Description = string.Format("{0} 至 {1}", start.ToShortDateString(), end.ToShortDateString());

            if (isRescue.HasValue)
            {
                query = query.Where(c => c.IsRescue == isRescue);
                //Description += string.Format("\n抢救:{0}", isRescue.Value ? "是" : "否");

                if (rescueResultId.HasValue)
                {
                    query = query.Where(c => c.RescueResultId == rescueResultId);
                }
            }
            else if (inRescueRoomWayId.HasValue)
            {
                query = query.Where(c => c.InRescueRoomWayId == inRescueRoomWayId);

                if (inRescueRoomWayIsHasAdditionalInfo == true)
                {
                    query = query.Where(c => c.InRescueRoomWayRemarks == inRescueRoomWayRemarks);
                }
            }
            else if (destinationId.HasValue)
            {
                query = query.Where(c => c.DestinationId == destinationId);

                if (destinationIsHasAdditionalInfo == true)
                {
                    query = query.Where(c => c.DestinationRemarks == destinationRemarks);
                }

                if (destinationIsTransfer == true)
                {
                    query = query.Where(c => c.TransferTarget == transferTarget);
                }

                if (destinationIsProfessional == true)
                {
                    query = query.Where(c => c.ProfessionalTarget == professionalTarget);
                }
            }

            var queryOrdered = query.OrderBy(c => c.OutDepartmentTime);

            var list = queryOrdered.ToList();

            var queryV = list.Select(c => new Item(c));

            this.List = queryV.ToList();
        }
コード例 #7
0
        public SelectionWorker(Edit targetV)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            this.Beds = new System.Web.Mvc.SelectList(db.Beds.Where(c => c.IsUseForObserveRoom).OrderBy(c => c.Priority), "BedId", "BedName", targetV.BedId);
            this.InObserveRoomWays  = new System.Web.Mvc.SelectList(db.InObserveRoomWays.OrderBy(c => c.Priority), "InObserveRoomWayId", "InObserveRoomWayName", targetV.InObserveRoomWayId);
            this.Destinations       = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForRescueRoom).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationId);
            this.DestinationFirsts  = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForSubscription).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationFirstId);
            this.DestinationSeconds = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForSubscription).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationSecondId);
            this.TransferReasons    = new System.Web.Mvc.SelectList(db.TransferReasons, "TransferReasonId", "TransferReasonName", targetV.TransferReasonId);
        }
コード例 #8
0
        public SelectionWorker(Edit targetV)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            this.Beds                = new System.Web.Mvc.SelectList(db.Beds.Where(c => c.IsUseForRescueRoom).OrderBy(c => c.Priority), "BedId", "BedName", targetV.BedId);
            this.InRescueRoomWays    = new System.Web.Mvc.SelectList(db.InRescueRoomWays.OrderBy(c => c.Priority), "InRescueRoomWayId", "InRescueRoomWayName", targetV.InRescueRoomWayId);
            this.GreenPathCategories = new System.Web.Mvc.SelectList(db.GreenPathCategories.OrderBy(c => c.Priority), "GreenPathCategoryId", "GreenPathCategoryName", targetV.GreenPathCategoryId);
            this.RescueResults       = new System.Web.Mvc.SelectList(db.RescueResults.OrderBy(c => c.Priority), "RescueResultId", "RescueResultName", targetV.RescueResultId);
            this.Destinations        = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForRescueRoom).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationId);
            this.CriticalLevels      = new System.Web.Mvc.SelectList(db.CriticalLevels, "CriticalLevelId", "CriticalLevelName", targetV.CriticalLevelId);
            this.DestinationFirsts   = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForSubscription).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationFirstId);
            this.DestinationSeconds  = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForSubscription).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.DestinationSecondId);
            this.TransferReasons     = new System.Web.Mvc.SelectList(db.TransferReasons, "TransferReasonId", "TransferReasonName", targetV.TransferReasonId);
        }
        /// <summary>
        /// 详情。
        /// </summary>
        /// <param name="id">留观室病例ID。</param>
        public ActionResult Details(Guid id)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            var target = db.ObserveRoomInfos.Find(id);

            if (target == null)
            {
                return(HttpNotFound());
            }

            var targetV = new Models.ViewModels.ObserveRoomInfos.Details.Details(target);

            return(View(targetV));
        }
コード例 #10
0
        /// <summary>
        /// 眉栏。
        /// </summary>
        /// <param name="id">抢救室病例ID。</param>
        public ActionResult Header(Guid id)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            var target = db.RescueRoomInfos.Find(id);

            if (target == null)
            {
                return(HttpNotFound());
            }

            var targetV = new Models.ViewModels.RescueRoomInfos.Header.Header(target);

            return(PartialView(targetV));
        }
コード例 #11
0
        public IndexSubscription()
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            this.Time = DateTime.Now;

            var query1        = db.RescueRoomInfos.Where(c => c.OutDepartmentTime == null);
            var queryOrdered1 = query1.OrderBy(c => c.InDepartmentTime).ThenBy(c => c.RescueRoomInfoId);
            var list1         = queryOrdered1.ToList();
            var listA         = list1.Select(c => new Item(c)).ToList();

            var query2        = db.ObserveRoomInfos.Where(c => c.OutDepartmentTime == null);
            var queryOrdered2 = query2.OrderBy(c => c.InDepartmentTime).ThenBy(c => c.ObserveRoomInfoId);
            var list2         = queryOrdered2.ToList();
            var listB         = list2.Select(c => new Item(c)).ToList();

            this.List = listA.Union(listB).ToList();
        }
コード例 #12
0
        /// <summary>
        /// 新增3。
        /// </summary>
        /// <param name="JZID">门诊医师接诊记录ID。</param>
        public ActionResult Create3(Guid JZID)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            //查找是否已存在相同JZID的记录。若存在,则跳转到Details。
            var targetDump = db.ObserveRoomInfos.Where(c => c.JZID == JZID).FirstOrDefault();

            if (targetDump != null)
            {
                return(RedirectToAction("Details", new { id = targetDump.ObserveRoomInfoId }));
            }

            var targetV = new Models.ViewModels.ObserveRoomInfos.Create.Create3(JZID);

            //无抢救室记录时,跳转到下一步。
            if (targetV.ListRescueRoomInfos.Count() != 0)
            {
                return(View(targetV));
            }
            else
            {
                return(RedirectToAction("Create4", new { JZID }));
            }
        }
コード例 #13
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var result = new List <ValidationResult>();

            var db = new Models.Domains.Entities.EiSDbContext();

            //1.入室时间不能晚于当前时间。
            if (this.InDepartmentTime > DateTime.Now)
            {
                result.Add(new ValidationResult("“入室时间”不能晚于当前时间", new string[] { "InDepartmentTime" }));
            }

            //2.入室方式必填。
            if (!this.InRescueRoomWayId.HasValue)
            {
                result.Add(new ValidationResult("“入室方式”不可为空", new string[] { "InRescueRoomWayId" }));
            }

            //3.首诊护士必填。
            if (string.IsNullOrWhiteSpace(this.FirstNurseName))
            {
                result.Add(new ValidationResult("“首诊护士”不可为空", new string[] { "FirstNurseName" }));
            }

            //4.入室方式为允许附加数据才可以有附加数据。
            //if (!db.InRescueRoomWays.Find(rescueRoomInfo.InRescueRoomWayId).IsHasAdditionalInfo && !string.IsNullOrEmpty(rescueRoomInfo.InRescueRoomWayRemarks))
            //    ModelState.AddModelError("InRescueRoomWayRemarks", "与入院方式不匹配。");

            //5.入室方式为允许附加数据,必须有具体名称。
            if (this.InRescueRoomWayId.HasValue && db.InRescueRoomWays.Find(this.InRescueRoomWayId).IsHasAdditionalInfo&& string.IsNullOrWhiteSpace(this.InRescueRoomWayRemarks))
            {
                result.Add(new ValidationResult("“入室方式明细”不可为空", new string[] { "InRescueRoomWayRemarks" }));
            }

            //6.有抢救才能有抢救结果。
            if (!this.IsRescue && this.RescueResultId.HasValue)
            {
                result.Add(new ValidationResult("与“抢救”不匹配", new string[] { "RescueResultId" }));
            }

            //7.离室时,有抢救则必须有抢救结果。
            if (this.OutDepartmentTime.HasValue && this.IsRescue && !this.RescueResultId.HasValue)
            {
                result.Add(new ValidationResult("离室时,有“抢救”必须有“抢救结果”", new string[] { "RescueResultId" }));
            }

            //8.绿色通道为允许附加数据才可以有附加数据。
            //if (!db.GreenPathCategories.Find(rescueRoomInfo.GreenPathCategoryId).IsHasAdditionalInfo && !string.IsNullOrEmpty(rescueRoomInfo.GreenPathCategoryRemarks))
            //    ModelState.AddModelError("GreenPathCategoryRemarks", "与绿色通道病种不匹配。");

            //9.绿色通道为允许附加数据,必须有具体名称。
            if (this.GreenPathCategoryId.HasValue && db.GreenPathCategories.Find(this.GreenPathCategoryId).IsHasAdditionalInfo&& string.IsNullOrWhiteSpace(this.GreenPathCategoryRemarks))
            {
                result.Add(new ValidationResult("“绿色通道明细”不可为空", new string[] { "GreenPathCategoryRemarks" }));
            }

            //10.有预约首选科室,必须有预约首选时间。
            if (this.DestinationFirstId.HasValue && !this.DestinationFirstTime.HasValue)
            {
                result.Add(new ValidationResult("“预约时间”不可为空", new string[] { "DestinationFirstTime" }));
            }

            //11.预约首选时间不能早于入室时间。
            if (this.DestinationFirstTime.HasValue && this.DestinationFirstTime.Value < this.InDepartmentTime)
            {
                result.Add(new ValidationResult("“预约时间”不能早于“入室时间”", new string[] { "DestinationFirstTime" }));
            }

            //12.有预约首选科室,必须有预约首选医师。
            if (this.DestinationFirstId.HasValue && string.IsNullOrWhiteSpace(this.DestinationFirstContact))
            {
                result.Add(new ValidationResult("“预约医师”不可为空", new string[] { "DestinationFirstContact" }));
            }

            //13.有预约次选科室,必须有预约首选科室。
            if (this.DestinationSecondId.HasValue && !this.DestinationFirstId.HasValue)
            {
                result.Add(new ValidationResult("必须先填写“预约首选科室”", new string[] { "DestinationSecondId" }));
            }

            //14.有离室时间,必须有去向。
            if (this.OutDepartmentTime.HasValue && this.DestinationId == null)
            {
                result.Add(new ValidationResult("离室时必填", new string[] { "DestinationId" }));
            }

            //15.有离室时间,必须有经手护士。
            if (this.OutDepartmentTime.HasValue && string.IsNullOrWhiteSpace(this.HandleNurse))
            {
                result.Add(new ValidationResult("离室时必填", new string[] { "HandleNurse" }));
            }

            //16.离室时间必须不早于入室时间。
            if (this.OutDepartmentTime.HasValue && this.InDepartmentTime > this.OutDepartmentTime)
            {
                result.Add(new ValidationResult("不能早于“入室时间”", new string[] { "OutDepartmentTime" }));
            }

            //17.去向为允许附加数据才可以填写去向详细。
            //if (!db.Destinations.Find(rescueRoomInfo.DestinationId).IsHasAdditionalInfo && !string.IsNullOrEmpty(rescueRoomInfo.DestinationRemarks))
            //    ModelState.AddModelError("DestinationRemarks", "与去向不匹配。");

            //18.去向为允许附加数据,必须填写去向详细。
            if (this.DestinationId.HasValue && db.Destinations.Find(this.DestinationId).IsHasAdditionalInfo&& string.IsNullOrWhiteSpace(this.DestinationRemarks))
            {
                result.Add(new ValidationResult("“去向明细”不可为空", new string[] { "DestinationRemarks" }));
            }

            //19.有去向,必须有离室时间。
            if (this.DestinationId.HasValue && !this.OutDepartmentTime.HasValue)
            {
                result.Add(new ValidationResult("“离室时间”不可为空", new string[] { "OutDepartmentTime" }));
            }

            //20.有去向,必须有经手护士。
            if (this.DestinationId.HasValue && string.IsNullOrWhiteSpace(this.HandleNurse))
            {
                result.Add(new ValidationResult("“经手护士”不可为空", new string[] { "HandleNurse" }));
            }

            //21.去向为转院时,必须有转院原因。
            if (this.DestinationId.HasValue && db.Destinations.Find(this.DestinationId).IsTransfer&& !this.TransferReasonId.HasValue)
            {
                result.Add(new ValidationResult("“转院原因”不可为空", new string[] { "TransferReasonId" }));
            }

            //22.去向为转院时,必须有转往医院。
            if (this.DestinationId.HasValue && db.Destinations.Find(this.DestinationId).IsTransfer&& string.IsNullOrWhiteSpace(this.TransferTarget))
            {
                result.Add(new ValidationResult("“转往医院”不可为空", new string[] { "TransferTarget" }));
            }

            //23.去向为专科时,必须有专科名称
            if (this.DestinationId.HasValue && db.Destinations.Find(this.DestinationId).IsProfessional&& string.IsNullOrWhiteSpace(this.ProfessionalTarget))
            {
                result.Add(new ValidationResult("“专科名称”不可为空", new string[] { "ProfessionalTarget" }));
            }

            return(result);
        }
コード例 #14
0
        public SelectionWorker(Edit targetV)
        {
            var db = new Models.Domains.Entities.EiSDbContext();

            this.ConsultationDepartments = new System.Web.Mvc.SelectList(db.Destinations.Where(c => c.IsUseForConsultation).OrderBy(c => c.Priority2), "DestinationId", "DestinationName", targetV.ConsultationDepartmentId);
        }