コード例 #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);
 }
コード例 #2
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);
                    }
                }
            }
        }