Exemplo n.º 1
0
        public Item(GreenPathAmi target)
        {
            this.GreenPathAmiId   = target.GreenPathAmiId;
            this.RescueRoomInfoId = target.RescueRoomInfoId;
            this.IsLeave          = target.RescueRoomInfo.OutDepartmentTime.HasValue;

            this.PatientName      = target.RescueRoomInfo.PatientName;
            this.OutPatientNumber = target.RescueRoomInfo.OutPatientNumber;
            this.InDepartmentTime = target.RescueRoomInfo.InDepartmentTime;

            this.OccurrenceTime = target.OccurrenceTime;

            this.EcgFirstTime  = target.EcgFirstTime;
            this.EcgSecondTime = target.EcgSecondTime;
            this.Remarks       = target.Remarks;

            this.FinishPathTime    = target.FinishPathTime;
            this.OutDepartmentTime = target.RescueRoomInfo.OutDepartmentTime;
            this.IsHeldUp          = target.IsHeldUp;
            this.Problem           = target.Problem;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 急性心肌梗死新增。
        /// </summary>
        /// <param name="rescueRoomInfoId">归属的抢救室病例ID。</param>
        /// <remarks>直接生成后,跳转到Edit。</remarks>
        public ActionResult CreateAmi(Guid rescueRoomInfoId)
        {
            var db = new EiSDbContext();

            var rescueRoomInfo = db.RescueRoomInfos.Find(rescueRoomInfoId);

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

            if (db.GreenPathAmis.Any(c => c.RescueRoomInfoId == rescueRoomInfoId))
            {
                return(HttpNotFound());
            }

            var target = new GreenPathAmi();

            target.GreenPathAmiId   = Guid.NewGuid();
            target.RescueRoomInfoId = rescueRoomInfoId;

            target.UpdateTime = DateTime.Now;

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

            //**已用索引保证唯一性**
            //if (db.GreenPathAmis.Count(c => c.RescueRoomInfoId == rescueRoomInfoId) > 1)
            //{
            //    db.GreenPathAmis.Remove(target);
            //    db.SaveChanges();

            //    return HttpNotFound();
            //}

            return(RedirectToAction("EditAmi", new { id = target.GreenPathAmiId }));
        }