Example #1
0
        public List <ProcedureDetail> getProcedureDetail(long _patientIEID, long _patientFUID, string MCODE, string bodyPart)
        {
            List <ProcedureDetail> _proceduredetails = new List <ProcedureDetail>();
            DataAccess             _dal  = new DataAccess();
            List <SqlParameter>    param = new List <SqlParameter>();

            param.Add(new SqlParameter("@PatientIE_ID", _patientIEID));
            if (_patientFUID != 0)
            {
                param.Add(new SqlParameter("@PatientFU_ID", _patientFUID));
            }
            param.Add(new SqlParameter("@MCODE", MCODE));
            param.Add(new SqlParameter("@bodyPart", bodyPart));
            DataTable _dt = _dal.getDataTable("nusp_GetProceduresDetail", param);

            foreach (DataRow _dr in _dt.Rows)
            {
                ProcedureDetail _proceduredetail = new ProcedureDetail();
                _proceduredetail.PatientIE_ID       = Convert.ToInt64(_dr["PatientIE_ID"]);
                _proceduredetail.PatientFU_ID       = Convert.IsDBNull(_dr["PatientFU_ID"]) ? null : (long?)Convert.ToInt64(_dr["PatientFU_ID"]);
                _proceduredetail.ProcedureDetail_ID = Convert.ToInt64(_dr["ProcedureDetail_ID"]);
                _proceduredetail.Procedure_ID       = Convert.ToInt64(_dr["Procedure_Master_ID"]);
                _proceduredetail.MCODE        = _dr["MCODE"].ToString();
                _proceduredetail.Date         = Convert.IsDBNull(_dr["Date"]) ? null : (DateTime?)Convert.ToDateTime(_dr["Date"]);
                _proceduredetail.DateType     = _dr["DateType"].ToString();
                _proceduredetail.SubProcedure = _dr["SubProcedure"].ToString();
                long createdby = 0;
                _proceduredetail.CreatedBy = Int64.TryParse(Convert.ToString(_dr["CreatedBy"]), out createdby) ? (long?)createdby : null;
                _proceduredetails.Add(_proceduredetail);
            }

            return(_proceduredetails);
        }
        //Update Procedure
        public bool UpdateProcedure(ProcedureDetail detail)
        {
            var entity = _ctx.Procedures.Single(e => e.ProcedureId == detail.ProcedureId);

            entity.Name        = detail.Name;
            entity.Description = detail.Description;
            entity.Preperation = detail.Preperation;
            entity.Risks       = detail.Risks;
            return(_ctx.SaveChanges() == 1);
        }
        //Get Procedure by Id
        public ProcedureDetail GetProcedureById(int procedureId)
        {
            var procedureEntity = _ctx.Procedures.Find(procedureId);
            var procedureDetail = new ProcedureDetail
            {
                ProcedureId = procedureEntity.ProcedureId,
                Name        = procedureEntity.Name,
                Description = procedureEntity.Description,
                Preperation = procedureEntity.Preperation,
                Risks       = procedureEntity.Risks
            };

            return(procedureDetail);
        }
Example #4
0
        public ActionResult Edit(int id)
        {
            var service = new ProcedureService();
            var detail  = service.GetProcedureById(id);
            var model   = new ProcedureDetail
            {
                ProcedureId = detail.ProcedureId,
                Name        = detail.Name,
                Description = detail.Description,
                Preperation = detail.Preperation,
                Risks       = detail.Risks
            };

            return(View(model));
        }
Example #5
0
        /// <summary>
        /// Creates procedure detail optionally including specified data.
        /// </summary>
        /// <param name="rp"></param>
        /// <param name="procedureStepFilter"></param>
        /// <param name="includeProtocol"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public ProcedureDetail CreateProcedureDetail(
            Procedure rp,
            Predicate <ProcedureStep> procedureStepFilter,
            bool includeProtocol,
            IPersistenceContext context)
        {
            var detail = new ProcedureDetail
            {
                ProcedureRef         = rp.GetRef(),
                Status               = EnumUtils.GetEnumValueInfo(rp.Status, context),
                Type                 = new ProcedureTypeAssembler().CreateSummary(rp.Type),
                ScheduledStartTime   = rp.ScheduledStartTime,
                SchedulingCode       = EnumUtils.GetEnumValueInfo(rp.SchedulingCode),
                StartTime            = rp.StartTime,
                EndTime              = rp.EndTime,
                CheckInTime          = rp.ProcedureCheckIn.CheckInTime,
                CheckOutTime         = rp.ProcedureCheckIn.CheckOutTime,
                PerformingFacility   = new FacilityAssembler().CreateFacilitySummary(rp.PerformingFacility),
                PerformingDepartment = rp.PerformingDepartment == null ? null : new DepartmentAssembler().CreateSummary(rp.PerformingDepartment, context),
                Laterality           = EnumUtils.GetEnumValueInfo(rp.Laterality, context),
                ImageAvailability    = EnumUtils.GetEnumValueInfo(rp.ImageAvailability, context),
                Portable             = rp.Portable,
                StudyInstanceUid     = rp.StudyInstanceUID
            };

            var includedSteps = CollectionUtils.Select(rp.GetWorkflowHistory(), procedureStepFilter);

            if (includedSteps.Count > 0)
            {
                var procedureStepAssembler = new ProcedureStepAssembler();
                detail.ProcedureSteps = CollectionUtils.Map(
                    includedSteps,
                    (ProcedureStep ps) => procedureStepAssembler.CreateProcedureStepDetail(ps, context));
            }

            // the Protocol may be null, if this procedure has not been protocolled
            if (includeProtocol && rp.ActiveProtocol != null)
            {
                var protocolAssembler = new ProtocolAssembler();
                detail.Protocol = protocolAssembler.CreateProtocolDetail(rp.ActiveProtocol, context);
            }

            return(detail);
        }
Example #6
0
 /// <summary>
 /// Formats the procedure name, portable and laterality similar to "Name (Portable/Laterality)".
 /// Name is formatted according to the default person name format as specified in <see cref="FormatSettings"/>
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public static string Format(ProcedureDetail p)
 {
     return(Format(p.Type.Name, p.Portable, p.Laterality, FormatSettings.Default.ProcedurePortableLateralityDefaultFormat));
 }
Example #7
0
 public ProtocolEditorProcedurePlanSummaryTableItem(ProcedureDetail _rpDetail, ProtocolDetail _protocolDetail)
 {
     this._rpDetail       = _rpDetail;
     this._protocolDetail = _protocolDetail;
 }
Example #8
0
        public ActionResult Index(int procedureid, int projectid, IEnumerable <ProcedureDetailViewModel> ProcedureDetailVM)
        {
            if (!_projectuservalidationservice.UserCanEditProject(projectid))
            {
                ViewBag.ErrorMessage = "Access Denied. Please contact administrator for further assistance.";
                return(View("Error"));
            }

            var userKey = (int)Membership.GetUser().ProviderUserKey;

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", new { procedureid = procedureid, projectid = projectid }));
            }

            Procedure procedure = GetValidProcedure(procedureid);

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

            foreach (var eachProcedureDetail in ProcedureDetailVM)
            {
                if (!ProcedureDetailFieldIsValid(eachProcedureDetail.FieldID))
                {
                    ViewBag.ErrorMessage = "Data conflicts occurred. Please contact administrator for further assistance.";
                    return(View("Error"));
                }
                ;

                if (eachProcedureDetail.FieldType == EntryFieldType.Lookup.ToString() && eachProcedureDetail.Multiple == false)
                {
                    // the procedure details with the same fields
                    var ExistingProceduredetails = db.ProcedureDetails.Where(pd => pd.ProcedureDetailOptionFieldID == eachProcedureDetail.FieldID && pd.ProcedureProcedureID == procedureid);

                    foreach (var proceduredetail in ExistingProceduredetails)
                    {
                        if (proceduredetail.Status != "Deleted")
                        {
                            proceduredetail.Status        = "Deleted";
                            proceduredetail.LastUpdatedBy = userKey;
                        }
                    }
                    if (eachProcedureDetail.OptionID > 0)
                    {
                        // procedure details with the same field and same option
                        var ExistingProceduredetail = ExistingProceduredetails.Where(pd => pd.ProcedureDetailOptionID == eachProcedureDetail.OptionID);

                        if (ExistingProceduredetail.Count() == 0)
                        {
                            ProcedureDetail Newproceduredetail = new ProcedureDetail()
                            {
                                ProcedureProcedureID         = eachProcedureDetail.ProcedureID,
                                ProcedureDetailOptionFieldID = eachProcedureDetail.FieldID,
                                ProcedureDetailOptionID      = eachProcedureDetail.OptionID,

                                LastUpdatedBy = userKey,
                            };
                            db.ProcedureDetails.Add(Newproceduredetail);
                        }
                        else
                        {
                            ExistingProceduredetail.FirstOrDefault().Status        = "Current";
                            ExistingProceduredetail.FirstOrDefault().LastUpdatedBy = userKey;
                        }
                    }
                }

                if (eachProcedureDetail.FieldType == EntryFieldType.Lookup.ToString() && eachProcedureDetail.Multiple == true)
                {
                    var ExistingProceduredetails = db.ProcedureDetails.Where(pd => pd.ProcedureDetailOptionFieldID == eachProcedureDetail.FieldID && pd.ProcedureProcedureID == procedureid);

                    foreach (var proceduredetail in ExistingProceduredetails)
                    {
                        proceduredetail.Status        = "Deleted";
                        proceduredetail.LastUpdatedBy = userKey;
                    }

                    if (eachProcedureDetail.OptionIDs != null)
                    {
                        foreach (var optionID in eachProcedureDetail.OptionIDs)
                        {
                            var ExistingProceduredetail = ExistingProceduredetails.Where(pd => pd.ProcedureDetailOptionID == optionID);

                            if (ExistingProceduredetail.Count() == 0)
                            {
                                ProcedureDetail procedureDetail = new ProcedureDetail
                                {
                                    ProcedureDetailOptionFieldID = eachProcedureDetail.FieldID,
                                    ProcedureProcedureID         = eachProcedureDetail.ProcedureID,
                                    ProcedureDetailOptionID      = optionID,

                                    LastUpdatedBy = userKey,
                                };

                                db.ProcedureDetails.Add(procedureDetail);
                            }
                            else
                            {
                                ExistingProceduredetail.FirstOrDefault().Status        = "Current";
                                ExistingProceduredetail.FirstOrDefault().LastUpdatedBy = userKey;
                            }
                        }
                    }
                }
                else if (eachProcedureDetail.FieldType != EntryFieldType.Lookup.ToString())
                {
                    var ExistingProceduredetails = db.ProcedureDetails.Where(pd => pd.ProcedureDetailOptionFieldID == eachProcedureDetail.FieldID && pd.ProcedureProcedureID == procedureid);

                    //set everything to "Deleted" as a reset before adding new values
                    foreach (var proceduredetail in ExistingProceduredetails)
                    {
                        proceduredetail.Status        = "Deleted";
                        proceduredetail.LastUpdatedBy = userKey;
                    }
                    if (eachProcedureDetail.Value != null)
                    {
                        if (ExistingProceduredetails.Count() == 0)
                        {
                            ProcedureDetail proceduredetail = new ProcedureDetail()
                            {
                                ProcedureProcedureID         = eachProcedureDetail.ProcedureID,
                                ProcedureDetailValue         = eachProcedureDetail.Value,
                                ProcedureDetailOptionFieldID = eachProcedureDetail.FieldID,

                                LastUpdatedBy = (int)Membership.GetUser().ProviderUserKey,
                            };
                            db.ProcedureDetails.Add(proceduredetail);
                        }
                        else
                        {
                            ExistingProceduredetails.FirstOrDefault().ProcedureDetailValue = eachProcedureDetail.Value;
                            ExistingProceduredetails.FirstOrDefault().Status        = "Current";
                            ExistingProceduredetails.FirstOrDefault().LastUpdatedBy = userKey;
                        }
                    }
                }
            }

            db.SaveChanges();

            //      ViewBag.UpdatedMessage = "Information Updated";

            return(RedirectToAction("Details", "MultiPARTProject", new { projectid = projectid }));
        }
Example #9
0
 public ProcedurePlanSummaryTableItem(ProcedureDetail rpDetail, ProcedureStepDetail mpsDetail)
 {
     _rpDetail  = rpDetail;
     _mpsDetail = mpsDetail;
 }