Пример #1
0
        /// <summary>
        /// 绑定数据源数据到控件
        /// </summary>
        public override void BindDataToUI(MedAnesSheetDetails control, Dictionary <string, System.Data.DataTable> dataSources)
        {
            if (!dataSources.ContainsKey("AnesthesiaEvent"))
            {
                throw new NotImplementedException(string.Format("在数据源中未找到名为{0}的表AnesInformations.AnesthesiaEventDataTable,请添加此绑定数据源!", "AnesthesiaEvent"));
            }

            if (!dataSources.ContainsKey("MED_OPERATION_MASTER"))
            {
                throw new NotImplementedException(string.Format("在数据源中未找到名为{0}的表AnesInformations.OperationMasterDataTable,请添加此绑定数据源!", "MED_OPERATION_MASTER"));
            }

            // 获取事件表和主表数据
            List <MED_ANESTHESIA_EVENT> anesEventTable  = new ModelHandler <MED_ANESTHESIA_EVENT>().FillModel(dataSources["AnesthesiaEvent"]);
            MED_OPERATION_MASTER        operationMaster = new ModelHandler <MED_OPERATION_MASTER>().FillModel(dataSources["MED_OPERATION_MASTER"].Rows[0]);

            // 设置明细栏的起始和结束时间
            if (PagerSetting.PageTimeSpan.StartDateTime != DateTime.MinValue)
            {
                control.StartTime = PagerSetting.PageTimeSpan.StartDateTime;
                control.EndTime   = PagerSetting.PageTimeSpan.EndDateTime;
            }

            // 清空之前的数据
            control.Collections.Clear();

            // 明细分组显示
            if (control.Group)
            {
                MedAnesSheetDetailCollection collection;
                // 显示事件信息
                if (control.HasEvent)
                {
                    List <AnesClassType> anesClassList = new List <AnesClassType>();
                    anesClassList.Add(AnesClassType.Event);
                    // 是否显示插管
                    if (control.HasZhiGuan)
                    {
                        anesClassList.Add(AnesClassType.PutPipe);
                        anesClassList.Add(AnesClassType.PullPipe);
                    }

                    // 是否显示附记
                    if (control.HasFuji)
                    {
                        anesClassList.Add(AnesClassType.ECG);
                    }

                    // 默认必须显示出量和事件
                    anesClassList.Add(AnesClassType.OutLiquid);
                    AnesClassType[] anesClasses = anesClassList.ToArray();
                    collection = this.GenDetailCollection(anesEventTable, anesClasses, "事件", CollectionType.Event,
                                                          control.StartTime, null, AnesDrugShowType.Total, false, operationMaster);
                    control.Collections.Add(collection);
                    if (collection != null)
                    {
                        collection.Color = control.EventColor;
                    }
                }

                // 是否显示麻药
                if (control.HasAnesDrug)
                {
                    collection = this.AddAnesSheetDetailCollection(control, anesEventTable, AnesClassType.AnesDrug,
                                                                   "麻药", CollectionType.Drug, control.AnesDrugColor,
                                                                   control.StartTime, control.AnesDrugShowType, false, operationMaster);
                }

                // 默认显示用药信息
                this.AddAnesSheetDetailCollection(control, anesEventTable, AnesClassType.Drug, "用药",
                                                  CollectionType.Drug, control.DrugColor, control.StartTime, false, operationMaster);
                // 是否要输血输液
                if (control.HasLiquid)
                {
                    //modified by joysola on 2018-3-6 当输血一行的时候,不用在事件栏里显示
                    if (ApplicationConfiguration.PassedInLiquidInBloodFormat.Equals("BloodInOne"))
                    {
                        collection = this.GenDetailCollection(anesEventTable, new AnesClassType[] { AnesClassType.InLiquid },
                                                              "输液", CollectionType.Drug, control.StartTime, null,
                                                              AnesDrugShowType.Total, false, operationMaster);
                    }
                    else
                    {
                        collection = this.GenDetailCollection(anesEventTable, new AnesClassType[] { AnesClassType.InBlood, AnesClassType.InLiquid },
                                                              "输液和输血", CollectionType.Drug, control.StartTime, null,
                                                              AnesDrugShowType.Total, false, operationMaster);
                    }
                    if (collection != null)
                    {
                        collection.Color = control.InLiquidColor;
                        control.Collections.Add(collection);
                    }
                }

                // 列表信息时间排序
                if (control.IsTimeOrder)
                {
                    MedAnesSheetDetailCollection collection99 = new MedAnesSheetDetailCollection("事件");
                    for (int i = control.Collections.Count - 1; i >= 0; i--)
                    {
                        MedAnesSheetDetailCollection cl = control.Collections[i];
                        collection99.Add(cl);
                        control.Collections.Remove(cl);
                    }

                    collection99.Sort();
                    for (int i = collection99.Points.Count - 1; i >= 0; i--)
                    {
                        collection99.Points[i].Index = i + 1;
                    }

                    control.Collections.Add(collection99);
                }
                else
                {
                    for (int i = control.Collections.Count - 1; i >= 0; i--)
                    {
                        MedAnesSheetDetailCollection cl = control.Collections[i];
                        if (cl != null && cl.Points != null)
                        {
                            for (int j = cl.Points.Count - 1; j >= 0; j--)
                            {
                                cl.Points[j].Color = cl.Color;
                            }
                        }
                    }
                }
            }
            else
            {
                // 不分组显示
                MedAnesSheetDetailCollection collection00 = null;
                List <AnesClassType>         types        = new List <AnesClassType>();
                foreach (int enumValue in Enum.GetValues(typeof(AnesClassType)))
                {
                    types.Add((AnesClassType)enumValue);
                }

                types.Remove(AnesClassType.Breath);
                types.Remove(AnesClassType.ControlBreath);
                types.Remove(AnesClassType.AssistBreath);
                types.Remove(AnesClassType.DataModify);

                // 是否显示事件
                if (!control.HasEvent)
                {
                    types.Remove(AnesClassType.Event);
                }
                // 是否显示插管
                if (!control.HasZhiGuan)
                {
                    types.Remove(AnesClassType.PutPipe);
                    types.Remove(AnesClassType.PullPipe);
                }
                // 是否显示附记
                if (!control.HasFuji)
                {
                    types.Add(AnesClassType.ECG);
                }
                // 是否要输血输液
                if (!control.HasLiquid)
                {
                    types.Remove(AnesClassType.InBlood);
                    types.Remove(AnesClassType.InLiquid);
                }
                // 是否显示麻药
                if (control.HasAnesDrug)
                {
                    collection00 = this.AddAnesSheetDetailCollection(control, anesEventTable, types.ToArray(), "事件",
                                                                     CollectionType.Event, control.EventColor, control.StartTime, null,
                                                                     AnesDrugShowType.Total, false, operationMaster);
                }
                else
                {
                    types.Remove(AnesClassType.AnesDrug);
                    collection00 = this.AddAnesSheetDetailCollection(control, anesEventTable, types.ToArray(), "事件",
                                                                     CollectionType.Event, control.EventColor, control.StartTime,
                                                                     GetAnesClassTypeString(AnesClassType.AnesDrug), AnesDrugShowType.Total,
                                                                     false, operationMaster);
                }

                if (collection00 != null)
                {
                    collection00.Color = control.EventColor;
                }
            }

            // 获取用药图表控件,去掉重复的药
            MedDrugGraph drugGraph = null;

            foreach (IUIElementHandler handler in MedicalPaperUIElementHandlers)
            {
                if (handler.GetControlType == typeof(MedDrugGraph) && handler.GetCurrentControl != null)
                {
                    drugGraph = handler.GetCurrentControl as MedDrugGraph;
                    break;
                }
            }

            if (drugGraph != null)
            {
                for (int i = 0; i < drugGraph.Curves.Count; i++)
                {
                    foreach (MedAnesSheetDetailCollection collect in control.Collections)
                    {
                        MedAnesSheetDetailPoint point = null;
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point = collect.Points[ii];
                            if (point.Text.ToLower() == drugGraph.Curves[i].Text.ToLower())
                            {
                                collect.Points.Remove(point);
                                ii = ii - 1;
                            }
                        }

                        // 重新给序号
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point       = collect.Points[ii];
                            point.Index = ii + 1;
                        }
                    }
                }
            }

            // 获取索引表格控件,去掉重复的输血输液
            MedGridGraph gridGraph = null;

            foreach (IUIElementHandler handler in MedicalPaperUIElementHandlers)
            {
                if (handler.GetControlType == typeof(MedGridGraph) && handler.GetCurrentControl != null)
                {
                    gridGraph = handler.GetCurrentControl as MedGridGraph;
                    break;
                }
            }

            if (gridGraph != null)
            {
                for (int i = 0; i < gridGraph.Rows.Count; i++)
                {
                    foreach (MedAnesSheetDetailCollection collect in control.Collections)
                    {
                        MedAnesSheetDetailPoint point = null;
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point = collect.Points[ii];
                            if (point.Text.ToLower() == gridGraph.Rows[i].Text.ToLower())
                            {
                                collect.Points.Remove(point);
                                ii = ii - 1;
                            }
                        }

                        //重新给序号
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point       = collect.Points[ii];
                            point.Index = ii + 1;
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 绑定数据源数据到控件
        /// </summary>
        /// <param name="control"></param>
        /// <param name="dataSources"></param>
        public override void BindDataToUI(MedAnesSheetDetails control, Dictionary <string, System.Data.DataTable> dataSources)
        {
            if (!dataSources.ContainsKey("AnesthesiaEvent"))
            {
                throw new NotImplementedException(string.Format("在数据源中未找到名为{0}的表AnesInformations.AnesthesiaEventDataTable,请添加此绑定数据源!", "AnesthesiaEvent"));
            }
            List <MED_ANESTHESIA_EVENT> anesEventTable = ModelHelper <MED_ANESTHESIA_EVENT> .ConvertDataTableToList(dataSources["AnesthesiaEvent"]);

            if (!dataSources.ContainsKey("MED_OPERATION_MASTER"))
            {
                throw new NotImplementedException(string.Format("在数据源中未找到名为{0}的表AnesInformations.OperationMasterDataTable,请添加此绑定数据源!", "MED_OPERATION_MASTER"));
            }
            // MED_OPERATION_MASTER operationMaster = ModelHelper<MED_OPERATION_MASTER>.ConvertDataRowToSingle(dataSources["MED_OPERATION_MASTER"].Rows[0]);
            MED_OPERATION_MASTER operationMaster = ModelHelper <MED_OPERATION_MASTER> .ConvertDataTableToList(dataSources["MED_OPERATION_MASTER"])[0];

            if (PagerSetting.PageTimeSpan.StartDateTime != DateTime.MinValue)
            {
                control.StartTime = PagerSetting.PageTimeSpan.StartDateTime;
                control.EndTime   = PagerSetting.PageTimeSpan.EndDateTime;
            }


            control.Collections.Clear();

            if (control.Group)
            {
                MedAnesSheetDetailCollection collection;
                if (control.HasEvent)
                {
                    List <AnesClassType> anesClassList = new List <AnesClassType>();
                    anesClassList.Add(AnesClassType.Event);
                    if (control.HasZhiGuan)
                    {
                        anesClassList.Add(AnesClassType.PutPipe);
                        anesClassList.Add(AnesClassType.PullPipe);
                    }
                    if (control.HasFuji)
                    {
                        anesClassList.Add(AnesClassType.ECG);
                    }
                    AnesClassType[] anesClasses = anesClassList.ToArray();
                    collection = GenDetailCollection(anesEventTable, anesClasses, "事件", CollectionType.Event, control.StartTime, null, AnesDrugShowType.Total, false, operationMaster);
                    control.Collections.Add(collection);
                    if (collection != null)
                    {
                        collection.Color = control.EventColor;
                    }
                }
                if (control.HasAnesDrug)
                {
                    // collection = AddAnesSheetDetailCollection(control, anesEventTable, AnesClassType.AnesDrug, "诱导", CollectionType.Drug, ApplicationConfiguration.YouDaoColor, control.StartTime, control.AnesDrugShowType, true, operationMaster);
                    collection = AddAnesSheetDetailCollection(control, anesEventTable, AnesClassType.AnesDrug, "麻药", CollectionType.Drug, control.AnesDrugColor, control.StartTime, control.AnesDrugShowType, false, operationMaster);
                }
                AddAnesSheetDetailCollection(control, anesEventTable, AnesClassType.Drug, "用药", CollectionType.Drug, control.DrugColor, control.StartTime, false, operationMaster);
                if (control.HasLiquid)
                {
                    collection = GenDetailCollection(anesEventTable, new AnesClassType[] { AnesClassType.InBlood, AnesClassType.InLiquid }, "输液和输血", CollectionType.Drug, control.StartTime, null, AnesDrugShowType.Total, false, operationMaster);
                    if (collection != null)
                    {
                        collection.Color = control.InLiquidColor;
                        control.Collections.Add(collection);
                    }
                }

                if (control.IsTimeOrder)
                {
                    MedAnesSheetDetailCollection collection99 = new MedAnesSheetDetailCollection("事件");
                    for (int i = control.Collections.Count - 1; i >= 0; i--)
                    {
                        MedAnesSheetDetailCollection cl = control.Collections[i];
                        collection99.Add(cl);
                        control.Collections.Remove(cl);
                    }
                    collection99.Sort();
                    for (int i = collection99.Points.Count - 1; i >= 0; i--)
                    {
                        collection99.Points[i].Index = i + 1;
                    }
                    control.Collections.Add(collection99);
                }
                else
                {
                    for (int i = control.Collections.Count - 1; i >= 0; i--)
                    {
                        MedAnesSheetDetailCollection cl = control.Collections[i];
                        if (cl != null && cl.Points != null)
                        {
                            for (int j = cl.Points.Count - 1; j >= 0; j--)
                            {
                                cl.Points[j].Color = cl.Color;
                            }
                        }
                    }
                }
            }
            else
            {
                List <AnesClassType> types = new List <AnesClassType>();


                foreach (int enumValue in Enum.GetValues(typeof(AnesClassType)))
                {
                    types.Add((AnesClassType)enumValue);
                }

                types.Remove(AnesClassType.DataModify);
                if (!control.HasEvent)
                {
                    types.Remove(AnesClassType.Event);
                }
                if (!control.HasZhiGuan)
                {
                    types.Remove(AnesClassType.PutPipe);

                    types.Remove(AnesClassType.PullPipe);
                }
                if (!control.HasAnesDrug)
                {
                    types.Remove(AnesClassType.AnesDrug);
                }


                if (!control.HasFuji)
                {
                    types.Add(AnesClassType.ECG);
                }
                if (!control.HasLiquid)
                {
                    types.Remove(AnesClassType.InBlood);
                    types.Remove(AnesClassType.InLiquid);
                }


                MedAnesSheetDetailCollection collection00 = null;
                if (control.HasAnesDrug)
                {
                    collection00 = AddAnesSheetDetailCollection(control, anesEventTable, types.ToArray(), "事件", CollectionType.Event, control.EventColor, control.StartTime, null, AnesDrugShowType.Total, false, operationMaster);
                }
                else
                {
                    collection00 = AddAnesSheetDetailCollection(control, anesEventTable, types.ToArray(), "事件", CollectionType.Event, control.EventColor, control.StartTime, GetAnesClassTypeString(AnesClassType.AnesDrug), AnesDrugShowType.Total, false, operationMaster);
                }
                if (collection00 != null)
                {
                    collection00.Color = control.EventColor;
                }
            }

            //去掉重复的药
            MedDrugGraph drugGraph = null;//GetAnesGraph<MedDrugGraph>();

            foreach (IUIElementHandler handler in MedicalPaperUIElementHandlers)
            {
                if (handler.GetControlType == typeof(MedDrugGraph) && handler.GetCurrentControl != null)
                {
                    drugGraph = handler.GetCurrentControl as MedDrugGraph;
                }
            }

            if (drugGraph != null)
            {
                for (int i = 0; i < drugGraph.Curves.Count; i++)
                {
                    foreach (MedAnesSheetDetailCollection collect in control.Collections)
                    {
                        MedAnesSheetDetailPoint point = null;
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point = collect.Points[ii];
                            if (point.Text.ToLower() == drugGraph.Curves[i].Text.ToLower())
                            {
                                collect.Points.Remove(point);
                                ii = ii - 1;
                                // continue;
                            }
                        }
                        //重新给序号
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point       = collect.Points[ii];
                            point.Index = ii + 1;
                        }
                    }
                }
            }



            //}

            //去掉重复的输血输液
            MedGridGraph gridGraph = null;// GetAnesGraph<MedGridGraph>();

            foreach (IUIElementHandler handler in MedicalPaperUIElementHandlers)
            {
                if (handler.GetControlType == typeof(MedGridGraph) && handler.GetCurrentControl != null)
                {
                    gridGraph = handler.GetCurrentControl as MedGridGraph;
                }
            }
            if (gridGraph != null)
            {
                for (int i = 0; i < gridGraph.Rows.Count; i++)
                {
                    foreach (MedAnesSheetDetailCollection collect in control.Collections)
                    {
                        MedAnesSheetDetailPoint point = null;
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point = collect.Points[ii];
                            if (point.Text.ToLower() == gridGraph.Rows[i].Text.ToLower())
                            {
                                collect.Points.Remove(point);
                                ii = ii - 1;
                            }
                        }
                        //重新给序号
                        for (int ii = 0; ii < collect.Points.Count; ii++)
                        {
                            point       = collect.Points[ii];
                            point.Index = ii + 1;
                        }
                    }
                }
            }
        }