//输出用于图形的风险划分
        public static List<GuideList> GetBPGuide(DataConnection pclsCache, string PlanNo, string ItemType, List<MstBloodPressure> Reference)
        {
            List<GuideList> result = new List<GuideList>();
            GuideList SysGuides = new GuideList();
            SysGuides.minimum = Convert.ToDouble(Reference[0].SBP);
            //SysGuides.maximum = Reference[Reference.Count-1].SBP.ToString();
            SysGuides.maximum = Convert.ToDouble(Reference[Reference.Count - 1].SBP);

            GuideList DiaGuides = new GuideList();
            //DiaGuides.minimum = Reference[0].DBP.ToString();
            //DiaGuides.maximum = Reference[Reference.Count - 1].DBP.ToString();
            DiaGuides.minimum = Convert.ToDouble(Reference[0].DBP);
            DiaGuides.maximum = Convert.ToDouble(Reference[Reference.Count - 1].DBP);

            List<Guide> SysGuideList = new List<Guide>();
            List<Guide> DiaGuideList = new List<Guide>();

            try
            {
                //收缩压

                InterSystems.Data.CacheTypes.CacheSysList SysTarget = null;
                SysTarget = PsTarget.GetTargetByCode(pclsCache, PlanNo, "Bloodpressure", "Bloodpressure_1");

                if (SysTarget != null)
                {
                    //初始值
                    Guide originalGuide = new Guide();
                    originalGuide.value = SysTarget[4].ToString(); //值或起始值
                    originalGuide.toValue = "#CC0000";           //终值或""
                    originalGuide.label = "";      //中文定义 目标线、偏低、偏高等
                    //originalGuide.label = "起始" + ":" + originalGuide.value;
                    originalGuide.lineColor = "#FF5151";          //直线颜色  目标线  初始线
                    originalGuide.lineAlpha = "1";//直线透明度 0全透~1
                    originalGuide.dashLength = "8"; //虚线密度  4  8
                    originalGuide.color = "#CC0000";    //字体颜色
                    originalGuide.fontSize = "8"; //字体大小  默认14
                    originalGuide.position = "right"; //字体位置 right left
                    originalGuide.inside = "";//坐标系的内或外  false
                    originalGuide.fillAlpha = "";
                    originalGuide.fillColor = "";
                    SysGuideList.Add(originalGuide);
                    SysGuides.original = originalGuide.value;

                    //目标值
                    Guide tagetGuide = new Guide();
                    tagetGuide.value = SysTarget[3].ToString();
                    tagetGuide.toValue = "#CC0000";
                    tagetGuide.label = "";
                    //tagetGuide.label = "目标" + ":" + tagetGuide.value;
                    tagetGuide.lineColor = "#CC0000";
                    tagetGuide.lineAlpha = "1";
                    tagetGuide.dashLength = "4";
                    tagetGuide.color = "#CC0000";
                    tagetGuide.fontSize = "14";
                    tagetGuide.position = "right";
                    tagetGuide.inside = "";

                    tagetGuide.fillAlpha = "";
                    tagetGuide.fillColor = "";
                    SysGuideList.Add(tagetGuide);
                    SysGuides.target = tagetGuide.value;
                }

                //舒张压

                InterSystems.Data.CacheTypes.CacheSysList DiaTarget = null;
                DiaTarget = PsTarget.GetTargetByCode(pclsCache, PlanNo, "Bloodpressure", "Bloodpressure_2");

                if (DiaTarget != null)
                {
                    //初始值
                    Guide originalGuide = new Guide();
                    originalGuide.value = DiaTarget[4].ToString(); //值或起始值
                    originalGuide.toValue = "#CC0000";           //终值或""
                    originalGuide.label = "";      //中文定义 目标线、偏低、偏高等
                    //originalGuide.label = "起始" + ":" + originalGuide.value;
                    originalGuide.lineColor = "#FF5151";          //直线颜色  目标线  初始线
                    originalGuide.lineAlpha = "1";//直线透明度 0全透~1
                    originalGuide.dashLength = "8"; //虚线密度  4  8
                    originalGuide.color = "#CC0000";    //字体颜色
                    originalGuide.fontSize = "8"; //字体大小  默认14
                    originalGuide.position = "right"; //字体位置 right left
                    originalGuide.inside = "";//坐标系的内或外  false

                    originalGuide.fillAlpha = "";
                    originalGuide.fillColor = "";
                    DiaGuideList.Add(originalGuide);
                    DiaGuides.original = originalGuide.value;

                    //目标值
                    Guide tagetGuide = new Guide();
                    tagetGuide.value = DiaTarget[3].ToString();
                    tagetGuide.toValue = "#CC0000";
                    tagetGuide.label = "";
                    //tagetGuide.label = "目标" + ":" + tagetGuide.value;
                    tagetGuide.lineColor = "#CC0000";
                    tagetGuide.lineAlpha = "1";
                    tagetGuide.dashLength = "4";
                    tagetGuide.color = "#CC0000";
                    tagetGuide.fontSize = "14";
                    tagetGuide.position = "right";
                    tagetGuide.inside = "";

                    tagetGuide.fillColor = "";
                    tagetGuide.fillAlpha = "";
                    DiaGuideList.Add(tagetGuide);
                    DiaGuides.target = tagetGuide.value;
                }

                //风险范围
                for (int i = 0; i <= Reference.Count - 2; i++)
                {
                    //收缩压
                    Guide SysGuide = new Guide();
                    SysGuide.value = Reference[i].SBP.ToString(); //起始值
                    SysGuide.toValue = Reference[i + 1].SBP.ToString();                //终值
                    SysGuide.label = Reference[i].Name;          //偏低、偏高等
                    SysGuide.lineColor = "";     //直线颜色  目标线  初始线
                    SysGuide.lineAlpha = "";   //直线透明度 0全透~1
                    SysGuide.dashLength = "";  //虚线密度  4  8
                    SysGuide.color = "#CC0000";     //字体颜色
                    SysGuide.fontSize = "14";   //字体大小  默认14
                    SysGuide.position = "right";    //字体位置 right left
                    SysGuide.inside = "true";      //坐标系的内或外  false
                    SysGuide.fillAlpha = "0.1";
                    SysGuide.fillColor = CmMstBloodPressure.GetFillColor(SysGuide.label);   //GetFillColor
                    SysGuideList.Add(SysGuide);

                    //舒张压
                    Guide DiaGuide = new Guide();
                    DiaGuide.value = Reference[i].DBP.ToString();
                    DiaGuide.toValue = Reference[i + 1].DBP.ToString();
                    DiaGuide.label = Reference[i].Name;
                    DiaGuide.lineColor = "";
                    DiaGuide.lineAlpha = "";
                    DiaGuide.dashLength = "";
                    DiaGuide.color = "#CC0000";
                    DiaGuide.fontSize = "14";
                    DiaGuide.position = "right";
                    DiaGuide.inside = "true";
                    DiaGuide.fillAlpha = "0.1";
                    DiaGuide.fillColor = CmMstBloodPressure.GetFillColor(DiaGuide.label);
                    DiaGuideList.Add(DiaGuide);

                }

                //一般线
                for (int i = 0; i <= Reference.Count - 1; i++)
                {
                    //收缩压
                    Guide SysGuide = new Guide();
                    SysGuide.value = Reference[i].SBP.ToString();
                    SysGuide.toValue = "#CC0000";
                    SysGuide.label = Reference[i].SBP.ToString();
                    SysGuide.lineColor = "#CC0000";
                    SysGuide.lineAlpha = "0.15";
                    SysGuide.dashLength = "";
                    SysGuide.color = "#CC0000";
                    SysGuide.fontSize = "8";
                    SysGuide.position = "left";
                    SysGuide.inside = "";
                    SysGuide.fillAlpha = "";
                    SysGuide.fillColor = "";
                    SysGuideList.Add(SysGuide);

                    //舒张压
                    Guide DiaGuide = new Guide();
                    DiaGuide.value = Reference[i].DBP.ToString();
                    DiaGuide.toValue = "#CC0000";
                    DiaGuide.label = Reference[i].DBP.ToString();
                    DiaGuide.lineColor = "#CC0000";
                    DiaGuide.lineAlpha = "0.15";
                    DiaGuide.dashLength = "";
                    DiaGuide.color = "#CC0000";
                    DiaGuide.fontSize = "8";
                    DiaGuide.position = "left";
                    DiaGuide.inside = "";
                    DiaGuide.fillAlpha = "";
                    DiaGuide.fillColor = "";
                    DiaGuideList.Add(DiaGuide);

                }

                SysGuides.Guides = SysGuideList;
                DiaGuides.Guides = DiaGuideList;

                result.Add(SysGuides);
                result.Add(DiaGuides);

                return result;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstBloodPressure.GetBPGuide", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {
            }
        }
        //GetGuidesByCode LS 2015-06-28 输出用于图形的分级区域
        public static GraphGuide GetGuidesByCode(DataConnection pclsCache, string PlanNo, string Code, List<MstBloodPressure> Reference)
        {

            GraphGuide GraphGuide = new GraphGuide();   //输出

            List<Guide> GuideList = new List<Guide>();


            try
            {


                if ((Code == "Bloodpressure|Bloodpressure_1") && (Reference != null))
                {
                    #region 收缩压

                    GraphGuide.minimum = Convert.ToDouble(Reference[0].SBP);
                    GraphGuide.maximum = Convert.ToDouble(Reference[Reference.Count - 1].SBP);

                    InterSystems.Data.CacheTypes.CacheSysList SysTarget = null;
                    SysTarget = PsTarget.GetTargetByCode(pclsCache, PlanNo, "Bloodpressure", "Bloodpressure_1");
                    if (SysTarget != null)
                    {
                        //初始值
                        Guide originalGuide = new Guide();
                        originalGuide.value = SysTarget[4].ToString(); //值或起始值
                        originalGuide.toValue = "#CC0000";           //终值或""
                        originalGuide.label = "";      //中文定义 目标线、偏低、偏高等
                        //originalGuide.label = "起始" + ":" + originalGuide.value;
                        originalGuide.lineColor = "#FF5151";          //直线颜色  目标线  初始线
                        originalGuide.lineAlpha = "1";//直线透明度 0全透~1
                        originalGuide.dashLength = "8"; //虚线密度  4  8
                        originalGuide.color = "#CC0000";    //字体颜色
                        originalGuide.fontSize = "8"; //字体大小  默认14
                        originalGuide.position = "right"; //字体位置 right left
                        originalGuide.inside = "";//坐标系的内或外  false
                        originalGuide.fillAlpha = "";
                        originalGuide.fillColor = "";

                        GuideList.Add(originalGuide);
                        GraphGuide.original = originalGuide.value + "mmHg";


                        //目标值
                        Guide tagetGuide = new Guide();
                        tagetGuide.value = SysTarget[3].ToString();
                        tagetGuide.toValue = "#CC0000";
                        tagetGuide.label = "";
                        //tagetGuide.label = "目标" + ":" + tagetGuide.value;
                        tagetGuide.lineColor = "#CC0000";
                        tagetGuide.lineAlpha = "1";
                        tagetGuide.dashLength = "4";
                        tagetGuide.color = "#CC0000";
                        tagetGuide.fontSize = "14";
                        tagetGuide.position = "right";
                        tagetGuide.inside = "";
                        tagetGuide.fillAlpha = "";
                        tagetGuide.fillColor = "";

                        GuideList.Add(tagetGuide);
                        GraphGuide.target = tagetGuide.value + "mmHg";
                    }

                    //风险范围
                    for (int i = 0; i <= Reference.Count - 2; i++)
                    {
                        //收缩压
                        Guide SysGuide = new Guide();
                        SysGuide.value = Reference[i].SBP.ToString(); //起始值
                        SysGuide.toValue = Reference[i + 1].SBP.ToString();                //终值
                        SysGuide.label = Reference[i].Name;          //偏低、偏高等
                        SysGuide.lineColor = "";     //直线颜色  目标线  初始线
                        SysGuide.lineAlpha = "";   //直线透明度 0全透~1
                        SysGuide.dashLength = "";  //虚线密度  4  8
                        SysGuide.color = "#CC0000";     //字体颜色
                        SysGuide.fontSize = "14";   //字体大小  默认14
                        SysGuide.position = "right";    //字体位置 right left
                        SysGuide.inside = "true";      //坐标系的内或外  false
                        SysGuide.fillAlpha = "0.1";
                        SysGuide.fillColor = CmMstBloodPressure.GetBPColor(SysGuide.label, "fill");   //GetFillColor
                        GuideList.Add(SysGuide);

                    }

                    //一般线
                    for (int i = 0; i <= Reference.Count - 1; i++)
                    {
                        //收缩压
                        Guide SysGuide = new Guide();
                        SysGuide.value = Reference[i].SBP.ToString();
                        SysGuide.toValue = "#CC0000";
                        SysGuide.label = Reference[i].SBP.ToString();
                        SysGuide.lineColor = "#CC0000";
                        SysGuide.lineAlpha = "0.15";
                        SysGuide.dashLength = "";
                        SysGuide.color = "#CC0000";
                        SysGuide.fontSize = "8";
                        SysGuide.position = "left";
                        SysGuide.inside = "";
                        SysGuide.fillAlpha = "";
                        SysGuide.fillColor = "";
                        GuideList.Add(SysGuide);

                    }

                    #endregion
                }
                else if ((Code == "Bloodpressure|Bloodpressure_2") && (Reference != null))
                {
                    #region 舒张压
                    GraphGuide.minimum = Convert.ToDouble(Reference[0].DBP);
                    GraphGuide.maximum = Convert.ToDouble(Reference[Reference.Count - 1].DBP);

                    InterSystems.Data.CacheTypes.CacheSysList DiaTarget = null;
                    DiaTarget = PsTarget.GetTargetByCode(pclsCache, PlanNo, "Bloodpressure", "Bloodpressure_2");

                    if (DiaTarget != null)
                    {
                        //初始值
                        Guide originalGuide = new Guide();
                        originalGuide.value = DiaTarget[4].ToString(); //值或起始值
                        originalGuide.toValue = "#CC0000";           //终值或""
                        originalGuide.label = "";      //中文定义 目标线、偏低、偏高等
                        //originalGuide.label = "起始" + ":" + originalGuide.value;
                        originalGuide.lineColor = "#FF5151";          //直线颜色  目标线  初始线
                        originalGuide.lineAlpha = "1";//直线透明度 0全透~1
                        originalGuide.dashLength = "8"; //虚线密度  4  8
                        originalGuide.color = "#CC0000";    //字体颜色
                        originalGuide.fontSize = "8"; //字体大小  默认14
                        originalGuide.position = "right"; //字体位置 right left
                        originalGuide.inside = "";//坐标系的内或外  false
                        originalGuide.fillAlpha = "";
                        originalGuide.fillColor = "";

                        GuideList.Add(originalGuide);
                        GraphGuide.original = originalGuide.value + "mmHg";

                        //目标值
                        Guide tagetGuide = new Guide();
                        tagetGuide.value = DiaTarget[3].ToString();
                        tagetGuide.toValue = "#CC0000";
                        tagetGuide.label = "";
                        //tagetGuide.label = "目标" + ":" + tagetGuide.value;
                        tagetGuide.lineColor = "#CC0000";
                        tagetGuide.lineAlpha = "1";
                        tagetGuide.dashLength = "4";
                        tagetGuide.color = "#CC0000";
                        tagetGuide.fontSize = "14";
                        tagetGuide.position = "right";
                        tagetGuide.inside = "";
                        tagetGuide.fillColor = "";
                        tagetGuide.fillAlpha = "";

                        GuideList.Add(tagetGuide);
                        GraphGuide.target = tagetGuide.value + "mmHg";
                    }

                    //风险范围
                    for (int i = 0; i <= Reference.Count - 2; i++)
                    {
                        //舒张压
                        Guide DiaGuide = new Guide();
                        DiaGuide.value = Reference[i].DBP.ToString();
                        DiaGuide.toValue = Reference[i + 1].DBP.ToString();
                        DiaGuide.label = Reference[i].Name;
                        DiaGuide.lineColor = "";
                        DiaGuide.lineAlpha = "";
                        DiaGuide.dashLength = "";
                        DiaGuide.color = "#CC0000";
                        DiaGuide.fontSize = "14";
                        DiaGuide.position = "right";
                        DiaGuide.inside = "true";
                        DiaGuide.fillAlpha = "0.1";
                        DiaGuide.fillColor = CmMstBloodPressure.GetBPColor(DiaGuide.label, "fill");

                        GuideList.Add(DiaGuide);

                    }

                    //一般线
                    for (int i = 0; i <= Reference.Count - 1; i++)
                    {
                        //舒张压
                        Guide DiaGuide = new Guide();
                        DiaGuide.value = Reference[i].DBP.ToString();
                        DiaGuide.toValue = "#CC0000";
                        DiaGuide.label = Reference[i].DBP.ToString();
                        DiaGuide.lineColor = "#CC0000";
                        DiaGuide.lineAlpha = "0.15";
                        DiaGuide.dashLength = "";
                        DiaGuide.color = "#CC0000";
                        DiaGuide.fontSize = "8";
                        DiaGuide.position = "left";
                        DiaGuide.inside = "";
                        DiaGuide.fillAlpha = "";
                        DiaGuide.fillColor = "";

                        GuideList.Add(DiaGuide);

                    }

                    #endregion
                }
                else if (Code == "Pulserate|Pulserate_1") //脉率没有 初始值和目标值
                {
                    #region 脉率
                    GraphGuide.minimum = 30;
                    GraphGuide.maximum = 150;

                    ////初始值
                    //Guide originalGuide = new Guide();
                    //originalGuide.value =""; //值或起始值
                    //originalGuide.toValue = "#CC0000";           //终值或""
                    //originalGuide.label = "";      //中文定义 目标线、偏低、偏高等
                    ////originalGuide.label = "起始" + ":" + originalGuide.value;
                    //originalGuide.lineColor = "#FF5151";          //直线颜色  目标线  初始线
                    //originalGuide.lineAlpha = "1";//直线透明度 0全透~1
                    //originalGuide.dashLength = "8"; //虚线密度  4  8
                    //originalGuide.color = "#CC0000";    //字体颜色
                    //originalGuide.fontSize = "8"; //字体大小  默认14
                    //originalGuide.position = "right"; //字体位置 right left
                    //originalGuide.inside = "";//坐标系的内或外  false
                    //originalGuide.fillAlpha = "";
                    //originalGuide.fillColor = "";

                    //GuideList.Add(originalGuide);
                    //GraphGuide.original = originalGuide.value;

                    ////目标值
                    //Guide tagetGuide = new Guide();
                    //tagetGuide.value = "";
                    //tagetGuide.toValue = "#CC0000";
                    //tagetGuide.label = "";
                    ////tagetGuide.label = "目标" + ":" + tagetGuide.value;
                    //tagetGuide.lineColor = "#CC0000";
                    //tagetGuide.lineAlpha = "1";
                    //tagetGuide.dashLength = "4";
                    //tagetGuide.color = "#CC0000";
                    //tagetGuide.fontSize = "14";
                    //tagetGuide.position = "right";
                    //tagetGuide.inside = "";
                    //tagetGuide.fillColor = "";
                    //tagetGuide.fillAlpha = "";


                    //风险范围
                    //正常
                    Guide PulseGuide = new Guide();
                    PulseGuide.value = "60";
                    PulseGuide.toValue = "100";
                    PulseGuide.label = "正常";
                    PulseGuide.lineColor = "";
                    PulseGuide.lineAlpha = "";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#00DB00";  //字的颜色
                    PulseGuide.fontSize = "14";
                    PulseGuide.position = "right";
                    PulseGuide.inside = "true";
                    PulseGuide.fillAlpha = "0.1";
                    PulseGuide.fillColor = "#2894FF";  //区域颜色
                    GuideList.Add(PulseGuide);

                    //偏高 #CC0000
                    PulseGuide = new Guide();
                    PulseGuide.value = "100";
                    PulseGuide.toValue = "150";
                    PulseGuide.label = "偏高";
                    PulseGuide.lineColor = "";
                    PulseGuide.lineAlpha = "";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#FF60AF";
                    PulseGuide.fontSize = "14";
                    PulseGuide.position = "right";
                    PulseGuide.inside = "true";
                    PulseGuide.fillAlpha = "0.1";
                    PulseGuide.fillColor = "#CC0000";
                    GuideList.Add(PulseGuide);

                    //偏低
                    PulseGuide = new Guide();
                    PulseGuide.value = "30";
                    PulseGuide.toValue = "60";
                    PulseGuide.label = "偏低";
                    PulseGuide.lineColor = "";
                    PulseGuide.lineAlpha = "";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#8080C0";
                    PulseGuide.fontSize = "14";
                    PulseGuide.position = "right";
                    PulseGuide.inside = "true";
                    PulseGuide.fillAlpha = "0.1";
                    PulseGuide.fillColor = "#FFC78E";
                    GuideList.Add(PulseGuide);


                    //一般线

                    //30
                    PulseGuide = new Guide();
                    PulseGuide.value = "30";
                    PulseGuide.toValue = "#CC0000";
                    PulseGuide.label = "30";
                    PulseGuide.lineColor = "#CC0000";
                    PulseGuide.lineAlpha = "0.15";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#CC0000";
                    PulseGuide.fontSize = "8";
                    PulseGuide.position = "left";
                    PulseGuide.inside = "";
                    PulseGuide.fillAlpha = "";
                    PulseGuide.fillColor = "";
                    GuideList.Add(PulseGuide);


                    //60
                    PulseGuide = new Guide();
                    PulseGuide.value = "60";
                    PulseGuide.toValue = "#CC0000";
                    PulseGuide.label = "60";
                    PulseGuide.lineColor = "#CC0000";
                    PulseGuide.lineAlpha = "0.15";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#CC0000";
                    PulseGuide.fontSize = "8";
                    PulseGuide.position = "left";
                    PulseGuide.inside = "";
                    PulseGuide.fillAlpha = "";
                    PulseGuide.fillColor = "";
                    GuideList.Add(PulseGuide);

                    //100
                    PulseGuide = new Guide();
                    PulseGuide.value = "100";
                    PulseGuide.toValue = "#CC0000";
                    PulseGuide.label = "100";
                    PulseGuide.lineColor = "#CC0000";
                    PulseGuide.lineAlpha = "0.15";
                    PulseGuide.dashLength = "";
                    PulseGuide.color = "#CC0000";
                    PulseGuide.fontSize = "8";
                    PulseGuide.position = "left";
                    PulseGuide.inside = "";
                    PulseGuide.fillAlpha = "";
                    PulseGuide.fillColor = "";
                    GuideList.Add(PulseGuide);

                    #endregion
                }

                GraphGuide.GuideList = GuideList;
                return GraphGuide;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstBloodPressure.GetGuidesByCode", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {
            }
        }