Esempio n. 1
0
 /// <summary>
 /// 重置主表节点时间
 /// </summary>
 private MED_OPERATION_MASTER ResetOperationMaster(MED_OPERATION_MASTER master, OperationStatus status)
 {
     foreach (string s in OperationStatusHelper.OperationStatusList)
     {
         OperationStatus StatusFile = OperationStatusHelper.OperationStatusFromString(s);
         if (StatusFile == OperationStatus.TurnToEmergency || StatusFile == OperationStatus.TurnToICU || StatusFile == OperationStatus.TurnToSickRoom ||
             StatusFile == OperationStatus.TurnToMortuary || StatusFile == OperationStatus.TurnToPACU || StatusFile == OperationStatus.OutYouDao ||
             StatusFile == OperationStatus.OperScheduled || StatusFile == OperationStatus.None || StatusFile == OperationStatus.LeftHospital ||
             StatusFile == OperationStatus.InYouDao || StatusFile == OperationStatus.CancelOperation || StatusFile == OperationStatus.Done)
         {
             continue;
         }
         if (StatusFile > status)
         {
             string dtField = OperationStatusHelper.GetTimeFieldName(StatusFile);
             master.SetValue(dtField, null);
         }
     }
     return(master);
 }
Esempio n. 2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        protected override SaveResult SaveData()
        {
            TransactionParamsters tp     = TransactionParamsters.Create();
            OperationStatus       status = OperationStatusHelper.OperationStatusFromString(OperStatus);

            // 保存手术跳转明细记录
            this.SaveOperationJump(this.strReason, status, ref tp);
            // 更新主表手术间号
            this.SaveOperationMaster(ref tp);

            if (status == OperationStatus.IsReady)
            {
                DeleteAnesEvent();
                DeleteMonitorData();
                // 更新手术室数据
                this.SaveOperatingRoom(ref tp, true);
                // 更新监护仪数据
                this.SaveMonitorDict(ref tp, true);
            }
            if (this.CurPatientModel.OperStatusCode >= OperationStatus.OutOperationRoom && status != OperationStatus.IsReady)
            {
                // 更新手术室数据
                this.SaveOperatingRoom(ref tp, false);
                // 更新监护仪数据
                this.SaveMonitorDict(ref tp, false);
            }

            bool result = CommonService.ClientInstance.UpdateByTransaction(tp.ToString());

            // 刷新主界面信息
            Messenger.Default.Send <object>(this, EnumMessageKey.RefreshMainWindow);


            // 更新手术间字典表
            ApplicationModel.Instance.AllDictList.OperatingRoomList = DictService.ClientInstance.GetOperatingRoomList().Where(x => x.DEPT_CODE == ExtendAppContext.Current.OperDeptCode).ToList();

            // 更新字典表
            ApplicationModel.Instance.AllDictList.MonitorDictList = DictService.ClientInstance.GetMonitorDictList();

            return(result ? SaveResult.Success : SaveResult.Fail);
        }
Esempio n. 3
0
        /// <summary>
        /// 绑定数据源数据到控件
        /// </summary>
        public override void BindDataToUI(MedDrugGraph control, Dictionary <string, System.Data.DataTable> dataSources)
        {
            if (!dataSources.ContainsKey("AnesthesiaEvent"))
            {
                throw new NotImplementedException(string.Format("在数据源中未找到名为{0}的表AnesInformations.AnesthesiaEventDataTable,请添加此绑定数据源!", "AnesthesiaEvent"));
            }

            bool     isEndAnes = false;
            DateTime dtEndAnes = DateTime.Now;
            List <MED_ANESTHESIA_EVENT> anesEvent = new ModelHandler <MED_ANESTHESIA_EVENT>().FillModel(dataSources["AnesthesiaEvent"]);

            // 针对麻醉系统:持续用药随手术状态自动结束
            if (ApplicationConfiguration.DrugAutoStop && ExtendAppContext.Current.EventNo == "0")
            {
                string          operText   = ApplicationConfiguration.DrugAutoStopOperationStatus;
                OperationStatus operStatus = OperationStatusHelper.OperationStatusFromString(operText);
                if (operStatus != OperationStatus.None)
                {
                    string    timeField = OperationStatusHelper.GetTimeFieldName(operStatus);
                    DataTable dtMaster  = DataContext.GetCurrent().GetData("MED_OPERATION_MASTER");
                    if (dtMaster != null && dtMaster.Rows.Count > 0 && !dtMaster.Rows[0].IsNull(timeField))
                    {
                        int status = 0;
                        if (!dtMaster.Rows[0].IsNull("OPER_STATUS_CODE"))
                        {
                            status = Convert.ToInt32(dtMaster.Rows[0]["OPER_STATUS_CODE"]);
                        }

                        // 出手术室 35
                        // 时如果没有持续用药没有自动结束的话,会按照配置的时间自动结束
                        if (status >= (int)operStatus)
                        {
                            dtEndAnes = (DateTime)dtMaster.Rows[0][timeField];
                            isEndAnes = true;

                            bool changed = false;
                            if (anesEvent != null)
                            {
                                anesEvent.ForEach(row =>
                                {
                                    if (row.DURATIVE_INDICATOR.HasValue && row.DURATIVE_INDICATOR == 1 && !row.END_TIME.HasValue)
                                    {
                                        row.END_TIME = dtEndAnes;
                                        changed      = true;
                                    }
                                });
                            }

                            if (changed)
                            {
                                AnesInfoService.ClientInstance.UpadteAnesthesiaEvent(anesEvent);
                            }
                        }
                    }
                }
            }

            control.Curves.Clear();
            control.ProLongedDrugShowType = (ProLongedDrugUnitShowType)ApplicationConfiguration.ProLonged;
            control.DrugShowType          = (NormalDrugUnitShowType)ApplicationConfiguration.DrugShow;
            control.StartTime             = PagerSetting.PageTimeSpan.StartDateTime;
            control.EndTime          = PagerSetting.PageTimeSpan.EndDateTime;
            control.MinStartDateTime = PagerSetting.PageTimeSpan.OrigiStartDateTime;
            control.MaxEndDateTime   = PagerSetting.PageTimeSpan.OrigiEndDateTime;

            //joysola测试用

            //ApplicationConfiguration.PassedDrugPointFormat = "DOSAGE;DOSAGE_UNITS;(;PERFORM_SPEED;SPEED_UNIT;+;CONCENTRATION;CONCENTRATION_UNIT;\r\n;ADMINISTRATOR;)";//DOSAGE_UNITS,ADMINISTRATOR
            //ApplicationConfiguration.PassedDrugNameFormat = "EVENT_ITEM_NAME;(;DOSAGE_UNITS;);SPEED_UNIT;CONCENTRATION_UNIT;ADMINISTRATOR";//SPEED_UNIT

            //ApplicationConfiguration.DrugPointShowFormat = "DOSAGE;;PERFORM_SPEED;SPEED_UNIT;CONCENTRATION;CONCENTRATION_UNIT;";//DOSAGE_UNITS,ADMINISTRATOR
            //ApplicationConfiguration.DrugNameShowFormat = "EVENT_ITEM_NAME;DOSAGE_UNITS;;CONCENTRATION_UNIT;ADMINISTRATOR";//SPEED_UNIT
            //ApplicationConfiguration.DrugPointMarkFormat = "(;);+;\r\n;";
            //ApplicationConfiguration.DrugNameMarkFormat = "(;)";

            //modified by joysola on 2018-2-26、3-5、4-8 新增获取用药显示、持续用药显示、药名显示
            control.DrugPointShowFormatType     = ShowHelper.GetDrugPointShowFormat(ApplicationConfiguration.PassedDrugPointFormat);
            control.DrugProLongedShowFormatType = ShowHelper.GetDrugPointShowFormat(ApplicationConfiguration.PassedDrugProLongedFormat);
            control.DrugNameShowFormatType      = ShowHelper.GetDrugNameShowFormat(ApplicationConfiguration.PassedDrugNameFormat);

            control.PointMarkFormat     = ShowHelper.GetDrugPointMarkFormat(ApplicationConfiguration.PassedDrugPointFormat);
            control.ProLongedMarkFormat = ShowHelper.GetDrugPointMarkFormat(ApplicationConfiguration.PassedDrugProLongedFormat);
            control.NameMarkFormat      = ShowHelper.GetDrugNameMarkFormat(ApplicationConfiguration.PassedDrugNameFormat);
            //modified end
            string        itemClass = "," + GetAnesClassTypeString(AnesClassType.InOxygen) + ",";
            List <string> titles    = new List <string>();

            if (anesEvent != null)
            {
                anesEvent.ForEach(row =>
                {
                    if (!string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                        !string.IsNullOrEmpty(row.EVENT_ITEM_NAME) &&
                        itemClass.Contains("," + row.EVENT_CLASS_CODE + ",") &&
                        !titles.Contains(row.EVENT_ITEM_NAME))
                    {
                        // 只显示持续用药
                        if (control.IsOnlyLine)
                        {
                            if (row.DURATIVE_INDICATOR.HasValue && row.DURATIVE_INDICATOR == 1)
                            {
                                titles.Add(row.EVENT_ITEM_NAME);
                            }
                        }
                        else
                        {
                            titles.Add(row.EVENT_ITEM_NAME);
                        }
                    }
                });

                itemClass += this.GetAnesClassTypeString(AnesClassType.AnesDrug) + "," + this.GetAnesClassTypeString(AnesClassType.MixLiquid) + ",";
                anesEvent.ForEach(row =>
                {
                    if (!string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                        !string.IsNullOrEmpty(row.EVENT_ITEM_NAME) &&
                        itemClass.Contains("," + row.EVENT_CLASS_CODE + ",") &&
                        !titles.Contains(row.EVENT_ITEM_NAME))
                    {
                        // 只显示持续用药
                        if (control.IsOnlyLine)
                        {
                            if (row.DURATIVE_INDICATOR.HasValue && row.DURATIVE_INDICATOR == 1)
                            {
                                titles.Add(row.EVENT_ITEM_NAME);
                            }
                        }
                        else
                        {
                            titles.Add(row.EVENT_ITEM_NAME);
                        }
                    }
                });

                itemClass += "C,";// 用药
                // 泵注用药部分暂时隐藏,请勿删除
                //anesEvent.ForEach(row =>
                //{
                //    if (!string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                //        !string.IsNullOrEmpty(row.EVENT_ITEM_NAME) &&
                //        row.EVENT_CLASS_CODE.Equals("C") &&
                //        !titles.Contains(row.EVENT_ITEM_NAME)
                //        && !string.IsNullOrEmpty(row.ADMINISTRATOR) && row.ADMINISTRATOR.Equals("泵注"))
                //    {
                //        if (control.IsOnlyLine)
                //        {
                //            if (row.DURATIVE_INDICATOR.HasValue && row.DURATIVE_INDICATOR == 1)
                //            {
                //                titles.Add(row.EVENT_ITEM_NAME);
                //            }
                //        }
                //        else
                //        {
                //            titles.Add(row.EVENT_ITEM_NAME);
                //        }
                //    }
                //});

                anesEvent.ForEach(row =>
                {
                    if (!string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                        !string.IsNullOrEmpty(row.EVENT_ITEM_NAME) &&
                        row.EVENT_CLASS_CODE.Equals("C") &&
                        !titles.Contains(row.EVENT_ITEM_NAME))
                    {
                        if (control.IsOnlyLine)
                        {
                            if (row.DURATIVE_INDICATOR.HasValue && row.DURATIVE_INDICATOR == 1)
                            {
                                titles.Add(row.EVENT_ITEM_NAME);
                            }
                        }
                        else
                        {
                            titles.Add(row.EVENT_ITEM_NAME);
                        }
                    }
                });

                // 只显示持续用药时进行排序
                if (control.IsOnlyLine && titles.Count < control.LineParameters.Count)
                {
                    anesEvent.OrderBy(x => x.START_TIME).ToList().ForEach(row =>
                    {
                        if (!string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                            !string.IsNullOrEmpty(row.EVENT_ITEM_NAME) &&
                            itemClass.Contains("," + row.EVENT_CLASS_CODE + ",") &&
                            !titles.Contains(row.EVENT_ITEM_NAME))
                        {
                            if (row.DURATIVE_INDICATOR == null || row.DURATIVE_INDICATOR != 1)
                            {
                                titles.Add(row.EVENT_ITEM_NAME);
                            }
                        }
                    });
                }
            }

            // 最多只能显示 drugGraph.LineParameters.Count 行,多的显示在明细中
            int index = 0;

            if (titles.Count > 0)
            {
                DateTime sysDatetTime = this.GetSysDateTime();
                foreach (string title in titles)
                {
                    index++;

                    // 目前为 行
                    if (index > control.LineParameters.Count)
                    {
                        break;
                    }

                    MedDrugCurve curve = new MedDrugCurve(title, GetRandomColor());
                    List <MED_ANESTHESIA_EVENT> eventRows = anesEvent.Where(x => !string.IsNullOrEmpty(x.EVENT_ITEM_NAME) &&
                                                                            x.EVENT_ITEM_NAME.Equals(title)).ToList();
                    if (eventRows != null && eventRows.Count > 0)
                    {
                        eventRows.ForEach(row =>
                        {
                            if (row.START_TIME.HasValue &&
                                !string.IsNullOrEmpty(row.EVENT_CLASS_CODE) &&
                                itemClass.Contains("," + row.EVENT_CLASS_CODE + ","))
                            {
                                DateTime dt;
                                bool isArrow        = false;
                                PointType pointType = this.GetDecimalValue(row.DURATIVE_INDICATOR) == 1 ?
                                                      PointType.ProLonged : PointType.SinglePoint;
                                if (row.END_TIME.HasValue)
                                {
                                    dt = row.END_TIME.Value;
                                }
                                else if (pointType == PointType.ProLonged)
                                {
                                    DateTime dtUse = isEndAnes ? dtEndAnes : sysDatetTime;
                                    dt             = (dtUse > PagerSetting.PageTimeSpan.OrigiEndDateTime) ? dtUse : PagerSetting.PageTimeSpan.OrigiEndDateTime;
                                    isArrow        = !isEndAnes;
                                }
                                else
                                {
                                    dt = row.START_TIME.Value;
                                }

                                MedDrugPoint point = curve.AddPoint(row.START_TIME.Value, this.GetDoubleValue(row.DOSAGE),
                                                                    this.GetStringValue(row.DOSAGE_UNITS),
                                                                    this.GetDoubleValue(row.CONCENTRATION),
                                                                    this.GetStringValue(row.CONCENTRATION_UNIT),
                                                                    this.GetStringValue(row.ADMINISTRATOR),
                                                                    dt,
                                                                    this.GetDoubleValue(row.PERFORM_SPEED),
                                                                    this.GetStringValue(row.SPEED_UNIT), pointType);
                                point.IsArrow = isArrow;
                                _drugRows.Add(point, row);
                            }
                        });

                        control.Curves.Add(curve);
                    }
                }
            }
        }
Esempio n. 4
0
        private void SetOperStatusEnable()
        {
            OperationStatus operSate       = OperationStatusHelper.OperationStatusFromString(ViewFlag);
            int             patStatuIndex  = OperationStatusHelper.GetOperStatusIndex(ExtendAppContext.Current.PatientInformationExtend.OPER_STATUS_CODE);
            int             curntEditIndex = OperationStatusHelper.GetOperStatusIndex((int)operSate);

            //当前编辑已填写的状态的时间
            if (patStatuIndex > curntEditIndex)
            {
                visibIndex = patStatuIndex;
            }
            //编辑新的状态时间
            else
            {
                visibIndex     = curntEditIndex;
                operStatusCode = (int)operSate;
            }
            StepIndex       = visibIndex - 1;
            curntStatusCode = (int)operSate;

            enableIndex = curntEditIndex;


            switch (visibIndex)
            {
            case 1:
                InRoomVisible = Visibility.Visible;
                InRoomFinish  = true;
                break;

            case 2:
                InRoomVisible    = Visibility.Visible;
                AnesStartVisible = Visibility.Visible;
                InRoomFinish     = true;
                AnesStartFinish  = true;
                break;

            case 3:
                InRoomVisible    = Visibility.Visible;
                AnesStartVisible = Visibility.Visible;
                OperStartVisible = Visibility.Visible;
                InRoomFinish     = true;
                AnesStartFinish  = true;
                OperStartFinish  = true;
                break;

            case 4:
                InRoomVisible    = Visibility.Visible;
                AnesStartVisible = Visibility.Visible;
                OperStartVisible = Visibility.Visible;
                OperEndVisible   = Visibility.Visible;
                InRoomFinish     = true;
                AnesStartFinish  = true;
                OperStartFinish  = true;
                OperEndFinish    = true;
                break;

            case 5:
                InRoomVisible    = Visibility.Visible;
                AnesStartVisible = Visibility.Visible;
                OperStartVisible = Visibility.Visible;
                OperEndVisible   = Visibility.Visible;
                AnesEndVisible   = Visibility.Visible;
                InRoomFinish     = true;
                AnesStartFinish  = true;
                OperStartFinish  = true;
                OperEndFinish    = true;
                AnesEndFinish    = true;
                break;

            case 6:
                InRoomVisible    = Visibility.Visible;
                AnesStartVisible = Visibility.Visible;
                OperStartVisible = Visibility.Visible;
                OperEndVisible   = Visibility.Visible;
                AnesEndVisible   = Visibility.Visible;
                OutRoomVisible   = Visibility.Visible;
                InRoomFinish     = true;
                AnesStartFinish  = true;
                OperStartFinish  = true;
                OperEndFinish    = true;
                AnesEndFinish    = true;
                OutRoomFinish    = true;
                break;
            }

            switch (enableIndex)
            {
            case 1:
                InRoomEnable      = true;
                InRoomBackVisible = Visibility.Visible;
                InRoomFinish      = false;
                break;

            case 2:
                AnesStartEnable      = true;
                AnesStartBackVisible = Visibility.Visible;
                AnesStartFinish      = false;
                break;

            case 3:
                OperStartEnable      = true;
                OperStartBackVisible = Visibility.Visible;
                OperStartFinish      = false;
                break;

            case 4:
                OperEndEnable      = true;
                OperEndBackVisible = Visibility.Visible;
                OperEndFinish      = false;
                break;

            case 5:
                AnesEndEnable      = true;
                AnesEndBackVisible = Visibility.Visible;
                AnesEndFinish      = false;
                break;

            case 6:
                OutRoomEnable      = true;
                OutRoomBackVisible = Visibility.Visible;
                OutRoomFinish      = false;
                break;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 注册命令
        /// </summary>
        public void RegisterMessage()
        {
            Messenger.Default.Register <object>(this, EnumMessageKey.ChangeDateRegister, msg =>
            {
                if (null != msg && !string.IsNullOrEmpty(msg.ToString()) && this.CheckData())
                {
                    this.SaveData();
                    ViewFlag = msg.ToString();

                    // 执行的手术时间必须是按顺序
                    // 当前手术状态
                    OperationStatus curOperStatus  = (OperationStatus)_masterRow.OPER_STATUS_CODE;
                    OperationStatus nextOperStatus = OperationStatus.None;

                    // 目标状态
                    OperationStatus targetOperStatus = OperationStatusHelper.OperationStatusFromString(ViewFlag);

                    if (curOperStatus >= targetOperStatus)
                    {
                    }
                    else
                    {
                        switch (curOperStatus)
                        {
                        case OperationStatus.InOperationRoom:
                            nextOperStatus = OperationStatus.AnesthesiaStart;
                            break;

                        case OperationStatus.AnesthesiaStart:
                            nextOperStatus = OperationStatus.OperationStart;
                            break;

                        case OperationStatus.OperationStart:
                            nextOperStatus = OperationStatus.OperationEnd;
                            break;

                        case OperationStatus.OperationEnd:
                            nextOperStatus = OperationStatus.AnesthesiaEnd;
                            break;

                        case OperationStatus.AnesthesiaEnd:
                            nextOperStatus = OperationStatus.OutOperationRoom;
                            break;
                        }

                        if (nextOperStatus == OperationStatus.None || nextOperStatus != targetOperStatus)
                        {
                            this.ShowMessageBox("请按流程顺序操作!", MessageBoxButton.OK, MessageBoxImage.Warning);
                            return;
                        }
                        else if (nextOperStatus == targetOperStatus &&
                                 nextOperStatus == OperationStatus.OutOperationRoom)
                        {
                            this.Result = true;
                            this.CloseContentWindow();
                        }
                    }

                    this.InRoomVisible     = Visibility.Collapsed;
                    this.InRoomBackVisible = Visibility.Collapsed;
                    this.InRoomEnable      = false;
                    this.InRoomFinish      = false;

                    this.AnesStartVisible     = Visibility.Collapsed;
                    this.AnesStartBackVisible = Visibility.Collapsed;
                    this.AnesStartEnable      = false;
                    this.AnesStartFinish      = false;

                    this.OperStartVisible     = Visibility.Collapsed;
                    this.OperStartBackVisible = Visibility.Collapsed;
                    this.OperStartEnable      = false;
                    this.OperStartFinish      = false;

                    this.OperEndVisible     = Visibility.Collapsed;
                    this.OperEndBackVisible = Visibility.Collapsed;
                    this.OperEndEnable      = false;
                    this.OperEndFinish      = false;

                    this.AnesEndVisible     = Visibility.Collapsed;
                    this.AnesEndBackVisible = Visibility.Collapsed;
                    this.AnesEndEnable      = false;
                    this.AnesEndFinish      = false;

                    this.OutRoomVisible     = Visibility.Collapsed;
                    this.OutRoomBackVisible = Visibility.Collapsed;
                    this.OutRoomEnable      = false;
                    this.OutRoomFinish      = false;
                    this.LoadData();
                    Messenger.Default.Send <object>(true, EnumMessageKey.RefreshDateRegisterFocus);
                }
            });
        }